Browse Source

增加奶茶前端

vaecebyZ 1 year ago
parent
commit
0a1b32eb59
4 changed files with 641 additions and 87 deletions
  1. 595 0
      milktea/index.vue
  2. 12 3
      pages.json
  3. 32 82
      pages/index/index.vue
  4. 2 2
      utils/config.js

+ 595 - 0
milktea/index.vue

@@ -0,0 +1,595 @@
+<template>
+  <view class="content">
+    <view class="top-box">
+      <view class="progress">
+        <!-- {{ current + 1 + "/" + bannerList.length }} -->
+        <view class="indicator" v-for="item in bannerList.length">
+          <view :class="['block', item == current ? 'active' : '']"> </view>
+        </view>
+      </view>
+      <!-- <view class="goods-box">
+        <view class="goods-title">
+          {{ bannerList[current].title }}
+        </view>
+        <view class="goods-subtitle">
+          {{ bannerList[current].subtitle }}
+        </view>
+      </view> -->
+      <swiper class="swiper" @change="swiperChange" :indicator-dots="false" circular :current="current"
+        indicatorMode="line" :autoplay="true" :interval="3000" :duration="1000">
+        <swiper-item v-for="(item, index) in bannerList" :key="index">
+          <image class="swiper-item" mode="" :src="item.src"> </image>
+        </swiper-item>
+      </swiper>
+    </view>
+
+    <view class="card-box">
+      <view class="card-item">
+        <view class="card-title">
+          <view class="card-item-title">
+            <view class="card-img">
+              <image class="card-item-img" src="https://oss.dev.zonelife.cn/static/guida/img/milktea/index/self.png">
+              </image>
+            </view>
+            <view class="title-moji">到店自提</view>
+            <view class="subtitle">提前点单免排队</view>
+          </view>
+
+        </view>
+      </view>
+
+      <view class="card-item">
+        <view class="card-title">
+          <view class="card-item-title">
+            <view class="card-img">
+              <image class="card-item-img" src="https://oss.dev.zonelife.cn/static/guida/img/milktea/index/send.png">
+              </image>
+            </view>
+            <view class="title-moji">印象配送</view>
+            <view class="subtitle">尽情期待...</view>
+          </view>
+
+        </view>
+      </view>
+    </view>
+
+    <view class="swiper-box" style="height: 200rpx">
+      <swiper class="swiper" @change="swiperChange" :indicator-dots="false" circular :autoplay="false" :interval="3000"
+        :duration="1000">
+        <swiper-item v-for="(item, index) in advList1" :key="item.id" @click="jump(item.jumpUrl)">
+          <image class="swiper-item" mode="" :src="item.advertsImg"> </image>
+        </swiper-item>
+      </swiper>
+    </view>
+
+    <view class="sub-title">
+      <view>精选推荐</view>
+    </view>
+
+    <view class="goods-list">
+      <!-- 列表 -->
+      <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
+        <view class="left">
+          <view class="store-item" v-for="(item, index) in list" :key="index" @click="goShopDetail(item)">
+            <zs-img :src="item.logoPath" width="340rpx" height="340rpx" mode="widthFix"></zs-img>
+            <view class="info">
+              <view class="title">
+                {{ item.shopVo.shopName }}
+              </view>
+              <view class="goods-price">
+                <!-- <image
+                  class="position"
+                  src="../../static/position.png"
+                  mode=""
+                ></image> -->
+                <view> ¥120 </view>
+                <view class="distance">
+                  销售{{ (item.shopVo.distance / 1000).toFixed(2) }}
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+        <view class="right">
+          <view class="store-item" v-for="(item, index) in list1" :key="index" @click="goShopDetail(item)">
+            <zs-img :src="item.logoPath" width="340rpx" height="340rpx" mode="widthFix"></zs-img>
+            <view class="info">
+              <view class="title">
+                {{ item.shopVo.shopName }}
+              </view>
+              <view class="goods-price">
+                <!-- <image
+                  class="position"
+                  src="../../static/position.png"
+                  mode=""
+                ></image> -->
+                <view> ¥120 </view>
+                <view class="distance">
+                  销售{{ (item.shopVo.distance / 1000).toFixed(2) }}
+                </view>
+              </view>
+            </view>
+          </view>
+        </view>
+      </zs-list>
+    </view>
+  </view>
+</template>
+
+<script>
+import { getUserDetail, getMenu, getAdv } from "@/api/common.js";
+import { search } from "@/api/shop.js";
+// 腾讯地图
+// // var QQMapWX = require("../../libs/qqmap-wx-jssdk.min.js");
+// var qqmapsdk = new QQMapWX({ key: "KX5BZ-B64RC-RO62W-AMWAZ-VVTC3-YAFXF" });
+export default {
+  data() {
+    return {
+      advList: [],
+      advList1: [],
+      discountsList: [], //菜单
+      current: 0,
+      loading: false,
+      navBarHeight: 0,
+      bannerList: [
+        {
+          src: "http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/LasLcHe8z6F9c7c569e98cf778f866ac466404589d03.png/1.png",
+          theme: "#FD9E59",
+          title: "春季新品",
+          subtitle: "蜜桃乌龙海盐芝士茶",
+        },
+        {
+          src: "http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/QdulVZUZ9HYH190ae2e9392281ee1b845573e68ece1e.png/1.png",
+          theme: "#FDD34C",
+          title: "清仓处理",
+          subtitle: "农夫山泉矿泉水",
+        },
+        {
+          src: "http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/N7kknVWzDPKLbb7e15025599a818bbf11e3b030b6765.png/1.png",
+          theme: "#B0ACF9",
+          title: "正在热卖",
+          subtitle: "哇哈哈AD盖",
+        },
+      ],
+      list: [],
+      list1: [],
+      status: "more",
+      query: {
+        queryName: "",
+        "location.lat": 0,
+        "location.lon": 0,
+        pageCurrent: 1,
+        pageSize: 10,
+      },
+    };
+  },
+  onLoad() { },
+  created() {
+    this.loading = true;
+    this.navBarHeight = this.$navHight(1);
+    this.navBarHeight = this.navBarHeight + 10 + "px";
+    Promise.all([this.getMenu(), this.getAdv()]).then((res) => {
+      this.search();
+    });
+  },
+  methods: {
+    // swiper变动
+    swiperChange(val) {
+      this.current = val.target.current;
+    },
+    // 广告位
+    getAdv() {
+      return new Promise((resolve, reject) => {
+        getAdv({ currentPage: 1, pageSize: 99, advertsType: 1 }).then((res) => {
+          if (res.state == "Success") {
+            this.advList = res.content.records.filter(
+              (item, index) => index < 2
+            );
+            this.advList1 = res.content.records
+              .filter((item, index) => index >= 2)
+              .map((item) => {
+                return {
+                  ...item,
+                  advertsImg:
+                    "https://img.tukuppt.com/bg_grid/00/19/09/1dM5I5nUz7.jpg!/fh/350",
+                };
+              })
+              .filter((item, index) => index == 1);
+            this.loading = false;
+            resolve(2);
+          }
+        });
+      });
+    },
+    // 金刚区
+    getMenu() {
+      return new Promise((resolve, reject) => {
+        getMenu({ currentPage: 1, pageSize: 10 }).then((res) => {
+          if (res.state == "Success") {
+            this.discountsList = res.content.records.slice(0, 5);
+            resolve(1);
+          }
+        });
+      });
+    },
+    // 跳转优惠详情
+    goDetail(url, id, banner, title) {
+      url = "/pages/home/detail";
+      uni.navigateTo({
+        url: `${url}`,
+        success(res) {
+          // res.eventChannel.emit("banner", banner);
+        },
+      });
+    },
+    search() {
+      if (this.status == "noMore") return;
+      this.status = "loading";
+      search(this.query).then((res) => {
+        if (res.state == "Success") {
+          this.loading = false;
+          let list = [];
+          let list1 = [];
+          res.content.records.map((item, index) => {
+            if (index % 2) {
+              list.push(item);
+            } else {
+              list1.push(item);
+            }
+          });
+          this.list = this.list.concat(list);
+          this.list1 = this.list1.concat(list1);
+          let total = this.list.length + this.list1.length;
+          if (total >= res.content.total) {
+            this.status = "noMore";
+          } else {
+            this.status = "more";
+            this.query.pageCurrent++;
+          }
+        }
+      });
+    },
+    loadMore() {
+      console.log("loadMore");
+      if (this.query["location.lat"] && this.query["location.lon"]) {
+        this.search();
+      }
+    },
+  },
+};
+</script>
+
+<style lang="scss">
+page {
+  background-color: #fafafa;
+}
+
+.content {
+  // padding-top: 24%;
+  display: flex;
+  flex-direction: column;
+  background-color: #fafafa;
+  justify-content: center;
+
+  .top-box {
+    background: linear-gradient(180deg, var(--bg) 0%, #fff 100%);
+    // padding: 100rpx 32rpx 0;
+    height: 716rpx;
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+    justify-content: flex-end;
+
+    .progress {
+      position: absolute;
+      top: 35%;
+      right: 80%;
+      display: flex;
+      z-index: 2;
+      color: #ffffff;
+      font-size: 16rpx;
+      // background: rgba(255, 255, 255, 0.3);
+      padding: 2rpx 10rpx;
+      border-radius: 14rpx;
+
+      .block {
+        width: 30rpx;
+        height: 10rpx;
+        margin-left: 10rpx;
+        background: #fff;
+        border-radius: 10px;
+      }
+
+      .active {
+        background: #b4b4b4;
+      }
+    }
+
+    .goods-box {
+      position: absolute;
+      top: 10%;
+      z-index: 22;
+      margin-left: 20rpx;
+
+      .goods-title {
+        font-size: 70rpx;
+        color: #000;
+        margin-bottom: 10rpx;
+      }
+
+      .goods-subtitle {
+        font-size: 35rpx;
+        color: #8b8b8b;
+      }
+    }
+
+    .swiper {
+      height: 100%;
+      border-radius: 16rpx;
+
+      .swiper-item {
+        width: 100%;
+        height: 100%;
+        // border-radius: 16rpx;
+      }
+    }
+  }
+
+  .card-box {
+    background-color: white;
+    border-radius: 15rpx;
+    padding: 40rpx 20rpx;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    z-index: 9999;
+    margin: -15% 20rpx 20rpx 20rpx;
+
+    .title-moji {
+      font-size: 40rpx;
+      margin-bottom: 10rpx;
+      text-align: center;
+    }
+
+    .subtitle {
+      text-align: center;
+      font-size: 30rpx;
+      color: #8b8b8b;
+    }
+
+    .card-item{
+      position: relative;
+      flex: 1;
+    }
+    .card-item:nth-child(1){
+      ::after {
+        content: "";
+        position: absolute;
+        margin: 0 auto;
+        right: 0;
+        top: 30rpx;
+        width: 1px;
+        height: 120rpx;
+        background: #FFD9D9;
+      }
+    }
+
+    .card-img {
+      display: flex;
+      justify-content: center;
+      // padding: 40rpx 0 50rpx 0;
+
+      .card-item-img {
+        width: 90rpx;
+        height: 90rpx;
+      }
+    }
+
+    // height: 300rpx;
+  }
+}
+
+.search-box {
+  width: 100vw;
+}
+
+.swiper-box {
+  position: relative;
+  margin: 0 24rpx 10rpx;
+  padding-top: 20rpx;
+  width: 702rpx;
+  height: 280rpx;
+  border-radius: 16rpx;
+
+  .progress {
+    position: absolute;
+    top: 38rpx;
+    right: 20rpx;
+    z-index: 2;
+    color: #ffffff;
+    font-size: 16rpx;
+    background: rgba(255, 255, 255, 0.3);
+    padding: 2rpx 10rpx;
+    border-radius: 14rpx;
+  }
+
+  .swiper {
+    position: relative;
+    height: 100%;
+    padding: 0 10rpx;
+
+    .swiper-item {
+      width: 100%;
+      height: 100%;
+      border-radius: 16rpx;
+      object-fit: cover;
+    }
+  }
+}
+
+.discount-list {
+  display: flex;
+  flex-wrap: wrap;
+  width: 100%;
+  // padding: 30rpx 0;
+  // margin: 0 0rpx 0rpx;
+  background: #fafafa;
+  border-radius: 16rpx;
+  position: relative;
+  top: 0rpx;
+  padding-top: 20rpx;
+
+  .discount-item {
+    width: 20%;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-top: 10rpx;
+    margin-bottom: 10rpx;
+    position: relative;
+
+    .icon {
+      width: 56rpx;
+      height: 56rpx;
+    }
+
+    .title {
+      font-size: 26rpx;
+      margin-top: 10rpx;
+    }
+
+    .tag {
+      position: absolute;
+      top: -20rpx;
+      left: 50%;
+      background: #ff0615;
+      box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255, 255, 255, 0.16);
+      border-radius: 12rpx 14rpx 14rpx 0rpx;
+      color: #fff;
+      white-space: nowrap;
+      font-size: 18rpx;
+      line-height: -14rpx;
+      height: 24rpx;
+      padding: 0 10rpx;
+      // width: fit-content;
+      background-size: 100% 34rpx;
+    }
+
+    .desc {
+      color: #ff0817;
+      font-size: 16rpx;
+      text-align: center;
+      margin-top: 4rpx;
+    }
+  }
+}
+
+.sub-title {
+  margin: 20rpx 0;
+  padding-left: 40rpx;
+  font-size: 30rpx;
+  font-weight: bold;
+}
+
+.goods-list {
+  border-radius: 16rpx 16rpx 0 0;
+}
+
+.zs-list {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: space-between;
+  padding: 0 24rpx;
+
+  .left {
+    .adv-swiper {
+      width: 340rpx;
+      height: 444rpx;
+      margin-bottom: 25rpx;
+
+      .adv-item {
+        width: 340rpx;
+        height: 444rpx;
+      }
+    }
+  }
+
+  .right {}
+
+  .store-item {
+    width: 340rpx;
+    margin-bottom: 25rpx;
+    // box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
+    border-radius: 16rpx;
+    background: #fff;
+
+    .icon {
+      width: 100%;
+      height: 300rpx;
+      border-radius: 16rpx 16rpx 0 0;
+    }
+
+    .info {
+      padding: 20rpx;
+      background: #fff;
+      border-radius: 0 0 16rpx 16rpx;
+      position: relative;
+
+      .title {
+        // font-weight: bold;
+        width: 100%;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+      }
+
+      .tags {
+        display: flex;
+        align-items: center;
+
+        .tag-item {
+          line-height: 50rpx;
+          border-radius: 8rpx;
+          padding: 6rpx 0;
+          font-size: 24rpx;
+          margin-left: 10rpx;
+          display: flex;
+
+          .label {
+            background: #fff;
+            color: #fe5b47;
+            padding: 0 10rpx;
+            border-radius: 8rpx 0 0 8rpx;
+          }
+
+          .value {
+            color: #fff;
+            background: rgba(255, 255, 255, 0.2);
+            padding: 0 14rpx;
+            border-radius: 0 8rpx 8rpx 0;
+          }
+        }
+      }
+
+      .goods-price {
+        display: flex;
+        align-items: center;
+        margin-top: 15rpx;
+        justify-content: space-between;
+        color: #202020;
+
+        .distance {
+          color: #999;
+        }
+
+        .position {
+          color: 999;
+          width: 25rpx;
+          height: 29rpx;
+          margin-right: 8rpx;
+        }
+      }
+    }
+  }
+}
+</style>

