From 85e853c0f1170d4889552e59d604aa8ce4ed3235 Mon Sep 17 00:00:00 2001
From: Fox-33 <1466778434@qq.com>
Date: Mon, 29 Sep 2025 10:07:36 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/api.js | 4 +-
api/fetch.js | 4 +-
api/http.js | 4 +-
api/model/exam.js | 5 ++
pages_order/auth/agreementConfirmPopup.vue | 6 +--
pages_order/auth/wxLogin.vue | 2 -
pages_order/components/agreementModal.vue | 2 +
pages_order/report/codeErrorPopup.vue | 3 +-
pages_order/report/pay.vue | 81 ++++++++++++++++++++++--------
9 files changed, 78 insertions(+), 33 deletions(-)
diff --git a/api/api.js b/api/api.js
index bb03134..8167c13 100644
--- a/api/api.js
+++ b/api/api.js
@@ -12,7 +12,7 @@ const config = {
}
-export function api(key, data, callback, loadingTitle) {
+export function api(key, data, callback, loadingTitle, disabledToast) {
let req = config[key]
if (!req) {
@@ -72,7 +72,7 @@ export function api(key, data, callback, loadingTitle) {
}
return http.http(req.url, data, callback, req.method,
- loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
+ loadingTitle || req.showLoading, loadingTitle || req.loadingTitle, disabledToast)
}
diff --git a/api/fetch.js b/api/fetch.js
index 87ed77c..f38091b 100644
--- a/api/fetch.js
+++ b/api/fetch.js
@@ -1,6 +1,6 @@
import api from './api.js'
-const fetch = (key, data = {}, transform = true, loadingTitle) => {
+const fetch = (key, data = {}, transform = true, loadingTitle, disabledToast = false) => {
return new Promise((resolve, reject) => {
const callback = (res) => {
@@ -15,7 +15,7 @@ const fetch = (key, data = {}, transform = true, loadingTitle) => {
}
}
- api(key, data, callback, loadingTitle)
+ api(key, data, callback, loadingTitle, disabledToast)
})
}
diff --git a/api/http.js b/api/http.js
index 4a77b07..92efd3a 100644
--- a/api/http.js
+++ b/api/http.js
@@ -3,7 +3,7 @@ import Vue from 'vue'
import utils from '../utils/utils.js'
import store from '../store/store.js'
-function http(uri, data, callback, method = 'GET', showLoading, title) {
+function http(uri, data, callback, method = 'GET', showLoading, title, disabledToast) {
if(showLoading){
uni.showLoading({
@@ -38,7 +38,7 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
console.error('登录过期');
store.commit('clearUserInfo')
utils.toLogin()
- } else if(res.statusCode == 200 && res.data.code != 200
+ } else if(!disabledToast && res.statusCode == 200 && res.data.code != 200
&& res.data.code != 902){
uni.showToast({
mask: true,
diff --git a/api/model/exam.js b/api/model/exam.js
index abec89c..f5e3d94 100644
--- a/api/model/exam.js
+++ b/api/model/exam.js
@@ -29,6 +29,11 @@ const api = {
limit : 500,
showLoading : true,
},
+ // 支付-查询兑换码
+ queryCodeById: {
+ url: '/exam/queryCodeById',
+ method: 'GET',
+ },
// 我的-我的答题
queryExamLogList: {
url: '/exam/queryExamLogList',
diff --git a/pages_order/auth/agreementConfirmPopup.vue b/pages_order/auth/agreementConfirmPopup.vue
index 3bb9ddf..e4a93be 100644
--- a/pages_order/auth/agreementConfirmPopup.vue
+++ b/pages_order/auth/agreementConfirmPopup.vue
@@ -6,10 +6,10 @@
用户隐私保护提示
- 在你使用 普兆医疗服务之前,请仔细阅读我已阅读并同意
- 《服务协议与隐私条款》
+ 在你使用 {{ configList.app_name }}服务之前,请仔细阅读我已阅读并同意
+ 《服务协议与隐私条款》
和
- 《个人信息保护指引》
+ 《个人信息保护指引》
如你同意该指引,请点击“同意“开始使用本小程序。
阅读并同意我们的
-
《服务协议与隐私条款》
以及
-
《个人信息保护指引》
diff --git a/pages_order/components/agreementModal.vue b/pages_order/components/agreementModal.vue
index 82c5541..e9b11f0 100644
--- a/pages_order/components/agreementModal.vue
+++ b/pages_order/components/agreementModal.vue
@@ -68,6 +68,8 @@ export default {
.content {
padding: 8rpx 32rpx 40rpx 32rpx;
+ max-height: 70vh;
+ overflow-y: scroll;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
diff --git a/pages_order/report/codeErrorPopup.vue b/pages_order/report/codeErrorPopup.vue
index c5fb9bf..f8d477b 100644
--- a/pages_order/report/codeErrorPopup.vue
+++ b/pages_order/report/codeErrorPopup.vue
@@ -8,8 +8,7 @@
兑换码输入有误,请与客服确认~
联系客服获取抵扣码
-
-
+
diff --git a/pages_order/report/pay.vue b/pages_order/report/pay.vue
index 8e0f485..ebde6ad 100644
--- a/pages_order/report/pay.vue
+++ b/pages_order/report/pay.vue
@@ -6,8 +6,7 @@
实付金额
¥
-
- 24.00
+ {{ payAmount }}
联系客服获取抵扣码
@@ -27,7 +26,7 @@
选择支付方式
微信支付
-
-
+
@@ -53,8 +51,7 @@
兑换码抵扣支付
-
-
+
@@ -62,7 +59,7 @@
-
+
兑换码
@@ -98,12 +95,12 @@
return {
batchNo: null,
form: {
- payment: null,
+ payment: 0,
code: null,
},
rules: {
'payment': {
- type: 'string',
+ type: 'number',
required: false,
message: '请选择支付方式',
},
@@ -116,21 +113,65 @@
formItemStyle: { padding: 0 },
}
},
+ computed: {
+ payAmount() {
+ return Number(this.configList.pay_amount)
+ }
+ },
onLoad(arg) {
const { batchNo } = arg
this.batchNo = batchNo
},
methods: {
- onPay() {
- // todo
-
- // todo: check code is error
- // if error
- // this.$refs.codeErrorPopup.open()
-
- uni.redirectTo({
- url: `/pages_order/report/userInfo?batchNo=${this.batchNo}`
- })
+ async onPay() {
+ try {
+ await this.$refs.form.validate()
+
+ const {
+ payment,
+ code,
+ } = this.form
+
+ let payAmount = this.payAmount
+ let discountAmount = 0
+
+ if (payment == 1) { // 兑换码
+ const infoRes = await this.$fetch('queryCodeById', { code }, false, null, true)
+ const { result: infoResult } = infoRes
+
+ if (!infoResult || infoResult?.isUse !== '0') {
+ this.$refs.codeErrorPopup.open()
+ return
+ }
+
+ discountAmount = infoResult.discountAmount
+ payAmount -= discountAmount
+ }
+
+ const params = {
+ batchNo: this.batchNo,
+ payAmount,
+ discountAmount,
+ code,
+ }
+
+ const result = await this.$fetch('createOrder', params)
+
+ await uni.requestPaymentWxPay({ result })
+
+ uni.showToast({
+ title: '支付成功',
+ icon: 'none'
+ })
+
+ setTimeout(() => {
+ uni.redirectTo({
+ url: `/pages_order/report/userInfo?batchNo=${this.batchNo}`
+ })
+ }, 700)
+ } catch (err) {
+
+ }
},
},
}