Commit e1b93902165c0dde6a4ef3755e387c8a070fd145

Authored by gesilong
2 parents e495364c aa75b2c4

Merge branch 'cjerp-3.0-fix' into test_cjerp

... ... @@ -8,7 +8,7 @@
8 8 </view>
9 9 <view class="body">
10 10 <view v-if="tab === 'base'">
11   - <component :is="componentName" :id="auditCtx.businessId" :node-code="nodeCode" ref="basicRef" />
  11 + <component :is="componentName" :id="auditCtx.businessId" :node-code="nodeCode" mode="audit" ref="basicRef" />
12 12 </view>
13 13 <view v-else>
14 14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" />
... ...
... ... @@ -8,7 +8,7 @@
8 8 </view>
9 9 <view class="body">
10 10 <view v-if="tab === 'base'">
11   - <component :is="componentName" :id="auditCtx.businessId" ref="basicRef" />
  11 + <component :is="componentName" :id="auditCtx.businessId" mode="detail" ref="basicRef" />
12 12 </view>
13 13 <view v-else>
14 14 <FlowTimeline :nodeList="nodeList" :isEnd="isEnd" />
... ...
... ... @@ -46,7 +46,7 @@
46 46 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
47 47 </template>
48 48 </uni-list-item>
49   - <uni-list-item title="数量">
  49 + <uni-list-item title="数量(kg)">
50 50 <template v-slot:footer>
51 51 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
52 52 </template>
... ... @@ -133,7 +133,7 @@
133 133 </template>
134 134 </uni-list-item>
135 135
136   - <uni-list-item title="过磅数">
  136 + <uni-list-item title="过磅数(kg)">
137 137 <template v-slot:footer>
138 138 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled />
139 139 </template>
... ... @@ -143,17 +143,17 @@
143 143 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" />
144 144 </template>
145 145 </uni-list-item>
146   - <uni-list-item title="折斤">
  146 + <uni-list-item title="折斤(kg)">
147 147 <template v-slot:footer>
148 148 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" />
149 149 </template>
150 150 </uni-list-item>
151   - <uni-list-item title="退料">
  151 + <uni-list-item title="退料(kg)">
152 152 <template v-slot:footer>
153 153 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" />
154 154 </template>
155 155 </uni-list-item>
156   - <uni-list-item title="入库净重">
  156 + <uni-list-item title="入库净重(kg)">
157 157 <template v-slot:footer>
158 158 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" />
159 159 </template>
... ... @@ -181,19 +181,19 @@
181 181 <view class="total-title">合计</view>
182 182 <view class="total-body">
183 183 <view class="total-item">
184   - <text class="total-label">过磅数</text>
  184 + <text class="total-label">过磅数(kg)</text>
185 185 <text class="total-value">{{ totalSummary.totalWeighQuantity || '-' }}</text>
186 186 </view>
187 187 <view class="total-item">
188   - <text class="total-label">折斤</text>
  188 + <text class="total-label">折斤(kg)</text>
189 189 <text class="total-value">{{ totalSummary.totalFoldWeight || '-' }}</text>
190 190 </view>
191 191 <view class="total-item">
192   - <text class="total-label">退料</text>
  192 + <text class="total-label">退料(kg)</text>
193 193 <text class="total-value">{{ totalSummary.totalReturnWeight || '-' }}</text>
194 194 </view>
195 195 <view class="total-item">
196   - <text class="total-label">入库净重</text>
  196 + <text class="total-label">入库净重(kg)</text>
197 197 <text class="total-value">{{ totalSummary.totalNetWeight || '-' }}</text>
198 198 </view>
199 199 </view>
... ...
... ... @@ -26,7 +26,7 @@
26 26 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
27 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 28 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
29   - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
  29 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
30 30 </view>
31 31 </view>
32 32 </view>
... ... @@ -49,11 +49,11 @@
49 49 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
50 50 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
51 51 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view>
52   - <view class="row"><text class="label">过磅数</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
  52 + <view class="row"><text class="label">过磅数(kg)</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
53 53 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view>
54   - <view class="row"><text class="label">折斤</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
55   - <view class="row"><text class="label">退料</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
56   - <view class="row"><text class="label">入库净重</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
  54 + <view class="row"><text class="label">折斤(kg)</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
  55 + <view class="row"><text class="label">退料(kg)</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
  56 + <view class="row"><text class="label">入库净重(kg)</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
57 57 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view>
58 58 </view>
59 59 </view>
... ... @@ -68,19 +68,19 @@
68 68 <view class="total-title">合计</view>
69 69 <view class="total-body">
70 70 <view class="total-item">
71   - <text class="total-label">过磅数</text>
  71 + <text class="total-label">过磅数(kg)</text>
72 72 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text>
73 73 </view>
74 74 <view class="total-item">
75   - <text class="total-label">折斤</text>
  75 + <text class="total-label">折斤(kg)</text>
76 76 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text>
77 77 </view>
78 78 <view class="total-item">
79   - <text class="total-label">退料</text>
  79 + <text class="total-label">退料(kg)</text>
80 80 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text>
81 81 </view>
82 82 <view class="total-item">
83   - <text class="total-label">入库净重</text>
  83 + <text class="total-label">入库净重(kg)</text>
84 84 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text>
85 85 </view>
86 86 </view>
... ...
... ... @@ -21,7 +21,7 @@
21 21 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
22 22 <view class="card-index">第 {{ idx + 1 }} 行</view>
23 23 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
24   - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
  24 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
25 25 </view>
26 26 </view>
27 27 </view>
... ... @@ -40,11 +40,11 @@
40 40 <view class="row"><text class="label">品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
41 41 <view class="row"><text class="label">类别</text><text class="value">{{ safeText(item.category) }}</text></view>
42 42 <view class="row"><text class="label">名称</text><text class="value">{{ safeText(item.name) }}</text></view>
43   - <view class="row"><text class="label">过磅数</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
  43 + <view class="row"><text class="label">过磅数(kg)</text><text class="value">{{ formatNumber(item.weighQuantity) }}</text></view>
44 44 <view class="row"><text class="label">杂率(%)</text><text class="value">{{ formatNumber(item.impurityRate) }}</text></view>
45   - <view class="row"><text class="label">折斤</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
46   - <view class="row"><text class="label">退料</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
47   - <view class="row"><text class="label">入库净重</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
  45 + <view class="row"><text class="label">折斤(kg)</text><text class="value">{{ formatNumber(item.foldWeight) }}</text></view>
  46 + <view class="row"><text class="label">退料(kg)</text><text class="value">{{ formatNumber(item.returnWeight) }}</text></view>
  47 + <view class="row"><text class="label">入库净重(kg)</text><text class="value">{{ formatNumber(item.netWeight) }}</text></view>
48 48 <view class="row"><text class="label">备注</text><text class="value">{{ safeText(item.remark) }}</text></view>
49 49 </view>
50 50 </view>
... ... @@ -59,19 +59,19 @@
59 59 <view class="total-title">合计</view>
60 60 <view class="total-body">
61 61 <view class="total-item">
62   - <text class="total-label">过磅数</text>
  62 + <text class="total-label">过磅数(kg)</text>
63 63 <text class="total-value">{{ formatNumber(form.totalWeighQuantity) }}</text>
64 64 </view>
65 65 <view class="total-item">
66   - <text class="total-label">折斤</text>
  66 + <text class="total-label">折斤(kg)</text>
67 67 <text class="total-value">{{ formatNumber(form.totalFoldWeight) }}</text>
68 68 </view>
69 69 <view class="total-item">
70   - <text class="total-label">退料</text>
  70 + <text class="total-label">退料(kg)</text>
71 71 <text class="total-value">{{ formatNumber(form.totalReturnWeight) }}</text>
72 72 </view>
73 73 <view class="total-item">
74   - <text class="total-label">入库净重</text>
  74 + <text class="total-label">入库净重(kg)</text>
75 75 <text class="total-value">{{ formatNumber(form.totalNetWeight) }}</text>
76 76 </view>
77 77 </view>
... ...
... ... @@ -45,7 +45,7 @@
45 45 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
46 46 </template>
47 47 </uni-list-item>
48   - <uni-list-item title="数量">
  48 + <uni-list-item title="数量(kg)">
49 49 <template v-slot:footer>
50 50 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
51 51 </template>
... ... @@ -132,7 +132,7 @@
132 132 </template>
133 133 </uni-list-item>
134 134
135   - <uni-list-item title="过磅数">
  135 + <uni-list-item title="过磅数(kg)">
136 136 <template v-slot:footer>
137 137 <uni-easyinput :value="item.weighQuantity" :inputBorder="false" disabled />
138 138 </template>
... ... @@ -142,17 +142,17 @@
142 142 <uni-easyinput v-model="item.impurityRate" type="digit" :inputBorder="false" placeholder="请输入杂率" />
143 143 </template>
144 144 </uni-list-item>
145   - <uni-list-item title="折斤">
  145 + <uni-list-item title="折斤(kg)">
146 146 <template v-slot:footer>
147 147 <uni-easyinput v-model="item.foldWeight" type="digit" :inputBorder="false" placeholder="请输入折斤" />
148 148 </template>
149 149 </uni-list-item>
150   - <uni-list-item title="退料">
  150 + <uni-list-item title="退料(kg)">
