7d6c26f4 by 张猛

道馆个人,级位缴费

1 parent c1b557f6
...@@ -1429,12 +1429,11 @@ export function checkBusinessLicense(data) { ...@@ -1429,12 +1429,11 @@ export function checkBusinessLicense(data) {
1429 } 1429 }
1430 1430
1431 // 生成单位订单renewYear 1431 // 生成单位订单renewYear
1432 export function certifiedNew(data) { 1432 export function certifiedNew(renewYear) {
1433 return request({ 1433 return request({
1434 url: `/system/certifiedNew/commit`, 1434 url: `/system/certifiedNew/commit?renewYear=${renewYear}`,
1435 method: 'post', 1435 method: 'post',
1436 params: data 1436 })
1437 })
1438 } 1437 }
1439 1438
1440 // 模拟回调 1439 // 模拟回调
...@@ -1519,9 +1518,9 @@ export function getMyStatus() { ...@@ -1519,9 +1518,9 @@ export function getMyStatus() {
1519 } 1518 }
1520 1519
1521 // 个人会员缴费支付 1520 // 个人会员缴费支付
1522 export function goPay(id) { 1521 export function goPay(id, payType) {
1523 return request({ 1522 return request({
1524 url: `/person/paymentRangeNew/pay/${id}`, 1523 url: `/person/paymentRangeNew/pay/${id}/${payType}`,
1525 method: 'post' 1524 method: 'post'
1526 }) 1525 })
1527 } 1526 }
...@@ -1728,11 +1727,11 @@ export function confirmExam(examId) { ...@@ -1728,11 +1727,11 @@ export function confirmExam(examId) {
1728 } 1727 }
1729 1728
1730 // 提交级位考试订单 1729 // 提交级位考试订单
1731 export function commitJiExam(data) { 1730 export function commitJiExam(params) {
1732 return request({ 1731 return request({
1733 url: `/exam/person/commitJi`, 1732 url: `/exam/info/commitJi/${params.id}/${params.addresId}/${params.payType}`,
1734 method: 'post', 1733 method: 'post',
1735 data 1734 params
1736 }) 1735 })
1737 } 1736 }
1738 1737
......
...@@ -23,7 +23,7 @@ const ERROR_MESSAGES = { ...@@ -23,7 +23,7 @@ const ERROR_MESSAGES = {
23 * @async 23 * @async
24 * @param {string} orderId - 订单ID,用于错误处理和取消订单 24 * @param {string} orderId - 订单ID,用于错误处理和取消订单
25 * @param {string} encryptedData - 加密数据 25 * @param {string} encryptedData - 加密数据
26 * @returns {Promise<void>} 26 * @returns {Promise<string>}
27 * @throws {Error} 支付过程中发生的错误 27 * @throws {Error} 支付过程中发生的错误
28 */ 28 */
29 async function minShengPay(orderId, encryptedData) { 29 async function minShengPay(orderId, encryptedData) {
...@@ -86,14 +86,13 @@ async function minShengPay(orderId, encryptedData) { ...@@ -86,14 +86,13 @@ async function minShengPay(orderId, encryptedData) {
86 86
87 uni.hideLoading() 87 uni.hideLoading()
88 // 8. 调起微信支付 88 // 8. 调起微信支付
89 const [payErr] = await to(invokeWechatPayment(payParams, orderId)) 89 const [payErr, paySuccess] = await to(invokeWechatPayment(payParams, orderId))
90 if (payErr) { 90 if (payErr) {
91 handlePaymentError(payErr, orderId) 91 handlePaymentError(payErr, orderId)
92
93 } 92 }
94 // if (paySuccess) { 93 if (paySuccess) {
95 // return paySuccess 94 return 'OK'
96 // } 95 }
97 } 96 }
98 97
99 /** 98 /**
...@@ -213,10 +212,10 @@ function invokeWechatPayment(payParams, orderId) { ...@@ -213,10 +212,10 @@ function invokeWechatPayment(payParams, orderId) {
213 signType: payParams.signType, 212 signType: payParams.signType,
214 paySign: payParams.paySign, 213 paySign: payParams.paySign,
215 success: (res) => { 214 success: (res) => {
215 resolve(res)
216 uni.showToast({ 216 uni.showToast({
217 title: '支付成功', 217 title: '支付成功',
218 duration: 2000, 218 duration: 2000,
219 complete: () => resolve(res)
220 }) 219 })
221 }, 220 },
222 fail: async (err) => { 221 fail: async (err) => {
......
1 <template> 1 <template>
2 <view> 2 <view>
3 <view class="searchbar"> 3 <view class="searchbar">
4 <uni-easyinput placeholderStyle="font-size:30rpx" :input-border="false" prefixIcon="search" 4 <uni-easyinput v-model="queryParams.name" :input-border="false" placeholder="搜索考级名称"
5 v-model="queryParams.name" placeholder="搜索考级名称" @blur="getList" @clear="getList"> 5 placeholderStyle="font-size:30rpx" prefixIcon="search" @blur="getList" @clear="getList">
6 </uni-easyinput> 6 </uni-easyinput>
7 <view class="invertedbtn-red" v-if="isExam=='0'" @click="goAdd">+ 添加级位考试</view> 7 <view v-if="isExam=='0'" class="invertedbtn-red" @click="goAdd">+ 添加级位考试</view>
8 </view> 8 </view>
9 <view class="appList"> 9 <view class="appList">
10 <view class="appItem" v-for="(item,index) in list" :key="item.examId || index"> 10 <view v-for="(item,index) in list" :key="item.examId || index" class="appItem">
11 <view class="status" @click="goDetail(item)"> 11 <view class="status" @click="goDetail(item)">
12 <text v-if="item.status=='0'" class="text-primary">{{ item.statusStr }}</text> 12 <text v-if="item.status=='0'" class="text-primary">{{ item.statusStr }}</text>
13 <text v-if="item.status=='1'" class="text-primary">{{ item.statusStr }}</text> 13 <text v-if="item.status=='1'" class="text-primary">{{ item.statusStr }}</text>
14 <text v-if="item.status=='2'" class="text-success">{{ item.statusStr }}</text> 14 <text v-if="item.status=='2'" class="text-success">{{ item.statusStr }}</text>
15 <text v-if="item.status=='3'" class="text-danger">{{ item.statusStr }}</text> 15 <text v-if="item.status=='3'" class="text-danger">{{ item.statusStr }}</text>
16 <text v-if="item.status=='4'" class="text-warning">{{ item.statusStr }}</text> 16 <text v-if="item.status=='4'" class="text-warning">{{ item.statusStr }}</text>
17 </view> 17 </view>
18 <view class="date" v-if="item.status!='0'&&item.submitTime">提交时间:{{item.submitTime}}</view> 18 <view v-if="item.status!='0'&&item.submitTime" class="date">提交时间:{{ item.submitTime }}</view>
19 <view class="mt0" @click="goDetail(item)"><text class="text-primary">{{item.examCode}}</text></view> 19 <view class="mt0" @click="goDetail(item)">
20 <view class="name mt0" @click="goDetail(item)">{{item.name}}</view> 20 <text class="text-primary">{{ item.examCode }}</text>
21 <view class="pp esp">申请单位:{{item.memberName}}</view> 21 </view>
22 <view class="pp esp">考级日期:{{item.startTime.substring(0,16)}}{{item.endTime.substring(0,16)}}</view> 22 <view class="name mt0" @click="goDetail(item)">{{ item.name }}</view>
23 <view class="flexbox" @click="goDetail(item)"> 23 <view class="pp esp">申请单位:{{ item.memberName }}</view>
24 <view> 24 <view class="pp esp">考级日期:{{ item.startTime?.substring(0, 16) }}{{ item.endTime?.substring(0, 16) }}
25 申请日期 25 </view>
26 <view>{{item.applyTime.substring(0, 10)}}</view> 26 <view class="flexbox" @click="goDetail(item)">
27 </view> 27 <view>
28 <view> 28 申请日期
29 考官 29 <view>{{ item.applyTime?.substring(0, 10) }}</view>
30 <view>{{item.examinerNames}}</view> 30 </view>
31 </view> 31 <view>
32 32 考官
33 <view> 33 <view>{{ item.examinerNames }}</view>
34 通过人数 34 </view>
35 <view>{{item.pass}}</view> 35
36 </view> 36 <view>
37 </view> 37 通过人数
38 <view class="func" v-if="item.status=='0'||item.status=='3'||item.status=='4'"> 38 <view>{{ item.pass }}</view>
39 <button @click="handleDelete(item)">删除</button> 39 </view>
40 <button @click="editThis(item)">编辑</button> 40 </view>
41 <button :disabled="!(item.totalNum?item.totalNum:(item.pass+item.noPass))" @click="handleSubmit(item)">提交审核</button> 41 <view v-if="item.status=='0'||item.status=='3'||item.status=='4'||item.status=='9'" class="func">
42 </view> 42 <button :disabled="item.status=='1'||item.status=='2'||item.status=='3'"
43 </view> 43 @click="handleDelete(item)">删除
44 </view> 44 </button>
45 45 <button :disabled="!(item.status=='0')" @click="editThis(item)">编辑</button>
46 46 <button :disabled="item.status!='0'&&item.status!='9'||item.totalNum==0||item.pass==0"
47 47 @click="handleSubmit(item)">
48 <view class="nodata" v-if="list.length==0"> 48 提交审核
49 <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> 49 </button>
50 <text>暂无数据</text> 50 </view>
51 </view> 51 </view>
52 </view> 52 </view>
53
54
55 <view v-if="list.length==0" class="nodata">
56 <image :src="config.baseUrl_api + '/fs/static/nodata.png'" mode="aspectFit"></image>
57 <text>暂无数据</text>
58 </view>
59 </view>
53 </template> 60 </template>
54 61
55 <script setup> 62 <script setup>
56 import * as api from '@/common/api.js' 63 import * as api from '@/common/api.js'
57 import config from '@/config.js' 64 import config from '@/config.js'
58 import { 65 import {
59 onMounted, 66 onMounted,
60 ref 67 ref
61 } from 'vue' 68 } from 'vue'
62 import { 69 import {
63 onLoad, 70 onLoad,
64 onShow 71 onShow
65 } from '@dcloudio/uni-app' 72 } from '@dcloudio/uni-app'
66 const app = getApp(); 73
67 const queryParams = ref({ 74 const app = getApp();
68 // pageNum: 1, 75 const queryParams = ref({
69 // pageSize: 10 76 // pageNum: 1,
70 type: '1', 77 // pageSize: 10
71 rankStatus: '0' 78 type: '1',
72 }) 79 rankStatus: '0'
73 const navs = ref(['未提交', '审核中', '审核通过', '审核拒绝']) 80 })
74 const current = ref() 81 const navs = ref(['未提交', '审核中', '审核通过', '审核拒绝'])
75 const list = ref([]) 82 const current = ref()
76 const total = ref(0) 83 const list = ref([])
77 const deptType = ref('') 84 const total = ref(0)
78 const userType = ref('') 85 const deptType = ref('')
79 const isExam = ref('1') 86 const userType = ref('')
80 onShow(() => { 87 const isExam = ref('1')
81 if (app.globalData.isLogin) { 88 onShow(() => {
82 init() 89 if (app.globalData.isLogin) {
83 } else { 90 init()
84 91 } else {
85 app.firstLoadCallback = () => { 92
86 init() 93 app.firstLoadCallback = () => {
87 }; 94 init()
88 } 95 };
89 }) 96 }
90 97 })
91 function init() { 98
92 uni.showLoading({ 99 function init() {
93 title: '加载中', 100 uni.showLoading({
94 mask: true 101 title: '加载中',
95 }) 102 mask: true
96 deptType.value = app.globalData.deptType 103 })
97 userType.value = app.globalData.userType 104 deptType.value = app.globalData.deptType
98 isExam.value = app.globalData.isExam 105 userType.value = app.globalData.userType
99 getList() 106 isExam.value = app.globalData.isExam
100 } 107 getList()
101 108 }
102 109
103 function getList() { 110
104 api.getLevelList(queryParams.value).then(res => { 111 function getList() {
105 uni.hideLoading() 112 api.getLevelList(queryParams.value).then(res => {
106 list.value = res.rows 113 uni.hideLoading()
107 total.value = res.total 114 list.value = res.rows
108 }) 115 total.value = res.total
109 } 116 })
110 117 }
111 function goAdd() { 118
112 let path = `/level/addApply` 119 function goAdd() {
113 uni.navigateTo({ 120 let path = `/level/addApply`
114 url: path 121 uni.navigateTo({
115 }); 122 url: path
116 } 123 });
117 124 }
118 function editThis(item) { 125
119 let path = `/level/addApply?examId=${item.examId}` 126 function editThis(item) {
120 uni.navigateTo({ 127 let path = `/level/addApply?examId=${item.examId}`
121 url: path 128 uni.navigateTo({
122 }); 129 url: path
123 } 130 });
124 131 }
125 function handleSubmit(item) { 132
126 uni.showModal({ 133 function handleSubmit(item) {
127 title: '提示', 134 uni.showModal({
128 content: `请确认人员照片是否已更新`, 135 title: '提示',
129 success: function(res) { 136 content: `请确认人员照片是否已更新`,
130 if (res.confirm) { 137 success: function (res) {
131 // 跳转到付款详情页面 138 if (res.confirm) {
132 uni.navigateTo({ 139 // 跳转到付款详情页面
133 url: `/level/paymentDetail?examId=${item.examId}` 140 uni.navigateTo({
134 }); 141 url: `/level/paymentDetail?examId=${item.examId}`
135 } 142 });
136 } 143 }
137 }) 144 }
138 } 145 })
139 function handleDelete(row) { 146 }
140 uni.showModal({ 147
141 title: '提示', 148 function handleDelete(row) {
142 content: `确定删除${row.name}吗`, 149 uni.showModal({
143 success: function(res) { 150 title: '提示',
144 if (res.confirm) { 151 content: `确定删除${row.name}吗`,
145 uni.showLoading({ 152 success: function (res) {
146 title: `删除中` 153 if (res.confirm) {
147 }) 154 uni.showLoading({
148 api.delLevel(row.examId).then(res=>{ 155 title: `删除中`
149 uni.showToast({ 156 })
150 title:'操作成功!', 157 api.delLevel(row.examId).then(res => {
151 icon:'none' 158 uni.showToast({
152 }) 159 title: '操作成功!',
153 uni.hideLoading() 160 icon: 'none'
154 getList() 161 })
155 }) 162 uni.hideLoading()
156 } 163 getList()
157 } 164 })
158 }) 165 }
159 } 166 }
160 167 })
161 function upApply(id) { 168 }
162 api.submitVerity(id).then(res => { 169
163 uni.hideLoading() 170 function upApply(id) {
164 getList() 171 api.submitVerity(id).then(res => {
165 uni.showToast({ 172 uni.hideLoading()
166 title: `提交成功` 173 getList()
167 }) 174 uni.showToast({
168 }) 175 title: `提交成功`
169 } 176 })
170 177 })
171 178 }
172 function goDetail(item) { 179
173 if (item.status != '0') { 180
174 let path = `/level/applyDetail?examId=${item.examId}` 181 function goDetail(item) {
175 uni.navigateTo({ 182 if (item.status != '0') {
176 url: path 183 let path = `/level/applyDetail?examId=${item.examId}`
177 }); 184 uni.navigateTo({
178 } else { 185 url: path
179 // 去编辑 186 });
180 editThis(item) 187 } else {
181 } 188 // 去编辑
182 189 editThis(item)
183 } 190 }
191
192 }
184 </script> 193 </script>
185 194
186 195
187 <style scoped lang="scss"> 196 <style lang="scss" scoped>
188 .searchbar { 197 .searchbar {
189 display: flex; 198 display: flex;
190 align-items: center; 199 align-items: center;
191 padding: 25rpx; 200 padding: 25rpx;
192 box-sizing: border-box; 201 box-sizing: border-box;
193 202
194 :deep(.uni-easyinput .uni-easyinput__content) { 203 :deep(.uni-easyinput .uni-easyinput__content) {
195 border-radius: 35rpx; 204 border-radius: 35rpx;
196 border: none; 205 border: none;
197 height: 70rpx; 206 height: 70rpx;
198 } 207 }
199 208
200 :deep(.uni-easyinput__content-input) { 209 :deep(.uni-easyinput__content-input) {
201 font-size: 26rpx; 210 font-size: 26rpx;
202 } 211 }
203 212
204 .invertedbtn-red { 213 .invertedbtn-red {
205 border-radius: 50px; 214 border-radius: 50px;
206 background-color: #fff; 215 background-color: #fff;
207 216
208 font-size: 30rpx; 217 font-size: 30rpx;
209 padding: 10rpx 20rpx; 218 padding: 10rpx 20rpx;
210 } 219 }
211 } 220 }
212 221
213 .mt0 { 222 .mt0 {
214 margin-top: 0 !important; 223 margin-top: 0 !important;
215 } 224 }
216 225
217 .appList .appItem .name { 226 .appList .appItem .name {
218 width: 80%; 227 width: 80%;
219 word-break: break-all; 228 word-break: break-all;
220 } 229 }
221 </style> 230 </style>
......
1 <template> 1 <template>
2 <view class="payment-page"> 2 <view class="payment-page">
3 <!-- 加载状态 --> 3 <!-- 加载状态 -->
4 <view class="loading-wrap" v-if="loading"> 4 <view v-if="loading" class="loading-wrap">
5 <text>加载中...</text> 5 <text>加载中...</text>
6 </view> 6 </view>
7 7
8 <view v-else> 8 <view v-else>
9 <!-- 缴费单位卡片 --> 9 <!-- 缴费单位卡片 -->
10 <view class="info-card"> 10 <view class="info-card">
...@@ -16,15 +16,15 @@ ...@@ -16,15 +16,15 @@
16 <view class="info-line sub">{{ deptInfo.aname || '--' }}</view> 16 <view class="info-line sub">{{ deptInfo.aname || '--' }}</view>
17 </view> 17 </view>
18 </view> 18 </view>
19 19
20 <!-- 邮寄信息卡片 --> 20 <!-- 邮寄信息卡片 -->
21 <view class="info-card"> 21 <view class="info-card">
22 <view class="card-header"> 22 <view class="card-header">
23 <text class="card-title">邮寄信息</text> 23 <text class="card-title">邮寄信息</text>
24 <text class="manage-btn" @click="goAddressManage">管理地址</text> 24 <text class="manage-btn" @click="goAddressManage">管理地址</text>
25 </view> 25 </view>
26 26
27 <view class="address-content" v-if="selectedAddress.id" @click="goAddressManage"> 27 <view v-if="selectedAddress.id" class="address-content" @click="goAddressManage">
28 <view class="address-region"> 28 <view class="address-region">
29 {{ selectedAddress.province }} {{ selectedAddress.city }} {{ selectedAddress.area }} 29 {{ selectedAddress.province }} {{ selectedAddress.city }} {{ selectedAddress.area }}
30 </view> 30 </view>
...@@ -33,57 +33,57 @@ ...@@ -33,57 +33,57 @@
33 </view> 33 </view>
34 <view class="address-contact"> 34 <view class="address-contact">
35 {{ selectedAddress.name }} {{ selectedAddress.phone }} 35 {{ selectedAddress.name }} {{ selectedAddress.phone }}
36 <view class="default-tag" v-if="selectedAddress.defaultFlag == 1">默认</view> 36 <view v-if="selectedAddress.defaultFlag == 1" class="default-tag">默认</view>
37 </view> 37 </view>
38 </view> 38 </view>
39 39
40 <view class="empty-address" v-else @click="goAddressManage"> 40 <view v-else class="empty-address" @click="goAddressManage">
41 <text class="empty-tip">请添加收货地址</text> 41 <text class="empty-tip">请添加收货地址</text>
42 <text class="arrow"></text> 42 <text class="arrow"></text>
43 </view> 43 </view>
44 </view> 44 </view>
45 45
46 <!-- 考试信息卡片 --> 46 <!-- 考试信息卡片 -->
47 <view class="info-card"> 47 <view class="info-card">
48 <view class="card-header"> 48 <view class="card-header">
49 <text class="card-title">考试信息</text> 49 <text class="card-title">考试信息</text>
50 </view> 50 </view>
51 51
52 <view class="exam-info"> 52 <view class="exam-info">
53 <view class="info-row"> 53 <view class="info-row">
54 <text class="label">人数合计</text> 54 <text class="label">人数合计</text>
55 <text class="value">{{ examData.allCount || 0 }}</text> 55 <text class="value">{{ examData.allCount || 0 }}</text>
56 </view> 56 </view>
57 57
58 <view class="info-row level-row" v-if="levelTags.length > 0"> 58 <view v-if="levelTags.length > 0" class="info-row level-row">
59 <text class="label">级别分布</text> 59 <text class="label">级别分布</text>
60 <view class="level-tags"> 60 <view class="level-tags">
61 <view class="level-tag" v-for="tag in levelTags" :key="tag.level"> 61 <view v-for="tag in levelTags" :key="tag.level" class="level-tag">
62 {{ tag.name }}{{ tag.count }} 62 {{ tag.name }}{{ tag.count }}
63 </view> 63 </view>
64 </view> 64 </view>
65 </view> 65 </view>
66 66
67 <view class="info-row total-row"> 67 <view class="info-row total-row">
68 <text class="label">费用合计</text> 68 <text class="label">费用合计</text>
69 <text class="value price">¥{{ (Number(examData.allFee) || 0).toFixed(2) }}</text> 69 <text class="value price">¥{{ (Number(examData.allFee) || 0).toFixed(2) }}</text>
70 </view> 70 </view>
71 </view> 71 </view>
72 </view> 72 </view>
73 73
74 <!-- 支付方式 --> 74 <!-- 支付方式 -->
75 <view class="payment-section"> 75 <view class="payment-section">
76 <view class="section-title">支付方式</view> 76 <view class="section-title">支付方式</view>
77 <view class="payment-methods"> 77 <view class="payment-methods">
78 <view class="payment-item selected"> 78 <view class="payment-item selected">
79 <image class="icon" :src="config.baseUrl_api + '/fs/static/min.png'" mode="widthFix"></image> 79 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
80 <text class="payment-name">民生付</text> 80 <text class="payment-name">民生付</text>
81 <view class="check-icon"></view> 81 <view class="check-icon"></view>
82 </view> 82 </view>
83 </view> 83 </view>
84 </view> 84 </view>
85 </view> 85 </view>
86 86
87 <!-- 底部提交按钮 --> 87 <!-- 底部提交按钮 -->
88 <view class="bottom-bar"> 88 <view class="bottom-bar">
89 <view class="total-info"> 89 <view class="total-info">
...@@ -91,23 +91,24 @@ ...@@ -91,23 +91,24 @@
91 <text class="total-price">¥{{ (Number(examData.allFee) || 0).toFixed(2) }}</text> 91 <text class="total-price">¥{{ (Number(examData.allFee) || 0).toFixed(2) }}</text>
92 </view> 92 </view>
93 <view 93 <view
94 class="submit-btn"
95 :class="{ disabled: !selectedAddress.id }" 94 :class="{ disabled: !selectedAddress.id }"
95 class="submit-btn"
96 @click="handleSubmit" 96 @click="handleSubmit"
97 > 97 >
98 提交订单 98 提交订单
99 </view> 99 </view>
100 </view> 100 </view>
101 101
102 <view class="tip-text" v-if="!selectedAddress.id">请先选择邮寄地址</view> 102 <view v-if="!selectedAddress.id" class="tip-text">请先选择邮寄地址</view>
103 </view> 103 </view>
104 </template> 104 </template>
105 105
106 <script setup> 106 <script setup>
107 import { ref, computed, onMounted } from 'vue'; 107 import {ref, computed, onMounted} from 'vue';
108 import { onLoad ,onShow} from '@dcloudio/uni-app'; 108 import {onLoad, onShow} from '@dcloudio/uni-app';
109 import * as api from '@/common/api.js'; 109 import * as api from '@/common/api.js';
110 import config from '@/config.js' 110 import config from '@/config.js'
111 import {minShengPay} from '@/common/pay.js';
111 112
112 const examId = ref(''); 113 const examId = ref('');
113 const loading = ref(true); 114 const loading = ref(true);
...@@ -145,7 +146,7 @@ onLoad((options) => { ...@@ -145,7 +146,7 @@ onLoad((options) => {
145 // 获取全局用户信息 146 // 获取全局用户信息
146 const app = getApp(); 147 const app = getApp();
147 memberInfo.value = app.globalData.memberInfo || {}; 148 memberInfo.value = app.globalData.memberInfo || {};
148 149
149 }); 150 });
150 151
151 onMounted(() => { 152 onMounted(() => {
...@@ -164,10 +165,10 @@ onShow(() => { ...@@ -164,10 +165,10 @@ onShow(() => {
164 } 165 }
165 }); 166 });
166 const getName = async () => { 167 const getName = async () => {
167 const res = await api.getMyOwnMemberInfo() 168 const res = await api.getMyOwnMemberInfo()
168 169
169 deptInfo.value = res.data.dept 170 deptInfo.value = res.data.dept
170 171
171 } 172 }
172 const initData = async () => { 173 const initData = async () => {
173 loading.value = true; 174 loading.value = true;
...@@ -179,7 +180,7 @@ const initData = async () => { ...@@ -179,7 +180,7 @@ const initData = async () => {
179 } 180 }
180 } catch (e) { 181 } catch (e) {
181 console.error('获取考试信息失败', e); 182 console.error('获取考试信息失败', e);
182 uni.showToast({ title: '加载失败', icon: 'none' }); 183 uni.showToast({title: '加载失败', icon: 'none'});
183 } finally { 184 } finally {
184 loading.value = false; 185 loading.value = false;
185 } 186 }
...@@ -204,63 +205,73 @@ const goAddressManage = () => { ...@@ -204,63 +205,73 @@ const goAddressManage = () => {
204 205
205 const handleSubmit = async () => { 206 const handleSubmit = async () => {
206 if (!selectedAddress.value.id) { 207 if (!selectedAddress.value.id) {
207 return uni.showToast({ title: '请先选择地址', icon: 'none' }); 208 return uni.showToast({title: '请先选择地址', icon: 'none'});
208 } 209 }
209 210
210 uni.showModal({ 211 uni.showModal({
211 title: '提示', 212 title: '提示',
212 content: `确定提交订单吗?`, 213 content: `确定提交订单吗?`,
213 success: async (res) => { 214 success: async (res) => {
214 if (res.confirm) { 215 if (res.confirm) {
215 uni.showLoading({ title: '提交中...' }); 216 uni.showLoading({title: '提交中...'});
216 try { 217 try {
217 const commitRes = await api.commitJiExam({ 218 const commitRes = await api.commitJiExam({
218 addresId: selectedAddress.value.id, 219 addresId: selectedAddress.value.id,
219 id: examId.value 220 id: examId.value,
221 payType: '2'
220 }); 222 });
221 223 if (commitRes.data && commitRes.data.payResult.encryptedData) {
222 if (commitRes.data && commitRes.data.orderId) { 224 const res = await minShengPay(commitRes.data.orderId, commitRes.data.payResult.encryptedData)
223 // 有支付流程,调用支付 225 if (res == 'OK') {
224 const payRes = await api.payJiExam(commitRes.data.orderId); 226 uni.showToast({title: '支付成功', icon: 'success'});
225 uni.hideLoading();
226
227 if (payRes.data && payRes.data.payResult && payRes.data.payResult.encryptedData) {
228 // 调用支付
229 uni.requestPayment({
230 provider: 'wxpay',
231 timeStamp: payRes.data.payResult.timeStamp,
232 nonceStr: payRes.data.payResult.nonceStr,
233 package: payRes.data.payResult.package,
234 signType: payRes.data.payResult.signType,
235 paySign: payRes.data.payResult.paySign,
236 success: () => {
237 uni.showToast({ title: '支付成功', icon: 'success' });
238 setTimeout(() => {
239 uni.navigateBack();
240 }, 1500);
241 },
242 fail: () => {
243 uni.showToast({ title: '支付失败', icon: 'none' });
244 }
245 });
246 } else {
247 // 无需支付,直接成功
248 uni.showToast({ title: '提交成功', icon: 'success' });
249 setTimeout(() => { 227 setTimeout(() => {
250 uni.navigateBack(); 228 uni.navigateBack();
251 }, 1500); 229 }, 1500)
252 } 230 }
253 } else {
254 uni.hideLoading();
255 uni.showToast({ title: '提交成功', icon: 'success' });
256 setTimeout(() => {
257 uni.navigateBack();
258 }, 1500);
259 } 231 }
232
233 // if (commitRes.data && commitRes.data.orderId) {
234 // // 有支付流程,调用支付
235 // const payRes = await api.payJiExam(commitRes.data.orderId);
236 // uni.hideLoading();
237 //
238 // if (payRes.data && payRes.data.payResult && payRes.data.payResult.encryptedData) {
239 // // 调用支付
240 // uni.requestPayment({
241 // provider: 'wxpay',
242 // timeStamp: payRes.data.payResult.timeStamp,
243 // nonceStr: payRes.data.payResult.nonceStr,
244 // package: payRes.data.payResult.package,
245 // signType: payRes.data.payResult.signType,
246 // paySign: payRes.data.payResult.paySign,
247 // success: () => {
248 // uni.showToast({title: '支付成功', icon: 'success'});
249 // setTimeout(() => {
250 // uni.navigateBack();
251 // }, 1500);
252 // },
253 // fail: () => {
254 // uni.showToast({title: '支付失败', icon: 'none'});
255 // }
256 // });
257 // } else {
258 // // 无需支付,直接成功
259 // uni.showToast({title: '提交成功', icon: 'success'});
260 // setTimeout(() => {
261 // uni.navigateBack();
262 // }, 1500);
263 // }
264 // } else {
265 // uni.hideLoading();
266 // uni.showToast({title: '提交成功', icon: 'success'});
267 // setTimeout(() => {
268 // uni.navigateBack();
269 // }, 1500);
270 // }
260 } catch (e) { 271 } catch (e) {
261 uni.hideLoading(); 272 uni.hideLoading();
262 console.error('提交失败', e); 273 console.error('提交失败', e);
263 uni.showToast({ title: '提交失败', icon: 'none' }); 274 uni.showToast({title: '提交失败', icon: 'none'});
264 } 275 }
265 } 276 }
266 } 277 }
...@@ -291,7 +302,7 @@ const handleSubmit = async () => { ...@@ -291,7 +302,7 @@ const handleSubmit = async () => {
291 padding: 30rpx; 302 padding: 30rpx;
292 margin-bottom: 20rpx; 303 margin-bottom: 20rpx;
293 box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04); 304 box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
294 305
295 .card-header { 306 .card-header {
296 display: flex; 307 display: flex;
297 justify-content: space-between; 308 justify-content: space-between;
...@@ -299,14 +310,14 @@ const handleSubmit = async () => { ...@@ -299,14 +310,14 @@ const handleSubmit = async () => {
299 padding-bottom: 20rpx; 310 padding-bottom: 20rpx;
300 margin-bottom: 20rpx; 311 margin-bottom: 20rpx;
301 border-bottom: 1rpx solid #f0f0f0; 312 border-bottom: 1rpx solid #f0f0f0;
302 313
303 .card-title { 314 .card-title {
304 font-size: 32rpx; 315 font-size: 32rpx;
305 font-weight: 600; 316 font-weight: 600;
306 color: #333; 317 color: #333;
307 position: relative; 318 position: relative;
308 padding-left: 20rpx; 319 padding-left: 20rpx;
309 320
310 &::before { 321 &::before {
311 content: ''; 322 content: '';
312 position: absolute; 323 position: absolute;
...@@ -319,19 +330,19 @@ const handleSubmit = async () => { ...@@ -319,19 +330,19 @@ const handleSubmit = async () => {
319 border-radius: 3rpx; 330 border-radius: 3rpx;
320 } 331 }
321 } 332 }
322 333
323 .manage-btn { 334 .manage-btn {
324 font-size: 28rpx; 335 font-size: 28rpx;
325 color: #1561cb; 336 color: #1561cb;
326 } 337 }
327 } 338 }
328 339
329 .card-content { 340 .card-content {
330 .info-line { 341 .info-line {
331 font-size: 30rpx; 342 font-size: 30rpx;
332 color: #333; 343 color: #333;
333 margin-bottom: 8rpx; 344 margin-bottom: 8rpx;
334 345
335 &.sub { 346 &.sub {
336 font-size: 26rpx; 347 font-size: 26rpx;
337 color: #999; 348 color: #999;
...@@ -344,13 +355,13 @@ const handleSubmit = async () => { ...@@ -344,13 +355,13 @@ const handleSubmit = async () => {
344 background: #f8f9fa; 355 background: #f8f9fa;
345 padding: 24rpx; 356 padding: 24rpx;
346 border-radius: 12rpx; 357 border-radius: 12rpx;
347 358
348 .address-region { 359 .address-region {
349 font-size: 28rpx; 360 font-size: 28rpx;
350 color: #666; 361 color: #666;
351 margin-bottom: 10rpx; 362 margin-bottom: 10rpx;
352 } 363 }
353 364
354 .address-detail { 365 .address-detail {
355 font-size: 30rpx; 366 font-size: 30rpx;
356 color: #333; 367 color: #333;
...@@ -358,14 +369,14 @@ const handleSubmit = async () => { ...@@ -358,14 +369,14 @@ const handleSubmit = async () => {
358 margin-bottom: 16rpx; 369 margin-bottom: 16rpx;
359 line-height: 1.5; 370 line-height: 1.5;
360 } 371 }
361 372
362 .address-contact { 373 .address-contact {
363 display: flex; 374 display: flex;
364 align-items: center; 375 align-items: center;
365 gap: 16rpx; 376 gap: 16rpx;
366 font-size: 26rpx; 377 font-size: 26rpx;
367 color: #666; 378 color: #666;
368 379
369 .default-tag { 380 .default-tag {
370 background: linear-gradient(135deg, #FF755A, #F51722); 381 background: linear-gradient(135deg, #FF755A, #F51722);
371 color: #fff; 382 color: #fff;
...@@ -383,12 +394,12 @@ const handleSubmit = async () => { ...@@ -383,12 +394,12 @@ const handleSubmit = async () => {
383 padding: 30rpx; 394 padding: 30rpx;
384 background: #f8f9fa; 395 background: #f8f9fa;
385 border-radius: 12rpx; 396 border-radius: 12rpx;
386 397
387 .empty-tip { 398 .empty-tip {
388 font-size: 28rpx; 399 font-size: 28rpx;
389 color: #999; 400 color: #999;
390 } 401 }
391 402
392 .arrow { 403 .arrow {
393 font-size: 36rpx; 404 font-size: 36rpx;
394 color: #999; 405 color: #999;
...@@ -399,39 +410,39 @@ const handleSubmit = async () => { ...@@ -399,39 +410,39 @@ const handleSubmit = async () => {
399 .info-row { 410 .info-row {
400 display: flex; 411 display: flex;
401 margin-bottom: 24rpx; 412 margin-bottom: 24rpx;
402 413
403 &:last-child { 414 &:last-child {
404 margin-bottom: 0; 415 margin-bottom: 0;
405 } 416 }
406 417
407 .label { 418 .label {
408 width: 140rpx; 419 width: 140rpx;
409 font-size: 28rpx; 420 font-size: 28rpx;
410 color: #666; 421 color: #666;
411 flex-shrink: 0; 422 flex-shrink: 0;
412 } 423 }
413 424
414 .value { 425 .value {
415 font-size: 28rpx; 426 font-size: 28rpx;
416 color: #333; 427 color: #333;
417 font-weight: 500; 428 font-weight: 500;
418 429
419 &.price { 430 &.price {
420 color: #e4393c; 431 color: #e4393c;
421 font-size: 36rpx; 432 font-size: 36rpx;
422 font-weight: 600; 433 font-weight: 600;
423 } 434 }
424 } 435 }
425 436
426 &.level-row { 437 &.level-row {
427 align-items: flex-start; 438 align-items: flex-start;
428 439
429 .level-tags { 440 .level-tags {
430 flex: 1; 441 flex: 1;
431 display: flex; 442 display: flex;
432 flex-wrap: wrap; 443 flex-wrap: wrap;
433 gap: 12rpx; 444 gap: 12rpx;
434 445
435 .level-tag { 446 .level-tag {
436 background: #fff0f0; 447 background: #fff0f0;
437 color: #e4393c; 448 color: #e4393c;
...@@ -441,7 +452,7 @@ const handleSubmit = async () => { ...@@ -441,7 +452,7 @@ const handleSubmit = async () => {
441 } 452 }
442 } 453 }
443 } 454 }
444 455
445 &.total-row { 456 &.total-row {
446 padding-top: 20rpx; 457 padding-top: 20rpx;
447 border-top: 1rpx dashed #eee; 458 border-top: 1rpx dashed #eee;
...@@ -455,7 +466,7 @@ const handleSubmit = async () => { ...@@ -455,7 +466,7 @@ const handleSubmit = async () => {
455 border-radius: 16rpx; 466 border-radius: 16rpx;
456 padding: 30rpx; 467 padding: 30rpx;
457 margin-bottom: 20rpx; 468 margin-bottom: 20rpx;
458 469
459 .section-title { 470 .section-title {
460 font-size: 32rpx; 471 font-size: 32rpx;
461 font-weight: 600; 472 font-weight: 600;
...@@ -463,7 +474,7 @@ const handleSubmit = async () => { ...@@ -463,7 +474,7 @@ const handleSubmit = async () => {
463 margin-bottom: 20rpx; 474 margin-bottom: 20rpx;
464 position: relative; 475 position: relative;
465 padding-left: 20rpx; 476 padding-left: 20rpx;
466 477
467 &::before { 478 &::before {
468 content: ''; 479 content: '';
469 position: absolute; 480 position: absolute;
...@@ -476,41 +487,41 @@ const handleSubmit = async () => { ...@@ -476,41 +487,41 @@ const handleSubmit = async () => {
476 border-radius: 3rpx; 487 border-radius: 3rpx;
477 } 488 }
478 } 489 }
479 490
480 .payment-methods { 491 .payment-methods {
481 background: #f8f9fa; 492 background: #f8f9fa;
482 border-radius: 12rpx; 493 border-radius: 12rpx;
483 padding: 20rpx; 494 padding: 20rpx;
484 495
485 .payment-item { 496 .payment-item {
486 display: flex; 497 display: flex;
487 align-items: center; 498 align-items: center;
488 padding: 16rpx; 499 padding: 16rpx;
489 border-radius: 12rpx; 500 border-radius: 12rpx;
490 border: 2rpx solid transparent; 501 border: 2rpx solid transparent;
491 502
492 &.selected { 503 &.selected {
493 border-color: #e4393c; 504 border-color: #e4393c;
494 background: #fff; 505 background: #fff;
495 506
496 .check-icon { 507 .check-icon {
497 display: flex; 508 display: flex;
498 } 509 }
499 } 510 }
500 511
501 .payment-icon { 512 .payment-icon {
502 width: 48rpx; 513 width: 48rpx;
503 height: 48rpx; 514 height: 48rpx;
504 margin-right: 16rpx; 515 margin-right: 16rpx;
505 } 516 }
506 517
507 .payment-name { 518 .payment-name {
508 flex: 1; 519 flex: 1;
509 font-size: 30rpx; 520 font-size: 30rpx;
510 color: #333; 521 color: #333;
511 font-weight: 500; 522 font-weight: 500;
512 } 523 }
513 524
514 .check-icon { 525 .check-icon {
515 width: 40rpx; 526 width: 40rpx;
516 height: 40rpx; 527 height: 40rpx;
...@@ -537,25 +548,25 @@ const handleSubmit = async () => { ...@@ -537,25 +548,25 @@ const handleSubmit = async () => {
537 padding: 20rpx 30rpx; 548 padding: 20rpx 30rpx;
538 background: #fff; 549 background: #fff;
539 box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05); 550 box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
540 551
541 .total-info { 552 .total-info {
542 flex: 1; 553 flex: 1;
543 display: flex; 554 display: flex;
544 align-items: baseline; 555 align-items: baseline;
545 gap: 8rpx; 556 gap: 8rpx;
546 557
547 .total-label { 558 .total-label {
548 font-size: 28rpx; 559 font-size: 28rpx;
549 color: #666; 560 color: #666;
550 } 561 }
551 562
552 .total-price { 563 .total-price {
553 font-size: 40rpx; 564 font-size: 40rpx;
554 color: #e4393c; 565 color: #e4393c;
555 font-weight: 600; 566 font-weight: 600;
556 } 567 }
557 } 568 }
558 569
559 .submit-btn { 570 .submit-btn {
560 width: 240rpx; 571 width: 240rpx;
561 height: 88rpx; 572 height: 88rpx;
...@@ -566,18 +577,20 @@ const handleSubmit = async () => { ...@@ -566,18 +577,20 @@ const handleSubmit = async () => {
566 font-size: 32rpx; 577 font-size: 32rpx;
567 border-radius: 44rpx; 578 border-radius: 44rpx;
568 font-weight: 500; 579 font-weight: 500;
569 580
570 &.disabled { 581 &.disabled {
571 opacity: 0.5; 582 opacity: 0.5;
572 pointer-events: none; 583 pointer-events: none;
573 } 584 }
574 } 585 }
575 } 586 }
587
576 .icon { 588 .icon {
577 width: 40rpx; 589 width: 40rpx;
578 height: 40rpx; 590 height: 40rpx;
579 margin-right: 10rpx; 591 margin-right: 10rpx;
580 } 592 }
593
581 .tip-text { 594 .tip-text {
582 position: fixed; 595 position: fixed;
583 bottom: 130rpx; 596 bottom: 130rpx;
......
...@@ -7,23 +7,25 @@ ...@@ -7,23 +7,25 @@
7 <text class="info-label">缴费单位</text> 7 <text class="info-label">缴费单位</text>
8 <text class="info-value">{{ payName || '-' }}</text> 8 <text class="info-value">{{ payName || '-' }}</text>
9 </view> 9 </view>
10 <view class="info-row" v-if="assoName"> 10 <view v-if="assoName" class="info-row">
11 <text class="info-label">所属协会</text> 11 <text class="info-label">所属协会</text>
12 <text class="info-value">{{ assoName || '-' }}</text> 12 <text class="info-value">{{ assoName || '-' }}</text>
13 </view> 13 </view>
14 </view> 14 </view>
15 15
16 <view class="card"> 16 <view class="card">
17 <view class="yearRow"> 17 <view class="yearRow">
18 <view class="label">缴费年限</view> 18 <view class="label">缴费年限</view>
19 <view class="control"> 19 <view class="control">
20 <image v-if="form.renewYear > 1" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02.png'" 20 <image v-if="form.renewYear > 1" :src="config.loginImage_api + '/fs/static/dd_02.png'" class="icon"
21 mode="widthFix"
21 @click="minusYear"></image> 22 @click="minusYear"></image>
22 <image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02_g.png'"></image> 23 <image v-else :src="config.loginImage_api + '/fs/static/dd_02_g.png'" class="icon" mode="widthFix"></image>
23 <text class="num">{{ form.renewYear }}</text> 24 <text class="num">{{ form.renewYear }}</text>
24 <image v-if="form.renewYear < 5" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03.png'" 25 <image v-if="form.renewYear < 5" :src="config.loginImage_api + '/fs/static/btn_03.png'" class="icon"
26 mode="widthFix"
25 @click="plusYear"></image> 27 @click="plusYear"></image>
26 <image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03_g.png'"></image> 28 <image v-else :src="config.loginImage_api + '/fs/static/btn_03_g.png'" class="icon" mode="widthFix"></image>
27 </view> 29 </view>
28 </view> 30 </view>
29 </view> 31 </view>
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
47 <label class="radioItem"> 49 <label class="radioItem">
48 <radio :checked="payType === '1'" class="custom-radio" value="1"/> 50 <radio :checked="payType === '1'" class="custom-radio" value="1"/>
49 <view class="payInfo"> 51 <view class="payInfo">
50 <image class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/min.png'"></image> 52 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
51 <text>民生付</text> 53 <text>民生付</text>
52 </view> 54 </view>
53 </label> 55 </label>
...@@ -84,6 +86,7 @@ import to from 'await-to-js' ...@@ -84,6 +86,7 @@ import to from 'await-to-js'
84 import * as api from '@/common/api.js' 86 import * as api from '@/common/api.js'
85 import {minShengPay} from '@/common/pay.js' 87 import {minShengPay} from '@/common/pay.js'
86 import config from '@/config.js' 88 import config from '@/config.js'
89
87 const form = ref({ 90 const form = ref({
88 renewYear: 1 91 renewYear: 1
89 }) 92 })
...@@ -132,20 +135,16 @@ const handelPay = async () => { ...@@ -132,20 +135,16 @@ const handelPay = async () => {
132 }) 135 })
133 return 136 return
134 } 137 }
135 138
136 // 显示 loading 139 // 显示 loading
137 uni.showLoading({ 140 uni.showLoading({
138 title: '支付中...', 141 title: '支付中...',
139 mask: true 142 mask: true
140 }) 143 })
144 if (isPaying.value) return
141 isPaying.value = true 145 isPaying.value = true
142
143 // 创建订单 - 参考PC端逻辑 146 // 创建订单 - 参考PC端逻辑
144 const [orderErr, orderRes] = await to(api.certifiedNew({ 147 const [orderErr, orderRes] = await to(api.certifiedNew(form.value.renewYear))
145 renewYear: form.value.renewYear,
146 type: '1',
147 url: ''
148 }))
149 if (orderErr) { 148 if (orderErr) {
150 uni.hideLoading() 149 uni.hideLoading()
151 isPaying.value = false 150 isPaying.value = false
...@@ -155,7 +154,7 @@ const handelPay = async () => { ...@@ -155,7 +154,7 @@ const handelPay = async () => {
155 }) 154 })
156 return 155 return
157 } 156 }
158 157
159 const data = orderRes.data 158 const data = orderRes.data
160 // 无需支付,直接成功 159 // 无需支付,直接成功
161 if (data.payFlag == 0) { 160 if (data.payFlag == 0) {
...@@ -168,11 +167,14 @@ const handelPay = async () => { ...@@ -168,11 +167,14 @@ const handelPay = async () => {
168 } 167 }
169 if (data.payResult && data.payResult.encryptedData) { 168 if (data.payResult && data.payResult.encryptedData) {
170 try { 169 try {
171 await minShengPay(data.orderId, data.payResult.encryptedData) 170 const res = await minShengPay(data.orderId, data.payResult.encryptedData)
172 // 支付成功,跳转到成功页面 171 if (res == 'OK') {
173 uni.redirectTo({ 172 isPaying.value = false
174 url: `/myCenter/sucPay?orderId=${data.orderId}` 173 // 支付成功,跳转到成功页面
175 }) 174 uni.redirectTo({
175 url: `/myCenter/sucPay?orderId=${data.orderId}`
176 })
177 }
176 } catch (e) { 178 } catch (e) {
177 console.error('支付失败', e) 179 console.error('支付失败', e)
178 uni.hideLoading() 180 uni.hideLoading()
...@@ -185,12 +187,12 @@ const handelPay = async () => { ...@@ -185,12 +187,12 @@ const handelPay = async () => {
185 } 187 }
186 188
187 onLoad((option) => { 189 onLoad((option) => {
188 console.log(66,option) 190 console.log(66, option)
189 // 接收年限 191 // 接收年限
190 form.value.renewYear = Number(option.renewYear || 1) 192 form.value.renewYear = Number(option.renewYear || 1)
191 // 接收缴费单位和所属协会 193 // 接收缴费单位和所属协会
192 payName.value = decodeURIComponent(option.payName || '') 194 payName.value = decodeURIComponent(option.payName || '')
193 console.log(77,payName.value) 195 console.log(77, payName.value)
194 assoName.value = decodeURIComponent(option.assoName || '') 196 assoName.value = decodeURIComponent(option.assoName || '')
195 // 初始化获取费用和优惠 197 // 初始化获取费用和优惠
196 init() 198 init()
...@@ -237,7 +239,7 @@ async function getZtxDiscountPolicyApi() { ...@@ -237,7 +239,7 @@ async function getZtxDiscountPolicyApi() {
237 } 239 }
238 </script> 240 </script>
239 241
240 <style scoped lang="scss"> 242 <style lang="scss" scoped>
241 /* 整体容器 */ 243 /* 整体容器 */
242 .container { 244 .container {
243 min-height: 100vh; 245 min-height: 100vh;
...@@ -265,16 +267,16 @@ async function getZtxDiscountPolicyApi() { ...@@ -265,16 +267,16 @@ async function getZtxDiscountPolicyApi() {
265 align-items: center; 267 align-items: center;
266 padding: 16rpx 0; 268 padding: 16rpx 0;
267 border-bottom: 1rpx solid #f5f5f5; 269 border-bottom: 1rpx solid #f5f5f5;
268 270
269 &:last-child { 271 &:last-child {
270 border-bottom: none; 272 border-bottom: none;
271 } 273 }
272 274
273 .info-label { 275 .info-label {
274 font-size: 28rpx; 276 font-size: 28rpx;
275 color: #666; 277 color: #666;
276 } 278 }
277 279
278 .info-value { 280 .info-value {
279 font-size: 28rpx; 281 font-size: 28rpx;
280 color: #333; 282 color: #333;
......
1 <template> 1 <template>
2 <view class="pay-order-container"> 2 <view class="pay-order-container">
3 <!-- 页面头部 --> 3 <!-- 页面头部 -->
4 <view class="page-header"> 4 <view class="page-header">
5 <text class="title">确认并支付</text> 5 <text class="title">确认并支付</text>
6 </view> 6 </view>
7 7
8 <!-- 订单核心信息 --> 8 <!-- 订单核心信息 -->
9 <view class="order-info"> 9 <view class="order-info">
10 <view class="info-item"> 10 <view class="info-item">
11 <text class="label">人数合计:</text> 11 <text class="label">人数合计:</text>
12 <text class="value red">{{ formData.all ?? 0 }}</text> 12 <text class="value red">{{ formData.all ?? 0 }}</text>
13 </view> 13 </view>
14 <view class="info-item"> 14 <view class="info-item">
15 <text class="label">新会员合计:</text> 15 <text class="label">新会员合计:</text>
16 <text class="value red">{{ formData.new ?? 0 }}</text> 16 <text class="value red">{{ formData.new ?? 0 }}</text>
17 </view> 17 </view>
18 <view class="info-item"> 18 <view class="info-item">
19 <text class="label">续费会员合计:</text> 19 <text class="label">续费会员合计:</text>
20 <text class="value red">{{ formData.old ?? 0 }}</text> 20 <text class="value red">{{ formData.old ?? 0 }}</text>
21 </view> 21 </view>
22 <view class="info-item total-price"> 22 <view class="info-item total-price">
23 <text class="label">支付总费用:</text> 23 <text class="label">支付总费用:</text>
24 <text class="value red">{{ formData.price ?? 0 }}</text> 24 <text class="value red">{{ formData.price ?? 0 }}</text>
25 </view> 25 </view>
26 </view> 26 </view>
27 27
28 <!-- 支付方式选择(修复v-model报错 + 默认勾选) --> 28 <!-- 支付方式选择(修复v-model报错 + 默认勾选) -->
29 <view class="pay-type-section"> 29 <view class="pay-type-section">
30 <text class="section-title">选择支付方式</text> 30 <text class="section-title">选择支付方式</text>
31 <!-- uni-app小程序原生radio-group写法 --> 31 <!-- uni-app小程序原生radio-group写法 -->
32 <radio-group :value="payType" @change="handlePayTypeChange"> 32 <radio-group :value="payType" @change="handlePayTypeChange">
33 <label class="radio-item"> 33 <label class="radio-item">
34 <!-- checked属性实现默认勾选 --> 34 <!-- checked属性实现默认勾选 -->
35 <radio value="0" color="#E60012" :checked="payType === '0'" /> 35 <radio :checked="payType === '0'" color="#E60012" value="0"/>
36 <view class="pay-method"> 36 <view class="pay-method">
37 <image class="icon" :src="config.baseUrl_api + '/fs/static/min.png'" mode="widthFix"></image> 37 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
38 <text class="pay-name">民生付</text> 38 <text class="pay-name">民生付</text>
39 </view> 39 </view>
40 </label> 40 </label>
41 </radio-group> 41 </radio-group>
42 </view> 42 </view>
43 43
44 <!-- 底部支付按钮 --> 44 <!-- 底部支付按钮 -->
45 <view class="fixed-bottom"> 45 <view class="fixed-bottom">
46 <button class="pay-btn red-bg" :loading="payLoading" @click="handlePay">立即支付</button> 46 <button :loading="payLoading" class="pay-btn red-bg" @click="handlePay">立即支付</button>
47 </view> 47 </view>
48 </view> 48 </view>
49 </template> 49 </template>
50 50
51 <script setup> 51 <script setup>
52 import { 52 import {
53 ref 53 ref
54 } from 'vue' 54 } from 'vue'
55 import { 55 import {
56 onLoad 56 onLoad
57 } from '@dcloudio/uni-app'; 57 } from '@dcloudio/uni-app';
58 import * as api from '@/common/api.js' 58 import * as api from '@/common/api.js'
59 import config from '@/config.js' 59 import config from '@/config.js'
60 // 核心数据 60 import {minShengPay} from "@/common/pay";
61 const formData = ref({}) // 订单统计数据 61
62 const rangeId = ref('') // 核心业务ID 62 // 核心数据
63 const payType = ref('0') // 支付方式(默认0=民生付) 63 const formData = ref({}) // 订单统计数据
64 const payLoading = ref(false) // 支付按钮加载状态 64 const rangeId = ref('') // 核心业务ID
65 65 const payType = ref('0') // 支付方式(默认0=民生付)
66 // 页面加载接收参数 66 const payLoading = ref(false) // 支付按钮加载状态
67 onLoad(async (options) => { 67
68 console.log('订单ID:', options.rangeId) 68 // 页面加载接收参数
69 if (options.rangeId) { 69 onLoad(async (options) => {
70 rangeId.value = options.rangeId 70 console.log('订单ID:', options.rangeId)
71 await getCount() 71 if (options.rangeId) {
72 } 72 rangeId.value = options.rangeId
73 }) 73 await getCount()
74 74 }
75 async function getCount() { 75 })
76 try { 76
77 const res = await api.getNewCountByRangeId(rangeId.value) 77 async function getCount() {
78 formData.value = res.data || { 78 try {
79 all: 0, 79 const res = await api.getNewCountByRangeId(rangeId.value)
80 new: 0, 80 formData.value = res.data || {
81 old: 0 81 all: 0,
82 } 82 new: 0,
83 } catch (e) { 83 old: 0
84 formData.value = { 84 }
85 all: 0, 85 } catch (e) {
86 new: 0, 86 formData.value = {
87 old: 0 87 all: 0,
88 } 88 new: 0,
89 } 89 old: 0
90 } 90 }
91 91 }
92 // 支付方式切换 92 }
93 function handlePayTypeChange(e) { 93
94 payType.value = e.detail.value 94 // 支付方式切换
95 } 95 function handlePayTypeChange(e) {
96 96 payType.value = e.detail.value
97 // 立即支付核心逻辑 97 }
98 async function handlePay() { 98
99 // 基础校验 99 // 立即支付核心逻辑
100 if (!rangeId.value || rangeId.value === '-1') { 100 async function handlePay() {
101 return uni.showToast({ 101 // 基础校验
102 title: '订单ID异常', 102 if (!rangeId.value || rangeId.value === '-1') {
103 icon: 'none' 103 return uni.showToast({
104 }) 104 title: '订单ID异常',
105 } 105 icon: 'none'
106 106 })
107 try { 107 }
108 payLoading.value = true 108
109 const res = await api.goPay(rangeId.value) 109 try {
110 110 payLoading.value = true
111 if (res.data?.orderId) { 111 const res = await api.goPay(rangeId.value, '2')
112 await api.pcallBack2(res.data.orderId) 112 if (res.data.payResult && res.data.payResult.encryptedData) {
113 uni.redirectTo({ 113 const reason = await minShengPay(res.data.orderId, res.data.payResult.encryptedData)
114 url: `/myCenter/sucPay?rangeId=${rangeId.value}from=payOrder` 114 if (reason == 'OK') {
115 }) 115 // // 支付成功,跳转到成功页面
116 } 116 // uni.redirectTo({
117 117 // url: `/myCenter/sucPay?orderId=${res.data.orderId}`
118 // 跳转到支付成功页 118 // })
119 119
120 } catch (err) { 120 uni.showToast({title: '支付成功', icon: 'success'});
121 const errMsg = err?.data?.msg || err?.message || '支付失败,请稍后重试' 121 setTimeout(() => {
122 uni.showToast({ 122 uni.navigateBack();
123 title: errMsg, 123 }, 1500)
124 icon: 'none' 124 }
125 }) 125 }
126 } finally { 126
127 payLoading.value = false 127 // 跳转到支付成功页
128 } 128
129 } 129 } catch (err) {
130 const errMsg = err?.data?.msg || err?.message || '支付失败,请稍后重试'
131 uni.showToast({
132 title: errMsg,
133 icon: 'none'
134 })
135 } finally {
136 payLoading.value = false
137 }
138 }
130 </script> 139 </script>
131 140
132 <style scoped lang="scss"> 141 <style lang="scss" scoped>
133 .pay-order-container { 142 .pay-order-container {
134 padding: 30rpx; 143 padding: 30rpx;
135 background-color: #fff; 144 background-color: #fff;
136 min-height: 100vh; 145 min-height: 100vh;
137 box-sizing: border-box; 146 box-sizing: border-box;
138 } 147 }
139 148
140 .icon { 149 .icon {
141 width: 30px; 150 width: 30px;
142 } 151 }
143 152
144 // 页面头部 153 // 页面头部
145 .page-header { 154 .page-header {
146 text-align: center; 155 text-align: center;
147 padding: 20rpx 0; 156 padding: 20rpx 0;
148 border-bottom: 1px solid #eee; 157 border-bottom: 1px solid #eee;
149 margin-bottom: 40rpx; 158 margin-bottom: 40rpx;
150 159
151 .title { 160 .title {
152 font-size: 36rpx; 161 font-size: 36rpx;
153 font-weight: 600; 162 font-weight: 600;
154 color: #333; 163 color: #333;
155 } 164 }
156 } 165 }
157 166
158 // 订单信息区域 167 // 订单信息区域
159 .order-info { 168 .order-info {
160 margin-bottom: 60rpx; 169 margin-bottom: 60rpx;
161 170
162 .info-item { 171 .info-item {
163 display: flex; 172 display: flex;
164 justify-content: space-between; 173 justify-content: space-between;
165 align-items: center; 174 align-items: center;
166 padding: 25rpx 0; 175 padding: 25rpx 0;
167 border-bottom: 1px solid #f5f5f5; 176 border-bottom: 1px solid #f5f5f5;
168 font-size: 32rpx; 177 font-size: 32rpx;
169 178
170 .label { 179 .label {
171 color: #666; 180 color: #666;
172 } 181 }
173 182
174 .value { 183 .value {
175 font-weight: 600; 184 font-weight: 600;
176 font-size: 34rpx; 185 font-size: 34rpx;
177 } 186 }
178 187
179 .red { 188 .red {
180 color: #E60012; 189 color: #E60012;
181 } 190 }
182 } 191 }
183 192
184 .total-price { 193 .total-price {
185 border-bottom: none; 194 border-bottom: none;
186 margin-top: 10rpx; 195 margin-top: 10rpx;
187 196
188 .label { 197 .label {
189 font-size: 34rpx; 198 font-size: 34rpx;
190 color: #333; 199 color: #333;
191 } 200 }
192 201
193 .value { 202 .value {
194 font-size: 38rpx; 203 font-size: 38rpx;
195 } 204 }
196 } 205 }
197 } 206 }
198 207
199 // 支付方式区域 208 // 支付方式区域
200 .pay-type-section { 209 .pay-type-section {
201 margin-bottom: 80rpx; 210 margin-bottom: 80rpx;
202 211
203 .section-title { 212 .section-title {
204 font-size: 32rpx; 213 font-size: 32rpx;
205 color: #333; 214 color: #333;
206 margin-bottom: 20rpx; 215 margin-bottom: 20rpx;
207 display: block; 216 display: block;
208 } 217 }
209 218
210 .radio-item { 219 .radio-item {
211 display: flex; 220 display: flex;
212 align-items: center; 221 align-items: center;
213 font-size: 32rpx; 222 font-size: 32rpx;
214 padding: 10rpx 0; 223 padding: 10rpx 0;
215 224
216 .pay-method { 225 .pay-method {
217 display: flex; 226 display: flex;
218 align-items: center; 227 align-items: center;
219 margin-left: 10rpx; 228 margin-left: 10rpx;
220 229
221 .pay-name { 230 .pay-name {
222 font-size: 32rpx; 231 font-size: 32rpx;
223 margin-left: 20rpx; 232 margin-left: 20rpx;
224 color: #333; 233 color: #333;
225 } 234 }
226 } 235 }
227 } 236 }
228 } 237 }
229 238
230 // 底部支付按钮 239 // 底部支付按钮
231 .fixed-bottom { 240 .fixed-bottom {
232 position: fixed; 241 position: fixed;
233 bottom: 0; 242 bottom: 0;
234 left: 0; 243 left: 0;
235 right: 0; 244 right: 0;
236 padding: 20rpx 30rpx 30rpx; 245 padding: 20rpx 30rpx 30rpx;
237 background-color: #fff; 246 background-color: #fff;
238 border-top: 1px solid #eee; 247 border-top: 1px solid #eee;
239 248
240 .pay-btn { 249 .pay-btn {
241 width: 100%; 250 width: 100%;
242 height: 88rpx; 251 height: 88rpx;
243 line-height: 88rpx; 252 line-height: 88rpx;
244 border-radius: 44rpx; 253 border-radius: 44rpx;
245 font-size: 34rpx; 254 font-size: 34rpx;
246 font-weight: 600; 255 font-weight: 600;
247 } 256 }
248 257
249 .red-bg { 258 .red-bg {
250 background-color: #E60012; 259 background-color: #E60012;
251 color: #fff; 260 color: #fff;
252 } 261 }
253 } 262 }
254 </style> 263 </style>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!