| | |
| | | <u-form-item label="输入数量" labelWidth="20%" ref="item1"> |
| | | <view class="forward-card-amount"> |
| | | <view class="forward-card-amount-input"><u--input v-model="val.carNum" placeholder="请输入转发数量"></u--input></view> |
| | | <u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index)"> |
| | | <u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index, val)"> |
| | | <u-checkbox :customStyle="{ marginBottom: '8px' }" size="30" labelSize="30" label="全部转发" name="全部转发" :disabled="val.ischecked"></u-checkbox> |
| | | </u-checkbox-group> |
| | | </view> |
| | |
| | | index: '', |
| | | checkboxValue1: '', |
| | | selectPopupShow: false, |
| | | list1: [ |
| | | { |
| | | name: '车队' |
| | | }, |
| | | { |
| | | name: '货代' |
| | | } |
| | | ], |
| | | list1: [{ name: '车队' }, { name: '货代' }], |
| | | tabHuoDai: false, |
| | | carNumSurplus1: '', |
| | | cars2: '', |
| | | carNum: '', |
| | | carNumSurplusHuodai: '', |
| | | formNum: 1 |
| | | formNum: 1, |
| | | // 个人转发数据 |
| | | personalForward: {} |
| | | }; |
| | | }, |
| | | onShow() { |
| | |
| | | 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: { |
| | | init() { |
| | | console.log('roleType', this.roleType); |
| | | switch (this.roleType) { |
| | | case 1: |
| | | this.getAllHuoDaiByCustomerId(); |
| | |
| | | allrelay(x, y) { |
| | | let a = 0; |
| | | if (y != 0) { |
| | | a = x + y; |
| | | a = Number(x) + Number(y); |
| | | return a; |
| | | } else { |
| | | return x; |
| | | return Number(x); |
| | | } |
| | | }, |
| | | allrelayto(x, y) { |
| | | let a = 0; |
| | | if (y != 0) { |
| | | a = x - y; |
| | | a = Number(x) - Number(y); |
| | | return a; |
| | | } else { |
| | | return x; |
| | | return Number(x); |
| | | } |
| | | }, |
| | | checkboxChange(value, index) { |
| | | checkboxChange(value, index, v) { |
| | | uni.setStorageSync('allrelay', this.jhOrderPlanForwardList[index].carNum); |
| | | this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map((v, i) => { |
| | | return { |
| | |
| | | if (value.length != 0) { |
| | | let tempforwardSurplus = this.forwardSurplus; |
| | | let tempcarNumSurplus1 = this.carNumSurplus1; |
| | | // 计算全部转发数 |
| | | // 客户 |
| | | if (this.roleType == 1) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.jhOrderPlanForwardList[index].carNum, tempcarNumSurplus1); |
| | | if (v.id) { |
| | | this.$reqGet('jhorderplanforward', { forwardId: v.id }).then(res => { |
| | | this.personalForward = res.data; |
| | | // 计算全部转发数 |
| | | // 客户 |
| | | if (this.roleType == 1) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempcarNumSurplus1); |
| | | if (this.jhOrderPlanForwardList[index].carNum == 0) { |
| | | this.jhOrderPlanForwardList[index].carNum == tempcarNumSurplus1; |
| | | } |
| | | } |
| | | tempcarNumSurplus1 = 0; |
| | | // 货代 |
| | | if (this.roleType == 2) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempforwardSurplus); |
| | | } |
| | | tempforwardSurplus = 0; |
| | | }); |
| | | } else { |
| | | if (this.roleType == 1) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.carNumSurplus1; |
| | | // this.allrelay(this.jhOrderPlanForwardList[index].carNum, this.carNumSurplus1); |
| | | } |
| | | tempcarNumSurplus1 = 0; |
| | | if (this.roleType == 2) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.forwardSurplus; |
| | | // this.allrelay(this.jhOrderPlanForwardList[index].carNum, this.forwardSurplus); |
| | | } |
| | | tempforwardSurplus = 0; |
| | | } |
| | | tempcarNumSurplus1 = 0; |
| | | // 货代 |
| | | if (this.roleType == 2) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.jhOrderPlanForwardList[index].carNum, tempforwardSurplus); |
| | | } |
| | | tempforwardSurplus = 0; |
| | | // 选择一个后其余禁止复选 |
| | | this.jhOrderPlanForwardList.forEach((v, i) => { |
| | | if (i !== index) { |
| | |
| | | let tempcarNumSurplus1 = this.carNumSurplus1; |
| | | // 货代 |
| | | if (this.roleType == 2) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelayto(this.jhOrderPlanForwardList[index].carNum, this.forwardSurplus); |
| | | this.jhOrderPlanForwardList[index].carNum = 0; |
| | | if (this.jhOrderPlanForwardList[index].carNum <= 0) { |
| | | this.jhOrderPlanForwardList[index].carNum = 0; |
| | | } |
| | | } |
| | | // 客户 |
| | | if (this.roleType == 1) { |
| | | this.jhOrderPlanForwardList[index].carNum = this.allrelayto(this.jhOrderPlanForwardList[index].carNum, this.carNumSurplus1); |
| | | this.jhOrderPlanForwardList[index].carNum = 0; |
| | | if (this.jhOrderPlanForwardList[index].carNum <= 0) { |
| | | this.jhOrderPlanForwardList[index].carNum = 0; |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | if (this.jhOrderPlanForwardList.length === 0) { |
| | | this.$u.toast('请至少选择一组转发对象'); |
| | | } |
| | | let reg = /^[1-9]\d*$/; |
| | | this.jhOrderPlanForwardList.forEach(v => { |
| | | if (isNaN(Number(v.carNum)) || Number(v.carNum) <= 0) { |
| | | if (!reg.test(v.carNum) || Number(v.carNum) <= 0) { |
| | | this.$u.toast('请输入合法数字'); |
| | | isPass = false; |
| | | return isPass; |