3c74f831 by lttnew

支付

1 parent 6a64b49d
...@@ -1701,23 +1701,25 @@ export function goPay(params) { ...@@ -1701,23 +1701,25 @@ export function goPay(params) {
1701 } 1701 }
1702 1702
1703 1703
1704 // 再次支付 1704 // 再次支付
1705 export function payForOrder(params) { 1705 export function payForOrder(params) {
1706 let url = `/common/order/payForOrder/${params.id}` 1706 let url = `/common/order/payForOrder/${params.id}`
1707 const queryParams = [] 1707 const queryParams = []
1708 if (params.id) queryParams.push(`id=${encodeURIComponent(params.id)}`) 1708 if (params.id) queryParams.push(`id=${encodeURIComponent(params.id)}`)
1709 if (params.payType) queryParams.push(`payType=${encodeURIComponent(params.payType)}`) 1709 if (params.payType) queryParams.push(`payType=${encodeURIComponent(params.payType)}`)
1710 if (params.type) queryParams.push(`type=${encodeURIComponent(params.type)}`)
1711 if (params.addresId) queryParams.push(`addresId=${encodeURIComponent(params.addresId)}`)
1710 if (params.contactPerson) queryParams.push(`contactPerson=${encodeURIComponent(params.contactPerson)}`) 1712 if (params.contactPerson) queryParams.push(`contactPerson=${encodeURIComponent(params.contactPerson)}`)
1711 if (params.contactTel) queryParams.push(`contactTel=${encodeURIComponent(params.contactTel)}`) 1713 if (params.contactTel) queryParams.push(`contactTel=${encodeURIComponent(params.contactTel)}`)
1712 if (queryParams.length > 0) { 1714 if (queryParams.length > 0) {
1713 url += '?' + queryParams.join('&') 1715 url += '?' + queryParams.join('&')
1714 } 1716 }
1715 return request({ 1717 return request({
1716 url, 1718 url,
1717 method: 'post', 1719 method: 'post',
1718 showLoading: false 1720 showLoading: false
1719 }) 1721 })
1720 } 1722 }
1721 1723
1722 /** 1724 /**
1723 * 取消订单 1725 * 取消订单
...@@ -1960,21 +1962,20 @@ export function confirmExam(examId) { ...@@ -1960,21 +1962,20 @@ export function confirmExam(examId) {
1960 }) 1962 })
1961 } 1963 }
1962 1964
1963 // 提交级位考试订单 1965 // 提交级位考试订单
1964 export function commitJiExam(params) { 1966 export function commitJiExam(params) {
1965 let url = `/exam/info/commitJi/${params.id}/${params.addresId}/${params.payType}` 1967 const type = params.type || params.payType
1966 const queryParams = [] 1968 const url = `/exam/info/commitJi/${params.id}/${params.addresId}/${type}`
1967 if (params.contactPerson) queryParams.push(`contactPerson=${params.contactPerson}`) 1969 return request({
1968 if (params.contactTel) queryParams.push(`contactTel=${params.contactTel}`) 1970 url,
1969 if (queryParams.length > 0) { 1971 method: 'post',
1970 url += '?' + queryParams.join('&') 1972 params: {
1971 } 1973 ...params,
1972 return request({ 1974 type
1973 url, 1975 },
1974 method: 'post', 1976 showLoading: false
1975 showLoading: false 1977 })
1976 }) 1978 }
1977 }
1978 1979
1979 // 级位考试支付 1980 // 级位考试支付
1980 export function payJiExam(orderId) { 1981 export function payJiExam(orderId) {
......
...@@ -207,7 +207,7 @@ function goDetail(item) { ...@@ -207,7 +207,7 @@ function goDetail(item) {
207 207
208 function handlePay(item) { 208 function handlePay(item) {
209 uni.navigateTo({ 209 uni.navigateTo({
210 url: `/level/paymentDetail?examId=${item.examId}` 210 url: `/level/paymentDetail?examId=${item.examId}&orderId=${item.orderId || ''}`
211 }) 211 })
212 } 212 }
213 </script> 213 </script>
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
76 <view class="section-title">支付方式</view> 76 <view class="section-title">支付方式</view>
77 <view class="payment-methods"> 77 <view class="payment-methods">
78 <radio-group @change="onPayTypeChange"> 78 <radio-group @change="onPayTypeChange">
79 <label :class="{ selected: payType === '0' }" class="payment-item"> 79 <label :class="{ selected: payType === '2' }" class="payment-item">
80 <radio :checked="payType === '0'" value="0"/> 80 <radio :checked="payType === '2'" value="2"/>
81 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image> 81 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image>
82 <text class="payment-name ml10">民生付</text> 82 <text class="payment-name ml10">民生付</text>
83 <!-- <view v-if="payType === '1'" class="check-icon"></view> --> 83 <!-- <view v-if="payType === '1'" class="check-icon"></view> -->
...@@ -132,17 +132,21 @@ import config from '@/config.js' ...@@ -132,17 +132,21 @@ import config from '@/config.js'
132 import {minShengPay} from '@/common/pay.js'; 132 import {minShengPay} from '@/common/pay.js';
133 133
134 const examId = ref(''); 134 const examId = ref('');
135 const orderId = ref('');
135 const loading = ref(true); 136 const loading = ref(true);
136 const examData = ref({}); 137 const examData = ref({});
137 const selectedAddress = ref({}); 138 const selectedAddress = ref({});
138 const memberInfo = ref({}); 139 const memberInfo = ref({});
139 const deptInfo = ref({}); 140 const deptInfo = ref({});
140 const payType = ref('0'); 141 const payType = ref('2');
141 const formData = ref({ 142 const formData = ref({
142 contactPerson: '', 143 contactPerson: '',
143 contactTel: '' 144 contactTel: ''
144 }); 145 });
145 146
147 // 判断是再次支付还是新订单
148 const isRePay = computed(() => !!orderId.value);
149
146 // 级别标签 150 // 级别标签
147 const levelTags = computed(() => { 151 const levelTags = computed(() => {
148 const tags = []; 152 const tags = [];
...@@ -169,10 +173,13 @@ onLoad((options) => { ...@@ -169,10 +173,13 @@ onLoad((options) => {
169 if (options.examId) { 173 if (options.examId) {
170 examId.value = options.examId; 174 examId.value = options.examId;
171 } 175 }
176 if (options.orderId) {
177 orderId.value = options.orderId;
178 }
172 // 获取全局用户信息 179 // 获取全局用户信息
173 const app = getApp(); 180 const app = getApp();
174 memberInfo.value = app.globalData.memberInfo || {}; 181 memberInfo.value = app.globalData.memberInfo || {};
175 182
176 }); 183 });
177 184
178 onMounted(() => { 185 onMounted(() => {
...@@ -230,6 +237,7 @@ const goAddressManage = () => { ...@@ -230,6 +237,7 @@ const goAddressManage = () => {
230 }; 237 };
231 238
232 const onPayTypeChange = (e) => { 239 const onPayTypeChange = (e) => {
240 console.log('选择的支付方式:', e.detail.value)
233 payType.value = e.detail.value 241 payType.value = e.detail.value
234 formData.value.contactPerson = '' 242 formData.value.contactPerson = ''
235 formData.value.contactTel = '' 243 formData.value.contactTel = ''
...@@ -239,7 +247,15 @@ const handleSubmit = async () => { ...@@ -239,7 +247,15 @@ const handleSubmit = async () => {
239 if (!selectedAddress.value.id) { 247 if (!selectedAddress.value.id) {
240 return uni.showToast({title: '请先选择地址', icon: 'none'}); 248 return uni.showToast({title: '请先选择地址', icon: 'none'});
241 } 249 }
242 250
251 console.log('支付参数:', {
252 isRePay: isRePay.value,
253 orderId: orderId.value,
254 examId: examId.value,
255 payType: payType.value,
256 selectedAddress: selectedAddress.value
257 })
258
243 // 对公转账校验 259 // 对公转账校验
244 if (payType.value === '3') { 260 if (payType.value === '3') {
245 if (!formData.value.contactPerson) { 261 if (!formData.value.contactPerson) {
...@@ -264,14 +280,35 @@ const handleSubmit = async () => { ...@@ -264,14 +280,35 @@ const handleSubmit = async () => {
264 mask: true 280 mask: true
265 }) 281 })
266 try { 282 try {
267 const commitRes = await api.commitJiExam({ 283 let commitRes
268 addresId: selectedAddress.value.id, 284 if (isRePay.value) {
269 id: examId.value, 285 // 再次支付
270 payType: payType.value, 286 console.log('再次支付参数:', {
271 contactPerson: formData.value.contactPerson, 287 id: orderId.value,
272 contactTel: formData.value.contactTel 288 addresId: selectedAddress.value.id,
273 }) 289 payType: payType.value,
274 290 contactPerson: formData.value.contactPerson,
291 contactTel: formData.value.contactTel
292 })
293 commitRes = await api.payForOrder({
294 id: orderId.value,
295 addresId: selectedAddress.value.id,
296 type: payType.value,
297 contactPerson: formData.value.contactPerson,
298 contactTel: formData.value.contactTel
299 })
300 console.log('再次支付响应:', commitRes)
301 } else {
302 // 新订单
303 commitRes = await api.commitJiExam({
304 addresId: selectedAddress.value.id,
305 id: examId.value,
306 type: payType.value,
307 contactPerson: formData.value.contactPerson,
308 contactTel: formData.value.contactTel
309 })
310 }
311
275 // 对公转账 312 // 对公转账
276 if (commitRes.data.payFlag == 2) { 313 if (commitRes.data.payFlag == 2) {
277 uni.hideLoading(); 314 uni.hideLoading();
...@@ -280,7 +317,7 @@ const handleSubmit = async () => { ...@@ -280,7 +317,7 @@ const handleSubmit = async () => {
280 }); 317 });
281 return; 318 return;
282 } 319 }
283 320
284 // 民生付 321 // 民生付
285 if (commitRes.data.payResult && commitRes.data.payResult.encryptedData) { 322 if (commitRes.data.payResult && commitRes.data.payResult.encryptedData) {
286 const res = await minShengPay(commitRes.data.orderId, commitRes.data.payResult.encryptedData) 323 const res = await minShengPay(commitRes.data.orderId, commitRes.data.payResult.encryptedData)
...@@ -293,7 +330,7 @@ const handleSubmit = async () => { ...@@ -293,7 +330,7 @@ const handleSubmit = async () => {
293 }, 1500) 330 }, 1500)
294 } 331 }
295 } 332 }
296 333
297 } catch (e) { 334 } catch (e) {
298 uni.hideLoading(); 335 uni.hideLoading();
299 console.error('提交失败', e); 336 console.error('提交失败', e);
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
47 <view class="payRow "> 47 <view class="payRow ">
48 <radio-group @change="onPayTypeChange"> 48 <radio-group @change="onPayTypeChange">
49 <label class="radioItem"> 49 <label class="radioItem">
50 <radio :checked="payType == '0'" class="custom-radio" value="0"/> 50 <radio :checked="payType == '2'" class="custom-radio" value="2"/>
51 <view class="payInfo"> 51 <view class="payInfo">
52 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image> 52 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
53 <text>民生付</text> 53 <text>民生付</text>
...@@ -118,7 +118,7 @@ const preferentialPolicy = ref(false) ...@@ -118,7 +118,7 @@ const preferentialPolicy = ref(false)
118 const preferentialData = ref({ 118 const preferentialData = ref({
119 name: '优惠' 119 name: '优惠'
120 }) 120 })
121 const payType = ref('0') 121 const payType = ref('2')
122 const isPaying = ref(false) 122 const isPaying = ref(false)
123 const payName = ref('') 123 const payName = ref('')
124 const assoName = ref('') 124 const assoName = ref('')
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
34 <view class="section-title">选择支付方式</view> 34 <view class="section-title">选择支付方式</view>
35 <view class="payment-methods"> 35 <view class="payment-methods">
36 <radio-group @change="handlePayTypeChange"> 36 <radio-group @change="handlePayTypeChange">
37 <label :class="{ selected: payType === '0' }" class="payment-item"> 37 <label :class="{ selected: payType === '2' }" class="payment-item">
38 <radio :checked="payType =='0'" value="0"/> 38 <radio :checked="payType =='2'" value="2"/>
39 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image> 39 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image>
40 <text class="pay-name ml10">民生付</text> 40 <text class="pay-name ml10">民生付</text>
41 </label> 41 </label>
...@@ -85,7 +85,7 @@ const rangeId = ref('') // 核心业务ID ...@@ -85,7 +85,7 @@ const rangeId = ref('') // 核心业务ID
85 const orderId = ref('') // common/order 订单ID,用于订单列表再次支付 85 const orderId = ref('') // common/order 订单ID,用于订单列表再次支付
86 const payName = ref('') 86 const payName = ref('')
87 const assoName = ref('') 87 const assoName = ref('')
88 const payType = ref('0') // 支付方式(默认0=民生付 88 const payType = ref('2') // 支付方式(2=民生付,3=对公转账
89 const payLoading = ref(false) // 支付按钮加载状态 89 const payLoading = ref(false) // 支付按钮加载状态
90 const form = ref({ 90 const form = ref({
91 contactPerson: '', 91 contactPerson: '',
...@@ -245,7 +245,8 @@ async function handlePay() { ...@@ -245,7 +245,8 @@ async function handlePay() {
245 // 构建请求参数 245 // 构建请求参数
246 const params = { 246 const params = {
247 id: orderId.value || rangeId.value, 247 id: orderId.value || rangeId.value,
248 payType: payType.value 248 payType: payType.value,
249 type: payType.value
249 } 250 }
250 if (payType.value === '3') { 251 if (payType.value === '3') {
251 params.contactPerson = form.value.contactPerson 252 params.contactPerson = form.value.contactPerson
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 <view class="card-title">转账信息</view> 26 <view class="card-title">转账信息</view>
27 <view class="bank-row"> 27 <view class="bank-row">
28 <text class="bank-label">收款人姓名</text> 28 <text class="bank-label">收款人姓名</text>
29 <text class="bank-value">秦琦五洋赫公司</text> 29 <text class="bank-value">中国跆拳道协会</text>
30 <!-- <view class="copy-btn" @tap.stop="handleCopy('秦琦五洋赫公司')">复制</view> --> 30 <!-- <view class="copy-btn" @tap.stop="handleCopy('秦琦五洋赫公司')">复制</view> -->
31 </view> 31 </view>
32 <view class="bank-row"> 32 <view class="bank-row">
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
29 <view class="payRow "> 29 <view class="payRow ">
30 <radio-group @change="onPayTypeChange"> 30 <radio-group @change="onPayTypeChange">
31 <label class="radioItem"> 31 <label class="radioItem">
32 <radio :checked="payType === '1'" class="custom-radio" value="1"/> 32 <radio :checked="payType === '2'" class="custom-radio" value="2"/>
33 <view class="payInfo"> 33 <view class="payInfo">
34 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image> 34 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon" mode="widthFix"></image>
35 <text>民生付</text> 35 <text>民生付</text>
...@@ -73,7 +73,7 @@ const form = ref({ ...@@ -73,7 +73,7 @@ const form = ref({
73 }) 73 })
74 74
75 // 支付方式 75 // 支付方式
76 const payType = ref('1') 76 const payType = ref('2')
77 const isPaying = ref(false) 77 const isPaying = ref(false)
78 78
79 // 费用与优惠 79 // 费用与优惠
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!