Browse Source

店铺主页修改

chengjunhui 1 month ago
parent
commit
40e346fb5b
6 changed files with 383 additions and 500 deletions
  1. 0 21
      api/home.ts
  2. 2 2
      config/global.config.js
  3. 23 31
      pages.json
  4. 213 0
      pages/shop/components/SeckillGood.vue
  5. 145 108
      pages/shop/index.vue
  6. 0 338
      pages/tabtar/shop.vue

+ 0 - 21
api/home.ts

@@ -1,22 +1 @@
-// 获取会员在店铺详细信息
-export const getUserBusinessRoleApi = () => uni.$uv.http.get(`/user/userBusinessRole/userInfo`);
 
-// 查询商品分类列表
-export const getShopProductCategoryApi = (businessId : string) => uni.$uv.http.get(`/shop/productCategory/list`, {
-	params: {
-		businessId
-	}
-});
-
-// 商家店铺内分页查询产品列表
-export const getShopProductApi = (params) => uni.$uv.http.get(`/shop/product/shop/page`, {
-	params
-});
-
-// 根据协议code查询 协议信息
-export const getProductInfoApi = (code) => uni.$uv.http.get(`/protocol/info?code=${code}`);
-
-// // 新增用户反馈
-// export const userOpinionAdd = (data) => uni.$uv.http.post(`/user/userOpinion/add`, data);
-// // 获取用户反馈详细信息
-// export const userOpinionInfo = (opinionId) => uni.$uv.http.get(`/user/userOpinion/info/${opinionId}`);

+ 2 - 2
config/global.config.js

@@ -1,8 +1,8 @@
 const CONFIG = {
     staticUrl: 'https://shop.xiaocaituan.com/image', // 所有图片服务器地址 https://shop.xiaocaituan.com/image
 
-    baseUrl: 'http://192.168.0.152:8300/api', // 后台接、口请求地址
-    // baseUrl: 'http://192.168.0.70:8300/api', // 后台接、口请求地址
+    // baseUrl: 'http://192.168.0.152:8300/api', // 后台接、口请求地址
+    baseUrl: 'http://192.168.0.70:8300/api', // 后台接、口请求地址
 		
     // baseUrl: 'https://shop.xiaocaituan.com/hd-api/api', // 正式接口请求地址
     telRegex: /^1[3-9]\d{9}$/, //手机正则

+ 23 - 31
pages.json

@@ -8,14 +8,6 @@
 				"enablePullDownRefresh": false
 			}
 		},
-		// {
-		// 	"path": "pages/tabtar/SwitchStores",
-		// 	"style": {
-		// 		"navigationBarTitleText": "商场",
-		// 		"navigationStyle": "custom",
-		// 		"enablePullDownRefresh": false
-		// 	}
-		// },
 		{
 			"path": "pages/index/index",
 			"style": {
@@ -23,29 +15,6 @@
 				"navigationStyle": "custom"
 			}
 		},
