From 8fc8838a441ae3d3b1616f4fc003b16292978b54 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期一, 19 十二月 2022 11:19:45 +0800 Subject: [PATCH] 注册,登录,主页,日计划的修改 --- pages/edit-my-application/edit-my-application.vue | 176 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 133 insertions(+), 43 deletions(-) diff --git a/pages/edit-my-application/edit-my-application.vue b/pages/edit-my-application/edit-my-application.vue index 380cf20..8d27101 100644 --- a/pages/edit-my-application/edit-my-application.vue +++ b/pages/edit-my-application/edit-my-application.vue @@ -4,6 +4,9 @@ <combination-title class="newApplicationTitle" title="鏂板"></combination-title> <view class="formDataContaniner"> <u--form labelPosition="left" :model="newFormData" ref="formRef"> + <u-form-item @click="selectLedger" labelWidth="20%" label="璐﹀" borderBottom> + <u--input disabled disabledColor="#ffffff" v-model="ledgerName" border="none"></u--input> + </u-form-item> <u-form-item labelWidth="20%" label="缁撶畻瀹㈡埛" borderBottom ref="customerNameRef"> <u--input v-model="newFormData.customerName" disabled disabledColor="#ffffff" border="none"></u--input> </u-form-item> @@ -27,8 +30,19 @@ </u--form> </view> + <!-- 閫夋嫨璐﹀ --> + <u-picker + @change="selectLedgerChange" + @confirm="selectLedgerConfirm" + @cancel="selectLedgerCancel" + @close="selectLedgerClose" + :show="selectLedgerShow" + :columns="ledgerList" + keyName="name" + ></u-picker> + <!-- 鐢宠鏃ュ巻銆佽寖鍥存椂闂� --> - <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110" :maxDate="maxDate"></u-calendar> + <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110"></u-calendar> <!-- 娣诲姞鍚堝悓瀛愰」 --> <view class="addContractContainer"> <u-popup :show="addContractShow" @close="addContractClose" @open="addContractOpen" mode="bottom" round="22"> @@ -381,6 +395,7 @@ <script> import combinationTitle from '@/components/common/combined-title/combined-title.vue'; import popupMenu from '@/components/common/popup-menu/popup-menu.vue'; +import { BaseUrl } from '@/utils/request.js'; // 鏈�澶ф樉绀虹殑鏃ユ湡 const d = new Date(); @@ -391,6 +406,10 @@ export default { data() { return { + // 璐﹀閫夋嫨鍣� + selectLedgerShow: false, + ledgerList: [], + ledgerName: '', applicationOrderIndex: null, tdStyle: 'max-height: 30px;overflow: scroll;', spanStyle: 'overflow:auto', @@ -408,7 +427,6 @@ // 鏃堕棿 timeShow: false, mode: 'range', - maxDate: `${year}-${month}-${date + 70}`, // 閫夋嫨瀹㈡埛 selectCustomerData: { compIds: '', @@ -637,6 +655,7 @@ } }, init() { + this.getLedgerList(); // 璐﹀鍒楄〃 this.jcfavouredpolicyitem(); this.coalfiled(); this.coalprice(); @@ -646,6 +665,76 @@ this.fetchCompTree(); this.getFavouredPolicyItem(); this.editApplicationFormData(); // 淇敼鐢宠琛ㄥ崟璇︽儏 + }, + /** + * 鑾峰彇鍒嗙被璐﹀ + */ + getLedgerList() { + this.$reqGet('zhaccountledger', { compId: uni.getStorageSync('userInfo').compId }).then(res => { + this.ledgerList.push(res.data.records); + // console.log('璐﹀鍒楄〃',this.ledgerList); + // if (res.data.records) { + // this.newFormData.ledgerId = res.data.records[0].id; + // this.ledgerName = res.data.records[0].name; + // } + }); + }, + selectLedger() { + this.selectLedgerShow = true; + }, + selectLedgerChange(index) { + console.log('璐﹀閫夋嫨鍣�', index); + + + + // if(this.newFormData.customerName||this.newFormData.contractNum||this.newFormData.contractName){ + // this.newFormData.customerName = ''; + // this.newFormData.contractNum = ''; + // this.newFormData.contractName = ''; + // } + }, + async selectLedgerConfirm(index) { + console.log('閫夋嫨璐﹀鐐瑰嚮纭畾', index); + this.selectLedgerShow = false; + + await this.$reqGet('getAccount', { customerId: this.newFormData.customerId, ledgerId: index.value[0].id }).then(res => { + let accountReq = res.data; + let amountPrice = 0; + this.newFormData.contractOrders.forEach(item => { + amountPrice += Number(item.amount); + }); + console.log('浠锋牸鍚堣', amountPrice); + if (this.newFormData.payType == 0) { + if (accountReq.balance > amountPrice) { + this.ledgerName = index.value[0].name; + this.newFormData.ledgerId = index.value[0].id; + this.accountDetails = accountReq; + } else { + uni.showToast({ + title: '璐︽埛鍐呯幇姹囦綑棰濓細' + accountReq.balance +'锛屼笉瓒虫敮浠樼幇鍦ㄨ鍗�', + icon: 'none' + }); + } + } else if (this.newFormData.payType == 1) { + if (accountReq.balance2 > amountPrice) { + this.ledgerName = index.value[0].name; + this.newFormData.ledgerId = index.value[0].id; + this.accountDetails = accountReq; + } else { + uni.showToast({ + title: '璐︽埛鍐呮壙鍏戜綑棰濓細'+accountReq.balance2+'锛屼笉瓒虫敮浠樼幇鍦ㄨ鍗�', + icon: 'none' + }); + } + } + }); + + }, + selectLedgerCancel() { + this.selectLedgerShow = false; + }, + selectLedgerClose() { + this.selectLedgerShow = false; }, // 鍒濆鍖栫敵璇疯〃鍗� async editApplicationFormData() { @@ -658,6 +747,7 @@ console.log('鏁翠綋璇︽儏', res.data); this.newFormData = res.data; this.timeDataStr = this.newFormData.startDate; + this.ledgerName = res.data.ledgerName; }); // 鑾峰彇鍚堝悓璇︽儏锛岀叅绉� @@ -665,7 +755,7 @@ // 鍒濆鍖栧綋鍓嶇敵璇峰鎴疯处鎴锋儏鍐� if (this.newFormData.customerId) { - await this.$reqGet('getAccount', { customerId: this.newFormData.customerId }).then(res => { + await this.$reqGet('getAccount', { customerId: this.newFormData.customerId, ledgerId: this.newFormData.ledgerId }).then(res => { this.accountDetails = res.data; }); } @@ -821,7 +911,7 @@ selectCustomerOkClick(v) { this.newFormData.customerName = v.customerName; this.newFormData.customerId = v.id; - this.$reqGet('getAccount', { customerId: v.id }).then(res => { + this.$reqGet('getAccount', { customerId: v.id,ledgerId: this.newFormData.ledgerId }).then(res => { this.accountDetails = res.data; this.searchContractForm.customerName = res.data.customerName; @@ -893,7 +983,9 @@ quant: '', toStation: '', trainType: 1, - type: '' + type: '', + ledgerId:null, + ledgerName:'' }; // 杩愯緭绫诲瀷鍒濆鍖� switch (this.addContractFormdata.trainType) { @@ -949,21 +1041,11 @@ addContractConsignee() { 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.$nextTick(() => { - this.addContractConsigneeShow = false; - }); // 璧嬪�肩粰鍙栦环鏍艰姹傚弬鏁� this.getNewPriceData.customerAddressName = v.customerFullName; @@ -983,6 +1065,7 @@ } this.addContractCoalData.push(a); }); + this.addContractConsigneeShow = false; }, // 鍝佺閫夋嫨鍣� addContractCoalConfirm(e) { @@ -1183,40 +1266,43 @@ this.newFormData.contractOrders.forEach(e => { amount += Number(e.amount); }); - if (this.newFormData.payType == '0') { - 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; - this.$u.toast('瀹㈡埛璐︽埛鎵垮厬浣欓涓嶈冻锛屾壙鍏戜綑棰�:' + msg); - } else { - uni.showLoading({ - title: '鍔犺浇涓�...' - }); - this.editShenQing(); - // this.xswaybill(); + console.log(typeof this.newFormData.payType); + if (this.newFormData.contractOrders.length > 0) { + if (this.newFormData.payType == 0) { + if (this.accountDetails.balance < amount) { + let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance; + this.$u.toast('瀹㈡埛璐︽埛鐜版眹浣欓涓嶈冻锛屾壙鍏戜綑棰�:' + msg); + } else { + uni.showLoading({ + title: '鍔犺浇涓�...' + }); + this.editShenQing(); + // this.xswaybill(); + } + } else if (this.newFormData.payType == 1) { + if (this.accountDetails.balance2 < amount) { + let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2; + this.$u.toast('瀹㈡埛璐︽埛鎵垮厬浣欓涓嶈冻锛屾壙鍏戜綑棰�:' + msg); + } else { + uni.showLoading({ + title: '鍔犺浇涓�...' + }); + this.editShenQing(); + } } } else { - 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; - this.$u.toast('瀹㈡埛璐︽埛鎵垮厬浣欓涓嶈冻锛屾壙鍏戜綑棰�:' + msg); - } else { - uni.showLoading({ - title: '鍔犺浇涓�...' - }); - this.editShenQing(); - } + uni.showToast({ + title: '璇锋坊鍔犺鍗曞瓙椤癸紒', + icon: 'none' + }); } }, // 淇敼鐢宠淇℃伅 editShenQing() { + console.log('editApp-------'); uni .request({ - url: this.baseUrl + '/yunxiao/xswaybill', + url: BaseUrl + '/yunxiao/xswaybill', method: 'PUT', data: this.newFormData, header: { @@ -1227,7 +1313,11 @@ }) .then(res => { uni.hideLoading(); - this.$u.toast('淇敼鎴愬姛'); + uni.showToast({ + title:'淇敼鎴愬姛!', + icon:'none', + duration:1500 + }) this.$nextTick(() => { uni.navigateBack({ delta: 1 -- Gitblit v1.9.1