cmy před 1 týdnem
rodič
revize
1f839ef5dd

+ 32 - 25
components/payment/index.vue

@@ -58,7 +58,7 @@
 				default: false
 			}
 		},
-		mixins:[colors],
+		mixins: [colors],
 		data() {
 			return {
 				formContent: '',
@@ -88,7 +88,7 @@
 		methods: {
 			payType(number, paytype, index) {
 				this.active = index;
-				console.log(this.active,'this.active');
+				console.log(this.active, 'this.active');
 				this.paytype = paytype;
 				this.number = number;
 				this.$emit('changePayType', paytype)
@@ -144,11 +144,11 @@
 							});
 
 							// #ifdef MP
-							let mp_pay_name=''
-							if(uni.requestOrderPayment){
-								mp_pay_name='requestOrderPayment'
-							}else{
-								mp_pay_name='requestPayment'
+							let mp_pay_name = ''
+							if (uni.requestOrderPayment) {
+								mp_pay_name = 'requestOrderPayment'
+							} else {
+								mp_pay_name = 'requestPayment'
 							}
 							uni[mp_pay_name]({
 								timeStamp: jsConfig.timestamp,
@@ -218,7 +218,7 @@
 									.catch(function(res) {
 										if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
 											title: '取消支付'
-										},() => {
+										}, () => {
 											that.$emit('onChangeFun', {
 												action: 'pay_fail'
 											});
@@ -231,7 +231,8 @@
 								provider: 'wxpay',
 								orderInfo: jsConfig,
 								success: (e) => {
-									let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
+									let url = '/pages/goods/order_pay_status/index?order_id=' +
+										orderId +
 										'&msg=支付成功';
 									uni.showToast({
 										title: "支付成功"
@@ -339,12 +340,15 @@
 							break;
 						case "huifu":
 							// #ifdef MP
-							uni.openEmbeddedMiniProgram({
-								appId: 'wx33dc829ad98f7c64',
-								path: `pages/index/index?token=${res.data.result.data.pre_order_id}`,
-								envVersion: 'release',
-								// release: 正式版  trial: 体验版
-								success(res) {
+							console.log(res, 'resdata')
+							let data = JSON.parse(res.data.result.data.pay_info);
+							uni.requestPayment({
+								timeStamp: data.timeStamp,
+								nonceStr: data.nonceStr,
+								package: data.package,
+								signType: data.signType,
+								paySign: data.paySign,
+								success: function(res) {
 									uni.showToast({
 										title: "支付成功"
 									})
@@ -354,15 +358,17 @@
 										});
 									}, 2000)
 								},
-								complete(err) {
-									// uni.showModal({
-									// 	title:"",
-									// 	content:err
-									// })
-									console.log(err,'errrs')
-									uni.hideLoading();
+								fail: function() {
+									return that.$util.Tips({
+										title: '支付失败'
+									});
+								},
+								complete: function(res) {
+									if (res.errMsg == 'requestPayment:cancel') return that.$util
+										.Tips({
+											title: '取消支付'
+										});
 								}
-								
 							})
 							// #endif
 							// #ifdef H5
@@ -406,9 +412,10 @@
 </script>
 
 <style scoped lang="scss">
-	.bgcolor{
+	.bgcolor {
 		background-color: var(--view-theme)
 	}
+
 	.payment {
 		position: fixed;
 		bottom: 0;
@@ -521,4 +528,4 @@
 		font-size: 40rpx;
 		color: #ccc;
 	}
-</style>
+</style>

+ 30 - 22
pages/goods/order_confirm/index.vue

@@ -678,7 +678,7 @@
 		},
 		// #ifdef APP
 		onReady() {
-			this.showAppHistary = uni.getStorageSync('showAppHistary')||false
+			this.showAppHistary = uni.getStorageSync('showAppHistary') || false
 		},
 		// #endif
 		methods: {
@@ -1660,33 +1660,41 @@
 							break;
 						case "HUIFU_PAY":
 							// #ifdef MP
-							wx.openEmbeddedMiniProgram({
-								appId: 'wx33dc829ad98f7c64',
-								path: `pages/index/index?token=${res.data.result.data.pre_order_id}`,
-								envVersion: 'release',
-								// release: 正式版  trial: 体验版
-								success(res) {
-									// 打开成功
+							let data = JSON.parse(res.data.result.data.pay_info);
+							let navurl = '/pages/goods/order_pay_status/index?order_id=' +  res.data.result.data.req_seq_id+ '&msg=' + res
+								.msg +
+								'&type=3' + '&totalPrice=' + this.totalPrice
+							uni.requestPayment({
+								timeStamp: data.timeStamp,
+								nonceStr: data.nonceStr,
+								package: data.package,
+								signType: data.signType,
+								paySign: data.paySign,
+								success: function(res) {
 									return that.$util.Tips({
-									title: '支付成功',
-									icon: 'success'
+										title: '支付成功',
+										icon: 'success'
 									}, {
-									tab: 4,
-									url: goPages
+										tab: 4,
+										url: navurl
 									});
-									// uni.navigateTo({
-									// 	url: '/pages/goods/order_details/index?order_id=' +
-									// 		orderId
-									// })
 								},
-								complete(err) {
-									// uni.showModal({
-									// 	title:"",
-									// 	content:err
-									// })
-									uni.hideLoading();
+								fail: function() {
+									return that.$util.Tips({
+										title: '支付失败'
+									});
+								},
+								complete: function(res) {
+									if (res.errMsg == 'requestPayment:cancel') return that.$util
+										.Tips({
+											title: '取消支付'
+										});
 								}
 							})
+
+
+
+
 							// #endif
 							// #ifdef H5
 							// window.location.href = res.data.result.counter_url;

+ 18 - 16
pages/users/user_payment/index.vue

@@ -377,10 +377,6 @@
 								});
 							},
 							complete: function(res) {
-								uni.showModal({
-									title:"",
-									content:err
-								})
 								if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({
 									title: '取消支付'
 								});
@@ -401,14 +397,16 @@
 						from: this.payType
 					}).then(res => {
 						uni.hideLoading();
-						let data = res.data.data;
 						// #ifdef MP
-						uni.openEmbeddedMiniProgram({
-							appId: 'wx33dc829ad98f7c64',
-							path: `pages/index/index?token=${res.data.pre_order_id}`,
-							envVersion: 'release',
-							// release: 正式版  trial: 体验版
-							success(res) {
+						let data = JSON.parse(res.data.data.data.pay_info);
+						console.log(data,"data")
+						uni.requestPayment({
+							timeStamp: data.timeStamp,
+							nonceStr: data.nonceStr,
+							package: data.package,
+							signType: data.signType,
+							paySign: data.paySign,
+							success: function(res) {
 								return that.$util.Tips({
 									title: '支付成功',
 									icon: 'success'
@@ -417,14 +415,18 @@
 									url: '/pages/users/user_money/index'
 								});
 							},
-							complete(err) {
-								console.log(err,'errrs')
-								uni.hideLoading();
+							fail: function() {
+								return that.$util.Tips({
+									title: '支付失败'
+								});
+							},
+							complete: function(res) {
+								if (res.errMsg == 'requestPayment:cancel') return that.$util.Tips({
+									title: '取消支付'
+								});
 							}
 						})
 						// #endif
-
-
 					}).catch(err => {
 						uni.hideLoading();
 						return that.$util.Tips({