Commit 09b6c3ebb8d01b91f8f0626aede2e8578b7e4254
1 parent
6deb07e1
分类列表添加风格页面 商品列表
Showing
3 changed files
with
576 additions
and
48 deletions
pages/goods/categoryList/categoryList.js
1 | var t = getApp(), e = t.request, oo = t.globalData.setting; | 1 | var t = getApp(), e = t.request, oo = t.globalData.setting; |
2 | 2 | ||
3 | +var i = function (i) { | ||
4 | + return i && i.__esModule ? i : { | ||
5 | + default: i | ||
6 | + }; | ||
7 | +}(require("../../../utils/LoadMore.js")), a = new i.default(), ut = require("../../../utils/util.js"); | ||
8 | +//t = i,e = t | ||
3 | Page({ | 9 | Page({ |
4 | data: { | 10 | data: { |
5 | - is_date:true, | ||
6 | - scrollHeight: 0, | ||
7 | - currentTab:-1, | ||
8 | - abc:0, | 11 | + is_date:true, |
12 | + scrollHeight: 0, | ||
13 | + currentTab:-1, | ||
14 | + abc:0, | ||
9 | windowHeight:0, | 15 | windowHeight:0, |
10 | windowWidth: 0, | 16 | windowWidth: 0, |
11 | eachLetterHeight:0, | 17 | eachLetterHeight:0, |
@@ -39,13 +45,32 @@ Page({ | @@ -39,13 +45,32 @@ Page({ | ||
39 | cat_id:0, | 45 | cat_id:0, |
40 | pl_timer: null,//只有品类的定时器 | 46 | pl_timer: null,//只有品类的定时器 |
41 | is_pl_time:0, | 47 | is_pl_time:0, |
42 | - | 48 | + requestData:null, //风格三的商品数据列表 分页 |
49 | + stylePage:1, //商品列表分页标识 | ||
50 | + | ||
51 | + //风格三使用 | ||
52 | + url: t.globalData.setting.imghost, | ||
53 | + currentPage: 1, | ||
54 | + requestData: null, | ||
55 | + allData: null, | ||
56 | + openFilterModal: !1, | ||
57 | + baseUrl: "api/weshop/goods/page?1=1&cat_id=1&parent_id=0&orderField=goods_id&orderType=desc&page=1&is_mainshow=1&isonsale=1&store_id=1&is_recommend=1", | ||
58 | + requestUrl: "", | ||
59 | + tabname: "goods_id", //排序的字段 | ||
60 | + adname: "desc", //升降的字段 | ||
61 | + is_new: 0, | ||
62 | + is_hot: 0, | ||
63 | + msgStatus:false, //页面显示暂无数据状态 | ||
64 | + countDownNum: 3, | ||
65 | + timer: '', //定时器 | ||
43 | }, | 66 | }, |
44 | onLoad: function(tt) { | 67 | onLoad: function(tt) { |
68 | + var that = this; | ||
69 | + | ||
45 | const res = wx.getSystemInfoSync(), | 70 | const res = wx.getSystemInfoSync(), |
46 | letters = this.data.letters; | 71 | letters = this.data.letters; |
47 | 72 | ||
48 | - var that = this; | 73 | + |
49 | 74 | ||
50 | this.setData({ | 75 | this.setData({ |
51 | abc: t.globalData.heigth-88-88-16, | 76 | abc: t.globalData.heigth-88-88-16, |
@@ -77,11 +102,55 @@ Page({ | @@ -77,11 +102,55 @@ Page({ | ||
77 | if (this.data.is_used_share==0){ | 102 | if (this.data.is_used_share==0){ |
78 | this.get_nation(); | 103 | this.get_nation(); |
79 | } | 104 | } |
80 | - | 105 | + |
106 | + //风格三 | ||
107 | + //t = i,e = t | ||
108 | + var th = this; | ||
109 | + a.init(this, "", "requestData"); | ||
110 | + var url = this.data.baseUrl; | ||
111 | + this.data.is_new = i.is_new; | ||
112 | + this.data.is_hot = i.is_hot; | ||
113 | + if (0 != this.data.cat_id) { | ||
114 | + url += "&cat_id=" + this.data.cat_id; | ||
115 | + } | ||
116 | + | ||
117 | + // this.requestGoodsList(url); | ||
118 | + getApp().getConfig2(function (rs) { | ||
119 | + //计算等级价相关 | ||
120 | + var swithc_list = rs.switch_list; | ||
121 | + var sw_arr = JSON.parse(swithc_list); | ||
122 | + //---如果后台又开等级卡的开关--- | ||
123 | + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { | ||
124 | + th.setData({ rank_switch: true }); | ||
125 | + var user = getApp().globalData.userInfo; | ||
126 | + var ti = setInterval(function () { | ||
127 | + if (!user) return false; | ||
128 | + clearInterval(ti); | ||
129 | + //---回调卡的列表--- | ||
130 | + th.getPlusCardType(function (ob) { | ||
131 | + th.setData({ card_list: ob.card_list }); | ||
132 | + if (user.card_field) { | ||
133 | + var str = user['card_expiredate'].replace(/-/g, '/'); | ||
134 | + var end = new Date(str); | ||
135 | + end = Date.parse(end) / 1000; | ||
136 | + var now = ut.gettimestamp(); | ||
137 | + | ||
138 | + //--- 判断是等级会员,且在有效期范围内 --- | ||
139 | + if (user.card_field && now < end) { | ||
140 | + var card_name = ob.name_map.get(user.card_field); | ||
141 | + if (card_name.length > 4) card_name = card_name.substring(0, 4); | ||
142 | + th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list }); | ||
143 | + } | ||
144 | + } | ||
145 | + }) | ||
146 | + }, 500) | ||
147 | + } | ||
148 | + }); | ||
81 | }, | 149 | }, |
82 | 150 | ||
83 | onShow:function(){ | 151 | onShow:function(){ |
84 | var that=this; | 152 | var that=this; |
153 | + | ||
85 | //this.requestFirstCategoris(); | 154 | //this.requestFirstCategoris(); |
86 | if(getApp().globalData.user_id) getApp().requestCardNum(); | 155 | if(getApp().globalData.user_id) getApp().requestCardNum(); |
87 | getApp().getConfig2(function (e) { | 156 | getApp().getConfig2(function (e) { |
@@ -150,6 +219,7 @@ Page({ | @@ -150,6 +219,7 @@ Page({ | ||
150 | that.setData({ currentTab: 0 }); | 219 | that.setData({ currentTab: 0 }); |
151 | } | 220 | } |
152 | }) | 221 | }) |
222 | + | ||
153 | }, | 223 | }, |
154 | 224 | ||
155 | //---------------分类请求接口,数据进行拼装------------------ | 225 | //---------------分类请求接口,数据进行拼装------------------ |
@@ -180,7 +250,7 @@ Page({ | @@ -180,7 +250,7 @@ Page({ | ||
180 | } | 250 | } |
181 | } | 251 | } |
182 | t.setData({ catelist: arr}); | 252 | t.setData({ catelist: arr}); |
183 | - }else{ | 253 | + } else if (t.data.is_used_share == 1 || t.data.is_used_share == 2){ |
184 | 254 | ||
185 | //---------新的版本---------------- | 255 | //---------新的版本---------------- |
186 | for (var i = 0; i < dda.length; i++) { | 256 | for (var i = 0; i < dda.length; i++) { |
@@ -221,11 +291,11 @@ Page({ | @@ -221,11 +291,11 @@ Page({ | ||
221 | } | 291 | } |
222 | t.setData({one_level_classify:arr}); | 292 | t.setData({one_level_classify:arr}); |
223 | 293 | ||
224 | - } | 294 | + } |
225 | } | 295 | } |
226 | }); | 296 | }); |
227 | }, | 297 | }, |
228 | - | 298 | + |
229 | requestCategories: function(t) { | 299 | requestCategories: function(t) { |
230 | var s = this; | 300 | var s = this; |
231 | e.get("/api/goods/goodsSecAndThirdCategoryList", { | 301 | e.get("/api/goods/goodsSecAndThirdCategoryList", { |
@@ -460,36 +530,48 @@ Page({ | @@ -460,36 +530,48 @@ Page({ | ||
460 | }, | 530 | }, |
461 | // 新的版本分类点击一级分类 | 531 | // 新的版本分类点击一级分类 |
462 | click_classify:function(e){ | 532 | click_classify:function(e){ |
463 | - this.data.ishaf_three=0; | ||
464 | - var indexs=e.currentTarget.dataset.index; | 533 | + clearInterval(this.data.timer); |
534 | + this.setData({ countDownNum:3 ,stylePage:1}); | ||
535 | + this.data.ishaf_three = 0; | ||
536 | + var indexs = e.currentTarget.dataset.index; | ||
465 | var name = e.currentTarget.dataset.name; | 537 | var name = e.currentTarget.dataset.name; |
466 | var cid = e.currentTarget.dataset.cid; | 538 | var cid = e.currentTarget.dataset.cid; |
467 | var pid = e.currentTarget.dataset.pid; | 539 | var pid = e.currentTarget.dataset.pid; |
468 | var arr = e.currentTarget.dataset.arr; | 540 | var arr = e.currentTarget.dataset.arr; |
469 | - | ||
470 | - if (indexs==220){ this.get_brand();} | ||
471 | - if (arr!="undefined" && arr!=undefined){ | ||
472 | - if (arr.length==0){ | ||
473 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name,cat_id:cid, | ||
474 | - goodslist: null,is_level_three: 0 }); | ||
475 | - return false; | ||
476 | - } | ||
477 | - if (arr.length != 0){ | ||
478 | - var is_lev_thr=0 | ||
479 | - for(var i=0;i<arr.length;i++){ | ||
480 | - if (arr[i].arrays.length>0) {is_lev_thr=1;break; } | ||
481 | - } | ||
482 | - this.setData({ is_level_three: is_lev_thr }); | ||
483 | - | ||
484 | - if (this.data.is_level_three!=1) { | ||
485 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); | ||
486 | - } else { | ||
487 | - this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); | ||
488 | - } | 541 | + console.log("cid:=" + cid) |
542 | + if (indexs == 220) { this.get_brand(); } | ||
543 | + //==2的时候 请求数据为商品,不为分类 | ||
544 | + if (this.data.is_used_share == 2) { | ||
545 | + this.style(this.data.stylePage, cid) | ||
546 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid }); | ||
547 | + }else{ | ||
548 | + | ||
549 | + | ||
550 | + if (arr != "undefined" && arr != undefined) { | ||
551 | + if (arr.length == 0) { | ||
552 | + this.setData({ | ||
553 | + select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, | ||
554 | + goodslist: null, is_level_three: 0 | ||
555 | + }); | ||
556 | + return false; | ||
557 | + } | ||
558 | + if (arr.length != 0) { | ||
559 | + var is_lev_thr = 0 | ||
560 | + for (var i = 0; i < arr.length; i++) { | ||
561 | + if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; } | ||
562 | + } | ||
563 | + this.setData({ is_level_three: is_lev_thr }); | ||
564 | + | ||
565 | + if (this.data.is_level_three != 1) { | ||
566 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); | ||
567 | + } else { | ||
568 | + this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); | ||
569 | + } | ||
570 | + } | ||
489 | } | 571 | } |
572 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage:1}); | ||
490 | } | 573 | } |
491 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid}); | ||
492 | - | 574 | + |
493 | }, | 575 | }, |
494 | 576 | ||
495 | 577 | ||
@@ -527,4 +609,220 @@ Page({ | @@ -527,4 +609,220 @@ Page({ | ||
527 | this.destroyActivityTimer(); | 609 | this.destroyActivityTimer(); |
528 | }, | 610 | }, |
529 | 611 | ||
612 | + | ||
613 | + //风格三使用 | ||
614 | + changeTab: function (t) { | ||
615 | + var ord = t.currentTarget.dataset.href; | ||
616 | + var ad = t.currentTarget.dataset.ad; | ||
617 | + var url = this.data.requestUrl; | ||
618 | + | ||
619 | + if (this.data.tabname != ord) { | ||
620 | + this.setData({ tabname: ord, adname: "desc" }); | ||
621 | + } else { | ||
622 | + ad = ad == "desc" ? "asc" : "desc"; | ||
623 | + this.setData({ adname: ad }); | ||
624 | + } | ||
625 | + this.resetData(), this.requestGoodsList(url); | ||
626 | + }, | ||
627 | + | ||
628 | + requestGoodsList: function (t) { | ||
629 | + var that = this; | ||
630 | + that.data.requestUrl = t; | ||
631 | + e.get("/api/weshop/goods/page?1=1", { | ||
632 | + data: { page: that.data.stylePage, cat_id: that.data.cat_id, parent_id: 0, orderField: 'goods_id', orderType: 'desc', is_mainshow: 1, isonsale: 1, store_id: 1, is_recommend: 1 }, | ||
633 | + success: function (data) { | ||
634 | + console.log(data.data.data.pageData) | ||
635 | + that.setData({ | ||
636 | + requestData: data.data.data.pageData, | ||
637 | + is_go: 1 | ||
638 | + }); | ||
639 | + that.setData({ is_go: 1 }); | ||
640 | + that.data.stylePage++ , null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)), | ||
641 | + wx.stopPullDownRefresh(); | ||
642 | + } | ||
643 | + }); | ||
644 | + // //不是商品分组的,不是默认排序的 | ||
645 | + // if (t.indexOf("group_id") == -1 || e.data.tabname != "goods_id") { | ||
646 | + // t += "&orderField=" + e.data.tabname; | ||
647 | + // t += "&orderType=" + e.data.adname; | ||
648 | + // } | ||
649 | + // + "&parent_id=0&orderField=goods_id&orderType=desc&page="+this.data.page+"&is_mainshow=1&isonsale=1&store_id=1&is_recommend=1" | ||
650 | + // t += "&page=" + e.data.page; | ||
651 | + // a.request(t, | ||
652 | + // function (t) { | ||
653 | + // e.setData({ is_go: 1 }); | ||
654 | + // e.data.page++ , null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)), | ||
655 | + // wx.stopPullDownRefresh(); | ||
656 | + // }, | ||
657 | + // null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid } | ||
658 | + // ); | ||
659 | + }, | ||
660 | + | ||
661 | + onReachBottom: function () { | ||
662 | + console.log('监听上拉:=') | ||
663 | + var that = this; | ||
664 | + clearInterval(that.data.timer); | ||
665 | + that.setData({ | ||
666 | + stylePage: that.data.stylePage + 1, | ||
667 | + countDownNum: 3, | ||
668 | + }); | ||
669 | + that.style(that.data.stylePage, that.data.cat_id); | ||
670 | + }, | ||
671 | + // onPullDownRefresh: function () { | ||
672 | + // console.log('监听下拉:=' + this.data.requestUrl) | ||
673 | + // this.resetData(), this.requestGoodsList(this.data.requestUrl); | ||
674 | + // }, | ||
675 | + // 左侧更新 | ||
676 | + scrollLower: function (data) { | ||
677 | + console.log("上拉加载更多", JSON.stringify(data)) | ||
678 | + var that = this; | ||
679 | + clearInterval(that.data.timer); | ||
680 | + that.setData({ | ||
681 | + stylePage: that.data.stylePage + 1, | ||
682 | + countDownNum: 3, | ||
683 | + }); | ||
684 | + that.style(that.data.stylePage, that.data.cat_id); | ||
685 | + }, | ||
686 | + | ||
687 | + //页面版面风格三的时候请求推荐商品 返回 | ||
688 | + style: function (page, cid) { | ||
689 | + console.log("page:=" + page) | ||
690 | + var s = this | ||
691 | + e.get("/api/weshop/goods/page?1=1", { | ||
692 | + data: { page: page, cat_id: cid, parent_id: 0, orderField: 'goods_id', orderType: 'desc', is_mainshow: 1, isonsale: 1, store_id: 1, is_recommend: 1 }, | ||
693 | + success: function (e) { | ||
694 | + console.log(e.data.data.pageData) | ||
695 | + | ||
696 | + if (e.data.data.pageData.length > 0) { | ||
697 | + s.setData({ | ||
698 | + msgStatus: false, | ||
699 | + }); | ||
700 | + //如果有数据 怕断分页为第一页的时候直接渲染数据 | ||
701 | + if (page = 1) { | ||
702 | + s.setData({ | ||
703 | + requestData: e.data.data.pageData | ||
704 | + }); | ||
705 | + if (wx.pageScrollTo) { | ||
706 | + wx.pageScrollTo({ | ||
707 | + scrollTop: 0 | ||
708 | + }) | ||
709 | + } | ||
710 | + }else{ | ||
711 | + //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 | ||
712 | + var arr = s.data.requestData | ||
713 | + arr.push(e.data.data.pageData); | ||
714 | + s.setData({ | ||
715 | + requestData: arr | ||
716 | + }); | ||
717 | + } | ||
718 | + } else { | ||
719 | + //没有数据页面显示暂无数据 | ||
720 | + | ||
721 | + if (page != 1) { | ||
722 | + var dataArray = s.data.one_level_classify | ||
723 | + var index = s.data.index | ||
724 | + console.log(dataArray[index + 1]['items']) | ||
725 | + s.setData({ | ||
726 | + stylePage: 1, | ||
727 | + index: index + 1, | ||
728 | + select_classify_on: index + 1, | ||
729 | + cat_id: dataArray[index + 1]['items']['id'], | ||
730 | + classify_name: dataArray[index + 1]['items']['name'] | ||
731 | + }); | ||
732 | + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']) | ||
733 | + }else{ | ||
734 | + let countDownNum = 3; //获取倒计时初始值 | ||
735 | + s.setData({ | ||
736 | + msgStatus: true, | ||
737 | + countDownNum: countDownNum, | ||
738 | + requestData: [] | ||
739 | + }); | ||
740 | + s.setData({ | ||
741 | + timer: setInterval(function () { | ||
742 | + if (countDownNum == 0) { | ||
743 | + clearInterval(s.data.timer); | ||
744 | + //关闭定时器之后,可作其他处理 | ||
745 | + s.setData({ | ||
746 | + msgStatus: false, | ||
747 | + }) | ||
748 | + | ||
749 | + //如果没有数据就把分页初始化成第一页 | ||
750 | + //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据 | ||
751 | + var dataArray = s.data.one_level_classify | ||
752 | + var index = s.data.index | ||
753 | + console.log(dataArray[index + 1]['items']) | ||
754 | + s.setData({ | ||
755 | + stylePage: 1, | ||
756 | + index: index + 1, | ||
757 | + select_classify_on: index + 1, | ||
758 | + cat_id: dataArray[index + 1]['items']['id'], | ||
759 | + classify_name: dataArray[index + 1]['items']['name'] | ||
760 | + }); | ||
761 | + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); | ||
762 | + | ||
763 | + } | ||
764 | + countDownNum--; | ||
765 | + s.setData({ | ||
766 | + countDownNum: countDownNum | ||
767 | + }) | ||
768 | + }, 1000) | ||
769 | + | ||
770 | + }) | ||
771 | + } | ||
772 | + | ||
773 | + | ||
774 | + } | ||
775 | + } | ||
776 | + }); | ||
777 | + }, | ||
778 | + | ||
779 | + | ||
780 | + openFilterModal: function () { | ||
781 | + this.setData({ | ||
782 | + openFilterModal: !0 | ||
783 | + }); | ||
784 | + }, | ||
785 | + closeFilterModal: function () { | ||
786 | + this.setData({ | ||
787 | + openFilterModal: !1 | ||
788 | + }); | ||
789 | + }, | ||
790 | + filterGoods: function (t) { | ||
791 | + this.resetData(), this.requestGoodsList(t.currentTarget.dataset.href), this.closeFilterModal(); | ||
792 | + }, | ||
793 | + resetData: function () { | ||
794 | + a.resetConfig(), this.data.requestData = null, this.data.currentPage = 1; | ||
795 | + }, | ||
796 | + | ||
797 | + //---回复最初的设置--- | ||
798 | + restoreData: function () { | ||
799 | + this.setData({ | ||
800 | + requestData: null, | ||
801 | + }); | ||
802 | + this.data.page = 1; | ||
803 | + }, | ||
804 | + | ||
805 | + //--- 获取卡类列表 --- | ||
806 | + getPlusCardType: function (func) { | ||
807 | + var storid = oo.stoid; | ||
808 | + var th = this; | ||
809 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { | ||
810 | + var plusCard = res.data.data; | ||
811 | + var arr = [1219, 2089, 3031]; | ||
812 | + var new_arr = new Array(); | ||
813 | + var card_name_map = new Map(); | ||
814 | + var user = getApp().globalData.userInfo; | ||
815 | + for (var i = 0; i < plusCard.length; i++) { | ||
816 | + if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { | ||
817 | + continue; | ||
818 | + } | ||
819 | + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); | ||
820 | + card_name_map.set(name, plusCard[i].CardName); | ||
821 | + new_arr.push(plusCard[i]); | ||
822 | + } | ||
823 | + | ||
824 | + var ob = { "card_list": new_arr, "name_map": card_name_map }; | ||
825 | + func(ob); | ||
826 | + }) | ||
827 | + }, | ||
530 | }); | 828 | }); |
531 | \ No newline at end of file | 829 | \ No newline at end of file |
pages/goods/categoryList/categoryList.wxml
1 | +<!-- 风格1 --> | ||
1 | <block wx:if="{{is_used_share==0}}"> | 2 | <block wx:if="{{is_used_share==0}}"> |
2 | <view class='top_view' wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 3 | <view class='top_view' wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> |
3 | - <view class="swiper-tab" > | ||
4 | - <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}" | ||
5 | - data-current="0" bindtap="clickTab">分类</view> | ||
6 | - <view wx:if="{{is_show_gb}}" class="swiper-tab-item {{currentTab==1?'active':''}}" | ||
7 | - data-current="1" bindtap="clickTab">国家</view> | ||
8 | - <view wx:if="{{is_show_pp}}" class="swiper-tab-item {{currentTab==2?'active':''}}" | ||
9 | - data-current="2" bindtap="clickTab">品牌</view> | ||
10 | - </view> | ||
11 | -</view> | 4 | + <view class="swiper-tab" > |
5 | + <view wx:if="{{is_show_pl}}" class="swiper-tab-item {{currentTab==0?'active':''}}" | ||
6 | + data-current="0" bindtap="clickTab">分类</view> | ||
7 | + <view wx:if="{{is_show_gb}}" class="swiper-tab-item {{currentTab==1?'active':''}}" | ||
8 | + data-current="1" bindtap="clickTab">国家</view> | ||
9 | + <view wx:if="{{is_show_pp}}" class="swiper-tab-item {{currentTab==2?'active':''}}" | ||
10 | + data-current="2" bindtap="clickTab">品牌</view> | ||
11 | + </view> | ||
12 | + </view> | ||
12 | <view class="search-box " bindtap="goseach"> | 13 | <view class="search-box " bindtap="goseach"> |
13 | <view class="search-inner"> | 14 | <view class="search-inner"> |
14 | <view class="search-img"> | 15 | <view class="search-img"> |
@@ -16,7 +17,7 @@ | @@ -16,7 +17,7 @@ | ||
16 | </view> | 17 | </view> |
17 | <input bindfocus="goseach" class="search-cont" placeholder="寻找好口碑" type="text"></input> | 18 | <input bindfocus="goseach" class="search-cont" placeholder="寻找好口碑" type="text"></input> |
18 | </view> | 19 | </view> |
19 | -</view> | 20 | + </view> |
20 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 21 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> |
21 | <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;"> | 22 | <swiper current="{{currentTab}}" duration="300" bindanimationfinish="swiperTab" style="height:{{abc}}rpx;"> |
22 | <!--------分类----------> | 23 | <!--------分类----------> |
@@ -84,16 +85,17 @@ | @@ -84,16 +85,17 @@ | ||
84 | <view class="no-data-title">暂无分类</view> | 85 | <view class="no-data-title">暂无分类</view> |
85 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | 86 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> |
86 | </view> | 87 | </view> |
87 | -</block> | 88 | + </block> |
88 | <block wx:elif="{{is_do}}"> | 89 | <block wx:elif="{{is_do}}"> |
89 | <view class="no-data" > | 90 | <view class="no-data" > |
90 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | 91 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> |
91 | <view class="no-data-title">商家暂未设置分类</view> | 92 | <view class="no-data-title">商家暂未设置分类</view> |
92 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | 93 | <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> |
93 | </view> | 94 | </view> |
95 | + </block> | ||
94 | </block> | 96 | </block> |
95 | -</block> | ||
96 | -<block wx:else> | 97 | +<!-- 风格2 --> |
98 | +<block wx:elif="{{is_used_share == 1}}"> | ||
97 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | 99 | <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> |
98 | <!-- 新版分类头部 --> | 100 | <!-- 新版分类头部 --> |
99 | <view class="xc-search-box flex-center white_b"> | 101 | <view class="xc-search-box flex-center white_b"> |
@@ -262,4 +264,227 @@ | @@ -262,4 +264,227 @@ | ||
262 | </view> | 264 | </view> |
263 | </block> | 265 | </block> |
264 | 266 | ||
267 | +</block> | ||
268 | +<!-- 风格3 --> | ||
269 | +<block wx:elif="{{is_used_share == 2}}"> | ||
270 | + <block wx:if="{{is_show_pl || is_show_gb || is_show_pp }}"> | ||
271 | + <!-- 头部 --> | ||
272 | + <view class="xc-search-box flex-center white_b" id="navbar" style="position:fixed;top:0;z-index:99999"> | ||
273 | + <view class="share-height t-c" bindtap="getScancode" > | ||
274 | + <image class="scanning_black-img"src="{{iurl}}/miniapp/images/goodscategory/scanning_black.png"></image> | ||
275 | + <view class="fs24"> | ||
276 | + 扫一扫 | ||
277 | + </view> | ||
278 | + </view> | ||
279 | + <view class="xc-search-inner "> | ||
280 | + <view class="search-img left"> | ||
281 | + <image class="wh100" src="{{iurl}}/miniapp/images/search.png"></image> | ||
282 | + </view> | ||
283 | + <input bindfocus="goseach" class="search-cont" placeholder="搜索你想要的生活" type="text"></input> | ||
284 | + </view> | ||
285 | + </view> | ||
286 | + <!-- /头部 --> | ||
287 | + <!-- 分类项目内容 --> | ||
288 | + <view class="flex project_height" style="margin-left:-10rpx;margin-top:120rpx;"> | ||
289 | + <!-- 分类项目的类型 --> | ||
290 | + <view class="project_type" style="position:fixed;left:0;z-index:999999"> | ||
291 | + <view class="project_type-frame"> | ||
292 | + <view wx:if="{{is_show_gb}}"> | ||
293 | + <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}"> | ||
294 | + <text>国</text><text>家</text> | ||
295 | + </view> | ||
296 | + </view> | ||
297 | + <view wx:if="{{is_show_pp}}"> | ||
298 | + <view bindtap="click_classify" class="{{select_classify_on==220?'select_classify':''}} share_type fs30 flex-space-between xc-letter-spacing" wx:if="{{is_brand}}"data-index="220"data-name="品牌"> | ||
299 | + <text>品</text><text>牌</text> | ||
300 | + </view> | ||
301 | + </view> | ||
302 | + <view wx:if="{{is_show_pl}}"> | ||
303 | + <view wx:for="{{one_level_classify}}" wx:for-item="ittms" > | ||
304 | + <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs30 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}"> | ||
305 | + <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}"> | ||
306 | + <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index"> | ||
307 | + <view> | ||
308 | + {{name}} | ||
309 | + </view> | ||
310 | + </view> | ||
311 | + | ||
312 | + </view> | ||
313 | + <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}} | ||
314 | + </view> | ||
315 | + </view> | ||
316 | + | ||
317 | + </view> | ||
318 | + | ||
319 | + </view> | ||
320 | + </view> | ||
321 | + | ||
322 | + </view> | ||
323 | + <!-- 分类项目的内容 --> | ||
324 | + <view class="classify_content" style="margin-left:26%"> | ||
325 | + <!-- 国家的样式 --> | ||
326 | + <block wx:if="{{select_classify_on==223&&is_show_gb}}"> | ||
327 | + <view class="classify_name fs28 flex-space-between"> | ||
328 | + <view>{{ishaf_three==1?good_list.name:classify_name}}</view> | ||
329 | + | ||
330 | + </view> | ||
331 | + <view class=" classify_content-frame flex-space-between " > | ||
332 | + <view bindtap="go_nation" class="country_img-frame rel outer_location"wx:for="{{nationlist}}" wx:for-item="bitem" wx:for-index="pidx" data-nid="{{bitem.id}}" > | ||
333 | + <image class="country_img" src="{{iurl}}{{bitem.logo}}"></image> | ||
334 | + <view class='nation_box abs box'> | ||
335 | + <view class='nt_1 t-c line-height' style="height:50rpx"> | ||
336 | + <text class="nation_z_name ellipsis-1 nt_1_t height fs24">{{bitem.name}}</text> | ||
337 | + </view> | ||
338 | + <view class='nt_2 t-c line-height fs24' style="line-height: 50rpx"> | ||
339 | + <text class="nation_y_name ellipsis-1 nt_1_t height fs24">{{bitem.enname}}</text> | ||
340 | + </view> | ||
341 | + </view> | ||
342 | + <!--<view class='nation_box abs box' style="top:20rpx">--> | ||
343 | + <!--</view>--> | ||
344 | + </view> | ||
345 | + </view> | ||
346 | + </block> | ||
347 | + <!-- 品牌 --> | ||
348 | + <block wx:if="{{select_classify_on==220&&is_show_pp}}"> | ||
349 | + | ||
350 | + <view class="classify_name fs28 flex-space-between"> | ||
351 | + <view>{{classify_name}}</view> | ||
352 | + </view> | ||
353 | + | ||
354 | + <view class="classify_content-frame flex flex-wrap"> | ||
355 | + | ||
356 | + <block wx:for="{{groups}}" wx:for-item="brand_list" wx:for-index="pidx"> | ||
357 | + <view class="brand_img_frame "wx:for="{{brand_list.array}}"wx:for-item="user" wx:for-index="idx" bindtap="go_brand" data-bid="{{user.id}}" > | ||
358 | + | ||
359 | + <view class="brand_img t-c"> | ||
360 | + <image class=" brand_img" src="{{user.logo}}" data-errorimg="groups[{{pidx}}].array[{{idx}}].logo" binderror="bind_bnerr_pp"></image> | ||
361 | + <view class="brand_img_name ellipsis-1 fs24">{{user.name}}</view> | ||
362 | + </view> | ||
363 | + </view> | ||
364 | + | ||
365 | + | ||
366 | + </block> | ||
367 | + </view> | ||
368 | + </block> | ||
369 | + <!-- 品类--> | ||
370 | + <block wx:if="{{is_show_pl}}"> | ||
371 | + <block wx:if="{{select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> | ||
372 | + <view style="width:100%;height:100%;"> | ||
373 | + <view class="classify_name fs28 flex-space-between" id="header" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more' style="position:fixed;z-index:999999;top:120rpx;width:70%;background-color:#ffffff;left:26%;padding:0 10rpx;"> | ||
374 | + <view class="classify_title ellipsis-1">{{classify_name}}</view> | ||
375 | + <view class="flex select_more" > | ||
376 | + <view class="red-co fs24" >更多</view> | ||
377 | + <view class="bg_right width_height"></view> | ||
378 | + </view> | ||
379 | + </view> | ||
380 | + <!-- 显示商品列表开始 --> | ||
381 | + <!-- <view class="classify_content-frame flex-wrap" style="width:100%;overflow:hidden;heigth:100%;"> --> | ||
382 | + | ||
383 | + <!-- <view class="null" style="width:100%;margin-top:70rpx;"></view> --> | ||
384 | + <scroll-view scroll-y scroll-into-view="{{cat_id}}" bindscrolltolower='scrollLower' style="height:{{windowHeight}};position:absolute;margin-top:70rpx;top:120rpx;bottom:0;rigth:0;left:26%;width:73%;"> | ||
385 | + <!-- <view class="null" style="width:100%;height:29px;"></view> --> | ||
386 | + <!-- goodslist --> | ||
387 | + <view class="choice_list"> | ||
388 | + <navigator class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" wx:key="{{index}}"> | ||
389 | + <view class="img-wrap"> | ||
390 | + <image src="{{item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image> | ||
391 | + </view> | ||
392 | + <view class="item-cont"> | ||
393 | + <view class="title">{{item.goods_name}}</view> | ||
394 | + <!-- 判断是否有活动价 --> | ||
395 | + <block wx:if="{{item.prom_price>0}}"> | ||
396 | + <!-- 活动价 --> | ||
397 | + <view class="price">¥{{item.prom_price}}</view> | ||
398 | + <view class="comment flex jc_sb"> | ||
399 | + <view class="word-line xc-ash">¥{{item.market_price}}</view> | ||
400 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
401 | + </view> | ||
402 | + </block> | ||
403 | + <block wx:else> | ||
404 | + <!-- 商品价格,先判断下是后又等级价--> | ||
405 | + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> | ||
406 | + <!-- 当会员是等级卡的时候 --> | ||
407 | + <block wx:if="{{card_field}}"> | ||
408 | + <!-- 等级价>0 --> | ||
409 | + <block wx:if="{{item[card_field]>0}}"> | ||
410 | + <view class="flex ai_and"> | ||
411 | + <view class="price">¥{{item[card_field]}}</view> | ||
412 | + <view class="card_bg"> | ||
413 | + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image> | ||
414 | + <view class="card_name">{{card_name}}</view> | ||
415 | + </view> | ||
416 | + </view> | ||
417 | + <view class="comment flex jc_sb"> | ||
418 | + <view class="word-line xc-ash">¥{{item.market_price}}</view> | ||
419 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
420 | + </view> | ||
421 | + </block> | ||
422 | + <block wx:else> | ||
423 | + <view class="price">¥{{item.shop_price}}</view> | ||
424 | + <view class="comment flex jc_sb"> | ||
425 | + <view class="word-line xc-ash">¥{{item.market_price}}</view> | ||
426 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
427 | + </view> | ||
428 | + </block> | ||
429 | + </block> | ||
430 | + <block wx:else> | ||
431 | + <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | ||
432 | + <view class="flex ai-center"> | ||
433 | + <view class="price">¥{{item.shop_price}}</view> | ||
434 | + <view class="word-line xc-ash mk_price">¥{{item.market_price}}</view> | ||
435 | + </view> | ||
436 | + <view class="comment flex jc_sb"> | ||
437 | + <view class="flex ai_and"> | ||
438 | + <view class="">¥{{g_filter.get_card_price(item,card_list,0)}}</view> | ||
439 | + <view class="card_bg"> | ||
440 | + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image> | ||
441 | + {{g_filter.get_card_price(item,card_list,1)}} | ||
442 | + </view> | ||
443 | + </view> | ||
444 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
445 | + </view> | ||
446 | + </block> | ||
447 | + <block wx:else> | ||
448 | + <view class="price">¥{{item.shop_price}}</view> | ||
449 | + <view class="comment flex jc_sb"> | ||
450 | + <view class="word-line xc-ash">¥{{item.market_price}}</view> | ||
451 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
452 | + </view> | ||
453 | + </block> | ||
454 | + </block> | ||
455 | + </block> | ||
456 | + <block wx:else> | ||
457 | + <view class="price">¥{{item.shop_price}}</view> | ||
458 | + <view class="comment flex jc_sb"> | ||
459 | + <view class="word-line xc-ash">¥{{item.market_price}}</view> | ||
460 | + <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view> | ||
461 | + </view> | ||
462 | + </block> | ||
463 | + </block> | ||
464 | + </view> | ||
465 | + </navigator> | ||
466 | + </view> | ||
467 | + <view class="no-data" wx:if="{{msgStatus == true}}"> | ||
468 | + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | ||
469 | + <view class="no-data-title">该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别</view> | ||
470 | + <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> --> | ||
471 | + </view> | ||
472 | + </scroll-view> | ||
473 | + <!-- /goodslist --> | ||
474 | + </view> | ||
475 | + <!-- 商品列表结束 --> | ||
476 | + | ||
477 | + </block> | ||
478 | + </block> | ||
479 | + </view> | ||
480 | + </view> | ||
481 | + </block> | ||
482 | + <block wx:elif="{{is_do}}"> | ||
483 | + <view class="no-data" > | ||
484 | + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | ||
485 | + <view class="no-data-title">商家暂未设置分类</view> | ||
486 | + <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> | ||
487 | + </view> | ||
488 | + </block> | ||
489 | + | ||
265 | </block> | 490 | </block> |
266 | \ No newline at end of file | 491 | \ No newline at end of file |
pages/goods/categoryList/categoryList.wxss
1 | /*---nyf 2018-9-7---*/ | 1 | /*---nyf 2018-9-7---*/ |
2 | + | ||
2 | page{height: 100%; background: #fff;} | 3 | page{height: 100%; background: #fff;} |
3 | .top_view{ width: 100%;background: #fff;} | 4 | .top_view{ width: 100%;background: #fff;} |
5 | + | ||
4 | .swiper-tab{ | 6 | .swiper-tab{ |
5 | width: 70%; | 7 | width: 70%; |
6 | text-align: center; | 8 | text-align: center; |
@@ -400,4 +402,7 @@ margin: auto; | @@ -400,4 +402,7 @@ margin: auto; | ||
400 | width: 80%; | 402 | width: 80%; |
401 | } | 403 | } |
402 | 404 | ||
403 | -.brand_img_name {color: #666;} | ||
404 | \ No newline at end of file | 405 | \ No newline at end of file |
406 | +.brand_img_name {color: #666;} | ||
407 | + | ||
408 | +/* 风格三商品列表样式引入 */ | ||
409 | +@import "../goodsList/goodsList.wxss"; | ||
405 | \ No newline at end of file | 410 | \ No newline at end of file |