From 73b874c72ad55eb9eef21c36160ac0de58f0189e Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Thu, 05 Feb 2026 10:30:43 +0800
Subject: [PATCH] 优化名片

---
 mobile/pages/shop/register.vue |  153 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 140 insertions(+), 13 deletions(-)

diff --git a/mobile/pages/shop/register.vue b/mobile/pages/shop/register.vue
index 1e39119..043083e 100644
--- a/mobile/pages/shop/register.vue
+++ b/mobile/pages/shop/register.vue
@@ -28,6 +28,14 @@
 							<view class="icon iconfont icon-yanzhengma"></view>
 							<input type="text" name="code" v-model="form.code" placeholder='请输入验证码' />
 						</view>
+						<picker class="" value="" @change="changeSupplierType($event)"
+							:range="supplier_type_list">
+							<view class="certification_head_body_item d-b-c">
+								<view class="make-item input-box flex-1" v-if="supplier_type_name_active">{{supplier_type_name_active}}</view>
+								<view class="make-item input-box flex-1" style="color: #777777;" v-else>请选择供应商类型</view>
+								<view class="icon iconfont icon-jiantou" style="font-size: 24rpx;"></view>
+							</view>
+						</picker>
 						<picker class="" value="" @change="changeSelect($event)"
 							:range="classify_data_name">
 							<view class="certification_head_body_item d-b-c">
@@ -36,6 +44,19 @@
 								<view class="icon iconfont icon-jiantou" style="font-size: 24rpx;"></view>
 							</view>
 						</picker>
+						<view class="certification_head_body_item d-b-c">
+							<view class="icon iconfont icon-dizhi1"></view>
+							<view class="input-box flex-1">
+								<input class="f32 flex-1 p-30-0" name="location_address" type="text" placeholder-class="gray9" placeholder="请选择地址" v-model="address.location_address"
+								 disabled @click="chooseLocation" />
+							</view>
+							<view class="icon iconfont icon-jiantou" style="font-size: 24rpx;"></view>
+						</view>
+						<view class="certification_head_body_item">
+							<view class="icon iconfont icon-diliweizhi"></view>
+							<textarea class="flex-1 f32 p-30-0 lh150" name="house_number" placeholder-class="grary9" :auto-height="true"
+							 v-model="address.house_number" placeholder="请输入街道小区楼牌号等"></textarea>
+						</view>
 						<picker class="" value="" @change="changeArea($event)"
 							:range="area_data_name" v-if="area_data_id.length > 0">
 							<view class="certification_head_body_item d-b-c">
@@ -104,13 +125,29 @@
 				area_data_id: '', //列表id
 				area_data_name_active: '', //当前选中的列表名字
 				area_data_id_active: '', //当前选中的列表id
+				supplier_type_list: [], //供应商类型列表
+				supplier_type_ids: [], //供应商类型ID列表
+				supplier_type_name_active: '', //当前选中的供应商类型名称
+				supplier_type_id_active: '', //当前选中的供应商类型ID
+				classify_all_data: [], //保存所有分类数据
 				/*当前秒数*/
 				second: 60,
 				send_btn_txt: '获取验证码',
 				/*是否已发验证码*/
 				is_send: false,
 				sms_open: 0,
