Showing
14 changed files
with
5408 additions
and
12 deletions
api/procure-manage/weighTicket.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | +import { ContentTypeEnum } from '@/utils/httpEnum' | ||
| 3 | + | ||
| 4 | +// 过磅码单(对齐 PC 端 api/warehouse-manage/weight-ticket) | ||
| 5 | +const baseUrl = '/procurement/weighing/ticket' | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 分页查询过磅单列表 | ||
| 9 | + * params: pageIndex, pageSize, code, planCode, supplierName, companyShortId, | ||
| 10 | + * approvalStatus, createBy, startTime, endTime, deleted(boolean) | ||
| 11 | + */ | ||
| 12 | +export function weighTicketQueryApi(params) { | ||
| 13 | + return request({ | ||
| 14 | + url: baseUrl + '/query', | ||
| 15 | + method: 'get', | ||
| 16 | + params | ||
| 17 | + }) | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 生成过磅单编号(直接返回编号字符串) | ||
| 22 | + */ | ||
| 23 | +export function weighTicketGenerateCodeApi() { | ||
| 24 | + return request({ | ||
| 25 | + url: baseUrl + '/generateCode', | ||
| 26 | + method: 'get' | ||
| 27 | + }) | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * 查询过磅单可选计划列表 | ||
| 32 | + * params: pageIndex, pageSize, code(计划编号), companyName(收料单位) | ||
| 33 | + */ | ||
| 34 | +export function weighingTicketPlansApi(params) { | ||
| 35 | + return request({ | ||
| 36 | + url: baseUrl + '/weighingTicketPlans', | ||
| 37 | + method: 'get', | ||
| 38 | + params | ||
| 39 | + }) | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +/** | ||
| 43 | + * 根据计划id集合查询计划明细行 | ||
| 44 | + * ids: 计划id数组 | ||
| 45 | + */ | ||
| 46 | +export function weighTicketPlanLinesApi(ids) { | ||
| 47 | + return request({ | ||
| 48 | + url: baseUrl + '/planLines', | ||
| 49 | + method: 'get', | ||
| 50 | + params: { ids: (ids || []).join(',') } | ||
| 51 | + }) | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * 查询过磅单详情 | ||
| 56 | + */ | ||
| 57 | +export function weighTicketDetailApi(params) { | ||
| 58 | + return request({ | ||
| 59 | + url: baseUrl, | ||
| 60 | + method: 'get', | ||
| 61 | + params | ||
| 62 | + }) | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +/** | ||
| 66 | + * 提交审核 | ||
| 67 | + */ | ||
| 68 | +export function weighTicketSubmitAuditApi(id) { | ||
| 69 | + return request({ | ||
| 70 | + url: baseUrl + '/submit?id=' + id, | ||
| 71 | + method: 'put' | ||
| 72 | + }) | ||
| 73 | +} | ||
| 74 | + | ||
| 75 | +/** | ||
| 76 | + * 作废过磅单 | ||
| 77 | + */ | ||
| 78 | +export function weighTicketCancelApi(id) { | ||
| 79 | + return request({ | ||
| 80 | + url: baseUrl + '/delete?id=' + id, | ||
| 81 | + method: 'put' | ||
| 82 | + }) | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +/** | ||
| 86 | + * 新增过磅单 | ||
| 87 | + */ | ||
| 88 | +export function weighTicketCreateApi(data) { | ||
| 89 | + return request({ | ||
| 90 | + url: baseUrl + '/create', | ||
| 91 | + method: 'post', | ||
| 92 | + data, | ||
| 93 | + contentType: ContentTypeEnum.JSON | ||
| 94 | + }) | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +/** | ||
| 98 | + * 修改过磅单 | ||
| 99 | + */ | ||
| 100 | +export function weighTicketUpdateApi(data) { | ||
| 101 | + return request({ | ||
| 102 | + url: baseUrl, | ||
| 103 | + method: 'put', | ||
| 104 | + data, | ||
| 105 | + contentType: ContentTypeEnum.JSON | ||
| 106 | + }) | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +/** | ||
| 110 | + * 上传签字凭证 | ||
| 111 | + * data: { id, fileIds(逗号分隔), fileNames(逗号分隔) } | ||
| 112 | + */ | ||
| 113 | +export function weighTicketUploadSignApi(data) { | ||
| 114 | + return request({ | ||
| 115 | + url: baseUrl + '/attachment/sign', | ||
| 116 | + method: 'put', | ||
| 117 | + data, | ||
| 118 | + contentType: ContentTypeEnum.JSON | ||
| 119 | + }) | ||
| 120 | +} | ||
| 121 | + | ||
| 122 | +/** | ||
| 123 | + * 上传延期说明附件 | ||
| 124 | + * data: { id, fileIds(逗号分隔), fileNames(逗号分隔) } | ||
| 125 | + */ | ||
| 126 | +export function weighTicketUploadDelayApi(data) { | ||
| 127 | + return request({ | ||
| 128 | + url: baseUrl + '/attachment/delay', | ||
| 129 | + method: 'put', | ||
| 130 | + data, | ||
| 131 | + contentType: ContentTypeEnum.JSON | ||
| 132 | + }) | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +/** | ||
| 136 | + * 公司简称下拉数据(PC: base-data/short-name) | ||
| 137 | + */ | ||
| 138 | +export function companyShortQueryApi(params) { | ||
| 139 | + return request({ | ||
| 140 | + url: '/basedata/company/short/query', | ||
| 141 | + method: 'get', | ||
| 142 | + params | ||
| 143 | + }) | ||
| 144 | +} |
| @@ -6,7 +6,7 @@ module.exports = { | @@ -6,7 +6,7 @@ module.exports = { | ||
| 6 | // baseUrl: 'http://ft.wecando21cn.com/api', | 6 | // baseUrl: 'http://ft.wecando21cn.com/api', |
| 7 | // baseUrl: 'http://gjtd.ahcjxc.com:81/api', | 7 | // baseUrl: 'http://gjtd.ahcjxc.com:81/api', |
| 8 | baseUrl: 'http://erp.qgutech.com/api', | 8 | baseUrl: 'http://erp.qgutech.com/api', |
| 9 | - // baseUrl: 'http://127.0.0.1:8085', | 9 | + // baseUrl: 'http://10.9.5.246:8081', |
| 10 | // 应用信息 | 10 | // 应用信息 |
| 11 | appInfo: { | 11 | appInfo: { |
| 12 | // 应用名称 | 12 | // 应用名称 |
| @@ -541,6 +541,54 @@ | @@ -541,6 +541,54 @@ | ||
| 541 | } | 541 | } |
| 542 | }, | 542 | }, |
| 543 | { | 543 | { |
| 544 | + "path": "pages/weight-ticket/index", | ||
| 545 | + "style": { | ||
| 546 | + "navigationBarTitleText": "过磅码单", | ||
| 547 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 548 | + "navigationBarTextStyle": "black" | ||
| 549 | + } | ||
| 550 | + }, | ||
| 551 | + { | ||
| 552 | + "path": "pages/weight-ticket/add", | ||
| 553 | + "style": { | ||
| 554 | + "navigationBarTitleText": "新增过磅码单", | ||
| 555 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 556 | + "navigationBarTextStyle": "black" | ||
| 557 | + } | ||
| 558 | + }, | ||
| 559 | + { | ||
| 560 | + "path": "pages/weight-ticket/detail", | ||
| 561 | + "style": { | ||
| 562 | + "navigationBarTitleText": "过磅码单详情", | ||
| 563 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 564 | + "navigationBarTextStyle": "black" | ||
| 565 | + } | ||
| 566 | + }, | ||
| 567 | + { | ||
| 568 | + "path": "pages/weight-ticket/modify", | ||
| 569 | + "style": { | ||
| 570 | + "navigationBarTitleText": "编辑过磅码单", | ||
| 571 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 572 | + "navigationBarTextStyle": "black" | ||
| 573 | + } | ||
| 574 | + }, | ||
| 575 | + { | ||
| 576 | + "path": "pages/weight-ticket/upload", | ||
| 577 | + "style": { | ||
| 578 | + "navigationBarTitleText": "上传附件", | ||
| 579 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 580 | + "navigationBarTextStyle": "black" | ||
| 581 | + } | ||
| 582 | + }, | ||
| 583 | + { | ||
| 584 | + "path": "pages/weight-ticket/reweigh", | ||
| 585 | + "style": { | ||
| 586 | + "navigationBarTitleText": "复磅", | ||
| 587 | + "navigationBarBackgroundColor": "#ffffff", | ||
| 588 | + "navigationBarTextStyle": "black" | ||
| 589 | + } | ||
| 590 | + }, | ||
| 591 | + { | ||
| 544 | "path": "pages/order_list/index", | 592 | "path": "pages/order_list/index", |
| 545 | "style": { | 593 | "style": { |
| 546 | "navigationBarTitleText": "订货单列表", | 594 | "navigationBarTitleText": "订货单列表", |
| @@ -203,6 +203,42 @@ export default { | @@ -203,6 +203,42 @@ export default { | ||
| 203 | icon: '/static/images/index/draft_order.png', | 203 | icon: '/static/images/index/draft_order.png', |
| 204 | link: '/pages/domestic-agreement/index', | 204 | link: '/pages/domestic-agreement/index', |
| 205 | name: 'DomesticAgreement' | 205 | name: 'DomesticAgreement' |
| 206 | + }, | ||
| 207 | + { | ||
| 208 | + text: '过磅码单', | ||
| 209 | + icon: '/static/images/index/contract_foreign_unplan.png', | ||
| 210 | + link: '/pages/weight-ticket/index', | ||
| 211 | + name: 'WeightTicket' | ||
| 212 | + }, | ||
| 213 | + { | ||
| 214 | + text: '化验送样单', | ||
| 215 | + icon: '/static/images/index/contract_unlocked_operation.png', | ||
| 216 | + link: '/pages/sample-submission/index', | ||
| 217 | + name: 'SampleSubmission' | ||
| 218 | + }, | ||
| 219 | + { | ||
| 220 | + text: '原料化验报告单', | ||
| 221 | + icon: '/static/images/index/contract_retail.png', | ||
| 222 | + link: '/pages/material-test/index', | ||
| 223 | + name: 'MaterialTest' | ||
| 224 | + }, | ||
| 225 | + { | ||
| 226 | + text: '原料结算详情单', | ||
| 227 | + icon: '/static/images/index/dev_manage.png', | ||
| 228 | + link: '/pages/material-settlement/index', | ||
| 229 | + name: 'MaterialSettlement' | ||
| 230 | + }, | ||
| 231 | + { | ||
| 232 | + text: '仓库收料单', | ||
| 233 | + icon: '/static/images/index/credit_manage.png', | ||
| 234 | + link: '/pages/warehouse-material/index', | ||
| 235 | + name: 'WarehouseMaterial' | ||
| 236 | + }, | ||
| 237 | + { | ||
| 238 | + text: '买断入库核算单', | ||
| 239 | + icon: '/static/images/index/draft_order.png', | ||
| 240 | + link: '/pages/outright-purchase/index', | ||
| 241 | + name: 'OuthrightPurchase' | ||
| 206 | } | 242 | } |
| 207 | ] | 243 | ] |
| 208 | }, | 244 | }, |
| @@ -162,12 +162,11 @@ | @@ -162,12 +162,11 @@ | ||
| 162 | </uni-list-item> | 162 | </uni-list-item> |
| 163 | 163 | ||
| 164 | <uni-list-item | 164 | <uni-list-item |
| 165 | - v-if="mode === 'view'" | ||
| 166 | - :class="['select-item', item.workshopName ? 'is-filled' : 'is-empty']" | ||
| 167 | - :rightText="item.workshopName || '-'" | 165 | + v-if="!canEditWorkshop" |
| 166 | + title="分厂" | ||
| 168 | > | 167 | > |
| 169 | - <template v-slot:body> | ||
| 170 | - <view class="item-title"><text>分厂</text></view> | 168 | + <template v-slot:footer> |
| 169 | + <text class="lock-value">{{ safeText(item.workshopName) }}</text> | ||
| 171 | </template> | 170 | </template> |
| 172 | </uni-list-item> | 171 | </uni-list-item> |
| 173 | <uni-list-item | 172 | <uni-list-item |
| @@ -233,6 +232,7 @@ export default { | @@ -233,6 +232,7 @@ export default { | ||
| 233 | components: { SingleSelectSheet }, | 232 | components: { SingleSelectSheet }, |
| 234 | props: { | 233 | props: { |
| 235 | mode: { type: String, default: 'edit' }, | 234 | mode: { type: String, default: 'edit' }, |
| 235 | + canEditWorkshop: { type: Boolean, default: false }, | ||
| 236 | list: { type: Array, default: function () { return [] } }, | 236 | list: { type: Array, default: function () { return [] } }, |
| 237 | max: { type: Number, default: 50 }, | 237 | max: { type: Number, default: 50 }, |
| 238 | productOptions: { type: Array, default: function () { return [] } }, | 238 | productOptions: { type: Array, default: function () { return [] } }, |
pages/weight-ticket/add.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <uni-list> | ||
| 5 | + <!-- 编号 --> | ||
| 6 | + <uni-list-item class="select-item" :class="form.code ? 'is-filled' : 'is-empty'"> | ||
| 7 | + <template v-slot:body> | ||
| 8 | + <view class="item-title"><text class="required">*</text><text>编号</text></view> | ||
| 9 | + </template> | ||
| 10 | + <template v-slot:footer> | ||
| 11 | + <view class="serial-number-row"> | ||
| 12 | + <text class="readonly-text value-code">{{ form.code || '-' }}</text> | ||
| 13 | + <button class="generate-btn" @click="onGenerateCode">点此生成</button> | ||
| 14 | + </view> | ||
| 15 | + </template> | ||
| 16 | + </uni-list-item> | ||
| 17 | + | ||
| 18 | + <!-- 类型 --> | ||
| 19 | + <uni-list-item class="select-item" :class="form.type ? 'is-filled' : 'is-empty'"> | ||
| 20 | + <template v-slot:body> | ||
| 21 | + <view class="item-title"><text class="required">*</text><text>类型</text></view> | ||
| 22 | + </template> | ||
| 23 | + <template v-slot:footer> | ||
| 24 | + <picker mode="selector" :range="typeLabels" @change="onTypeChange"> | ||
| 25 | + <view class="picker-value" :class="{ placeholder: !form.type }"> | ||
| 26 | + {{ getTypeLabel() || '请选择类型' }} | ||
| 27 | + </view> | ||
| 28 | + </picker> | ||
| 29 | + </template> | ||
| 30 | + </uni-list-item> | ||
| 31 | + | ||
| 32 | + <!-- 计划编号(弹窗多选计划) --> | ||
| 33 | + <uni-list-item class="select-item" :class="form.planCode ? 'is-filled' : 'is-empty'" clickable | ||
| 34 | + @click="openPlanSheet" :rightText="form.planCode || '请选择计划'" showArrow> | ||
| 35 | + <template v-slot:body> | ||
| 36 | + <view class="item-title"><text class="required">*</text><text>计划编号</text></view> | ||
| 37 | + </template> | ||
| 38 | + </uni-list-item> | ||
| 39 | + | ||
| 40 | + <!-- 单位(禁用) --> | ||
| 41 | + <uni-list-item title="单位"> | ||
| 42 | + <template v-slot:footer> | ||
| 43 | + <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> | ||
| 44 | + </template> | ||
| 45 | + </uni-list-item> | ||
| 46 | + | ||
| 47 | + <!-- 供料单位(带出,禁用) --> | ||
| 48 | + <uni-list-item title="供料单位"> | ||
| 49 | + <template v-slot:footer> | ||
| 50 | + <uni-easyinput v-model="form.supplierName" :inputBorder="false" disabled placeholder="选择计划后自动带出" /> | ||
| 51 | + </template> | ||
| 52 | + </uni-list-item> | ||
| 53 | + | ||
| 54 | + <!-- 收料单位(带出,禁用) --> | ||
| 55 | + <uni-list-item title="收料单位"> | ||
| 56 | + <template v-slot:footer> | ||
| 57 | + <uni-easyinput v-model="form.companyShortName" :inputBorder="false" disabled placeholder="选择计划后自动带出" /> | ||
| 58 | + </template> | ||
| 59 | + </uni-list-item> | ||
| 60 | + </uni-list> | ||
| 61 | + | ||
| 62 | + <!-- 计划单明细(只读) --> | ||
| 63 | + <view class="sub-table"> | ||
| 64 | + <view class="header"> | ||
| 65 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 66 | + <text class="title">计划单明细</text> | ||
| 67 | + </view> | ||
| 68 | + <view class="add-list"> | ||
| 69 | + <view v-if="!planList.length" class="empty-tip">选择计划后自动带出</view> | ||
| 70 | + <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="block"> | ||
| 71 | + <uni-list> | ||
| 72 | + <uni-list-item title="计划编号"> | ||
| 73 | + <template v-slot:footer> | ||
| 74 | + <uni-easyinput :value="item.planCode" :inputBorder="false" disabled /> | ||
| 75 | + </template> | ||
| 76 | + </uni-list-item> | ||
| 77 | + <uni-list-item title="计划品种"> | ||
| 78 | + <template v-slot:footer> | ||
| 79 | + <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> | ||
| 80 | + </template> | ||
| 81 | + </uni-list-item> | ||
| 82 | + <uni-list-item title="计划数量"> | ||
| 83 | + <template v-slot:footer> | ||
| 84 | + <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> | ||
| 85 | + </template> | ||
| 86 | + </uni-list-item> | ||
| 87 | + </uni-list> | ||
| 88 | + </view> | ||
| 89 | + </view> | ||
| 90 | + </view> | ||
| 91 | + | ||
| 92 | + <!-- 过磅明细(可编辑) --> | ||
| 93 | + <view class="sub-table"> | ||
| 94 | + <view class="header"> | ||
| 95 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 96 | + <text class="title">过磅明细</text> | ||
| 97 | + <view class="ops"> | ||
| 98 | + <image class="opAdd" @click="addWeightRow" src="/static/images/plus.png" /> | ||
| 99 | + </view> | ||
| 100 | + </view> | ||
| 101 | + <view class="add-list"> | ||
| 102 | + <view v-if="!weighList.length" class="empty-tip">暂无明细,请添加</view> | ||
| 103 | + <view v-for="(item, idx) in weighList" :key="'w-' + (item.id || idx)" class="block"> | ||
| 104 | + <uni-list> | ||
| 105 | + <uni-list-item class="select-item" :class="item.planCode ? 'is-filled' : 'is-empty'"> | ||
| 106 | + <template v-slot:body> | ||
| 107 | + <view class="item-title"><text class="required">*</text><text>计划编号</text></view> | ||
| 108 | + </template> | ||
| 109 | + <template v-slot:footer> | ||
| 110 | + <picker mode="selector" :range="planCodeLabels" | ||
| 111 | + @change="(e) => handleWeighPlanChange(idx, Number(e.detail.value))"> | ||
| 112 | + <view class="picker-value" :class="{ placeholder: !item.planCode }"> | ||
| 113 | + {{ item.planCode || '请选择计划编号' }} | ||
| 114 | + </view> | ||
| 115 | + </picker> | ||
| 116 | + </template> | ||
| 117 | + </uni-list-item> | ||
| 118 | + <uni-list-item class="select-item" :class="item.productId ? 'is-filled' : 'is-empty'"> | ||
| 119 | + <template v-slot:body> | ||
| 120 | + <view class="item-title"><text class="required">*</text><text>过磅品种</text></view> | ||
| 121 | + </template> | ||
| 122 | + <template v-slot:footer> | ||
| 123 | + <picker mode="selector" :range="getWeightProductLabels(item)" | ||
| 124 | + @change="(e) => handleWeightProductChange(idx, Number(e.detail.value))"> | ||
| 125 | + <view class="picker-value" :class="{ placeholder: !item.productId }"> | ||
| 126 | + {{ getWeightProductLabel(item) || '请选择过磅品种' }} | ||
| 127 | + </view> | ||
| 128 | + </picker> | ||
| 129 | + </template> | ||
| 130 | + </uni-list-item> | ||
| 131 | + <uni-list-item title="开票品名"> | ||
| 132 | + <template v-slot:footer> | ||
| 133 | + <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled /> | ||
| 134 | + </template> | ||
| 135 | + </uni-list-item> | ||
| 136 | + <uni-list-item title="过磅数量"> | ||
| 137 | + <template v-slot:body> | ||
| 138 | + <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> | ||
| 139 | + </template> | ||
| 140 | + <template v-slot:footer> | ||
| 141 | + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> | ||
| 142 | + </template> | ||
| 143 | + </uni-list-item> | ||
| 144 | + </uni-list> | ||
| 145 | + <view class="block-ops"> | ||
| 146 | + <div class="del" @click="removeRow('weigh', idx)"> | ||
| 147 | + <image src="/static/images/delete.png" class="icon" />删除 | ||
| 148 | + </div> | ||
| 149 | + </view> | ||
| 150 | + </view> | ||
| 151 | + </view> | ||
| 152 | + </view> | ||
| 153 | + | ||
| 154 | + <!-- 申请数量明细(仅买断展示) --> | ||
| 155 | + <view v-if="isBuyout" class="sub-table"> | ||
| 156 | + <view class="header"> | ||
| 157 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 158 | + <text class="title">申请数量明细</text> | ||
| 159 | + <view class="ops"> | ||
| 160 | + <image class="opAdd" @click="addApplyRow" src="/static/images/plus.png" /> | ||
| 161 | + </view> | ||
| 162 | + </view> | ||
| 163 | + <view class="add-list"> | ||
| 164 | + <view v-if="!applyList.length" class="empty-tip">暂无明细,请添加</view> | ||
| 165 | + <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="block"> | ||
| 166 | + <uni-list> | ||
| 167 | + <uni-list-item class="select-item" :class="item.breedRelationshipId ? 'is-filled' : 'is-empty'"> | ||
| 168 | + <template v-slot:body> | ||
| 169 | + <view class="item-title"><text class="required">*</text><text>类别</text></view> | ||
| 170 | + </template> | ||
| 171 | + <template v-slot:footer> | ||
| 172 | + <picker mode="selector" :range="varietyLabels" | ||
| 173 | + @change="(e) => handleVarietyChange(idx, Number(e.detail.value))"> | ||
| 174 | + <view class="picker-value" :class="{ placeholder: !item.breedRelationshipId }"> | ||
| 175 | + {{ getVarietyLabel(item) || '请选择类别' }} | ||
| 176 | + </view> | ||
| 177 | + </picker> | ||
| 178 | + </template> | ||
| 179 | + </uni-list-item> | ||
| 180 | + <uni-list-item title="数量"> | ||
| 181 | + <template v-slot:body> | ||
| 182 | + <view class="item-title"><text class="required">*</text><text>数量</text></view> | ||
| 183 | + </template> | ||
| 184 | + <template v-slot:footer> | ||
| 185 | + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" /> | ||
| 186 | + </template> | ||
| 187 | + </uni-list-item> | ||
| 188 | + </uni-list> | ||
| 189 | + <view class="block-ops"> | ||
| 190 | + <div class="del" @click="removeRow('apply', idx)"> | ||
| 191 | + <image src="/static/images/delete.png" class="icon" />删除 | ||
| 192 | + </div> | ||
| 193 | + </view> | ||
| 194 | + </view> | ||
| 195 | + </view> | ||
| 196 | + </view> | ||
| 197 | + | ||
| 198 | + <!-- 其他信息 --> | ||
| 199 | + <view class="remark-section"> | ||
| 200 | + <view class="header"> | ||
| 201 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 202 | + <text class="title">其他信息</text> | ||
| 203 | + </view> | ||
| 204 | + <view class="section-content"> | ||
| 205 | + <uni-list> | ||
| 206 | + <uni-list-item title="物料名称"> | ||
| 207 | + <template v-slot:footer> | ||
| 208 | + <uni-easyinput :value="materialName" :inputBorder="false" disabled /> | ||
| 209 | + </template> | ||
| 210 | + </uni-list-item> | ||
| 211 | + <uni-list-item> | ||
| 212 | + <template v-slot:body> | ||
| 213 | + <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> | ||
| 214 | + </template> | ||
| 215 | + <template v-slot:footer> | ||
| 216 | + <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> | ||
| 217 | + </template> | ||
| 218 | + </uni-list-item> | ||
| 219 | + <uni-list-item> | ||
| 220 | + <template v-slot:body> | ||
| 221 | + <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> | ||
| 222 | + </template> | ||
| 223 | + <template v-slot:footer> | ||
| 224 | + <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> | ||
| 225 | + </template> | ||
| 226 | + </uni-list-item> | ||
| 227 | + <uni-list-item title="货物净重"> | ||
| 228 | + <template v-slot:footer> | ||
| 229 | + <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> | ||
| 230 | + </template> | ||
| 231 | + </uni-list-item> | ||
| 232 | + <uni-list-item title="净重大写"> | ||
| 233 | + <template v-slot:footer> | ||
| 234 | + <uni-easyinput :value="computedNetWeightUpper" :inputBorder="false" disabled /> | ||
| 235 | + </template> | ||
| 236 | + </uni-list-item> | ||
| 237 | + </uni-list> | ||
| 238 | + | ||
| 239 | + <view class="form-group"> | ||
| 240 | + <view class="item-title"><text class="required">*</text><text>来料扣杂类型</text></view> | ||
| 241 | + <uni-data-checkbox | ||
| 242 | + mode="tag" | ||
| 243 | + :multiple="true" | ||
| 244 | + :value-field="'value'" | ||
| 245 | + :text-field="'text'" | ||
| 246 | + v-model="form.deductionTypes" | ||
| 247 | + :localdata="deductionTypeOptions" | ||
| 248 | + /> | ||
| 249 | + </view> | ||
| 250 | + | ||
| 251 | + <uni-list> | ||
| 252 | + <uni-list-item> | ||
| 253 | + <template v-slot:body> | ||
| 254 | + <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> | ||
| 255 | + </template> | ||
| 256 | + <template v-slot:footer> | ||
| 257 | + <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> | ||
| 258 | + </template> | ||
| 259 | + </uni-list-item> | ||
| 260 | + <uni-list-item> | ||
| 261 | + <template v-slot:body> | ||
| 262 | + <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> | ||
| 263 | + </template> | ||
| 264 | + <template v-slot:footer> | ||
| 265 | + <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> | ||
| 266 | + </template> | ||
| 267 | + </uni-list-item> | ||
| 268 | + <uni-list-item> | ||
| 269 | + <template v-slot:body> | ||
| 270 | + <view class="item-title"><text class="required">*</text><text>车牌号</text></view> | ||
| 271 | + </template> | ||
| 272 | + <template v-slot:footer> | ||
| 273 | + <uni-easyinput v-model="form.plateNumber" :inputBorder="false" placeholder="请输入车牌号" /> | ||
| 274 | + </template> | ||
| 275 | + </uni-list-item> | ||
| 276 | + </uni-list> | ||
| 277 | + </view> | ||
| 278 | + </view> | ||
| 279 | + | ||
| 280 | + <!-- 备注模块 --> | ||
| 281 | + <view class="remark-section"> | ||
| 282 | + <view class="header"> | ||
| 283 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 284 | + <text class="title">备注</text> | ||
| 285 | + </view> | ||
| 286 | + <view class="section-content"> | ||
| 287 | + <view class="remark-group"> | ||
| 288 | + <view class="remark-label">业务摘要</view> | ||
| 289 | + <uni-easyinput :value="computedBusinessSummary" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 290 | + </view> | ||
| 291 | + <view class="remark-group"> | ||
| 292 | + <view class="remark-label">特别说明</view> | ||
| 293 | + <uni-easyinput v-model="form.specialNote" type="textarea" :inputBorder="false" placeholder="请输入特别说明" maxlength="2000" /> | ||
| 294 | + </view> | ||
| 295 | + <view class="remark-group"> | ||
| 296 | + <view class="remark-label">单据备注</view> | ||
| 297 | + <uni-easyinput :value="computedDocumentRemark" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 298 | + </view> | ||
| 299 | + </view> | ||
| 300 | + </view> | ||
| 301 | + | ||
| 302 | + <view class="footer"> | ||
| 303 | + <button class="btn submit" type="primary" @click="onSubmit">保存</button> | ||
| 304 | + </view> | ||
| 305 | + </scroll-view> | ||
| 306 | + | ||
| 307 | + <RelateSelectSheet :visible.sync="planSheet.visible" title="选择计划" :multiple="true" | ||
| 308 | + :fetchFn="planSheet.fetchFn" :display-fields="planSheet.displayFields" | ||
| 309 | + row-key="id" :selectedKeys.sync="planSheet.selectedKeys" @confirm="onPlanConfirm" /> | ||
| 310 | + </view> | ||
| 311 | +</template> | ||
| 312 | + | ||
| 313 | +<script> | ||
| 314 | +import RelateSelectSheet from '@/components/relate-select/index.vue' | ||
| 315 | +import { | ||
| 316 | + weighTicketGenerateCodeApi, | ||
| 317 | + weighingTicketPlansApi, | ||
| 318 | + weighTicketPlanLinesApi, | ||
| 319 | + weighTicketCreateApi | ||
| 320 | +} from '@/api/procure-manage/weighTicket.js' | ||
| 321 | +import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js' | ||
| 322 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 323 | + | ||
| 324 | +export default { | ||
| 325 | + name: 'AddWeightTicket', | ||
| 326 | + components: { RelateSelectSheet }, | ||
| 327 | + data() { | ||
| 328 | + return { | ||
| 329 | + form: { | ||
| 330 | + code: '', | ||
| 331 | + type: '', | ||
| 332 | + planCode: '', | ||
| 333 | + unit: '公斤', | ||
| 334 | + supplierName: '', | ||
| 335 | + companyShortName: '', | ||
| 336 | + totalGrossWeight: '', | ||
| 337 | + actualImpurityWeight: '', | ||
| 338 | + deductionTypes: [], | ||
| 339 | + supplierStockMaterial: '', | ||
| 340 | + logisticsStockMaterial: '', | ||
| 341 | + plateNumber: '', | ||
| 342 | + specialNote: '' | ||
| 343 | + }, | ||
| 344 | + dicOptions: { TYPE: [], DEDUCTION_TYPE: [] }, | ||
| 345 | + // 选中计划行(多选) | ||
| 346 | + selectedPlanRows: [], | ||
| 347 | + // 计划单明细(只读) | ||
| 348 | + planList: [], | ||
| 349 | + // 过磅明细(可编辑) | ||
| 350 | + weighList: [], | ||
| 351 | + // 申请数量明细(买断时) | ||
| 352 | + applyList: [], | ||
| 353 | + varietyOptions: [], | ||
| 354 | + planSheet: { | ||
| 355 | + visible: false, | ||
| 356 | + fetchFn: null, | ||
| 357 | + displayFields: [ | ||
| 358 | + { label: '计划编号', field: 'code' }, | ||
| 359 | + { label: '是否买断', field: 'buyout', format: v => (v ? '是' : '否') }, | ||
| 360 | + { label: '收料单位', field: 'companyName' }, | ||
| 361 | + { label: '供料单位', field: 'supplierName' }, | ||
| 362 | + { label: '总数量', field: 'totalQuantity' }, | ||
| 363 | + { label: '创建人', field: 'createBy' } | ||
| 364 | + ], | ||
| 365 | + selectedKeys: [] | ||
| 366 | + } | ||
| 367 | + } | ||
| 368 | + }, | ||
| 369 | + computed: { | ||
| 370 | + typeLabels() { | ||
| 371 | + return (this.dicOptions.TYPE || []).map(it => it.name) | ||
| 372 | + }, | ||
| 373 | + deductionTypeOptions() { | ||
| 374 | + return (this.dicOptions.DEDUCTION_TYPE || []).map(it => ({ | ||
| 375 | + value: it.code != null ? String(it.code) : '', | ||
| 376 | + text: it.name || '' | ||
| 377 | + })).filter(it => it.value) | ||
| 378 | + }, | ||
| 379 | + isBuyout() { | ||
| 380 | + const first = (this.selectedPlanRows || [])[0] | ||
| 381 | + return !!(first && first.buyout) | ||
| 382 | + }, | ||
| 383 | + // 过磅明细-计划编号下拉选项(范围=基础信息已选计划) | ||
| 384 | + planCodeOptions() { | ||
| 385 | + const seen = new Set() | ||
| 386 | + const opts = [] | ||
| 387 | + ;(this.selectedPlanRows || []).forEach(it => { | ||
| 388 | + const code = it.code || '' | ||
| 389 | + if (!code || seen.has(code)) return | ||
| 390 | + seen.add(code) | ||
| 391 | + opts.push({ code: code, planId: it.id }) | ||
| 392 | + }) | ||
| 393 | + return opts | ||
| 394 | + }, | ||
| 395 | + planCodeLabels() { | ||
| 396 | + return this.planCodeOptions.map(o => o.code) | ||
| 397 | + }, | ||
| 398 | + varietyLabels() { | ||
| 399 | + return (this.varietyOptions || []).map(item => | ||
| 400 | + [item.productName, item.code].filter(Boolean).join(' ') | ||
| 401 | + ) | ||
| 402 | + }, | ||
| 403 | + // 物料名称:过磅明细开票品名去重顿号拼接 | ||
| 404 | + materialName() { | ||
| 405 | + const names = (this.weighList || []) | ||
| 406 | + .map(item => item.invoiceProductName) | ||
| 407 | + .filter(name => !!name) | ||
| 408 | + return Array.from(new Set(names)).join('、') | ||
| 409 | + }, | ||
| 410 | + // 货物净重 = 过磅总重 - 实际伙重(保留两位) | ||
| 411 | + computedNetWeight() { | ||
| 412 | + const gross = this.form.totalGrossWeight | ||
| 413 | + if (gross === undefined || gross === null || gross === '') return '' | ||
| 414 | + const num = Number(gross) - Number(this.form.actualImpurityWeight || 0) | ||
| 415 | + return String(Math.round(num * 100) / 100) | ||
| 416 | + }, | ||
| 417 | + // 净重大写:中文大写 | ||
| 418 | + computedNetWeightUpper() { | ||
| 419 | + const net = this.computedNetWeight | ||
| 420 | + if (net === '' || net === null || net === undefined) return '' | ||
| 421 | + return numberToChineseUpper(net) | ||
| 422 | + }, | ||
| 423 | + // 业务摘要 | ||
| 424 | + computedBusinessSummary() { | ||
| 425 | + const parts = [] | ||
| 426 | + const weightItems = (this.weighList || []) | ||
| 427 | + .map(item => { | ||
| 428 | + const name = item.productName || '' | ||
| 429 | + const qty = item.quantity === null || item.quantity === undefined ? '' : item.quantity | ||
| 430 | + if (!name && qty === '') return '' | ||
| 431 | + return `${name}${qty}公斤` | ||
| 432 | + }) | ||
| 433 | + .filter(text => !!text) | ||
| 434 | + if (weightItems.length) parts.push(weightItems.join('、')) | ||
| 435 | + const deductionNames = (this.form.deductionTypes || []) | ||
| 436 | + .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)) | ||
| 437 | + .filter(name => !!name) | ||
| 438 | + if (deductionNames.length) parts.push(deductionNames.join('、')) | ||
| 439 | + if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) | ||
| 440 | + if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) | ||
| 441 | + if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) | ||
| 442 | + return parts.join(',') | ||
| 443 | + }, | ||
| 444 | + // 单据备注 = 业务摘要 + 特别说明 | ||
| 445 | + computedDocumentRemark() { | ||
| 446 | + const summary = this.computedBusinessSummary || '' | ||
| 447 | + const note = this.form.specialNote || '' | ||
| 448 | + return [summary, note].filter(text => !!text).join('\n') | ||
| 449 | + } | ||
| 450 | + }, | ||
| 451 | + created() { | ||
| 452 | + this.planSheet.fetchFn = this.fetchPlans.bind(this) | ||
| 453 | + this.loadDicData() | ||
| 454 | + this.loadVarietyOptions() | ||
| 455 | + this.onGenerateCode() | ||
| 456 | + }, | ||
| 457 | + methods: { | ||
| 458 | + async loadDicData() { | ||
| 459 | + try { | ||
| 460 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | ||
| 461 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 462 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 463 | + // 类型默认选择「常规」 | ||
| 464 | + const defaultType = (this.dicOptions.TYPE || []).find(item => item.name === '常规') | ||
| 465 | + if (defaultType) { | ||
| 466 | + this.form.type = defaultType.code != null ? String(defaultType.code) : '' | ||
| 467 | + } | ||
| 468 | + } catch (e) { | ||
| 469 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 470 | + } | ||
| 471 | + }, | ||
| 472 | + async loadVarietyOptions() { | ||
| 473 | + try { | ||
| 474 | + const res = await breedRelationshipQueryApi({ pageIndex: 1, pageSize: 9999 }) | ||
| 475 | + const _data = (res && res.data) || {} | ||
| 476 | + this.varietyOptions = _data.datas || _data.list || _data.records || [] | ||
| 477 | + } catch (e) { | ||
| 478 | + this.varietyOptions = [] | ||
| 479 | + } | ||
| 480 | + }, | ||
| 481 | + getTypeLabel() { | ||
| 482 | + const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type)) | ||
| 483 | + return found ? found.name : '' | ||
| 484 | + }, | ||
| 485 | + onTypeChange(e) { | ||
| 486 | + const idx = Number(e.detail.value) | ||
| 487 | + const opt = (this.dicOptions.TYPE || [])[idx] | ||
| 488 | + this.form.type = opt && opt.code != null ? String(opt.code) : '' | ||
| 489 | + }, | ||
| 490 | + onGenerateCode() { | ||
| 491 | + weighTicketGenerateCodeApi() | ||
| 492 | + .then(res => { | ||
| 493 | + this.form.code = (res && res.data) ? res.data : '' | ||
| 494 | + }) | ||
| 495 | + .catch(() => {}) | ||
| 496 | + }, | ||
| 497 | + // 计划选择弹窗数据源 | ||
| 498 | + fetchPlans({ pageIndex, pageSize, extra }) { | ||
| 499 | + const keyword = (extra && extra.keyword) || '' | ||
| 500 | + const params = { | ||
| 501 | + pageIndex, | ||
| 502 | + pageSize, | ||
| 503 | + code: keyword || undefined | ||
| 504 | + } | ||
| 505 | + return weighingTicketPlansApi(params).then(res => { | ||
| 506 | + const _data = (res && res.data) || {} | ||
| 507 | + const records = _data.datas || _data.list || _data.records || [] | ||
| 508 | + const totalCount = _data.totalCount || _data.count || 0 | ||
| 509 | + const hasNext = _data.hasNext || false | ||
| 510 | + return { records, totalCount, hasNext } | ||
| 511 | + }).catch(() => ({ records: [], totalCount: 0, hasNext: false })) | ||
| 512 | + }, | ||
| 513 | + openPlanSheet() { | ||
| 514 | + this.planSheet.selectedKeys = this.selectedPlanRows.map(it => it.id) | ||
| 515 | + this.planSheet.visible = true | ||
| 516 | + }, | ||
| 517 | + onPlanConfirm({ items }) { | ||
| 518 | + const list = items || [] | ||
| 519 | + if (!list.length) { | ||
| 520 | + this.selectedPlanRows = [] | ||
| 521 | + this.form.planCode = '' | ||
| 522 | + this.form.supplierName = '' | ||
| 523 | + this.form.companyShortName = '' | ||
| 524 | + this.planList = [] | ||
| 525 | + this.weighList = [] | ||
| 526 | + return | ||
| 527 | + } | ||
| 528 | + // 校验:所选计划的「是否买断、供料单位、收料单位、车间」必须一致 | ||
| 529 | + const first = list[0] | ||
| 530 | + const isSame = list.every(item => | ||
| 531 | + item.buyout === first.buyout && | ||
| 532 | + item.supplierName === first.supplierName && | ||
| 533 | + item.companyName === first.companyName && | ||
| 534 | + item.workshopName === first.workshopName | ||
| 535 | + ) | ||
| 536 | + if (!isSame) { | ||
| 537 | + uni.showToast({ title: '是否买断,供料单位,收料单位应保持一致', icon: 'none' }) | ||
| 538 | + this.planSheet.selectedKeys = this.selectedPlanRows.map(it => it.id) | ||
| 539 | + return | ||
| 540 | + } | ||
| 541 | + this.selectedPlanRows = list.map(it => ({ ...it })) | ||
| 542 | + this.form.planCode = list.map(it => it.code).filter(Boolean).join(',') | ||
| 543 | + this.form.supplierName = first.supplierName || '' | ||
| 544 | + this.form.companyShortName = (first.companyName || '') + (first.workshopName || '') | ||
| 545 | + // 查询计划明细行,填充计划单明细;过磅明细初始化为计划明细拷贝 | ||
| 546 | + weighTicketPlanLinesApi(list.map(it => it.id)).then(res => { | ||
| 547 | + const lines = (res && res.data) || [] | ||
| 548 | + this.planList = lines.map(it => ({ ...it })) | ||
| 549 | + this.weighList = lines.map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 550 | + }).catch(() => { | ||
| 551 | + this.planList = [] | ||
| 552 | + this.weighList = [] | ||
| 553 | + }) | ||
| 554 | + }, | ||
| 555 | + // 过磅明细-计划编号变更:更新行计划编号/计划id,并清空品种选择 | ||
| 556 | + handleWeighPlanChange(idx, optIdx) { | ||
| 557 | + const opt = (this.planCodeOptions || [])[optIdx] | ||
| 558 | + if (!opt) return | ||
| 559 | + const row = this.weighList[idx] | ||
| 560 | + row.planCode = opt.code | ||
| 561 | + row.procurementPlanId = opt.planId || '' | ||
| 562 | + row.productId = '' | ||
| 563 | + row.productName = '' | ||
| 564 | + row.invoiceProductName = '' | ||
| 565 | + }, | ||
| 566 | + // 当前计划编号下的品种选项 | ||
| 567 | + getWeightProductLabels(item) { | ||
| 568 | + return (this.planList || []) | ||
| 569 | + .filter(it => it.planCode === item.planCode) | ||
| 570 | + .map(it => it.productName || '') | ||
| 571 | + }, | ||
| 572 | + getWeightProductLabel(item) { | ||
| 573 | + if (!item.productId) return '' | ||
| 574 | + const found = (this.planList || []).find(it => it.productId === item.productId && it.planCode === item.planCode) | ||
| 575 | + return found ? (found.productName || '') : '' | ||
| 576 | + }, | ||
| 577 | + // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) | ||
| 578 | + handleWeightProductChange(idx, optIdx) { | ||
| 579 | + const row = this.weighList[idx] | ||
| 580 | + const options = (this.planList || []).filter(it => it.planCode === row.planCode) | ||
| 581 | + const raw = options[optIdx] | ||
| 582 | + if (!raw) return | ||
| 583 | + this.weighList.splice(idx, 1, { | ||
| 584 | + ...raw, | ||
| 585 | + id: row.id, | ||
| 586 | + planCode: row.planCode || raw.planCode || '', | ||
| 587 | + procurementPlanId: row.procurementPlanId || raw.procurementPlanId || '' | ||
| 588 | + }) | ||
| 589 | + }, | ||
| 590 | + getVarietyLabel(item) { | ||
| 591 | + if (!item.breedRelationshipId) return '' | ||
| 592 | + const found = (this.varietyOptions || []).find(it => it.id === item.breedRelationshipId) | ||
| 593 | + return found ? [found.productName, found.code].filter(Boolean).join(' ') : '' | ||
| 594 | + }, | ||
| 595 | + handleVarietyChange(idx, optIdx) { | ||
| 596 | + const raw = (this.varietyOptions || [])[optIdx] | ||
| 597 | + if (!raw) return | ||
| 598 | + const row = this.applyList[idx] | ||
| 599 | + row.category = raw.code || '' | ||
| 600 | + row.breedRelationshipId = raw.id || '' | ||
| 601 | + }, | ||
| 602 | + addWeightRow() { | ||
| 603 | + this.weighList.push({ | ||
| 604 | + id: genRowId(), | ||
| 605 | + procurementPlanId: '', | ||
| 606 | + planCode: '', | ||
| 607 | + productId: '', | ||
| 608 | + invoiceProductName: '', | ||
| 609 | + quantity: '' | ||
| 610 | + }) | ||
| 611 | + }, | ||
| 612 | + addApplyRow() { | ||
| 613 | + this.applyList.push({ | ||
| 614 | + id: genRowId(), | ||
| 615 | + category: '', | ||
| 616 | + breedRelationshipId: '', | ||
| 617 | + quantity: '' | ||
| 618 | + }) | ||
| 619 | + }, | ||
| 620 | + removeRow(type, idx) { | ||
| 621 | + if (type === 'weigh') this.weighList.splice(idx, 1) | ||
| 622 | + else if (type === 'apply') this.applyList.splice(idx, 1) | ||
| 623 | + }, | ||
| 624 | + validate() { | ||
| 625 | + const f = this.form | ||
| 626 | + if (!f.code) return this.tip('请生成编号') | ||
| 627 | + if (!f.type) return this.tip('请选择类型') | ||
| 628 | + if (!this.selectedPlanRows.length) return this.tip('请选择计划编号') | ||
| 629 | + if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') | ||
| 630 | + if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') | ||
| 631 | + if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') | ||
| 632 | + if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料') | ||
| 633 | + if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') | ||
| 634 | + if (!f.plateNumber) return this.tip('请输入车牌号') | ||
| 635 | + // 过磅明细:计划编号、品种、数量必填 | ||
| 636 | + const weightList = this.weighList || [] | ||
| 637 | + for (let i = 0; i < weightList.length; i++) { | ||
| 638 | + const row = weightList[i] | ||
| 639 | + if (!row.planCode) return this.tip(`过磅明细第${i + 1}行:请选择计划编号`) | ||
| 640 | + if (!row.productId) return this.tip(`过磅明细第${i + 1}行:请选择过磅品种`) | ||
| 641 | + if (row.quantity === '' || row.quantity == null) return this.tip(`过磅明细第${i + 1}行:请输入过磅数量`) | ||
| 642 | + } | ||
| 643 | + // 申请数量明细:类别、数量必填(买断时) | ||
| 644 | + if (this.isBuyout) { | ||
| 645 | + const applyList = this.applyList || [] | ||
| 646 | + for (let i = 0; i < applyList.length; i++) { | ||
| 647 | + const row = applyList[i] | ||
| 648 | + if (!row.breedRelationshipId) return this.tip(`申请数量明细第${i + 1}行:请选择类别`) | ||
| 649 | + if (row.quantity === '' || row.quantity == null) return this.tip(`申请数量明细第${i + 1}行:请输入数量`) | ||
| 650 | + } | ||
| 651 | + } | ||
| 652 | + return true | ||
| 653 | + }, | ||
| 654 | + tip(msg) { | ||
| 655 | + uni.showToast({ title: msg, icon: 'none' }) | ||
| 656 | + return false | ||
| 657 | + }, | ||
| 658 | + buildSubmitData() { | ||
| 659 | + return { | ||
| 660 | + code: this.form.code, | ||
| 661 | + type: this.form.type, | ||
| 662 | + planIds: this.selectedPlanRows.map(it => it.id), | ||
| 663 | + weighLines: (this.weighList || []).map(row => ({ | ||
| 664 | + procurementPlanId: row.procurementPlanId || '', | ||
| 665 | + planCode: row.planCode || '', | ||
| 666 | + productId: row.productId || '', | ||
| 667 | + invoiceProductName: row.invoiceProductName || '', | ||
| 668 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 669 | + itemId: row.id | ||
| 670 | + })), | ||
| 671 | + applyLines: (this.applyList || []).map(row => ({ | ||
| 672 | + category: row.category || '', | ||
| 673 | + breedRelationshipId: row.breedRelationshipId || '', | ||
| 674 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 675 | + itemId: row.breedRelationshipId | ||
| 676 | + })), | ||
| 677 | + unit: this.form.unit, | ||
| 678 | + materialName: this.materialName || null, | ||
| 679 | + totalGrossWeight: this.form.totalGrossWeight === '' ? null : Number(this.form.totalGrossWeight), | ||
| 680 | + actualImpurityWeight: this.form.actualImpurityWeight === '' ? null : Number(this.form.actualImpurityWeight), | ||
| 681 | + netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), | ||
| 682 | + netWeightUpper: this.computedNetWeightUpper || null, | ||
| 683 | + deductionTypes: (this.form.deductionTypes || []).join(',') || null, | ||
| 684 | + supplierStockMaterial: this.form.supplierStockMaterial || null, | ||
| 685 | + logisticsStockMaterial: this.form.logisticsStockMaterial || null, | ||
| 686 | + plateNumber: this.form.plateNumber || null, | ||
| 687 | + businessSummary: this.computedBusinessSummary || null, | ||
| 688 | + specialNote: this.form.specialNote || null, | ||
| 689 | + documentRemark: this.computedDocumentRemark || null | ||
| 690 | + } | ||
| 691 | + }, | ||
| 692 | + async onSubmit() { | ||
| 693 | + if (!this.validate()) return | ||
| 694 | + const confirmRes = await new Promise(resolve => { | ||
| 695 | + uni.showModal({ title: '提示', content: '确定保存过磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | ||
| 696 | + }) | ||
| 697 | + if (!(confirmRes && confirmRes.confirm)) return | ||
| 698 | + uni.showLoading({ title: '提交中...', mask: true }) | ||
| 699 | + weighTicketCreateApi(this.buildSubmitData()) | ||
| 700 | + .then(() => { | ||
| 701 | + uni.hideLoading() | ||
| 702 | + uni.showToast({ title: '保存成功', icon: 'none' }) | ||
| 703 | + try { uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') } catch (e) {} | ||
| 704 | + setTimeout(() => { uni.navigateBack() }, 400) | ||
| 705 | + }) | ||
| 706 | + .catch(e => { | ||
| 707 | + uni.hideLoading() | ||
| 708 | + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' }) | ||
| 709 | + }) | ||
| 710 | + } | ||
| 711 | + } | ||
| 712 | +} | ||
| 713 | + | ||
| 714 | +// 生成前端临时行 id | ||
| 715 | +function genRowId() { | ||
| 716 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | ||
| 717 | +} | ||
| 718 | + | ||
| 719 | +// 数字转中文大写(对齐 PC 端 useWeightTicketForm.ts) | ||
| 720 | +function numberToChineseUpper(num) { | ||
| 721 | + if (num === null || num === undefined || num === '' || isNaN(Number(num))) return '零' | ||
| 722 | + const n = Number(num) | ||
| 723 | + if (!isFinite(n)) return '零' | ||
| 724 | + | ||
| 725 | + const digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] | ||
| 726 | + const smallUnits = ['', '拾', '佰', '仟'] | ||
| 727 | + const bigUnits = ['', '万', '亿', '兆'] | ||
| 728 | + | ||
| 729 | + const negative = n < 0 | ||
| 730 | + const abs = Math.abs(n) | ||
| 731 | + const parts = abs.toString().split('.') | ||
| 732 | + const intStrRaw = parts[0] | ||
| 733 | + const decStrRaw = parts[1] || '' | ||
| 734 | + const s = intStrRaw | ||
| 735 | + const len = s.length | ||
| 736 | + | ||
| 737 | + let intPart = '' | ||
| 738 | + let zeroFlag = false | ||
| 739 | + for (let i = 0; i < len; i++) { | ||
| 740 | + const d = parseInt(s[i], 10) | ||
| 741 | + const pos = len - 1 - i | ||
| 742 | + const unitIdx = pos % 4 | ||
| 743 | + const groupIdx = Math.floor(pos / 4) | ||
| 744 | + if (d !== 0) { | ||
| 745 | + if (zeroFlag) { | ||
| 746 | + intPart += digit[0] | ||
| 747 | + zeroFlag = false | ||
| 748 | + } | ||
| 749 | + intPart += digit[d] + smallUnits[unitIdx] | ||
| 750 | + } else { | ||
| 751 | + zeroFlag = true | ||
| 752 | + } | ||
| 753 | + if (unitIdx === 0) { | ||
| 754 | + const start = Math.max(0, len - (groupIdx + 1) * 4) | ||
| 755 | + const end = len - groupIdx * 4 | ||
| 756 | + const groupDigits = s.slice(start, end) | ||
| 757 | + if (!/^0+$/.test(groupDigits)) { | ||
| 758 | + intPart += bigUnits[groupIdx] || '' | ||
| 759 | + } | ||
| 760 | + } | ||
| 761 | + } | ||
| 762 | + if (intPart === '') intPart = digit[0] | ||
| 763 | + | ||
| 764 | + let result = intPart | ||
| 765 | + if (decStrRaw) { | ||
| 766 | + const decChars = decStrRaw | ||
| 767 | + .split('') | ||
| 768 | + .map(c => digit[parseInt(c, 10)]) | ||
| 769 | + .join('') | ||
| 770 | + result += '点' + decChars | ||
| 771 | + } | ||
| 772 | + return (negative ? '负' : '') + result | ||
| 773 | +} | ||
| 774 | +</script> | ||
| 775 | + | ||
| 776 | +<style lang="scss" scoped> | ||
| 777 | +.page { | ||
| 778 | + display: flex; | ||
| 779 | + flex-direction: column; | ||
| 780 | + height: 100%; | ||
| 781 | +} | ||
| 782 | + | ||
| 783 | +.scroll { | ||
| 784 | + flex: 1; | ||
| 785 | + padding: 12rpx 0 200rpx !important; | ||
| 786 | +} | ||
| 787 | + | ||
| 788 | +.footer { | ||
| 789 | + z-index: 2; | ||
| 790 | + position: fixed; | ||
| 791 | + left: 0; | ||
| 792 | + right: 0; | ||
| 793 | + bottom: 0; | ||
| 794 | + padding: 32rpx; | ||
| 795 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 796 | + background: #fff; | ||
| 797 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 798 | + | ||
| 799 | + .btn { | ||
| 800 | + height: 80rpx; | ||
| 801 | + line-height: 80rpx; | ||
| 802 | + border-radius: 12rpx; | ||
| 803 | + font-size: 32rpx; | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + .submit { | ||
| 807 | + background: $theme-primary; | ||
| 808 | + color: #fff; | ||
| 809 | + } | ||
| 810 | +} | ||
| 811 | + | ||
| 812 | +::v-deep .uni-list { | ||
| 813 | + .uni-easyinput { | ||
| 814 | + display: flex; | ||
| 815 | + | ||
| 816 | + .uni-input-input { | ||
| 817 | + color: rgba(0, 0, 0, 0.9); | ||
| 818 | + } | ||
| 819 | + } | ||
| 820 | + | ||
| 821 | + .uni-input-placeholder { | ||
| 822 | + z-index: 1; | ||
| 823 | + } | ||
| 824 | + | ||
| 825 | + .uni-input-input { | ||
| 826 | + background-color: #ffffff; | ||
| 827 | + } | ||
| 828 | + | ||
| 829 | + background: transparent; | ||
| 830 | + | ||
| 831 | + &-item { | ||
| 832 | + &__extra-text { | ||
| 833 | + font-size: 32rpx; | ||
| 834 | + } | ||
| 835 | + | ||
| 836 | + &__content-title { | ||
| 837 | + font-size: 32rpx; | ||
| 838 | + color: rgba(0, 0, 0, 0.9); | ||
| 839 | + } | ||
| 840 | + | ||
| 841 | + &__container { | ||
| 842 | + padding: 32rpx; | ||
| 843 | + | ||
| 844 | + .uni-easyinput { | ||
| 845 | + &__placeholder-class { | ||
| 846 | + font-size: 32rpx; | ||
| 847 | + color: rgba(0, 0, 0, 0.4); | ||
| 848 | + } | ||
| 849 | + | ||
| 850 | + &__content { | ||
| 851 | + border: none; | ||
| 852 | + background-color: #ffffff !important; | ||
| 853 | + | ||
| 854 | + &-input { | ||
| 855 | + padding-left: 0 !important; | ||
| 856 | + height: 48rpx; | ||
| 857 | + line-height: 48rpx; | ||
| 858 | + font-size: 32rpx; | ||
| 859 | + } | ||
| 860 | + | ||
| 861 | + .content-clear-icon { | ||
| 862 | + font-size: 44rpx !important; | ||
| 863 | + } | ||
| 864 | + } | ||
| 865 | + } | ||
| 866 | + | ||
| 867 | + .item-title, | ||
| 868 | + .uni-list-item__content { | ||
| 869 | + flex: none; | ||
| 870 | + min-height: 48rpx; | ||
| 871 | + line-height: 48rpx; | ||
| 872 | + font-size: 32rpx; | ||
| 873 | + position: relative; | ||
| 874 | + width: 240rpx; | ||
| 875 | + margin-right: 32rpx; | ||
| 876 | + color: rgba(0, 0, 0, 0.9); | ||
| 877 | + | ||
| 878 | + .required { | ||
| 879 | + color: red; | ||
| 880 | + position: absolute; | ||
| 881 | + top: 50%; | ||
| 882 | + transform: translateY(-50%); | ||
| 883 | + left: -16rpx; | ||
| 884 | + } | ||
| 885 | + } | ||
| 886 | + } | ||
| 887 | + | ||
| 888 | + &.select-item { | ||
| 889 | + &.is-empty { | ||
| 890 | + .uni-list-item__extra-text { | ||
| 891 | + color: rgba(0, 0, 0, 0.4) !important; | ||
| 892 | + } | ||
| 893 | + } | ||
| 894 | + | ||
| 895 | + &.is-filled { | ||
| 896 | + .uni-list-item__extra-text { | ||
| 897 | + color: rgba(0, 0, 0, 0.9) !important; | ||
| 898 | + } | ||
| 899 | + } | ||
| 900 | + | ||
| 901 | + .serial-number-row { | ||
| 902 | + display: flex; | ||
| 903 | + align-items: center; | ||
| 904 | + | ||
| 905 | + .generate-btn { | ||
| 906 | + margin-left: 24rpx; | ||
| 907 | + height: 48rpx; | ||
| 908 | + line-height: 48rpx; | ||
| 909 | + padding: 0 24rpx; | ||
| 910 | + font-size: 24rpx; | ||
| 911 | + border-radius: 8rpx; | ||
| 912 | + background: $theme-primary; | ||
| 913 | + color: #fff; | ||
| 914 | + } | ||
| 915 | + } | ||
| 916 | + } | ||
| 917 | + } | ||
| 918 | +} | ||
| 919 | + | ||
| 920 | +.readonly-text { | ||
| 921 | + color: rgba(0, 0, 0, 0.9); | ||
| 922 | + font-size: 32rpx; | ||
| 923 | + line-height: 48rpx; | ||
| 924 | + text-align: right; | ||
| 925 | + white-space: pre-wrap; | ||
| 926 | + word-break: break-all; | ||
| 927 | +} | ||
| 928 | + | ||
| 929 | +.value-code { | ||
| 930 | + width: 260rpx; | ||
| 931 | + text-align: left; | ||
| 932 | +} | ||
| 933 | + | ||
| 934 | +.picker-value { | ||
| 935 | + font-size: 32rpx; | ||
| 936 | + color: rgba(0, 0, 0, 0.9); | ||
| 937 | + line-height: 48rpx; | ||
| 938 | + text-align: right; | ||
| 939 | + min-height: 48rpx; | ||
| 940 | + | ||
| 941 | + &.placeholder { | ||
| 942 | + color: rgba(0, 0, 0, 0.4); | ||
| 943 | + } | ||
| 944 | +} | ||
| 945 | + | ||
| 946 | +.sub-table, | ||
| 947 | +.remark-section { | ||
| 948 | + margin-top: 20rpx; | ||
| 949 | + background: #fff; | ||
| 950 | +} | ||
| 951 | + | ||
| 952 | +.header { | ||
| 953 | + display: flex; | ||
| 954 | + align-items: center; | ||
| 955 | + padding: 24rpx 32rpx; | ||
| 956 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 957 | + | ||
| 958 | + .opCollapse { | ||
| 959 | + width: 32rpx; | ||
| 960 | + height: 28rpx; | ||
| 961 | + margin-right: 16rpx; | ||
| 962 | + margin-top: 8rpx; | ||
| 963 | + } | ||
| 964 | + | ||
| 965 | + .title { | ||
| 966 | + font-size: 32rpx; | ||
| 967 | + color: rgba(0, 0, 0, 0.9); | ||
| 968 | + font-weight: 600; | ||
| 969 | + flex: 1; | ||
| 970 | + } | ||
| 971 | + | ||
| 972 | + .ops { | ||
| 973 | + display: flex; | ||
| 974 | + align-items: center; | ||
| 975 | + | ||
| 976 | + .opAdd { | ||
| 977 | + width: 40rpx; | ||
| 978 | + height: 40rpx; | ||
| 979 | + } | ||
| 980 | + } | ||
| 981 | +} | ||
| 982 | + | ||
| 983 | +.add-list { | ||
| 984 | + padding: 0 0 16rpx; | ||
| 985 | + | ||
| 986 | + .empty-tip { | ||
| 987 | + text-align: center; | ||
| 988 | + padding: 60rpx 0; | ||
| 989 | + color: rgba(0, 0, 0, 0.4); | ||
| 990 | + font-size: 28rpx; | ||
| 991 | + } | ||
| 992 | + | ||
| 993 | + .block { | ||
| 994 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 995 | + | ||
| 996 | + &:last-child { | ||
| 997 | + border-bottom: none; | ||
| 998 | + } | ||
| 999 | + | ||
| 1000 | + .block-ops { | ||
| 1001 | + display: flex; | ||
| 1002 | + align-items: center; | ||
| 1003 | + justify-content: flex-end; | ||
| 1004 | + gap: 48rpx; | ||
| 1005 | + padding: 20rpx 32rpx; | ||
| 1006 | + background: #f8f8f8; | ||
| 1007 | + | ||
| 1008 | + .del, | ||
| 1009 | + .toggle { | ||
| 1010 | + display: flex; | ||
| 1011 | + align-items: center; | ||
| 1012 | + font-size: 28rpx; | ||
| 1013 | + color: rgba(0, 0, 0, 0.6); | ||
| 1014 | + | ||
| 1015 | + .icon { | ||
| 1016 | + width: 32rpx; | ||
| 1017 | + height: 32rpx; | ||
| 1018 | + margin-right: 8rpx; | ||
| 1019 | + } | ||
| 1020 | + } | ||
| 1021 | + | ||
| 1022 | + .del { | ||
| 1023 | + color: #d54941; | ||
| 1024 | + } | ||
| 1025 | + } | ||
| 1026 | + } | ||
| 1027 | +} | ||
| 1028 | + | ||
| 1029 | +.section-content { | ||
| 1030 | + padding: 32rpx; | ||
| 1031 | +} | ||
| 1032 | + | ||
| 1033 | +.form-group { | ||
| 1034 | + margin: 24rpx 0 32rpx; | ||
| 1035 | + | ||
| 1036 | + .item-title { | ||
| 1037 | + display: flex; | ||
| 1038 | + align-items: center; | ||
| 1039 | + font-size: 32rpx; | ||
| 1040 | + color: rgba(0, 0, 0, 0.9); | ||
| 1041 | + margin-bottom: 20rpx; | ||
| 1042 | + position: relative; | ||
| 1043 | + padding-left: 16rpx; | ||
| 1044 | + | ||
| 1045 | + .required { | ||
| 1046 | + color: red; | ||
| 1047 | + position: absolute; | ||
| 1048 | + left: 0; | ||
| 1049 | + } | ||
| 1050 | + } | ||
| 1051 | +} | ||
| 1052 | + | ||
| 1053 | +.remark-group { | ||
| 1054 | + margin-bottom: 32rpx; | ||
| 1055 | + | ||
| 1056 | + &:last-child { | ||
| 1057 | + margin-bottom: 0; | ||
| 1058 | + } | ||
| 1059 | + | ||
| 1060 | + .remark-label { | ||
| 1061 | + display: flex; | ||
| 1062 | + align-items: center; | ||
| 1063 | + font-size: 32rpx; | ||
| 1064 | + color: rgba(0, 0, 0, 0.9); | ||
| 1065 | + margin-bottom: 16rpx; | ||
| 1066 | + } | ||
| 1067 | +} | ||
| 1068 | +</style> |
pages/weight-ticket/detail.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">{{ formatDate(form.firstGrossWeightTime) }}</text></view> | ||
| 12 | + <view class="row"><text class="label">供料单位</text><text class="value">{{ safeText(form.supplierName) }}</text></view> | ||
| 13 | + <view class="row"><text class="label">收料单位</text><text class="value">{{ safeText(form.companyShortName) }}</text></view> | ||
| 14 | + </view> | ||
| 15 | + | ||
| 16 | + <!-- 计划单明细 --> | ||
| 17 | + <view class="sub-table"> | ||
| 18 | + <view class="sub-header"> | ||
| 19 | + <image class="sub-bar" src="/static/images/title.png" /> | ||
| 20 | + <text class="sub-title">计划单明细</text> | ||
| 21 | + <view class="sub-toggle" @click="toggle('plan')"> | ||
| 22 | + <image class="sub-toggle_icon" :src="collapse.plan ? '/static/images/down.png' : '/static/images/up.png'" /> | ||
| 23 | + <text class="sub-toggle_text">{{ collapse.plan ? '展开' : '收起' }}</text> | ||
| 24 | + </view> | ||
| 25 | + </view> | ||
| 26 | + <view v-if="!collapse.plan" class="sub-body"> | ||
| 27 | + <view v-if="!planList.length" class="empty-tip">暂无明细</view> | ||
| 28 | + <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card"> | ||
| 29 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | ||
| 30 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> | ||
| 31 | + <view class="row"><text class="label">计划品种</text><text class="value">{{ safeText(item.productName) }}</text></view> | ||
| 32 | + <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | ||
| 33 | + </view> | ||
| 34 | + </view> | ||
| 35 | + </view> | ||
| 36 | + | ||
| 37 | + <!-- 过磅明细 --> | ||
| 38 | + <view class="sub-table"> | ||
| 39 | + <view class="sub-header"> | ||
| 40 | + <image class="sub-bar" src="/static/images/title.png" /> | ||
| 41 | + <text class="sub-title">过磅明细</text> | ||
| 42 | + <view class="sub-toggle" @click="toggle('weigh')"> | ||
| 43 | + <image class="sub-toggle_icon" :src="collapse.weigh ? '/static/images/down.png' : '/static/images/up.png'" /> | ||
| 44 | + <text class="sub-toggle_text">{{ collapse.weigh ? '展开' : '收起' }}</text> | ||
| 45 | + </view> | ||
| 46 | + </view> | ||
| 47 | + <view v-if="!collapse.weigh" class="sub-body"> | ||
| 48 | + <view v-if="!weighList.length" class="empty-tip">暂无明细</view> | ||
| 49 | + <view v-for="(item, idx) in weighList" :key="'w-' + (item.id || idx)" class="card"> | ||
| 50 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | ||
| 51 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view> | ||
| 52 | + <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view> | ||
| 53 | + <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view> | ||
| 54 | + <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | ||
| 55 | + </view> | ||
| 56 | + </view> | ||
| 57 | + </view> | ||
| 58 | + | ||
| 59 | + <!-- 申请数量明细(仅买断或有数据时展示) --> | ||
| 60 | + <view v-if="isBuyout" class="sub-table"> | ||
| 61 | + <view class="sub-header"> | ||
| 62 | + <image class="sub-bar" src="/static/images/title.png" /> | ||
| 63 | + <text class="sub-title">申请数量明细</text> | ||
| 64 | + <view class="sub-toggle" @click="toggle('apply')"> | ||
| 65 | + <image class="sub-toggle_icon" :src="collapse.apply ? '/static/images/down.png' : '/static/images/up.png'" /> | ||
| 66 | + <text class="sub-toggle_text">{{ collapse.apply ? '展开' : '收起' }}</text> | ||
| 67 | + </view> | ||
| 68 | + </view> | ||
| 69 | + <view v-if="!collapse.apply" class="sub-body"> | ||
| 70 | + <view v-if="!applyList.length" class="empty-tip">暂无明细</view> | ||
| 71 | + <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card"> | ||
| 72 | + <view class="card-index">第 {{ idx + 1 }} 行</view> | ||
| 73 | + <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view> | ||
| 74 | + <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | ||
| 75 | + </view> | ||
| 76 | + </view> | ||
| 77 | + </view> | ||
| 78 | + | ||
| 79 | + <!-- 其他信息 --> | ||
| 80 | + <view class="title-header"> | ||
| 81 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 82 | + <span>其他信息</span> | ||
| 83 | + </view> | ||
| 84 | + <view class="section"> | ||
| 85 | + <view class="row"><text class="label">物料名称</text><text class="value">{{ safeText(form.materialName) }}</text></view> | ||
| 86 | + <view class="row"><text class="label">过磅总重</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view> | ||
| 87 | + <view class="row"><text class="label">实际伙重</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view> | ||
| 88 | + <view class="row"><text class="label">货物净重</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view> | ||
| 89 | + <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view> | ||
| 90 | + <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view> | ||
| 91 | + <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view> | ||
| 92 | + <view class="row"><text class="label">物流存欠料</text><text class="value">{{ safeText(form.logisticsStockMaterial) }}</text></view> | ||
| 93 | + <view class="row"><text class="label">车牌号</text><text class="value">{{ safeText(form.plateNumber) }}</text></view> | ||
| 94 | + </view> | ||
| 95 | + | ||
| 96 | + <!-- 业务摘要 --> | ||
| 97 | + <view class="title-header"> | ||
| 98 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 99 | + <span>业务摘要</span> | ||
| 100 | + </view> | ||
| 101 | + <view class="section"> | ||
| 102 | + <text class="remark-text">{{ safeText(form.businessSummary) }}</text> | ||
| 103 | + </view> | ||
| 104 | + | ||
| 105 | + <!-- 特别说明 --> | ||
| 106 | + <view class="title-header"> | ||
| 107 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 108 | + <span>特别说明</span> | ||
| 109 | + </view> | ||
| 110 | + <view class="section"> | ||
| 111 | + <text class="remark-text">{{ safeText(form.specialNote) }}</text> | ||
| 112 | + </view> | ||
| 113 | + | ||
| 114 | + <!-- 单据备注 --> | ||
| 115 | + <view class="title-header"> | ||
| 116 | + <image class="title-header_icon" src="/static/images/title.png" /> | ||
| 117 | + <span>单据备注</span> | ||
| 118 | + </view> | ||
| 119 | + <view class="section"> | ||
| 120 | + <text class="remark-text">{{ safeText(form.documentRemark) }}</text> | ||
| 121 | + </view> | ||
| 122 | + </view> | ||
| 123 | + </scroll-view> | ||
| 124 | + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" /> | ||
| 125 | + </view> | ||
| 126 | +</template> | ||
| 127 | + | ||
| 128 | +<script> | ||
| 129 | +import DetailButtons from '@/components/detail-buttons/index.vue' | ||
| 130 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 131 | +import { weighTicketDetailApi, weighTicketSubmitAuditApi, weighTicketCancelApi } from '@/api/procure-manage/weighTicket.js' | ||
| 132 | +import { getInfo } from '@/api/login.js' | ||
| 133 | + | ||
| 134 | +export default { | ||
| 135 | + name: 'WeightTicketDetail', | ||
| 136 | + components: { DetailButtons }, | ||
| 137 | + data() { | ||
| 138 | + return { | ||
| 139 | + id: '', | ||
| 140 | + form: {}, | ||
| 141 | + planList: [], | ||
| 142 | + weighList: [], | ||
| 143 | + applyList: [], | ||
| 144 | + buyout: false, | ||
| 145 | + currentUserId: '', | ||
| 146 | + collapse: { plan: false, weigh: false, apply: false }, | ||
| 147 | + dicOptions: { | ||
| 148 | + TYPE: [], | ||
| 149 | + DEDUCTION_TYPE: [], | ||
| 150 | + AUDIT_STATUS: [] | ||
| 151 | + }, | ||
| 152 | + buttons: [ | ||
| 153 | + { text: '修改', visible: true, variant: 'outline', event: 'edit' }, | ||
| 154 | + { text: '提交审核', visible: true, variant: 'outline', event: 'submitAudit' }, | ||
| 155 | + { text: '审核', visible: true, variant: 'primary', event: 'audit' }, | ||
| 156 | + { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' }, | ||
| 157 | + { text: '作废', visible: true, variant: 'outline', event: 'cancel' }, | ||
| 158 | + { text: '上传签字凭证', visible: true, variant: 'outline', event: 'uploadSign' }, | ||
| 159 | + { text: '上传延期说明', visible: true, variant: 'outline', event: 'uploadDelay' }, | ||
| 160 | + { text: '复磅', visible: true, variant: 'outline', event: 'reweigh' } | ||
| 161 | + ] | ||
| 162 | + } | ||
| 163 | + }, | ||
| 164 | + computed: { | ||
| 165 | + typeName() { | ||
| 166 | + const v = this.form.type == null ? '' : String(this.form.type) | ||
| 167 | + if (!v) return '-' | ||
| 168 | + return getDicName('TYPE', v, this.dicOptions.TYPE) || v | ||
| 169 | + }, | ||
| 170 | + planCodeText() { | ||
| 171 | + const codes = Array.from(new Set((this.planList || []).map(it => it.planCode).filter(Boolean))) | ||
| 172 | + return codes.join(',') | ||
| 173 | + }, | ||
| 174 | + deductionNames() { | ||
| 175 | + const codes = (this.form.deductionTypes == null ? '' : String(this.form.deductionTypes)).split(',').filter(Boolean) | ||
| 176 | + const names = codes.map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)).filter(Boolean) | ||
| 177 | + return names.length ? names.join('、') : '-' | ||
| 178 | + }, | ||
| 179 | + isBuyout() { | ||
| 180 | + return this.buyout || (this.applyList || []).length > 0 | ||
| 181 | + }, | ||
| 182 | + displayButtons() { | ||
| 183 | + const status = this.form.approvalStatus || '' | ||
| 184 | + const isMine = this.form.createById === this.currentUserId | ||
| 185 | + const isPass = status === 'PASS' | ||
| 186 | + const isAudit = status === 'AUDIT' | ||
| 187 | + const showExamine = this.form.showExamine === true | ||
| 188 | + const showExamineDetail = this.form.showExamineDetail === true | ||
| 189 | + return [ | ||
| 190 | + { | ||
| 191 | + ...this.buttons[0], | ||
| 192 | + visible: (status === 'DRAFT' || status === 'REFUSE' || !status) && isMine && this.$auth.hasPermi('warehouse-manage:weight-ticket:modify') | ||
| 193 | + }, | ||
| 194 | + { | ||
| 195 | + ...this.buttons[1], | ||
| 196 | + visible: (status === 'DRAFT' || status === 'REFUSE' || !status) && isMine && this.$auth.hasPermi('warehouse-manage:weight-ticket:submit') | ||
| 197 | + }, | ||
| 198 | + { | ||
| 199 | + ...this.buttons[2], | ||
| 200 | + visible: isAudit && showExamine && this.$auth.hasPermi('warehouse-manage:weight-ticket:approve') | ||
| 201 | + }, | ||
| 202 | + { | ||
| 203 | + ...this.buttons[3], | ||
| 204 | + visible: (isAudit || isPass) && showExamineDetail && this.$auth.hasPermi('warehouse-manage:weight-ticket:review') | ||
| 205 | + }, | ||
| 206 | + { | ||
| 207 | + ...this.buttons[4], | ||
| 208 | + visible: isPass && this.$auth.hasPermi('warehouse-manage:weight-ticket:cancel') | ||
| 209 | + }, | ||
| 210 | + { | ||
| 211 | + ...this.buttons[5], | ||
| 212 | + visible: isPass && this.$auth.hasPermi('warehouse-manage:weight-ticket:uploadSigned') | ||
| 213 | + }, | ||
| 214 | + { | ||
| 215 | + ...this.buttons[6], | ||
| 216 | + visible: isPass && this.$auth.hasPermi('warehouse-manage:weight-ticket:uploadExtension') | ||
| 217 | + }, | ||
| 218 | + { | ||
| 219 | + ...this.buttons[7], | ||
| 220 | + visible: isPass && this.$auth.hasPermi('warehouse-manage:weight-ticket:reweigh') | ||
| 221 | + } | ||
| 222 | + ] | ||
| 223 | + } | ||
| 224 | + }, | ||
| 225 | + onLoad(query) { | ||
| 226 | + this.id = (query && query.id) || '' | ||
| 227 | + this.loadDicData() | ||
| 228 | + this.loadDetail() | ||
| 229 | + this.getUserInfo() | ||
| 230 | + }, | ||
| 231 | + onShow() { | ||
| 232 | + let needRefresh = '' | ||
| 233 | + try { needRefresh = uni.getStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH') } catch (e) {} | ||
| 234 | + if (!needRefresh) return | ||
| 235 | + try { uni.removeStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH') } catch (e) {} | ||
| 236 | + this.loadDetail() | ||
| 237 | + }, | ||
| 238 | + methods: { | ||
| 239 | + toggle(key) { | ||
| 240 | + this.collapse = { ...this.collapse, [key]: !this.collapse[key] } | ||
| 241 | + }, | ||
| 242 | + async loadDicData() { | ||
| 243 | + try { | ||
| 244 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE', 'AUDIT_STATUS']) | ||
| 245 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 246 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 247 | + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || [] | ||
| 248 | + } catch (e) { | ||
| 249 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [], AUDIT_STATUS: [] } | ||
| 250 | + } | ||
| 251 | + }, | ||
| 252 | + async getUserInfo() { | ||
| 253 | + try { | ||
| 254 | + const res = await getInfo() | ||
| 255 | + this.currentUserId = (res && (res.id || (res.data && res.data.id))) || '' | ||
| 256 | + } catch (e) { | ||
| 257 | + this.currentUserId = '' | ||
| 258 | + } | ||
| 259 | + }, | ||
| 260 | + loadDetail() { | ||
| 261 | + if (!this.id) { | ||
| 262 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | ||
| 263 | + return | ||
| 264 | + } | ||
| 265 | + uni.showLoading && uni.showLoading({ title: '加载中...', mask: true }) | ||
| 266 | + weighTicketDetailApi({ id: this.id }) | ||
| 267 | + .then(res => { | ||
| 268 | + const data = res && res.data ? (res.data.data || res.data) : {} | ||
| 269 | + this.form = Object.assign({}, data) | ||
| 270 | + this.buyout = !!data.buyout | ||
| 271 | + this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] | ||
| 272 | + this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] | ||
| 273 | + this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : [] | ||
| 274 | + }) | ||
| 275 | + .catch(() => { | ||
| 276 | + uni.showToast({ title: '详情加载失败', icon: 'none' }) | ||
| 277 | + }) | ||
| 278 | + .finally(() => { | ||
| 279 | + uni.hideLoading && uni.hideLoading() | ||
| 280 | + }) | ||
| 281 | + }, | ||
| 282 | + handleButtonClick(btn) { | ||
| 283 | + if (!btn || btn.disabled || !btn.visible) return | ||
| 284 | + const e = btn.event || '' | ||
| 285 | + if (e === 'edit') return this.onEdit() | ||
| 286 | + if (e === 'submitAudit') return this.onSubmitAudit() | ||
| 287 | + if (e === 'audit') return this.onAudit() | ||
| 288 | + if (e === 'auditDetail') return this.onAuditDetail() | ||
| 289 | + if (e === 'cancel') return this.onCancel() | ||
| 290 | + if (e === 'uploadSign') return this.onUpload('sign') | ||
| 291 | + if (e === 'uploadDelay') return this.onUpload('delay') | ||
| 292 | + if (e === 'reweigh') return this.onReweigh() | ||
| 293 | + }, | ||
| 294 | + onEdit() { | ||
| 295 | + uni.navigateTo({ url: '/pages/weight-ticket/modify?id=' + this.id }) | ||
| 296 | + }, | ||
| 297 | + onAudit() { | ||
| 298 | + const id = this.id || (this.form && this.form.id) || '' | ||
| 299 | + if (!id) return | ||
| 300 | + uni.setStorageSync('contractType', 'WEIGHING_RECORD') | ||
| 301 | + uni.setStorageSync('sourceBusinessId', id) | ||
| 302 | + uni.navigateTo({ url: '/pages/flow/audit' }) | ||
| 303 | + }, | ||
| 304 | + onAuditDetail() { | ||
| 305 | + const id = this.id || (this.form && this.form.id) || '' | ||
| 306 | + if (!id) return | ||
| 307 | + uni.setStorageSync('contractType', 'WEIGHING_RECORD') | ||
| 308 | + uni.setStorageSync('sourceBusinessId', id) | ||
| 309 | + uni.navigateTo({ url: '/pages/flow/audit_detail' }) | ||
| 310 | + }, | ||
| 311 | + onUpload(mode) { | ||
| 312 | + uni.navigateTo({ url: '/pages/weight-ticket/upload?id=' + this.id + '&mode=' + mode }) | ||
| 313 | + }, | ||
| 314 | + onReweigh() { | ||
| 315 | + uni.navigateTo({ url: '/pages/weight-ticket/reweigh?id=' + this.id }) | ||
| 316 | + }, | ||
| 317 | + refreshListFlags() { | ||
| 318 | + try { | ||
| 319 | + uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | ||
| 320 | + uni.setStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH', '1') | ||
| 321 | + } catch (e) {} | ||
| 322 | + }, | ||
| 323 | + runWithConfirm(opts) { | ||
| 324 | + const title = opts.title || '提示' | ||
| 325 | + const content = opts.content || '' | ||
| 326 | + const run = opts.run | ||
| 327 | + const loading = opts.loading || '处理中' | ||
| 328 | + const successText = opts.successText || '操作成功' | ||
| 329 | + const failText = opts.failText || '操作失败' | ||
| 330 | + if (!this.id) { | ||
| 331 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | ||
| 332 | + return | ||
| 333 | + } | ||
| 334 | + uni.showModal({ | ||
| 335 | + title, | ||
| 336 | + content, | ||
| 337 | + confirmText: '确定', | ||
| 338 | + cancelText: '取消', | ||
| 339 | + success: res => { | ||
| 340 | + if (!res || !res.confirm) return | ||
| 341 | + uni.showLoading({ title: loading, mask: true }) | ||
| 342 | + Promise.resolve(run(this.id)) | ||
| 343 | + .then(() => { | ||
| 344 | + uni.hideLoading() | ||
| 345 | + uni.showToast({ title: successText, icon: 'none' }) | ||
| 346 | + this.refreshListFlags() | ||
| 347 | + this.loadDetail() | ||
| 348 | + }) | ||
| 349 | + .catch(e => { | ||
| 350 | + uni.hideLoading() | ||
| 351 | + uni.showToast({ title: (e && (e.msg || e.message)) || failText, icon: 'none' }) | ||
| 352 | + }) | ||
| 353 | + } | ||
| 354 | + }) | ||
| 355 | + }, | ||
| 356 | + onSubmitAudit() { | ||
| 357 | + this.runWithConfirm({ | ||
| 358 | + title: '提交审核', | ||
| 359 | + content: '确认提交审核吗?', | ||
| 360 | + loading: '提交中', | ||
| 361 | + successText: '提交审核成功', | ||
| 362 | + failText: '提交审核失败', | ||
| 363 | + run: id => weighTicketSubmitAuditApi(id) | ||
| 364 | + }) | ||
| 365 | + }, | ||
| 366 | + onCancel() { | ||
| 367 | + this.runWithConfirm({ | ||
| 368 | + title: '作废', | ||
| 369 | + content: '确认作废该过磅单吗?', | ||
| 370 | + loading: '处理中', | ||
| 371 | + successText: '作废成功', | ||
| 372 | + failText: '作废失败', | ||
| 373 | + run: id => weighTicketCancelApi(id) | ||
| 374 | + }) | ||
| 375 | + }, | ||
| 376 | + safeText(v) { | ||
| 377 | + const s = v == null ? '' : String(v) | ||
| 378 | + return s.trim() ? s : '-' | ||
| 379 | + }, | ||
| 380 | + formatNumber(v) { | ||
| 381 | + if (v === null || v === undefined || v === '') return '-' | ||
| 382 | + const n = Number(v) | ||
| 383 | + if (isNaN(n)) return String(v) | ||
| 384 | + return n.toLocaleString('zh-CN', { maximumFractionDigits: 4 }) | ||
| 385 | + }, | ||
| 386 | + formatDate(v) { | ||
| 387 | + const s = v == null ? '' : String(v).trim() | ||
| 388 | + if (!s) return '-' | ||
| 389 | + return s | ||
| 390 | + } | ||
| 391 | + } | ||
| 392 | +} | ||
| 393 | +</script> | ||
| 394 | + | ||
| 395 | +<style lang="scss" scoped> | ||
| 396 | +.page { | ||
| 397 | + display: flex; | ||
| 398 | + flex-direction: column; | ||
| 399 | + height: 100%; | ||
| 400 | +} | ||
| 401 | +.scroll { | ||
| 402 | + flex: 1; | ||
| 403 | + padding: 8rpx 0 144rpx; | ||
| 404 | +} | ||
| 405 | +.detail-page { | ||
| 406 | + background: #f3f3f3; | ||
| 407 | +} | ||
| 408 | +.section { | ||
| 409 | + padding: 32rpx; | ||
| 410 | + background: #fff; | ||
| 411 | + margin-bottom: 20rpx; | ||
| 412 | +} | ||
| 413 | +.title-header { | ||
| 414 | + display: flex; | ||
| 415 | + align-items: center; | ||
| 416 | + padding: 24rpx 32rpx 12rpx; | ||
| 417 | + background-color: #ffffff; | ||
| 418 | + .title-header_icon { width: 36rpx; height: 36rpx; margin-right: 12rpx; } | ||
| 419 | + span { font-size: 34rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); } | ||
| 420 | +} | ||
| 421 | +.row { | ||
| 422 | + display: flex; | ||
| 423 | + margin-bottom: 28rpx; | ||
| 424 | + &:last-child { margin-bottom: 0; } | ||
| 425 | + &.company { | ||
| 426 | + font-size: 36rpx; | ||
| 427 | + font-weight: 600; | ||
| 428 | + color: rgba(0, 0, 0, 0.9); | ||
| 429 | + padding-top: 8rpx; | ||
| 430 | + line-height: 50rpx; | ||
| 431 | + } | ||
| 432 | + .label { | ||
| 433 | + max-width: 420rpx; | ||
| 434 | + margin-right: 20rpx; | ||
| 435 | + line-height: 32rpx; | ||
| 436 | + font-size: 28rpx; | ||
| 437 | + color: rgba(0, 0, 0, 0.6); | ||
| 438 | + } | ||
| 439 | + .value { | ||
| 440 | + flex: 1; | ||
| 441 | + line-height: 32rpx; | ||
| 442 | + font-size: 28rpx; | ||
| 443 | + color: rgba(0, 0, 0, 0.9); | ||
| 444 | + text-align: right; | ||
| 445 | + word-break: break-all; | ||
| 446 | + } | ||
| 447 | +} | ||
| 448 | +.remark-text { | ||
| 449 | + font-size: 28rpx; | ||
| 450 | + color: rgba(0, 0, 0, 0.9); | ||
| 451 | + line-height: 1.6; | ||
| 452 | + white-space: pre-wrap; | ||
| 453 | +} | ||
| 454 | +.sub-table { | ||
| 455 | + background: #fff; | ||
| 456 | + margin-bottom: 20rpx; | ||
| 457 | +} | ||
| 458 | +.sub-header { | ||
| 459 | + display: flex; | ||
| 460 | + align-items: center; | ||
| 461 | + padding: 16rpx 0 16rpx 32rpx; | ||
| 462 | + .sub-bar { width: 6rpx; height: 32rpx; margin-right: 14rpx; } | ||
| 463 | + .sub-title { font-size: 30rpx; font-weight: 600; color: rgba(0, 0, 0, 0.9); flex: 1; line-height: 42rpx; } | ||
| 464 | + .sub-toggle { | ||
| 465 | + display: flex; | ||
| 466 | + align-items: center; | ||
| 467 | + padding: 0 12rpx; | ||
| 468 | + height: 56rpx; | ||
| 469 | + .sub-toggle_icon { width: 24rpx; height: 24rpx; margin-right: 8rpx; } | ||
| 470 | + .sub-toggle_text { font-size: 26rpx; color: rgba(0, 0, 0, 0.6); } | ||
| 471 | + } | ||
| 472 | +} | ||
| 473 | +.sub-body { | ||
| 474 | + padding: 0 32rpx 24rpx; | ||
| 475 | + .empty-tip { | ||
| 476 | + text-align: center; | ||
| 477 | + padding: 60rpx 0; | ||
| 478 | + color: rgba(0, 0, 0, 0.4); | ||
| 479 | + font-size: 28rpx; | ||
| 480 | + } | ||
| 481 | + .card { | ||
| 482 | + position: relative; | ||
| 483 | + background: #fafafa; | ||
| 484 | + border-radius: 12rpx; | ||
| 485 | + padding: 32rpx 28rpx 20rpx; | ||
| 486 | + margin-bottom: 24rpx; | ||
| 487 | + .card-index { | ||
| 488 | + position: absolute; | ||
| 489 | + top: 0; | ||
| 490 | + right: 0; | ||
| 491 | + background: rgba(24, 144, 255, 0.08); | ||
| 492 | + color: $theme-primary; | ||
| 493 | + font-size: 22rpx; | ||
| 494 | + line-height: 36rpx; | ||
| 495 | + padding: 0 16rpx; | ||
| 496 | + border-bottom-left-radius: 12rpx; | ||
| 497 | + border-top-right-radius: 12rpx; | ||
| 498 | + } | ||
| 499 | + .row { | ||
| 500 | + align-items: center; | ||
| 501 | + justify-content: space-between; | ||
| 502 | + padding: 14rpx 0; | ||
| 503 | + margin-bottom: 0; | ||
| 504 | + border-bottom: 1rpx dashed #f2f2f2; | ||
| 505 | + &:last-child { border-bottom: none; } | ||
| 506 | + .label { | ||
| 507 | + flex-shrink: 0; | ||
| 508 | + width: 220rpx; | ||
| 509 | + max-width: none; | ||
| 510 | + margin-right: 0; | ||
| 511 | + font-size: 28rpx; | ||
| 512 | + color: rgba(0, 0, 0, 0.6); | ||
| 513 | + line-height: 40rpx; | ||
| 514 | + } | ||
| 515 | + .value { | ||
| 516 | + flex: 1; | ||
| 517 | + text-align: right; | ||
| 518 | + font-size: 28rpx; | ||
| 519 | + color: rgba(0, 0, 0, 0.9); | ||
| 520 | + line-height: 40rpx; | ||
| 521 | + overflow: hidden; | ||
| 522 | + text-overflow: ellipsis; | ||
| 523 | + white-space: nowrap; | ||
| 524 | + } | ||
| 525 | + } | ||
| 526 | + } | ||
| 527 | +} | ||
| 528 | +</style> |
pages/weight-ticket/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <view class="ticket-list-fixed"> | ||
| 4 | + <view class="search-row"> | ||
| 5 | + <uni-search-bar | ||
| 6 | + v-model="searchKeyword" | ||
| 7 | + radius="6" | ||
| 8 | + placeholder="请输入编号" | ||
| 9 | + clearButton="auto" | ||
| 10 | + cancelButton="none" | ||
| 11 | + bgColor="#F3F3F3" | ||
| 12 | + textColor="rgba(0,0,0,0.4)" | ||
| 13 | + @confirm="search" | ||
| 14 | + @input="onSearchInput" | ||
| 15 | + /> | ||
| 16 | + <view class="tool-icons"> | ||
| 17 | + <image | ||
| 18 | + v-if="$auth.hasPermi('warehouse-manage:weight-ticket:add')" | ||
| 19 | + class="tool-icon" | ||
| 20 | + src="/static/images/dev_manage/add_icon.png" | ||
| 21 | + @click="onAdd" | ||
| 22 | + /> | ||
| 23 | + <image class="tool-icon" src="/static/images/dev_manage/filter_icon.png" @click="openFilter" /> | ||
| 24 | + </view> | ||
| 25 | + </view> | ||
| 26 | + | ||
| 27 | + <view class="tabs"> | ||
| 28 | + <view | ||
| 29 | + v-for="(t, i) in tabs" | ||
| 30 | + :key="i" | ||
| 31 | + :class="['tab', { active: deleted === t.value }]" | ||
| 32 | + @click="switchTab(t)" | ||
| 33 | + > | ||
| 34 | + {{ t.label }} | ||
| 35 | + </view> | ||
| 36 | + </view> | ||
| 37 | + </view> | ||
| 38 | + | ||
| 39 | + <view class="list-box"> | ||
| 40 | + <card-list | ||
| 41 | + ref="cardRef" | ||
| 42 | + :fetch-fn="fetchList" | ||
| 43 | + :query="query" | ||
| 44 | + :extra="extraParams" | ||
| 45 | + row-key="id" | ||
| 46 | + :enable-refresh="true" | ||
| 47 | + :enable-load-more="true" | ||
| 48 | + @loaded="onCardLoaded" | ||
| 49 | + @error="onCardError" | ||
| 50 | + > | ||
| 51 | + <template v-slot="{ item }"> | ||
| 52 | + <view class="card" @click="onCardClick(item)"> | ||
| 53 | + <view class="card-header"> | ||
| 54 | + <text class="title omit2">{{ item.supplierName || '-' }}</text> | ||
| 55 | + <text :class="['status', `status_${item.approvalStatus}`]">{{ getAuditStatusText(item.approvalStatus) }}</text> | ||
| 56 | + </view> | ||
| 57 | + <view class="info-row"> | ||
| 58 | + <text>编号</text> | ||
| 59 | + <text>{{ item.code || '-' }}</text> | ||
| 60 | + </view> | ||
| 61 | + <view class="info-row"> | ||
| 62 | + <text>计划编号</text> | ||
| 63 | + <text>{{ item.planCodes || '-' }}</text> | ||
| 64 | + </view> | ||
| 65 | + <view class="info-row"> | ||
| 66 | + <text>公司简称</text> | ||
| 67 | + <text>{{ item.companyShortName || '-' }}</text> | ||
| 68 | + </view> | ||
| 69 | + <view class="info-row"> | ||
| 70 | + <text>创建人</text> | ||
| 71 | + <text>{{ item.createBy || '-' }}</text> | ||
| 72 | + </view> | ||
| 73 | + <view class="info-row"> | ||
| 74 | + <text>时间</text> | ||
| 75 | + <text>{{ formatDateOnly(item.firstGrossWeightTime) }}</text> | ||
| 76 | + </view> | ||
| 77 | + </view> | ||
| 78 | + </template> | ||
| 79 | + </card-list> | ||
| 80 | + </view> | ||
| 81 | + | ||
| 82 | + <filter-modal | ||
| 83 | + :visible.sync="filterVisible" | ||
| 84 | + :value.sync="filterForm" | ||
| 85 | + title="筛选" | ||
| 86 | + @reset="onFilterReset" | ||
| 87 | + @confirm="onFilterConfirm" | ||
| 88 | + > | ||
| 89 | + <template v-slot="{ model }"> | ||
| 90 | + <view class="filter-form"> | ||
| 91 | + <view class="form-item"> | ||
| 92 | + <view class="label">编号</view> | ||
| 93 | + <input class="input" v-model="model.code" placeholder="请输入编号" /> | ||
| 94 | + </view> | ||
| 95 | + <view class="form-item"> | ||
| 96 | + <view class="label">计划编号</view> | ||
| 97 | + <input class="input" v-model="model.planCode" placeholder="请输入计划编号" /> | ||
| 98 | + </view> | ||
| 99 | + <view class="form-item"> | ||
| 100 | + <view class="label">供料单位</view> | ||
| 101 | + <input class="input" v-model="model.supplierName" placeholder="请输入供料单位" /> | ||
| 102 | + </view> | ||
| 103 | + <view class="form-item"> | ||
| 104 | + <view class="label">公司简称</view> | ||
| 105 | + <picker mode="selector" :range="companyShortLabels" @change="onCompanyShortChange"> | ||
| 106 | + <view class="fake-select"> | ||
| 107 | + <text v-if="companyShortLabel" class="value">{{ companyShortLabel }}</text> | ||
| 108 | + <text v-else class="placeholder">请选择公司简称</text> | ||
| 109 | + </view> | ||
| 110 | + </picker> | ||
| 111 | + </view> | ||
| 112 | + <view class="form-item"> | ||
| 113 | + <view class="label">审核状态</view> | ||
| 114 | + <uni-data-checkbox | ||
| 115 | + mode="tag" | ||
| 116 | + :multiple="false" | ||
| 117 | + :value-field="'value'" | ||
| 118 | + :text-field="'text'" | ||
| 119 | + v-model="model.approvalStatus" | ||
| 120 | + :localdata="approvalStatusOptions" | ||
| 121 | + /> | ||
| 122 | + </view> | ||
| 123 | + <view class="form-item"> | ||
| 124 | + <view class="label">创建人</view> | ||
| 125 | + <input class="input" v-model="model.createBy" placeholder="请输入创建人" /> | ||
| 126 | + </view> | ||
| 127 | + <view class="form-item"> | ||
| 128 | + <view class="label">时间</view> | ||
| 129 | + <uni-datetime-picker type="daterange" v-model="model.timeRange" start="2023-01-01" /> | ||
| 130 | + </view> | ||
| 131 | + </view> | ||
| 132 | + </template> | ||
| 133 | + </filter-modal> | ||
| 134 | + </view> | ||
| 135 | +</template> | ||
| 136 | + | ||
| 137 | +<script> | ||
| 138 | +import CardList from '@/components/card/index.vue' | ||
| 139 | +import FilterModal from '@/components/filter/index.vue' | ||
| 140 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 141 | +import { weighTicketQueryApi, companyShortQueryApi } from '@/api/procure-manage/weighTicket.js' | ||
| 142 | + | ||
| 143 | +export default { | ||
| 144 | + name: 'WeightTicketList', | ||
| 145 | + components: { CardList, FilterModal }, | ||
| 146 | + data() { | ||
| 147 | + return { | ||
| 148 | + searchKeyword: '', | ||
| 149 | + searchKeywordDebounced: '', | ||
| 150 | + searchDebounceTimer: null, | ||
| 151 | + deleted: false, | ||
| 152 | + tabs: [ | ||
| 153 | + { label: '有效', value: false }, | ||
| 154 | + { label: '作废', value: true } | ||
| 155 | + ], | ||
| 156 | + query: { | ||
| 157 | + code: '', | ||
| 158 | + planCode: '', | ||
| 159 | + supplierName: '', | ||
| 160 | + companyShortId: '', | ||
| 161 | + approvalStatus: '', | ||
| 162 | + createBy: '', | ||
| 163 | + timeRange: [] | ||
| 164 | + }, | ||
| 165 | + extraParams: {}, | ||
| 166 | + currentItems: [], | ||
| 167 | + filterVisible: false, | ||
| 168 | + filterForm: { | ||
| 169 | + code: '', | ||
| 170 | + planCode: '', | ||
| 171 | + supplierName: '', | ||
| 172 | + companyShortId: '', | ||
| 173 | + approvalStatus: '', | ||
| 174 | + createBy: '', | ||
| 175 | + timeRange: [] | ||
| 176 | + }, | ||
| 177 | + approvalStatusOptions: [ | ||
| 178 | + { value: '', text: '全部' }, | ||
| 179 | + { value: 'DRAFT', text: '草稿' }, | ||
| 180 | + { value: 'AUDIT', text: '审核中' }, | ||
| 181 | + { value: 'PASS', text: '审核通过' }, | ||
| 182 | + { value: 'REFUSE', text: '已驳回' }, | ||
| 183 | + { value: 'CANCEL', text: '已取消' } | ||
| 184 | + ], | ||
| 185 | + companyShortOptions: [], | ||
| 186 | + companyShortLabel: '', | ||
| 187 | + dicOptions: { | ||
| 188 | + AUDIT_STATUS: [] | ||
| 189 | + } | ||
| 190 | + } | ||
| 191 | + }, | ||
| 192 | + computed: { | ||
| 193 | + companyShortLabels() { | ||
| 194 | + return ['全部'].concat(this.companyShortOptions.map(it => it.label)) | ||
| 195 | + }, | ||
| 196 | + extraCombined() { | ||
| 197 | + return { | ||
| 198 | + keyword: this.searchKeywordDebounced || undefined, | ||
| 199 | + deleted: this.deleted | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + }, | ||
| 203 | + watch: { | ||
| 204 | + extraCombined: { | ||
| 205 | + deep: true, | ||
| 206 | + handler(v) { | ||
| 207 | + this.extraParams = v | ||
| 208 | + }, | ||
| 209 | + immediate: true | ||
| 210 | + } | ||
| 211 | + }, | ||
| 212 | + created() { | ||
| 213 | + this.loadDicData() | ||
| 214 | + this.loadCompanyShortOptions() | ||
| 215 | + }, | ||
| 216 | + onShow() { | ||
| 217 | + let needRefresh = '' | ||
| 218 | + try { needRefresh = uni.getStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH') } catch (e) {} | ||
| 219 | + if (!needRefresh) return | ||
| 220 | + try { uni.removeStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH') } catch (e) {} | ||
| 221 | + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.reload) { | ||
| 222 | + this.$refs.cardRef.reload() | ||
| 223 | + } | ||
| 224 | + }, | ||
| 225 | + onReachBottom() { | ||
| 226 | + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) { | ||
| 227 | + this.$refs.cardRef.onLoadMore() | ||
| 228 | + } | ||
| 229 | + }, | ||
| 230 | + beforeDestroy() { | ||
| 231 | + if (this.searchDebounceTimer) { | ||
| 232 | + clearTimeout(this.searchDebounceTimer) | ||
| 233 | + this.searchDebounceTimer = null | ||
| 234 | + } | ||
| 235 | + }, | ||
| 236 | + methods: { | ||
| 237 | + async loadDicData() { | ||
| 238 | + try { | ||
| 239 | + const results = await getDicByCodes(['AUDIT_STATUS']) | ||
| 240 | + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || [] | ||
| 241 | + } catch (e) { | ||
| 242 | + this.dicOptions.AUDIT_STATUS = [] | ||
| 243 | + } | ||
| 244 | + }, | ||
| 245 | + async loadCompanyShortOptions() { | ||
| 246 | + try { | ||
| 247 | + const res = await companyShortQueryApi({ pageIndex: 1, pageSize: 9999 }) | ||
| 248 | + const datas = (res && res.data && res.data.datas) || [] | ||
| 249 | + this.companyShortOptions = datas.map(item => ({ | ||
| 250 | + label: item.shortName || '', | ||
| 251 | + value: item.id || '' | ||
| 252 | + })).filter(it => it.value) | ||
| 253 | + } catch (e) { | ||
| 254 | + this.companyShortOptions = [] | ||
| 255 | + } | ||
| 256 | + }, | ||
| 257 | + getAuditStatusText(status) { | ||
| 258 | + const v = status == null ? '' : String(status) | ||
| 259 | + if (!v) return '-' | ||
| 260 | + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v | ||
| 261 | + }, | ||
| 262 | + formatDateOnly(v) { | ||
| 263 | + const s = v == null ? '' : String(v).trim() | ||
| 264 | + if (!s) return '-' | ||
| 265 | + if (s.length >= 10) return s.slice(0, 10) | ||
| 266 | + return s | ||
| 267 | + }, | ||
| 268 | + onCardLoaded({ items }) { | ||
| 269 | + this.currentItems = items | ||
| 270 | + }, | ||
| 271 | + onCardError() { | ||
| 272 | + uni.showToast({ title: '列表加载失败', icon: 'none' }) | ||
| 273 | + }, | ||
| 274 | + onAdd() { | ||
| 275 | + uni.navigateTo({ url: '/pages/weight-ticket/add' }) | ||
| 276 | + }, | ||
| 277 | + onSearchInput() { | ||
| 278 | + if (this.searchDebounceTimer) clearTimeout(this.searchDebounceTimer) | ||
| 279 | + this.searchDebounceTimer = setTimeout(() => { | ||
| 280 | + this.searchKeywordDebounced = this.searchKeyword | ||
| 281 | + this.searchDebounceTimer = null | ||
| 282 | + }, 1200) | ||
| 283 | + }, | ||
| 284 | + search(e) { | ||
| 285 | + const val = e && e.value != null ? e.value : this.searchKeyword | ||
| 286 | + this.searchKeyword = val | ||
| 287 | + this.searchKeywordDebounced = val | ||
| 288 | + }, | ||
| 289 | + switchTab(t) { | ||
| 290 | + this.deleted = t.value | ||
| 291 | + }, | ||
| 292 | + onCompanyShortChange(e) { | ||
| 293 | + const idx = Number(e.detail.value) | ||
| 294 | + if (idx <= 0) { | ||
| 295 | + this.filterForm.companyShortId = '' | ||
| 296 | + this.companyShortLabel = '' | ||
| 297 | + } else { | ||
| 298 | + const opt = this.companyShortOptions[idx - 1] | ||
| 299 | + this.filterForm.companyShortId = opt ? opt.value : '' | ||
| 300 | + this.companyShortLabel = opt ? opt.label : '' | ||
| 301 | + } | ||
| 302 | + }, | ||
| 303 | + openFilter() { | ||
| 304 | + this.filterForm = { | ||
| 305 | + code: this.query.code || '', | ||
| 306 | + planCode: this.query.planCode || '', | ||
| 307 | + supplierName: this.query.supplierName || '', | ||
| 308 | + companyShortId: this.query.companyShortId || '', | ||
| 309 | + approvalStatus: this.query.approvalStatus || '', | ||
| 310 | + createBy: this.query.createBy || '', | ||
| 311 | + timeRange: Array.isArray(this.query.timeRange) ? this.query.timeRange.slice(0) : [] | ||
| 312 | + } | ||
| 313 | + const found = this.companyShortOptions.find(it => it.value === this.filterForm.companyShortId) | ||
| 314 | + this.companyShortLabel = found ? found.label : '' | ||
| 315 | + this.filterVisible = true | ||
| 316 | + }, | ||
| 317 | + onFilterReset(payload) { | ||
| 318 | + this.filterForm = payload | ||
| 319 | + this.companyShortLabel = '' | ||
| 320 | + }, | ||
| 321 | + onFilterConfirm(payload) { | ||
| 322 | + this.query = { | ||
| 323 | + code: payload.code || '', | ||
| 324 | + planCode: payload.planCode || '', | ||
| 325 | + supplierName: payload.supplierName || '', | ||
| 326 | + companyShortId: payload.companyShortId || '', | ||
| 327 | + approvalStatus: payload.approvalStatus || '', | ||
| 328 | + createBy: payload.createBy || '', | ||
| 329 | + timeRange: Array.isArray(payload.timeRange) ? payload.timeRange : [] | ||
| 330 | + } | ||
| 331 | + }, | ||
| 332 | + fetchList({ pageIndex, pageSize, query, extra }) { | ||
| 333 | + const q = query || {} | ||
| 334 | + const e = extra || {} | ||
| 335 | + const range = Array.isArray(q.timeRange) ? q.timeRange : [] | ||
| 336 | + const keyword = e.keyword || '' | ||
| 337 | + const params = { | ||
| 338 | + pageIndex, | ||
| 339 | + pageSize, | ||
| 340 | + deleted: e.deleted === true, | ||
| 341 | + code: q.code || keyword || '', | ||
| 342 | + planCode: q.planCode || '', | ||
| 343 | + supplierName: q.supplierName || '', | ||
| 344 | + companyShortId: q.companyShortId || '', | ||
| 345 | + approvalStatus: q.approvalStatus || '', | ||
| 346 | + createBy: q.createBy || '', | ||
| 347 | + startTime: range && range.length === 2 ? range[0] : '', | ||
| 348 | + endTime: range && range.length === 2 ? range[1] : '' | ||
| 349 | + } | ||
| 350 | + return weighTicketQueryApi(params) | ||
| 351 | + .then(res => { | ||
| 352 | + const _data = (res && res.data) || {} | ||
| 353 | + let records = _data.datas || _data.list || _data.records || [] | ||
| 354 | + const totalCount = _data.totalCount || _data.count || 0 | ||
| 355 | + const hasNext = _data.hasNext || false | ||
| 356 | + records = records.map(it => ({ ...it })) | ||
| 357 | + return { records, totalCount, hasNext } | ||
| 358 | + }) | ||
| 359 | + .catch(() => { | ||
| 360 | + this.onCardError() | ||
| 361 | + return { records: [], totalCount: 0, hasNext: false } | ||
| 362 | + }) | ||
| 363 | + }, | ||
| 364 | + onCardClick(item) { | ||
| 365 | + const id = item && item.id | ||
| 366 | + if (!id) { | ||
| 367 | + uni.showToast({ title: '缺少ID', icon: 'none' }) | ||
| 368 | + return | ||
| 369 | + } | ||
| 370 | + uni.navigateTo({ url: '/pages/weight-ticket/detail?id=' + id }) | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | +} | ||
| 374 | +</script> | ||
| 375 | + | ||
| 376 | +<style lang="scss" scoped> | ||
| 377 | +.page { | ||
| 378 | + display: flex; | ||
| 379 | + flex-direction: column; | ||
| 380 | + height: 100vh; | ||
| 381 | +} | ||
| 382 | +.ticket-list-fixed { | ||
| 383 | + position: fixed; | ||
| 384 | + top: 96rpx; | ||
| 385 | + left: 0; | ||
| 386 | + right: 0; | ||
| 387 | + z-index: 2; | ||
| 388 | + background: #fff; | ||
| 389 | + .search-row { | ||
| 390 | + display: flex; | ||
| 391 | + align-items: center; | ||
| 392 | + padding: 16rpx 32rpx; | ||
| 393 | + .uni-searchbar { padding: 0; flex: 1; } | ||
| 394 | + .tool-icons { | ||
| 395 | + display: flex; | ||
| 396 | + .tool-icon { width: 48rpx; height: 48rpx; display: block; margin-left: 32rpx; } | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + .tabs { | ||
| 400 | + display: flex; | ||
| 401 | + align-items: center; | ||
| 402 | + justify-content: space-between; | ||
| 403 | + padding: 26rpx 34rpx; | ||
| 404 | + border-bottom: solid 1px #e7e7e7; | ||
| 405 | + .tab { width: 50%; text-align: center; color: rgba(0, 0, 0, 0.9); line-height: 44rpx; position: relative; font-weight: 600; } | ||
| 406 | + .tab.active { color: $theme-primary; } | ||
| 407 | + .tab.active::after { | ||
| 408 | + content: ''; | ||
| 409 | + position: absolute; | ||
| 410 | + left: 50%; | ||
| 411 | + transform: translateX(-50%); | ||
| 412 | + bottom: -13px; | ||
| 413 | + width: 32rpx; | ||
| 414 | + height: 6rpx; | ||
| 415 | + border-radius: 4rpx; | ||
| 416 | + background: $theme-primary; | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | +} | ||
| 420 | +::v-deep .uni-searchbar__box { | ||
| 421 | + height: 80rpx !important; | ||
| 422 | + justify-content: start; | ||
| 423 | + .uni-searchbar__box-search-input { font-size: 32rpx !important; } | ||
| 424 | +} | ||
| 425 | +.list-box { | ||
| 426 | + flex: 1; | ||
| 427 | + padding-top: 236rpx; | ||
| 428 | + .card { position: relative; } | ||
| 429 | + .card-header { | ||
| 430 | + margin-bottom: 28rpx; | ||
| 431 | + position: relative; | ||
| 432 | + .title { font-size: 36rpx; font-weight: 600; line-height: 50rpx; color: rgba(0, 0, 0, 0.9); width: 578rpx; } | ||
| 433 | + .status { | ||
| 434 | + position: absolute; | ||
| 435 | + top: -32rpx; | ||
| 436 | + right: -12rpx; | ||
| 437 | + height: 48rpx; | ||
| 438 | + line-height: 48rpx; | ||
| 439 | + font-weight: 600; | ||
| 440 | + color: #fff; | ||
| 441 | + font-size: 24rpx; | ||
| 442 | + padding: 0 14rpx; | ||
| 443 | + border-radius: 6rpx; | ||
| 444 | + box-sizing: content-box; | ||
| 445 | + | ||
| 446 | + &.status_AUDIT { background: $theme-primary; } | ||
| 447 | + &.status_PASS { background: #2ba471; } | ||
| 448 | + &.status_REFUSE { background: #d54941; } | ||
| 449 | + &.status_DRAFT { background: #e7e7e7; color: rgba(0, 0, 0, 0.9); } | ||
| 450 | + &.status_CANCEL { background: #e7e7e7; color: rgba(0, 0, 0, 0.9); } | ||
| 451 | + } | ||
| 452 | + } | ||
| 453 | + .info-row { | ||
| 454 | + display: flex; | ||
| 455 | + align-items: center; | ||
| 456 | + color: rgba(0, 0, 0, 0.6); | ||
| 457 | + font-size: 28rpx; | ||
| 458 | + margin-bottom: 24rpx; | ||
| 459 | + height: 32rpx; | ||
| 460 | + &:last-child { margin-bottom: 0; } | ||
| 461 | + text { | ||
| 462 | + width: 50%; | ||
| 463 | + &:last-child { | ||
| 464 | + color: rgba(0, 0, 0, 0.9); | ||
| 465 | + width: 50%; | ||
| 466 | + overflow: hidden; | ||
| 467 | + text-overflow: ellipsis; | ||
| 468 | + white-space: nowrap; | ||
| 469 | + } | ||
| 470 | + } | ||
| 471 | + } | ||
| 472 | +} | ||
| 473 | +.filter-form { | ||
| 474 | + .form-item { margin-bottom: 24rpx; } | ||
| 475 | + .label { margin-bottom: 20rpx; color: rgba(0, 0, 0, 0.9); height: 44rpx; line-height: 44rpx; font-size: 30rpx; } | ||
| 476 | + .input { | ||
| 477 | + width: 100%; | ||
| 478 | + height: 72rpx; | ||
| 479 | + line-height: 72rpx; | ||
| 480 | + padding: 0 24rpx; | ||
| 481 | + border: 1rpx solid #e7e7e7; | ||
| 482 | + border-radius: 8rpx; | ||
| 483 | + font-size: 28rpx; | ||
| 484 | + color: rgba(0, 0, 0, 0.9); | ||
| 485 | + background: #fff; | ||
| 486 | + box-sizing: border-box; | ||
| 487 | + } | ||
| 488 | + .fake-select { | ||
| 489 | + height: 72rpx; | ||
| 490 | + line-height: 72rpx; | ||
| 491 | + padding: 0 24rpx; | ||
| 492 | + border: 1rpx solid #e7e7e7; | ||
| 493 | + border-radius: 8rpx; | ||
| 494 | + font-size: 28rpx; | ||
| 495 | + .placeholder { color: #999; } | ||
| 496 | + .value { color: rgba(0, 0, 0, 0.9); } | ||
| 497 | + } | ||
| 498 | +} | ||
| 499 | +</style> |
pages/weight-ticket/modify.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <uni-list> | ||
| 5 | + <!-- 编号(只读) --> | ||
| 6 | + <uni-list-item class="select-item" :class="form.code ? 'is-filled' : 'is-empty'"> | ||
| 7 | + <template v-slot:body> | ||
| 8 | + <view class="item-title"><text class="required">*</text><text>编号</text></view> | ||
| 9 | + </template> | ||
| 10 | + <template v-slot:footer> | ||
| 11 | + <text class="readonly-text value-code">{{ form.code || '-' }}</text> | ||
| 12 | + </template> | ||
| 13 | + </uni-list-item> | ||
| 14 | + | ||
| 15 | + <!-- 类型 --> | ||
| 16 | + <uni-list-item class="select-item" :class="form.type ? 'is-filled' : 'is-empty'"> | ||
| 17 | + <template v-slot:body> | ||
| 18 | + <view class="item-title"><text class="required">*</text><text>类型</text></view> | ||
| 19 | + </template> | ||
| 20 | + <template v-slot:footer> | ||
| 21 | + <picker mode="selector" :range="typeLabels" @change="onTypeChange"> | ||
| 22 | + <view class="picker-value" :class="{ placeholder: !form.type }"> | ||
| 23 | + {{ getTypeLabel() || '请选择类型' }} | ||
| 24 | + </view> | ||
| 25 | + </picker> | ||
| 26 | + </template> | ||
| 27 | + </uni-list-item> | ||
| 28 | + | ||
| 29 | + <!-- 计划编号(弹窗多选计划) --> | ||
| 30 | + <uni-list-item class="select-item" :class="form.planCode ? 'is-filled' : 'is-empty'" clickable | ||
| 31 | + @click="openPlanSheet" :rightText="form.planCode || '请选择计划'" showArrow> | ||
| 32 | + <template v-slot:body> | ||
| 33 | + <view class="item-title"><text class="required">*</text><text>计划编号</text></view> | ||
| 34 | + </template> | ||
| 35 | + </uni-list-item> | ||
| 36 | + | ||
| 37 | + <!-- 单位(禁用) --> | ||
| 38 | + <uni-list-item title="单位"> | ||
| 39 | + <template v-slot:footer> | ||
| 40 | + <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> | ||
| 41 | + </template> | ||
| 42 | + </uni-list-item> | ||
| 43 | + | ||
| 44 | + <!-- 供料单位(带出,禁用) --> | ||
| 45 | + <uni-list-item title="供料单位"> | ||
| 46 | + <template v-slot:footer> | ||
| 47 | + <uni-easyinput v-model="form.supplierName" :inputBorder="false" disabled placeholder="选择计划后自动带出" /> | ||
| 48 | + </template> | ||
| 49 | + </uni-list-item> | ||
| 50 | + | ||
| 51 | + <!-- 收料单位(带出,禁用) --> | ||
| 52 | + <uni-list-item title="收料单位"> | ||
| 53 | + <template v-slot:footer> | ||
| 54 | + <uni-easyinput v-model="form.companyShortName" :inputBorder="false" disabled placeholder="选择计划后自动带出" /> | ||
| 55 | + </template> | ||
| 56 | + </uni-list-item> | ||
| 57 | + </uni-list> | ||
| 58 | + | ||
| 59 | + <!-- 计划单明细(只读) --> | ||
| 60 | + <view class="sub-table"> | ||
| 61 | + <view class="header"> | ||
| 62 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 63 | + <text class="title">计划单明细</text> | ||
| 64 | + </view> | ||
| 65 | + <view class="add-list"> | ||
| 66 | + <view v-if="!planList.length" class="empty-tip">选择计划后自动带出</view> | ||
| 67 | + <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="block"> | ||
| 68 | + <uni-list> | ||
| 69 | + <uni-list-item title="计划品种"> | ||
| 70 | + <template v-slot:footer> | ||
| 71 | + <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> | ||
| 72 | + </template> | ||
| 73 | + </uni-list-item> | ||
| 74 | + <uni-list-item title="计划数量"> | ||
| 75 | + <template v-slot:footer> | ||
| 76 | + <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> | ||
| 77 | + </template> | ||
| 78 | + </uni-list-item> | ||
| 79 | + <uni-list-item title="计划编号"> | ||
| 80 | + <template v-slot:footer> | ||
| 81 | + <uni-easyinput :value="item.planCode" :inputBorder="false" disabled /> | ||
| 82 | + </template> | ||
| 83 | + </uni-list-item> | ||
| 84 | + </uni-list> | ||
| 85 | + </view> | ||
| 86 | + </view> | ||
| 87 | + </view> | ||
| 88 | + | ||
| 89 | + <!-- 过磅明细(可编辑) --> | ||
| 90 | + <view class="sub-table"> | ||
| 91 | + <view class="header"> | ||
| 92 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 93 | + <text class="title">过磅明细</text> | ||
| 94 | + <view class="ops"> | ||
| 95 | + <image class="opAdd" @click="addWeightRow" src="/static/images/plus.png" /> | ||
| 96 | + </view> | ||
| 97 | + </view> | ||
| 98 | + <view class="add-list"> | ||
| 99 | + <view v-if="!weighList.length" class="empty-tip">暂无明细,请添加</view> | ||
| 100 | + <view v-for="(item, idx) in weighList" :key="'w-' + (item.id || idx)" class="block"> | ||
| 101 | + <uni-list> | ||
| 102 | + <uni-list-item class="select-item" :class="item.planCode ? 'is-filled' : 'is-empty'"> | ||
| 103 | + <template v-slot:body> | ||
| 104 | + <view class="item-title"><text class="required">*</text><text>计划编号</text></view> | ||
| 105 | + </template> | ||
| 106 | + <template v-slot:footer> | ||
| 107 | + <picker mode="selector" :range="planCodeLabels" | ||
| 108 | + @change="(e) => handleWeighPlanChange(idx, Number(e.detail.value))"> | ||
| 109 | + <view class="picker-value" :class="{ placeholder: !item.planCode }"> | ||
| 110 | + {{ item.planCode || '请选择计划编号' }} | ||
| 111 | + </view> | ||
| 112 | + </picker> | ||
| 113 | + </template> | ||
| 114 | + </uni-list-item> | ||
| 115 | + <uni-list-item class="select-item" :class="item.productId ? 'is-filled' : 'is-empty'"> | ||
| 116 | + <template v-slot:body> | ||
| 117 | + <view class="item-title"><text class="required">*</text><text>过磅品种</text></view> | ||
| 118 | + </template> | ||
| 119 | + <template v-slot:footer> | ||
| 120 | + <picker mode="selector" :range="getWeightProductLabels(item)" | ||
| 121 | + @change="(e) => handleWeightProductChange(idx, Number(e.detail.value))"> | ||
| 122 | + <view class="picker-value" :class="{ placeholder: !item.productId }"> | ||
| 123 | + {{ getWeightProductLabel(item) || '请选择过磅品种' }} | ||
| 124 | + </view> | ||
| 125 | + </picker> | ||
| 126 | + </template> | ||
| 127 | + </uni-list-item> | ||
| 128 | + <uni-list-item title="开票品名"> | ||
| 129 | + <template v-slot:footer> | ||
| 130 | + <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled /> | ||
| 131 | + </template> | ||
| 132 | + </uni-list-item> | ||
| 133 | + <uni-list-item title="过磅数量"> | ||
| 134 | + <template v-slot:body> | ||
| 135 | + <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> | ||
| 136 | + </template> | ||
| 137 | + <template v-slot:footer> | ||
| 138 | + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> | ||
| 139 | + </template> | ||
| 140 | + </uni-list-item> | ||
| 141 | + </uni-list> | ||
| 142 | + <view class="block-ops"> | ||
| 143 | + <div class="del" @click="removeRow('weigh', idx)"> | ||
| 144 | + <image src="/static/images/delete.png" class="icon" />删除 | ||
| 145 | + </div> | ||
| 146 | + </view> | ||
| 147 | + </view> | ||
| 148 | + </view> | ||
| 149 | + </view> | ||
| 150 | + | ||
| 151 | + <!-- 申请数量明细(仅买断展示) --> | ||
| 152 | + <view v-if="isBuyout" class="sub-table"> | ||
| 153 | + <view class="header"> | ||
| 154 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 155 | + <text class="title">申请数量明细</text> | ||
| 156 | + <view class="ops"> | ||
| 157 | + <image class="opAdd" @click="addApplyRow" src="/static/images/plus.png" /> | ||
| 158 | + </view> | ||
| 159 | + </view> | ||
| 160 | + <view class="add-list"> | ||
| 161 | + <view v-if="!applyList.length" class="empty-tip">暂无明细,请添加</view> | ||
| 162 | + <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="block"> | ||
| 163 | + <uni-list> | ||
| 164 | + <uni-list-item class="select-item" :class="item.breedRelationshipId ? 'is-filled' : 'is-empty'"> | ||
| 165 | + <template v-slot:body> | ||
| 166 | + <view class="item-title"><text class="required">*</text><text>类别</text></view> | ||
| 167 | + </template> | ||
| 168 | + <template v-slot:footer> | ||
| 169 | + <picker mode="selector" :range="varietyLabels" | ||
| 170 | + @change="(e) => handleVarietyChange(idx, Number(e.detail.value))"> | ||
| 171 | + <view class="picker-value" :class="{ placeholder: !item.breedRelationshipId }"> | ||
| 172 | + {{ getVarietyLabel(item) || '请选择类别' }} | ||
| 173 | + </view> | ||
| 174 | + </picker> | ||
| 175 | + </template> | ||
| 176 | + </uni-list-item> | ||
| 177 | + <uni-list-item title="数量"> | ||
| 178 | + <template v-slot:body> | ||
| 179 | + <view class="item-title"><text class="required">*</text><text>数量</text></view> | ||
| 180 | + </template> | ||
| 181 | + <template v-slot:footer> | ||
| 182 | + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" /> | ||
| 183 | + </template> | ||
| 184 | + </uni-list-item> | ||
| 185 | + </uni-list> | ||
| 186 | + <view class="block-ops"> | ||
| 187 | + <div class="del" @click="removeRow('apply', idx)"> | ||
| 188 | + <image src="/static/images/delete.png" class="icon" />删除 | ||
| 189 | + </div> | ||
| 190 | + </view> | ||
| 191 | + </view> | ||
| 192 | + </view> | ||
| 193 | + </view> | ||
| 194 | + | ||
| 195 | + <!-- 其他信息 --> | ||
| 196 | + <view class="remark-section"> | ||
| 197 | + <view class="header"> | ||
| 198 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 199 | + <text class="title">其他信息</text> | ||
| 200 | + </view> | ||
| 201 | + <view class="section-content"> | ||
| 202 | + <uni-list> | ||
| 203 | + <uni-list-item title="物料名称"> | ||
| 204 | + <template v-slot:footer> | ||
| 205 | + <uni-easyinput :value="materialName" :inputBorder="false" disabled /> | ||
| 206 | + </template> | ||
| 207 | + </uni-list-item> | ||
| 208 | + <uni-list-item> | ||
| 209 | + <template v-slot:body> | ||
| 210 | + <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> | ||
| 211 | + </template> | ||
| 212 | + <template v-slot:footer> | ||
| 213 | + <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> | ||
| 214 | + </template> | ||
| 215 | + </uni-list-item> | ||
| 216 | + <uni-list-item> | ||
| 217 | + <template v-slot:body> | ||
| 218 | + <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> | ||
| 219 | + </template> | ||
| 220 | + <template v-slot:footer> | ||
| 221 | + <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> | ||
| 222 | + </template> | ||
| 223 | + </uni-list-item> | ||
| 224 | + <uni-list-item title="货物净重"> | ||
| 225 | + <template v-slot:footer> | ||
| 226 | + <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> | ||
| 227 | + </template> | ||
| 228 | + </uni-list-item> | ||
| 229 | + <uni-list-item title="净重大写"> | ||
| 230 | + <template v-slot:footer> | ||
| 231 | + <uni-easyinput :value="computedNetWeightUpper" :inputBorder="false" disabled /> | ||
| 232 | + </template> | ||
| 233 | + </uni-list-item> | ||
| 234 | + </uni-list> | ||
| 235 | + | ||
| 236 | + <view class="form-group"> | ||
| 237 | + <view class="item-title"><text class="required">*</text><text>来料扣杂类型</text></view> | ||
| 238 | + <uni-data-checkbox | ||
| 239 | + mode="tag" | ||
| 240 | + :multiple="true" | ||
| 241 | + :value-field="'value'" | ||
| 242 | + :text-field="'text'" | ||
| 243 | + v-model="form.deductionTypes" | ||
| 244 | + :localdata="deductionTypeOptions" | ||
| 245 | + /> | ||
| 246 | + </view> | ||
| 247 | + | ||
| 248 | + <uni-list> | ||
| 249 | + <uni-list-item> | ||
| 250 | + <template v-slot:body> | ||
| 251 | + <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> | ||
| 252 | + </template> | ||
| 253 | + <template v-slot:footer> | ||
| 254 | + <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> | ||
| 255 | + </template> | ||
| 256 | + </uni-list-item> | ||
| 257 | + <uni-list-item> | ||
| 258 | + <template v-slot:body> | ||
| 259 | + <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> | ||
| 260 | + </template> | ||
| 261 | + <template v-slot:footer> | ||
| 262 | + <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> | ||
| 263 | + </template> | ||
| 264 | + </uni-list-item> | ||
| 265 | + <uni-list-item> | ||
| 266 | + <template v-slot:body> | ||
| 267 | + <view class="item-title"><text class="required">*</text><text>车牌号</text></view> | ||
| 268 | + </template> | ||
| 269 | + <template v-slot:footer> | ||
| 270 | + <uni-easyinput v-model="form.plateNumber" :inputBorder="false" placeholder="请输入车牌号" /> | ||
| 271 | + </template> | ||
| 272 | + </uni-list-item> | ||
| 273 | + </uni-list> | ||
| 274 | + </view> | ||
| 275 | + </view> | ||
| 276 | + | ||
| 277 | + <!-- 备注模块 --> | ||
| 278 | + <view class="remark-section"> | ||
| 279 | + <view class="header"> | ||
| 280 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 281 | + <text class="title">备注</text> | ||
| 282 | + </view> | ||
| 283 | + <view class="section-content"> | ||
| 284 | + <view class="remark-group"> | ||
| 285 | + <view class="remark-label">业务摘要</view> | ||
| 286 | + <uni-easyinput :value="computedBusinessSummary" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 287 | + </view> | ||
| 288 | + <view class="remark-group"> | ||
| 289 | + <view class="remark-label">特别说明</view> | ||
| 290 | + <uni-easyinput v-model="form.specialNote" type="textarea" :inputBorder="false" placeholder="请输入特别说明" maxlength="2000" /> | ||
| 291 | + </view> | ||
| 292 | + <view class="remark-group"> | ||
| 293 | + <view class="remark-label">单据备注</view> | ||
| 294 | + <uni-easyinput :value="computedDocumentRemark" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 295 | + </view> | ||
| 296 | + </view> | ||
| 297 | + </view> | ||
| 298 | + | ||
| 299 | + <view class="footer"> | ||
| 300 | + <button class="btn submit" type="primary" @click="onSubmit">保存</button> | ||
| 301 | + </view> | ||
| 302 | + </scroll-view> | ||
| 303 | + | ||
| 304 | + <RelateSelectSheet :visible.sync="planSheet.visible" title="选择计划" :multiple="true" | ||
| 305 | + :fetchFn="planSheet.fetchFn" :display-fields="planSheet.displayFields" | ||
| 306 | + row-key="id" :selectedKeys.sync="planSheet.selectedKeys" @confirm="onPlanConfirm" /> | ||
| 307 | + </view> | ||
| 308 | +</template> | ||
| 309 | + | ||
| 310 | +<script> | ||
| 311 | +import RelateSelectSheet from '@/components/relate-select/index.vue' | ||
| 312 | +import { | ||
| 313 | + weighingTicketPlansApi, | ||
| 314 | + weighTicketPlanLinesApi, | ||
| 315 | + weighTicketDetailApi, | ||
| 316 | + weighTicketUpdateApi | ||
| 317 | +} from '@/api/procure-manage/weighTicket.js' | ||
| 318 | +import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js' | ||
| 319 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 320 | + | ||
| 321 | +export default { | ||
| 322 | + name: 'ModifyWeightTicket', | ||
| 323 | + components: { RelateSelectSheet }, | ||
| 324 | + data() { | ||
| 325 | + return { | ||
| 326 | + id: '', | ||
| 327 | + form: { | ||
| 328 | + code: '', | ||
| 329 | + type: '', | ||
| 330 | + planCode: '', | ||
| 331 | + unit: '公斤', | ||
| 332 | + supplierName: '', | ||
| 333 | + companyShortName: '', | ||
| 334 | + totalGrossWeight: '', | ||
| 335 | + actualImpurityWeight: '', | ||
| 336 | + deductionTypes: [], | ||
| 337 | + supplierStockMaterial: '', | ||
| 338 | + logisticsStockMaterial: '', | ||
| 339 | + plateNumber: '', | ||
| 340 | + specialNote: '' | ||
| 341 | + }, | ||
| 342 | + dicOptions: { TYPE: [], DEDUCTION_TYPE: [] }, | ||
| 343 | + // 选中计划行(多选) | ||
| 344 | + selectedPlanRows: [], | ||
| 345 | + // 计划单明细(只读) | ||
| 346 | + planList: [], | ||
| 347 | + // 过磅明细(可编辑) | ||
| 348 | + weighList: [], | ||
| 349 | + // 申请数量明细(买断时) | ||
| 350 | + applyList: [], | ||
| 351 | + varietyOptions: [], | ||
| 352 | + planSheet: { | ||
| 353 | + visible: false, | ||
| 354 | + fetchFn: null, | ||
| 355 | + displayFields: [ | ||
| 356 | + { label: '计划编号', field: 'code' }, | ||
| 357 | + { label: '是否买断', field: 'buyout', format: v => (v ? '是' : '否') }, | ||
| 358 | + { label: '收料单位', field: 'companyName' }, | ||
| 359 | + { label: '供料单位', field: 'supplierName' }, | ||
| 360 | + { label: '总数量', field: 'totalQuantity' }, | ||
| 361 | + { label: '创建人', field: 'createBy' } | ||
| 362 | + ], | ||
| 363 | + selectedKeys: [] | ||
| 364 | + } | ||
| 365 | + } | ||
| 366 | + }, | ||
| 367 | + computed: { | ||
| 368 | + typeLabels() { | ||
| 369 | + return (this.dicOptions.TYPE || []).map(it => it.name) | ||
| 370 | + }, | ||
| 371 | + deductionTypeOptions() { | ||
| 372 | + return (this.dicOptions.DEDUCTION_TYPE || []).map(it => ({ | ||
| 373 | + value: it.code != null ? String(it.code) : '', | ||
| 374 | + text: it.name || '' | ||
| 375 | + })).filter(it => it.value) | ||
| 376 | + }, | ||
| 377 | + isBuyout() { | ||
| 378 | + const first = (this.selectedPlanRows || [])[0] | ||
| 379 | + return !!(first && first.buyout) | ||
| 380 | + }, | ||
| 381 | + // 过磅明细-计划编号下拉选项(范围=基础信息已选计划) | ||
| 382 | + planCodeOptions() { | ||
| 383 | + const seen = new Set() | ||
| 384 | + const opts = [] | ||
| 385 | + ;(this.selectedPlanRows || []).forEach(it => { | ||
| 386 | + const code = it.code || '' | ||
| 387 | + if (!code || seen.has(code)) return | ||
| 388 | + seen.add(code) | ||
| 389 | + opts.push({ code: code, planId: it.id }) | ||
| 390 | + }) | ||
| 391 | + return opts | ||
| 392 | + }, | ||
| 393 | + planCodeLabels() { | ||
| 394 | + return this.planCodeOptions.map(o => o.code) | ||
| 395 | + }, | ||
| 396 | + varietyLabels() { | ||
| 397 | + return (this.varietyOptions || []).map(item => | ||
| 398 | + [item.productName, item.code].filter(Boolean).join(' ') | ||
| 399 | + ) | ||
| 400 | + }, | ||
| 401 | + // 物料名称:过磅明细开票品名去重顿号拼接 | ||
| 402 | + materialName() { | ||
| 403 | + const names = (this.weighList || []) | ||
| 404 | + .map(item => item.invoiceProductName) | ||
| 405 | + .filter(name => !!name) | ||
| 406 | + return Array.from(new Set(names)).join('、') | ||
| 407 | + }, | ||
| 408 | + // 货物净重 = 过磅总重 - 实际伙重(保留两位) | ||
| 409 | + computedNetWeight() { | ||
| 410 | + const gross = this.form.totalGrossWeight | ||
| 411 | + if (gross === undefined || gross === null || gross === '') return '' | ||
| 412 | + const num = Number(gross) - Number(this.form.actualImpurityWeight || 0) | ||
| 413 | + return String(Math.round(num * 100) / 100) | ||
| 414 | + }, | ||
| 415 | + // 净重大写:中文大写 | ||
| 416 | + computedNetWeightUpper() { | ||
| 417 | + const net = this.computedNetWeight | ||
| 418 | + if (net === '' || net === null || net === undefined) return '' | ||
| 419 | + return numberToChineseUpper(net) | ||
| 420 | + }, | ||
| 421 | + // 业务摘要 | ||
| 422 | + computedBusinessSummary() { | ||
| 423 | + const parts = [] | ||
| 424 | + const weightItems = (this.weighList || []) | ||
| 425 | + .map(item => { | ||
| 426 | + const name = item.productName || '' | ||
| 427 | + const qty = item.quantity === null || item.quantity === undefined ? '' : item.quantity | ||
| 428 | + if (!name && qty === '') return '' | ||
| 429 | + return `${name}${qty}公斤` | ||
| 430 | + }) | ||
| 431 | + .filter(text => !!text) | ||
| 432 | + if (weightItems.length) parts.push(weightItems.join('、')) | ||
| 433 | + const deductionNames = (this.form.deductionTypes || []) | ||
| 434 | + .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)) | ||
| 435 | + .filter(name => !!name) | ||
| 436 | + if (deductionNames.length) parts.push(deductionNames.join('、')) | ||
| 437 | + if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) | ||
| 438 | + if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) | ||
| 439 | + if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) | ||
| 440 | + return parts.join(',') | ||
| 441 | + }, | ||
| 442 | + // 单据备注 = 业务摘要 + 特别说明 | ||
| 443 | + computedDocumentRemark() { | ||
| 444 | + const summary = this.computedBusinessSummary || '' | ||
| 445 | + const note = this.form.specialNote || '' | ||
| 446 | + return [summary, note].filter(text => !!text).join('\n') | ||
| 447 | + } | ||
| 448 | + }, | ||
| 449 | + onLoad(query) { | ||
| 450 | + this.id = (query && query.id) || '' | ||
| 451 | + }, | ||
| 452 | + created() { | ||
| 453 | + this.planSheet.fetchFn = this.fetchPlans.bind(this) | ||
| 454 | + this.loadDicData() | ||
| 455 | + this.loadVarietyOptions() | ||
| 456 | + this.loadDetail() | ||
| 457 | + }, | ||
| 458 | + methods: { | ||
| 459 | + async loadDicData() { | ||
| 460 | + try { | ||
| 461 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | ||
| 462 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 463 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 464 | + } catch (e) { | ||
| 465 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 466 | + } | ||
| 467 | + }, | ||
| 468 | + async loadVarietyOptions() { | ||
| 469 | + try { | ||
| 470 | + const res = await breedRelationshipQueryApi({ pageIndex: 1, pageSize: 9999 }) | ||
| 471 | + const _data = (res && res.data) || {} | ||
| 472 | + this.varietyOptions = _data.datas || _data.list || _data.records || [] | ||
| 473 | + } catch (e) { | ||
| 474 | + this.varietyOptions = [] | ||
| 475 | + } | ||
| 476 | + }, | ||
| 477 | + loadDetail() { | ||
| 478 | + if (!this.id) { | ||
| 479 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | ||
| 480 | + return | ||
| 481 | + } | ||
| 482 | + uni.showLoading({ title: '加载中...', mask: true }) | ||
| 483 | + weighTicketDetailApi({ id: this.id }) | ||
| 484 | + .then(res => { | ||
| 485 | + const data = res && res.data ? (res.data.data || res.data) : {} | ||
| 486 | + const buyout = !!data.buyout | ||
| 487 | + // 计划编号:详情接口可能返回数组(如 ["260900006","260900006_03"]),统一转逗号拼接字符串 | ||
| 488 | + const planCodeRaw = data.planCode || data.planCodes || '' | ||
| 489 | + const planCodeText = Array.isArray(planCodeRaw) ? planCodeRaw.filter(Boolean).join(',') : String(planCodeRaw || '') | ||
| 490 | + this.form = { | ||
| 491 | + code: data.code || '', | ||
| 492 | + type: data.type != null ? String(data.type) : '', | ||
| 493 | + planCode: planCodeText, | ||
| 494 | + unit: data.unit || '', | ||
| 495 | + supplierName: data.supplierName || '', | ||
| 496 | + companyShortName: data.companyShortName || '', | ||
| 497 | + totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), | ||
| 498 | + actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), | ||
| 499 | + deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], | ||
| 500 | + supplierStockMaterial: data.supplierStockMaterial || '', | ||
| 501 | + logisticsStockMaterial: data.logisticsStockMaterial || '', | ||
| 502 | + plateNumber: data.plateNumber || '', | ||
| 503 | + specialNote: data.specialNote || '' | ||
| 504 | + } | ||
| 505 | + // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id) | ||
| 506 | + this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) | ||
| 507 | + this.selectedPlanRows = this.planList.map(item => ({ | ||
| 508 | + id: item.procurementPlanId || item.id, | ||
| 509 | + code: item.planCode || '', | ||
| 510 | + buyout: buyout, | ||
| 511 | + supplierName: data.supplierName || '', | ||
| 512 | + companyName: data.companyShortName || '', | ||
| 513 | + workshopName: '' | ||
| 514 | + })) | ||
| 515 | + this.weighList = (Array.isArray(data.weighLines) ? data.weighLines : []).map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 516 | + this.applyList = (Array.isArray(data.applyLines) ? data.applyLines : []).map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 517 | + }) | ||
| 518 | + .catch(() => { | ||
| 519 | + uni.showToast({ title: '加载详情失败', icon: 'none' }) | ||
| 520 | + }) | ||
| 521 | + .finally(() => { | ||
| 522 | + uni.hideLoading() | ||
| 523 | + }) | ||
| 524 | + }, | ||
| 525 | + getTypeLabel() { | ||
| 526 | + const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type)) | ||
| 527 | + return found ? found.name : '' | ||
| 528 | + }, | ||
| 529 | + onTypeChange(e) { | ||
| 530 | + const idx = Number(e.detail.value) | ||
| 531 | + const opt = (this.dicOptions.TYPE || [])[idx] | ||
| 532 | + this.form.type = opt && opt.code != null ? String(opt.code) : '' | ||
| 533 | + }, | ||
| 534 | + // 计划选择弹窗数据源 | ||
| 535 | + fetchPlans({ pageIndex, pageSize, extra }) { | ||
| 536 | + const keyword = (extra && extra.keyword) || '' | ||
| 537 | + const params = { | ||
| 538 | + pageIndex, | ||
| 539 | + pageSize, | ||
| 540 | + code: keyword || undefined | ||
| 541 | + } | ||
| 542 | + return weighingTicketPlansApi(params).then(res => { | ||
| 543 | + const _data = (res && res.data) || {} | ||
| 544 | + const records = _data.datas || _data.list || _data.records || [] | ||
| 545 | + const totalCount = _data.totalCount || _data.count || 0 | ||
| 546 | + const hasNext = _data.hasNext || false | ||
| 547 | + return { records, totalCount, hasNext } | ||
| 548 | + }).catch(() => ({ records: [], totalCount: 0, hasNext: false })) | ||
| 549 | + }, | ||
| 550 | + openPlanSheet() { | ||
| 551 | + this.planSheet.selectedKeys = this.selectedPlanRows.map(it => it.id) | ||
| 552 | + this.planSheet.visible = true | ||
| 553 | + }, | ||
| 554 | + onPlanConfirm({ items }) { | ||
| 555 | + const list = items || [] | ||
| 556 | + if (!list.length) { | ||
| 557 | + this.selectedPlanRows = [] | ||
| 558 | + this.form.planCode = '' | ||
| 559 | + this.form.supplierName = '' | ||
| 560 | + this.form.companyShortName = '' | ||
| 561 | + this.planList = [] | ||
| 562 | + this.weighList = [] | ||
| 563 | + return | ||
| 564 | + } | ||
| 565 | + // 校验:所选计划的「是否买断、供料单位、收料单位、车间」必须一致 | ||
| 566 | + const first = list[0] | ||
| 567 | + const isSame = list.every(item => | ||
| 568 | + item.buyout === first.buyout && | ||
| 569 | + item.supplierName === first.supplierName && | ||
| 570 | + item.companyName === first.companyName && | ||
| 571 | + item.workshopName === first.workshopName | ||
| 572 | + ) | ||
| 573 | + if (!isSame) { | ||
| 574 | + uni.showToast({ title: '是否买断,供料单位,收料单位应保持一致', icon: 'none' }) | ||
| 575 | + this.planSheet.selectedKeys = this.selectedPlanRows.map(it => it.id) | ||
| 576 | + return | ||
| 577 | + } | ||
| 578 | + this.selectedPlanRows = list.map(it => ({ ...it })) | ||
| 579 | + this.form.planCode = list.map(it => it.code).filter(Boolean).join(',') | ||
| 580 | + this.form.supplierName = first.supplierName || '' | ||
| 581 | + this.form.companyShortName = (first.companyName || '') + (first.workshopName || '') | ||
| 582 | + // 查询计划明细行,填充计划单明细;过磅明细初始化为计划明细拷贝 | ||
| 583 | + weighTicketPlanLinesApi(list.map(it => it.id)).then(res => { | ||
| 584 | + const lines = (res && res.data) || [] | ||
| 585 | + this.planList = lines.map(it => ({ ...it })) | ||
| 586 | + this.weighList = lines.map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 587 | + }).catch(() => { | ||
| 588 | + this.planList = [] | ||
| 589 | + this.weighList = [] | ||
| 590 | + }) | ||
| 591 | + }, | ||
| 592 | + // 过磅明细-计划编号变更:更新行计划编号/计划id,并清空品种选择 | ||
| 593 | + handleWeighPlanChange(idx, optIdx) { | ||
| 594 | + const opt = (this.planCodeOptions || [])[optIdx] | ||
| 595 | + if (!opt) return | ||
| 596 | + const row = this.weighList[idx] | ||
| 597 | + row.planCode = opt.code | ||
| 598 | + row.procurementPlanId = opt.planId || '' | ||
| 599 | + row.productId = '' | ||
| 600 | + row.productName = '' | ||
| 601 | + row.invoiceProductName = '' | ||
| 602 | + }, | ||
| 603 | + // 当前计划编号下的品种选项 | ||
| 604 | + getWeightProductLabels(item) { | ||
| 605 | + return (this.planList || []) | ||
| 606 | + .filter(it => it.planCode === item.planCode) | ||
| 607 | + .map(it => it.productName || '') | ||
| 608 | + }, | ||
| 609 | + getWeightProductLabel(item) { | ||
| 610 | + if (!item.productId) return '' | ||
| 611 | + const found = (this.planList || []).find(it => it.productId === item.productId && it.planCode === item.planCode) | ||
| 612 | + return found ? (found.productName || '') : '' | ||
| 613 | + }, | ||
| 614 | + // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号) | ||
| 615 | + handleWeightProductChange(idx, optIdx) { | ||
| 616 | + const row = this.weighList[idx] | ||
| 617 | + const options = (this.planList || []).filter(it => it.planCode === row.planCode) | ||
| 618 | + const raw = options[optIdx] | ||
| 619 | + if (!raw) return | ||
| 620 | + this.weighList.splice(idx, 1, { | ||
| 621 | + ...raw, | ||
| 622 | + id: row.id, | ||
| 623 | + planCode: row.planCode || raw.planCode || '', | ||
| 624 | + procurementPlanId: row.procurementPlanId || raw.procurementPlanId || '' | ||
| 625 | + }) | ||
| 626 | + }, | ||
| 627 | + getVarietyLabel(item) { | ||
| 628 | + if (!item.breedRelationshipId) return '' | ||
| 629 | + const found = (this.varietyOptions || []).find(it => it.id === item.breedRelationshipId) | ||
| 630 | + return found ? [found.productName, found.code].filter(Boolean).join(' ') : '' | ||
| 631 | + }, | ||
| 632 | + handleVarietyChange(idx, optIdx) { | ||
| 633 | + const raw = (this.varietyOptions || [])[optIdx] | ||
| 634 | + if (!raw) return | ||
| 635 | + const row = this.applyList[idx] | ||
| 636 | + row.category = raw.code || '' | ||
| 637 | + row.breedRelationshipId = raw.id || '' | ||
| 638 | + }, | ||
| 639 | + addWeightRow() { | ||
| 640 | + this.weighList.push({ | ||
| 641 | + id: genRowId(), | ||
| 642 | + procurementPlanId: '', | ||
| 643 | + planCode: '', | ||
| 644 | + productId: '', | ||
| 645 | + invoiceProductName: '', | ||
| 646 | + quantity: '' | ||
| 647 | + }) | ||
| 648 | + }, | ||
| 649 | + addApplyRow() { | ||
| 650 | + this.applyList.push({ | ||
| 651 | + id: genRowId(), | ||
| 652 | + category: '', | ||
| 653 | + breedRelationshipId: '', | ||
| 654 | + quantity: '' | ||
| 655 | + }) | ||
| 656 | + }, | ||
| 657 | + removeRow(type, idx) { | ||
| 658 | + if (type === 'weigh') this.weighList.splice(idx, 1) | ||
| 659 | + else if (type === 'apply') this.applyList.splice(idx, 1) | ||
| 660 | + }, | ||
| 661 | + validate() { | ||
| 662 | + const f = this.form | ||
| 663 | + if (!f.code) return this.tip('缺少编号') | ||
| 664 | + if (!f.type) return this.tip('请选择类型') | ||
| 665 | + if (!this.selectedPlanRows.length) return this.tip('请选择计划编号') | ||
| 666 | + if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') | ||
| 667 | + if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') | ||
| 668 | + if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') | ||
| 669 | + if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料') | ||
| 670 | + if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') | ||
| 671 | + if (!f.plateNumber) return this.tip('请输入车牌号') | ||
| 672 | + // 过磅明细:计划编号、品种、数量必填 | ||
| 673 | + const weightList = this.weighList || [] | ||
| 674 | + for (let i = 0; i < weightList.length; i++) { | ||
| 675 | + const row = weightList[i] | ||
| 676 | + if (!row.planCode) return this.tip(`过磅明细第${i + 1}行:请选择计划编号`) | ||
| 677 | + if (!row.productId) return this.tip(`过磅明细第${i + 1}行:请选择过磅品种`) | ||
| 678 | + if (row.quantity === '' || row.quantity == null) return this.tip(`过磅明细第${i + 1}行:请输入过磅数量`) | ||
| 679 | + } | ||
| 680 | + // 申请数量明细:类别、数量必填(买断时) | ||
| 681 | + if (this.isBuyout) { | ||
| 682 | + const applyList = this.applyList || [] | ||
| 683 | + for (let i = 0; i < applyList.length; i++) { | ||
| 684 | + const row = applyList[i] | ||
| 685 | + if (!row.breedRelationshipId) return this.tip(`申请数量明细第${i + 1}行:请选择类别`) | ||
| 686 | + if (row.quantity === '' || row.quantity == null) return this.tip(`申请数量明细第${i + 1}行:请输入数量`) | ||
| 687 | + } | ||
| 688 | + } | ||
| 689 | + return true | ||
| 690 | + }, | ||
| 691 | + tip(msg) { | ||
| 692 | + uni.showToast({ title: msg, icon: 'none' }) | ||
| 693 | + return false | ||
| 694 | + }, | ||
| 695 | + buildSubmitData() { | ||
| 696 | + return { | ||
| 697 | + id: this.id, | ||
| 698 | + code: this.form.code, | ||
| 699 | + type: this.form.type, | ||
| 700 | + planIds: this.selectedPlanRows.map(it => it.id), | ||
| 701 | + weighLines: (this.weighList || []).map(row => ({ | ||
| 702 | + procurementPlanId: row.procurementPlanId || '', | ||
| 703 | + planCode: row.planCode || '', | ||
| 704 | + productId: row.productId || '', | ||
| 705 | + invoiceProductName: row.invoiceProductName || '', | ||
| 706 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 707 | + itemId: row.id | ||
| 708 | + })), | ||
| 709 | + applyLines: (this.applyList || []).map(row => ({ | ||
| 710 | + category: row.category || '', | ||
| 711 | + breedRelationshipId: row.breedRelationshipId || '', | ||
| 712 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 713 | + itemId: row.breedRelationshipId | ||
| 714 | + })), | ||
| 715 | + unit: this.form.unit, | ||
| 716 | + materialName: this.materialName || null, | ||
| 717 | + totalGrossWeight: this.form.totalGrossWeight === '' ? null : Number(this.form.totalGrossWeight), | ||
| 718 | + actualImpurityWeight: this.form.actualImpurityWeight === '' ? null : Number(this.form.actualImpurityWeight), | ||
| 719 | + netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), | ||
| 720 | + netWeightUpper: this.computedNetWeightUpper || null, | ||
| 721 | + deductionTypes: (this.form.deductionTypes || []).join(',') || null, | ||
| 722 | + supplierStockMaterial: this.form.supplierStockMaterial || null, | ||
| 723 | + logisticsStockMaterial: this.form.logisticsStockMaterial || null, | ||
| 724 | + plateNumber: this.form.plateNumber || null, | ||
| 725 | + businessSummary: this.computedBusinessSummary || null, | ||
| 726 | + specialNote: this.form.specialNote || null, | ||
| 727 | + documentRemark: this.computedDocumentRemark || null | ||
| 728 | + } | ||
| 729 | + }, | ||
| 730 | + async onSubmit() { | ||
| 731 | + if (!this.validate()) return | ||
| 732 | + const confirmRes = await new Promise(resolve => { | ||
| 733 | + uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | ||
| 734 | + }) | ||
| 735 | + if (!(confirmRes && confirmRes.confirm)) return | ||
| 736 | + uni.showLoading({ title: '保存中...', mask: true }) | ||
| 737 | + weighTicketUpdateApi(this.buildSubmitData()) | ||
| 738 | + .then(() => { | ||
| 739 | + uni.hideLoading() | ||
| 740 | + uni.showToast({ title: '保存成功', icon: 'none' }) | ||
| 741 | + try { | ||
| 742 | + uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | ||
| 743 | + uni.setStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH', '1') | ||
| 744 | + } catch (e) {} | ||
| 745 | + setTimeout(() => { uni.navigateBack() }, 400) | ||
| 746 | + }) | ||
| 747 | + .catch(e => { | ||
| 748 | + uni.hideLoading() | ||
| 749 | + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' }) | ||
| 750 | + }) | ||
| 751 | + } | ||
| 752 | + } | ||
| 753 | +} | ||
| 754 | + | ||
| 755 | +// 生成前端临时行 id | ||
| 756 | +function genRowId() { | ||
| 757 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | ||
| 758 | +} | ||
| 759 | + | ||
| 760 | +// 数字转中文大写(对齐 PC 端 useWeightTicketForm.ts) | ||
| 761 | +function numberToChineseUpper(num) { | ||
| 762 | + if (num === null || num === undefined || num === '' || isNaN(Number(num))) return '零' | ||
| 763 | + const n = Number(num) | ||
| 764 | + if (!isFinite(n)) return '零' | ||
| 765 | + | ||
| 766 | + const digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] | ||
| 767 | + const smallUnits = ['', '拾', '佰', '仟'] | ||
| 768 | + const bigUnits = ['', '万', '亿', '兆'] | ||
| 769 | + | ||
| 770 | + const negative = n < 0 | ||
| 771 | + const abs = Math.abs(n) | ||
| 772 | + const parts = abs.toString().split('.') | ||
| 773 | + const intStrRaw = parts[0] | ||
| 774 | + const decStrRaw = parts[1] || '' | ||
| 775 | + const s = intStrRaw | ||
| 776 | + const len = s.length | ||
| 777 | + | ||
| 778 | + let intPart = '' | ||
| 779 | + let zeroFlag = false | ||
| 780 | + for (let i = 0; i < len; i++) { | ||
| 781 | + const d = parseInt(s[i], 10) | ||
| 782 | + const pos = len - 1 - i | ||
| 783 | + const unitIdx = pos % 4 | ||
| 784 | + const groupIdx = Math.floor(pos / 4) | ||
| 785 | + if (d !== 0) { | ||
| 786 | + if (zeroFlag) { | ||
| 787 | + intPart += digit[0] | ||
| 788 | + zeroFlag = false | ||
| 789 | + } | ||
| 790 | + intPart += digit[d] + smallUnits[unitIdx] | ||
| 791 | + } else { | ||
| 792 | + zeroFlag = true | ||
| 793 | + } | ||
| 794 | + if (unitIdx === 0) { | ||
| 795 | + const start = Math.max(0, len - (groupIdx + 1) * 4) | ||
| 796 | + const end = len - groupIdx * 4 | ||
| 797 | + const groupDigits = s.slice(start, end) | ||
| 798 | + if (!/^0+$/.test(groupDigits)) { | ||
| 799 | + intPart += bigUnits[groupIdx] || '' | ||
| 800 | + } | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + if (intPart === '') intPart = digit[0] | ||
| 804 | + | ||
| 805 | + let result = intPart | ||
| 806 | + if (decStrRaw) { | ||
| 807 | + const decChars = decStrRaw | ||
| 808 | + .split('') | ||
| 809 | + .map(c => digit[parseInt(c, 10)]) | ||
| 810 | + .join('') | ||
| 811 | + result += '点' + decChars | ||
| 812 | + } | ||
| 813 | + return (negative ? '负' : '') + result | ||
| 814 | +} | ||
| 815 | +</script> | ||
| 816 | + | ||
| 817 | +<style lang="scss" scoped> | ||
| 818 | +.page { | ||
| 819 | + display: flex; | ||
| 820 | + flex-direction: column; | ||
| 821 | + height: 100%; | ||
| 822 | +} | ||
| 823 | + | ||
| 824 | +.scroll { | ||
| 825 | + flex: 1; | ||
| 826 | + padding: 12rpx 0 200rpx !important; | ||
| 827 | +} | ||
| 828 | + | ||
| 829 | +.footer { | ||
| 830 | + z-index: 2; | ||
| 831 | + position: fixed; | ||
| 832 | + left: 0; | ||
| 833 | + right: 0; | ||
| 834 | + bottom: 0; | ||
| 835 | + padding: 32rpx; | ||
| 836 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 837 | + background: #fff; | ||
| 838 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 839 | + | ||
| 840 | + .btn { | ||
| 841 | + height: 80rpx; | ||
| 842 | + line-height: 80rpx; | ||
| 843 | + border-radius: 12rpx; | ||
| 844 | + font-size: 32rpx; | ||
| 845 | + } | ||
| 846 | + | ||
| 847 | + .submit { | ||
| 848 | + background: $theme-primary; | ||
| 849 | + color: #fff; | ||
| 850 | + } | ||
| 851 | +} | ||
| 852 | + | ||
| 853 | +::v-deep .uni-list { | ||
| 854 | + .uni-easyinput { | ||
| 855 | + display: flex; | ||
| 856 | + | ||
| 857 | + .uni-input-input { | ||
| 858 | + color: rgba(0, 0, 0, 0.9); | ||
| 859 | + } | ||
| 860 | + } | ||
| 861 | + | ||
| 862 | + .uni-input-placeholder { | ||
| 863 | + z-index: 1; | ||
| 864 | + } | ||
| 865 | + | ||
| 866 | + .uni-input-input { | ||
| 867 | + background-color: #ffffff; | ||
| 868 | + } | ||
| 869 | + | ||
| 870 | + background: transparent; | ||
| 871 | + | ||
| 872 | + &-item { | ||
| 873 | + &__extra-text { | ||
| 874 | + font-size: 32rpx; | ||
| 875 | + } | ||
| 876 | + | ||
| 877 | + &__content-title { | ||
| 878 | + font-size: 32rpx; | ||
| 879 | + color: rgba(0, 0, 0, 0.9); | ||
| 880 | + } | ||
| 881 | + | ||
| 882 | + &__container { | ||
| 883 | + padding: 32rpx; | ||
| 884 | + | ||
| 885 | + .uni-easyinput { | ||
| 886 | + &__placeholder-class { | ||
| 887 | + font-size: 32rpx; | ||
| 888 | + color: rgba(0, 0, 0, 0.4); | ||
| 889 | + } | ||
| 890 | + | ||
| 891 | + &__content { | ||
| 892 | + border: none; | ||
| 893 | + background-color: #ffffff !important; | ||
| 894 | + | ||
| 895 | + &-input { | ||
| 896 | + padding-left: 0 !important; | ||
| 897 | + height: 48rpx; | ||
| 898 | + line-height: 48rpx; | ||
| 899 | + font-size: 32rpx; | ||
| 900 | + } | ||
| 901 | + | ||
| 902 | + .content-clear-icon { | ||
| 903 | + font-size: 44rpx !important; | ||
| 904 | + } | ||
| 905 | + } | ||
| 906 | + } | ||
| 907 | + | ||
| 908 | + .item-title, | ||
| 909 | + .uni-list-item__content { | ||
| 910 | + flex: none; | ||
| 911 | + min-height: 48rpx; | ||
| 912 | + line-height: 48rpx; | ||
| 913 | + font-size: 32rpx; | ||
| 914 | + position: relative; | ||
| 915 | + width: 240rpx; | ||
| 916 | + margin-right: 32rpx; | ||
| 917 | + color: rgba(0, 0, 0, 0.9); | ||
| 918 | + | ||
| 919 | + .required { | ||
| 920 | + color: red; | ||
| 921 | + position: absolute; | ||
| 922 | + top: 50%; | ||
| 923 | + transform: translateY(-50%); | ||
| 924 | + left: -16rpx; | ||
| 925 | + } | ||
| 926 | + } | ||
| 927 | + } | ||
| 928 | + | ||
| 929 | + &.select-item { | ||
| 930 | + &.is-empty { | ||
| 931 | + .uni-list-item__extra-text { | ||
| 932 | + color: rgba(0, 0, 0, 0.4) !important; | ||
| 933 | + } | ||
| 934 | + } | ||
| 935 | + | ||
| 936 | + &.is-filled { | ||
| 937 | + .uni-list-item__extra-text { | ||
| 938 | + color: rgba(0, 0, 0, 0.9) !important; | ||
| 939 | + } | ||
| 940 | + } | ||
| 941 | + | ||
| 942 | + .serial-number-row { | ||
| 943 | + display: flex; | ||
| 944 | + align-items: center; | ||
| 945 | + | ||
| 946 | + .generate-btn { | ||
| 947 | + margin-left: 24rpx; | ||
| 948 | + height: 48rpx; | ||
| 949 | + line-height: 48rpx; | ||
| 950 | + padding: 0 24rpx; | ||
| 951 | + font-size: 24rpx; | ||
| 952 | + border-radius: 8rpx; | ||
| 953 | + background: $theme-primary; | ||
| 954 | + color: #fff; | ||
| 955 | + } | ||
| 956 | + } | ||
| 957 | + } | ||
| 958 | + } | ||
| 959 | +} | ||
| 960 | + | ||
| 961 | +.readonly-text { | ||
| 962 | + color: rgba(0, 0, 0, 0.9); | ||
| 963 | + font-size: 32rpx; | ||
| 964 | + line-height: 48rpx; | ||
| 965 | + text-align: right; | ||
| 966 | + white-space: pre-wrap; | ||
| 967 | + word-break: break-all; | ||
| 968 | +} | ||
| 969 | + | ||
| 970 | +.value-code { | ||
| 971 | + width: 260rpx; | ||
| 972 | + text-align: left; | ||
| 973 | +} | ||
| 974 | + | ||
| 975 | +.picker-value { | ||
| 976 | + font-size: 32rpx; | ||
| 977 | + color: rgba(0, 0, 0, 0.9); | ||
| 978 | + line-height: 48rpx; | ||
| 979 | + text-align: right; | ||
| 980 | + min-height: 48rpx; | ||
| 981 | + | ||
| 982 | + &.placeholder { | ||
| 983 | + color: rgba(0, 0, 0, 0.4); | ||
| 984 | + } | ||
| 985 | +} | ||
| 986 | + | ||
| 987 | +.sub-table, | ||
| 988 | +.remark-section { | ||
| 989 | + margin-top: 20rpx; | ||
| 990 | + background: #fff; | ||
| 991 | +} | ||
| 992 | + | ||
| 993 | +.header { | ||
| 994 | + display: flex; | ||
| 995 | + align-items: center; | ||
| 996 | + padding: 24rpx 32rpx; | ||
| 997 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 998 | + | ||
| 999 | + .opCollapse { | ||
| 1000 | + width: 32rpx; | ||
| 1001 | + height: 28rpx; | ||
| 1002 | + margin-right: 16rpx; | ||
| 1003 | + margin-top: 8rpx; | ||
| 1004 | + } | ||
| 1005 | + | ||
| 1006 | + .title { | ||
| 1007 | + font-size: 32rpx; | ||
| 1008 | + color: rgba(0, 0, 0, 0.9); | ||
| 1009 | + font-weight: 600; | ||
| 1010 | + flex: 1; | ||
| 1011 | + } | ||
| 1012 | + | ||
| 1013 | + .ops { | ||
| 1014 | + display: flex; | ||
| 1015 | + align-items: center; | ||
| 1016 | + | ||
| 1017 | + .opAdd { | ||
| 1018 | + width: 40rpx; | ||
| 1019 | + height: 40rpx; | ||
| 1020 | + } | ||
| 1021 | + } | ||
| 1022 | +} | ||
| 1023 | + | ||
| 1024 | +.add-list { | ||
| 1025 | + padding: 0 0 16rpx; | ||
| 1026 | + | ||
| 1027 | + .empty-tip { | ||
| 1028 | + text-align: center; | ||
| 1029 | + padding: 60rpx 0; | ||
| 1030 | + color: rgba(0, 0, 0, 0.4); | ||
| 1031 | + font-size: 28rpx; | ||
| 1032 | + } | ||
| 1033 | + | ||
| 1034 | + .block { | ||
| 1035 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 1036 | + | ||
| 1037 | + &:last-child { | ||
| 1038 | + border-bottom: none; | ||
| 1039 | + } | ||
| 1040 | + | ||
| 1041 | + .block-ops { | ||
| 1042 | + display: flex; | ||
| 1043 | + align-items: center; | ||
| 1044 | + justify-content: flex-end; | ||
| 1045 | + gap: 48rpx; | ||
| 1046 | + padding: 20rpx 32rpx; | ||
| 1047 | + background: #f8f8f8; | ||
| 1048 | + | ||
| 1049 | + .del, | ||
| 1050 | + .toggle { | ||
| 1051 | + display: flex; | ||
| 1052 | + align-items: center; | ||
| 1053 | + font-size: 28rpx; | ||
| 1054 | + color: rgba(0, 0, 0, 0.6); | ||
| 1055 | + | ||
| 1056 | + .icon { | ||
| 1057 | + width: 32rpx; | ||
| 1058 | + height: 32rpx; | ||
| 1059 | + margin-right: 8rpx; | ||
| 1060 | + } | ||
| 1061 | + } | ||
| 1062 | + | ||
| 1063 | + .del { | ||
| 1064 | + color: #d54941; | ||
| 1065 | + } | ||
| 1066 | + } | ||
| 1067 | + } | ||
| 1068 | +} | ||
| 1069 | + | ||
| 1070 | +.section-content { | ||
| 1071 | + padding: 32rpx; | ||
| 1072 | +} | ||
| 1073 | + | ||
| 1074 | +.form-group { | ||
| 1075 | + margin: 24rpx 0 32rpx; | ||
| 1076 | + | ||
| 1077 | + .item-title { | ||
| 1078 | + display: flex; | ||
| 1079 | + align-items: center; | ||
| 1080 | + font-size: 32rpx; | ||
| 1081 | + color: rgba(0, 0, 0, 0.9); | ||
| 1082 | + margin-bottom: 20rpx; | ||
| 1083 | + position: relative; | ||
| 1084 | + padding-left: 16rpx; | ||
| 1085 | + | ||
| 1086 | + .required { | ||
| 1087 | + color: red; | ||
| 1088 | + position: absolute; | ||
| 1089 | + left: 0; | ||
| 1090 | + } | ||
| 1091 | + } | ||
| 1092 | +} | ||
| 1093 | + | ||
| 1094 | +.remark-group { | ||
| 1095 | + margin-bottom: 32rpx; | ||
| 1096 | + | ||
| 1097 | + &:last-child { | ||
| 1098 | + margin-bottom: 0; | ||
| 1099 | + } | ||
| 1100 | + | ||
| 1101 | + .remark-label { | ||
| 1102 | + display: flex; | ||
| 1103 | + align-items: center; | ||
| 1104 | + font-size: 32rpx; | ||
| 1105 | + color: rgba(0, 0, 0, 0.9); | ||
| 1106 | + margin-bottom: 16rpx; | ||
| 1107 | + } | ||
| 1108 | +} | ||
| 1109 | +</style> |
pages/weight-ticket/reweigh.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <uni-list> | ||
| 5 | + <!-- 编号(F+原编号,只读) --> | ||
| 6 | + <uni-list-item class="select-item" :class="form.code ? 'is-filled' : 'is-empty'"> | ||
| 7 | + <template v-slot:body> | ||
| 8 | + <view class="item-title"><text class="required">*</text><text>编号</text></view> | ||
| 9 | + </template> | ||
| 10 | + <template v-slot:footer> | ||
| 11 | + <text class="readonly-text value-code">{{ form.code || '-' }}</text> | ||
| 12 | + </template> | ||
| 13 | + </uni-list-item> | ||
| 14 | + | ||
| 15 | + <!-- 类型(只读) --> | ||
| 16 | + <uni-list-item title="类型"> | ||
| 17 | + <template v-slot:footer> | ||
| 18 | + <uni-easyinput :value="getTypeLabel() || form.type" :inputBorder="false" disabled /> | ||
| 19 | + </template> | ||
| 20 | + </uni-list-item> | ||
| 21 | + | ||
| 22 | + <!-- 计划编号(只读) --> | ||
| 23 | + <uni-list-item title="计划编号"> | ||
| 24 | + <template v-slot:footer> | ||
| 25 | + <uni-easyinput :value="planCodeText" :inputBorder="false" disabled /> | ||
| 26 | + </template> | ||
| 27 | + </uni-list-item> | ||
| 28 | + | ||
| 29 | + <!-- 单位(只读) --> | ||
| 30 | + <uni-list-item title="单位"> | ||
| 31 | + <template v-slot:footer> | ||
| 32 | + <uni-easyinput :value="form.unit" :inputBorder="false" disabled /> | ||
| 33 | + </template> | ||
| 34 | + </uni-list-item> | ||
| 35 | + | ||
| 36 | + <!-- 供料单位(只读) --> | ||
| 37 | + <uni-list-item title="供料单位"> | ||
| 38 | + <template v-slot:footer> | ||
| 39 | + <uni-easyinput :value="form.supplierName" :inputBorder="false" disabled /> | ||
| 40 | + </template> | ||
| 41 | + </uni-list-item> | ||
| 42 | + | ||
| 43 | + <!-- 收料单位(只读) --> | ||
| 44 | + <uni-list-item title="收料单位"> | ||
| 45 | + <template v-slot:footer> | ||
| 46 | + <uni-easyinput :value="form.companyShortName" :inputBorder="false" disabled /> | ||
| 47 | + </template> | ||
| 48 | + </uni-list-item> | ||
| 49 | + </uni-list> | ||
| 50 | + | ||
| 51 | + <!-- 计划单明细(只读) --> | ||
| 52 | + <view class="sub-table"> | ||
| 53 | + <view class="header"> | ||
| 54 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 55 | + <text class="title">计划单明细</text> | ||
| 56 | + </view> | ||
| 57 | + <view class="add-list"> | ||
| 58 | + <view v-if="!planList.length" class="empty-tip">暂无明细</view> | ||
| 59 | + <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="block"> | ||
| 60 | + <uni-list> | ||
| 61 | + <uni-list-item title="计划编号"> | ||
| 62 | + <template v-slot:footer> | ||
| 63 | + <uni-easyinput :value="item.planCode" :inputBorder="false" disabled /> | ||
| 64 | + </template> | ||
| 65 | + </uni-list-item> | ||
| 66 | + <uni-list-item title="计划品种"> | ||
| 67 | + <template v-slot:footer> | ||
| 68 | + <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> | ||
| 69 | + </template> | ||
| 70 | + </uni-list-item> | ||
| 71 | + <uni-list-item title="计划数量"> | ||
| 72 | + <template v-slot:footer> | ||
| 73 | + <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> | ||
| 74 | + </template> | ||
| 75 | + </uni-list-item> | ||
| 76 | + </uni-list> | ||
| 77 | + </view> | ||
| 78 | + </view> | ||
| 79 | + </view> | ||
| 80 | + | ||
| 81 | + <!-- 过磅明细(仅过磅数量可编辑) --> | ||
| 82 | + <view class="sub-table"> | ||
| 83 | + <view class="header"> | ||
| 84 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 85 | + <text class="title">过磅明细</text> | ||
| 86 | + </view> | ||
| 87 | + <view class="add-list"> | ||
| 88 | + <view v-if="!weighList.length" class="empty-tip">暂无明细</view> | ||
| 89 | + <view v-for="(item, idx) in weighList" :key="'w-' + (item.id || idx)" class="block"> | ||
| 90 | + <uni-list> | ||
| 91 | + <uni-list-item title="计划编号"> | ||
| 92 | + <template v-slot:footer> | ||
| 93 | + <uni-easyinput :value="item.planCode" :inputBorder="false" disabled /> | ||
| 94 | + </template> | ||
| 95 | + </uni-list-item> | ||
| 96 | + <uni-list-item title="过磅品种"> | ||
| 97 | + <template v-slot:footer> | ||
| 98 | + <uni-easyinput :value="item.productName" :inputBorder="false" disabled /> | ||
| 99 | + </template> | ||
| 100 | + </uni-list-item> | ||
| 101 | + <uni-list-item title="开票品名"> | ||
| 102 | + <template v-slot:footer> | ||
| 103 | + <uni-easyinput :value="item.invoiceProductName" :inputBorder="false" disabled /> | ||
| 104 | + </template> | ||
| 105 | + </uni-list-item> | ||
| 106 | + <uni-list-item title="过磅数量"> | ||
| 107 | + <template v-slot:body> | ||
| 108 | + <view class="item-title"><text class="required">*</text><text>过磅数量</text></view> | ||
| 109 | + </template> | ||
| 110 | + <template v-slot:footer> | ||
| 111 | + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" /> | ||
| 112 | + </template> | ||
| 113 | + </uni-list-item> | ||
| 114 | + </uni-list> | ||
| 115 | + </view> | ||
| 116 | + </view> | ||
| 117 | + </view> | ||
| 118 | + | ||
| 119 | + <!-- 申请数量明细(仅买断展示,只读) --> | ||
| 120 | + <view v-if="isBuyout" class="sub-table"> | ||
| 121 | + <view class="header"> | ||
| 122 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 123 | + <text class="title">申请数量明细</text> | ||
| 124 | + </view> | ||
| 125 | + <view class="add-list"> | ||
| 126 | + <view v-if="!applyList.length" class="empty-tip">暂无明细</view> | ||
| 127 | + <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="block"> | ||
| 128 | + <uni-list> | ||
| 129 | + <uni-list-item title="类别"> | ||
| 130 | + <template v-slot:footer> | ||
| 131 | + <uni-easyinput :value="item.category" :inputBorder="false" disabled /> | ||
| 132 | + </template> | ||
| 133 | + </uni-list-item> | ||
| 134 | + <uni-list-item title="数量"> | ||
| 135 | + <template v-slot:footer> | ||
| 136 | + <uni-easyinput :value="item.quantity" :inputBorder="false" disabled /> | ||
| 137 | + </template> | ||
| 138 | + </uni-list-item> | ||
| 139 | + </uni-list> | ||
| 140 | + </view> | ||
| 141 | + </view> | ||
| 142 | + </view> | ||
| 143 | + | ||
| 144 | + <!-- 其他信息 --> | ||
| 145 | + <view class="remark-section"> | ||
| 146 | + <view class="header"> | ||
| 147 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 148 | + <text class="title">其他信息</text> | ||
| 149 | + </view> | ||
| 150 | + <view class="section-content"> | ||
| 151 | + <uni-list> | ||
| 152 | + <uni-list-item title="物料名称"> | ||
| 153 | + <template v-slot:footer> | ||
| 154 | + <uni-easyinput :value="materialName" :inputBorder="false" disabled /> | ||
| 155 | + </template> | ||
| 156 | + </uni-list-item> | ||
| 157 | + <uni-list-item> | ||
| 158 | + <template v-slot:body> | ||
| 159 | + <view class="item-title"><text class="required">*</text><text>过磅总重</text></view> | ||
| 160 | + </template> | ||
| 161 | + <template v-slot:footer> | ||
| 162 | + <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" /> | ||
| 163 | + </template> | ||
| 164 | + </uni-list-item> | ||
| 165 | + <uni-list-item> | ||
| 166 | + <template v-slot:body> | ||
| 167 | + <view class="item-title"><text class="required">*</text><text>实际伙重</text></view> | ||
| 168 | + </template> | ||
| 169 | + <template v-slot:footer> | ||
| 170 | + <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" /> | ||
| 171 | + </template> | ||
| 172 | + </uni-list-item> | ||
| 173 | + <uni-list-item title="货物净重"> | ||
| 174 | + <template v-slot:footer> | ||
| 175 | + <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled /> | ||
| 176 | + </template> | ||
| 177 | + </uni-list-item> | ||
| 178 | + <uni-list-item title="净重大写"> | ||
| 179 | + <template v-slot:footer> | ||
| 180 | + <uni-easyinput :value="computedNetWeightUpper" :inputBorder="false" disabled /> | ||
| 181 | + </template> | ||
| 182 | + </uni-list-item> | ||
| 183 | + </uni-list> | ||
| 184 | + | ||
| 185 | + <view class="form-group"> | ||
| 186 | + <view class="item-title"><text class="required">*</text><text>来料扣杂类型</text></view> | ||
| 187 | + <uni-data-checkbox | ||
| 188 | + mode="tag" | ||
| 189 | + :multiple="true" | ||
| 190 | + :value-field="'value'" | ||
| 191 | + :text-field="'text'" | ||
| 192 | + v-model="form.deductionTypes" | ||
| 193 | + :localdata="deductionTypeOptions" | ||
| 194 | + /> | ||
| 195 | + </view> | ||
| 196 | + | ||
| 197 | + <uni-list> | ||
| 198 | + <uni-list-item> | ||
| 199 | + <template v-slot:body> | ||
| 200 | + <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view> | ||
| 201 | + </template> | ||
| 202 | + <template v-slot:footer> | ||
| 203 | + <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" /> | ||
| 204 | + </template> | ||
| 205 | + </uni-list-item> | ||
| 206 | + <uni-list-item> | ||
| 207 | + <template v-slot:body> | ||
| 208 | + <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view> | ||
| 209 | + </template> | ||
| 210 | + <template v-slot:footer> | ||
| 211 | + <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" /> | ||
| 212 | + </template> | ||
| 213 | + </uni-list-item> | ||
| 214 | + <uni-list-item> | ||
| 215 | + <template v-slot:body> | ||
| 216 | + <view class="item-title"><text class="required">*</text><text>车牌号</text></view> | ||
| 217 | + </template> | ||
| 218 | + <template v-slot:footer> | ||
| 219 | + <uni-easyinput v-model="form.plateNumber" :inputBorder="false" placeholder="请输入车牌号" /> | ||
| 220 | + </template> | ||
| 221 | + </uni-list-item> | ||
| 222 | + </uni-list> | ||
| 223 | + </view> | ||
| 224 | + </view> | ||
| 225 | + | ||
| 226 | + <!-- 备注模块 --> | ||
| 227 | + <view class="remark-section"> | ||
| 228 | + <view class="header"> | ||
| 229 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 230 | + <text class="title">备注</text> | ||
| 231 | + </view> | ||
| 232 | + <view class="section-content"> | ||
| 233 | + <view class="remark-group"> | ||
| 234 | + <view class="remark-label">业务摘要</view> | ||
| 235 | + <uni-easyinput :value="computedBusinessSummary" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 236 | + </view> | ||
| 237 | + <view class="remark-group"> | ||
| 238 | + <view class="remark-label">特别说明</view> | ||
| 239 | + <uni-easyinput v-model="form.specialNote" type="textarea" :inputBorder="false" placeholder="请输入特别说明" maxlength="2000" /> | ||
| 240 | + </view> | ||
| 241 | + <view class="remark-group"> | ||
| 242 | + <view class="remark-label">单据备注</view> | ||
| 243 | + <uni-easyinput :value="computedDocumentRemark" type="textarea" :inputBorder="false" disabled autoHeight /> | ||
| 244 | + </view> | ||
| 245 | + </view> | ||
| 246 | + </view> | ||
| 247 | + | ||
| 248 | + <!-- 附件信息 --> | ||
| 249 | + <view class="remark-section"> | ||
| 250 | + <view class="header"> | ||
| 251 | + <image class="opCollapse" src="/static/images/title.png" /> | ||
| 252 | + <text class="title">复磅附件</text> | ||
| 253 | + <view class="ops"> | ||
| 254 | + <view class="upload-btn" @click="selectFile">上传文件</view> | ||
| 255 | + </view> | ||
| 256 | + </view> | ||
| 257 | + <view class="section-content"> | ||
| 258 | + <view v-if="!fileList.length" class="empty-tip">暂无附件,请上传</view> | ||
| 259 | + <view v-for="(file, idx) in fileList" :key="file.id || idx" class="file-item"> | ||
| 260 | + <text class="file-name">{{ file.name || '未命名文件' }}</text> | ||
| 261 | + <text class="file-del" @click="removeFile(idx)">删除</text> | ||
| 262 | + </view> | ||
| 263 | + </view> | ||
| 264 | + </view> | ||
| 265 | + | ||
| 266 | + <view class="footer"> | ||
| 267 | + <button class="btn submit" type="primary" @click="onSubmit">保存</button> | ||
| 268 | + </view> | ||
| 269 | + </scroll-view> | ||
| 270 | + </view> | ||
| 271 | +</template> | ||
| 272 | + | ||
| 273 | +<script> | ||
| 274 | +import { weighTicketDetailApi, weighTicketCreateApi } from '@/api/procure-manage/weighTicket.js' | ||
| 275 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 276 | +import upload from '@/utils/upload' | ||
| 277 | +import { uploadFileApi } from '@/api/base.js' | ||
| 278 | + | ||
| 279 | +export default { | ||
| 280 | + name: 'ReweighWeightTicket', | ||
| 281 | + data() { | ||
| 282 | + return { | ||
| 283 | + // 原过磅单ID | ||
| 284 | + id: '', | ||
| 285 | + form: { | ||
| 286 | + code: '', | ||
| 287 | + type: '', | ||
| 288 | + planCode: '', | ||
| 289 | + unit: '', | ||
| 290 | + supplierName: '', | ||
| 291 | + companyShortName: '', | ||
| 292 | + totalGrossWeight: '', | ||
| 293 | + actualImpurityWeight: '', | ||
| 294 | + deductionTypes: [], | ||
| 295 | + supplierStockMaterial: '', | ||
| 296 | + logisticsStockMaterial: '', | ||
| 297 | + plateNumber: '', | ||
| 298 | + specialNote: '' | ||
| 299 | + }, | ||
| 300 | + dicOptions: { TYPE: [], DEDUCTION_TYPE: [] }, | ||
| 301 | + // 选中计划行(供 planIds 提交与 isBuyout 判断) | ||
| 302 | + selectedPlanRows: [], | ||
| 303 | + buyout: false, | ||
| 304 | + // 计划单明细(只读) | ||
| 305 | + planList: [], | ||
| 306 | + // 过磅明细(仅数量可编辑) | ||
| 307 | + weighList: [], | ||
| 308 | + // 申请数量明细(只读) | ||
| 309 | + applyList: [], | ||
| 310 | + // 复磅附件 [{ id, name }] | ||
| 311 | + fileList: [] | ||
| 312 | + } | ||
| 313 | + }, | ||
| 314 | + computed: { | ||
| 315 | + deductionTypeOptions() { | ||
| 316 | + return (this.dicOptions.DEDUCTION_TYPE || []).map(it => ({ | ||
| 317 | + value: it.code != null ? String(it.code) : '', | ||
| 318 | + text: it.name || '' | ||
| 319 | + })).filter(it => it.value) | ||
| 320 | + }, | ||
| 321 | + isBuyout() { | ||
| 322 | + return this.buyout || (this.applyList || []).length > 0 | ||
| 323 | + }, | ||
| 324 | + planCodeText() { | ||
| 325 | + const codes = Array.from(new Set((this.planList || []).map(it => it.planCode).filter(Boolean))) | ||
| 326 | + return codes.join(',') | ||
| 327 | + }, | ||
| 328 | + // 物料名称:过磅明细开票品名去重顿号拼接 | ||
| 329 | + materialName() { | ||
| 330 | + const names = (this.weighList || []) | ||
| 331 | + .map(item => item.invoiceProductName) | ||
| 332 | + .filter(name => !!name) | ||
| 333 | + return Array.from(new Set(names)).join('、') | ||
| 334 | + }, | ||
| 335 | + // 货物净重 = 过磅总重 - 实际伙重(保留两位) | ||
| 336 | + computedNetWeight() { | ||
| 337 | + const gross = this.form.totalGrossWeight | ||
| 338 | + if (gross === undefined || gross === null || gross === '') return '' | ||
| 339 | + const num = Number(gross) - Number(this.form.actualImpurityWeight || 0) | ||
| 340 | + return String(Math.round(num * 100) / 100) | ||
| 341 | + }, | ||
| 342 | + // 净重大写:中文大写 | ||
| 343 | + computedNetWeightUpper() { | ||
| 344 | + const net = this.computedNetWeight | ||
| 345 | + if (net === '' || net === null || net === undefined) return '' | ||
| 346 | + return numberToChineseUpper(net) | ||
| 347 | + }, | ||
| 348 | + // 业务摘要 | ||
| 349 | + computedBusinessSummary() { | ||
| 350 | + const parts = [] | ||
| 351 | + const weightItems = (this.weighList || []) | ||
| 352 | + .map(item => { | ||
| 353 | + const name = item.productName || '' | ||
| 354 | + const qty = item.quantity === null || item.quantity === undefined ? '' : item.quantity | ||
| 355 | + if (!name && qty === '') return '' | ||
| 356 | + return `${name}${qty}公斤` | ||
| 357 | + }) | ||
| 358 | + .filter(text => !!text) | ||
| 359 | + if (weightItems.length) parts.push(weightItems.join('、')) | ||
| 360 | + const deductionNames = (this.form.deductionTypes || []) | ||
| 361 | + .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)) | ||
| 362 | + .filter(name => !!name) | ||
| 363 | + if (deductionNames.length) parts.push(deductionNames.join('、')) | ||
| 364 | + if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`) | ||
| 365 | + if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`) | ||
| 366 | + if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`) | ||
| 367 | + return parts.join(',') | ||
| 368 | + }, | ||
| 369 | + // 单据备注 = 业务摘要 + 特别说明 | ||
| 370 | + computedDocumentRemark() { | ||
| 371 | + const summary = this.computedBusinessSummary || '' | ||
| 372 | + const note = this.form.specialNote || '' | ||
| 373 | + return [summary, note].filter(text => !!text).join('\n') | ||
| 374 | + } | ||
| 375 | + }, | ||
| 376 | + onLoad(query) { | ||
| 377 | + this.id = (query && query.id) || '' | ||
| 378 | + }, | ||
| 379 | + created() { | ||
| 380 | + this.loadDicData() | ||
| 381 | + this.loadDetail() | ||
| 382 | + }, | ||
| 383 | + methods: { | ||
| 384 | + async loadDicData() { | ||
| 385 | + try { | ||
| 386 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | ||
| 387 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 388 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 389 | + } catch (e) { | ||
| 390 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 391 | + } | ||
| 392 | + }, | ||
| 393 | + getTypeLabel() { | ||
| 394 | + const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type)) | ||
| 395 | + return found ? found.name : '' | ||
| 396 | + }, | ||
| 397 | + loadDetail() { | ||
| 398 | + if (!this.id) { | ||
| 399 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | ||
| 400 | + return | ||
| 401 | + } | ||
| 402 | + uni.showLoading({ title: '加载中...', mask: true }) | ||
| 403 | + weighTicketDetailApi({ id: this.id }) | ||
| 404 | + .then(res => { | ||
| 405 | + const data = res && res.data ? (res.data.data || res.data) : {} | ||
| 406 | + this.buyout = !!data.buyout | ||
| 407 | + this.form = { | ||
| 408 | + // 复磅编号 = F + 原编号 | ||
| 409 | + code: 'F' + (data.code || ''), | ||
| 410 | + type: data.type != null ? String(data.type) : '', | ||
| 411 | + planCode: data.planCode || data.planCodes || '', | ||
| 412 | + unit: data.unit || '', | ||
| 413 | + supplierName: data.supplierName || '', | ||
| 414 | + companyShortName: data.companyShortName || '', | ||
| 415 | + totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), | ||
| 416 | + actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), | ||
| 417 | + deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [], | ||
| 418 | + supplierStockMaterial: data.supplierStockMaterial || '', | ||
| 419 | + logisticsStockMaterial: data.logisticsStockMaterial || '', | ||
| 420 | + plateNumber: data.plateNumber || '', | ||
| 421 | + specialNote: data.specialNote || '' | ||
| 422 | + } | ||
| 423 | + this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it })) | ||
| 424 | + // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用) | ||
| 425 | + this.selectedPlanRows = this.planList.map(item => ({ | ||
| 426 | + id: item.procurementPlanId || item.id, | ||
| 427 | + buyout: this.buyout | ||
| 428 | + })) | ||
| 429 | + this.weighList = (Array.isArray(data.weighLines) ? data.weighLines : []).map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 430 | + this.applyList = (Array.isArray(data.applyLines) ? data.applyLines : []).map(it => ({ ...it, id: it.id || genRowId() })) | ||
| 431 | + // 已传复磅附件回显(多文件逗号分隔) | ||
| 432 | + const ids = String(data.reweighAttachmentFileIds || '').split(',').filter(Boolean) | ||
| 433 | + const names = String(data.reweighAttachmentFileNames || '').split(',').filter(Boolean) | ||
| 434 | + this.fileList = ids.map((fid, i) => ({ id: fid, name: names[i] || '' })) | ||
| 435 | + }) | ||
| 436 | + .catch(() => { | ||
| 437 | + uni.showToast({ title: '加载详情失败', icon: 'none' }) | ||
| 438 | + }) | ||
| 439 | + .finally(() => { | ||
| 440 | + uni.hideLoading() | ||
| 441 | + }) | ||
| 442 | + }, | ||
| 443 | + // 选择并上传复磅附件(多文件逐个追加) | ||
| 444 | + selectFile() { | ||
| 445 | + if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { | ||
| 446 | + uni.chooseMessageFile({ | ||
| 447 | + count: 9, | ||
| 448 | + type: 'all', | ||
| 449 | + success: async res => { | ||
| 450 | + const files = (res && res.tempFiles) || [] | ||
| 451 | + if (!files.length) return | ||
| 452 | + uni.showLoading({ title: '上传中...', mask: true }) | ||
| 453 | + try { | ||
| 454 | + for (const f of files) { | ||
| 455 | + const name = f.name || 'file' | ||
| 456 | + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' }) | ||
| 457 | + const d = r && r.data ? r.data : r | ||
| 458 | + const fid = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId)))) | ||
| 459 | + ? String(d.id || d.fileId || d.data.id || d.data.fileId) | ||
| 460 | + : '' | ||
| 461 | + if (fid) this.fileList.push({ id: fid, name }) | ||
| 462 | + } | ||
| 463 | + } catch (e) { | ||
| 464 | + uni.showToast({ title: '上传失败', icon: 'none' }) | ||
| 465 | + } finally { | ||
| 466 | + uni.hideLoading() | ||
| 467 | + } | ||
| 468 | + }, | ||
| 469 | + fail: () => { | ||
| 470 | + uni.showToast({ title: '未选择文件', icon: 'none' }) | ||
| 471 | + } | ||
| 472 | + }) | ||
| 473 | + return | ||
| 474 | + } | ||
| 475 | + // H5 兜底:动态创建原生 input | ||
| 476 | + try { | ||
| 477 | + const self = this | ||
| 478 | + const input = document.createElement('input') | ||
| 479 | + input.type = 'file' | ||
| 480 | + input.multiple = true | ||
| 481 | + input.style.position = 'fixed' | ||
| 482 | + input.style.left = '-9999px' | ||
| 483 | + document.body.appendChild(input) | ||
| 484 | + input.addEventListener('change', self.onFileChange) | ||
| 485 | + input.click() | ||
| 486 | + setTimeout(() => { document.body.removeChild(input) }, 1000) | ||
| 487 | + } catch (e) { | ||
| 488 | + uni.showToast({ title: '无法打开文件选择', icon: 'none' }) | ||
| 489 | + } | ||
| 490 | + }, | ||
| 491 | + async onFileChange(e) { | ||
| 492 | + const files = (e && e.target && e.target.files) || [] | ||
| 493 | + if (!files.length) return | ||
| 494 | + uni.showLoading({ title: '上传中...', mask: true }) | ||
| 495 | + try { | ||
| 496 | + for (const file of files) { | ||
| 497 | + const name = file.name || '' | ||
| 498 | + const fd = new FormData() | ||
| 499 | + fd.append('file', file, name) | ||
| 500 | + const d = await uploadFileApi(fd) | ||
| 501 | + const data = d && d.data ? d.data : d | ||
| 502 | + const fid = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId)))) | ||
| 503 | + ? String(data.id || data.fileId || data.data.id || data.data.fileId) | ||
| 504 | + : '' | ||
| 505 | + if (fid) this.fileList.push({ id: fid, name }) | ||
| 506 | + } | ||
| 507 | + } catch (e2) { | ||
| 508 | + uni.showToast({ title: '上传失败', icon: 'none' }) | ||
| 509 | + } finally { | ||
| 510 | + uni.hideLoading() | ||
| 511 | + if (e && e.target) e.target.value = '' | ||
| 512 | + } | ||
| 513 | + }, | ||
| 514 | + removeFile(idx) { | ||
| 515 | + this.fileList.splice(idx, 1) | ||
| 516 | + }, | ||
| 517 | + validate() { | ||
| 518 | + const f = this.form | ||
| 519 | + if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重') | ||
| 520 | + if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重') | ||
| 521 | + if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型') | ||
| 522 | + if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料') | ||
| 523 | + if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料') | ||
| 524 | + if (!f.plateNumber) return this.tip('请输入车牌号') | ||
| 525 | + // 过磅明细:过磅数量必填 | ||
| 526 | + const weightList = this.weighList || [] | ||
| 527 | + for (let i = 0; i < weightList.length; i++) { | ||
| 528 | + const row = weightList[i] | ||
| 529 | + if (row.quantity === '' || row.quantity == null) return this.tip(`过磅明细第${i + 1}行:请输入过磅数量`) | ||
| 530 | + } | ||
| 531 | + // 复磅附件必传 | ||
| 532 | + if (!this.fileList.length) return this.tip('请上传复磅附件') | ||
| 533 | + return true | ||
| 534 | + }, | ||
| 535 | + tip(msg) { | ||
| 536 | + uni.showToast({ title: msg, icon: 'none' }) | ||
| 537 | + return false | ||
| 538 | + }, | ||
| 539 | + async onSubmit() { | ||
| 540 | + if (!this.validate()) return | ||
| 541 | + const confirmRes = await new Promise(resolve => { | ||
| 542 | + uni.showModal({ title: '提示', content: '确定保存复磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | ||
| 543 | + }) | ||
| 544 | + if (!(confirmRes && confirmRes.confirm)) return | ||
| 545 | + const ids = this.fileList.map(it => it.id).filter(Boolean) | ||
| 546 | + const names = this.fileList.map(it => it.name).filter(Boolean) | ||
| 547 | + const payload = { | ||
| 548 | + originWeighingTicketId: this.id, | ||
| 549 | + code: this.form.code, | ||
| 550 | + type: this.form.type, | ||
| 551 | + planIds: (this.selectedPlanRows || []).map(it => it.id), | ||
| 552 | + weighLines: (this.weighList || []).map(row => ({ | ||
| 553 | + procurementPlanId: row.procurementPlanId || '', | ||
| 554 | + planCode: row.planCode || '', | ||
| 555 | + productId: row.productId || '', | ||
| 556 | + invoiceProductName: row.invoiceProductName || '', | ||
| 557 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 558 | + itemId: row.id | ||
| 559 | + })), | ||
| 560 | + applyLines: (this.applyList || []).map(row => ({ | ||
| 561 | + category: row.category || '', | ||
| 562 | + breedRelationshipId: row.breedRelationshipId || '', | ||
| 563 | + quantity: row.quantity === null || row.quantity === undefined ? '' : String(row.quantity), | ||
| 564 | + itemId: row.breedRelationshipId | ||
| 565 | + })), | ||
| 566 | + unit: this.form.unit, | ||
| 567 | + materialName: this.materialName || null, | ||
| 568 | + totalGrossWeight: this.form.totalGrossWeight === '' ? null : Number(this.form.totalGrossWeight), | ||
| 569 | + actualImpurityWeight: this.form.actualImpurityWeight === '' ? null : Number(this.form.actualImpurityWeight), | ||
| 570 | + netWeight: this.computedNetWeight === '' ? null : Number(this.computedNetWeight), | ||
| 571 | + netWeightUpper: this.computedNetWeightUpper || null, | ||
| 572 | + deductionTypes: (this.form.deductionTypes || []).join(',') || null, | ||
| 573 | + supplierStockMaterial: this.form.supplierStockMaterial || null, | ||
| 574 | + logisticsStockMaterial: this.form.logisticsStockMaterial || null, | ||
| 575 | + plateNumber: this.form.plateNumber || null, | ||
| 576 | + businessSummary: this.computedBusinessSummary || null, | ||
| 577 | + specialNote: this.form.specialNote || null, | ||
| 578 | + documentRemark: this.computedDocumentRemark || null, | ||
| 579 | + reweighAttachmentFileIds: ids.join(','), | ||
| 580 | + reweighAttachmentFileNames: names.join(',') | ||
| 581 | + } | ||
| 582 | + uni.showLoading({ title: '保存中...', mask: true }) | ||
| 583 | + weighTicketCreateApi(payload) | ||
| 584 | + .then(() => { | ||
| 585 | + uni.hideLoading() | ||
| 586 | + uni.showToast({ title: '保存成功', icon: 'none' }) | ||
| 587 | + try { | ||
| 588 | + uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | ||
| 589 | + uni.setStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH', '1') | ||
| 590 | + } catch (e) {} | ||
| 591 | + setTimeout(() => { uni.navigateBack() }, 400) | ||
| 592 | + }) | ||
| 593 | + .catch(e => { | ||
| 594 | + uni.hideLoading() | ||
| 595 | + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' }) | ||
| 596 | + }) | ||
| 597 | + } | ||
| 598 | + } | ||
| 599 | +} | ||
| 600 | + | ||
| 601 | +// 生成前端临时行 id | ||
| 602 | +function genRowId() { | ||
| 603 | + return 'row_' + Date.now().toString(36) + '_' + Math.random().toString(36).slice(2, 8) | ||
| 604 | +} | ||
| 605 | + | ||
| 606 | +// 数字转中文大写(对齐 PC 端 useWeightTicketForm.ts) | ||
| 607 | +function numberToChineseUpper(num) { | ||
| 608 | + if (num === null || num === undefined || num === '' || isNaN(Number(num))) return '零' | ||
| 609 | + const n = Number(num) | ||
| 610 | + if (!isFinite(n)) return '零' | ||
| 611 | + | ||
| 612 | + const digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] | ||
| 613 | + const smallUnits = ['', '拾', '佰', '仟'] | ||
| 614 | + const bigUnits = ['', '万', '亿', '兆'] | ||
| 615 | + | ||
| 616 | + const negative = n < 0 | ||
| 617 | + const abs = Math.abs(n) | ||
| 618 | + const parts = abs.toString().split('.') | ||
| 619 | + const intStrRaw = parts[0] | ||
| 620 | + const decStrRaw = parts[1] || '' | ||
| 621 | + const s = intStrRaw | ||
| 622 | + const len = s.length | ||
| 623 | + | ||
| 624 | + let intPart = '' | ||
| 625 | + let zeroFlag = false | ||
| 626 | + for (let i = 0; i < len; i++) { | ||
| 627 | + const d = parseInt(s[i], 10) | ||
| 628 | + const pos = len - 1 - i | ||
| 629 | + const unitIdx = pos % 4 | ||
| 630 | + const groupIdx = Math.floor(pos / 4) | ||
| 631 | + if (d !== 0) { | ||
| 632 | + if (zeroFlag) { | ||
| 633 | + intPart += digit[0] | ||
| 634 | + zeroFlag = false | ||
| 635 | + } | ||
| 636 | + intPart += digit[d] + smallUnits[unitIdx] | ||
| 637 | + } else { | ||
| 638 | + zeroFlag = true | ||
| 639 | + } | ||
| 640 | + if (unitIdx === 0) { | ||
| 641 | + const start = Math.max(0, len - (groupIdx + 1) * 4) | ||
| 642 | + const end = len - groupIdx * 4 | ||
| 643 | + const groupDigits = s.slice(start, end) | ||
| 644 | + if (!/^0+$/.test(groupDigits)) { | ||
| 645 | + intPart += bigUnits[groupIdx] || '' | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + } | ||
| 649 | + if (intPart === '') intPart = digit[0] | ||
| 650 | + | ||
| 651 | + let result = intPart | ||
| 652 | + if (decStrRaw) { | ||
| 653 | + const decChars = decStrRaw | ||
| 654 | + .split('') | ||
| 655 | + .map(c => digit[parseInt(c, 10)]) | ||
| 656 | + .join('') | ||
| 657 | + result += '点' + decChars | ||
| 658 | + } | ||
| 659 | + return (negative ? '负' : '') + result | ||
| 660 | +} | ||
| 661 | +</script> | ||
| 662 | + | ||
| 663 | +<style lang="scss" scoped> | ||
| 664 | +.page { | ||
| 665 | + display: flex; | ||
| 666 | + flex-direction: column; | ||
| 667 | + height: 100%; | ||
| 668 | +} | ||
| 669 | + | ||
| 670 | +.scroll { | ||
| 671 | + flex: 1; | ||
| 672 | + padding: 12rpx 0 200rpx !important; | ||
| 673 | +} | ||
| 674 | + | ||
| 675 | +.footer { | ||
| 676 | + z-index: 2; | ||
| 677 | + position: fixed; | ||
| 678 | + left: 0; | ||
| 679 | + right: 0; | ||
| 680 | + bottom: 0; | ||
| 681 | + padding: 32rpx; | ||
| 682 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 683 | + background: #fff; | ||
| 684 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 685 | + | ||
| 686 | + .btn { | ||
| 687 | + height: 80rpx; | ||
| 688 | + line-height: 80rpx; | ||
| 689 | + border-radius: 12rpx; | ||
| 690 | + font-size: 32rpx; | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + .submit { | ||
| 694 | + background: $theme-primary; | ||
| 695 | + color: #fff; | ||
| 696 | + } | ||
| 697 | +} | ||
| 698 | + | ||
| 699 | +::v-deep .uni-list { | ||
| 700 | + .uni-easyinput { | ||
| 701 | + display: flex; | ||
| 702 | + | ||
| 703 | + .uni-input-input { | ||
| 704 | + color: rgba(0, 0, 0, 0.9); | ||
| 705 | + } | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + .uni-input-placeholder { | ||
| 709 | + z-index: 1; | ||
| 710 | + } | ||
| 711 | + | ||
| 712 | + .uni-input-input { | ||
| 713 | + background-color: #ffffff; | ||
| 714 | + } | ||
| 715 | + | ||
| 716 | + background: transparent; | ||
| 717 | + | ||
| 718 | + &-item { | ||
| 719 | + &__extra-text { | ||
| 720 | + font-size: 32rpx; | ||
| 721 | + } | ||
| 722 | + | ||
| 723 | + &__content-title { | ||
| 724 | + font-size: 32rpx; | ||
| 725 | + color: rgba(0, 0, 0, 0.9); | ||
| 726 | + } | ||
| 727 | + | ||
| 728 | + &__container { | ||
| 729 | + padding: 32rpx; | ||
| 730 | + | ||
| 731 | + .uni-easyinput { | ||
| 732 | + &__placeholder-class { | ||
| 733 | + font-size: 32rpx; | ||
| 734 | + color: rgba(0, 0, 0, 0.4); | ||
| 735 | + } | ||
| 736 | + | ||
| 737 | + &__content { | ||
| 738 | + border: none; | ||
| 739 | + background-color: #ffffff !important; | ||
| 740 | + | ||
| 741 | + &-input { | ||
| 742 | + padding-left: 0 !important; | ||
| 743 | + height: 48rpx; | ||
| 744 | + line-height: 48rpx; | ||
| 745 | + font-size: 32rpx; | ||
| 746 | + } | ||
| 747 | + } | ||
| 748 | + } | ||
| 749 | + | ||
| 750 | + .item-title, | ||
| 751 | + .uni-list-item__content { | ||
| 752 | + flex: none; | ||
| 753 | + min-height: 48rpx; | ||
| 754 | + line-height: 48rpx; | ||
| 755 | + font-size: 32rpx; | ||
| 756 | + position: relative; | ||
| 757 | + width: 240rpx; | ||
| 758 | + margin-right: 32rpx; | ||
| 759 | + color: rgba(0, 0, 0, 0.9); | ||
| 760 | + | ||
| 761 | + .required { | ||
| 762 | + color: red; | ||
| 763 | + position: absolute; | ||
| 764 | + top: 50%; | ||
| 765 | + transform: translateY(-50%); | ||
| 766 | + left: -16rpx; | ||
| 767 | + } | ||
| 768 | + } | ||
| 769 | + } | ||
| 770 | + } | ||
| 771 | +} | ||
| 772 | + | ||
| 773 | +.readonly-text { | ||
| 774 | + color: rgba(0, 0, 0, 0.9); | ||
| 775 | + font-size: 32rpx; | ||
| 776 | + line-height: 48rpx; | ||
| 777 | + text-align: right; | ||
| 778 | + white-space: pre-wrap; | ||
| 779 | + word-break: break-all; | ||
| 780 | +} | ||
| 781 | + | ||
| 782 | +.value-code { | ||
| 783 | + width: 260rpx; | ||
| 784 | + text-align: left; | ||
| 785 | +} | ||
| 786 | + | ||
| 787 | +.sub-table, | ||
| 788 | +.remark-section { | ||
| 789 | + margin-top: 20rpx; | ||
| 790 | + background: #fff; | ||
| 791 | +} | ||
| 792 | + | ||
| 793 | +.header { | ||
| 794 | + display: flex; | ||
| 795 | + align-items: center; | ||
| 796 | + padding: 24rpx 32rpx; | ||
| 797 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 798 | + | ||
| 799 | + .opCollapse { | ||
| 800 | + width: 32rpx; | ||
| 801 | + height: 28rpx; | ||
| 802 | + margin-right: 16rpx; | ||
| 803 | + margin-top: 8rpx; | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + .title { | ||
| 807 | + font-size: 32rpx; | ||
| 808 | + color: rgba(0, 0, 0, 0.9); | ||
| 809 | + font-weight: 600; | ||
| 810 | + flex: 1; | ||
| 811 | + } | ||
| 812 | + | ||
| 813 | + .ops { | ||
| 814 | + display: flex; | ||
| 815 | + align-items: center; | ||
| 816 | + | ||
| 817 | + .upload-btn { | ||
| 818 | + height: 56rpx; | ||
| 819 | + line-height: 56rpx; | ||
| 820 | + padding: 0 24rpx; | ||
| 821 | + font-size: 26rpx; | ||
| 822 | + border-radius: 8rpx; | ||
| 823 | + background: $theme-primary; | ||
| 824 | + color: #fff; | ||
| 825 | + } | ||
| 826 | + } | ||
| 827 | +} | ||
| 828 | + | ||
| 829 | +.add-list { | ||
| 830 | + padding: 0 0 16rpx; | ||
| 831 | + | ||
| 832 | + .empty-tip { | ||
| 833 | + text-align: center; | ||
| 834 | + padding: 60rpx 0; | ||
| 835 | + color: rgba(0, 0, 0, 0.4); | ||
| 836 | + font-size: 28rpx; | ||
| 837 | + } | ||
| 838 | + | ||
| 839 | + .block { | ||
| 840 | + border-bottom: 1rpx solid #f0f0f0; | ||
| 841 | + | ||
| 842 | + &:last-child { | ||
| 843 | + border-bottom: none; | ||
| 844 | + } | ||
| 845 | + } | ||
| 846 | +} | ||
| 847 | + | ||
| 848 | +.section-content { | ||
| 849 | + padding: 32rpx; | ||
| 850 | + | ||
| 851 | + .empty-tip { | ||
| 852 | + text-align: center; | ||
| 853 | + padding: 40rpx 0; | ||
| 854 | + color: rgba(0, 0, 0, 0.4); | ||
| 855 | + font-size: 28rpx; | ||
| 856 | + } | ||
| 857 | + | ||
| 858 | + .file-item { | ||
| 859 | + display: flex; | ||
| 860 | + align-items: center; | ||
| 861 | + justify-content: space-between; | ||
| 862 | + padding: 20rpx 24rpx; | ||
| 863 | + margin-bottom: 16rpx; | ||
| 864 | + background: #fafafa; | ||
| 865 | + border-radius: 8rpx; | ||
| 866 | + | ||
| 867 | + &:last-child { | ||
| 868 | + margin-bottom: 0; | ||
| 869 | + } | ||
| 870 | + | ||
| 871 | + .file-name { | ||
| 872 | + flex: 1; | ||
| 873 | + font-size: 28rpx; | ||
| 874 | + color: rgba(0, 0, 0, 0.9); | ||
| 875 | + word-break: break-all; | ||
| 876 | + margin-right: 20rpx; | ||
| 877 | + } | ||
| 878 | + | ||
| 879 | + .file-del { | ||
| 880 | + flex-shrink: 0; | ||
| 881 | + font-size: 26rpx; | ||
| 882 | + color: #d54941; | ||
| 883 | + } | ||
| 884 | + } | ||
| 885 | +} | ||
| 886 | + | ||
| 887 | +.form-group { | ||
| 888 | + margin: 24rpx 0 32rpx; | ||
| 889 | + | ||
| 890 | + .item-title { | ||
| 891 | + display: flex; | ||
| 892 | + align-items: center; | ||
| 893 | + font-size: 32rpx; | ||
| 894 | + color: rgba(0, 0, 0, 0.9); | ||
| 895 | + margin-bottom: 20rpx; | ||
| 896 | + position: relative; | ||
| 897 | + padding-left: 16rpx; | ||
| 898 | + | ||
| 899 | + .required { | ||
| 900 | + color: red; | ||
| 901 | + position: absolute; | ||
| 902 | + left: 0; | ||
| 903 | + } | ||
| 904 | + } | ||
| 905 | +} | ||
| 906 | + | ||
| 907 | +.remark-group { | ||
| 908 | + margin-bottom: 32rpx; | ||
| 909 | + | ||
| 910 | + &:last-child { | ||
| 911 | + margin-bottom: 0; | ||
| 912 | + } | ||
| 913 | + | ||
| 914 | + .remark-label { | ||
| 915 | + display: flex; | ||
| 916 | + align-items: center; | ||
| 917 | + font-size: 32rpx; | ||
| 918 | + color: rgba(0, 0, 0, 0.9); | ||
| 919 | + margin-bottom: 16rpx; | ||
| 920 | + } | ||
| 921 | +} | ||
| 922 | +</style> |
pages/weight-ticket/upload.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">{{ 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">{{ planCodeText || '-' }}</text></view> | ||
| 10 | + <view class="row"><text class="label">单位</text><text class="value">{{ form.unit || '-' }}</text></view> | ||
| 11 | + <view class="row"><text class="label">供料单位</text><text class="value">{{ form.supplierName || '-' }}</text></view> | ||
| 12 | + <view class="row"><text class="label">收料单位</text><text class="value">{{ 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">{{ item.planCode || '-' }}</text></view> | ||
| 26 | + <view class="row"><text class="label">计划品种</text><text class="value">{{ 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">{{ item.planCode || '-' }}</text></view> | ||
| 43 | + <view class="row"><text class="label">过磅品种</text><text class="value">{{ item.productName || '-' }}</text></view> | ||
| 44 | + <view class="row"><text class="label">开票品名</text><text class="value">{{ 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">{{ 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">{{ 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">{{ 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">{{ form.supplierStockMaterial || '-' }}</text></view> | ||
| 79 | + <view class="row"><text class="label">物流存欠料</text><text class="value">{{ form.logisticsStockMaterial || '-' }}</text></view> | ||
| 80 | + <view class="row"><text class="label">车牌号</text><text class="value">{{ 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">{{ 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">{{ 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">{{ 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">{{ mode === 'delay' ? '延期说明' : '签字凭证' }}</text> | ||
| 115 | + <view class="upload-btn" @click="selectFile">上传文件</view> | ||
| 116 | + </view> | ||
| 117 | + <view class="sub-body"> | ||
| 118 | + <view v-if="mode === 'sign'" class="driver-row"> | ||
| 119 | + <view class="driver-label"><text class="required">*</text><text>驾驶员姓名</text></view> | ||
| 120 | + <input | ||
| 121 | + class="driver-input" | ||
| 122 | + v-model="driver" | ||
| 123 | + placeholder="请输入驾驶员姓名" | ||
| 124 | + placeholder-style="color: rgba(0,0,0,0.4); font-size: 28rpx;" | ||
| 125 | + /> | ||
| 126 | + </view> | ||
| 127 | + <view v-if="!fileList.length" class="empty-tip">暂无附件,请上传</view> | ||
| 128 | + <view v-for="(file, idx) in fileList" :key="file.id || idx" class="file-item"> | ||
| 129 | + <text class="file-name">{{ file.name || '未命名文件' }}</text> | ||
| 130 | + <text class="file-del" @click="removeFile(idx)">删除</text> | ||
| 131 | + </view> | ||
| 132 | + </view> | ||
| 133 | + </view> | ||
| 134 | + </view> | ||
| 135 | + </scroll-view> | ||
| 136 | + <view class="footer"> | ||
| 137 | + <button class="btn submit" type="primary" @click="onSubmit">保存</button> | ||
| 138 | + </view> | ||
| 139 | + </view> | ||
| 140 | +</template> | ||
| 141 | + | ||
| 142 | +<script> | ||
| 143 | +import { | ||
| 144 | + weighTicketDetailApi, | ||
| 145 | + weighTicketUploadSignApi, | ||
| 146 | + weighTicketUploadDelayApi | ||
| 147 | +} from '@/api/procure-manage/weighTicket.js' | ||
| 148 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 149 | +import upload from '@/utils/upload' | ||
| 150 | +import { uploadFileApi } from '@/api/base.js' | ||
| 151 | + | ||
| 152 | +export default { | ||
| 153 | + name: 'WeightTicketUpload', | ||
| 154 | + data() { | ||
| 155 | + return { | ||
| 156 | + id: '', | ||
| 157 | + // 上传类型:sign-签字凭证;delay-延期说明 | ||
| 158 | + mode: 'sign', | ||
| 159 | + form: { | ||
| 160 | + code: '', | ||
| 161 | + type: '', | ||
| 162 | + unit: '', | ||
| 163 | + supplierName: '', | ||
| 164 | + companyShortName: '', | ||
| 165 | + materialName: '', | ||
| 166 | + totalGrossWeight: '', | ||
| 167 | + actualImpurityWeight: '', | ||
| 168 | + netWeight: '', | ||
| 169 | + netWeightUpper: '', | ||
| 170 | + deductionTypes: '', | ||
| 171 | + supplierStockMaterial: '', | ||
| 172 | + logisticsStockMaterial: '', | ||
| 173 | + plateNumber: '', | ||
| 174 | + businessSummary: '', | ||
| 175 | + specialNote: '', | ||
| 176 | + documentRemark: '' | ||
| 177 | + }, | ||
| 178 | + planList: [], | ||
| 179 | + weighList: [], | ||
| 180 | + applyList: [], | ||
| 181 | + buyout: false, | ||
| 182 | + // 附件列表 [{ id, name }] | ||
| 183 | + fileList: [], | ||
| 184 | + // 驾驶员姓名(仅签字凭证必填) | ||
| 185 | + driver: '', | ||
| 186 | + dicOptions: { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 187 | + } | ||
| 188 | + }, | ||
| 189 | + computed: { | ||
| 190 | + typeName() { | ||
| 191 | + const v = this.form.type == null ? '' : String(this.form.type) | ||
| 192 | + if (!v) return '-' | ||
| 193 | + return getDicName('TYPE', v, this.dicOptions.TYPE) || v | ||
| 194 | + }, | ||
| 195 | + planCodeText() { | ||
| 196 | + const codes = Array.from(new Set((this.planList || []).map(it => it.planCode).filter(Boolean))) | ||
| 197 | + return codes.join(',') | ||
| 198 | + }, | ||
| 199 | + deductionNames() { | ||
| 200 | + const codes = (this.form.deductionTypes == null ? '' : String(this.form.deductionTypes)).split(',').filter(Boolean) | ||
| 201 | + const names = codes.map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)).filter(Boolean) | ||
| 202 | + return names.length ? names.join('、') : '-' | ||
| 203 | + }, | ||
| 204 | + isBuyout() { | ||
| 205 | + return this.buyout || (this.applyList || []).length > 0 | ||
| 206 | + } | ||
| 207 | + }, | ||
| 208 | + onLoad(query) { | ||
| 209 | + this.id = (query && query.id) || '' | ||
| 210 | + this.mode = query && query.mode === 'delay' ? 'delay' : 'sign' | ||
| 211 | + uni.setNavigationBarTitle({ | ||
| 212 | + title: this.mode === 'delay' ? '上传延期说明' : '上传签字凭证' | ||
| 213 | + }) | ||
| 214 | + }, | ||
| 215 | + created() { | ||
| 216 | + this.loadDicData() | ||
| 217 | + this.loadDetail() | ||
| 218 | + }, | ||
| 219 | + methods: { | ||
| 220 | + async loadDicData() { | ||
| 221 | + try { | ||
| 222 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | ||
| 223 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 224 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 225 | + } catch (e) { | ||
| 226 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 227 | + } | ||
| 228 | + }, | ||
| 229 | + loadDetail() { | ||
| 230 | + if (!this.id) { | ||
| 231 | + uni.showToast({ title: '缺少单据ID', icon: 'none' }) | ||
| 232 | + return | ||
| 233 | + } | ||
| 234 | + uni.showLoading({ title: '加载中...', mask: true }) | ||
| 235 | + weighTicketDetailApi({ id: this.id }) | ||
| 236 | + .then(res => { | ||
| 237 | + const data = res && res.data ? (res.data.data || res.data) : {} | ||
| 238 | + this.form = { | ||
| 239 | + code: data.code || '', | ||
| 240 | + type: data.type != null ? String(data.type) : '', | ||
| 241 | + unit: data.unit || '', | ||
| 242 | + supplierName: data.supplierName || '', | ||
| 243 | + companyShortName: data.companyShortName || '', | ||
| 244 | + materialName: data.materialName || '', | ||
| 245 | + totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight), | ||
| 246 | + actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight), | ||
| 247 | + netWeight: data.netWeight == null ? '' : String(data.netWeight), | ||
| 248 | + netWeightUpper: data.netWeightUpper || '', | ||
| 249 | + deductionTypes: data.deductionTypes || '', | ||
| 250 | + supplierStockMaterial: data.supplierStockMaterial || '', | ||
| 251 | + logisticsStockMaterial: data.logisticsStockMaterial || '', | ||
| 252 | + plateNumber: data.plateNumber || '', | ||
| 253 | + businessSummary: data.businessSummary || '', | ||
| 254 | + specialNote: data.specialNote || '', | ||
| 255 | + documentRemark: data.documentRemark || '' | ||
| 256 | + } | ||
| 257 | + // 驾驶员姓名回显(仅签字凭证) | ||
| 258 | + this.driver = data.driver || '' | ||
| 259 | + this.buyout = !!data.buyout | ||
| 260 | + this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] | ||
| 261 | + this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] | ||
| 262 | + this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : [] | ||
| 263 | + // 已传附件回显(多文件逗号分隔) | ||
| 264 | + const key = this.mode === 'delay' ? 'delayFile' : 'signFile' | ||
| 265 | + const ids = String(data[key + 'Id'] || '').split(',').filter(Boolean) | ||
| 266 | + const names = String(data[key + 'Name'] || '').split(',').filter(Boolean) | ||
| 267 | + this.fileList = ids.map((id, i) => ({ id, name: names[i] || '' })) | ||
| 268 | + }) | ||
| 269 | + .catch(() => { | ||
| 270 | + uni.showToast({ title: '加载详情失败', icon: 'none' }) | ||
| 271 | + }) | ||
| 272 | + .finally(() => { | ||
| 273 | + uni.hideLoading() | ||
| 274 | + }) | ||
| 275 | + }, | ||
| 276 | + // 选择并上传文件(多文件逐个追加) | ||
| 277 | + selectFile() { | ||
| 278 | + if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') { | ||
| 279 | + uni.chooseMessageFile({ | ||
| 280 | + count: 9, | ||
| 281 | + type: 'all', | ||
| 282 | + success: async res => { | ||
| 283 | + const files = (res && res.tempFiles) || [] | ||
| 284 | + if (!files.length) return | ||
| 285 | + uni.showLoading({ title: '上传中...', mask: true }) | ||
| 286 | + try { | ||
| 287 | + for (const f of files) { | ||
| 288 | + const name = f.name || 'file' | ||
| 289 | + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: f.path, name: 'file' }) | ||
| 290 | + const d = r && r.data ? r.data : r | ||
| 291 | + const id = (d && (d.id || d.fileId || (d.data && (d.data.id || d.data.fileId)))) | ||
| 292 | + ? String(d.id || d.fileId || d.data.id || d.data.fileId) | ||
| 293 | + : '' | ||
| 294 | + if (id) this.fileList.push({ id, name }) | ||
| 295 | + } | ||
| 296 | + } catch (e) { | ||
| 297 | + uni.showToast({ title: '上传失败', icon: 'none' }) | ||
| 298 | + } finally { | ||
| 299 | + uni.hideLoading() | ||
| 300 | + } | ||
| 301 | + }, | ||
| 302 | + fail: () => { | ||
| 303 | + uni.showToast({ title: '未选择文件', icon: 'none' }) | ||
| 304 | + } | ||
| 305 | + }) | ||
| 306 | + return | ||
| 307 | + } | ||
| 308 | + // H5 兜底:动态创建原生 input | ||
| 309 | + try { | ||
| 310 | + const self = this | ||
| 311 | + const input = document.createElement('input') | ||
| 312 | + input.type = 'file' | ||
| 313 | + input.multiple = true | ||
| 314 | + input.style.position = 'fixed' | ||
| 315 | + input.style.left = '-9999px' | ||
| 316 | + document.body.appendChild(input) | ||
| 317 | + input.addEventListener('change', self.onFileChange) | ||
| 318 | + input.click() | ||
| 319 | + setTimeout(() => { document.body.removeChild(input) }, 1000) | ||
| 320 | + } catch (e) { | ||
| 321 | + uni.showToast({ title: '无法打开文件选择', icon: 'none' }) | ||
| 322 | + } | ||
| 323 | + }, | ||
| 324 | + async onFileChange(e) { | ||
| 325 | + const files = (e && e.target && e.target.files) || [] | ||
| 326 | + if (!files.length) return | ||
| 327 | + uni.showLoading({ title: '上传中...', mask: true }) | ||
| 328 | + try { | ||
| 329 | + for (const file of files) { | ||
| 330 | + const name = file.name || '' | ||
| 331 | + const fd = new FormData() | ||
| 332 | + fd.append('file', file, name) | ||
| 333 | + const d = await uploadFileApi(fd) | ||
| 334 | + const data = d && d.data ? d.data : d | ||
| 335 | + const id = (data && (data.id || data.fileId || (data.data && (data.data.id || data.data.fileId)))) | ||
| 336 | + ? String(data.id || data.fileId || data.data.id || data.data.fileId) | ||
| 337 | + : '' | ||
| 338 | + if (id) this.fileList.push({ id, name }) | ||
| 339 | + } | ||
| 340 | + } catch (e2) { | ||
| 341 | + uni.showToast({ title: '上传失败', icon: 'none' }) | ||
| 342 | + } finally { | ||
| 343 | + uni.hideLoading() | ||
| 344 | + if (e && e.target) e.target.value = '' | ||
| 345 | + } | ||
| 346 | + }, | ||
| 347 | + removeFile(idx) { | ||
| 348 | + this.fileList.splice(idx, 1) | ||
| 349 | + }, | ||
| 350 | + formatNumber(v) { | ||
| 351 | + if (v === null || v === undefined || v === '') return '-' | ||
| 352 | + const n = Number(v) | ||
| 353 | + if (isNaN(n)) return String(v) | ||
| 354 | + return n.toLocaleString('zh-CN', { maximumFractionDigits: 4 }) | ||
| 355 | + }, | ||
| 356 | + async onSubmit() { | ||
| 357 | + const ids = this.fileList.map(it => it.id).filter(Boolean) | ||
| 358 | + const names = this.fileList.map(it => it.name).filter(Boolean) | ||
| 359 | + if (!ids.length || !names.length) { | ||
| 360 | + uni.showToast({ title: this.mode === 'delay' ? '请上传延期说明附件' : '请上传签字凭证', icon: 'none' }) | ||
| 361 | + return | ||
| 362 | + } | ||
| 363 | + // 签字凭证:驾驶员姓名必填 | ||
| 364 | + const driver = (this.driver || '').trim() | ||
| 365 | + if (this.mode === 'sign' && !driver) { | ||
| 366 | + uni.showToast({ title: '请输入驾驶员姓名', icon: 'none' }) | ||
| 367 | + return | ||
| 368 | + } | ||
| 369 | + const confirmRes = await new Promise(resolve => { | ||
| 370 | + uni.showModal({ title: '提示', content: '确定保存附件吗?', confirmText: '确定', cancelText: '取消', success: resolve }) | ||
| 371 | + }) | ||
| 372 | + if (!(confirmRes && confirmRes.confirm)) return | ||
| 373 | + const data = { | ||
| 374 | + id: this.id, | ||
| 375 | + fileIds: ids.join(','), | ||
| 376 | + fileNames: names.join(',') | ||
| 377 | + } | ||
| 378 | + if (this.mode === 'sign') { | ||
| 379 | + data.driver = driver | ||
| 380 | + } | ||
| 381 | + uni.showLoading({ title: '保存中...', mask: true }) | ||
| 382 | + const api = this.mode === 'delay' ? weighTicketUploadDelayApi : weighTicketUploadSignApi | ||
| 383 | + api(data) | ||
| 384 | + .then(() => { | ||
| 385 | + uni.hideLoading() | ||
| 386 | + uni.showToast({ title: '保存成功', icon: 'none' }) | ||
| 387 | + try { | ||
| 388 | + uni.setStorageSync('WEIGHT_TICKET_LIST_NEED_REFRESH', '1') | ||
| 389 | + uni.setStorageSync('WEIGHT_TICKET_DETAIL_NEED_REFRESH', '1') | ||
| 390 | + } catch (e) {} | ||
| 391 | + setTimeout(() => { uni.navigateBack() }, 400) | ||
| 392 | + }) | ||
| 393 | + .catch(e => { | ||
| 394 | + uni.hideLoading() | ||
| 395 | + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' }) | ||
| 396 | + }) | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | +} | ||
| 400 | +</script> | ||
| 401 | + | ||
| 402 | +<style lang="scss" scoped> | ||
| 403 | +.page { | ||
| 404 | + display: flex; | ||
| 405 | + flex-direction: column; | ||
| 406 | + height: 100%; | ||
| 407 | +} | ||
| 408 | + | ||
| 409 | +.scroll { | ||
| 410 | + flex: 1; | ||
| 411 | + padding: 8rpx 0 176rpx; | ||
| 412 | +} | ||
| 413 | + | ||
| 414 | +.detail-page { | ||
| 415 | + background: #f3f3f3; | ||
| 416 | +} | ||
| 417 | + | ||
| 418 | +.footer { | ||
| 419 | + z-index: 2; | ||
| 420 | + position: fixed; | ||
| 421 | + left: 0; | ||
| 422 | + right: 0; | ||
| 423 | + bottom: 0; | ||
| 424 | + padding: 32rpx; | ||
| 425 | + padding-bottom: calc(32rpx + env(safe-area-inset-bottom)); | ||
| 426 | + background: #fff; | ||
| 427 | + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06); | ||
| 428 | + | ||
| 429 | + .btn { | ||
| 430 | + height: 80rpx; | ||
| 431 | + line-height: 80rpx; | ||
| 432 | + border-radius: 12rpx; | ||
| 433 | + font-size: 32rpx; | ||
| 434 | + } | ||
| 435 | + | ||
| 436 | + .submit { | ||
| 437 | + background: $theme-primary; | ||
| 438 | + color: #fff; | ||
| 439 | + } | ||
| 440 | +} | ||
| 441 | + | ||
| 442 | +.section { | ||
| 443 | + padding: 32rpx; | ||
| 444 | + background: #fff; | ||
| 445 | + margin-bottom: 20rpx; | ||
| 446 | +} | ||
| 447 | + | ||
| 448 | +.title-header { | ||
| 449 | + display: flex; | ||
| 450 | + align-items: center; | ||
| 451 | + padding: 24rpx 32rpx 12rpx; | ||
| 452 | + background-color: #ffffff; | ||
| 453 | + | ||
| 454 | + .title-header_icon { | ||
| 455 | + width: 36rpx; | ||
| 456 | + height: 36rpx; | ||
| 457 | + margin-right: 12rpx; | ||
| 458 | + } | ||
| 459 | + | ||
| 460 | + span { | ||
| 461 | + font-size: 34rpx; | ||
| 462 | + font-weight: 600; | ||
| 463 | + color: rgba(0, 0, 0, 0.9); | ||
| 464 | + } | ||
| 465 | +} | ||
| 466 | + | ||
| 467 | +.row { | ||
| 468 | + display: flex; | ||
| 469 | + margin-bottom: 28rpx; | ||
| 470 | + | ||
| 471 | + &:last-child { | ||
| 472 | + margin-bottom: 0; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + &.company { | ||
| 476 | + font-size: 36rpx; | ||
| 477 | + font-weight: 600; | ||
| 478 | + color: rgba(0, 0, 0, 0.9); | ||
| 479 | + padding-top: 8rpx; | ||
| 480 | + line-height: 50rpx; | ||
| 481 | + } | ||
| 482 | + | ||
| 483 | + .label { | ||
| 484 | + max-width: 420rpx; | ||
| 485 | + margin-right: 20rpx; | ||
| 486 | + line-height: 32rpx; | ||
| 487 | + font-size: 28rpx; | ||
| 488 | + color: rgba(0, 0, 0, 0.6); | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + .value { | ||
| 492 | + flex: 1; | ||
| 493 | + line-height: 32rpx; | ||
| 494 | + font-size: 28rpx; | ||
| 495 | + color: rgba(0, 0, 0, 0.9); | ||
| 496 | + text-align: right; | ||
| 497 | + word-break: break-all; | ||
| 498 | + } | ||
| 499 | +} | ||
| 500 | + | ||
| 501 | +.remark-text { | ||
| 502 | + font-size: 28rpx; | ||
| 503 | + color: rgba(0, 0, 0, 0.9); | ||
| 504 | + line-height: 1.6; | ||
| 505 | + white-space: pre-wrap; | ||
| 506 | +} | ||
| 507 | + | ||
| 508 | +.sub-table { | ||
| 509 | + background: #fff; | ||
| 510 | + margin-bottom: 20rpx; | ||
| 511 | +} | ||
| 512 | + | ||
| 513 | +.sub-header { | ||
| 514 | + display: flex; | ||
| 515 | + align-items: center; | ||
| 516 | + padding: 16rpx 0 16rpx 32rpx; | ||
| 517 | + | ||
| 518 | + .sub-bar { | ||
| 519 | + width: 6rpx; | ||
| 520 | + height: 32rpx; | ||
| 521 | + margin-right: 14rpx; | ||
| 522 | + } | ||
| 523 | + | ||
| 524 | + .sub-title { | ||
| 525 | + font-size: 30rpx; | ||
| 526 | + font-weight: 600; | ||
| 527 | + color: rgba(0, 0, 0, 0.9); | ||
| 528 | + flex: 1; | ||
| 529 | + line-height: 42rpx; | ||
| 530 | + } | ||
| 531 | + | ||
| 532 | + .upload-btn { | ||
| 533 | + margin-right: 32rpx; | ||
| 534 | + height: 56rpx; | ||
| 535 | + line-height: 56rpx; | ||
| 536 | + padding: 0 24rpx; | ||
| 537 | + font-size: 26rpx; | ||
| 538 | + border-radius: 8rpx; | ||
| 539 | + background: $theme-primary; | ||
| 540 | + color: #fff; | ||
| 541 | + } | ||
| 542 | +} | ||
| 543 | + | ||
| 544 | +.sub-body { | ||
| 545 | + padding: 0 32rpx 24rpx; | ||
| 546 | + | ||
| 547 | + .empty-tip { | ||
| 548 | + text-align: center; | ||
| 549 | + padding: 40rpx 0; | ||
| 550 | + color: rgba(0, 0, 0, 0.4); | ||
| 551 | + font-size: 28rpx; | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + .driver-row { | ||
| 555 | + display: flex; | ||
| 556 | + align-items: center; | ||
| 557 | + justify-content: space-between; | ||
| 558 | + min-height: 88rpx; | ||
| 559 | + padding: 8rpx 0; | ||
| 560 | + margin-bottom: 8rpx; | ||
| 561 | + border-bottom: 1rpx dashed #f2f2f2; | ||
| 562 | + | ||
| 563 | + .driver-label { | ||
| 564 | + display: flex; | ||
| 565 | + align-items: center; | ||
| 566 | + flex-shrink: 0; | ||
| 567 | + width: 220rpx; | ||
| 568 | + font-size: 28rpx; | ||
| 569 | + color: rgba(0, 0, 0, 0.6); | ||
| 570 | + line-height: 40rpx; | ||
| 571 | + | ||
| 572 | + .required { | ||
| 573 | + color: #d54941; | ||
| 574 | + margin-right: 6rpx; | ||
| 575 | + } | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + .driver-input { | ||
| 579 | + flex: 1; | ||
| 580 | + height: 56rpx; | ||
| 581 | + line-height: 56rpx; | ||
| 582 | + font-size: 28rpx; | ||
| 583 | + color: rgba(0, 0, 0, 0.9); | ||
| 584 | + text-align: right; | ||
| 585 | + } | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + .card { | ||
| 589 | + position: relative; | ||
| 590 | + background: #fafafa; | ||
| 591 | + border-radius: 12rpx; | ||
| 592 | + padding: 32rpx 28rpx 20rpx; | ||
| 593 | + margin-bottom: 24rpx; | ||
| 594 | + | ||
| 595 | + .card-index { | ||
| 596 | + position: absolute; | ||
| 597 | + top: 0; | ||
| 598 | + right: 0; | ||
| 599 | + background: rgba(24, 144, 255, 0.08); | ||
| 600 | + color: $theme-primary; | ||
| 601 | + font-size: 22rpx; | ||
| 602 | + line-height: 36rpx; | ||
| 603 | + padding: 0 16rpx; | ||
| 604 | + border-bottom-left-radius: 12rpx; | ||
| 605 | + border-top-right-radius: 12rpx; | ||
| 606 | + } | ||
| 607 | + | ||
| 608 | + .row { | ||
| 609 | + align-items: center; | ||
| 610 | + justify-content: space-between; | ||
| 611 | + padding: 14rpx 0; | ||
| 612 | + margin-bottom: 0; | ||
| 613 | + border-bottom: 1rpx dashed #f2f2f2; | ||
| 614 | + | ||
| 615 | + &:last-child { | ||
| 616 | + border-bottom: none; | ||
| 617 | + } | ||
| 618 | + | ||
| 619 | + .label { | ||
| 620 | + flex-shrink: 0; | ||
| 621 | + width: 220rpx; | ||
| 622 | + max-width: none; | ||
| 623 | + margin-right: 0; | ||
| 624 | + font-size: 28rpx; | ||
| 625 | + color: rgba(0, 0, 0, 0.6); | ||
| 626 | + line-height: 40rpx; | ||
| 627 | + } | ||
| 628 | + | ||
| 629 | + .value { | ||
| 630 | + flex: 1; | ||
| 631 | + text-align: right; | ||
| 632 | + font-size: 28rpx; | ||
| 633 | + color: rgba(0, 0, 0, 0.9); | ||
| 634 | + line-height: 40rpx; | ||
| 635 | + overflow: hidden; | ||
| 636 | + text-overflow: ellipsis; | ||
| 637 | + white-space: nowrap; | ||
| 638 | + } | ||
| 639 | + } | ||
| 640 | + } | ||
| 641 | + | ||
| 642 | + .file-item { | ||
| 643 | + display: flex; | ||
| 644 | + align-items: center; | ||
| 645 | + justify-content: space-between; | ||
| 646 | + padding: 20rpx 24rpx; | ||
| 647 | + margin-bottom: 16rpx; | ||
| 648 | + background: #fafafa; | ||
| 649 | + border-radius: 8rpx; | ||
| 650 | + | ||
| 651 | + &:last-child { | ||
| 652 | + margin-bottom: 0; | ||
| 653 | + } | ||
| 654 | + | ||
| 655 | + .file-name { | ||
| 656 | + flex: 1; | ||
| 657 | + font-size: 28rpx; | ||
| 658 | + color: rgba(0, 0, 0, 0.9); | ||
| 659 | + word-break: break-all; | ||
| 660 | + margin-right: 20rpx; | ||
| 661 | + } | ||
| 662 | + | ||
| 663 | + .file-del { | ||
| 664 | + flex-shrink: 0; | ||
| 665 | + font-size: 26rpx; | ||
| 666 | + color: #d54941; | ||
| 667 | + } | ||
| 668 | + } | ||
| 669 | +} | ||
| 670 | +</style> |
pages/weight-ticket/weightTicketViewer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="detail-page"> | ||
| 3 | + <scroll-view class="scroll" scroll-y> | ||
| 4 | + <!-- 基础信息 --> | ||
| 5 | + <view class="section"> | ||
| 6 | + <text class="row company">{{ safeText(form.code) }}</text> | ||
| 7 | + <view class="row"><text class="label">类型</text><text class="value">{{ typeName }}</text></view> | ||
| 8 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(planCodeText) }}</text></view> | ||
| 9 | + <view class="row"><text class="label">单位</text><text class="value">{{ safeText(form.unit) }}</text></view> | ||
| 10 | + <view class="row"><text class="label">时间</text><text class="value">{{ formatDate(form.firstGrossWeightTime) }}</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.productName) }}</text></view> | ||
| 26 | + <view class="row"><text class="label">计划数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | ||
| 27 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</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.productName) }}</text></view> | ||
| 43 | + <view class="row"><text class="label">开票品名</text><text class="value">{{ safeText(item.invoiceProductName) }}</text></view> | ||
| 44 | + <view class="row"><text class="label">过磅数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view> | ||
| 45 | + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</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 | + </scroll-view> | ||
| 110 | + </view> | ||
| 111 | +</template> | ||
| 112 | + | ||
| 113 | +<script> | ||
| 114 | +import { weighTicketDetailApi } from '@/api/procure-manage/weighTicket.js' | ||
| 115 | +import { getDicByCodes, getDicName } from '@/utils/dic.js' | ||
| 116 | + | ||
| 117 | +export default { | ||
| 118 | + name: 'WeightTicketViewer', | ||
| 119 | + props: { id: { type: [String, Number], default: '' } }, | ||
| 120 | + data() { | ||
| 121 | + return { | ||
| 122 | + form: {}, | ||
| 123 | + planList: [], | ||
| 124 | + weighList: [], | ||
| 125 | + applyList: [], | ||
| 126 | + buyout: false, | ||
| 127 | + dicOptions: { | ||
| 128 | + TYPE: [], | ||
| 129 | + DEDUCTION_TYPE: [] | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + computed: { | ||
| 134 | + typeName() { | ||
| 135 | + const v = this.form.type == null ? '' : String(this.form.type) | ||
| 136 | + if (!v) return '-' | ||
| 137 | + return getDicName('TYPE', v, this.dicOptions.TYPE) || v | ||
| 138 | + }, | ||
| 139 | + planCodeText() { | ||
| 140 | + const codes = Array.from(new Set((this.planList || []).map(it => it.planCode).filter(Boolean))) | ||
| 141 | + return codes.join(',') | ||
| 142 | + }, | ||
| 143 | + deductionNames() { | ||
| 144 | + const codes = (this.form.deductionTypes == null ? '' : String(this.form.deductionTypes)).split(',').filter(Boolean) | ||
| 145 | + const names = codes.map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE)).filter(Boolean) | ||
| 146 | + return names.length ? names.join('、') : '-' | ||
| 147 | + }, | ||
| 148 | + isBuyout() { | ||
| 149 | + return this.buyout || (this.applyList || []).length > 0 | ||
| 150 | + } | ||
| 151 | + }, | ||
| 152 | + created() { | ||
| 153 | + this.loadDicData() | ||
| 154 | + }, | ||
| 155 | + watch: { | ||
| 156 | + id: { | ||
| 157 | + immediate: true, | ||
| 158 | + handler(val) { | ||
| 159 | + const v = (val !== undefined && val !== null) ? String(val) : '' | ||
| 160 | + if (v) this.loadDetail(v) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + }, | ||
| 164 | + methods: { | ||
| 165 | + async loadDicData() { | ||
| 166 | + try { | ||
| 167 | + const results = await getDicByCodes(['TYPE', 'DEDUCTION_TYPE']) | ||
| 168 | + this.dicOptions.TYPE = (results.TYPE && results.TYPE.data) || [] | ||
| 169 | + this.dicOptions.DEDUCTION_TYPE = (results.DEDUCTION_TYPE && results.DEDUCTION_TYPE.data) || [] | ||
| 170 | + } catch (e) { | ||
| 171 | + this.dicOptions = { TYPE: [], DEDUCTION_TYPE: [] } | ||
| 172 | + } | ||
| 173 | + }, | ||
| 174 | + loadDetail(id) { | ||
| 175 | + weighTicketDetailApi({ id }) | ||
| 176 | + .then(res => { | ||
| 177 | + const data = res && res.data ? (res.data.data || res.data) : {} | ||
| 178 | + this.form = Object.assign({}, data) | ||
| 179 | + this.buyout = !!data.buyout | ||
| 180 | + this.planList = Array.isArray(data.planLines) ? data.planLines.map(x => ({ ...x })) : [] | ||
| 181 | + this.weighList = Array.isArray(data.weighLines) ? data.weighLines.map(x => ({ ...x })) : [] | ||
| 182 | + this.applyList = Array.isArray(data.applyLines) ? data.applyLines.map(x => ({ ...x })) : [] | ||
| 183 | + }) | ||
| 184 | + .catch(() => { | ||
| 185 | + uni.showToast({ title: '详情加载失败', icon: 'none' }) | ||
| 186 | + }) | ||
| 187 | + }, | ||
| 188 | + safeText(v) { | ||
| 189 | + const s = v == null ? '' : String(v) | ||
| 190 | + return s.trim() ? s : '-' | ||
| 191 | + }, | ||
| 192 | + formatNumber(v) { | ||
| 193 | + if (v === null || v === undefined || v === '') return '-' | ||
| 194 | + const n = Number(v) | ||
| 195 | + if (isNaN(n)) return String(v) | ||
| 196 | + return n.toLocaleString('zh-CN', { maximumFractionDigits: 4 }) | ||
| 197 | + }, | ||
| 198 | + formatDate(v) { | ||
| 199 | + const s = v == null ? '' : String(v).trim() | ||
| 200 | + if (!s) return '-' | ||
| 201 | + return s | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | +} | ||
| 205 | +</script> | ||
| 206 | + | ||
| 207 | +<style lang="scss" scoped> | ||
| 208 | +.detail-page { | ||
| 209 | + background: #f3f3f3; | ||
| 210 | + min-height: 100%; | ||
| 211 | +} | ||
| 212 | +.scroll { | ||
| 213 | + height: 100%; | ||
| 214 | +} | ||
| 215 | +.section { | ||
| 216 | + padding: 32rpx; | ||
| 217 | + background: #fff; | ||
| 218 | + margin-bottom: 20rpx; | ||
| 219 | +} | ||
| 220 | +.title-header { | ||
| 221 | + display: flex; | ||
| 222 | + align-items: center; | ||
| 223 | + padding: 24rpx 32rpx 12rpx; | ||
| 224 | + background-color: #ffffff; | ||
| 225 | + | ||
| 226 | + .title-header_icon { | ||
| 227 | + width: 36rpx; | ||
| 228 | + height: 36rpx; | ||
| 229 | + margin-right: 12rpx; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + span { | ||
| 233 | + font-size: 34rpx; | ||
| 234 | + font-weight: 600; | ||
| 235 | + color: rgba(0, 0, 0, 0.9); | ||
| 236 | + } | ||
| 237 | +} | ||
| 238 | +.row { | ||
| 239 | + display: flex; | ||
| 240 | + margin-bottom: 28rpx; | ||
| 241 | + | ||
| 242 | + &:last-child { | ||
| 243 | + margin-bottom: 0; | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + &.company { | ||
| 247 | + font-size: 36rpx; | ||
| 248 | + font-weight: 600; | ||
| 249 | + color: rgba(0, 0, 0, 0.9); | ||
| 250 | + padding-top: 8rpx; | ||
| 251 | + line-height: 50rpx; | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + .label { | ||
| 255 | + max-width: 420rpx; | ||
| 256 | + margin-right: 20rpx; | ||
| 257 | + line-height: 32rpx; | ||
| 258 | + font-size: 28rpx; | ||
| 259 | + color: rgba(0, 0, 0, 0.6); | ||
| 260 | + } | ||
| 261 | + | ||
| 262 | + .value { | ||
| 263 | + flex: 1; | ||
| 264 | + line-height: 32rpx; | ||
| 265 | + font-size: 28rpx; | ||
| 266 | + color: rgba(0, 0, 0, 0.9); | ||
| 267 | + text-align: right; | ||
| 268 | + word-break: break-all; | ||
| 269 | + } | ||
| 270 | +} | ||
| 271 | +.remark-text { | ||
| 272 | + font-size: 28rpx; | ||
| 273 | + color: rgba(0, 0, 0, 0.9); | ||
| 274 | + line-height: 1.6; | ||
| 275 | + white-space: pre-wrap; | ||
| 276 | +} | ||
| 277 | +.sub-table { | ||
| 278 | + background: #fff; | ||
| 279 | + margin-bottom: 20rpx; | ||
| 280 | +} | ||
| 281 | +.sub-header { | ||
| 282 | + display: flex; | ||
| 283 | + align-items: center; | ||
| 284 | + padding: 16rpx 0 16rpx 32rpx; | ||
| 285 | + | ||
| 286 | + .sub-bar { | ||
| 287 | + width: 6rpx; | ||
| 288 | + height: 32rpx; | ||
| 289 | + margin-right: 14rpx; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + .sub-title { | ||
| 293 | + font-size: 30rpx; | ||
| 294 | + font-weight: 600; | ||
| 295 | + color: rgba(0, 0, 0, 0.9); | ||
| 296 | + flex: 1; | ||
| 297 | + line-height: 42rpx; | ||
| 298 | + } | ||
| 299 | +} | ||
| 300 | +.sub-body { | ||
| 301 | + padding: 0 32rpx 24rpx; | ||
| 302 | + | ||
| 303 | + .empty-tip { | ||
| 304 | + text-align: center; | ||
| 305 | + padding: 60rpx 0; | ||
| 306 | + color: rgba(0, 0, 0, 0.4); | ||
| 307 | + font-size: 28rpx; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + .card { | ||
| 311 | + position: relative; | ||
| 312 | + background: #fafafa; | ||
| 313 | + border-radius: 12rpx; | ||
| 314 | + padding: 32rpx 28rpx 20rpx; | ||
| 315 | + margin-bottom: 24rpx; | ||
| 316 | + | ||
| 317 | + .card-index { | ||
| 318 | + position: absolute; | ||
| 319 | + top: 0; | ||
| 320 | + right: 0; | ||
| 321 | + background: rgba(24, 144, 255, 0.08); | ||
| 322 | + color: $theme-primary; | ||
| 323 | + font-size: 22rpx; | ||
| 324 | + line-height: 36rpx; | ||
| 325 | + padding: 0 16rpx; | ||
| 326 | + border-bottom-left-radius: 12rpx; | ||
| 327 | + border-top-right-radius: 12rpx; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + .row { | ||
| 331 | + align-items: center; | ||
| 332 | + justify-content: space-between; | ||
| 333 | + padding: 14rpx 0; | ||
| 334 | + margin-bottom: 0; | ||
| 335 | + border-bottom: 1rpx dashed #f2f2f2; | ||
| 336 | + | ||
| 337 | + &:last-child { | ||
| 338 | + border-bottom: none; | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + .label { | ||
| 342 | + flex-shrink: 0; | ||
| 343 | + width: 220rpx; | ||
| 344 | + max-width: none; | ||
| 345 | + margin-right: 0; | ||
| 346 | + font-size: 28rpx; | ||
| 347 | + color: rgba(0, 0, 0, 0.6); | ||
| 348 | + line-height: 40rpx; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + .value { | ||
| 352 | + flex: 1; | ||
| 353 | + text-align: right; | ||
| 354 | + font-size: 28rpx; | ||
| 355 | + color: rgba(0, 0, 0, 0.9); | ||
| 356 | + line-height: 40rpx; | ||
| 357 | + overflow: hidden; | ||
| 358 | + text-overflow: ellipsis; | ||
| 359 | + white-space: nowrap; | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | + } | ||
| 363 | +} | ||
| 364 | +</style> |
| @@ -27,8 +27,9 @@ import ConfirmationFormViewer from '@/pages/confirmation_form/viewer.vue' | @@ -27,8 +27,9 @@ import ConfirmationFormViewer from '@/pages/confirmation_form/viewer.vue' | ||
| 27 | import ConfirmationFormApprove from '@/pages/confirmation_form/approve.vue' | 27 | import ConfirmationFormApprove from '@/pages/confirmation_form/approve.vue' |
| 28 | import FollowUpFormViewer from '@/pages/follow_up_form/viewer.vue' | 28 | import FollowUpFormViewer from '@/pages/follow_up_form/viewer.vue' |
| 29 | import DomesticPlanViewer from '@/pages/domestic-plan/domesticPlanViewer.vue' | 29 | import DomesticPlanViewer from '@/pages/domestic-plan/domesticPlanViewer.vue' |
| 30 | -import DomesticAgreementViewer from '@/pages/domestic-agreement/domesticAgreementViewer.vue' | ||
| 31 | import SupplePlanViewer from '@/pages/supple-plan/supplePlanViewer.vue' | 30 | import SupplePlanViewer from '@/pages/supple-plan/supplePlanViewer.vue' |
| 31 | +import DomesticAgreementViewer from '@/pages/domestic-agreement/domesticAgreementViewer.vue' | ||
| 32 | +import WeightTicketViewer from '@/pages/weight-ticket/weightTicketViewer.vue' | ||
| 32 | 33 | ||
| 33 | export default function registerComponents(Vue) { | 34 | export default function registerComponents(Vue) { |
| 34 | Vue.component('CustomerDevelopViewer', CustomerDevelopViewer) | 35 | Vue.component('CustomerDevelopViewer', CustomerDevelopViewer) |
| @@ -60,6 +61,7 @@ export default function registerComponents(Vue) { | @@ -60,6 +61,7 @@ export default function registerComponents(Vue) { | ||
| 60 | Vue.component('ForeignDraftDistAgmtViewer', ForeignDraftDistAgmtViewer) | 61 | Vue.component('ForeignDraftDistAgmtViewer', ForeignDraftDistAgmtViewer) |
| 61 | Vue.component('AgmtViewer', AgmtViewer) | 62 | Vue.component('AgmtViewer', AgmtViewer) |
| 62 | Vue.component('DomesticPlanViewer', DomesticPlanViewer) | 63 | Vue.component('DomesticPlanViewer', DomesticPlanViewer) |
| 63 | - Vue.component('DomesticAgreementViewer', DomesticAgreementViewer) | ||
| 64 | Vue.component('SupplePlanViewer', SupplePlanViewer) | 64 | Vue.component('SupplePlanViewer', SupplePlanViewer) |
| 65 | + Vue.component('DomesticAgreementViewer', DomesticAgreementViewer) | ||
| 66 | + Vue.component('WeightTicketViewer', WeightTicketViewer) | ||
| 65 | } | 67 | } |
| @@ -142,16 +142,22 @@ export const getSysFlowComponentPath = (bizFlag) => { | @@ -142,16 +142,22 @@ export const getSysFlowComponentPath = (bizFlag) => { | ||
| 142 | case 'PROCUREMENT_PLAN_EDIT': // 采购计划 | 142 | case 'PROCUREMENT_PLAN_EDIT': // 采购计划 |
| 143 | componentPath = 'DomesticPlanViewer'; // 采购计划-审批 | 143 | componentPath = 'DomesticPlanViewer'; // 采购计划-审批 |
| 144 | break; | 144 | break; |
| 145 | + case 'PLAN_REPLENISH': // 补库计划 | ||
| 146 | + componentPath = 'SupplePlanViewer'; // 补库计划-审批详情 | ||
| 147 | + break; | ||
| 148 | + case 'PLAN_REPLENISH_EDIT': // 补库计划 | ||
| 149 | + componentPath = 'SupplePlanViewer'; // 补库计划-审批 | ||
| 145 | case 'PROCUREMENT_CONTRACT': // 内贸协议 | 150 | case 'PROCUREMENT_CONTRACT': // 内贸协议 |
| 146 | componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批详情 | 151 | componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批详情 |
| 147 | break; | 152 | break; |
| 148 | case 'PROCUREMENT_CONTRACT_EDIT': // 内贸协议 | 153 | case 'PROCUREMENT_CONTRACT_EDIT': // 内贸协议 |
| 149 | componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批 | 154 | componentPath = 'DomesticAgreementViewer'; // 内贸协议-审批 |
| 150 | - case 'PLAN_REPLENISH': // 补库计划 | ||
| 151 | - componentPath = 'SupplePlanViewer'; // 补库计划-审批详情 | ||
| 152 | break; | 155 | break; |
| 153 | - case 'PLAN_REPLENISH_EDIT': // 补库计划 | ||
| 154 | - componentPath = 'SupplePlanViewer'; // 补库计划-审批 | 156 | + case 'WEIGHING_RECORD': // 过磅码单 |
| 157 | + componentPath = 'WeightTicketViewer'; // 过磅码单-审批详情 | ||
| 158 | + break; | ||
| 159 | + case 'WEIGHING_RECORD_EDIT': // 过磅码单 | ||
| 160 | + componentPath = 'WeightTicketViewer'; // 过磅码单-审批 | ||
| 155 | break; | 161 | break; |
| 156 | } | 162 | } |
| 157 | return componentPath; | 163 | return componentPath; |