From 7c3218e12105b87cab21e9ced57c99c339ffac10 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期二, 26 七月 2022 08:51:58 +0800 Subject: [PATCH] tatolpage --- pages/new-application-form-data/new-application-form-data.vue | 149 +++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 118 insertions(+), 31 deletions(-) diff --git a/pages/new-application-form-data/new-application-form-data.vue b/pages/new-application-form-data/new-application-form-data.vue index fe61c3d..3d75a8e 100644 --- a/pages/new-application-form-data/new-application-form-data.vue +++ b/pages/new-application-form-data/new-application-form-data.vue @@ -83,7 +83,7 @@ width: 43px; font-size: 10px; padding: 0;" - @click="selectCustomerOkClick(item.id)" + @click="selectCustomerOkClick(item)" > 閫夋嫨 </button> @@ -91,7 +91,9 @@ </u-cell> </u-cell-group> </view> - + <view class="loadmoreClass"> + <u-loadmore loadmoreText="鐐瑰嚮鍔犺浇鏇村" nomoreText="鏃犳洿澶氭暟鎹�!!!" :status="status" @loadmore="loadingCustomer" fontSize="20" height="30px" /> + </view> <!-- 閫夋嫨鐢ㄦ埛鑿滃崟椤� --> <view class="selectCustomerCompSheet"> <u-action-sheet @@ -347,9 +349,11 @@ <u-form-item label="鍗曚环" labelWidth="20%" ref="item1"> <u--input v-model="addContractFormdata.price" disabled disabledColor="#ffffff" border="none"></u--input> </u-form-item> - <u-form-item label="璁㈠崟閲戦" labelWidth="20%" ref="item1"><u--input v-show="currentRowComputed" v-model="addContractFormdata.amount"></u--input></u-form-item> + <u-form-item label="璁㈠崟閲戦" labelWidth="20%" ref="item1"> + <u--input :disabled="addContractFormdata.trainType == 2" v-show="currentRowComputed" v-model="addContractFormdata.amount"></u--input> + </u-form-item> <u-form-item label="璁㈠崟鏁伴噺" labelWidth="20%" ref="item1"> - <u--input v-model="addContractFormdata.quant" disabled disabledColor="#ffffff" border="none"></u--input> + <u--input :disabled="addContractFormdata.trainType == 1" @input="jisuanAmount" v-model="addContractFormdata.quant"></u--input> </u-form-item> </view> @@ -461,6 +465,9 @@ </u-cell> </u-cell-group> </view> + <view class="loadmoreClass"> + <u-loadmore loadmoreText="鐐瑰嚮鍔犺浇鏇村" nomoreText="鏃犳洿澶氭暟鎹�!!!" :status="status" @loadmore="loadingCustomer" fontSize="20" height="30px" /> + </view> <!-- 閫夋嫨鐢ㄦ埛鑿滃崟椤� --> <view class="selectCustomerCompSheet"> <u-action-sheet @@ -536,8 +543,9 @@ <text style="color: #FFA500;;">瀹㈡埛璐︽埛鐜版眹浣欓:{{ accountDetails.balanceTotal }},鎵垮厬浣欓锛歿{ accountDetails.balance2 == null ? 0 : customerChengdui }}</text> </view> <u-swipe-action> - <u-swipe-action-item @click="deleteContractCardClick" :options="options1" v-for="(item, index) in this.newFormData.contractOrders" :key="index"> + <u-swipe-action-item @click="deleteContractCardClick" :options="options1" v-for="(item, index) in newFormData.contractOrders" :key="index"> <view class="cardList"> + <view class="" class="cardListIcon"><u-icon name="edit-pen" color="#2979ff" size="35"></u-icon></view> <view class="cardList-container"> <view class="cardList_item"> 鏀惰揣浜猴細 @@ -678,7 +686,7 @@ // 鏃堕棿 timeShow: false, mode: 'range', - maxDate: `${year}-${month}-${date + 80}`, + maxDate: `${year}-${month}-${date + 70}`, // 閫夋嫨瀹㈡埛 selectCustomerData: { compIds: '', @@ -687,6 +695,8 @@ current: 1, size: 10 }, + status: 'loadmore', + customerDataAllNum: 0, //瀹㈡埛鍒楄〃鎬绘潯鏁� account: null, //瀹㈡埛璐︽埛淇℃伅 // 鎼滅储瀛楁 selectCompsData: [], @@ -715,6 +725,7 @@ customerName: '' }, contractData: [], + contractNumList: [], // 绫诲瀷 selectContractTypeShow: false, selectContractTypeData: [[]], @@ -884,36 +895,34 @@ return true; }, async currentRowComputed() { + console.log('currentRowComputed'); //鍙樹环鏍肩敤鐨� this.changePriceMode(this.addContractFormdata.priceMode); //鍙樿鍗曢噺 - if (this.addContractFormdata.amount > 0 && this.addContractFormdata.price > 0) { + if (this.addContractFormdata.price > 0 && (this.addContractFormdata.amount > 0 || this.addContractFormdata.quant > 0)) { let price = this.addContractFormdata.price; - if (this.addContractFormdata.trainType == 2) { + if (this.addContractFormdata.trainType == 1) { + let q = this.addContractFormdata.amount / price; + this.addContractFormdata.quant = q.toFixed(2); + this.addContractFormdata.cost1 = null; //杩愯垂 + this.addContractFormdata.cost2 = null; //鎶戝皹璐� + } else if (this.addContractFormdata.trainType == 2) { //濡傛灉璺繍浠锋牸澧炲姞鎶戝皹璐瑰拰杩愯垂 let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //璺繍杩愯垂 price += cost1Price; price += this.dust; - } - let q = this.addContractFormdata.amount / price; - this.addContractFormdata.quant = q.toFixed(2); - if (this.addContractFormdata.trainType == 2) { - let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //璺繍杩愯垂 this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //杩愯垂 this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //鎶戝皹璐� - console.log('杩愯垂锛屾姂灏樿垂锛�', this.addContractFormdata.cost1, this.addContractFormdata.cost2); - } else { - this.addContractFormdata.cost1 = null; //杩愯垂 - this.addContractFormdata.cost2 = null; //鎶戝皹璐� + + let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2); + console.log(amount); + this.addContractFormdata.amount = amount.toFixed(2); + // console.log('杩愯垂锛屾姂灏樿垂锛�', this.addContractFormdata.cost1, this.addContractFormdata.cost2); } } else { this.addContractFormdata.quant = null; } - // if (this.currentRow.quant > 0 && this.currentRow.price > 0) { - // this.currentRow.amount = this.currentRow.quant * this.currentRow.price; - // return true; - // } return true; } // accountMsg() { @@ -962,6 +971,20 @@ combinationTitle }, methods: { + async jisuanAmount() { + if (this.addContractFormdata.trainType == 2) { + let price = this.addContractFormdata.price; + //濡傛灉璺繍浠锋牸澧炲姞鎶戝皹璐瑰拰杩愯垂 + let cost1Price = await this.getFreight(this.addContractFormdata.fromStation, this.addContractFormdata.toStation, this.addContractFormdata.customerAddressId); //璺繍杩愯垂 + price += cost1Price; + price += this.dust; + this.addContractFormdata.cost1 = (this.addContractFormdata.quant * cost1Price).toFixed(2); //杩愯垂 + this.addContractFormdata.cost2 = (this.addContractFormdata.quant * this.dust).toFixed(2); //鎶戝皹璐� + let amount = Number(price * this.addContractFormdata.quant) + Number(this.addContractFormdata.cost1) + Number(this.addContractFormdata.cost2); + console.log(amount); + this.addContractFormdata.amount = amount.toFixed(2); + } + }, init() { this.jcfavouredpolicyitem(); this.coalfiled(); @@ -980,10 +1003,13 @@ title: '鍔犺浇涓�...' }); this.selectCustomerShow = true; + this.selectCustomerData.current = 1; this.$reqGet('customer', this.selectCustomerData).then(res => { + console.log('瀹㈡埛鍛靛懙鍝堝搱鍝堟垨', res); uni.hideLoading(); if (res.code == 0) { this.customerData = res.data.records; + this.customerDataAllNum = res.data.total; } }); }, @@ -1042,15 +1068,47 @@ this.selectCustomer(); }, selectCustomerOkClick(v) { - console.log('id', v); - this.$reqGet('getAccount', { customerId: v }).then(res => { + console.log('澶栧眰瀹㈡埛閫夋嫨', v); + this.newFormData.customerName = v.customerName; + this.newFormData.customerId = v.id; + this.$reqGet('getAccount', { customerId: v.id }).then(res => { + console.log('瀹㈡埛閫夋嫨璐︽埛', res); this.accountDetails = res.data; - this.newFormData.customerName = res.data.customerName; - this.newFormData.customerId = res.data.id; this.searchContractForm.customerName = res.data.customerName; + this.reqContract(); + this.$nextTick(() => { + this.contractData.forEach(item => { + this.contractNumList.push(item.num); + }); + console.log('鍚堝悓鍙风爜鍒楄〃', this.contractNumList); + // 妫�鏌ユ崲瀹㈡埛鍚庡搴旂殑鍚堝悓 + if (this.contractNumList.indexOf(this.newFormData.contractNum) > -1) { + this.newFormData.contractNum = ''; + this.newFormData.contractName = ''; + } + }); }); this.$nextTick(() => { this.selectCustomerShow = false; + }); + }, + loadingCustomer() { + console.log('鍔犺浇鏇村浜嬩欢'); + if (this.selectCustomerData.current >= this.customerDataAllNum / 10) return; + this.status = 'loading'; + this.selectCustomerData.current = ++this.selectCustomerData.current; + this.$reqGet('customer', this.selectCustomerData).then(res => { + if (this.selectCustomerData.current >= this.customerDataAllNum / 10) { + this.status = 'nomore'; + this.$u.toast('娌℃湁鏇村鏁版嵁浜嗭紒'); + } + uni.hideLoading(); + if (res.code == 0) { + this.customerDataAllNum = res.data.total; + this.customerData = this.customerData.concat(res.data.records); + this.status = 'loadmore'; + console.log(this.selectCustomerData); + } }); }, // 鏃堕棿 @@ -1107,6 +1165,10 @@ this.$reqGet('contract_status').then(res => { console.log('鐘舵��', res); }); + this.reqContract(); + }, + // 鍚堝悓璇锋眰 + reqContract() { this.$reqGet('contract', this.searchContractForm).then(res => { uni.hideLoading(); if (res.code == 0) { @@ -1275,15 +1337,16 @@ this.addContractConsigneeShow = true; }, addContractConsigneeConfirm(v) { + console.log('鏀惰揣浜�', v); this.addContractFormdata.toStation = v.toStation; this.addContractFormdata.customerName = v.customerName; + this.addContractFormdata.customerId = v.id; this.$reqGet('getAccount', { customerId: v.id }).then(res => { console.log('鑾峰彇鏀惰揣浜鸿处鍙�', res); // this.accountDetails = res.data; // this.newFormData.customerName = res.data.customerName; // this.newFormData.customerId = res.data.id; // this.searchContractForm.customerName = res.data.customerName; - this.addContractFormdata.customerId = res.data.id; }); this.$nextTick(() => { this.addContractConsigneeShow = false; @@ -1296,13 +1359,13 @@ this.addContractFormdata.toStation = v.toStation; this.addContractFormdata.customerAddressId = v.id; - + // 娣诲姞鐓ょ閫夐」 this.contractDetails.forEach(item => { let a = [{ label: '', id: '' }]; a[0].label = item.coalName; a[0].id = item.coalId; - if(this.addContractCoalData[0]){ + if (this.addContractCoalData[0]) { this.addContractCoalData = []; } this.addContractCoalData.push(a); @@ -1415,6 +1478,7 @@ addContractSanConfirm() { if (this.addContractFormdata.compId && this.addContractFormdata.customerId && this.addContractFormdata.filedId) { this.newFormData.contractOrders.push(this.addContractFormdata); + console.log('娣诲姞瀛愯鍗�',this.addContractFormdata); this.$nextTick(() => { this.addContractShow = false; }); @@ -1469,6 +1533,7 @@ // 鑾峰彇鎵�鏈夌殑浼樻儬鏀跨瓥 getFavouredPolicyItem() { this.$reqGet('getFavouredPolicyItem', { current: 1, size: 1000, status: 0 }).then(res => { + console.log('鎵�鏈変紭鎯犳斂绛�', res.data.records); this.favouredpolicyListAll = res.data.records; }); }, @@ -1502,7 +1567,10 @@ amount += Number(e.amount); }); if (this.newFormData.payType == '0') { - if (this.accountDetails.balance < amount) { + if (this.newFormData.contractOrders.length <= 0) { + this.$u.toast('璇锋坊鍔犺鍗曞瓙椤癸紒'); + return false; + } else if (this.accountDetails.balance < amount) { let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance; uni.showToast({ title: '瀹㈡埛璐︽埛鐜版眹浣欓涓嶈冻锛岀幇姹囦綑棰�:' + msg, @@ -1510,10 +1578,14 @@ duration: 2000 }); } else { + console.log('鎻愪氦鏁翠綋',this.newFormData); this.xswaybill(); } } else { - if (this.accountDetails.balance2 < amount) { + if (this.newFormData.contractOrders.length <= 0) { + this.$u.toast('璇锋坊鍔犺鍗曞瓙椤癸紒'); + return false; + } else if (this.accountDetails.balance2 < amount) { let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2; uni.showToast({ title: '瀹㈡埛璐︽埛鎵垮厬浣欓涓嶈冻锛屾壙鍏戜綑棰�:' + msg, @@ -1521,6 +1593,7 @@ duration: 2000 }); } else { + console.log('鎻愪氦鏁翠綋',this.newFormData); this.xswaybill(); } } @@ -1535,7 +1608,7 @@ this.newFormData.contractOrders.splice(e, 1); }, xswaybill() { - console.log('鏂板缓鍙戣繍鐢宠'); + console.log('鏂板缓鍙戣繍鐢宠', this.newFormData); uni.showLoading({ title: '鍔犺浇涓�...' }); @@ -1611,6 +1684,14 @@ } .selectCustomerContainer { padding: 0 4%; + // .loadmoreClass{ + // .u-loadmore{ + // .u-loadmore__content{ + // .u-loadmore__content__text{ + // } + // } + // } + // } .searchContainer { } .searchCustomerBtn { @@ -1904,6 +1985,12 @@ height: vww(130); border-radius: vww(4); padding: vww(10); + position: relative; + .cardListIcon { + position: absolute; + right: vww(20); + top: vww(20); + } .cardList-container { .cardList_item { margin-top: vww(12); -- Gitblit v1.9.1