From 5596cc695d444d9ef13661148d6e227f8ed3171e Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期四, 28 七月 2022 20:25:37 +0800
Subject: [PATCH] '冲突解决'
---
pages/new-application-form-data/new-application-form-data.vue | 248 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 178 insertions(+), 70 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..dc1bf80 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>
@@ -359,7 +363,7 @@
<u-form-item label="鎶戝皹璐�" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.cost2" border="none"></u--input></u-form-item> -->
</u--form>
- <view class="addContractConfirm"><u-button text="娣诲姞" type="primary" @click="addContractSanConfirm"></u-button></view>
+ <view class="addContractConfirm"><u-button :text="editApplicationIndex != null ? '娣诲姞淇敼':'娣诲姞'" type="primary" @click="addContractSanConfirm"></u-button></view>
</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
@@ -533,11 +540,12 @@
<view class="balanceNo" v-if="accountDetails.balanceTotal < 0"><text style="color:red;">瀹㈡埛璐︽埛褰撳墠澶勪簬娆犳鐘舵��</text></view>
<view class="messageCustomerBalance" v-if="accountDetails.balanceTotal >= 0">
- <text style="color: #FFA500;;">瀹㈡埛璐︽埛鐜版眹浣欓:{{ accountDetails.balanceTotal }},鎵垮厬浣欓锛歿{ accountDetails.balance2 == null ? 0 : customerChengdui }}</text>
+ <text style="color: #FFA500;;">瀹㈡埛璐︽埛鐜版眹浣欓:{{ accountDetails.balanceTotal == null ? 0 :accountDetails.balanceTotal.toFixed(2) }},鎵垮厬浣欓锛歿{ 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="cardListIcon" @click="editApplicationClick(index)"><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: [[]],
@@ -774,25 +785,25 @@
loading: false,
// 浠锋牸璇锋眰鍙傛暟
getNewPriceData: {
- compId: 133,
- compName: '閭㈠彴鐭�',
- customerAddressName: '閭㈠彴鍥芥嘲鍙戠數鏈夐檺璐d换鍏徃',
- customerAddressId: 236,
- coalId: 45,
- coalName: '',
- trainType: 1,
- fromStation: '灏忓悍搴�',
- toStation: '灏忓悍搴�',
- quant: '',
- price: '',
- amount: '',
- priceMode: null,
- filedName: '閭㈠彴鐭夸富鐓ゅ満',
- filedId: 4,
- type: '',
- cost1: '',
- cost2: '',
- edit: true
+ // compId: 133,
+ // compName: '閭㈠彴鐭�',
+ // customerAddressName: '閭㈠彴鍥芥嘲鍙戠數鏈夐檺璐d换鍏徃',
+ // customerAddressId: 236,
+ // coalId: 45,
+ // coalName: '',
+ // trainType: 1,
+ // fromStation: '灏忓悍搴�',
+ // toStation: '灏忓悍搴�',
+ // quant: '',
+ // price: '',
+ // amount: '',
+ // priceMode: null,
+ // filedName: '閭㈠彴鐭夸富鐓ゅ満',
+ // filedId: 4,
+ // type: '',
+ // cost1: '',
+ // cost2: '',
+ // edit: true
},
dust: null, // 鎶戝皹璐�
trainfreight: {}, //璺繍杩愯垂
@@ -814,7 +825,8 @@
{
text: '鍒犻櫎'
}
- ]
+ ],
+ editApplicationIndex:null
};
},
onShow() {
@@ -884,36 +896,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 +972,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 +1004,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 +1069,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 +1166,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) {
@@ -1242,6 +1305,8 @@
// 娣诲姞鍚堝悓寮瑰嚭妗�
addContractClose() {
this.addContractShow = false;
+ this.addContractFormdata = {};
+ this.editApplicationIndex = null;
},
addContractOpen() {
console.log('娣诲姞璁㈠崟鎵撳紑');
@@ -1255,6 +1320,7 @@
},
// 閫夋嫨鐨勭叅鍘�
coalFiledSelectClick(e) {
+ console.log('閫夋嫨鐨勭叅鍘�',e);
this.addContractFormdata.compName = e.compName;
this.addContractFormdata.filedName = e.name;
this.addContractFormdata.compId = e.compId;
@@ -1263,7 +1329,14 @@
this.selectCoalFiledData = e;
- this.coalFiledSelectShow = false;
+ // 鑾峰彇浠锋牸鍙傛暟
+ this.getNewPriceData.compId = e.compId;
+ this.getNewPriceData.compName = e.compName;
+ this.getNewPriceData.filedId = e.id;
+ this.getNewPriceData.filedName = e.name;
+
+
+ this.coalFiledSelectShow = false;
},
// 鏀惰揣浜�
addContractConsigneeClose() {
@@ -1275,15 +1348,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 +1370,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);
@@ -1342,7 +1416,7 @@
// this.currentCoal.type = 1;
// }
this.addContractFormdata.modifyId = data.modifyId;
- this.addContractFormdata.id = data.id;
+ // this.addContractFormdata.id = data.id;
} else {
uni.$u.toast('鐓ょ浠锋牸鏈缃�');
}
@@ -1414,10 +1488,14 @@
},
addContractSanConfirm() {
if (this.addContractFormdata.compId && this.addContractFormdata.customerId && this.addContractFormdata.filedId) {
- this.newFormData.contractOrders.push(this.addContractFormdata);
- this.$nextTick(() => {
- this.addContractShow = false;
- });
+ if(this.editApplicationIndex != null){
+ this.newFormData.contractOrders[this.editApplicationIndex] = this.addContractFormdata;
+ } else {
+ this.newFormData.contractOrders.push(this.addContractFormdata);
+ console.log('娣诲姞瀛愯鍗�',this.addContractFormdata);
+ }
+ this.addContractShow = false;// 鍏抽棴寮瑰嚭妗�
+ console.log('this.newFormData.contractOrders褰撳墠鍏抽棴鍚�',this.newFormData.contractOrders)
} else {
uni.$u.toast('璇疯鑼冭緭鍏ユ墍鏈変俊鎭�');
}
@@ -1469,6 +1547,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 +1581,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 +1592,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 +1607,7 @@
duration: 2000
});
} else {
+ console.log('鎻愪氦鏁翠綋',this.newFormData);
this.xswaybill();
}
}
@@ -1534,8 +1621,13 @@
console.log('鍒犻櫎璁㈠崟鍗$墖', e);
this.newFormData.contractOrders.splice(e, 1);
},
+ editApplicationClick(index){
+ this.editApplicationIndex = index;
+ this.addContractFormdata = this.newFormData.contractOrders[index];
+ this.addContractShow = true;
+ },
xswaybill() {
- console.log('鏂板缓鍙戣繍鐢宠');
+ console.log('鏂板缓鍙戣繍鐢宠', this.newFormData);
uni.showLoading({
title: '鍔犺浇涓�...'
});
@@ -1543,17 +1635,19 @@
uni.hideLoading();
console.log('鏂板缓鍙戣繍鐢宠', res);
if (res.code == 0) {
- uni.showToast({
- title: '娣诲姞鎴愬姛锛�',
- icon: 'success',
- duration: 2000
- });
- this.$nextTick(() => {
- uni.navigateBack({
- // url: '/pages/my-application/my-application'
- delta: 2
- });
- });
+ // uni.showToast({
+ // title: '娣诲姞鎴愬姛锛�',
+ // icon: 'success',
+ // duration: 1000
+ // });
+ this.$u.toast('娣诲姞鎴愬姛锛屽嵆灏嗚繑鍥炵敵璇烽〉锛侊紒锛�')
+ setTimeout(() => {
+ uni.navigateBack({
+ // url: '/pages/my-application/my-application'
+ delta: 2
+ });
+ },2000)
+
}
});
},
@@ -1611,6 +1705,14 @@
}
.selectCustomerContainer {
padding: 0 4%;
+ // .loadmoreClass{
+ // .u-loadmore{
+ // .u-loadmore__content{
+ // .u-loadmore__content__text{
+ // }
+ // }
+ // }
+ // }
.searchContainer {
}
.searchCustomerBtn {
@@ -1904,6 +2006,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