From df31ccf78ab750b60bc05523dfa8d7f859938e16 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期二, 21 十一月 2023 09:46:41 +0800
Subject: [PATCH] #

---
 pages/business/cstmr/modiCsmter.vue |  141 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 121 insertions(+), 20 deletions(-)

diff --git a/pages/business/cstmr/modiCsmter.vue b/pages/business/cstmr/modiCsmter.vue
index a48cdba..e32513b 100644
--- a/pages/business/cstmr/modiCsmter.vue
+++ b/pages/business/cstmr/modiCsmter.vue
@@ -2,45 +2,66 @@
 	<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>
+						v-model="baseFormData.cstmrType$" @input="autoLoad('cstmrType',baseFormData.cstmrType$)"></uni-combox>
 					</view>
 				</uni-forms-item>
+				<uni-forms-item label="瀹㈡埛琛屼笟" required name="industry">
+					<view >
+						<uni-combox :candidates="industrys" placeholder="璇烽�夋嫨瀹㈡埛琛屼笟"
+						v-model="baseFormData.industry"></uni-combox>
+					</view>
+				</uni-forms-item>
+				
+				<uni-forms-item label="浜у搧绫诲埆" required name="productCategory">
+					<view>
+						<uni-combox :candidates="productCategorys" placeholder="璇烽�夋嫨浜у搧绫诲埆"
+						v-model="baseFormData.productCategory"></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>
-				<uni-forms-item label="鐪佸競鍖�" required name="citysData">
-					<uni-data-picker @change="areaChange" placeholder="璇烽�夋嫨鐪佸競鍖�" popup-title="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" :localdata="citysData" v-model="baseFormData.pcd">
+				<uni-forms-item label="鐪佸競鍖�" required name="pcd">
+					<uni-data-picker preload @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="璇疯緭鍏ュ娉�" />
 				</uni-forms-item>
 			</uni-forms>
-			<button type="primary" @click="addCstmr()">娣诲姞</button>
+			<button type="primary" @click="modiCstmr()">淇敼</button>
 		</view>
 	</view>
 </template>
@@ -50,19 +71,26 @@
 	export default {
 		data() {
 			return {
+				ide: 0,
 				cstmrTypes: [],
 				cstmrType: '',
 				directors: [],
 				director: '',
 				cstmrTypeList: [],
 				directorList: [],
+				names: [],
+				nameList: [],
+				industrys: ['鍖昏嵂涓�','鍒堕�犱笟','绾虹粐涓�'],
+				productCategorys: ['绔嬩綋搴擄紙璐ф灦锛�','绔嬩綋搴擄紙闆嗘垚锛�','鍥涘悜绌挎搴�/涓ゅ悜绌挎搴�','闃佹ゼ璐ф灦/閽㈠钩鍙�','鍛ㄨ浆瀹瑰櫒','骞冲簱'],
 				baseFormData: {
+					name: '',
 					citysData: [],
 					cstmrType: '',
 					director: '',
 					rela: '',
 					remarks: '',
-					
+					industry: '',
+					pcd$: ''
 				},
 				rules: {
 					name: {
@@ -83,13 +111,25 @@
 							errorMessage: '璇烽�夋嫨瀹㈡埛绫诲埆',
 						}]
 					},
+					industry: {
+						rules: [{
+							required: true,
+							errorMessage: '璇烽�夋嫨瀹㈡埛琛屼笟'
+						}]
+					},
+					productCategory: {
+						rules: [{
+							required: true,
+							errorMessage: '璇烽�夋嫨浜у搧绫诲埆'
+						}]
+					},
 					type: {
 						rules: [{
 							required: true,
 							errorMessage: '璇烽�夋嫨鍖哄垎',
 						}]
 					},
-					citysData: {
+					pcd: {
 						rules: [{
 							required: true,
 							errorMessage: '璇烽�夋嫨鐪佸競鍖�',
@@ -149,12 +189,72 @@
 			this.autoLoad('cstmrType','')
 			this.autoLoad('user','')
 		},
+		onLoad(option) {
+			if (JSON.stringify(option) != "{}") {
+				this.id = option.id
+				this.init()
+			} else {
+				let _this = this
+				const eventChannel = this.getOpenerEventChannel();
+				eventChannel.on('cstmr', function(data) {
+					_this.id = data.data.id
+					_this.init()
+				})
+			}
+		},
 		methods: {
+			init() {
+				let that = this
+				uni.request({
+					url: that.baseUrl + '/cstmr/' + that.id +'/auth',
+					header: {'token' : uni.getStorageSync('token')},
+					method: 'GET',
+					success(res) {
+						res = res.data
+						for (let key in res.data) {
+							if (res.data[key] === null) {
+								res.data[key] = ''
+							}
+							if (key == 'pcd') {
+								that.citysDataTemp = res.data[key]
+								res.data[key] = res.data[key].split(',')[2]
+							}
+						}
+						that.ide = res.data.id
+						that.baseFormData = res.data
+					}
+				})
+			},
+			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
 			},
 			areaChange(e) {
+				console.log(e);
+				console.log(this.baseFormData.pcd$);
 				this.citysDataTemp = e.detail.value[0].value + ',' + e.detail.value[1].value + ',' + e.detail.value[2].value
 			},
 			autoLoad(type,condition) {
@@ -191,8 +291,8 @@
 					}
 				})
 			},
-			// 娣诲姞鐢ㄦ埛
-			addCstmr() {
+			// 淇敼鐢ㄦ埛
+			modiCstmr() {
 				let that = this
 				var element;
 				for (element of that.directorList) {
@@ -201,7 +301,7 @@
 					}
 				}
 				for (element of that.cstmrTypeList) {
-					if(element.value == that.baseFormData.cstmrType) {
+					if(element.value == that.baseFormData.cstmrType$) {
 						that.baseFormData.cstmrType = element.id
 					}
 				}
@@ -213,8 +313,9 @@
 						res.remarks = ''
 					}
 					res.pcd = this.citysDataTemp
+					res['id'] = this.ide
 					uni.request({
-						url: that.baseUrl + '/cstmr/add/auth',
+						url: that.baseUrl + '/cstmr/update/auth',
 						header:{
 							'token':uni.getStorageSync('token'),
 							'content-type':'application/x-www-form-urlencoded',
@@ -252,4 +353,4 @@
 		background-color: #fff;
 		/* background-color: aqua; */
 	}
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.1