浏览代码

支付组件增加停车场支付

yangzj 2 年之前
父节点
当前提交
eff1c63b29
共有 1 个文件被更改,包括 108 次插入65 次删除
  1. 108 65
      pages/paymentMethod/paymentMethod.vue

+ 108 - 65
pages/paymentMethod/paymentMethod.vue

@@ -120,31 +120,53 @@
 					deviceNo: this.deviceNo,
 					deviceNo: this.deviceNo,
 					jumpUrl: this.jumpUrl,
 					jumpUrl: this.jumpUrl,
 					payeeId: this.payeeId,
 					payeeId: this.payeeId,
-					payeeName: this.payeeName
+					payeeName: this.payeeName,
+					pursueType: this.pursueType,
+					sanPay: this.sanPay
 				};
 				};
-				this.$u.api
-					.payGzbank(params)
-					.then((res) => {
+				if (this.exportFlag == true) {
+					this.$u.api.quickPayExportApi(params).then(res => {
 						if (res.data.needPay) {
 						if (res.data.needPay) {
 							let payUrl = res.data.url;
 							let payUrl = res.data.url;
 							location.href = payUrl;
 							location.href = payUrl;
 						} else {
 						} else {
 							this.$refs.uToast.show({
 							this.$refs.uToast.show({
 								title: '无需支付',
 								title: '无需支付',
-								type: 'info'
+								type: 'info',
 							});
 							});
 							setTimeout(() => {
 							setTimeout(() => {
 								uni.hideLoading();
 								uni.hideLoading();
-								location.reload();
-							}, 1000);
+								location.reload()
+							}, 1000)
 						}
 						}
-					})
-					.catch((err) => {
+					}).catch(err => {
 						this.$refs.uToast.show({
 						this.$refs.uToast.show({
 							title: err.msg,
 							title: err.msg,
-							type: 'error'
+							type: 'error',
 						});
 						});
 					});
 					});
+				} else {
+					this.$u.api.payGzbank(params).then(res => {
+						if (res.data.needPay) {
+							let payUrl = res.data.url;
+							location.href = payUrl;
+						} else {
+							this.$refs.uToast.show({
+								title: '无需支付',
+								type: 'info',
+							});
+							setTimeout(() => {
+								uni.hideLoading();
+								location.reload()
+							}, 1000)
+						}
+					}).catch(err => {
+						this.$refs.uToast.show({
+							title: err.msg,
+							type: 'error',
+						});
+					});
+				}
 			},
 			},
 			/**
 			/**
 			 * 聚合支付
 			 * 聚合支付
@@ -161,39 +183,46 @@
 			 * 微信支付
 			 * 微信支付
 			 */
 			 */
 			wechatPay() {
 			wechatPay() {
-				this.$u.api
-					.wechatPayApi({
-						orderList: this.curOrderList,
-						openid: this.vuex_wxinfo.openId,
-						deviceNo: this.deviceNo || undefined,
-						payeeId: this.payeeId || undefined,
-						payeeName: this.payeeName || undefined
-					})
-					.then((res) => {
-						if (res.code === 200) {
-							$wxPay.wexinPay(res.data.wx).then((res1) => {
-								switch (Number(res1.code)) {
-									case 0: // 成功
-										//#ifdef H5
-										window.location.reload();
-										//#endif
-										break;
-									case 1: // 取消
-										this.$refs.uToast.show({
-											title: '已取消支付',
-											type: 'info'
-										});
-										break;
-									case 2: // 支付失败
-										this.$refs.uToast.show({
-											title: '支付失败,请检查!',
-											type: 'error'
-										});
-										break;
-								}
-							});
-						}
+				if (this.exportFlag) {
+					this.$refs.uToast.show({
+						title: '停车场暂不支持微信支付!',
+						type: 'warning'
 					});
 					});
+				} else {
+					this.$u.api
+						.wechatPayApi({
+							orderList: this.curOrderList,
+							openid: this.vuex_wxinfo.openId,
+							deviceNo: this.deviceNo || undefined,
+							payeeId: this.payeeId || undefined,
+							payeeName: this.payeeName || undefined
+						})
+						.then((res) => {
+							if (res.code === 200) {
+								$wxPay.wexinPay(res.data.wx).then((res1) => {
+									switch (Number(res1.code)) {
+										case 0: // 成功
+											//#ifdef H5
+											window.location.reload();
+											//#endif
+											break;
+										case 1: // 取消
+											this.$refs.uToast.show({
+												title: '已取消支付',
+												type: 'info'
+											});
+											break;
+										case 2: // 支付失败
+											this.$refs.uToast.show({
+												title: '支付失败,请检查!',
+												type: 'error'
+											});
+											break;
+									}
+								});
+							}
+						});
+				}
 			},
 			},
 			/**
 			/**
 			 * 直接通过后台获取贵阳银行微信支付地址
 			 * 直接通过后台获取贵阳银行微信支付地址
@@ -203,33 +232,47 @@
 			getWXPayByJava(orderList, deviceNo) {
 			getWXPayByJava(orderList, deviceNo) {
 				let params = {
 				let params = {
 					orderList: orderList,
 					orderList: orderList,
-					openid: '',
+					openid: this.vuex_wxinfo.openId,
 					jumpUrl: this.jumpUrl,
 					jumpUrl: this.jumpUrl,
 					deviceNo: deviceNo ? deviceNo : null,
 					deviceNo: deviceNo ? deviceNo : null,
 					payeeId: this.payeeId,
 					payeeId: this.payeeId,
-					payeeName: this.payeeName
+					payeeName: this.payeeName,
+					pursueType: this.pursueType,
+					sanPay: this.sanPay
 				};
 				};
-				this.$u.api
-					.ordinaryWxPay(params)
-					.then((res) => {
-						if (res.code === 200) {
-							// if (getEnvIsWx()) {
-							// 	location.href = res.data.qrCodeUrl + '&jump_url=' + encodeURIComponent(this.jumpUrl)
-							// } else {
-							// 	location.href = res.data.qrCodeUrl
-							// }
-							localStorage.setItem('jumpUrl', this.jumpUrl);
-							location.href = res.data.qrCodeUrl;
-						} else {
-							uni.hideLoading();
-						}
-					})
-					.catch((err) => {
-						this.$refs.uToast.show({
-							title: '无法调起微信支付!',
-							type: 'error'
-						});
-					});
+				if (this.exportFlag) {
+					this.$u.api.polyPayExportApi(params)
+						.then(res => {
+							if (res.code === 200) {
+								localStorage.setItem('jumpUrl', this.jumpUrl)
+								location.href = res.data.qrCodeUrl
+							} else {
+								uni.hideLoading();
+							}
+						})
+						.catch(err => {
+							this.$refs.uToast.show({
+								title: '无法调起微信支付!',
+								type: 'error',
+							});
+						})
+				} else {
+					this.$u.api.ordinaryWxPay(params)
+						.then(res => {
+							if (res.code === 200) {
+								localStorage.setItem('jumpUrl', this.jumpUrl)
+								location.href = res.data.qrCodeUrl
+							} else {
+								uni.hideLoading();
+							}
+						})
+						.catch(err => {
+							this.$refs.uToast.show({
+								title: '无法调起微信支付!',
+								type: 'error',
+							});
+						})
+				}
 			},
 			},
 			/**
 			/**
 			 * 关闭弹框
 			 * 关闭弹框