+ 12 - 3
pages.json

@@ -382,8 +382,7 @@
 				}
 
 			]
-		},
-		
+		},	
 		{
 			"root": "trip", //出行
 			"pages": [
@@ -511,8 +510,18 @@
 				}
 		
 			]
+		},
+		{
+			"root": "milktea",
+			"pages": [
+				{
+					"path": "index",
+					"style": {
+						"navigationStyle": "custom"
+					}
+				}
+			]
 		}
-
 	],
 	"tabBar": {
 		"color": "#AAAAAA",

+ 32 - 82
pages/index/index.vue

@@ -2,10 +2,7 @@
   <view>
     <zs-skeleton type="index" :loading="loading"></zs-skeleton>
     <view class="navBarBox">
-      <view
-        class="statusBar"
-        :style="{ paddingTop: statusBarHeight + 'px' }"
-      ></view>
+      <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
       <view class="navBar">
         <view>印象贵大文创</view>
         <image class="logo" mode="scaleToFill"></image>
@@ -13,48 +10,24 @@
     </view>
     <view class="content">
       <view @click="handleSearch" class="search-box">
-        <zs-search
-          style="margin-top: 10px"
-          :showBtn="false"
-          :showPrefix="false"
-          :readOnly="true"
-          placeholder="请输入商品名称"
-          height="80"
-          bgColor="#F6F6F6"
-        ></zs-search>
+        <zs-search style="margin-top: 10px" :showBtn="false" :showPrefix="false" :readOnly="true" placeholder="请输入商品名称"
+          height="80" bgColor="#F6F6F6"></zs-search>
       </view>
 
       <view class="swiper-box">
         <view class="progress">
           {{ current + 1 + "/" + advList.length }}
         </view>
-        <swiper
-          class="swiper"
-          @change="swiperChange"
-          :current="current"
-          :indicator-dots="false"
-          circular
-          :autoplay="true"
-          :interval="3000"
-          :duration="1000"
-        >
-          <swiper-item
-            v-for="(item, index) in advList"
-            :key="item.id"
-            @click="jump(item.jumpUrl)"
-          >
+        <swiper class="swiper" @change="swiperChange" :current="current" :indicator-dots="false" circular
+          :autoplay="true" :interval="3000" :duration="1000">
+          <swiper-item v-for="(item, index) in advList" :key="item.id" @click="jump(item.jumpUrl)">
             <image class="swiper-item" mode="" :src="item.advertsImg"> </image>
           </swiper-item>
         </swiper>
       </view>
 
       <view class="discount-list">
-        <view
-          class="discount-item"
-          v-for="(item, index) in discountsList"
-          :key="index"
-          @click="goDetail(item)"
-        >
+        <view class="discount-item" v-for="(item, index) in discountsList" :key="index" @click="goDetail(item)">
           <image class="icon" :src="item.columnImg" mode=""></image>
           <view class="title">{{ item.columnName }}</view>
         </view>
@@ -64,21 +37,9 @@
         <view class="progress">
           {{ current1 + 1 + "/" + advList1.length }}
         </view>
-        <swiper
-          class="swiper"
-          @change="swiperChangeAd"
-          :indicator-dots="false"
-          circular
-          :current="current1"
-          :autoplay="true"
-          :interval="3000"
-          :duration="1000"
-        >
-          <swiper-item
-            v-for="(item, index) in advList1"
-            :key="item.id"
-            @click="jump(item.jumpUrl)"
-          >
+        <swiper class="swiper" @change="swiperChangeAd" :indicator-dots="false" circular :current="current1"
+          :autoplay="true" :interval="3000" :duration="1000">
+          <swiper-item v-for="(item, index) in advList1" :key="item.id" @click="jump(item.jumpUrl)">
             <image class="swiper-item" mode="" :src="item.advertsImg"> </image>
           </swiper-item>
         </swiper>
@@ -91,18 +52,8 @@
       <view class="goods-list">
         <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
           <view class="left">
-            <view
-              class="store-item"
-              v-for="(item, index) in list"
-              :key="index"
-              @click="goGoodsDetail(item)"
-            >
-              <zs-img
-                :src="item.goodsImg"
-                width="340rpx"
-                height="340rpx"
-                mode="widthFix"
-              ></zs-img>
+            <view class="store-item" v-for="(item, index) in list" :key="index" @click="goGoodsDetail(item)">
+              <zs-img :src="item.goodsImg" width="340rpx" height="340rpx" mode="widthFix"></zs-img>
               <view class="info">
                 <view class="title">
                   {{ item.goodsName }}
@@ -115,18 +66,8 @@
             </view>
           </view>
           <view class="right">
-            <view
-              class="store-item"
-              v-for="(item, index) in list1"
-              :key="index"
-              @click="goGoodsDetail(item)"
-            >
-              <zs-img
-                :src="item.goodsImg"
-                width="340rpx"
-                height="340rpx"
-                mode="widthFix"
-              ></zs-img>
+            <view class="store-item" v-for="(item, index) in list1" :key="index" @click="goGoodsDetail(item)">
+              <zs-img :src="item.goodsImg" width="340rpx" height="340rpx" mode="widthFix"></zs-img>
               <view class="info">
                 <view class="title">
                   {{ item.goodsName }}
@@ -184,7 +125,7 @@ export default {
       },
     };
   },
