diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index f483645..1514c65 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -107,12 +107,13 @@ Component({ 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)); + 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); }, @@ -124,7 +125,7 @@ Component({ var th = this; var g_id = this.data.g_id; if (classstyle_id == 1) { - //手动选择的时候 + //---手动选择的时候--- g_id = this.data.firist_type_data[th.data.firist_type_curr]; th.data.firist_type_curr++; } @@ -136,75 +137,46 @@ Component({ //--初始化卡类-- th.card_init(); - var os=getApp().globalData.setting; - classstyle_id = classstyle_id + ""; switch (classstyle_id) { - case "1": - g_id.forEach(function (val, ind) { - var item = {}; - var prom_id = null; - console.log(val.goodsid); - app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goodsid, {}).then(res => { - //商品地址 - var goods = res.data.data; - th.setData({ - goods_btn: res.data.data - }) - - item.goods_name = goods.goods_name; - item.goods_img = th.data.imghost + goods.original_img; - item.market_price = goods.market_price; - item.shop_price = goods.shop_price; - item.sales_sum = goods.sales_sum; - item.goods_id = goods.goods_id; - item.cardprice1 = goods.cardprice1; - item.cardprice2 = goods.cardprice2; - item.cardprice3 = goods.cardprice3; - - prom_id = res.data.data.prom_id; - - var prom_type = res.data.data.prom_type; //0普通商品 1秒杀 6拼单 - - var url = ""; - if (prom_type == 6) { - url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - } else if (prom_type == 1) { - url = "/api/ms/flash_sale/get/" + os.stoid + "/" + prom_id; - } - if(url==""){ - th.data.requestData.push(item); - th.setData({ goods_array: th.data.requestData, }); - if (th.data.firist_type_curr == th.data.firist_type_data.length) { - th.setData({ goods_btn: [] }); - } - }else{ - return app.request.promiseGet(url, {}) - } - - }).then(res => { - index++; - var prom = res.data.data; - var now=ut.gettimestamp(); - if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_timenow) {item.prom_type=0; item.prom_price=0;} + new_arr.push(item); + } + rData = rData.concat(new_arr); + th.data.requestData = rData; + th.setData({ goods_array: rData }); + //---控制有没有加载更多的按钮--- + if (th.data.firist_type_curr == th.data.firist_type_data.length) {th.setData({ goods_btn: [] }); } + else th.setData({ goods_btn: res.data}); + } + } + + }) + break; case "2": - var item = {}; app.request.promiseGet("/api/weshop/goods/page", { data: { @@ -256,7 +228,8 @@ Component({ } if(url!="") { await app.request.promiseGet(url, {}).then(res => { - var prom = res.data.data; + var prom = null + if (res && res.data) prom=res.data.data; if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time { - var prom = res.data.data; + var prom =null; + if(res && res.data) res.data.data; if (prom != null && prom.is_end==0 && prom.end_time>now && prom.show_time - - - - 拼单 - - - + + + + + 拼单 - - - - - - - - - - - 即将开始 - - - 火热进行 - - - - - - - + + + + + + + + + + + + - - - - - - + + 即将开始 + + + 火热进行 + - 商家 - 会员 - 阶梯 - + - - {{aitem.goods_name}} - ¥{{aitem.price}} - + + + - - {{aitem.ct_num}}人团 + + + + + + - 去参团 - 去开团 - 去开团 - 已抢光 - - - - - - + 商家 + 会员 + 阶梯 + - - - - - - - - - - - 商家 - 会员 - 阶梯 - - + + {{aitem.goods_name}} + ¥{{aitem.price}} + - + + {{aitem.ct_num}}人团 - {{aitem.title}} - - 已团{{aitem.buy_num}}件 - {{aitem.ct_num}}人团 - - ¥{{aitem.price}} - ¥{{aitem.market_price}} - - - {{aitem.djs.day}}天{{aitem.djs.hou}}时{{aitem.djs.min}}分{{aitem.djs.sec}}秒 - - - 去参团 - 去开团 - 去参团 - 已抢光 - - - - - + 去参团 + 去开团 + 去开团 + 已抢光 + + + + + + + + + + + + + + + + 商家 + 会员 + 阶梯 + + + + + + {{aitem.title}} + + 已团{{aitem.buy_num}}件 {{aitem.ct_num}}人团 + + + ¥{{aitem.price}} + ¥{{aitem.market_price}} + + + + {{aitem.djs.day}}天{{aitem.djs.hou}}时{{aitem.djs.min}}分{{aitem.djs.sec}}秒 + + + 去参团 + 去开团 + 去参团 + 已抢光 + + + + + + + \ No newline at end of file diff --git a/components/diy_pingd_buy/diy_pingd_buy.wxss b/components/diy_pingd_buy/diy_pingd_buy.wxss index 7ecabf5..2ca2b78 100644 --- a/components/diy_pingd_buy/diy_pingd_buy.wxss +++ b/components/diy_pingd_buy/diy_pingd_buy.wxss @@ -1,7 +1,11 @@ /* pages/wp/wp.wxss */ - +.top{ + display: flex; + align-items: center; + font-size: 32rpx; +} .top_p { - width: 100%; + padding:0rpx 20rpx; background-color: white; height: 70rpx; line-height: 70rpx; @@ -9,12 +13,12 @@ text-align: left; border-bottom: 2rpx solid #eee; display: flex; + justify-content: space-between; + align-items: center; } .right_p { width: 30rpx; - height: 100%; - margin-left: 580rpx; } .right_p image { @@ -26,9 +30,7 @@ width: 10rpx; height: 38rpx; background: #c4182e; - margin-top: 18rpx; margin-right: 12rpx; - margin-left: 20rpx; } .sp_p { @@ -42,7 +44,7 @@ .sp_p .sp_top_p { height: 220rpx; min-width: 30%; - position: relative; + position: relative; } .sp_p .sp_top_p .s_img_p { @@ -206,38 +208,41 @@ swiper { } .sp2_p .one1_p { - width: 100%; background-color: white; height: 252rpx; display: flex; padding: 20rpx; border-bottom: 6rpx#eee solid; + align-items: center; } .sp2_p .one1_p .o1_img_p { - width: 200rpx; - height: 240rpx; - margin-right: 24rpx; + width: 220rpx; + height: 220rpx; + margin-right: 25rpx; } -.o1_right_p{position: relative; width: 485rpx;} +.o1_right_p { + position: relative; + width: 465rpx; +} .o1_right_p .sp_wzi_p { - font-size: 36rpx; + font-size: 30rpx; margin-bottom: 6rpx; width: 100%; text-align: left; padding: 4rpx 0; - overflow: hidden; height: 48rpx; + overflow: hidden; + white-space: nowrap; text-overflow: ellipsis; } .o1_right_p .o1_sj_p { height: 60rpx; - margin-bottom: 10rpx; - font-size: 28rpx; - line-height: 40rpx; + font-size: 26rpx; + line-height: 40rpx; } .o1_right_p .o1_sj_p text { @@ -250,7 +255,7 @@ swiper { .o1_right_p .sp_jg_p { color: #c4182e; - font-size: 36rpx; + font-size: 30rpx; overflow: hidden; display: inline-block; margin-right: 10rpx; @@ -269,22 +274,20 @@ swiper { height: 100%; background-color: blueviolet; position: relative; - top: -8rpx; - left: 0rpx; } .o1_right_p .wo_p { background-color: #c4182e; - width: 160rpx; - height: 60rpx; - line-height: 60rpx; + width: 150rpx; + height: 55rpx; + line-height: 55rpx; color: white; text-align: center; - font-size: 26rpx; + font-size: 30rpx; border-radius: 14rpx; - position: absolute; - right: 0; - bottom:46rpx; + position: absolute; + right: 0; + bottom: 46rpx; } .sp_sj_p { @@ -295,12 +298,11 @@ swiper { position: absolute; bottom: 300rpx; right: 0rpx; - top: 0; + top: 0; width: 60rpx; height: 60rpx; text-align: center; line-height: 60rpx; - } .sp_sj1_p { @@ -315,20 +317,49 @@ swiper { text-align: center; line-height: 60rpx; } -.tuan_set_num{ - display: flex;justify-content: space-between; font-size: 28rpx; + +.tuan_set_num { + display: flex; + justify-content: space-between; + font-size: 28rpx; } -.tuan_set_num .co-red2{ - color: #B2AEA8;font-size: 26rpx; +.tuan_set_num .co-red2 { + color: #b2aea8; + font-size: 26rpx; } -.tuan_set_num .cantuan{ - background:#c4182e; color: #fff; padding: 4rpx 10rpx; border-radius:5rpx ; + +.tuan_set_num .cantuan { + background: #c4182e; + color: #fff; + padding: 4rpx 10rpx; + border-radius: 5rpx; } -.tuan_set_num .cantuan.huise{ - background:gainsboro; color: #666; + +.tuan_set_num .cantuan.huise { + background: gainsboro; + color: #666; } -.o1_sj_p .time_img{width: 40rpx; height: 40rpx; vertical-align: top; margin-right: 10rpx;} -.o1_right_p .co-red2{font-size:30rpx; color: #999;} -.o1_right_p .co-red2 .yituan_num{font-size:30rpx; margin-right: 10rpx; color: #333;} +.o1_sj_p .time_img { + width: 35rpx; + height: 35rpx; + vertical-align: top; + margin-right: 10rpx; +} + +.o1_right_p .co-red2 { + font-size: 26rpx; + color: #999; +} + +.o1_right_p .co-red2 .yituan_num { + font-size: 26rpx; + margin-right: 10rpx; + color: #333; +} +.money{ + display: flex; + align-items: center; + margin:5rpx 0rpx; +} \ No newline at end of file diff --git a/components/diy_seckill/diy_seckill.wxml b/components/diy_seckill/diy_seckill.wxml index 653412b..9eac2c0 100644 --- a/components/diy_seckill/diy_seckill.wxml +++ b/components/diy_seckill/diy_seckill.wxml @@ -1,100 +1,117 @@ - - - - 秒杀 - - - + + + + + 秒杀 + + + + - - - - - - - - - - - 即将开始 - - - 火热进行 - - - - - - - - - {{aitem.djs.day}}天 - {{aitem.djs.hou}}时 - {{aitem.djs.min}}分 - {{aitem.djs.sec}}秒 - - - - - - - {{aitem.goods_name}} - ¥{{aitem.price}} - ¥{{aitem.market_price}} - - - - + + + + + + + + + + + + 即将开始 + - - - - - - - - - - - - - - - - {{aitem.goods_name}} - - {{aitem.djs.day}} - 天 - {{aitem.djs.hou}} - : - {{aitem.djs.min}} - : - {{aitem.djs.sec}} - - - ¥{{aitem.price}} - ¥{{aitem.market_price}} - - 正在预热 - - - 我要抢 - - - - - - - - + + + 火热进行 + + + + + 已抢光 + + + + + + + + + + + {{aitem.djs.day}}天 + {{aitem.djs.hou}}时 + {{aitem.djs.min}}分 + {{aitem.djs.sec}}秒 + + + + + + + {{aitem.goods_name}} + ¥{{aitem.price}} + ¥{{aitem.market_price}} + + + + + - + + + + + + + + + + + + + + {{aitem.goods_name}} + + {{aitem.djs.day}} 天 + {{aitem.djs.hou}} : + {{aitem.djs.min}} : + {{aitem.djs.sec}} + + + + ¥{{aitem.price}} + ¥{{aitem.market_price}} + + + + 正在预热 + + + + + 我要抢 + + + + + + 已抢光 + + + + + + + + + + + + \ No newline at end of file diff --git a/components/diy_seckill/diy_seckill.wxss b/components/diy_seckill/diy_seckill.wxss index 8d24783..f364ac3 100644 --- a/components/diy_seckill/diy_seckill.wxss +++ b/components/diy_seckill/diy_seckill.wxss @@ -1,334 +1,291 @@ - -.top{ - width: 100%; +.flex{ + display: flex; + align-items: center; +} +.top { background-color: white; height: 70rpx; line-height: 70rpx; - color: #000; - text-align: left; - border-bottom: 2rpx solid #eee; - display: flex; + color: #000; + border-bottom: 2rpx solid #eee; + padding:0rpx 20rpx; + display: flex; + justify-content: space-between; + font-size: 32rpx; } - -.s_it{ +.s_it { width: 100%; display: flex; background-color: white; } -.s_prom{ +.s_prom { width: 100%; background-color: white; min-height: 200rpx; } swiper { - display:block; - height:400rpx; - + display: block; + height: 400rpx; } -.right_k{ +.right_k { width: 30rpx; - height: 100%; - margin-left: 580rpx; } -.right_k image{ width: 30rpx; height: 30rpx} - - -.top .t_left{ - width: 10rpx; - height: 38rpx; - background: #C4182E; - margin-top:18rpx; -margin-right:12rpx; -margin-left:20rpx; +.right_k image{ + width: 30rpx; + height: 30rpx; +} + .t_left { + width: 10rpx; + height: 38rpx; + background: #c4182e; + margin-right: 10rpx; } -.sp{ +.sp { min-height: 300rpx; width: 100%; background-color: white; - padding:18rpx; -display: flex; + padding: 18rpx; + display: flex; } -.sp .sp_top{ +.sp .sp_top { height: 220rpx; min-width: 30%; - - } -.sp .sp_top .s_img{ +.sp .sp_top .s_img { width: 210rpx; height: 100%; } -.sp .sp_top .s_img image{ +.sp .sp_top .s_img image { width: 210rpx; height: 100%; - position: relative; top: -74rpx; - left:0rpx; - + left: 0rpx; } -.sp .sp_top .s_top_kill - -{ - -background-color:#C4182E; -font-size:24rpx; -height:38rpx; -line-height:38rpx; -left:6rpx; - -padding:4rpx 10rpx; - -border-radius:10rpx; - - -z-index: 999; +.sp .sp_top .s_top_kill { + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + left: 6rpx; + padding: 4rpx 10rpx; + border-radius: 10rpx; + z-index: 999; position: relative; - top:-6rpx; - width: 210rpx; - - - color: #fff; - text-align: center; - - + top: -6rpx; + width: 210rpx; + color: #fff; + text-align: center; } -.po{ +.po { position: absolute; } -.sp .sp_top .s_foot_kill{ +.sp .sp_top .s_foot_kill { font-size: 20rpx; position: relative; - top:-90rpx; - width: 210rpx; - height: 38rpx; - line-height: 38rpx; - color: #fff; - text-align: center; - background-color: rgba(0, 0, 0, 0.5); + top: -90rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); } - - -.sp_wz{ -width: 210rpx; - min-height:100rpx; - +.sp_wz { + width: 210rpx; + min-height: 100rpx; } -.sp_wz .sp_wzi{ - font-size: 30rpx; - border-bottom: 2rpx solid #dcdcdc; - width: 100%; - text-align: left; - padding: 4rpx 0; - overflow: hidden; - height: 48rpx; - text-overflow: ellipsis; - white-space: nowrap; - line-height: 48rpx; +.sp_wz .sp_wzi { + font-size: 30rpx; + border-bottom: 2rpx solid #dcdcdc; + width: 100%; + text-align: left; + padding: 4rpx 0; + overflow: hidden; + height: 48rpx; + text-overflow: ellipsis; + white-space: nowrap; + line-height: 48rpx; } -.sp_wz .sp_jg{ - color: #C4182E; - font-size: 30rpx; - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - margin-right: 10rpx; +.sp_wz .sp_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + margin-right: 10rpx; } -.sp_wz .sp_jgx{ +.sp_wz .sp_jgx { color: #adadad; - text-decoration: line-through; - font-size: 24rpx; - - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - + text-decoration: line-through; + font-size: 24rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; } -.one{ +.one { margin-left: 14rpx; - } - -.sp .sp_top .s_top1_kill{ +.sp .sp_top .s_top1_kill { position: absolute; -background-color:#C4182E; -font-size:24rpx; -height:38rpx; -line-height:38rpx; -left:265rpx; -top:100rpx; -padding:0 10rpx; -color:white; -border-radius:10rpx; - + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + left: 265rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; } -.sp .sp_top .s_top2_kill{ +.sp .sp_top .s_top2_kill { position: absolute; -background-color:#C4182E; -font-size:24rpx; -height:38rpx; -line-height:38rpx; -right:146rpx; -top:100rpx; -padding:0 10rpx; -color:white; -border-radius:10rpx; - + background-color: #c4182e; + font-size: 24rpx; + height: 38rpx; + line-height: 38rpx; + right: 146rpx; + top: 100rpx; + padding: 0 10rpx; + color: white; + border-radius: 10rpx; } - - -.sp .sp_top .s_foot1_kill{ +.sp .sp_top .s_foot1_kill { font-size: 20rpx; position: absolute; - top:270rpx; - width: 210rpx; - height: 38rpx; - line-height: 38rpx; - color: #fff; - text-align: center; - background-color: rgba(0, 0, 0, 0.5); + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); } -.po1{ +.po1 { position: absolute; } - -.sp .sp_top .s_foot2_kill{ +.sp .sp_top .s_foot2_kill { font-size: 20rpx; position: absolute; - top:270rpx; - width: 210rpx; - height: 38rpx; - line-height: 38rpx; - color: #fff; - text-align: center; - background-color: rgba(0, 0, 0, 0.5); + top: 270rpx; + width: 210rpx; + height: 38rpx; + line-height: 38rpx; + color: #fff; + text-align: center; + background-color: rgba(0, 0, 0, 0.5); } - - - - - - -.sp2{ +.sp2 { width: 100%; min-height: 240rpx; - } -.sp2 .one1{ - width: 100%; +.sp2 .one1 { background-color: white; - height: 252rpx; + height: 285rpx; display: flex; - padding: 20rpx; - border-bottom:6rpx#eee solid; - + padding:0rpx 20rpx; + border-bottom: 6rpx#eee solid; + align-items: center; } -.sp2 .one1 .o1_img{ - width: 200rpx; - height: 240rpx; - - margin-right: 24rpx; +.sp2 .one1 .o1_img { + width: 220rpx; + height: 220rpx; + margin-right: 25rpx; } -.o1_right .sp_wzi{ - font-size: 36rpx; - margin-bottom:6rpx; - - width: 100%; +.o1_right .sp_wzi { + font-size: 30rpx; + margin-bottom: 6rpx; text-align: left; padding: 4rpx 0; - overflow: hidden; height: 48rpx; + overflow: hidden; + white-space: nowrap; text-overflow: ellipsis; - white-space: nowrap } -.o1_right .o1_sj_kill{ +.o1_right .o1_sj_kill { height: 60rpx; - margin-bottom: 10rpx; + font-size: 28rpx; } -.o1_right .o1_sj_kill text{ +.o1_right .o1_sj_kill text { background-color: #fdcb08; text-align: center; border-radius: 10rpx; - padding:4rpx; -margin-left:6rpx; - + padding: 4rpx; + margin-left: 6rpx; } - - -.o1_right .sp_jg{ - color: #C4182E; - font-size: 36rpx; - +.o1_right .sp_jg { + color: #c4182e; + font-size: 30rpx; overflow: hidden; display: inline-block; margin-right: 10rpx; } -.o1_right .sp_jgx{ +.o1_right .sp_jgx { color: #dcdcdc; text-decoration: line-through; font-size: 26rpx; - overflow: hidden; display: inline-block; } - -.o1_img image{ - width: 100%; - height: 100%; - - position:relative; -top:-23rpx; -left:0rpx; - +.o1_img image { + width: 220rpx; + height: 220rpx; } - -.o1_right .wo{ - background-color: #C4182E; - width: 160rpx; - height: 60rpx; - line-height: 60rpx; +.o1_right{ + width: 465rpx; +} +.o1_right .wo { + background-color: #c4182e; + width: 150rpx; + height: 50rpx; + line-height: 50rpx; color: white; text-align: center; - font-size: 38rpx; - margin-left:298rpx; -border-radius:14rpx; -padding-left: 10rpx; -padding-right: 10rpx; + font-size: 30rpx; + border-radius: 14rpx; +} +.rob{ + display: flex; + justify-content: flex-end; + font-size: 30rpx; +} +.money{ + display: flex; + align-items: center; } - - +.sp .sp_top .s_top_kill.gray{background-color:#bdbdc1;color: #fff;font-weight: normal} \ No newline at end of file diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index e0fb47c..4d499d8 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -113,11 +113,7 @@ Page({ onShow: function() { var th=this; if (th.data.isclose==0){ - /*--- - wx.navigateTo({ - url: "/pages/user/index/index" - //url: "/pages/index/index/index" - })---*/ + wx.switchTab({ url: "/pages/index/index/index" }) @@ -131,7 +127,7 @@ Page({ th.setData({user_addr: ie }); var going=0; - //使用计算器,避免空现象 + //使用计时器,避免空现象 var jishi= setInterval(function () { if (th.data.is_b_now == 1 && going==0) { if(th.data.bn_goods) { @@ -243,7 +239,7 @@ Page({ data: { user_id: to.globalData.user_id, selected:1, store_id: oo.stoid, pageSize: 600 }, - success: async function (su) { + success:function (su) { //按门店分类的数组 var arr = new Array(); var carr = su.data.data.pageData; @@ -305,74 +301,13 @@ Page({ arr.push(ie); } } - - //------------开始计算使用优惠券相关------------ - for(var ind in arr){ - var ep=arr[ind]; - var goodlist=ep.goods; - - //--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西 - //就要把相应的值,写入cartlist数组中-- - var ckeck_quan_price=0, - check_quan_price_list='', - check_quan_ware_list=''; - - for(var i in goodlist){ - var gd=goodlist[i]; - //--如果是秒杀就跳出-- - if(gd.prom_type==1){ continue; } - var item_price=gd.goods_price*gd.goods_num; - ckeck_quan_price+=item_price; - - //--组装价格list-- - if (check_quan_price_list) { - check_quan_price_list += "," +item_price; - } else { - check_quan_price_list = item_price; - } - //--组装商品的线下erpwareid-- - if (check_quan_ware_list) { - check_quan_ware_list += "," +gd['erpwareid']; - } else { - check_quan_ware_list = gd['erpwareid']; - } - } - - arr[ind].ckeck_quan_price=ckeck_quan_price; - arr[ind].check_quan_ware_list=check_quan_ware_list; - arr[ind].check_quan_price_list=check_quan_price_list; - - //是否关闭使用优惠券 - if (th.data.is_close_quan != 1) { - //调用接口,获取优惠券的列表 - var url="/api/weshop/couponList/getUseCouponList"; - await app.request.promiseGet(url,{ - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100} - }).then(res=>{ - if(res.data.code==0) - arr[ind].quan_list=res.data.data.pageData; - }) - - var frozenQuan=null; - var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id; - await app.request.promiseGet(url0,{1:1}).then(res=>{ - if(res.data.code==0){ - frozenQuan=res.data.data; - } - }) - - if (frozenQuan && arr[ind].quan_list){ - arr[ind].quan_list=th.check_is_frozenQuan(arr[ind].quan_list,frozenQuan); - } - - } - } - th.setData({ cartlist: arr, }), th.calculatePrice(); + //--- 获取一下看有没有优惠券 ---- + th.get_cart_quan(); } }); }, @@ -381,7 +316,6 @@ Page({ get_buy_goods: function (e){ var th=this; var gg = to.get_b_now(); - //--------如果goods_id一样,就是要立即购买----- if(e==gg.goods_id){ a.get("/api/weshop/goods/get/" + oo.stoid+"/"+e, { @@ -408,7 +342,6 @@ Page({ } } - switch (gd.prom_type){ case 0: case 2: @@ -419,46 +352,21 @@ Page({ //--此时开始计算商品的使用券相关,如果有等级价还要计算和等级价相关的, // 如果有优惠促销,还要把促销的部分计算在内,因为促销还有不能使用优惠券-- t.data.data.shop_price=gg.goods_price; - th.data.ckeck_quan_price=t.data.data.shop_price*gg.goods_num; th.data.check_quan_price_list=t.data.data.shop_price*gg.goods_num+""; th.data.check_quan_ware_list=t.data.data.erpwareid+""; - var quanlist=null; - - if (th.data.is_close_quan != 1) { - var url="/api/weshop/couponList/getUseCouponList"; - await app.request.promiseGet(url,{ - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100} - }).then(res=>{ - if(res.data.code==0) - quanlist=res.data.data.pageData; - - - }) - } - - var frozenQuan=null; - var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id; - await app.request.promiseGet(url0,{1:1}).then(res=>{ - if(res.data.code==0){ - frozenQuan=res.data.data; - } - }) - - if (frozenQuan && quanlist){ - quanlist=th.check_is_frozenQuan(quanlist,frozenQuan); - } - t.data.data.prom_id = 0; t.data.data.prom_type = 0; th.setData({ bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist + bn_pick: gg.pick_id, bn_t_exp_t: distr_t }); //计算价格 th.calculatePrice2(); + //获取优惠券 + th.get_buy_now_quan(); break; case 1: //---秒杀----- @@ -474,37 +382,16 @@ Page({ th.data.ckeck_quan_price=t.data.data.shop_price*gg.goods_num; th.data.check_quan_price_list=t.data.data.shop_price*gg.goods_num+""; th.data.check_quan_ware_list=t.data.data.erpwareid+""; - - if (th.data.is_close_quan != 1) { - - var url="/api/weshop/couponList/getUseCouponList"; - await app.request.promiseGet(url,{ - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100} - }).then(res=>{ - if(res.data.code==0) - quanlist=res.data.data.pageData; - }) - - var frozenQuan=null; - var url0="/api/weshop/users/frozenQuan/listFrozenQuan/"+app.globalData.user_id; - await app.request.promiseGet(url0,{1:1}).then(res=>{ - if(res.data.code==0){ - frozenQuan=res.data.data; - } - }) - - if (frozenQuan && quanlist){ - quanlist=th.check_is_frozenQuan(quanlist,frozenQuan); - } - } } th.setData({ bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, - bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist + bn_pick: gg.pick_id, bn_t_exp_t: distr_t }); //计算价格 th.calculatePrice2(); + //获取优惠券 + th.get_buy_now_quan(); } }); @@ -1397,7 +1284,9 @@ Page({ //--验证是否已经冻结-- check_is_frozenQuan:function(quanlist,frozenQuan){ - console.log("券列表",quanlist); + console.log("券列表",quanlist); + if(!quanlist) return null; + if(!frozenQuan) return quanlist; var arr=[]; for(var i=0;i{ + if(res.data.code==0){ frozenQuan=res.data.data; } + //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- + var url="/api/weshop/couponList/getUseCouponList"; + app.request.time_limit_get(6,url,{ + data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100}, + success:function (res) { + if (res.data.code == 0) { + arr[ind].quan_list = res.data.data.pageData; + arr[ind].quan_list = th.check_is_frozenQuan(arr[ind].quan_list, frozenQuan); + th.setData({cartlist:arr }) + } + } + }) + }) + } + } + }, + //------ 获取立即购买的购物车的劵 -------- + get_buy_now_quan:function () { + var quanlist=null,th=this,frozenQuan = null; + if(th.data.is_close_quan != 1) + { + var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; + var url="/api/weshop/couponList/getUseCouponList"; + app.request.promiseGet(url0, {1: 1}).then(res => { + if (res.data.code == 0) { + frozenQuan = res.data.data; + } + app.request.time_limit_get(6, url, { + data: { + storeId: oo.stoid, + userId: app.globalData.user_id, + BuySum: th.data.ckeck_quan_price, + WareIds: th.data.check_quan_ware_list, + pageSize: 100 + }, + success: function (res) { + if (res.data.code == 0) { + quanlist = res.data.data.pageData; + if (quanlist) { + quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); + th.setData({selected_quan_list:quanlist }) + } + } + } + + }) + }) + + } + } }); diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index 40e65b3..5bd9134 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -1,3 +1,4 @@ +var i = require("../../../utils/util.js"); var e = getApp(), a = e.globalData.setting, os = a, @@ -12,35 +13,43 @@ Page({ wareCard: [], page: 0, pageSize: 10, - isEmpty: true, + isEmpty: false, loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore contentText: { contentdown: '加载更多', contentrefresh: '加载中...', contentnomore: '已加载全部' - } + }, + ismore: 0, //数据是否全部加载完成 + is_read: 0, //是否查询过我的礼包接口 + curpage: 1, //当前分页数 + pageSize: 3, //页大小 + total: 0, //总数量 }, onLoad: function(options) { var th = this; + var my_confirm = th.selectComponent("#my_confirm"); //组件的id + my_confirm.open_cancel(0); th.setData({ getStorageID: a.stoid, - getUserID: 5682130 + getUserID: d.user_id }) + th.getList(); }, onShow: function() { - var th = this; - th.setData({ - pages: 1, - pageSize: 10, - loadingType: 0 - }) - th.getList(); + // var th = this; + // th.setData({ + // pages: 1, + // pageSize: 10, + // loadingType: 0 + // }) + // th.getList(); }, GetBuyPrice: function(e) { var that = this.data; var th = this; - var lbId = e.currentTarget.dataset.lbId;//活动id + var id = e.currentTarget.dataset.id; //活动id var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open( "是否确定购买该礼包", @@ -50,11 +59,12 @@ Page({ my_confirm.open_cancel(0); }, function() { + my_confirm.open_cancel(0); var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 "buyType": '2', //1=积分兑换 2=余额购买 - "lbId": lbId, //礼包Id + "lbId": id, //礼包Id "storeId": that.getStorageID, //商家Id "userId": that.getUserID, //用户ID "buyFrom": 2 @@ -68,9 +78,22 @@ Page({ header: { 'content-type': 'application/json' }, // 设置请求的 header - success: function (res) { + success: function(res) { if (res.data.code == 0) { - window.location.href = th.data.url + '/Mobile/Payment/getPay.html?stoid=' + that.getStorageID + '&order_sn=' + res.data.data.orderSn + '&recharge_type=6'; + res = res.data.data; + wx.requestPayment({ + timeStamp: String(res.timeStamp), + nonceStr: res.nonceStr, + package: res.packageValue, + signType: res.signType, + paySign: res.paySign, + success: function(n) { + + }, + fail: function(n) { + + } + }); } else { getApp().my_warnning(res.data.msg, 0, th); } @@ -87,7 +110,7 @@ Page({ GetBuyIntegral: function(e) { var that = this.data; var th = this; - var lbId = e.currentTarget.dataset.lbId;//活动id + var id = e.currentTarget.dataset.id; //活动id var my_confirm = th.selectComponent("#my_confirm"); //组件的id my_confirm.open( "是否确定兑换该礼包", @@ -97,16 +120,25 @@ Page({ my_confirm.open_cancel(0); }, function() { - getApp().request.post('/api/weshop/marketing/buy/receive/gift/record/insert', { - data: { - "actId": '', //活动Id - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "buyType": '1', //1=积分兑换 2=余额购买 - "lbId": 26, //礼包Id - "storeId": that.getStorageID, //商家Id - "userId": that.getUserID //用户ID - }, - success: function success(res) { + my_confirm.open_cancel(0); + var json = { + "actId": '', //活动Id + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "buyType": '1', //1=积分兑换 2=余额购买 + "lbId": id, //礼包Id + "storeId": that.getStorageID, //商家Id + "userId": that.getUserID //用户ID + }; + var data = JSON.stringify(json); + var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; + wx.request({ + url: url, + data: data, + method: 'post', + header: { + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { if (res.data.code == 0) { getApp().my_warnning("兑换成功!", 1, th); } else { @@ -117,66 +149,66 @@ Page({ }) - }, getList: function(e) { - var _this = this; //上拉加载 - var that = this.data; - if (that.loadingType != 0) { - return false; - } - // that.loadingType = 1; - _this.setData({ - loadingType: 1 - }) - getApp().request.get('/api/weshop/marketing/my/giftbag/page', { + var th = this; + getApp().request.get('/api/weshop/marketing/giftbag/page', { data: { - "storeId": that.getStorageID, //商家ID - "userId": that.getUserID, //用户ID - "page": that.pages, - "pageSize": that.pageSize + storeId: th.data.getStorageID, //商家ID + userId: th.data.getUserID, //用户ID + page: th.data.pages, + pageSize: th.data.pageSize }, success: function success(res) { + wx.hideLoading(); if (res.data.code == 0) { - if (res.data.data.total > 0) { - _this.setData({ - isEmpty: false - }) - } else { - _this.setData({ - isEmpty: true - }) - } - if (res.data.data.pageData.length == 0) { - _this.setData({ - loadingType: 2 - }) - } else { - var wareCard = that.wareCard; - if (wareCard.length < res.data.data.total) { - for (var i = 0; i < res.data.data.pageData.length; i++) { - wareCard.push(res.data.data.pageData[i]); - } - } - _this.setData({ - wareCard: wareCard - }) - _this.setData({ - loadingType: 0 - }) - - } + th.data.curpage++; + var arr1 = th.data.wareCard; + var arr2 = res.data.data.pageData; + var arr3 = [...arr1, ...arr2]; + var ismore = 0; + if (arr3.length == res.data.data.total) ismore = 1 + th.setData({ + wareCard: arr3, + total: res.data.data.total, + ismore: ismore, + is_read: 1 + }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { - getApp().my_warnning(res.data.msg, 0, th); + th.setData({ + is_read: 1 + }) } } }) }, - //界面跳转 - goto: function(e) { + //销毁界面跳转 + redirectTo: function(e) { var th = this; var url = e.currentTarget.dataset.url; - getApp().goto(url); - } + //销毁跳转 + wx.redirectTo({ + url: url + }); + }, + //不销毁界面跳转 + navigateTo: function(e) { + var th = this; + var url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }) + }, + //下拉事件 + onReachBottom: function() { + var th = this; + if (th.data.total <= th.data.pageSize) return; + if (th.data.ismore) return; + wx.showLoading({ + title: '加载中...', + }) + th.getList(); + }, + }) \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.json b/pages/giftpack/buygiftpack/giftpackbuy.json index d1faf2e..f5d4df2 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.json +++ b/pages/giftpack/buygiftpack/giftpackbuy.json @@ -1,6 +1,7 @@ { "navigationBarTitleText": "礼包列表", "navigationStyle": "custom", + "enablePullDownRefresh": false, "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm" diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index bc7d106..53c9c16 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -1,78 +1,86 @@ - - + + + + + + 礼包列表 - - - 礼包列表 + + + 我的礼包 + + + + + + + - - - 我的礼包 + + + {{items.giftTitle}} + + + + {{"¥"+items.payMoney}} + + + / + + + + {{items.payIntegral}} + 积分 + + + + + {{"原价:¥"+items.giftPosPrice}} + + + {{"活动时间:"+items.endTime}} + - - - - - - - - - - {{items.giftTitle}} - - - - {{"¥"+items.payMoney}} - - - / - - - {{items.payIntegral+"积分"}} - - - - {{"原价:¥"+items.giftPosPrice}} - - - {{"活动时间:"+items.endTime}} - - - - - - {{"已售:"+items.giftQty+"件"}} - - - - - - - - - - - - + + + + {{"已售:"+items.giftQty+"件"}} - - - - - - - - 当前暂无礼包 + + + + - - 去获取 + + + + + - - - ———— 到底了 ———— + + + + + + + + + + 当前暂无礼包 + + + 去获取 + + + + + + 到底了 + + diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxss b/pages/giftpack/buygiftpack/giftpackbuy.wxss index 0ae857b..a43b773 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxss +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxss @@ -29,6 +29,7 @@ page { margin: 0rpx 20rpx 0rpx 20rpx; -webkit-align-content: center; align-content: center; + margin-bottom: 10rpx; } .top_title_box { @@ -60,8 +61,9 @@ page { .content_box { background-color: #fff; - margin: 10rpx 20rpx 0rpx 20rpx; + margin: 0rpx 20rpx; border-radius: 10rpx; + margin-bottom: 10rpx; } .content_box_ware { @@ -149,7 +151,7 @@ page { } .box_button_remark { - margin-left: 5rpx; + } .box_button_remark text { @@ -162,24 +164,20 @@ page { width: 160rpx; height: 50rpx; font-size: 20rpx; - background: #d41c34; - color: #fff; + background: #fff; + color: #000; line-height: 50rpx; } -.box_button_dui { - text-align: right; - margin: 22rpx 25rpx 0rpx 0rpx; -} - .box_button_dui button { display: inline-block; width: 160rpx; height: 50rpx; font-size: 20rpx; - background: #fff; - color: #000; + background: #d41c34; + color: #fff; line-height: 50rpx; + margin-left: 20rpx; } .foot_box { @@ -229,3 +227,17 @@ page { font-size: 28rpx; color: #fff; } +.After_all { + height: 80rpx; + margin-bottom: 10rpx; + color: rgb(255, 255, 255); +} + +.After_all .Line { + border-top: 3rpx solid rgb(255, 255, 255); + width: 130rpx; +} + +.After_all .end { + margin: 0rpx 15rpx; +} \ No newline at end of file diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index fbb2069..bfd99dd 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -22,6 +22,7 @@ Page({ getUrl: '', wareCard: [], orderSn: "", //订单编号 + lbId:"" }, onLoad: function(options) { var th = this; @@ -32,93 +33,129 @@ Page({ getGiftID: options.lbId, orderSn: options.orderSn }) - }, - onShow: function() { - var th = this; - if (th.data.isBuy == 0) { + if (options.isBuy == 0) { th.GetMyGiftList(); } else { th.GetBuyGiftList(); } - - // this.giftRemark = this.giftRemark.replace(/

- - + + + + + + {{giftTitle}} - - - {{giftTitle}} - - - {{"兑换截至时间:"+giftDate}} + + {{"兑换截至时间:"+giftDate}} + + + + {{"¥"+giftPrice}} + + + / + + + {{giftIntegral+"积分"}} + + + {{actTitle}} + + + + + {{"原价:"+giftPosPrice+"元"}} + + + {{"已售:"+giftQty+"件"}} + + + + + + 礼包内容 + + + + + + + + + + + + + + + + + + + - - - {{"¥"+giftPrice}} + + + {{item.couponName}} + + + + + + {{"数量:"+item.num}} + + + + - - / + + + + + - - {{giftIntegral+"积分"}} + + 已自动到账 - - {{actTitle}} - - - - - {{"原价:"+giftPosPrice+"元"}} - - - {{"已售:"+giftQty+"件"}} - + + + + + + + 活动说明 - - - 礼包内容 - - - - - - - - - - - - - - - - - - - - - - - {{item.couponName}} - - - - - - {{"数量:"+item.num}} - - - - - - - - - - - - - 已自动到账 - - - - - + + - - - 活动说明 + + + + + + + 立即购买 - - + + + + 立即兑换 - - - - - - - 立即购买 - - - - - 立即兑换 - - - - - 立即购买 - - - - - 立即兑换 - - + + + + 立即购买 - - - - - 立即使用 - + + + + 立即兑换 - + + + + + + + 立即使用 + + + diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index f2d85fa..35c810b 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -1,3 +1,4 @@ +var i = require("../../../utils/util.js") var e = getApp(), a = e.globalData.setting, os = a, @@ -6,19 +7,24 @@ var e = getApp(), Page({ data: { iurl: a.imghost, //图片前缀网址 - getDate: new Date().getTime(), + getDate: "", getStorageID: '', getUserID: '', wareCard: [], pages: 0, pageSize: 10, - isEmpty: true, + isEmpty: false, loadingType: 0, //定义加载方式 0---contentdown 1---contentrefresh 2---contentnomore contentText: { contentdown: '加载更多', contentrefresh: '加载中...', contentnomore: '已加载全部' - } + }, + ismore:0,//数据是否全部加载完成 + is_read:0,//是否查询过我的礼包接口 + curpage: 1, //当前分页数 + pageSize: 3, //页大小 + total: 0, //总数量 }, onLoad: function(options) { @@ -27,21 +33,26 @@ Page({ var th = this; th.setData({ getStorageID: a.stoid, - getUserID: 5682130 + getUserID: d.user_id, + pages: 1, + pageSize: 3, + loadingType: 0, + getDate: i.formatTime(new Date().getTime()) }) + th.getList(); }, onShow: function() { // this.pages = 1; // this.pageSize = 10; // this.loadingType = 0; // this.getList(); - var th = this; - th.setData({ - pages: 1, - pageSize: 10, - loadingType: 0 - }) - th.getList(); + // var th = this; + // th.setData({ + // pages: 1, + // pageSize: 10, + // loadingType: 0 + // }) + // th.getList(); }, // methods: { // BuyGift: function BuyGift() { @@ -60,96 +71,117 @@ Page({ // }, getList: function() { - var _this = this; //上拉加载 - var that = this.data; - if (that.loadingType != 0) { - return false; - } - // that.loadingType = 1; - _this.setData({ - loadingType: 1 - }) + var th = this; + // if (th.data.loadingType) { + // return false; + // } + // // that.loadingType = 1; + // th.setData({ + // loadingType: 1 + // }) getApp().request.get('/api/weshop/marketing/my/giftbag/page', { data: { // "storeId": this.getStorageID, //商家ID // "userId": this.getUserID, //用户ID // "page": this.pages, // "pageSize": this.pageSize - "storeId": that.getStorageID, //商家ID - "userId": that.getUserID, //用户ID - "page": that.pages, - "pageSize": that.pageSize + storeId: th.data.getStorageID, //商家ID + userId: th.data.getUserID, //用户ID + page: th.data.curpage, + pageSize: th.data.pageSize }, success: function success(res) { + wx.hideLoading(); if (res.data.code == 0) { - console.log(res.data.data); - if (res.data.data.total > 0) { - // _this.isEmpty = false; - _this.setData({ - isEmpty: false - }) - } else { - // _this.isEmpty = true; - _this.setData({ - isEmpty: true - }) - } - if (res.data.data.pageData.length == 0) { - // _this.loadingType = 2; - _this.setData({ - loadingType: 2 - }) - } else { - // console.log(_this.wareCard.length); - // console.log(res.data.data.pageData.length); - var wareCard = that.wareCard; - // if (_this.wareCard.length < res.data.data.pageData.length) { - if (wareCard.length < res.data.data.total) { - for (var i = 0; i < res.data.data.pageData.length; i++) { - wareCard.push(res.data.data.pageData[i]); - } - } - _this.setData({ - wareCard: wareCard - }) - - // _this.loadingType = 0; - _this.setData({ - loadingType: 0 - }) - console.log(_this.wareCard); - } + th.data.curpage++; + var arr1 = th.data.wareCard; + var arr2 = res.data.data.pageData; + var arr3 = [...arr1, ...arr2]; + var ismore = 0; + if (arr3.length == res.data.data.total) ismore = 1 + th.setData({ + wareCard: arr3, + total: res.data.data.total, + ismore: ismore, + is_read:1 + }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { - console.log(res.data.msg); + th.setData({ + is_read: 1 + }) } + // if (res.data.code == 0) { + // if (res.data.data.total > 0) { + // // _this.isEmpty = false; + // _this.setData({ + // isEmpty: false + // }) + // } else { + // // _this.isEmpty = true; + // _this.setData({ + // isEmpty: true + // }) + // } + // if (res.data.data.pageData.length == 0) { + // // _this.loadingType = 2; + // _this.setData({ + // loadingType: 2 + // }) + // } else { + // var wareCard = that.wareCard; + // var is_resad = 0; + // // if (_this.wareCard.length < res.data.data.pageData.length) { + // if (wareCard.length < res.data.data.total) { + // for (var i = 0; i < res.data.data.pageData.length; i++) { + // wareCard.push(res.data.data.pageData[i]); + // } + // }else{ + // is_resad=1 + // } + // _this.setData({ + // wareCard: wareCard, + // is_resad: is_resad + // }) + + // // _this.loadingType = 0; + // _this.setData({ + // loadingType: 0 + // }) + // } + // } else { + + // } } + }); }, - TimeToDate: function(num) { //时间戳数据处理 是按秒来转换 - var date = new Date(num * 1000); - //时间戳为10位需*1000,时间戳为13位的话不需乘1000 - var y = date.getFullYear(); - var MM = date.getMonth() + 1; - MM = MM < 10 ? '0' + MM : MM; //月补0 - var d = date.getDate(); - d = d < 10 ? '0' + d : d; //天补0 - var h = date.getHours(); - h = h < 10 ? '0' + h : h; //小时补0 - var m = date.getMinutes(); - m = m < 10 ? '0' + m : m; //分钟补0 - var s = date.getSeconds(); - s = s < 10 ? '0' + s : s; //秒补0 - return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s; + //销毁界面跳转 + redirectTo: function (e) { + var th = this; + var url = e.currentTarget.dataset.url; + //销毁跳转 + wx.redirectTo({ + url: url + }); }, - DateToTime: function DateToTime(TimeNum) { //时间转换成时间戳 - var Time = new Date(TimeNum); - return Time.getTime() / 1000; + //不销毁界面跳转 + navigateTo: function (e) { + var th = this; + var url = e.currentTarget.dataset.url; + wx.navigateTo({ + url: url, + }) }, - goto: function(e) { + //下拉事件 + onReachBottom: function () { var th = this; - var url = e.currentTarget.dataset.url; - getApp().goto(url); - } + if (th.data.total <= th.data.pageSize) return; + if (th.data.ismore) return; + wx.showLoading({ + title: '加载中...', + }) + th.getList(); + }, }); \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 92f2f04..ecd8de2 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -1,11 +1,11 @@ - + - 礼包列表 + 礼包列表 @@ -14,14 +14,13 @@ - - + + - + - - + 新人有礼 @@ -43,7 +42,7 @@ - {{item.giftTitle}} + {{item.giftTitle}} @@ -72,37 +71,44 @@ {{"原价:¥"+item.giftPosPrice}} - - - {{"兑换截至日期:"+getDate}} - + + {{"兑换截至日期:"+item.endTime}} + {{"距兑换开始时间: "+item.starTime}} - - + + - + - + 当前暂无礼包 - 去获取 + 去获取 - + + + + + + 到底了 + + + diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxss b/pages/giftpack/mygiftpack/mygiftpack.wxss index 089d370..f723b7b 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxss +++ b/pages/giftpack/mygiftpack/mygiftpack.wxss @@ -1,206 +1,254 @@ - - /*引用样式路径*/ @charset "UTF-8"; + /* Author XGQ * 2019-11-12 */ + .top_img { - -webkit-align-content: center; - align-content: center; + -webkit-align-content: center; + align-content: center; } + .top_img image { - width: 100%; - height: 660rpx; + width: 100%; + height: 660rpx; } + .top_title { - display: -webkit-box; - display: -webkit-flex; - display: flex; - background-color: #FFFFFF; - height: 85rpx; - border-radius: 10rpx 10rpx 0rpx 0rpx; - margin: 0rpx 20rpx 0rpx 20rpx; - -webkit-align-content: center; - align-content: center; + display: -webkit-box; + display: -webkit-flex; + display: flex; + background-color: #fff; + height: 85rpx; + border-radius: 10rpx 10rpx 0rpx 0rpx; + margin: 0rpx 20rpx 0rpx 20rpx; + -webkit-align-content: center; + align-content: center; + margin-bottom: 10rpx; } + .top_title_box { - width: 49%; - -webkit-align-content: center; - align-content: center; - text-align: center; - padding: 15rpx; + width: 49%; + -webkit-align-content: center; + align-content: center; + text-align: center; + padding: 15rpx; } + .top_title_box_S { - width: 1%; - -webkit-align-content: center; - align-content: center; - text-align: center; - margin: 20rpx 0rpx 20rpx 0rpx; - border-left: #000000 solid 3rpx; + width: 1%; + -webkit-align-content: center; + align-content: center; + text-align: center; + margin: 20rpx 0rpx 20rpx 0rpx; + border-left: #000 solid 3rpx; } + .top_title_redtext { - font-size: 30rpx; - color: #d61b30; + font-size: 30rpx; + color: #d61b30; } + .top_title_blacktext { - font-size: 30rpx; - color: #000000; + font-size: 30rpx; + color: #000; } + .content_box { - background-color: #FFFFFF; - height: 375rpx; - margin: 10rpx 20rpx 0rpx 20rpx; - border-radius: 10rpx; + background-color: #fff; + height: 375rpx; + margin: 0rpx 20rpx; + border-radius: 10rpx; + margin-bottom: 10rpx; } + .content_box_ware { - border-bottom: #f5f5f5 solid 2rpx; - display: -webkit-box; - display: -webkit-flex; - display: flex; + border-bottom: #f5f5f5 solid 2rpx; + display: -webkit-box; + display: -webkit-flex; + display: flex; } + .content_box_img { - margin: 20rpx 20rpx 20rpx 25rpx; - width: 35%; - display: -webkit-box; - display: -webkit-flex; - display: flex; - font-size: 8rpx; - position: relative; + margin: 20rpx 20rpx 20rpx 25rpx; + width: 35%; + display: -webkit-box; + display: -webkit-flex; + display: flex; + font-size: 8rpx; + position: relative; } + .content_box_img image { - width: 100%; - height: 230rpx; + width: 100%; + height: 230rpx; } + .content_box_img_title { - position: absolute; - background: #D01119; - display: -webkit-box; - display: -webkit-flex; - display: flex; - padding: 8rpx; - border-radius: 0rpx 0rpx 10rpx 0rpx; + position: absolute; + background: #d01119; + display: -webkit-box; + display: -webkit-flex; + display: flex; + padding: 8rpx; + border-radius: 0rpx 0rpx 10rpx 0rpx; } -.content_box_img_ground1{ - background: #fb6451; + +.content_box_img_ground1 { + background: #fb6451; } -.content_box_img_ground2{ - background: #ffb72d; + +.content_box_img_ground2 { + background: #ffb72d; } -.content_box_img_ground3{ - background: #9be0e5; + +.content_box_img_ground3 { + background: #9be0e5; } -.content_box_img_ground4{ - background: #4784ef; + +.content_box_img_ground4 { + background: #4784ef; } + .content_box_img_title image { - width: 30rpx; - height: 30rpx; + width: 30rpx; + height: 30rpx; } + .content_box_img_title text { - font-size: 20rpx; - color: #FFFFFF; - line-height: 25rpx; - padding-top: 5rpx; + font-size: 20rpx; + color: #fff; + line-height: 25rpx; + padding-top: 5rpx; } + .content_box_title { - width: 65%; - margin: 25rpx 25rpx 10rpx 0rpx; - position: relative; + width: 65%; + margin: 25rpx 25rpx 10rpx 0rpx; + position: relative; } + .content_ware_title { - font-size: 30rpx; - word-break: break-all; - /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ - text-overflow: ellipsis; - display: -webkit-box; - /** 对象作为伸缩盒子模型显示 **/ - -webkit-box-orient: vertical; - /** 设置或检索伸缩盒对象的子元素的排列方式 **/ - -webkit-line-clamp: 2; - /** 显示的行数 **/ - overflow: hidden; - /** 隐藏超出的内容 **/ + font-size: 30rpx; + word-break: break-all; + /*属性规定自动换行的处理方法。normal(使用浏览器默认的换行规则。),break-all(允许在单词内换行。),keep-all(只能在半角空格或连字符处换行。)*/ + text-overflow: ellipsis; + display: -webkit-box; + /** 对象作为伸缩盒子模型显示 **/ + -webkit-box-orient: vertical; + /** 设置或检索伸缩盒对象的子元素的排列方式 **/ + -webkit-line-clamp: 2; + /** 显示的行数 **/ + overflow: hidden; + /** 隐藏超出的内容 **/ } + .content_ware_type { - font-size: 28rpx; - color: #c61a34; - margin-top: 10rpx; - position: absolute; - left: 0; - bottom: 100rpx; + font-size: 28rpx; + color: #c61a34; + margin-top: 10rpx; + position: absolute; + left: 0; + bottom: 100rpx; } + .content_ware_price { - font-size: 20rpx; - color: #b9b5b5; - margin-top: 2rpx; - text-decoration: line-through; - position: absolute; - left: 0; - bottom: 70rpx; + font-size: 20rpx; + color: #b9b5b5; + margin-top: 2rpx; + text-decoration: line-through; + position: absolute; + left: 0; + bottom: 70rpx; } + .content_ware_time { - font-size: 25rpx; - color: #c61a34; - margin-top: 20rpx; - position: absolute; - left: 0; - bottom: 25rpx; + font-size: 25rpx; + color: #c61a34; + margin-top: 20rpx; + position: absolute; + left: 0; + bottom: 25rpx; } + .content_box_button { - text-align: right; - margin: 20rpx 25rpx 20rpx 20rpx; + text-align: right; + margin: 20rpx 25rpx 20rpx 20rpx; } + .content_box_button button { - display: inline-block; - width: 160rpx; - height: 50rpx; - font-size: 25rpx; - background: #d41c34; - color: #FFFFFF; - line-height: 50rpx; + display: inline-block; + width: 160rpx; + height: 50rpx; + font-size: 25rpx; + background: #d41c34; + color: #fff; + line-height: 50rpx; } + .foot_box { - -webkit-align-content: center; - align-content: center; - text-align: center; - margin-top: 15rpx; - margin-bottom: 50rpx; + -webkit-align-content: center; + align-content: center; + text-align: center; + margin-top: 15rpx; + margin-bottom: 50rpx; } + .foot_box text { - font-size: 25rpx; - color: #FFFFFF; -} -.foot_empty{ - background-color: #FFFFFF; - height: 375rpx; - margin: 10rpx 20rpx 0rpx 20rpx; - border-radius: 10rpx; - text-align: center; - padding: 150rpx 0rpx 300rpx 0rpx; - -webkit-box-pack: center; - -webkit-justify-content: center; - justify-content: center; -} -.foot_empty image{ - width: 400rpx; - height: 273rpx; -} -.foot_empty text{ - font-size: 30rpx; - color: #999999; -} -.foot_empty_button{ - background: #ff6363; - margin: 60rpx 230rpx 0rpx 230rpx; - padding: 10rpx; - border-radius: 70rpx; - line-height: 40rpx; -} -.foot_empty_button text{ - font-size: 28rpx; - color: #FFFFFF; + font-size: 25rpx; + color: #fff; +} + +.foot_empty { + background-color: #fff; + height: 375rpx; + margin: 10rpx 20rpx 0rpx 20rpx; + border-radius: 10rpx; + text-align: center; + padding: 150rpx 0rpx 300rpx 0rpx; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; } + +.foot_empty image { + width: 400rpx; + height: 273rpx; +} + +.foot_empty text { + font-size: 30rpx; + color: #999; +} + +.foot_empty_button { + background: #ff6363; + margin: 60rpx 230rpx 0rpx 230rpx; + padding: 10rpx; + border-radius: 70rpx; + line-height: 40rpx; +} + +.foot_empty_button text { + font-size: 28rpx; + color: #fff; +} + page { - background-color: #fb7454; + background-color: #fb7454; +} +.After_all { + height: 80rpx; + margin-bottom: 10rpx; + color: rgb(255, 255, 255); +} + +.After_all .Line { + border-top: 3rpx solid rgb(255, 255, 255); + width: 130rpx; +} + +.After_all .end { + margin: 0rpx 15rpx; } diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 25f9ee2..75e50a1 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -212,14 +212,16 @@ 我的地址 - + 我的服务 + + + 我的礼包 + - - diff --git a/utils/request.js b/utils/request.js index affbf49..35657e9 100644 --- a/utils/request.js +++ b/utils/request.js @@ -8,7 +8,8 @@ module.exports = { //"content-type": "application/texts" }, s = "GET" != (e = e.toUpperCase()) && o.data ? t.json2Form(o.data) : o.data; i = this.modifyUrl(i, o), o.isShowLoading = void 0 === o.isShowLoading || o.isShowLoading, - o.isShowLoading && this.showLoading(), console.log("app.request", i, o), wx.request(Object.assign({}, o, { + o.isShowLoading && this.showLoading(); + var req=wx.request(Object.assign({}, o, { url: i, method: e, data: s, @@ -20,9 +21,10 @@ module.exports = { o.isShowLoading && n.hideLoading(), n.doFail(o, t); } })); + return req; }, get: function (t, e) { - this.request("GET", t, e); + return this.request("GET", t, e); }, post: function (t, e) { this.request("POST", t, e); @@ -202,6 +204,13 @@ module.exports = { fail(err) { data.isShowLoading && th.hideLoading(); reject(err); } }) }) + }, + //--------具有时间限制的读取接口---------- + time_limit_get(time,url,data){ + var req=this.get(url,data); + setTimeout(function () { + if(req) req.abort(); + },time*1000) } }; \ No newline at end of file