|
@@ -22,6 +22,16 @@ interface IOrderInfo {
|
|
|
orderNo: string | number
|
|
|
actualPrice: string | number
|
|
|
}
|
|
|
+const urlType = {
|
|
|
+ goodsPay: {
|
|
|
+ cancelUrl: '/api-mall-portal/order/cancelUserOrder',
|
|
|
+ payUrl: '/api-mall-portal/payment/orderPay'
|
|
|
+ },
|
|
|
+ orderPay: {
|
|
|
+ cancelUrl: '/api-student/userOrder/orderCancel',
|
|
|
+ payUrl: '/api-student/userOrder/orderPay'
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'payment',
|
|
@@ -40,6 +50,10 @@ export default defineComponent({
|
|
|
onBackOut: {
|
|
|
type: Function,
|
|
|
default: () => {}
|
|
|
+ },
|
|
|
+ paymentType: {
|
|
|
+ type: String,
|
|
|
+ default: 'orderPay' as 'orderPay' | 'goodsPay'
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -65,7 +79,7 @@ export default defineComponent({
|
|
|
},
|
|
|
async onCancel(noBack?: boolean) {
|
|
|
try {
|
|
|
- await request.post('/api-student/userOrder/orderCancel', {
|
|
|
+ await request.post(urlType[this.paymentType].cancelUrl, {
|
|
|
data: {
|
|
|
orderNo: this.orderInfo.orderNo
|
|
|
}
|
|
@@ -79,7 +93,7 @@ export default defineComponent({
|
|
|
async onSubmit() {
|
|
|
// 支付...
|
|
|
try {
|
|
|
- let res = await request.post('/api-student/userOrder/orderPay', {
|
|
|
+ let res = await request.post(urlType[this.paymentType].payUrl, {
|
|
|
data: {
|
|
|
orderNo: this.orderInfo.orderNo,
|
|
|
payChannel: this.payType
|
|
@@ -104,7 +118,9 @@ export default defineComponent({
|
|
|
listenerMessage('paymentOperation', (result: any) =>
|
|
|
this.paymentOperation(result)
|
|
|
)
|
|
|
- } catch {}
|
|
|
+ } catch (e: any) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
},
|
|
|
paymentOperation(res: any) {
|
|
|
if (res.status === 'success') {
|