MS-CIAZDCOIXVRW\Administrator hace 3 años
padre
commit
f006f8f595
Se han modificado 3 ficheros con 430 adiciones y 203 borrados
  1. 191 141
      pages/bill/bill.vue
  2. 214 58
      pages/home/home.vue
  3. 25 4
      util/api.js

+ 191 - 141
pages/bill/bill.vue

@@ -8,7 +8,7 @@
 				</uni-segmented-control>
 				<view class="select" v-if="list.length">
 					<uni-data-picker class="picker" placeholder="点击根据时间筛选" popup-title="请选择筛选条件" :localdata="dataTree"
-						v-model="classes" @change="onchange">
+						@change="onchange">
 					</uni-data-picker>
 				</view>
 				<view class="content" v-if="list.length">
@@ -17,7 +17,7 @@
 						<view class="detail" v-for="item in list" :key="item.id">
 							<view class="detail_title">
 								<view class="title1">
-									{{ item.title }}
+									{{ item.payYear }}水费账单
 								</view>
 								<text>缴费失败</text>
 							</view>
@@ -25,36 +25,36 @@
 							<view class="info">
 								<view class="place">
 									<view class="name">宿舍</view>
-									<view class="rooms">{{ item.room }}</view>
+									<view class="rooms">{{ item.dorm }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">上月表数</view>
-									<view class="rooms">{{ item.last }}</view>
+									<view class="rooms">{{ item.payForIdentify }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">本月表数</view>
-									<view class="rooms">{{ item.current }}</view>
+									<view class="rooms">{{ item.studentName }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">用量</view>
-									<view class="rooms">{{ item.use }}</view>
+									<view class="rooms">{{ item.className }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">补助吨数</view>
-									<view class="rooms">{{ item.sub }}</view>
+									<view class="rooms">{{ item.parentOrder }}</view>
 								</view>
 
 								<view class="place">
-									<view class="time">备注:{{item.notes}}</view>
+									<view class="time">备注:{{item.orderNotice}}</view>
 								</view>
 
 								<view class="timeAndNumber">
-									<view class="time">{{ item.time }}</view>
-									<view class="number">待付款¥{{ item.money }}</view>
+									<view class="time">{{ item.createTime }}</view>
+									<view class="number">待付款¥{{ item.nowPayAmount }}</view>
 								</view>
 
 								<view class="button">
@@ -63,7 +63,7 @@
 										订单反馈
 									</button>
 
-									<button type="primary" plain size="mini" :disabled="isAccredit" class="button_item"
+									<button type="primary" plain size="mini" class="button_item"
 										@click="goPayPage(item)">
 										继续支付
 									</button>
@@ -76,7 +76,7 @@
 						<view class="detail" v-for="item in list" :key="item.id">
 							<view class="detail_title">
 								<view class="title1">
-									{{ item.title }}
+									{{ item.payYear }}水费账单
 								</view>
 								<text class="title3">缴费成功</text>
 							</view>
@@ -84,31 +84,35 @@
 							<view class="info">
 								<view class="place">
 									<view class="name">宿舍</view>
-									<view class="rooms">{{ item.room }}</view>
+									<view class="rooms">{{ item.dorm }}</view>
 								</view>
 								<view class="place">
 									<view class="name">上月表数</view>
-									<view class="rooms">{{ item.last }}</view>
+									<view class="rooms">{{ item.payForIdentify }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">本月表数</view>
-									<view class="rooms">{{ item.current }}</view>
+									<view class="rooms">{{ item.studentName }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">用量</view>
-									<view class="rooms">{{ item.use }}</view>
+									<view class="rooms">{{ item.className }}</view>
 								</view>
 
 								<view class="place">
 									<view class="name">补助吨数</view>
-									<view class="rooms">{{ item.sub }}</view>
+									<view class="rooms">{{ item.parentOrder }}</view>
+								</view>
+
+								<view class="place">
+									<view class="time">备注:{{item.orderNotice}}</view>
 								</view>
 
 								<view class="timeAndNumber">
-									<view class="time">{{ item.time }}</view>
-									<view class="number">实付款¥{{ item.money }}</view>
+									<view class="time">{{ item.createTime }}</view>
+									<view class="number">实付款¥{{ item.nowPayAmount }}</view>
 								</view>
 
 								<view class="button2">
@@ -185,7 +189,6 @@
 					</view>
 				</view>
 			</uni-popup>
-
 		</view>
 	</view>
 </template>
@@ -196,6 +199,7 @@
 	export default {
 		data() {
 			return {
+				// 图片上传组件的样式
 				imageStyles: {
 					width: 75,
 					height: 75,
@@ -206,36 +210,18 @@
 						radius: '5px'
 					}
 				},
-				classes: "",
-				dataTree: [{
-						text: "2022",
-						value: "2022"
-					},
-					{
-						text: "2023",
-						value: "2023"
-					},
-					{
-						text: "2024",
-						value: "2024"
-					},
-				],
+				// 时间筛选框绑定数据
+				dataTree: [],
+				// 分段器数据
 				items: ["缴费失败", "缴费成功"],
+				// 当前激活分段器
 				current: 1,
-				status: 2,
-				itemName: "",
+				// 缴费状态
+				payStatu: 2,
+				// 支付时间
 				payYear: "",
-				list: [{
-					title: "2022年9月水费账单",
-					room: "1栋210",
-					last: 0,
-					current: 22,
-					use: 22,
-					sub: 15,
-					notes: "水费为3.2元/吨",
-					time: "2022-08-20 14:23:12",
-					money: "14.70"
-				}],
+				// 页面账单数据
+				list: [],
 				// 订单反馈弹窗 表格的验证规则
 				rules: {
 					feedbackPersonName: {
@@ -267,12 +253,6 @@
 							errorMessage: "请输入宿舍号",
 						}, ],
 					},
-					// feedbackImg: {
-					// 	rules: [{
-					// 		required: true,
-					// 		errorMessage: "请上传图片",
-					// 	}, ],
-					// },
 					feedbackInfo: {
 						rules: [{
 							required: true,
@@ -288,10 +268,11 @@
 					feedbackInfo: "",
 					feedbackImg: []
 				},
-				range: [],
-				detailInfo: {},
-				single: "2021-04-3",
+				// 订单号
 				orderNo: "",
+				// 支付金额
+				amount: "",
+				// 微信支付参数
 				form: {
 					appId: "",
 					timeStamp: "",
@@ -300,9 +281,11 @@
 					paySign: "",
 					package: "",
 				},
-				amount: "",
-				notifyUrl: "https://chtech.ncjti.edu.cn/jiaofei/jiaofei-api/tuitionpayment/pay/jxnxs/notify/", //农商行地址
+				//农商行地址
+				notifyUrl: "https://chtech.ncjti.edu.cn/jiaofei/jiaofei-api/tuitionpayment/pay/jxnxs/notify/",
+				// 悬浮窗移动标识
 				flags: false,
+				// 定位属性
 				position: {
 					x: 0,
 					y: 0,
@@ -313,19 +296,53 @@
 				yPum: "",
 				maxW: "",
 				maxH: "",
-				isAccredit: false,
-				popTitle: ""
+				// 弹窗标题
+				popTitle: "",
 			};
 		},
 		onLoad() {
-
+			this.getData()
+			this.getTime()
 		},
 		methods: {
+			// 获取账单列表数据
+			async getData() {
+				let res = await this.$myRequest({
+					url: "/payorder/queryWaterOrder",
+					data: {
+						dorm: localStorage.room,
+						payYear: this.payYear,
+						payStatu: this.payStatu,
+						itemName: "水费缴纳"
+					}
+				})
+				// console.log(res);
+				if (res.success) {
+					this.list = res.data
+				}
+			},
+			// 获取时间数组
+			async getTime() {
+				let res = await this.$myRequest({
+					url: "/payableinfowater/queryAllYear",
+					data: {
+						dorm: localStorage.room,
+						payStatu: this.payStatu,
+					}
+				})
+				// console.log(res);
+				if (res.success) {
+					this.dataTree = res.data
+				}
+			},
+			// 上传图片回调
 			select(e) {
 				e.tempFiles.forEach((item) => {
 					TranslateImage.translate(item.path, ((res) => {
+						// 先清空图片数组
+						this.valiFormData.feedbackImg = []
+						// 判断图片大小是否过大
 						if (Number(res.size) > 1000000) {
-							this.valiFormData.feedbackImg = []
 							uni.showModal({
 								content: `图片过大,请重新上传`,
 								showCancel: false,
@@ -334,68 +351,81 @@
 							return
 						}
 
-						this.valiFormData.feedbackImg.push({
-							url: item.path
-						})
-						console.log(this.valiFormData.feedbackImg);
-						// uni.showLoading({
-						// 	title: '上传中'
-						// });
-						// uni.uploadFile({
-						// 	url: `/baoxiu/repairApi/order/uploadImage`,
-						// 	filePath: res.url,
-						// 	name: 'orderImages',
-						// 	success: (uploadFileRes) => {
-						// 		this.ceshiData1.push((JSON.parse(uploadFileRes.data).data))
-						// 		const path = item.path;
-						// 		this.imageValue.push({
-						// 			url: path,
-						// 			name: ""
-						// 		})
-						// 		uni.hideLoading();
-						// 	},
-						// 	fail: () => {
-						// 		uni.hideLoading();
-						// 	}
-						// });
+						uni.showLoading({
+							title: '上传中'
+						});
+
+						// 上传图片
+						uni.uploadFile({
+							url: `http://192.168.161.34:9999/tuitionpayment/feedbackmsg/uploadImage`,
+							filePath: res.url,
+							name: 'images',
+							success: (uploadFileRes) => {
+								const path = item.path;
+								this.valiFormData.feedbackImg.push({
+									url: path,
+									name: ""
+								})
+								uni.hideLoading();
+							},
+							fail: () => {
+								uni.hideLoading();
+							}
+						});
 					}))
 				})
 			},
+			// 删除图片回调
 			handleDelete(e) {
 				const num = this.valiFormData.feedbackImg.findIndex(v => v.path === e.tempFilePath);
 				this.valiFormData.feedbackImg.splice(num, 1);
-				console.log(this.valiFormData.feedbackImg);
+				// console.log(this.valiFormData.feedbackImg);
 			},
 			// 筛选框数据改变回调
 			onchange(e) {
 				// console.log(e);
 				if (e.detail.value.length == 0) {
-					this.itemName = "";
 					this.payYear = "";
 				} else {
-					this.itemName = e.detail.value[0].text;
 					this.payYear = e.detail.value[0].text;
 				}
+				this.getData()
 			},
 
 			// 顶部tab标签切换回调
 			onClickItem(e) {
 				this.current = e.currentIndex;
 				if (this.current == 0) {
-					this.status = 1;
+					this.payStatu = 1;
 				} else {
-					this.status = 2;
+					this.payStatu = 2;
 				}
+				this.getData()
 			},
 
 			// 订单反馈按钮回调
-			handleFeedback(item) {
+			async handleFeedback(item) {
+				console.log();
 				this.popTitle = item.title
 				this.valiFormData.feedbackPersonName = "";
 				this.valiFormData.feedbackPersonPhone = "";
 				this.valiFormData.feedbackRoom = "";
 				this.valiFormData.feedbackInfo = "";
 				this.valiFormData.feedbackImg = [];
+
+				let res = await this.$myRequest({
+					url: "/wechat/getUserNameTele",
+					data: {
+						cardNumber: localStorage.card_number || "360721199802141618",
+					},
+				});
+
+				if (res.success) {
+					this.valiFormData.feedbackPersonName = res.data.name
+					this.valiFormData.feedbackPersonPhone = res.data.telephone
+					this.valiFormData.feedbackRoom = localStorage.room
+				}
+
 				this.$refs.popup_feedback.open();
 			},
 
@@ -403,12 +433,35 @@
 			submit(ref) {
 				this.$refs[ref]
 					.validate()
-					.then((res) => {
-						console.log(res);
+					.then(async (res) => {
+						// 如果上传了图片,处理图片参数字段
+						if (res.feedbackImg.length) {
+							let temList = []
+							res.feedbackImg.forEach((ele) => {
+								temList.push(ele.url)
+							})
+							res.image = temList.join(";")
+						}
+						res.feedbackItemName = "水费缴纳"
+
+						// 整理参数
+						let {
+							feedbackImg,
+							...data
+						} = res
+
+						let result = await this.$myRequest({
+							url: "/feedbackmsg/save",
+							method: "post",
+							data
+						})
+						if (result.success) {
+							uni.showToast({
+								title: '提交成功',
+							});
+						}
+
 						this.$refs.popup_feedback.close();
-						uni.showToast({
-							title: '提交成功',
-						});
 					})
 					.catch((err) => {
 						console.log("err", err);
@@ -422,40 +475,65 @@
 
 			// 继续支付按钮回调
 			goPayPage(item) {
+				console.log(item);
+				this.orderNo = item.orderNo;
+				this.amount = item.nowPayAmount;
+				this.getQuery(item)
+			},
+
+			// 处理参数
+			async getQuery(item) {
 				// console.log(item);
-				console.log("支付");
-				// this.orderNo = item.orderNo;
-				// this.amount = item.nowPayAmount;
-				// this.createPayorder(item);
+				let res = await this.$myRequest({
+					url: `/payorder/${item.payForIdentify}/receiveOrder`,
+					method: "post",
+					data: {
+						id: item.id,
+						studentNo: item.studentNo,
+						itemName: item.payItem,
+						payYear: item.payYear,
+						payDetail: item.payDetail,
+						dorm: item.dorm,
+						payOrderLoan: "",
+						orderNotice: item.orderNotice,
+						// payItemType: 1,
+						payCount: "1",
+						notPaySize: 0,
+						nowRealPayAmount: item.realPayAmount,
+						payerCardNumber: localStorage.card_number || "360721199802141618",
+						payerName: localStorage.studentName || "陈志斌"
+					}
+				})
+				// console.log(res);
+				if (res.success) {
+					this.createPayorder(item)
+				}
 			},
 
+			// 创建订单
 			async createPayorder(item) {
-				let allListString = item.payDetail.join("/");
 				let res = await this.$myRequest({
 					url: `/payorder/${item.payForIdentify}/create`,
 					method: "post",
 					data: {
-						id: item.payinfoId,
+						id: item.id,
 						studentNo: item.payForIdentify,
 						itemName: item.payItem,
 						payYear: item.payYear,
-						payDetail: allListString,
+						payDetail: item.payDetail,
 						dorm: item.dorm,
 						payOrderLoan: item.payOrderLoan,
 						orderNotice: item.orderNotice,
-						payCount: item.payDetail ? "2" : "1",
-						notPaySize: item.notPaySize,
+						payCount: "1",
+						notPaySize: 0,
 						nowRealPayAmount: item.nowPayAmount,
-						payerCardNumber: localStorage.getItem("card_number"),
-						payerName: localStorage.getItem("studentName"),
+						payerCardNumber: localStorage.card_number || "360721199802141618",
+						payerName: localStorage.studentName || "陈志斌"
 					},
 				});
 				// console.log(res);
 				if (res.success) {
 					this.orderNo = res.data[0].orderNo;
-					// if (res.data.length > 1) {
-					// 	this.secondOrderNo = res.data[1].orderNo
-					// }
 					if (res.data[0].payMethod == "1") {
 						// console.log("建行");
 						this.getjhPay();
@@ -463,27 +541,6 @@
 						// console.log("农商");
 						this.getnsPay();
 					}
-				} else {
-					if (res.code == 10028 || res.code == 10029) {
-						uni.showModal({
-							title: "提示",
-							content: res.message,
-							showCancel: false,
-							success: function(res) {
-								if (res.confirm) {
-									uni.reLaunch({
-										url: "/pages/home/home",
-									});
-								}
-							},
-						});
-					} else {
-						uni.showToast({
-							title: res.message,
-							icon: "error",
-							mask: true,
-						});
-					}
 				}
 			},
 
@@ -493,7 +550,7 @@
 					url: "/pay/ccb/getJsApiParam",
 					data: {
 						orderNo: this.orderNo,
-						openId: uni.getStorageSync("openId"),
+						openId: localStorage.openId,
 						secondOrderNo: "",
 					},
 				});
@@ -513,6 +570,7 @@
 				}
 			},
 
+			// 微信支付回调
 			wxPay() {
 				let that = this;
 
@@ -618,14 +676,6 @@
 			end() {
 				this.flags = false;
 			},
-
-			// 下拉刷新回调
-			onPullDownRefresh() {
-				this.getData();
-				setTimeout(() => {
-					uni.stopPullDownRefresh();
-				}, 1500);
-			},
 		},
 	};
 </script>

+ 214 - 58
pages/home/home.vue

@@ -86,7 +86,7 @@
 							</button>
 
 							<button class="feedback" type="primary" size="mini" @click="navigateToPay(item)" v-else>
-								支付
+								支付
 							</button>
 						</view>
 					</view>
@@ -104,7 +104,8 @@
 		</view>
 
 		<!-- 悬浮按钮区域 -->
-		<view class="suspend_button" @click="goBill" @touchstart="down" @touchmove.prevent="move" @touchend="end">
+		<view v-if="roomSelect!='请选择宿舍'" class="suspend_button" @click="goBill" @touchstart="down"
+			@touchmove.prevent="move" @touchend="end">
 			订单查询
 		</view>
 
@@ -239,12 +240,6 @@
 							errorMessage: "请输入宿舍号",
 						}, ],
 					},
-					// feedbackImg: {
-					// 	rules: [{
-					// 		required: true,
-					// 		errorMessage: "请上传图片",
-					// 	}, ],
-					// },
 					feedbackInfo: {
 						rules: [{
 							required: true,
@@ -260,7 +255,23 @@
 					feedbackInfo: "",
 					feedbackImg: []
 				},
-				popTitle: ""
+				// 弹窗标题
+				popTitle: "",
+				// 订单号
+				orderNo: "",
+				// 金额
+				amount: "",
+				// 微信支付参数
+				form: {
+					appId: "",
+					timeStamp: "",
+					nonceStr: "",
+					signType: "",
+					paySign: "",
+					package: "",
+				},
+				//农商行地址
+				notifyUrl: "https://chtech.ncjti.edu.cn/jiaofei/jiaofei-api/tuitionpayment/pay/jxnxs/notify/",
 			};
 		},
 		onLoad() {
@@ -283,7 +294,6 @@
 					url: "/payableinfowater/queryWaterInfo",
 					data: {
 						dorm: localStorage.room,
-						// dorm: "12栋202",
 						year: this.time_value,
 						payStatu: this.pay_type,
 					},
@@ -299,7 +309,6 @@
 					url: "/payableinfowater/queryAllYear",
 					data: {
 						dorm: localStorage.room,
-						// dorm: "12栋202",
 					},
 				});
 				// console.log(res);
@@ -311,8 +320,10 @@
 			select(e) {
 				e.tempFiles.forEach((item) => {
 					TranslateImage.translate(item.path, ((res) => {
+						// 先清空图片数组
+						this.valiFormData.feedbackImg = []
+						// 判断图片大小是否过大
 						if (Number(res.size) > 1000000) {
-							this.valiFormData.feedbackImg = []
 							uni.showModal({
 								content: `图片过大,请重新上传`,
 								showCancel: false,
@@ -320,31 +331,26 @@
 							})
 							return
 						}
-
-						this.valiFormData.feedbackImg.push({
-							url: item.path
-						})
-						console.log(this.valiFormData.feedbackImg);
-						// uni.showLoading({
-						// 	title: '上传中'
-						// });
-						// uni.uploadFile({
-						// 	url: `/baoxiu/repairApi/order/uploadImage`,
-						// 	filePath: res.url,
-						// 	name: 'orderImages',
-						// 	success: (uploadFileRes) => {
-						// 		this.ceshiData1.push((JSON.parse(uploadFileRes.data).data))
-						// 		const path = item.path;
-						// 		this.imageValue.push({
-						// 			url: path,
-						// 			name: ""
-						// 		})
-						// 		uni.hideLoading();
-						// 	},
-						// 	fail: () => {
-						// 		uni.hideLoading();
-						// 	}
-						// });
+						uni.showLoading({
+							title: '上传中'
+						});
+						// 上传图片
+						uni.uploadFile({
+							url: `http://192.168.161.34:9999/tuitionpayment/feedbackmsg/uploadImage`,
+							filePath: res.url,
+							name: 'images',
+							success: (uploadFileRes) => {
+								const path = item.path;
+								this.valiFormData.feedbackImg.push({
+									url: path,
+									name: ""
+								})
+								uni.hideLoading();
+							},
+							fail: () => {
+								uni.hideLoading();
+							}
+						});
 					}))
 				})
 			},
@@ -352,11 +358,10 @@
 			handleDelete(e) {
 				const num = this.valiFormData.feedbackImg.findIndex(v => v.path === e.tempFilePath);
 				this.valiFormData.feedbackImg.splice(num, 1);
-				console.log(this.valiFormData.feedbackImg);
+				// console.log(this.valiFormData.feedbackImg);
 			},
 			// 订单反馈按钮弹窗
 			async handleFeedback(item) {
-				console.log(item);
 				this.popTitle = item.title
 				this.valiFormData.feedbackPersonName = "";
 				this.valiFormData.feedbackPersonPhone = "";
@@ -367,13 +372,14 @@
 				let res = await this.$myRequest({
 					url: "/wechat/getUserNameTele",
 					data: {
-						cardNumber: item.cardNumber,
+						cardNumber: localStorage.card_number || "360721199802141618",
 					},
 				});
 				// console.log(res);
 				if (res.success) {
 					this.valiFormData.feedbackPersonName = res.data.name
 					this.valiFormData.feedbackPersonPhone = res.data.telephone
+					this.valiFormData.feedbackRoom = localStorage.room
 				}
 
 				this.$refs.popup_feedback.open();
@@ -382,12 +388,33 @@
 			popSubmit(ref) {
 				this.$refs[ref]
 					.validate()
-					.then((res) => {
-						console.log(res);
+					.then(async (res) => {
+						// 如果上传了图片,处理图片参数字段
+						if (res.feedbackImg.length) {
+							let temList = []
+							res.feedbackImg.forEach((ele) => {
+								temList.push(ele.url)
+							})
+							res.image = temList.join(";")
+						}
+						res.feedbackItemName = "水费缴纳"
+
+						// 整理参数
+						let {
+							feedbackImg,
+							...data
+						} = res
+						let result = await this.$myRequest({
+							url: "/feedbackmsg/save",
+							method: "post",
+							data
+						})
+						if (result.success) {
+							uni.showToast({
+								title: '提交成功',
+							});
+						}
 						this.$refs.popup_feedback.close();
-						uni.showToast({
-							title: '提交成功',
-						});
 					})
 					.catch((err) => {
 						console.log("err", err);
@@ -427,13 +454,151 @@
 					url: '/pages/select/select',
 				});
 			},
-			// 跳转到支付页面
+			// 支付回调
 			navigateToPay(item) {
-				let info = JSON.stringify(item)
-				uni.navigateTo({
-					url: `/pages/pay/pay?info=${info}`,
+				// console.log(item);
+				this.amount = item.realPayAmount;
+				this.getQuery(item)
+			},
+
+			// 处理参数
+			async getQuery(item) {
+				// console.log(item);
+				let res = await this.$myRequest({
+					url: `/payorder/${item.payForIdentify}/receiveOrder`,
+					method: "post",
+					data: {
+						id: item.id,
+						studentNo: "",
+						itemName: item.paymentItem,
+						payYear: item.payMonth,
+						payDetail: item.payAmountDetail,
+						dorm: item.dorm,
+						payOrderLoan: "",
+						orderNotice: item.orderNotice,
+						// payItemType: 1,
+						payCount: "1",
+						notPaySize: 0,
+						nowRealPayAmount: item.realPayAmount,
+						payerCardNumber: localStorage.card_number || "360721199802141618",
+						payerName: localStorage.studentName || "陈志斌"
+					}
+				})
+				// console.log(res);
+				if (res.success) {
+					this.createPayorder(item)
+				}
+			},
+
+			// 创建订单
+			async createPayorder(item) {
+				let res = await this.$myRequest({
+					url: `/payorder/${item.payForIdentify}/create`,
+					method: "post",
+					data: {
+						id: item.id,
+						studentNo: "",
+						itemName: item.paymentItem,
+						payYear: item.payMonth,
+						payDetail: item.payAmountDetail,
+						dorm: item.dorm,
+						payOrderLoan: 0,
+						orderNotice: item.orderNotice,
+						payCount: "1",
+						notPaySize: 0,
+						nowRealPayAmount: item.realPayAmount,
+						payerCardNumber: localStorage.card_number || "360721199802141618",
+						payerName: localStorage.studentName || "陈志斌"
+					},
 				});
+				// console.log(res);
+				if (res.success) {
+					this.orderNo = res.data[0].orderNo;
+					if (res.data[0].payMethod == "1") {
+						// console.log("建行");
+						this.getjhPay();
+					} else {
+						// console.log("农商");
+						this.getnsPay();
+					}
+				}
+			},
+
+			// 建行支付请求
+			async getjhPay() {
+				let res = await this.$myRequest({
+					url: "/pay/ccb/getJsApiParam",
+					data: {
+						orderNo: this.orderNo,
+						openId: localStorage.openId,
+						secondOrderNo: "",
+					},
+				});
+				// console.log(res);
+				if (res.success) {
+					this.form = {
+						...res.data,
+					};
+					//调起微信支付
+					this.wxPay();
+				} else {
+					uni.showToast({
+						title: res.message,
+						icon: "error",
+						mask: true,
+					});
+				}
+			},
+
+			// 微信支付回调
+			wxPay() {
+				let that = this;
+
+				function onBridgeReady() {
+					WeixinJSBridge.invoke(
+						"getBrandWCPayRequest",
+						that.form,
+						function(res) {
+							if (res.errMsg == "get_brand_wcpay_request:ok") {
+								// 使用以上方式判断前端返回,微信团队郑重提示:
+								//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+							}
+						}
+					);
+				}
+				// 兼容处理
+				if (typeof WeixinJSBridge == "undefined") {
+					if (document.addEventListener) {
+						document.addEventListener(
+							"WeixinJSBridgeReady",
+							onBridgeReady,
+							false
+						);
+					} else if (document.attachEvent) {
+						document.attachEvent("WeixinJSBridgeReady", onBridgeReady);
+						document.attachEvent("onWeixinJSBridgeReady", onBridgeReady);
+					}
+				} else {
+					onBridgeReady();
+				}
 			},
+
+			// 农商支付请求
+			getnsPay() {
+				let O = "6fc31630a4d3de99f5e41debbd35b9f0";
+
+				let out_no = this.orderNo;
+
+				let amount = this.amount;
+
+				let appoint_notify = this.notifyUrl;
+
+				let mainUrl =
+					`https://q.jxnxs.com/newpay?O=${O}&out_no=${out_no}&amount=${amount}&appoint_notify=${appoint_notify}`;
+
+				window.location.href = mainUrl;
+			},
+
 			// 订单查询悬浮按钮回调
 			goBill() {
 				uni.navigateTo({
@@ -497,15 +662,6 @@
 					phoneNumber: '82293462'
 				});
 			},
-
-			// 下拉刷新回调
-			onPullDownRefresh() {
-				console.log('刷新');
-				// this.getData();
-				setTimeout(() => {
-					uni.stopPullDownRefresh();
-				}, 1500);
-			},
 		}
 	}
 </script>

+ 25 - 4
util/api.js

@@ -12,13 +12,34 @@ export const myRequest = (options) => {
 			url: BASE_URL + options.url,
 			method: options.method || "GET",
 			data: options.data || {},
-			// header: {
-			// 	'card_number': sessionStorage.getItem("card_number") ||localStorage.getItem("tem_card_number")|| localStorage.getItem(
-			// 		"card_number")
-			// },
+			header: {
+				'card_number': localStorage.getItem("card_number") || "360721199802141618"
+			},
 			success: (res) => {
 				uni.hideLoading();
 				resolve(res.data)
+				if (!res.data.success) {
+					if (res.data.code == 10028 || res.data.code == 10029) {
+						uni.showModal({
+							title: "提示",
+							content: res.data.message,
+							showCancel: false,
+							success: function(res) {
+								if (res.confirm) {
+									uni.reLaunch({
+										url: "/pages/home/home",
+									});
+								}
+							},
+						});
+					} else {
+						uni.showToast({
+							title: res.data.message,
+							icon: "error",
+							mask: true,
+						});
+					}
+				}
 			},
 			fail: (err) => {
 				uni.hideLoading();