From d2c5aeeb8e059dbdeb2a8b28d187bf5ad1d9dc82 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期一, 21 七月 2025 11:40:02 +0800 Subject: [PATCH] 解决主包过大问题 --- pages/cusbar/home/template/tpl_menu.vue | 62 pages/cusbar/home/title.vue | 193 + pages/product/home/template/tpl_flex_one.vue | 38 pages/product/home/template/tpl_flex_two.vue | 49 pages/product/home/template/tpl_group.vue | 40 pages/cusbar/home/template/tpl_join_group.vue | 90 pages/product/m-goods-recommend/index.vue | 2 pages/cusbar/home/views.vue | 250 ++ pages/product/home/template/tpl.scss | 32 pages/product/home/template/tpl_promotions_detail.vue | 274 ++ pages/cusbar/home/template/tpl_flex_three.vue | 40 pages/cusbar/home/template/tpl_group.vue | 40 pages/cusbar/home/template/tpl.scss | 32 pages/product/home/template/tpl_left_one_right_two.vue | 46 pages/product/home/index.vue | 43 pages/product/home/template/tpl_flex_five.vue | 32 pages/product/home/template/tpl.js | 208 + pages/product/home/template/tpl_spike.vue | 38 pages/product/goods.vue | 26 pages/cusbar/home/template/tpl_goods.vue | 263 ++ pages.json | 399 +- pages/product/home/template/tpl_banner.vue | 38 pages/product/home/views.vue | 250 ++ pages/product/home/template/tpl_notice.vue | 50 pages/product/home/template/tpl_search.vue | 64 pages/cusbar/home/template/tpl.js | 208 + pages/cusbar/home/template/tpl_flex_two.vue | 49 pages/cusbar/home/template/tpl_spike.vue | 38 pages/cusbar/home/template/tpl_promotions_detail.vue | 274 ++ pages/cusbar/home/template/tpl_title.vue | 58 pages/product/home/template/tpl_flex_four.vue | 36 pages/cusbar/home/template/tpl_left_one_right_two.vue | 46 pages/cusbar/home/web-view.vue | 53 pages/product/home/web-view.vue | 53 pages/cusbar/home/template/tpl_text_picture.vue | 101 pages/product/home/template/tpl_flex_three.vue | 40 pages/cusbar/home/template/fetch_coupon.vue | 172 + pages/cusbar/home/template/tpl_flex_five.vue | 32 pages/product/home/template/tpl_text_picture.vue | 101 pages/product/home/template/tpl_title.vue | 58 pages/cusbar/home/template/tpl_notice.vue | 50 pages/product/home/template/tpl_goods.vue | 263 ++ pages/product/home/template/tpl_join_group.vue | 90 pages/cusbar/home/template/tpl_flex_four.vue | 36 pages/cusbar/home/template/tpl_search.vue | 64 pages/product/home/template/tpl_top_two_bottom_one.vue | 80 pages/product/shopPage.vue | 32 pages/cusbar/home/template/tpl_flex_one.vue | 38 pages/promotion/m-goods-recommend/README.md | 10 pages/cusbar/home/template/tpl_top_one_bottom_two.vue | 73 pages/product/home/template/tpl_hot_zone.vue | 57 pages/cusbar/home/template/tpl_left_two_right_one.vue | 45 pages/product/home/template/tpl_menu.vue | 62 pages/cusbar/home/template/tpl_hot_zone.vue | 57 pages/cusbar/home/template/tpl_top_two_bottom_one.vue | 80 pages/product/home/template/tpl_top_one_bottom_two.vue | 73 pages/subComponents/comment.vue | 379 +++ pages/product/home/template/advertising.scss | 57 pages/cusbar/home/template/tpl_banner.vue | 38 pages/cusbar/home/index.vue | 43 pages/cusbar/home/template/advertising.scss | 57 pages/product/home/template/fetch_coupon.vue | 172 + pages/product/home/template/tpl_integral.vue | 85 pages/product/home/template/tpl_left_two_right_one.vue | 45 pages/promotion/m-goods-recommend/index.vue | 137 + pages/cusbar/home/template/tpl_integral.vue | 85 pages/product/home/title.vue | 193 + 67 files changed, 6,098 insertions(+), 221 deletions(-) diff --git a/pages.json b/pages.json index 93752ba..4c5472b 100644 --- a/pages.json +++ b/pages.json @@ -2,8 +2,8 @@ "easycom": { "autoscan": true, "custom": { - "^u-(.*)": "@/pages/subComponents/uview-components/uview-ui/components/u-$1/u-$1.vue", - "__placeholder__": true + "^u-(.*)": "@/pages/subComponents/uview-components/uview-ui/components/u-$1/u-$1.vue", + "__placeholder__": true //uview, // "^uni-(.*)": "@/uni_modules/uni-$1/components/uni-$1/uni-$1.vue" // uniapp缁勪欢 } @@ -146,18 +146,18 @@ // } // } // } - // , - // { - // "path": "components/m-buy/goods", - // "style": { - // "navigationBarTitleText": "", - // "componentPlaceholder": { - // "u-popup": "view", - // "u-image": "view", - // "u-alert-tips": "view" - // } - // } - // } + // , + // { + // "path": "components/m-buy/goods", + // "style": { + // "navigationBarTitleText": "", + // "componentPlaceholder": { + // "u-popup": "view", + // "u-image": "view", + // "u-alert-tips": "view" + // } + // } + // } // { // "path": "components/m-take-down-sale-goods/index", // "style": { @@ -530,13 +530,13 @@ "path": "deposit/index", "style": { // "navigationStyle": "custom" - "navigationBarTitleText": "棰勫瓨娆惧垪琛�" + "navigationBarTitleText": "棰勫瓨娆惧垪琛�" } }, { "path": "deposit/operation", "style": { - "navigationBarTitleText": "浣欓" + "navigationBarTitleText": "浣欓" // "navigationStyle": "custom" } }, @@ -651,11 +651,11 @@ // 闅愯棌绯荤粺瀵艰埅鏍� "enablePullDownRefresh": true, "app-plus": {}, - "componentPlaceholder": { - "u-navbar": "view", - "u-image": "view", - "u-avatar": "view" - } + "componentPlaceholder": { + "u-navbar": "view", + "u-image": "view", + "u-avatar": "view" + } } }, { @@ -770,12 +770,12 @@ "path": "msgTips/packageMsg/logisticsDetail", "style": { "navigationBarTitleText": "璁㈠崟璺熻釜", - "componentPlaceholder": { - "u-time-line": "view", - "u-time-line-item": "view", - "u-icon": "view", - "u-empty": "view" - } + "componentPlaceholder": { + "u-time-line": "view", + "u-time-line-item": "view", + "u-icon": "view", + "u-empty": "view" + } } }, { @@ -893,87 +893,111 @@ }, { "root": "pages/product", - // 鍏抽敭閰嶇疆 + // 鍏抽敭閰嶇疆 "pages": [ { "path": "shopPage", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-image": "view", + "u-navbar": "view", + "u-no-network": "view", + "u-icon": "view", + "tpl_banner": "view", + "tpl_title": "view", + "tpl_left_one_right_two":"view", + "tpl_left_two_right_one":"view", + "tpl_top_one_bottom_two":"view", + "tpl_top_two_bottom_one":"view", + "tpl_flex_three":"view", + "tpl_flex_five":"view", + "tpl_flex_four":"view", + "tpl_flex_two":"view", + "tpl_text_picture":"view", + "tpl_menu":"view", + "tpl_search":"view", + "tpl_flex_one":"view", + "tpl_goods":"view", + "tpl_group":"view" + + + } } }, - { - "path": "m-share/index", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "componentPlaceholder": { - "u-popup": "view", - "u-icon": "view" - } - } - }, - { - "path": "m-goods-list/list", - "style": { - "navigationBarTitleText": "", - "navigationStyle": "custom", - "app-plus": { - //app椤甸潰涓嶆樉绀烘粴鍔ㄦ潯 - "scrollIndicator": "none", - "bottom": "0", - "contentAdjust": "false", - "bounce": "none", - "safearea": { - "bottom": "none" - } - }, - "componentPlaceholder": { - "u-image": "view", - "u-loading": "view", - "u-tag": "view", - "u-icon": "view" - } - } - }, - { - "path": "m-buy/goods", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-popup": "view", - "u-image": "view", - "u-alert-tips": "view" - } - } - }, - { - "path": "m-take-down-sale-goods/index", - "style": { - "navigationBarTitleText": "", - "componentPlaceholder": { - "u-popup": "view" - } - } - }, - // { - // "path": "popups/popups", - // "style": { - // "navigationBarTitleText": "", - // "componentPlaceholder": { - // "u-icon": "view", - // "u-button": "view", - // "u-form": "view", - // "u-form-item": "view", - // "u-input": "view", - // "u-popup": "view", - // "u-search": "view", - // "u-loading": "view", - // "u-navbar": "view", - // "u-image": "view", - // "u-loadmore": "view" - // } - // } - // }, + { + "path": "m-goods-list/list", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "app-plus": { + //app椤甸潰涓嶆樉绀烘粴鍔ㄦ潯 + "scrollIndicator": "none", + "bottom": "0", + "contentAdjust": "false", + "bounce": "none", + "safearea": { + "bottom": "none" + } + }, + "componentPlaceholder": { + "u-image": "view", + "u-loading": "view", + "u-tag": "view", + "u-icon": "view" + } + } + }, + { + "path": "m-share/index", + "style": { + "navigationBarTitleText": "", + "navigationStyle": "custom", + "componentPlaceholder": { + "u-popup": "view", + "u-icon": "view" + } + } + }, + { + "path": "m-buy/goods", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-popup": "view", + "u-image": "view", + "u-alert-tips": "view" + } + } + }, + { + "path": "m-take-down-sale-goods/index", + "style": { + "navigationBarTitleText": "", + "componentPlaceholder": { + "u-popup": "view" + } + } + }, + // { + // "path": "popups/popups", + // "style": { + // "navigationBarTitleText": "", + // "componentPlaceholder": { + // "u-icon": "view", + // "u-button": "view", + // "u-form": "view", + // "u-form-item": "view", + // "u-input": "view", + // "u-popup": "view", + // "u-search": "view", + // "u-loading": "view", + // "u-navbar": "view", + // "u-image": "view", + // "u-loadmore": "view" + // } + // } + // }, { "path": "shopList", "style": { @@ -984,7 +1008,10 @@ { "path": "licencePhoto", "style": { - "navigationBarTitleText": "钀ヤ笟鎵х収" + "navigationBarTitleText": "钀ヤ笟鎵х収", + "componentPlaceholder": { + "u-image": "view" + } } }, { @@ -992,19 +1019,19 @@ "style": { "navigationBarTitleText": "", "navigationStyle": "custom", - "componentPlaceholder": { - "u-icon": "view", - "u-button": "view", - "u-form": "view", - "u-form-item": "view", - "u-input": "view", - "u-popup": "view", - "u-search": "view", - "u-loading": "view", - "u-navbar": "view", - "u-image": "view", - "u-loadmore": "view" - } + "componentPlaceholder": { + "u-icon": "view", + "u-button": "view", + "u-form": "view", + "u-form-item": "view", + "u-input": "view", + "u-popup": "view", + "u-search": "view", + "u-loading": "view", + "u-navbar": "view", + "u-image": "view", + "u-loadmore": "view" + } } }, { @@ -1027,7 +1054,7 @@ "u-icon": "view", "u-navbar": "view", "u-popup": "view", - "popups":"view" + "popups": "view" } } }, @@ -1127,7 +1154,13 @@ "style": { "navigationBarTitleText": "鍟嗗搧璇勪环", //app椤甸潰涓嶆樉绀烘粴鍔ㄦ潯 - "scrollIndicator": "none" + "scrollIndicator": "none", + "componentPlaceholder": { + "u-empty": "view", + "u-loadmore": "view", + "u-image": "view", + "u-empty": "view" + } } }, { @@ -1146,7 +1179,6 @@ }, { "root": "pages/floor", - "pages": [ { "path": "empty" @@ -1199,7 +1231,6 @@ }, { "root": "pages/passport", - "pages": [ { "path": "login", @@ -1308,7 +1339,6 @@ }, { "root": "pages/promotion", - "pages": [ { "path": "seckill", @@ -1385,7 +1415,6 @@ }, { "root": "pages/cart", - "pages": [ { "path": "coupon/myCoupon", @@ -1430,11 +1459,11 @@ "popGesture": "none" //绂佹渚ф粦閫�鍑� }, - "componentPlaceholder": { - "u-count-down": "view", - "u-row": "view", - "u-icon": "view" - } + "componentPlaceholder": { + "u-count-down": "view", + "u-row": "view", + "u-icon": "view" + } } }, { @@ -1462,7 +1491,6 @@ }, { "root": "pages/order", - "pages": [ { "path": "complain/complain", @@ -1531,17 +1559,17 @@ "path": "orderDetail", "style": { "navigationBarTitleText": "璁㈠崟璇︽儏", - "componentPlaceholder": { - "u-icon": "view", - "u-image": "view", - "u-tag": "view", - "u-button": "view", - "u-popup": "view", - "u-radio-group": "view", - "u-radio": "view", - "u-toast": "view", - "u-modal": "view" - } + "componentPlaceholder": { + "u-icon": "view", + "u-image": "view", + "u-tag": "view", + "u-button": "view", + "u-popup": "view", + "u-radio-group": "view", + "u-radio": "view", + "u-toast": "view", + "u-modal": "view" + } } }, { @@ -1554,23 +1582,23 @@ "path": "evaluate/evaluateDetail", "style": { "navigationBarTitleText": "璇勪环璇︽儏", - "componentPlaceholder": { - "u-image": "view" - } + "componentPlaceholder": { + "u-image": "view" + } } }, { "path": "evaluate/releaseEvaluate", "style": { "navigationBarTitleText": "鍙戝竷璇勪环", - "componentPlaceholder": { - "u-icon": "view", - "u-image": "view", - "u-input": "view", - "u-upload": "view", - "u-rate": "view", - "u-toast": "view" - } + "componentPlaceholder": { + "u-icon": "view", + "u-image": "view", + "u-input": "view", + "u-upload": "view", + "u-rate": "view", + "u-toast": "view" + } } }, { @@ -1626,10 +1654,10 @@ "path": "afterSales/afterSalesSelect", "style": { "navigationBarTitleText": "鐢宠鍞悗", - "componentPlaceholder": { - "u-image": "view", - "u-icon": "view" - } + "componentPlaceholder": { + "u-image": "view", + "u-icon": "view" + } } }, { @@ -1672,7 +1700,6 @@ }, { "root": "pages/health", - "pages": [ { "path": "healthVideo", @@ -1685,7 +1712,6 @@ }, { "root": "pages/tabbar/home", - "pages": [ { "path": "web-view", @@ -1695,7 +1721,6 @@ }, { "root": "pages/kitchen", - "pages": [ { "path": "KitchenVideo", @@ -1707,33 +1732,32 @@ } ] }, - { - "root": "pages/subComponents", - "pages": [{ - "path" : "empty/empty", - "style" : - { - "navigationBarTitleText" : "鍒嗗寘鍗犱綅" - } - },{ - "path" : "popups/popups", - "style" : - { - "componentPlaceholder": { - "u-modal": "view", - "u-tabs": "view", - "u-image": "view", - "u-search": "view", - "u-icon": "view", - "u-loadmore": "view" - } - } - } - ] - }, + { + "root": "pages/subComponents", + "pages": [ + { + "path": "empty/empty", + "style": { + "navigationBarTitleText": "鍒嗗寘鍗犱綅" + } + }, + { + "path": "popups/popups", + "style": { + "componentPlaceholder": { + "u-modal": "view", + "u-tabs": "view", + "u-image": "view", + "u-search": "view", + "u-icon": "view", + "u-loadmore": "view" + } + } + } + ] + }, { "root": "pages/tabbar/user", - "pages": [ { "path": "my", @@ -1752,7 +1776,6 @@ }, { "root": "pages/supplier/suppler-order", - "pages": [ { "path": "suppler-order", @@ -1772,7 +1795,6 @@ }, { "root": "pages/supplier/publish-goods", - "pages": [ { "path": "publishGoods", @@ -1801,7 +1823,6 @@ }, { "root": "pages/goods-manager", - "pages": [ { "path": "goodsList/goodsList", @@ -1838,7 +1859,6 @@ }, { "root": "pages/news", - "pages": [ { "path": "news", @@ -1855,8 +1875,7 @@ "u-loading": "view", "u-navbar": "view", "u-loadmore": "view", - "u-empty": "view" - + "u-empty": "view" } } }, @@ -1882,7 +1901,6 @@ }, { "root": "pages/userPermissions", - "pages": [ { "path": "addStoreMember", @@ -1929,7 +1947,6 @@ }, { "root": "pages/commodity-square", - "pages": [ { "path": "commoditySquare", @@ -1952,7 +1969,6 @@ }, { "root": "pages/navigation", - "pages": [ { "path": "search/searchPage", @@ -1981,7 +1997,6 @@ }, { "root": "pages/cusbar", - "pages": [ { "path": "special/special", diff --git a/pages/cusbar/home/index.vue b/pages/cusbar/home/index.vue new file mode 100644 index 0000000..aa8b37a --- /dev/null +++ b/pages/cusbar/home/index.vue @@ -0,0 +1,43 @@ +<template> + <div class="wrapper"> + <!-- 妤煎眰瑁呬慨缁勪欢 --> + <tpl ref="tpl" /> + </div> +</template> +<script> +import tpl from "@/pages/tabbar/home/views.vue"; + +export default { + data() { + return { + background: { + backgroundColor: "#fff", + }, + }; + }, + onShow(){ + setTimeout(()=>{ + this.$refs.tpl.fetchCoupon(); + },1000) + }, + methods: { + + }, + onReachBottom(){ + // 缁欏瓙绾х洃鍚Е搴曞姞杞� + uni.$emit('onReachBottom',true) + }, + + onPullDownRefresh() { + this.$refs.tpl.init(); + + uni.stopPullDownRefresh(); + }, + components: { + tpl, + }, +}; +</script> + +<style lang="scss" scoped> +</style> diff --git a/pages/cusbar/home/template/advertising.scss b/pages/cusbar/home/template/advertising.scss new file mode 100644 index 0000000..be5228c --- /dev/null +++ b/pages/cusbar/home/template/advertising.scss @@ -0,0 +1,57 @@ +.position-box{ + position: absolute; + right: 0; + bottom: 0; +} +.join-box { + display: flex; + } + .item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } + } + .join-item { + flex: 1; + } + .item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; + } + .item-img-box { + position: relative; + } + .item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } + } + .item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; + } + .join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } + } \ No newline at end of file diff --git a/pages/cusbar/home/template/fetch_coupon.vue b/pages/cusbar/home/template/fetch_coupon.vue new file mode 100644 index 0000000..7058fd8 --- /dev/null +++ b/pages/cusbar/home/template/fetch_coupon.vue @@ -0,0 +1,172 @@ +<template> + <div> + <u-popup v-model="enableShowCoupon" mode="center" width="550rpx" height="400px"> + <view style="height: 130rpx"> + <view + style=" + width: 200rpx; + height: 120rpx; + float: left; + line-height: 120rpx; + font-size: 35rpx; + color: #28a4f2; + font-weight: 600; + margin-left: 20rpx; + " + >浼樻儬鍒告椿鍔�</view + > + <view style="width: 120rpx; height: 120rpx; float: right"> + <image + @click="enableShowCoupon = false" + src="/static/cpauto1.png" + style="width: 100%; height: 100%" + ></image> + </view> + </view> + <scroll-view scroll-y="true" style="height: 620rpx"> + <!-- {{coupList}} --> + <view v-for="(item, index) in coupList" :key="index"> + <view class="grad1"> + <view style="float: right"> + <view v-if="item.couponType == 'DISCOUNT'" + >{{ item.discount }}鎶�</view + > + <view v-else + >浼樻儬閲戦锛�<span style="color: red; font-size: 32rpx">{{ + item.price | unitPrice + }}</span + >鍏�</view + > + <view + >婊�<span style="color: red; font-size: 32rpx" + >{{ item.consumeThreshold | unitPrice }}鍏�</span + >鍙敤</view + > + <view v-if="item.scopeType == 'ALL' && item.storeId == '0'" + >鍏ㄥ钩鍙�</view + > + <view v-if="item.scopeType == 'PORTION_GOODS_CATEGORY'" + >浠呴檺鍝佺被</view + > + <view v-else + >{{ + item.storeName == "platform" + ? "鍏ㄥ钩鍙�" + : item.storeName + "搴楅摵" + }}浣跨敤 + </view> + <view v-if="item.endTime" + >鏈夋晥鏈熻嚦锛歿{ item.endTime.split(" ")[0] }}</view + > + </view> + <view + style=" + color: white; + font-size: 28rpx; + font-weight: 500; + float: left; + writing-mode: vertical-rl; + flex: auto; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + " + @click="enableShowCoupon = false" + > + 绔嬪嵆浣跨敤 + </view> + </view> + </view> + </scroll-view> + </u-popup> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { getAutoCoup } from "@/api/login"; +import storage from "@/utils/storage.js"; +export default { + data() { + return { + storage, + enableShowCoupon: false, + coupList:[] + }; + }, + mounted() { + this.firstGetAuto(); + }, + methods: { + firstGetAuto() { + if(!this.$options.filters.isLogin('auth')) return false + let data = new Date(); + let now = data.getDate(); + let hours = data.getHours(); + let flagCoup = storage.getAutoCp(); + if ( + storage.getAutoCp() && + storage.getAutoCp() != "" && + storage.getAutoCp() != undefined && + storage.getAutoCp() != null + ) { + if (Number(now) > Number(flagCoup)) { + if (Number(hours) >= 6) { + storage.setAutoCp(now); + this.getAutoCp(); + } + } + } else { + this.getAutoCp(); + } + }, + getAutoCp() { + let data = new Date(); + let now = data.getDate(); + getAutoCoup().then((res) => { + console.log(res); + if (res.data.success) { + this.coupList.push(...res.data.result); + if (this.coupList != "") { + this.enableShowCoupon = true; + } else { + this.enableShowCoupon = false; + } + storage.setAutoCp(now); + let objs = {}; + this.coupList = this.coupList.reduce((cur, next) => { + //瀵硅薄鍘婚噸 + if (next.id != undefined) { + objs[next.id] ? "" : (objs[next.id] = true && cur.push(next)); + } + return cur; + }, []); + } + }); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.grad1 { + width: 500rpx; + height: 200rpx; + background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) + top left / 120rpx 51% no-repeat, + radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom + left / 120rpx 51% no-repeat, + radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right / + 380rpx 51% no-repeat, + radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom + right / 380rpx 51% no-repeat; + filter: drop-shadow(6rpx 6rpx 6rpx rgba(0, 0, 0, 0.3)); + margin: 30rpx auto; + padding-top: 2rpx; + padding-bottom: 10rpx; + padding-left: 38rpx; + padding-right: 30rpx; +} +</style> diff --git a/pages/cusbar/home/template/tpl.js b/pages/cusbar/home/template/tpl.js new file mode 100644 index 0000000..5701e89 --- /dev/null +++ b/pages/cusbar/home/template/tpl.js @@ -0,0 +1,208 @@ +/** 閰嶇疆妤煎眰妯″潡鐨勮烦杞� */ +export function modelNavigateTo(item) { + let val = item.url || item; + //閾炬帴璺宠浆鍒颁笓棰� + + if (val && val.id && val.pageType == "special") { + uni.navigateTo({ + url: `/pages/tabbar/special/special?id=${val.id}`, + }); + } + switch (val.___type || val.type) { + case "goods": + uni.navigateTo({ + url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId, + }); + break; + case "category": + if (val.id) { + uni.navigateTo({ + url: `/pages/navigation/search/searchPage?category=${val.id}`, + }); + } else { + uni.navigateTo({ + url: `/pages/navigation/search/searchPage`, + }); + } + break; + case "shops": + uni.navigateTo({ + url: `/pages/product/shopPage?id=${val.id}`, + }); + break; + // 娲诲姩 + case "marketing": + uni.navigateTo({ + url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, + }); + break; + case "pages": + uni.navigateTo({ + url: val.___path + "?id=" + val.id + "&title=" + val.title, + }); + break; + case "other": + switch (val.title || item.title) { + case "棣栭〉": + uni.switchTab({ + url: `/pages/tabbar/home/index`, + }); + break; + case "璐墿杞�": + uni.switchTab({ + url: `/pages/tabbar/cart/cartList`, + }); + return; + case "涓汉涓績": + uni.switchTab({ + url: `/pages/tabbar/user/my`, + }); + break; + case "鏀惰棌鍟嗗搧": + uni.navigateTo({ + url: `/pages/mine/myCollect`, + }); + break; + case "鎴戠殑璁㈠崟": + uni.navigateTo({ + url: `/pages/order/myOrder?status=0`, + }); + break; + case "棰嗗埜涓績": + uni.navigateTo({ + url: `/pages/cart/coupon/couponCenter`, + }); + break; + case "绛惧埌": + uni.navigateTo({ + url: `/pages/mine/signIn`, + }); + break; + case "绉掓潃棰戦亾": + uni.navigateTo({ + url: `/pages/promotion/seckill`, + }); + break; + case "鎷煎洟棰戦亾": + uni.navigateTo({ + url: `/pages/promotion/joinGroup`, + }); + break; + case "灏忕▼搴忕洿鎾�": + uni.navigateTo({ + url: `/pages/promotion/lives`, + }); + break; + case "鐮嶄环": + uni.navigateTo({ + url: `/pages/promotion/bargain/list`, + }); + break; + case "绉垎鍟嗗煄": + uni.navigateTo({ + url: `/pages/promotion/point/pointList`, + }); + break; + case "搴楅摵鍒楄〃": + uni.navigateTo({ + url: `/pages/product/shopList`, + }); + break; + default: + // #ifdef H5 + window.location.href = val.url || item.link; + // #endif + // #ifdef APP-PLUS + plus.runtime.openURL(val.url || item.link) //涓嶉渶瑕佹嫾鎺 + // #endif + break; + } + + break; + } +} + + + + +import config from "@/config/config"; + +async function scan() { + // #ifdef APP-PLUS + let isIos = plus.os.name == "iOS"; + // 鍒ゆ柇鏄惁鏄疘os + if (isIos) { + const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //鏄笉鏄涓�娆″紑鍚浉鏈� + if (iosFirstCamera !== "false") { + uni.setStorageSync("iosFirstCamera", "false"); //璁句负false灏变唬琛ㄤ笉鏄涓�娆″紑鍚浉鏈� + seacnCode(); + } else { + if (permision.judgeIosPermission("camera")) { + seacnCode(); + } else { + // 娌℃湁鏉冮檺鎻愰啋鏄惁鍘荤敵璇锋潈闄� + tipsGetSettings(); + } + } + } else { + /** + * TODO 瀹夊崜 鏉冮檺宸茬粡鎺堟潈浜嗭紝璋冪敤api鎬绘槸鏄剧ず鐢ㄦ埛宸叉案涔呮嫆缁濈敵璇枫�備汉鍌讳簡 + * TODO 濡傛灉xdm鏈夋洿濂界殑鍔炴硶璇峰湪 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 鎻愪笅璋㈣阿 + */ + seacnCode(); + } + + // #endif + + // #ifdef MP-WEIXIN + seacnCode(); + // #endif +} +/** + * 鎻愮ず鑾峰彇鏉冮檺 + */ +function tipsGetSettings() { + uni.showModal({ + title: "鎻愮ず", + content: "鎮ㄥ凡缁忓叧闂浉鏈烘潈闄�,鍘昏缃�", + success: function (res) { + if (res.confirm) { + if (isIos) { + plus.runtime.openURL("app-settings:"); + } else { + permision.gotoAppPermissionSetting(); + } + } + }, + }); +} + +function seacnCode() { + uni.scanCode({ + success: function (res) { + let path = encodeURIComponent(res.result); + + // WX_CODE 涓哄皬绋嬪簭鐮� + if (res.scanType == "WX_CODE") { + console.log(res); + uni.navigateTo({ + url: `/${res.path}`, + }); + } else { + config.scanAuthNavigation.forEach((src) => { + if (res.result.indexOf(src) != -1) { + uni.navigateTo({ + url: `/${res.result.substring(src.length)}`, + }); + } else { + setTimeout(() => { + uni.navigateTo({ + url: "/pages/tabbar/home/web-view?src=" + path, + }); + }, 100); + } + }); + } + }, + }); + } \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl.scss b/pages/cusbar/home/template/tpl.scss new file mode 100644 index 0000000..a9702fb --- /dev/null +++ b/pages/cusbar/home/template/tpl.scss @@ -0,0 +1,32 @@ +.image-mode { + width: 100%; + height: 100%; + display: block; + padding: 2rpx; +} +.layout { + padding: 16rpx; + margin: 8rpx 0; + background: #fff; +} +.layout, +.view-height-75, +.view-height-150 { + overflow: hidden; +} +.view-width-100 { + width: 100%; +} +.view-height-75 { + // height: 150rpx; +} +.view-height-150 { + // height: 300rpx; + flex: 1; +} + +.view-height-85 { + height: 170rpx; + flex: 1; +} + diff --git a/pages/cusbar/home/template/tpl_banner.vue b/pages/cusbar/home/template/tpl_banner.vue new file mode 100644 index 0000000..1442865 --- /dev/null +++ b/pages/cusbar/home/template/tpl_banner.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="box"> + <u-swiper @click="clickSwiper" interval="5000" duration="500" height="350" v-if="res" name="img" :list="res.list"> + <u-loading slot="loading"></u-loading> + </u-swiper> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "瀵艰埅鏍�", + props: ["res"], + watch: { + res: { + handler(newValue, oldValue) { + this.$set(this, "res", newValue); + }, + deep: true, + }, + }, + + mounted() { + + }, + methods: { + clickSwiper(index) { + modelNavigateTo(this.res.list[index]); + }, + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +</style> diff --git a/pages/cusbar/home/template/tpl_flex_five.vue b/pages/cusbar/home/template/tpl_flex_five.vue new file mode 100644 index 0000000..c7618ab --- /dev/null +++ b/pages/cusbar/home/template/tpl_flex_five.vue @@ -0,0 +1,32 @@ + +<template> + <div class="layout"> + <u-image width="140rpx" mode="aspectFit" height="140rpx" @click="modelNavigateTo(item)" class="image-mode" v-for="(item,index) in res.list" :key="index" :src="item.img" alt=""> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "浜斿垪鍗曡鍥剧墖妯″潡", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_flex_four.vue b/pages/cusbar/home/template/tpl_flex_four.vue new file mode 100644 index 0000000..c802a92 --- /dev/null +++ b/pages/cusbar/home/template/tpl_flex_four.vue @@ -0,0 +1,36 @@ + +<template> + <div class="layout"> + <u-image height="175rpx" mode="aspectFit" width="175rpx" @click="modelNavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "鍥涘垪鍗曡鍥剧墖妯″潡", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +img { + width: 84px; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_flex_one.vue b/pages/cusbar/home/template/tpl_flex_one.vue new file mode 100644 index 0000000..5c7ebc6 --- /dev/null +++ b/pages/cusbar/home/template/tpl_flex_one.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="flex-one"> + <u-image v-if="res.list[0].zoneInfo == ''" @click="modelNavigateTo(res.list[0])" width="100%" mode="aspectFit" height="280rpx" :src="res.list[0].img" alt=""></u-image> + <hotzone v-else :res="res"></hotzone> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +import hotzone from "@/pages/tabbar/home/template/tpl_hot_zone.vue"; + +export default { + title: "鍗曡鍥剧墖妯″潡", + components: { + hotzone, + }, + data() { + return { + modelNavigateTo + }; + }, + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.flex-one { + width: 100%; + display: block; + overflow: hidden; + > img { + width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_flex_three.vue b/pages/cusbar/home/template/tpl_flex_three.vue new file mode 100644 index 0000000..65831e1 --- /dev/null +++ b/pages/cusbar/home/template/tpl_flex_three.vue @@ -0,0 +1,40 @@ + +<template> + <div class="layout"> + <u-image @click="modelNavigateTo(item)" height="240rpx" width="240rpx" class="image-mode" :src="item.img" v-for="(item, index) in res.list" :key="index"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; + +export default { + title: "涓夊垪鍗曡鍥剧墖妯″潡", + props: ["res"], + mounted() { + + }, + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + padding: 0; + + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +img { + width: 111px; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_flex_two.vue b/pages/cusbar/home/template/tpl_flex_two.vue new file mode 100644 index 0000000..296dc35 --- /dev/null +++ b/pages/cusbar/home/template/tpl_flex_two.vue @@ -0,0 +1,49 @@ +<template> + <div class="layout"> + <div class="flex-two"> + <div class="flex-item" @click="modelNavigateTo(res.list[0])"> + <u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[0].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="flex-item" @click="modelNavigateTo(res.list[1])"> + <u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[1].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' + +import { modelNavigateTo } from "./tpl"; +export default { + title: "涓ゅ紶妯浘", + props: ["res"], + mounted() { + + }, + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.flex-two { + width: 100%; + display: flex; + overflow: hidden; +} +.flex-item { + width: 50%; + > img { + display: block; + max-width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_goods.vue b/pages/cusbar/home/template/tpl_goods.vue new file mode 100644 index 0000000..768e44a --- /dev/null +++ b/pages/cusbar/home/template/tpl_goods.vue @@ -0,0 +1,263 @@ +<template> + <div class="layout"> + <u-sticky> + <div class="goods-cell-title"> + <div + class="goods-item-title" + :class="{ 'selected-title': selected.index == index }" + @click="handleClickTitle(title, index)" + v-for="(title, index) in res.list[0].titleWay" + :key="index" + > + <h4 class="h4">{{ title.title }}</h4> + <div>{{ title.desc }}</div> + </div> + </div> + </u-sticky> + <div class="goods-list"> + <div + v-if=" + item.___index != undefined + ? selected.index == item.___index + : selected.val == item.type + " + @click="handleClick(item)" + class="goods-item" + v-for="(item, item_index) in res.list[0].listWay" + :key="item_index" + > + <div class="goods-img"> + <u-image + :src="item.img" + height="350rpx" + mode="aspectFit" + width="100%" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="goods-desc"> + <div class="goods-title"> + {{ item.title }} + </div> + <div class="goods-bottom"> + <div class="goods-price"> + 楼<span + >{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span + >.{{ $options.filters.goodsFormatPrice(item.price)[1] }} + </div> + </div> + </div> + </div> + + <div + v-if="res.list[0].titleWay[selected.index].bindCategory && goodsData.length" + v-for="(item, index) in goodsData" + :key="index" + class="goods-item" + @click="handleClick(item)" + > + <div class="goods-img"> + <u-image + :src="item.thumbnail" + height="350rpx" + mode="aspectFit" + width="100%" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="goods-desc"> + <div class="goods-title"> + {{ item.goodsName }} + </div> + <div class="goods-bottom"> + <div class="goods-price"> + 楼<span + >{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span + >.{{ $options.filters.goodsFormatPrice(item.price)[1] }} + </div> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { getGoodsList } from "@/api/goods.js"; +export default { + title: "鍟嗗搧鍒嗙被浠ュ強鍟嗗搧", + data() { + return { + selected: { + index: 0, + val: "", + }, + params: { + pageNumber: 1, + pageSize: 100, + categoryId: "", + }, + goodsData: [], //鍟嗗搧寰幆鍐呭 + goodsResult:"", //es鎬昏繑鍥炲唴瀹� + }; + }, + props: ["res","enableBottomLoad"], + watch: { + res: { + handler(val) { + // 鐩戝惉鐖剁骇鐨勫�� 濡傛灉鏈夊�煎皢鍊艰祴缁檚elected + if (val) { + console.log(val) + // 濡傛灉绗竴涓爣绛鹃〉缁戝畾涓哄晢鍝� + this.selected.val = this.res.list[0].listWay[0] ? this.res.list[0].listWay[0].type: ''; + // 濡傛灉绗竴涓爣绛句负缁戝畾涓哄垎绫� + this.res.list[0].titleWay[0].bindCategory ? this.initGoods(this.res.list[0].titleWay[0]) : '' + } + }, + immediate: true, + }, + }, + mounted() { + uni.$on('onReachBottom',()=>{ + if(this.enableBottomLoad && this.goodsResult.totalElements >= this.params.pageNumber * this.params.pageSize){ + this.params.pageNumber++ + this.initGoods(this.res.list[0].titleWay[this.selected.index]) + } + + }) + }, + destroyed(){ + uni.$off('onReachBottom') + }, + methods: { + handleClick(item) { + uni.navigateTo({ + url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, + }); + }, + closeGoods(val, index) { + this.res.list[0].listWay.splice(index, 1); + }, + async initGoods(val) { + if(this.enableBottomLoad) this.params.pageSize = 20 + val ? this.params.categoryId = val.bindCategory.id : ''; + const res = await getGoodsList(this.params); + if (res.data.success) { + this.goodsResult = res.data.result + const result = res.data.result.records + this.goodsData.push(...result); + console.log(this.goodsData) + } + }, + handleClickTitle(val, index) { + this.selected.index = index; + this.selected.val = val.title; + if (val.bindCategory) { + this.params.pageNumber = 1 + this.goodsData = [] + this.initGoods(val); + } + }, + }, +}; +</script> +<style lang="scss" scoped> +$w_94: 94%; + +.layout { + padding: 8px 0; + background: #f9f9f9; +} + +.selected-title { + > h4 { + font-size: 30rpx; + color: #000 !important; + } + + > div { + font-weight: bold; + color: $main-color !important; + } +} + +.goods-cell-title { + background: #f9f9f9; + padding: 10px; + transition: 0.35s; + display: flex; + + > .goods-item-title { + flex: 1; + text-align: center; + + > h4 { + font-size: 32rpx; + } + + > div { + color: #999; + font-size: 24rpx; + } + } +} + +.goods-list { + width: 100%; + display: flex; + flex-wrap: wrap; +} + +.goods-item { + width: 50%; + margin-bottom: 10px; + border-radius: 0.4em; + overflow: hidden; +} + +.goods-img { + position: relative; + margin: 0 auto; + // width: 158px; + width: $w_94; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; + overflow: hidden; + > img { + width: 100%; + height: 100%; + } +} + +.goods-desc { + border-bottom-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + width: $w_94; + background: #fff; + padding: 8rpx 0 8rpx 8rpx; + margin: 0 auto; + > .goods-title { + font-size: 24rpx; + height: 67rpx; + display: -webkit-box; + font-weight: 500; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + + > .goods-bottom { + display: flex; + font-weight: bold; + > .goods-price { + line-height: 2; + color: $main-color; + > span { + font-size: 42rpx; + } + } + } +} +</style> diff --git a/pages/cusbar/home/template/tpl_group.vue b/pages/cusbar/home/template/tpl_group.vue new file mode 100644 index 0000000..b234a80 --- /dev/null +++ b/pages/cusbar/home/template/tpl_group.vue @@ -0,0 +1,40 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" @click="modelNavigateTo(item)" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img class="item-img" src="https://picsum.photos/id/268/200/200" alt /> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�190.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +import { modelNavigateTo } from "./tpl"; +export default { + props: ["res"], + title: "鎷煎洟", + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +@import "./advertising.scss"; +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_hot_zone.vue b/pages/cusbar/home/template/tpl_hot_zone.vue new file mode 100644 index 0000000..ba51470 --- /dev/null +++ b/pages/cusbar/home/template/tpl_hot_zone.vue @@ -0,0 +1,57 @@ +<template> + <div class="layout"> + <div class="flex-one hot-image"> + <image mode="widthFix" :src="res.list[0].img" alt=""></image> + + <image + v-for="(area, index) in res.list[0].zoneInfo" + :key="index" + @click="modelNavigateTo(area)" + mode="widthFix" + class="hot-area" + :style="{ + left: area.leftPer * 100 + '%', + top: area.topPer * 100 + '%', + width: area.widthPer * 100 + '%', + height: area.heightPer * 100 + '%', + }" + :src="area.img" + alt="" + ></image> + </div> + </div> +</template> +<script> +import { modelNavigateTo } from "./tpl"; + +export default { + title: "鐑尯妯″潡", + data() { + return { + modelNavigateTo, + }; + }, + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.hot-image { + position: relative; +} +.hot-area { + position: absolute; + z-index: 99; +} +.flex-one { + width: 100%; + display: block; + overflow: hidden; + image { + width: 100%; + + min-height: 200rpx; + // height: 100%; + } +} +</style> diff --git a/pages/cusbar/home/template/tpl_integral.vue b/pages/cusbar/home/template/tpl_integral.vue new file mode 100644 index 0000000..8f73a78 --- /dev/null +++ b/pages/cusbar/home/template/tpl_integral.vue @@ -0,0 +1,85 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img class="item-img" src="https://picsum.photos/id/268/200/200" alt /> + </div> + <div class="item-price"> + <span>20绉垎</span> + </div> + <div class="item-line-through"> + <span>30绉垎</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + title:"绉垎鍟嗗搧", + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; +} +.join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_join_group.vue b/pages/cusbar/home/template/tpl_join_group.vue new file mode 100644 index 0000000..9309331 --- /dev/null +++ b/pages/cusbar/home/template/tpl_join_group.vue @@ -0,0 +1,90 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img + class="item-img" + src="https://picsum.photos/id/268/200/200" + alt + /> + <div class="item-position-tips">2浜哄洟</div> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�120.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + props: ["res"], + title:"鍥㈣喘" +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; +} +.join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_left_one_right_two.vue b/pages/cusbar/home/template/tpl_left_one_right_two.vue new file mode 100644 index 0000000..5edeefd --- /dev/null +++ b/pages/cusbar/home/template/tpl_left_one_right_two.vue @@ -0,0 +1,46 @@ + +<template> + <div class="layout"> + <div class="view-height-150" @click="modelNavigateTo(res.list[0])"> + <u-image width="100%" height="340rpx" class="image-mode" :src="res.list[0].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-150"> + <div class="view-height-75" @click="modelNavigateTo(res.list[1])"> + <u-image width="100%" height="170rpx" class="image-mode" :src="res.list[1].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-75" @click="modelNavigateTo(res.list[2])"> + <u-image width="100%" height="170rpx" class="image-mode" :src="res.list[2].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "宸︿竴鍙充簩", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + + background-size: cover; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_left_two_right_one.vue b/pages/cusbar/home/template/tpl_left_two_right_one.vue new file mode 100644 index 0000000..94a57d0 --- /dev/null +++ b/pages/cusbar/home/template/tpl_left_two_right_one.vue @@ -0,0 +1,45 @@ + +<template> + <div class="layout "> + <div class="view-height-150"> + <div class="view-height-75" @click="modelNavigateTo(res.list[0])"> + <u-image class="image-mode" width="100%" height="150rpx" :src="res.list[0].img" ></u-image> + </div> + <div class="view-height-75" @click="modelNavigateTo(res.list[1])"> + <u-image class="image-mode" width="100%" height="150rpx" :src="res.list[1].img" ></u-image> + </div> + </div> + <div class="view-height-150" @click="modelNavigateTo(res.list[2])"> + <u-image class="image-mode" width="100%" height="300rpx" :src="res.list[2].img" ></u-image> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "宸︿簩鍙充竴", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + } +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + height: 300rpx; + display: flex; + align-items: center; + justify-content: center; + + background-size: cover; +} + +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_menu.vue b/pages/cusbar/home/template/tpl_menu.vue new file mode 100644 index 0000000..79a500c --- /dev/null +++ b/pages/cusbar/home/template/tpl_menu.vue @@ -0,0 +1,62 @@ +<template> + <div class="layout"> + <div class="menu-list"> + <div + class="menu-item" + @click="modelNavigateTo(item)" + v-for="(item, index) in res.list" + :key="index" + > + <div> + <u-image + width="88rpx" + height="88rpx" + class="menu-img" + :src="item.img" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="menu-title">{{ item.title }}</div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "浜斿垪鑿滃崟", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.menu-list { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + + > .menu-item { + text-align: center; + width: 20%; + // flex: 1; + margin: 20rpx 0; + } +} +.menu-img { + display: flex; + margin: 0 auto; + width: 88rpx; + height: 88rpx; +} +.menu-title { + font-size: 24rpx; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_notice.vue b/pages/cusbar/home/template/tpl_notice.vue new file mode 100644 index 0000000..98d6466 --- /dev/null +++ b/pages/cusbar/home/template/tpl_notice.vue @@ -0,0 +1,50 @@ +<template> + <div class="layout"> + <div class="background"> + <u-notice-bar mode="vertical" :bg-color="res.list[0].bk_color" :color="res.list[0].color" :list="list"></u-notice-bar> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' + export default { + title: "鍏憡", + props: ["res"], + data() { + return { + list: [] + } + }, + mounted() { + this.list = this.res.list[0].title.map(i => i.context); + }, + }; +</script> +<style lang="scss" scoped> + @import "./tpl.scss"; + .background { + position: absolute; + z-index: 2; + width: 100%; + height: 84rpx; + text-align: left; + font-size: 20rpx; + background-size: cover; + } + .layout { + text-align: center; + position: relative; + height: 84rpx; + display: flex; + align-items: center; + justify-content: center; + + background: #ffffff; + } + .title { + line-height: 84rpx; + font-size: 20px; + font-weight: bold; + } +</style> diff --git a/pages/cusbar/home/template/tpl_promotions_detail.vue b/pages/cusbar/home/template/tpl_promotions_detail.vue new file mode 100644 index 0000000..cb2e925 --- /dev/null +++ b/pages/cusbar/home/template/tpl_promotions_detail.vue @@ -0,0 +1,274 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div + v-for="(item, index) in res.list" + :key="index" + class="join-list-item" + @click="goToDetail(item.type)" + > + <div> + <div class="join-title"> + <div>{{ item.title }}</div> + <div + class="sub" + v-if="item.type !== 'SECKILL'" + :style="{ + backgroundColor: item.bk_color, + color: item.color1, + borderColor: item.bk_color, + }" + > + {{ item.title1 }} + </div> + <div class="sub-seckill" v-else> + <div class="sub-seckill-block flex"> + <div class="sub-seckill-block-text"> + {{ timeLine[0] ? timeLine[0].timeLine : "x" }}鐐瑰満 + </div> + {{ times.hours == "00" ? "0" : times.hours }}:{{ + times.minutes + }}:{{ times.seconds }} + </div> + </div> + </div> + <div class="join-box"> + <div + class="join-item" + v-for="(i, _index) in item.data" + :key="_index" + > + <div class="item-img-box"> + <u-image + class="item-img" + width="156rpx" + height="156rpx" + :src="i.thumbnail ? i.thumbnail : i.goodsImage" + alt + /> + </div> + <div + class="ellipsis" + :class="{ 'max-width': res.list.length <= 1 }" + > + {{ i.goodsName ? i.goodsName : i.name }} + </div> + <div class="item-price"> + <span>锟{ i.price ? i.price : i.originalPrice }}</span> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import * as API_Promotions from "@/api/promotions"; +import Foundation from "@/utils/Foundation.js"; +export default { + props: ["res"], + data() { + return { + timeLine: "", //鑾峰彇鍑犱釜鐐规椿鍔� + resTime: 0, //褰撳墠鏃堕棿 + time: 0, //璺濈涓嬩竴涓椿鍔ㄧ殑鏃堕棿鍊� + times: {}, //鏃堕棿闆嗗悎 + onlyOne: "", //鏄惁鏈�鍚庝竴涓晢鍝� + }; + }, + mounted() { + let params = { + pageNumber: 1, + pageSize: 2, + status: "START", + promotionStatus: "START", + }; + this._setTimeInterval = setInterval(() => { + if (this.time <= 0) { + clearInterval(this._setTimeInterval); + } else { + this.times = Foundation.countTimeDown(this.time); + this.time--; + } + }, 1000); + this.res.list.forEach((ele) => { + switch (ele.type) { + case "PINTUAN": + API_Promotions.getAssembleList(params).then((response) => { + const data = response.data.result.records; + if (data) { + ele.data = data; + } + }); + break; + case "SECKILL": + API_Promotions.getSeckillTimeLine().then((response) => { + if (response.data.success && response.data.result) { + ele.data = response.data.result[0].seckillGoodsList.slice(0, 2); + let timeLine = response.data.result.sort( + (x, y) => Number(x.timeLine) - Number(y.timeLine) + ); + this.timeLine = timeLine.slice(0, 5); + this.resTime = parseInt(new Date().getTime() / 1000); + this.onlyOne = response.data.result.length === 1; + this.diffTime = parseInt(new Date().getTime() / 1000) - this.resTime; + + this.time = + this.timeLine[0].distanceStartTime || + (this.timeLine[1] && this.timeLine[1].distanceStartTime) || + Foundation.theNextDayTime() - this.diffTime; + this.times = Foundation.countTimeDown(this.time); + console.log(this.timeLine); + } + }); + break; + case "LIVE": + API_Promotions.getLiveList(params).then((response) => { + if (response.success && response.result.records) { + ele.data = response.result.records[0].commodityList.slice(0, 2); + } + }); + break; + case "KANJIA": + API_Promotions.getBargainList(params).then((response) => { + if (response.success && response.result) { + ele.data = response.result.records(0, 2); + } + }); + break; + default: + break; + } + }); + }, + methods: { + //璺宠浆璇︽儏 + goToDetail(type) { + switch(type) { + case "SECKILL": + uni.navigateTo({ + url: `/pages/promotion/seckill`, + }); + break; + case "PINTUAN": + uni.navigateTo({ + url: `/pages/promotion/joinGroup`, + }); + break; + case "LIVE": + uni.navigateTo({ + url: `/pages/promotion/lives`, + }); + break; + case "KANJIA": + uni.navigateTo({ + url: `/pages/promotion/bargain/list`, + }); + break; + }; + } + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.join-list { + width: 100%; + display: flex; + overflow: hidden; +} +.join-list-item { + flex: 1; +} +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 108rpx; // 澶т簬1涓椿鍔� + font-size: 22rpx; +} +.max-width { + width: 316rpx !important; +} +.item-price { + > span { + font-size: 28rpx; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 150rpx; + height: 150rpx; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 20rpx; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 24rpx; + bottom: 0; +} +.join-title { + display: flex; + + align-items: center; + background: #fff; + height: 100rpx; + > div:nth-of-type(1) { + font-size: 30rpx; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 20rpx; + line-height: 1.75; + border-radius: 16rpx; + text-align: center; + padding: 0 16rpx; + margin-left: 20rpx; + } + .sub { + background-color: #e1212b; + margin-right: 80rpx; + } + .sub-seckill { + white-space: nowrap; + padding: 0 !important; + } + .sub-seckill-block { + background: rgba($main-color, 0.3); + border-radius: 100px !important; + color: rgba($main-color, 0.7); + overflow: hidden; + padding-right: 8rpx; + } + .sub-seckill-block-text { + background-color: $main-color; + color: #fff; + border-top-right-radius: 100px; + border-bottom-right-radius: 100px; + padding: 0 12rpx !important; + margin-right: 12rpx; + } +} +</style> diff --git a/pages/cusbar/home/template/tpl_search.vue b/pages/cusbar/home/template/tpl_search.vue new file mode 100644 index 0000000..7da30eb --- /dev/null +++ b/pages/cusbar/home/template/tpl_search.vue @@ -0,0 +1,64 @@ +<template> + <div class="layout"> + <div class="search" @click="handleSearch"> + <u-icon name="search"></u-icon> + {{ res.list[0].title }} + </div> + <div slot="right" open-type="contact" class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);" > + <image style="width:53rpx;height:53rpx;margin-top:6rpx;" src="@/pages/subComponents/static/img/title.png"></image> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +export default { + title:"鎼滅储鏍�", + props: ["res","storeId"], + methods: { + linkMsgDetail(){ + uni.navigateTo({ + url:`/pages/tabbar/home/title` + }) + }, + + handleSearch() { + if(this.storeId){ + uni.navigateTo({ + url: `/pages/navigation/search/searchPage?storeId=${this.storeId}`, + }); + }else{ + uni.navigateTo({ + url: `/pages/navigation/search/searchPage`, + }); + } + + }, + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; + +.search { + height: 64rpx; + border-radius: 10rpx; + display: flex; + align-items: center; + justify-content: center; + background: #ededed; +} + +.layout { + background: #fff; + padding: 0 16rpx; + position: relative; +} +.navbar-right{ + position: absolute; + top: 0; + // right: 0; +} +.message{ + right:40rpx; +} +</style> diff --git a/pages/cusbar/home/template/tpl_spike.vue b/pages/cusbar/home/template/tpl_spike.vue new file mode 100644 index 0000000..c77a51b --- /dev/null +++ b/pages/cusbar/home/template/tpl_spike.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img + class="item-img" + src="https://picsum.photos/id/268/200/200" + alt + /> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�190.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +@import './advertising.scss'; + +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_text_picture.vue b/pages/cusbar/home/template/tpl_text_picture.vue new file mode 100644 index 0000000..a071a0e --- /dev/null +++ b/pages/cusbar/home/template/tpl_text_picture.vue @@ -0,0 +1,101 @@ + +<template> + <div class="layout"> + <div class="view-list"> + <div class="view-item" @click="modelNavigateTo(res.list[0])"> + <div class="-item-tilte">{{res.list[0].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[0].img" alt ></u-image> + </div> + </div> + <div class="view-item" @click="modelNavigateTo(res.list[1])"> + <div class="-item-tilte">{{res.list[1].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[1].img" alt ></u-image> + </div> + </div> + </div> + <div class="view-list"> + <div class="view-item" @click="modelNavigateTo(res.list[2])"> + <div class="-item-tilte">{{res.list[2].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[2].img" alt ></u-image> + </div> + </div> + <div class="view-item" @click="modelNavigateTo(res.list[3])"> + <div class="-item-tilte">{{res.list[3].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[3].img" alt ></u-image> + </div> + </div> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "鏂囧瓧鍥剧墖妯℃澘", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + } +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + background: #e8e8e8; + align-items: center; + justify-content: center; + background-size: cover; + padding: 0; +} +.-item-image{ + + padding: 10px ; + >img{ + + width: 100%; + } +} +.-item-tilte { + background: $aider-light-color; + height: 60rpx; + color: #fff; + font-size: 14px; + text-align: center; + line-height: 30px; +} + +.view-list { + width: 48%; + margin: 0 auto; + display: flex; + background: #fff; + border-top-left-radius: 0.8em; + border-top-right-radius: 0.8em; + border: 1px solid #ededed; + + > .view-item { + width: 50%; + } + > .view-item:nth-of-type(1) { + > .-item-tilte { + border-top-left-radius: 0.8em; + } + } + > .view-item:nth-of-type(2) { + > .-item-tilte { + border-top-right-radius: 0.8em; + } + } +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_title.vue b/pages/cusbar/home/template/tpl_title.vue new file mode 100644 index 0000000..ded00d1 --- /dev/null +++ b/pages/cusbar/home/template/tpl_title.vue @@ -0,0 +1,58 @@ +<template> + <div class="layout" :style="{textAlign: res.list[0].textAlign}" @click="modelNavigateTo(res.list[0])" > + <div class="background" :style="{ backgroundColor: res.list[0].bk_color}"> + <div class="title" :style="{ color: res.list[0].color }"> + {{ res.list[0].title }} + </div> + <div style="position: absolute;right: 10px;top:2px;color: #fff;line-height: 42px;font-size: 10px"> + <a :style="{ color: res.list[0].color1 }" style="text-decoration: none">{{ res.list[0].title1 }}</a> + </div> + </div> + </div> +</template> + + +<script> +import { modelNavigateTo } from "./tpl"; +export default { + title: "鏍囬鏍�", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.background { + // background: url("/pages/subComponents/static/title.png") no-repeat; + position: absolute; + z-index: 2; + width: 100%; + height: 84rpx; + background-position-x: center; + background-position-y: center; + background-size: cover; +} + +.layout { + text-align: center; + position: relative; + height: 84rpx; + display: flex; + align-items: center; + justify-content: center; + + background: #ffffff; +} + +.title { + line-height: 84rpx; + font-size: 30rpx; + font-weight: bold; + margin-left: 8rpx; +} +</style> diff --git a/pages/cusbar/home/template/tpl_top_one_bottom_two.vue b/pages/cusbar/home/template/tpl_top_one_bottom_two.vue new file mode 100644 index 0000000..c77229f --- /dev/null +++ b/pages/cusbar/home/template/tpl_top_one_bottom_two.vue @@ -0,0 +1,73 @@ + +<template> + <div class="layout"> + <div class="view-width-100" @click="modelNavigateTo(res.list[0])"> + <u-image class="image-mode" width="100%" height="200rpx" :src="res.list[0].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-width-100" @click="modelNavigateTo(res.list[1])"> + <div class="view-height-85"> + <u-image class="image-mode" width="100%" height="170rpx" :src="res.list[1].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-85" @click="modelNavigateTo(res.list[2])"> + <u-image class="image-mode" width="100%" height="170rpx" :src="res.list[2].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "涓婁竴涓嬩簩", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; + + flex-direction: column; +} +// img { +// width: 100% !important; +// height: 85px !important; +// } +.view-width-100 { + padding: 1px 0; + display: flex; + height: 200rpx; + width: 100%; + > img { + width: 100%; + height: 100%; + } +} +.view-height-85 { + padding: 0 1px; + width: 50%; + > img { + width: 100%; + height: 100%; + } +} +.image-mode{ + width: 100%; +} +</style> \ No newline at end of file diff --git a/pages/cusbar/home/template/tpl_top_two_bottom_one.vue b/pages/cusbar/home/template/tpl_top_two_bottom_one.vue new file mode 100644 index 0000000..c387755 --- /dev/null +++ b/pages/cusbar/home/template/tpl_top_two_bottom_one.vue @@ -0,0 +1,80 @@ +<template> + <div class="layout"> + <div class="view-width-100"> + <div class="view-height-85" @click="modelNavigateTo(res.list[0])"> + <u-image + class="image-mode" + height="170rpx" + width="100%" + :src="res.list[0].img" + alt + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + <div class="view-height-85" @click="modelNavigateTo(res.list[1])"> + <u-image + class="image-mode" + height="170rpx" + width="100%" + :src="res.list[1].img" + alt + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + </div> + <div class="view-width-100" @click="modelNavigateTo(res.list[2])"> + <u-image + class="image-mode" + height="200rpx" + width="100%" + :src="res.list[2].img" + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "涓婁簩涓嬩竴", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; + // height: 260rpx; + flex-direction: column; +} +// img { +// width: 100% !important; +// height: 85px !important; +// } +.view-width-100 { + padding: 1px 0; + display: flex; + height: 200rpx; + width: 100%; +} +.view-height-85 { + padding: 0 1px; + width: 50%; +} +.image-mode{ + width: 100%; +} +</style> diff --git a/pages/cusbar/home/title.vue b/pages/cusbar/home/title.vue new file mode 100644 index 0000000..e36d240 --- /dev/null +++ b/pages/cusbar/home/title.vue @@ -0,0 +1,193 @@ +<template> + <view> + <view> + <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs> + <view v-if="showLoading" style="width:500rpx;margin:0 auto;text-align: center;height:800rpx;line-height: 800rpx;"> + <u-loading mode="flower" ></u-loading> + <text>姝e湪鍔犺浇涓�</text> + </view> + <u-cell-group v-if="current == 0"> + <view v-for="(item,index) in lists" :key="index"> + <u-cell-item :arrow="false" v-if="item.status =='UN_READY'" style="position: relative;" + @click="linkMsgDetail(item)"> + <template slot="label"> + <view style="display: inline-block; + width: 100%; + height: auto; + font-family: Gibson; + font-size: 25rpx; + word-break: break-all; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: pre-wrap;"> + <view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view> + <view>{{item.content}}</view> + <view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view> + </view> + </template> + <!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#000000;color:white;">鏈</button> --> + </u-cell-item> + </view> + + </u-cell-group> + <u-cell-group v-if="current == 1"> + <view v-for="(item,index) in lists" :key="index"> + <u-cell-item :arrow="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;" + @click="linkMsgDetail(item)"> + <template slot="label"> + <view style="display: inline-block; + width: 100%; + height: auto; + font-family: Gibson; + font-size: 25rpx; + word-break: break-all; + text-overflow: ellipsis; + word-wrap: break-word; + + white-space: pre-wrap;"> + <view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view> + <view>{{item.content}}</view> + <view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view> + </view> + </template> + <!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#F3F3FA;color:black;">宸茶</button> --> + </u-cell-item> + </view> + </u-cell-group> + </view> + + </view> +</template> + +<script> + import '@/components/uview-components/uview-ui' + import { + messages, + editMessages + } from "@/api/message.js" + export default { + data() { + return { + showLoading:true, + params: { + pageSize: 20, + pageNumber: 1, + memberId: "", + messageId: "", + status:"UN_READY" + }, + loadText: { + loadmore: '杞昏交涓婃媺', + loading: '鍔姏鍔犺浇涓�', + nomore: '瀹炲湪娌℃湁浜�' + }, + list: [{ + name: "鏈" + }, { + name: "宸茶" + }], + current: 0, + lists: [], + status: "loadmore" + } + }, + onShow() { + this.getMessage() + }, + onReachBottom() { + this.params.pageNumber++; + this.statuss = "loading"; + this.getMessage() + }, + methods: { + linkMsgDetail(v) { + + if (v.status == 'UN_READY') { + let params = {} + params.messageId = v.memberId + editMessages(v.id, params).then(res => { + if (res.data.success) { + console.log( this.lists) + this.lists.forEach((item,index)=>{ + console.log(item) + if(item.id == v.id){ + this.lists.splice(index, 1) + } + }) + } + }) + } + + // uni.navigateTo({ + // url:`/pages/tabbar/home/messageDetail?data=${encodeURIComponent(JSON.stringify(v))}` + // }) + + + }, + /** + * 杩斿洖 + */ + back() { + if (getCurrentPages().length == 1) { + uni.switchTab({ + url: "/pages/tabbar/home/index", + }); + } else { + uni.navigateBack(); + } + }, + change(e) { + this.showLoading = true; + console.log(e) + this.current = e; + if (e == 0) { + this.params.status = "UN_READY" + this.params.pageNumber = 1; + } else if (e == 1) { + this.params.status = "ALREADY_READY" + this.params.pageNumber = 1; + } + this.lists = [] + this.getMessage() + }, + getMessage() { + this.params.memberId = this.$options.filters.isLogin().id; + + messages(this.params).then(res => { + console.log(res) + if (res.data.success) { + this.showLoading = false + if (res.data.result.records == '') { + console.log(11111) + this.status = "nomore" + } + res.data.result.records.forEach(item => { + this.lists.push(item) + let obj = {}; + this.lists = this.lists.reduce( + (cur, next) => { + //瀵硅薄鍘婚噸 + if (next.id != undefined) { + obj[next.id] ? + "" : + (obj[next.id] = true && cur.push(next)); + } + console.log(cur); + return cur; + }, + [] + ) + }) + + } + }) + } + }, + } +</script> +<style> + .foot { + position: fixed; + bottom: 0; + } +</style> diff --git a/pages/cusbar/home/views.vue b/pages/cusbar/home/views.vue new file mode 100644 index 0000000..f148be0 --- /dev/null +++ b/pages/cusbar/home/views.vue @@ -0,0 +1,250 @@ +<template> + <div class="wrapper"> + <!-- uni 涓笉鑳戒娇鐢� vue component 鎵�浠ョ敤if鍒ゆ柇姣忎釜缁勪欢 --> + <div v-for="(item, index) in pageData.list" :key="index"> + <!-- 鎼滅储鏍忥紝濡傛灉鍦ㄦゼ灞傝淇《閮ㄥ垯浼氳嚜鍔ㄦ诞鍔紝鍚﹀垯涓嶆诞鍔� --> + <u-navbar class="navbar" v-if="item.type == 'search'" :is-back="false" :is-fixed="index === 1 ? false : true"> + <search style="width: 100%" :res="item.options" /> + <!-- #ifndef H5 --> + <!-- 鎵爜鍔熻兘 涓嶅吋瀹筯5 璇︽儏鏂囨。: https://uniapp.dcloud.io/api/system/barcode?id=scancode --> + <div slot="right" class="navbar-right"> + <u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon> + </div> + <!-- #endif --> + </u-navbar> + <carousel v-if="item.type == 'carousel'" :res="item.options" /> + <titleLayout v-if="item.type == 'title'" :res="item.options" /> + <leftOneRightTwo v-if="item.type == 'leftOneRightTwo'" :res="item.options" /> + <leftTwoRightOne v-if="item.type == 'leftTwoRightOne'" :res="item.options" /> + <topOneBottomTwo v-if="item.type == 'topOneBottomTwo'" :res="item.options" /> + <topTwoBottomOne v-if="item.type == 'topTwoBottomOne'" :res="item.options" /> + <flexThree v-if="item.type == 'flexThree'" :res="item.options" /> + <flexFive v-if="item.type == 'flexFive'" :res="item.options" /> + <flexFour v-if="item.type == 'flexFour'" :res="item.options" /> + <flexTwo v-if="item.type == 'flexTwo'" :res="item.options" /> + <textPicture v-if="item.type == 'textPicture'" :res="item.options" /> + <menuLayout v-if="item.type == 'menu'" :res="item.options" /> + <flexOne v-if="item.type == 'flexOne'" :res="item.options" /> + <goods :enableBottomLoad="enableLoad" v-if="item.type == 'goods'" :res="item.options" /> + <group v-if="item.type == 'group'" :res="item.options" /> + <notice v-if="item.type == 'notice'" :res="item.options" /> + <promotions v-if="item.type == 'promotionDetail'" :res="item.options" /> + <!-- <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" /> --> + <!-- <integral v-if="item.type == 'integral'" :res="item.options" /> --> + <!-- <spike v-if="item.type == 'spike'" :res="item.options" /> --> + + </div> + <fetchCoupon ref='coupon' /> + <u-no-network @retry="init" @isConnected="isConnected"></u-no-network> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +// 寮曠敤缁勪欢 +import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //瀵艰埅鏍忔ā鍧� +import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //鏍囬鏍忔ā鍧� +import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //宸︿竴鍙充簩妯″潡 +import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //宸︿簩鍙充竴妯″潡 +import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //涓婁竴涓嬩簩妯″潡 +import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //涓婁簩涓嬩竴妯″潡 +import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //鍗曡鍥剧墖妯″潡 +import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //涓ゅ紶妯浘妯″潡 +import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //涓夊垪鍗曡鍥剧墖妯″潡 +import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //浜斿垪鍗曡鍥剧墖妯″潡 +import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //鍥涘垪鍗曡鍥剧墖妯″潡 +import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //鏂囧瓧鍥剧墖妯℃澘 +import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //浜斿垪鑿滃崟妯″潡 +import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //鎼滅储鏍� +import tpl_group from "@/pages/tabbar/home/template/tpl_group"; // +import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //鍟嗗搧鍒嗙被浠ュ強鍒嗙被涓殑鍟嗗搧 +// 缁撴潫寮曠敤缁勪欢 +import { getFloorData } from "@/api/home"; //鑾峰彇妤煎眰瑁呬慨鎺ュ彛 +import permission from "@/js_sdk/wa-permission/permission.js"; //鏉冮檺宸ュ叿绫� +import config from "@/config/config"; + +import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //鏍囬鏍忔ā鍧� +import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //鏍囬鏍忔ā鍧� +import storage from "@/utils/storage.js"; +import fetchCoupon from '@/pages/tabbar/home/template/fetch_coupon' +// import {receiveCoupons} from "@/api/members" + +export default { + data () { + return { + config, + storage, + showCp:true, + pageData: "", //妤煎眰椤甸潰鏁版嵁 + isIos: "", + enableLoad: false, //瑙﹀簳鍔犺浇 閽堝浜庡晢鍝佹ā鍧� + }; + }, + components: { + carousel: tpl_banner, + titleLayout: tpl_title, + leftOneRightTwo: tpl_left_one_right_two, + leftTwoRightOne: tpl_left_two_right_one, + topOneBottomTwo: tpl_top_one_bottom_two, + topTwoBottomOne: tpl_top_two_bottom_one, + flexThree: tpl_flex_three, + flexFive: tpl_flex_five, + flexFour: tpl_flex_four, + flexTwo: tpl_flex_two, + textPicture: tpl_text_picture, + menuLayout: tpl_menu, + search: tpl_search, + flexOne: tpl_flex_one, + goods: tpl_goods, + group: tpl_group, + notice: tpl_notice, + promotions: tpl_promotions, + fetchCoupon + }, + + mounted () { + this.init(); + // #ifdef MP-WEIXIN + // 灏忕▼搴忛粯璁ゅ垎浜� + uni.showShareMenu({ withShareTicket: true }); + // #endif + + }, + methods: { + fetchCoupon(){ + this.$refs.coupon.firstGetAuto(); + }, + /** + * 瀹炰緥鍖栭椤垫暟鎹ゼ灞� + */ + init () { + this.pageData = ""; + getFloorData().then((res) => { + if (res.data.success) { + const result = JSON.parse(res.data.result.pageData) + this.pageData = result; + if (result.list.length) { + // 濡傛灉鏈�鍚庝竴涓淇ā鍧楁槸鍟嗗搧妯″潡鐨勮瘽 榛樿鍚敤鑷姩鍔犺浇 + result.list[result.list.length - 1] ? result.list[result.list.length - 1].model == 'goods' ? this.enableLoad = true : '' : '' + } + } + }); + }, + // 鏄惁鏈夌綉缁滈摼鎺� + isConnected (val) { + val ? this.init() : '' + }, + + /** + * TODO 鎵爜鍔熻兘鍚庣画杩樹細鍚庣画澧炲姞 + * 搴旇瀹炵幇鐨勫姛鑳界洰鍓嶈鍒掓湁锛� + * 鎵弿鍟嗗搧璺宠浆鍟嗗搧椤甸潰 + * 鎵弿娲诲姩璺宠浆娲诲姩椤甸潰 + * 鎵弿浜岀淮鐮佺櫥褰� + * 鎵弿鍏朵粬绔欎俊鎭� 寮瑰嚭鎻愮ず锛岃繑鍥為椤点�� + */ + scanCode () { + uni.scanCode({ + success: function (res) { + let path = encodeURIComponent(res.result); + + + + if (path != undefined && path.indexOf("QR_CODE_LOGIN_SESSION") == 0) { + console.log(path) + //app鎵爜鐧诲綍 + uni.navigateTo({ + url: "/pages/passport/scannerCodeLoginConfirm?token=" + path + }); + return; + } + + + // WX_CODE 涓哄皬绋嬪簭鐮� + if (res.scanType == "WX_CODE") { + console.log(res); + uni.navigateTo({ + url: `/${res.path}`, + }); + } else { + config.scanAuthNavigation.forEach((src) => { + if (res.result.indexOf(src) != -1) { + uni.navigateTo({ + url: `/${res.result.substring(src.length)}`, + }); + } else { + setTimeout(() => { + uni.navigateTo({ + url: "/pages/tabbar/home/web-view?src=" + path, + }); + }, 100); + } + }); + } + }, + }); + }, + + /** + * 鎻愮ず鑾峰彇鏉冮檺 + */ + tipsGetSettings () { + uni.showModal({ + title: "鎻愮ず", + content: "鎮ㄥ凡缁忓叧闂浉鏈烘潈闄�,鍘昏缃�", + success: function (res) { + if (res.confirm) { + if (this.isIos) { + plus.runtime.openURL("app-settings:"); + } else { + permission.gotoAppPermissionSetting(); + } + } + }, + }); + }, + + /** + * 鍞ら啋瀹㈡埛绔壂鐮� + * 娌℃潈闄愬幓鐢宠鏉冮檺锛屾湁鏉冮檺鑾峰彇鎵爜鍔熻兘 + */ + async scan () { + // #ifdef APP-PLUS + this.isIos = plus.os.name == "iOS"; + // 鍒ゆ柇鏄惁鏄疘os + if (this.isIos) { + const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //鏄笉鏄涓�娆″紑鍚浉鏈� + if (iosFirstCamera !== "false") { + uni.setStorageSync("iosFirstCamera", "false"); //璁句负false灏变唬琛ㄤ笉鏄涓�娆″紑鍚浉鏈� + this.scanCode(); + } else { + if (permission.judgeIosPermission("camera")) { + this.scanCode(); + } else { + // 娌℃湁鏉冮檺鎻愰啋鏄惁鍘荤敵璇锋潈闄� + this.tipsGetSettings(); + } + } + } else { + /** + * TODO 瀹夊崜 鏉冮檺宸茬粡鎺堟潈浜嗭紝璋冪敤api鎬绘槸鏄剧ず鐢ㄦ埛宸叉案涔呮嫆缁濈敵璇枫�備汉鍌讳簡 + * TODO 濡傛灉xdm鏈夋洿濂界殑鍔炴硶璇峰湪 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 鎻愪笅璋㈣阿 + */ + this.scanCode(); + } + + // #endif + + // #ifdef MP-WEIXIN + this.scanCode(); + // #endif + }, + }, +}; +</script> + +<style scoped lang="scss"> +.navbar-right { + padding: 0 16rpx 0 0; +} +</style> diff --git a/pages/cusbar/home/web-view.vue b/pages/cusbar/home/web-view.vue new file mode 100644 index 0000000..892ffe2 --- /dev/null +++ b/pages/cusbar/home/web-view.vue @@ -0,0 +1,53 @@ +<template> + <view class="web-view"> + <web-view :webview-styles="webviewStyles" :src="src"></web-view> + </view> +</template> + +<script> +import configs from "@/config/config"; +import storage from "@/utils/storage"; +export default { + data() { + return { + configs, + storage, + webviewStyles: { + progress: { + color: this.$lightColor, + }, + }, + src: "", + }; + }, + onLoad(params) { + // params.IM ? (this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}&id=${params.IM}`): (this.src = decodeURIComponent(params.src)); + if(params.IM) + { + if(params.IM==0) + { + this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}`; + } + else + { + this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}&id=${params.IM}`; + } + } + else + { + this.src = decodeURIComponent(params.src); + console.log(this.src); + } + + }, +}; +</script> + +<style lang="scss" scoped> +.web-view { + /deep/ .web-view { + padding: 0; + margin: 0; + } +} +</style> diff --git a/pages/product/goods.vue b/pages/product/goods.vue index c315288..cd99290 100644 --- a/pages/product/goods.vue +++ b/pages/product/goods.vue @@ -198,10 +198,10 @@ <view class="page-bottom mp-iphonex-bottom" id="pageBottom"> <view class="icon-btn"> -<!-- <view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)"> + <view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)"> <u-icon size="34" class="red" name="home-fill"></u-icon> <view class="red icon-btn-name">搴楅摵</view> - </view> --> + </view> <view class="icon-btn-item" @click="linkMsgDetail()"> <u-icon size="34" name="kefu-ermai"></u-icon> <view class="icon-btn-name">瀹㈡湇</view> @@ -213,10 +213,10 @@ </view> </view> <!-- 涓嬫灦灞曠ず --> - <div class="detail-btn" v-if="takeDownFromSale"> +<!-- <div class="detail-btn" v-if="takeDownFromSale"> <view class="to-store-car to-store-btn" @click="reStartTakeDownSale"> 鏌ョ湅绫讳技鍟嗗搧</view> - </div> + </div> --> <!-- 姝e父缁撶畻椤甸潰 --> <view class="detail-btn" v-if="!isGroup && !takeDownFromSale"> <view class="to-store-car to-store-btn" v-if="goodsDetail.goodsType != 'VIRTUAL_GOODS'" @click="shutMask(4)"> @@ -295,14 +295,14 @@ import PromotionAssembleListLayout from "./product/promotion/-promotion-assemble-list"; //鎷煎洟鐢ㄦ埛鍒楄〃 import PromotionCoupon from "./product/promotion/-promotion-coupon"; //浼樻儬鍒哥粍浠� import GoodsIntro from "./product/goods/-goods-intro"; //鍟嗗搧浠嬬粛缁勪欢 -// import GoodsRecommend from "./product/goods/-goods-recommend"; //瀹濊礉鎺ㄨ崘 +import GoodsRecommend from "./product/goods/-goods-recommend"; //瀹濊礉鎺ㄨ崘 import storeLayout from "./product/shop/-shop"; //搴楅摵缁勪欢 import Evaluation from "./product/evaluation/-evaluation"; //璇勪环缁勪欢 import GoodsSwiper from "./product/goods/-goods-swiper"; //杞挱鍥剧粍浠� import popupGoods from "@/pages/product/m-buy/goods.vue"; //璐墿杞﹀晢鍝佺殑妯″潡 import popupAddress from "./product/popup/address"; //鍦板潃閫夋嫨妯″潡 import shares from "@/pages/product/m-share/index.vue"; //鍒嗕韩 -import popups from "@/pages/subComponents/popups/popups.vue"; //姘旀场妗� +import popups from "@/pages/product/popups/popups.vue"; //姘旀场妗� import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index"; //涓嬫灦妗� import setup from "./product/popup/popup"; import { @@ -318,6 +318,7 @@ PromotionAssembleListLayout, PromotionCoupon, GoodsIntro, + GoodsRecommend, storeLayout, Evaluation, GoodsSwiper, @@ -399,10 +400,10 @@ text: "璇︽儏", id: "3", }, - { - text: "鎺ㄨ崘", - id: "4", - }, + // { + // text: "鎺ㄨ崘", + // id: "4", + // }, ], tabScrollTop: null, scrollArr: [], @@ -731,13 +732,14 @@ * 鏌ョ湅璐墿杞� */ reluchToCart () { + console.log('鐐瑰嚮浜嗚喘鐗╄溅-----------------------銆�') let obj = { from: "product", id: this.productId, }; storage.setCartBackbtn(obj); - uni.switchTab({ - url: "/pages/tabbar/cart/cartList", + uni.redirectTo({ + url: "/pages/cusbar/cart/cartList", }); }, diff --git a/pages/product/home/index.vue b/pages/product/home/index.vue new file mode 100644 index 0000000..aa8b37a --- /dev/null +++ b/pages/product/home/index.vue @@ -0,0 +1,43 @@ +<template> + <div class="wrapper"> + <!-- 妤煎眰瑁呬慨缁勪欢 --> + <tpl ref="tpl" /> + </div> +</template> +<script> +import tpl from "@/pages/tabbar/home/views.vue"; + +export default { + data() { + return { + background: { + backgroundColor: "#fff", + }, + }; + }, + onShow(){ + setTimeout(()=>{ + this.$refs.tpl.fetchCoupon(); + },1000) + }, + methods: { + + }, + onReachBottom(){ + // 缁欏瓙绾х洃鍚Е搴曞姞杞� + uni.$emit('onReachBottom',true) + }, + + onPullDownRefresh() { + this.$refs.tpl.init(); + + uni.stopPullDownRefresh(); + }, + components: { + tpl, + }, +}; +</script> + +<style lang="scss" scoped> +</style> diff --git a/pages/product/home/template/advertising.scss b/pages/product/home/template/advertising.scss new file mode 100644 index 0000000..be5228c --- /dev/null +++ b/pages/product/home/template/advertising.scss @@ -0,0 +1,57 @@ +.position-box{ + position: absolute; + right: 0; + bottom: 0; +} +.join-box { + display: flex; + } + .item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } + } + .join-item { + flex: 1; + } + .item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; + } + .item-img-box { + position: relative; + } + .item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } + } + .item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; + } + .join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } + } \ No newline at end of file diff --git a/pages/product/home/template/fetch_coupon.vue b/pages/product/home/template/fetch_coupon.vue new file mode 100644 index 0000000..7058fd8 --- /dev/null +++ b/pages/product/home/template/fetch_coupon.vue @@ -0,0 +1,172 @@ +<template> + <div> + <u-popup v-model="enableShowCoupon" mode="center" width="550rpx" height="400px"> + <view style="height: 130rpx"> + <view + style=" + width: 200rpx; + height: 120rpx; + float: left; + line-height: 120rpx; + font-size: 35rpx; + color: #28a4f2; + font-weight: 600; + margin-left: 20rpx; + " + >浼樻儬鍒告椿鍔�</view + > + <view style="width: 120rpx; height: 120rpx; float: right"> + <image + @click="enableShowCoupon = false" + src="/static/cpauto1.png" + style="width: 100%; height: 100%" + ></image> + </view> + </view> + <scroll-view scroll-y="true" style="height: 620rpx"> + <!-- {{coupList}} --> + <view v-for="(item, index) in coupList" :key="index"> + <view class="grad1"> + <view style="float: right"> + <view v-if="item.couponType == 'DISCOUNT'" + >{{ item.discount }}鎶�</view + > + <view v-else + >浼樻儬閲戦锛�<span style="color: red; font-size: 32rpx">{{ + item.price | unitPrice + }}</span + >鍏�</view + > + <view + >婊�<span style="color: red; font-size: 32rpx" + >{{ item.consumeThreshold | unitPrice }}鍏�</span + >鍙敤</view + > + <view v-if="item.scopeType == 'ALL' && item.storeId == '0'" + >鍏ㄥ钩鍙�</view + > + <view v-if="item.scopeType == 'PORTION_GOODS_CATEGORY'" + >浠呴檺鍝佺被</view + > + <view v-else + >{{ + item.storeName == "platform" + ? "鍏ㄥ钩鍙�" + : item.storeName + "搴楅摵" + }}浣跨敤 + </view> + <view v-if="item.endTime" + >鏈夋晥鏈熻嚦锛歿{ item.endTime.split(" ")[0] }}</view + > + </view> + <view + style=" + color: white; + font-size: 28rpx; + font-weight: 500; + float: left; + writing-mode: vertical-rl; + flex: auto; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + " + @click="enableShowCoupon = false" + > + 绔嬪嵆浣跨敤 + </view> + </view> + </view> + </scroll-view> + </u-popup> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { getAutoCoup } from "@/api/login"; +import storage from "@/utils/storage.js"; +export default { + data() { + return { + storage, + enableShowCoupon: false, + coupList:[] + }; + }, + mounted() { + this.firstGetAuto(); + }, + methods: { + firstGetAuto() { + if(!this.$options.filters.isLogin('auth')) return false + let data = new Date(); + let now = data.getDate(); + let hours = data.getHours(); + let flagCoup = storage.getAutoCp(); + if ( + storage.getAutoCp() && + storage.getAutoCp() != "" && + storage.getAutoCp() != undefined && + storage.getAutoCp() != null + ) { + if (Number(now) > Number(flagCoup)) { + if (Number(hours) >= 6) { + storage.setAutoCp(now); + this.getAutoCp(); + } + } + } else { + this.getAutoCp(); + } + }, + getAutoCp() { + let data = new Date(); + let now = data.getDate(); + getAutoCoup().then((res) => { + console.log(res); + if (res.data.success) { + this.coupList.push(...res.data.result); + if (this.coupList != "") { + this.enableShowCoupon = true; + } else { + this.enableShowCoupon = false; + } + storage.setAutoCp(now); + let objs = {}; + this.coupList = this.coupList.reduce((cur, next) => { + //瀵硅薄鍘婚噸 + if (next.id != undefined) { + objs[next.id] ? "" : (objs[next.id] = true && cur.push(next)); + } + return cur; + }, []); + } + }); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.grad1 { + width: 500rpx; + height: 200rpx; + background: radial-gradient(circle at right top, transparent 20rpx, #ff6b35 0) + top left / 120rpx 51% no-repeat, + radial-gradient(circle at right bottom, transparent 20rpx, #ff6b35 0) bottom + left / 120rpx 51% no-repeat, + radial-gradient(circle at left top, transparent 20rpx, #ffffff 0) top right / + 380rpx 51% no-repeat, + radial-gradient(circle at left bottom, transparent 20rpx, #ffffff 0) bottom + right / 380rpx 51% no-repeat; + filter: drop-shadow(6rpx 6rpx 6rpx rgba(0, 0, 0, 0.3)); + margin: 30rpx auto; + padding-top: 2rpx; + padding-bottom: 10rpx; + padding-left: 38rpx; + padding-right: 30rpx; +} +</style> diff --git a/pages/product/home/template/tpl.js b/pages/product/home/template/tpl.js new file mode 100644 index 0000000..5701e89 --- /dev/null +++ b/pages/product/home/template/tpl.js @@ -0,0 +1,208 @@ +/** 閰嶇疆妤煎眰妯″潡鐨勮烦杞� */ +export function modelNavigateTo(item) { + let val = item.url || item; + //閾炬帴璺宠浆鍒颁笓棰� + + if (val && val.id && val.pageType == "special") { + uni.navigateTo({ + url: `/pages/tabbar/special/special?id=${val.id}`, + }); + } + switch (val.___type || val.type) { + case "goods": + uni.navigateTo({ + url: "/pages/product/goods?id=" + val.id + "&goodsId=" + val.goodsId, + }); + break; + case "category": + if (val.id) { + uni.navigateTo({ + url: `/pages/navigation/search/searchPage?category=${val.id}`, + }); + } else { + uni.navigateTo({ + url: `/pages/navigation/search/searchPage`, + }); + } + break; + case "shops": + uni.navigateTo({ + url: `/pages/product/shopPage?id=${val.id}`, + }); + break; + // 娲诲姩 + case "marketing": + uni.navigateTo({ + url: "/pages/product/goods?id=" + val.skuId + "&goodsId=" + val.goodsId, + }); + break; + case "pages": + uni.navigateTo({ + url: val.___path + "?id=" + val.id + "&title=" + val.title, + }); + break; + case "other": + switch (val.title || item.title) { + case "棣栭〉": + uni.switchTab({ + url: `/pages/tabbar/home/index`, + }); + break; + case "璐墿杞�": + uni.switchTab({ + url: `/pages/tabbar/cart/cartList`, + }); + return; + case "涓汉涓績": + uni.switchTab({ + url: `/pages/tabbar/user/my`, + }); + break; + case "鏀惰棌鍟嗗搧": + uni.navigateTo({ + url: `/pages/mine/myCollect`, + }); + break; + case "鎴戠殑璁㈠崟": + uni.navigateTo({ + url: `/pages/order/myOrder?status=0`, + }); + break; + case "棰嗗埜涓績": + uni.navigateTo({ + url: `/pages/cart/coupon/couponCenter`, + }); + break; + case "绛惧埌": + uni.navigateTo({ + url: `/pages/mine/signIn`, + }); + break; + case "绉掓潃棰戦亾": + uni.navigateTo({ + url: `/pages/promotion/seckill`, + }); + break; + case "鎷煎洟棰戦亾": + uni.navigateTo({ + url: `/pages/promotion/joinGroup`, + }); + break; + case "灏忕▼搴忕洿鎾�": + uni.navigateTo({ + url: `/pages/promotion/lives`, + }); + break; + case "鐮嶄环": + uni.navigateTo({ + url: `/pages/promotion/bargain/list`, + }); + break; + case "绉垎鍟嗗煄": + uni.navigateTo({ + url: `/pages/promotion/point/pointList`, + }); + break; + case "搴楅摵鍒楄〃": + uni.navigateTo({ + url: `/pages/product/shopList`, + }); + break; + default: + // #ifdef H5 + window.location.href = val.url || item.link; + // #endif + // #ifdef APP-PLUS + plus.runtime.openURL(val.url || item.link) //涓嶉渶瑕佹嫾鎺 + // #endif + break; + } + + break; + } +} + + + + +import config from "@/config/config"; + +async function scan() { + // #ifdef APP-PLUS + let isIos = plus.os.name == "iOS"; + // 鍒ゆ柇鏄惁鏄疘os + if (isIos) { + const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //鏄笉鏄涓�娆″紑鍚浉鏈� + if (iosFirstCamera !== "false") { + uni.setStorageSync("iosFirstCamera", "false"); //璁句负false灏变唬琛ㄤ笉鏄涓�娆″紑鍚浉鏈� + seacnCode(); + } else { + if (permision.judgeIosPermission("camera")) { + seacnCode(); + } else { + // 娌℃湁鏉冮檺鎻愰啋鏄惁鍘荤敵璇锋潈闄� + tipsGetSettings(); + } + } + } else { + /** + * TODO 瀹夊崜 鏉冮檺宸茬粡鎺堟潈浜嗭紝璋冪敤api鎬绘槸鏄剧ず鐢ㄦ埛宸叉案涔呮嫆缁濈敵璇枫�備汉鍌讳簡 + * TODO 濡傛灉xdm鏈夋洿濂界殑鍔炴硶璇峰湪 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 鎻愪笅璋㈣阿 + */ + seacnCode(); + } + + // #endif + + // #ifdef MP-WEIXIN + seacnCode(); + // #endif +} +/** + * 鎻愮ず鑾峰彇鏉冮檺 + */ +function tipsGetSettings() { + uni.showModal({ + title: "鎻愮ず", + content: "鎮ㄥ凡缁忓叧闂浉鏈烘潈闄�,鍘昏缃�", + success: function (res) { + if (res.confirm) { + if (isIos) { + plus.runtime.openURL("app-settings:"); + } else { + permision.gotoAppPermissionSetting(); + } + } + }, + }); +} + +function seacnCode() { + uni.scanCode({ + success: function (res) { + let path = encodeURIComponent(res.result); + + // WX_CODE 涓哄皬绋嬪簭鐮� + if (res.scanType == "WX_CODE") { + console.log(res); + uni.navigateTo({ + url: `/${res.path}`, + }); + } else { + config.scanAuthNavigation.forEach((src) => { + if (res.result.indexOf(src) != -1) { + uni.navigateTo({ + url: `/${res.result.substring(src.length)}`, + }); + } else { + setTimeout(() => { + uni.navigateTo({ + url: "/pages/tabbar/home/web-view?src=" + path, + }); + }, 100); + } + }); + } + }, + }); + } \ No newline at end of file diff --git a/pages/product/home/template/tpl.scss b/pages/product/home/template/tpl.scss new file mode 100644 index 0000000..a9702fb --- /dev/null +++ b/pages/product/home/template/tpl.scss @@ -0,0 +1,32 @@ +.image-mode { + width: 100%; + height: 100%; + display: block; + padding: 2rpx; +} +.layout { + padding: 16rpx; + margin: 8rpx 0; + background: #fff; +} +.layout, +.view-height-75, +.view-height-150 { + overflow: hidden; +} +.view-width-100 { + width: 100%; +} +.view-height-75 { + // height: 150rpx; +} +.view-height-150 { + // height: 300rpx; + flex: 1; +} + +.view-height-85 { + height: 170rpx; + flex: 1; +} + diff --git a/pages/product/home/template/tpl_banner.vue b/pages/product/home/template/tpl_banner.vue new file mode 100644 index 0000000..1442865 --- /dev/null +++ b/pages/product/home/template/tpl_banner.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="box"> + <u-swiper @click="clickSwiper" interval="5000" duration="500" height="350" v-if="res" name="img" :list="res.list"> + <u-loading slot="loading"></u-loading> + </u-swiper> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "瀵艰埅鏍�", + props: ["res"], + watch: { + res: { + handler(newValue, oldValue) { + this.$set(this, "res", newValue); + }, + deep: true, + }, + }, + + mounted() { + + }, + methods: { + clickSwiper(index) { + modelNavigateTo(this.res.list[index]); + }, + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +</style> diff --git a/pages/product/home/template/tpl_flex_five.vue b/pages/product/home/template/tpl_flex_five.vue new file mode 100644 index 0000000..c7618ab --- /dev/null +++ b/pages/product/home/template/tpl_flex_five.vue @@ -0,0 +1,32 @@ + +<template> + <div class="layout"> + <u-image width="140rpx" mode="aspectFit" height="140rpx" @click="modelNavigateTo(item)" class="image-mode" v-for="(item,index) in res.list" :key="index" :src="item.img" alt=""> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "浜斿垪鍗曡鍥剧墖妯″潡", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_flex_four.vue b/pages/product/home/template/tpl_flex_four.vue new file mode 100644 index 0000000..c802a92 --- /dev/null +++ b/pages/product/home/template/tpl_flex_four.vue @@ -0,0 +1,36 @@ + +<template> + <div class="layout"> + <u-image height="175rpx" mode="aspectFit" width="175rpx" @click="modelNavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "鍥涘垪鍗曡鍥剧墖妯″潡", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +img { + width: 84px; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_flex_one.vue b/pages/product/home/template/tpl_flex_one.vue new file mode 100644 index 0000000..5c7ebc6 --- /dev/null +++ b/pages/product/home/template/tpl_flex_one.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="flex-one"> + <u-image v-if="res.list[0].zoneInfo == ''" @click="modelNavigateTo(res.list[0])" width="100%" mode="aspectFit" height="280rpx" :src="res.list[0].img" alt=""></u-image> + <hotzone v-else :res="res"></hotzone> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +import hotzone from "@/pages/tabbar/home/template/tpl_hot_zone.vue"; + +export default { + title: "鍗曡鍥剧墖妯″潡", + components: { + hotzone, + }, + data() { + return { + modelNavigateTo + }; + }, + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.flex-one { + width: 100%; + display: block; + overflow: hidden; + > img { + width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_flex_three.vue b/pages/product/home/template/tpl_flex_three.vue new file mode 100644 index 0000000..65831e1 --- /dev/null +++ b/pages/product/home/template/tpl_flex_three.vue @@ -0,0 +1,40 @@ + +<template> + <div class="layout"> + <u-image @click="modelNavigateTo(item)" height="240rpx" width="240rpx" class="image-mode" :src="item.img" v-for="(item, index) in res.list" :key="index"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; + +export default { + title: "涓夊垪鍗曡鍥剧墖妯″潡", + props: ["res"], + mounted() { + + }, + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + padding: 0; + + display: flex; + align-items: center; + justify-content: center; + background-size: cover; +} +img { + width: 111px; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_flex_two.vue b/pages/product/home/template/tpl_flex_two.vue new file mode 100644 index 0000000..296dc35 --- /dev/null +++ b/pages/product/home/template/tpl_flex_two.vue @@ -0,0 +1,49 @@ +<template> + <div class="layout"> + <div class="flex-two"> + <div class="flex-item" @click="modelNavigateTo(res.list[0])"> + <u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[0].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="flex-item" @click="modelNavigateTo(res.list[1])"> + <u-image height="250rpx" width="100%" mode="scaleToFill" :src="res.list[1].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' + +import { modelNavigateTo } from "./tpl"; +export default { + title: "涓ゅ紶妯浘", + props: ["res"], + mounted() { + + }, + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.flex-two { + width: 100%; + display: flex; + overflow: hidden; +} +.flex-item { + width: 50%; + > img { + display: block; + max-width: 100%; + height: 100%; + } +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_goods.vue b/pages/product/home/template/tpl_goods.vue new file mode 100644 index 0000000..768e44a --- /dev/null +++ b/pages/product/home/template/tpl_goods.vue @@ -0,0 +1,263 @@ +<template> + <div class="layout"> + <u-sticky> + <div class="goods-cell-title"> + <div + class="goods-item-title" + :class="{ 'selected-title': selected.index == index }" + @click="handleClickTitle(title, index)" + v-for="(title, index) in res.list[0].titleWay" + :key="index" + > + <h4 class="h4">{{ title.title }}</h4> + <div>{{ title.desc }}</div> + </div> + </div> + </u-sticky> + <div class="goods-list"> + <div + v-if=" + item.___index != undefined + ? selected.index == item.___index + : selected.val == item.type + " + @click="handleClick(item)" + class="goods-item" + v-for="(item, item_index) in res.list[0].listWay" + :key="item_index" + > + <div class="goods-img"> + <u-image + :src="item.img" + height="350rpx" + mode="aspectFit" + width="100%" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="goods-desc"> + <div class="goods-title"> + {{ item.title }} + </div> + <div class="goods-bottom"> + <div class="goods-price"> + 楼<span + >{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span + >.{{ $options.filters.goodsFormatPrice(item.price)[1] }} + </div> + </div> + </div> + </div> + + <div + v-if="res.list[0].titleWay[selected.index].bindCategory && goodsData.length" + v-for="(item, index) in goodsData" + :key="index" + class="goods-item" + @click="handleClick(item)" + > + <div class="goods-img"> + <u-image + :src="item.thumbnail" + height="350rpx" + mode="aspectFit" + width="100%" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="goods-desc"> + <div class="goods-title"> + {{ item.goodsName }} + </div> + <div class="goods-bottom"> + <div class="goods-price"> + 楼<span + >{{ $options.filters.goodsFormatPrice(item.price)[0] }} </span + >.{{ $options.filters.goodsFormatPrice(item.price)[1] }} + </div> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { getGoodsList } from "@/api/goods.js"; +export default { + title: "鍟嗗搧鍒嗙被浠ュ強鍟嗗搧", + data() { + return { + selected: { + index: 0, + val: "", + }, + params: { + pageNumber: 1, + pageSize: 100, + categoryId: "", + }, + goodsData: [], //鍟嗗搧寰幆鍐呭 + goodsResult:"", //es鎬昏繑鍥炲唴瀹� + }; + }, + props: ["res","enableBottomLoad"], + watch: { + res: { + handler(val) { + // 鐩戝惉鐖剁骇鐨勫�� 濡傛灉鏈夊�煎皢鍊艰祴缁檚elected + if (val) { + console.log(val) + // 濡傛灉绗竴涓爣绛鹃〉缁戝畾涓哄晢鍝� + this.selected.val = this.res.list[0].listWay[0] ? this.res.list[0].listWay[0].type: ''; + // 濡傛灉绗竴涓爣绛句负缁戝畾涓哄垎绫� + this.res.list[0].titleWay[0].bindCategory ? this.initGoods(this.res.list[0].titleWay[0]) : '' + } + }, + immediate: true, + }, + }, + mounted() { + uni.$on('onReachBottom',()=>{ + if(this.enableBottomLoad && this.goodsResult.totalElements >= this.params.pageNumber * this.params.pageSize){ + this.params.pageNumber++ + this.initGoods(this.res.list[0].titleWay[this.selected.index]) + } + + }) + }, + destroyed(){ + uni.$off('onReachBottom') + }, + methods: { + handleClick(item) { + uni.navigateTo({ + url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, + }); + }, + closeGoods(val, index) { + this.res.list[0].listWay.splice(index, 1); + }, + async initGoods(val) { + if(this.enableBottomLoad) this.params.pageSize = 20 + val ? this.params.categoryId = val.bindCategory.id : ''; + const res = await getGoodsList(this.params); + if (res.data.success) { + this.goodsResult = res.data.result + const result = res.data.result.records + this.goodsData.push(...result); + console.log(this.goodsData) + } + }, + handleClickTitle(val, index) { + this.selected.index = index; + this.selected.val = val.title; + if (val.bindCategory) { + this.params.pageNumber = 1 + this.goodsData = [] + this.initGoods(val); + } + }, + }, +}; +</script> +<style lang="scss" scoped> +$w_94: 94%; + +.layout { + padding: 8px 0; + background: #f9f9f9; +} + +.selected-title { + > h4 { + font-size: 30rpx; + color: #000 !important; + } + + > div { + font-weight: bold; + color: $main-color !important; + } +} + +.goods-cell-title { + background: #f9f9f9; + padding: 10px; + transition: 0.35s; + display: flex; + + > .goods-item-title { + flex: 1; + text-align: center; + + > h4 { + font-size: 32rpx; + } + + > div { + color: #999; + font-size: 24rpx; + } + } +} + +.goods-list { + width: 100%; + display: flex; + flex-wrap: wrap; +} + +.goods-item { + width: 50%; + margin-bottom: 10px; + border-radius: 0.4em; + overflow: hidden; +} + +.goods-img { + position: relative; + margin: 0 auto; + // width: 158px; + width: $w_94; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; + overflow: hidden; + > img { + width: 100%; + height: 100%; + } +} + +.goods-desc { + border-bottom-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + width: $w_94; + background: #fff; + padding: 8rpx 0 8rpx 8rpx; + margin: 0 auto; + > .goods-title { + font-size: 24rpx; + height: 67rpx; + display: -webkit-box; + font-weight: 500; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } + + > .goods-bottom { + display: flex; + font-weight: bold; + > .goods-price { + line-height: 2; + color: $main-color; + > span { + font-size: 42rpx; + } + } + } +} +</style> diff --git a/pages/product/home/template/tpl_group.vue b/pages/product/home/template/tpl_group.vue new file mode 100644 index 0000000..b234a80 --- /dev/null +++ b/pages/product/home/template/tpl_group.vue @@ -0,0 +1,40 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" @click="modelNavigateTo(item)" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img class="item-img" src="https://picsum.photos/id/268/200/200" alt /> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�190.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +import { modelNavigateTo } from "./tpl"; +export default { + props: ["res"], + title: "鎷煎洟", + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +@import "./advertising.scss"; +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_hot_zone.vue b/pages/product/home/template/tpl_hot_zone.vue new file mode 100644 index 0000000..ba51470 --- /dev/null +++ b/pages/product/home/template/tpl_hot_zone.vue @@ -0,0 +1,57 @@ +<template> + <div class="layout"> + <div class="flex-one hot-image"> + <image mode="widthFix" :src="res.list[0].img" alt=""></image> + + <image + v-for="(area, index) in res.list[0].zoneInfo" + :key="index" + @click="modelNavigateTo(area)" + mode="widthFix" + class="hot-area" + :style="{ + left: area.leftPer * 100 + '%', + top: area.topPer * 100 + '%', + width: area.widthPer * 100 + '%', + height: area.heightPer * 100 + '%', + }" + :src="area.img" + alt="" + ></image> + </div> + </div> +</template> +<script> +import { modelNavigateTo } from "./tpl"; + +export default { + title: "鐑尯妯″潡", + data() { + return { + modelNavigateTo, + }; + }, + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.hot-image { + position: relative; +} +.hot-area { + position: absolute; + z-index: 99; +} +.flex-one { + width: 100%; + display: block; + overflow: hidden; + image { + width: 100%; + + min-height: 200rpx; + // height: 100%; + } +} +</style> diff --git a/pages/product/home/template/tpl_integral.vue b/pages/product/home/template/tpl_integral.vue new file mode 100644 index 0000000..8f73a78 --- /dev/null +++ b/pages/product/home/template/tpl_integral.vue @@ -0,0 +1,85 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img class="item-img" src="https://picsum.photos/id/268/200/200" alt /> + </div> + <div class="item-price"> + <span>20绉垎</span> + </div> + <div class="item-line-through"> + <span>30绉垎</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + title:"绉垎鍟嗗搧", + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; +} +.join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_join_group.vue b/pages/product/home/template/tpl_join_group.vue new file mode 100644 index 0000000..9309331 --- /dev/null +++ b/pages/product/home/template/tpl_join_group.vue @@ -0,0 +1,90 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img + class="item-img" + src="https://picsum.photos/id/268/200/200" + alt + /> + <div class="item-position-tips">2浜哄洟</div> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�120.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + props: ["res"], + title:"鍥㈣喘" +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.item-price { + > span { + font-size: 15px; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 75px; + height: 75px; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 10px; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 12px; + bottom: 0; +} +.join-title { + display: flex; + justify-content: space-between; + align-items: center; + background: #fff; + height: 50px; + > div:nth-of-type(1) { + font-size: 16px; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 12px; + color: #999; + } +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_left_one_right_two.vue b/pages/product/home/template/tpl_left_one_right_two.vue new file mode 100644 index 0000000..5edeefd --- /dev/null +++ b/pages/product/home/template/tpl_left_one_right_two.vue @@ -0,0 +1,46 @@ + +<template> + <div class="layout"> + <div class="view-height-150" @click="modelNavigateTo(res.list[0])"> + <u-image width="100%" height="340rpx" class="image-mode" :src="res.list[0].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-150"> + <div class="view-height-75" @click="modelNavigateTo(res.list[1])"> + <u-image width="100%" height="170rpx" class="image-mode" :src="res.list[1].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-75" @click="modelNavigateTo(res.list[2])"> + <u-image width="100%" height="170rpx" class="image-mode" :src="res.list[2].img" alt> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "宸︿竴鍙充簩", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + + background-size: cover; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_left_two_right_one.vue b/pages/product/home/template/tpl_left_two_right_one.vue new file mode 100644 index 0000000..94a57d0 --- /dev/null +++ b/pages/product/home/template/tpl_left_two_right_one.vue @@ -0,0 +1,45 @@ + +<template> + <div class="layout "> + <div class="view-height-150"> + <div class="view-height-75" @click="modelNavigateTo(res.list[0])"> + <u-image class="image-mode" width="100%" height="150rpx" :src="res.list[0].img" ></u-image> + </div> + <div class="view-height-75" @click="modelNavigateTo(res.list[1])"> + <u-image class="image-mode" width="100%" height="150rpx" :src="res.list[1].img" ></u-image> + </div> + </div> + <div class="view-height-150" @click="modelNavigateTo(res.list[2])"> + <u-image class="image-mode" width="100%" height="300rpx" :src="res.list[2].img" ></u-image> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "宸︿簩鍙充竴", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + } +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + height: 300rpx; + display: flex; + align-items: center; + justify-content: center; + + background-size: cover; +} + +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_menu.vue b/pages/product/home/template/tpl_menu.vue new file mode 100644 index 0000000..79a500c --- /dev/null +++ b/pages/product/home/template/tpl_menu.vue @@ -0,0 +1,62 @@ +<template> + <div class="layout"> + <div class="menu-list"> + <div + class="menu-item" + @click="modelNavigateTo(item)" + v-for="(item, index) in res.list" + :key="index" + > + <div> + <u-image + width="88rpx" + height="88rpx" + class="menu-img" + :src="item.img" + > + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="menu-title">{{ item.title }}</div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "浜斿垪鑿滃崟", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.menu-list { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + + > .menu-item { + text-align: center; + width: 20%; + // flex: 1; + margin: 20rpx 0; + } +} +.menu-img { + display: flex; + margin: 0 auto; + width: 88rpx; + height: 88rpx; +} +.menu-title { + font-size: 24rpx; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_notice.vue b/pages/product/home/template/tpl_notice.vue new file mode 100644 index 0000000..98d6466 --- /dev/null +++ b/pages/product/home/template/tpl_notice.vue @@ -0,0 +1,50 @@ +<template> + <div class="layout"> + <div class="background"> + <u-notice-bar mode="vertical" :bg-color="res.list[0].bk_color" :color="res.list[0].color" :list="list"></u-notice-bar> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' + export default { + title: "鍏憡", + props: ["res"], + data() { + return { + list: [] + } + }, + mounted() { + this.list = this.res.list[0].title.map(i => i.context); + }, + }; +</script> +<style lang="scss" scoped> + @import "./tpl.scss"; + .background { + position: absolute; + z-index: 2; + width: 100%; + height: 84rpx; + text-align: left; + font-size: 20rpx; + background-size: cover; + } + .layout { + text-align: center; + position: relative; + height: 84rpx; + display: flex; + align-items: center; + justify-content: center; + + background: #ffffff; + } + .title { + line-height: 84rpx; + font-size: 20px; + font-weight: bold; + } +</style> diff --git a/pages/product/home/template/tpl_promotions_detail.vue b/pages/product/home/template/tpl_promotions_detail.vue new file mode 100644 index 0000000..cb2e925 --- /dev/null +++ b/pages/product/home/template/tpl_promotions_detail.vue @@ -0,0 +1,274 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div + v-for="(item, index) in res.list" + :key="index" + class="join-list-item" + @click="goToDetail(item.type)" + > + <div> + <div class="join-title"> + <div>{{ item.title }}</div> + <div + class="sub" + v-if="item.type !== 'SECKILL'" + :style="{ + backgroundColor: item.bk_color, + color: item.color1, + borderColor: item.bk_color, + }" + > + {{ item.title1 }} + </div> + <div class="sub-seckill" v-else> + <div class="sub-seckill-block flex"> + <div class="sub-seckill-block-text"> + {{ timeLine[0] ? timeLine[0].timeLine : "x" }}鐐瑰満 + </div> + {{ times.hours == "00" ? "0" : times.hours }}:{{ + times.minutes + }}:{{ times.seconds }} + </div> + </div> + </div> + <div class="join-box"> + <div + class="join-item" + v-for="(i, _index) in item.data" + :key="_index" + > + <div class="item-img-box"> + <u-image + class="item-img" + width="156rpx" + height="156rpx" + :src="i.thumbnail ? i.thumbnail : i.goodsImage" + alt + /> + </div> + <div + class="ellipsis" + :class="{ 'max-width': res.list.length <= 1 }" + > + {{ i.goodsName ? i.goodsName : i.name }} + </div> + <div class="item-price"> + <span>锟{ i.price ? i.price : i.originalPrice }}</span> + </div> + </div> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +import * as API_Promotions from "@/api/promotions"; +import Foundation from "@/utils/Foundation.js"; +export default { + props: ["res"], + data() { + return { + timeLine: "", //鑾峰彇鍑犱釜鐐规椿鍔� + resTime: 0, //褰撳墠鏃堕棿 + time: 0, //璺濈涓嬩竴涓椿鍔ㄧ殑鏃堕棿鍊� + times: {}, //鏃堕棿闆嗗悎 + onlyOne: "", //鏄惁鏈�鍚庝竴涓晢鍝� + }; + }, + mounted() { + let params = { + pageNumber: 1, + pageSize: 2, + status: "START", + promotionStatus: "START", + }; + this._setTimeInterval = setInterval(() => { + if (this.time <= 0) { + clearInterval(this._setTimeInterval); + } else { + this.times = Foundation.countTimeDown(this.time); + this.time--; + } + }, 1000); + this.res.list.forEach((ele) => { + switch (ele.type) { + case "PINTUAN": + API_Promotions.getAssembleList(params).then((response) => { + const data = response.data.result.records; + if (data) { + ele.data = data; + } + }); + break; + case "SECKILL": + API_Promotions.getSeckillTimeLine().then((response) => { + if (response.data.success && response.data.result) { + ele.data = response.data.result[0].seckillGoodsList.slice(0, 2); + let timeLine = response.data.result.sort( + (x, y) => Number(x.timeLine) - Number(y.timeLine) + ); + this.timeLine = timeLine.slice(0, 5); + this.resTime = parseInt(new Date().getTime() / 1000); + this.onlyOne = response.data.result.length === 1; + this.diffTime = parseInt(new Date().getTime() / 1000) - this.resTime; + + this.time = + this.timeLine[0].distanceStartTime || + (this.timeLine[1] && this.timeLine[1].distanceStartTime) || + Foundation.theNextDayTime() - this.diffTime; + this.times = Foundation.countTimeDown(this.time); + console.log(this.timeLine); + } + }); + break; + case "LIVE": + API_Promotions.getLiveList(params).then((response) => { + if (response.success && response.result.records) { + ele.data = response.result.records[0].commodityList.slice(0, 2); + } + }); + break; + case "KANJIA": + API_Promotions.getBargainList(params).then((response) => { + if (response.success && response.result) { + ele.data = response.result.records(0, 2); + } + }); + break; + default: + break; + } + }); + }, + methods: { + //璺宠浆璇︽儏 + goToDetail(type) { + switch(type) { + case "SECKILL": + uni.navigateTo({ + url: `/pages/promotion/seckill`, + }); + break; + case "PINTUAN": + uni.navigateTo({ + url: `/pages/promotion/joinGroup`, + }); + break; + case "LIVE": + uni.navigateTo({ + url: `/pages/promotion/lives`, + }); + break; + case "KANJIA": + uni.navigateTo({ + url: `/pages/promotion/bargain/list`, + }); + break; + }; + } + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.join-box { + display: flex; +} +.join-list { + width: 100%; + display: flex; + overflow: hidden; +} +.join-list-item { + flex: 1; +} +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 108rpx; // 澶т簬1涓椿鍔� + font-size: 22rpx; +} +.max-width { + width: 316rpx !important; +} +.item-price { + > span { + font-size: 28rpx; + font-weight: 500; + color: #e1212b; + } +} +.join-item { + flex: 1; +} +.item-img { + width: 150rpx; + height: 150rpx; + margin: 0 auto; + display: block; +} +.item-img-box { + position: relative; +} +.item-line-through { + > span { + font-size: 20rpx; + font-weight: 400; + text-decoration: line-through; + color: #999; + } +} +.item-position-tips { + position: absolute; + right: 0; + color: #fff; + font-size: 24rpx; + bottom: 0; +} +.join-title { + display: flex; + + align-items: center; + background: #fff; + height: 100rpx; + > div:nth-of-type(1) { + font-size: 30rpx; + font-weight: bold; + } + > div:nth-of-type(2) { + font-size: 20rpx; + line-height: 1.75; + border-radius: 16rpx; + text-align: center; + padding: 0 16rpx; + margin-left: 20rpx; + } + .sub { + background-color: #e1212b; + margin-right: 80rpx; + } + .sub-seckill { + white-space: nowrap; + padding: 0 !important; + } + .sub-seckill-block { + background: rgba($main-color, 0.3); + border-radius: 100px !important; + color: rgba($main-color, 0.7); + overflow: hidden; + padding-right: 8rpx; + } + .sub-seckill-block-text { + background-color: $main-color; + color: #fff; + border-top-right-radius: 100px; + border-bottom-right-radius: 100px; + padding: 0 12rpx !important; + margin-right: 12rpx; + } +} +</style> diff --git a/pages/product/home/template/tpl_search.vue b/pages/product/home/template/tpl_search.vue new file mode 100644 index 0000000..7da30eb --- /dev/null +++ b/pages/product/home/template/tpl_search.vue @@ -0,0 +1,64 @@ +<template> + <div class="layout"> + <div class="search" @click="handleSearch"> + <u-icon name="search"></u-icon> + {{ res.list[0].title }} + </div> + <div slot="right" open-type="contact" class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);" > + <image style="width:53rpx;height:53rpx;margin-top:6rpx;" src="@/pages/subComponents/static/img/title.png"></image> + </div> + </div> +</template> +<script> +import '@/components/uview-components/uview-ui' +export default { + title:"鎼滅储鏍�", + props: ["res","storeId"], + methods: { + linkMsgDetail(){ + uni.navigateTo({ + url:`/pages/tabbar/home/title` + }) + }, + + handleSearch() { + if(this.storeId){ + uni.navigateTo({ + url: `/pages/navigation/search/searchPage?storeId=${this.storeId}`, + }); + }else{ + uni.navigateTo({ + url: `/pages/navigation/search/searchPage`, + }); + } + + }, + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; + +.search { + height: 64rpx; + border-radius: 10rpx; + display: flex; + align-items: center; + justify-content: center; + background: #ededed; +} + +.layout { + background: #fff; + padding: 0 16rpx; + position: relative; +} +.navbar-right{ + position: absolute; + top: 0; + // right: 0; +} +.message{ + right:40rpx; +} +</style> diff --git a/pages/product/home/template/tpl_spike.vue b/pages/product/home/template/tpl_spike.vue new file mode 100644 index 0000000..c77a51b --- /dev/null +++ b/pages/product/home/template/tpl_spike.vue @@ -0,0 +1,38 @@ +<template> + <div class="layout"> + <div class="join-list"> + <div class="join-title"> + <div>{{ res.list[0].title }}</div> + <div>鏇村</div> + </div> + <div class="join-box"> + <div class="join-item" v-for="item in 4" :key="item"> + <div class="item-img-box"> + <img + class="item-img" + src="https://picsum.photos/id/268/200/200" + alt + /> + </div> + <div class="item-price"> + <span>锟�120.00</span> + </div> + <div class="item-line-through"> + <span>锟�190.00</span> + </div> + </div> + </div> + </div> + </div> +</template> +<script> +// TODO 鍚庣画鐗堟湰寮�鍙戞鍔熻兘 灏芥儏鏈熷緟 +export default { + props: ["res"], +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +@import './advertising.scss'; + +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_text_picture.vue b/pages/product/home/template/tpl_text_picture.vue new file mode 100644 index 0000000..a071a0e --- /dev/null +++ b/pages/product/home/template/tpl_text_picture.vue @@ -0,0 +1,101 @@ + +<template> + <div class="layout"> + <div class="view-list"> + <div class="view-item" @click="modelNavigateTo(res.list[0])"> + <div class="-item-tilte">{{res.list[0].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[0].img" alt ></u-image> + </div> + </div> + <div class="view-item" @click="modelNavigateTo(res.list[1])"> + <div class="-item-tilte">{{res.list[1].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[1].img" alt ></u-image> + </div> + </div> + </div> + <div class="view-list"> + <div class="view-item" @click="modelNavigateTo(res.list[2])"> + <div class="-item-tilte">{{res.list[2].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[2].img" alt ></u-image> + </div> + </div> + <div class="view-item" @click="modelNavigateTo(res.list[3])"> + <div class="-item-tilte">{{res.list[3].title}}</div> + <div class="-item-image"> + <u-image width="120rpx" mode="scaleToFill" height="120rpx" :src="res.list[3].img" alt ></u-image> + </div> + </div> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "鏂囧瓧鍥剧墖妯℃澘", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + } +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + background: #e8e8e8; + align-items: center; + justify-content: center; + background-size: cover; + padding: 0; +} +.-item-image{ + + padding: 10px ; + >img{ + + width: 100%; + } +} +.-item-tilte { + background: $aider-light-color; + height: 60rpx; + color: #fff; + font-size: 14px; + text-align: center; + line-height: 30px; +} + +.view-list { + width: 48%; + margin: 0 auto; + display: flex; + background: #fff; + border-top-left-radius: 0.8em; + border-top-right-radius: 0.8em; + border: 1px solid #ededed; + + > .view-item { + width: 50%; + } + > .view-item:nth-of-type(1) { + > .-item-tilte { + border-top-left-radius: 0.8em; + } + } + > .view-item:nth-of-type(2) { + > .-item-tilte { + border-top-right-radius: 0.8em; + } + } +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_title.vue b/pages/product/home/template/tpl_title.vue new file mode 100644 index 0000000..ded00d1 --- /dev/null +++ b/pages/product/home/template/tpl_title.vue @@ -0,0 +1,58 @@ +<template> + <div class="layout" :style="{textAlign: res.list[0].textAlign}" @click="modelNavigateTo(res.list[0])" > + <div class="background" :style="{ backgroundColor: res.list[0].bk_color}"> + <div class="title" :style="{ color: res.list[0].color }"> + {{ res.list[0].title }} + </div> + <div style="position: absolute;right: 10px;top:2px;color: #fff;line-height: 42px;font-size: 10px"> + <a :style="{ color: res.list[0].color1 }" style="text-decoration: none">{{ res.list[0].title1 }}</a> + </div> + </div> + </div> +</template> + + +<script> +import { modelNavigateTo } from "./tpl"; +export default { + title: "鏍囬鏍�", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.background { + // background: url("/pages/subComponents/static/title.png") no-repeat; + position: absolute; + z-index: 2; + width: 100%; + height: 84rpx; + background-position-x: center; + background-position-y: center; + background-size: cover; +} + +.layout { + text-align: center; + position: relative; + height: 84rpx; + display: flex; + align-items: center; + justify-content: center; + + background: #ffffff; +} + +.title { + line-height: 84rpx; + font-size: 30rpx; + font-weight: bold; + margin-left: 8rpx; +} +</style> diff --git a/pages/product/home/template/tpl_top_one_bottom_two.vue b/pages/product/home/template/tpl_top_one_bottom_two.vue new file mode 100644 index 0000000..c77229f --- /dev/null +++ b/pages/product/home/template/tpl_top_one_bottom_two.vue @@ -0,0 +1,73 @@ + +<template> + <div class="layout"> + <div class="view-width-100" @click="modelNavigateTo(res.list[0])"> + <u-image class="image-mode" width="100%" height="200rpx" :src="res.list[0].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-width-100" @click="modelNavigateTo(res.list[1])"> + <div class="view-height-85"> + <u-image class="image-mode" width="100%" height="170rpx" :src="res.list[1].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + <div class="view-height-85" @click="modelNavigateTo(res.list[2])"> + <u-image class="image-mode" width="100%" height="170rpx" :src="res.list[2].img"> + <u-loading slot="loading"></u-loading> + </u-image> + </div> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import { modelNavigateTo } from "./tpl"; +export default { + title: "涓婁竴涓嬩簩", + props: ["res"], + data() { + return { + modelNavigateTo, + }; + }, + mounted() {}, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; + + flex-direction: column; +} +// img { +// width: 100% !important; +// height: 85px !important; +// } +.view-width-100 { + padding: 1px 0; + display: flex; + height: 200rpx; + width: 100%; + > img { + width: 100%; + height: 100%; + } +} +.view-height-85 { + padding: 0 1px; + width: 50%; + > img { + width: 100%; + height: 100%; + } +} +.image-mode{ + width: 100%; +} +</style> \ No newline at end of file diff --git a/pages/product/home/template/tpl_top_two_bottom_one.vue b/pages/product/home/template/tpl_top_two_bottom_one.vue new file mode 100644 index 0000000..c387755 --- /dev/null +++ b/pages/product/home/template/tpl_top_two_bottom_one.vue @@ -0,0 +1,80 @@ +<template> + <div class="layout"> + <div class="view-width-100"> + <div class="view-height-85" @click="modelNavigateTo(res.list[0])"> + <u-image + class="image-mode" + height="170rpx" + width="100%" + :src="res.list[0].img" + alt + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + <div class="view-height-85" @click="modelNavigateTo(res.list[1])"> + <u-image + class="image-mode" + height="170rpx" + width="100%" + :src="res.list[1].img" + alt + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + </div> + <div class="view-width-100" @click="modelNavigateTo(res.list[2])"> + <u-image + class="image-mode" + height="200rpx" + width="100%" + :src="res.list[2].img" + ><u-loading slot="loading"></u-loading + ></u-image> + </div> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +import {modelNavigateTo} from './tpl' +export default { + title: "涓婁簩涓嬩竴", + props: ["res"], + data () { + return { + modelNavigateTo, + } + }, + mounted() { + + }, +}; +</script> +<style lang="scss" scoped> +@import "./tpl.scss"; +.layout { + display: flex; + align-items: center; + justify-content: center; + background-size: cover; + // height: 260rpx; + flex-direction: column; +} +// img { +// width: 100% !important; +// height: 85px !important; +// } +.view-width-100 { + padding: 1px 0; + display: flex; + height: 200rpx; + width: 100%; +} +.view-height-85 { + padding: 0 1px; + width: 50%; +} +.image-mode{ + width: 100%; +} +</style> diff --git a/pages/product/home/title.vue b/pages/product/home/title.vue new file mode 100644 index 0000000..e36d240 --- /dev/null +++ b/pages/product/home/title.vue @@ -0,0 +1,193 @@ +<template> + <view> + <view> + <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs> + <view v-if="showLoading" style="width:500rpx;margin:0 auto;text-align: center;height:800rpx;line-height: 800rpx;"> + <u-loading mode="flower" ></u-loading> + <text>姝e湪鍔犺浇涓�</text> + </view> + <u-cell-group v-if="current == 0"> + <view v-for="(item,index) in lists" :key="index"> + <u-cell-item :arrow="false" v-if="item.status =='UN_READY'" style="position: relative;" + @click="linkMsgDetail(item)"> + <template slot="label"> + <view style="display: inline-block; + width: 100%; + height: auto; + font-family: Gibson; + font-size: 25rpx; + word-break: break-all; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: pre-wrap;"> + <view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view> + <view>{{item.content}}</view> + <view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view> + </view> + </template> + <!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#000000;color:white;">鏈</button> --> + </u-cell-item> + </view> + + </u-cell-group> + <u-cell-group v-if="current == 1"> + <view v-for="(item,index) in lists" :key="index"> + <u-cell-item :arrow="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;" + @click="linkMsgDetail(item)"> + <template slot="label"> + <view style="display: inline-block; + width: 100%; + height: auto; + font-family: Gibson; + font-size: 25rpx; + word-break: break-all; + text-overflow: ellipsis; + word-wrap: break-word; + + white-space: pre-wrap;"> + <view style="color:black;font-size:30rpx;font-weight:500;">{{item.title}}</view> + <view>{{item.content}}</view> + <view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view> + </view> + </template> + <!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#F3F3FA;color:black;">宸茶</button> --> + </u-cell-item> + </view> + </u-cell-group> + </view> + + </view> +</template> + +<script> + import '@/components/uview-components/uview-ui' + import { + messages, + editMessages + } from "@/api/message.js" + export default { + data() { + return { + showLoading:true, + params: { + pageSize: 20, + pageNumber: 1, + memberId: "", + messageId: "", + status:"UN_READY" + }, + loadText: { + loadmore: '杞昏交涓婃媺', + loading: '鍔姏鍔犺浇涓�', + nomore: '瀹炲湪娌℃湁浜�' + }, + list: [{ + name: "鏈" + }, { + name: "宸茶" + }], + current: 0, + lists: [], + status: "loadmore" + } + }, + onShow() { + this.getMessage() + }, + onReachBottom() { + this.params.pageNumber++; + this.statuss = "loading"; + this.getMessage() + }, + methods: { + linkMsgDetail(v) { + + if (v.status == 'UN_READY') { + let params = {} + params.messageId = v.memberId + editMessages(v.id, params).then(res => { + if (res.data.success) { + console.log( this.lists) + this.lists.forEach((item,index)=>{ + console.log(item) + if(item.id == v.id){ + this.lists.splice(index, 1) + } + }) + } + }) + } + + // uni.navigateTo({ + // url:`/pages/tabbar/home/messageDetail?data=${encodeURIComponent(JSON.stringify(v))}` + // }) + + + }, + /** + * 杩斿洖 + */ + back() { + if (getCurrentPages().length == 1) { + uni.switchTab({ + url: "/pages/tabbar/home/index", + }); + } else { + uni.navigateBack(); + } + }, + change(e) { + this.showLoading = true; + console.log(e) + this.current = e; + if (e == 0) { + this.params.status = "UN_READY" + this.params.pageNumber = 1; + } else if (e == 1) { + this.params.status = "ALREADY_READY" + this.params.pageNumber = 1; + } + this.lists = [] + this.getMessage() + }, + getMessage() { + this.params.memberId = this.$options.filters.isLogin().id; + + messages(this.params).then(res => { + console.log(res) + if (res.data.success) { + this.showLoading = false + if (res.data.result.records == '') { + console.log(11111) + this.status = "nomore" + } + res.data.result.records.forEach(item => { + this.lists.push(item) + let obj = {}; + this.lists = this.lists.reduce( + (cur, next) => { + //瀵硅薄鍘婚噸 + if (next.id != undefined) { + obj[next.id] ? + "" : + (obj[next.id] = true && cur.push(next)); + } + console.log(cur); + return cur; + }, + [] + ) + }) + + } + }) + } + }, + } +</script> +<style> + .foot { + position: fixed; + bottom: 0; + } +</style> diff --git a/pages/product/home/views.vue b/pages/product/home/views.vue new file mode 100644 index 0000000..f148be0 --- /dev/null +++ b/pages/product/home/views.vue @@ -0,0 +1,250 @@ +<template> + <div class="wrapper"> + <!-- uni 涓笉鑳戒娇鐢� vue component 鎵�浠ョ敤if鍒ゆ柇姣忎釜缁勪欢 --> + <div v-for="(item, index) in pageData.list" :key="index"> + <!-- 鎼滅储鏍忥紝濡傛灉鍦ㄦゼ灞傝淇《閮ㄥ垯浼氳嚜鍔ㄦ诞鍔紝鍚﹀垯涓嶆诞鍔� --> + <u-navbar class="navbar" v-if="item.type == 'search'" :is-back="false" :is-fixed="index === 1 ? false : true"> + <search style="width: 100%" :res="item.options" /> + <!-- #ifndef H5 --> + <!-- 鎵爜鍔熻兘 涓嶅吋瀹筯5 璇︽儏鏂囨。: https://uniapp.dcloud.io/api/system/barcode?id=scancode --> + <div slot="right" class="navbar-right"> + <u-icon name="scan" @click="scan()" color="#666" size="50"></u-icon> + </div> + <!-- #endif --> + </u-navbar> + <carousel v-if="item.type == 'carousel'" :res="item.options" /> + <titleLayout v-if="item.type == 'title'" :res="item.options" /> + <leftOneRightTwo v-if="item.type == 'leftOneRightTwo'" :res="item.options" /> + <leftTwoRightOne v-if="item.type == 'leftTwoRightOne'" :res="item.options" /> + <topOneBottomTwo v-if="item.type == 'topOneBottomTwo'" :res="item.options" /> + <topTwoBottomOne v-if="item.type == 'topTwoBottomOne'" :res="item.options" /> + <flexThree v-if="item.type == 'flexThree'" :res="item.options" /> + <flexFive v-if="item.type == 'flexFive'" :res="item.options" /> + <flexFour v-if="item.type == 'flexFour'" :res="item.options" /> + <flexTwo v-if="item.type == 'flexTwo'" :res="item.options" /> + <textPicture v-if="item.type == 'textPicture'" :res="item.options" /> + <menuLayout v-if="item.type == 'menu'" :res="item.options" /> + <flexOne v-if="item.type == 'flexOne'" :res="item.options" /> + <goods :enableBottomLoad="enableLoad" v-if="item.type == 'goods'" :res="item.options" /> + <group v-if="item.type == 'group'" :res="item.options" /> + <notice v-if="item.type == 'notice'" :res="item.options" /> + <promotions v-if="item.type == 'promotionDetail'" :res="item.options" /> + <!-- <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" /> --> + <!-- <integral v-if="item.type == 'integral'" :res="item.options" /> --> + <!-- <spike v-if="item.type == 'spike'" :res="item.options" /> --> + + </div> + <fetchCoupon ref='coupon' /> + <u-no-network @retry="init" @isConnected="isConnected"></u-no-network> + </div> +</template> + +<script> +import '@/components/uview-components/uview-ui' +// 寮曠敤缁勪欢 +import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //瀵艰埅鏍忔ā鍧� +import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //鏍囬鏍忔ā鍧� +import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //宸︿竴鍙充簩妯″潡 +import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //宸︿簩鍙充竴妯″潡 +import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //涓婁竴涓嬩簩妯″潡 +import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //涓婁簩涓嬩竴妯″潡 +import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //鍗曡鍥剧墖妯″潡 +import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //涓ゅ紶妯浘妯″潡 +import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //涓夊垪鍗曡鍥剧墖妯″潡 +import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //浜斿垪鍗曡鍥剧墖妯″潡 +import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //鍥涘垪鍗曡鍥剧墖妯″潡 +import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //鏂囧瓧鍥剧墖妯℃澘 +import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //浜斿垪鑿滃崟妯″潡 +import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //鎼滅储鏍� +import tpl_group from "@/pages/tabbar/home/template/tpl_group"; // +import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //鍟嗗搧鍒嗙被浠ュ強鍒嗙被涓殑鍟嗗搧 +// 缁撴潫寮曠敤缁勪欢 +import { getFloorData } from "@/api/home"; //鑾峰彇妤煎眰瑁呬慨鎺ュ彛 +import permission from "@/js_sdk/wa-permission/permission.js"; //鏉冮檺宸ュ叿绫� +import config from "@/config/config"; + +import tpl_notice from "@/pages/tabbar/home/template/tpl_notice"; //鏍囬鏍忔ā鍧� +import tpl_promotions from "@/pages/tabbar/home/template/tpl_promotions_detail"; //鏍囬鏍忔ā鍧� +import storage from "@/utils/storage.js"; +import fetchCoupon from '@/pages/tabbar/home/template/fetch_coupon' +// import {receiveCoupons} from "@/api/members" + +export default { + data () { + return { + config, + storage, + showCp:true, + pageData: "", //妤煎眰椤甸潰鏁版嵁 + isIos: "", + enableLoad: false, //瑙﹀簳鍔犺浇 閽堝浜庡晢鍝佹ā鍧� + }; + }, + components: { + carousel: tpl_banner, + titleLayout: tpl_title, + leftOneRightTwo: tpl_left_one_right_two, + leftTwoRightOne: tpl_left_two_right_one, + topOneBottomTwo: tpl_top_one_bottom_two, + topTwoBottomOne: tpl_top_two_bottom_one, + flexThree: tpl_flex_three, + flexFive: tpl_flex_five, + flexFour: tpl_flex_four, + flexTwo: tpl_flex_two, + textPicture: tpl_text_picture, + menuLayout: tpl_menu, + search: tpl_search, + flexOne: tpl_flex_one, + goods: tpl_goods, + group: tpl_group, + notice: tpl_notice, + promotions: tpl_promotions, + fetchCoupon + }, + + mounted () { + this.init(); + // #ifdef MP-WEIXIN + // 灏忕▼搴忛粯璁ゅ垎浜� + uni.showShareMenu({ withShareTicket: true }); + // #endif + + }, + methods: { + fetchCoupon(){ + this.$refs.coupon.firstGetAuto(); + }, + /** + * 瀹炰緥鍖栭椤垫暟鎹ゼ灞� + */ + init () { + this.pageData = ""; + getFloorData().then((res) => { + if (res.data.success) { + const result = JSON.parse(res.data.result.pageData) + this.pageData = result; + if (result.list.length) { + // 濡傛灉鏈�鍚庝竴涓淇ā鍧楁槸鍟嗗搧妯″潡鐨勮瘽 榛樿鍚敤鑷姩鍔犺浇 + result.list[result.list.length - 1] ? result.list[result.list.length - 1].model == 'goods' ? this.enableLoad = true : '' : '' + } + } + }); + }, + // 鏄惁鏈夌綉缁滈摼鎺� + isConnected (val) { + val ? this.init() : '' + }, + + /** + * TODO 鎵爜鍔熻兘鍚庣画杩樹細鍚庣画澧炲姞 + * 搴旇瀹炵幇鐨勫姛鑳界洰鍓嶈鍒掓湁锛� + * 鎵弿鍟嗗搧璺宠浆鍟嗗搧椤甸潰 + * 鎵弿娲诲姩璺宠浆娲诲姩椤甸潰 + * 鎵弿浜岀淮鐮佺櫥褰� + * 鎵弿鍏朵粬绔欎俊鎭� 寮瑰嚭鎻愮ず锛岃繑鍥為椤点�� + */ + scanCode () { + uni.scanCode({ + success: function (res) { + let path = encodeURIComponent(res.result); + + + + if (path != undefined && path.indexOf("QR_CODE_LOGIN_SESSION") == 0) { + console.log(path) + //app鎵爜鐧诲綍 + uni.navigateTo({ + url: "/pages/passport/scannerCodeLoginConfirm?token=" + path + }); + return; + } + + + // WX_CODE 涓哄皬绋嬪簭鐮� + if (res.scanType == "WX_CODE") { + console.log(res); + uni.navigateTo({ + url: `/${res.path}`, + }); + } else { + config.scanAuthNavigation.forEach((src) => { + if (res.result.indexOf(src) != -1) { + uni.navigateTo({ + url: `/${res.result.substring(src.length)}`, + }); + } else { + setTimeout(() => { + uni.navigateTo({ + url: "/pages/tabbar/home/web-view?src=" + path, + }); + }, 100); + } + }); + } + }, + }); + }, + + /** + * 鎻愮ず鑾峰彇鏉冮檺 + */ + tipsGetSettings () { + uni.showModal({ + title: "鎻愮ず", + content: "鎮ㄥ凡缁忓叧闂浉鏈烘潈闄�,鍘昏缃�", + success: function (res) { + if (res.confirm) { + if (this.isIos) { + plus.runtime.openURL("app-settings:"); + } else { + permission.gotoAppPermissionSetting(); + } + } + }, + }); + }, + + /** + * 鍞ら啋瀹㈡埛绔壂鐮� + * 娌℃潈闄愬幓鐢宠鏉冮檺锛屾湁鏉冮檺鑾峰彇鎵爜鍔熻兘 + */ + async scan () { + // #ifdef APP-PLUS + this.isIos = plus.os.name == "iOS"; + // 鍒ゆ柇鏄惁鏄疘os + if (this.isIos) { + const iosFirstCamera = uni.getStorageSync("iosFirstCamera"); //鏄笉鏄涓�娆″紑鍚浉鏈� + if (iosFirstCamera !== "false") { + uni.setStorageSync("iosFirstCamera", "false"); //璁句负false灏变唬琛ㄤ笉鏄涓�娆″紑鍚浉鏈� + this.scanCode(); + } else { + if (permission.judgeIosPermission("camera")) { + this.scanCode(); + } else { + // 娌℃湁鏉冮檺鎻愰啋鏄惁鍘荤敵璇锋潈闄� + this.tipsGetSettings(); + } + } + } else { + /** + * TODO 瀹夊崜 鏉冮檺宸茬粡鎺堟潈浜嗭紝璋冪敤api鎬绘槸鏄剧ず鐢ㄦ埛宸叉案涔呮嫆缁濈敵璇枫�備汉鍌讳簡 + * TODO 濡傛灉xdm鏈夋洿濂界殑鍔炴硶璇峰湪 https://gitee.com/beijing_hongye_huicheng/lilishop/issues 鎻愪笅璋㈣阿 + */ + this.scanCode(); + } + + // #endif + + // #ifdef MP-WEIXIN + this.scanCode(); + // #endif + }, + }, +}; +</script> + +<style scoped lang="scss"> +.navbar-right { + padding: 0 16rpx 0 0; +} +</style> diff --git a/pages/product/home/web-view.vue b/pages/product/home/web-view.vue new file mode 100644 index 0000000..892ffe2 --- /dev/null +++ b/pages/product/home/web-view.vue @@ -0,0 +1,53 @@ +<template> + <view class="web-view"> + <web-view :webview-styles="webviewStyles" :src="src"></web-view> + </view> +</template> + +<script> +import configs from "@/config/config"; +import storage from "@/utils/storage"; +export default { + data() { + return { + configs, + storage, + webviewStyles: { + progress: { + color: this.$lightColor, + }, + }, + src: "", + }; + }, + onLoad(params) { + // params.IM ? (this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}&id=${params.IM}`): (this.src = decodeURIComponent(params.src)); + if(params.IM) + { + if(params.IM==0) + { + this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}`; + } + else + { + this.src = `${configs.imWebSrc}?token=${storage.getAccessToken()}&id=${params.IM}`; + } + } + else + { + this.src = decodeURIComponent(params.src); + console.log(this.src); + } + + }, +}; +</script> + +<style lang="scss" scoped> +.web-view { + /deep/ .web-view { + padding: 0; + margin: 0; + } +} +</style> diff --git a/pages/product/m-goods-recommend/index.vue b/pages/product/m-goods-recommend/index.vue index 245bbc0..fe4b27a 100644 --- a/pages/product/m-goods-recommend/index.vue +++ b/pages/product/m-goods-recommend/index.vue @@ -5,7 +5,7 @@ </div> </template> <script> - import goodsTemplate from '@/pages/promotion/m-goods-list/list.vue' + import goodsTemplate from '@/pages/product/m-goods-list/list.vue' import { getGoodsList } from "@/api/goods.js"; export default { data() { diff --git a/pages/product/shopPage.vue b/pages/product/shopPage.vue index b0062c2..b9b48d8 100644 --- a/pages/product/shopPage.vue +++ b/pages/product/shopPage.vue @@ -161,22 +161,22 @@ <script> import '@/components/uview-components/uview-ui' // 寮曠敤缁勪欢 -import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //瀵艰埅鏍忔ā鍧� -import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //鏍囬鏍忔ā鍧� -import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //宸︿竴鍙充簩妯″潡 -import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //宸︿簩鍙充竴妯″潡 -import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //涓婁竴涓嬩簩妯″潡 -import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //涓婁簩涓嬩竴妯″潡 -import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //鍗曡鍥剧墖妯″潡 -import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //涓ゅ紶妯浘妯″潡 -import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //涓夊垪鍗曡鍥剧墖妯″潡 -import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //浜斿垪鍗曡鍥剧墖妯″潡 -import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //鍥涘垪鍗曡鍥剧墖妯″潡 -import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //鏂囧瓧鍥剧墖妯℃澘 -import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //浜斿垪鑿滃崟妯″潡 -import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //鎼滅储鏍� -import tpl_group from "@/pages/tabbar/home/template/tpl_group"; // -import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //鍟嗗搧鍒嗙被浠ュ強鍒嗙被涓殑鍟嗗搧 +import tpl_banner from "./home/template/tpl_banner.vue"; //瀵艰埅鏍忔ā鍧� +import tpl_title from "./home/template/tpl_title.vue"; //鏍囬鏍忔ā鍧� +import tpl_left_one_right_two from "./home/template/tpl_left_one_right_two.vue"; //宸︿竴鍙充簩妯″潡 +import tpl_left_two_right_one from "./home/template/tpl_left_two_right_one.vue"; //宸︿簩鍙充竴妯″潡 +import tpl_top_one_bottom_two from "./home/template/tpl_top_one_bottom_two.vue"; //涓婁竴涓嬩簩妯″潡 +import tpl_top_two_bottom_one from "./home/template/tpl_top_two_bottom_one.vue"; //涓婁簩涓嬩竴妯″潡 +import tpl_flex_one from "./home/template/tpl_flex_one.vue"; //鍗曡鍥剧墖妯″潡 +import tpl_flex_two from "./home/template/tpl_flex_two.vue"; //涓ゅ紶妯浘妯″潡 +import tpl_flex_three from "./home/template/tpl_flex_three.vue"; //涓夊垪鍗曡鍥剧墖妯″潡 +import tpl_flex_five from "./home/template/tpl_flex_five.vue"; //浜斿垪鍗曡鍥剧墖妯″潡 +import tpl_flex_four from "./home/template/tpl_flex_four.vue"; //鍥涘垪鍗曡鍥剧墖妯″潡 +import tpl_text_picture from "./home/template/tpl_text_picture.vue"; //鏂囧瓧鍥剧墖妯℃澘 +import tpl_menu from "./home/template/tpl_menu.vue"; //浜斿垪鑿滃崟妯″潡 +import tpl_search from "./home/template/tpl_search.vue"; //鎼滅储鏍� +import tpl_group from "./home/template/tpl_group.vue"; // +import tpl_goods from "./home/template/tpl_goods.vue"; //鍟嗗搧鍒嗙被浠ュ強鍒嗙被涓殑鍟嗗搧 import goodsTemplate from '@/pages/product/m-goods-list/list.vue' import { getStoreBaseInfo, getStoreCategory } from "@/api/store.js"; import { diff --git a/pages/promotion/m-goods-recommend/README.md b/pages/promotion/m-goods-recommend/README.md new file mode 100644 index 0000000..b33849a --- /dev/null +++ b/pages/promotion/m-goods-recommend/README.md @@ -0,0 +1,10 @@ +## 鍟嗗搧鎺ㄨ崘 + + +### OBJECT 鍙傛暟璇存槑 +灞炴�璇存槑|绫诲瀷|蹇呭~ +---|---|---|--- +`title`|鏍囬锛岀敤浜庨《閮ㄦ樉绀虹殑鍐呭|String|鍚� +`pageSize`|鏄剧ず澶氬皯鏉℃暟鎹紝寤鸿鏄�2鐨勫�嶆暟,榛樿涓�12鏉*|鍚� +`categoryId`|鍒嗙被id|Function|鍚� +`storeId`|鍗栧id锛屾悳绱㈠簵閾哄晢鍝佺殑鏃跺�欎娇鐢▅String|鍚� \ No newline at end of file diff --git a/pages/promotion/m-goods-recommend/index.vue b/pages/promotion/m-goods-recommend/index.vue new file mode 100644 index 0000000..245bbc0 --- /dev/null +++ b/pages/promotion/m-goods-recommend/index.vue @@ -0,0 +1,137 @@ +<template> + <div> + <div class="goods-recommend">{{title ? `--${title}-- `:''}}</div> + <goodsTemplate :res='goodsList' /> + </div> +</template> +<script> + import goodsTemplate from '@/pages/promotion/m-goods-list/list.vue' +import { getGoodsList } from "@/api/goods.js"; +export default { + data() { + return { + goodsList: [], + params: { + pageNumber: 1, + }, + }; + }, + props: { + title: { + type: String, + default: "", + }, + pageSize: { + type: null, + default: 12, + }, + categoryId: { + type: null, + default: "", + }, + storeId: { + type: null, + default: "", + }, + }, + components:{goodsTemplate}, + mounted() { + this.initGoods(); + }, + methods: { + /** + * 鍒濆鍖栧晢鍝� + */ + async initGoods() { + let submit = JSON.parse( + JSON.stringify( + Object.assign(this.params, { + pageSize: this.pageSize, + categoryId: this.categoryId, + storeId: this.storeId, + }) + ) + ); + + Object.keys(submit).map((key) => { + if (!submit[key] || submit[key].length == 0) { + delete submit[key]; + } + }); + let goodsList = await getGoodsList(submit); + this.goodsList.push(...goodsList.data.result.records); + }, + handleClick(item) { + uni.navigateTo({ + url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, + }); + }, + }, +}; +</script> + +<style scoped lang="scss"> +/**鍟嗗搧浠g爜 */ +$w_94: 94%; +.goods-recommend { + background: #f7f7f7; + height: 100rpx; + line-height: 100rpx; + text-align: center; + font-size: 30rpx; + font-weight: bold; +} +.goods-list { + display: flex; + flex-wrap: wrap; + background: #f7f7f7; +} +.goods-item { + width: 50%; + margin-bottom: 10px; + border-radius: 0.4em; + overflow: hidden; +} +.goods-img { + position: relative; + margin: 0 auto; + width: $w_94; + height: 350rpx; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; + overflow: hidden; + > img { + width: 100%; + height: 100%; + } +} +.goods-desc { + border-bottom-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + width: $w_94; + background: #fff; + padding: 8rpx 0 8rpx 8rpx; + margin: 0 auto; + > .goods-title { + font-size: 12px; + height: 70rpx; + display: -webkit-box; + font-weight: 500; + -webkit-box-orient: vertical; + + -webkit-line-clamp: 2; + + overflow: hidden; + } + + > .goods-bottom { + display: flex; + font-weight: bold; + + > .goods-price { + line-height: 2; + color: $main-color; + } + } +} +</style> \ No newline at end of file diff --git a/pages/subComponents/comment.vue b/pages/subComponents/comment.vue new file mode 100644 index 0000000..58ebd48 --- /dev/null +++ b/pages/subComponents/comment.vue @@ -0,0 +1,379 @@ +<template> + <view class="comment"> + <view class="top-tab"> + <view class="tab-btn" :v-if="commentDetail"> + <view @click="select(0)" :class="{ cur: selectIndex == 0 }">鍏ㄩ儴</view> + <view @click="select(1)" :class="{ cur: selectIndex == 1 }">濂借瘎{{ commentDetail.good }}</view> + <view @click="select(2)" :class="{ cur: selectIndex == 2 }">涓瘎{{ commentDetail.moderate }}</view> + <view @click="select(3)" :class="{ cur: selectIndex == 3 }">宸瘎{{ commentDetail.worse }}</view> + <view @click="select(4)" :class="{ cur: selectIndex == 4 }">鏈夊浘{{ commentDetail.haveImage }}</view> + </view> + </view> + <!-- 璇勪环 --> + <div class="goodsBoxOver"> + <div class="scoll-page"> + <view class="eva-section"> + <div class="empty" v-if="commDetail.length < 1"> + <view> + <u-empty mode="message" text="璧炴棤璇勮"></u-empty> + </view> + </div> + <view class="eva-box" v-for="(item, index) in commDetail" :key="index"> + <view class="section-info"> + <image class="portrait" :src="item.memberProfile || userImage" mode="aspectFit"></image> + <view class="star-content"> + <text class="name">{{ item.memberName | noPassByName }}</text> + <text class="time">{{ item.createTime }}</text> + </view> + <view class="stars"> + <text :class="{ star: item.deliveryScore > 0 }"></text> + <text :class="{ star: item.deliveryScore > 1 }"></text> + <text :class="{ star: item.deliveryScore > 2 }"></text> + <text :class="{ star: item.deliveryScore > 3 }"></text> + <text :class="{ star: item.deliveryScore > 4 }"></text> + </view> + </view> + <view class="section-contant"> + <div class="content">{{ item.content }}</div> + <view class="img"> + <!-- 寰幆鍑虹敤鎴疯瘎浠风殑鍥剧墖 --> + <u-image width="140rpx" height="140rpx" v-if="item.images" v-for="(img, i) in splitImg(item.images)" :src="img" :key="i" @click="preview(splitImg(item.images), i)"> + </u-image> + </view> + <view class="bot"> + <text class="attr">{{ item.goodsName }} - {{ gradeList[item.grade] }}</text> + </view> + </view> + <view class="commentStyle" v-if="item.reply"> + 鍟嗗鍥炲锛� + <span class="addCommentSpan">{{ item.reply }}</span> + <view class="img"> + <!-- 寰幆鍑哄晢瀹跺洖澶嶈瘎浠风殑鍥剧墖 --> + <u-image width="140rpx" height="140rpx" v-if="item.replyImage" v-for="(replyImg, replyIndex) in splitImg(item.replyImage)" :src="replyImg" :key="replyIndex" + @click="preview(splitImg( item.replyImage), index)"> + </u-image> + </view> + </view> + </view> + <u-loadmore bg-color="transparent" style="margin:40rpx 0" :status="status" @loadmore="loadmore()" icon-type="iconType" /> + </view> + </div> + </div> + </view> +</template> + +<script> +import '@/components/uview-components/uview-ui' +// import { getGoodsDetail } from '@/api/goods.js'; +import * as membersApi from "@/api/members.js"; +import configs from '@/config/config' +export default { + data() { + return { + configs, + status: "loadmore", //搴曢儴鍒锋柊鐘舵�� + userImage:configs.defaultUserPhoto, + commentDetail: "", //璇勪环璇︽儏 + selectIndex: "0", //妫�绱㈡潯浠� + params: { // 璇勮鍒嗛〉鎻愪氦鏁版嵁 + pageNumber: 1, + pageSize: 10, + grade: "", + }, + gradeList: { + GOOD: "濂借瘎", + MODERATE: "涓瘎", + WORSE: "宸瘎", + HAVEIMAGE: "鏈夊浘", + }, + // 璇勮璇︽儏 + commDetail: [], + dataTotal: 0, //璇勮鐨勬�籺otal鏁伴噺 + opid: "", //涓婄骇浼犲弬id + }; + }, + async onLoad(options) { + this.getGoodsCommentsFun(options.id); + this.getGoodsCommentsNum(options.id); + this.opid = options.id; + }, + + /** + * 瑙﹀簳鍔犺浇 + */ + onReachBottom() { + this.params.pageNumber++; + this.getGoodsCommentsFun(this.opid); + }, + + methods: { + /** + * 鍒囧壊鍥惧儚 + */ + splitImg(val) { + if (val && val.split(",")) { + return val.split(","); + } else if (val) { + return val; + } else { + return false; + } + }, + + /** + * 鑾峰彇鍟嗗搧璇勮 + */ + getGoodsCommentsFun(id) { + this.status = "loading"; + // getGoodsComments + membersApi.getGoodsComments(id, this.params).then((res) => { + if ( + res.data.result.records == [] || + res.data.result.records == "" || + res.data.result.records == null + ) { + this.status = "noMore"; + return false; + } + this.commDetail = this.commDetail.concat(res.data.result.records); + this.dataTotal = res.data.result.total; + this.status = "loadmore"; + }); + }, + + /** + * 鑾峰彇鍟嗗搧璇勮鏁� + */ + getGoodsCommentsNum(id) { + membersApi.getGoodsCommentsCount(id).then((res) => { + if (res.statusCode === 200) { + this.commentDetail = res.data.result; + } + }); + }, + + /** + * 椤堕儴绛涢�夋潯浠� + */ + select(index) { + this.params = { + pageNumber: 1, + pageSize: 10, + }; + this.selectIndex = index; + this.params.grade = ["", "GOOD", "MODERATE", "WORSE", ""][ + this.selectIndex + ]; + this.selectIndex === 4 ? (this.params.haveImage = 1) : true; + this.commDetail = []; + if (this.selectIndex === 0) { + this.params = { + pageNumber: 1, + pageSize: 10, + grade: "", + }; + } + // 閲嶆柊鍔犺浇璇勮 + this.getGoodsCommentsFun(this.opid); + }, + + /** + * 鐐瑰嚮鍥剧墖鏀惧ぇ鎴栦繚瀛� + */ + preview(urls, index) { + uni.previewImage({ + current: index, + urls: urls, + longPressActions: { + itemList: ["淇濆瓨鍥剧墖"], + success: function (data) { + uni.showToast({ + title: "淇濆瓨鎴愬姛", + duration: 2000, + icon: "none", + }); + }, + fail: function (err) { + uni.showToast({ + title: "淇濆瓨澶辫触", + duration: 2000, + icon: "none", + }); + }, + }, + }); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.commentStyle { + margin-top: 16rpx; + padding: 14rpx 26rpx; + background: #f5f5f5; + border-radius: 6px; + font-size: 22rpx; + font-weight: 700; + text-align: left; + line-height: 40rpx; +} + +.addCommentSpan { + color: $u-tips-color !important; + padding-left: 20rpx; +} +.img { + display: flex; + flex-wrap: wrap; + /* height: 140rpx; */ + overflow: hidden; + + image { + width: 166rpx; + height: 166rpx; + margin: 0 15rpx 15rpx 0; + + &:nth-of-type(3n + 0) { + margin: 0 0 15rpx 0; + } + } +} + +.goodsBoxOver { + overflow-y: scroll; +} + +page { + background: #f7f7f7; +} +.comment { + color: #333; + background: #f7f7f7; + + overflow: hidden; + + .top-tab { + background: #fff; + margin-bottom: 10rpx; + border-radius: 20rpx; + display: flex; + flex-direction: column; + padding: 0 30rpx 0 30rpx; + font-size: 24rpx; + + .tab-btn { + margin-top: 20rpx; + display: flex; + flex-wrap: wrap; + + view { + min-width: 118rpx; + text-align: center; + height: 50rpx; + line-height: 50rpx; + padding: 0 10rpx; + background: #f8f8fe; + border-radius: 25rpx; + margin: 0 20rpx 30rpx 0; + + &.cur { + background: $aider-light-color; + color: #fff; + } + } + } + } + + .eva-section { + padding: 20rpx 0; + + .eva-box { + padding: 40rpx; + margin-bottom: 10rpx; + background: #fff; + border-radius: 20rpx; + /* star */ + .star-content { + display: flex; + flex-direction: column; + + view { + flex: 1; + display: flex; + align-items: center; + } + + .time { + font-size: 24rpx; + color: #999; + } + } + + .section-info { + display: flex; + + .stars { + flex: 1; + display: flex; + justify-content: flex-end; + align-items: center; + + .star { + width: 30rpx; + height: 30rpx; + background: url("/pages/subComponents/static/star.png"); + background-size: 100%; + } + } + .portrait { + flex-shrink: 0; + width: 80rpx; + height: 80rpx; + border-radius: 100px; + margin-right: 20rpx; + } + } + .section-contant { + display: flex; + flex-direction: column; + + .content { + font-size: 24rpx; + line-height: 46rpx; + font-weight: 400; + color: $font-color-dark; + color: #333; + padding: 26rpx 0; + } + + .img { + display: flex; + flex-wrap: wrap; + /* height: 140rpx; */ + overflow: hidden; + > * { + margin-right: 16rpx; + } + } + + .bot { + display: flex; + justify-content: space-between; + font-size: $font-sm; + color: $font-color-light; + margin-top: 20rpx; + + + } + } + } + } +} + +.empty { + padding-top: 300rpx; + color: #999999; + text-align: center; +} +</style> -- Gitblit v1.8.0