diff --git a/packages/shop/goods/index.vue b/packages/shop/goods/index.vue index ee6e528c..f1341af9 100644 --- a/packages/shop/goods/index.vue +++ b/packages/shop/goods/index.vue @@ -837,6 +837,51 @@ export default { }) }) }, + // 处理mergePreorder接口的响应 + handleMergePreorderResponse(res, orderId) { + if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) { + // 调用微信支付 + uni.requestPayment({ + timeStamp: res.timeStamp, + nonceStr: res.nonceStr, + package: res.package, + signType: res.signType, + paySign: res.paySign, + success: (payRes) => { + const params = { + order_id: orderId, + from: this.carList.some(item => item.isAdver === true) ? 3 : (isGroupBuyValid ? 2 : 1), + adver_id: this.carList.some(item => item.isAdver === true) ? this.carList.find(item => item.isAdver === true).adver_id : '' + } + request(apiArr.queryOrder, "POST", params).then(res => { + this.verifyCode = res.verification_code + this.slJin = res.shiliu_money + this.boxshadow1 = true + }) + }, + fail: (payErr) => { + uni.showToast({ + title: payErr.errMsg == 'requestPayment:fail cancel' ? '已取消支付' : '支付失败', + icon: 'none' + }) + const params = { + order_ids: orderId, + } + request(apiArr.cancelPay, "POST", params).then(res => { + }) + }, + complete: () => { + // 支付完成后的回调,无论成功失败都会执行 + } + }) + } else { + console.error("获取支付参数失败,缺少必要参数") + uni.showToast({ + title: '获取支付信息失败', + icon: 'none' + }) + } + }, // 获取评论 getComment(id) { let params = {}