-  onLoad() {},
+  onLoad() { },
   created() {
     this.loading = true;
     this.navBarHeight = this.$navHight(1);
@@ -197,7 +138,7 @@ export default {
       this.appSearch(),
       this.getBanner(),
       this.getCity(),
-    ]).then((res) => {});
+    ]).then((res) => { });
   },
   methods: {
     goGoodsDetail(item) {
@@ -283,7 +224,8 @@ export default {
       return new Promise((resolve, reject) => {
         searchMenu({
           currentPage: 1,
-          pageSize: 4,
+          pageSize: 5,
+          columnId: 0,
           belongType: 1,
           status: 1,
         }).then((res) => {
@@ -303,9 +245,17 @@ export default {
       //     // res.eventChannel.emit("banner", banner);
       //   },
       // });
-      uni.navigateTo({
-        url: `./searchResult?column=${item.columnName}&goodsCateId=${item.goodsCateId}&columnId=${item.id}`,
-      });
+      if (item.columnName == '奶茶单点') {
+        uni.navigateTo(
+          {
+            url: "/milktea/index"
+          }
+        )
+      } else {
+        uni.navigateTo({
+          url: `./searchResult?column=${item.columnName}&goodsCateId=${item.goodsCateId}&columnId=${item.id}`,
+        });
+      }
       console.log("item", item);
     },
     appSearch() {
@@ -313,7 +263,7 @@ export default {
       this.status = "loading";
       appSearch({
         ...this.query,
-        qualityType:1,
+        qualityType: 1,
       }).then((res) => {
         if (res.state == "Success") {
           this.loading = false;
@@ -544,8 +494,7 @@ page {
     }
   }
 
-  .right {
-  }
+  .right {}
 
   .store-item {
     width: 340rpx;
@@ -610,6 +559,7 @@ page {
         color: #ff4d3a;
         font-weight: bold;
         font-size: 30rpx;
+
         .distance {
           font-weight: normal;
           font-size: 20rpx;

+ 2 - 2
utils/config.js

@@ -1,5 +1,5 @@
-// export const BASE_URL = 'https://api.dev.zonelife.cn';
-export let BASE_URL = 'https://api.zonelife.cn';
+export const BASE_URL = 'https://api.dev.zonelife.cn';
+// export let BASE_URL = 'https://api.zonelife.cn';
 
 // export const SHOP_ID = '65aa19c3e2cc5b1095f087fc';//测试视频会员店铺
 export const SHOP_ID = '65aa17f980f6d56f44643a1f';//生产视频会员店铺