|
|
@@ -182,34 +182,37 @@ export default {
|
|
|
affirm(val) {
|
|
|
this.isFocus = false;
|
|
|
this.isFocusOne = false;
|
|
|
- if (val.index === 0) {
|
|
|
- this.modalCancel();
|
|
|
- } else {
|
|
|
- console.log(this.customData)
|
|
|
- const {
|
|
|
- bigCount,
|
|
|
- smallCount,
|
|
|
- bigNum,
|
|
|
- bigUnit,
|
|
|
- smallNum,
|
|
|
- smallUnit,
|
|
|
- ratio
|
|
|
- } = this.customData;
|
|
|
- const ratioNum = Number(ratio);
|
|
|
-
|
|
|
- //超过库存时 设置为库存最大值
|
|
|
- if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
|
|
|
- uni.showToast({
|
|
|
- title: `库存只有${bigNum}${bigUnit}${smallNum}${smallUnit}`,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- this.customData.bigCount = bigNum;
|
|
|
- this.customData.smallCount = smallNum;
|
|
|
- } else {
|
|
|
- this.updateItemEvent(this.customData);
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ if (val.index === 0) {
|
|
|
this.modalCancel();
|
|
|
+ } else {
|
|
|
+ console.log(this.customData)
|
|
|
+ const {
|
|
|
+ bigCount,
|
|
|
+ smallCount,
|
|
|
+ bigNum,
|
|
|
+ bigUnit,
|
|
|
+ smallNum,
|
|
|
+ smallUnit,
|
|
|
+ ratio
|
|
|
+ } = this.customData;
|
|
|
+ const ratioNum = Number(ratio);
|
|
|
+
|
|
|
+ //超过库存时 设置为库存最大值
|
|
|
+ if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
|
|
|
+ uni.showToast({
|
|
|
+ title: `库存只有${bigNum}${bigUnit}${smallNum}${smallUnit}`,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.customData.bigCount = bigNum;
|
|
|
+ this.customData.smallCount = smallNum;
|
|
|
+ } else {
|
|
|
+ this.updateItemEvent(this.customData);
|
|
|
+ this.modalCancel();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
cancelEvent() {
|
|
|
this.showSubmitModel = false;
|