|
@@ -30,13 +30,13 @@
|
|
|
<div v-if="isWalletPay" class="py-10" style="text-align: center;">
|
|
|
<div>
|
|
|
<span>剩余点数:</span>
|
|
|
- <span style="color: var(--v-primary-base);">{{ balance }}</span>
|
|
|
+ <span style="color: var(--v-primary-base);">{{ accountBalance }}</span>
|
|
|
</div>
|
|
|
- <div class="my-3" v-if="balanceNotEnough">
|
|
|
+ <div class="my-3" v-if="notEnoughMoney">
|
|
|
<!-- <v-icon color="warning">mdi-information</v-icon> -->
|
|
|
<!-- <span class="color-warning">{{ props.params?.txt || '当前余额不足,请选择其他支付方式' }}</span> -->
|
|
|
<span class="color-error">
|
|
|
- 当前剩余点数不足,<span class="text-decoration-underline cursor-pointer" @click="showRecharge = true">去充值</span>
|
|
|
+ 当前剩余点数不足,<span class="text-decoration-underline cursor-pointer" @click="handleRecharge">去充值</span>
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -46,7 +46,7 @@
|
|
|
<div class="mb-5" v-if="payQrCodeTxt" style="color: var(--v-error-base);">扫码支付时请勿离开</div>
|
|
|
</div>
|
|
|
<!-- 钱包支付确认按钮 -->
|
|
|
- <div v-if="isWalletPay && !balanceNotEnough" class="mt-2" style="text-align: center;">
|
|
|
+ <div v-if="isWalletPay && !notEnoughMoney" class="mt-2" style="text-align: center;">
|
|
|
<v-btn
|
|
|
class="buttons" color="primary"
|
|
|
:loading="payLoading"
|
|
@@ -59,8 +59,8 @@
|
|
|
</template>
|
|
|
</v-card>
|
|
|
|
|
|
- <CtDialog :visible="showRecharge" :widthType="1" titleClass="text-h6" title="点数充值" :footer="false" submitText="确认" @close="handleClose">
|
|
|
- <Recharge @finish="handleFinish"></Recharge>
|
|
|
+ <CtDialog :visible="showRecharge" :widthType="1" titleClass="text-h6" title="点数充值" :footer="false" submitText="确认" @close="handleRechargeClose">
|
|
|
+ <Recharge @paySuccess="RechargePaySuccess"></Recharge>
|
|
|
</CtDialog>
|
|
|
</template>
|
|
|
|
|
@@ -128,10 +128,10 @@ const tip = ref('')
|
|
|
// 如果是点数支付也要走上面的步骤,只是不生成二维码
|
|
|
|
|
|
|
|
|
-const balance = ref(JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.balance || 0)
|
|
|
-const balanceNotEnough = computed(() => {
|
|
|
- console.log(props.cost, balance.value, 'balanceNotEnough')
|
|
|
- return (Number(props.cost) > Number(balance))
|
|
|
+const accountBalance = ref(0)
|
|
|
+
|
|
|
+const notEnoughMoney = computed(() => {
|
|
|
+ return (Number(props.cost) > Number(accountBalance.value))
|
|
|
})
|
|
|
|
|
|
// 生成二维码内容
|
|
@@ -180,8 +180,7 @@ const getUnpaidOrderList = async () => {
|
|
|
//* 充值
|
|
|
if (props.rechargeInfo.payPrice === undefined && props.rechargeInfo.packageId === undefined) return
|
|
|
const params = {
|
|
|
- // payPrice: payCalculation(props.cost, 'emit'),
|
|
|
- payPrice: props.rechargeInfo.payPrice - 0,
|
|
|
+ payPrice: (props.rechargeInfo.payPrice-0),
|
|
|
packageId: props.rechargeInfo.id,
|
|
|
}
|
|
|
const data = await rechargeOrderCreate(params)
|
|
@@ -226,7 +225,6 @@ const payTypeChange = (value) => {
|
|
|
isQrCodePay.value = qrCodePay.includes(payType.value)
|
|
|
isWalletPay.value = walletPay.includes(payType.value)
|
|
|
paySubmit() // 生成二维码内容
|
|
|
- // emit('payTypeChange', value, balanceNotEnough)
|
|
|
}
|
|
|
// 1.支付方式
|
|
|
const payType = ref('')
|
|
@@ -272,6 +270,7 @@ const walletPaySubmit = () => {
|
|
|
paySubmit() // 使用点数
|
|
|
}
|
|
|
|
|
|
+import { useUserStore } from '@/store/user'; const store = useUserStore()
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
import { useRoute } from 'vue-router'; const route = useRoute()
|
|
|
import { useRouter } from 'vue-router'; const router = useRouter()
|
|
@@ -285,9 +284,13 @@ const payStatus = async () => {
|
|
|
// 支付成功
|
|
|
if (timer.value) clearInterval(timer.value); timer.value = null
|
|
|
setTimeout(() => {
|
|
|
+ // 更新点数(充值、发布职位)
|
|
|
+ updateAccountInfo()
|
|
|
+ // 支付成功
|
|
|
+ emit('paySuccess')
|
|
|
+ // 返回指定页面
|
|
|
if (route.fullPath === props.returnUrl) router.go(0)
|
|
|
- else if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
|
|
|
- emit('paySuccess', isWalletPay.value)
|
|
|
+ else if (props.returnUrl) router.push(props.returnUrl)
|
|
|
Snackbar.success('支付成功')
|
|
|
}, 2000);
|
|
|
}
|
|
@@ -296,16 +299,28 @@ const payStatus = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const handleClose = () => {
|
|
|
+const handleRechargeClose = () => {
|
|
|
showRecharge.value = false
|
|
|
+ loading.value = false
|
|
|
}
|
|
|
|
|
|
-const handleFinish = () => {
|
|
|
+// 点数发生支付时点充值
|
|
|
+const RechargePaySuccess = () => {
|
|
|
showRecharge.value = false
|
|
|
- console.log(localStorage.getItem('enterpriseUserAccount'), '------')
|
|
|
- balance.value = JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.balance || 0
|
|
|
- console.log(balance.value, 'balance.value')
|
|
|
+ // updateAccountInfo()
|
|
|
+}
|
|
|
+
|
|
|
+const handleRecharge = () => {
|
|
|
+ showRecharge.value = true
|
|
|
+}
|
|
|
+
|
|
|
+const updateAccountInfo = async (init = false) => {
|
|
|
+ const account = await store.getEnterpriseUserAccountInfo()
|
|
|
+ accountBalance.value = account?.balance
|
|
|
+ if (init) return
|
|
|
+ loading.value = false
|
|
|
}
|
|
|
+if ((props.appId - 0) !== 11) updateAccountInfo(true) // 点数发生支付时点充值-充值不查余额
|
|
|
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|