|
@@ -143,11 +143,25 @@
|
|
|
this.$http('openMallOrder/submitOrder', params,'POST').then(res => {
|
|
|
uni.hideLoading();
|
|
|
if(res.code==0){
|
|
|
+
|
|
|
+ this.unifiedPay(res.data)
|
|
|
+ }else{
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
icon: 'none',
|
|
|
duration: 3000
|
|
|
});
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ unifiedPay(res){
|
|
|
+ this.$http('openMallOrder/unifiedPay', {
|
|
|
+ sheetId:res.id
|
|
|
+ },'POST').then(res => {
|
|
|
+
|
|
|
+ if(res.code==0){
|
|
|
+
|
|
|
+ this.requestPayment(res.data)
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
@@ -157,6 +171,48 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ requestPayment(res){
|
|
|
+ var payInfo=res;
|
|
|
+ console.log(payInfo)
|
|
|
+ console.log(String(Date.now()))
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ //timeStamp: String(Date.now()),
|
|
|
+ timeStamp: payInfo.timeStamp,
|
|
|
+ nonceStr: payInfo.nonceStr,
|
|
|
+ package:payInfo.package,
|
|
|
+ signType: payInfo.signType,
|
|
|
+ paySign: payInfo.paySign,
|
|
|
+ appid:payInfo.appId,
|
|
|
+ /* provider: 'wxpay',
|
|
|
+ orderInfo:{
|
|
|
+ "appid":payInfo.appid, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
|
|
|
+ "noncestr": payInfo.nonceStr, // 随机字符串
|
|
|
+ "package": "Sign=WXPay", // 固定值
|
|
|
+ "partnerid":payInfo.mchId, // 微信支付商户号
|
|
|
+ "prepayid": payInfo.prepayId, // 统一下单订单号
|
|
|
+ "timeStamp": String(Date.now()), // 时间戳(单位:秒)
|
|
|
+ "sign": payInfo.sign // 签名,这里用的 MD5/RSA 签名
|
|
|
+ }, */
|
|
|
+ success: function (res) {
|
|
|
+ console.log('success:' + JSON.stringify(res));
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ icon:'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ console.log(err)
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon:'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
openGoodsDetailById(){
|
|
|
this.$http('openMall/openGoodsDetailById', {
|
|
|
id:this.id
|