浏览代码

Merge branch 'master' of http://39.101.143.165:8090/hxl13994548489/LocalLivingServicesUniapp

caiyuqin 1 月之前
父节点
当前提交
8b867adae6
共有 2 个文件被更改,包括 47 次插入36 次删除
  1. 38 27
      pages/index/shop.vue
  2. 9 9
      pages/store/businessInfor.vue

+ 38 - 27
pages/index/shop.vue

@@ -24,7 +24,7 @@
 								:disabled="true"></u-rate>
 							<span>{{shopData.grade}}分</span>
 						</view>
-						<span :style="{color:btnList[typeIndex].color}">{{btnList[typeIndex].name}}</span>
+						<span v-if="typeIndex !== null" :style="{color:btnList[typeIndex].color}">{{btnList[typeIndex].name}}</span>
 					</view>
 				</view>
 				<view class="address">
@@ -83,7 +83,7 @@
 				</view>
 				<view class="center">
 					<image :src="btnList[currentIndex].image" mode="" v-show="shopStatus == 1"></image>
-					<span>{{btnList[currentIndex].tip}}</span>
+					<span>{{ resultTip || (btnList[currentIndex] && btnList[currentIndex].tip) }}</span>
 					<view class="error" v-show="shopStatus == 4">
 						当前门店还存在有效服务券<br />
 						暂时无法关闭门店
@@ -124,28 +124,28 @@
 						type:3,
 						class:"close",
 						tip:"该店铺已暂停营业",
-						image:"/static/index/close.png",
-						content:"	",
-						color:"#999999"
-					},
-					{
-						name: '解约下线',
-						type: 4,
-						class:"close",
-						tip:"谢谢光临,该店铺已下架",
 						image:"/static/index/rest.png",
 						content:"	",
 						color:"#FF8024"
 					},
-					{
-						name: '门店歇业',
-						type: 5,
-						class:"rest",
-						tip:"当前门店已歇业",
-						image:"/static/index/rest.png",
-						content:"当前门店确定歇业?",
-						color:"#FF8024"
-					},
+					// {
+					// 	name: '解约下线',
+					// 	type: 4,
+					// 	class:"close",
+					// 	tip:"谢谢光临,该店铺已下架",
+					// 	image:"/static/index/rest.png",
+					// 	content:"	",
+					// 	color:"#FF8024"
+					// },
+					// {
+					// 	name: '门店歇业',
+					// 	type: 5,
+					// 	class:"rest",
+					// 	tip:"当前门店已歇业",
+					// 	image:"/static/index/rest.png",
+					// 	content:"当前门店确定歇业?",
+					// 	color:"#FF8024"
+					// },
 				],
 				currentIndex: 0,
 				isPopup: false,
@@ -154,8 +154,9 @@
 				count: 5,
 				shopData: {},
 				shopStatus: null,
-				typeIndex: 0,
+				typeIndex: null,
 				id: '',
+				resultTip:''
 			}
 		},
 		methods: {
@@ -183,8 +184,10 @@
 					this.$http.post("/merchant/localMerchantInfo/editStatus", data).then(res => {
 						if (res.data.code == 200) {
 							this.isPopup = false
-							this.isSuccess = true
-							this.getShopData()
+							// 解决页面闪烁状态问题
+							this.getShopData().then(() => {
+                this.isSuccess = true
+            	})
 						}else {
               uni.showToast({
                 icon: 'none',
@@ -194,13 +197,21 @@
 					})
 			},
 			getShopData() {
-				this.$http.get("/merchant/localMerchantInfo/queryById?id=" + this.id).then(res => {
+				return  this.$http.get("/merchant/localMerchantInfo/queryById?id=" + this.id).then(res => {
 					if (res.data.code == 200) {
 						this.shopData = res.data.result
+						this.resultTip = ''
 						this.shopStatus = res.data.result.merchantStatus
-						const index=this.btnList.findIndex(item => item.type == this.shopStatus);
-						this.typeIndex = index
-						this.currentIndex=index
+						let tempStatus = this.shopStatus
+						if (tempStatus === 5) {
+							this.resultTip = '当前时间不在营业时间范围内,已自动歇业。'
+							tempStatus = 3
+						}
+						const index=this.btnList.findIndex(item => item.type == tempStatus);
+						if (index > -1) {
+								this.typeIndex = index
+								this.currentIndex=index
+						}
 					}
 				})
 			},

+ 9 - 9
pages/store/businessInfor.vue

@@ -64,9 +64,9 @@
 					<view class="title">地理位置</view>
 					<view class=" booder-top" style="padding-bottom: 16upx" :style="{ display: mapIsHidden }"
 						@click="selectAddress">
-						<tdmap 
-							:allowSelection="false" 
-							:showCoordinates="false" 
+						<tdmap
+							:allowSelection="false"
+							:showCoordinates="false"
 							:key="mapKey"
 						></tdmap>
 					</view>
@@ -80,7 +80,7 @@
 			<button class="cu-btn round line-gray  shadow" @click="back()">取消</button>
 			<button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交</button>
 		</view>
-		<u-picker v-model="show" mode="time" :default-time="date" @confirm="selectTime" style="z-index: 999 !important;"></u-picker>
+		<u-picker v-model="show" mode="time" :default-time="date||''" @confirm="selectTime" style="z-index: 999 !important;"></u-picker>
 	</view>
 </template>
 
@@ -120,7 +120,7 @@
 				mapIsHidden: 'block', // 修复:初始为block,确保地图容器显示
 				mapKey: 1,
 				// 修复:初始化savedLocation为合法对象,避免undefined
-				savedLocation: { lng: 112.55, lat: 37.87 } 
+				savedLocation: { lng: 112.55, lat: 37.87 }
 			};
 		},
 		onLoad(data) {
@@ -130,7 +130,7 @@
 				obj.photo = obj.photo ? obj.photo.split(',').filter(id => id !== '') : [];
 				this.form = obj;
 				this.date = this.form.openingTime;
-				
+
 				// 修复:从obj中赋值坐标,确保数字类型
 				if (obj.longitude && obj.latitude) {
 					this.savedLocation = {
@@ -154,14 +154,14 @@
 						uni.showToast({ icon:'none', title:res.data.message });
 					}
 				});
-			
+
 			// 修复:安全获取存储的地址,避免da为undefined
 			let da = uni.getStorageSync("address") || {};
 			// console.log(da)
 			// 核心:确保lng/lat是合法数字,兜底默认值
 			const lng = Number(da.lng) || 112.55;
 			const lat = Number(da.lat) || 37.87;
-			
+
 			// 更新savedLocation(触发子组件props更新)
 			this.savedLocation = {
 				lng: lng,
@@ -171,7 +171,7 @@
 			uni.setStorageSync('mapMarkData',this.savedLocation)
 			this.latitude = lat;
 			this.longitude = lng;
-			
+
 			// 优化:仅当坐标变化时更新mapKey,避免频繁刷新
 			if (lng !== 112.55 || lat !== 37.87) {
 				this.mapKey += 1;