|
|
@@ -155,33 +155,50 @@ export default {
|
|
|
modalCancel() {
|
|
|
this.isModel = false;
|
|
|
this.customData = {};
|
|
|
- }, // 取消 确认
|
|
|
+ },
|
|
|
+ // 取消 确认
|
|
|
affirm(val) {
|
|
|
- if(this.customData.bigCount==0 && this.customData.smallCount==0){
|
|
|
- this.delAllEvent(this.customData)}
|
|
|
+
|
|
|
if (val.index === 0) {
|
|
|
+ this.delAllEvent(this.customData)
|
|
|
this.modalCancel();
|
|
|
- } else {
|
|
|
- const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
|
|
|
- const ratioNum = Number(ratio);
|
|
|
- //超过库存时 设置为库存最大值 1
|
|
|
- if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
|
|
|
- uni.showToast({
|
|
|
- // title: `库存只有${bigNum}${bigUnit}${smallNum}${smallUnit}`,
|
|
|
- title: '库存不足',
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- this.customData.bigCount = 0;
|
|
|
- this.customData.smallCount = 0;
|
|
|
- this.delAllEvent(this.customData)
|
|
|
- } else {
|
|
|
- this.updateItemEvent(this.customData);
|
|
|
- this.modalCancel();
|
|
|
- }
|
|
|
- // this.updateItemEvent(this.customData);
|
|
|
- // this.modalCancel();
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.customData.bigCount==null && this.customData.smallCount==null){
|
|
|
+ this.delAllEvent(this.customData)
|
|
|
+ uni.showToast({title: '请填写数量',icon: "none"})
|
|
|
+ return false
|
|
|
}
|
|
|
|
|
|
+ if(this.customData.bigCount==0 && this.customData.smallCount==0){
|
|
|
+ this.delAllEvent(this.customData)
|
|
|
+ uni.showToast({title: '请填写数量',icon: "none"})
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.customData.bigCount<0 || this.customData.smallCount<0){
|
|
|
+ this.delAllEvent(this.customData)
|
|
|
+ uni.showToast({title: '数量填写错误',icon: "none"})
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
|
|
|
+ const ratioNum = Number(ratio);
|
|
|
+ //超过库存时 设置为库存最大值 1
|
|
|
+ if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '库存不足',
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.customData.bigCount = 0;
|
|
|
+ this.customData.smallCount = 0;
|
|
|
+ this.delAllEvent(this.customData)
|
|
|
+ } else {
|
|
|
+ this.updateItemEvent(this.customData);
|
|
|
+ this.modalCancel();
|
|
|
+ }
|
|
|
+ // this.updateItemEvent(this.customData);
|
|
|
+ // this.modalCancel();
|
|
|
|
|
|
},
|
|
|
cancelEvent() {
|