From 59f7e8823c852655058491749553fec61f4c7168 Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期二, 31 十月 2023 14:36:01 +0800 Subject: [PATCH] # --- pages/business/saleManage/addSaleManage.vue | 102 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 62 insertions(+), 40 deletions(-) diff --git a/pages/business/saleManage/addSaleManage.vue b/pages/business/saleManage/addSaleManage.vue index 975270a..7317116 100644 --- a/pages/business/saleManage/addSaleManage.vue +++ b/pages/business/saleManage/addSaleManage.vue @@ -2,29 +2,33 @@ <view> <view class="container"> <uni-forms ref="baseForm" :modelValue="baseFormData"> - <uni-forms-item label="椤圭洰鍚嶇О" required name="name"> - <uni-easyinput v-model="baseFormData.name" placeholder="璇疯緭鍏ラ」鐩悕绉�" /> + <uni-forms-item label="璺熻釜椤圭洰鍚嶇О" required name="name"> + <uni-easyinput v-model="baseFormData.name" placeholder="璇疯緭鍏ヨ窡韪」鐩悕绉�" /> + </uni-forms-item> + <uni-forms-item label="鐢叉柟鍗曚綅" required name="cstmrId"> + <view @click="autoLoad('cstmr','')"> + <uni-combox :candidates="cstmrs" placeholder="璇烽�夋嫨鐢叉柟鍗曚綅" v-model="baseFormData.cstmrId" + @input="autoLoad('cstmr',baseFormData.cstmrId)"></uni-combox> + </view> </uni-forms-item> <uni-forms-item label="鎵�灞炲叕鍙�" required name="company"> <view @click="autoLoad('company','')"> - <uni-combox :candidates="companies" placeholder="璇烽�夋墍灞炲叕鍙�" - v-model="baseFormData.company" @input="autoLoad('company',baseFormData.company)"></uni-combox> + <uni-combox :candidates="companies" placeholder="璇烽�夋墍灞炲叕鍙�" v-model="baseFormData.company" + @input="autoLoad('company',baseFormData.company)"></uni-combox> </view> </uni-forms-item> - <uni-forms-item label="鐢叉柟鍗曚綅" name="cstmrId"> - <view @click="autoLoad('cstmr','')"> - <uni-combox :candidates="cstmrs" placeholder="璇烽�夋嫨鐢叉柟鍗曚綅" - v-model="baseFormData.cstmrId" @input="autoLoad('cstmr',baseFormData.cstmrId)"></uni-combox> - </view> + <uni-forms-item label="椤圭洰鎬婚噾棰�" name="money"> + <uni-easyinput v-model="baseFormData.money" placeholder="璇疯緭鍏ラ」鐩�婚噾棰�" /> </uni-forms-item> <uni-forms-item label="璐熻矗浜�" name="director"> <view @click="autoLoad('user','')"> - <uni-combox :candidates="directors" placeholder="璇烽�夋嫨璐熻矗浜�" - v-model="baseFormData.director" @input="autoLoad('user',baseFormData.director)"></uni-combox> + <uni-combox :candidates="directors" placeholder="璇烽�夋嫨璐熻矗浜�" v-model="baseFormData.director" + @input="autoLoad('user',baseFormData.director)"></uni-combox> </view> </uni-forms-item> <uni-forms-item label="鐪佸競鍖�" name="citysData"> - <uni-data-picker @change="areaChange" placeholder="璇烽�夋嫨鐪佸競鍖�" popup-title="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" :localdata="citysData" v-model="baseFormData.pcd"> + <uni-data-picker @change="areaChange" placeholder="璇烽�夋嫨鐪佸競鍖�" popup-title="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" + :localdata="citysData" v-model="baseFormData.pcd"> </uni-data-picker> </uni-forms-item> <uni-forms-item label="椤圭洰鎬婚噾棰�" name="money"> @@ -33,7 +37,7 @@ <uni-forms-item label="椤圭洰鍦板潃" name="addr"> <uni-easyinput v-model="baseFormData.addr" placeholder="璇疯緭鍏ラ」鐩湴鍧�" /> </uni-forms-item> - + <uni-forms-item label="澶囨敞" name="remarks"> <uni-easyinput type="textarea" v-model="baseFormData.remarks" placeholder="璇疯緭鍏ュ娉�" /> </uni-forms-item> @@ -74,7 +78,13 @@ name: { rules: [{ required: true, - errorMessage: '璇峰~鍐欏鎴峰悕绉�', + errorMessage: '璇疯緭鍏ヨ窡韪」鐩悕绉�', + }] + }, + cstmrId: { + rules: [{ + required: true, + errorMessage: '璇烽�夋嫨鐢叉柟鍗曚綅', }] }, company: { @@ -97,8 +107,8 @@ } }, onReady() { - // 闇�瑕佸湪onReady涓缃鍒� - this.$refs.baseForm.setRules(this.rules) + // 闇�瑕佸湪onReady涓缃鍒� + this.$refs.baseForm.setRules(this.rules) }, onShow() { // 鑾峰彇鐪佸競鍖� @@ -110,25 +120,30 @@ this.baseFormData.cstmrType = this.cstmrTypes[e.detail.value].id }, areaChange(e) { - this.citysDataTemp = e.detail.value[0].value + ',' + e.detail.value[1].value + ',' + e.detail.value[2].value + this.citysDataTemp = e.detail.value[0].value + ',' + e.detail.value[1].value + ',' + e.detail.value[2] + .value }, - autoLoad(type,condition) { + autoLoad(type, condition) { let that = this that.companies = [] that.directors = [] that.cstmrs = [] var a = that.baseUrl + '/' + type + 'Query/auth' uni.request({ - url: that.baseUrl + '/' + type + 'Query' +'/auth', - header:{'token':uni.getStorageSync('token')}, - data: {condition:condition}, + url: that.baseUrl + '/' + type + 'Query' + '/auth', + header: { + 'token': uni.getStorageSync('token') + }, + data: { + condition: condition + }, method: 'GET', success(result) { var res = result.data if (res.code === 200) { var element; if (type == 'user') { - for(element of res.data) { + for (element of res.data) { that.directors.push(element.value) that.directorList.push(element) } @@ -150,50 +165,50 @@ return } } - + } }) }, listAuth(type) { - - }, + + }, // 娣诲姞璺熻釜椤圭洰 addOrder() { let that = this var element; // 鎵�灞炲叕鍙� for (element of that.companyList) { - if(element.name == that.baseFormData.company) { + if (element.name == that.baseFormData.company) { that.baseFormData.company = element.id } } for (element of that.cstmrList) { - if(element.value == that.baseFormData.cstmrId) { + if (element.value == that.baseFormData.cstmrId) { that.baseFormData.cstmrId = element.id } } for (element of that.directorList) { - if(element.value == that.baseFormData.director) { + if (element.value == that.baseFormData.director) { that.baseFormData.director = element.id } } - this.$refs.baseForm.validate().then(res=>{ + this.$refs.baseForm.validate().then(res => { if (res.addr == undefined) { res.addr = '' } - if(res.money == undefined) { + if (res.money == undefined) { res.money = '' } - if(res.remarks == undefined) { + if (res.remarks == undefined) { res.remarks = '' } res.pcd = this.citysDataTemp uni.request({ url: that.baseUrl + '/order/add/auth', - header:{ - 'token':uni.getStorageSync('token'), - 'content-type':'application/x-www-form-urlencoded', - }, + header: { + 'token': uni.getStorageSync('token'), + 'content-type': 'application/x-www-form-urlencoded', + }, data: res, method: 'POST', success(result) { @@ -201,22 +216,29 @@ if (res.code === 200) { uni.navigateBack() } else if (res.code === 403) { - uni.showToast({title: res.msg, icon: "none", position: 'top'}) + uni.showToast({ + title: res.msg, + icon: "none", + position: 'top' + }) setTimeout(() => { uni.reLaunch({ url: '../../login/login' }); }, 1000); } else { - uni.showToast({title: res.msg, icon: "none",position: 'top'}) + uni.showToast({ + title: res.msg, + icon: "none", + position: 'top' + }) } } }) - }).catch(err =>{ - }) + }).catch(err => {}) } } - + } </script> -- Gitblit v1.9.1