baijunde 8 mēneši atpakaļ
vecāks
revīzija
5860c9dec8

+ 7 - 0
common/router/modules/routes.js

@@ -571,6 +571,13 @@ const routes = [{
 			title: '添加检测站',
 		},
 	},
+	{
+		path: '/pages/product/checkTdMap',
+		name: 'checkTdMap',
+		meta: {
+			title: '添加检测站',
+		},
+	},
 	{
 		path: '/pages/groupMeal/goods/index',
 		name: 'groupMealGoodsIndex',

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "掌柜生活商户版",
     "appid" : "__UNI__E0EA6E1",
     "description" : "",
-    "versionName" : "1.1.3.3",
-    "versionCode" : 1133,
+    "versionName" : "1.1.3.5",
+    "versionCode" : 1135,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 4 - 0
pages.json

@@ -115,6 +115,10 @@
 			"path": "pages/product/checkMap",
 			"style": {}
 		},
+		{
+			"path": "pages/product/checkTdMap",
+			"style": {}
+		},
 		{
 			"path": "pages/product/salesUser",
 			"style": {}

+ 3 - 3
pages/login/settled.vue

@@ -762,7 +762,7 @@
 							this.form.identityOne = configService.apiUrl+'/'+this.form.identityOne
 						}
 						if(!isHttpOrHttpstwo){
-							tthis.form.identityTwo = configService.apiUrl+'/'+this.form.identityTwo
+							this.form.identityTwo = configService.apiUrl+'/'+this.form.identityTwo
 						}
 					let data = {
 						...this.form,
@@ -772,10 +772,10 @@
 						// longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
 						// latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
 					}
