From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期日, 07 四月 2024 15:53:37 +0800
Subject: [PATCH] #

---
 pages/business/cstmr/addCsmtr.vue |  126 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 110 insertions(+), 16 deletions(-)

diff --git a/pages/business/cstmr/addCsmtr.vue b/pages/business/cstmr/addCsmtr.vue
index 6c4624f..94d805f 100644
--- a/pages/business/cstmr/addCsmtr.vue
+++ b/pages/business/cstmr/addCsmtr.vue
@@ -2,18 +2,39 @@
 	<view>
 		<view class="container">
 			<uni-forms ref="baseForm" :modelValue="baseFormData">
-				<uni-forms-item label="瀹㈡埛鍚嶇О" required name="name">
+				<!-- <uni-forms-item label="瀹㈡埛鍚嶇О" required name="name">
 					<uni-easyinput v-model="baseFormData.name" placeholder="璇疯緭鍏ュ鎴峰悕绉�" />
+				</uni-forms-item> -->
+				
+				<uni-forms-item label="瀹㈡埛鍚嶇О" required name="name">
+					<view>
+						<uni-combox :candidates="names" placeholder="璇疯緭鍏ュ鎴峰悕绉�"
+						v-model="baseFormData.name" @input="cstmrSearch()"></uni-combox>
+					</view>
 				</uni-forms-item>
-				<uni-forms-item label="瀹㈡埛鍏崇郴" name="rela" >
-					<uni-easyinput v-model="baseFormData.rela" placeholder="璇疯緭鍏ュ鎴峰叧绯�" />
-				</uni-forms-item>
+				
 				<uni-forms-item label="瀹㈡埛绫诲埆" required name="cstmrType">
 					<view @click="autoLoad('cstmrType','')">
 						<uni-combox :candidates="cstmrTypes" placeholder="璇烽�夋嫨瀹㈡埛绫诲埆"
 						v-model="baseFormData.cstmrType" @input="autoLoad('cstmrType',baseFormData.cstmrType)"></uni-combox>
 					</view>
 				</uni-forms-item>
+				<uni-forms-item label="瀹㈡埛琛屼笟" name="industry" required>
+					<view @click="autoLoad('customerIndustryName','')">
+						<uni-combox :candidates="industrys" placeholder="璇烽�夋嫨瀹㈡埛琛屼笟" 
+						v-model="baseFormData.industry"
+							@input="autoLoad('customerIndustryName',baseFormData.industry)"></uni-combox>
+					</view>
+				</uni-forms-item>
+				
+				<uni-forms-item label="浜у搧绫诲瀷" name="productCategory" required>
+					<view @click="autoLoad('orderProductType','')">
+						<uni-combox :candidates="productCategorys" placeholder="璇烽�夋嫨浜у搧绫诲瀷" 
+						v-model="baseFormData.productCategory"
+							@input="autoLoad('orderProductType',baseFormData.orderProductTypeId)"></uni-combox>
+					</view>
+				</uni-forms-item>
+				
 				<uni-forms-item label="鍖哄垎" required name="type">
 					<uni-data-checkbox v-model="baseFormData.type" :localdata="type$" />
 				</uni-forms-item>
@@ -21,20 +42,22 @@
 					<uni-data-picker @change="areaChange" placeholder="璇烽�夋嫨鐪佸競鍖�" popup-title="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" :localdata="citysData" v-model="baseFormData.pcd">
 					</uni-data-picker>
 				</uni-forms-item>
-				<uni-forms-item label="鐢佃瘽" required name="tel">
-					<uni-easyinput v-model="baseFormData.tel" placeholder="璇疯緭鍏ュ鎴风數璇�" />
-				</uni-forms-item>
 				<uni-forms-item label="璇︾粏鍦板潃" required name="addr">
 					<uni-easyinput v-model="baseFormData.addr" placeholder="璇疯緭鍏ヨ缁嗗湴鍧�" />
 				</uni-forms-item>
-				<uni-forms-item label="璐熻矗浜�" required name="director">
+				
+				
+				<!-- <uni-forms-item label="璐熻矗浜�" required name="director">
 					<view @click="autoLoad('user','')">
 						<uni-combox :candidates="directors" placeholder="璇烽�夋嫨璐熻矗浜�"
 						v-model="baseFormData.director" @input="autoLoad('user',baseFormData.director)"></uni-combox>
 					</view>
-				</uni-forms-item>
+				</uni-forms-item> -->
 				<uni-forms-item label="瀹㈡埛鑱旂郴浜�" required name="contacts">
 					<uni-easyinput v-model="baseFormData.contacts" placeholder="璇疯緭鍏ュ鎴疯仈绯讳汉" />
