Commit 75d905dff9f68017039def17158949012a299165

Authored by gesilong
1 parent dc656050

commit:拆分数量功能

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