151 151 <template v-slot:footer>
152 152 <uni-easyinput v-model="item.returnWeight" type="digit" :inputBorder="false" placeholder="请输入退料" />
153 153 </template>
154 154 </uni-list-item>
155   - <uni-list-item title="入库净重">
  155 + <uni-list-item title="入库净重(kg)">
156 156 <template v-slot:footer>
157 157 <uni-easyinput v-model="item.netWeight" type="digit" :inputBorder="false" placeholder="请输入入库净重" />
158 158 </template>
... ...
... ... @@ -31,7 +31,7 @@
31 31 <text class="value">{{ row.category || '-' }}</text>
32 32 </view>
33 33 <view class="row">
34   - <text class="label">数量</text>
  34 + <text class="label">数量(kg)</text>
35 35 <text class="value">{{ row.quantity === null || row.quantity === undefined || row.quantity === '' ? '-' : row.quantity }}</text>
36 36 </view>
37 37
... ...
... ... @@ -31,7 +31,7 @@
31 31 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
32 32 <view class="card-index">第 {{ idx + 1 }} 行</view>
33 33 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
34   - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
  34 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
35 35 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
36 36 <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view>
37 37 <view v-for="key in componentKeys" :key="key" class="row">
... ...
... ... @@ -26,7 +26,7 @@
26 26 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
27 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 28 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
29   - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
  29 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
30 30 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
31 31 <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view>
32 32 <view v-for="key in componentKeys" :key="key" class="row">
... ... @@ -49,6 +49,20 @@
49 49 </view>
50 50 </template>
51 51
  52 + <!-- 审核意见(仅审核时展示,按流程顺序) -->
  53 + <template v-if="isAudit && opinionRows.length">
  54 + <view class="title-header">
  55 + <image class="title-header_icon" src="/static/images/title.png" />
  56 + <span>审核意见</span>
  57 + </view>
  58 + <view class="section opinion-section">
  59 + <view v-for="item in opinionRows" :key="item.key" class="opinion-item">
  60 + <view class="opinion-label">{{ item.label }}</view>
  61 + <textarea class="opinion-textarea" :value="item.opinion || '-'" disabled />
  62 + </view>
  63 + </view>
  64 + </template>
  65 +
52 66 <!-- 是否继续审批(assay_report_yfcckzg 节点必填) -->
53 67 <view v-if="showContinueApproval" class="section">
54 68 <view class="field-row">
... ... @@ -77,7 +91,9 @@ export default {
77 91 props: {
78 92 id: { type: [String, Number], default: '' },
79 93 // 当前审核节点编码(flow/audit 透传,flow/instance/getByBusinessId 返回)
80   - nodeCode: { type: String, default: '' }
  94 + nodeCode: { type: String, default: '' },
  95 + // 页面模式:audit-审核;detail-审核详情
  96 + mode: { type: String, default: 'detail' }
81 97 },
82 98 data() {
83 99 return {
... ... @@ -97,9 +113,13 @@ export default {
97 113 }
98 114 },
99 115 computed: {
100   - // assay_report_gyglkzg2 节点需填写 是否继续审批
  116 + // 是否审核页面
  117 + isAudit() {
  118 + return this.mode === 'audit'
  119 + },
  120 + // assay_report_gyglkzg2 节点需填写 是否继续审批(仅审核时展示)
101 121 showContinueApproval() {
102   - return this.nodeCode === 'assay_report_gyglkzg2'
  122 + return this.isAudit && this.nodeCode === 'assay_report_gyglkzg2'
103 123 },
104 124 componentKeys() {
105 125 // 按 workshopCode 匹配成分项,名称兜底
... ... @@ -117,6 +137,27 @@ export default {
117 137 const v = this.form.hasQualityProblem
118 138 return v === true || v === 1 || v === '1'
119 139 },
  140 + // 审核意见:按流程顺序(仓库主管 → 供应管理科主管 → 供应部主管 → 分厂主管)展示,缺失的节点不展示
  141 + opinionRows() {
  142 + const defs = [
  143 + { key: 'ckzg', label: '仓库主管', name: 'ckzgName', opinion: 'ckzgOpinion' },
  144 + { key: 'gyglkzg', label: '供应管理科主管', name: 'gyglkzgName', opinion: 'gyglkzgOpinion' },
  145 + { key: 'gybzg', label: '供应部主管', name: 'gybzgName', opinion: 'gybzgOpinion' },
  146 + { key: 'fczg', label: '分厂主管', name: 'fczgName', opinion: 'fczgOpinion' }
  147 + ]
  148 + return defs
  149 + .map(it => {
  150 + const person = this.form[it.name] == null ? '' : String(this.form[it.name]).trim()
  151 + const opinion = this.form[it.opinion] == null ? '' : String(this.form[it.opinion]).trim()
  152 + return {
  153 + key: it.key,
  154 + label: person ? `${it.label}:${person}` : it.label,
  155 + opinion,
  156 + visible: !!(person || opinion)
  157 + }
  158 + })
  159 + .filter(it => it.visible)
  160 + },
120 161 approvalStatusName() {
121 162 const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus)
122 163 if (!v) return '-'
... ... @@ -255,11 +296,40 @@ export default {
255 296 }
256 297 }
257 298
  299 +.opinion-section {
  300 + padding: 24rpx 32rpx;
  301 +
  302 + .opinion-item {
  303 + margin-bottom: 24rpx;
  304 +
  305 + &:last-child { margin-bottom: 0; }
  306 +
  307 + .opinion-label {
  308 + font-size: 28rpx;
  309 + color: rgba(0, 0, 0, 0.9);
  310 + line-height: 40rpx;
  311 + margin-bottom: 12rpx;
  312 + }
  313 +
  314 + .opinion-textarea {
  315 + width: 100%;
  316 + box-sizing: border-box;
  317 + height: 140rpx;
  318 + padding: 16rpx 20rpx;
  319 + background: #fafafa;
  320 + border: 1rpx solid #eee;
  321 + border-radius: 8rpx;
  322 + font-size: 28rpx;
  323 + line-height: 40rpx;
  324 + color: rgba(0, 0, 0, 0.9);
  325 + }
  326 + }
  327 +}
  328 +
258 329 .field-row {
259 330 display: flex;
260 331 align-items: center;
261 332 justify-content: space-between;
262   -
263 333 .field-label {
264 334 flex: none;
265 335 font-size: 32rpx;
... ...
... ... @@ -27,7 +27,7 @@
27 27 <view v-for="(item, idx) in lineRows" :key="'l-' + (item.assayApplyId || idx)" class="card">
28 28 <view class="card-index">第 {{ idx + 1 }} 行</view>
29 29 <view class="row"><text class="label">样品</text><text class="value">{{ safeText(item.productName) }}</text></view>
30   - <view class="row"><text class="label">数量</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
  30 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
31 31 <view class="row"><text class="label">样号</text><text class="value">{{ safeText(item.testCode) }}</text></view>
32 32 <view class="row"><text class="label">送样编号</text><text class="value">{{ safeText(item.assayApplyCode) }}</text></view>
33 33 <view v-for="key in componentKeys" :key="key" class="row">
... ...
... ... @@ -46,7 +46,7 @@
46 46 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
47 47 </template>
48 48 </uni-list-item>
49   - <uni-list-item title="买断数量">
  49 + <uni-list-item title="买断数量(kg)">
50 50 <template v-slot:footer>
51 51 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled />
52 52 </template>
... ... @@ -63,7 +63,7 @@
63 63 </uni-list-item>
64 64 <uni-list-item>
65 65 <template v-slot:body>
66   - <view class="item-title"><text class="required">*</text><text>入库数量</text></view>
  66 + <view class="item-title"><text class="required">*</text><text>入库数量(kg)</text></view>
67 67 </template>
68 68 <template v-slot:footer>
69 69 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" />
... ... @@ -118,7 +118,7 @@
118 118 <view class="total-title">合计</view>
119 119 <view class="total-body">
120 120 <view class="total-item">
121   - <text class="total-label">买断数量</text>
  121 + <text class="total-label">买断数量(kg)</text>
122 122 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text>
123 123 </view>
124 124 <view class="total-item">
... ... @@ -126,7 +126,7 @@
126 126 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text>
127 127 </view>
128 128 <view class="total-item">
129   - <text class="total-label">入库数量</text>
  129 + <text class="total-label">入库数量(kg)</text>
130 130 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text>
131 131 </view>
132 132 <view class="total-item">
... ...
... ... @@ -26,10 +26,10 @@
26 26 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card">
27 27 <view class="card-index">第 {{ idx + 1 }} 行</view>
28 28 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
29   - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
  29 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
30 30 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view>
31 31 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view>
32   - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
  32 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
33 33 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view>
34 34 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view>
35 35 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view>
... ... @@ -46,9 +46,9 @@
46 46 <span>合计</span>
47 47 </view>
48 48 <view class="section">
49   - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(form.totalBuyoutQuantity) }}</text></view>
  49 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(form.totalBuyoutQuantity) }}</text></view>
50 50 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(form.totalBuyoutAmount) }}</text></view>
51   - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(form.totalInstockQuantity) }}</text></view>
  51 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(form.totalInstockQuantity) }}</text></view>
52 52 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(form.totalInstockAmount) }}</text></view>
53 53 <view class="row"><text class="label">差异金额</text><text class="value">{{ formatNumber(form.totalDiffAmount) }}</text></view>
54 54 </view>
... ...
... ... @@ -45,7 +45,7 @@
45 45 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
46 46 </template>
47 47 </uni-list-item>
48   - <uni-list-item title="买断数量">
  48 + <uni-list-item title="买断数量(kg)">
49 49 <template v-slot:footer>
50 50 <uni-easyinput :value="item.buyoutQuantity" :inputBorder="false" disabled />
51 51 </template>
... ... @@ -62,7 +62,7 @@
62 62 </uni-list-item>
63 63 <uni-list-item>
64 64 <template v-slot:body>
65   - <view class="item-title"><text class="required">*</text><text>入库数量</text></view>
  65 + <view class="item-title"><text class="required">*</text><text>入库数量(kg)</text></view>
66 66 </template>
67 67 <template v-slot:footer>
68 68 <uni-easyinput v-model="item.instockQuantity" type="digit" :inputBorder="false" placeholder="请输入入库数量" @input="recalcDiffAmount(item)" />
... ... @@ -117,7 +117,7 @@
117 117 <view class="total-title">合计</view>
118 118 <view class="total-body">
119 119 <view class="total-item">
120   - <text class="total-label">买断数量</text>
  120 + <text class="total-label">买断数量(kg)</text>
121 121 <text class="total-value">{{ totalSummary.totalBuyoutQuantity || '-' }}</text>
122 122 </view>
123 123 <view class="total-item">
... ... @@ -125,7 +125,7 @@
125 125 <text class="total-value">{{ totalSummary.totalBuyoutAmount || '-' }}</text>
126 126 </view>
127 127 <view class="total-item">
128   - <text class="total-label">入库数量</text>
  128 + <text class="total-label">入库数量(kg)</text>
129 129 <text class="total-value">{{ totalSummary.totalInstockQuantity || '-' }}</text>
130 130 </view>
131 131 <view class="total-item">
... ...
... ... @@ -21,10 +21,10 @@
21 21 <view v-for="(item, idx) in lineList" :key="'l-' + (item.id || idx)" class="card">
22 22 <view class="card-index">第 {{ idx + 1 }} 行</view>
23 23 <view class="row"><text class="label">买断品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
24   - <view class="row"><text class="label">买断数量</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
  24 + <view class="row"><text class="label">买断数量(kg)</text><text class="value">{{ formatNumber(item.buyoutQuantity) }}</text></view>
25 25 <view class="row"><text class="label">买断单价</text><text class="value">{{ formatNumber(item.buyoutPrice) }}</text></view>
26 26 <view class="row"><text class="label">买断金额</text><text class="value">{{ formatNumber(item.buyoutAmount) }}</text></view>
27   - <view class="row"><text class="label">入库数量</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
  27 + <view class="row"><text class="label">入库数量(kg)</text><text class="value">{{ formatNumber(item.instockQuantity) }}</text></view>
28 28 <view class="row"><text class="label">入库单价</text><text class="value">{{ formatNumber(item.instockPrice) }}</text></view>
29 29 <view class="row"><text class="label">入库金额</text><text class="value">{{ formatNumber(item.instockAmount) }}</text></view>
30 30 <view class="row"><text class="label">预计吨损耗(元/吨)</text><text class="value">{{ formatNumber(item.expectTonLoss) }}</text></view>
... ... @@ -44,7 +44,7 @@
44 44 <view class="total-title">合计</view>
45 45 <view class="total-body">
46 46 <view class="total-item">
47   - <text class="total-label">买断数量</text>
  47 + <text class="total-label">买断数量(kg)</text>
48 48 <text class="total-value">{{ formatNumber(form.totalBuyoutQuantity) }}</text>
49 49 </view>
50 50 <view class="total-item">
... ... @@ -52,7 +52,7 @@
52 52 <text class="total-value">{{ formatNumber(form.totalBuyoutAmount) }}</text>
53 53 </view>
54 54 <view class="total-item">
55   - <text class="total-label">入库数量</text>
  55 + <text class="total-label">入库数量(kg)</text>
56 56 <text class="total-value">{{ formatNumber(form.totalInstockQuantity) }}</text>
57 57 </view>
58 58 <view class="total-item">
... ...
... ... @@ -63,7 +63,7 @@
63 63 </uni-list-item>
64 64 <uni-list-item>
65 65 <template v-slot:body>
66   - <view class="item-title"><text class="required">*</text><text>数量(采购数)</text></view>
  66 + <view class="item-title"><text class="required">*</text><text>数量(采购数kg)</text></view>
67 67 </template>
68 68 <template v-slot:footer>
69 69 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" />
... ... @@ -71,7 +71,7 @@
71 71 </uni-list-item>
72 72 <uni-list-item>
73 73 <template v-slot:body>
74   - <view class="item-title"><text class="required">*</text><text>数量(实收数)</text></view>
  74 + <view class="item-title"><text class="required">*</text><text>数量(实收数kg)</text></view>
75 75 </template>
76 76 <template v-slot:footer>
77 77 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" />
... ... @@ -115,11 +115,11 @@
115 115 <view class="total-title">合计</view>
116 116 <view class="total-body">
117 117 <view class="total-item">
118   - <text class="total-label">采购数</text>
  118 + <text class="total-label">采购数(kg)</text>
119 119 <text class="total-value">{{ purchaseQuantityCap }}</text>
120 120 </view>
121 121 <view class="total-item">
122   - <text class="total-label">实收数</text>
  122 + <text class="total-label">实收数(kg)</text>
123 123 <text class="total-value">{{ totalActualQuantity || '-' }}</text>
124 124 </view>
125 125 <view class="total-item">
... ... @@ -143,9 +143,9 @@
143 143
144 144 <!-- 附件 -->
145 145 <view class="form-group">
146   - <view class="item-title"><text class="required">*</text><text>附件</text></view>
  146 + <view class="item-title"><text>附件</text></view>
147 147 <view class="upload-btn" @click="selectFile">上传文件</view>
148   - <view v-if="!fileList.length" class="empty-tip">请上传附件</view>
  148 + <view v-if="!fileList.length" class="empty-tip">暂无附件</view>
149 149 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item">
150 150 <text class="file-name">{{ file.fileName || '未命名文件' }}</text>
151 151 <text class="file-del" @click="removeFile(idx)">删除</text>
... ... @@ -442,7 +442,6 @@ export default {
442 442 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`)
443 443 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`)
444 444 }
445   - if (!this.fileList.length) return this.tip('请上传附件')
446 445 return true
447 446 },
448 447 tip(msg) {
... ...
... ... @@ -29,8 +29,8 @@
29 29 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view>
30 30 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view>
31 31 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view>
32   - <view class="row"><text class="label">数量(采购数)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
33   - <view class="row"><text class="label">数量(实收数)</text><text class="value">{{ formatNumber(item.actualQuantity) }}</text></view>
  32 + <view class="row"><text class="label">数量(采购数kg)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
  33 + <view class="row"><text class="label">数量(实收数kg)</text><text class="value">{{ formatNumber(item.actualQuantity) }}</text></view>
34 34 <view class="row"><text class="label">含税价格(单价)</text><text class="value">{{ formatNumber(item.taxPrice) }}</text></view>
35 35 <view class="row"><text class="label">含税价格(金额)</text><text class="value">{{ formatNumber(item.taxAmount) }}</text></view>
36 36 <view class="row"><text class="label">不含税价格(单价)</text><text class="value">{{ formatNumber(item.noTaxPrice) }}</text></view>
... ... @@ -44,11 +44,11 @@
44 44 <view class="total-title">合计</view>
45 45 <view class="total-body">
46 46 <view class="total-item">
47   - <text class="total-label">采购数</text>
  47 + <text class="total-label">采购数(kg)</text>
48 48 <text class="total-value">{{ purchaseQuantityCap }}</text>
49 49 </view>
50 50 <view class="total-item">
51   - <text class="total-label">实收数</text>
  51 + <text class="total-label">实收数(kg)</text>
52 52 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text>
53 53 </view>
54 54 <view class="total-item">
... ...
... ... @@ -62,7 +62,7 @@
62 62 </uni-list-item>
63 63 <uni-list-item>
64 64 <template v-slot:body>
65   - <view class="item-title"><text class="required">*</text><text>数量(采购数)</text></view>
  65 + <view class="item-title"><text class="required">*</text><text>数量(采购数kg)</text></view>
66 66 </template>
67 67 <template v-slot:footer>
68 68 <uni-easyinput v-model="item.purchaseQuantity" type="digit" :inputBorder="false" placeholder="请输入采购数" @input="recalcTaxAmount(item)" />
... ... @@ -70,7 +70,7 @@
70 70 </uni-list-item>
71 71 <uni-list-item>
72 72 <template v-slot:body>
73   - <view class="item-title"><text class="required">*</text><text>数量(实收数)</text></view>
  73 + <view class="item-title"><text class="required">*</text><text>数量(实收数kg)</text></view>
74 74 </template>
75 75 <template v-slot:footer>
76 76 <uni-easyinput v-model="item.actualQuantity" type="digit" :inputBorder="false" placeholder="请输入实收数" />
... ... @@ -114,11 +114,11 @@
114 114 <view class="total-title">合计</view>
115 115 <view class="total-body">
116 116 <view class="total-item">
117   - <text class="total-label">采购数</text>
  117 + <text class="total-label">采购数(kg)</text>
118 118 <text class="total-value">{{ purchaseQuantityCap }}</text>
119 119 </view>
120 120 <view class="total-item">
121   - <text class="total-label">实收数</text>
  121 + <text class="total-label">实收数(kg)</text>
122 122 <text class="total-value">{{ totalActualQuantity || '-' }}</text>
123 123 </view>
124 124 <view class="total-item">
... ... @@ -142,9 +142,9 @@
142 142
143 143 <!-- 附件 -->
144 144 <view class="form-group">
145   - <view class="item-title"><text class="required">*</text><text>附件</text></view>
  145 + <view class="item-title"><text>附件</text></view>
146 146 <view class="upload-btn" @click="selectFile">上传文件</view>
147   - <view v-if="!fileList.length" class="empty-tip">请上传附件</view>
  147 + <view v-if="!fileList.length" class="empty-tip">暂无附件</view>
148 148 <view v-for="(file, idx) in fileList" :key="file.fileId || idx" class="file-item">
149 149 <text class="file-name">{{ file.fileName || '未命名文件' }}</text>
150 150 <text class="file-del" @click="removeFile(idx)">删除</text>
... ... @@ -369,7 +369,6 @@ export default {
369 369 if (row.actualQuantity === '' || row.actualQuantity == null) return this.tip(`明细第${i + 1}行:请输入实收数`)
370 370 if (row.taxPrice === '' || row.taxPrice == null) return this.tip(`明细第${i + 1}行:请输入含税单价`)
371 371 }
372   - if (!this.fileList.length) return this.tip('请上传附件')
373 372 return true
374 373 },
375 374 tip(msg) {
... ...
... ... @@ -24,9 +24,9 @@
24 24 <view class="row"><text class="label">材料名称</text><text class="value">{{ safeText(item.name) }}</text></view>
25 25 <view class="row"><text class="label">规格型号</text><text class="value">{{ safeText(item.specModel) }}</text></view>
26 26 <view class="row"><text class="label">单位</text><text class="value">{{ safeText(item.unit) }}</text></view>
27   - <view class="row"><text class="label">数量(采购数)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
  27 + <view class="row"><text class="label">数量(采购数kg)</text><text class="value">{{ formatNumber(item.purchaseQuantity) }}</text></view>
28 28 <view class="row actual-row">
29   - <view class="label"><text v-if="canEditActualQuantity" class="required">*</text><text>数量(实收数)</text></view>
  29 + <view class="label"><text v-if="canEditActualQuantity" class="required">*</text><text>数量(实收数kg)</text></view>
30 30 <view class="actual-value">
31 31 <uni-easyinput v-if="canEditActualQuantity" v-model="item.actualQuantity" type="digit"
32 32 :inputBorder="false" placeholder="请输入实收数" />
... ... @@ -50,11 +50,11 @@
50 50 <view class="total-title">合计</view>
51 51 <view class="total-body">
52 52 <view class="total-item">
53   - <text class="total-label">采购数</text>
  53 + <text class="total-label">采购数(kg)</text>
54 54 <text class="total-value">{{ purchaseQuantityCap }}</text>
55 55 </view>
56 56 <view class="total-item">
57   - <text class="total-label">实收数</text>
  57 + <text class="total-label">实收数(kg)</text>
58 58 <text class="total-value">{{ formatNumber(form.totalActualQuantity) }}</text>
59 59 </view>
60 60 <view class="total-item">
... ...
... ... @@ -79,7 +79,7 @@
79 79 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
80 80 </template>
81 81 </uni-list-item>
82   - <uni-list-item title="计划数量">
  82 + <uni-list-item title="计划数量(kg)">
83 83 <template v-slot:footer>
84 84 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
85 85 </template>
... ... @@ -135,7 +135,7 @@
135 135 </uni-list-item>
136 136 <uni-list-item title="过磅数量">
137 137 <template v-slot:body>
138   - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view>
  138 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
139 139 </template>
140 140 <template v-slot:footer>
141 141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
... ... @@ -179,7 +179,7 @@
179 179 </uni-list-item>
180 180 <uni-list-item title="数量">
181 181 <template v-slot:body>
182   - <view class="item-title"><text class="required">*</text><text>数量</text></view>
  182 + <view class="item-title"><text class="required">*</text><text>数量(kg)</text></view>
183 183 </template>
184 184 <template v-slot:footer>
185 185 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" />
... ... @@ -210,7 +210,7 @@
210 210 </uni-list-item>
211 211 <uni-list-item>
212 212 <template v-slot:body>
213   - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view>
  213 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
214 214 </template>
215 215 <template v-slot:footer>
216 216 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
... ... @@ -218,13 +218,13 @@
218 218 </uni-list-item>
219 219 <uni-list-item>
220 220 <template v-slot:body>
221   - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view>
  221 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
222 222 </template>
223 223 <template v-slot:footer>
224 224 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
225 225 </template>
226 226 </uni-list-item>
227   - <uni-list-item title="货物净重">
  227 + <uni-list-item title="货物净重(kg)">
228 228 <template v-slot:footer>
229 229 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
230 230 </template>
... ... @@ -251,7 +251,16 @@
251 251 <uni-list>
252 252 <uni-list-item>
253 253 <template v-slot:body>
254   - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view>
  254 + <view class="item-title"><text>来料类型备注</text></view>
  255 + </template>
  256 + <template v-slot:footer>
  257 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark"
  258 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  259 + </template>
  260 + </uni-list-item>
  261 + <uni-list-item>
  262 + <template v-slot:body>
  263 + <view class="item-title"><text>供应存欠料</text></view>
255 264 </template>
256 265 <template v-slot:footer>
257 266 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
... ... @@ -259,7 +268,7 @@
259 268 </uni-list-item>
260 269 <uni-list-item>
261 270 <template v-slot:body>
262   - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view>
  271 + <view class="item-title"><text>物流存欠料</text></view>
263 272 </template>
264 273 <template v-slot:footer>
265 274 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
... ... @@ -319,7 +328,7 @@ import {
319 328 weighTicketCreateApi
320 329 } from '@/api/procure-manage/weighTicket.js'
321 330 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
322   -import { getDicByCodes, getDicName } from '@/utils/dic.js'
  331 +import { getDicByCodes } from '@/utils/dic.js'
323 332
324 333 export default {
325 334 name: 'AddWeightTicket',
... ... @@ -336,6 +345,7 @@ export default {
336 345 totalGrossWeight: '',
337 346 actualImpurityWeight: '',
338 347 deductionTypes: [],
  348 + deductionTypeRemark: '',
339 349 supplierStockMaterial: '',
340 350 logisticsStockMaterial: '',
341 351 plateNumber: '',
... ... @@ -420,6 +430,14 @@ export default {
420 430 if (net === '' || net === null || net === undefined) return ''
421 431 return numberToChineseUpper(net)
422 432 },
  433 + // 过磅数量合计
  434 + weightQuantityTotal() {
  435 + const total = (this.weighList || []).reduce((sum, item) => {
  436 + const qty = Number(item.quantity)
  437 + return sum + (isNaN(qty) ? 0 : qty)
  438 + }, 0)
  439 + return Math.round(total * 100) / 100
  440 + },
423 441 // 业务摘要
424 442 computedBusinessSummary() {
425 443 const parts = []
... ... @@ -432,10 +450,9 @@ export default {
432 450 })
433 451 .filter(text => !!text)
434 452 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('、'))
  453 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  454 + const deductionSegment = (this.form.deductionTypeRemark || '').trim()
  455 + if (deductionSegment) parts.push(deductionSegment)
439 456 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
440 457 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
441 458 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
... ... @@ -448,6 +465,15 @@ export default {
448 465 return [summary, note].filter(text => !!text).join('\n')
449 466 }
450 467 },
  468 + watch: {
  469 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  470 + 'form.deductionTypes': {
  471 + deep: true,
  472 + handler(list) {
  473 + this.syncDeductionRemark(list)
  474 + }
  475 + }
  476 + },
451 477 created() {
452 478 this.planSheet.fetchFn = this.fetchPlans.bind(this)
453 479 this.loadDicData()
... ... @@ -494,6 +520,31 @@ export default {
494 520 })
495 521 .catch(() => {})
496 522 },
  523 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  524 + syncDeductionRemark(list) {
  525 + const selected = (list || []).map(code => String(code))
  526 + const names = this.deductionTypeOptions
  527 + .filter(it => selected.includes(it.value))
  528 + .map(it => it.text)
  529 + .filter(name => !!name)
  530 + const segments = (this.form.deductionTypeRemark || '')
  531 + .split('、')
  532 + .map(text => text.trim())
  533 + .filter(text => !!text)
  534 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  535 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  536 + const matched = []
  537 + segments.forEach(text => {
  538 + const name = sortedNames.find(item => text.startsWith(item))
  539 + if (!name) return
  540 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  541 + })
  542 + const result = names.map(name => {
  543 + const found = matched.find(item => item.name === name)
  544 + return found ? found.text : name
  545 + })
  546 + this.form.deductionTypeRemark = result.join('、')
  547 + },
497 548 // 计划选择弹窗数据源
498 549 fetchPlans({ pageIndex, pageSize, extra }) {
499 550 const keyword = (extra && extra.keyword) || ''
... ... @@ -563,11 +614,16 @@ export default {
563 614 row.productName = ''
564 615 row.invoiceProductName = ''
565 616 },
  617 + // 当前行可选的品种(同一计划下已被其他行选中的品种不再展示)
  618 + getWeightProductOptions(item) {
  619 + const used = (this.weighList || [])
  620 + .filter(row => row !== item && row.planCode === item.planCode && row.productId && row.productId !== item.productId)
  621 + .map(row => row.productId)
  622 + return (this.planList || []).filter(it => it.planCode === item.planCode && !used.includes(it.productId))
  623 + },
566 624 // 当前计划编号下的品种选项
567 625 getWeightProductLabels(item) {
568   - return (this.planList || [])
569   - .filter(it => it.planCode === item.planCode)
570   - .map(it => it.productName || '')
  626 + return this.getWeightProductOptions(item).map(it => it.productName || '')
571 627 },
572 628 getWeightProductLabel(item) {
573 629 if (!item.productId) return ''
... ... @@ -577,7 +633,7 @@ export default {
577 633 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号)
578 634 handleWeightProductChange(idx, optIdx) {
579 635 const row = this.weighList[idx]
580   - const options = (this.planList || []).filter(it => it.planCode === row.planCode)
  636 + const options = this.getWeightProductOptions(row)
581 637 const raw = options[optIdx]
582 638 if (!raw) return
583 639 this.weighList.splice(idx, 1, {
... ... @@ -629,8 +685,8 @@ export default {
629 685 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
630 686 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
631 687 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
632   - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
633   - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
  688 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  689 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
634 690 if (!f.plateNumber) return this.tip('请输入车牌号')
635 691 // 过磅明细:计划编号、品种、数量必填
636 692 const weightList = this.weighList || []
... ... @@ -689,12 +745,24 @@ export default {
689 745 documentRemark: this.computedDocumentRemark || null
690 746 }
691 747 },
  748 + // 过磅数量合计与货物净重不一致时二次确认
  749 + async confirmQuantityMismatch() {
  750 + const net = this.computedNetWeight
  751 + if (net === '' || net === null || net === undefined) return true
  752 + const netNum = Math.round(Number(net) * 100) / 100
  753 + if (this.weightQuantityTotal === netNum) return true
  754 + const res = await new Promise(resolve => {
  755 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  756 + })
  757 + return !!(res && res.confirm)
  758 + },
692 759 async onSubmit() {
693 760 if (!this.validate()) return
694 761 const confirmRes = await new Promise(resolve => {
695 762 uni.showModal({ title: '提示', content: '确定保存过磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve })
696 763 })
697 764 if (!(confirmRes && confirmRes.confirm)) return
  765 + if (!(await this.confirmQuantityMismatch())) return
698 766 uni.showLoading({ title: '提交中...', mask: true })
699 767 weighTicketCreateApi(this.buildSubmitData())
700 768 .then(() => {
... ... @@ -1050,6 +1118,12 @@ function numberToChineseUpper(num) {
1050 1118 }
1051 1119 }
1052 1120
  1121 +// 来料类型备注:textarea 占满剩余宽度
  1122 +.deduction-remark-input {
  1123 + flex: 1;
  1124 + width: 100%;
  1125 +}
  1126 +
1053 1127 .remark-group {
1054 1128 margin-bottom: 32rpx;
1055 1129
... ...
... ... @@ -29,7 +29,7 @@
29 29 <view class="card-index">第 {{ idx + 1 }} 行</view>
30 30 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
31 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>
  32 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
33 33 </view>
34 34 </view>
35 35 </view>
... ... @@ -51,7 +51,7 @@
51 51 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
52 52 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
53 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>
  54 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
55 55 </view>
56 56 </view>
57 57 </view>
... ... @@ -71,7 +71,7 @@
71 71 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
72 72 <view class="card-index">第 {{ idx + 1 }} 行</view>
73 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>
  74 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
75 75 </view>
76 76 </view>
77 77 </view>
... ... @@ -83,9 +83,9 @@
83 83 </view>
84 84 <view class="section">
85 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>
  86 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  87 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  88 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
89 89 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view>
90 90 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view>
91 91 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view>
... ...
... ... @@ -72,7 +72,7 @@
72 72 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
73 73 </template>
74 74 </uni-list-item>
75   - <uni-list-item title="计划数量">
  75 + <uni-list-item title="计划数量(kg)">
76 76 <template v-slot:footer>
77 77 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
78 78 </template>
... ... @@ -133,9 +133,9 @@
133 133 <uni-easyinput v-model="item.invoiceProductName" :inputBorder="false" disabled />
134 134 </template>
135 135 </uni-list-item>
136   - <uni-list-item title="过磅数量">
  136 + <uni-list-item title="过磅数量(kg)">
137 137 <template v-slot:body>
138   - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view>
  138 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
139 139 </template>
140 140 <template v-slot:footer>
141 141 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
... ... @@ -180,7 +180,7 @@
180 180 </uni-list-item>
181 181 <uni-list-item title="数量">
182 182 <template v-slot:body>
183   - <view class="item-title"><text class="required">*</text><text>数量</text></view>
  183 + <view class="item-title"><text class="required">*</text><text>数量(kg)</text></view>
184 184 </template>
185 185 <template v-slot:footer>
186 186 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" :disabled="isReweigh" />
... ... @@ -211,7 +211,7 @@
211 211 </uni-list-item>
212 212 <uni-list-item>
213 213 <template v-slot:body>
214   - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view>
  214 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
215 215 </template>
216 216 <template v-slot:footer>
217 217 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
... ... @@ -219,13 +219,13 @@
219 219 </uni-list-item>
220 220 <uni-list-item>
221 221 <template v-slot:body>
222   - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view>
  222 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
223 223 </template>
224 224 <template v-slot:footer>
225 225 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
226 226 </template>
227 227 </uni-list-item>
228   - <uni-list-item title="货物净重">
  228 + <uni-list-item title="货物净重(kg)">
229 229 <template v-slot:footer>
230 230 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
231 231 </template>
... ... @@ -252,7 +252,16 @@
252 252 <uni-list>
253 253 <uni-list-item>
254 254 <template v-slot:body>
255   - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view>
  255 + <view class="item-title"><text>来料类型备注</text></view>
  256 + </template>
  257 + <template v-slot:footer>
  258 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark"
  259 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  260 + </template>
  261 + </uni-list-item>
  262 + <uni-list-item>
  263 + <template v-slot:body>
  264 + <view class="item-title"><text>供应存欠料</text></view>
256 265 </template>
257 266 <template v-slot:footer>
258 267 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
... ... @@ -260,7 +269,7 @@
260 269 </uni-list-item>
261 270 <uni-list-item>
262 271 <template v-slot:body>
263   - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view>
  272 + <view class="item-title"><text>物流存欠料</text></view>
264 273 </template>
265 274 <template v-slot:footer>
266 275 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
... ... @@ -320,7 +329,7 @@ import {
320 329 weighTicketUpdateApi
321 330 } from '@/api/procure-manage/weighTicket.js'
322 331 import { breedRelationshipQueryApi } from '@/api/procure-manage/salesmanQuotation.js'
323   -import { getDicByCodes, getDicName } from '@/utils/dic.js'
  332 +import { getDicByCodes } from '@/utils/dic.js'
324 333
325 334 export default {
326 335 name: 'ModifyWeightTicket',
... ... @@ -338,6 +347,7 @@ export default {
338 347 totalGrossWeight: '',
339 348 actualImpurityWeight: '',
340 349 deductionTypes: [],
  350 + deductionTypeRemark: '',
341 351 supplierStockMaterial: '',
342 352 logisticsStockMaterial: '',
343 353 plateNumber: '',
... ... @@ -426,6 +436,14 @@ export default {
426 436 if (net === '' || net === null || net === undefined) return ''
427 437 return numberToChineseUpper(net)
428 438 },
  439 + // 过磅数量合计
  440 + weightQuantityTotal() {
  441 + const total = (this.weighList || []).reduce((sum, item) => {
  442 + const qty = Number(item.quantity)
  443 + return sum + (isNaN(qty) ? 0 : qty)
  444 + }, 0)
  445 + return Math.round(total * 100) / 100
  446 + },
429 447 // 业务摘要
430 448 computedBusinessSummary() {
431 449 const parts = []
... ... @@ -438,10 +456,9 @@ export default {
438 456 })
439 457 .filter(text => !!text)
440 458 if (weightItems.length) parts.push(weightItems.join('、'))
441   - const deductionNames = (this.form.deductionTypes || [])
442   - .map(code => getDicName('DEDUCTION_TYPE', code, this.dicOptions.DEDUCTION_TYPE))
443   - .filter(name => !!name)
444   - if (deductionNames.length) parts.push(deductionNames.join('、'))
  459 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  460 + const deductionSegment = (this.form.deductionTypeRemark || '').trim()
  461 + if (deductionSegment) parts.push(deductionSegment)
445 462 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
446 463 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
447 464 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
... ... @@ -454,14 +471,23 @@ export default {
454 471 return [summary, note].filter(text => !!text).join('\n')
455 472 }
456 473 },
  474 + watch: {
  475 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  476 + 'form.deductionTypes': {
  477 + deep: true,
  478 + handler(list) {
  479 + this.syncDeductionRemark(list)
  480 + }
  481 + }
  482 + },
457 483 onLoad(query) {
458 484 this.id = (query && query.id) || ''
459 485 },
460 486 created() {
461 487 this.planSheet.fetchFn = this.fetchPlans.bind(this)
462   - this.loadDicData()
463 488 this.loadVarietyOptions()
464   - this.loadDetail()
  489 + // 先加载字典,再回显详情,保证来料类型备注能正确解析
  490 + this.loadDicData().finally(() => this.loadDetail())
465 491 },
466 492 methods: {
467 493 async loadDicData() {
... ... @@ -482,6 +508,53 @@ export default {
482 508 this.varietyOptions = []
483 509 }
484 510 },
  511 + // 当前已选扣杂类型的名称
  512 + getSelectedDeductionNames() {
  513 + const selected = (this.form.deductionTypes || []).map(code => String(code))
  514 + return this.deductionTypeOptions
  515 + .filter(it => selected.includes(it.value))
  516 + .map(it => it.text)
  517 + .filter(name => !!name)
  518 + },
  519 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  520 + syncDeductionRemark(list) {
  521 + const selected = (list || []).map(code => String(code))
  522 + const names = this.deductionTypeOptions
  523 + .filter(it => selected.includes(it.value))
  524 + .map(it => it.text)
  525 + .filter(name => !!name)
  526 + const segments = (this.form.deductionTypeRemark || '')
  527 + .split('、')
  528 + .map(text => text.trim())
  529 + .filter(text => !!text)
  530 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  531 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  532 + const matched = []
  533 + segments.forEach(text => {
  534 + const name = sortedNames.find(item => text.startsWith(item))
  535 + if (!name) return
  536 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  537 + })
  538 + const result = names.map(name => {
  539 + const found = matched.find(item => item.name === name)
  540 + return found ? found.text : name
  541 + })
  542 + this.form.deductionTypeRemark = result.join('、')
  543 + },
  544 + // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注
  545 + extractDeductionRemark(businessSummary) {
  546 + const names = this.getSelectedDeductionNames()
  547 + const parts = String(businessSummary || '')
  548 + .split(',')
  549 + .map(text => text.trim())
  550 + .filter(text => !!text)
  551 + const found = parts.find(part => {
  552 + if (part.includes('公斤') || part.includes(':')) return false
  553 + const items = part.split('、').map(text => text.trim()).filter(text => !!text)
  554 + return items.length > 0 && items.every(text => names.some(name => text.startsWith(name)))
  555 + })
  556 + return found || names.join('、')
  557 + },
485 558 loadDetail() {
486 559 if (!this.id) {
487 560 uni.showToast({ title: '缺少单据ID', icon: 'none' })
... ... @@ -505,11 +578,14 @@ export default {
505 578 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight),
506 579 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight),
507 580 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [],
  581 + deductionTypeRemark: '',
508 582 supplierStockMaterial: data.supplierStockMaterial || '',
509 583 logisticsStockMaterial: data.logisticsStockMaterial || '',
510 584 plateNumber: data.plateNumber || '',
511 585 specialNote: data.specialNote || ''
512 586 }
  587 + // 回显来料类型备注:优先取已保存业务摘要中的扣杂段落
  588 + this.form.deductionTypeRemark = this.extractDeductionRemark(data.businessSummary)
513 589 // 计划选择回显:行对象缓存供提交 planIds 使用(id 取计划明细行上的计划 id)
514 590 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it }))
515 591 this.selectedPlanRows = this.planList.map(item => ({
... ... @@ -610,11 +686,16 @@ export default {
610 686 row.productName = ''
611 687 row.invoiceProductName = ''
612 688 },
  689 + // 当前行可选的品种(同一计划下已被其他行选中的品种不再展示)
  690 + getWeightProductOptions(item) {
  691 + const used = (this.weighList || [])
  692 + .filter(row => row !== item && row.planCode === item.planCode && row.productId && row.productId !== item.productId)
  693 + .map(row => row.productId)
  694 + return (this.planList || []).filter(it => it.planCode === item.planCode && !used.includes(it.productId))
  695 + },
613 696 // 当前计划编号下的品种选项
614 697 getWeightProductLabels(item) {
615   - return (this.planList || [])
616   - .filter(it => it.planCode === item.planCode)
617   - .map(it => it.productName || '')
  698 + return this.getWeightProductOptions(item).map(it => it.productName || '')
618 699 },
619 700 getWeightProductLabel(item) {
620 701 if (!item.productId) return ''
... ... @@ -624,7 +705,7 @@ export default {
624 705 // 过磅品种改选:整行替换为对应计划明细数据(保留行id与计划编号)
625 706 handleWeightProductChange(idx, optIdx) {
626 707 const row = this.weighList[idx]
627   - const options = (this.planList || []).filter(it => it.planCode === row.planCode)
  708 + const options = this.getWeightProductOptions(row)
628 709 const raw = options[optIdx]
629 710 if (!raw) return
630 711 this.weighList.splice(idx, 1, {
... ... @@ -676,8 +757,8 @@ export default {
676 757 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
677 758 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
678 759 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
679   - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
680   - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
  760 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  761 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
681 762 if (!f.plateNumber) return this.tip('请输入车牌号')
682 763 // 过磅明细:计划编号、品种、数量必填
683 764 const weightList = this.weighList || []
... ... @@ -737,12 +818,24 @@ export default {
737 818 documentRemark: this.computedDocumentRemark || null
738 819 }
739 820 },
  821 + // 过磅数量合计与货物净重不一致时二次确认
  822 + async confirmQuantityMismatch() {
  823 + const net = this.computedNetWeight
  824 + if (net === '' || net === null || net === undefined) return true
  825 + const netNum = Math.round(Number(net) * 100) / 100
  826 + if (this.weightQuantityTotal === netNum) return true
  827 + const res = await new Promise(resolve => {
  828 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  829 + })
  830 + return !!(res && res.confirm)
  831 + },
740 832 async onSubmit() {
741 833 if (!this.validate()) return
742 834 const confirmRes = await new Promise(resolve => {
743 835 uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve })
744 836 })
745 837 if (!(confirmRes && confirmRes.confirm)) return
  838 + if (!(await this.confirmQuantityMismatch())) return
746 839 uni.showLoading({ title: '保存中...', mask: true })
747 840 weighTicketUpdateApi(this.buildSubmitData())
748 841 .then(() => {
... ... @@ -1101,6 +1194,12 @@ function numberToChineseUpper(num) {
1101 1194 }
1102 1195 }
1103 1196
  1197 +// 来料类型备注:textarea 占满剩余宽度
  1198 +.deduction-remark-input {
  1199 + flex: 1;
  1200 + width: 100%;
  1201 +}
  1202 +
1104 1203 .remark-group {
1105 1204 margin-bottom: 32rpx;
1106 1205
... ...
... ... @@ -68,7 +68,7 @@
68 68 <uni-easyinput :value="item.productName" :inputBorder="false" disabled />
69 69 </template>
70 70 </uni-list-item>
71   - <uni-list-item title="计划数量">
  71 + <uni-list-item title="计划数量(kg)">
72 72 <template v-slot:footer>
73 73 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
74 74 </template>
... ... @@ -105,7 +105,7 @@
105 105 </uni-list-item>
106 106 <uni-list-item title="过磅数量">
107 107 <template v-slot:body>
108   - <view class="item-title"><text class="required">*</text><text>过磅数量</text></view>
  108 + <view class="item-title"><text class="required">*</text><text>过磅数量(kg)</text></view>
109 109 </template>
110 110 <template v-slot:footer>
111 111 <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入过磅数量" />
... ... @@ -131,7 +131,7 @@
131 131 <uni-easyinput :value="item.category" :inputBorder="false" disabled />
132 132 </template>
133 133 </uni-list-item>
134   - <uni-list-item title="数量">
  134 + <uni-list-item title="数量(kg)">
135 135 <template v-slot:footer>
136 136 <uni-easyinput :value="item.quantity" :inputBorder="false" disabled />
137 137 </template>
... ... @@ -156,7 +156,7 @@
156 156 </uni-list-item>
157 157 <uni-list-item>
158 158 <template v-slot:body>
159   - <view class="item-title"><text class="required">*</text><text>过磅总重</text></view>
  159 + <view class="item-title"><text class="required">*</text><text>过磅总重(kg)</text></view>
160 160 </template>
161 161 <template v-slot:footer>
162 162 <uni-easyinput v-model="form.totalGrossWeight" type="digit" :inputBorder="false" placeholder="请输入过磅总重" />
... ... @@ -164,13 +164,13 @@
164 164 </uni-list-item>
165 165 <uni-list-item>
166 166 <template v-slot:body>
167   - <view class="item-title"><text class="required">*</text><text>实际伙重</text></view>
  167 + <view class="item-title"><text class="required">*</text><text>实际伙重(kg)</text></view>
168 168 </template>
169 169 <template v-slot:footer>
170 170 <uni-easyinput v-model="form.actualImpurityWeight" type="digit" :inputBorder="false" placeholder="请输入实际伙重" />
171 171 </template>
172 172 </uni-list-item>
173   - <uni-list-item title="货物净重">
  173 + <uni-list-item title="货物净重(kg)">
174 174 <template v-slot:footer>
175 175 <uni-easyinput :value="computedNetWeight" :inputBorder="false" disabled />
176 176 </template>
... ... @@ -197,7 +197,16 @@
197 197 <uni-list>
198 198 <uni-list-item>
199 199 <template v-slot:body>
200   - <view class="item-title"><text class="required">*</text><text>供应存欠料</text></view>
  200 + <view class="item-title"><text>来料类型备注</text></view>
  201 + </template>
  202 + <template v-slot:footer>
  203 + <uni-easyinput class="deduction-remark-input" v-model="form.deductionTypeRemark"
  204 + type="textarea" :inputBorder="false" placeholder="请输入来料类型备注" autoHeight />
  205 + </template>
  206 + </uni-list-item>
  207 + <uni-list-item>
  208 + <template v-slot:body>
  209 + <view class="item-title"><text>供应存欠料</text></view>
201 210 </template>
202 211 <template v-slot:footer>
203 212 <uni-easyinput v-model="form.supplierStockMaterial" :inputBorder="false" placeholder="请输入供应存欠料" />
... ... @@ -205,7 +214,7 @@
205 214 </uni-list-item>
206 215 <uni-list-item>
207 216 <template v-slot:body>
208   - <view class="item-title"><text class="required">*</text><text>物流存欠料</text></view>
  217 + <view class="item-title"><text>物流存欠料</text></view>
209 218 </template>
210 219 <template v-slot:footer>
211 220 <uni-easyinput v-model="form.logisticsStockMaterial" :inputBorder="false" placeholder="请输入物流存欠料" />
... ... @@ -272,7 +281,7 @@
272 281
273 282 <script>
274 283 import { weighTicketDetailApi, weighTicketCreateApi } from '@/api/procure-manage/weighTicket.js'
275   -import { getDicByCodes, getDicName } from '@/utils/dic.js'
  284 +import { getDicByCodes } from '@/utils/dic.js'
276 285 import upload from '@/utils/upload'
277 286 import { uploadFileApi } from '@/api/base.js'
278 287
... ... @@ -292,6 +301,7 @@ export default {
292 301 totalGrossWeight: '',
293 302 actualImpurityWeight: '',
294 303 deductionTypes: [],
  304 + deductionTypeRemark: '',
295 305 supplierStockMaterial: '',
296 306 logisticsStockMaterial: '',
297 307 plateNumber: '',
... ... @@ -345,6 +355,14 @@ export default {
345 355 if (net === '' || net === null || net === undefined) return ''
346 356 return numberToChineseUpper(net)
347 357 },
  358 + // 过磅数量合计
  359 + weightQuantityTotal() {
  360 + const total = (this.weighList || []).reduce((sum, item) => {
  361 + const qty = Number(item.quantity)
  362 + return sum + (isNaN(qty) ? 0 : qty)
  363 + }, 0)
  364 + return Math.round(total * 100) / 100
  365 + },
348 366 // 业务摘要
349 367 computedBusinessSummary() {
350 368 const parts = []
... ... @@ -357,10 +375,9 @@ export default {
357 375 })
358 376 .filter(text => !!text)
359 377 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('、'))
  378 + // 来料扣杂类型段落以「来料类型备注」文本为准(用户可自由修改)
  379 + const deductionSegment = (this.form.deductionTypeRemark || '').trim()
  380 + if (deductionSegment) parts.push(deductionSegment)
364 381 if (this.form.supplierStockMaterial) parts.push(`供应存欠料:${this.form.supplierStockMaterial}`)
365 382 if (this.form.logisticsStockMaterial) parts.push(`物流存欠料:${this.form.logisticsStockMaterial}`)
366 383 if (this.form.plateNumber) parts.push(`车牌号:${this.form.plateNumber}`)
... ... @@ -373,12 +390,21 @@ export default {
373 390 return [summary, note].filter(text => !!text).join('\n')
374 391 }
375 392 },
  393 + watch: {
  394 + // 来料扣杂类型增减时,同步维护「来料类型备注」文本(保留用户已填写的数字等内容)
  395 + 'form.deductionTypes': {
  396 + deep: true,
  397 + handler(list) {
  398 + this.syncDeductionRemark(list)
  399 + }
  400 + }
  401 + },
376 402 onLoad(query) {
377 403 this.id = (query && query.id) || ''
378 404 },
379 405 created() {
380   - this.loadDicData()
381   - this.loadDetail()
  406 + // 先加载字典,再回显详情,保证来料类型备注能正确解析
  407 + this.loadDicData().finally(() => this.loadDetail())
382 408 },
383 409 methods: {
384 410 async loadDicData() {
... ... @@ -394,6 +420,53 @@ export default {
394 420 const found = (this.dicOptions.TYPE || []).find(it => String(it.code) === String(this.form.type))
395 421 return found ? found.name : ''
396 422 },
  423 + // 当前已选扣杂类型的名称
  424 + getSelectedDeductionNames() {
  425 + const selected = (this.form.deductionTypes || []).map(code => String(code))
  426 + return this.deductionTypeOptions
  427 + .filter(it => selected.includes(it.value))
  428 + .map(it => it.text)
  429 + .filter(name => !!name)
  430 + },
  431 + // 按所选扣杂类型同步备注文本:移除已取消的类型、补充新增的类型,保留用户已填写的后缀内容
  432 + syncDeductionRemark(list) {
  433 + const selected = (list || []).map(code => String(code))
  434 + const names = this.deductionTypeOptions
  435 + .filter(it => selected.includes(it.value))
  436 + .map(it => it.text)
  437 + .filter(name => !!name)
  438 + const segments = (this.form.deductionTypeRemark || '')
  439 + .split('、')
  440 + .map(text => text.trim())
  441 + .filter(text => !!text)
  442 + // 名称按长度倒序匹配,避免「水」误匹配「水杂」这类前缀相同的情况
  443 + const sortedNames = names.slice().sort((a, b) => b.length - a.length)
  444 + const matched = []
  445 + segments.forEach(text => {
  446 + const name = sortedNames.find(item => text.startsWith(item))
  447 + if (!name) return
  448 + if (!matched.some(item => item.name === name)) matched.push({ name, text })
  449 + })
  450 + const result = names.map(name => {
  451 + const found = matched.find(item => item.name === name)
  452 + return found ? found.text : name
  453 + })
  454 + this.form.deductionTypeRemark = result.join('、')
  455 + },
  456 + // 从已保存的业务摘要中解析来料扣杂类型段落,用于回显来料类型备注
  457 + extractDeductionRemark(businessSummary) {
  458 + const names = this.getSelectedDeductionNames()
  459 + const parts = String(businessSummary || '')
  460 + .split(',')
  461 + .map(text => text.trim())
  462 + .filter(text => !!text)
  463 + const found = parts.find(part => {
  464 + if (part.includes('公斤') || part.includes(':')) return false
  465 + const items = part.split('、').map(text => text.trim()).filter(text => !!text)
  466 + return items.length > 0 && items.every(text => names.some(name => text.startsWith(name)))
  467 + })
  468 + return found || names.join('、')
  469 + },
397 470 loadDetail() {
398 471 if (!this.id) {
399 472 uni.showToast({ title: '缺少单据ID', icon: 'none' })
... ... @@ -415,11 +488,14 @@ export default {
415 488 totalGrossWeight: data.totalGrossWeight == null ? '' : String(data.totalGrossWeight),
416 489 actualImpurityWeight: data.actualImpurityWeight == null ? '' : String(data.actualImpurityWeight),
417 490 deductionTypes: data.deductionTypes ? String(data.deductionTypes).split(',').filter(Boolean) : [],
  491 + deductionTypeRemark: '',
418 492 supplierStockMaterial: data.supplierStockMaterial || '',
419 493 logisticsStockMaterial: data.logisticsStockMaterial || '',
420 494 plateNumber: data.plateNumber || '',
421 495 specialNote: data.specialNote || ''
422 496 }
  497 + // 回显来料类型备注:优先取已保存业务摘要中的扣杂段落
  498 + this.form.deductionTypeRemark = this.extractDeductionRemark(data.businessSummary)
423 499 this.planList = (Array.isArray(data.planLines) ? data.planLines : []).map(it => ({ ...it }))
424 500 // 选中计划行对象(buyout 供 isBuyout 判断,id 供 planIds 提交使用)
425 501 this.selectedPlanRows = this.planList.map(item => ({
... ... @@ -519,8 +595,8 @@ export default {
519 595 if (f.totalGrossWeight === '' || f.totalGrossWeight == null) return this.tip('请输入过磅总重')
520 596 if (f.actualImpurityWeight === '' || f.actualImpurityWeight == null) return this.tip('请输入实际伙重')
521 597 if (!f.deductionTypes || !f.deductionTypes.length) return this.tip('请选择来料扣杂类型')
522   - if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
523   - if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
  598 + // if (!f.supplierStockMaterial) return this.tip('请输入供应存欠料')
  599 + // if (!f.logisticsStockMaterial) return this.tip('请输入物流存欠料')
524 600 if (!f.plateNumber) return this.tip('请输入车牌号')
525 601 // 过磅明细:过磅数量必填
526 602 const weightList = this.weighList || []
... ... @@ -536,12 +612,24 @@ export default {
536 612 uni.showToast({ title: msg, icon: 'none' })
537 613 return false
538 614 },
  615 + // 过磅数量合计与货物净重不一致时二次确认
  616 + async confirmQuantityMismatch() {
  617 + const net = this.computedNetWeight
  618 + if (net === '' || net === null || net === undefined) return true
  619 + const netNum = Math.round(Number(net) * 100) / 100
  620 + if (this.weightQuantityTotal === netNum) return true
  621 + const res = await new Promise(resolve => {
  622 + uni.showModal({ title: '提示', content: '过磅数量总和货物净重不一致,确定保存吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  623 + })
  624 + return !!(res && res.confirm)
  625 + },
539 626 async onSubmit() {
540 627 if (!this.validate()) return
541 628 const confirmRes = await new Promise(resolve => {
542 629 uni.showModal({ title: '提示', content: '确定保存复磅单吗?', confirmText: '确定', cancelText: '取消', success: resolve })
543 630 })
544 631 if (!(confirmRes && confirmRes.confirm)) return
  632 + if (!(await this.confirmQuantityMismatch())) return
545 633 const ids = this.fileList.map(it => it.id).filter(Boolean)
546 634 const names = this.fileList.map(it => it.name).filter(Boolean)
547 635 const payload = {
... ... @@ -904,6 +992,12 @@ function numberToChineseUpper(num) {
904 992 }
905 993 }
906 994
  995 +// 来料类型备注:textarea 占满剩余宽度
  996 +.deduction-remark-input {
  997 + flex: 1;
  998 + width: 100%;
  999 +}
  1000 +
907 1001 .remark-group {
908 1002 margin-bottom: 32rpx;
909 1003
... ...
... ... @@ -24,7 +24,7 @@
24 24 <view class="card-index">第 {{ idx + 1 }} 行</view>
25 25 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
26 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>
  27 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
28 28 </view>
29 29 </view>
30 30 </view>
... ... @@ -42,7 +42,7 @@
42 42 <view class="row"><text class="label">计划编号</text><text class="value">{{ item.planCode || '-' }}</text></view>
43 43 <view class="row"><text class="label">过磅品种</text><text class="value">{{ item.productName || '-' }}</text></view>
44 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>
  45 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
46 46 </view>
47 47 </view>
48 48 </view>
... ... @@ -58,7 +58,7 @@
58 58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
59 59 <view class="card-index">第 {{ idx + 1 }} 行</view>
60 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>
  61 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
62 62 </view>
63 63 </view>
64 64 </view>
... ... @@ -70,9 +70,9 @@
70 70 </view>
71 71 <view class="section">
72 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>
  73 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  74 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  75 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
76 76 <view class="row"><text class="label">净重大写</text><text class="value">{{ form.netWeightUpper || '-' }}</text></view>
77 77 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view>
78 78 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ form.supplierStockMaterial || '-' }}</text></view>
... ... @@ -273,8 +273,46 @@ export default {
273 273 uni.hideLoading()
274 274 })
275 275 },
276   - // 选择并上传文件(多文件逐个追加)
  276 + // 选择上传方式:拍照 / 相册 / 文件
277 277 selectFile() {
  278 + uni.showActionSheet({
  279 + itemList: ['拍照上传', '从相册选择', '选择文件'],
  280 + success: res => {
  281 + if (res.tapIndex === 0) this.chooseImage(['camera'])
  282 + else if (res.tapIndex === 1) this.chooseImage(['album'])
  283 + else this.chooseFile()
  284 + }
  285 + })
  286 + },
  287 + // 拍照 / 相册上传图片(多张逐个追加)
  288 + chooseImage(sourceType) {
  289 + uni.chooseImage({
  290 + count: 9,
  291 + sizeType: ['original', 'compressed'],
  292 + sourceType,
  293 + success: async res => {
  294 + const paths = (res && res.tempFilePaths) || []
  295 + if (!paths.length) return
  296 + uni.showLoading({ title: '上传中...', mask: true })
  297 + try {
  298 + for (let i = 0; i < paths.length; i++) {
  299 + const path = paths[i]
  300 + const ext = (/\.(\w+)$/.exec(path) || [])[1] || 'jpg'
  301 + const name = `照片_${Date.now()}_${i + 1}.${ext}`
  302 + const r = await upload({ url: '/sw/filebox/uploadFile', filePath: path, name: 'file' })
  303 + const id = getUploadedFileId(r)
  304 + if (id) this.fileList.push({ id, name })
  305 + }
  306 + } catch (e) {
  307 + uni.showToast({ title: '上传失败', icon: 'none' })
  308 + } finally {
  309 + uni.hideLoading()
  310 + }
  311 + }
  312 + })
  313 + },
  314 + // 选择并上传文件(多文件逐个追加)
  315 + chooseFile() {
278 316 if (typeof uni !== 'undefined' && typeof uni.chooseMessageFile === 'function') {
279 317 uni.chooseMessageFile({
280 318 count: 9,
... ... @@ -287,10 +325,7 @@ export default {
287 325 for (const f of files) {
288 326 const name = f.name || 'file'
289 327 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   - : ''
  328 + const id = getUploadedFileId(r)
294 329 if (id) this.fileList.push({ id, name })
295 330 }
296 331 } catch (e) {
... ... @@ -331,10 +366,7 @@ export default {
331 366 const fd = new FormData()
332 367 fd.append('file', file, name)
333 368 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   - : ''
  369 + const id = getUploadedFileId(d)
338 370 if (id) this.fileList.push({ id, name })
339 371 }
340 372 } catch (e2) {
... ... @@ -397,6 +429,14 @@ export default {
397 429 }
398 430 }
399 431 }
  432 +
  433 +// 解析上传接口返回的文件ID
  434 +function getUploadedFileId(res) {
  435 + const d = res && res.data ? res.data : res
  436 + if (!d) return ''
  437 + const id = d.id || d.fileId || (d.data && (d.data.id || d.data.fileId))
  438 + return id ? String(id) : ''
  439 +}
400 440 </script>
401 441
402 442 <style lang="scss" scoped>
... ...
... ... @@ -23,7 +23,7 @@
23 23 <view v-for="(item, idx) in planList" :key="'p-' + (item.id || idx)" class="card">
24 24 <view class="card-index">第 {{ idx + 1 }} 行</view>
25 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>
  26 + <view class="row"><text class="label">计划数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
27 27 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
28 28 </view>
29 29 </view>
... ... @@ -41,7 +41,7 @@
41 41 <view class="card-index">第 {{ idx + 1 }} 行</view>
42 42 <view class="row"><text class="label">过磅品种</text><text class="value">{{ safeText(item.productName) }}</text></view>
43 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>
  44 + <view class="row"><text class="label">过磅数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
45 45 <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(item.planCode) }}</text></view>
46 46 </view>
47 47 </view>
... ... @@ -58,7 +58,7 @@
58 58 <view v-for="(item, idx) in applyList" :key="'a-' + (item.id || idx)" class="card">
59 59 <view class="card-index">第 {{ idx + 1 }} 行</view>
60 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>
  61 + <view class="row"><text class="label">数量(kg)</text><text class="value">{{ formatNumber(item.quantity) }}</text></view>
62 62 </view>
63 63 </view>
64 64 </view>
... ... @@ -70,9 +70,9 @@
70 70 </view>
71 71 <view class="section">
72 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>
  73 + <view class="row"><text class="label">过磅总重(kg)</text><text class="value">{{ formatNumber(form.totalGrossWeight) }}</text></view>
  74 + <view class="row"><text class="label">实际伙重(kg)</text><text class="value">{{ formatNumber(form.actualImpurityWeight) }}</text></view>
  75 + <view class="row"><text class="label">货物净重(kg)</text><text class="value">{{ formatNumber(form.netWeight) }}</text></view>
76 76 <view class="row"><text class="label">净重大写</text><text class="value">{{ safeText(form.netWeightUpper) }}</text></view>
77 77 <view class="row"><text class="label">来料扣杂类型</text><text class="value">{{ deductionNames }}</text></view>
78 78 <view class="row"><text class="label">供应存欠料</text><text class="value">{{ safeText(form.supplierStockMaterial) }}</text></view>
... ...