郭宇琦 2 недель назад
Родитель
Сommit
7c580f2e9d

+ 6 - 9
pages/carDetail/carDetail.vue

@@ -8,8 +8,7 @@
 			<view class="car-detail-name">{{car_detail.car_model_name}}</view>
 			<view class="car-detail-price"><allPrice :amount="Number(price)"/></view>
 			<view style="flex-wrap: wrap;justify-content: flex-start;" class="flex-row car-detail-time">
-				<view v-for="(item,index) in car_detail.rental_setting"  :key="index" @tap="tapSelectType" :data-price="item.hire_price"
-					:data-select_type="item.hire_duration_unit"
+				<view v-for="(item,index) in car_detail.rental_setting"  :key="index" @click="tapSelectType(item)" 
 					:class="['time-unit',selectType==item.hire_duration_unit? 'time-unit-i':'']">
 					<text v-if="item.hire_duration_unit==1">日租</text>
 					<text v-if="item.hire_duration_unit==2">月租</text>
@@ -20,7 +19,7 @@
 					<text v-if="item.hire_duration_unit==7">季租</text>
 				</view>
 				
-				<view @tap="tapSelectType" :data-select_type="100" :data-price="car_detail.sell_price"
+				<view  @click="tapSelectType({hire_duration_unit:100,hire_price:car_detail.sell_price})" :data-select_type="100" :data-price="car_detail.sell_price"
 					:class="['time-unit',selectType==100? 'time-unit-i':'']">购买</view>
 			</view>
 		</view>
@@ -137,6 +136,7 @@
 					longitude: longitude,
 				}, (resp) => {
 					if (resp.data.code === 200) {
+						me.tapSelectType(resp.data.data.rental_setting[0])
 						me.setData({
 							car_detail:resp.data.data,
 							price:((resp.data.data.rental_setting[0]?.hire_price || 0)/100).toFixed(2)
@@ -146,14 +146,11 @@
 					}
 				})
 			},
-			
-			
 			tapSelectType(e) {
-				const {select_type,price} = e.currentTarget.dataset
-				console.log(select_type,price,'select_type,price');
+				const {hire_duration_unit,hire_price} = e
 				this.setData({
-					selectType: select_type,
-					price:(price/100).toFixed(2)
+					selectType: hire_duration_unit,
+					price:(hire_price/100).toFixed(2)
 				})
 			},
 			tapCallPhone(){

+ 1 - 12
pages/service/components/carRentalList/carRentalList.css

@@ -16,18 +16,7 @@
 	margin-bottom: 20rpx;
 }
 .card-center-ren .store-type{
-	border-radius: 8rpx;
-	border: 2rpx solid #0A59F7;
-	text-align: center;
-	font-weight: 600;
-	padding: 12rpx 20rpx;
-	line-height: 20rpx;
-	font-size: 24rpx;
 	color: #0A59F7;
-	margin-right: 12rpx;
-	display: flex;
-	align-items: center;
-	justify-content: center;
 }
 
 .card-top-style>view:nth-of-type(2) {
@@ -53,7 +42,7 @@
 	color: #060809;
 }
 