+				</uni-forms-item>
+				<uni-forms-item label="鐢佃瘽" required name="tel">
+					<uni-easyinput v-model="baseFormData.tel" placeholder="璇疯緭鍏ュ鎴风數璇�" />
 				</uni-forms-item>
 				<uni-forms-item label="澶囨敞" name="remarks">
 					<uni-easyinput type="textarea" v-model="baseFormData.remarks" placeholder="璇疯緭鍏ュ娉�" />
@@ -50,20 +73,26 @@
 	export default {
 		data() {
 			return {
-				baseUrl: '',
 				cstmrTypes: [],
 				cstmrType: '',
 				directors: [],
 				director: '',
 				cstmrTypeList: [],
 				directorList: [],
+				names: [],
+				nameList: [],
+				industrys: [],
+				industryList: [],
+				productCategorys: [],
+				productCategoryList: [],
 				baseFormData: {
+					name: '',
 					citysData: [],
 					cstmrType: '',
 					director: '',
 					rela: '',
 					remarks: '',
-					
+					industry: ''
 				},
 				rules: {
 					name: {
@@ -82,6 +111,18 @@
 						rules: [{
 							required: true,
 							errorMessage: '璇烽�夋嫨瀹㈡埛绫诲埆',
+						}]
+					},
+					industry: {
+						rules: [{
+							required: true,
+							errorMessage: '璇烽�夋嫨瀹㈡埛琛屼笟'
+						}]
+					},
+					productCategory: {
+						rules: [{
+							required: true,
+							errorMessage: '璇烽�夋嫨浜у搧绫诲埆'
 						}]
 					},
 					type: {
@@ -136,7 +177,8 @@
 					value: 2
 				}],
 				citysData: [],
-				citysDataTemp: ''
+				citysDataTemp: '',
+				uraddr: 'add'
 				
 			}
 		},
@@ -144,14 +186,42 @@
 				// 闇�瑕佸湪onReady涓缃鍒�
 				this.$refs.baseForm.setRules(this.rules)
 		},
-		mounted() {
+		onShow() {
 			// 鑾峰彇鐪佸競鍖�
 			this.citysData = test.citysData
-			this.baseUrl = uni.getStorageSync('baseUrl')
 			this.autoLoad('cstmrType','')
 			this.autoLoad('user','')
+			this.autoLoad('orderProductType','')
+		},
+		onLoad(option) {
+			if(option.type == 1) {
+				this.uraddr = 'add2'
+			}
 		},
 		methods: {
+			cstmrSearch() {
+				this.names = []
+				let _this = this
+				if(_this.baseFormData.name.length < 4) {
+					return
+				}
+				uni.request({
+					url: `${_this.baseUrl}/cstmrSearch/auth`,
+					header:{'token':uni.getStorageSync('token'),'content-type':'application/x-www-form-urlencoded',},
+					data: {condition: _this.baseFormData.name},
+					method: 'POST',
+					success(res) {
+						res = res.data
+						if (res.code === 200 && res.data.length > 0) {
+							for(let element of res.data) {
+								_this.names.push(element.name)
+								_this.nameList.push(element)
+							}
+						}
+					}
+				})
+				
+			},
 			bindPickerChange: function(e) {
 				this.cstmrTypeIndex = e.detail.value
 				this.baseFormData.cstmrType = this.cstmrTypes[e.detail.value].id
@@ -164,6 +234,7 @@
 				that.cstmrTypes = []
 				that.directors = []
 				that.directorList = []
+				that.industrys = []
 				var a = that.baseUrl + '/' + type + 'Query/auth'
 				uni.request({
 					url: that.baseUrl + '/' + type + 'Query' +'/auth',
@@ -188,7 +259,20 @@
 								}
 								return
 							}
-							
+							if (type == 'orderProductType') {
+								for (element of res.data) {
+									that.productCategorys.push(element.value)
+									that.productCategoryList.push(element)
+								}
+								return
+							}
+							if (type == 'customerIndustryName') {
+								for (element of res.data) {
+									that.industrys.push(element.value)
+									that.industryList.push(element)
+								}
+								return
+							}
 						}
 					}
 				})
@@ -207,6 +291,16 @@
 						that.baseFormData.cstmrType = element.id
 					}
 				}
+				for (element of that.productCategoryList) {
+					if(element.value == that.baseFormData.productCategory) {
+						that.baseFormData.productCategory = element.id
+					}
+				}
+				for (element of that.industryList) {
+					if(element.value == that.baseFormData.industry) {
+						that.baseFormData.industry = element.id
+					}
+				}
 				this.$refs.baseForm.validate().then(res=>{
 					if (res.rela == undefined) {
 						res.rela = ''
@@ -216,7 +310,7 @@
 					}
 					res.pcd = this.citysDataTemp
 					uni.request({
-						url: that.baseUrl + '/cstmr/add/auth',
+						url: `${that.baseUrl}/cstmr/${that.uraddr}/auth`,
 						header:{
 							'token':uni.getStorageSync('token'),
 							'content-type':'application/x-www-form-urlencoded',

--
Gitblit v1.9.1