-				store_open:false
+				store_open:false,
+				location_address:'',
+				address:{
+					location_address:'',
+					house_number:'',
+					longitude:'',
+					latitude:'',
+				},
+				province_id: 0,
+				city_id: 0,
+				region_id: 0,
+				region:[]
 			}
 		},
 		mounted() {
@@ -166,20 +203,51 @@
 				self._post('supplier.apply/category', {
 
 				}, function(res) {
-					let list_name = [];
-					let list_id = [];
-					//合成select列表
-					for (var i = 0; i < res.data.list.length; i++) {
-						list_name.push(res.data.list[i].name);
-					}
-					//合成上传所需id数组
-					for (var i2 = 0; i2 < res.data.list.length; i2++) {
-						list_id.push(res.data.list[i2].category_id);
-					}
-					self.classify_data_name = list_name;
-					self.classify_data_id = list_id;
+					// 保存所有分类数据(新的数据结构:list是对象,key是类型ID)
+					self.classify_all_data = res.data.list || {};
 					self.sms_open = res.data.sms_open;
+
+					// 处理供应商类型列表
+					let typeList = res.data.typeList || {};
+					self.supplier_type_list = [];
+					self.supplier_type_ids = [];
+					for (let key in typeList) {
+						self.supplier_type_list.push(typeList[key]);
+						self.supplier_type_ids.push(parseInt(key));
+					}
+
+					// 如果已经选择了供应商类型,则过滤对应的分类
+					if (self.supplier_type_id_active) {
+						self.filterClassifyByType(self.supplier_type_id_active);
+					}
 				});
+			},
+			//根据供应商类型过滤分类
+			filterClassifyByType(type) {
+				let self = this;
+				let list_name = [];
+				let list_id = [];
+				let targetList = [];
+
+				// 根据新的数据结构:classify_all_data是对象,key是类型ID
+				// 需要处理type可能是字符串的情况
+				let typeKey = String(type);
+				if (self.classify_all_data && self.classify_all_data[typeKey]) {
+					targetList = self.classify_all_data[typeKey] || [];
+				}
+
+				//合成select列表
+				for (var i = 0; i < targetList.length; i++) {
+					list_name.push(targetList[i].name);
+					list_id.push(targetList[i].category_id);
+				}
+
+				self.classify_data_name = list_name;
+				self.classify_data_id = list_id;
+
+				// 清空当前选择的分类
+				self.classify_data_name_active = '';
+				self.classify_data_id_active = '';
 			},
 			//选择分类
 			select() {
@@ -222,6 +290,13 @@
 				formdata.business_id = self.form.business_id;
 				formdata.category_id = self.classify_data_id_active;
 				formdata.area_id = self.area_data_id_active;
+				formdata.supplier_type = self.supplier_type_id_active;
+				formdata.province_id = self.province_id;
+				formdata.city_id = self.city_id;
+				formdata.region_id = self.region_id;
+				formdata.address=self.region[0]+self.region[1]+self.region[2]+self.address.location_address+self.address.house_number
+				formdata.longitude = self.address.longitude;
+				formdata.latitude = self.address.latitude;
 				if (self.classify_data_name_active == '') {
 					uni.showToast({
 						title: '请填主营类别',
@@ -230,9 +305,25 @@
 					});
 					return false;
 				}
+				if (self.address.location_address == '') {
+					uni.showToast({
+						title: '请选择地址',
+						duration: 1000,
+						icon: 'none'
+					});
+					return false;
+				}
 				if (self.area_data_id.length > 0 && self.area_data_id_active == '') {
 					uni.showToast({
 						title: '请选择所在区域',
+						duration: 1000,
+						icon: 'none'
+					});
+					return false;
+				}
+				if (self.supplier_type_id_active == '') {
+					uni.showToast({
+						title: '请选择供应商类型',
 						duration: 1000,
 						icon: 'none'
 					});
@@ -314,6 +405,33 @@
 			openUpload(e) {
 				this.type = e;
 				this.isupload = true;
+			},// 打开地图选择地址 by lyzflash
+			chooseLocation(n) {
+				let self=this;
+				uni.chooseLocation({
+					success: function (res) {
+						self.address.longitude=res.longitude;
+						self.address.latitude=res.latitude;
+						self.location_address=res.address;
+						self.address.house_number=res.name;
+						// 获取省市区
+						self.setLocationAddress();
+					}
+				});
+			},
+			
+			// 获取掉省市区 by lyzflash
+			setLocationAddress() {
+				let self = this;
+				self._get('user.address/setLocationAddress', {
+					address: self.location_address
+				}, function(res) {
+					self.address.location_address = res.data.short_address;
+					self.province_id = res.data.cityCode[0];
+					self.city_id = res.data.cityCode[1];
+					self.region_id = res.data.cityCode[2];
+					self.region = res.data.region;
+				});
 			},
 
 			/*获取图片*/
@@ -342,6 +460,15 @@
 				this.area_data_id_active = this.area_data_id[e.detail.value];
 				this.area_data_name_active = this.area_data_name[e.detail.value];
 			},
+			/* 供应商类型选择 */
+			changeSupplierType(e) {
+				let index = parseInt(e.detail.value);
+				let typeId = this.supplier_type_ids[index];
+				this.supplier_type_id_active = typeId.toString();
+				this.supplier_type_name_active = this.supplier_type_list[index];
+				// 根据选择的供应商类型过滤分类
+				this.filterClassifyByType(this.supplier_type_id_active);
+			},
 		}
 	}
 </script>

--
Gitblit v1.9.2