Commit 833536aada2ea0bd4a40c796ac1fa1753782d1c9

Authored by gesilong
1 parent 2b378729

commit:拆分数量功能

... ... @@ -90,6 +90,11 @@
90 90 placeholder="不可编辑" />
91 91 </template>
92 92 </uni-list-item>
  93 + <uni-list-item title="本次锁价数量">
  94 + <template v-slot:footer>
  95 + <uni-easyinput v-model="item.currentQuantity" type="number" :inputBorder="false" placeholder="请输入本次锁价数量" @input="onImmediateChange(idx)" @blur="onNumberBlur(idx, 'currentQuantity', 3)" />
  96 + </template>
  97 + </uni-list-item>
93 98 <uni-list-item title="单价">
94 99 <template v-slot:footer>
95 100 <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false"
... ... @@ -255,6 +260,7 @@ export default {
255 260 lengthTolNeg: v.lengthTolNeg || '',
256 261 materialCode: v.materialCode || '',
257 262 status: v.status || '',
  263 + currentQuantity: v.currentQuantity === 0 ? 0 : (v.currentQuantity || ''),
258 264 quantity: v.productQuantity || v.quantity || '',
259 265 unitPrice: v.unitPrice || '',
260 266 // amountExcludingTax: v.amountExcludingTax || 0,
... ... @@ -335,6 +341,7 @@ export default {
335 341 this.items = this.items.map((it, i) => ({
336 342 ...it,
337 343 quantity: '',
  344 + currentQuantity: '',
338 345 unitPrice: '',
339 346 // amountExcludingTax: 0
340 347 }))
... ... @@ -344,10 +351,12 @@ export default {
344 351 const raw = { ...(it.raw || {}) }
345 352 const qty = this.toNumber(it.quantity)
346 353 const price = this.toNumber(it.unitPrice)
  354 + const curQtyRaw = it.currentQuantity
347 355 const total = this.toNumber(it.totalAmount)
348 356 // const excl = this.toNumber(it.amountExcludingTax)
349 357 if (Object.prototype.hasOwnProperty.call(raw, 'productQuantity')) raw.productQuantity = qty
350 358 else raw.quantity = qty
  359 + raw.currentQuantity = (curQtyRaw === '' || curQtyRaw === null || curQtyRaw === undefined) ? null : this.toNumber(curQtyRaw)
351 360 raw.unitPrice = price
352 361 raw.totalAmount = total
353 362 // raw.amountExcludingTax = excl
... ... @@ -365,6 +374,14 @@ export default {
365 374 uni.showToast({ title: '请填写单价', icon: 'none' })
366 375 return
367 376 }
  377 + const invalidQty = selected.find(r => {
  378 + const q = this.toNumber(r.currentQuantity)
  379 + return !(q > 0)
  380 + })
  381 + if (invalidQty) {
  382 + uni.showToast({ title: '请填写本次锁价数量', icon: 'none' })
  383 + return
  384 + }
368 385 this.selectedItems = selected
369 386 const payload = {
370 387 id: this.id,
... ...
... ... @@ -84,6 +84,11 @@
84 84 <uni-easyinput v-model="item.quantity" type="number" :inputBorder="false" disabled placeholder="不可编辑" />
85 85 </template>
86 86 </uni-list-item>
  87 + <uni-list-item title="本次锁价数量">
  88 + <template v-slot:footer>
  89 + <uni-easyinput v-model="item.currentQuantity" type="number" :inputBorder="false" placeholder="请输入本次锁价数量" @input="onImmediateChange(idx)" @blur="onNumberBlur(idx, 'currentQuantity', 3)" />
  90 + </template>
  91 + </uni-list-item>
87 92 <uni-list-item title="单价">
88 93 <template v-slot:footer>
89 94 <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入单价" @input="onImmediateChange(idx)" @blur="onNumberBlur(idx, 'unitPrice', 0)" />
... ... @@ -243,6 +248,7 @@ export default {
243 248 materialCode: v.materialCode || '',
244 249 status: v.status || '',
245 250 quantity: v.productQuantity || v.quantity || '',
  251 + currentQuantity: v.currentQuantity === 0 ? 0 : (v.currentQuantity || ''),
246 252 unitPrice: v.unitPrice || '',
247 253 amountExcludingTax: v.amountExcludingTax || 0,
248 254 totalAmount: v.totalAmount || 0,
... ... @@ -322,6 +328,7 @@ export default {
322 328 this.items = this.items.map((it, i) => ({
323 329 ...it,
324 330 quantity: '',
  331 + currentQuantity: '',
325 332 unitPrice: '',
326 333 amountExcludingTax: 0
327 334 }))
... ... @@ -330,11 +337,13 @@ export default {
330 337 const selected = this.items.filter(it => it.locked).map(it => {
331 338 const raw = { ...(it.raw || {}) }
332 339 const qty = this.toNumber(it.quantity)
  340 + const curQtyRaw = it.currentQuantity
333 341 const price = this.toNumber(it.unitPrice)
334 342 const total = this.toNumber(it.totalAmount)
335 343 const excl = this.toNumber(it.amountExcludingTax)
336 344 if (Object.prototype.hasOwnProperty.call(raw, 'productQuantity')) raw.productQuantity = qty
337 345 else raw.quantity = qty
  346 + raw.currentQuantity = (curQtyRaw === '' || curQtyRaw === null || curQtyRaw === undefined) ? null : this.toNumber(curQtyRaw)
338 347 raw.unitPrice = price
339 348 raw.totalAmount = total
340 349 raw.amountExcludingTax = excl
... ... @@ -352,6 +361,14 @@ export default {
352 361 uni.showToast({ title: '请填写单价', icon: 'none' })
353 362 return
354 363 }
  364 + const invalidQty = selected.find(r => {
  365 + const q = this.toNumber(r.currentQuantity)
  366 + return !(q > 0)
  367 + })
  368 + if (invalidQty) {
  369 + uni.showToast({ title: '请填写本次锁价数量', icon: 'none' })
  370 + return
  371 + }
355 372 this.selectedItems = selected
356 373 const payload = {
357 374 id: this.id,
... ... @@ -768,4 +785,4 @@ export default {
768 785 height: 60rpx;
769 786 align-items: center;
770 787 }
771   -</style>
\ No newline at end of file
  788 +</style>
... ...