7d6c26f4 by 张猛

道馆个人,级位缴费

1 parent c1b557f6
......@@ -1429,12 +1429,11 @@ export function checkBusinessLicense(data) {
}
// 生成单位订单renewYear
export function certifiedNew(data) {
return request({
url: `/system/certifiedNew/commit`,
method: 'post',
params: data
})
export function certifiedNew(renewYear) {
return request({
url: `/system/certifiedNew/commit?renewYear=${renewYear}`,
method: 'post',
})
}
// 模拟回调
......@@ -1519,9 +1518,9 @@ export function getMyStatus() {
}
// 个人会员缴费支付
export function goPay(id) {
export function goPay(id, payType) {
return request({
url: `/person/paymentRangeNew/pay/${id}`,
url: `/person/paymentRangeNew/pay/${id}/${payType}`,
method: 'post'
})
}
......@@ -1728,11 +1727,11 @@ export function confirmExam(examId) {
}
// 提交级位考试订单
export function commitJiExam(data) {
export function commitJiExam(params) {
return request({
url: `/exam/person/commitJi`,
url: `/exam/info/commitJi/${params.id}/${params.addresId}/${params.payType}`,
method: 'post',
data
params
})
}
......
......@@ -23,7 +23,7 @@ const ERROR_MESSAGES = {
* @async
* @param {string} orderId - 订单ID,用于错误处理和取消订单
* @param {string} encryptedData - 加密数据
* @returns {Promise<void>}
* @returns {Promise<string>}
* @throws {Error} 支付过程中发生的错误
*/
async function minShengPay(orderId, encryptedData) {
......@@ -86,14 +86,13 @@ async function minShengPay(orderId, encryptedData) {
uni.hideLoading()
// 8. 调起微信支付
const [payErr] = await to(invokeWechatPayment(payParams, orderId))
const [payErr, paySuccess] = await to(invokeWechatPayment(payParams, orderId))
if (payErr) {
handlePaymentError(payErr, orderId)
}
// if (paySuccess) {
// return paySuccess
// }
if (paySuccess) {
return 'OK'
}
}
/**
......@@ -213,10 +212,10 @@ function invokeWechatPayment(payParams, orderId) {
signType: payParams.signType,
paySign: payParams.paySign,
success: (res) => {
resolve(res)
uni.showToast({
title: '支付成功',
duration: 2000,
complete: () => resolve(res)
})
},
fail: async (err) => {
......
......@@ -7,23 +7,25 @@
<text class="info-label">缴费单位</text>
<text class="info-value">{{ payName || '-' }}</text>
</view>
<view class="info-row" v-if="assoName">
<view v-if="assoName" class="info-row">
<text class="info-label">所属协会</text>
<text class="info-value">{{ assoName || '-' }}</text>
</view>
</view>
<view class="card">
<view class="yearRow">
<view class="label">缴费年限</view>
<view class="control">
<image v-if="form.renewYear > 1" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02.png'"
<image v-if="form.renewYear > 1" :src="config.loginImage_api + '/fs/static/dd_02.png'" class="icon"
mode="widthFix"
@click="minusYear"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02_g.png'"></image>
<image v-else :src="config.loginImage_api + '/fs/static/dd_02_g.png'" class="icon" mode="widthFix"></image>
<text class="num">{{ form.renewYear }}</text>
<image v-if="form.renewYear < 5" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03.png'"
<image v-if="form.renewYear < 5" :src="config.loginImage_api + '/fs/static/btn_03.png'" class="icon"
mode="widthFix"
@click="plusYear"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03_g.png'"></image>
<image v-else :src="config.loginImage_api + '/fs/static/btn_03_g.png'" class="icon" mode="widthFix"></image>
</view>
</view>
</view>
......@@ -47,7 +49,7 @@
<label class="radioItem">
<radio :checked="payType === '1'" class="custom-radio" value="1"/>
<view class="payInfo">
<image class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/min.png'"></image>
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
<text>民生付</text>
</view>
</label>
......@@ -84,6 +86,7 @@ import to from 'await-to-js'
import * as api from '@/common/api.js'
import {minShengPay} from '@/common/pay.js'
import config from '@/config.js'
const form = ref({
renewYear: 1
})
......@@ -132,20 +135,16 @@ const handelPay = async () => {
})
return
}
// 显示 loading
uni.showLoading({
title: '支付中...',
mask: true
})
if (isPaying.value) return
isPaying.value = true
// 创建订单 - 参考PC端逻辑
const [orderErr, orderRes] = await to(api.certifiedNew({
renewYear: form.value.renewYear,
type: '1',
url: ''
}))
const [orderErr, orderRes] = await to(api.certifiedNew(form.value.renewYear))
if (orderErr) {
uni.hideLoading()
isPaying.value = false
......@@ -155,7 +154,7 @@ const handelPay = async () => {
})
return
}
const data = orderRes.data
// 无需支付,直接成功
if (data.payFlag == 0) {
......@@ -168,11 +167,14 @@ const handelPay = async () => {
}
if (data.payResult && data.payResult.encryptedData) {
try {
await minShengPay(data.orderId, data.payResult.encryptedData)
// 支付成功,跳转到成功页面
uni.redirectTo({
url: `/myCenter/sucPay?orderId=${data.orderId}`
})
const res = await minShengPay(data.orderId, data.payResult.encryptedData)
if (res == 'OK') {
isPaying.value = false
// 支付成功,跳转到成功页面
uni.redirectTo({
url: `/myCenter/sucPay?orderId=${data.orderId}`
})
}
} catch (e) {
console.error('支付失败', e)
uni.hideLoading()
......@@ -185,12 +187,12 @@ const handelPay = async () => {
}
onLoad((option) => {
console.log(66,option)
console.log(66, option)
// 接收年限
form.value.renewYear = Number(option.renewYear || 1)
// 接收缴费单位和所属协会
payName.value = decodeURIComponent(option.payName || '')
console.log(77,payName.value)
console.log(77, payName.value)
assoName.value = decodeURIComponent(option.assoName || '')
// 初始化获取费用和优惠
init()
......@@ -237,7 +239,7 @@ async function getZtxDiscountPolicyApi() {
}
</script>
<style scoped lang="scss">
<style lang="scss" scoped>
/* 整体容器 */
.container {
min-height: 100vh;
......@@ -265,16 +267,16 @@ async function getZtxDiscountPolicyApi() {
align-items: center;
padding: 16rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.info-label {
font-size: 28rpx;
color: #666;
}
.info-value {
font-size: 28rpx;
color: #333;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!