7d6c26f4 by 张猛

道馆个人,级位缴费

1 parent c1b557f6
...@@ -1429,11 +1429,10 @@ export function checkBusinessLicense(data) { ...@@ -1429,11 +1429,10 @@ 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
1437 }) 1436 })
1438 } 1437 }
1439 1438
...@@ -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>
...@@ -15,69 +15,77 @@ ...@@ -15,69 +15,77 @@
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="pp esp">申请单位:{{ item.memberName }}</view>
24 <view class="pp esp">考级日期:{{ item.startTime?.substring(0, 16) }}{{ item.endTime?.substring(0, 16) }}
25 </view>
23 <view class="flexbox" @click="goDetail(item)"> 26 <view class="flexbox" @click="goDetail(item)">
24 <view> 27 <view>
25 申请日期 28 申请日期
26 <view>{{item.applyTime.substring(0, 10)}}</view> 29 <view>{{ item.applyTime?.substring(0, 10) }}</view>
27 </view> 30 </view>
28 <view> 31 <view>
29 考官 32 考官
30 <view>{{item.examinerNames}}</view> 33 <view>{{ item.examinerNames }}</view>
31 </view> 34 </view>
32 35
33 <view> 36 <view>
34 通过人数 37 通过人数
35 <view>{{item.pass}}</view> 38 <view>{{ item.pass }}</view>
36 </view> 39 </view>
37 </view> 40 </view>
38 <view class="func" v-if="item.status=='0'||item.status=='3'||item.status=='4'"> 41 <view v-if="item.status=='0'||item.status=='3'||item.status=='4'||item.status=='9'" class="func">
39 <button @click="handleDelete(item)">删除</button> 42 <button :disabled="item.status=='1'||item.status=='2'||item.status=='3'"
40 <button @click="editThis(item)">编辑</button> 43 @click="handleDelete(item)">删除
41 <button :disabled="!(item.totalNum?item.totalNum:(item.pass+item.noPass))" @click="handleSubmit(item)">提交审核</button> 44 </button>
45 <button :disabled="!(item.status=='0')" @click="editThis(item)">编辑</button>
46 <button :disabled="item.status!='0'&&item.status!='9'||item.totalNum==0||item.pass==0"
47 @click="handleSubmit(item)">
48 提交审核
49 </button>
42 </view> 50 </view>
43 </view> 51 </view>
44 </view> 52 </view>
45 53
46 54
47 55 <view v-if="list.length==0" class="nodata">
48 <view class="nodata" v-if="list.length==0"> 56 <image :src="config.baseUrl_api + '/fs/static/nodata.png'" mode="aspectFit"></image>
49 <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image>
50 <text>暂无数据</text> 57 <text>暂无数据</text>
51 </view> 58 </view>
52 </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();
75 const queryParams = ref({
68 // pageNum: 1, 76 // pageNum: 1,
69 // pageSize: 10 77 // pageSize: 10
70 type: '1', 78 type: '1',
71 rankStatus: '0' 79 rankStatus: '0'
72 }) 80 })
73 const navs = ref(['未提交', '审核中', '审核通过', '审核拒绝']) 81 const navs = ref(['未提交', '审核中', '审核通过', '审核拒绝'])
74 const current = ref() 82 const current = ref()
75 const list = ref([]) 83 const list = ref([])
76 const total = ref(0) 84 const total = ref(0)
77 const deptType = ref('') 85 const deptType = ref('')
78 const userType = ref('') 86 const userType = ref('')
79 const isExam = ref('1') 87 const isExam = ref('1')
80 onShow(() => { 88 onShow(() => {
81 if (app.globalData.isLogin) { 89 if (app.globalData.isLogin) {
82 init() 90 init()
83 } else { 91 } else {
...@@ -86,9 +94,9 @@ ...@@ -86,9 +94,9 @@
86 init() 94 init()
87 }; 95 };
88 } 96 }
89 }) 97 })
90 98
91 function init() { 99 function init() {
92 uni.showLoading({ 100 uni.showLoading({
93 title: '加载中', 101 title: '加载中',
94 mask: true 102 mask: true
...@@ -97,36 +105,36 @@ ...@@ -97,36 +105,36 @@
97 userType.value = app.globalData.userType 105 userType.value = app.globalData.userType
98 isExam.value = app.globalData.isExam 106 isExam.value = app.globalData.isExam
99 getList() 107 getList()
100 } 108 }
101 109
102 110
103 function getList() { 111 function getList() {
104 api.getLevelList(queryParams.value).then(res => { 112 api.getLevelList(queryParams.value).then(res => {
105 uni.hideLoading() 113 uni.hideLoading()
106 list.value = res.rows 114 list.value = res.rows
107 total.value = res.total 115 total.value = res.total
108 }) 116 })
109 } 117 }
110 118
111 function goAdd() { 119 function goAdd() {
112 let path = `/level/addApply` 120 let path = `/level/addApply`
113 uni.navigateTo({ 121 uni.navigateTo({
114 url: path 122 url: path
115 }); 123 });
116 } 124 }
117 125
118 function editThis(item) { 126 function editThis(item) {
119 let path = `/level/addApply?examId=${item.examId}` 127 let path = `/level/addApply?examId=${item.examId}`
120 uni.navigateTo({ 128 uni.navigateTo({
121 url: path 129 url: path
122 }); 130 });
123 } 131 }
124 132
125 function handleSubmit(item) { 133 function handleSubmit(item) {
126 uni.showModal({ 134 uni.showModal({
127 title: '提示', 135 title: '提示',
128 content: `请确认人员照片是否已更新`, 136 content: `请确认人员照片是否已更新`,
129 success: function(res) { 137 success: function (res) {
130 if (res.confirm) { 138 if (res.confirm) {
131 // 跳转到付款详情页面 139 // 跳转到付款详情页面
132 uni.navigateTo({ 140 uni.navigateTo({
...@@ -135,20 +143,21 @@ ...@@ -135,20 +143,21 @@
135 } 143 }
136 } 144 }
137 }) 145 })
138 } 146 }
139 function handleDelete(row) { 147
148 function handleDelete(row) {
140 uni.showModal({ 149 uni.showModal({
141 title: '提示', 150 title: '提示',
142 content: `确定删除${row.name}吗`, 151 content: `确定删除${row.name}吗`,
143 success: function(res) { 152 success: function (res) {
144 if (res.confirm) { 153 if (res.confirm) {
145 uni.showLoading({ 154 uni.showLoading({
146 title: `删除中` 155 title: `删除中`
147 }) 156 })
148 api.delLevel(row.examId).then(res=>{ 157 api.delLevel(row.examId).then(res => {
149 uni.showToast({ 158 uni.showToast({
150 title:'操作成功!', 159 title: '操作成功!',
151 icon:'none' 160 icon: 'none'
152 }) 161 })
153 uni.hideLoading() 162 uni.hideLoading()
154 getList() 163 getList()
...@@ -156,9 +165,9 @@ ...@@ -156,9 +165,9 @@
156 } 165 }
157 } 166 }
158 }) 167 })
159 } 168 }
160 169
161 function upApply(id) { 170 function upApply(id) {
162 api.submitVerity(id).then(res => { 171 api.submitVerity(id).then(res => {
163 uni.hideLoading() 172 uni.hideLoading()
164 getList() 173 getList()
...@@ -166,10 +175,10 @@ ...@@ -166,10 +175,10 @@
166 title: `提交成功` 175 title: `提交成功`
167 }) 176 })
168 }) 177 })
169 } 178 }
170 179
171 180
172 function goDetail(item) { 181 function goDetail(item) {
173 if (item.status != '0') { 182 if (item.status != '0') {
174 let path = `/level/applyDetail?examId=${item.examId}` 183 let path = `/level/applyDetail?examId=${item.examId}`
175 uni.navigateTo({ 184 uni.navigateTo({
...@@ -180,12 +189,12 @@ ...@@ -180,12 +189,12 @@
180 editThis(item) 189 editThis(item)
181 } 190 }
182 191
183 } 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;
...@@ -208,14 +217,14 @@ ...@@ -208,14 +217,14 @@
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
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
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,11 +33,11 @@ ...@@ -33,11 +33,11 @@
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>
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
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>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
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>
...@@ -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);
...@@ -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,7 +205,7 @@ const goAddressManage = () => { ...@@ -204,7 +205,7 @@ 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({
...@@ -212,55 +213,65 @@ const handleSubmit = async () => { ...@@ -212,55 +213,65 @@ const handleSubmit = async () => {
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,
220 }); 221 payType: '2'
221
222 if (commitRes.data && commitRes.data.orderId) {
223 // 有支付流程,调用支付
224 const payRes = await api.payJiExam(commitRes.data.orderId);
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 }); 222 });
246 } else { 223 if (commitRes.data && commitRes.data.payResult.encryptedData) {
247 // 无需支付,直接成功 224 const res = await minShengPay(commitRes.data.orderId, commitRes.data.payResult.encryptedData)
248 uni.showToast({ title: '提交成功', icon: 'success' }); 225 if (res == 'OK') {
226 uni.showToast({title: '支付成功', icon: 'success'});
249 setTimeout(() => { 227 setTimeout(() => {
250 uni.navigateBack(); 228 uni.navigateBack();
251 }, 1500); 229 }, 1500)
252 } 230 }
253 } else { 231 }
254 uni.hideLoading(); 232
255 uni.showToast({ title: '提交成功', icon: 'success' }); 233 // if (commitRes.data && commitRes.data.orderId) {
256 setTimeout(() => { 234 // // 有支付流程,调用支付
257 uni.navigateBack(); 235 // const payRes = await api.payJiExam(commitRes.data.orderId);
258 }, 1500); 236 // uni.hideLoading();
259 } 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 }
...@@ -573,11 +584,13 @@ const handleSubmit = async () => { ...@@ -573,11 +584,13 @@ const handleSubmit = async () => {
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,7 +7,7 @@ ...@@ -7,7 +7,7 @@
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>
...@@ -17,13 +17,15 @@ ...@@ -17,13 +17,15 @@
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 })
...@@ -138,14 +141,10 @@ const handelPay = async () => { ...@@ -138,14 +141,10 @@ const handelPay = async () => {
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
...@@ -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)
171 if (res == 'OK') {
172 isPaying.value = false
172 // 支付成功,跳转到成功页面 173 // 支付成功,跳转到成功页面
173 uni.redirectTo({ 174 uni.redirectTo({
174 url: `/myCenter/sucPay?orderId=${data.orderId}` 175 url: `/myCenter/sucPay?orderId=${data.orderId}`
175 }) 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;
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
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>
...@@ -43,36 +43,38 @@ ...@@ -43,36 +43,38 @@
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 // 页面加载接收参数
69 onLoad(async (options) => {
68 console.log('订单ID:', options.rangeId) 70 console.log('订单ID:', options.rangeId)
69 if (options.rangeId) { 71 if (options.rangeId) {
70 rangeId.value = options.rangeId 72 rangeId.value = options.rangeId
71 await getCount() 73 await getCount()
72 } 74 }
73 }) 75 })
74 76
75 async function getCount() { 77 async function getCount() {
76 try { 78 try {
77 const res = await api.getNewCountByRangeId(rangeId.value) 79 const res = await api.getNewCountByRangeId(rangeId.value)
78 formData.value = res.data || { 80 formData.value = res.data || {
...@@ -87,15 +89,15 @@ ...@@ -87,15 +89,15 @@
87 old: 0 89 old: 0
88 } 90 }
89 } 91 }
90 } 92 }
91 93
92 // 支付方式切换 94 // 支付方式切换
93 function handlePayTypeChange(e) { 95 function handlePayTypeChange(e) {
94 payType.value = e.detail.value 96 payType.value = e.detail.value
95 } 97 }
96 98
97 // 立即支付核心逻辑 99 // 立即支付核心逻辑
98 async function handlePay() { 100 async function handlePay() {
99 // 基础校验 101 // 基础校验
100 if (!rangeId.value || rangeId.value === '-1') { 102 if (!rangeId.value || rangeId.value === '-1') {
101 return uni.showToast({ 103 return uni.showToast({
...@@ -106,13 +108,20 @@ ...@@ -106,13 +108,20 @@
106 108
107 try { 109 try {
108 payLoading.value = true 110 payLoading.value = true
109 const res = await api.goPay(rangeId.value) 111 const res = await api.goPay(rangeId.value, '2')
110 112 if (res.data.payResult && res.data.payResult.encryptedData) {
111 if (res.data?.orderId) { 113 const reason = await minShengPay(res.data.orderId, res.data.payResult.encryptedData)
112 await api.pcallBack2(res.data.orderId) 114 if (reason == 'OK') {
113 uni.redirectTo({ 115 // // 支付成功,跳转到成功页面
114 url: `/myCenter/sucPay?rangeId=${rangeId.value}from=payOrder` 116 // uni.redirectTo({
115 }) 117 // url: `/myCenter/sucPay?orderId=${res.data.orderId}`
118 // })
119
120 uni.showToast({title: '支付成功', icon: 'success'});
121 setTimeout(() => {
122 uni.navigateBack();
123 }, 1500)
124 }
116 } 125 }
117 126
118 // 跳转到支付成功页 127 // 跳转到支付成功页
...@@ -126,23 +135,23 @@ ...@@ -126,23 +135,23 @@
126 } finally { 135 } finally {
127 payLoading.value = false 136 payLoading.value = false
128 } 137 }
129 } 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;
...@@ -153,10 +162,10 @@ ...@@ -153,10 +162,10 @@
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 {
...@@ -194,10 +203,10 @@ ...@@ -194,10 +203,10 @@
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 {
...@@ -225,10 +234,10 @@ ...@@ -225,10 +234,10 @@
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;
...@@ -250,5 +259,5 @@ ...@@ -250,5 +259,5 @@
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!