-					console.log(data)
+				
 					// this.$http.post('/merchant/localMerchantInfo/edit', data).then(res => {
 							this.$http.post('/merchant/localMerchantInfo/editMerchantInfo', data).then(res => {
-						
+							console.log(res)
 						if (res.data.success) {
 							// this.$tip.success(res.data.result || '成功')
 							uni.showToast({

+ 23 - 2
pages/order/details.vue

@@ -11,7 +11,7 @@
 		<view class="content">
 			<view class="status">
 				<view class="status_title">
-					{{product.state}} <span v-if="product.differenceMinutes>0 && product.state == '待支付'">, 剩余</span> 
+					{{product.state}} <span v-if="product.differenceMinutes>0 && product.state == '待支付'">, 剩余</span>
 					<u-count-down :timestamp="product.differenceMinutes*60" :show-days="false" font-size="36rpx" @end="getDetail"
 						v-if="product.differenceMinutes>0 && product.state == '待支付'"></u-count-down>
 
@@ -91,7 +91,28 @@
 							style="font-size: 22rpx;">¥</text>{{product.orderPrice}}</span>
 				</view>
 			</view>
-			<view class="product">
+			<view class="product" v-if="product.orderType ==4">
+				<view class="title">
+					订单信息
+				</view>
+				<view class="data">
+					<span>订单号 :</span>
+					{{product.orderId?product.orderId:'--'}}
+				</view>
+				<view class="data">
+					<span>下单时间:</span>
+					{{product.buyTime?product.buyTime:'--'}}
+				</view>
+				<view class="data">
+					<span>联系方式:</span>
+					{{product.phone?product.phone:'--'}}
+				</view>
+				<view class="data">
+					<span >付款时间:</span>
+					{{product.payTime?product.payTime:'--'}}
+				</view>
+			</view>
+			<view class="product" v-else>
 				<view class="title negotiate" v-if="product.auditType">
 					协商历史
 					<view class="look" @click="goRecord">

+ 69 - 54
pages/order/index.vue

@@ -43,23 +43,23 @@
 		<mescroll-uni class="list" :fixed="false" ref="mescrollRef" @up="getList" @init="mescrollInit" :use="false"
 			v-if="tabIndex ==0">
 			<view class="order_item" v-for="(item,index) in orderList" :key="item.id" @click="geDetail(item)">
-				<view class="order_id" >
+				<view class="order_id">
 					<view class="id_left">
 						订单编号:{{item.orderId}}
 					</view>
-					
+
 					<view class="id_right" v-if="item.stateCode ==0" style="color: #ff9900;">
 						待使用
 					</view>
 					<view class="id_right" v-if="item.stateCode ==1">
 						已使用
 					</view>
-					<view class="id_right" v-if="item.stateCode == 2">
+					<!-- 	<view class="id_right" v-if="item.stateCode == 2">
 						待评价
 					</view>
 					<view class="id_right" v-if="item.stateCode ==3">
 						已过期
-					</view>
+					</view> -->
 					<view class="id_right" v-if="item.stateCode == 5">
 						待付款
 					</view>
@@ -78,10 +78,13 @@
 					<view class="id_right" v-if="item.stateCode == 10">
 						订单关闭
 					</view>
+					<view class="id_right" v-if="item.stateCode == 11">
+						已取消
+					</view>
 					<!-- <view class="id_right" v-if="item.stateCode == 4 && item.refundType !=1" style="color:#449AFF ;">
 						退款/售后
 					</view> -->
-					
+
 					<view class="id_right" v-if="item.refundType ==0  && item.stateCode == 4">
 						售后申请中
 					</view>
@@ -101,17 +104,20 @@
 						挂起
 					</view>
 				</view>
-			<!-- 	<view class="order_id" v-if="item.stateCode == 4 && item.refundType ">
+				<!-- 	<view class="order_id" v-if="item.stateCode == 4 && item.refundType ">
 					
 				</view> -->
 				<!-- 普通订单 -->
 				<view class="order_product" v-if="item.categoryId != 1945013773786701826">
-					<view class="img">
+					<view class="img" >
 						<image :src="item.productImage" mode=""></image>
 					</view>
 					<view class="name">
 						{{item.productName}}
-						<span>¥{{item.orderPrice}}</span>
+						<span class="exceed" v-if="item.orderType == 4"
+							style="color: #999999;">适用范围:{{item.remark==1?'本店可用':item.remark==2?'部分分类商品可用':'部分分类商品不可用'}}</span>
+						<span v-if="item.orderType == 4" style="color: #999999;"> 使用期限:{{item.startTime}} --{{item.endTime}}</span>
+						<span v-if="item.orderType != 4">¥{{item.orderPrice}}</span>
 					</view>
 					<view class="ticket" v-if="item.isUseRights">
 						<image src="/static/product/ticket.png" mode=""></image>
@@ -779,51 +785,51 @@
 			},
 			//商户去取车
 			goGetCar(item) {
-			    // 清除之前的定时器,实现防抖
-			    if (this.getCarDebounceTimer) {
-			      clearTimeout(this.getCarDebounceTimer);
-			    }
-			
-			    // 2000ms后执行真正的逻辑
-			    this.getCarDebounceTimer = setTimeout(() => {
-			      console.log(item);
-			      let data = {
-			        taskId: item.taskId,
-			        checkType: item.checkType,
-			        paramState: '05', //商户接单成功
-			        serveType: '01'
-			      };
-			      let that = this;
-			      
-			      this.serviceList = [];
-			      let page = {
-			        num: 1,
-			        size: 10
-			      };
-			      this.getserviceList(page);
-			      
-			      uni.openLocation({
-			        longitude: Number(item.userLongitude),
-			        latitude: Number(item.userLatitude),
-			        name: item.carAddres, // 位置名称(注意:原代码可能笔误,应该是carAddress?)
-			        // address: e.F_Address, // 位置地点
-			        success: function(res) {
-			          console.log('打开系统位置地图成功');
-			          that.$http.post("/ts/merchant/update/Serve", data).then(res => {
-			            if (res.data.code == 200) {
-			              // this.isReceive = true
-			            }
-			          });
-			        },
-			        fail: function(error) {
-			          console.log(error);
-			        },
-			      });
-			
-			      // 执行完成后清空定时器(可选,防止内存泄漏)
-			      this.getCarDebounceTimer = null;
-			    }, 2000); // 防抖间隔2000ms
-			  },
+				// 清除之前的定时器,实现防抖
+				if (this.getCarDebounceTimer) {
+					clearTimeout(this.getCarDebounceTimer);
+				}
+
+				// 2000ms后执行真正的逻辑
+				this.getCarDebounceTimer = setTimeout(() => {
+					console.log(item);
+					let data = {
+						taskId: item.taskId,
+						checkType: item.checkType,
+						paramState: '05', //商户接单成功
+						serveType: '01'
+					};
+					let that = this;
+
+					this.serviceList = [];
+					let page = {
+						num: 1,
+						size: 10
+					};
+					this.getserviceList(page);
+
+					uni.openLocation({
+						longitude: Number(item.userLongitude),
+						latitude: Number(item.userLatitude),
+						name: item.carAddres, // 位置名称(注意:原代码可能笔误,应该是carAddress?)
+						// address: e.F_Address, // 位置地点
+						success: function(res) {
+							console.log('打开系统位置地图成功');
+							that.$http.post("/ts/merchant/update/Serve", data).then(res => {
+								if (res.data.code == 200) {
+									// this.isReceive = true
+								}
+							});
+						},
+						fail: function(error) {
+							console.log(error);
+						},
+					});
+
+					// 执行完成后清空定时器(可选,防止内存泄漏)
+					this.getCarDebounceTimer = null;
+				}, 2000); // 防抖间隔2000ms
+			},
 			// goGetCar(item) {
 			// 	console.log(item)
 			// 	let data = {
@@ -1204,8 +1210,16 @@
 							font-size: 22rpx;
 							color: #F0761D;
 						}
+
+						.exceed {
+							width: 500rpx;
+							overflow: hidden;
+							text-overflow: ellipsis;
+							white-space: nowrap;
+						}
 					}
 
+
 					.ticket {
 						image {
 							width: 50rpx;
@@ -1295,7 +1309,8 @@
 						align-items: center;
 						justify-content: center;
 					}
-					.all_price{
+
+					.all_price {
 						min-width: 33%;
 						margin-left: 10rpx;
 					}

+ 1 - 1
pages/order/record.vue

@@ -65,7 +65,7 @@
 				<!-- <view class="information" v-if="item.refundType == 0">
 					您已同意退货退款,平台会将退款原路退回。
 				</view> -->
-				<view class="request" v-if="item.auditType ==0">
+				<view class="request" v-if="item.auditType ==0 && item.orderType != 4 ">
 					<view class="btn" @click="reject(item)">拒绝</view>
 					<view class="btn" @click="agree(item)">同意</view>
 				</view>

+ 293 - 144
pages/order/serviceOrder/project.vue

@@ -1,31 +1,40 @@
 <template>
 	<view class="project">
-		<view class="top">
-		</view>
+		<view class="top"></view>
 		<view class="head">
 			<span class="cuIcon-back" @click="back"></span>
 			<view class="case">
-				<!-- 选择服务项目 -->
 				{{type==0?'修改服务项目':'选择服务项目'}}
 			</view>
 		</view>
 		<view class="content">
-			<view class="option" v-for="(item,index) in projectList" :key="index">
+			<view class="option" v-for="(item, index) in projectList" :key="index">
 				<view class="name">
 					<span>{{item.itemName}}</span>
 					<u-switch v-model="item.checked" size="50rpx" @change="change(item)"></u-switch>
 				</view>
-				<view class="price" v-if="item.checked">
-					<span>服务价格</span>
-					<span><u-input v-model="item.itemMoney" type="number" @input="handleInput(item)" @blur="validateInput(item)"
-							style="width: 260rpx;height: 62rpx;background-color: #f7f8fc;padding: 0rpx 20rpx;margin-right: 16rpx;" />元</span>
-				</view>
-				<view class="explain" v-if="item.checked">
-					<span>服务说明</span>
-					<view class="text">
-						<textarea v-model="item.itemContent" placeholder="请简要说明收费项目内容" maxlength="100" cols="30" rows="10"
-							style="width: 100%;height: 100%;padding: 12rpx 16rpx;font-size: 26rpx;"></textarea>
-						<span>{{item.itemContent.length}}/100</span>
+				<view class="price-details" v-if="item.checked">
+					<view class="details-wrapper" v-for="(row, rowIndex) in item.serveList" :key="rowIndex">
+						<view class="details_item">
+							<view class="details_name">
+								<span class="label">明细名称</span>
+								<u-input v-model="row.name" placeholder="请输入明细名称"  :customStyle="{padding: '0', fontSize: '28rpx'}" />
+							</view>
+							<view class="details_name">
+								<span class="label">项目价格</span>
+								<u-input v-model="row.price" type="number" placeholder="请输入价格"  :customStyle="{padding: '0', fontSize: '28rpx'}" />
+							</view>
+							<view class="action-btns">
+								<view class="add" @click="addDetail(item)" v-if="rowIndex === item.serveList.length - 1">
+									<image src="/static/icon/icon_plus.png" mode="aspectFit"></image>
+									<span>添加</span>
+								</view>
+								<view class="delete" @click="removeDetail(item, rowIndex)" v-if="item.serveList.length > 1">
+									<image src="/static/icon/icon_del.png" mode="aspectFit"></image>
+									<span>删除</span>
+								</view>
+							</view>
+						</view>
 					</view>
 				</view>
 			</view>
@@ -50,40 +59,66 @@
 				orderNo: '',
 				productName: '',
 				subOrderId: '', //修改用
-				projectList: [{
+				projectList: [
+					{
 						itemName: '车辆维修费',
 						checked: false,
 						delFlag: '',
 						itemMoney: null,
-						itemContent: ''
+						itemContent: '',
+						serveList: [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
 					},
 					{
 						itemName: '喷漆费',
 						checked: false,
 						delFlag: '',
 						itemMoney: null,
-						itemContent: ''
+						itemContent: '',
+						serveList: [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
 					},
 					{
 						itemName: '零配件',
 						checked: false,
 						delFlag: '',
 						itemMoney: null,
-						itemContent: ''
+						itemContent: '',
+						serveList: [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
 					},
 					{
 						itemName: '车辆清洁费',
 						checked: false,
 						delFlag: '',
 						itemMoney: null,
-						itemContent: ''
+						itemContent: '',
+						serveList: [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
 					},
 					{
 						itemName: '其他费用',
 						checked: false,
 						delFlag: '',
 						itemMoney: null,
-						itemContent: ''
+						itemContent: '',
+						serveList: [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
 					}
 				],
 				type: '',
@@ -91,13 +126,8 @@
 			}
 		},
 		methods: {
-
 			//返回
 			back() {
-				// uni.navigateBack();
-				// uni.navigateBack({
-				// 	delta: 1
-				// });
 				uni.switchTab({
 					url: '/pages/order/index'
 				})
@@ -105,33 +135,67 @@
 
 			//关闭时置空
 			change(item) {
-				console.log(item)
+				console.log('开关状态变化:', item)
 				if (!item.checked) {
 					item.itemContent = ''
 					item.itemMoney = ''
+				} else {
+					// 确保选中时有serveList数据
+					if (!item.serveList || item.serveList.length === 0) {
+						item.serveList = [{
+							name: '',
+							price: '',
+							quantity: 1
+						}]
+					}
+				}
+			},
+			
+			// 添加明细
+			addDetail(item) {
+				if (!item.serveList) {
+					item.serveList = []
+				}
+				item.serveList.push({
+					name: '',
+					price: '',
+					quantity: item.serveList.length + 1
+				})
+				console.log('添加明细后:', item.serveList)
+			},
+			
+			// 删除明细
+			removeDetail(item, index) {
+				if (item.serveList && item.serveList.length > 1) {
+					item.serveList.splice(index, 1)
+					// 重新排序quantity
+					item.serveList.forEach((row, idx) => {
+						row.quantity = idx + 1
+					})
 				}
 			},
-			 // 实时输入时校验(防止用户输入非法字符)
-			  handleInput(item) {
-			    let value = item.itemMoney.toString();
-			       
-			       // 限制整数部分最多8位
-			       let parts = value.split('.');
-			       if (parts[0].length > 8) {
-			         parts[0] = parts[0].slice(0, 8);
-			       }
-			   
-			       // 限制小数部分最多两位
-			       if (parts[1]) {
-			         parts[1] = parts[1].slice(0, 2);
-			       }
-			   
-			       // 合并整数和小数部分,确保输入的格式符合要求
-			       item.itemMoney = parts.join('.');
-			  },
+
+			// 实时输入时校验(防止用户输入非法字符)
+			handleInput(item) {
+				if (item.itemMoney) {
+					let value = item.itemMoney.toString();
+					// 限制整数部分最多8位
+					let parts = value.split('.');
+					if (parts[0].length > 8) {
+						parts[0] = parts[0].slice(0, 8);
+					}
+					// 限制小数部分最多两位
+					if (parts[1]) {
+						parts[1] = parts[1].slice(0, 2);
+					}
+					// 合并整数和小数部分,确保输入的格式符合要求
+					item.itemMoney = parts.join('.');
+				}
+			},
+			
 			//输入金额
 			validateInput(item) {
-				if (Number(item.itemMoney) <= 0) {
+				if (item.itemMoney && Number(item.itemMoney) <= 0) {
 					uni.showToast({
 						title: '金额必须大于0',
 						icon: 'none'
@@ -139,77 +203,139 @@
 					item.itemMoney = ''; // 清空或设置为默认最小值
 				}
 			},
+			
+			// 计算明细总金额
+			calculateTotal(item) {
+				if (!item.serveList || item.serveList.length === 0) {
+					item.itemMoney = 0
+					return
+				}
+				
+				let total = 0
+				item.serveList.forEach(row => {
+					const price = parseFloat(row.price) || 0
+					total += price
+				})
+				item.itemMoney = total.toFixed(2)
+			},
+			
 			submit() {
+				// 计算每个项目的总金额
+				this.projectList.forEach(item => {
+					this.calculateTotal(item)
+				})
 				
 				let list = []
 				this.projectList.forEach(item => {
-					if (item.checked ) {
+					if (item.checked) {
 						item.delFlag = 0
+						// 如果有serveList,生成说明
+						if (item.serveList && item.serveList.length > 0) {
+							const detailNames = item.serveList.map(row => row.name).filter(name => name).join('、')
+							if (detailNames) {
+								item.itemContent = detailNames
+							}
+						}
 					} else {
 						item.delFlag = 1
 						item.itemMoney = 0
 					}
 					list.push({
 						delFlag: item.delFlag,
-						itemContent: item.itemContent,
-						itemMoney:item.itemMoney ,
+						itemContent: item.itemContent || '',
+						itemMoney: item.itemMoney || 0,
 						itemName: item.itemName
 					})
 				})
-				console.log(list)
-					let data = {
-						checkType: this.checkType,
-						taskId: this.taskId,
-						orderNo: this.orderNo,
-						orderName: this.productName,
-						merchantId: uni.getStorageSync('login_user_info').merchantId,
-						id: this.editId,
-						serveType:this.checkType<20?'01':'02',
-						// id : uni.getStorageSync('login_user_info').id,
-						addMerchantServiceVoList: list
-					}
-					this.$http.post("/ts/merchant/addPaidService", data).then(res => {
-						console.log(res)
-						if (res.data.code == 200) {
-							// this.$emit('upSuccess')
-							uni.showToast({
-								icon: 'none',
-								title: '添加成功'
-							})
+				
+				console.log('提交数据:', list)
+				
+				let data = {
+					checkType: this.checkType,
+					taskId: this.taskId,
+					orderNo: this.orderNo,
+					orderName: this.productName,
+					merchantId: uni.getStorageSync('login_user_info').merchantId,
+					id: this.editId,
+					serveType: this.checkType < 20 ? '01' : '02',
+					addMerchantServiceVoList: list
+				}
+				
+				console.log('最终提交:', data)
+				
+				this.$http.post("/ts/merchant/addPaidService", data).then(res => {
+					console.log(res)
+					if (res.data.code == 200) {
+						uni.showToast({
+							icon: 'success',
+							title: '添加成功'
+						})
+						setTimeout(() => {
 							this.back()
-						}else{
-							uni.showToast({
-								icon: 'none',
-								title: res.data.message
-							})
-						}
+						}, 1500)
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: res.data.message || '提交失败'
+						})
+					}
+				}).catch(err => {
+					console.error('提交错误:', err)
+					uni.showToast({
+						icon: 'none',
+						title: '网络错误'
 					})
-				
+				})
 			},
+			
 			//回显
 			getChange() {
 				this.$http.get("/ts/merchant/servicesDetails?subOrderId=" + this.orderNo).then(res => {
 					if (res.data.code == 200) {
-
 						this.editId = res.data.result.id
-						res.data.result.serviceDetails.forEach(item => {
-							item.delFlag == 0 ? item.checked = true : item.checked = false
+						const details = res.data.result.serviceDetails || []
+						
+						// 更新项目列表,保持原有结构
+						this.projectList = this.projectList.map(project => {
+							const detail = details.find(d => d.itemName === project.itemName)
+							if (detail) {
+								return {
+									...project,
+									checked: detail.delFlag == 0,
+									delFlag: detail.delFlag,
+									itemMoney: detail.itemMoney,
+									itemContent: detail.itemContent || '',
+									serveList: detail.serveList || [{
+										name: detail.itemContent || '',
+										price: detail.itemMoney || '',
+										quantity: 1
+									}]
+								}
+							}
+							return project
 						})
-						this.projectList = res.data.result.serviceDetails
+						
+						console.log('回显数据:', this.projectList)
 					}
+				}).catch(err => {
+					console.error('获取回显数据错误:', err)
 				})
 			}
 		},
 		onLoad(options) {
-			console.log(options)
-			this.checkType = options.checkType
-			this.taskId = options.taskId
-			this.orderNo = options.orderNo
-			this.productName = options.productName
-			this.type = options.type
+			console.log('页面参数:', options)
+			this.checkType = options.checkType || ''
+			this.taskId = options.taskId || ''
+			this.orderNo = options.orderNo || ''
+			this.productName = options.productName || ''
+			this.type = options.type || '1'
 			if (this.type == 0) {
 				this.getChange()
 			}
+		},
+		onShow() {
+			// 确保页面显示时数据正确
+			console.log('项目列表:', this.projectList)
 		}
 	}
 </script>
@@ -221,16 +347,15 @@
 		background: #F8F8FA;
 		display: flex;
 		flex-direction: column;
-		// overflow-y: auto;
-
+		
 		/*#ifdef APP-PLUS*/
 		.top {
 			width: 100%;
 			height: var(--status-bar-height);
 			background: #FFFFFF;
 		}
-
 		/*#endif*/
+		
 		.head {
 			width: 100%;
 			height: 112rpx;
@@ -240,12 +365,12 @@
 			background: #FFFFFF;
 			position: relative;
 			border-bottom: 1px solid #F0F3F5;
-
+			
 			.cuIcon-back {
 				font-size: 40rpx;
 				margin-right: 40rpx;
 			}
-
+			
 			.case {
 				position: absolute;
 				left: 50%;
@@ -254,67 +379,106 @@
 				font-weight: 600;
 			}
 		}
-
+		
 		.content {
-			padding: 0 24rpx;
+			padding: 24rpx;
 			overflow-y: auto;
 			flex: 1;
-
+			
 			.option {
 				width: 100%;
-				// height: 86rpx;
 				padding: 20rpx 32rpx;
-
 				background: #FFFFFF;
 				box-shadow: 0px 2rpx 8rpx 0px rgba(214, 225, 237, 0.1);
 				border-radius: 16rpx;
 				margin-bottom: 16rpx;
-
+				
 				.name {
 					width: 100%;
 					display: flex;
 					align-items: center;
 					justify-content: space-between;
 					margin-bottom: 16rpx;
+					font-size: 32rpx;
+					font-weight: 500;
 				}
-
-				.price {
+				
+				.price-details {
 					width: 100%;
-					height: 78rpx;
-					border-bottom: 1px solid #eeeeee;
-					display: flex;
-					align-items: start;
-					justify-content: space-between;
-
-					span {
-						display: flex;
-						align-items: center;
+					margin-top: 20rpx;
+					
+					.details-wrapper {
+						margin-bottom: 24rpx;
+						
+						&:last-child {
+							margin-bottom: 0;
+						}
 					}
-				}
-
-				.explain {
-					margin-top: 16rpx;
-
-					.text {
+					
+					.details_item {
 						width: 100%;
-						height: 164rpx;
-						background-color: #f7f8fc;
-						margin-top: 12rpx;
-						position: relative;
-
-						span {
-							position: absolute;
-							bottom: 12rpx;
-							right: 16rpx;
-							font-size: 24rpx;
-							color: #999999;
+						display: flex;
+						flex-direction: column;
+						gap: 24rpx;
+						
+						.details_name {
+							display: flex;
+							align-items: center;
+							justify-content: space-between;
+							padding-bottom: 16rpx;
+							border-bottom: 1px solid #f0f0f0;
+							
+							.label {
+								font-size: 28rpx;
+								color: #333333;
+								width: 160rpx;
+								flex-shrink: 0;
+							}
+							
+							::v-deep .u-input {
+								flex: 1;
+								height: 60rpx;
+							}
+						}
+						
+						.action-btns {
+							display: flex;
+							justify-content: flex-end;
+							gap: 30rpx;
+							padding-top: 10rpx;
+							
+							.add, .delete {
+								display: flex;
+								align-items: center;
+								padding: 12rpx 24rpx;
+								border-radius: 8rpx;
+								font-size: 26rpx;
+								cursor: pointer;
+								
+								image {
+									width: 28rpx;
+									height: 28rpx;
+									margin-right: 8rpx;
+								}
+							}
+							
+							.add {
+								background: #f0f7ff;
+								color: #2D88F4;
+								border: 1px solid #2D88F4;
+							}
+							
+							.delete {
+								background: #fff0f0;
+								color: #FF4444;
+								border: 1px solid #FF4444;
+							}
 						}
 					}
-
 				}
 			}
 		}
-
+		
 		.btn_box {
 			width: 100%;
 			height: 109rpx;
@@ -324,7 +488,7 @@
 			justify-content: space-around;
 			margin-top: 10rpx;
 			font-size: 28rpx;
-
+			
 			.customer {
 				border-radius: 49rpx;
 				border: 1px solid #2D88F4;
@@ -335,7 +499,7 @@
 				justify-content: center;
 				color: #2D88F4;
 			}
-
+			
 			.accept {
 				display: flex;
 				align-items: center;
@@ -348,19 +512,4 @@
 			}
 		}
 	}
-
-	::v-deep .custom-switch {
-		width: 52rpx;
-		/* 自定义宽度 */
-		height: 27rpx;
-		/* 自定义高度 */
-
-	}
-
-	::v-deep .u-switch__node .node-class {
-		width: 25rpx !important;
-		/* 自定义按钮大小 */
-		height: 25rpx !important;
-		/* 自定义按钮大小 */
-	}
 </style>

+ 825 - 0
pages/product/checkTdMap.vue

@@ -0,0 +1,825 @@
+<template>
+	<view class="container">
+		<view class="top"></view>
+		<view class="head">
+			<view class="handle">
+				<view class="head_left">
+					<span class="cuIcon-back" @click="back"></span>
+				</view>
+				<span class="center">选择检测站</span>
+				<span class="submit-btn" @click="submit">确定</span>
+			</view>
+		</view>
+
+		<!-- 地图容器 -->
+		<view id="mapContainer" class="map-container"></view>
+
+		<!-- 搜索功能区域 -->
+		<view class="search-panel" v-if="showSearch">
+			<view class="search-input-group">
+				<input class="search-input" v-model="searchKeyword" placeholder="输入关键词搜索地点" @confirm="handleSearch"
+					@input="onSearchInput" />
+				<button class="search-btn" @click="handleSearch">搜索</button>
+			</view>
+
+			<view class="search-results" v-if="dataTips.length > 0">
+				<view class="result-header">
+					<text>搜索结果 ({{ dataTips.length }} 个)</text>
+					<text class="clear-results" @click="clearSearchResults">清除搜索结果</text>
+				</view>
+				<scroll-view class="results-list" scroll-y>
+					<view v-for="(result, index) in dataTips" :key="index" 
+						class="result-item" 
+						@click="selectSearchResult(result)"
+						:class="{'selected': result.check}">
+						<view class="left">
+							<view class="result-name">
+								<text v-show="result.check" class="selected-tag">已选</text>
+								{{ result.name }}
+							</view>
+							<view class="result-address">{{ result.address }}</view>
+						</view>
+						<view class="right">
+							<image src="/static/coupon/danxuan.png" mode="" v-if="result.check"></image>
+							<image src="/static/product/round.png" mode="" v-else></image>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			initialPosition: {
+				type: Object,
+				default: () => ({
+					lnglat: null,
+					address: ''
+				})
+			},
+			allowSelection: {
+				type: Boolean,
+				default: true
+			},
+			showCoordinates: {
+				type: Boolean,
+				default: true
+			},
+			showSearch: {
+				type: Boolean,
+				default: true
+			}
+		},
+		data() {
+			return {
+				tk: '9bcf63358817bfb878e8236de8bf1423',
+				searchKeyword: '',
+				dataTips: [], // 存储:已选检测站 + 搜索结果(合并去重)
+				selectedResult: null,
+				renderjsReady: false,
+				merchantId: uni.getStorageSync('login_user_info')?.merchantId || '',
+				originalSelected: [] // 新增:存储原始已选检测站(用于去重和保留)
+			};
+		},
+		mounted() {
+			console.log('组件mounted');
+			// 1. 先获取已选检测站(保留原有数据)
+			this.getShopList();
+			// 2. 等待renderjs初始化
+			setTimeout(() => {
+				this.waitForRenderjs();
+			}, 1000);
+		},
+		methods: {
+			// 核心:获取已选检测站(保留到originalSelected,避免被搜索覆盖)
+			getShopList() {
+				if (!this.merchantId) {
+					console.warn('商户ID不存在');
+					return;
+				}
+				this.$http.get(`/ts/localTsMerchantLinkInspection/list?merchantId=${this.merchantId}`).then(res => {
+					if (res.data.code == 200) {
+						// 存储原始已选数据(用于去重)
+						this.originalSelected = res.data.result.map(item => ({
+							...item,
+							check: true, // 强制设置为已选
+							lonlat: `${item.inspectionStationLongitude},${item.inspectionStationLatitude}`,
+							address: item.detailedAddress,
+							name: item.inspectionStationName,
+							// 新增:用ID作为唯一标识(避免重复添加)
+							uniqueKey: item.id || `${item.inspectionStationLongitude}-${item.inspectionStationLatitude}`
+						}));
+						// 初始数据 = 原始已选数据
+						this.dataTips = [...this.originalSelected];
+						console.log(this.dataTips)
+						// 自动定位第一个已选检测站(传入isInit=true,不切换check状态)
+						if (this.dataTips.length > 0) {
+							this.selectSearchResult(this.dataTips[0], true); // 修改:添加isInit参数
+						}
+					}
+				}).catch(err => {
+					console.error('获取已选检测站失败:', err);
+				});
+			},
+			
+			// 等待renderjs就绪
+			waitForRenderjs() {
+				if (this.renderjsReady) return;
+				
+				const checkInterval = setInterval(() => {
+					if (this.$refs && this.$refs.renderjsMap) {
+						clearInterval(checkInterval);
+						this.renderjsReady = true;
+						console.log('renderjs就绪');
+						
+						if (this.initialPosition && this.isValidPosition(this.initialPosition)) {
+							this.setMapCenterFromProps();
+						}
+					}
+				}, 100);
+				
+				setTimeout(() => {
+					clearInterval(checkInterval);
+					console.warn('等待renderjs超时');
+				}, 10000);
+			},
+			
+			setMapCenterFromProps() {
+				const mapData = {
+					lng: this.initialPosition.lng || 
+						(this.initialPosition.lnglat && this.initialPosition.lnglat.lng) || 
+						(this.initialPosition.lnglat && this.initialPosition.lnglat.longitude),
+					lat: this.initialPosition.lat || 
+						(this.initialPosition.lnglat && this.initialPosition.lnglat.lat) || 
+						(this.initialPosition.lnglat && this.initialPosition.lnglat.latitude),
+					address: this.initialPosition.address || ''
+				};
+				
+				this.callRenderjsMethod('updateMapWithMarker', mapData);
+			},
+			
+			callRenderjsMethod(methodName, data) {
+				if (!this.renderjsReady) {
+					console.warn('renderjs未就绪,延迟执行');
+					setTimeout(() => {
+						this.callRenderjsMethod(methodName, data);
+					}, 300);
+					return;
+				}
+				
+				try {
+					if (this.$refs.renderjsMap) {
+						this.$refs.renderjsMap.callMethod(methodName, data);
+						return;
+					}
+					
+					const ownerInstance = this.$ownerInstance;
+					if (ownerInstance && ownerInstance.callMethod) {
+						ownerInstance.callMethod('callRenderjsMethod', {
+							method: methodName,
+							data: data
+						});
+						return;
+					}
+					
+					console.error('无法调用renderjs方法');
+					
+				} catch (error) {
+					console.error(`调用renderjs方法 ${methodName} 失败:`, error);
+					setTimeout(() => {
+						if (this.renderjsReady) {
+							this.callRenderjsMethod(methodName, data);
+						}
+					}, 500);
+				}
+			},
+			
+			// 选择检测站:新增isInit参数,区分初始化和用户点击
+			selectSearchResult(result, isInit = false) {
+				console.log('选择搜索结果:', result);
+				
+				// 只有非初始化场景,才切换check状态(用户点击时)
+				if (!isInit) {
+					result.check = !result.check;
+					this.selectedResult = result.check ? result : null;
+				} else {
+					// 初始化场景:强制保持check=true,仅定位不切换
+					result.check = true;
+					this.selectedResult = result;
+				}
+				
+				// 提取经纬度并定位
+				const coords = this.extractCoordinates(result);
+				if (!coords) {
+					uni.showToast({
+						title: '无法获取位置坐标',
+						icon: 'none'
+					});
+					console.error('无法解析坐标:', result);
+					return;
+				}
+				
+				const { lng, lat } = coords;
+				const mapData = {
+					lng: lng,
+					lat: lat,
+					address: result.address || result.name,
+					name: result.name,
+					fromSearch: true
+				};
+				
+				this.callRenderjsMethod('updateMapWithMarker', mapData);
+				console.log('地图已定位到:', lng, lat, result.name);
+			},
+			
+			// 核心提交:带上原有已选 + 当前新选
+			submit() {
+				// 过滤所有选中的检测站(包括原有已选和当前新选)
+				const selectedItems = this.dataTips.filter(item => item.check);
+				if (selectedItems.length === 0) {
+					uni.showToast({
+						title: '请至少选择一个检测站',
+						icon: 'none'
+					});
+					return;
+				}
+				
+				// 构造提交数据(兼容原有已选和新选)
+				const submitData = selectedItems.map(item => {
+					const locationParts = item.lonlat ? item.lonlat.split(",") : [];
+					return {
+						// 原有已选数据带id,新选数据可能没有,保留id(便于后端更新/去重)
+						id: item.id || '', 
+						country: item.adcode || item.country || '',
+						detailedAddress: item.address || item.detailedAddress || '',
+						inspectionStationName: item.name || item.inspectionStationName || '',
+						locality: item.district || item.locality || '',
+						inspectionStationLongitude: item.inspectionStationLongitude || (locationParts[0] || null),
+						inspectionStationLatitude: item.inspectionStationLatitude || (locationParts[1] || null),
+						merchantId: this.merchantId
+					};
+				});
+				
+				// 调用保存接口(后端需支持:存在id则更新,不存在则新增)
+				this.$http.post("/ts/localTsMerchantLinkInspection/add", submitData).then(res => {
+					console.log('保存检测站结果:', res);
+					if (res.data.code == 200) {
+						uni.showToast({
+							icon: 'none',
+							title: '保存成功(包含原有已选)'
+						});
+						this.back();
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: '保存失败:' + (res.data.msg || '未知错误')
+						});
+					}
+				}).catch(err => {
+					console.error('保存检测站失败:', err);
+					uni.showToast({
+						icon: 'none',
+						title: '网络错误,请重试'
+					});
+				});
+			},
+			
+			// 提取坐标信息
+			extractCoordinates(item) {
+				let lng, lat;
+				
+				if (item.lonlat) {
+					const coords = item.lonlat.split(',');
+					if (coords.length >= 2) {
+						lng = parseFloat(coords[0]);
+						lat = parseFloat(coords[1]);
+					}
+				} else if (item.longitude && item.latitude) {
+					lng = item.longitude;
+					lat = item.latitude;
+				} else if (item.lng && item.lat) {
+					lng = item.lng;
+					lat = item.lat;
+				} else if (item.inspectionStationLongitude && item.inspectionStationLatitude) {
+					lng = item.inspectionStationLongitude;
+					lat = item.inspectionStationLatitude;
+				}
+				
+				if (lng !== undefined && lat !== undefined && 
+					!isNaN(lng) && !isNaN(lat) &&
+					lng >= -180 && lng <= 180 &&
+					lat >= -90 && lat <= 90) {
+					return { lng, lat };
+				}
+				
+				console.warn('无法提取有效坐标:', item);
+				return null;
+			},
+			
+			back() {
+				uni.navigateBack({
+					delta: 1
+				});
+			},
+			
+			isValidPosition(position) {
+				const lng = position.lng ||
+					(position.lnglat && (position.lnglat.lng || position.lnglat.longitude));
+				const lat = position.lat ||
+					(position.lnglat && (position.lnglat.lat || position.lnglat.latitude));
+				return lng && lat && !isNaN(parseFloat(lng)) && !isNaN(parseFloat(lat));
+			},
+			
+			// 搜索:合并搜索结果与原有已选(去重)
+			handleSearch() {
+				if (!this.searchKeyword.trim()) {
+					uni.showToast({
+						title: '请输入搜索关键词',
+						icon: 'none'
+					});
+					return;
+				}
+				
+				this.searchByRestAPI(this.searchKeyword);
+			},
+			
+			searchByRestAPI(keyword) {
+				let cityCode = uni.getStorageSync('cityCode') || '140100';
+				let postStr = {
+					"keyWord": keyword,
+					"queryType": 12,
+					"start": 0,
+					"count": 10,
+					"specify": "156" + cityCode
+				};
+				
+				uni.request({
+					url: `https://api.tianditu.gov.cn/v2/search?postStr=${encodeURIComponent(JSON.stringify(postStr))}&type=query&tk=${this.tk}`,
+					success: (res) => {
+						if (res.statusCode === 200 && res.data) {
+							// 处理搜索结果:添加唯一标识,避免与原有已选重复
+							const searchResults = res.data.pois.map(item => ({
+								...item,
+								location: item.lonlat,
+								check: false, // 新搜索结果默认未选中
+								detailedAddress: item.address,
+								inspectionStationName: item.name,
+								locality: item.district || '',
+								// 唯一标识:用经纬度拼接(避免重复添加同一检测站)
+								uniqueKey: `${item.lonlat}`
+							}));
+							
+							// 合并:原有已选 + 新搜索结果(去重)
+							const allData = [...this.originalSelected];
+							searchResults.forEach(searchItem => {
+								// 去重:判断uniqueKey是否已存在
+								const isDuplicate = allData.some(
+									item => item.uniqueKey === searchItem.uniqueKey
+								);
+								if (!isDuplicate) {
+									allData.push(searchItem);
+								}
+							});
+							
+							// 更新显示列表(保留原有已选)
+							this.dataTips = allData;
+						
+						} else {
+							uni.showToast({
+								title: '搜索失败,请重试',
+								icon: 'none'
+							});
+						}
+					},
+					fail: (error) => {
+						console.error('搜索请求失败:', error);
+						uni.showToast({
+							title: '网络错误,请重试',
+							icon: 'none'
+						});
+					}
+				});
+			},
+			
+			onSearchInput(e) {
+				this.searchKeyword = e.detail.value;
+			},
+			
+			// 清除搜索结果:只清除新搜索的,保留原有已选
+			clearSearchResults() {
+				this.searchKeyword = '';
+				this.selectedResult = null;
+				// 恢复为原始已选数据(清除新搜索结果)
+				this.dataTips = [...this.originalSelected];
+			}
+		}
+	};
+</script>
+
+<!-- renderjs模块不变 -->
+<script module="renderjsMap" lang="renderjs">
+	let mapInstance = null;
+	let markerInstance = null;
+	let labelInstance = null;
+	
+	export default {
+		data() {
+			return {
+				mapLoaded: false,
+				lastDataHash: ''
+			};
+		},
+		methods: {
+			updateMapWithMarker(mapData) {
+				console.log('【RenderJS】updateMapWithMarker 被调用', mapData);
+				
+				if (!this.mapLoaded || !mapInstance) {
+					console.warn('地图未加载,延迟执行');
+					setTimeout(() => {
+						this.updateMapWithMarker(mapData);
+					}, 300);
+					return;
+				}
+				
+				const dataHash = JSON.stringify(mapData);
+				if (dataHash === this.lastDataHash) {
+					console.log('数据未变化,跳过更新');
+					return;
+				}
+				this.lastDataHash = dataHash;
+				
+				const lng = Number(mapData.lng);
+				const lat = Number(mapData.lat);
+				const address = mapData.address || mapData.name || '未知位置';
+				
+				if (isNaN(lng) || isNaN(lat)) {
+					console.error('坐标无效:', mapData);
+					return;
+				}
+				
+				const targetLngLat = new window.T.LngLat(lng, lat);
+				mapInstance.panTo(targetLngLat);
+				
+				if (mapData.fromSearch) {
+					mapInstance.setZoom(15);
+				}
+				
+				this.createMarker(targetLngLat, address, mapData.name || '');
+			},
+			clearMarkers() {
+				if (markerInstance && mapInstance) {
+					mapInstance.removeOverLay(markerInstance);
+					markerInstance = null;
+				}
+				if (labelInstance && mapInstance) {
+					mapInstance.removeOverLay(labelInstance);
+					labelInstance = null;
+				}
+			},
+			createMarker(lngLat, address, name) {
+				try {
+					const T = window.T;
+					this.clearMarkers();
+					
+					const iconUrl = this.generateMarkerIcon('#ff0000');
+					const icon = new T.Icon({
+						iconUrl: iconUrl,
+						iconSize: new T.Point(30, 30),
+						iconAnchor: new T.Point(15, 30)
+					});
+					
+					markerInstance = new T.Marker(lngLat, {
+						icon: icon,
+						title: name || address
+					});
+					
+					labelInstance = new T.Label({
+						text: address,
+						position: lngLat,
+						style: {
+							color: '#333',
+							backgroundColor: 'rgba(255, 255, 255, 0.9)',
+							borderColor: '#ff0000',
+							borderWidth: 1,
+							borderRadius: 4,
+							fontSize: '14px',
+							fontWeight: '500',
+							padding: '6px 10px'
+						},
+						offset: new T.Point(0, -40)
+					});
+					
+					mapInstance.addOverLay(markerInstance);
+					mapInstance.addOverLay(labelInstance);
+					
+					markerInstance.addEventListener('click', () => {
+						this.sendToVue('showLocationInfo', {
+							lng: lngLat.getLng().toFixed(6),
+							lat: lngLat.getLat().toFixed(6),
+							address: address,
+							name: name
+						});
+					});
+					
+					console.log('标记创建成功');
+				} catch (error) {
+					console.error('创建标记失败:', error);
+				}
+			},
+			generateMarkerIcon(color) {
+				const size = 30;
+				const canvas = document.createElement('canvas');
+				canvas.width = size;
+				canvas.height = size;
+				const ctx = canvas.getContext('2d');
+				
+				ctx.beginPath();
+				ctx.arc(size/2, size/2, size/2 - 1, 0, Math.PI * 2);
+				ctx.fillStyle = '#ffffff';
+				ctx.fill();
+				
+				ctx.beginPath();
+				ctx.arc(size/2, size/2, size/2 - 4, 0, Math.PI * 2);
+				ctx.fillStyle = color;
+				ctx.fill();
+				
+				return canvas.toDataURL();
+			},
+			async initMap() {
+				try {
+					console.log('【RenderJS】开始初始化地图');
+					await this.loadTiandituAPI();
+					
+					const container = document.getElementById('mapContainer');
+					if (!container) throw new Error('地图容器不存在');
+					
+					const T = window.T;
+					mapInstance = new T.Map(container);
+					const center = new T.LngLat(112.55, 37.87);
+					mapInstance.centerAndZoom(center, 12);
+					
+					const vecLayer = new T.TileLayer(
+						`https://t{s}.tianditu.gov.cn/vec_c/wmts?tk=9bcf63358817bfb878e8236de8bf1423`, {
+							subdomains: ['0', '1', '2', '3', '4', '5', '6', '7']
+						}
+					);
+					const cvaLayer = new T.TileLayer(
+						`https://t{s}.tianditu.gov.cn/cva_c/wmts?tk=9bcf63358817bfb878e8236de8bf1423`, {
+							subdomains: ['0', '1', '2', '3', '4', '5', '6', '7']
+						}
+					);
+					
+					mapInstance.addLayer(vecLayer);
+					mapInstance.addLayer(cvaLayer);
+					mapInstance.addControl(new T.Control.Zoom());
+					mapInstance.addEventListener('click', (e) => this.handleMapClick(e));
+					
+					this.mapLoaded = true;
+					console.log('【RenderJS】地图初始化完成');
+				} catch (error) {
+					console.error('【RenderJS】地图初始化失败:', error);
+				}
+			},
+			loadTiandituAPI() {
+				return new Promise((resolve, reject) => {
+					if (window.T && window.T.Map) {
+						resolve();
+						return;
+					}
+					const script = document.createElement('script');
+					script.src = 'https://api.tianditu.gov.cn/api?v=4.0&tk=9bcf63358817bfb878e8236de8bf1423';
+					script.onload = () => {
+						const checkInterval = setInterval(() => {
+							if (window.T && window.T.Map) {
+								clearInterval(checkInterval);
+								resolve();
+							}
+						}, 100);
+						setTimeout(() => {
+							clearInterval(checkInterval);
+							reject(new Error('T对象初始化超时'));
+						}, 5000);
+					};
+					script.onerror = reject;
+					document.head.appendChild(script);
+				});
+			},
+			handleMapClick(e) {
+				if (!this.mapLoaded) return;
+				const lng = e.lnglat.lng;
+				const lat = e.lnglat.lat;
+				const mapData = { lng, lat, address: '点击位置' };
+				this.updateMapWithMarker(mapData);
+				this.sendToVue('onMapClick', { lng, lat });
+			},
+			sendToVue(method, data) {
+				try {
+					if (this.$ownerInstance && this.$ownerInstance.callMethod) {
+						this.$ownerInstance.callMethod(method, data);
+					}
+				} catch (error) {
+					console.error('发送消息到Vue失败:', error);
+				}
+			},
+			cleanupMap() {
+				this.clearMarkers();
+				if (mapInstance) {
+					try { mapInstance.destroy(); } catch (e) {}
+					mapInstance = null;
+				}
+				this.mapLoaded = false;
+			}
+		},
+		mounted() {
+			console.log('【RenderJS】模块挂载');
+			setTimeout(() => this.initMap(), 500);
+		},
+		beforeDestroy() {
+			console.log('【RenderJS】模块销毁');
+			this.cleanupMap();
+		}
+	};
+</script>
+
+<style scoped lang="scss">
+	.top {
+		width: 100%;
+		height: var(--status-bar-height);
+		background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
+	}
+
+	.head {
+		width: 100%;
+		background: #ffffff;
+
+		.handle {
+			height: 112rpx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding: 0px 24rpx;
+			position: relative;
+
+			.head_left {
+				font-size: 40rpx;
+			}
+
+			.center {
+				position: absolute;
+				left: 50%;
+				top: 50%;
+				transform: translate(-50%, -50%);
+				font-size: 30rpx;
+				font-weight: 600;
+			}
+			
+			.submit-btn {
+				display: flex;
+				width: 104rpx;
+				height: 49rpx;
+				background: #2D88F4;
+				border-radius: 8rpx;
+				align-items: center;
+				justify-content: center;
+				font-size: 28rpx;
+				color: #FFFFFF;
+			}
+		}
+	}
+
+	.container {
+		width: 100%;
+		height: 100vh;
+		display: flex;
+		flex-direction: column;
+		position: relative;
+	}
+
+	.map-container {
+		width: 100%;
+		height: 300px;
+		background-color: #f8f8f8;
+		position: relative;
+	}
+
+	.search-panel {
+		margin-top: 20rpx;
+		padding: 20rpx;
+		background-color: #f8f9fa;
+		border-radius: 8rpx;
+		flex: 1;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.search-input-group {
+		display: flex;
+		gap: 10rpx;
+		margin-bottom: 20rpx;
+	}
+
+	.search-input {
+		flex: 1;
+		height: 70rpx;
+		padding: 0 20rpx;
+		border: 1px solid #ddd;
+		border-radius: 8rpx;
+		background-color: white;
+		font-size: 28rpx;
+	}
+
+	.search-btn {
+		height: 70rpx;
+		padding: 0 20rpx;
+		background-color: #1890ff;
+		color: white;
+		border-radius: 8rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		font-size: 28rpx;
+		border: none;
+	}
+
+	.search-results {
+		border: 1px solid #e8e8e8;
+		border-radius: 8rpx;
+		flex: 1;
+		background-color: white;
+	}
+
+	.result-header {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		padding: 20rpx;
+		border-bottom: 1px solid #f0f0f0;
+		font-weight: bold;
+		font-size: 28rpx;
+	}
+
+	.clear-results {
+		color: #1890ff;
+		font-size: 24rpx;
+	}
+
+	.results-list {
+		max-height: 700rpx;
+	}
+
+	.result-item {
+		padding: 20rpx;
+		border-bottom: 1px solid #f5f5f5;
+		cursor: pointer;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		
+		&.selected {
+			background-color: #e6f7ff;
+			border-left: 4rpx solid #1890ff;
+		}
+		
+		.left {
+			flex: 1;
+			margin-right: 20rpx;
+		}
+		
+		.selected-tag {
+			display: inline-flex;
+			align-items: center;
+			justify-content: center;
+			width: 80rpx;
+			height: 43rpx;
+			background: rgba(253,73,18,0.05);
+			border-radius: 4rpx ;
+			font-size: 24rpx;
+			color: #FD4912;
+			margin-right: 12rpx;
+		}
+		
+		.right {
+			image {
+				width: 40rpx;
+				height: 40rpx;
+			}
+		}
+	}
+	
+	.result-name {
+		font-weight: bold;
+		margin-bottom: 5rpx;
+		color: #333;
+		font-size: 28rpx;
+		display: flex;
+		align-items: center;
+	}
+
+	.result-address {
+		font-size: 24rpx;
+		color: #666;
+	}
+</style>

+ 2 - 1
pages/product/index.vue

@@ -485,7 +485,8 @@
 			//跳转至选择检测站
 			goSelect(item) {
 				uni.navigateTo({
-					url: '/pages/product/checkMap'
+					// url: '/pages/product/checkMap'
+					url:'/pages/product/checkTdMap'
 				})
 			},
 			getStatus() {

+ 3 - 3
pages/store/businessInfor.vue

@@ -66,7 +66,6 @@
 					<view class=" booder-top" style="padding-bottom: 16upx" :style="{ display: mapIsHidden }"
 						@click="selectAddress">
 						<tdmap 
-							:initialPosition="savedLocation" 
 							:allowSelection="false" 
 							:showCoordinates="false" 
 							:key="mapKey"
@@ -140,6 +139,7 @@
 						lat: Number(obj.latitude) || 37.87,
 						address: obj.address || '位置'
 					};
+					uni.setStorage('mapMarkData',this.savedLocation)
 					this.latitude = obj.latitude;
 					this.longitude = obj.longitude;
 				}
@@ -158,8 +158,7 @@
 			
 			// 修复:安全获取存储的地址,避免da为undefined
 			let da = uni.getStorageSync("address") || {};
-			console.log('存储的地址信息:', da);
-			
+			// console.log(da)
 			// 核心:确保lng/lat是合法数字,兜底默认值
 			const lng = Number(da.lng) || 112.55;
 			const lat = Number(da.lat) || 37.87;
@@ -170,6 +169,7 @@
 				lat: lat,
 				address: da.address || '位置'
 			};
+			uni.setStorageSync('mapMarkData',this.savedLocation)
 			this.latitude = lat;
 			this.longitude = lng;
 			

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 512 - 416
pages/store/selectTdMap.vue


+ 494 - 139
pages/store/tdtuMap.vue

@@ -1,13 +1,9 @@
 <template>
     <view class="map_container">
-        <!-- #ifdef APP-PLUS || H5 -->
         <view 
             id="MapContainer"
-            :props="randerProps"
-            :change:props="handlePropsChange"
             style="width: 100%;height: 300px;position: relative;"
         ></view>
-        <!-- #endif -->
     </view>
 </template>
 
@@ -15,67 +11,47 @@
 export default {
     name: "TdMap",
     props: {
-        initialPosition: {
-            type: Object,
-            default: () => ({ lng: 112.55, lat: 37.87 }),
-            validator: (val) => {
-                if (!val) return true;
-                return typeof val.lng === 'number' && typeof val.lat === 'number' && !isNaN(val.lng) && !isNaN(val.lat);
-            }
-        },
         allowSelection: { type: Boolean, default: false },
         showCoordinates: { type: Boolean, default: false },
         mapKey: { type: [String, Number], default: 0 }
     },
-    computed: {
-        randerProps() {
-            console.log('【子组件】接收的经纬度', this.initialPosition)
-            return {
-                initialPosition: { ...this.initialPosition },
-                allowSelection: this.allowSelection,
-                showCoordinates: this.showCoordinates
-            };
-        }
-    },
-    methods: {
-        handlePropsChange(newProps) {
-            return { ...newProps };
-        }
+    mounted() {
+        console.log('【地图组件挂载】开始初始化');
     },
-    watch: {
-        initialPosition: {
-            deep: true,
-            handler() {
-                this.handlePropsChange(this.randerProps);
-            }
-        }
+    beforeDestroy() {
+        // 清理资源
+        this.$emit('destroy-map');
     }
 };
 </script>
 
 <script module="randerJSMap" lang="renderjs">
 export default {
-    props: ['props'],
     data() {
         return {
             mapRef: null,
             markerRef: null,
-            mapLoaded: false
+            labelRef: null,
+            mapLoaded: false,
+            initPromise: null,
+            lastDataHash: '',
+            storageCheckTimer: null,
+            lastStorageDataStr: ''
         };
     },
     methods: {
         /**
-         * 修复APP端容器获取失败问题
+         * 获取地图容器
          */
         getMapContainer() {
             return new Promise((resolve) => {
-                // 方案1:常规document获取
                 let container = document.getElementById('MapContainer');
                 if (container) {
                     console.log('【容器获取】成功', container);
                     return resolve(container);
                 }
-                // 方案2:APP端兜底(RenderJS专用)
+                
+                // APP端兜底
                 uni.createSelectorQuery().in(this.$ownerInstance)
                     .select('#MapContainer')
                     .boundingClientRect((rect) => {
@@ -90,146 +66,502 @@ export default {
         },
 
         /**
-         * 初始化地图(适配4.0:移除VectorLayer,简化逻辑)
+         * 直接从storage获取地图数据
          */
-        async initMap() {
+        getMapDataFromStorage() {
             try {
-                const T = window.T;
-                if (!T) throw new Error('天地图API未加载');
-
-                // 1. 安全获取容器(解决APP端容器为空)
-                const container = await this.getMapContainer();
-                if (!container) throw new Error('地图容器为空');
-
-                // 2. 创建地图实例(4.0简化版)
-                this.mapRef = new T.Map(container);
-                if (!this.mapRef) throw new Error('地图实例创建失败');
-
-                // 3. 解析坐标(确认有值)
-                const { lng = 112.55, lat = 37.87 } = this.props?.initialPosition || {};
-                const targetLngLat = new T.LngLat(Number(lng), Number(lat));
-                console.log('【初始化】最终坐标', targetLngLat.getLng(), targetLngLat.getLat());
-
-                // 4. 初始化地图视图(放大缩放级别,确保点在视野中心)
-                this.mapRef.centerAndZoom(targetLngLat, 16); // 放大到16级,点更显眼
-                this.mapRef.setMapType(T.TMAP_NORMAL_MAP);
-                this.mapRef.enableScrollWheelZoom(true); // 开启滚轮缩放,方便查看
-
-                // 5. 强制渲染地图
-                this.mapRef.render();
-                this.mapLoaded = true;
-
-                // 6. 延长延迟创建点(给4.0地图加载留足时间,APP端需500ms+)
-                setTimeout(() => {
-                    this.createMarker(targetLngLat);
-                }, 800);
-
+                console.log('【RenderJS开始获取storage数据】');
+                const storageData = uni.getStorageSync('mapMarkData');
+                console.log('【RenderJS从storage获取的原始数据】', storageData);
+                console.log('【RenderJS数据类型】', typeof storageData);
+                
+                let parsedData = null;
+                
+                if (storageData) {
+                    // 如果是字符串,尝试解析为JSON
+                    if (typeof storageData === 'string') {
+                        try {
+                            parsedData = JSON.parse(storageData);
+                            console.log('【RenderJS解析后的数据】', parsedData);
+                        } catch (parseError) {
+                            console.error('【RenderJS JSON解析失败】', parseError);
+                            return this.getDefaultMapData();
+                        }
+                    } else {
+                        parsedData = storageData;
+                    }
+                    
+                    // 验证数据格式
+                    const isValidData = parsedData && 
+                                       typeof parsedData === 'object' && 
+                                       (typeof parsedData.lng !== 'undefined' || parsedData.longitude) && 
+                                       (typeof parsedData.lat !== 'undefined' || parsedData.latitude);
+                    
+                    console.log('【RenderJS数据验证结果】', isValidData);
+                    
+                    if (isValidData) {
+                        // 支持多种字段名
+                        const lng = parsedData.lng || parsedData.longitude || 112.55;
+                        const lat = parsedData.lat || parsedData.latitude || 37.87;
+                        const address = parsedData.address || parsedData.name || parsedData.location || '未知位置';
+                        
+                        return {
+                            lng: Number(lng),
+                            lat: Number(lat),
+                            address: address,
+                            isValid: true
+                        };
+                    } else {
+                        console.warn('【RenderJS】storage数据格式无效,使用默认值');
+                        console.warn('【RenderJS无效数据详情】', parsedData);
+                        return this.getDefaultMapData();
+                    }
+                } else {
+                    console.log('【RenderJS】storage中无mapMarkData数据,使用默认值');
+                    return this.getDefaultMapData();
+                }
             } catch (error) {
-                console.error('【初始化失败】', error);
-                this.mapLoaded = false;
+                console.error('【RenderJS】从storage获取数据失败', error);
+                return this.getDefaultMapData();
             }
         },
+        
+        /**
+         * 获取默认地图数据
+         */
+        getDefaultMapData() {
+            return {
+                lng: 112.55,
+                lat: 37.87,
+                address: '山西省太原市',
+                isValid: false
+            };
+        },
 
         /**
-         * 创建点覆盖物(4.0适配:直接添加到地图,放大尺寸确保可见)
+         * 创建标记和标签
          */
-        createMarker(lngLat) {
+        createMarkerWithLabel(lngLat, address) {
             try {
                 const T = window.T;
-                if (!this.mapLoaded || !lngLat) {
-                    console.error('【标点失败】前置条件不足', {
-                        mapLoaded: this.mapLoaded,
-                        lngLat: !!lngLat
-                    });
+                if (!this.mapLoaded || !lngLat || !this.mapRef) {
+                    console.error('【标点失败】前置条件不足');
                     return;
                 }
 
-                // 移除旧点(4.0直接从地图移除)
-                if (this.markerRef) {
-                    this.mapRef.removeOverlay(this.markerRef);
-                    this.markerRef = null;
-                }
+                // 1. 移除旧标记
+                this.clearMarkers();
 
-                // 创建点覆盖物(超大尺寸+高亮颜色,确保100%可见)
-                this.markerRef = new T.PointOverlay(lngLat, {
-                    radius: 15, // 放大到15px,肉眼绝对可见
-                    color: '#ff0000', // 红色(最显眼)
-                    borderColor: '#ffffff',
-                    borderWidth: 4,
-                    zIndex: 99999 // 顶级层级,绝对不被覆盖
+                // 2. 创建自定义图标(红色标记)
+                const icon = new T.Icon({
+                    iconUrl: this.generateMarkerIcon('#ff0000'),
+                    iconSize: new T.Point(30, 30),
+                    iconAnchor: new T.Point(15, 30)
                 });
 
-                // 4.0适配:直接添加到地图实例(无需矢量图层)
-                this.mapRef.addOverlay(this.markerRef);
-                console.log('【标点】点覆盖物添加到地图成功', this.markerRef);
+                // 3. 创建标记(使用T.Marker类)
+                this.markerRef = new T.Marker(lngLat, {
+                    icon: icon,
+                    title: address || '未知位置',
+                    draggable: false
+                });
+
+                // 4. 创建文本标签
+                this.labelRef = new T.Label({
+                    text: address || '未知位置',
+                    position: lngLat,
+                    style: {
+                        color: '#333333',
+                        backgroundColor: 'rgba(255, 255, 255, 0.9)',
+                        borderColor: '#ff0000',
+                        borderWidth: 1,
+                        borderRadius: 4,
+                        fontSize: '14px',
+                        fontWeight: '500',
+                        padding: '6px 10px'
+                    },
+                    offset: new T.Point(0, -40) // 向上偏移
+                });
 
-                // 强制刷新地图
-                this.mapRef.render();
+                // 5. 添加到地图
+                this.mapRef.addOverLay(this.markerRef);
+                this.mapRef.addOverLay(this.labelRef);
+
+                console.log('【创建标记】成功', { 
+                    lng: lngLat.getLng(), 
+                    lat: lngLat.getLat(),
+                    address 
+                });
 
-                // 确保点在视野中心(双重保障)
-                this.mapRef.panTo(lngLat);
+                // 6. 调整地图视图
+                this.mapRef.setViewport([lngLat]);
 
-                // 点击事件(验证点存在)
-                this.markerRef.addEventListener('click', () => {
+                // 7. 标记点击事件
+                this.markerRef.addEventListener('click', (e) => {
                     const coord = {
                         lng: lngLat.getLng().toFixed(6),
                         lat: lngLat.getLat().toFixed(6)
                     };
+                    const message = `地址:${address}\n坐标:${coord.lng}, ${coord.lat}`;
+                    
+                    uni.showModal({
+                        title: '位置信息',
+                        content: message,
+                        showCancel: false,
+                        confirmText: '确定'
+                    });
+                });
+
+                // 8. 标签点击事件
+                this.labelRef.addEventListener('click', (e) => {
+                    e.stopPropagation();
                     uni.showToast({
-                        title: `坐标:${coord.lng},${coord.lat}`,
+                        title: `地址:${address}`,
                         icon: 'none',
                         duration: 3000
                     });
                 });
 
             } catch (error) {
-                console.error('【标点异常】', error);
+                console.error('【创建标记异常】', error);
+                // 备用方案:使用默认标记
+                this.createDefaultMarker(lngLat, address);
+            }
+        },
+
+        /**
+         * 生成标记图标
+         */
+        generateMarkerIcon(color) {
+            const size = 30;
+            const canvas = document.createElement('canvas');
+            canvas.width = size;
+            canvas.height = size;
+            
+            const ctx = canvas.getContext('2d');
+            
+            // 外圆(白色边框)
+            ctx.beginPath();
+            ctx.arc(size/2, size/2, size/2 - 1, 0, Math.PI * 2);
+            ctx.fillStyle = '#ffffff';
+            ctx.fill();
+            
+            // 内圆(红色)
+            ctx.beginPath();
+            ctx.arc(size/2, size/2, size/2 - 4, 0, Math.PI * 2);
+            ctx.fillStyle = color;
+            ctx.fill();
+            
+            return canvas.toDataURL();
+        },
+
+        /**
+         * 创建默认标记(备用方案)
+         */
+        createDefaultMarker(lngLat, address) {
+            try {
+                const T = window.T;
+                
+                // 清除旧标记
+                this.clearMarkers();
+                
+                // 创建默认标记
+                this.markerRef = new T.Marker(lngLat, {
+                    title: address || '未知位置'
+                });
+                
+                // 设置默认图标
+                this.markerRef.setIcon(new T.Icon.Default());
+                
+                // 添加到地图
+                this.mapRef.addOverLay(this.markerRef);
+                
+                // 标记点击事件
+                this.markerRef.addEventListener('click', (e) => {
+                    const coord = {
+                        lng: lngLat.getLng().toFixed(6),
+                        lat: lngLat.getLat().toFixed(6)
+                    };
+                    const message = `地址:${address}\n坐标:${coord.lng}, ${coord.lat}`;
+                    
+                    uni.showModal({
+                        title: '位置信息',
+                        content: message,
+                        showCancel: false,
+                        confirmText: '确定'
+                    });
+                });
+                
+                console.log('【创建默认标记】成功');
+                
+            } catch (error) {
+                console.error('【创建默认标记失败】', error);
+            }
+        },
+
+        /**
+         * 清除所有标记
+         */
+        clearMarkers() {
+            try {
+                if (this.markerRef && this.mapRef) {
+                    this.mapRef.removeOverLay(this.markerRef);
+                    this.markerRef = null;
+                }
+                if (this.labelRef && this.mapRef) {
+                    this.mapRef.removeOverLay(this.labelRef);
+                    this.labelRef = null;
+                }
+            } catch (error) {
+                console.warn('清除标记时出错', error);
+            }
+        },
+
+        /**
+         * 初始化地图
+         */
+        async initMap() {
+            try {
+                console.log('【初始化地图】开始');
+                
+                const T = window.T;
+                if (!T || !T.Map) {
+                    throw new Error('天地图API未正确加载');
+                }
+
+                // 获取容器
+                const container = await this.getMapContainer();
+                if (!container) {
+                    throw new Error('地图容器获取失败');
+                }
+
+                // 直接从storage获取位置数据
+                const mapData = this.getMapDataFromStorage();
+                console.log('【初始化地图使用的数据】', mapData);
+                
+                const center = new T.LngLat(Number(mapData.lng), Number(mapData.lat));
+                console.log('【地图中心点】', center);
+
+                // 创建地图实例
+                this.mapRef = new T.Map(container);
+                this.mapRef.centerAndZoom(center, 16);
+                this.mapRef.enableScrollWheelZoom();
+
+                this.mapLoaded = true;
+                console.log('【初始化地图】成功');
+
+                // 创建标记和标签
+                setTimeout(() => {
+                    this.createMarkerWithLabel(center, mapData.address);
+                }, 500);
+
+            } catch (error) {
+                console.error('【初始化失败】', error);
+                this.mapLoaded = false;
+                
+                uni.showToast({
+                    title: '地图初始化失败',
+                    icon: 'error',
+                    duration: 3000
+                });
+            }
+        },
+
+        /**
+         * 确保API加载完成
+         */
+        async ensureAPILoaded() {
+            if (window.T && window.T.Map && window.T.LngLat) {
+                console.log('【API已加载】');
+                return Promise.resolve();
             }
+
+            return new Promise((resolve, reject) => {
+                console.log('【开始加载API】');
+                
+                // 检查是否已经在加载中
+                const existingScript = document.querySelector('script[src*="tianditu.gov.cn"]');
+                if (existingScript) {
+                    console.log('【API已在加载中】');
+                    const checkInterval = setInterval(() => {
+                        if (window.T && window.T.Map && window.T.LngLat) {
+                            clearInterval(checkInterval);
+                            console.log('【API加载完成】');
+                            resolve();
+                        }
+                    }, 100);
+                    
+                    setTimeout(() => {
+                        clearInterval(checkInterval);
+                        reject(new Error('API加载超时'));
+                    }, 10000);
+                    
+                    return;
+                }
+
+                // 加载天地图4.0 API
+                const script = document.createElement('script');
+                script.src = 'https://api.tianditu.gov.cn/api?v=4.0&tk=9bcf63358817bfb878e8236de8bf1423';
+                
+                script.onload = () => {
+                    console.log('【API脚本加载完成】');
+                    const checkT = setInterval(() => {
+                        if (window.T && window.T.Map && window.T.LngLat) {
+                            clearInterval(checkT);
+                            console.log('【T对象初始化完成】');
+                            resolve();
+                        }
+                    }, 50);
+                    
+                    setTimeout(() => {
+                        clearInterval(checkT);
+                        reject(new Error('T对象初始化超时'));
+                    }, 5000);
+                };
+                
+                script.onerror = (err) => {
+                    console.error('API加载失败', err);
+                    reject(new Error('API加载失败'));
+                };
+                
+                document.head.appendChild(script);
+            });
         },
 
         /**
-         * props更新时同步点位置
+         * 更新地图标记(从storage获取最新数据)
          */
-        handlePropsUpdate(newProps) {
-            console.log('【props更新】', newProps);
-            if (!this.mapLoaded || !newProps) return;
+        updateMapFromStorage() {
+            if (!this.mapLoaded || !this.mapRef) {
+                console.warn('【更新被跳过】地图未加载');
+                return;
+            }
 
-            const { lng, lat } = newProps.initialPosition || {};
-            if (typeof lng !== 'number' || typeof lat !== 'number' || isNaN(lng) || isNaN(lat)) {
+            // 获取最新数据
+            const mapData = this.getMapDataFromStorage();
+            console.log('【更新地图使用的数据】', mapData);
+            
+            // 生成数据哈希,避免重复更新
+            const dataHash = JSON.stringify(mapData);
+            if (dataHash === this.lastDataHash) {
+                console.log('【数据未变化,跳过更新】');
+                return;
+            }
+            
+            this.lastDataHash = dataHash;
+
+            // 验证坐标有效性
+            const isValidLng = typeof mapData.lng !== 'undefined' && !isNaN(Number(mapData.lng)) && mapData.lng !== null;
+            const isValidLat = typeof mapData.lat !== 'undefined' && !isNaN(Number(mapData.lat)) && mapData.lat !== null;
+            
+            console.log('【坐标验证】', { isValidLng, isValidLat, lng: mapData.lng, lat: mapData.lat });
+            
+            if (!isValidLng || !isValidLat) {
                 console.warn('无效坐标,使用默认值');
-                return this.createMarker(new window.T.LngLat(112.55, 37.87));
+                const defaultLngLat = new window.T.LngLat(112.55, 37.87);
+                this.createMarkerWithLabel(defaultLngLat, mapData.address || '默认位置');
+                return;
             }
 
+            // 创建新标记
+            const targetLngLat = new window.T.LngLat(Number(mapData.lng), Number(mapData.lat));
+            
+            // 移动地图中心
+            this.mapRef.panTo(targetLngLat);
+            
             setTimeout(() => {
-                this.createMarker(new window.T.LngLat(lng, lat));
-            }, 500);
+                this.createMarkerWithLabel(targetLngLat, mapData.address || '未知位置');
+            }, 300);
+        },
+        
+        /**
+         * 设置storage监听
+         */
+        setupStorageListener() {
+            // 监听uni-app自定义事件
+            uni.$on('storageChange', (data) => {
+                console.log('【RenderJS收到storage变化事件】', data);
+                if (data && data.key === 'mapMarkData') {
+                    this.updateMapFromStorage();
+                }
+            });
+            
+            // 定时检查(兼容性更好)
+            this.storageCheckTimer = setInterval(() => {
+                this.checkStorageUpdate();
+            }, 2000);
+        },
+        
+        /**
+         * 检查storage是否更新
+         */
+        checkStorageUpdate() {
+            try {
+                const currentData = uni.getStorageSync('mapMarkData');
+                const currentStr = JSON.stringify(currentData);
+                
+                // 首次检查时初始化lastStorageData
+                if (!this.lastStorageDataStr) {
+                    this.lastStorageDataStr = currentStr;
+                    return;
+                }
+                
+                if (currentStr !== this.lastStorageDataStr) {
+                    console.log('【storage数据已更新】', currentData);
+                    this.lastStorageDataStr = currentStr;
+                    this.updateMapFromStorage();
+                }
+            } catch (error) {
+                console.error('检查storage更新失败', error);
+            }
         }
     },
     mounted() {
-        console.log('【RenderJS】开始加载API');
-        if (window.T) {
-            // 延迟初始化(确保容器+props就绪)
-            setTimeout(() => this.initMap(), 500);
-        } else {
-            // 加载天地图4.0 API(替换为自己的TK)
-            const script = document.createElement('script');
-            script.src = 'https://api.tianditu.gov.cn/api?v=4.0&tk=92c4ddd919f4e41a30e765680e3a29b7';
-            script.async = false; // 同步加载,避免时序问题
-            script.onload = () => {
-                console.log('【API加载】完成');
-                setTimeout(() => this.initMap(), 800); // 延长延迟
-            };
-            script.onerror = () => console.error('API加载失败,请检查TK密钥是否有效');
-            document.body.appendChild(script);
-        }
-    },
-    watch: {
-        props: {
-            deep: true,
-            handler(newProps) {
-                this.handlePropsUpdate(newProps);
+        console.log('【RenderJS】开始加载');
+        
+        // 延迟初始化
+        setTimeout(async () => {
+            try {
+                await this.ensureAPILoaded();
+                await this.initMap();
+                
+                // 初始化成功后设置监听
+                this.setupStorageListener();
+                
+                // 保存初始数据用于比较
+                try {
+                    this.lastStorageDataStr = JSON.stringify(uni.getStorageSync('mapMarkData'));
+                } catch (error) {
+                    this.lastStorageDataStr = '';
+                }
+            } catch (error) {
+                console.error('【初始化失败】', error);
+                uni.showToast({
+                    title: '地图加载失败',
+                    icon: 'error',
+                    duration: 3000
+                });
             }
+        }, 500);
+    },
+    beforeDestroy() {
+        // 清理资源
+        if (this.mapRef) {
+            this.clearMarkers();
+            this.mapRef = null;
         }
+        
+        // 清理定时器
+        if (this.storageCheckTimer) {
+            clearInterval(this.storageCheckTimer);
+            this.storageCheckTimer = null;
+        }
+        
+        // 移除事件监听
+        uni.$off('storageChange');
+        
+        this.mapLoaded = false;
+        console.log('【RenderJS】组件销毁');
     }
 };
 </script>
@@ -240,19 +572,42 @@ export default {
     width: 100%;
     height: 300px;
     z-index: 1;
-    overflow: visible;
-    /* 浅灰色背景,对比红色点更显眼 */
+    overflow: hidden;
     background: #f0f0f0;
+    border-radius: 8px;
+    border: 1px solid #e0e0e0;
 }
+
 #MapContainer {
     position: relative;
-    z-index: 9999 !important; // 顶级层级,避免任何遮挡
+    z-index: 9999;
     display: block;
-    width: 100%;
-    height: 100%;
-    /* 移除可能的内边距/边框遮挡 */
+    width: 100% !important;
+    height: 100% !important;
     padding: 0 !important;
     margin: 0 !important;
     border: none !important;
+    border-radius: 8px;
+}
+
+/* 自定义样式 */
+::v-deep .tdt-label {
+    cursor: pointer;
+    transition: all 0.3s ease;
+    
+    &:hover {
+        background-color: rgba(255, 255, 255, 1) !important;
+        border-color: #ff4444 !important;
+        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
+    }
+}
+
+::v-deep .tdt-marker-icon {
+    cursor: pointer;
+    transition: transform 0.2s;
+    
+    &:hover {
+        transform: scale(1.2);
+    }
 }
 </style>

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels