Commit 7cff4c20c91ea494dfb0d1f83f8f7ad513d16bb8

Authored by 史婷婷
1 parent 873d84e1

feat: 规格变更单-修改暂存

Showing 1 changed file with 30 additions and 26 deletions
@@ -138,7 +138,7 @@ @@ -138,7 +138,7 @@
138 <view class="view-total"> 138 <view class="view-total">
139 <view class="head">合计</view> 139 <view class="head">合计</view>
140 <view class="row"> 140 <view class="row">
141 - <text class="label">总数量</text><text class="value">{{ form.totalQuantity }}</text> 141 + <text class="label">总数量</text><text class="value">{{ form.afterTotalQuantity }}</text>
142 </view> 142 </view>
143 </view> 143 </view>
144 <button class="btn submit" type="primary" @click="onSubmit">提交</button> 144 <button class="btn submit" type="primary" @click="onSubmit">提交</button>
@@ -162,35 +162,30 @@ export default { @@ -162,35 +162,30 @@ export default {
162 return { 162 return {
163 id: '', 163 id: '',
164 form: { 164 form: {
165 - code: '',  
166 - supplier: '',  
167 - buyer: '',  
168 - // 默认当前日期 格式为 yyyy-MM-dd 165 + orderId: '',
  166 + purchaseOrderId: '',
  167 + orderNo: '',
  168 + supplyUnit: '',
  169 + orderingUnit: '',
169 orderDate: new Date().toISOString().substring(0, 10), 170 orderDate: new Date().toISOString().substring(0, 10),
170 - unit: '',  
171 - totalQuantity: '',  
172 - totalAmountExcludingTax: '',  
173 - totalAmountIncludingTax: '',  
174 - totalAmountCapital: '',  
175 - depositInfo: '',  
176 - packagingRequirements: '',  
177 - paymentTerms: '',  
178 - transportMode: '',  
179 - destinationId: [],  
180 - includesPackagingFee: '',  
181 - includesTransportFee: '',  
182 - designatedConsignee: '',  
183 - specialTerms: '', 171 + workshopId: '',
  172 + settlementTerms: '',
  173 + deliveryMethod: '',
  174 + priceListNo: '',
  175 + invoicingStatus: '',
  176 + shippingCost: '',
  177 + packagingFee: '',
184 executionStandard: '', 178 executionStandard: '',
185 executionStandardRemarks: '', 179 executionStandardRemarks: '',
186 - specialInstructions: '',  
187 - remarks: '',  
188 - pieceWeightHead: '', 180 + totalQuantity: '',
  181 + afterTotalQuantity: '',
  182 + pieceWeightHeader: '',
189 surface: '', 183 surface: '',
190 tolerance: '', 184 tolerance: '',
191 performance: '', 185 performance: '',
192 - component: '', 186 + element: '',
193 packaging: '', 187 packaging: '',
  188 + remarks: '',
194 }, 189 },
195 initPurchaseOrderLineList: [], 190 initPurchaseOrderLineList: [],
196 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] }, 191 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [] },
@@ -216,8 +211,9 @@ export default { @@ -216,8 +211,9 @@ export default {
216 const res = await getDetailApi(id) 211 const res = await getDetailApi(id)
217 const m = res.data || {} 212 const m = res.data || {}
218 const next = { ...this.form, ...m } 213 const next = { ...this.form, ...m }
219 - next.id = m.id || m.code || id  
220 - next.purchaseOrderLineList = Array.isArray(m.purchaseOrderLineList) ? m.purchaseOrderLineList.map(x => ({ ...x })) : [] 214 + next.id = m.id || m.code || id;
  215 + next.purchaseOrderId = m.orderId || '';
  216 + next.purchaseOrderLineList = Array.isArray(m.afterChangeSpecList) ? m.afterChangeSpecList.map(x => ({ ...x })) : []
221 this.form = next; 217 this.form = next;
222 this.initPurchaseOrderLineList = next.purchaseOrderLineList || []; 218 this.initPurchaseOrderLineList = next.purchaseOrderLineList || [];
223 this.refreshStandardName() 219 this.refreshStandardName()
@@ -248,7 +244,10 @@ export default { @@ -248,7 +244,10 @@ export default {
248 getDicName: getDicName, 244 getDicName: getDicName,
249 async onSubmit() { 245 async onSubmit() {
250 const payload = { ...this.form } 246 const payload = { ...this.form }
  247 + payload.orderSpecList = payload.purchaseOrderLineList || [];
  248 + delete payload.purchaseOrderLineList
251 console.log('onSubmit__payload', payload) 249 console.log('onSubmit__payload', payload)
  250 + return
252 try { 251 try {
253 await updateApi(payload) 252 await updateApi(payload)
254 uni.showToast({ title: '保存成功', icon: 'success' }) 253 uni.showToast({ title: '保存成功', icon: 'success' })
@@ -259,7 +258,12 @@ export default { @@ -259,7 +258,12 @@ export default {
259 }, 258 },
260 purchaseOrderLineListChange(data) { 259 purchaseOrderLineListChange(data) {
261 const list = Array.isArray(data) ? data : [] 260 const list = Array.isArray(data) ? data : []
262 - this.form.purchaseOrderLineList = list; 261 + this.form.purchaseOrderLineList = list
  262 + const sum = list.reduce((acc, it) => {
  263 + const v = Number(it && it.quantity)
  264 + return acc + (isNaN(v) ? 0 : v)
  265 + }, 0)
  266 + this.form.afterTotalQuantity = sum
263 }, 267 },
264 } 268 }
265 } 269 }