py 1 год назад
Родитель
Сommit
b5f4975e19
1 измененных файлов с 25 добавлено и 12 удалено
  1. 25 12
      pages-takeout/shop.vue

+ 25 - 12
pages-takeout/shop.vue

@@ -16,7 +16,8 @@
 			<view id="shopInfoBox" class="shop-info-box bgc-f box-border-box p-24">
 				<view class="info-box-top flex-justify-space mb-10">
 					<view class="box-top-left">
-						<view class="top-left-1 fs-40 fw-600 text-overflow-ellipsis-one">{{shopsInfo.shop_name || ""}}
+						<view class="top-left-1 fs-40 fw-600 text-overflow-ellipsis">
+							{{shopsInfo.shop_name || ""}}
 						</view>
 						<view class="align-items-center mb-8">
 							<image class="img-x mr-12" src="@/static/img/index/index-x.png" mode=""></image>
@@ -31,8 +32,8 @@
 					公告:{{shopsInfo.notice||""}}
 				</view>
 				<view class="flex-wrap-wrap p-t-20" v-if="couponData.length>0">
-					<view class="info-box-quan-list" v-for="(item,i) in couponData" :key="i" @click="openCoupon">
-						<view class="" v-if="i<=2">
+					<view class="" v-for="(item,i) in couponData" :key="i" @click="openCoupon">
+						<view class="info-box-quan-list" v-if="i<=2">
 							<image src="@/static/img/takeout/quan-bg.png" mode=""></image>
 							<view class="quan-list-1 fw-b fs-32 fc-f">
 								<span class="fw-b fs-20 fc-f">¥</span>{{item.money}}
@@ -102,7 +103,9 @@
 							<view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-12">
 								{{goods.goods_name}}
 							</view>
-							<view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 mb-18" :class="goods.status_str?'fc-FD5C02':'fc-9'">{{goods.status_str?goods.status_str:goods.goods_attr}}
+							<view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 mb-18"
+								:class="goods.status_str?'fc-FD5C02':'fc-9'">
+								{{goods.status_str?goods.status_str:goods.goods_attr}}
 							</view>
 							<view class="flex-justify-space">
 								<view class="">
@@ -221,7 +224,7 @@
 		},
 		data() {
 			return {
-				domHeigjt: 224,
+				domHeigjt: 0,
 				shopTypeList: [{
 					name: "点菜",
 					id: 1
@@ -383,11 +386,20 @@
 			toBack() {
 				tools.leftClick()
 			},
-			getDomH() {
-				let info = uni.createSelectorQuery().select('#shopInfoBox');
-				info.boundingClientRect((data) => {
-					this.domHeigjt = data.height * 2 - 34
-				}).exec()
+			getDomH(num) {
+				this.$nextTick(() => {
+					let info = uni.createSelectorQuery().select('#shopInfoBox');
+					info.boundingClientRect((data) => {
+						if (num === 1) {
+							this.domHeigjt = data.height + 72
+						} else {
+							this.domHeigjt = data.height + 72 + 48
+						}
+					}).exec()
+				})
+				// setTimeout(() => {
+
+				// }, 500)
 			},
 
 			scrolltolower() {
@@ -447,10 +459,11 @@
 				}).then((res) => {
 					if (res.code == 1) {
 						if (res.data.length > 0) {
-							this.domHeigjt = 224
 							this.couponData = res.data
+							this.getDomH(2)
 						} else {
-							this.domHeigjt = 156
+							this.getDomH(1)
+							// this.domHeigjt = 156
 							// console.log(this.domHeigjt, '1111111111111111111');
 						}
 					}