Browse Source

支付宝支付

DELL 3 years ago
parent
commit
5012b80710

+ 33 - 2
src/packageGoods/order/detail.vue

@@ -191,13 +191,43 @@
 				uni.showLoading({
 					title: '加载中'
 				});
-				$http.post('/api/v1/mp/user/deliver/order/pay', {
+				// #ifdef MP-ALIPAY
+				let data = {
+					orderId: _this.info.orderId,
+					payType: 1
+				}
+				// #endif
+				// #ifndef MP-ALIPAY
+				let data = {
 					orderId: _this.info.orderId,
 					payType: 2
-				}).then(ele => {
+				}
+				// #endif
+				$http.post('/api/v1/mp/user/deliver/order/pay', data).then(ele => {
 					payIng = true
 					uni.hideLoading();
 					if (ele.code == 0) {
+						// #ifdef MP-ALIPAY
+						uni.requestPayment({
+							orderInfo: ele.data.pay_info,
+							success() {
+								uni.showToast({
+									title: '支付成功',
+									icon: 'success',
+									duration: 2000
+								})
+								setTimeout(() => {
+									uni.navigateBack({
+										delta: 1
+									})
+								}, 500)
+							},
+							fail() {
+								payIng = false
+							}
+						})
+						// #endif
+						// #ifndef MP-ALIPAY
 						uni.requestPayment({
 							timeStamp: ele.data.timeStamp,
 							nonceStr: ele.data.nonceStr,
@@ -220,6 +250,7 @@
 								payIng = false
 							}
 						})
+						// #endif
 					} else if (ele.code == 1005) {
 						_this.authShow = true
 					} else {

+ 29 - 2
src/packageGoods/order/index.vue

@@ -176,13 +176,39 @@
 				uni.showLoading({
 					title: '加载中'
 				});
-				$http.post('/api/v1/mp/user/deliver/order/pay', {
+				// #ifdef MP-ALIPAY
+				let data = {
+					orderId: item.orderId,
+					payType: 1
+				}
+				// #endif
+				// #ifndef MP-ALIPAY
+				let data = {
 					orderId: item.orderId,
 					payType: 2
-				}).then(ele => {
+				}
+				// #endif
+				$http.post('/api/v1/mp/user/deliver/order/pay', data).then(ele => {
 					uni.hideLoading();
 					payIng = true
 					if (ele.code == 0) {
+						// #ifdef MP-ALIPAY
+						uni.requestPayment({
+							orderInfo: ele.data.pay_info,
+							success() {
+								uni.showToast({
+									title: '支付成功',
+									icon: 'success',
+									duration: 2000
+								})
+								_this.pageList()
+							},
+							fail() {
+								payIng = false
+							}
+						})
+						// #endif
+						// #ifndef MP-ALIPAY
 						uni.requestPayment({
 							timeStamp: ele.data.timeStamp,
 							nonceStr: ele.data.nonceStr,
@@ -201,6 +227,7 @@
 								payIng = false
 							}
 						})
+						// #endif
 					} else if (ele.code == 1005) {
 						_this.authShow = true
 					} else {

+ 40 - 2
src/packageGoods/order/settlement.vue

@@ -186,11 +186,47 @@
 					uni.hideLoading();
 					if (res.code == 0) {
 						if (res.data.needPay == 1) {
-							$http.post('/api/v1/mp/user/deliver/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/deliver/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
+											})
+											setTimeout(() => {
+												uni.redirectTo({
+													url: `/packageGoods/order/index`
+												})
+											}, 500)
+										},
+										fail() {
+											payIng = false
+											setTimeout(() => {
+												uni.redirectTo({
+													url: `/packageGoods/order/index`
+												})
+											}, 500)
+										}
+									})
+									// #endif
+									
+									// #ifndef MP-ALIPAY
 									uni.requestPayment({
 										timeStamp: ele.data.timeStamp,
 										nonceStr: ele.data.nonceStr,
@@ -218,6 +254,8 @@
 											}, 500)
 										}
 									})
+									// #endif
+									
 								} else if (ele.code == 1005) {
 									_this.authShow = true
 								} else {