fanfan 6 months ago
commit 4877daf437
  1. 11
      App.vue
  2. 9
      api/cashier/index.js
  3. 38
      pages/checkout/cashier/index.vue

@ -24,6 +24,17 @@
//
this.getStoreInfo()
},
onShow(options) {
console.log('app onShow', options);
let extraData = options.referrerInfo.extraData;
if (extraData) {
// wx.showToast({
// title: params.errStr,
// icon: 'none',
// });
uni.$emit('appShow', extraData);
}
},
methods: {

@ -5,6 +5,7 @@ const api = {
orderInfo: 'cashier/orderInfo',
orderPay: 'cashier/orderPay',
tradeQuery: 'cashier/tradeQuery',
unify: 'goods/unify',
}
/**
@ -33,3 +34,11 @@ export function orderPay(orderId, data) {
export function tradeQuery(param) {
return request.get(api.tradeQuery, param)
}
/**
* 查询第三方支付信息
* @param {Object} param
*/
export function unify(param) {
return request.get(api.unify, param)
}

@ -135,11 +135,19 @@
// ID
this.orderId = Number(orderId)
//
this.getCashierInfo()
this.getCashierInfo();
uni.$on('appShow', this.solveShowMsg);
},
methods: {
solveShowMsg(msgData) {
console.log(msgData);
if (msgData.errCode === '0000') {
this.onShowSuccess({ message: msgData.errStr });
} else {
this.onPayFail({ message: msgData.errStr });
}
},
//
getCashierInfo() {
const app = this
@ -182,10 +190,10 @@
//
handleSelectPayType(index) {
if (this.methods[index].method == 'huifu') {
this.$toast('抱歉,此支付方式暂未完善')
return
}
// if (this.methods[index].method == 'huifu') {
// this.$toast('')
// return
// }
this.curPaymentItem = this.methods[index]
},
@ -236,7 +244,23 @@
client: app.platform,
extra: app.getExtraAsUnify(app.curPaymentItem.method)
})
.then(result => app.onSubmitCallback(result))
.then(result => {
console.log(result);
if (app.curPaymentItem.method === 'huifu') {
const { miniPayRequest } = result.data.payment;
let appPayRequest = '';
appPayRequest = encodeURIComponent(JSON.stringify({
sign: miniPayRequest.sign,
prepayid: miniPayRequest.prepayid,
}));
uni.navigateToMiniProgram({
appId: miniPayRequest.miniuser,
path: `${miniPayRequest.minipath}?appPayRequest=${appPayRequest}`,
});
} else {
app.onSubmitCallback(result)
}
})
.finally(err => setTimeout(() => app.disabled = false, 10))
},

Loading…
Cancel
Save