道馆个人,级位缴费
Showing
6 changed files
with
44 additions
and
44 deletions
| ... | @@ -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) => { | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
| ... | @@ -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; | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment