按钮
Showing
7 changed files
with
47 additions
and
29 deletions
| ... | @@ -293,6 +293,7 @@ const handleSubmit = async () => { | ... | @@ -293,6 +293,7 @@ const handleSubmit = async () => { |
| 293 | commitRes = await api.payForOrder({ | 293 | commitRes = await api.payForOrder({ |
| 294 | id: orderId.value, | 294 | id: orderId.value, |
| 295 | addresId: selectedAddress.value.id, | 295 | addresId: selectedAddress.value.id, |
| 296 | payType: payType.value, | ||
| 296 | type: payType.value, | 297 | type: payType.value, |
| 297 | contactPerson: formData.value.contactPerson, | 298 | contactPerson: formData.value.contactPerson, |
| 298 | contactTel: formData.value.contactTel | 299 | contactTel: formData.value.contactTel | ... | ... |
| ... | @@ -246,13 +246,14 @@ const handelPay = async () => { | ... | @@ -246,13 +246,14 @@ const handelPay = async () => { |
| 246 | let data | 246 | let data |
| 247 | // 再次支付 | 247 | // 再次支付 |
| 248 | if (payForm.value.id && payForm.value.payStatus === '0') { | 248 | if (payForm.value.id && payForm.value.payStatus === '0') { |
| 249 | const [err, res] = await to(api.payForOrder({ | 249 | const [err, res] = await to(api.payForOrder({ |
| 250 | id: payForm.value.id, | 250 | id: payForm.value.id, |
| 251 | renewYear: form.value.renewYear, | 251 | renewYear: form.value.renewYear, |
| 252 | type: payType.value, | 252 | payType: payType.value, |
| 253 | contactPerson: form.value.contactPerson, | 253 | type: payType.value, |
| 254 | contactTel: form.value.contactTel | 254 | contactPerson: form.value.contactPerson, |
| 255 | })) | 255 | contactTel: form.value.contactTel |
| 256 | })) | ||
| 256 | if (err || res.code !== 200) { | 257 | if (err || res.code !== 200) { |
| 257 | uni.hideLoading() | 258 | uni.hideLoading() |
| 258 | isPaying.value = false | 259 | isPaying.value = false | ... | ... |
| ... | @@ -323,11 +323,11 @@ const getOrderCountText = (item) => { | ... | @@ -323,11 +323,11 @@ const getOrderCountText = (item) => { |
| 323 | 323 | ||
| 324 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1' | 324 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1' |
| 325 | 325 | ||
| 326 | const isPayDisabled = (item) => String(item?.auditStatus) !== '9' | 326 | const isPayDisabled = (item) => String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' |
| 327 | 327 | ||
| 328 | const canShowCancel = (item) => String(item?.auditStatus) === '9' | 328 | const canShowCancel = (item) => String(item?.auditStatus) === '9' |
| 329 | 329 | ||
| 330 | const isCancelDisabled = (item) => String(item?.auditStatus) !== '9' | 330 | const isCancelDisabled = (item) => String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' |
| 331 | 331 | ||
| 332 | const canShowInvoiceApply = (item) => !hasInvoice(item) | 332 | const canShowInvoiceApply = (item) => !hasInvoice(item) |
| 333 | 333 | ... | ... |
| ... | @@ -376,20 +376,26 @@ const isGroupOrder = (item) => getRowType(item) === '1' | ... | @@ -376,20 +376,26 @@ const isGroupOrder = (item) => getRowType(item) === '1' |
| 376 | const isLevelOrder = (item) => ['2', '3', '4'].includes(getRowType(item)) | 376 | const isLevelOrder = (item) => ['2', '3', '4'].includes(getRowType(item)) |
| 377 | 377 | ||
| 378 | const canShowCancel = (item) => { | 378 | const canShowCancel = (item) => { |
| 379 | if (isPersonalOrder(item)) { | ||
| 380 | return String(item?.auditStatus) === '9' || String(item?.payStatus) !== '0' | ||
| 381 | } | ||
| 379 | if (isGroupOrder(item)) return String(item?.auditStatus) === '0' | 382 | if (isGroupOrder(item)) return String(item?.auditStatus) === '0' |
| 380 | return String(item?.auditStatus) === '9' | 383 | return String(item?.auditStatus) === '9' |
| 381 | } | 384 | } |
| 382 | 385 | ||
| 383 | const isPayDisabled = (item) => { | 386 | const isPayDisabled = (item) => { |
| 384 | if (isPersonalOrder(item)) return String(item?.auditStatus) !== '9' | 387 | if (isPersonalOrder(item) || isLevelOrder(item)) { |
| 385 | if (isLevelOrder(item)) return String(item?.auditStatus) !== '9' | 388 | return String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' |
| 389 | } | ||
| 386 | if (String(item?.payStatus) !== '0') return true | 390 | if (String(item?.payStatus) !== '0') return true |
| 387 | return String(item?.auditStatus) !== '0' | 391 | return String(item?.auditStatus) !== '0' |
| 388 | } | 392 | } |
| 389 | 393 | ||
| 390 | const isCancelDisabled = (item) => { | 394 | const isCancelDisabled = (item) => { |
| 391 | if (isPersonalOrder(item)) return String(item?.auditStatus) !== '9' | 395 | if (isPersonalOrder(item)) return String(item?.auditStatus) !== '9' |
| 392 | if (isLevelOrder(item)) return String(item?.auditStatus) !== '9' | 396 | if (isLevelOrder(item)) { |
| 397 | return String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0' | ||
| 398 | } | ||
| 393 | return String(item?.payStatus) !== '0' | 399 | return String(item?.payStatus) !== '0' |
| 394 | } | 400 | } |
| 395 | 401 | ||
| ... | @@ -400,7 +406,6 @@ const canShowInvoiceApply = (item) => !hasInvoice(item) | ... | @@ -400,7 +406,6 @@ const canShowInvoiceApply = (item) => !hasInvoice(item) |
| 400 | const isInvoiceDisabled = (item) => { | 406 | const isInvoiceDisabled = (item) => { |
| 401 | if (hasInvoice(item)) return true | 407 | if (hasInvoice(item)) return true |
| 402 | if (isPersonalOrder(item)) return String(item?.auditStatus) !== '2' || String(item?.payStatus) === '4' | 408 | if (isPersonalOrder(item)) return String(item?.auditStatus) !== '2' || String(item?.payStatus) === '4' |
| 403 | if (isLevelOrder(item)) return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0 | ||
| 404 | return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0 | 409 | return String(item?.payStatus) !== '1' || String(item?.auditStatus) !== '2' || Number(item?.price || 0) <= 0 |
| 405 | } | 410 | } |
| 406 | 411 | ... | ... |
| ... | @@ -84,7 +84,7 @@ | ... | @@ -84,7 +84,7 @@ |
| 84 | </view> | 84 | </view> |
| 85 | 85 | ||
| 86 | <!-- 纳税人识别号(企业才显示) --> | 86 | <!-- 纳税人识别号(企业才显示) --> |
| 87 | <view v-if="form.type === '1' && form.invoiceType === '1'" class="form-item column"> | 87 | <view v-if="form.type === '1'" class="form-item column"> |
| 88 | <text class="label">纳税人识别号</text> | 88 | <text class="label">纳税人识别号</text> |
| 89 | <input | 89 | <input |
| 90 | v-model="form.taxno" | 90 | v-model="form.taxno" | ... | ... |
| ... | @@ -22,7 +22,8 @@ | ... | @@ -22,7 +22,8 @@ |
| 22 | <view class="form-item"> | 22 | <view class="form-item"> |
| 23 | <text class="label">发票类型</text> | 23 | <text class="label">发票类型</text> |
| 24 | <view class="type-select"> | 24 | <view class="type-select"> |
| 25 | <view | 25 | <view |
| 26 | v-if="!personalInvoiceMode" | ||
| 26 | :class="{ active: form.type === '0' }" | 27 | :class="{ active: form.type === '0' }" |
| 27 | class="type-option" | 28 | class="type-option" |
| 28 | @click="form.type = '0'" | 29 | @click="form.type = '0'" |
| ... | @@ -57,7 +58,7 @@ | ... | @@ -57,7 +58,7 @@ |
| 57 | <input | 58 | <input |
| 58 | v-model="form.name" | 59 | v-model="form.name" |
| 59 | class="input" | 60 | class="input" |
| 60 | :disabled="!showIndividualType" | 61 | :disabled="!showIndividualType || personalInvoiceMode" |
| 61 | :placeholder="form.type === '0' ? '请输入公司全称' : '请输入发票抬头'" | 62 | :placeholder="form.type === '0' ? '请输入公司全称' : '请输入发票抬头'" |
| 62 | /> | 63 | /> |
| 63 | <text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致</text> | 64 | <text class="hint">请确保发票抬头与公司营业执照或个人身份证上的名称一致</text> |
| ... | @@ -102,6 +103,7 @@ const app = getApp(); | ... | @@ -102,6 +103,7 @@ const app = getApp(); |
| 102 | const submitting = ref(false); | 103 | const submitting = ref(false); |
| 103 | const showSuccessModal = ref(false); | 104 | const showSuccessModal = ref(false); |
| 104 | const showIndividualType = ref(true); | 105 | const showIndividualType = ref(true); |
| 106 | const personalInvoiceMode = ref(false); | ||
| 105 | 107 | ||
| 106 | // 表单数据 | 108 | // 表单数据 |
| 107 | const form = reactive({ | 109 | const form = reactive({ |
| ... | @@ -122,6 +124,15 @@ onLoad((options) => { | ... | @@ -122,6 +124,15 @@ onLoad((options) => { |
| 122 | // 自动填充发票抬头和纳税人识别号(与PC端一致) | 124 | // 自动填充发票抬头和纳税人识别号(与PC端一致) |
| 123 | const memberInfo = app.globalData.memberInfo | 125 | const memberInfo = app.globalData.memberInfo |
| 124 | 126 | ||
| 127 | if (options.personalInvoice == '1') { | ||
| 128 | personalInvoiceMode.value = true | ||
| 129 | form.type = '1' | ||
| 130 | form.name = decodeURIComponent(options.invoiceTitle || '') || '' | ||
| 131 | form.taxno = '' | ||
| 132 | showIndividualType.value = true | ||
| 133 | return | ||
| 134 | } | ||
| 135 | |||
| 125 | 136 | ||
| 126 | // 如果是对公转账(ziZhangBu有值),默认只能开企业发票,隐藏个人选项 | 137 | // 如果是对公转账(ziZhangBu有值),默认只能开企业发票,隐藏个人选项 |
| 127 | if (options.ziZhangBu == '1') { | 138 | if (options.ziZhangBu == '1') { |
| ... | @@ -457,4 +468,4 @@ function closeSuccessModal() { | ... | @@ -457,4 +468,4 @@ function closeSuccessModal() { |
| 457 | .success-btn::after { | 468 | .success-btn::after { |
| 458 | border: none; | 469 | border: none; |
| 459 | } | 470 | } |
| 460 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 471 | </style> | ... | ... |
| ... | @@ -130,10 +130,13 @@ | ... | @@ -130,10 +130,13 @@ |
| 130 | <button v-if="canShowCancel(item)" :class="{ disabled: isCancelDisabled(item) }" :disabled="isCancelDisabled(item)" class="btn btn-info" @click.stop="handleCancel(item)">取消订单</button> | 130 | <button v-if="canShowCancel(item)" :class="{ disabled: isCancelDisabled(item) }" :disabled="isCancelDisabled(item)" class="btn btn-info" @click.stop="handleCancel(item)">取消订单</button> |
| 131 | <!-- 已缴费:申请开票/已开票(需要审核通过才能开票) --> | 131 | <!-- 已缴费:申请开票/已开票(需要审核通过才能开票) --> |
| 132 | <template v-if="canShowInvoiceApply(item)"> | 132 | <template v-if="canShowInvoiceApply(item)"> |
| 133 | <button :class="{ disabled: isInvoiceDisabled(item) }" :disabled="isInvoiceDisabled(item)" class="btn btn-view-invoice" @click.stop="makeInvoiceFN(item)"> | 133 | <button :class="{ disabled: isInvoiceDisabled(item) }" :disabled="isInvoiceDisabled(item)" class="btn btn-view-invoice" @click.stop="makeInvoiceFN(item)"> |
| 134 | 申请开票 | 134 | 申请开票 |
| 135 | </button> | 135 | </button> |
| 136 | </template> | 136 | </template> |
| 137 | <template v-if="hasInvoice(item)"> | ||
| 138 | <button class="btn btn-invoice" @click.stop="viewInvoice(item)">查看发票</button> | ||
| 139 | </template> | ||
| 137 | </view> | 140 | </view> |
| 138 | </view> | 141 | </view> |
| 139 | </view> | 142 | </view> |
| ... | @@ -276,11 +279,11 @@ const getAuditStatusText = (status) => { | ... | @@ -276,11 +279,11 @@ const getAuditStatusText = (status) => { |
| 276 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1'; | 279 | const hasInvoice = (item) => String(item?.invoiceStatus) === '1'; |
| 277 | 280 | ||
| 278 | const isPayDisabled = (item) => { | 281 | const isPayDisabled = (item) => { |
| 279 | return String(item?.auditStatus) !== '9'; | 282 | return String(item?.auditStatus) !== '9' || String(item?.payStatus) !== '0'; |
| 280 | }; | 283 | }; |
| 281 | 284 | ||
| 282 | const canShowCancel = (item) => { | 285 | const canShowCancel = (item) => { |
| 283 | return String(item?.auditStatus) === '9'; | 286 | return String(item?.auditStatus) === '9' || String(item?.payStatus) !== '0'; |
| 284 | }; | 287 | }; |
| 285 | 288 | ||
| 286 | const isCancelDisabled = (item) => { | 289 | const isCancelDisabled = (item) => { |
| ... | @@ -446,21 +449,18 @@ const closeDelPopup = () => { | ... | @@ -446,21 +449,18 @@ const closeDelPopup = () => { |
| 446 | 449 | ||
| 447 | // 去缴费 | 450 | // 去缴费 |
| 448 | const handlePay = async (item) => { | 451 | const handlePay = async (item) => { |
| 449 | if (item.payStatus !== 0) return; | 452 | if (isPayDisabled(item)) return; |
| 450 | try { | 453 | goPay(item); |
| 451 | await api.goPay({id: item.id}); | ||
| 452 | uni.navigateTo({url: `/pages/pay/pay?orderId=${item.id}`}); | ||
| 453 | } catch (e) { | ||
| 454 | uni.showToast({title: '发起支付失败', icon: 'none'}); | ||
| 455 | } | ||
| 456 | }; | 454 | }; |
| 457 | 455 | ||
| 458 | // 申请开票 | 456 | // 申请开票 |
| 459 | const makeInvoiceFN = (item) => { | 457 | const makeInvoiceFN = (item) => { |
| 460 | if (isInvoiceDisabled(item)) return; | 458 | // if (isInvoiceDisabled(item)) return; |
| 461 | needRefresh.value = true; | 459 | needRefresh.value = true; |
| 460 | const rawInvoiceTitle = item.orderName || item.content?.orderName || item.memberName || '' | ||
| 461 | const invoiceTitle = encodeURIComponent(String(rawInvoiceTitle).split('-')[0] || '') | ||
| 462 | uni.navigateTo({ | 462 | uni.navigateTo({ |
| 463 | url: `/pages/invoice/applyFeisui?orderId=${item.id}&amount=${item.price}&type=1` | 463 | url: `/pages/invoice/applyFeisui?orderId=${item.id}&amount=${item.price}&type=1&personalInvoice=1&invoiceTitle=${invoiceTitle}` |
| 464 | }); | 464 | }); |
| 465 | }; | 465 | }; |
| 466 | 466 | ... | ... |
-
Please register or sign in to post a comment