|
|
@@ -14,11 +14,11 @@
|
|
|
<view class="input-placeholder" @click="searchClick"
|
|
|
>请输入检索关键字</view
|
|
|
>
|
|
|
- <text class="iconfont2 msgCenter" @click="goToMsg()">
|
|
|
+ <view class="msgCenter" @click="goToMsg()">
|
|
|
<!--  -->
|
|
|
<uv-icon name="chat" color="#ffffff" size="28"></uv-icon>
|
|
|
<text v-if="msgCenter == 0 ? false : msgCenter">{{ msgCenter }}</text>
|
|
|
- </text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="u-skeleton">
|
|
|
@@ -86,24 +86,22 @@
|
|
|
</view>
|
|
|
<!-- 惠选专区 hxCateList-->
|
|
|
<ChoiceZone
|
|
|
- :hxCateList="hxCateList"
|
|
|
+ ref="choiceZoneRef"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
@jumpHxCate="jumpHxCate"
|
|
|
/>
|
|
|
|
|
|
<!-- 限时秒杀 -->
|
|
|
<Seckill
|
|
|
+ ref="seckillRef"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
- :itemsDis2="itemsDis2"
|
|
|
- :activeBannerIndex2="activeBannerIndex2"
|
|
|
@goDetail="goDetail"
|
|
|
- @imgActiveFun2="imgActiveFun2"
|
|
|
@goProductDetails="goProductDetails"
|
|
|
/>
|
|
|
|
|
|
<!-- 拼团购 -->
|
|
|
<GroupBuy
|
|
|
- :groupList="groupList"
|
|
|
+ ref="groupBuyRef"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
:bgImage="bgImage.image2"
|
|
|
@goDetail="goDetail"
|
|
|
@@ -112,7 +110,7 @@
|
|
|
|
|
|
<!-- 热门推荐 -->
|
|
|
<HotRecommend
|
|
|
- :recommendList="recommendList"
|
|
|
+ ref="hotRecommendRef"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
:bgImage="bgImage.image3"
|
|
|
@goDetail="goDetail"
|
|
|
@@ -121,23 +119,19 @@
|
|
|
|
|
|
<!-- 本月热销 -->
|
|
|
<MonthlyBestSeller
|
|
|
- :hotList="hotList"
|
|
|
+ ref="monthlyBestSellerRef"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
:bgImage="bgImage.image4"
|
|
|
- :itemsDis="itemsDis"
|
|
|
- :lineList="lineList"
|
|
|
- :activeBannerIndex="activeBannerIndex"
|
|
|
@goDetail="goDetail"
|
|
|
@goProductDetails="goProductDetails"
|
|
|
- @imgActiveFun="imgActiveFun"
|
|
|
/>
|
|
|
|
|
|
<!-- 猜你喜欢 -->
|
|
|
<GuessYouLike
|
|
|
+ ref="guessYouLikeRef"
|
|
|
:goodsList="goodsList"
|
|
|
:skeletonShow="skeletonShow"
|
|
|
:bgImage="bgImage.image5"
|
|
|
- :status="status"
|
|
|
@goDetail="goDetail"
|
|
|
@goProductDetails="goProductDetails"
|
|
|
/>
|
|
|
@@ -156,17 +150,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, onMounted, getCurrentInstance } from "vue";
|
|
|
+import { ref, reactive } from "vue";
|
|
|
import {
|
|
|
onLoad,
|
|
|
onShow,
|
|
|
onPullDownRefresh,
|
|
|
- onReachBottom,
|
|
|
onPageScroll,
|
|
|
onShareAppMessage,
|
|
|
} 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 ChoiceZone from "./components/ChoiceZone.vue";
|
|
|
@@ -177,6 +169,13 @@ import MonthlyBestSeller from "./components/MonthlyBestSeller.vue";
|
|
|
import GuessYouLike from "./components/GuessYouLike.vue";
|
|
|
import utils from "@/util/index.js";
|
|
|
|
|
|
+const choiceZoneRef = ref(null);
|
|
|
+const seckillRef = ref(null);
|
|
|
+const groupBuyRef = ref(null);
|
|
|
+const hotRecommendRef = ref(null);
|
|
|
+const monthlyBestSellerRef = ref(null);
|
|
|
+// const guessYouLikeRef = ref(null);
|
|
|
+
|
|
|
// 响应式数据
|
|
|
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
|
|
|
const menuButtonHeight = ref(0);
|
|
|
@@ -186,22 +185,10 @@ try {
|
|
|
console.log(error);
|
|
|
}
|
|
|
const showTopSearch = ref(true);
|
|
|
-
|
|
|
-const keyWord = ref("");
|
|
|
-const groupList = ref([]); //团购
|
|
|
-const hotList = ref([]); //本月热销
|
|
|
-const recommendList = ref([]); //推荐
|
|
|
const shopBanner = ref([]); //轮播图
|
|
|
const goodsList = ref([]); //猜你喜欢
|
|
|
-const itemsDis = ref(1);
|
|
|
-const activeBannerIndex = ref(0);
|
|
|
-
|
|
|
-const page = ref(1);
|
|
|
-const status = ref("more");
|
|
|
const msgCenter = ref(null);
|
|
|
const cateList = ref([]); // 一级分类
|
|
|
-const hxCateList = ref([]);
|
|
|
-const lineList = ref(0);
|
|
|
const homeBanner1 = ref({});
|
|
|
const skeletonShow = ref(true);
|
|
|
|
|
|
@@ -234,11 +221,10 @@ const getHomeBanner1 = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const init = () => {
|
|
|
- page.value = 1;
|
|
|
- getAll();
|
|
|
+const init = () => {
|
|
|
+ getBanner();
|
|
|
getOneCate();
|
|
|
- // getHxCateList();
|
|
|
+ getHomeBanner1();
|
|
|
};
|
|
|
|
|
|
// 跳转消息页面
|
|
|
@@ -262,15 +248,6 @@ const goProductDetails = (url) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const getAll = () => {
|
|
|
- // rest();
|
|
|
- getBanner();
|
|
|
- // seckillList();
|
|
|
- // getgroupList();
|
|
|
- recommend();
|
|
|
- hotSale();
|
|
|
- // guessLike();
|
|
|
-};
|
|
|
|
|
|
/**获得消息数量 */
|
|
|
const getmessageNum = () => {
|
|
|
@@ -296,14 +273,6 @@ const getOneCate = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const getHxCateList = () => {
|
|
|
- uni.$uv.$http.get("/hxcategory/home/recommend/4").then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- hxCateList.value = res.list;
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
|
|
|
const jumpHxCate = (item, area_feature) => {
|
|
|
let url = `/pages/freeCollection/index`;
|
|
|
@@ -332,103 +301,6 @@ const getBanner = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const imgActiveFun = (e) => {
|
|
|
- activeBannerIndex.value = e.detail.current;
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-/**团购 */
|
|
|
-const getgroupList = () => {
|
|
|
- uni.$uv.$http
|
|
|
- .get(
|
|
|
- `/groupbuy/activitygoods/will-you-spell`,
|
|
|
- {
|
|
|
- limit: 10,
|
|
|
- page: 1,
|
|
|
- },
|
|
|
- false
|
|
|
- )
|
|
|
- .then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- if (res.list.length > 0) {
|
|
|
- groupList.value = res.list;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-/**热门推荐 */
|
|
|
-const recommend = () => {
|
|
|
- shopProductList_Api({
|
|
|
- limit: 6,
|
|
|
- recommendStatus: 1,
|
|
|
- }).then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- recommendList.value = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-/**本月热销 */
|
|
|
-const hotSale = () => {
|
|
|
- shopProductList_Api({
|
|
|
- limit: 12,
|
|
|
- hot: 1,
|
|
|
- }).then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- let list = res.data || [];
|
|
|
- hotList.value = res.data;
|
|
|
- if (hotList.value.length > 2) {
|
|
|
- lineList.value = hotList.value.length - 2;
|
|
|
- }
|
|
|
- if (list.length <= 3) {
|
|
|
- itemsDis.value = list.length;
|
|
|
- }
|
|
|
- if (list.length > 3 && list.length <= 6) {
|
|
|
- itemsDis.value = 3;
|
|
|
- }
|
|
|
- if (list.length > 6 && list.length <= 9) {
|
|
|
- itemsDis.value = 3;
|
|
|
- }
|
|
|
- if (list.length > 9 && list.length <= 12) {
|
|
|
- itemsDis.value = 3;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-/**猜你喜欢 */
|
|
|
-const guessLike = () => {
|
|
|
- keyWord.value = uni.getStorageSync("history")
|
|
|
- ? uni.getStorageSync("history").join(",")
|
|
|
- : "";
|
|
|
- uni.$uv.$http
|
|
|
- .get(
|
|
|
- `/goods/smart`,
|
|
|
- {
|
|
|
- page: page.value,
|
|
|
- limit: 6,
|
|
|
- keywords: keyWord.value,
|
|
|
- },
|
|
|
- false
|
|
|
- )
|
|
|
- .then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- goodsList.value =
|
|
|
- page.value == 1
|
|
|
- ? res.page.list
|
|
|
- : goodsList.value.concat(res.page.list);
|
|
|
- if (res.page.totalPage <= res.page.currPage) {
|
|
|
- status.value = "noMore";
|
|
|
- } else {
|
|
|
- status.value = "more";
|
|
|
- }
|
|
|
- skeletonShow.value = false;
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
const goDetail = (url, isNeedLogin, tabShow = false) => {
|
|
|
if ((isNeedLogin && uni.getStorageSync("apiToken") == "") || null) {
|
|
|
uni.$uv.toast("请先登录");
|
|
|
@@ -445,15 +317,6 @@ const goDetail = (url, isNeedLogin, tabShow = false) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-/**重置数据*/
|
|
|
-const rest = () => {
|
|
|
- goodsList.value = [];
|
|
|
- shopBanner.value = [];
|
|
|
- recommendList.value = [];
|
|
|
- hotList.value = [];
|
|
|
- groupList.value = [];
|
|
|
-};
|
|
|
-
|
|
|
const toCartPage = () => {
|
|
|
uni.switchTab({
|
|
|
url: "/pages/tabtar/shoppingCart",
|
|
|
@@ -464,7 +327,6 @@ const toCartPage = () => {
|
|
|
onLoad(() => {
|
|
|
skeletonShow.value = false;
|
|
|
init();
|
|
|
- getHomeBanner1();
|
|
|
});
|
|
|
|
|
|
onShow(() => {
|
|
|
@@ -472,24 +334,26 @@ onShow(() => {
|
|
|
});
|
|
|
|
|
|
onPullDownRefresh(() => {
|
|
|
- return;
|
|
|
- page.value = 1;
|
|
|
- getAll();
|
|
|
- getOneCate();
|
|
|
- getHxCateList();
|
|
|
- getHomeBanner1();
|
|
|
+ init();
|
|
|
+ if(choiceZoneRef.value) choiceZoneRef.value.init();
|
|
|
+ if(seckillRef.value) seckillRef.value.init();
|
|
|
+ if(groupBuyRef.value) groupBuyRef.value.init();
|
|
|
+ if(hotRecommendRef.value) hotRecommendRef.value.init();
|
|
|
+ if(monthlyBestSellerRef.value) monthlyBestSellerRef.value.init();
|
|
|
+ // if(guessYouLikeRef.value) guessYouLikeRef.value.init();
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
uni.stopPullDownRefresh();
|
|
|
}, 300);
|
|
|
});
|
|
|
|
|
|
-onReachBottom(() => {
|
|
|
- return;
|
|
|
- if (status.value == "more") {
|
|
|
- page.value++;
|
|
|
- guessLike();
|
|
|
- }
|
|
|
-});
|
|
|
+// onReachBottom(() => {
|
|
|
+// return;
|
|
|
+// if (status.value == "more") {
|
|
|
+// page.value++;
|
|
|
+// guessLike();
|
|
|
+// }
|
|
|
+// });
|
|
|
|
|
|
onPageScroll((e) => {
|
|
|
//nvue暂不支持滚动监听,可用bindingx代替
|
|
|
@@ -508,7 +372,7 @@ onShareAppMessage((res) => {
|
|
|
}
|
|
|
return {
|
|
|
title: "商城",
|
|
|
- path: `/pages/index/lidaPage?shareId=${user.id || ""}`,
|
|
|
+ path: `/pages/tabtar/home?shareId=${user.id || ""}`,
|
|
|
};
|
|
|
});
|
|
|
</script>
|
|
|
@@ -780,7 +644,7 @@ onShareAppMessage((res) => {
|
|
|
padding-left: 80rpx;
|
|
|
// color: #666666;
|
|
|
background: rgba(255, 255, 255, 0.3);
|
|
|
- // background-image: url("/static/czd/search.png");
|
|
|
+ background-image: url("/static/search.png");
|
|
|
background-size: 40rpx 40rpx;
|
|
|
background-position: 24rpx 50%;
|
|
|
background-repeat: no-repeat;
|