-.card-center-ren view {
+.card-center-ren .tag {
 	margin-right: 12rpx;
 	font-size: 22rpx;
 	color: #2A3A5A;

+ 30 - 5
pages/service/components/carRentalList/carRentalList.vue

@@ -8,16 +8,15 @@
 						<view>{{item.distance}}</view>
 					</view>
 					<view class="card-center-ren flex-row">
-						<view v-for="(items,indexs) of item.business_list" :key="indexs" class="store-type">
+						<view style="color: #0A59F7;border-color: #0A59F7;" v-for="(items,indexs) of item.business_list" :key="indexs" class=" tag align-c">
 							{{items.title}}
 						</view>
-						<view class="align-c">
+						<view class="align-c tag">
 							<text class="card-center-num">{{item.model_list.length}}</text>
 							款车型
 						</view>
 					</view>
 				</view>
-				
 				<view v-if="item.model_list.length===1">
 					<view class="card-bottom card-first flex-row">
 						<view class="second-view flex-row">
@@ -74,7 +73,7 @@
 								src="https://qiniu.bms16.com/Ft0YA1JYmq66hdoeEN-PgBHy5vLa"  mode=""></image>
 						</view>
 						<view style="margin-left: 20rpx;">
-							<image style="width: 112rpx;height: 64rpx;"
+							<image @click="bindToNav(item)" style="width: 112rpx;height: 64rpx;"
 								src="https://qiniu.bms16.com/Fts38M35doVjK09GfOza5qD-wwkK" mode=""></image>
 								
 						</view>
@@ -154,7 +153,33 @@
 			// }
 		},
 		methods: {
-			callFn(tel){
+			bindToNav(item) {
+				const {
+					latitude,
+					longitude,
+					shop_name
+				} = item
+				uni.openLocation({
+					latitude: latitude - 0,
+					longitude: longitude - 0,
+					scale: 15,
+					name: shop_name,
+				})
+			},
+			callFn(){
+				uni.showModal({
+					content: `您是否要拨打电话${tel}?`,
+					confirmText: '确定',
+					success: (res) => {
+						if (res.confirm) {
+							uni.makePhoneCall({
+								phoneNumber: tel,
+								success() {},
+								fail() {}
+							})
+						}
+					},
+				})
 				uni.makePhoneCall({
 					phoneNumber: tel 
 				});

+ 7 - 20
pages/storeDetails/storeDetails.vue

@@ -37,7 +37,7 @@
 							</view>
 						</view>
 						<view v-if="storeInfo.work_begin_time" class="grid_text_2">
-							{{storeInfo.work_begin_time[0]}}:{{storeInfo.work_begin_time[1]}}-{{storeInfo.work_end_time[0]}}:{{storeInfo.work_end_time[1]}}
+							{{storeInfo.work_begin_time.split(':')[0]}}:{{storeInfo.work_begin_time.split(':')[1]}}-{{storeInfo.work_end_time.split(':')[0]}}:{{storeInfo.work_end_time.split(':')[1]}}
 						</view>
 					</view>
 					<view @tap="bindToNav" class="right_grid flex-between">
@@ -240,36 +240,23 @@
 						storeInfo: resp.data.data.info
 					})
 					this.storeInfo.distance = common.formatDistance(Number(this.storeInfo.distance))
-					this.shop_image = JSON.parse(resp.data.data.info.shop_image) || []
+					
+					this.shop_image = resp.data.data.info.shop_image || []
 					var cabinetInfo = resp.data.data.info
 					this.storeInfo.work_begin_time = (cabinetInfo.work_begin_time == null ? '00:00:00' :
 						cabinetInfo
-						.work_begin_time).split(':')
+						.work_begin_time)
 					this.storeInfo.work_end_time = (cabinetInfo.work_end_time == null ? '00:00:00' :
 						cabinetInfo
-						.work_end_time).split(':')
-					this.isWorkTimer = this.isWithinTimeRange(cabinetInfo.work_begin_time,
+						.work_end_time)
+					this.isWorkTimer = common.isWithinTimeRange(cabinetInfo.work_begin_time,
 						cabinetInfo.work_end_time)
 				} else {
 					common.simpleToast(resp.data.msg)
 				}
 			})
 		},
-		isWithinTimeRange(startTime, endTime) {
-			// 获取当前时间
-			const now = new Date();
-			const currentMinutes = now.getHours() * 60 + now.getMinutes();
-
-			// 将传入的时间转换为分钟
-			const [startHour, startMinute] = startTime.map(Number);
-			const [endHour, endMinute] = endTime.map(Number);
-
-			const startMinutes = startHour * 60 + startMinute;
-			const endMinutes = endHour * 60 + endMinute;
-
-			// 判断当前时间是否在指定范围内
-			return currentMinutes >= startMinutes && currentMinutes <= endMinutes;
-		},
+		
 		tapPhone() {
 			const me = this
 			uni.showModal({