DELL 3 жил өмнө
parent
commit
6ba1e809d9

+ 31 - 3
src/components/pay-popup/pay-popup.vue

@@ -112,7 +112,6 @@
 			success(id) {
 				this.$emit('success', id)
 			},
-
 			pay() {
 				let _this = this
 				let payIng = false
@@ -133,11 +132,38 @@
 					payIng = true
 					if (res.code == 0) {
 						if (res.data.needPay == 1) {
-							$http.post('/api/v1/mp/user/ticket/order/pay', {
+							// #ifdef MP-ALIPAY
+							let data = {
+								orderId: res.data.orderId,
+								payType: 1
+							}
+							// #endif
+							// #ifndef MP-ALIPAY
+							let data = {
 								orderId: res.data.orderId,
 								payType: 2
-							}).then(ele => {
+							}
+							// #endif
+							$http.post('/api/v1/mp/user/ticket/order/pay', data).then(ele => {
 								if (ele.code == 0) {
+									// #ifdef MP-ALIPAY
+									uni.requestPayment({
+										orderInfo: ele.data.pay_info,
+										success() {
+											uni.showToast({
+												title: '支付成功',
+												icon: 'success',
+												duration: 2000
+											})
+											_this.success(res.data.orderId)
+										},
+										fail() {
+											payIng = false
+											_this.close()
+										}
+									})
+									// #endif
+									// #ifndef MP-ALIPAY
 									uni.requestPayment({
 										timeStamp: ele.data.timeStamp,
 										nonceStr: ele.data.nonceStr,
@@ -157,6 +183,8 @@
 											_this.close()
 										}
 									})
+									// #endif
+									
 								} else if (ele.code == 1005) {
 									_this.authShow = true
 								} else {