chengjunhui 1 månad sedan
förälder
incheckning
dcdd76ebfb
7 ändrade filer med 343 tillägg och 492 borttagningar
  1. 21 0
      api/seckill.js
  2. 1 1
      pages.json
  3. 88 117
      pages/seckill/list.vue
  4. 142 263
      pages/seckill/seckillGoods.vue
  5. 64 36
      pages/tabtar/components/Seckill.vue
  6. 6 75
      pages/tabtar/home.vue
  7. 21 0
      static/style/common.scss

+ 21 - 0
api/seckill.js

@@ -0,0 +1,21 @@
+
+// APP -- 限时秒杀
+export const seckillActivityProductFlash_Api = (params) => uni.$uv.http.get(`/seckill/seckillActivityProduct/flash-sale`, { params });
+
+// 查询商家某个秒杀活动商品列表
+export const seckillGetSeckillGoodsList_Api = (params) => uni.$uv.http.get(`/seckill/seckillActivityProduct/getSeckillGoodsList`, { params });
+
+// 获取秒杀活动商品详细信息
+export const seckillActivityProductInfo_Api = (id) => uni.$uv.http.get(`/seckill/seckillActivityProduct/info/${id}`, {  });
+
+// 查询该店铺中的正在秒杀的活动商品
+export const seckillActivityProductSeckillingList_Api = (params) => uni.$uv.http.get(`/seckill/seckillActivityProduct/seckillingList`, { params });
+
+// APP -- 根据开始时间查询限时秒杀
+export const seckillActivityProductStartFlashSale_Api = (params) => uni.$uv.http.get(`/seckill/seckillActivityProduct/start-flash-sale`, { params });
+
+// 查询该店铺中的即将秒杀的活动商品
+export const seckillActivityProductWillSeckill_Api = (params) => uni.$uv.http.get(`/seckill/seckillActivityProduct/willSeckill`, { params });
+
+// 查询秒杀活动时间配置列表
+export const seckillTimeConfigList_Api = (params) => uni.$uv.http.get(`/seckill/seckillTimeConfig/list`, { params });

+ 1 - 1
pages.json

@@ -536,7 +536,7 @@
 					}
 				},
 				{
-					"path": "details",
+					"path": "seckillGoods",
 					"style": {
 						"navigationBarTitleText": "商品详情"
 					}

+ 88 - 117
pages/seckill/list.vue

@@ -11,7 +11,7 @@
           >
             <view class="number">
               <!-- {{ item.st + ":00" }} -->
-              {{ item.start_hour }}
+              {{ item.startHour }}
             </view>
             <view
               :class="item.active ? 'font' : 'font-soon'"
@@ -39,18 +39,7 @@
         <view class="transverse"> </view>
         <view class="surplus-content" v-if="activeState == 1">
           <view class="lable"> 本场剩余 </view>
-          <uni-countdown
-            v-if="countDown"
-            :backgroundColor="'#DCCDA4'"
-            :color="'#00bf5a'"
-            :splitorColor="'#fff'"
-            :show-day="time2[0] > 0"
-            :day="time2[0]"
-            :hour="time2[1]"
-            :minute="time2[2]"
-            :second="time2[3]"
-          >
-          </uni-countdown>
+          <uv-count-down :time="remainingTime" format="HH:mm:ss"></uv-count-down>
         </view>
         <view class="surplus-content" v-if="activeState == 0">
           <view class="lable">即将开始</view>
@@ -74,17 +63,18 @@
         v-for="(item, key) in goodList"
         :key="item.id"
         @click="
-          goProductDetails('/pages/product/goods/seckillGoods?id=' + item.id)
+          goProductDetails('/pages/seckill/seckillGoods?id=' + item.id)
         "
       >
         <view
           :class="[activeBannerIndex == key ? 'active-back' : 'swiper-back']"
         >
+          <!-- ?x-oss-process=style/w_350 -->
           <image
             :class="[
               activeBannerIndex == key ? 'current-item' : 'default-image',
             ]"
-            :src="`${item.cover}?x-oss-process=style/w_350`"
+            :src="`${item.coverImage}`"
             mode=""
           >
           </image>
@@ -100,12 +90,12 @@
             <view class="content-number">
               <view class="large">
                 <rich-text
-                  :nodes="$mUtil.priceBigSmall(item.min_price)"
+                  :nodes="$mUtil.priceBigSmall(item.minPrice)"
                 ></rich-text>
               </view>
               <view class="small">
                 <rich-text
-                  :nodes="$mUtil.priceBigSmall(item.min_sale_price)"
+                  :nodes="$mUtil.priceBigSmall(item.minSalePrice)"
                 ></rich-text>
               </view>
             </view>
@@ -143,14 +133,12 @@
           v-for="(item, index) in goodList"
           :key="index"
           @click="
-            goProductDetails('/pages/product/goods/seckillGoods?id=' + item.id)
+            goProductDetails('/pages/seckill/seckillGoods?id=' + item.id)
           "
         >
           <view class="item-left">
-            <image
-              :src="`${item.cover}?x-oss-process=style/w_350`"
-              mode=""
-            ></image>
+            <!-- ?x-oss-process=style/w_350 -->
+            <image :src="`${item.coverImage}`" mode=""></image>
           </view>
           <view class="item-right">
             <view class="title">
@@ -170,12 +158,12 @@
               <view class="number">
                 <view class="large">
                   <rich-text
-                    :nodes="$mUtil.priceBigSmall(item.min_price)"
+                    :nodes="$mUtil.priceBigSmall(item.minPrice)"
                   ></rich-text>
                 </view>
                 <view class="small">
                   <rich-text
-                    :nodes="$mUtil.priceBigSmall(item.min_sale_price)"
+                    :nodes="$mUtil.priceBigSmall(item.minSalePrice)"
                   ></rich-text>
                 </view>
               </view>
@@ -189,29 +177,31 @@
         </view>
         <loadMore v-if="goodList.length > 0" :status="status"></loadMore>
       </view>
-      <nodata v-else :config="{ top: 20, content: '暂无商品~' }"></nodata>
+      <noData v-else :config="{ top: 20, content: '暂无商品~' }"></noData>
     </view>
-    <ldLoading isFullScreen :active="loading"></ldLoading>
   </view>
 </template>
 
 <script setup>
 import { ref, onMounted } from "vue";
-import { onShow, onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app";
-// import { getAllKillConfig } from "@/api/home";
-
-const $http = uni.$http;
-const $mUtil = uni.$mUtil;
+import {
+  onShow,
+  onPullDownRefresh,
+  onReachBottom,
+  onLoad,
+} from "@dcloudio/uni-app";
+import {
+  seckillTimeConfigList_Api,
+  seckillActivityProductStartFlashSale_Api,
+} from "@/api/seckill.js";
 
 const loading = ref(true);
 const page = ref(1);
 const limit = ref(10);
 const activeState = ref(null);
 const times = ref([]);
-const countDown = ref(true);
 const curTime = ref(null);
 const goodList = ref([]);
-const time2 = ref([0, 0, 0, 0]); // 秒杀倒计时
 const httpCurTime = ref(null);
 const status = ref("more");
 const activeBannerIndex = ref(0);
@@ -219,31 +209,17 @@ const params = ref({});
 const endTime = ref(null);
 const ispay = ref(getApp().globalData.openPay);
 const currentItem = ref(0);
-
-// 初始化参数
-const initParams = (options) => {
-  if (options.shopid) {
-    params.value.shop_id = options.shopid;
-  }
-};
+const remainingTime = ref(0);
 
 // 切换时间
 const switeTime = (item) => {
-  let st_hour = item.start_hour.split(":")[0];
-  let et_hour = item.end_hour.split(":")[0];
-  console.log(item, 1111);
-  countDown.value = false;
-  time2.value = [0, 0, 0, 0];
-
-  setTimeout(() => {
-    countDown.value = true;
-  }, 0);
-
-  httpCurTime.value = item.start_hour;
-  if (et_hour == "23") {
+  let stHour = item.startHour.split(":")[0];
+  let etHour = item.endHour.split(":")[0];
+  httpCurTime.value = item.startHour;
+  if (etHour == "23") {
     endTime.value = "23:59";
   } else {
-    endTime.value = item.end_hour;
+    endTime.value = item.endHour;
   }
 
   times.value.forEach((val) => {
@@ -263,90 +239,84 @@ const goProductDetails = (url) => {
       url: url,
     });
   } else if (activeState.value == 0) {
-    $mUtil.toast("该活动还未开始");
+    uni.$uv.toast("该活动还未开始");
   } else {
-    $mUtil.toast("该活动已结束");
+    uni.$uv.toast("该活动已结束");
   }
 };
 
 const imgActiveFun = (e) => {
   activeBannerIndex.value = e.detail.current;
-  console.log(currentItem.value);
-  console.log(e.detail.current);
+  // console.log(currentItem.value);
+  // console.log(e.detail.current);
 };
 
 const getTime = async () => {
-	return
   curTime.value = new Date().getHours();
-  times.value = await getAllKillConfig();
-
-  if (times.value && times.value.length > 0) {
-    times.value.forEach((val, index) => {
-      let st_hour = val.start_hour.split(":")[0];
-      let et_hour = val.end_hour.split(":")[0];
-
-      // 活动正在进行中
-      if (st_hour <= curTime.value && curTime.value < et_hour) {
-        val.value = 2;
-        httpCurTime.value = val.start_hour;
-        endTime.value = val.end_hour;
-        val.active = true;
-      } else if (curTime.value < et_hour) {
-        // 活动即将开始
-        val.value = 0;
-        if (httpCurTime.value == null) {
-          httpCurTime.value = val.start_hour;
-          endTime.value = val.end_hour;
-          val.active = true;
-        }
-      } else if (
-        curTime.value >= et_hour &&
-        curTime.value > times.value[index + 1]?.start_hour
-      ) {
-        // 活动已过期
-        val.value = 1;
+  await seckillTimeConfigList_Api().then((res) => {
+    if (res.code == 200) {
+      // times.value = res.data || [];
+      if (res.data && res.data.length > 0) {
+        times.value = res.data.map((val, index) => {
+          let stHour = val.startHour.split(":")[0];
+          let etHour = val.endHour.split(":")[0];
+
+          // 活动正在进行中
+          if (stHour <= curTime.value && curTime.value < etHour) {
+            val.value = 2;
+            httpCurTime.value = val.startHour;
+            endTime.value = val.endHour;
+            val.active = true;
+          } else if (curTime.value < etHour) {
+            // 活动即将开始
+            val.value = 0;
+            if (httpCurTime.value == null) {
+              httpCurTime.value = val.startHour;
+              endTime.value = val.endHour;
+              val.active = true;
+            }
+          } else {
+            val.value = 1;
+          }
+
+          return val;
+        });
       }
-    });
-  }
+    }
+  });
+
   getList();
 };
 
 const getList = () => {
   loading.value = false;
-  $http
-    .get(
-      "/marketing/seckillActivityGoods/start-flash-sale",
-      {
-        start_hour: httpCurTime.value,
-        end_hour: endTime.value,
-        page: page.value,
-        limit: limit.value,
-        ...params.value,
-      },
-      false
-    )
-    .then((res) => {
-      if (res && res.code == 200) {
-        activeState.value = res.data.active_state;
-        time2.value = $mUtil
-          .countDown(Math.floor(res.data.finish_time / 1000), res.data.now_time)
-          .split(":")
-          .map((val) => Number(val));
-        goodList.value = goodList.value.concat(res.data.page.list);
-
-        if (res.data.page.totalPage <= res.data.page.currPage) {
-          status.value = "noMore";
-        } else {
-          status.value = "more";
-        }
+  let objs = {
+    startHour: httpCurTime.value,
+    endHour: endTime.value,
+    limit: limit.value,
+    ...params.value,
+  };
+  seckillActivityProductStartFlashSale_Api(objs).then((res) => {
+    if (res && res.code == 200) {
+      activeState.value = res.data.activeState;
+      remainingTime.value = res.data.finishTime - res.data.nowTime;
+      goodList.value = goodList.value.concat(res.data.pageList?.rows || []);
+
+      if (res.data.pageList?.total <= goodList.value.length) {
+        status.value = "noMore";
+      } else {
+        status.value = "more";
       }
-    });
+    }
+  });
 };
 
 // 生命周期
 onLoad((options) => {
-  initParams(options);
-  //   getTime();
+  if (options.businessId) {
+    params.value.businessId = options.businessId;
+  }
+  getTime();
 });
 
 onShow(() => {
@@ -859,7 +829,8 @@ page {
     display: flex;
     align-items: center;
 
-    text {
+    text,
+    &:deep(.uv-count-down__text) {
       color: #00bf5a;
       padding: 1rpx 4rpx;
       background-color: #dccda4;

+ 142 - 263
pages/seckill/seckillGoods.vue

@@ -13,10 +13,10 @@
               duration="1500"
               circular="true"
             >
-              <swiper-item v-if="dataForm.video_url">
+              <swiper-item v-if="dataForm.videoUrl">
                 <j-video
                   class="jvideo"
-                  :url="dataForm.video_url"
+                  :url="dataForm.videoUrl"
                   width="750rpx"
                   height="620rpx"
                 ></j-video>
@@ -30,11 +30,11 @@
               <view class="pd24 u-flex-center" style="align-items: baseline">
                 <view class="u-FFF u-font36">
                   <rich-text
-                    :nodes="$mUtil.priceBigSmallTwo(dataForm.min_price)"
+                    :nodes="$mUtil.priceBigSmallTwo(dataForm.minPrice)"
                   ></rich-text>
                 </view>
                 <text class="discount u-font24 u-ml20 u-del"
-                  >¥{{ dataForm.max_sale_price }}</text
+                  >¥{{ dataForm.maxSalePrice }}</text
                 >
               </view>
               <view class="p-ab u-flex-center">
@@ -42,29 +42,23 @@
                 <view class="seckill u-text-center u-font28">
                   <!-- active_state 0:未开始 * 1:进行中 * 2:已结束 -->
 
-                  <view class="u-bold" v-if="dataForm.active_state == 1"
+                  <view class="u-bold" v-if="dataForm.activeTimeState == 1"
                     >距结束</view
                   >
 
                   <view
                     class="u-bold"
                     v-if="
-                      dataForm.active_state == 0 || dataForm.active_state == 2
+                      dataForm.activeTimeState == 0 ||
+                      dataForm.activeTimeState == 2
                     "
                     >已结束</view
                   >
-                  <view v-if="dataForm.active_state != 2">
-                    <uni-countdown
-                      :backgroundColor="'none'"
-                      @timeup="overDown1"
-                      :color="'#3775F6'"
-                      :splitorColor="'#3775F6'"
-                      :show-day="time1[0] > 0"
-                      :day="time1[0]"
-                      :hour="time1[1]"
-                      :minute="time1[2]"
-                      :second="time1[3]"
-                    ></uni-countdown>
+                  <view v-if="dataForm.activeTimeState != 2">
+                    <uv-count-down
+                      :time="remainingTime"
+                      format="HH:mm:ss"
+                    ></uv-count-down>
                   </view>
                 </view>
               </view>
@@ -73,7 +67,7 @@
             <view class="mt10 u-plr30">
               <view>
                 <view
-                  v-if="shop.platform_shop"
+                  v-if="shop.platformShop"
                   class="tipsStatus"
                   style="vertical-align: middle"
                   >自营</view
@@ -85,9 +79,9 @@
               <view class="u-font24 u-mt15 u-999">
                 <text
                   >已售
-                  <text class="u-FF0000">{{ dataForm.result_sale_num }}</text
+                  <text class="u-FF0000">{{ dataForm.resultSaleNum }}</text
                   >件,仅剩<text class="u-FF0000">{{
-                    dataForm.residue_stock_total
+                    dataForm.residueStockTotal
                   }}</text
                   >件</text
                 >
@@ -101,20 +95,20 @@
           <view class="u-plr30 u-flex-center-sb pt-pb35">
             <view class="u-flex-center" @click="goShop">
               <view>
-                <image class="u-avatar104" :src="shop.logo"></image>
+                <image class="u-avatar104" :src="shop.image"></image>
               </view>
               <view class="u-ml25">
                 <view class="u-font28 u-1A1A1A u-bold"
-                  >{{ shop.shop_name }}
+                  >{{ shop.businessName }}
                 </view>
                 <view class="u-999 u-font24 u-mt5 u-text2">
                   <text
                     class="iconfont"
                     style="color: #00bf5a"
                     @click.stop="goLocal"
-                    >&#xe6db;</text
+                    >&#xe990;</text
                   >
-                  {{ shop.province_name }}{{ shop.city_name }}{{ shop.area_name
+                  {{ shop.provinceName }}{{ shop.cityName }}{{ shop.areaName
                   }}{{ shop.address }}
                 </view>
               </view>
@@ -146,10 +140,10 @@
           <!--商品详情-->
           <view v-if="isChecked == 0">
             <view class="richText ql-editor-box">
-              <u-parse
+              <uv-parse
                 class="custom-parse"
-                :html="goodsInfo.mobile_detail"
-              ></u-parse>
+                :content="productObj.content"
+              ></uv-parse>
             </view>
           </view>
 
@@ -173,12 +167,12 @@
         </button>
 
         <!--秒杀按钮-->
-        <view class="seckill-btn" v-if="dataForm.active_state == 0">
+        <view class="seckill-btn" v-if="dataForm.activeTimeState == 0">
           <button v-if="ispay" class="u-btn-two u-DCCDA4" @click="notStarted()">
             立即购买
           </button>
         </view>
-        <view class="seckill-btn" v-if="dataForm.active_state == 1">
+        <view class="seckill-btn" v-if="dataForm.activeTimeState == 1">
           <button
             v-if="ispay"
             class="u-btn-two u-DCCDA4"
@@ -187,7 +181,7 @@
             立即购买
           </button>
         </view>
-        <view class="seckill-btn" v-if="dataForm.active_state == 2">
+        <view class="seckill-btn" v-if="dataForm.activeTimeState == 2">
           <button
             v-if="ispay"
             class="u-btn-two u-DCCDA4"
@@ -200,56 +194,40 @@
     </view>
 
     <!--规格-->
-    <uv-popup type="bottom" ref="specOpenRef">
+    <uv-popup mode="bottom" ref="specOpenRef" round="30rpx">
       <view class="u-bg-fff spec">
         <view class="u-plr30 flex-sb u-border-one-one pb30">
           <view class="u-flex-center">
             <image
               class="u-goods200"
-              :src="choseConfig.cover ? choseConfig.cover : cover"
+              :src="skuObj.cover ? skuObj.cover : cover"
             ></image>
             <view class="u-ml20">
               <view class="u-999 u-font24 u-flex-center">
                 <view class="u-00BF5A u-font36">
                   <rich-text
-                    :nodes="
-                      $mUtil.priceBigSmall(
-                        choseConfig.activity_price
-                          ? choseConfig.activity_price
-                          : moPrice
-                      )
-                    "
+                    :nodes="$mUtil.priceBigSmall(skuObj.marketPrice || 0)"
                   ></rich-text>
                 </view>
 
                 <text class="u-del u-ml15"
-                  >¥{{
-                    choseConfig.market_price
-                      ? choseConfig.market_price
-                      : moDelPrice
-                  }}
+                  >¥{{ skuObj.originalSalePrice || 0 }}
                 </text>
               </view>
               <view class="u-font22 u-999 u-mt5"
-                >活动库存 {{ stock }} 件
-                <text
-                  >商品库存{{
-                    choseConfig.able_stock
-                      ? choseConfig.able_stock
-                      : goods_total_stock
-                  }}</text
-                >
+                >活动库存 {{ skuObj.stock }} 件
               </view>
               <view class="u-1A1A1A u-mt25"
-                >{{
-                  choseConfig.sku_set_name ? choseConfig.sku_set_name : "请选择"
-                }}
+                >{{ skuObj.skuSetName ? skuObj.skuSetName : "请选择" }}
               </view>
             </view>
           </view>
-          <view class="iconfont u-999 closeIcon" @click="specOpenRef.close()"
+          <!-- <view class="iconfont u-999 closeIcon" @click="specOpenRef.close()"
             >&#xe612;</view
-          >
+          > -->
+          <view class="closeIcon" @click.stop="specOpenRef.close()">
+            <uv-icon name="close-circle" color="#999999" size="36rpx"></uv-icon>
+          </view>
         </view>
 
         <view>
@@ -279,19 +257,12 @@
             <view class="u-flex-center-sb">
               <view>购买数量</view>
               <view class="u-flex-center">
-                <view class="iconfont minus" @click="resNum">&#xe60b;</view>
-                <view class="num">{{ add_num }}</view>
-                <view class="iconfont plus-sign" @click="addNum">&#xe686;</view>
+                <uv-number-box v-model="addNumber" disabledInput></uv-number-box>
               </view>
             </view>
             <view class="specOpen-btn">
-              <view v-if="btnType == 0">
-                <button class="u-btn-two" @click="btnBuy(btnType)">
-                  {{ btnName }}
-                </button>
-              </view>
-              <view v-else>
-                <button class="u-btn-two" @click="btnBuy(btnType)">
+              <view>
+                <button class="u-btn-two" @click="btnBuy(1)">
                   {{ btnName }}
                 </button>
               </view>
@@ -308,10 +279,16 @@
 <script setup>
 import { ref } from "vue";
 import { onShareAppMessage, onShow, onLoad } from "@dcloudio/uni-app";
+import { seckillActivityProductInfo_Api } from "@/api/seckill.js";
+import {
+  getBusinessInfoId_Api,
+  productInfo,
+  shopOrderCommentPage,
+} from "@/api/shop.js";
+
 import comment from "@/components/ld-comment/ld-comment.vue";
+import utils from "@/util/index.js";
 
-const $http = uni.$http;
-const $mUtil = uni.$mUtil;
 const specOpenRef = ref(null);
 // 手机状态栏高度
 const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
@@ -319,31 +296,19 @@ const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
 const imglist = ref([]); // 详情图片数组
 const isChecked = ref(0);
 const btnName = ref("");
-const btnType = ref(""); // 0 购物车,1 立即购买
 const dataForm = ref({}); // 商品详情
 const shop = ref({}); // 店铺信息
-const shopDiscounts = ref({}); // 店铺首单优惠
-const stock = ref(0);
-const goods_total_stock = ref(0);
 const cover = ref("");
 const loading = ref(true);
-const moDelPrice = ref("");
-const moPrice = ref("");
-const goodsSkuList = ref([]); // sku 组合值
 const skuTab = ref([]); // sku 二位数组
-const goods_id = ref(null);
-const limit_buy_num = ref(0);
-const choseConfig = ref({});
+const skuObj = ref({}); // sku 对象
 const hasId = ref("");
-const add_num = ref(1);
-const goStatus = ref(0); // 0: 购物车,1 下单
-const shop_id = ref(0);
+const addNumber = ref(1);
 const commentList = ref([]);
 const commentListLength = ref(0);
-const goodsInfo = ref({});
-const time1 = ref([0, 0, 0, 0]);
-const ispay = ref(getApp().globalData.openPay);
-const able_stock = ref(0);
+const productObj = ref({});
+const remainingTime = ref(0); // 剩余时间
+const ispay = ref(true);
 
 // 生命周期
 onShow(() => {});
@@ -387,8 +352,8 @@ const itSover = () => {
 
 const goLocal = () => {
   uni.openLocation({
-    latitude: Number(shop.value.tx_latitude),
-    longitude: Number(shop.value.tx_longitude),
+    latitude: Number(shop.value.txLatitude),
+    longitude: Number(shop.value.txLongitude),
     name: shop.value.name,
     address: shop.value.address,
     success: function () {
@@ -399,64 +364,63 @@ const goLocal = () => {
 
 const goShop = () => {
   uni.navigateTo({
-    url: "/pages/convenienceService/shopDetails?shopId=" + shop_id.value,
+    url:
+      "/pages/convenienceService/shopDetails?businessId=" +
+      dataForm.value.businessId,
   });
 };
 
-const recordSave = (share_user_id, goods_id) => {
+const recordSave = (shareUserId, productI) => {
+  return;
   $http
     .post("/share/record/save", {
-      share_user_id: share_user_id,
-      goods_id: goods_id,
+      shareUserId: shareUserId,
+      productI: productI,
     })
     .then((res) => {});
 };
 
 const getDetailInfo = (id) => {
-  $http.get("/marketing/seckillActivityGoods/info/" + id).then((res) => {
+  seckillActivityProductInfo_Api(id).then((res) => {
     loading.value = false;
     if (res && res.code == 200) {
       dataForm.value = res.data;
-      shop_id.value = res.data.shop_id;
-      $http
-        .get("/marketing/firstOrder/getByShop/" + shop_id.value)
-        .then((res) => {
-          if (res && res.code == 200) {
-            shopDiscounts.value = res.data;
-          }
-        });
-      $http.get("/yxt/shop/info/" + shop_id.value).then((res) => {
-        if (res.data && res.code == 200) {
-          shop.value = res.data;
+      imglist.value = res.data.coverImage.split(",");
+
+      if (res.data.activeTimeState == 1) {
+        remainingTime.value = res.data.finishTime * 1000 - new Date().getTime();
+        // console.log("remainingTime.value", remainingTime.value);
+      }
+      productInfo(dataForm.value.productId).then((ret) => {
+        if (ret && ret.code == 200) {
+          productObj.value = ret.data;
+          skuTab.value = ret.data.skuTable.map((item) => {
+            if (item.values) {
+              item.values[0].flag = true;
+            }
+            return item;
+          });
         }
       });
-      imglist.value = res.data.cover.split(",");
-
-      if (res.data.active_state == 0 || res.data.active_state == 2) {
-        time1.value = $mUtil
-          .countDown(res.data.will_start_time)
-          .split(":")
-          .map((val) => Number(val));
-      } else {
-        time1.value = $mUtil
-          .countDown(res.data.finish_time)
-          .split(":")
-          .map((val) => Number(val));
-      }
-      $http.get(`/goods/content/${dataForm.value.goods_id}`).then((res) => {
+
+      getBusinessInfoId_Api(dataForm.value.businessId).then((ret) => {
+        if (ret.data && ret.code == 200) {
+          shop.value = ret.data;
+        }
+      });
+
+      // return
+      shopOrderCommentPage({
+        productId: dataForm.value.productId,
+        page: 1,
+        pageSize: 10,
+      }).then((res) => {
         if (res && res.code == 200) {
-          goodsInfo.value = res.data;
+          commentList.value = res.list;
+          commentListLength.value =
+            res.list && res.list.length ? res.list.length : 0;
         }
       });
-      $http
-        .get(`/comment/orderGoods/getgoodscomments/${dataForm.value.goods_id}`)
-        .then((res) => {
-          if (res && res.code == 200) {
-            commentList.value = res.list;
-            commentListLength.value =
-              res.list && res.list.length ? res.list.length : 0;
-          }
-        });
     }
   });
 };
@@ -466,32 +430,21 @@ const change = (i) => {
 };
 
 const buy = (i, id) => {
-  btnType.value = i;
-  checkSku(id);
-  if (i == 0) {
-    btnName.value = "加入购物车";
-  } else {
-    btnName.value = "立即购买";
-  }
-};
-
-const resNum = () => {
-  if (add_num.value > 1) {
-    add_num.value--;
-  }
-};
-
-const addNum = () => {
-  add_num.value++;
+  chonseSku();
+  btnName.value = "立即购买";
+  specOpenRef.value.open();
 };
 
+// 处理选中的
 const chonseSku = (index, id) => {
-  skuTab.value[index].values.forEach((res) => {
-    res.flag = false;
-    if (res.id == id) {
-      res.flag = true;
-    }
-  });
+  if (index != null) {
+    skuTab.value[index].values.forEach((res) => {
+      res.flag = false;
+      if (res.id == id) {
+        res.flag = true;
+      }
+    });
+  }
   let choseId = [];
   skuTab.value.forEach((res) => {
     res.values.forEach((Key) => {
@@ -500,134 +453,66 @@ const chonseSku = (index, id) => {
       }
     });
   });
-  let totalId = choseId.sort((a, b) => a - b).join("|");
+  let totalId = choseId.sort((a, b) => a - b).join("_");
+  totalId = "_" + totalId + "_";
   hasId.value = totalId;
-  goodsSkuList.value.forEach((res) => {
-    let temp = res.sku_hash_code;
-    let sku_hash_code_val = temp
-      .split("|")
-      .sort((a, b) => a - b)
-      .join("|");
-    if (sku_hash_code_val == totalId) {
-      choseConfig.value = res;
-      stock.value = dataForm.value.real_stock_total;
-      able_stock.value = res.able_stock;
+  dataForm.value.productSkuSetList.forEach((res) => {
+    if (res.skuHashCode == totalId) {
+      skuObj.value = res;
     }
   });
 };
 
-const checkSku = (id) => {
-  $http
-    .get(`/marketing/seckillActivityGoods/skus/${dataForm.value.id}`)
-    .then((res) => {
-      loading.value = false;
-      goods_total_stock.value = res.data.goods_total_stock;
-      if (res && res.code == 200) {
-        choseConfig.value = {};
-        hasId.value = "";
-        res.data.goods.sku_table.forEach((keys) => {
-          keys.values.forEach((val) => {
-            val.flag = false;
-          });
-        });
-        limit_buy_num.value = dataForm.value.limit_buy_num;
-        goods_id.value = dataForm.value.goods_id;
-        goodsSkuList.value = res.data.goods_sku_list;
-        moPrice.value = dataForm.value.min_price;
-        moDelPrice.value = dataForm.value.min_sale_price;
-        cover.value = imglist.value[0];
-        stock.value = dataForm.value.real_stock_total;
-        if (res.data.goods_auth) {
-          if (res.data.goods_auth.added) {
-            specOpenRef.value.open();
-          } else {
-            uni.$uv.toast("该商品已经下架");
-          }
-        } else {
-          uni.$uv.toast("没有经营权限");
-        }
-        if (skuTab.value.length == 0) {
-          skuTab.value = res.data.goods.sku_table;
-          for (let i in skuTab.value) {
-            skuTab.value[i].values[0].flag = true;
-          }
-        }
-        chonseSku(0, skuTab.value[0].values[0].id);
-      }
-    });
-};
-
 const btnBuys = () => {
-  if (skuTab.value.length > 0 && hasId.value == "") {
+  if (!skuObj.value.id && hasId.value == "") {
     uni.$uv.toast("请选中 sku");
     return false;
   }
 
-  if (add_num.value > limit_buy_num.value && limit_buy_num.value != 0) {
-    uni.$uv.toast("商品限购" + limit_buy_num.value + "件");
+  if (
+    Number(addNumber.value) > dataForm.value.limitBuyNum &&
+    dataForm.value.limitBuyNum != 0
+  ) {
+    uni.$uv.toast("商品限购" + dataForm.value.limitBuyNum + "件");
     return false;
   }
-  if (goodsSkuList.value.length > 0 && able_stock.value < add_num.value) {
-    uni.$uv.toast("商品库存只有" + able_stock.value + "件");
-    $http
-      .post(`/singlegoods/understockrecord/save`, {
-        shop_id: shop_id.value,
-        goods_id: goods_id.value,
-        single_goods_id: choseConfig.value.single_goods_id,
-        sku_set_name: choseConfig.value.sku_set_name,
-        buy_num: add_num.value,
-      })
-      .then((res) => {});
+  if (
+    dataForm.value.productSkuSetList.length > 0 &&
+    Number(skuObj.value.stock) < Number(addNumber.value)
+  ) {
+    uni.$uv.toast("商品库存只有" + skuObj.value.stock + "件");
     return false;
   }
-  if (goStatus.value == 0) {
-    let data = {
-      goods_id: goods_id.value,
-      sku_hash_code: hasId.value,
-      add_num: add_num.value,
-      source_shop_id: shop_id.value.toString(),
-    };
-    $http.post(`/cart/add`, data).then((res) => {
-      if (res && res.code == 200) {
-        uni.$uv.toast("添加成功");
-        // specOpen.value.close();
-        choseConfig.value = {};
-        add_num.value = 1;
-        cartList();
-      }
-    });
-  } else {
-    psotJson();
-  }
+  // psotJson();
 };
 
 const psotJson = () => {
   let dataJson = {};
   let childArr = [];
   let parendArr = [];
-  choseConfig.value;
+  skuObj.value;
 
   childArr.push({
-    user_cart_id: 0,
-    activity_goods_id: choseConfig.value.activity_goods_id,
-    goods_id: goods_id.value,
-    num: add_num.value,
-    sku_hash_code: choseConfig.value.sku_hash_code,
+    userCartId: 0,
+    activityGoodsId: skuObj.value.activityGoodsId,
+    productI: dataForm.value.productI,
+    num: addNumber.value,
+    skuHashCode: skuObj.value.skuHashCode,
   });
   parendArr.push({
-    shop_id: shop.value.id,
-    source_shop_id: shop.value.id,
-    activity_id: dataForm.value.seckill_id,
-    sponsor_activity_id: 0,
-    user_remark: "",
+    businessId: shop.value.id,
+    sourceBusinessId: shop.value.id,
+    activityId: dataForm.value.seckillId,
+    sponsorActivityId: 0,
+    userRemark: "",
     items: childArr,
   });
   dataJson = {
-    is_cart: false,
-    receipt_id: null,
+    isCart: false,
+    receiptId: null,
     shipment_mode: 0,
-    shop_orders: parendArr,
-    marketing_type: 1,
+    shopOrders: parendArr,
+    marketingType: 1,
   };
   uni.setStorageSync("dataJson", dataJson);
   uni.navigateTo({
@@ -636,20 +521,10 @@ const psotJson = () => {
 };
 
 const btnBuy = (i) => {
-  goStatus.value = i;
-  let token = uni.getStorageSync("apiToken");
-  if (!token) {
-    uni.navigateTo({
-      url: "/pages/login/index",
-    });
-  } else {
+  if (!utils.isLoginTo(true)) {
     btnBuys();
   }
 };
-
-const cartList = () => {
-  // 实现购物车逻辑
-};
 </script>
 
 <style lang="scss" scoped>
@@ -808,6 +683,10 @@ const cartList = () => {
   border-radius: 5rpx 20rpx 0px 0px;
   text-align: center;
   // width: 150rpx;
+  &:deep(.uv-count-down__text) {
+    color: #3775f6;
+    font-size: 24rpx;
+  }
 }
 
 .seckill-btn {

+ 64 - 36
pages/tabtar/components/Seckill.vue

@@ -6,15 +6,15 @@
     <view class="seckill-item">
       <view
         class="seckill-top"
-        @click="goDetail('/pages/research/nearby/timeLimit')"
+        @click="goDetail('/pages/seckill/list')"
       >
         <view class="left">限时秒杀</view>
         <view class="line" v-if="currTime"></view>
         <view class="time" v-if="currTime">{{ currTime }}点场 剩余</view>
         <view class="reciprocal" v-if="currTime">
-          <uni-countdown
+          <!-- <uni-countdown
+            :time="finishTime"
             :backgroundColor="'none'"
-            @timeup="overDown2"
             :color="'#fff'"
             :splitorColor="'#fff'"
             :show-day="time2[0] > 0"
@@ -23,7 +23,8 @@
             :minute="time2[2]"
             :second="time2[3]"
           >
-          </uni-countdown>
+          </uni-countdown> -->
+          <uv-count-down :time="finishTime" format="HH:mm:ss"></uv-count-down>
         </view>
       </view>
       <view
@@ -45,20 +46,21 @@
                 v-for="itemSon in item"
                 @click="
                   goProductDetails(
-                    '/pages/product/goods/seckillGoods?id=' + itemSon.id
+                    '/pages/seckill/seckillGoods?id=' + itemSon.id
                   )
                 "
                 :key="itemSon.id"
               >
+                <!-- ?x-oss-process=style/w_350 -->
                 <image
-                  v-if="itemSon && itemSon.cover"
-                  :src="`${itemSon.cover}?x-oss-process=style/w_350`"
+                  v-if="itemSon && itemSon.coverImage"
+                  :src="`${itemSon.coverImage}`"
                   mode="aspectFill"
                 >
                 </image>
                 <view class="number">
                   <rich-text
-                    :nodes="$mUtil.priceBigSmall(itemSon.min_price)"
+                    :nodes="$mUtil.priceBigSmall(itemSon.minPrice)"
                   ></rich-text>
                 </view>
               </view>
@@ -82,54 +84,75 @@
 </template>
 
 <script setup>
-import { getCurrentInstance } from "vue";
-const { proxy } = getCurrentInstance();
-const $mUtil = proxy.$mUtil;
+import { ref } from "vue";
+import { seckillActivityProductFlash_Api } from "@/api/seckill.js";
 
 const props = defineProps({
-  currSeckill: {
-    type: Array,
-    default: () => []
-  },
   skeletonShow: {
     type: Boolean,
     default: false
-  },
-  currTime: {
-    type: [Number, String],
-    default: null
-  },
-  time2: {
-    type: Array,
-    default: () => [0, 0, 0, 0]
-  },
-  itemsDis2: {
-    type: Number,
-    default: 1
-  },
-  activeBannerIndex2: {
-    type: Number,
-    default: 0
   }
 });
 
 const emit = defineEmits(['goDetail', 'overDown2', 'imgActiveFun2', 'goProductDetails']);
 
+const currSeckill = ref([]); //秒杀
+const currTime = ref(null);
+const finishTime = ref(null);
+const itemsDis2 = ref(1);
+const activeBannerIndex2 = ref(0);
+
+
 const goDetail = (url) => {
   emit('goDetail', url);
 };
 
-const overDown2 = () => {
-  emit('overDown2');
-};
-
 const imgActiveFun2 = (e) => {
-  emit('imgActiveFun2', e);
+  activeBannerIndex2.value = e.detail.current;
 };
 
 const goProductDetails = (url) => {
   emit('goProductDetails', url);
 };
+
+const oneArrToTwoArr = (data) => {
+  let newData = [];
+  let zyf = 4; //一维数组转二维数组长度(此处是二维数组每一个长度控制)
+  for (var i = 0; i < Math.ceil(data.length / zyf); i++) {
+    newData[i] = [];
+    newData[i].push(data[i * zyf]);
+    for (var j = 1; j < zyf; j++) {
+      if (data[i * zyf + j] == undefined) {
+        //超出长度控住
+        return newData;
+      } else {
+        newData[i].push(data[i * zyf + j]);
+      }
+    }
+  }
+  return newData;
+};
+
+
+/**限时秒杀 */
+const getSeckillList = () => {
+  seckillActivityProductFlash_Api({ limit: 10 }).then((res) => {
+    if (res && res.code == 200) {
+      currTime.value = res.data.startHour;
+      if (res.data.list) {
+        currSeckill.value = oneArrToTwoArr(res.data.list);
+      }
+      if (res.data.finishTime) {
+        finishTime.value = res.data.finishTime - new Date().getTime();
+      }
+    }
+  });
+};
+getSeckillList();
+
+defineExpose({
+  getSeckillList
+});
 </script>
 
 <style scoped lang="scss">
@@ -211,6 +234,11 @@ const goProductDetails = (url) => {
         font-weight: Bold;
         border-radius: 30rpx;
         margin-left: 30rpx;
+
+        &:deep(.uv-count-down__text) {
+          color: #ffffff;
+          font-size: 24rpx;
+        }
       }
     }
   }

+ 6 - 75
pages/tabtar/home.vue

@@ -67,7 +67,9 @@
             :src="`${item.icon}`"
           >
           </image>
-          <div class="word u-skeleton-fillet u-font26">{{ item.name || "加载中" }}</div>
+          <div class="word u-skeleton-fillet u-font26">
+            {{ item.name || "加载中" }}
+          </div>
         </div>
       </div>
       <view
@@ -91,14 +93,10 @@
 
       <!-- 限时秒杀 -->
       <Seckill
-        :currSeckill="currSeckill"
         :skeletonShow="skeletonShow"
-        :currTime="currTime"
-        :time2="time2"
         :itemsDis2="itemsDis2"
         :activeBannerIndex2="activeBannerIndex2"
         @goDetail="goDetail"
-        @overDown2="overDown2"
         @imgActiveFun2="imgActiveFun2"
         @goProductDetails="goProductDetails"
       />
@@ -169,9 +167,7 @@ import {
 } from "@dcloudio/uni-app";
 import { getAdList_Api, getQuickLinkList_Api } from "@/api/index.js";
 import { shopProductList_Api } from "@/api/shop.js";
-import {
-  messageUnreadNum_Api,
-} from "@/api/userInfo.js";
+import { messageUnreadNum_Api } from "@/api/userInfo.js";
 
 import ChoiceZone from "./components/ChoiceZone.vue";
 import Seckill from "./components/Seckill.vue";
@@ -196,14 +192,10 @@ const groupList = ref([]); //团购
 const hotList = ref([]); //本月热销
 const recommendList = ref([]); //推荐
 const shopBanner = ref([]); //轮播图
-const currSeckill = ref([]); //秒杀
-const time2 = ref([0, 0, 0, 0]); //秒杀倒计时
 const goodsList = ref([]); //猜你喜欢
-const currTime = ref(null);
 const itemsDis = ref(1);
 const activeBannerIndex = ref(0);
-const itemsDis2 = ref(1);
-const activeBannerIndex2 = ref(0);
+
 const page = ref(1);
 const status = ref("more");
 const msgCenter = ref(null);
@@ -312,14 +304,6 @@ const getHxCateList = () => {
   });
 };
 
-// 跳转一级分类
-const jumpCate = (id) => {
-  // uni.$uv.$store.commit("changeCateId", id || "");
-  uni.switchTab({
-    url: "/pages/index/list",
-    success: (res) => {},
-  });
-};
 
 const jumpHxCate = (item, area_feature) => {
   let url = `/pages/freeCollection/index`;
@@ -352,59 +336,7 @@ const imgActiveFun = (e) => {
   activeBannerIndex.value = e.detail.current;
 };
 
-const imgActiveFun2 = (e) => {
-  activeBannerIndex2.value = e.detail.current;
-};
-
-const overDown2 = () => {
-  isOver2.value = true;
-};
 
-/**限时秒杀 */
-const seckillList = () => {
-  uni.$uv.$http
-    .get(
-      `/marketing/seckillActivityGoods/flash-sale`,
-      {
-        limit: 10,
-        page: 1,
-      },
-      false
-    )
-    .then((res) => {
-      if (res && res.code == 200) {
-        currTime.value = res.data.start_hour;
-        if (res.data.list) {
-          currSeckill.value = oneArrToTwoArr(res.data.list);
-        }
-
-        if (res.data.finish_time) {
-          time2.value = uni.$uv.$mUtil
-            .countDown(Math.floor(res.data.finish_time / 1000))
-            .split(":")
-            .map((val) => Number(val));
-        }
-      }
-    });
-};
-
-const oneArrToTwoArr = (data) => {
-  let newData = [];
-  let zyf = 4; //一维数组转二维数组长度(此处是二维数组每一个长度控制)
-  for (var i = 0; i < Math.ceil(data.length / zyf); i++) {
-    newData[i] = [];
-    newData[i].push(data[i * zyf]);
-    for (var j = 1; j < zyf; j++) {
-      if (data[i * zyf + j] == undefined) {
-        //超出长度控住
-        return newData;
-      } else {
-        newData[i].push(data[i * zyf + j]);
-      }
-    }
-  }
-  return newData;
-};
 
 /**团购 */
 const getgroupList = () => {
@@ -499,7 +431,7 @@ const guessLike = () => {
 
 const goDetail = (url, isNeedLogin, tabShow = false) => {
   if ((isNeedLogin && uni.getStorageSync("apiToken") == "") || null) {
-    uni.$uv.$mUtil.toast("请先登录");
+    uni.$uv.toast("请先登录");
     return false;
   }
   if (tabShow) {
@@ -516,7 +448,6 @@ const goDetail = (url, isNeedLogin, tabShow = false) => {
 /**重置数据*/
 const rest = () => {
   goodsList.value = [];
-  currSeckill.value = [];
   shopBanner.value = [];
   recommendList.value = [];
   hotList.value = [];

+ 21 - 0
static/style/common.scss

@@ -530,6 +530,10 @@
   background-color: #dccda4;
 }
 
+.u-00BF5A {
+  color: #00BF5A;
+}
+
 // 字体大小相关
 .u-font20{
   font-size: 20rpx;
@@ -559,6 +563,14 @@
   font-size: 32rpx;
 }
 
+.u-font34 {
+  font-size: 34rpx;
+}
+
+.u-font36 {
+  font-size: 36rpx;
+}
+
 // 字体粗细相关
 .u-bold {
   font-weight: bold;
@@ -745,6 +757,15 @@
   height: 180rpx;
 }
 
+.u-avatar104{
+  width: 104rpx;
+  height: 104rpx;
+}
+
+.u-del{
+  text-decoration: line-through;
+}
+
 .popup-title {
   text-align: center;
   font-size: 32rpx;