3c74f831 by lttnew

支付

1 parent 6a64b49d
......@@ -1707,6 +1707,8 @@ export function payForOrder(params) {
const queryParams = []
if (params.id) queryParams.push(`id=${encodeURIComponent(params.id)}`)
if (params.payType) queryParams.push(`payType=${encodeURIComponent(params.payType)}`)
if (params.type) queryParams.push(`type=${encodeURIComponent(params.type)}`)
if (params.addresId) queryParams.push(`addresId=${encodeURIComponent(params.addresId)}`)
if (params.contactPerson) queryParams.push(`contactPerson=${encodeURIComponent(params.contactPerson)}`)
if (params.contactTel) queryParams.push(`contactTel=${encodeURIComponent(params.contactTel)}`)
if (queryParams.length > 0) {
......@@ -1962,16 +1964,15 @@ export function confirmExam(examId) {
// 提交级位考试订单
export function commitJiExam(params) {
let url = `/exam/info/commitJi/${params.id}/${params.addresId}/${params.payType}`
const queryParams = []
if (params.contactPerson) queryParams.push(`contactPerson=${params.contactPerson}`)
if (params.contactTel) queryParams.push(`contactTel=${params.contactTel}`)
if (queryParams.length > 0) {
url += '?' + queryParams.join('&')
}
const type = params.type || params.payType
const url = `/exam/info/commitJi/${params.id}/${params.addresId}/${type}`
return request({
url,
method: 'post',
params: {
...params,
type
},
showLoading: false
})
}
......
......@@ -207,7 +207,7 @@ function goDetail(item) {
function handlePay(item) {
uni.navigateTo({
url: `/level/paymentDetail?examId=${item.examId}`
url: `/level/paymentDetail?examId=${item.examId}&orderId=${item.orderId || ''}`
})
}
</script>
......
......@@ -76,8 +76,8 @@
<view class="section-title">支付方式</view>
<view class="payment-methods">
<radio-group @change="onPayTypeChange">
<label :class="{ selected: payType === '0' }" class="payment-item">
<radio :checked="payType === '0'" value="0"/>
<label :class="{ selected: payType === '2' }" class="payment-item">
<radio :checked="payType === '2'" value="2"/>
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image>
<text class="payment-name ml10">民生付</text>
<!-- <view v-if="payType === '1'" class="check-icon"></view> -->
......@@ -132,17 +132,21 @@ import config from '@/config.js'
import {minShengPay} from '@/common/pay.js';
const examId = ref('');
const orderId = ref('');
const loading = ref(true);
const examData = ref({});
const selectedAddress = ref({});
const memberInfo = ref({});
const deptInfo = ref({});
const payType = ref('0');
const payType = ref('2');
const formData = ref({
contactPerson: '',
contactTel: ''
});
// 判断是再次支付还是新订单
const isRePay = computed(() => !!orderId.value);
// 级别标签
const levelTags = computed(() => {
const tags = [];
......@@ -169,6 +173,9 @@ onLoad((options) => {
if (options.examId) {
examId.value = options.examId;
}
if (options.orderId) {
orderId.value = options.orderId;
}
// 获取全局用户信息
const app = getApp();
memberInfo.value = app.globalData.memberInfo || {};
......@@ -230,6 +237,7 @@ const goAddressManage = () => {
};
const onPayTypeChange = (e) => {
console.log('选择的支付方式:', e.detail.value)
payType.value = e.detail.value
formData.value.contactPerson = ''
formData.value.contactTel = ''
......@@ -240,6 +248,14 @@ const handleSubmit = async () => {
return uni.showToast({title: '请先选择地址', icon: 'none'});
}
console.log('支付参数:', {
isRePay: isRePay.value,
orderId: orderId.value,
examId: examId.value,
payType: payType.value,
selectedAddress: selectedAddress.value
})
// 对公转账校验
if (payType.value === '3') {
if (!formData.value.contactPerson) {
......@@ -264,13 +280,34 @@ const handleSubmit = async () => {
mask: true
})
try {
const commitRes = await api.commitJiExam({
let commitRes
if (isRePay.value) {
// 再次支付
console.log('再次支付参数:', {
id: orderId.value,
addresId: selectedAddress.value.id,
id: examId.value,
payType: payType.value,
contactPerson: formData.value.contactPerson,
contactTel: formData.value.contactTel
})
commitRes = await api.payForOrder({
id: orderId.value,
addresId: selectedAddress.value.id,
type: payType.value,
contactPerson: formData.value.contactPerson,
contactTel: formData.value.contactTel
})
console.log('再次支付响应:', commitRes)
} else {
// 新订单
commitRes = await api.commitJiExam({
addresId: selectedAddress.value.id,
id: examId.value,
type: payType.value,
contactPerson: formData.value.contactPerson,
contactTel: formData.value.contactTel
})
}
// 对公转账
if (commitRes.data.payFlag == 2) {
......
......@@ -47,7 +47,7 @@
<view class="payRow ">
<radio-group @change="onPayTypeChange">
<label class="radioItem">
<radio :checked="payType == '0'" class="custom-radio" value="0"/>
<radio :checked="payType == '2'" class="custom-radio" value="2"/>
<view class="payInfo">
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
<text>民生付</text>
......@@ -118,7 +118,7 @@ const preferentialPolicy = ref(false)
const preferentialData = ref({
name: '优惠'
})
const payType = ref('0')
const payType = ref('2')
const isPaying = ref(false)
const payName = ref('')
const assoName = ref('')
......
......@@ -34,8 +34,8 @@
<view class="section-title">选择支付方式</view>
<view class="payment-methods">
<radio-group @change="handlePayTypeChange">
<label :class="{ selected: payType === '0' }" class="payment-item">
<radio :checked="payType =='0'" value="0"/>
<label :class="{ selected: payType === '2' }" class="payment-item">
<radio :checked="payType =='2'" value="2"/>
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image>
<text class="pay-name ml10">民生付</text>
</label>
......@@ -85,7 +85,7 @@ const rangeId = ref('') // 核心业务ID
const orderId = ref('') // common/order 订单ID,用于订单列表再次支付
const payName = ref('')
const assoName = ref('')
const payType = ref('0') // 支付方式(默认0=民生付
const payType = ref('2') // 支付方式(2=民生付,3=对公转账
const payLoading = ref(false) // 支付按钮加载状态
const form = ref({
contactPerson: '',
......@@ -245,7 +245,8 @@ async function handlePay() {
// 构建请求参数
const params = {
id: orderId.value || rangeId.value,
payType: payType.value
payType: payType.value,
type: payType.value
}
if (payType.value === '3') {
params.contactPerson = form.value.contactPerson
......
......@@ -26,7 +26,7 @@
<view class="card-title">转账信息</view>
<view class="bank-row">
<text class="bank-label">收款人姓名</text>
<text class="bank-value">秦琦五洋赫公司</text>
<text class="bank-value">中国跆拳道协会</text>
<!-- <view class="copy-btn" @tap.stop="handleCopy('秦琦五洋赫公司')">复制</view> -->
</view>
<view class="bank-row">
......
......@@ -29,7 +29,7 @@
<view class="payRow ">
<radio-group @change="onPayTypeChange">
<label class="radioItem">
<radio :checked="payType === '1'" class="custom-radio" value="1"/>
<radio :checked="payType === '2'" class="custom-radio" value="2"/>
<view class="payInfo">
<image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
<text>民生付</text>
......@@ -73,7 +73,7 @@ const form = ref({
})
// 支付方式
const payType = ref('1')
const payType = ref('2')
const isPaying = ref(false)
// 费用与优惠
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!