-		{
-			"path": "pages/tabtar/shop",
-			"style": {
-				"navigationBarTitleText": "店铺信息",
-				"navigationStyle": "custom",
-				"enablePullDownRefresh": true
-			}
-		},
-		// {
-		// 	"path": "pages/shop/goodSearch",
-		// 	"style": {
-		// 		"navigationBarTitleText": "搜索",
-		// 		"navigationStyle": "custom"
-		// 	}
-		// },
-		// {
-		// 	"path": "pages/shop/goodsList",
-		// 	"style": {
-		// 		"navigationBarTitleText": "商品列表",
-		// 		"navigationStyle": "custom",
-		// 		"enablePullDownRefresh": true
-		// 	}
-		// },
 		{
 			"path": "pages/tabtar/goodsType",
 			"style": {
@@ -129,6 +98,29 @@
 		{
 			"root": "pages/shop",
 			"pages": [
+				{
+					"path": "index",
+					"style": {
+						"navigationBarTitleText": "店铺信息",
+						"navigationStyle": "custom",
+						"enablePullDownRefresh": true
+					}
+				},
+				{
+					"path": "goodSearch",
+					"style": {
+						"navigationBarTitleText": "搜索",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "goodsList",
+					"style": {
+						"navigationBarTitleText": "商品列表",
+						"navigationStyle": "custom",
+						"enablePullDownRefresh": true
+					}
+				},
 				{
 					"path": "content/index",
 					"style": {

+ 213 - 0
pages/shop/components/SeckillGood.vue

@@ -0,0 +1,213 @@
+<template>
+  <view class="limitCard" v-if="currSeckill && currSeckill.length > 0">
+    <view class="limitCard_top">
+      <view class="limitCard_top_title">限时秒杀</view>
+      <view class="limitCard_top_lab">{{ currTime }}点场 剩余</view>
+      <!-- <view class="limitCard_top_time">3天 17 : 26 : 35</view> -->
+      <view class="limitCard_top_time">
+        <uv-count-down
+          :time="9 * 60 * 1000"
+          format="DD:HH:mm:ss"
+          autoStart
+          millisecond
+          @change="onChange"
+        >
+          <view class="time">
+            <text class="time__item" v-if="timeData.days"
+              >{{ timeData.days }}天</text
+            >
+            <text class="time__item"
+              >{{
+                timeData.hours > 10 ? timeData.hours : "0" + timeData.hours
+              }}:</text
+            >
+            <text class="time__item">{{ timeData.minutes > 10 ? timeData.minutes : "0" + timeData.minutes }}:</text>
+            <text class="time__item">{{ timeData.seconds }}</text>
+          </view>
+        </uv-count-down>
+      </view>
+    </view>
+    <swiper
+      class="swiper"
+      indicator-color="#EDEDED"
+      indicator-active-color="#3775F6"
+      circular
+      :indicator-dots="true"
+      :autoplay="false"
+      :interval="2000"
+      :duration="500"
+    >
+      <swiper-item v-for="(item, key) in currSeckill" :key="key">
+        <view class="listBox">
+          <view
+            class="listBox_item"
+            v-for="itemSon in item"
+            @click="
+              goProductDetails(
+                '/pages/product/goods/seckillGoods?id=' + itemSon.id
+              )
+            "
+            :key="item.id"
+          >
+            <!-- ?x-oss-process=style/w_350 -->
+            <image
+              v-if="itemSon && itemSon.coverImage"
+              :src="`${itemSon.coverImage}`"
+              mode=""
+            >
+            </image>
+            <!-- <view>¥<text>64.</text>20</view> -->
+            <view class="">
+              <rich-text
+                :nodes="$mUtil.priceBigSmall(itemSon.minPrice)"
+              ></rich-text>
+            </view>
+          </view>
+        </view>
+      </swiper-item>
+    </swiper>
+  </view>
+</template>
+
+<script setup>
+import { ref, watch } from "vue";
+const props = defineProps({
+  currSeckill: {
+    type: Array,
+    default: () => [],
+  },
+});
+
+const currSeckill = ref([]);
+const currTime = ref(7);
+const timeData = ref({});
+
+// // 监听限时秒杀数据
+// watch(
+//   () => props.currSeckill,
+//   (newValue) => {
+//     currSeckill.value = oneArrToTwoArr(newValue || []);
+//   }
+// );
+
+const onChange = (e) => {
+  timeData.value = e;
+};
+
+// 一维数组转二维数组
+const oneArrToTwoArr = (data) => {
+  let newData = [];
+  let zyf = 4; //一维数组转二维数组长度(此处是二维数组每一个长度控制)
+  for (let i = 0; i < Math.ceil(data.length / zyf); i++) {
+    newData[i] = [];
+    newData[i].push(data[i * zyf]);
+    for (let j = 1; j < zyf; j++) {
+      if (data[i * zyf + j] == undefined) {
+        //超出长度控住
+        return newData;
+      } else {
+        newData[i].push(data[i * zyf + j]);
+      }
+    }
+  }
+  return newData;
+};
+
+const goProductDetails = (url) => {
+  uni.navigateTo({
+    url,
+  });
+};
+</script>
+
+<style lang="scss" scoped>
+.limitCard {
+  margin: auto;
+//   width: 720rpx;
+  height: 410rpx;
+  padding: 0 30rpx;
+  // background: url("/static/convenienceService/cardBg.png") 0 0 no-repeat;
+  background-size: 720rpx 410rpx;
+  box-sizing: border-box;
+
+  .limitCard_top {
+    display: flex;
+    padding: 35rpx 30rpx 20rpx 30rpx;
+    align-items: center;
+    border-bottom: 1rpx solid #e6e6e6;
+
+    .limitCard_top_title {
+      font-size: 36rpx;
+      color: #1a1a1a;
+      font-weight: 700;
+      display: flex;
+      align-items: center;
+      position: relative;
+      padding-right: 15rpx;
+
+      &::after {
+        display: block;
+        content: "";
+        width: 1rpx;
+        height: 33rpx;
+        background: #707070;
+        position: absolute;
+        right: 0;
+        top: 10rpx;
+      }
+    }
+
+    .limitCard_top_lab {
+      font-size: 24rpx;
+      color: #666666;
+      margin: 0 30rpx 0 15rpx;
+    }
+
+    .limitCard_top_time {
+      border-radius: 17rpx;
+      background: #ff0000;
+      font-size: 24rpx;
+      color: #fff;
+      font-weight: 700;
+      padding: 0 15rpx;
+    }
+  }
+
+  .swiper {
+    height: 280rpx;
+
+    .listBox {
+      padding: 25rpx 20rpx;
+      display: flex;
+      box-sizing: border-box;
+      
+      .listBox_item {
+        margin-right: 20rpx;
+
+        image {
+          width: 140rpx;
+          height: 140rpx;
+        }
+
+        > view {
+          width: 140rpx;
+          font-size: 20rpx;
+          color: #333333;
+          text-align: center;
+
+          text {
+            font-size: 28rpx;
+            font-weight: 600;
+            display: inline-block;
+            margin-left: 10rpx;
+          }
+        }
+
+        &:last-child {
+          margin-right: 0 !important;
+        }
+      }
+    }
+  }
+}
+</style>

+ 145 - 108
pages/shop/index.vue

@@ -1,51 +1,70 @@
 <template>
   <view>
-    <uv-navbar title="店铺信息" placeholder @leftClick="goBack"></uv-navbar>
+    <uv-navbar title="店铺信息" placeholder></uv-navbar>
     <view class="top">
       <view class="shop">
         <view class="shop_l">
-          <image :src="details.logo" mode="" />
+          <image :src="details.image" mode="" />
           <view>
-            <view class="shop_l_title">{{details.businessName}}</view>
-            <view class="shop_l_rate">
-              <rate :value="Math.round(details.average)" />
+            <view class="shop_l_title">{{ details.businessName }}</view>
+            <view class="shop_l_rate u-flex-center-sb">
+              <view class="u-flex-center">
+                <rate :value="Math.round(details.average)" />
+                <text class="u-font24 u-ml10">{{ details.average }}分</text>
+              </view>
+              <view class="shop_r" @click="goPhone()"> 售后电话 </view>
             </view>
           </view>
         </view>
-        <view class="shop_r" @click="goPhone()">
-          售后电话
-        </view>
       </view>
       <view class="searchBox">
         <image :src="$handleImageUrl('/common/search.png')" mode=""></image>
-        <input @click="searchClick" v-model="value" type="text" placeholder-style="color:#B3B3B3;font-size:28rpx" placeholder="可搜索本店商品" />
+        <input
+          @click="searchClick"
+          v-model="value"
+          type="text"
+          placeholder-style="color:#B3B3B3;font-size:28rpx"
+          placeholder="可搜索本店商品"
+        />
       </view>
     </view>
+
+    <!-- 限时秒杀 -->
+    <SeckillGood :currSeckill="list" />
+
     <view class="tabsBox">
-      <uv-tabs :list="tabList" keyName="categoryName" lineColor="#FA6138" activeStyle="color:#FA6138;" lineWidth="60rpx" @click="tabsClick"></uv-tabs>
+      <uv-tabs
+        :list="tabList"
+        keyName="categoryName"
+        lineColor="#FA6138"
+        activeStyle="color:#FA6138;"
+        lineWidth="60rpx"
+        @click="tabsClick"
+      ></uv-tabs>
     </view>
     <view class="list">
-      <view class="goodsListA_item" v-for="item in list" :key="item.id" @click="goDetails(item)">
+      <view
+        class="goodsListA_item"
+        v-for="item in list"
+        :key="item.id"
+        @click="goDetails(item)"
+      >
         <image :src="`${item.coverImage}`" mode=""></image>
         <view class="goodsListA_item_title">{{ item.title }}</view>
         <view class="goodsListA_item_pirce">
-          <text v-if="item.productPaymentMode==1" style="font-size:22rpx;">{{item.minPoints}}积分</text>
-          <rich-text v-else :nodes="mUtil.priceBigSmall(item.salePrice||item.minSalePrice)"></rich-text>
-          <view>¥ {{ item.marketPrice||item.minMarketPrice }}</view>
+          <text v-if="item.productPaymentMode == 1" style="font-size: 22rpx"
+            >{{ item.minPoints }}积分</text
+          >
+          <rich-text
+            v-else
+            :nodes="$mUtil.priceBigSmall(item.salePrice || item.minSalePrice)"
+          ></rich-text>
+          <view>¥ {{ item.marketPrice || item.minMarketPrice }}</view>
         </view>
-        <view class="goodsListA_item_num">已售{{ item.showSales}}件</view>
+        <view class="goodsListA_item_num">已售{{ item.showSales }}件</view>
       </view>
-      <!-- <view class="goodsListA_item" @click="goDetails()" v-for="(v,i) in 10" :key="i">
-        <image src="https://jiangxishop.oss-cn-beijing.aliyuncs.com/20250920/b53b0ad4931340258ce217581c6bdcf4.png?x-oss-process=style/w_350" mode=""></image>
-        <view class="goodsListA_item_title">陶瓷扒花雕刻品茗杯主人杯咖啡杯中式高档茶杯礼盒装</view>
-        <view class="goodsListA_item_pirce">
-          <rich-text :nodes="mUtil.priceBigSmall('133')"></rich-text>
-          <view>¥ 500</view>
-        </view>
-        <view class="goodsListA_item_num">已售0件</view>
-      </view> -->
     </view>
-    <view v-if="list.length<=0" style="width: 100%;">
+    <view v-if="list.length <= 0" style="width: 100%">
       <noData :config="{ top: 20, content: '暂无商品~' }"></noData>
     </view>
     <uv-load-more v-else :status="status" />
@@ -53,20 +72,29 @@
 </template>
 
 <script setup >
-import { getBusinessInfo, getProductCategoryList, productList } from "@/api/shop.js"
-import { ref, getCurrentInstance } from 'vue'
-import { onShow, onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
-const { proxy } = getCurrentInstance();
-const mUtil = proxy.$mUtil;
+import {
+  getBusinessInfo,
+  getProductCategoryList,
+  productList,
+} from "@/api/shop.js";
+import { ref, getCurrentInstance } from "vue";
+import {
+  onShow,
+  onLoad,
+  onPullDownRefresh,
+  onReachBottom,
+} from "@dcloudio/uni-app";
+import SeckillGood from "./components/SeckillGood.vue"; // 限时秒杀组件
+
 const details = ref({});
 const value = ref("");
-const status = ref('loadmore')
-const list = ref([]) // 添加缺失的商品列表数据
+const status = ref("loadmore");
+const list = ref([]); // 添加缺失的商品列表数据
 const tabList = ref([
   {
     id: 1,
-    categoryName: "推荐",
-    categoryId: "recommend",
+    categoryName: "全部",
+    categoryId: "",
   },
   {
     id: 2,
@@ -77,117 +105,125 @@ const tabList = ref([
     id: 3,
     categoryName: "新品",
     categoryId: "new",
-  }
+  },
 ]);
 const params = ref({
-  recommendStatus: true,
   pageNum: 1,
-  pageSize: 10
-})
-onShow(() => {
-  let id = uni.getStorageSync('businessId');
+  pageSize: 10,
+});
+
+
+onLoad((options) => {
+  let id = options.businessId;
   if (id) {
     params.value.businessId = id;
     getDetails();
-    getTabs()
+    getTabs();
   }
-})
+});
 // 下拉刷新
 onPullDownRefresh(() => {
-  params.value.pageNum = 1
-  getProductList()
-})
+  params.value.pageNum = 1;
+  getProductList();
+});
 // 上拉加载更多
 onReachBottom(() => {
-  if (status.value == 'loadmore') {
-    params.value.pageNum++
-    getProductList()
+  if (status.value == "loadmore") {
+    params.value.pageNum++;
+    getProductList();
   }
-})
+});
 const goBack = () => {
   // uni.navigateBack()
-  uni.navigateTo({ url: '/pages/index/index' })
-}
+  uni.navigateTo({ url: "/pages/index/index" });
+};
 const getTabs = () => {
-  getProductCategoryList({ businessId: params.value.businessId }).then(res => {
-    tabList.value = [...tabList.value, ...res.data]
-  }
-  )
-}
+  getProductCategoryList({ businessId: params.value.businessId }).then(
+    (res) => {
+      tabList.value = [...tabList.value, ...res.data];
+    }
+  );
+};
 // 商家电话
 const goPhone = () => {
-  uni.makePhoneCall({
-    phoneNumber: details.value.contactPhone
-  });
-}
+  if (details.value.customerServicePhone) {
+    uni.makePhoneCall({
+      phoneNumber: details.value.customerServicePhone,
+    });
+  } else {
+    uni.showToast({
+      title: "暂无商家电话",
+      icon: "none",
+    });
+  }
+};
 const getDetails = () => {
-  getBusinessInfo({ businessId: params.value.businessId }).then(res => {
+  getBusinessInfo({ businessId: params.value.businessId }).then((res) => {
     details.value = res.data;
-    getProductList()
-  })
-}
+    getProductList();
+  });
+};
 // 获取商品分页列表
 const getProductList = () => {
-  status.value = 'loading'
-  productList(params.value).then(res => {
-    if (params.value.pageNum == 1) {
-      list.value = res.rows
-    } else {
-      list.value = [...list.value, ...res.rows]
-    }
-    if (list.value.length < res.total) {
-      status.value = 'loadmore'
-    } else {
-      status.value = 'noMore'
-    }
-    uni.stopPullDownRefresh()
-  }).catch(e => {
-    uni.stopPullDownRefresh()
-    status.value = 'loadmore'
-  })
+  status.value = "loading";
+  productList(params.value)
+    .then((res) => {
+      if (!res.rows) return;
+      if (params.value.pageNum == 1) {
+        list.value = res.rows;
+      } else {
+        list.value = [...list.value, ...res.rows];
+      }
+      if (list.value.length < res.total) {
+        status.value = "loadmore";
+      } else {
+        status.value = "noMore";
+      }
+      uni.stopPullDownRefresh();
+    })
+    .catch((e) => {
+      uni.stopPullDownRefresh();
+      status.value = "loadmore";
+    });
 };
 const goDetails = (item) => {
   uni.navigateTo({
-    url: `/pages/shop/goodsDetails?id=${item.productId}`
+    url: `/pages/shop/goodsDetails?id=${item.productId}`,
   });
-}
+};
 const searchClick = () => {
   uni.navigateTo({
-    url: '/pages/shop/goodSearch'
+    url: "/pages/shop/goodSearch",
   });
 };
 const tabsClick = (e) => {
   // 重置分页参数
-  params.value.pageNum = 1
+  params.value.pageNum = 1;
   // 根据选中的标签设置不同的查询参数
   if (e.index === 0) {
-    // 推荐
-    params.value.recommendStatus = true
-    delete params.value.productCategoryId
-    delete params.value.hot
-    delete params.value.newStatus
+    // 全部
+    delete params.value.productCategoryId;
+    delete params.value.hot;
+    delete params.value.newStatus;
   } else if (e.index === 1) {
     // 热销
-    params.value.hot = true
-    delete params.value.productCategoryId
-    delete params.value.recommendStatus
-    delete params.value.newStatus
+    params.value.hot = true;
+    delete params.value.productCategoryId;
+    delete params.value.newStatus;
   } else if (e.index === 2) {
     // 新品
-    params.value.newStatus = true
-    delete params.value.productCategoryId
-    delete params.value.recommendStatus
-    delete params.value.hot
+    params.value.newStatus = true;
+    delete params.value.productCategoryId;
+    delete params.value.hot;
   } else {
     // 具体分类
-    params.value.productCategoryId = tabList.value[e.index].categoryId
-    delete params.value.recommendStatus
-    delete params.value.hot
-    delete params.value.newStatus
+    params.value.productCategoryId = tabList.value[e.index].categoryId;
+    delete params.value.hot;
+    delete params.value.newStatus;
   }
   // 重新获取商品列表
-  getProductList()
-}
+  getProductList();
+};
 </script>
 
 <style lang="scss" scoped>
