|
|
|
@ -15,7 +15,8 @@ Page({ |
|
|
|
form: null, |
|
|
|
deductType: 1, |
|
|
|
columns: [], |
|
|
|
visible: false |
|
|
|
visible: false, |
|
|
|
nowItem: null |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
@ -57,8 +58,10 @@ Page({ |
|
|
|
this.setData({ visible: true }) |
|
|
|
}, |
|
|
|
onConfirm: function({detail}){ |
|
|
|
this.data.form.productId = this.data.paperList[detail.index].categoryId |
|
|
|
this.setData({ visible: false, ['form.productCategoryName']: detail.value }) |
|
|
|
this.data.nowItem = this.data.paperList[detail.index] |
|
|
|
this.data.form.productId = this.data.nowItem.id |
|
|
|
var unitPrice = this.data.nowItem.defaultUnitPrice |
|
|
|
this.setData({ visible: false, ['form.productCategoryName']: detail.value, ['form.unitPrice']: unitPrice }) |
|
|
|
}, |
|
|
|
onHide: function(){ |
|
|
|
this.setData({ visible: false }) |
|
|
|
@ -98,6 +101,14 @@ Page({ |
|
|
|
util.showToast('请输入单价') |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.data.nowItem.highestUnitPrice && Number(this.data.form.unitPrice) > Number(this.data.nowItem.highestUnitPrice)){ |
|
|
|
util.showToast('输入单价过高,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/KG-'+ this.data.nowItem.highestUnitPrice + '元/KG') |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.data.nowItem.lowestUnitPrice && Number(this.data.form.unitPrice) < Number(this.data.nowItem.lowestUnitPrice)){ |
|
|
|
util.showToast('输入单价过低,价格范围:' + this.data.nowItem.lowestUnitPrice + '元/KG-'+ this.data.nowItem.highestUnitPrice + '元/KG') |
|
|
|
return |
|
|
|
} |
|
|
|
// if(this.data.deductType == 1 && (util.isEmpty(this.data.form.deductWeight) || Number(this.data.form.deductWeight) <= 0)){
|
|
|
|
// util.showToast('请输入扣重')
|
|
|
|
// return
|
|
|
|
|