diff --git a/components/diy_advertising/diy_advertising.wxss b/components/diy_advertising/diy_advertising.wxss index f2e0625..0c964de 100644 --- a/components/diy_advertising/diy_advertising.wxss +++ b/components/diy_advertising/diy_advertising.wxss @@ -5,8 +5,6 @@ width: 100%; color: #fff; font-size: 32rpx; - min-height: 300rpx; - line-height: 300rpx; text-align: center; } diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index a4467ba..a3bb465 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=0, + 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..86cd51d 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..e827ffd 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxss +++ b/components/diy_goodsGroup/diy_goodsGroup.wxss @@ -1,315 +1,278 @@ /* pages/diy_zs/diy_zs.wxss */ -.zs_goods{ - width: 100%; - min-height: 500rpx; -border: 2rpx #ddd solid; -margin: 0 auto; +.zwp_3 { + margin-top: 10rpx; } -.zwp_3{ - /* width: 30%; */ +.zs_goods { + width: 700rpx; + border: 1rpx #ddd solid; + margin-bottom: 10rpx; + margin: 0 auto; } -.s1_gk_a1{ +.s1_gk_a1 { display: inline; width: auto; height: auto; } -.clear{ + +.clear { clear: both; } -.zs_top{ + +.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{ - width: 100%; - min-height: 200rpx; - font-size: 28rpx; - color: #333; - text-align: left; - margin-left: 25rpx; - padding: 0 10rpx; +.zs_center { + width: 100%; + min-height: 200rpx; + font-size: 28rpx; + color: #333; + text-align: left; + margin-left: 25rpx; + padding: 0 10rpx; } -.zs_wz1{ +.zs_wz1 { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; + width: 640rpx; } - -.zs_wz2{ +.zs_wz2 { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz3{ +.zs_wz3 { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz4{ +.zs_wz4 { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz5{ +.zs_wz5 { overflow: hidden; - text-overflow: ellipsis; - font-size:30rpx; - white-space: nowrap; -} - -.wz_red{ - - color: #C4182E; - font-size: 32rpx; + text-overflow: ellipsis; + font-size: 30rpx; + white-space: nowrap; } -.del{ - font-size: 24rpx; - color: #999; - text-decoration: line-through; +.wz_red { + color: #c4182e; + font-size: 32rpx; } -.zs_t1{ +.zs_t1 { width: 56rpx; height: 56rpx; - position: relative; - right: 58rpx; - bottom: -640rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } - -.zs_t2{ +.zs_t2 { width: 56rpx; height: 56rpx; - position: relative; - right: 58rpx; - bottom: -2rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } -.zs_t3{ +.zs_t3 { width: 56rpx; height: 56rpx; - position: relative; - right: 692rpx; - bottom: -4rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } - -.zs_t4{ +.zs_t4 { width: 56rpx; height: 56rpx; - position: relative; - right: 692rpx; - bottom: -642rpx; + position: absolute; + right: 20rpx; + bottom: 10rpx; } - - - -/* xiao */ - - -.zs_goods_xiao_bottom{ +.zs_goods_xiao_bottom { width: 100%; min-height: 300rpx; - display: flex; border-bottom: 2rpx #eee solid; padding: 10rpx; background-color: white; - } -.zs_goods_xiao{ +.zs_goods_xiao { width: 100%; min-height: 300rpx; - display: flex; /* border-bottom: 2rpx #eee solid; */ padding: 10rpx; background-color: white; } -.zs_top_x{ +.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; + width: 290rpx; height: 290rpx; margin-left: 20rpx; - /* background-color: bisque; */ - } -.zs_center_x{ - +.zs_center_x { width: 100%; min-height: 200rpx; font-size: 28rpx; color: #333; text-align: left; margin-top: 30rpx; - padding: 0 10rpx; + padding: 0 10rpx; } -.zs_wz1_x{ +.zs_wz1_x { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; - width: 80%; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; + width: 80%; } - -.zs_wz2_x{ +.zs_wz2_x { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz3_x{ +.zs_wz3_x { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz4_x{ +.zs_wz4_x { overflow: hidden; - text-overflow: ellipsis; - margin-bottom:10rpx; -font-size:28rpx; - white-space: nowrap; + text-overflow: ellipsis; + margin-bottom: 10rpx; + font-size: 28rpx; + white-space: nowrap; } -.zs_wz5_x{ +.zs_wz5_x { overflow: hidden; - text-overflow: ellipsis; - font-size:30rpx; - white-space: nowrap; + text-overflow: ellipsis; + font-size: 30rpx; + white-space: nowrap; } -.wz_red{ - color: #C4182E; - font-size: 32rpx; +.wz_red { + color: #c4182e; + font-size: 32rpx; } -.del{ - font-size: 24rpx; - color: #999; - text-decoration: line-through; - margin-left: 10rpx; - margin-top: 8rpx; +.del { + font-size: 24rpx; + color: #999; + text-decoration: line-through; + margin-top: 8rpx; } -.zs_t1_x{ +.zs_t1_x { width: 56rpx; height: 56rpx; position: relative; right: 62rpx; -top: 6rpx; + top: 6rpx; } -.zs_t1_x1{ - width: 56rpx; +.zs_t1_x1 { + width: 56rpx; height: 56rpx; position: relative; right: 285rpx; -top: 6rpx; + top: 6rpx; } -.zs_t1_x2{ - width: 56rpx; +.zs_t1_x2 { + width: 56rpx; height: 56rpx; position: relative; right: 56rpx; -top: 234rpx; + top: 234rpx; } - -.zs_t1_x3{ - width: 56rpx; +.zs_t1_x3 { + width: 56rpx; height: 56rpx; position: relative; right: 288rpx; -top: 234rpx; + top: 234rpx; } /*1列2个*/ -.zs_goods_ban{ +.zs_goods_ban { width: 100%; min-height: 300rpx; } -.zs_goods_wai_ban{ +.zs_goods_wai_ban { display: flex; /* padding-left: 2rpx; */ margin-bottom: 12rpx; width: 48.5%; float: left; background: #fff; - margin-left: 1% + margin-left: 1%; } - -.zs_goods_2l{ +.zs_goods_2l { width: 94%; min-height: 300rpx; /* border: 2rpx #ddd solid; */ margin: 0 auto; - padding: 2rpx; + padding: 2rpx; } -.zs_top_2l{ +.zs_top_2l { width: 340rpx; height: 340rpx; } @@ -319,124 +282,117 @@ top: 234rpx; border: none; } - .zs_t_img_2l { width: 100%; height: 100%; margin: 0 auto; } -.zs_center_2l{ +.zs_center_2l { width: 100%; min-height: 200rpx; font-size: 28rpx; color: #333; text-align: left; - padding: 0 10rpx; + padding: 0 10rpx; } -.zs_wz1_2l{ +.zs_wz1_2l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; + margin-bottom: 10rpx; + font-size: 30rpx; white-space: nowrap; margin-top: 10rpx; } - -.zs_wz2_2l{ +.zs_wz2_2l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; + margin-bottom: 10rpx; + font-size: 30rpx; white-space: nowrap; margin-top: 10rpx; + height: 80rpx; + line-height: 40rpx; } -.zs_wz3_2l{ +.zs_wz3_2l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; + margin-bottom: 10rpx; + font-size: 30rpx; white-space: nowrap; margin-top: 10rpx; } -.zs_wz4_2l{ +.zs_wz4_2l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; + margin-bottom: 10rpx; + font-size: 30rpx; white-space: nowrap; margin-top: 10rpx; } -.zs_wz5_2l{ +.zs_wz5_2l { overflow: hidden; text-overflow: ellipsis; - font-size:30rpx; + font-size: 30rpx; white-space: nowrap; margin-top: 10rpx; } +/*---俩列图片位置---*/ -.zs_t1_2l{ +.zs_t1_2l { width: 56rpx; height: 56rpx; - position: relative; - right: -2rpx; - top: -310rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } - -.zs_t2_2l{ +.zs_t2_2l { width: 56rpx; height: 56rpx; - position: relative; - right: -294rpx; - bottom: 310rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } -.zs_t3_2l{ +.zs_t3_2l { width: 56rpx; height: 56rpx; - position: relative; - right: -294rpx; - bottom: 68rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } - -.zs_t4_2l{ +.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; + +.zs_goods_wai_san { + width: 230rpx; display: flex; - margin-left: 8rpx; + margin-left: 10rpx; float: left; margin-bottom: 8rpx; - background-color:white; - + background-color: white; } -.zs_goods_san{ +.zs_goods_san { width: 240rpx; - } - - - - - -.zs_goods_3l{ +.zs_goods_3l { width: 240rpx; min-height: 300rpx; border: 2rpx #ddd solid; @@ -444,113 +400,161 @@ top: 234rpx; padding: 2rpx; } -.zs_top_3l{ - width: 240rpx; - height: 240rpx; - - - - - - +.zs_top_3l { + 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{ +.zs_center_3l { width: 100%; min-height: 200rpx; font-size: 28rpx; color: #333; text-align: left; - padding: 0 10rpx; + padding: 0 10rpx; } -.zs_wz1_3l{ +.zs_wz1_3l { + margin-bottom: 10rpx; + font-size: 30rpx; + height: 80rpx; + width: 220rpx; overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; - height: 80rpx; - width: 227rpx; - /* white-space: nowrap; */ + 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; +.zs_wz2_3l { + margin-bottom: 10rpx; + font-size: 30rpx; + display: flex; } -.zs_wz3_3l{ +.zs_wz3_3l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; - white-space: nowrap; + margin-bottom: 10rpx; + font-size: 30rpx; + white-space: nowrap; } -.zs_wz4_3l{ +.zs_wz4_3l { overflow: hidden; text-overflow: ellipsis; - margin-bottom:10rpx; - font-size:30rpx; - white-space: nowrap; + margin-bottom: 10rpx; + font-size: 30rpx; + white-space: nowrap; } -.zs_wz5_3l{ +.zs_wz5_3l { overflow: hidden; text-overflow: ellipsis; - font-size:30rpx; - white-space: nowrap; + font-size: 30rpx; + white-space: nowrap; } - -.zs_t1_3l{ +.zs_t1_3l { width: 56rpx; height: 56rpx; - position: relative; - right: 0rpx; - top: -250rpx; + position: absolute; + left: 0rpx; + top: 10rpx; } - -.zs_t2_3l{ +.zs_t2_3l { width: 56rpx; height: 56rpx; - position: relative; - right: -177rpx; - bottom: 250rpx; + position: absolute; + right: 0rpx; + top: 10rpx; } -.zs_t3_3l{ +.zs_t3_3l { width: 56rpx; height: 56rpx; - position: relative; - right: -177rpx; - bottom: 67rpx; + position: absolute; + left: 0rpx; + bottom: 10rpx; } - -.zs_t4_3l{ +.zs_t4_3l { width: 56rpx; height: 56rpx; - position: relative; + position: absolute; right: 0rpx; - bottom: 67rpx; + bottom: 10rpx; } -.zs_goods_wai{ +.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; + margin-top: -3rpx; +} + +.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: 25rpx; + align-items: center; + border-radius: 26rpx; + font-size: 19rpx; + line-height: 25rpx; + max-width: 110rpx; + background: #333; + color: #fff; + justify-content: center; + margin-left: 8rpx; +} + +.card_bg image { + width: 19rpx; + height: 19rpx; + margin-right: 1rpx; +} + +.card_bg .card_name { + max-width: 76rpx; + width: auto; + overflow: hidden; + white-space: nowrap; +} 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..11b1296 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -1,139 +1,159 @@ -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属性,属性值可以在组件使用时指定 + // 这⾥定义了innerText属性,属性值可以在组件使⽤时指定 }, 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 }); - } - } - }) - }, - - + 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 th = this; + // var url = "http://172.20.0.233:8022/api/weshop/display"; + // wx.request({ + // url: url, + // success: function (res) { + // th.setData({ + // recommend: res.data.data.pageData + // }) + // } + // }) + // }, + 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) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + 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); - }) - }, - + 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..eb5ed88 100644 --- a/components/goods_list/goods_list.wxml +++ b/components/goods_list/goods_list.wxml @@ -1,128 +1,144 @@ - - - - - - - - - - - - - {{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}} + + + + + + + {{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}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + - - - - 没有更多内容了 - - - - - - \ No newline at end of file + + + + + + 没有更多内容了 + + + \ No newline at end of file diff --git a/components/goods_list/goods_list.wxss b/components/goods_list/goods_list.wxss index 437a2a9..2814822 100644 --- a/components/goods_list/goods_list.wxss +++ b/components/goods_list/goods_list.wxss @@ -1,71 +1,78 @@ .collects { margin-top: 40rpx; } -.ib{ - display: inline-block; -} -.fs20{ - font-size: 20rpx; -} -.fs22{ - font-size: 22rpx; -} -.fs24{ - font-size: 24rpx; -} -.fs26{ - font-size: 26rpx; + +.ib { + display: inline-block; } -.fs28{ - font-size: 28rpx; + +.fs20 { + font-size: 20rpx; } -.fs35{ - font-size:35rpx; + +.fs22 { + font-size: 22rpx; } +.fs24 { + font-size: 24rpx; +} +.fs26 { + font-size: 26rpx; +} -.flex-center{ -display:flex; -justify-content:center; -align-items:center; +.fs28 { + font-size: 28rpx; } -.xc-wc{ - color: #d60021; +.fs35 { + font-size: 35rpx; } +.flex-center { + display: flex; + justify-content: center; + align-items: center; +} +.xc-wc { + color: #d60021; +} -.xc-ash{ -color: #b9b9b9; +.xc-ash { + color: #b9b9b9; } + .choice_box .choice_list .choice_footer .price { - color: #f23030; height: 10px + color: #f23030; + height: 10px; +} + +.flex { + display: flex; } -.flex{display: flex} .ellipsis-2 { - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; -} -.goods_name{ - height: 62rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods_name { + height: 62rpx; margin-top: 6rpx; line-height: 30rpx; - - } + .hang { width: 100%; margin: auto; padding-left: 21rpx; } - .hang .collect { width: 347rpx; height: 520rpx; @@ -91,15 +98,19 @@ color: #b9b9b9; line-height: 28rpx; align-items: baseline; } -.collect .money view{ + +.collect .money view { line-height: 28rpx; } + .collect .money .flex { - font-weight: bold; + font-weight: bold; } -.collect .money .flex .fs24{ + +.collect .money .flex .fs24 { padding-top: 5rpx; } + .collect .Discount { width: 156rpx; height: 28rpx; @@ -150,12 +161,34 @@ color: #b9b9b9; background-color: rgb(138, 138, 138); } -.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 +.line_th { + text-decoration: line-through; +} + +.card_bg { + display: flex; + padding: 2rpx 10rpx; + height: 25rpx; + align-items: center; + border-radius: 26rpx; + font-size: 19rpx; + line-height: 25rpx; + max-width: 110rpx; + background: #333; + color: #fff; + justify-content: center; + margin-left: 8rpx; +} + +.card_bg image { + width: 19rpx; + height: 19rpx; + margin-right: 1rpx; +} + +.card_bg .card_name { + max-width: 76rpx; + width: auto; + overflow: hidden; + white-space: nowrap; +} diff --git a/pages/goods/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml index 688da7e..c918332 100644 --- a/pages/goods/goodsList/goodsList.wxml +++ b/pages/goods/goodsList/goodsList.wxml @@ -1,141 +1,153 @@ - - - - - - - - - - - - - + + + + + + + + + + + {{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}} - + + + + - - 没有相关的数据 - 去逛逛 + + 没有相关的数据 + 去逛逛 - - +