Commit 8132e6fb authored by tyyin lan's avatar tyyin lan

feat: 积分充值

parent 0fb7c270
...@@ -15,3 +15,7 @@ export function fetchGetEquityPayQrCode<T>(payload: object) { ...@@ -15,3 +15,7 @@ export function fetchGetEquityPayQrCode<T>(payload: object) {
export function fetchGetPayStatus<T>(payOrderSn: string) { export function fetchGetPayStatus<T>(payOrderSn: string) {
return request.post<T>(`/payRest/orderStatus.json?payOrderSn=${payOrderSn}`) return request.post<T>(`/payRest/orderStatus.json?payOrderSn=${payOrderSn}`)
} }
export function fetchGetPointsGiftPackageList<T>() {
return request.post<T>('/equityRest/getPointPackageList.json')
}
...@@ -113,7 +113,7 @@ common_module: ...@@ -113,7 +113,7 @@ common_module:
year: ' Year' year: ' Year'
month: ' Month' month: ' Month'
alipay: 'Alipay' alipay: 'Alipay'
weChat: 'WeChat' wechat: 'WeChat'
analysis: 'Analysis' analysis: 'Analysis'
last_week: 'Last week' last_week: 'Last week'
last_month: 'Last month' last_month: 'Last month'
...@@ -124,6 +124,8 @@ common_module: ...@@ -124,6 +124,8 @@ common_module:
as_needed: 'As needed' as_needed: 'As needed'
support: 'Support' support: 'Support'
unlimited_duration: 'Unlimited duration' unlimited_duration: 'Unlimited duration'
buy_now: 'Buy now'
payment_success: 'Payment success'
dialogue_module: dialogue_module:
continue_question_message: 'You can keep asking questions' continue_question_message: 'You can keep asking questions'
...@@ -552,6 +554,9 @@ equity_module: ...@@ -552,6 +554,9 @@ equity_module:
custom_digital_person: 'Custom digital person' custom_digital_person: 'Custom digital person'
ai_training_tuning_service: 'AI training tuning service' ai_training_tuning_service: 'AI training tuning service'
private_deployment: 'Private deployment' private_deployment: 'Private deployment'
point_recharge: 'Point recharge'
get_points_for_interacting_with_the_ai: 'Get {points} points for interacting with the AI'
no_time_limit_when_used_up: 'No time limit, when used up'
order_manage_module: order_manage_module:
package_name: 'PackageName' package_name: 'PackageName'
......
...@@ -112,7 +112,7 @@ common_module: ...@@ -112,7 +112,7 @@ common_module:
year: '年' year: '年'
month: '个月' month: '个月'
alipay: '支付宝' alipay: '支付宝'
weChat: '微信' wechat: '微信'
analysis: '分析' analysis: '分析'
last_week: '最近一周' last_week: '最近一周'
last_month: '最近一月' last_month: '最近一月'
...@@ -123,6 +123,8 @@ common_module: ...@@ -123,6 +123,8 @@ common_module:
as_needed: '按需' as_needed: '按需'
support: '支持' support: '支持'
unlimited_duration: '无期限' unlimited_duration: '无期限'
buy_now: '立即购买'
payment_success: '支付成功'
dialogue_module: dialogue_module:
continue_question_message: '你可以继续提问' continue_question_message: '你可以继续提问'
...@@ -550,6 +552,9 @@ equity_module: ...@@ -550,6 +552,9 @@ equity_module:
custom_digital_person: '定制数字人' custom_digital_person: '定制数字人'
ai_training_tuning_service: 'AI训练调优服务' ai_training_tuning_service: 'AI训练调优服务'
private_deployment: '私有化部署' private_deployment: '私有化部署'
point_recharge: '积分充值'
get_points_for_interacting_with_the_ai: '获得{points}积分,用于和AI互动行动'
no_time_limit_when_used_up: '无期限,用完即止'
order_manage_module: order_manage_module:
package_name: '套餐名称' package_name: '套餐名称'
......
...@@ -112,7 +112,7 @@ common_module: ...@@ -112,7 +112,7 @@ common_module:
year: '年' year: '年'
month: '個月' month: '個月'
alipay: '支付寶' alipay: '支付寶'
weChat: '微信' wechat: '微信'
analysis: '分析' analysis: '分析'
last_week: '最近一週' last_week: '最近一週'
last_month: '最近一月' last_month: '最近一月'
...@@ -123,6 +123,8 @@ common_module: ...@@ -123,6 +123,8 @@ common_module:
as_needed: '按需' as_needed: '按需'
support: '支持' support: '支持'
unlimited_duration: '無期限' unlimited_duration: '無期限'
buy_now: '立即購買'
payment_success: '支付成功'
dialogue_module: dialogue_module:
continue_question_message: '你可以繼續提問' continue_question_message: '你可以繼續提問'
...@@ -550,6 +552,9 @@ equity_module: ...@@ -550,6 +552,9 @@ equity_module:
custom_digital_person: '定製數字人' custom_digital_person: '定製數字人'
ai_training_tuning_service: 'AI訓練調優服務' ai_training_tuning_service: 'AI訓練調優服務'
private_deployment: '私有化部署' private_deployment: '私有化部署'
point_recharge: '积分充值'
get_points_for_interacting_with_the_ai: '獲得{points}積分,用於和AI互動行動'
no_time_limit_when_used_up: '無期限,用完即止'
order_manage_module: order_manage_module:
package_name: '套餐名稱' package_name: '套餐名稱'
......
...@@ -30,7 +30,7 @@ function handleVersionSwitch(version: VersionName) { ...@@ -30,7 +30,7 @@ function handleVersionSwitch(version: VersionName) {
<div <div
class="mt-[31px] grid grid-flow-row-dense gap-[29px]" class="mt-[31px] grid grid-flow-row-dense gap-[29px]"
style="grid-template-columns: repeat(auto-fill, minmax(255px, 269px))" style="grid-template-columns: repeat(auto-fill, minmax(255px, 1fr))"
> >
<section class="relative h-[452px] rounded-[10px] border border-[#CFD3D4] bg-[#FBFCFF]"> <section class="relative h-[452px] rounded-[10px] border border-[#CFD3D4] bg-[#FBFCFF]">
<div <div
...@@ -108,10 +108,10 @@ function handleVersionSwitch(version: VersionName) { ...@@ -108,10 +108,10 @@ function handleVersionSwitch(version: VersionName) {
</div> </div>
<div class="font-600 mt-[18px] text-center text-[24px] text-[#482801]"> <div class="font-600 mt-[18px] text-center text-[24px] text-[#482801]">
<span class="font-600 text-[24px]">19.9</span> <span class="font-600 text-[24px]">19.9</span>
<span class="text-[14px]"> HK$/{{ t('equity_module.month') }}</span> <span class="text-[14px]">/{{ t('equity_module.month') }}</span>
<span class="font-600 ml-[10px] text-[24px]">199</span> <span class="font-600 ml-[10px] text-[24px]">199</span>
<span class="text-[14px]"> HK$/{{ t('equity_module.year') }}</span> <span class="text-[14px]">/{{ t('equity_module.year') }}</span>
</div> </div>
<button <button
...@@ -182,10 +182,10 @@ function handleVersionSwitch(version: VersionName) { ...@@ -182,10 +182,10 @@ function handleVersionSwitch(version: VersionName) {
</div> </div>
<div class="font-600 mt-[18px] text-center text-[24px] text-[#482801]"> <div class="font-600 mt-[18px] text-center text-[24px] text-[#482801]">
<span class="font-600 text-[24px]">29.9</span> <span class="font-600 text-[24px]">29.9</span>
<span class="text-[14px]"> HK$/{{ t('equity_module.month') }}</span> <span class="text-[14px]">/{{ t('equity_module.month') }}</span>
<span class="font-600 ml-[10px] text-[24px]">299</span> <span class="font-600 ml-[10px] text-[24px]">299</span>
<span class="text-[14px]"> HK$/{{ t('equity_module.year') }}</span> <span class="text-[14px]">/{{ t('equity_module.year') }}</span>
</div> </div>
<button <button
...@@ -268,7 +268,6 @@ function handleVersionSwitch(version: VersionName) { ...@@ -268,7 +268,6 @@ function handleVersionSwitch(version: VersionName) {
{{ t('equity_module.consult_now') }} {{ t('equity_module.consult_now') }}
</button> </button>
</div> </div>
<div class="mt-[12px]"> <div class="mt-[12px]">
<ul class="ml-[42px]"> <ul class="ml-[42px]">
<li <li
......
...@@ -37,6 +37,7 @@ const payInfo = ref({ ...@@ -37,6 +37,7 @@ const payInfo = ref({
payOrderSn: '', payOrderSn: '',
}) })
const isPayQrcodeInvalid = ref(false) const isPayQrcodeInvalid = ref(false)
const payStatusTimer = ref<NodeJS.Timeout | null>(null)
const isShowPayQrCode = computed(() => { const isShowPayQrCode = computed(() => {
return !!( return !!(
...@@ -88,6 +89,7 @@ function clearPayInfo() { ...@@ -88,6 +89,7 @@ function clearPayInfo() {
} }
function getEquityPayQrCode() { function getEquityPayQrCode() {
clearPayStatusTimer()
clearPayInfo() clearPayInfo()
const payload = { const payload = {
...@@ -155,24 +157,34 @@ function getEquityPayQrCode() { ...@@ -155,24 +157,34 @@ function getEquityPayQrCode() {
} }
function getPayStatus() { function getPayStatus() {
function request() {
fetchGetPayStatus<{ payStatus: 'Paid' | 'NoPayment' | 'Cancel' }>(payInfo.value.payOrderSn).then((res) => { fetchGetPayStatus<{ payStatus: 'Paid' | 'NoPayment' | 'Cancel' }>(payInfo.value.payOrderSn).then((res) => {
if (res.code !== 0) return '' if (res.code !== 0) return ''
if (res.data.payStatus === 'Paid') { if (res.data.payStatus === 'Paid') {
isPaymentSuccess.value = true isPaymentSuccess.value = true
clearPayStatusTimer()
setTimeout(() => { setTimeout(() => {
currentSelectVersion.value = null currentSelectVersion.value = null
userStore.fetchUpdateEquityInfo() userStore.fetchUpdateEquityInfo()
window.$message.success('支付成功') window.$message.success(t('common_module.payment_success'))
}, 1400) }, 1400)
} else {
setTimeout(() => {
!isPayQrcodeInvalid.value && getPayStatus()
}, 1000)
} }
}) })
}
payStatusTimer.value = setInterval(() => {
request()
}, 1000)
}
function clearPayStatusTimer() {
if (payStatusTimer.value) {
clearInterval(payStatusTimer.value)
payStatusTimer.value = null
}
} }
function handlePaymentMethodSwitch(method: typeof currentPaymentMethod.value) { function handlePaymentMethodSwitch(method: typeof currentPaymentMethod.value) {
...@@ -214,21 +226,21 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric ...@@ -214,21 +226,21 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric
</div> </div>
<div class="font-600 mt-[20px] text-[20px] text-[#482801]"> <div class="font-600 mt-[20px] text-[20px] text-[#482801]">
{{ packageItem.currentPrice }}<span class="text-[14px]"> HK$/{{ t('equity_module.month') }}</span> {{ packageItem.currentPrice }}<span class="text-[14px]"> CNY$/{{ t('equity_module.month') }}</span>
</div> </div>
<div <div
v-show="currentSelectPackage === index" v-show="currentSelectPackage === index"
class="mt-[6px] text-center text-[14px] text-[#482801] line-through" class="mt-[6px] text-center text-[14px] text-[#482801] line-through"
> >
{{ packageItem.originalPrice }} HK$ {{ packageItem.originalPrice }} CNY$
</div> </div>
<div <div
v-show="currentSelectPackage !== index" v-show="currentSelectPackage !== index"
class="absolute bottom-0 w-full bg-[#ffebd2] py-[6px] text-center text-[12px] text-[#9A5705]" class="absolute bottom-0 w-full bg-[#ffebd2] py-[6px] text-center text-[12px] text-[#9A5705]"
> >
{{ t('equity_module.discounted') }}{{ packageItem.discountedPrice }}HK$ {{ t('equity_module.discounted') }}{{ packageItem.discountedPrice }}CNY$
</div> </div>
<div <div
...@@ -261,7 +273,7 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric ...@@ -261,7 +273,7 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric
@click="handlePaymentMethodSwitch('wechatpay')" @click="handlePaymentMethodSwitch('wechatpay')"
> >
<img class="mr-[5px] h-[16px] w-[16px]" src="@/assets/images/equity/wechat-icon.png" alt="alipay" /> <img class="mr-[5px] h-[16px] w-[16px]" src="@/assets/images/equity/wechat-icon.png" alt="alipay" />
<span>{{ t('common_module.weChat') }}</span> <span>{{ t('common_module.wechat') }}</span>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -304,15 +316,15 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric ...@@ -304,15 +316,15 @@ function handlePackageSwitch(packageKey: typeof currentSelectPackage.value, pric
<span class="font-600 text-[16px]"> <span class="font-600 text-[16px]">
{{ t('common_module.alipay') }} {{ t('equity_module.scan_code_payment') }} {{ t('common_module.alipay') }} {{ t('equity_module.scan_code_payment') }}
<span class="text-[24px] text-[#F25744]">{{ currentPayPrice }}</span <span class="text-[24px] text-[#F25744]">{{ currentPayPrice }}</span
>HK$ >CNY$
</span> </span>
</template> </template>
<template v-else-if="currentPaymentMethod === 'wechatpay'"> <template v-else-if="currentPaymentMethod === 'wechatpay'">
<img class="mr-[5px] mt-[6px] h-[16px] w-[16px]" src="@/assets/images/equity/wechat-icon.png" alt="alipay" /> <img class="mr-[5px] mt-[6px] h-[16px] w-[16px]" src="@/assets/images/equity/wechat-icon.png" alt="alipay" />
<span class="font-600 text-[16px]"> <span class="font-600 text-[16px]">
{{ t('common_module.weChat') }} {{ t('equity_module.scan_code_payment') }} {{ t('common_module.wechat') }} {{ t('equity_module.scan_code_payment') }}
<span class="text-[24px] text-[#F25744]">{{ currentPayPrice }}</span <span class="text-[24px] text-[#F25744]">{{ currentPayPrice }}</span
>HK$ >CNY$
</span> </span>
</template> </template>
</div> </div>
......
...@@ -20,11 +20,11 @@ const equityInfo = computed(() => { ...@@ -20,11 +20,11 @@ const equityInfo = computed(() => {
return userStore.equityInfo return userStore.equityInfo
}) })
// function handlePointRecharge() { function handlePointRecharge() {
// currentSelectVersion.value = null currentSelectVersion.value = null
// isShowPointRechargeModal.value = true isShowPointRechargeModal.value = true
// } }
</script> </script>
<template> <template>
...@@ -76,13 +76,13 @@ const equityInfo = computed(() => { ...@@ -76,13 +76,13 @@ const equityInfo = computed(() => {
</div> </div>
</div> </div>
<!-- <div <div
class="flex cursor-pointer select-none items-center justify-end text-[15px] text-[#0B7DFF]" class="flex cursor-pointer select-none items-center justify-end text-[15px] text-[#0B7DFF]"
@click="handlePointRecharge" @click="handlePointRecharge"
> >
<span>{{ t('equity_module.top_up_immediately') }}</span> <span>{{ t('equity_module.top_up_immediately') }}</span>
<i class="iconfont icon-left ml-[2px] inline-block rotate-180 text-[12px]"></i> <i class="iconfont icon-left ml-[2px] inline-block rotate-180 text-[12px]"></i>
</div> --> </div>
</section> </section>
<section <section
class="flex h-[170px] flex-1 flex-col justify-between rounded-[10px] bg-[#F8F9FB] px-[30px] py-[24px]" class="flex h-[170px] flex-1 flex-col justify-between rounded-[10px] bg-[#F8F9FB] px-[30px] py-[24px]"
......
...@@ -121,7 +121,7 @@ function createPackageColumns(): DataTableColumns<OrderItem> { ...@@ -121,7 +121,7 @@ function createPackageColumns(): DataTableColumns<OrderItem> {
title: t('order_manage_module.pay_method'), title: t('order_manage_module.pay_method'),
key: 'payChannel', key: 'payChannel',
render(row) { render(row) {
return h('div', {}, row.payChannel === 'Wx' ? t('common_module.weChat') : t('common_module.alipay')) return h('div', {}, row.payChannel === 'Wx' ? t('common_module.wechat') : t('common_module.alipay'))
}, },
}, },
{ {
......
...@@ -84,7 +84,7 @@ function createRechargeColumns(): DataTableColumns<OrderItem> { ...@@ -84,7 +84,7 @@ function createRechargeColumns(): DataTableColumns<OrderItem> {
title: t('order_manage_module.pay_method'), title: t('order_manage_module.pay_method'),
key: 'payChannel', key: 'payChannel',
render(row) { render(row) {
return h('div', {}, row.payChannel === 'Wx' ? t('common_module.weChat') : t('common_module.alipay')) return h('div', {}, row.payChannel === 'Wx' ? t('common_module.wechat') : t('common_module.alipay'))
}, },
}, },
{ {
......
...@@ -113,7 +113,7 @@ declare namespace I18n { ...@@ -113,7 +113,7 @@ declare namespace I18n {
year: string year: string
month: string month: string
alipay: string alipay: string
weChat: string wechat: string
analysis: string analysis: string
last_week: string last_week: string
last_month: string last_month: string
...@@ -123,6 +123,8 @@ declare namespace I18n { ...@@ -123,6 +123,8 @@ declare namespace I18n {
unlimited_amount: string unlimited_amount: string
as_needed: string as_needed: string
support: string support: string
buy_now: string
payment_success: string
dialogue_module: { dialogue_module: {
continue_question_message: string continue_question_message: string
...@@ -566,6 +568,9 @@ declare namespace I18n { ...@@ -566,6 +568,9 @@ declare namespace I18n {
custom_digital_person: string custom_digital_person: string
ai_training_tuning_service: string ai_training_tuning_service: string
private_deployment: string private_deployment: string
point_recharge: string
get_points_for_interacting_with_the_ai: string
no_time_limit_when_used_up: string
} }
order_manage_module: { order_manage_module: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment