diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index a4467ba..c70b433 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -25,6 +25,7 @@ Component({ is_new: 0, baseUrl: "/api/weshop/goods/page", resourceUrl: t.globalData.setting.resourceUrl, + url: t.globalData.setting.imghost, currentPage: 1, requestData: null, requestUrl: "", @@ -43,37 +44,80 @@ Component({ }, ready: function () { - console.log("ready"); - this.data.classstyle_id = this.data.object.classstyle; - this.data.goodscount = this.data.object.goodscount; - console.log(this.data.classstyle_id); - this.data.wgroup = this.data.object.wgroup; - console.log(this.data.wgroup); - this.setData({ - classstyle_id: this.data.object.classstyle - }) - if (this.data.object.goodsclass == 1) { - this.data.is_recommend = 1 - } - if (this.data.object.goodsclass == 2) { - this.data.is_hot = 1 - } - if (this.data.object.goodsclass == 3) { - this.data.is_new = 1 - } - this.data.requestData = new Array(); - this.data.g_id = this.data.object.data; - var arr = []; - - for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { - arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); - } - this.data.firist_type_data = arr; - console.log("firist_type_data"); - console.log(this.data.firist_type_data); - this.init(this.data.classstyle_id, this.data.wgroup); }, + + + lifetimes: { + attached: function() { + // 在组件实例进入页面节点树时执行 + this.data.classstyle_id = this.data.object.classstyle; + this.data.goodscount = this.data.object.goodscount; + this.data.wgroup = this.data.object.wgroup; + + this.setData({ + classstyle_id: this.data.object.classstyle + }) + if (this.data.object.goodsclass == 1) { + this.data.is_recommend = 1 + } + if (this.data.object.goodsclass == 2) { + this.data.is_hot = 1 + } + if (this.data.object.goodsclass == 3) { + this.data.is_new = 1 + } + this.data.requestData = new Array(); + this.data.g_id = this.data.object.data; + var arr = []; + + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { + arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); + } + this.data.firist_type_data = arr; + this.init(this.data.classstyle_id, this.data.wgroup); + }, + detached: function() { + // 在组件实例被从页面节点树移除时执行 + }, + }, + + pageLifetimes: { + show: function () { + this.data.firist_type_curr=1, + this.data.currentPage=1, + this.setData({ goods_array: null}) + + // 页面被展示 + // 在组件实例进入页面节点树时执行 + this.data.classstyle_id = this.data.object.classstyle; + this.data.goodscount = this.data.object.goodscount; + this.data.wgroup = this.data.object.wgroup; + + this.setData({ + classstyle_id: this.data.object.classstyle + }) + if (this.data.object.goodsclass == 1) { + this.data.is_recommend = 1 + } + if (this.data.object.goodsclass == 2) { + this.data.is_hot = 1 + } + if (this.data.object.goodsclass == 3) { + this.data.is_new = 1 + } + this.data.requestData = new Array(); + this.data.g_id = this.data.object.data; + var arr = []; + + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { + arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); + } + this.data.firist_type_data = arr; + this.init(this.data.classstyle_id, this.data.wgroup); + }, + }, + methods: { // 这里是一个自定义方法 init: function (classstyle_id, wgroup) { @@ -90,6 +134,11 @@ Component({ index = 0, gdata = []; + //--初始化卡类-- + th.card_init(); + + var os=getApp().globalData.setting; + classstyle_id = classstyle_id + ""; switch (classstyle_id) { case "1": @@ -110,14 +159,18 @@ Component({ item.shop_price = goods.shop_price; item.sales_sum = goods.sales_sum; item.goods_id = goods.goods_id; + item.cardprice1 = val.cardprice1; + item.cardprice2 = val.cardprice2; + item.cardprice3 = val.cardprice3; + prom_id = res.data.data.prom_id; var prom_type = res.data.data.prom_type; //0普通商品 1秒杀 6拼单 var url = ""; - if (prom_type == 1) { + if (prom_type == 6) { url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - } else if (prom_type == 6) { + } else if (prom_type == 1) { url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; } if(url==""){ @@ -130,12 +183,12 @@ Component({ return app.request.promiseGet(url, {}) } - }).then(res => { index++; var prom = res.data.data; - if (prom != null) { - item.shop_price = res.data.data.price; + var now=ut.gettimestamp(); + if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time { + await app.request.promiseGet(url, {}).then(res => { var prom = res.data.data; - if (prom != null) { - item.shop_price = res.data.data.price; + if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time { //商品地址 var goods = res.data.data; - console.log("goods"); - console.log(goods); - // th.setData({ - // goods_btn: res.data.data - // }) + item.goods_name = val.goods_name; item.goods_img = th.data.imghost + val.original_img; item.market_price = val.market_price; item.shop_price = val.shop_price; item.sales_sum = val.sales_sum; item.goods_id = val.goods_id; + + item.cardprice1 = val.cardprice1; + item.cardprice2 = val.cardprice2; + item.cardprice3 = val.cardprice3; + prom_id = val.prom_id; var prom_type = res.data.data.prom_type; //0普通商品 1秒杀 6拼单 var url = ""; - if (prom_type == 1) { + if (prom_type == 6) { url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - } else if (prom_type == 6) { + } else if (prom_type == 1) { url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; } if(url!=null){ - app.request.promiseGet(url, {}).then(res => { + await app.request.promiseGet(url, {}).then(res => { var prom = res.data.data; - if (prom != null) { - item.shop_price = res.data.data.price; + if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time 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) + }) + + } + }) + } + }) + + }, + + //--- 获取卡类列表 --- + getPlusCardType: function(func) { + var storid = o.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(); + for (var i = 0; i < plusCard.length; i++) { + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + } + + var ob = { + "card_list": plusCard, + "name_map": card_name_map + }; + func(ob); + }) + }, + + } }) \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml index 1b21d89..51b7200 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxml +++ b/components/diy_goodsGroup/diy_goodsGroup.wxml @@ -1,464 +1,168 @@ - - - - - - + + + + + - - + + > - - - - - - - + - + - - - - - {{item.goods_name}} + - ¥{{item.shop_price}} - ¥{{item.market_price}} + + ¥{{item.prom_price}} + ¥{{item.market_price}} + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + {{card_name}} + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + + + - 销量:{{item.sales_sum}}件 - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - + + - - - - - - + - - - - - - - - - - + - - - - @@ -466,187 +170,100 @@ {{item.goods_name}} - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} + + ¥{{item.prom_price}} + ¥{{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + {{card_name}} + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + 销量:{{item.sales_sum}}件 - @@ -654,46 +271,34 @@ - - + - - - - + + - - - + - - - - - + - - - - @@ -702,8 +307,97 @@ {{item.goods_name}} - ¥{{item.shop_price}} - ¥{{item.market_price}} + + ¥{{item.prom_price}} + ¥{{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + {{card_name}} + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + 销量:{{item.sales_sum}}件 @@ -713,212 +407,145 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - + + + + + + + + + + - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + {{item.goods_name}} + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + {{card_name}} + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + - - - - - - - - - - - - - - - - - + + ¥{{item.shop_price}} + ¥{{item.market_price}} - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - + 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.goods_name}} - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - 销量:{{item.sales_sum}}件 - - - - - - - - - - - - - - - - - + - - - + - - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxss b/components/diy_goodsGroup/diy_goodsGroup.wxss index ad4e535..7adea90 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxss +++ b/components/diy_goodsGroup/diy_goodsGroup.wxss @@ -1,42 +1,30 @@ /* pages/diy_zs/diy_zs.wxss */ - +.zwp_3{ margin-top: 10rpx} .zs_goods{ - width: 100%; - min-height: 500rpx; -border: 2rpx #ddd solid; -margin: 0 auto; -} - -.zwp_3{ - /* width: 30%; */ + width: 700rpx; + border: 1rpx #ddd solid; + margin-bottom: 10rpx; + margin: 0 auto; + } - .s1_gk_a1{ display: inline; width: auto; height: auto; } -.clear{ - clear: both; -} +.clear{ clear: both;} .zs_top{ width: 100%; min-height: 700rpx; margin: 0 auto; - padding-left:22rpx; -padding-bottom:30rpx; - -display: flex; -/* padding-left: 6rpx; */ -/* padding-right: 30rpx; */ + margin-bottom:30rpx; + display: flex; } .zs_t_img { - width: 700rpx; - height: 700rpx; - /* margin: 0 auto; */ - /* background-color: bisque; */ - + width: 698rpx; + height: 698rpx; + margin: 1rpx auto; } .zs_center{ @@ -53,8 +41,9 @@ display: flex; overflow: hidden; text-overflow: ellipsis; margin-bottom:10rpx; -font-size:28rpx; + font-size:28rpx; white-space: nowrap; + width: 640rpx } @@ -95,52 +84,44 @@ font-size:28rpx; font-size: 32rpx; } -.del{ - font-size: 24rpx; - color: #999; - text-decoration: line-through; -} + .zs_t1{ width: 56rpx; height: 56rpx; - position: relative; - right: 58rpx; - bottom: -640rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } .zs_t2{ width: 56rpx; height: 56rpx; - position: relative; - right: 58rpx; - bottom: -2rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } .zs_t3{ width: 56rpx; height: 56rpx; - position: relative; - right: 692rpx; - bottom: -4rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } .zs_t4{ width: 56rpx; height: 56rpx; - position: relative; - right: 692rpx; - bottom: -642rpx; + position: absolute; + right: 20rpx; + bottom: 10rpx; } - -/* xiao */ - - .zs_goods_xiao_bottom{ width: 100%; min-height: 300rpx; @@ -165,24 +146,15 @@ font-size:28rpx; .zs_top_x{ width: 400rpx; height: 318rpx; - margin-top: 20rpx; - /* /* padding-top:30rpx; -padding-bottom:30rpx; */ - -display: flex; - + margin-top: 20rpx; + display: flex; } -/* .zs_goods_xiao{ - background-color: white; -} */ - .zs_t_img_x { width: 290rpx; height: 290rpx; margin-left: 20rpx; - /* background-color: bisque; */ - + } .zs_center_x{ @@ -243,10 +215,9 @@ font-size:28rpx; } .del{ - font-size: 24rpx; + font-size: 24rpx; color: #999; text-decoration: line-through; - margin-left: 10rpx; margin-top: 8rpx; } @@ -381,61 +352,57 @@ top: 234rpx; } + +/*---俩列图片位置---*/ .zs_t1_2l{ width: 56rpx; height: 56rpx; - position: relative; - right: -2rpx; - top: -310rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } - .zs_t2_2l{ width: 56rpx; height: 56rpx; - position: relative; - right: -294rpx; - bottom: 310rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } .zs_t3_2l{ width: 56rpx; height: 56rpx; - position: relative; - right: -294rpx; - bottom: 68rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } .zs_t4_2l{ width: 56rpx; height: 56rpx; - position: relative; - right: -2rpx; - bottom: 68rpx; + position: absolute; + right: 0rpx; + bottom: 10rpx; } + + /*一个3列*/ .zs_goods_wai_san{ - width: 240rpx; + width: 230rpx; display: flex; - margin-left: 8rpx; + margin-left: 10rpx; float: left; margin-bottom: 8rpx; - background-color:white; - + background-color:white; } .zs_goods_san{ width: 240rpx; } - - - - - - .zs_goods_3l{ width: 240rpx; min-height: 300rpx; @@ -445,22 +412,15 @@ top: 234rpx; } .zs_top_3l{ - width: 240rpx; - height: 240rpx; - - - - - - + width: 232rpx; + height: 232rpx; } .zs_t_img_3l { - width:237rpx; - height: 240rpx; + width:232rpx; + height: 232rpx; margin: 0 auto; background-color: bisque; - } .zs_center_3l{ @@ -469,27 +429,28 @@ top: 234rpx; font-size: 28rpx; color: #333; text-align: left; - padding: 0 10rpx; + padding: 0 10rpx; } .zs_wz1_3l{ - overflow: hidden; - text-overflow: ellipsis; + margin-bottom:10rpx; font-size:30rpx; height: 80rpx; - width: 227rpx; - /* white-space: nowrap; */ + width: 220rpx; + + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; } .zs_wz2_3l{ - /* overflow: hidden; - text-overflow: ellipsis; */ margin-bottom:10rpx; font-size:30rpx; - /* white-space: nowrap; */ - display: flex; + display: flex; } .zs_wz3_3l{ @@ -497,7 +458,7 @@ top: 234rpx; text-overflow: ellipsis; margin-bottom:10rpx; font-size:30rpx; - white-space: nowrap; + white-space: nowrap; } .zs_wz4_3l{ @@ -505,7 +466,7 @@ top: 234rpx; text-overflow: ellipsis; margin-bottom:10rpx; font-size:30rpx; - white-space: nowrap; + white-space: nowrap; } .zs_wz5_3l{ @@ -519,38 +480,58 @@ top: 234rpx; .zs_t1_3l{ width: 56rpx; height: 56rpx; - position: relative; - right: 0rpx; - top: -250rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } .zs_t2_3l{ width: 56rpx; height: 56rpx; - position: relative; - right: -177rpx; - bottom: 250rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } .zs_t3_3l{ width: 56rpx; height: 56rpx; - position: relative; - right: -177rpx; - bottom: 67rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } .zs_t4_3l{ width: 56rpx; height: 56rpx; - position: relative; + position: absolute; right: 0rpx; - bottom: 67rpx; + bottom: 10rpx; } .zs_goods_wai{ background-color: white; margin-top: 10rpx; -} \ No newline at end of file +} + +.rel{position: relative} +.flex{display: flex} +.fs24{font-size: 24rpx} +.fs35{font-size: 35rpx} +.xc-wc{ align-items: center} + +.price.xc-ash{ + font-size: 24rpx; + color: #999; + text-decoration: line-through; + margin-top: 8rpx; +} + + +.line_th{ text-decoration: line-through} +.card_bg {display: flex; padding: 2rpx 10rpx;height: 28rpx; align-items: center; border-radius: 26rpx; font-size: 19rpx;line-height: 28rpx;max-width: 110rpx; + background: #333; color: #fff; justify-content: center; margin-left: 2rpx;} +.card_bg image{ width: 19rpx; height: 19rpx; margin-right: 1rpx;} +.card_bg .card_name{ max-width: 76rpx; width: auto;overflow: hidden; white-space:nowrap; } \ No newline at end of file diff --git a/components/diy_goodsGroup/g_filter.wxs b/components/diy_goodsGroup/g_filter.wxs new file mode 100644 index 0000000..8bba9f3 --- /dev/null +++ b/components/diy_goodsGroup/g_filter.wxs @@ -0,0 +1,84 @@ +//获取样式 +var get_class = function(column,position) { + //--列的情况 + if(column==1){ return "zs_t"+position; } + //--俩列的情况 + if(column==2){ return "zs_t"+position+"_2l"; } + //--三列的情况 + if(column==3){ return "zs_t"+position+"_3l"; } + //----列表的情况----- + if(column==4 ){ return "zs_t1_x"+position; } + +} + + +var g_filters = { + //-- 判断是不是有等级价 -- + is_has_rank:function(rank_switch,item){ + if(!rank_switch) return false; + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} + return false; + }, + + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price:function(goods,all_card,type){ + var price1=parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if(!all_card){ + if(type==0) return 0; + return ""; + } + + var min_price=null; + var min_name=null; + //---设置对应的价格名字---- + for(var i=0;i<3;i++) { + var vl=all_card[i]; + if(vl['CorrPrice']=="Price1" && price1>0) + { + if(min_price==null) { + min_price=price1;min_name=vl['CardName']; + } + else if(price10) + { + if(min_price==null) { + min_price=price2;min_name=vl['CardName']; + } + else if(price20) + { + if(min_price==null) { + min_price=price3;min_name=vl['CardName']; + } + else if(price34 ) min_name=min_name.substring(0, 4); + return min_name; + }, +} + + +module.exports = { + get_class: get_class, + is_has_rank:g_filters.is_has_rank, + get_card_price:g_filters.get_card_price, +} diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 11e118c..4d1e801 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -1,139 +1,165 @@ -var t = getApp(), a = t.request, o = t.globalData.setting, os = o, - i = require("../../utils/util.js"), ut = i, s = require("../../utils/common.js"); +var t = getApp(), + a = t.request, + o = t.globalData.setting, + os = o, + i = require("../../utils/util.js"), + ut = i, + s = require("../../utils/common.js"); Component({ data: { url: o.imghost, object: null, - curPage:1, - is_no_more:1,//加载完所有数据的控制器 - load_complete:0,//加载完成, - rank_switch:false, - card_field:"", - card_name:"", - max_card_field:"", - card_list:null + curPage: 1, + is_no_more: 1, //加载完所有数据的控制器 + load_complete: 0, //加载完成, + rank_switch: false, //等级卡开关 + card_field: "", //等级卡 + card_name: "", //卡的名称 + max_card_field: "", // + card_list: null }, properties: { // 这里定义了innerText属性,属性值可以在组件使用时指定 }, - ready: function () { - + ready: function() { + }, - methods: { - init:function(){ - var th = this; - getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { - success: function (e) { - getApp().globalData.userInfo = e.data.data; - getApp().getConfig2(function (e) { - var swithc_list = e.switch_list; - var sw_arr = JSON.parse(swithc_list); - //---如果后台又开等级卡的开关--- - if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - th.setData({ rank_switch: true }); - //---回调卡的列表--- - th.getPlusCardType(function (ob) { - th.setData({ card_list: ob.card_list }); - var ti = setInterval(function () { - var user = getApp().globalData.userInfo; - if (!user) return false; - clearInterval(ti); - - 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) - }) - - } - }) - } - }) - - }, - - - get_list:function(){ - var that = this; - if (that.data.is_no_more == 0) return false; - var curPage = that.data.curPage; - getApp().request.get('/api/weshop/goods/page?page', { - data: { - is_mainshow: 1, isonsale: 1, - is_recommend: 1, is_on_sale: 1, - store_id: o.stoid, - page: curPage, - pageSize: 6, - }, - success: function (res) { - var data = res.data; - var total = data.data.total; - if (total <= curPage * 6) { - that.setData({ is_no_more: 0 }); - } else { - that.data.curPage++; - } - - //加载完成 - if (data.data.pageData) { - that.setData({ load_complete: 1 }); - } - if (that.data.recommend != null) { - var ra = that.data.recommend.concat(data.data.pageData); - that.setData({ recommend: ra }); - } else { - that.setData({ recommend: data.data.pageData }); - } - } - }) - }, - - - bind_bnerr_xc: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errurl = e.target.dataset.url; - var _errObj = {}; - _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + methods: { + init: function() { + var th = this; + getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { + success: function(e) { + getApp().globalData.userInfo = e.data.data; + getApp().getConfig2(function(e) { + var swithc_list = e.switch_list; + var sw_arr = JSON.parse(swithc_list); + //---如果后台又开等级卡的开关--- + if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { + th.setData({ + rank_switch: true + }); + //---回调卡的列表--- + th.getPlusCardType(function(ob) { + th.setData({ + card_list: ob.card_list + }); + var ti = setInterval(function() { + var user = getApp().globalData.userInfo; + if (!user) return false; + clearInterval(ti); + + 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) + }) + + } + }) + } + }) + }, - - reset:function(){ - curPage=1; - }, - - //--- 获取卡类列表 --- - getPlusCardType: function (func) { - var storid = o.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(); - for (var i = 0; i < plusCard.length; i++) { - var name="card"+plusCard[i].CorrPrice.toLowerCase(); - card_name_map.set(name,plusCard[i].CardName); - } - - var ob={"card_list":plusCard,"name_map":card_name_map}; - func(ob); - }) - }, - + + + get_list: function() { + var that = this; + if (that.data.is_no_more == 0) return false; + var curPage = that.data.curPage; + getApp().request.get('/api/weshop/goods/page?page', { + data: { + is_mainshow: 1, + isonsale: 1, + is_recommend: 1, + is_on_sale: 1, + store_id: o.stoid, + page: curPage, + pageSize: 6, + }, + success: function(res) { + var data = res.data; + var total = data.data.total; + if (total <= curPage * 6) { + that.setData({ + is_no_more: 0 + }); + } else { + that.data.curPage++; + } + + //加载完成 + if (data.data.pageData) { + that.setData({ + load_complete: 1 + }); + } + if (that.data.recommend != null) { + var ra = that.data.recommend.concat(data.data.pageData); + that.setData({ + recommend: ra + }); + } else { + that.setData({ + recommend: data.data.pageData + }); + } + } + }) + }, + + + bind_bnerr_xc: function(e) { + var _errImg = e.target.dataset.errorimg; + var _errurl = e.target.dataset.url; + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, - - - + + reset: function() { + curPage = 1; + }, + + //--- 获取卡类列表 --- + getPlusCardType: function(func) { + var storid = o.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(); + for (var i = 0; i < plusCard.length; i++) { + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + } + + var ob = { + "card_list": plusCard, + "name_map": card_name_map + }; + func(ob); + }) + }, + + }, + + + }) \ No newline at end of file diff --git a/components/goods_list/goods_list.wxml b/components/goods_list/goods_list.wxml index 13a075c..969cb95 100644 --- a/components/goods_list/goods_list.wxml +++ b/components/goods_list/goods_list.wxml @@ -1,128 +1,145 @@ - - - - - - - - - - - - - {{item.goods_name}} - - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - {{card_name}} - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - - - - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - + + + + + + + + + + + + + {{item.goods_name}} + + + + + + {{filter.toFix(item.prom_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + + + + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + {{g_filter.get_card_price(item,card_list,1)}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + - - - - 没有更多内容了 - - - - - - \ No newline at end of file + + + + + + 没有更多内容了 + + + \ No newline at end of file diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index b26cc8c..d24fb9b 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -262,7 +262,7 @@ - + @@ -278,7 +278,7 @@ - + + + + + + + + 没有相关的数据 + 去逛逛 + \ No newline at end of file diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml index 39df1db..a7f6cc4 100644 --- a/pages/goods/search/search.wxml +++ b/pages/goods/search/search.wxml @@ -1,158 +1,170 @@ - - - - - - - - - - - - - + + + + + + + + + + + {{item.goods_name}} + + + + ¥{{item.prom_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} - - {{item.goods_name}} - - - - - - - - ¥{{item[card_field]}} - - {{card_name}} - - - - ¥{{item.market_price}} - 评论{{item.comment_count}} 已售{{item.sales_sum}} - - - - ¥{{item.shop_price}} - - ¥{{item.market_price}} - 评论{{item.comment_count}} 已售{{item.sales_sum}} - - - - - - - ¥{{item.shop_price}} - ¥{{item.market_price}} - - - - ¥{{g_filter.get_card_price(item,card_list,0)}} - - {{g_filter.get_card_price(item,card_list,1)}} - - - 评论{{item.comment_count}} 已售{{item.sales_sum}} - - - - ¥{{item.shop_price}} - - ¥{{item.market_price}} - 评论{{item.comment_count}} 已售{{item.sales_sum}} - - - - - - ¥{{item.shop_price}} - - ¥{{item.market_price}} - 评论{{item.comment_count}} 已售{{item.sales_sum}} - - + + + + + + + + + + ¥{{item[card_field]}} + + + {{card_name}} + + + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + + ¥{{item.shop_price}} + ¥{{item.market_price}} + + + + ¥{{g_filter.get_card_price(item,card_list,0)}} + + + {{g_filter.get_card_price(item,card_list,1)}} + + + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} + + + + + + ¥{{item.shop_price}} + + ¥{{item.market_price}} + 评论{{item.comment_count}} 已售{{item.sales_sum}} - - - - - 没有相关的数据 - 去逛逛 - + + + + + + + + 没有相关的数据 + 去逛逛 +