| | |
| | | return uni.getStorageSync('roleType'); |
| | | }, |
| | | text() { |
| | | return `已领取${this.cars2}张提煤单,剩余${this.carNumSurplus1}张提煤单`; |
| | | return `已领取${this.cars2}张通知单,剩余${this.carNumSurplus1}张通知单`; |
| | | }, |
| | | text1() { |
| | | return `已拥有${this.carNum}张提煤单,剩余${this.carNumSurplusHuodai}张提煤单`; |
| | | return `已拥有${this.carNum}张通知单,剩余${this.carNumSurplusHuodai}张通知单`; |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 计算提煤单数量,添加或删除时调用 |
| | | // 计算通知单数量,添加或删除时调用 |
| | | calculate(arr) { |
| | | let total = arr.reduce((prev, cur) => { |
| | | return cur.carNum + prev; |
| | | }, 0); |
| | | console.log(total, '提煤单一共的数据'); |
| | | console.log(total, '通知单一共的数据'); |
| | | if (this.roleType == 1) { |
| | | if (Number(this.cars2) >= total) { |
| | | this.carNumSurplus1 = Number(this.cars2) - total; |
| | |
| | | this.whetherClick1 = false; |
| | | } else { |
| | | this.carNumSurplus1 = 0; |
| | | this.$u.toast('剩余提煤单数量不足'); |
| | | this.$u.toast('剩余通知单数量不足'); |
| | | this.whetherClick = true; |
| | | this.whetherClick1 = true; |
| | | } |
| | |
| | | this.whetherClick1 = false; |
| | | } else { |
| | | this.carNumSurplusHuodai = 0; |
| | | this.$u.toast('剩余提煤单数量不足'); |
| | | this.$u.toast('剩余通知单数量不足'); |
| | | this.whetherClick = true; |
| | | this.whetherClick1 = true; |
| | | } |