a3ab5d87 by lttnew

去支付

1 parent 10c86415
...@@ -1705,8 +1705,10 @@ export function goPay(params) { ...@@ -1705,8 +1705,10 @@ export function goPay(params) {
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=${params.id}`) 1708 if (params.id) queryParams.push(`id=${encodeURIComponent(params.id)}`)
1709 if (params.payType) queryParams.push(`payType=${params.payType}`) 1709 if (params.payType) queryParams.push(`payType=${encodeURIComponent(params.payType)}`)
1710 if (params.contactPerson) queryParams.push(`contactPerson=${encodeURIComponent(params.contactPerson)}`)
1711 if (params.contactTel) queryParams.push(`contactTel=${encodeURIComponent(params.contactTel)}`)
1710 if (queryParams.length > 0) { 1712 if (queryParams.length > 0) {
1711 url += '?' + queryParams.join('&') 1713 url += '?' + queryParams.join('&')
1712 } 1714 }
......
1 // dev 1 // dev
2 const baseUrl_api = 'http://192.168.1.134:8787' 2 const baseUrl_api = 'http://192.168.1.222:8787'
3 // const baseUrl_api = 'http://47.98.186.233:8787' 3 // const baseUrl_api = 'http://47.98.186.233:8787'
4 // const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/' 4 // const baseUrl_api = 'https://tk001.wxjylt.com/stage-api/'
5 const loginImage_api = 'https://tk001.wxjylt.com/stage-api' 5 const loginImage_api = 'https://tk001.wxjylt.com/stage-api'
......
1 <template> 1 <template>
2 <view class="pay-order-container"> 2 <view class="pay-order-container">
3 <!-- 页面头部 -->
4 <view class="page-header">
5 <text class="title">确认并支付</text>
6 </view>
7 3
8 <!-- 订单核心信息 --> 4 <!-- 订单核心信息 -->
9 <view class="order-info"> 5 <view class="order-info">
10 <view class="info-item"> 6 <view class="info-item">
7 <text class="label">缴费单位:</text>
8 <text class="value normal">{{ displayPayName }}</text>
9 </view>
10 <view class="info-item">
11 <text class="label">所属协会:</text>
12 <text class="value normal">{{ displayAssoName }}</text>
13 </view>
14 <view class="info-item">
11 <text class="label">人数合计:</text> 15 <text class="label">人数合计:</text>
12 <text class="value red">{{ formData.all ?? 0 }}</text> 16 <text class="value red">{{ formData.all ?? 0 }}</text>
13 </view> 17 </view>
...@@ -30,13 +34,13 @@ ...@@ -30,13 +34,13 @@
30 <view class="section-title">选择支付方式</view> 34 <view class="section-title">选择支付方式</view>
31 <view class="payment-methods"> 35 <view class="payment-methods">
32 <radio-group @change="handlePayTypeChange"> 36 <radio-group @change="handlePayTypeChange">
33 <label :class="{ selected: payType === '1' }" class="payment-item"> 37 <label :class="{ selected: payType === '0' }" class="payment-item">
34 <radio :checked="payType =='0'" value="0"/> 38 <radio :checked="payType =='0'" value="0"/>
35 <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>
36 <text class="pay-name ml10">民生付</text> 40 <text class="pay-name ml10">民生付</text>
37 </label> 41 </label>
38 <label :class="{ selected: payType === '3' }" class="payment-item"> 42 <label :class="{ selected: payType === '3' }" class="payment-item">
39 <radio :checked="payType === '3'" value="1"/> 43 <radio :checked="payType === '3'" value="3"/>
40 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image> 44 <image :src="config.baseUrl_api + '/fs/static/min.png'" class="icon ml10" mode="widthFix"></image>
41 <text class="pay-name ml10">对公转账</text> 45 <text class="pay-name ml10">对公转账</text>
42 </label> 46 </label>
...@@ -65,6 +69,7 @@ ...@@ -65,6 +69,7 @@
65 69
66 <script setup> 70 <script setup>
67 import { 71 import {
72 computed,
68 ref 73 ref
69 } from 'vue' 74 } from 'vue'
70 import { 75 import {
...@@ -77,32 +82,118 @@ import {minShengPay} from "@/common/pay"; ...@@ -77,32 +82,118 @@ import {minShengPay} from "@/common/pay";
77 // 核心数据 82 // 核心数据
78 const formData = ref({}) // 订单统计数据 83 const formData = ref({}) // 订单统计数据
79 const rangeId = ref('') // 核心业务ID 84 const rangeId = ref('') // 核心业务ID
85 const orderId = ref('') // common/order 订单ID,用于订单列表再次支付
86 const payName = ref('')
87 const assoName = ref('')
80 const payType = ref('0') // 支付方式(默认0=民生付) 88 const payType = ref('0') // 支付方式(默认0=民生付)
81 const payLoading = ref(false) // 支付按钮加载状态 89 const payLoading = ref(false) // 支付按钮加载状态
82 const form = ref({ 90 const form = ref({
83 contactPerson: '', 91 contactPerson: '',
84 contactTel: '' 92 contactTel: ''
85 }) 93 })
94 const app = getApp()
95 const memberInfo = app.globalData?.memberInfo || {}
96 const deptInfo = app.globalData?.dept || app.globalData?.userInfo?.dept || {}
97
98 const pickFirst = (...values) => {
99 const value = values.find(item => item !== undefined && item !== null && String(item).trim() !== '')
100 return value ? String(value) : ''
101 }
102
103 const displayPayName = computed(() => {
104 return pickFirst(
105 memberInfo.name,
106 memberInfo.deptName,
107 deptInfo.deptName,
108 formData.value.orderName,
109 formData.value.payDeptName,
110 formData.value.payMemName,
111 formData.value.memberName,
112 payName.value,
113 formData.value.memName
114 ) || '-'
115 })
116
117 const displayAssoName = computed(() => {
118 return pickFirst(
119 deptInfo.aname,
120 deptInfo.associateName,
121 memberInfo.aname,
122 memberInfo.associateName,
123 memberInfo.assoName,
124 formData.value.assoName,
125 formData.value.associateName,
126 formData.value.associationName,
127 formData.value.aname,
128 formData.value.parentName,
129 assoName.value
130 ) || '-'
131 })
86 132
87 // 页面加载接收参数 133 // 页面加载接收参数
88 onLoad(async (options) => { 134 onLoad(async (options) => {
89 console.log('订单ID:', options.rangeId) 135 console.log('缴费范围ID:', options.rangeId, '订单ID:', options.orderId)
136 payName.value = decodeURIComponent(options.payName || '')
137 assoName.value = decodeURIComponent(options.assoName || '')
138 if (options.orderId) {
139 orderId.value = options.orderId
140 }
90 if (options.rangeId) { 141 if (options.rangeId) {
91 rangeId.value = options.rangeId 142 rangeId.value = options.rangeId
92 await getCount() 143 await getCount()
93 } 144 }
145 if (options.orderId) {
146 await getOrderDetail()
147 }
94 }) 148 })
95 149
96 async function getCount() { 150 async function getCount() {
97 try { 151 try {
98 const res = await api.getNewCountByRangeId(rangeId.value) 152 const res = await api.getNewCountByRangeId(rangeId.value)
99 formData.value = res.data || { 153 formData.value = {
154 ...formData.value,
155 ...(res.data || {
156 all: 0,
157 new: 0,
158 old: 0
159 })
160 }
161 } catch (e) {
162 formData.value = {
163 ...formData.value,
100 all: 0, 164 all: 0,
101 new: 0, 165 new: 0,
102 old: 0 166 old: 0
103 } 167 }
168 }
169 }
170
171 async function getOrderDetail() {
172 try {
173 const res = await api.orderDetail(orderId.value)
174 const data = res.data || {}
175 let content = {}
176 if (data.content) {
177 try {
178 content = typeof data.content === 'string' ? JSON.parse(data.content) : data.content
179 } catch (e) {
180 content = {}
181 }
182 }
183 formData.value = {
184 ...formData.value,
185 ...data,
186 ...content,
187 all: content.allPersonCount ?? data.allCount ?? data.all ?? 0,
188 new: content.newPersonCount ?? data.newCount ?? data.new ?? 0,
189 old: content.renewPersonCount ?? data.oldCount ?? data.old ?? 0,
190 price: data.price ?? content.price ?? 0
191 }
192 payName.value = pickFirst(data.orderName, content.orderName, data.payDeptName, data.payMemName, content.payDeptName, content.payMemName, data.memberName, content.memberName, payName.value)
193 assoName.value = pickFirst(data.assoName, data.associateName, data.associationName, data.aname, data.parentName, content.assoName, content.associateName, content.associationName, content.aname, content.parentName, assoName.value)
104 } catch (e) { 194 } catch (e) {
105 formData.value = { 195 formData.value = {
196 ...formData.value,
106 all: 0, 197 all: 0,
107 new: 0, 198 new: 0,
108 old: 0 199 old: 0
...@@ -112,7 +203,7 @@ async function getCount() { ...@@ -112,7 +203,7 @@ async function getCount() {
112 203
113 // 支付方式切换 204 // 支付方式切换
114 function handlePayTypeChange(e) { 205 function handlePayTypeChange(e) {
115 payType.value = e.detail.value == '0' ? '0' : '3' 206 payType.value = e.detail.value
116 console.log('支付方式:', payType.value) 207 console.log('支付方式:', payType.value)
117 if (payType.value === '3') { 208 if (payType.value === '3') {
118 form.value.contactPerson = '' 209 form.value.contactPerson = ''
...@@ -123,7 +214,7 @@ function handlePayTypeChange(e) { ...@@ -123,7 +214,7 @@ function handlePayTypeChange(e) {
123 // 立即支付核心逻辑 214 // 立即支付核心逻辑
124 async function handlePay() { 215 async function handlePay() {
125 // 基础校验 216 // 基础校验
126 if (!rangeId.value || rangeId.value === '-1') { 217 if ((!rangeId.value && !orderId.value) || rangeId.value === '-1') {
127 return uni.showToast({ 218 return uni.showToast({
128 title: '订单ID异常', 219 title: '订单ID异常',
129 icon: 'none' 220 icon: 'none'
...@@ -153,7 +244,7 @@ async function handlePay() { ...@@ -153,7 +244,7 @@ async function handlePay() {
153 244
154 // 构建请求参数 245 // 构建请求参数
155 const params = { 246 const params = {
156 id: rangeId.value, 247 id: orderId.value || rangeId.value,
157 payType: payType.value 248 payType: payType.value
158 } 249 }
159 if (payType.value === '3') { 250 if (payType.value === '3') {
...@@ -161,7 +252,7 @@ async function handlePay() { ...@@ -161,7 +252,7 @@ async function handlePay() {
161 params.contactTel = form.value.contactTel 252 params.contactTel = form.value.contactTel
162 } 253 }
163 254
164 const res = await api.goPay(params) 255 const res = orderId.value ? await api.payForOrder(params) : await api.goPay(params)
165 const resData = res.data 256 const resData = res.data
166 257
167 // 对公转账 - 跳转转账信息页面 258 // 对公转账 - 跳转转账信息页面
...@@ -230,6 +321,8 @@ async function handlePay() { ...@@ -230,6 +321,8 @@ async function handlePay() {
230 // 订单信息区域 321 // 订单信息区域
231 .order-info { 322 .order-info {
232 margin-bottom: 60rpx; 323 margin-bottom: 60rpx;
324 border-top: 1px solid #f5f5f5;
325 border-bottom: 1px solid #f5f5f5;
233 326
234 .info-item { 327 .info-item {
235 display: flex; 328 display: flex;
...@@ -241,11 +334,19 @@ async function handlePay() { ...@@ -241,11 +334,19 @@ async function handlePay() {
241 334
242 .label { 335 .label {
243 color: #666; 336 color: #666;
337 flex-shrink: 0;
244 } 338 }
245 339
246 .value { 340 .value {
247 font-weight: 600; 341 font-weight: 600;
248 font-size: 34rpx; 342 font-size: 34rpx;
343 text-align: right;
344 word-break: break-all;
345 }
346
347 .normal {
348 color: #111;
349 font-size: 30rpx;
249 } 350 }
250 351
251 .red { 352 .red {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 v-model="queryParams.wfCode" 17 v-model="queryParams.wfCode"
18 :input-border="false" 18 :input-border="false"
19 class="search-input" 19 class="search-input"
20 placeholder="输入订单编号/名称/单位/日期" 20 placeholder="输入缴费编号查询"
21 placeholderStyle="font-size:28rpx;color:#999" 21 placeholderStyle="font-size:28rpx;color:#999"
22 prefixIcon="search" 22 prefixIcon="search"
23 @blur="handelSearch" 23 @blur="handelSearch"
...@@ -229,31 +229,15 @@ ...@@ -229,31 +229,15 @@
229 </view> 229 </view>
230 </view> 230 </view>
231 </view> 231 </view>
232
233 <!-- 缴费方式 -->
234 <!-- <view class="pay-way-row">
235 <text class="pay-way-label">缴费方式:</text>
236 <text class="pay-way-value">{{ item.payType == '3' ? '对公转账' : '民生付' }}</text>
237 </view> -->
238
239 <!-- 按钮组:靠右展示 -->
240 <view class="btn-group"> 232 <view class="btn-group">
241 <!-- 已缴费:申请开票/已开票(需要审核通过才能开票) --> 233
242 <template v-if="item.payStatus == 1 && item.invoiceStatus != 1&& item.auditStatus == 2 &&item.price>0"> 234 <button :class="{ disabled: isPayDisabled(item) }" :disabled="isPayDisabled(item)" class="btn btn-pay" @click.stop="handlePay(item)">支付</button>
243 <button :disabled="item.invoiceStatus === 1" class="btn btn-view-invoice" 235 <button :class="{ disabled: isCancelDisabled(item) }" :disabled="isCancelDisabled(item)" class="btn btn-cancel" @click.stop="handleCancel(item)">取消订单</button>
244 @click.stop="makeInvoiceFN(item)"> 236 <template v-if="!hasInvoice(item)">
245 申请开票 237 <button :class="{ disabled: isInvoiceDisabled(item) }" :disabled="isInvoiceDisabled(item)" class="btn btn-view-invoice" @click.stop="makeInvoiceFN(item)">申请开票</button>
246 </button>
247 </template>
248 <!-- 已申请票据:查看票据 -->
249 <template v-if="item.invoiceStatus == 1">
250 <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看票据</button>
251 </template> 238 </template>
252 <!-- 未缴费:去缴费 + 取消订单 --> 239 <template v-else>
253 <template v-if="item.payStatus == 0"> 240 <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看发票</button>
254 <!-- 支付按钮:仅 auditStatus==='0' && payStatus==='0' 时可点 -->
255 <button :disabled="!(item.auditStatus == '0' && item.payStatus == 0)" class="btn btn-pay" @click.stop="handlePay(item)">去支付</button>
256 <button :disabled="item.payStatus != 0" class="btn btn-cancel" @click.stop="handleCancel(item)">取消订单</button>
257 </template> 241 </template>
258 </view> 242 </view>
259 </view> 243 </view>
...@@ -542,6 +526,46 @@ const filterType = (row) => { ...@@ -542,6 +526,46 @@ const filterType = (row) => {
542 if (row == 4) return '越位考试办理' 526 if (row == 4) return '越位考试办理'
543 } 527 }
544 528
529 const getRowType = (item) => String(item?.type ?? currentTab.value)
530
531 const isPersonalOrder = (item) => getRowType(item) === '0'
532
533 const isGroupOrder = (item) => getRowType(item) === '1'
534
535 const isPayDisabled = (item) => {
536 if (isPersonalOrder(item)) return String(item?.auditStatus) !== '9'
537 if (String(item?.payStatus) !== '0') return true
538 return String(item?.auditStatus) !== '0'
539 }
540
541 const isCancelDisabled = (item) => {
542 if (isPersonalOrder(item)) return String(item?.auditStatus) !== '9'
543 if (String(item?.payStatus) !== '0') return true
544 return false
545 }
546
547 const hasInvoice = (item) => String(item?.invoiceStatus) === '1'
548
549 const isInvoiceDisabled = (item) => {
550 if (hasInvoice(item)) return true
551 if (isPersonalOrder(item)) return String(item?.auditStatus) !== '2'
552 return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0
553 }
554
555 const encodeQueryValue = (value) => encodeURIComponent(value || '')
556
557 const getPayName = (item) => {
558 return item?.orderName || item?.content?.orderName || item?.payDeptName || item?.payMemName || item?.content?.payDeptName || item?.content?.payMemName || item?.memberName || item?.content?.memberName || ''
559 }
560
561 const getAssoName = (item) => {
562 return item?.assoName || item?.associateName || item?.associationName || item?.aname || item?.parentName || item?.content?.assoName || item?.content?.associateName || item?.content?.associationName || item?.content?.aname || item?.content?.parentName || ''
563 }
564
565 const buildPayInfoQuery = (item) => {
566 return `payName=${encodeQueryValue(getPayName(item))}&assoName=${encodeQueryValue(getAssoName(item))}`
567 }
568
545 569
546 // 数据请求核心方法 570 // 数据请求核心方法
547 const initData = async () => { 571 const initData = async () => {
...@@ -617,7 +641,7 @@ const confirmDel = async () => { ...@@ -617,7 +641,7 @@ const confirmDel = async () => {
617 641
618 const goToDetail = (item) => { 642 const goToDetail = (item) => {
619 const form = encodeURIComponent(JSON.stringify(item)) 643 const form = encodeURIComponent(JSON.stringify(item))
620 switch (currentTab.value) { 644 switch (getRowType(item)) {
621 case '1': 645 case '1':
622 uni.navigateTo({url: `/group/groupOrderDetail?form=${form}`}); 646 uni.navigateTo({url: `/group/groupOrderDetail?form=${form}`});
623 break; 647 break;
...@@ -641,13 +665,27 @@ const closeDelPopup = () => { ...@@ -641,13 +665,27 @@ const closeDelPopup = () => {
641 currentOrder.value = null; 665 currentOrder.value = null;
642 }; 666 };
643 667
644 // 去缴费 - 跳转到单位会员支付页面 668 // 去支付:个人会员订单走 payOrder,再次支付携带 common/order 的 id;单位会员订单走 goPay。
645 const handlePay = async (item) => { 669 const handlePay = async (item) => {
646 if (item.payStatus !== 0) return; 670 if (isPayDisabled(item)) return;
647 // 跳转到单位会员支付页面 671 const payInfoQuery = buildPayInfoQuery(item)
672
673 if (isPersonalOrder(item)) {
674 const rangeId = item.sourceId || item.rangId || ''
648 uni.navigateTo({ 675 uni.navigateTo({
649 url: `/myCenter/goPay?orderId=${item.id}&renewYear=${item.content?.yearCount || 1}` 676 url: `/myCenter/payOrder?orderId=${item.id}&rangeId=${rangeId}&${payInfoQuery}`
650 }); 677 });
678 return;
679 }
680
681 if (isGroupOrder(item)) {
682 uni.navigateTo({
683 url: `/myCenter/goPay?orderId=${item.id}&renewYear=${item.content?.yearCount || 1}&${payInfoQuery}`
684 });
685 return;
686 }
687
688 uni.navigateTo({url: `/pages/rank/applyDetail?examId=${item.sourceId || item.id}&type=${getRowType(item)}`});
651 }; 689 };
652 690
653 // 申请开票 691 // 申请开票
...@@ -715,7 +753,7 @@ const closeInvoiceWebview = () => { ...@@ -715,7 +753,7 @@ const closeInvoiceWebview = () => {
715 // 取消订单 753 // 取消订单
716 const handleCancel = (item) => { 754 const handleCancel = (item) => {
717 currentOrder.value = item; 755 currentOrder.value = item;
718 cancelModalContent.value = `是否确认取消订单编号为"${item.tradeNo}"的订单?`; 756 cancelModalContent.value = `是否确认取消缴费编号为"${item.wfCode}"的订单?`;
719 showCancelPopup.value = true; 757 showCancelPopup.value = true;
720 isPopupOpen.value = true; 758 isPopupOpen.value = true;
721 }; 759 };
...@@ -1205,8 +1243,12 @@ const onTabSwitch = (index, url) => { ...@@ -1205,8 +1243,12 @@ const onTabSwitch = (index, url) => {
1205 border: 1rpx solid #c30d23; 1243 border: 1rpx solid #c30d23;
1206 } 1244 }
1207 1245
1208 &:disabled { 1246 &.disabled,
1209 opacity: 0.6; 1247 &[disabled] {
1248 background: #f5f5f5 !important;
1249 color: #b8b8b8 !important;
1250 border: 1rpx solid #e1e1e1 !important;
1251 opacity: 1;
1210 pointer-events: none; 1252 pointer-events: none;
1211 } 1253 }
1212 } 1254 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!