支付
Showing
7 changed files
with
61 additions
and
22 deletions
| ... | @@ -1707,6 +1707,8 @@ export function payForOrder(params) { | ... | @@ -1707,6 +1707,8 @@ export function payForOrder(params) { |
| 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) { |
| ... | @@ -1962,16 +1964,15 @@ export function confirmExam(examId) { | ... | @@ -1962,16 +1964,15 @@ export function confirmExam(examId) { |
| 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}`) | ||
| 1968 | if (params.contactTel) queryParams.push(`contactTel=${params.contactTel}`) | ||
| 1969 | if (queryParams.length > 0) { | ||
| 1970 | url += '?' + queryParams.join('&') | ||
| 1971 | } | ||
| 1972 | return request({ | 1969 | return request({ |
| 1973 | url, | 1970 | url, |
| 1974 | method: 'post', | 1971 | method: 'post', |
| 1972 | params: { | ||
| 1973 | ...params, | ||
| 1974 | type | ||
| 1975 | }, | ||
| 1975 | showLoading: false | 1976 | showLoading: false |
| 1976 | }) | 1977 | }) |
| 1977 | } | 1978 | } | ... | ... |
| ... | @@ -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,6 +173,9 @@ onLoad((options) => { | ... | @@ -169,6 +173,9 @@ 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 || {}; |
| ... | @@ -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 = '' |
| ... | @@ -240,6 +248,14 @@ const handleSubmit = async () => { | ... | @@ -240,6 +248,14 @@ const handleSubmit = async () => { |
| 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,13 +280,34 @@ const handleSubmit = async () => { | ... | @@ -264,13 +280,34 @@ const handleSubmit = async () => { |
| 264 | mask: true | 280 | mask: true |
| 265 | }) | 281 | }) |
| 266 | try { | 282 | try { |
| 267 | const commitRes = await api.commitJiExam({ | 283 | let commitRes |
| 284 | if (isRePay.value) { | ||
| 285 | // 再次支付 | ||
| 286 | console.log('再次支付参数:', { | ||
| 287 | id: orderId.value, | ||
| 268 | addresId: selectedAddress.value.id, | 288 | addresId: selectedAddress.value.id, |
| 269 | id: examId.value, | ||
| 270 | payType: payType.value, | 289 | payType: payType.value, |
| 271 | contactPerson: formData.value.contactPerson, | 290 | contactPerson: formData.value.contactPerson, |
| 272 | contactTel: formData.value.contactTel | 291 | contactTel: formData.value.contactTel |
| 273 | }) | 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 | } | ||
| 274 | 311 | ||
| 275 | // 对公转账 | 312 | // 对公转账 |
| 276 | if (commitRes.data.payFlag == 2) { | 313 | if (commitRes.data.payFlag == 2) { | ... | ... |
| ... | @@ -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 | // 费用与优惠 | ... | ... |
-
Please register or sign in to post a comment