diff --git a/.idea/mshopweapp.iml b/.idea/mshopweapp.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/mshopweapp.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js
index 301ed31..60ff9f1 100644
--- a/pages/goods/categoryList/categoryList.js
+++ b/pages/goods/categoryList/categoryList.js
@@ -1,11 +1,17 @@
var t = getApp(), e = t.request, oo = t.globalData.setting;
+var i = function (i) {
+ return i && i.__esModule ? i : {
+ default: i
+ };
+}(require("../../../utils/LoadMore.js")), a = new i.default(), ut = require("../../../utils/util.js");
+//t = i,e = t
Page({
data: {
- is_date:true,
- scrollHeight: 0,
- currentTab:-1,
- abc:0,
+ is_date:true,
+ scrollHeight: 0,
+ currentTab:-1,
+ abc:0,
windowHeight:0,
windowWidth: 0,
eachLetterHeight:0,
@@ -39,14 +45,34 @@ Page({
cat_id:0,
pl_timer: null,//只有品类的定时器
is_pl_time:0,
-
+ requestData:null, //风格三的商品数据列表 分页
+ stylePage:1, //商品列表分页标识
+
+ //风格三使用
+ url: t.globalData.setting.imghost,
+ currentPage: 1,
+ requestData: null,
+ allData: null,
+ openFilterModal: !1,
+ 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",
+ requestUrl: "",
+ tabname: "goods_id", //排序的字段
+ adname: "desc", //升降的字段
+ is_new: 0,
+ is_hot: 0,
+ msgStatus:false, //页面显示暂无数据状态
+ countDownNum: 3,
+ timer: '', //定时器
+ lastMsg:false,
+ toView:"",
},
onLoad: function(tt) {
+ var that = this;
+ clearInterval(that.data.timer);
+ that.setData({ countDownNum: 3, stylePage: 1 });
+
const res = wx.getSystemInfoSync(),
letters = this.data.letters;
-
- var that = this;
-
this.setData({
abc: t.globalData.heigth-88-88-16,
windowHeight: res.windowHeight,
@@ -77,7 +103,50 @@ Page({
if (this.data.is_used_share==0){
this.get_nation();
}
-
+
+ //风格三
+ //t = i,e = t
+ var th = this;
+ a.init(this, "", "requestData");
+ var url = this.data.baseUrl;
+ this.data.is_new = i.is_new;
+ this.data.is_hot = i.is_hot;
+ if (0 != this.data.cat_id) {
+ url += "&cat_id=" + this.data.cat_id;
+ }
+
+ // this.requestGoodsList(url);
+ getApp().getConfig2(function (rs) {
+ //计算等级价相关
+ var swithc_list = rs.switch_list;
+ var sw_arr = JSON.parse(swithc_list);
+ //---如果后台又开等级卡的开关---
+ if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
+ th.setData({ rank_switch: true });
+ var user = getApp().globalData.userInfo;
+ var ti = setInterval(function () {
+ if (!user) return false;
+ clearInterval(ti);
+ //---回调卡的列表---
+ th.getPlusCardType(function (ob) {
+ th.setData({ card_list: ob.card_list });
+ if (user.card_field) {
+ var str = user['card_expiredate'].replace(/-/g, '/');
+ var end = new Date(str);
+ end = Date.parse(end) / 1000;
+ var now = ut.gettimestamp();
+
+ //--- 判断是等级会员,且在有效期范围内 ---
+ if (user.card_field && now < end) {
+ var card_name = ob.name_map.get(user.card_field);
+ if (card_name.length > 4) card_name = card_name.substring(0, 4);
+ th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
+ }
+ }
+ })
+ }, 500)
+ }
+ });
},
onShow:function(){
@@ -150,6 +219,7 @@ Page({
that.setData({ currentTab: 0 });
}
})
+
},
//---------------分类请求接口,数据进行拼装------------------
@@ -180,7 +250,7 @@ Page({
}
}
t.setData({ catelist: arr});
- }else{
+ } else if (t.data.is_used_share == 1 || t.data.is_used_share == 2){
//---------新的版本----------------
for (var i = 0; i < dda.length; i++) {
@@ -221,11 +291,11 @@ Page({
}
t.setData({one_level_classify:arr});
- }
+ }
}
});
},
-
+
requestCategories: function(t) {
var s = this;
e.get("/api/goods/goodsSecAndThirdCategoryList", {
@@ -300,6 +370,7 @@ Page({
//------------手指滑动------------------
touchmove(e) {
+ console.log("手指滑动")
const x = e.touches[0].clientX,
y = e.touches[0].clientY,
lettersPosition = this.data.lettersPosition,
@@ -460,36 +531,46 @@ Page({
},
// 新的版本分类点击一级分类
click_classify:function(e){
- this.data.ishaf_three=0;
- var indexs=e.currentTarget.dataset.index;
+ clearInterval(this.data.timer);
+ this.setData({ countDownNum: 3, stylePage: 1, scrollTop: 0});
+ this.data.ishaf_three = 0;
+ var indexs = e.currentTarget.dataset.index;
var name = e.currentTarget.dataset.name;
var cid = e.currentTarget.dataset.cid;
var pid = e.currentTarget.dataset.pid;
var arr = e.currentTarget.dataset.arr;
-
- if (indexs==220){ this.get_brand();}
- if (arr!="undefined" && arr!=undefined){
- if (arr.length==0){
- this.setData({ select_classify_on: indexs, index: indexs, classify_name: name,cat_id:cid,
- goodslist: null,is_level_three: 0 });
- return false;
- }
- if (arr.length != 0){
- var is_lev_thr=0
- for(var i=0;i0) {is_lev_thr=1;break; }
- }
- this.setData({ is_level_three: is_lev_thr });
-
- if (this.data.is_level_three!=1) {
- this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
- } else {
- this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
- }
+ console.log("cid:=" + cid)
+ if (indexs == 220) { this.get_brand(); }
+ //==2的时候 请求数据为商品,不为分类
+ if (this.data.is_used_share == 2) {
+ this.style(this.data.stylePage, cid)
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,lastMsg: false, });
+ }else{
+ if (arr != "undefined" && arr != undefined) {
+ if (arr.length == 0) {
+ this.setData({
+ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,
+ goodslist: null, is_level_three: 0
+ });
+ return false;
+ }
+ if (arr.length != 0) {
+ var is_lev_thr = 0
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i].arrays.length > 0) { is_lev_thr = 1; break; }
+ }
+ this.setData({ is_level_three: is_lev_thr });
+
+ if (this.data.is_level_three != 1) {
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr });
+ } else {
+ this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr });
+ }
+ }
}
+ this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,});
}
- this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid});
-
+
},
@@ -527,4 +608,244 @@ Page({
this.destroyActivityTimer();
},
+
+ //风格三使用
+ changeTab: function (t) {
+ var ord = t.currentTarget.dataset.href;
+ var ad = t.currentTarget.dataset.ad;
+ var url = this.data.requestUrl;
+
+ if (this.data.tabname != ord) {
+ this.setData({ tabname: ord, adname: "desc" });
+ } else {
+ ad = ad == "desc" ? "asc" : "desc";
+ this.setData({ adname: ad });
+ }
+ this.resetData(), this.requestGoodsList(url);
+ },
+
+ requestGoodsList: function (t) {
+ var that = this;
+ that.data.requestUrl = t;
+ e.get("/api/weshop/goods/page?1=1", {
+ 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 },
+ success: function (data) {
+ console.log(data.data.data.pageData)
+ that.setData({
+ requestData: data.data.data.pageData,
+ is_go: 1
+ });
+ that.setData({ is_go: 1 });
+ that.data.stylePage++ , null == that.data.allData && (that.data.allData = Object.assign({}, data.data.data.pageData)),
+ wx.stopPullDownRefresh();
+ }
+ });
+ // //不是商品分组的,不是默认排序的
+ // if (t.indexOf("group_id") == -1 || e.data.tabname != "goods_id") {
+ // t += "&orderField=" + e.data.tabname;
+ // t += "&orderType=" + e.data.adname;
+ // }
+ // + "&parent_id=0&orderField=goods_id&orderType=desc&page="+this.data.page+"&is_mainshow=1&isonsale=1&store_id=1&is_recommend=1"
+ // t += "&page=" + e.data.page;
+ // a.request(t,
+ // function (t) {
+ // e.setData({ is_go: 1 });
+ // e.data.page++ , null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)),
+ // wx.stopPullDownRefresh();
+ // },
+ // null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid }
+ // );
+ },
+
+ // onReachBottom: function () {
+ // console.log('监听上拉:=')
+ // var that = this;
+ // clearInterval(that.data.timer);
+ // that.setData({
+ // stylePage: that.data.stylePage + 1,
+ // countDownNum: 3,
+ // lastMsg: false,
+ // });
+ // that.style(that.data.stylePage, that.data.cat_id);
+ // },
+ // onPullDownRefresh: function () {
+ // console.log('监听下拉:=' + this.data.requestUrl)
+ // this.resetData(), this.requestGoodsList(this.data.requestUrl);
+ // },
+ // 左侧更新
+ scrollLower: function (data) {
+ console.log("上拉加载更多", JSON.stringify(data))
+ var that = this;
+ clearInterval(that.data.timer);
+ that.setData({
+ stylePage: that.data.stylePage + 1,
+ countDownNum: 3,
+ lastMsg: false,
+ });
+ that.style(that.data.stylePage, that.data.cat_id);
+ },
+
+ //页面版面风格三的时候请求推荐商品 返回
+ style: function (page, cid) {
+ console.log("page:=" + page)
+ var s = this
+ e.get("/api/weshop/goods/page?1=1", {
+ 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 },
+ success: function (e) {
+ console.log(e.data.data.pageData)
+ s.setData({
+ dataLength: e.data.data.pageData.length,
+ });
+ if (e.data.data.pageData.length > 0) {
+ s.setData({
+ msgStatus: false,
+ });
+ //如果有数据 怕断分页为第一页的时候直接渲染数据
+ if (page > 1) {
+ //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面
+ var arr = s.data.requestData
+ console.log("arr:=" + JSON.stringify(arr))
+
+ for (var i = 0; i < e.data.data.pageData.length;i++){
+ arr.push(e.data.data.pageData[i]);
+ }
+ console.log(arr)
+ s.setData({
+ requestData: arr
+ });
+
+ }else{
+ s.setData({
+ requestData: e.data.data.pageData
+ });
+ if (wx.pageScrollTo) {
+ wx.pageScrollTo({
+ scrollTop: 0
+ })
+ }
+ }
+
+ } else {
+ //没有数据页面显示暂无数据
+ if (page != 1) {
+ var dataArray = s.data.one_level_classify
+ var index = s.data.index
+ console.log(dataArray[index + 1]['items'])
+ s.setData({
+ msgStatus: true,
+ stylePage: 1,
+ index: index + 1,
+ select_classify_on: index + 1,
+ cat_id: dataArray[index + 1]['items']['id'],
+ classify_name: dataArray[index + 1]['items']['name']
+ });
+ s.style(s.data.stylePage, dataArray[index + 1]['items']['id'])
+ }else{
+ //没有数据而且是第一页的时候
+ s.setData({
+ stylePage: 1,
+ });
+ let countDownNum = 3; //获取倒计时初始值
+ s.setData({
+ msgStatus: true,
+ countDownNum: countDownNum,
+ requestData: []
+ });
+ s.setData({
+ timer: setInterval(function () {
+ if (countDownNum == 0) {
+ clearInterval(s.data.timer);
+ //关闭定时器之后,可作其他处理
+ s.setData({
+ msgStatus: false,
+ })
+
+ //如果没有数据就把分页初始化成第一页
+ //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据
+ var dataArray = s.data.one_level_classify
+ var index = s.data.index
+ console.log(dataArray[index + 1])
+ if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){
+ console.log("dataArray[index + 1] = undefined")
+ s.setData({
+ stylePage: 1,
+ msgStatus: true,
+ lastMsg: true
+ });
+ }else{
+ s.setData({
+ stylePage: 1,
+ index: index + 1,
+ select_classify_on: index + 1,
+ cat_id: dataArray[index + 1]['items']['id'],
+ classify_name: dataArray[index + 1]['items']['name']
+ });
+ s.style(s.data.stylePage, dataArray[index + 1]['items']['id']);
+ }
+
+ }
+ countDownNum--;
+ s.setData({
+ countDownNum: countDownNum
+ })
+ }, 1000)
+
+ })
+ }
+
+
+ }
+ }
+ });
+ },
+
+
+ openFilterModal: function () {
+ this.setData({
+ openFilterModal: !0
+ });
+ },
+ closeFilterModal: function () {
+ this.setData({
+ openFilterModal: !1
+ });
+ },
+ filterGoods: function (t) {
+ this.resetData(), this.requestGoodsList(t.currentTarget.dataset.href), this.closeFilterModal();
+ },
+ resetData: function () {
+ a.resetConfig(), this.data.requestData = null, this.data.currentPage = 1;
+ },
+
+ //---回复最初的设置---
+ restoreData: function () {
+ this.setData({
+ requestData: null,
+ });
+ this.data.page = 1;
+ },
+
+ //--- 获取卡类列表 ---
+ getPlusCardType: function (func) {
+ var storid = oo.stoid;
+ var th = this;
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
+ var plusCard = res.data.data;
+ var arr = [1219, 2089, 3031];
+ var new_arr = new Array();
+ var card_name_map = new Map();
+ var user = getApp().globalData.userInfo;
+ for (var i = 0; i < plusCard.length; i++) {
+ if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
+ continue;
+ }
+ var name = "card" + plusCard[i].CorrPrice.toLowerCase();
+ card_name_map.set(name, plusCard[i].CardName);
+ new_arr.push(plusCard[i]);
+ }
+
+ var ob = { "card_list": new_arr, "name_map": card_name_map };
+ func(ob);
+ })
+ },
});
\ No newline at end of file
diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml
index f5c8974..3d3047e 100644
--- a/pages/goods/categoryList/categoryList.wxml
+++ b/pages/goods/categoryList/categoryList.wxml
@@ -1,14 +1,15 @@
+
-
- 分类
- 国家
- 品牌
-
-
+
+ 分类
+ 国家
+ 品牌
+
+
@@ -16,7 +17,7 @@
-
+
@@ -84,16 +85,17 @@
暂无分类
去逛逛
-
+
商家暂未设置分类
去逛逛
+
-
-
+
+
@@ -262,4 +264,225 @@
+
+
+
+
+
+
+
+
+
+ 扫一扫
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 国家
+
+
+
+
+ 品牌
+
+
+
+
+
+
+
+
+ {{name}}
+
+
+
+ {{ittms.items.name}}
+
+
+
+
+
+
+
+
+
+
+ {{ishaf_three==1?good_list.name:classify_name}}
+
+
+
+
+
+
+
+ {{bitem.name}}
+
+
+ {{bitem.enname}}
+
+
+
+
+
+
+
+
+
+
+
+ {{classify_name}}
+
+
+
+
+
+
+
+
+
+ {{user.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.goods_name}}
+
+
+
+ ¥{{item.prom_price}}
+
+
+
+
+
+
+
+
+
+
+ ¥{{item[card_field]}}
+
+
+ {{card_name}}
+
+
+
+
+
+ ¥{{item.shop_price}}
+
+
+
+
+
+
+ ¥{{item.shop_price}}
+ ¥{{item.market_price}}
+
+
+
+
+ ¥{{item.shop_price}}
+
+
+
+
+
+ ¥{{item.shop_price}}
+
+
+
+
+
+
+
+
+
+ 该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别
+ 该类别暂无推荐商品
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 商家暂未设置分类
+ 去逛逛
+
+
+
\ No newline at end of file
diff --git a/pages/goods/categoryList/categoryList.wxss b/pages/goods/categoryList/categoryList.wxss
index 3eb60ef..8052175 100644
--- a/pages/goods/categoryList/categoryList.wxss
+++ b/pages/goods/categoryList/categoryList.wxss
@@ -1,6 +1,8 @@
/*---nyf 2018-9-7---*/
+
page{height: 100%; background: #fff;}
.top_view{ width: 100%;background: #fff;}
+
.swiper-tab{
width: 70%;
text-align: center;
@@ -400,4 +402,7 @@ margin: auto;
width: 80%;
}
-.brand_img_name {color: #666;}
\ No newline at end of file
+.brand_img_name {color: #666;}
+
+/* 风格三商品列表样式引入 */
+@import "../goodsList/goodsList.wxss";
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index 8843409..f8c02e4 100644
--- a/project.config.json
+++ b/project.config.json
@@ -31,10 +31,18 @@
"current": -1,
"list": []
},
+ "plugin": {
+ "current": -1,
+ "list": []
+ },
"game": {
"currentL": -1,
"list": []
},
+ "gamePlugin": {
+ "current": -1,
+ "list": []
+ },
"miniprogram": {
"current": -1,
"list": []