@@ -234,10 +270,10 @@ const tabsClick = (e) => {
     border-radius: 25rpx;
     background-color: #fff;
     border: 1rpx solid #666;
-    position: absolute;
-    right: 30rpx;
-    bottom: 25rpx;
-    font-size: 28rpx;
+    // position: absolute;
+    // right: 30rpx;
+    // bottom: 25rpx;
+    // font-size: 28rpx;
   }
 }
 .searchBox {
@@ -262,6 +298,7 @@ const tabsClick = (e) => {
     text-align: left;
   }
 }
+
 .tabsBox {
   margin-bottom: 20rpx;
   padding: 0 30rpx;

+ 0 - 338
pages/tabtar/shop.vue

@@ -1,338 +0,0 @@
-<template>
-  <view>
-    <uv-navbar title="店铺信息" placeholder></uv-navbar>
-    <view class="top">
-      <view class="shop">
-        <view class="shop_l">
-          <image :src="details.logo" mode="" />
-          <view>
-            <view class="shop_l_title">{{details.businessName}}</view>
-            <view class="shop_l_rate">
-              <rate :value="Math.round(details.average)" />
-            </view>
-          </view>
-        </view>
-        <view class="shop_r" @click="goPhone()">
-          售后电话
-        </view>
-      </view>
-      <view class="searchBox">
-        <image :src="$handleImageUrl('/common/search.png')" mode=""></image>
-        <input @click="searchClick" v-model="value" type="text" placeholder-style="color:#B3B3B3;font-size:28rpx" placeholder="可搜索本店商品" />
-      </view>
-    </view>
-    <view class="tabsBox">
-      <uv-tabs :list="tabList" keyName="categoryName" lineColor="#FA6138" activeStyle="color:#FA6138;" lineWidth="60rpx" @click="tabsClick"></uv-tabs>
-    </view>
-    <view class="list">
-      <view class="goodsListA_item" v-for="item in list" :key="item.id" @click="goDetails(item)">
-        <image :src="`${item.coverImage}`" mode=""></image>
-        <view class="goodsListA_item_title">{{ item.title }}</view>
-        <view class="goodsListA_item_pirce">
-          <text v-if="item.productPaymentMode==1" style="font-size:22rpx;">{{item.minPoints}}积分</text>
-          <rich-text v-else :nodes="mUtil.priceBigSmall(item.salePrice||item.minSalePrice)"></rich-text>
-          <view>¥ {{ item.marketPrice||item.minMarketPrice }}</view>
-        </view>
-        <view class="goodsListA_item_num">已售{{ item.showSales}}件</view>
-      </view>
-      <!-- <view class="goodsListA_item" @click="goDetails()" v-for="(v,i) in 10" :key="i">
-        <image src="https://jiangxishop.oss-cn-beijing.aliyuncs.com/20250920/b53b0ad4931340258ce217581c6bdcf4.png?x-oss-process=style/w_350" mode=""></image>
-        <view class="goodsListA_item_title">陶瓷扒花雕刻品茗杯主人杯咖啡杯中式高档茶杯礼盒装</view>
-        <view class="goodsListA_item_pirce">
-          <rich-text :nodes="mUtil.priceBigSmall('133')"></rich-text>
-          <view>¥ 500</view>
-        </view>
-        <view class="goodsListA_item_num">已售0件</view>
-      </view> -->
-    </view>
-    <view v-if="list.length<=0" style="width: 100%;">
-      <noData :config="{ top: 20, content: '暂无商品~' }"></noData>
-    </view>
-    <uv-load-more v-else :status="status" />
-  </view>
-</template>
-
-<script setup >
-import { getBusinessInfo, getProductCategoryList, productList } from "@/api/shop.js"
-import { ref, getCurrentInstance } from 'vue'
-import { onShow, onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
-const { proxy } = getCurrentInstance();
-const mUtil = proxy.$mUtil;
-const details = ref({});
-const value = ref("");
-const status = ref('loadmore')
-const list = ref([]) // 添加缺失的商品列表数据
-const tabList = ref([
-  {
-    id: 1,
-    categoryName: "推荐",
-    categoryId: "recommend",
-  },
-  {
-    id: 2,
-    categoryName: "热销",
-    categoryId: "hot",
-  },
-  {
-    id: 3,
-    categoryName: "新品",
-    categoryId: "new",
-  }
-]);
-const params = ref({
-  recommendStatus: true,
-  pageNum: 1,
-  pageSize: 10
-})
-onShow(() => {
-  let id = uni.getStorageSync('businessId');
-  if (id) {
-    params.value.businessId = id;
-    getDetails();
-    getTabs()
-  }
-})
-// 下拉刷新
-onPullDownRefresh(() => {
-  params.value.pageNum = 1
-  getProductList()
-})
-// 上拉加载更多
-onReachBottom(() => {
-  if (status.value == 'loadmore') {
-    params.value.pageNum++
-    getProductList()
-  }
-})
-const goBack = () => {
-  // uni.navigateBack()
-  uni.navigateTo({ url: '/pages/index/index' })
-}
-const getTabs = () => {
-  getProductCategoryList({ businessId: params.value.businessId }).then(res => {
-    tabList.value = [...tabList.value, ...res.data]
-  }
-  )
-}
-// 商家电话
-const goPhone = () => {
-  uni.makePhoneCall({
-    phoneNumber: details.value.contactPhone
-  });
-}
-const getDetails = () => {
-  getBusinessInfo({ businessId: params.value.businessId }).then(res => {
-    details.value = res.data;
-    getProductList()
-  })
-}
-// 获取商品分页列表
-const getProductList = () => {
-  status.value = 'loading'
-  productList(params.value).then(res => {
-    if (params.value.pageNum == 1) {
-      list.value = res.rows
-    } else {
-      list.value = [...list.value, ...res.rows]
-    }
-    if (list.value.length < res.total) {
-      status.value = 'loadmore'
-    } else {
-      status.value = 'noMore'
-    }
-    uni.stopPullDownRefresh()
-  }).catch(e => {
-    uni.stopPullDownRefresh()
-    status.value = 'loadmore'
-  })
-};
-const goDetails = (item) => {
-  uni.navigateTo({
-    url: `/pages/shop/goodsDetails?id=${item.productId}`
-  });
-}
-const searchClick = () => {
-  uni.navigateTo({
-    url: '/pages/shop/goodSearch'
-  });
-};
-const tabsClick = (e) => {
-  // 重置分页参数
-  params.value.pageNum = 1
-  // 根据选中的标签设置不同的查询参数
-  if (e.index === 0) {
-    // 推荐
-    params.value.recommendStatus = true
-    delete params.value.productCategoryId
-    delete params.value.hot
-    delete params.value.newStatus
-  } else if (e.index === 1) {
-    // 热销
-    params.value.hot = true
-    delete params.value.productCategoryId
-    delete params.value.recommendStatus
-    delete params.value.newStatus
-  } else if (e.index === 2) {
-    // 新品
-    params.value.newStatus = true
-    delete params.value.productCategoryId
-    delete params.value.recommendStatus
-    delete params.value.hot
-  } else {
-    // 具体分类
-    params.value.productCategoryId = tabList.value[e.index].categoryId
-    delete params.value.recommendStatus
-    delete params.value.hot
-    delete params.value.newStatus
-  }
-  // 重新获取商品列表
-  getProductList()
-}
-</script>
-
-<style lang="scss" scoped>
-.top {
-  width: 720rpx;
-  padding: 30rpx;
-  box-shadow: 0rpx 4rpx 8rpx 0rpx #f1f1f1;
-  background: #ffffff;
-  border-radius: 20rpx;
-  margin: auto;
-  box-sizing: border-box;
-}
-.shop {
-  display: flex;
-  align-items: center;
-  position: relative;
-  .shop_l {
-    display: flex;
-    align-items: center;
-    image {
-      width: 124rpx;
-      height: 124rpx;
-      border-radius: 20rpx;
-    }
-    > view {
-      flex: 1;
-      margin-left: 20rpx;
-      .shop_l_title {
-        font-size: 32rpx;
-        color: #333333;
-        font-weight: 700;
-      }
-      .shop_l_rate {
-        margin-top: 10rpx;
-      }
-    }
-  }
-  .shop_r {
-    width: 150rpx;
-    margin-left: auto;
-    padding: 6rpx 0rpx;
-    text-align: center;
-    color: #666;
-    border-radius: 25rpx;
-    background-color: #fff;
-    border: 1rpx solid #666;
-    position: absolute;
-    right: 30rpx;
-    bottom: 25rpx;
-    font-size: 28rpx;
-  }
-}
-.searchBox {
-  display: flex;
-  padding: 10rpx 35rpx;
-  border: 1rpx solid #cccccc;
-  border-radius: 36rpx;
-  margin: 30rpx 0 0;
-  display: flex;
-  align-items: center;
-  margin-top: 10rpx;
-  background: #fff;
-
-  image {
-    width: 35rpx;
-    height: 35rpx;
-    margin-right: 15rpx;
-    flex-shrink: 0;
-  }
-
-  input {
-    text-align: left;
-  }
-}
-.tabsBox {
-  margin-bottom: 20rpx;
-  padding: 0 30rpx;
-}
-.list {
-  padding: 0 30rpx;
-  display: flex;
-  flex-wrap: wrap;
-
-  .goodsListA_item {
-    width: 336rpx;
-    box-shadow: 0rpx 4rpx 8rpx 0rpx #f1f1f1;
-    border-radius: 18rpx;
-    margin-left: 18rpx;
-    margin-bottom: 30rpx;
-
-    &:nth-child(2n-1) {
-      margin-left: 0 !important;
-    }
-
-    image {
-      width: 336rpx;
-      height: 336rpx;
-      border-radius: 18rpx 18rpx 0 0;
-    }
-
-    > view {
-      padding: 0 20rpx;
-    }
-
-    .goodsListA_item_title {
-      font-size: 28rpx;
-      color: #181818;
-      overflow: hidden;
-      text-overflow: ellipsis;
-      display: -webkit-box;
-      -webkit-line-clamp: 2;
-      -webkit-box-orient: vertical;
-    }
-
-    .goodsListA_item_pirce {
-      display: flex;
-      // align-items: flex-end;
-      align-items: baseline;
-      font-size: 20rpx;
-      color: #ff6600;
-      font-weight: 700;
-
-      text {
-        font-size: 36rpx;
-        font-weight: 500;
-        display: inline-block;
-        // position: relative;
-        // top: 4rpx;
-      }
-
-      > view {
-        font-size: 24rpx;
-        color: #cccccc;
-        margin-left: 30rpx;
-        text-decoration: line-through;
-        font-weight: normal;
-      }
-    }
-
-    .goodsListA_item_num {
-      font-size: 22rpx;
-      color: #999999;
-      margin-top: 10rpx;
-      padding-bottom: 20rpx;
-    }
-  }
-}
-</style>