Commit 9c80d966abfa51f4d12e21fe17512dd3c6d793f6

Authored by 史婷婷
1 parent a566f00b

feat: 产品试样确认单-编辑保存

@@ -170,8 +170,6 @@ export default { @@ -170,8 +170,6 @@ export default {
170 170
171 this.form = next; 171 this.form = next;
172 this.initPurchaseOrderLineList = lines; 172 this.initPurchaseOrderLineList = lines;
173 - // 初始计算合计  
174 - this.calculateSummary(lines)  
175 } catch (e) { 173 } catch (e) {
176 uni.showToast({ title: '加载失败', icon: 'none' }) 174 uni.showToast({ title: '加载失败', icon: 'none' })
177 } 175 }
@@ -214,16 +212,16 @@ export default { @@ -214,16 +212,16 @@ export default {
214 }) 212 })
215 }, 213 },
216 validateRequired() { 214 validateRequired() {
217 - const checks = [  
218 - { key: 'purchaseOrderName', label: '订单编号' }  
219 - ]  
220 - for (const it of checks) {  
221 - const val = this.form[it.key]  
222 - if (val === undefined || val === null || String(val).trim() === '') {  
223 - uni.showToast({ title: `请先选择${it.label}`, icon: 'none' })  
224 - return false  
225 - }  
226 - } 215 + // const checks = [
  216 + // { key: 'purchaseOrderName', label: '订单编号' }
  217 + // ]
  218 + // for (const it of checks) {
  219 + // const val = this.form[it.key]
  220 + // if (val === undefined || val === null || String(val).trim() === '') {
  221 + // uni.showToast({ title: `请先选择${it.label}`, icon: 'none' })
  222 + // return false
  223 + // }
  224 + // }
227 return true 225 return true
228 }, 226 },
229 validateLineListRequired() { 227 validateLineListRequired() {
@@ -276,18 +274,14 @@ export default { @@ -276,18 +274,14 @@ export default {
276 }, 274 },
277 async onSubmit() { 275 async onSubmit() {
278 if (!this.validateRequired()) return 276 if (!this.validateRequired()) return
279 - if (!this.validateLineListRequired()) return  
280 const payload = { ...this.form } 277 const payload = { ...this.form }
281 - // 后端接口通常期望 replenishmentOrderLineList  
282 - payload.replenishmentOrderLineList = payload.purchaseOrderLineList || [];  
283 - // 清理可能存在的多余字段  
284 - delete payload.purchaseOrderLineList;  
285 - 278 + delete payload.status
286 console.log('onSubmit__payload', payload) 279 console.log('onSubmit__payload', payload)
  280 +
287 try { 281 try {
288 await updateApi(payload) 282 await updateApi(payload)
289 uni.showToast({ title: '保存成功', icon: 'success' }) 283 uni.showToast({ title: '保存成功', icon: 'success' })
290 - setTimeout(() => { uni.redirectTo({ url: '/pages/replenishment_order/index' }) }, 300) 284 + setTimeout(() => { uni.redirectTo({ url: '/pages/confirmation_form/index' }) }, 300)
291 } catch (e) { 285 } catch (e) {
292 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' }) 286 uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
293 } 287 }
@@ -312,8 +306,7 @@ export default { @@ -312,8 +306,7 @@ export default {
312 }, 306 },
313 purchaseOrderLineListChange(data) { 307 purchaseOrderLineListChange(data) {
314 const list = Array.isArray(data) ? data : [] 308 const list = Array.isArray(data) ? data : []
315 - this.form.purchaseOrderLineList = list  
316 - this.calculateSummary(list) 309 + this.form.productSampleConfirmationSlipDetailList = list
317 }, 310 },
318 openSheet(field) { 311 openSheet(field) {
319 let options = [] 312 let options = []