开票
Showing
6 changed files
with
866 additions
and
153 deletions
| ... | @@ -2106,3 +2106,38 @@ export function memberAuditList(params) { | ... | @@ -2106,3 +2106,38 @@ export function memberAuditList(params) { |
| 2106 | params: params | 2106 | params: params |
| 2107 | }) | 2107 | }) |
| 2108 | } | 2108 | } |
| 2109 | |||
| 2110 | // 不再显示考点弹框 | ||
| 2111 | export function noDisplay(data) { | ||
| 2112 | return request({ | ||
| 2113 | url: '/system/user/noDisplay', | ||
| 2114 | method: 'put', | ||
| 2115 | params: data | ||
| 2116 | }) | ||
| 2117 | } | ||
| 2118 | |||
| 2119 | // 修改手机号 | ||
| 2120 | export function editPhone(data) { | ||
| 2121 | return request({ | ||
| 2122 | url: '/system/user/editPhone', | ||
| 2123 | method: 'post', | ||
| 2124 | params: data | ||
| 2125 | }) | ||
| 2126 | } | ||
| 2127 | |||
| 2128 | // 图形验证码 | ||
| 2129 | export function getCodeImg() { | ||
| 2130 | return request({ | ||
| 2131 | url: '/captchaImage', | ||
| 2132 | method: 'get' | ||
| 2133 | }) | ||
| 2134 | } | ||
| 2135 | |||
| 2136 | // 短信验证码 | ||
| 2137 | export function getSmsCode(data) { | ||
| 2138 | return request({ | ||
| 2139 | url: '/captchaSmsWithCaptchaImageForMiniApp', | ||
| 2140 | method: 'post', | ||
| 2141 | params: data | ||
| 2142 | }) | ||
| 2143 | } | ... | ... |
| ... | @@ -106,11 +106,12 @@ function getInfo() { | ... | @@ -106,11 +106,12 @@ function getInfo() { |
| 106 | const userStore = useUserStore() | 106 | const userStore = useUserStore() |
| 107 | const app = getApp() | 107 | const app = getApp() |
| 108 | const user = res.data.user | 108 | const user = res.data.user |
| 109 | 109 | ||
| 110 | uni.setStorageSync('userName', user.userName) | 110 | uni.setStorageSync('userName', user.userName) |
| 111 | uni.removeStorageSync('webUserName') | 111 | uni.removeStorageSync('webUserName') |
| 112 | userStore.setUser(user) | 112 | userStore.setUser(user) |
| 113 | 113 | ||
| 114 | app.globalData.userInfo = user | ||
| 114 | app.globalData.deptType = user.dept.deptType | 115 | app.globalData.deptType = user.dept.deptType |
| 115 | app.globalData.genFlag = user.dept.genFlag | 116 | app.globalData.genFlag = user.dept.genFlag |
| 116 | app.globalData.changePassFlag = user.changePassFlag | 117 | app.globalData.changePassFlag = user.changePassFlag | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | <view class="exam-point-list"> | 2 | <view class="exam-point-list"> |
| 3 | <!-- 顶部申请按钮 --> | 3 | <!-- 顶部申请按钮 --> |
| 4 | <view class="apply-btn-box"> | 4 | <view class="apply-btn-box"> |
| 5 | <button class="apply-btn" :disabled="memberInfo.isPoints==0&&formInfo.auditStatus==2" @click="goApply">申请考点</button> | 5 | <button class="apply-btn" :disabled="memberInfo.isPoints==0||formInfo.auditStatus==2||formInfo.auditStatus==1" @click="goApply">申请考点</button> |
| 6 | </view> | 6 | </view> |
| 7 | 7 | ||
| 8 | <!-- 列表 --> | 8 | <!-- 列表 --> |
| ... | @@ -51,7 +51,7 @@ | ... | @@ -51,7 +51,7 @@ |
| 51 | <script setup> | 51 | <script setup> |
| 52 | import { ref } from 'vue' | 52 | import { ref } from 'vue' |
| 53 | import { onLoad, onReachBottom } from '@dcloudio/uni-app' | 53 | import { onLoad, onReachBottom } from '@dcloudio/uni-app' |
| 54 | import { getMyRecent } from '@/common/api' | 54 | import { getMyRecentExam } from '@/common/api' |
| 55 | const app = getApp() | 55 | const app = getApp() |
| 56 | const list = ref([]) | 56 | const list = ref([]) |
| 57 | const loading = ref(false) | 57 | const loading = ref(false) |
| ... | @@ -68,7 +68,7 @@ function loadData() { | ... | @@ -68,7 +68,7 @@ function loadData() { |
| 68 | if (loading.value) return | 68 | if (loading.value) return |
| 69 | loading.value = true | 69 | loading.value = true |
| 70 | 70 | ||
| 71 | getMyRecent().then(res => { | 71 | getMyRecentExam().then(res => { |
| 72 | formInfo.value = res.data | 72 | formInfo.value = res.data |
| 73 | if (res.data && res.data.auditLogs) { | 73 | if (res.data && res.data.auditLogs) { |
| 74 | try { | 74 | try { |
| ... | @@ -101,7 +101,7 @@ function goApply() { | ... | @@ -101,7 +101,7 @@ function goApply() { |
| 101 | function getStatusClass(status) { | 101 | function getStatusClass(status) { |
| 102 | return { | 102 | return { |
| 103 | 'status-1': status == 0, | 103 | 'status-1': status == 0, |
| 104 | 'status-2': status == 1, | 104 | 'status-2': status == 9, |
| 105 | 'status-3': status == 3 | 105 | 'status-3': status == 3 |
| 106 | } | 106 | } |
| 107 | } | 107 | } | ... | ... |
| ... | @@ -84,7 +84,7 @@ | ... | @@ -84,7 +84,7 @@ |
| 84 | <!-- 级位/段位考试(仅人数合计) --> | 84 | <!-- 级位/段位考试(仅人数合计) --> |
| 85 | <view v-if="currentTab === '2' || currentTab === '3' || currentTab === '4'" class="single-info"> | 85 | <view v-if="currentTab === '2' || currentTab === '3' || currentTab === '4'" class="single-info"> |
| 86 | <view class="label">人数合计</view> | 86 | <view class="label">人数合计</view> |
| 87 | <view class="value">{{ item.content.allPersonCount || 0 }}</view> | 87 | <view class="value">{{ item.content.personCount || 0 }}</view> |
| 88 | </view> | 88 | </view> |
| 89 | <view class="line" v-if="currentTab === '2' || currentTab === '3' || currentTab === '4'"></view> | 89 | <view class="line" v-if="currentTab === '2' || currentTab === '3' || currentTab === '4'"></view> |
| 90 | <view class="single-info"> | 90 | <view class="single-info"> |
| ... | @@ -111,10 +111,14 @@ | ... | @@ -111,10 +111,14 @@ |
| 111 | <view class="btn-group"> | 111 | <view class="btn-group"> |
| 112 | <!-- 已缴费:申请开票/已开票(需要审核通过才能开票) --> | 112 | <!-- 已缴费:申请开票/已开票(需要审核通过才能开票) --> |
| 113 | <template v-if="item.payStatus == 1 && item.invoiceStatus != 1&& item.auditStatus == 2"> | 113 | <template v-if="item.payStatus == 1 && item.invoiceStatus != 1&& item.auditStatus == 2"> |
| 114 | <button class="btn btn-invoice" @click="makeInvoiceFN(item)" :disabled="item.invoiceStatus === 1"> | 114 | <button class="btn btn-view-invoice" @click="makeInvoiceFN(item)" :disabled="item.invoiceStatus === 1"> |
| 115 | 开票 | 115 | 开票 |
| 116 | </button> | 116 | </button> |
| 117 | </template> | 117 | </template> |
| 118 | <!-- 已开票:查看发票 --> | ||
| 119 | <template v-if="item.invoiceStatus == 1"> | ||
| 120 | <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看发票</button> | ||
| 121 | </template> | ||
| 118 | <!-- 未缴费:去缴费 + 取消订单 --> | 122 | <!-- 未缴费:去缴费 + 取消订单 --> |
| 119 | <!-- <template v-if="item.payStatus == 0"> | 123 | <!-- <template v-if="item.payStatus == 0"> |
| 120 | <button class="btn btn-cancel" @click="handleCancel(item)">取消订单</button> | 124 | <button class="btn btn-cancel" @click="handleCancel(item)">取消订单</button> |
| ... | @@ -136,6 +140,40 @@ | ... | @@ -136,6 +140,40 @@ |
| 136 | </view> | 140 | </view> |
| 137 | </scroll-view> | 141 | </scroll-view> |
| 138 | 142 | ||
| 143 | <!-- 发票查看弹窗 --> | ||
| 144 | <view v-if="showInvoicePopup" class="invoice-popup-mask" @click="closeInvoicePopup"> | ||
| 145 | <view class="invoice-popup-content" @click.stop> | ||
| 146 | <view class="invoice-popup-header"> | ||
| 147 | <text class="invoice-popup-title">发票信息</text> | ||
| 148 | <view class="invoice-popup-close" @click="closeInvoicePopup">✕</view> | ||
| 149 | </view> | ||
| 150 | <view class="invoice-popup-body"> | ||
| 151 | |||
| 152 | |||
| 153 | <view class="invoice-info-list"> | ||
| 154 | <view class="invoice-info-row"> | ||
| 155 | <view class="invoice-info-label">发票类型</view> | ||
| 156 | <view class="invoice-type-badge" :class="{ 'vat-type': invoiceData.invoiceType == 2 }"> | ||
| 157 | {{ invoiceData.invoiceType == 1 ? '普通发票' : '增值税专用发票' }} | ||
| 158 | </view> | ||
| 159 | </view> | ||
| 160 | <view class="invoice-info-row"> | ||
| 161 | <text class="invoice-info-label">发票抬头</text> | ||
| 162 | <text class="invoice-info-value">{{ invoiceData.invoiceBuyerName || '—' }}</text> | ||
| 163 | </view> | ||
| 164 | <view class="invoice-info-row" v-if="invoiceData.invoiceBuyerTaxno"> | ||
| 165 | <text class="invoice-info-label">纳税人识别号</text> | ||
| 166 | <text class="invoice-info-value">{{ invoiceData.invoiceBuyerTaxno }}</text> | ||
| 167 | </view> | ||
| 168 | <view class="invoice-info-row"> | ||
| 169 | <text class="invoice-info-label">接收邮箱</text> | ||
| 170 | <text class="invoice-info-value">{{ invoiceData.invoicePushPhone || '—' }}</text> | ||
| 171 | </view> | ||
| 172 | </view> | ||
| 173 | </view> | ||
| 174 | </view> | ||
| 175 | </view> | ||
| 176 | |||
| 139 | <!-- 自定义删除确认弹窗 --> | 177 | <!-- 自定义删除确认弹窗 --> |
| 140 | <view v-if="showDelPopup" class="popup-mask" @touchmove.stop.prevent @click.stop="closeDelPopup"> | 178 | <view v-if="showDelPopup" class="popup-mask" @touchmove.stop.prevent @click.stop="closeDelPopup"> |
| 141 | <view class="custom-modal" @click.stop> | 179 | <view class="custom-modal" @click.stop> |
| ... | @@ -228,6 +266,8 @@ const queryParams = reactive({ | ... | @@ -228,6 +266,8 @@ const queryParams = reactive({ |
| 228 | const showDelPopup = ref(false); | 266 | const showDelPopup = ref(false); |
| 229 | const showCancelPopup = ref(false); | 267 | const showCancelPopup = ref(false); |
| 230 | const isPopupOpen = ref(false); | 268 | const isPopupOpen = ref(false); |
| 269 | const showInvoicePopup = ref(false); | ||
| 270 | const invoiceData = ref({}); | ||
| 231 | 271 | ||
| 232 | // 弹窗内容 | 272 | // 弹窗内容 |
| 233 | const delModalContent = ref(''); | 273 | const delModalContent = ref(''); |
| ... | @@ -397,6 +437,24 @@ const makeInvoiceFN = (item) => { | ... | @@ -397,6 +437,24 @@ const makeInvoiceFN = (item) => { |
| 397 | }); | 437 | }); |
| 398 | }; | 438 | }; |
| 399 | 439 | ||
| 440 | // 查看发票 | ||
| 441 | const viewInvoice = (item) => { | ||
| 442 | invoiceData.value = { | ||
| 443 | invoiceType: item.invoiceType || 1, | ||
| 444 | invoiceBuyerName: item.invoiceTitle || item.invoiceBuyerName || '—', | ||
| 445 | invoiceBuyerTaxno: item.invoiceTaxno || item.invoiceBuyerTaxno || '', | ||
| 446 | invoicePushPhone: item.invoiceEmail || item.invoicePushPhone || '—' | ||
| 447 | }; | ||
| 448 | showInvoicePopup.value = true; | ||
| 449 | isPopupOpen.value = true; | ||
| 450 | }; | ||
| 451 | |||
| 452 | // 关闭发票弹窗 | ||
| 453 | const closeInvoicePopup = () => { | ||
| 454 | showInvoicePopup.value = false; | ||
| 455 | isPopupOpen.value = false; | ||
| 456 | }; | ||
| 457 | |||
| 400 | // 取消订单 | 458 | // 取消订单 |
| 401 | const handleCancel = (item) => { | 459 | const handleCancel = (item) => { |
| 402 | currentOrder.value = item; | 460 | currentOrder.value = item; |
| ... | @@ -492,6 +550,8 @@ const closeCancelPopup = () => { | ... | @@ -492,6 +550,8 @@ const closeCancelPopup = () => { |
| 492 | padding: 20rpx; | 550 | padding: 20rpx; |
| 493 | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); | 551 | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04); |
| 494 | border-radius: 12rpx; | 552 | border-radius: 12rpx; |
| 553 | display: flex; | ||
| 554 | flex-direction: column; | ||
| 495 | // border-top: 6rpx solid transparent; | 555 | // border-top: 6rpx solid transparent; |
| 496 | // background-clip: padding-box, border-box; | 556 | // background-clip: padding-box, border-box; |
| 497 | // background-origin: padding-box, border-box; | 557 | // background-origin: padding-box, border-box; |
| ... | @@ -667,27 +727,29 @@ const closeCancelPopup = () => { | ... | @@ -667,27 +727,29 @@ const closeCancelPopup = () => { |
| 667 | // 按钮组 | 727 | // 按钮组 |
| 668 | .btn-group { | 728 | .btn-group { |
| 669 | display: flex; | 729 | display: flex; |
| 670 | justify-content: flex-end; | 730 | justify-content: flex-end; |
| 671 | align-items: center; | 731 | align-items: center; |
| 672 | gap: 16rpx; | 732 | gap: 16rpx; |
| 673 | width: 100%; | 733 | width: 100%; |
| 674 | 734 | margin-top: 20rpx; | |
| 735 | |||
| 675 | .btn { | 736 | .btn { |
| 676 | padding: 12rpx 32rpx; | 737 | // 固定宽度,所有按钮一样大 |
| 738 | width: 160rpx; | ||
| 739 | height: 70rpx; | ||
| 740 | line-height: 70rpx; | ||
| 741 | padding: 0; | ||
| 677 | border-radius: 40rpx; | 742 | border-radius: 40rpx; |
| 678 | font-size: 24rpx; | 743 | font-size: 24rpx; |
| 679 | line-height: 1.5; | ||
| 680 | white-space: nowrap; | 744 | white-space: nowrap; |
| 681 | display: inline-block; | ||
| 682 | margin: 0; | ||
| 683 | border: none; | 745 | border: none; |
| 684 | width: 80px; | ||
| 685 | background: transparent; | 746 | background: transparent; |
| 686 | 747 | text-align: center; | |
| 687 | &::after { | 748 | margin: 0; |
| 749 | &::after { | ||
| 688 | border: none; | 750 | border: none; |
| 751 | display: none; // 关键:隐藏伪元素 | ||
| 689 | } | 752 | } |
| 690 | |||
| 691 | &.btn-delete { | 753 | &.btn-delete { |
| 692 | background: #fff; | 754 | background: #fff; |
| 693 | color: #e4393c; | 755 | color: #e4393c; |
| ... | @@ -699,6 +761,12 @@ const closeCancelPopup = () => { | ... | @@ -699,6 +761,12 @@ const closeCancelPopup = () => { |
| 699 | color: #e4393c; | 761 | color: #e4393c; |
| 700 | border: 1rpx solid #e4393c; | 762 | border: 1rpx solid #e4393c; |
| 701 | } | 763 | } |
| 764 | |||
| 765 | &.btn-view-invoice { | ||
| 766 | background: linear-gradient(90deg, #FF755A, #F51722); | ||
| 767 | color: #fff; | ||
| 768 | border: none; | ||
| 769 | } | ||
| 702 | 770 | ||
| 703 | &.btn-cancel { | 771 | &.btn-cancel { |
| 704 | background: #fff; | 772 | background: #fff; |
| ... | @@ -720,7 +788,6 @@ const closeCancelPopup = () => { | ... | @@ -720,7 +788,6 @@ const closeCancelPopup = () => { |
| 720 | } | 788 | } |
| 721 | 789 | ||
| 722 | 790 | ||
| 723 | |||
| 724 | // 加载/无更多提示 | 791 | // 加载/无更多提示 |
| 725 | .loading-tip, .no-more { | 792 | .loading-tip, .no-more { |
| 726 | text-align: center; | 793 | text-align: center; |
| ... | @@ -814,4 +881,97 @@ const closeCancelPopup = () => { | ... | @@ -814,4 +881,97 @@ const closeCancelPopup = () => { |
| 814 | color: #e8341d; | 881 | color: #e8341d; |
| 815 | letter-spacing: 1rpx; | 882 | letter-spacing: 1rpx; |
| 816 | } | 883 | } |
| 884 | |||
| 885 | // 发票弹窗样式 | ||
| 886 | .invoice-popup-mask { | ||
| 887 | position: fixed; | ||
| 888 | top: 0; | ||
| 889 | left: 0; | ||
| 890 | right: 0; | ||
| 891 | bottom: 0; | ||
| 892 | background-color: rgba(0, 0, 0, 0.5); | ||
| 893 | display: flex; | ||
| 894 | align-items: center; | ||
| 895 | justify-content: center; | ||
| 896 | z-index: 999; | ||
| 897 | } | ||
| 898 | |||
| 899 | .invoice-popup-content { | ||
| 900 | width: 600rpx; | ||
| 901 | background: #fff; | ||
| 902 | border-radius: 20rpx; | ||
| 903 | overflow: hidden; | ||
| 904 | box-shadow: 0 10rpx 30rpx rgba(0, 0, 0, 0.2); | ||
| 905 | } | ||
| 906 | |||
| 907 | .invoice-popup-header { | ||
| 908 | display: flex; | ||
| 909 | justify-content: space-between; | ||
| 910 | align-items: center; | ||
| 911 | padding: 30rpx; | ||
| 912 | background: linear-gradient(135deg, #AD181F 0%, #E4393C 100%); | ||
| 913 | |||
| 914 | .invoice-popup-title { | ||
| 915 | font-size: 32rpx; | ||
| 916 | font-weight: 600; | ||
| 917 | color: #fff; | ||
| 918 | } | ||
| 919 | |||
| 920 | .invoice-popup-close { | ||
| 921 | width: 44rpx; | ||
| 922 | height: 44rpx; | ||
| 923 | display: flex; | ||
| 924 | align-items: center; | ||
| 925 | justify-content: center; | ||
| 926 | font-size: 28rpx; | ||
| 927 | color: rgba(255, 255, 255, 0.8); | ||
| 928 | } | ||
| 929 | } | ||
| 930 | |||
| 931 | .invoice-popup-body { | ||
| 932 | padding: 30rpx; | ||
| 933 | } | ||
| 934 | |||
| 935 | .invoice-type-badge { | ||
| 936 | display: inline-flex; | ||
| 937 | align-items: center; | ||
| 938 | padding: 8rpx 24rpx; | ||
| 939 | background: linear-gradient(135deg, #FF755A 0%, #F51722 100%); | ||
| 940 | color: #fff; | ||
| 941 | border-radius: 30rpx; | ||
| 942 | font-size: 24rpx; | ||
| 943 | font-weight: 500; | ||
| 944 | |||
| 945 | &.vat-type { | ||
| 946 | background: linear-gradient(135deg, #6aaaf2 0%, #178cd7 100%); | ||
| 947 | } | ||
| 948 | } | ||
| 949 | |||
| 950 | .invoice-info-list { | ||
| 951 | .invoice-info-row { | ||
| 952 | display: flex; | ||
| 953 | justify-content: space-between; | ||
| 954 | align-items: flex-start; | ||
| 955 | padding: 24rpx 0; | ||
| 956 | border-bottom: 1rpx dashed #eee; | ||
| 957 | |||
| 958 | &:last-child { | ||
| 959 | border-bottom: none; | ||
| 960 | } | ||
| 961 | |||
| 962 | .invoice-info-label { | ||
| 963 | font-size: 26rpx; | ||
| 964 | color: #999; | ||
| 965 | flex-shrink: 0; | ||
| 966 | } | ||
| 967 | |||
| 968 | .invoice-info-value { | ||
| 969 | font-size: 26rpx; | ||
| 970 | color: #333; | ||
| 971 | text-align: right; | ||
| 972 | word-break: break-all; | ||
| 973 | max-width: 340rpx; | ||
| 974 | } | ||
| 975 | } | ||
| 976 | } | ||
| 817 | </style> | 977 | </style> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <view class="loginOutIcon2" @click="goPath('/myCenter/index')"> | 7 | <view class="loginOutIcon2" @click="goPath('/myCenter/index')"> |
| 8 | <image :src="config.loginImage_api + '/fs/static/dg/icon01@3x.png'" class="switch-icon"></image> | 8 | <image :src="config.loginImage_api + '/fs/static/dg/icon01@3x.png'" class="switch-icon"></image> |
| 9 | </view> | 9 | </view> |
| 10 | <view class="welcome1" @click="goPath('/myCenter/index')"> | 10 | <view class="welcome1 mt30" @click="goPath('/myCenter/index')"> |
| 11 | <view class="flex f-a-c"> | 11 | <view class="flex f-a-c"> |
| 12 | <!-- <view> --> | 12 | <!-- <view> --> |
| 13 | <text class="title-border"></text> | 13 | <text class="title-border"></text> |
| ... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
| 16 | <!-- <image :src="config.loginImage_api + '/fs/static/dg/icon013@x.png'" class="switch-icon"></image> --> | 16 | <!-- <image :src="config.loginImage_api + '/fs/static/dg/icon013@x.png'" class="switch-icon"></image> --> |
| 17 | </view> | 17 | </view> |
| 18 | <view class="sub-title"> | 18 | <view class="sub-title"> |
| 19 | <view class="mt10">会员名称 会员所属道馆</view> | 19 | <view class="mt10">您好!{{ memberInfo.name }}</view> |
| 20 | <view class="mt10">欢迎使用中跆协会员管理系统!</view> | 20 | <view class="mt10">欢迎使用中跆协会员管理系统!</view> |
| 21 | </view> | 21 | </view> |
| 22 | </view> | 22 | </view> |
| ... | @@ -488,6 +488,58 @@ | ... | @@ -488,6 +488,58 @@ |
| 488 | </view> | 488 | </view> |
| 489 | </uni-section> | 489 | </uni-section> |
| 490 | </view> | 490 | </view> |
| 491 | |||
| 492 | <!-- 绑定手机号弹框 --> | ||
| 493 | <uni-popup ref="bindingPhonePopup" type="center" :mask-click="false"> | ||
| 494 | <view class="dialog-wrapper"> | ||
| 495 | <view class="dialog-close" @click="closeBindingPhoneDialog">✕</view> | ||
| 496 | <view class="dialog-icon"> | ||
| 497 | <uni-icons type="phone" size="48" color="#AD181F"></uni-icons> | ||
| 498 | </view> | ||
| 499 | <view class="dialog-title">绑定手机号</view> | ||
| 500 | <view class="dialog-content"> | ||
| 501 | <view class="form-item"> | ||
| 502 | <input class="form-input" v-model="bindingForm.phone" placeholder="请输入手机号" maxlength="11" type="number" /> | ||
| 503 | </view> | ||
| 504 | <view class="form-item captcha-row"> | ||
| 505 | <input class="form-input captcha-input" v-model="bindingForm.captcha" placeholder="图形验证码" maxlength="4" /> | ||
| 506 | <image class="captcha-img" :src="captchaUrl" @click="refreshCaptcha" mode="aspectFit"></image> | ||
| 507 | </view> | ||
| 508 | <view class="form-item captcha-row"> | ||
| 509 | <input class="form-input sms-input" v-model="bindingForm.code" placeholder="短信验证码" maxlength="6" type="number" /> | ||
| 510 | <button class="sms-btn" :disabled="smsCountdown > 0" @click="sendSmsCode"> | ||
| 511 | {{ smsCountdown > 0 ? smsCountdown + 's' : '获取验证码' }} | ||
| 512 | </button> | ||
| 513 | </view> | ||
| 514 | </view> | ||
| 515 | <view class="dialog-footer"> | ||
| 516 | <button class="dialog-btn cancel" @click="closeBindingPhoneDialog">取消</button> | ||
| 517 | <button class="dialog-btn confirm" @click="submitBindingPhone">确定</button> | ||
| 518 | </view> | ||
| 519 | </view> | ||
| 520 | </uni-popup> | ||
| 521 | |||
| 522 | <!-- 申请成为考点弹框 --> | ||
| 523 | <uni-popup ref="examPointPopup" type="center" :mask-click="false"> | ||
| 524 | <view class="dialog-wrapper exam-dialog"> | ||
| 525 | <view class="dialog-close" @click="closeExamPointDialog">✕</view> | ||
| 526 | <view class="dialog-icon success-icon"> | ||
| 527 | <uni-icons type="checkmark" size="48" color="#29c490"></uni-icons> | ||
| 528 | </view> | ||
| 529 | <view class="dialog-title">申请成为考点</view> | ||
| 530 | <view class="dialog-message"> | ||
| 531 | <text>恭喜您成为中国跆拳道协会团体会员!</text> | ||
| 532 | <text>根据协会考点管理办法,需成为考点单位才能进行考级业务的办理。</text> | ||
| 533 | </view> | ||
| 534 | <view class="dialog-footer"> | ||
| 535 | <button class="dialog-btn cancel" @click="closeExamPointDialog">取消</button> | ||
| 536 | <button class="dialog-btn confirm" @click="goExamPointApply">去申请</button> | ||
| 537 | </view> | ||
| 538 | <view class="no-display"> | ||
| 539 | <text @click="handleNoDisplay">不再显示</text> | ||
| 540 | </view> | ||
| 541 | </view> | ||
| 542 | </uni-popup> | ||
| 491 | </view> | 543 | </view> |
| 492 | </template> | 544 | </template> |
| 493 | 545 | ||
| ... | @@ -531,6 +583,21 @@ const newsList = ref([]) | ... | @@ -531,6 +583,21 @@ const newsList = ref([]) |
| 531 | const isInit = ref(false) | 583 | const isInit = ref(false) |
| 532 | const isBlack = ref(0) | 584 | const isBlack = ref(0) |
| 533 | 585 | ||
| 586 | // 绑定手机号弹框相关 | ||
| 587 | const bindingPhonePopup = ref(null) | ||
| 588 | const bindingForm = ref({ | ||
| 589 | phone: '', | ||
| 590 | captcha: '', | ||
| 591 | code: '', | ||
| 592 | uuid: '' | ||
| 593 | }) | ||
| 594 | const captchaUrl = ref('') | ||
| 595 | const smsCountdown = ref(0) | ||
| 596 | let smsTimer = null | ||
| 597 | |||
| 598 | // 申请考点弹框相关 | ||
| 599 | const examPointPopup = ref(null) | ||
| 600 | |||
| 534 | onShow(() => { | 601 | onShow(() => { |
| 535 | if (app.globalData.isLogin) { | 602 | if (app.globalData.isLogin) { |
| 536 | init() | 603 | init() |
| ... | @@ -722,8 +789,8 @@ function init() { | ... | @@ -722,8 +789,8 @@ function init() { |
| 722 | } | 789 | } |
| 723 | }) | 790 | }) |
| 724 | } | 791 | } |
| 725 | 792 | ||
| 726 | 793 | checkDialogs() | |
| 727 | uni.hideLoading(); | 794 | uni.hideLoading(); |
| 728 | }) | 795 | }) |
| 729 | 796 | ||
| ... | @@ -752,6 +819,116 @@ function goNewsDetail(n) { | ... | @@ -752,6 +819,116 @@ function goNewsDetail(n) { |
| 752 | url: `/pages/index/newsDetail?noteId=${n.noteId}` | 819 | url: `/pages/index/newsDetail?noteId=${n.noteId}` |
| 753 | }); | 820 | }); |
| 754 | } | 821 | } |
| 822 | |||
| 823 | // 绑定手机号弹框方法 | ||
| 824 | function refreshCaptcha() { | ||
| 825 | bindingForm.value.uuid = 'uuid-' + Date.now() | ||
| 826 | captchaUrl.value = config.baseUrl_api + '/captchaImage?uuid=' + bindingForm.value.uuid + '&t=' + Date.now() | ||
| 827 | } | ||
| 828 | |||
| 829 | function sendSmsCode() { | ||
| 830 | const phone = bindingForm.value.phone | ||
| 831 | const strTemp = /^1[2|3|4|5|6|7|8|9][0-9]{9}$/ | ||
| 832 | if (!phone) { | ||
| 833 | uni.showToast({ title: '请输入手机号', icon: 'none' }) | ||
| 834 | return | ||
| 835 | } | ||
| 836 | if (!strTemp.test(phone)) { | ||
| 837 | uni.showToast({ title: '请输入正确的手机号', icon: 'none' }) | ||
| 838 | return | ||
| 839 | } | ||
| 840 | if (!bindingForm.value.captcha) { | ||
| 841 | uni.showToast({ title: '请输入图形验证码', icon: 'none' }) | ||
| 842 | return | ||
| 843 | } | ||
| 844 | api.getSmsCode({ | ||
| 845 | uuid: bindingForm.value.uuid, | ||
| 846 | telNo: phone, | ||
| 847 | captcha: bindingForm.value.captcha | ||
| 848 | }).then(res => { | ||
| 849 | uni.showToast({ title: '发送成功', icon: 'success' }) | ||
| 850 | smsCountdown.value = 60 | ||
| 851 | smsTimer = setInterval(() => { | ||
| 852 | smsCountdown.value-- | ||
| 853 | if (smsCountdown.value <= 0) { | ||
| 854 | clearInterval(smsTimer) | ||
| 855 | smsTimer = null | ||
| 856 | } | ||
| 857 | }, 1000) | ||
| 858 | }).catch(() => { | ||
| 859 | refreshCaptcha() | ||
| 860 | }) | ||
| 861 | } | ||
| 862 | |||
| 863 | function closeBindingPhoneDialog() { | ||
| 864 | bindingPhonePopup.value.close() | ||
| 865 | } | ||
| 866 | |||
| 867 | async function submitBindingPhone() { | ||
| 868 | const { phone, captcha, code, uuid } = bindingForm.value | ||
| 869 | if (!phone) { | ||
| 870 | uni.showToast({ title: '请输入手机号', icon: 'none' }) | ||
| 871 | return | ||
| 872 | } | ||
| 873 | if (!captcha) { | ||
| 874 | uni.showToast({ title: '请输入图形验证码', icon: 'none' }) | ||
| 875 | return | ||
| 876 | } | ||
| 877 | if (!code) { | ||
| 878 | uni.showToast({ title: '请输入短信验证码', icon: 'none' }) | ||
| 879 | return | ||
| 880 | } | ||
| 881 | try { | ||
| 882 | await api.editPhone({ phone, captcha, code, uuid }) | ||
| 883 | uni.showToast({ title: '修改成功', icon: 'success' }) | ||
| 884 | closeBindingPhoneDialog() | ||
| 885 | setTimeout(() => { | ||
| 886 | uni.reLaunch({ url: '/pages/index/home' }) | ||
| 887 | }, 1500) | ||
| 888 | } catch (e) { | ||
| 889 | // 错误已由 request.js 处理 | ||
| 890 | } | ||
| 891 | } | ||
| 892 | |||
| 893 | // 申请考点弹框方法 | ||
| 894 | function closeExamPointDialog() { | ||
| 895 | examPointPopup.value.close() | ||
| 896 | } | ||
| 897 | |||
| 898 | function goExamPointApply() { | ||
| 899 | closeExamPointDialog() | ||
| 900 | uni.navigateTo({ url: '/myCenter/examPointApplyList' }) | ||
| 901 | } | ||
| 902 | |||
| 903 | async function handleNoDisplay() { | ||
| 904 | await api.noDisplay() | ||
| 905 | closeExamPointDialog() | ||
| 906 | } | ||
| 907 | |||
| 908 | // 检查弹框显示条件 | ||
| 909 | function checkDialogs() { | ||
| 910 | const user = app.globalData.userInfo || {} | ||
| 911 | const memberInfoData = app.globalData.memberInfo || {} | ||
| 912 | |||
| 913 | // 绑定手机号条件: changePassFlag='1' && activeStatus=1 && authenticationStatus=2 && phonenumber为空 && checkFlag=1 | ||
| 914 | if (app.globalData.changePassFlag === '1' && | ||
| 915 | memberInfoData.activeStatus == 1 && | ||
| 916 | app.globalData.authenticationStatus == 2 && | ||
| 917 | !user.phonenumber && | ||
| 918 | user.checkFlag == 1) { | ||
| 919 | refreshCaptcha() | ||
| 920 | bindingPhonePopup.value.open() | ||
| 921 | } | ||
| 922 | |||
| 923 | // 申请考点条件: activeStatus=1 && authenticationStatus=2 && hintFlag=1 && deptType=6 && isPoints=1 | ||
| 924 | if (memberInfoData.activeStatus == 1 && | ||
| 925 | app.globalData.authenticationStatus == 2 && | ||
| 926 | user.hintFlag == 1 && | ||
| 927 | app.globalData.deptType == 6 && | ||
| 928 | memberInfoData.isPoints == 1) { | ||
| 929 | examPointPopup.value.open() | ||
| 930 | } | ||
| 931 | } | ||
| 755 | </script> | 932 | </script> |
| 756 | <style lang="scss" scoped> | 933 | <style lang="scss" scoped> |
| 757 | :deep(.uni-section) { | 934 | :deep(.uni-section) { |
| ... | @@ -1021,3 +1198,154 @@ function goNewsDetail(n) { | ... | @@ -1021,3 +1198,154 @@ function goNewsDetail(n) { |
| 1021 | } | 1198 | } |
| 1022 | </style> | 1199 | </style> |
| 1023 | 1200 | ||
| 1201 | <style lang="scss" scoped> | ||
| 1202 | /* 弹框样式 */ | ||
| 1203 | .dialog-wrapper { | ||
| 1204 | width: 600rpx; | ||
| 1205 | background: linear-gradient(135deg, #fff 0%, #f8f9fc 100%); | ||
| 1206 | border-radius: 24rpx; | ||
| 1207 | padding: 48rpx 40rpx 40rpx; | ||
| 1208 | position: relative; | ||
| 1209 | box-sizing: border-box; | ||
| 1210 | } | ||
| 1211 | |||
| 1212 | .dialog-close { | ||
| 1213 | position: absolute; | ||
| 1214 | top: 20rpx; | ||
| 1215 | right: 24rpx; | ||
| 1216 | font-size: 32rpx; | ||
| 1217 | color: #999; | ||
| 1218 | z-index: 10; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | .dialog-icon { | ||
| 1222 | text-align: center; | ||
| 1223 | margin-bottom: 24rpx; | ||
| 1224 | } | ||
| 1225 | |||
| 1226 | .dialog-title { | ||
| 1227 | font-size: 40rpx; | ||
| 1228 | font-weight: 600; | ||
| 1229 | color: #303133; | ||
| 1230 | text-align: center; | ||
| 1231 | margin-bottom: 24rpx; | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | .dialog-content { | ||
| 1235 | padding: 0 10rpx; | ||
| 1236 | margin-bottom: 32rpx; | ||
| 1237 | } | ||
| 1238 | |||
| 1239 | .form-item { | ||
| 1240 | margin-bottom: 24rpx; | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | .form-input { | ||
| 1244 | height: 80rpx; | ||
| 1245 | background: #f5f7fa; | ||
| 1246 | border-radius: 16rpx; | ||
| 1247 | padding: 0 24rpx; | ||
| 1248 | font-size: 28rpx; | ||
| 1249 | width: 100%; | ||
| 1250 | box-sizing: border-box; | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | .captcha-row { | ||
| 1254 | display: flex; | ||
| 1255 | align-items: center; | ||
| 1256 | gap: 16rpx; | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | .captcha-input { | ||
| 1260 | flex: 1; | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | .captcha-img { | ||
| 1264 | width: 180rpx; | ||
| 1265 | height: 72rpx; | ||
| 1266 | border-radius: 12rpx; | ||
| 1267 | background: #f5f7fa; | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | .sms-input { | ||
| 1271 | flex: 1; | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | .sms-btn { | ||
| 1275 | width: 200rpx; | ||
| 1276 | height: 72rpx; | ||
| 1277 | line-height: 72rpx; | ||
| 1278 | background: #AD181F; | ||
| 1279 | color: #fff; | ||
| 1280 | font-size: 24rpx; | ||
| 1281 | border-radius: 16rpx; | ||
| 1282 | padding: 0; | ||
| 1283 | margin: 0; | ||
| 1284 | &::after { | ||
| 1285 | border: none; | ||
| 1286 | } | ||
| 1287 | } | ||
| 1288 | |||
| 1289 | .sms-btn[disabled] { | ||
| 1290 | background: #c0c4cc; | ||
| 1291 | color: #fff; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | .dialog-footer { | ||
| 1295 | display: flex; | ||
| 1296 | justify-content: center; | ||
| 1297 | gap: 40rpx; | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | .dialog-btn { | ||
| 1301 | width: 220rpx; | ||
| 1302 | height: 80rpx; | ||
| 1303 | line-height: 80rpx; | ||
| 1304 | border-radius: 40rpx; | ||
| 1305 | font-size: 28rpx; | ||
| 1306 | font-weight: 500; | ||
| 1307 | padding: 0; | ||
| 1308 | margin: 0; | ||
| 1309 | &::after { | ||
| 1310 | border: none; | ||
| 1311 | } | ||
| 1312 | } | ||
| 1313 | |||
| 1314 | .dialog-btn.cancel { | ||
| 1315 | background: #f5f7fa; | ||
| 1316 | color: #606266; | ||
| 1317 | border: 1rpx solid #dcdfe6; | ||
| 1318 | } | ||
| 1319 | |||
| 1320 | .dialog-btn.confirm { | ||
| 1321 | background: #AD181F; | ||
| 1322 | color: #fff; | ||
| 1323 | box-shadow: 0 4rpx 16rpx rgba(21, 97, 203, 0.3); | ||
| 1324 | } | ||
| 1325 | |||
| 1326 | /* 考点弹框样式 */ | ||
| 1327 | .exam-dialog { | ||
| 1328 | .dialog-message { | ||
| 1329 | font-size: 28rpx; | ||
| 1330 | color: #606266; | ||
| 1331 | line-height: 1.8; | ||
| 1332 | text-align: left; | ||
| 1333 | margin-bottom: 40rpx; | ||
| 1334 | display: flex; | ||
| 1335 | flex-direction: column; | ||
| 1336 | gap: 12rpx; | ||
| 1337 | } | ||
| 1338 | } | ||
| 1339 | |||
| 1340 | .no-display { | ||
| 1341 | text-align: right; | ||
| 1342 | margin-top: 24rpx; | ||
| 1343 | font-size: 24rpx; | ||
| 1344 | color: #909399; | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | .success-icon { | ||
| 1348 | color: #29c490; | ||
| 1349 | } | ||
| 1350 | </style> | ||
| 1351 | ... | ... |
| ... | @@ -4,61 +4,94 @@ | ... | @@ -4,61 +4,94 @@ |
| 4 | <!-- 发票类型 --> | 4 | <!-- 发票类型 --> |
| 5 | <view class="form-item"> | 5 | <view class="form-item"> |
| 6 | <text class="label">发票类型</text> | 6 | <text class="label">发票类型</text> |
| 7 | <text class="value">{{ form.invoiceType === '2' ? '普通发票(企业)' : '普通发票(个人)' }}</text> | 7 | <view class="type-select"> |
| 8 | <view | ||
| 9 | class="type-option" | ||
| 10 | :class="{ active: form.invoiceType === '1' }" | ||
| 11 | @click="form.invoiceType = '1'" | ||
| 12 | > | ||
| 13 | <view class="type-icon">个</view> | ||
| 14 | <view class="type-info"> | ||
| 15 | <text class="type-name">普通发票</text> | ||
| 16 | <text class="type-desc">个人/非企业单位</text> | ||
| 17 | </view> | ||
| 18 | </view> | ||
| 19 | <view | ||
| 20 | class="type-option" | ||
| 21 | :class="{ active: form.invoiceType === '2' }" | ||
| 22 | @click="form.invoiceType = '2'" | ||
| 23 | > | ||
| 24 | <view class="type-icon enterprise">企</view> | ||
| 25 | <view class="type-info"> | ||
| 26 | <text class="type-name">增值税发票</text> | ||
| 27 | <text class="type-desc">企业/可抵扣</text> | ||
| 28 | </view> | ||
| 29 | </view> | ||
| 30 | </view> | ||
| 8 | </view> | 31 | </view> |
| 9 | 32 | ||
| 10 | <!-- 发票抬头 --> | 33 | <!-- 发票抬头 --> |
| 11 | <view class="form-item"> | 34 | <view class="form-item column"> |
| 12 | <text class="label">发票抬头</text> | 35 | <text class="label">发票抬头</text> |
| 13 | <input | 36 | <input |
| 14 | class="input" | 37 | class="input" |
| 15 | v-model="form.name" | 38 | v-model="form.name" |
| 16 | placeholder="请输入公司全称或个人姓名" | 39 | placeholder="请输入公司全称或个人姓名" |
| 17 | placeholder-style="color: #999;" | ||
| 18 | /> | 40 | /> |
| 41 | <text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致。</text> | ||
| 19 | </view> | 42 | </view> |
| 20 | 43 | ||
| 21 | <!-- 纳税人识别号(企业才显示) --> | 44 | <!-- 纳税人识别号(企业才显示) --> |
| 22 | <view class="form-item" v-if="form.invoiceType === '2'"> | 45 | <view class="form-item column" v-if="form.invoiceType === '2'"> |
| 23 | <text class="label">纳税人识别号</text> | 46 | <text class="label">纳税人识别号</text> |
| 24 | <input | 47 | <input |
| 25 | class="input" | 48 | class="input" |
| 26 | v-model="form.taxno" | 49 | v-model="form.taxno" |
| 27 | placeholder="请输入纳税人识别号" | 50 | placeholder="请输入纳税人识别号" |
| 28 | placeholder-style="color: #999;" | ||
| 29 | maxlength="20" | 51 | maxlength="20" |
| 30 | /> | 52 | /> |
| 31 | </view> | 53 | <text class="hint">企业税务登记证上的号码,一般为 15、18 或 20 位</text> |
| 32 | |||
| 33 | <!-- 开票金额 --> | ||
| 34 | <view class="form-item"> | ||
| 35 | <text class="label">开票金额</text> | ||
| 36 | <text class="amount">¥ {{ (Number(form.amount)).toFixed(2) }}</text> | ||
| 37 | </view> | 54 | </view> |
| 38 | 55 | ||
| 39 | <!-- 接收方式 --> | 56 | <!-- 接收方式 --> |
| 40 | <view class="form-item"> | 57 | <view class="form-item"> |
| 41 | <text class="label">接收方式</text> | 58 | <text class="label">接收方式</text> |
| 42 | <text class="value">电子邮箱</text> | 59 | <view class="method-select"> |
| 60 | <view class="method-option active"> | ||
| 61 | <view class="method-icon">邮</view> | ||
| 62 | <view class="method-info"> | ||
| 63 | <text class="method-name">电子发票</text> | ||
| 64 | <text class="method-desc">发送至邮箱</text> | ||
| 65 | </view> | ||
| 66 | <view class="method-tag">推荐</view> | ||
| 67 | </view> | ||
| 68 | </view> | ||
| 43 | </view> | 69 | </view> |
| 44 | 70 | ||
| 71 | <!-- 开票金额 --> | ||
| 72 | <!-- <view class="form-item"> | ||
| 73 | <text class="label">开票金额</text> | ||
| 74 | <text class="amount">¥ {{ (Number(form.amount)).toFixed(2) }}</text> | ||
| 75 | </view> --> | ||
| 76 | |||
| 45 | <!-- 接收邮箱 --> | 77 | <!-- 接收邮箱 --> |
| 46 | <view class="form-item"> | 78 | <view class="form-item column"> |
| 47 | <text class="label">接收邮箱</text> | 79 | <text class="label">接收邮箱号码</text> |
| 48 | <input | 80 | <input |
| 49 | class="input" | 81 | class="input" |
| 50 | v-model="form.email" | 82 | v-model="form.phone" |
| 51 | placeholder="请输入接收发票的邮箱(必填)" | 83 | placeholder="请输入接收发票的邮箱号码" |
| 52 | placeholder-style="color: #999;" | 84 | type="text" |
| 53 | /> | 85 | /> |
| 86 | <text class="hint">电子发票将在 3-5 个工作日内发送至该邮箱</text> | ||
| 54 | </view> | 87 | </view> |
| 55 | </view> | 88 | </view> |
| 56 | 89 | ||
| 57 | <view class="hint">电子发票将在3-5个工作日内发送至该邮箱</view> | ||
| 58 | |||
| 59 | <!-- 提交按钮 --> | 90 | <!-- 提交按钮 --> |
| 60 | <view class="btn-wrap" @click="submitInvoice"> | 91 | <view class="btn-wrap"> |
| 61 | <view class="submit-btn">提交申请</view> | 92 | <view class="submit-btn" :class="{ loading: submitting }" @click="handleSubmit"> |
| 93 | {{ submitting ? '提交中...' : '提交申请' }} | ||
| 94 | </view> | ||
| 62 | </view> | 95 | </view> |
| 63 | </view> | 96 | </view> |
| 64 | </template> | 97 | </template> |
| ... | @@ -66,14 +99,17 @@ | ... | @@ -66,14 +99,17 @@ |
| 66 | <script setup> | 99 | <script setup> |
| 67 | import { ref, reactive } from 'vue'; | 100 | import { ref, reactive } from 'vue'; |
| 68 | import { onLoad } from '@dcloudio/uni-app'; | 101 | import { onLoad } from '@dcloudio/uni-app'; |
| 69 | import { outputInvoiceNo } from '@/common/api.js'; // 与PC端接口一致 | 102 | import { outputInvoiceNo } from '@/common/api.js'; |
| 103 | |||
| 104 | const submitting = ref(false); | ||
| 70 | 105 | ||
| 71 | // 表单数据(与PC端字段完全对齐) | 106 | // 表单数据(与PC端字段完全对齐) |
| 72 | const form = reactive({ | 107 | const form = reactive({ |
| 73 | invoiceType: '1', // 1=个人 2=企业 | 108 | invoiceType: '1', // 1=个人 2=企业 |
| 109 | deliveryMethod: '1', // 接收方式:1=电子发票 | ||
| 74 | name: '', // 发票抬头 | 110 | name: '', // 发票抬头 |
| 75 | taxno: '', // 纳税人识别号 | 111 | taxno: '', // 纳税人识别号 |
| 76 | email: '', // 邮箱 | 112 | phone: '', // 邮箱 |
| 77 | amount: 0, // 金额 | 113 | amount: 0, // 金额 |
| 78 | id: '' // 订单ID | 114 | id: '' // 订单ID |
| 79 | }); | 115 | }); |
| ... | @@ -81,73 +117,76 @@ const form = reactive({ | ... | @@ -81,73 +117,76 @@ const form = reactive({ |
| 81 | // 页面加载(接收PC端传来的参数) | 117 | // 页面加载(接收PC端传来的参数) |
| 82 | onLoad((options) => { | 118 | onLoad((options) => { |
| 83 | if (options.id || options.orderId) { | 119 | if (options.id || options.orderId) { |
| 84 | form.id = options.id|| options.orderId; | 120 | form.id = options.id || options.orderId; |
| 85 | form.amount = options.amount; | 121 | form.amount = options.amount; |
| 86 | console.log(33,form.amount); | ||
| 87 | } | 122 | } |
| 88 | if (options.invoiceType) { | 123 | if (options.invoiceType) { |
| 89 | form.invoiceType = options.invoiceType; | 124 | form.invoiceType = options.invoiceType; |
| 90 | } | 125 | } |
| 91 | // getOrderInfo(); | ||
| 92 | }); | 126 | }); |
| 93 | 127 | ||
| 94 | // 获取订单金额 | 128 | // 表单验证 |
| 95 | // const getOrderInfo = async () => { | 129 | const validateForm = () => { |
| 96 | // try { | 130 | // 发票抬头校验 |
| 97 | // // 这里替换成你真实获取订单金额的接口 | ||
| 98 | // = 1500; | ||
| 99 | // } catch (error) { | ||
| 100 | // uni.showToast({ title: '获取订单信息失败', icon: 'none' }); | ||
| 101 | // } | ||
| 102 | // }; | ||
| 103 | |||
| 104 | // 提交发票申请(与PC逻辑完全一致) | ||
| 105 | const submitInvoice = async () => { | ||
| 106 | // 1. PC端逻辑:个人不允许开票 | ||
| 107 | if (form.invoiceType === '1') { | ||
| 108 | return uni.showToast({ title: '暂不支持个人开票', icon: 'none' }); | ||
| 109 | } | ||
| 110 | |||
| 111 | // 2. 抬头校验 | ||
| 112 | if (!form.name) { | 131 | if (!form.name) { |
| 113 | return uni.showToast({ title: '请输入发票抬头', icon: 'none' }); | 132 | uni.showToast({ title: '请输入发票抬头', icon: 'none' }); |
| 133 | return false; | ||
| 134 | } | ||
| 135 | if (form.name.length < 2 || form.name.length > 100) { | ||
| 136 | uni.showToast({ title: '发票抬头长度在2-100个字符之间', icon: 'none' }); | ||
| 137 | return false; | ||
| 114 | } | 138 | } |
| 115 | 139 | ||
| 116 | // 3. 企业必须填纳税人识别号 | 140 | // 企业必须填纳税人识别号 |
| 117 | if (form.invoiceType === '2' && !form.taxno) { | 141 | if (form.invoiceType === '2' && !form.taxno) { |
| 118 | return uni.showToast({ title: '请输入纳税人识别号', icon: 'none' }); | 142 | uni.showToast({ title: '请输入纳税人识别号', icon: 'none' }); |
| 143 | return false; | ||
| 119 | } | 144 | } |
| 120 | 145 | ||
| 121 | // 4. 纳税人识别号格式校验(同PC) | 146 | // 纳税人识别号格式校验(同PC) |
| 122 | const taxReg = /^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/; | 147 | if (form.invoiceType === '2') { |
| 123 | if (form.invoiceType === '2' && !taxReg.test(form.taxno)) { | 148 | const taxReg = /^[A-Z0-9]{15}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/; |
| 124 | return uni.showToast({ title: '纳税人识别号格式不正确', icon: 'none' }); | 149 | if (!taxReg.test(form.taxno)) { |
| 150 | uni.showToast({ title: '纳税人识别号格式不正确', icon: 'none' }); | ||
| 151 | return false; | ||
| 152 | } | ||
| 125 | } | 153 | } |
| 126 | 154 | ||
| 127 | // 5. 邮箱校验 | 155 | // 邮箱校验 |
| 128 | const emailReg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; | 156 | if (!form.phone) { |
| 129 | if (!form.email) { | 157 | uni.showToast({ title: '请输入接收邮箱', icon: 'none' }); |
| 130 | return uni.showToast({ title: '请输入接收邮箱', icon: 'none' }); | 158 | return false; |
| 131 | } | 159 | } |
| 132 | if (!emailReg.test(form.email)) { | 160 | const phoneReg = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; |
| 133 | return uni.showToast({ title: '请输入正确的邮箱地址', icon: 'none' }); | 161 | if (!phoneReg.test(form.phone)) { |
| 162 | uni.showToast({ title: '请输入正确的邮箱地址', icon: 'none' }); | ||
| 163 | return false; | ||
| 134 | } | 164 | } |
| 135 | 165 | ||
| 166 | return true; | ||
| 167 | }; | ||
| 168 | |||
| 169 | // 提交发票申请(与PC逻辑完全一致) | ||
| 170 | const handleSubmit = async () => { | ||
| 171 | if (submitting.value) return; | ||
| 172 | if (!validateForm()) return; | ||
| 173 | |||
| 174 | submitting.value = true; | ||
| 175 | console.log('提交表单数据:', form); | ||
| 136 | try { | 176 | try { |
| 137 | // 调用PC端同一个接口:outputInvoiceNo | ||
| 138 | await outputInvoiceNo(form); | 177 | await outputInvoiceNo(form); |
| 139 | |||
| 140 | uni.showToast({ | 178 | uni.showToast({ |
| 141 | title: '发票申请提交成功!', | 179 | title: '开票申请提交成功', |
| 142 | icon: 'success', | 180 | icon: 'success' |
| 143 | duration: 2000 | ||
| 144 | }); | 181 | }); |
| 145 | |||
| 146 | setTimeout(() => { | 182 | setTimeout(() => { |
| 147 | uni.navigateBack(); | 183 | uni.navigateBack(); |
| 148 | }, 2000); | 184 | }, 1500); |
| 149 | } catch (error) { | 185 | } catch (error) { |
| 150 | uni.showToast({ title: '提交失败,请检查信息', icon: 'none' }); | 186 | submitting.value = false; |
| 187 | // 错误已由 request.js 处理 | ||
| 188 | } finally { | ||
| 189 | submitting.value = false; | ||
| 151 | } | 190 | } |
| 152 | }; | 191 | }; |
| 153 | </script> | 192 | </script> |
| ... | @@ -156,71 +195,221 @@ const submitInvoice = async () => { | ... | @@ -156,71 +195,221 @@ const submitInvoice = async () => { |
| 156 | .invoice-apply { | 195 | .invoice-apply { |
| 157 | min-height: 100vh; | 196 | min-height: 100vh; |
| 158 | background: #f5f7fa; | 197 | background: #f5f7fa; |
| 198 | } | ||
| 199 | |||
| 200 | .content { | ||
| 201 | padding: 20rpx; | ||
| 202 | } | ||
| 203 | |||
| 204 | .form-item { | ||
| 205 | background: #fff; | ||
| 206 | padding: 24rpx; | ||
| 207 | margin-bottom: 20rpx; | ||
| 208 | border-radius: 16rpx; | ||
| 209 | |||
| 210 | &.column { | ||
| 211 | display: flex; | ||
| 212 | flex-direction: column; | ||
| 213 | } | ||
| 159 | 214 | ||
| 160 | .content { | 215 | .label { |
| 161 | padding: 20rpx; | 216 | font-size: 28rpx; |
| 162 | 217 | color: #333; | |
| 163 | .form-item { | 218 | font-weight: 500; |
| 164 | display: flex; | 219 | margin-bottom: 16rpx; |
| 165 | justify-content: space-between; | 220 | } |
| 166 | align-items: center; | 221 | |
| 167 | background: #fff; | 222 | .input { |
| 168 | padding: 24rpx; | 223 | width: 100%; |
| 169 | border-bottom: 1rpx solid #eee; | 224 | font-size: 28rpx; |
| 170 | 225 | color: #333; | |
| 171 | .label { | 226 | padding: 0 24rpx; |
| 172 | font-size: 28rpx; | 227 | box-sizing: border-box; |
| 173 | color: #333; | 228 | background: transparent; |
| 174 | } | 229 | min-width: 0; |
| 175 | 230 | text-align: left; | |
| 176 | .input { | 231 | border: 1rpx solid #ccc; |
| 177 | width: 80%; | 232 | border-radius: 8rpx; |
| 178 | font-size: 28rpx; | 233 | height: 80rpx; |
| 179 | color: #333; | 234 | line-height: 80rpx; |
| 180 | padding: 16rpx 0; | 235 | |
| 181 | text-align: right; | 236 | &::placeholder { |
| 182 | } | 237 | color: #999; |
| 183 | 238 | font-size: 28rpx; | |
| 184 | .value { | 239 | line-height: 80rpx; |
| 185 | font-size: 28rpx; | ||
| 186 | color: #333; | ||
| 187 | } | ||
| 188 | |||
| 189 | .amount { | ||
| 190 | font-size: 28rpx; | ||
| 191 | color: #e4393c; | ||
| 192 | font-weight: 500; | ||
| 193 | } | ||
| 194 | } | 240 | } |
| 195 | } | 241 | } |
| 196 | 242 | ||
| 243 | .form-item.column .input { | ||
| 244 | width: 100%; | ||
| 245 | display: block; | ||
| 246 | } | ||
| 247 | |||
| 197 | .hint { | 248 | .hint { |
| 198 | font-size: 26rpx; | 249 | font-size: 24rpx; |
| 199 | color: #B6BCC0; | 250 | color: #909399; |
| 200 | margin-top: 20rpx; | 251 | margin-top: 8rpx; |
| 201 | text-align: center; | ||
| 202 | } | 252 | } |
| 203 | 253 | ||
| 204 | .btn-wrap { | 254 | .amount { |
| 205 | width: 100%; | 255 | font-size: 32rpx; |
| 206 | background-color: #fff; | 256 | color: #AD181F; |
| 207 | padding: 30rpx; | 257 | font-weight: 600; |
| 208 | position: fixed; | 258 | } |
| 209 | bottom: 0; | 259 | } |
| 210 | left: 0; | 260 | |
| 211 | right: 0; | 261 | /* 发票类型选择 */ |
| 212 | } | 262 | .type-select { |
| 213 | 263 | display: flex; | |
| 214 | .submit-btn { | 264 | gap: 20rpx; |
| 215 | height: 70rpx; | 265 | margin-top: 10rpx; |
| 216 | line-height: 70rpx; | 266 | } |
| 217 | border-radius: 35rpx; | 267 | |
| 218 | width: 90%; | 268 | .type-option { |
| 219 | margin: 0 auto; | 269 | flex: 1; |
| 270 | display: flex; | ||
| 271 | align-items: center; | ||
| 272 | padding: 20rpx; | ||
| 273 | border: 2rpx solid #e4e7ed; | ||
| 274 | border-radius: 12rpx; | ||
| 275 | background: #fafafa; | ||
| 276 | |||
| 277 | &.active { | ||
| 278 | border-color: #AD181F; | ||
| 279 | background: #FFF5F5; | ||
| 280 | } | ||
| 281 | |||
| 282 | .type-icon { | ||
| 283 | width: 60rpx; | ||
| 284 | height: 60rpx; | ||
| 285 | background: #f5f7ff; | ||
| 286 | border-radius: 8rpx; | ||
| 287 | display: flex; | ||
| 288 | align-items: center; | ||
| 289 | justify-content: center; | ||
| 290 | font-size: 24rpx; | ||
| 291 | color: #409eff; | ||
| 292 | font-weight: 600; | ||
| 293 | margin-right: 16rpx; | ||
| 294 | |||
| 295 | &.enterprise { | ||
| 296 | background: #f0f6ff; | ||
| 297 | color: #1561CB; | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | &.active .type-icon { | ||
| 220 | background: #AD181F; | 302 | background: #AD181F; |
| 221 | color: #fff; | 303 | color: #fff; |
| 222 | font-size: 28rpx; | 304 | } |
| 223 | text-align: center; | 305 | |
| 306 | .type-info { | ||
| 307 | display: flex; | ||
| 308 | flex-direction: column; | ||
| 309 | |||
| 310 | .type-name { | ||
| 311 | font-size: 28rpx; | ||
| 312 | font-weight: 600; | ||
| 313 | color: #303133; | ||
| 314 | } | ||
| 315 | |||
| 316 | .type-desc { | ||
| 317 | font-size: 22rpx; | ||
| 318 | color: #909399; | ||
| 319 | margin-top: 4rpx; | ||
| 320 | } | ||
| 321 | } | ||
| 322 | } | ||
| 323 | |||
| 324 | /* 接收方式选择 */ | ||
| 325 | .method-select { | ||
| 326 | margin-top: 10rpx; | ||
| 327 | } | ||
| 328 | |||
| 329 | .method-option { | ||
| 330 | display: flex; | ||
| 331 | align-items: center; | ||
| 332 | padding: 20rpx; | ||
| 333 | border: 2rpx solid #e4e7ed; | ||
| 334 | border-radius: 12rpx; | ||
| 335 | background: #fafafa; | ||
| 336 | |||
| 337 | &.active { | ||
| 338 | border-color: #AD181F; | ||
| 339 | background: #FFF5F5; | ||
| 340 | } | ||
| 341 | |||
| 342 | .method-icon { | ||
| 343 | width: 60rpx; | ||
| 344 | height: 60rpx; | ||
| 345 | background: #f5f7ff; | ||
| 346 | border-radius: 12rpx; | ||
| 347 | display: flex; | ||
| 348 | align-items: center; | ||
| 349 | justify-content: center; | ||
| 350 | font-size: 24rpx; | ||
| 351 | color: #409eff; | ||
| 352 | font-weight: 600; | ||
| 353 | margin-right: 16rpx; | ||
| 354 | } | ||
| 355 | |||
| 356 | &.active .method-icon { | ||
| 357 | background: #AD181F; | ||
| 358 | color: #fff; | ||
| 359 | } | ||
| 360 | |||
| 361 | .method-info { | ||
| 362 | flex: 1; | ||
| 363 | display: flex; | ||
| 364 | flex-direction: column; | ||
| 365 | |||
| 366 | .method-name { | ||
| 367 | font-size: 28rpx; | ||
| 368 | font-weight: 600; | ||
| 369 | color: #303133; | ||
| 370 | } | ||
| 371 | |||
| 372 | .method-desc { | ||
| 373 | font-size: 22rpx; | ||
| 374 | color: #909399; | ||
| 375 | margin-top: 4rpx; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | .method-tag { | ||
| 380 | font-size: 20rpx; | ||
| 381 | color: #67C23A; | ||
| 382 | background: #f0f9f0; | ||
| 383 | padding: 4rpx 12rpx; | ||
| 384 | border-radius: 6rpx; | ||
| 385 | } | ||
| 386 | } | ||
| 387 | |||
| 388 | /* 提交按钮 */ | ||
| 389 | .btn-wrap { | ||
| 390 | width: 100%; | ||
| 391 | background-color: #fff; | ||
| 392 | padding: 30rpx; | ||
| 393 | position: fixed; | ||
| 394 | bottom: 0; | ||
| 395 | left: 0; | ||
| 396 | right: 0; | ||
| 397 | box-sizing: border-box; | ||
| 398 | } | ||
| 399 | |||
| 400 | .submit-btn { | ||
| 401 | height: 88rpx; | ||
| 402 | line-height: 88rpx; | ||
| 403 | border-radius: 44rpx; | ||
| 404 | width: 100%; | ||
| 405 | background: #AD181F; | ||
| 406 | color: #fff; | ||
| 407 | font-size: 32rpx; | ||
| 408 | text-align: center; | ||
| 409 | font-weight: 500; | ||
| 410 | |||
| 411 | &.loading { | ||
| 412 | background: #c0c4cc; | ||
| 224 | } | 413 | } |
| 225 | } | 414 | } |
| 226 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 415 | </style> | ... | ... |
-
Please register or sign in to post a comment