Showing
9 changed files
with
1114 additions
and
5 deletions
| ... | ... | @@ -165,6 +165,30 @@ export function procurementPlanDiffQuantityExceededApi(data) { |
| 165 | 165 | }) |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | +// 上传请款附件:id-ID编号;fileIds-请款附件文件ID集合(逗号分隔);fileNames-请款附件文件名称集合(逗号分隔) | |
| 169 | +export function procurementPlanUploadRequestAttachmentApi(data) { | |
| 170 | + return request({ | |
| 171 | + url: '/procurement/plan/attachment/request', | |
| 172 | + method: 'put', | |
| 173 | + data, | |
| 174 | + contentType: ContentTypeEnum.JSON | |
| 175 | + }) | |
| 176 | +} | |
| 177 | + | |
| 178 | +// 生成正常请款单:sourceId-采购计划ID | |
| 179 | +export function procurementPlanGeneratePayRequestApi(sourceId) { | |
| 180 | + return request({ | |
| 181 | + url: '/procurement/fundPaymentRequest/generateData', | |
| 182 | + method: 'post', | |
| 183 | + data: { | |
| 184 | + source: 'PLAN', | |
| 185 | + sourceId, | |
| 186 | + requestKind: 'NORMAL' | |
| 187 | + }, | |
| 188 | + contentType: ContentTypeEnum.JSON | |
| 189 | + }) | |
| 190 | +} | |
| 191 | + | |
| 168 | 192 | export function procurementPlanChangeSubmitApi(id) { |
| 169 | 193 | return request({ |
| 170 | 194 | url: '/procurement/plan/change/submit?id=' + id, | ... | ... |
| ... | ... | @@ -98,6 +98,23 @@ export function warehouseReceiveCancelApi(id) { |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | + * 生成正常请款单 | |
| 102 | + * @param sourceId 收料单ID | |
| 103 | + */ | |
| 104 | +export function warehouseReceiveGenerateNormalPayRequestApi(sourceId) { | |
| 105 | + return request({ | |
| 106 | + url: '/procurement/fundPaymentRequest/generateData', | |
| 107 | + method: 'post', | |
| 108 | + data: { | |
| 109 | + source: 'RECEIVE', | |
| 110 | + sourceId, | |
| 111 | + requestKind: 'NORMAL' | |
| 112 | + }, | |
| 113 | + contentType: ContentTypeEnum.JSON | |
| 114 | + }) | |
| 115 | +} | |
| 116 | + | |
| 117 | +/** | |
| 101 | 118 | * 分厂下拉数据(PC: base-data/maker,即 baseData/workshop) |
| 102 | 119 | */ |
| 103 | 120 | export function workshopQueryApi(params) { | ... | ... |
| ... | ... | @@ -133,6 +133,42 @@ export function weighTicketUploadDelayApi(data) { |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | + * 生成正常请款单 | |
| 137 | + * @param sourceId 过磅单ID | |
| 138 | + */ | |
| 139 | +export function weighTicketGenerateNormalPayRequestApi(sourceId) { | |
| 140 | + return request({ | |
| 141 | + url: '/procurement/fundPaymentRequest/generateData', | |
| 142 | + method: 'post', | |
| 143 | + data: { | |
| 144 | + source: 'TICKET', | |
| 145 | + sourceId, | |
| 146 | + requestKind: 'NORMAL' | |
| 147 | + }, | |
| 148 | + contentType: ContentTypeEnum.JSON | |
| 149 | + }) | |
| 150 | +} | |
| 151 | + | |
| 152 | +/** | |
| 153 | + * 生成补充请款单 | |
| 154 | + * data: { sourceId-过磅单ID, supplementFileIds-补充说明附件ID集合(逗号分隔), supplementFileNames-补充说明附件名称集合(逗号分隔) } | |
| 155 | + */ | |
| 156 | +export function weighTicketGenerateSupplementPayRequestApi(data) { | |
| 157 | + return request({ | |
| 158 | + url: '/procurement/fundPaymentRequest/generateData', | |
| 159 | + method: 'post', | |
| 160 | + data: { | |
| 161 | + source: 'TICKET', | |
| 162 | + sourceId: data.sourceId, | |
| 163 | + requestKind: 'SUPPLEMENT', | |
| 164 | + supplementFileIds: data.supplementFileIds, | |
| 165 | + supplementFileNames: data.supplementFileNames | |
| 166 | + }, | |
| 167 | + contentType: ContentTypeEnum.JSON | |
| 168 | + }) | |
| 169 | +} | |
| 170 | + | |
| 171 | +/** | |
| 136 | 172 | * 公司简称下拉数据(PC: base-data/short-name) |
| 137 | 173 | */ |
| 138 | 174 | export function companyShortQueryApi(params) { | ... | ... |
| ... | ... | @@ -453,6 +453,14 @@ |
| 453 | 453 | } |
| 454 | 454 | }, |
| 455 | 455 | { |
| 456 | + "path": "pages/domestic-plan/uploadPay", | |
| 457 | + "style": { | |
| 458 | + "navigationBarTitleText": "上传请款附件", | |
| 459 | + "navigationBarBackgroundColor": "#ffffff", | |
| 460 | + "navigationBarTextStyle": "black" | |
| 461 | + } | |
| 462 | + }, | |
| 463 | + { | |
| 456 | 464 | "path": "pages/schedule-plan/index", |
| 457 | 465 | "style": { |
| 458 | 466 | "navigationBarTitleText": "计划变更单", |
| ... | ... | @@ -589,6 +597,14 @@ |
| 589 | 597 | } |
| 590 | 598 | }, |
| 591 | 599 | { |
| 600 | + "path": "pages/weight-ticket/generateSupplement", | |
| 601 | + "style": { | |
| 602 | + "navigationBarTitleText": "生成补充请款单", | |
| 603 | + "navigationBarBackgroundColor": "#ffffff", | |
| 604 | + "navigationBarTextStyle": "black" | |
| 605 | + } | |
| 606 | + }, | |
| 607 | + { | |
| 592 | 608 | "path": "pages/sample-submission/index", |
| 593 | 609 | "style": { |
| 594 | 610 | "navigationBarTitleText": "化验送样单", | ... | ... |
| ... | ... | @@ -40,6 +40,15 @@ |
| 40 | 40 | </view> |
| 41 | 41 | </view> |
| 42 | 42 | </view> |
| 43 | + <view class="row" v-if="requestAttachmentList.length"> | |
| 44 | + <text class="label">请款附件</text> | |
| 45 | + <view class="attach-list"> | |
| 46 | + <view v-for="(at, idx) in requestAttachmentList" :key="idx" class="attach-item"> | |
| 47 | + <text class="attach-name">{{ at.name }}</text> | |
| 48 | + <text class="attach-view" @click.stop="onPreviewAttachment(at)">查看</text> | |
| 49 | + </view> | |
| 50 | + </view> | |
| 51 | + </view> | |
| 43 | 52 | </view> |
| 44 | 53 | |
| 45 | 54 | <ProductRel |
| ... | ... | @@ -83,7 +92,7 @@ |
| 83 | 92 | <script> |
| 84 | 93 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 85 | 94 | import ProductRel from './productRel.vue' |
| 86 | -import { procurementPlanDetailApi, procurementPlanGenerateContractApi, procurementPlanSubmitAuditApi, procurementPlanSubmitApi, procurementPlanStopApi, procurementPlanDiffQuantityExceededApi } from '@/api/procure-manage/procurementPlan.js' | |
| 95 | +import { procurementPlanDetailApi, procurementPlanGenerateContractApi, procurementPlanSubmitAuditApi, procurementPlanSubmitApi, procurementPlanStopApi, procurementPlanDiffQuantityExceededApi, procurementPlanGeneratePayRequestApi } from '@/api/procure-manage/procurementPlan.js' | |
| 87 | 96 | import { buyoutApplyCreateApi, buyoutApplyAbolishApi, buyoutApplyDeleteByPlanIdApi } from '@/api/procure-manage/buyout.js' |
| 88 | 97 | import { getDicByCodes, getDicName } from '@/utils/dic.js' |
| 89 | 98 | import { getInfo } from '@/api/login.js' |
| ... | ... | @@ -98,6 +107,7 @@ export default { |
| 98 | 107 | form: {}, |
| 99 | 108 | lineList: [], |
| 100 | 109 | attachmentList: [], |
| 110 | + requestAttachmentList: [], | |
| 101 | 111 | materialConditionConfigs: [ |
| 102 | 112 | { field: 'materialConditionCopperRice', label: '铜米', dictCode: 'COPPER_RICE' }, |
| 103 | 113 | { field: 'materialConditionBrightCopper', label: '光亮铜', dictCode: 'BRIGHT_COPPER' }, |
| ... | ... | @@ -143,6 +153,8 @@ export default { |
| 143 | 153 | { text: '废除买断操作申请单', variant: 'danger', event: 'cancel' }, |
| 144 | 154 | { text: '查看买断操作申请单', variant: 'outline', event: 'look' }, |
| 145 | 155 | { text: '更改差值状态', variant: 'outline', event: 'change' }, |
| 156 | + { text: '上传请款附件', variant: 'primary', event: 'uploadPay' }, | |
| 157 | + { text: '生成正常请款单', variant: 'primary', event: 'generatePay' }, | |
| 146 | 158 | // { text: '上传附件', variant: 'primary', event: 'upload' } |
| 147 | 159 | ] |
| 148 | 160 | } |
| ... | ... | @@ -206,6 +218,8 @@ export default { |
| 206 | 218 | cancel: this.hasPerm('plan-manage:domestic-plan:cancel'), |
| 207 | 219 | look: this.hasPerm('plan-manage:domestic-plan:look'), |
| 208 | 220 | change: this.hasPerm('plan-manage:domestic-plan:change'), |
| 221 | + uploadPay: this.hasPerm('plan-manage:domestic-plan:uploadPay'), | |
| 222 | + generatePay: this.hasPerm('plan-manage:domestic-plan:generatePay'), | |
| 209 | 223 | // upload: this.hasPerm('plan-manage:domestic-plan:upload') |
| 210 | 224 | } |
| 211 | 225 | var visibleMap = { |
| ... | ... | @@ -223,6 +237,10 @@ export default { |
| 223 | 237 | look: inStatus([SC.TO_SUBMIT_REVIEW, SC.AUDIT, SC.COMPLETED, SC.REFUSE, SC.ABORTED]) && perms.look, |
| 224 | 238 | // 更改差值状态:按差值超量标识显示(布尔值,不走状态匹配) |
| 225 | 239 | change: !!diffQuantityExceeded && perms.change, |
| 240 | + // 上传请款附件:已完成 且 交提货方式为自提(PICK_UP) | |
| 241 | + uploadPay: inStatus([SC.COMPLETED]) && String(f.deliveryMode || '') === 'PICK_UP' && perms.uploadPay, | |
| 242 | + // 生成正常请款单:由后端 showApplyPayment 标识控制 | |
| 243 | + generatePay: !!f.showApplyPayment && perms.generatePay, | |
| 226 | 244 | // // uploadAttachment: inStatus([SC.COMPLETED]) && !!this.planRoleFlags.isPlanner && perms.uploadAttachment |
| 227 | 245 | } |
| 228 | 246 | var out = [] |
| ... | ... | @@ -394,6 +412,19 @@ export default { |
| 394 | 412 | } |
| 395 | 413 | this.attachmentList = list |
| 396 | 414 | }, |
| 415 | + // 请款附件:详情接口返回 requestFileIds/requestFileNames | |
| 416 | + buildRequestAttachmentList() { | |
| 417 | + var ids = this.form.requestFileIds | |
| 418 | + var names = this.form.requestFileNames | |
| 419 | + var idArr = (typeof ids === 'string' && ids) ? ids.split(',').filter(Boolean) : (Array.isArray(ids) ? ids : []) | |
| 420 | + var nameArr = (typeof names === 'string' && names) ? names.split(',').filter(Boolean) : (Array.isArray(names) ? names : []) | |
| 421 | + var len = Math.max(idArr.length, nameArr.length) | |
| 422 | + var list = [] | |
| 423 | + for (var i = 0; i < len; i++) { | |
| 424 | + list.push({ id: idArr[i] || '', name: nameArr[i] || ('请款附件' + (i + 1)) }) | |
| 425 | + } | |
| 426 | + this.requestAttachmentList = list | |
| 427 | + }, | |
| 397 | 428 | async loadDetail() { |
| 398 | 429 | if (!this.id) return |
| 399 | 430 | try { |
| ... | ... | @@ -411,6 +442,7 @@ export default { |
| 411 | 442 | this.form = d |
| 412 | 443 | this.lineList = Array.isArray(d.procurementPlanLineList) ? d.procurementPlanLineList : [] |
| 413 | 444 | this.buildAttachmentList() |
| 445 | + this.buildRequestAttachmentList() | |
| 414 | 446 | } catch (e) { |
| 415 | 447 | uni.showToast({ title: '加载详情失败', icon: 'none' }) |
| 416 | 448 | } |
| ... | ... | @@ -439,6 +471,8 @@ export default { |
| 439 | 471 | if (e === 'cancel') return this.onAbolishBuyoutApply() |
| 440 | 472 | if (e === 'look') return this.onViewBuyoutApply() |
| 441 | 473 | if (e === 'uploadAttachment') return this.onUploadAttachment() |
| 474 | + if (e === 'uploadPay') return this.onUploadPay() | |
| 475 | + if (e === 'generatePay') return this.onGeneratePayRequest() | |
| 442 | 476 | if (e === 'change') return this.onChangeDiffQuantityExceeded() |
| 443 | 477 | }, |
| 444 | 478 | |
| ... | ... | @@ -609,6 +643,26 @@ export default { |
| 609 | 643 | onUploadAttachment() { |
| 610 | 644 | uni.showToast({ title: '上传附件(待对接)', icon: 'none' }) |
| 611 | 645 | }, |
| 646 | + // 上传请款附件 | |
| 647 | + onUploadPay() { | |
| 648 | + var id = this.id || (this.form && this.form.id) || '' | |
| 649 | + if (!id) { | |
| 650 | + uni.showToast({ title: '缺少单据id', icon: 'none' }) | |
| 651 | + return | |
| 652 | + } | |
| 653 | + uni.navigateTo({ url: '/pages/domestic-plan/uploadPay?id=' + id }) | |
| 654 | + }, | |
| 655 | + // 生成正常请款单 | |
| 656 | + onGeneratePayRequest() { | |
| 657 | + this.runWithConfirm({ | |
| 658 | + title: '生成正常请款单确认', | |
| 659 | + content: '确认生成正常请款单吗?', | |
| 660 | + loading: '生成中', | |
| 661 | + successText: '生成正常请款单成功', | |
| 662 | + failText: '生成正常请款单失败', | |
| 663 | + run: function (id) { return procurementPlanGeneratePayRequestApi(id) } | |
| 664 | + }) | |
| 665 | + }, | |
| 612 | 666 | onApprove() { |
| 613 | 667 | var id = this.id || (this.form && this.form.id) || '' |
| 614 | 668 | if (!id) return | ... | ... |
pages/domestic-plan/uploadPay.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <scroll-view class="scroll" scroll-y> | |
| 4 | + <view class="detail-page"> | |
| 5 | + <!-- 基础信息 --> | |
| 6 | + <view class="section"> | |
| 7 | + <text class="company">{{ form.code || '-' }}</text> | |
| 8 | + <view class="row"><text class="label">公司简称</text><text class="value">{{ form.companyShortName || form.companyName || '-' }}</text></view> | |
| 9 | + <view class="row"><text class="label">供应商名称</text><text class="value">{{ form.supplierName || '-' }}</text></view> | |
| 10 | + <view class="row"><text class="label">采购处</text><text class="value">{{ form.purchaseDepartmentName || form.purchaseDepartment || '-' }}</text></view> | |
| 11 | + </view> | |
| 12 | + | |
| 13 | + <!-- 请款附件 --> | |
| 14 | + <view class="sub-table"> | |
| 15 | + <view class="sub-header"> | |
| 16 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 17 | + <text class="sub-title">请款附件</text> | |
| 18 | + <view class="upload-btn" @click="selectFile">上传文件</view> | |
| 19 | + </view> | |
| 20 | + <view class="sub-body"> | |
| 21 | + <view v-if="!fileList.length" class="empty-tip">暂无附件,请上传</view> | |
| 22 | + <view v-for="(file, idx) in fileList" :key="file.id || idx" class="file-item"> | |
| 23 | + <text class="file-name">{{ file.name || '未命名文件' }}</text> | |
| 24 | + <text class="file-del" @click="removeFile(idx)">删除</text> | |
| 25 | + </view> | |
| 26 | + </view> | |
| 27 | + </view> | |
| 28 | + </view> | |
| 29 | + </scroll-view> | |
| 30 | + <view class="footer"> | |
| 31 | + <button class="btn submit" type="primary" :loading="loading" @click="onSubmit">提交</button> | |
| 32 | + </view> | |
| 33 | + </view> | |
| 34 | +</template> | |
| 35 | + | |
| 36 | +<script> | |
| 37 | +import { procurementPlanDetailApi, procurementPlanUploadRequestAttachmentApi } from '@/api/procure-manage/procurementPlan.js' | |
| 38 | +import upload from '@/utils/upload' | |
| 39 | +import { uploadFileApi } from '@/api/base.js' | |
| 40 | + | |
| 41 | +export default { | |
| 42 | + name: 'DomesticPlanUploadPay', | |
| 43 | + data() { | |
| 44 | + return { | |
| 45 | + id: '', | |
| 46 | + loading: false, | |
| 47 | + form: {}, | |
| 48 | + // 请款附件列表 [{ id, name }] | |
| 49 | + fileList: [] | |
| 50 | + } | |
| 51 | + }, | |
| 52 | + onLoad(query) { | |
| 53 | + this.id = (query && query.id) || '' | |
| 54 | + this.loadDetail() | |
| 55 | + }, | |
| 56 | + methods: { | |
| 57 | + async loadDetail() { | |
| 58 | + if (!this.id) { | |
| 59 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | |
| 60 | + return | |
| 61 | + } | |
| 62 | + uni.showLoading({ title: '加载中...', mask: true }) | |
| 63 | + try { | |
| 64 | + const res = await procurementPlanDetailApi({ id: this.id }) | |
| 65 | + const m = (res && res.data) || {} | |
| 66 | + this.form = m | |
| 67 | + // 详情接口返回的请款附件字段为 requestFileIds/requestFileNames | |
| 68 | + const ids = String(m.requestFileIds || '').split(',').filter(Boolean) | |
| 69 | + const names = String(m.requestFileNames || '').split(',').filter(Boolean) | |
| 70 | + this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' })) | |
| 71 | + } catch (e) { | |
| 72 | + uni.showToast({ title: '加载详情失败', icon: 'none' }) | |
| 73 | + } finally { | |
| 74 | + uni.hideLoading() | |
| 75 | + } | |
| 76 | + }, | |
| 77 | + // 选择并上传文件(多文件逐个追加) | |
| 78 | + selectFile() { | |
| 79 | + if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { | |
| 80 | + uni.chooseMessageFile({ | |
| 81 | + count: 9, | |
| 82 | + type: 'all', | |
| 83 | + success: async res => { | |
| 84 | + const files = (res && res.tempFiles) || [] | |
| 85 | + if (!files.length) return | |
| 86 | + uni.showLoading({ title: '上传中...', mask: true }) | |
| 87 | + try { | |
| 88 | + for (const f of files) { | |
| 89 | + const name = f.name || 'file' | |
| 90 | + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' }) | |
| 91 | + const d = r && r.data ? r.data : r | |
| 92 | + const id = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId)))) | |
| 93 | + ? String(d.id || d.fileId || d.data.id || d.data.fileId) | |
| 94 | + : '' | |
| 95 | + if (id) this.fileList.push({ id, name }) | |
| 96 | + } | |
| 97 | + } catch (e) { | |
| 98 | + uni.showToast({ title: '上传失败', icon: 'none' }) | |
| 99 | + } finally { | |
| 100 | + uni.hideLoading() | |
| 101 | + } | |
| 102 | + }, | |
| 103 | + fail: () => { | |
| 104 | + uni.showToast({ title: '未选择文件', icon: 'none' }) | |
| 105 | + } | |
| 106 | + }) | |
| 107 | + return | |
| 108 | + } | |
| 109 | + // H5 兜底:动态创建原生 input | |
| 110 | + try { | |
| 111 | + const input = document.createElement('input') | |
| 112 | + input.type = 'file' | |
| 113 | + input.multiple = true | |
| 114 | + input.style.position = 'fixed' | |
| 115 | + input.style.left = '-9999px' | |
| 116 | + document.body.appendChild(input) | |
| 117 | + input.addEventListener('change', this.onFileChange) | |
| 118 | + input.click() | |
| 119 | + setTimeout(() => { document.body.removeChild(input) }, 1000) | |
| 120 | + } catch (e) { | |
| 121 | + uni.showToast({ title: '无法打开文件选择', icon: 'none' }) | |
| 122 | + } | |
| 123 | + }, | |
| 124 | + async onFileChange(e) { | |
| 125 | + const files = (e && e.target && e.target.files) || [] | |
| 126 | + if (!files.length) return | |
| 127 | + uni.showLoading({ title: '上传中...', mask: true }) | |
| 128 | + try { | |
| 129 | + for (const file of files) { | |
| 130 | + const name = file.name || '' | |
| 131 | + const fd = new FormData() | |
| 132 | + fd.append('file', file, name) | |
| 133 | + const d = await uploadFileApi(fd) | |
| 134 | + const data = d && d.data ? d.data : d | |
| 135 | + const id = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId)))) | |
| 136 | + ? String(data.id || data.fileId || data.data.id || data.data.fileId) | |
| 137 | + : '' | |
| 138 | + if (id) this.fileList.push({ id, name }) | |
| 139 | + } | |
| 140 | + } catch (e2) { | |
| 141 | + uni.showToast({ title: '上传失败', icon: 'none' }) | |
| 142 | + } finally { | |
| 143 | + uni.hideLoading() | |
| 144 | + if (e && e.target) e.target.value = '' | |
| 145 | + } | |
| 146 | + }, | |
| 147 | + removeFile(idx) { | |
| 148 | + this.fileList.splice(idx, 1) | |
| 149 | + }, | |
| 150 | + async onSubmit() { | |
| 151 | + const planId = (this.form && this.form.id) || this.id | |
| 152 | + if (!planId) { | |
| 153 | + uni.showToast({ title: '缺少单据id', icon: 'none' }) | |
| 154 | + return | |
| 155 | + } | |
| 156 | + const ids = this.fileList.map(it => it.id).filter(Boolean) | |
| 157 | + const names = this.fileList.map(it => it.name).filter(Boolean) | |
| 158 | + const data = { | |
| 159 | + id: planId, | |
| 160 | + fileIds: ids.join(','), | |
| 161 | + fileNames: names.join(',') | |
| 162 | + } | |
| 163 | + const confirmRes = await new Promise(resolve => { | |
| 164 | + uni.showModal({ title: '提交确认', content: '确定提交请款附件吗?', success: resolve }) | |
| 165 | + }) | |
| 166 | + if (!(confirmRes && confirmRes.confirm)) return | |
| 167 | + this.loading = true | |
| 168 | + try { | |
| 169 | + await procurementPlanUploadRequestAttachmentApi(data) | |
| 170 | + uni.showToast({ title: '提交成功', icon: 'success' }) | |
| 171 | + try { | |
| 172 | + uni.setStorageSync('DOMESTIC_PLAN_LIST_NEED_REFRESH', '1') | |
| 173 | + uni.setStorageSync('DOMESTIC_PLAN_DETAIL_NEED_REFRESH', '1') | |
| 174 | + } catch (e) { } | |
| 175 | + setTimeout(() => { uni.navigateBack() }, 400) | |
| 176 | + } catch (e) { | |
| 177 | + uni.showToast({ title: (e && (e.msg || e.message)) || '提交失败', icon: 'none' }) | |
| 178 | + } finally { | |
| 179 | + this.loading = false | |
| 180 | + } | |
| 181 | + } | |
| 182 | + } | |
| 183 | +} | |
| 184 | +</script> | |
| 185 | + | |
| 186 | +<style lang="scss" scoped> | |
| 187 | +.page { | |
| 188 | + display: flex; | |
| 189 | + flex-direction: column; | |
| 190 | + height: 100%; | |
| 191 | +} | |
| 192 | + | |
| 193 | +.scroll { | |
| 194 | + flex: 1; | |
| 195 | + padding: 8rpx 0 176rpx; | |
| 196 | +} | |
| 197 | + | |
| 198 | +.detail-page { | |
| 199 | + background: #f3f3f3; | |
| 200 | +} | |
| 201 | + | |
| 202 | +.footer { | |
| 203 | + z-index: 2; | |
| 204 | + position: fixed; | |
| 205 | + left: 0; | |
| 206 | + right: 0; | |
| 207 | + bottom: 0; | |
| 208 | + padding: 32rpx; | |
| 209 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | |
| 210 | + background: #fff; | |
| 211 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | |
| 212 | + | |
| 213 | + .btn { | |
| 214 | + height: 80rpx; | |
| 215 | + line-height: 80rpx; | |
| 216 | + border-radius: 12rpx; | |
| 217 | + font-size: 32rpx; | |
| 218 | + } | |
| 219 | + | |
| 220 | + .submit { | |
| 221 | + background: $theme-primary; | |
| 222 | + color: #fff; | |
| 223 | + } | |
| 224 | +} | |
| 225 | + | |
| 226 | +.section { | |
| 227 | + padding: 32rpx; | |
| 228 | + background: #fff; | |
| 229 | + margin-bottom: 20rpx; | |
| 230 | + | |
| 231 | + .company { | |
| 232 | + display: block; | |
| 233 | + font-size: 36rpx; | |
| 234 | + font-weight: 600; | |
| 235 | + color: rgba(0, 0, 0, 0.9); | |
| 236 | + padding: 8rpx 0 24rpx; | |
| 237 | + line-height: 50rpx; | |
| 238 | + } | |
| 239 | +} | |
| 240 | + | |
| 241 | +.row { | |
| 242 | + display: flex; | |
| 243 | + margin-bottom: 28rpx; | |
| 244 | + | |
| 245 | + &:last-child { | |
| 246 | + margin-bottom: 0; | |
| 247 | + } | |
| 248 | + | |
| 249 | + .label { | |
| 250 | + max-width: 420rpx; | |
| 251 | + margin-right: 20rpx; | |
| 252 | + line-height: 32rpx; | |
| 253 | + font-size: 28rpx; | |
| 254 | + color: rgba(0, 0, 0, 0.6); | |
| 255 | + } | |
| 256 | + | |
| 257 | + .value { | |
| 258 | + flex: 1; | |
| 259 | + line-height: 32rpx; | |
| 260 | + font-size: 28rpx; | |
| 261 | + color: rgba(0, 0, 0, 0.9); | |
| 262 | + text-align: right; | |
| 263 | + word-break: break-all; | |
| 264 | + } | |
| 265 | +} | |
| 266 | + | |
| 267 | +.sub-table { | |
| 268 | + background: #fff; | |
| 269 | + margin-bottom: 20rpx; | |
| 270 | +} | |
| 271 | + | |
| 272 | +.sub-header { | |
| 273 | + display: flex; | |
| 274 | + align-items: center; | |
| 275 | + padding: 16rpx 0 16rpx 32rpx; | |
| 276 | + | |
| 277 | + .sub-bar { | |
| 278 | + width: 6rpx; | |
| 279 | + height: 32rpx; | |
| 280 | + margin-right: 14rpx; | |
| 281 | + } | |
| 282 | + | |
| 283 | + .sub-title { | |
| 284 | + font-size: 30rpx; | |
| 285 | + font-weight: 600; | |
| 286 | + color: rgba(0, 0, 0, 0.9); | |
| 287 | + flex: 1; | |
| 288 | + line-height: 42rpx; | |
| 289 | + } | |
| 290 | + | |
| 291 | + .upload-btn { | |
| 292 | + margin-right: 32rpx; | |
| 293 | + height: 56rpx; | |
| 294 | + line-height: 56rpx; | |
| 295 | + padding: 0 24rpx; | |
| 296 | + font-size: 26rpx; | |
| 297 | + border-radius: 8rpx; | |
| 298 | + background: $theme-primary; | |
| 299 | + color: #fff; | |
| 300 | + } | |
| 301 | +} | |
| 302 | + | |
| 303 | +.sub-body { | |
| 304 | + padding: 0 32rpx 24rpx; | |
| 305 | + | |
| 306 | + .empty-tip { | |
| 307 | + text-align: center; | |
| 308 | + padding: 60rpx 0; | |
| 309 | + color: rgba(0, 0, 0, 0.4); | |
| 310 | + font-size: 28rpx; | |
| 311 | + } | |
| 312 | + | |
| 313 | + .file-item { | |
| 314 | + display: flex; | |
| 315 | + align-items: center; | |
| 316 | + justify-content: space-between; | |
| 317 | + padding: 20rpx 24rpx; | |
| 318 | + margin-bottom: 16rpx; | |
| 319 | + background: #fafafa; | |
| 320 | + border-radius: 8rpx; | |
| 321 | + | |
| 322 | + &:last-child { | |
| 323 | + margin-bottom: 0; | |
| 324 | + } | |
| 325 | + | |
| 326 | + .file-name { | |
| 327 | + flex: 1; | |
| 328 | + font-size: 28rpx; | |
| 329 | + color: rgba(0, 0, 0, 0.9); | |
| 330 | + word-break: break-all; | |
| 331 | + margin-right: 20rpx; | |
| 332 | + } | |
| 333 | + | |
| 334 | + .file-del { | |
| 335 | + flex-shrink: 0; | |
| 336 | + font-size: 26rpx; | |
| 337 | + color: #d54941; | |
| 338 | + } | |
| 339 | + } | |
| 340 | +} | |
| 341 | +</style> | ... | ... |
| ... | ... | @@ -101,7 +101,7 @@ |
| 101 | 101 | <script> |
| 102 | 102 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 103 | 103 | import { getDicByCodes, getDicName } from '@/utils/dic.js' |
| 104 | -import { warehouseReceiveDetailApi, warehouseReceiveSubmitAuditApi, warehouseReceiveCancelApi } from '@/api/procure-manage/warehouseMaterial.js' | |
| 104 | +import { warehouseReceiveDetailApi, warehouseReceiveSubmitAuditApi, warehouseReceiveCancelApi, warehouseReceiveGenerateNormalPayRequestApi } from '@/api/procure-manage/warehouseMaterial.js' | |
| 105 | 105 | import { getInfo } from '@/api/login.js' |
| 106 | 106 | import { downloadFile } from '@/utils/downloadFile.js' |
| 107 | 107 | |
| ... | ... | @@ -123,7 +123,8 @@ export default { |
| 123 | 123 | { text: '提交审核', visible: true, variant: 'outline', event: 'submitAudit' }, |
| 124 | 124 | { text: '审核', visible: true, variant: 'primary', event: 'audit' }, |
| 125 | 125 | { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' }, |
| 126 | - { text: '取消', visible: true, variant: 'outline', event: 'cancel' } | |
| 126 | + { text: '取消', visible: true, variant: 'outline', event: 'cancel' }, | |
| 127 | + { text: '生成正常请款单', visible: true, variant: 'primary', event: 'generatePayNormal' } | |
| 127 | 128 | ] |
| 128 | 129 | } |
| 129 | 130 | }, |
| ... | ... | @@ -168,6 +169,11 @@ export default { |
| 168 | 169 | { |
| 169 | 170 | ...this.buttons[4], |
| 170 | 171 | visible: (isDraft || isRefuse) && this.$auth.hasPermi('warehouse-manage:warehouse-material:cancel') |
| 172 | + }, | |
| 173 | + { | |
| 174 | + ...this.buttons[5], | |
| 175 | + // 生成正常请款单:由后端 showApplyPayment 标识控制(与PC一致) | |
| 176 | + visible: this.form.showApplyPayment === true && this.$auth.hasPermi('warehouse-manage:warehouse-material:generatePay') | |
| 171 | 177 | } |
| 172 | 178 | ] |
| 173 | 179 | }, |
| ... | ... | @@ -250,6 +256,7 @@ export default { |
| 250 | 256 | if (e === 'audit') return this.onAudit() |
| 251 | 257 | if (e === 'auditDetail') return this.onAuditDetail() |
| 252 | 258 | if (e === 'cancel') return this.onCancel() |
| 259 | + if (e === 'generatePayNormal') return this.onGenerateNormalPayRequest() | |
| 253 | 260 | }, |
| 254 | 261 | onEdit() { |
| 255 | 262 | uni.navigateTo({ url: '/pages/warehouse-material/modify?id=' + this.id }) |
| ... | ... | @@ -327,6 +334,17 @@ export default { |
| 327 | 334 | run: id => warehouseReceiveCancelApi(id) |
| 328 | 335 | }) |
| 329 | 336 | }, |
| 337 | + // 生成正常请款单:二次确认后调生成接口(与PC一致) | |
| 338 | + onGenerateNormalPayRequest() { | |
| 339 | + this.runWithConfirm({ | |
| 340 | + title: '生成正常请款单确认', | |
| 341 | + content: '确认生成正常请款单吗?', | |
| 342 | + loading: '生成中', | |
| 343 | + successText: '生成正常请款单成功', | |
| 344 | + failText: '生成正常请款单失败', | |
| 345 | + run: id => warehouseReceiveGenerateNormalPayRequestApi(id) | |
| 346 | + }) | |
| 347 | + }, | |
| 330 | 348 | safeText(v) { |
| 331 | 349 | const s = v == null ? '' : String(v) |
| 332 | 350 | return s.trim() ? s : '-' | ... | ... |
| ... | ... | @@ -153,7 +153,7 @@ |
| 153 | 153 | <script> |
| 154 | 154 | import DetailButtons from '@/components/detail-buttons/index.vue' |
| 155 | 155 | import { getDicByCodes, getDicName } from '@/utils/dic.js' |
| 156 | -import { weighTicketDetailApi, weighTicketSubmitAuditApi, weighTicketCancelApi } from '@/api/procure-manage/weighTicket.js' | |
| 156 | +import { weighTicketDetailApi, weighTicketSubmitAuditApi, weighTicketCancelApi, weighTicketGenerateNormalPayRequestApi } from '@/api/procure-manage/weighTicket.js' | |
| 157 | 157 | import { downloadFileApi } from '@/api/base.js' |
| 158 | 158 | import { getInfo } from '@/api/login.js' |
| 159 | 159 | |
| ... | ... | @@ -183,7 +183,9 @@ export default { |
| 183 | 183 | { text: '作废', visible: true, variant: 'outline', event: 'cancel' }, |
| 184 | 184 | { text: '上传签字凭证', visible: true, variant: 'outline', event: 'uploadSign' }, |
| 185 | 185 | { text: '上传延期说明', visible: true, variant: 'outline', event: 'uploadDelay' }, |
| 186 | - { text: '复磅', visible: true, variant: 'outline', event: 'reweigh' } | |
| 186 | + { text: '复磅', visible: true, variant: 'outline', event: 'reweigh' }, | |
| 187 | + { text: '生成正常请款单', visible: true, variant: 'primary', event: 'generatePayNormal' }, | |
| 188 | + { text: '生成补充请款单', visible: true, variant: 'primary', event: 'generatePaySupplement' } | |
| 187 | 189 | ] |
| 188 | 190 | } |
| 189 | 191 | }, |
| ... | ... | @@ -255,6 +257,14 @@ export default { |
| 255 | 257 | { |
| 256 | 258 | ...this.buttons[7], |
| 257 | 259 | visible: isPass && !isReweigh && this.$auth.hasPermi('warehouse-manage:weight-ticket:reweigh') |
| 260 | + }, | |
| 261 | + { | |
| 262 | + ...this.buttons[8], | |
| 263 | + visible: this.form.showApplyPayment === true && this.$auth.hasPermi('warehouse-manage:weight-ticket:generatePay') | |
| 264 | + }, | |
| 265 | + { | |
| 266 | + ...this.buttons[9], | |
| 267 | + visible: this.form.showApplyPayment === true && this.$auth.hasPermi('warehouse-manage:weight-ticket:generatePay') | |
| 258 | 268 | } |
| 259 | 269 | ] |
| 260 | 270 | } |
| ... | ... | @@ -369,6 +379,8 @@ export default { |
| 369 | 379 | if (e === 'uploadSign') return this.onUpload('sign') |
| 370 | 380 | if (e === 'uploadDelay') return this.onUpload('delay') |
| 371 | 381 | if (e === 'reweigh') return this.onReweigh() |
| 382 | + if (e === 'generatePayNormal') return this.onGenerateNormalPayRequest() | |
| 383 | + if (e === 'generatePaySupplement') return this.onGenerateSupplementPayRequest() | |
| 372 | 384 | }, |
| 373 | 385 | onEdit() { |
| 374 | 386 | uni.navigateTo({ url: '/pages/weight-ticket/modify?id=' + this.id }) |
| ... | ... | @@ -393,6 +405,26 @@ export default { |
| 393 | 405 | onReweigh() { |
| 394 | 406 | uni.navigateTo({ url: '/pages/weight-ticket/reweigh?id=' + this.id }) |
| 395 | 407 | }, |
| 408 | + // 生成正常请款单:二次确认后调生成接口(与PC一致) | |
| 409 | + onGenerateNormalPayRequest() { | |
| 410 | + this.runWithConfirm({ | |
| 411 | + title: '生成正常请款单确认', | |
| 412 | + content: '确认生成正常请款单吗?', | |
| 413 | + loading: '生成中', | |
| 414 | + successText: '生成正常请款单成功', | |
| 415 | + failText: '生成正常请款单失败', | |
| 416 | + run: id => weighTicketGenerateNormalPayRequestApi(id) | |
| 417 | + }) | |
| 418 | + }, | |
| 419 | + // 生成补充请款单:跳转详情+补充说明附件上传页 | |
| 420 | + onGenerateSupplementPayRequest() { | |
| 421 | + const id = this.id || (this.form && this.form.id) || '' | |
| 422 | + if (!id) { | |
| 423 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | |
| 424 | + return | |
| 425 | + } | |
| 426 | + uni.navigateTo({ url: '/pages/weight-ticket/generateSupplement?id=' + id }) | |
| 427 | + }, | |
| 396 | 428 | refreshListFlags() { |
| 397 | 429 | try { |
| 398 | 430 | uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | ... | ... |
pages/weight-ticket/generateSupplement.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <view class="page"> | |
| 3 | + <scroll-view class="scroll" scroll-y> | |
| 4 | + <view class="detail-page"> | |
| 5 | + <!-- 基础信息 --> | |
| 6 | + <view class="section"> | |
| 7 | + <text class="row company">{{ safeText(form.code) }}</text> | |
| 8 | + <view class="row"><text class="label">类型</text><text class="value">{{ typeName }}</text></view> | |
| 9 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(planCodeText) }}</text></view> | |
| 10 | + <view class="row"><text class="label">单位</text><text class="value">{{ safeText(form.unit) }}</text></view> | |
| 11 | + <view class="row"><text class="label">供料单位</text><text class="value">{{ safeText(form.supplierName) }}</text></view> | |
| 12 | + <view class="row"><text class="label">收料单位</text><text class="value">{{ safeText(form.companyShortName) }}</text></view> | |
| 13 | + </view> | |
| 14 | + | |
| 15 | + <!-- 计划单明细 --> | |
| 16 | + <view class="sub-table"> | |
| 17 | + <view class="sub-header"> | |
| 18 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 19 | + <text class="sub-title">计划单明细</text> | |
| 20 | + </view> | |
| 21 | + <view class="sub-body"> | |
| 22 | + <view v-if="!planList.length" class="empty-tip">暂无明细</view> | |
| 23 | + <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card"> | |
| 24 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 25 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> | |
| 26 | + <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view> | |
| 27 | + <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | |
| 28 | + </view> | |
| 29 | + </view> | |
| 30 | + </view> | |
| 31 | + | |
| 32 | + <!-- 过磅明细 --> | |
| 33 | + <view class="sub-table"> | |
| 34 | + <view class="sub-header"> | |
| 35 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 36 | + <text class="sub-title">过磅明细</text> | |
| 37 | + </view> | |
| 38 | + <view class="sub-body"> | |
| 39 | + <view v-if="!weighList.length" class="empty-tip">暂无明细</view> | |
| 40 | + <view v-for="(item, idx) in weighList" :key="'w-' + (item.id || idx)" class="card"> | |
| 41 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 42 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> | |
| 43 | + <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> | |
| 44 | + <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view> | |
| 45 | + <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | |
| 46 | + </view> | |
| 47 | + </view> | |
| 48 | + </view> | |
| 49 | + | |
| 50 | + <!-- 申请数量明细(仅买断或有数据时展示) --> | |
| 51 | + <view v-if="isBuyout" class="sub-table"> | |
| 52 | + <view class="sub-header"> | |
| 53 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 54 | + <text class="sub-title">申请数量明细</text> | |
| 55 | + </view> | |
| 56 | + <view class="sub-body"> | |
| 57 | + <view v-if="!applyList.length" class="empty-tip">暂无明细</view> | |
| 58 | + <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> | |
| 59 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | |
| 60 | + <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> | |
| 61 | + <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | |
| 62 | + </view> | |
| 63 | + </view> | |
| 64 | + </view> | |
| 65 | + | |
| 66 | + <!-- 其他信息 --> | |
| 67 | + <view class="title-header"> | |
| 68 | + <image class="title-header_icon" src="/static/images/title.png" /> | |
| 69 | + <span>其他信息</span> | |
| 70 | + </view> | |
| 71 | + <view class="section"> | |
| 72 | + <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view> | |
| 73 | + <view class="row"><text class="label">过磅总重</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view> | |
| 74 | + <view class="row"><text class="label">实际伙重</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view> | |
| 75 | + <view class="row"><text class="label">货物净重</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> | |
| 76 | + <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> | |
| 77 | + <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> | |
| 78 | + <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> | |
| 79 | + <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> | |
| 80 | + <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | |
| 81 | + </view> | |
| 82 | + | |
| 83 | + <!-- 业务摘要 --> | |
| 84 | + <view class="title-header"> | |
| 85 | + <image class="title-header_icon" src="/static/images/title.png" /> | |
| 86 | + <span>业务摘要</span> | |
| 87 | + </view> | |
| 88 | + <view class="section"> | |
| 89 | + <text class="remark-text">{{ safeText(form.businessSummary) }}</text> | |
| 90 | + </view> | |
| 91 | + | |
| 92 | + <!-- 特别说明 --> | |
| 93 | + <view class="title-header"> | |
| 94 | + <image class="title-header_icon" src="/static/images/title.png" /> | |
| 95 | + <span>特别说明</span> | |
| 96 | + </view> | |
| 97 | + <view class="section"> | |
| 98 | + <text class="remark-text">{{ safeText(form.specialNote) }}</text> | |
| 99 | + </view> | |
| 100 | + | |
| 101 | + <!-- 单据备注 --> | |
| 102 | + <view class="title-header"> | |
| 103 | + <image class="title-header_icon" src="/static/images/title.png" /> | |
| 104 | + <span>单据备注</span> | |
| 105 | + </view> | |
| 106 | + <view class="section"> | |
| 107 | + <text class="remark-text">{{ safeText(form.documentRemark) }}</text> | |
| 108 | + </view> | |
| 109 | + | |
| 110 | + <!-- 补充说明附件(必传) --> | |
| 111 | + <view class="sub-table"> | |
| 112 | + <view class="sub-header"> | |
| 113 | + <image class="sub-bar" src="/static/images/title.png" /> | |
| 114 | + <text class="sub-title">补充说明附件</text> | |
| 115 | + <view class="upload-btn" @click="selectFile">上传文件</view> | |
| 116 | + </view> | |
| 117 | + <view class="sub-body"> | |
| 118 | + <view v-if="!fileList.length" class="empty-tip">暂无附件,请上传</view> | |
| 119 | + <view v-for="(file, idx) in fileList" :key="file.id || idx" class="file-item"> | |
| 120 | + <text class="file-name">{{ file.name || '未命名文件' }}</text> | |
| 121 | + <text class="file-del" @click="removeFile(idx)">删除</text> | |
| 122 | + </view> | |
| 123 | + </view> | |
| 124 | + </view> | |
| 125 | + </view> | |
| 126 | + </scroll-view> | |
| 127 | + <view class="footer"> | |
| 128 | + <button class="btn submit" type="primary" :loading="loading" @click="onSubmit">提交</button> | |
| 129 | + </view> | |
| 130 | + </view> | |
| 131 | +</template> | |
| 132 | + | |
| 133 | +<script> | |
| 134 | +import { weighTicketDetailApi, weighTicketGenerateSupplementPayRequestApi } from '@/api/procure-manage/weighTicket.js' | |
| 135 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | |
| 136 | +import upload from '@/utils/upload' | |
| 137 | +import { uploadFileApi } from '@/api/base.js' | |
| 138 | + | |
| 139 | +export default { | |
| 140 | + name: 'WeightTicketGenerateSupplement', | |
| 141 | + data() { | |
| 142 | + return { | |
| 143 | + id: '', | |
| 144 | + loading: false, | |
| 145 | + form: {}, | |
| 146 | + planList: [], | |
| 147 | + weighList: [], | |
| 148 | + applyList: [], | |
| 149 | + buyout: false, | |
| 150 | + // 补充说明附件列表 [{ id, name }] | |
| 151 | + fileList: [], | |
| 152 | + dicOptions: { | |
| 153 | + TYPE: [], | |
| 154 | + DEDUCTION_TYPE: [] | |
| 155 | + } | |
| 156 | + } | |
| 157 | + }, | |
| 158 | + computed: { | |
| 159 | + typeName() { | |
| 160 | + const v = this.form.type == null ? '' : String(this.form.type) | |
| 161 | + if (!v) return '-' | |
| 162 | + return getDicName('TYPE', v, this.dicOptions.TYPE) || v | |
| 163 | + }, | |
| 164 | + planCodeText() { | |
| 165 | + const codes = Array.from(new Set((this.planList || []).map(it => it.planCode).filter(Boolean))) | |
| 166 | + return codes.join(',') | |
| 167 | + }, | |
| 168 | + deductionNames() { | |
| 169 | + const codes = (this.form.deductionTypes == null ? '' : String(this.form.deductionTypes)).split(',').filter(Boolean) | |
| 170 | + const names = codes.map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)).filter(Boolean) | |
| 171 | + return names.length ? names.join('、') : '-' | |
| 172 | + }, | |
| 173 | + isBuyout() { | |
| 174 | + return this.buyout || (this.applyList || []).length > 0 | |
| 175 | + } | |
| 176 | + }, | |
| 177 | + onLoad(query) { | |
| 178 | + this.id = (query && query.id) || '' | |
| 179 | + this.loadDicData() | |
| 180 | + this.loadDetail() | |
| 181 | + }, | |
| 182 | + methods: { | |
| 183 | + async loadDicData() { | |
| 184 | + try { | |
| 185 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | |
| 186 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | |
| 187 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | |
| 188 | + } catch (e) { | |
| 189 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | |
| 190 | + } | |
| 191 | + }, | |
| 192 | + loadDetail() { | |
| 193 | + if (!this.id) { | |
| 194 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | |
| 195 | + return | |
| 196 | + } | |
| 197 | + uni.showLoading && uni.showLoading({ title: '加载中...', mask: true }) | |
| 198 | + weighTicketDetailApi({ id: this.id }) | |
| 199 | + .then(res => { | |
| 200 | + const data = res && res.data ? (res.data.data || res.data) : {} | |
| 201 | + this.form = Object.assign({}, data) | |
| 202 | + this.buyout = !!data.buyout | |
| 203 | + this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] | |
| 204 | + this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] | |
| 205 | + this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : [] | |
| 206 | + }) | |
| 207 | + .catch(() => { | |
| 208 | + uni.showToast({ title: '加载详情失败', icon: 'none' }) | |
| 209 | + }) | |
| 210 | + .finally(() => { | |
| 211 | + uni.hideLoading && uni.hideLoading() | |
| 212 | + }) | |
| 213 | + }, | |
| 214 | + // 选择并上传文件(多文件逐个追加) | |
| 215 | + selectFile() { | |
| 216 | + if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { | |
| 217 | + uni.chooseMessageFile({ | |
| 218 | + count: 9, | |
| 219 | + type: 'all', | |
| 220 | + success: async res => { | |
| 221 | + const files = (res && res.tempFiles) || [] | |
| 222 | + if (!files.length) return | |
| 223 | + uni.showLoading({ title: '上传中...', mask: true }) | |
| 224 | + try { | |
| 225 | + for (const f of files) { | |
| 226 | + const name = f.name || 'file' | |
| 227 | + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' }) | |
| 228 | + const d = r && r.data ? r.data : r | |
| 229 | + const id = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId)))) | |
| 230 | + ? String(d.id || d.fileId || d.data.id || d.data.fileId) | |
| 231 | + : '' | |
| 232 | + if (id) this.fileList.push({ id, name }) | |
| 233 | + } | |
| 234 | + } catch (e) { | |
| 235 | + uni.showToast({ title: '上传失败', icon: 'none' }) | |
| 236 | + } finally { | |
| 237 | + uni.hideLoading() | |
| 238 | + } | |
| 239 | + }, | |
| 240 | + fail: () => { | |
| 241 | + uni.showToast({ title: '未选择文件', icon: 'none' }) | |
| 242 | + } | |
| 243 | + }) | |
| 244 | + return | |
| 245 | + } | |
| 246 | + // H5 兜底:动态创建原生 input | |
| 247 | + try { | |
| 248 | + const input = document.createElement('input') | |
| 249 | + input.type = 'file' | |
| 250 | + input.multiple = true | |
| 251 | + input.style.position = 'fixed' | |
| 252 | + input.style.left = '-9999px' | |
| 253 | + document.body.appendChild(input) | |
| 254 | + input.addEventListener('change', this.onFileChange) | |
| 255 | + input.click() | |
| 256 | + setTimeout(() => { document.body.removeChild(input) }, 1000) | |
| 257 | + } catch (e) { | |
| 258 | + uni.showToast({ title: '无法打开文件选择', icon: 'none' }) | |
| 259 | + } | |
| 260 | + }, | |
| 261 | + async onFileChange(e) { | |
| 262 | + const files = (e && e.target && e.target.files) || [] | |
| 263 | + if (!files.length) return | |
| 264 | + uni.showLoading({ title: '上传中...', mask: true }) | |
| 265 | + try { | |
| 266 | + for (const file of files) { | |
| 267 | + const name = file.name || '' | |
| 268 | + const fd = new FormData() | |
| 269 | + fd.append('file', file, name) | |
| 270 | + const d = await uploadFileApi(fd) | |
| 271 | + const data = d && d.data ? d.data : d | |
| 272 | + const id = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId)))) | |
| 273 | + ? String(data.id || data.fileId || data.data.id || data.data.fileId) | |
| 274 | + : '' | |
| 275 | + if (id) this.fileList.push({ id, name }) | |
| 276 | + } | |
| 277 | + } catch (e2) { | |
| 278 | + uni.showToast({ title: '上传失败', icon: 'none' }) | |
| 279 | + } finally { | |
| 280 | + uni.hideLoading() | |
| 281 | + if (e && e.target) e.target.value = '' | |
| 282 | + } | |
| 283 | + }, | |
| 284 | + removeFile(idx) { | |
| 285 | + this.fileList.splice(idx, 1) | |
| 286 | + }, | |
| 287 | + async onSubmit() { | |
| 288 | + if (!this.id) { | |
| 289 | + uni.showToast({ title: '缺少单据id', icon: 'none' }) | |
| 290 | + return | |
| 291 | + } | |
| 292 | + // 补充说明附件必传(与PC一致) | |
| 293 | + if (!this.fileList.length) { | |
| 294 | + uni.showToast({ title: '请上传补充说明附件', icon: 'none' }) | |
| 295 | + return | |
| 296 | + } | |
| 297 | + const ids = this.fileList.map(it => it.id).filter(Boolean) | |
| 298 | + const names = this.fileList.map(it => it.name).filter(Boolean) | |
| 299 | + const confirmRes = await new Promise(resolve => { | |
| 300 | + uni.showModal({ title: '提交确认', content: '确定生成补充请款单吗?', success: resolve }) | |
| 301 | + }) | |
| 302 | + if (!(confirmRes && confirmRes.confirm)) return | |
| 303 | + this.loading = true | |
| 304 | + try { | |
| 305 | + await weighTicketGenerateSupplementPayRequestApi({ | |
| 306 | + sourceId: this.id, | |
| 307 | + supplementFileIds: ids.join(','), | |
| 308 | + supplementFileNames: names.join(',') | |
| 309 | + }) | |
| 310 | + uni.showToast({ title: '生成补充请款单成功', icon: 'none' }) | |
| 311 | + try { | |
| 312 | + uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | |
| 313 | + uni.setStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH', '1') | |
| 314 | + } catch (e) { } | |
| 315 | + setTimeout(() => { uni.navigateBack() }, 400) | |
| 316 | + } catch (e) { | |
| 317 | + uni.showToast({ title: (e && (e.msg || e.message)) || '生成补充请款单失败', icon: 'none' }) | |
| 318 | + } finally { | |
| 319 | + this.loading = false | |
| 320 | + } | |
| 321 | + }, | |
| 322 | + safeText(v) { | |
| 323 | + const s = v == null ? '' : String(v) | |
| 324 | + return s.trim() ? s : '-' | |
| 325 | + }, | |
| 326 | + formatNumber(v) { | |
| 327 | + if (v === null || v === undefined || v === '') return '-' | |
| 328 | + const n = Number(v) | |
| 329 | + if (isNaN(n)) return String(v) | |
| 330 | + return n.toLocaleString('zh-CN', { maximumFractionDigits: 4 }) | |
| 331 | + } | |
| 332 | + } | |
| 333 | +} | |
| 334 | +</script> | |
| 335 | + | |
| 336 | +<style lang="scss" scoped> | |
| 337 | +.page { | |
| 338 | + display: flex; | |
| 339 | + flex-direction: column; | |
| 340 | + height: 100%; | |
| 341 | +} | |
| 342 | + | |
| 343 | +.scroll { | |
| 344 | + flex: 1; | |
| 345 | + padding: 8rpx 0 176rpx; | |
| 346 | +} | |
| 347 | + | |
| 348 | +.detail-page { | |
| 349 | + background: #f3f3f3; | |
| 350 | +} | |
| 351 | + | |
| 352 | +.footer { | |
| 353 | + z-index: 2; | |
| 354 | + position: fixed; | |
| 355 | + left: 0; | |
| 356 | + right: 0; | |
| 357 | + bottom: 0; | |
| 358 | + padding: 32rpx; | |
| 359 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | |
| 360 | + background: #fff; | |
| 361 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | |
| 362 | + | |
| 363 | + .btn { | |
| 364 | + height: 80rpx; | |
| 365 | + line-height: 80rpx; | |
| 366 | + border-radius: 12rpx; | |
| 367 | + font-size: 32rpx; | |
| 368 | + } | |
| 369 | + | |
| 370 | + .submit { | |
| 371 | + background: $theme-primary; | |
| 372 | + color: #fff; | |
| 373 | + } | |
| 374 | +} | |
| 375 | + | |
| 376 | +.section { | |
| 377 | + padding: 32rpx; | |
| 378 | + background: #fff; | |
| 379 | + margin-bottom: 20rpx; | |
| 380 | + | |
| 381 | + .company { | |
| 382 | + display: block; | |
| 383 | + font-size: 36rpx; | |
| 384 | + font-weight: 600; | |
| 385 | + color: rgba(0, 0, 0, 0.9); | |
| 386 | + padding: 8rpx 0 24rpx; | |
| 387 | + line-height: 50rpx; | |
| 388 | + } | |
| 389 | +} | |
| 390 | + | |
| 391 | +.title-header { | |
| 392 | + display: flex; | |
| 393 | + align-items: center; | |
| 394 | + padding: 24rpx 32rpx 12rpx; | |
| 395 | + background-color: #ffffff; | |
| 396 | + | |
| 397 | + .title-header_icon { | |
| 398 | + width: 36rpx; | |
| 399 | + height: 36rpx; | |
| 400 | + margin-right: 12rpx; | |
| 401 | + } | |
| 402 | + | |
| 403 | + span { | |
| 404 | + font-size: 34rpx; | |
| 405 | + font-weight: 600; | |
| 406 | + color: rgba(0, 0, 0, 0.9); | |
| 407 | + } | |
| 408 | +} | |
| 409 | + | |
| 410 | +.row { | |
| 411 | + display: flex; | |
| 412 | + margin-bottom: 28rpx; | |
| 413 | + | |
| 414 | + &:last-child { | |
| 415 | + margin-bottom: 0; | |
| 416 | + } | |
| 417 | + | |
| 418 | + .label { | |
| 419 | + max-width: 420rpx; | |
| 420 | + margin-right: 20rpx; | |
| 421 | + line-height: 32rpx; | |
| 422 | + font-size: 28rpx; | |
| 423 | + color: rgba(0, 0, 0, 0.6); | |
| 424 | + } | |
| 425 | + | |
| 426 | + .value { | |
| 427 | + flex: 1; | |
| 428 | + line-height: 32rpx; | |
| 429 | + font-size: 28rpx; | |
| 430 | + color: rgba(0, 0, 0, 0.9); | |
| 431 | + text-align: right; | |
| 432 | + word-break: break-all; | |
| 433 | + } | |
| 434 | +} | |
| 435 | + | |
| 436 | +.remark-text { | |
| 437 | + font-size: 28rpx; | |
| 438 | + color: rgba(0, 0, 0, 0.9); | |
| 439 | + line-height: 1.6; | |
| 440 | + white-space: pre-wrap; | |
| 441 | +} | |
| 442 | + | |
| 443 | +.sub-table { | |
| 444 | + background: #fff; | |
| 445 | + margin-bottom: 20rpx; | |
| 446 | +} | |
| 447 | + | |
| 448 | +.sub-header { | |
| 449 | + display: flex; | |
| 450 | + align-items: center; | |
| 451 | + padding: 16rpx 0 16rpx 32rpx; | |
| 452 | + | |
| 453 | + .sub-bar { | |
| 454 | + width: 6rpx; | |
| 455 | + height: 32rpx; | |
| 456 | + margin-right: 14rpx; | |
| 457 | + } | |
| 458 | + | |
| 459 | + .sub-title { | |
| 460 | + font-size: 30rpx; | |
| 461 | + font-weight: 600; | |
| 462 | + color: rgba(0, 0, 0, 0.9); | |
| 463 | + flex: 1; | |
| 464 | + line-height: 42rpx; | |
| 465 | + } | |
| 466 | + | |
| 467 | + .upload-btn { | |
| 468 | + margin-right: 32rpx; | |
| 469 | + height: 56rpx; | |
| 470 | + line-height: 56rpx; | |
| 471 | + padding: 0 24rpx; | |
| 472 | + font-size: 26rpx; | |
| 473 | + border-radius: 8rpx; | |
| 474 | + background: $theme-primary; | |
| 475 | + color: #fff; | |
| 476 | + } | |
| 477 | +} | |
| 478 | + | |
| 479 | +.sub-body { | |
| 480 | + padding: 0 32rpx 24rpx; | |
| 481 | + | |
| 482 | + .empty-tip { | |
| 483 | + text-align: center; | |
| 484 | + padding: 60rpx 0; | |
| 485 | + color: rgba(0, 0, 0, 0.4); | |
| 486 | + font-size: 28rpx; | |
| 487 | + } | |
| 488 | + | |
| 489 | + .card { | |
| 490 | + position: relative; | |
| 491 | + background: #fafafa; | |
| 492 | + border-radius: 12rpx; | |
| 493 | + padding: 32rpx 28rpx 20rpx; | |
| 494 | + margin-bottom: 24rpx; | |
| 495 | + | |
| 496 | + .card-index { | |
| 497 | + position: absolute; | |
| 498 | + top: 0; | |
| 499 | + right: 0; | |
| 500 | + background: rgba(24, 144, 255, 0.08); | |
| 501 | + color: $theme-primary; | |
| 502 | + font-size: 22rpx; | |
| 503 | + line-height: 36rpx; | |
| 504 | + padding: 0 16rpx; | |
| 505 | + border-bottom-left-radius: 12rpx; | |
| 506 | + border-top-right-radius: 12rpx; | |
| 507 | + } | |
| 508 | + | |
| 509 | + .row { | |
| 510 | + align-items: center; | |
| 511 | + justify-content: space-between; | |
| 512 | + padding: 14rpx 0; | |
| 513 | + margin-bottom: 0; | |
| 514 | + border-bottom: 1rpx dashed #f2f2f2; | |
| 515 | + | |
| 516 | + &:last-child { | |
| 517 | + border-bottom: none; | |
| 518 | + } | |
| 519 | + | |
| 520 | + .label { | |
| 521 | + flex-shrink: 0; | |
| 522 | + width: 220rpx; | |
| 523 | + max-width: none; | |
| 524 | + margin-right: 0; | |
| 525 | + font-size: 28rpx; | |
| 526 | + color: rgba(0, 0, 0, 0.6); | |
| 527 | + line-height: 40rpx; | |
| 528 | + } | |
| 529 | + | |
| 530 | + .value { | |
| 531 | + flex: 1; | |
| 532 | + text-align: right; | |
| 533 | + font-size: 28rpx; | |
| 534 | + color: rgba(0, 0, 0, 0.9); | |
| 535 | + line-height: 40rpx; | |
| 536 | + overflow: hidden; | |
| 537 | + text-overflow: ellipsis; | |
| 538 | + white-space: nowrap; | |
| 539 | + } | |
| 540 | + } | |
| 541 | + } | |
| 542 | + | |
| 543 | + .file-item { | |
| 544 | + display: flex; | |
| 545 | + align-items: center; | |
| 546 | + justify-content: space-between; | |
| 547 | + padding: 20rpx 24rpx; | |
| 548 | + margin-bottom: 16rpx; | |
| 549 | + background: #fafafa; | |
| 550 | + border-radius: 8rpx; | |
| 551 | + | |
| 552 | + &:last-child { | |
| 553 | + margin-bottom: 0; | |
| 554 | + } | |
| 555 | + | |
| 556 | + .file-name { | |
| 557 | + flex: 1; | |
| 558 | + font-size: 28rpx; | |
| 559 | + color: rgba(0, 0, 0, 0.9); | |
| 560 | + word-break: break-all; | |
| 561 | + margin-right: 20rpx; | |
| 562 | + } | |
| 563 | + | |
| 564 | + .file-del { | |
| 565 | + flex-shrink: 0; | |
| 566 | + font-size: 26rpx; | |
| 567 | + color: #d54941; | |
| 568 | + } | |
| 569 | + } | |
| 570 | +} | |
| 571 | +</style> | ... | ... |