道馆
Showing
4 changed files
with
46 additions
and
30 deletions
| ... | @@ -497,7 +497,7 @@ const handleReIssue = async (item) => { | ... | @@ -497,7 +497,7 @@ const handleReIssue = async (item) => { |
| 497 | if (isReIssueDisabled(item)) return | 497 | if (isReIssueDisabled(item)) return |
| 498 | openConfirmPopup({ | 498 | openConfirmPopup({ |
| 499 | order: item, | 499 | order: item, |
| 500 | content: '开票后30天内仅可重开一次,是否确认重新开票?原发票将作废且无法恢复。', | 500 | content: '开票后30天内仅可换开一次,是否确认换开?原发票将作废且无法恢复。', |
| 501 | action: confirmReIssue | 501 | action: confirmReIssue |
| 502 | }) | 502 | }) |
| 503 | } | 503 | } | ... | ... |
| ... | @@ -110,18 +110,18 @@ | ... | @@ -110,18 +110,18 @@ |
| 110 | </view> | 110 | </view> |
| 111 | <view class="btn-group"> | 111 | <view class="btn-group"> |
| 112 | <template v-if="isZtxRole"> | 112 | <template v-if="isZtxRole"> |
| 113 | <button :class="{ disabled: isRefundDisabled(item) }" :disabled="isRefundDisabled(item)" class="btn btn-danger" @click.stop="handleRefund(item)">退款</button> | 113 | <button v-if="canShowRefund(item)" class="btn btn-danger" @click.stop="handleRefund(item)">退款</button> |
| 114 | </template> | 114 | </template> |
| 115 | <template v-else> | 115 | <template v-else> |
| 116 | <button :class="{ disabled: isPayDisabled(item) }" :disabled="isPayDisabled(item)" class="btn btn-pay" @click.stop="handlePay(item)">去支付</button> | 116 | <button v-if="canShowPay(item)" class="btn btn-pay" @click.stop="handlePay(item)">去支付</button> |
| 117 | <button v-if="canShowCancel(item)" :class="{ disabled: isCancelDisabled(item) }" :disabled="isCancelDisabled(item)" class="btn btn-cancel" @click.stop="handleCancel(item)">取消订单</button> | 117 | <button v-if="canShowCancel(item)" class="btn btn-cancel" @click.stop="handleCancel(item)">取消订单</button> |
| 118 | <template v-if="canShowInvoiceApply(item)"> | 118 | <template v-if="canShowInvoiceApply(item)"> |
| 119 | <button :class="{ disabled: isInvoiceDisabled(item) }" :disabled="isInvoiceDisabled(item)" class="btn btn-view-invoice" @click.stop="makeInvoiceFN(item)">申请开票</button> | 119 | <button class="btn btn-view-invoice" @click.stop="makeInvoiceFN(item)">申请开票</button> |
| 120 | </template> | 120 | </template> |
| 121 | <template v-if="hasInvoice(item)"> | 121 | <template v-if="hasInvoice(item)"> |
| 122 | <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看发票</button> | 122 | <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看发票</button> |
| 123 | </template> | 123 | </template> |
| 124 | <button v-if="canShowReIssue(item)" :class="{ disabled: isReIssueDisabled(item) }" :disabled="isReIssueDisabled(item)" class="btn btn-danger" @click.stop="handleReIssue(item)">重新开票</button> | 124 | <button v-if="canShowReIssue(item)" class="btn btn-danger" @click.stop="handleReIssue(item)">换开</button> |
| 125 | </template> | 125 | </template> |
| 126 | </view> | 126 | </view> |
| 127 | </view> | 127 | </view> |
| ... | @@ -377,12 +377,13 @@ const isLevelOrder = (item) => ['2', '3', '4'].includes(getRowType(item)) | ... | @@ -377,12 +377,13 @@ const isLevelOrder = (item) => ['2', '3', '4'].includes(getRowType(item)) |
| 377 | 377 | ||
| 378 | const canShowCancel = (item) => { | 378 | const canShowCancel = (item) => { |
| 379 | if (isPersonalOrder(item)) { | 379 | if (isPersonalOrder(item)) { |
| 380 | return String(item?.auditStatus) === '9' || String(item?.payStatus) !== '0' | 380 | return !isCancelDisabled(item) |
| 381 | } | 381 | } |
| 382 | if (isGroupOrder(item)) return String(item?.auditStatus) === '0' | 382 | return !isCancelDisabled(item) |
| 383 | return String(item?.auditStatus) === '9' | ||
| 384 | } | 383 | } |
| 385 | 384 | ||
| 385 | const canShowPay = (item) => !isPayDisabled(item) | ||
| 386 | |||
| 386 | const isPayDisabled = (item) => { | 387 | const isPayDisabled = (item) => { |
| 387 | if (isPersonalOrder(item) || isLevelOrder(item)) { | 388 | if (isPersonalOrder(item) || isLevelOrder(item)) { |
| 388 | return String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' | 389 | return String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' |
| ... | @@ -401,7 +402,7 @@ const isCancelDisabled = (item) => { | ... | @@ -401,7 +402,7 @@ const isCancelDisabled = (item) => { |
| 401 | 402 | ||
| 402 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1' | 403 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1' |
| 403 | 404 | ||
| 404 | const canShowInvoiceApply = (item) => !hasInvoice(item) | 405 | const canShowInvoiceApply = (item) => !isInvoiceDisabled(item) |
| 405 | 406 | ||
| 406 | const isInvoiceDisabled = (item) => { | 407 | const isInvoiceDisabled = (item) => { |
| 407 | if (hasInvoice(item)) return true | 408 | if (hasInvoice(item)) return true |
| ... | @@ -409,22 +410,24 @@ const isInvoiceDisabled = (item) => { | ... | @@ -409,22 +410,24 @@ const isInvoiceDisabled = (item) => { |
| 409 | return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0 | 410 | return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0 |
| 410 | } | 411 | } |
| 411 | 412 | ||
| 412 | const isWithinCalendarMonth = (dateValue) => { | 413 | const isWithinOneMonth = (dateValue) => { |
| 413 | if (!dateValue) return false | 414 | if (!dateValue) return false |
| 414 | const date = dayjs(dateValue) | 415 | const date = dayjs(dateValue) |
| 415 | if (!date.isValid()) return false | 416 | if (!date.isValid()) return false |
| 416 | return date.isSame(dayjs(), 'month') | 417 | const diffDays = dayjs().diff(date, 'day') |
| 418 | return diffDays >= 0 && diffDays <= 30 | ||
| 417 | } | 419 | } |
| 418 | 420 | ||
| 419 | const canShowReIssue = (item) => { | 421 | const canShowReIssue = (item) => { |
| 420 | if (isZtxRole.value) return false | 422 | if (isZtxRole.value) return false |
| 421 | if (isGroupOrder(item)) return String(item?.auditStatus) !== '0' | 423 | if (String(item?.payType) === '3') return false |
| 422 | return String(item?.auditStatus) !== '9' | 424 | if (isGroupOrder(item)) return String(item?.auditStatus) !== '0' && !isReIssueDisabled(item) |
| 425 | return String(item?.auditStatus) !== '9' && !isReIssueDisabled(item) | ||
| 423 | } | 426 | } |
| 424 | 427 | ||
| 425 | const isReIssueDisabled = (item) => { | 428 | const isReIssueDisabled = (item) => { |
| 426 | return String(item?.invoiceStatus) !== '1' || | 429 | return String(item?.invoiceStatus) !== '1' || |
| 427 | !isWithinCalendarMonth(item?.invoiceTime) || | 430 | !isWithinOneMonth(item?.invoiceTime) || |
| 428 | String(item?.payStatus) === '4' || | 431 | String(item?.payStatus) === '4' || |
| 429 | String(item?.redFlag) === '1' || | 432 | String(item?.redFlag) === '1' || |
| 430 | String(item?.payType) === '3' | 433 | String(item?.payType) === '3' |
| ... | @@ -432,6 +435,8 @@ const isReIssueDisabled = (item) => { | ... | @@ -432,6 +435,8 @@ const isReIssueDisabled = (item) => { |
| 432 | 435 | ||
| 433 | const isRefundDisabled = (item) => String(item?.payStatus) !== '1' || String(item?.invoiceStatus) === '1' | 436 | const isRefundDisabled = (item) => String(item?.payStatus) !== '1' || String(item?.invoiceStatus) === '1' |
| 434 | 437 | ||
| 438 | const canShowRefund = (item) => !isRefundDisabled(item) | ||
| 439 | |||
| 435 | const encodeQueryValue = (value) => encodeURIComponent(value || '') | 440 | const encodeQueryValue = (value) => encodeURIComponent(value || '') |
| 436 | 441 | ||
| 437 | const getPayName = (item) => { | 442 | const getPayName = (item) => { |
| ... | @@ -597,15 +602,22 @@ const makeInvoiceFN = (item) => { | ... | @@ -597,15 +602,22 @@ const makeInvoiceFN = (item) => { |
| 597 | needRefresh.value = true; | 602 | needRefresh.value = true; |
| 598 | // 根据tab类型决定跳转页面:个人/单位会员开非税票,级位/段位/越段考试开增值税票 | 603 | // 根据tab类型决定跳转页面:个人/单位会员开非税票,级位/段位/越段考试开增值税票 |
| 599 | let url = ''; | 604 | let url = ''; |
| 600 | const ziZhangBu = item.ziZhangBu ? '&ziZhangBu=1' : ''; | 605 | const isB2B = String(item.payType) === '3' |
| 606 | const ziZhangBu = isB2B ? '&ziZhangBu=1' : ''; | ||
| 607 | const payTypeQuery = `&payType=${encodeURIComponent(item.payType || '')}` | ||
| 608 | const isPersonalSelfPay = !isB2B && isPersonalOrder(item) && String(item.subType) === '1' | ||
| 609 | const rawInvoiceTitle = item.orderName || item.content?.orderName || item.memberName || '' | ||
| 610 | const personalInvoiceQuery = isPersonalSelfPay | ||
| 611 | ? `&personalInvoice=1&invoiceTitle=${encodeURIComponent(String(rawInvoiceTitle).split('-')[0] || '')}` | ||
| 612 | : '' | ||
| 601 | if (currentTab.value === '0' || currentTab.value === '1') { | 613 | if (currentTab.value === '0' || currentTab.value === '1') { |
| 602 | // 个人/单位会员 - 非税开票 | 614 | // 个人/单位会员 - 非税开票 |
| 603 | // 如果是對公转账(ziZhangBu有值),只能开企业发票 | 615 | // 对公转账只能开企业发票;个人自行缴纳会员费只能开个人票。 |
| 604 | 616 | ||
| 605 | url = `/pages/invoice/applyFeisui?orderId=${item.id}&amount=${item.price}${ziZhangBu}`; | 617 | url = `/pages/invoice/applyFeisui?orderId=${item.id}&amount=${item.price}${payTypeQuery}${ziZhangBu}${personalInvoiceQuery}`; |
| 606 | } else { | 618 | } else { |
| 607 | // 级位/段位/越段考试 - 增值税开票 | 619 | // 级位/段位/越段考试 - 增值税开票 |
| 608 | url = `/pages/invoice/apply?orderId=${item.id}&amount=${item.price}${ziZhangBu}`; | 620 | url = `/pages/invoice/apply?orderId=${item.id}&amount=${item.price}${payTypeQuery}${ziZhangBu}`; |
| 609 | } | 621 | } |
| 610 | uni.navigateTo({ url }); | 622 | uni.navigateTo({ url }); |
| 611 | }; | 623 | }; |
| ... | @@ -614,7 +626,7 @@ const handleReIssue = async (item) => { | ... | @@ -614,7 +626,7 @@ const handleReIssue = async (item) => { |
| 614 | if (isReIssueDisabled(item)) return | 626 | if (isReIssueDisabled(item)) return |
| 615 | openConfirmPopup({ | 627 | openConfirmPopup({ |
| 616 | order: item, | 628 | order: item, |
| 617 | content: '开票后30天内仅可重开一次,是否确认重新开票?原发票将作废且无法恢复。', | 629 | content: '开票后1个月内仅可换开一次,是否确认换开?原发票将作废且无法恢复。', |
| 618 | action: confirmReIssue | 630 | action: confirmReIssue |
| 619 | }) | 631 | }) |
| 620 | } | 632 | } |
| ... | @@ -630,7 +642,7 @@ const confirmReIssue = async (item) => { | ... | @@ -630,7 +642,7 @@ const confirmReIssue = async (item) => { |
| 630 | makeInvoiceFN({ ...item, invoiceStatus: '0' }) | 642 | makeInvoiceFN({ ...item, invoiceStatus: '0' }) |
| 631 | } catch (e) { | 643 | } catch (e) { |
| 632 | uni.hideLoading() | 644 | uni.hideLoading() |
| 633 | uni.showToast({ title: '重新开票失败', icon: 'none' }) | 645 | uni.showToast({ title: '换开失败', icon: 'none' }) |
| 634 | } | 646 | } |
| 635 | } | 647 | } |
| 636 | 648 | ... | ... |
| ... | @@ -77,7 +77,7 @@ | ... | @@ -77,7 +77,7 @@ |
| 77 | <input | 77 | <input |
| 78 | v-model="form.name" | 78 | v-model="form.name" |
| 79 | class="input" | 79 | class="input" |
| 80 | :disabled="!showPersonalType && form.invoiceType === '1'" | 80 | :disabled="!showPersonalType && form.type === '1'" |
| 81 | :placeholder="form.type === '1' ? '请输入公司全称' : '请输入发票抬头'" | 81 | :placeholder="form.type === '1' ? '请输入公司全称' : '请输入发票抬头'" |
| 82 | /> | 82 | /> |
| 83 | <text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致。</text> | 83 | <text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致。</text> |
| ... | @@ -89,7 +89,7 @@ | ... | @@ -89,7 +89,7 @@ |
| 89 | <input | 89 | <input |
| 90 | v-model="form.taxno" | 90 | v-model="form.taxno" |
| 91 | class="input" | 91 | class="input" |
| 92 | :disabled="!showPersonalType && form.invoiceType === '1'" | 92 | :disabled="!showPersonalType && form.type === '1'" |
| 93 | maxlength="20" | 93 | maxlength="20" |
| 94 | placeholder="请输入纳税人识别号" | 94 | placeholder="请输入纳税人识别号" |
| 95 | /> | 95 | /> |
| ... | @@ -177,8 +177,10 @@ onLoad((options) => { | ... | @@ -177,8 +177,10 @@ onLoad((options) => { |
| 177 | form.amount = options.amount; | 177 | form.amount = options.amount; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | // 个人订单只开普票,隐藏个人/非企业选项 | 180 | const isB2B = options.payType ? options.payType == '3' : options.ziZhangBu == '1' |
| 181 | if (options.ziZhangBu == '1') { | 181 | |
| 182 | // 对公转账只能开企业发票,单位信息自动读取且不可修改。 | ||
| 183 | if (isB2B) { | ||
| 182 | showPersonalType.value = false | 184 | showPersonalType.value = false |
| 183 | form.type = '1' | 185 | form.type = '1' |
| 184 | form.invoiceType = '1' | 186 | form.invoiceType = '1' |
| ... | @@ -187,7 +189,7 @@ console.log(333,options) | ... | @@ -187,7 +189,7 @@ console.log(333,options) |
| 187 | 189 | ||
| 188 | // 自动填充发票抬头和纳税人识别号 | 190 | // 自动填充发票抬头和纳税人识别号 |
| 189 | const memberInfo = app.globalData.memberInfo | 191 | const memberInfo = app.globalData.memberInfo |
| 190 | if (memberInfo && options.ziZhangBu == '1') { | 192 | if (memberInfo && isB2B) { |
| 191 | form.name = memberInfo.companyName || '' | 193 | form.name = memberInfo.companyName || '' |
| 192 | form.taxno = memberInfo.creditCode || '' | 194 | form.taxno = memberInfo.creditCode || '' |
| 193 | } | 195 | } |
| ... | @@ -560,4 +562,4 @@ function closeSuccessModal() { | ... | @@ -560,4 +562,4 @@ function closeSuccessModal() { |
| 560 | .success-btn::after { | 562 | .success-btn::after { |
| 561 | border: none; | 563 | border: none; |
| 562 | } | 564 | } |
| 563 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 565 | </style> | ... | ... |
| ... | @@ -134,14 +134,16 @@ onLoad((options) => { | ... | @@ -134,14 +134,16 @@ onLoad((options) => { |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | // 如果是对公转账(ziZhangBu有值),默认只能开企业发票,隐藏个人选项 | 137 | const isB2B = options.payType ? options.payType == '3' : options.ziZhangBu == '1' |
| 138 | if (options.ziZhangBu == '1') { | 138 | |
| 139 | // 对公转账默认只能开企业发票,隐藏个人选项。 | ||
| 140 | if (isB2B) { | ||
| 139 | form.type = '0' | 141 | form.type = '0' |
| 140 | showIndividualType.value = false | 142 | showIndividualType.value = false |
| 141 | } else { | 143 | } else { |
| 142 | showIndividualType.value = true | 144 | showIndividualType.value = true |
| 143 | } | 145 | } |
| 144 | if (memberInfo && options.ziZhangBu == '1') { | 146 | if (memberInfo && isB2B) { |
| 145 | form.name = memberInfo.companyName || '' | 147 | form.name = memberInfo.companyName || '' |
| 146 | form.taxno = memberInfo.creditCode || '' | 148 | form.taxno = memberInfo.creditCode || '' |
| 147 | } | 149 | } | ... | ... |
-
Please register or sign in to post a comment