|
@@ -242,16 +242,42 @@ export default { |
|
@@ -242,16 +242,42 @@ export default { |
|
242
|
this.sheet.visible = false
|
242
|
this.sheet.visible = false
|
|
243
|
},
|
243
|
},
|
|
244
|
getDicName: getDicName,
|
244
|
getDicName: getDicName,
|
|
|
|
245
|
+ validateLineListRequired() {
|
|
|
|
246
|
+ const list = Array.isArray(this.form.purchaseOrderLineList) ? this.form.purchaseOrderLineList : []
|
|
|
|
247
|
+ if (list.length === 0) {
|
|
|
|
248
|
+ uni.showToast({ title: '请先添加产品', icon: 'none' })
|
|
|
|
249
|
+ return false
|
|
|
|
250
|
+ }
|
|
|
|
251
|
+ const fields = [
|
|
|
|
252
|
+ { key: 'industry', label: '行业' },
|
|
|
|
253
|
+ { key: 'quality', label: '品质' },
|
|
|
|
254
|
+ { key: 'brand', label: '牌号' },
|
|
|
|
255
|
+ { key: 'quantity', label: '数量' },
|
|
|
|
256
|
+ { key: 'salesPrice', label: '销售价格' },
|
|
|
|
257
|
+ { key: 'deliveryDate', label: '发货日期' },
|
|
|
|
258
|
+ ]
|
|
|
|
259
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
260
|
+ const it = list[i] || {}
|
|
|
|
261
|
+ for (const f of fields) {
|
|
|
|
262
|
+ const v = it && it[f.key]
|
|
|
|
263
|
+ if (v === undefined || v === null || String(v).trim() === '') {
|
|
|
|
264
|
+ uni.showToast({ title: `产品第${i + 1}条:${f.label}不能为空!`, icon: 'none' })
|
|
|
|
265
|
+ return false
|
|
|
|
266
|
+ }
|
|
|
|
267
|
+ }
|
|
|
|
268
|
+ }
|
|
|
|
269
|
+ return true
|
|
|
|
270
|
+ },
|
|
245
|
async onSubmit() {
|
271
|
async onSubmit() {
|
|
|
|
272
|
+ if (!this.validateLineListRequired()) return
|
|
246
|
const payload = { ...this.form }
|
273
|
const payload = { ...this.form }
|
|
247
|
payload.orderSpecList = payload.purchaseOrderLineList || [];
|
274
|
payload.orderSpecList = payload.purchaseOrderLineList || [];
|
|
248
|
delete payload.purchaseOrderLineList
|
275
|
delete payload.purchaseOrderLineList
|
|
249
|
console.log('onSubmit__payload', payload)
|
276
|
console.log('onSubmit__payload', payload)
|
|
250
|
- return
|
|
|
|
251
|
try {
|
277
|
try {
|
|
252
|
await updateApi(payload)
|
278
|
await updateApi(payload)
|
|
253
|
uni.showToast({ title: '保存成功', icon: 'success' })
|
279
|
uni.showToast({ title: '保存成功', icon: 'success' })
|
|
254
|
- setTimeout(() => { uni.redirectTo({ url: '/pages/order_list/index' }) }, 300)
|
280
|
+ setTimeout(() => { uni.redirectTo({ url: '/pages/change_list/index' }) }, 300)
|
|
255
|
} catch (e) {
|
281
|
} catch (e) {
|
|
256
|
uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
|
282
|
uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
|
|
257
|
}
|
283
|
}
|