|
@@ -16,11 +16,12 @@
|
|
|
<span class="font-size-13">¥</span>
|
|
|
<span class="font-size-30">{{ cost }}</span>
|
|
|
</div>
|
|
|
- <radioGroupUI
|
|
|
- :modelValue="payType"
|
|
|
- :item="payTypeItem"
|
|
|
- @change="val => payTypeChange(val)"
|
|
|
- ></radioGroupUI>
|
|
|
+ <v-chip-group v-model="payType" selected-class="text-primary" mandatory @update:modelValue="payTypeChange">
|
|
|
+ <v-chip filter v-for="k in payTypeList" :key="k.code" :value="k.code" class="mr-3" label>
|
|
|
+ {{ k.name }}
|
|
|
+ <svg-icon v-if="k.icon" class="ml-1" :name="k.icon" :size="k.size"></svg-icon>
|
|
|
+ </v-chip>
|
|
|
+ </v-chip-group>
|
|
|
<div class="pa-5">
|
|
|
<!-- 支付 -->
|
|
|
<div v-if="isWalletPay">
|
|
@@ -56,13 +57,12 @@
|
|
|
<script setup>
|
|
|
defineOptions({ name: 'pay-index'})
|
|
|
import { computed, onUnmounted, ref } from 'vue'
|
|
|
-import radioGroupUI from '@/components/FormUI/radioGroup'
|
|
|
import QrCode from '@/components/QrCode'
|
|
|
import { definePayTypeList, qrCodePay, walletPay } from './until/payType'
|
|
|
import { getEnableCodeList, getUnpaidOrder, payOrderSubmit, getOrderPayStatus } from '@/api/common'
|
|
|
import { createTradeOrder } from '@/api/position'
|
|
|
import { useSharedState } from '@/store/sharedState'
|
|
|
-const emit = defineEmits(['payTypeChange', ])
|
|
|
+const emit = defineEmits(['payTypeChange', 'paySuccess'])
|
|
|
const props = defineProps({
|
|
|
params: {
|
|
|
type: Object,
|
|
@@ -80,11 +80,16 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
default: ''
|
|
|
},
|
|
|
+ returnUrl: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
type: {
|
|
|
type: Number,
|
|
|
default: 2 // 订单类型 0平台订单| 1发布职位订单| 2发布众聘职位订单,示例值(1)
|
|
|
},
|
|
|
})
|
|
|
+
|
|
|
const loading = ref(true)
|
|
|
|
|
|
const balance = JSON.parse(localStorage.getItem('enterpriseUserAccount'))?.balance || 0
|
|
@@ -94,12 +99,12 @@ const balanceNotEnough = computed(() => {
|
|
|
// 支付方式
|
|
|
const isWalletPay = ref(true)
|
|
|
const isQrCodePay = ref(false)
|
|
|
-const payTypeChange = (val) => {
|
|
|
- payType.value = val
|
|
|
+const payTypeChange = (value) => {
|
|
|
+ payType.value = value
|
|
|
isQrCodePay.value = qrCodePay.includes(payType.value)
|
|
|
isWalletPay.value = walletPay.includes(payType.value)
|
|
|
if (isQrCodePay.value) initPayQrCode() // 生成二维码内容
|
|
|
- emit('payTypeChange', val, balanceNotEnough)
|
|
|
+ emit('payTypeChange', value, balanceNotEnough)
|
|
|
}
|
|
|
// 支付方式
|
|
|
const payType = ref('')
|
|
@@ -169,15 +174,6 @@ getUnpaidOrderList() // getUnpaidOrder
|
|
|
const payLoading = ref(false)
|
|
|
const payQrCodeTet = ref('')
|
|
|
|
|
|
-const payTypeItem = {
|
|
|
- label: '',
|
|
|
- width: 1,
|
|
|
- hideDetails: true,
|
|
|
- itemText: 'name',
|
|
|
- itemValue: 'code',
|
|
|
- items: payTypeList.value
|
|
|
-}
|
|
|
-
|
|
|
// 钱包支付(余额支付)
|
|
|
const walletPaySubmit = () => {
|
|
|
// emit('paySubmit', payType.value)
|
|
@@ -197,7 +193,7 @@ const initPayQrCode = async () => {
|
|
|
id: payOrder.value.id, // 支付单编号
|
|
|
channelCode: payType.value, // 支付渠道
|
|
|
displayMode: payOrder.value.notifyUrl, // 展示模式 notifyUrl
|
|
|
- returnUrl: '',
|
|
|
+ // returnUrl: location.href, // 支付成功后,支付渠道跳转回当前页;再由当前页,跳转回 {@link returnUrl} 对应的地址
|
|
|
}
|
|
|
const res = await payOrderSubmit(params)
|
|
|
payQrCodeTet.value = res?.displayContent || '' // 支付二维码
|
|
@@ -217,10 +213,8 @@ const payStatus = async () => {
|
|
|
// 支付成功
|
|
|
if (timer.value) clearInterval(timer.value); timer.value = null
|
|
|
setTimeout(() => {
|
|
|
- const query = { hire: true }
|
|
|
- router.push({ path: '/recruit/enterprise/position', query }) // 返回到众聘页面
|
|
|
- }, 500);
|
|
|
- setTimeout(() => {
|
|
|
+ if (props.returnUrl) router.push(props.returnUrl) // 返回指定页面
|
|
|
+ else emit('paySuccess')
|
|
|
Snackbar.success('付款成功')
|
|
|
}, 1000);
|
|
|
}
|