diff --git a/components/diy_pregoods/diy_pregoods.js b/components/diy_pregoods/diy_pregoods.js new file mode 100644 index 0000000..2e0ba8a --- /dev/null +++ b/components/diy_pregoods/diy_pregoods.js @@ -0,0 +1,107 @@ +var t = getApp(), os = t.globalData.setting,ut = require("../../utils/util.js"); +var regeneratorRuntime = require('../../utils/runtime.js'); +Component({ + properties: { + // 这里定义了innerText属性,属性值可以在组件使用时指定 + object: { + type: Object, value: null, + }, + goods_array: { + type: Array, value: [] + }, + }, + data: { + // 这里是一些组件内部数据 + someData: null, + imghost: os.imghost, + }, + + ready: function() { + var g_id = this.data.object.data; + this.init(g_id); + }, + + methods: { + // 这里是一个自定义方法 + init: function(g_id) { + var th = this, app = getApp(), goodsidlist=""; + if(g_id && g_id.length>0){ + //--先把商品ID串起来-- + g_id.forEach(function(val, ind) { + var item = {}; + goodsidlist+=val.goodsid+","; + }) + goodsidlist=ut.sub_last(goodsidlist); + //--调用接口,读取秒杀-- + app.request.promiseGet("/api/weshop/marketing/marketingPresellList/page?store_id=" + +os.stoid+"&goodsidlist="+goodsidlist, { + data:{is_end:0,timetype:1,isuse:1} + }).then(res => { + //如果秒杀的数组为空的时候 + var goodslist=res.data.data; + //就算是添加的活动已经过期,就要用最新的进行中活动 + if(goodslist && goodslist.length>0) { + th.set_goods_list(g_id,goodslist); + } + }); + }else{ + th.no_gid_set(); + } + }, + + //当是默认的情况 + no_gid_set(){ + getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", + {isShowLoading:1,data:{store_id:os.stoid,is_end:0,timetype:1,page:1,pageSize:9 }} + ).then(res=>{ + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0) { + var goodsidlist=res.data.data.pageData; + this.set_goods_list(null,goodsidlist); + } + }); + }, + + //就算是添加的活动已经过期,就要用最新的活动 + set_goods_list(g_id,goodslist){ + // 判断火热,预热 + var newTime = ut.gettimestamp(),all_array = [],th=this; + th.setData({newTime:newTime}); + if(g_id){ + /*--商品队列按照添加的顺序排列--*/ + g_id.forEach(function(val, ind) { + goodslist.forEach(function (vy,indy) { + if(val.goodsid==vy.goods_id){ all_array.push(vy); } + }) + }) + }else{ + all_array=goodslist; + } + + if(all_array.length==0){ all_array=goodslist;} + + var arr = new Array(); + //--三个三个一组--- + for(var i=0;i< all_array.length;i+=3){ + arr.push(all_array.slice(i,i+3)); + } + /*--熏染到前台--*/ + th.setData({goods_array:arr}); + }, + + //图片失败,默认图片 + bind_bnerr3: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "/public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + + go_to_skill:function () { + wx.navigateTo({ + url:"/packageC/pages/presell/list/list" + }); + } + }, + + +}) \ No newline at end of file diff --git a/components/diy_pregoods/diy_pregoods.json b/components/diy_pregoods/diy_pregoods.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/diy_pregoods/diy_pregoods.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/diy_pregoods/diy_pregoods.wxml b/components/diy_pregoods/diy_pregoods.wxml new file mode 100644 index 0000000..789e7af --- /dev/null +++ b/components/diy_pregoods/diy_pregoods.wxml @@ -0,0 +1,135 @@ + + + + + + 秒杀 + + + + + + + + + + + + + + + + + + 即将开始 + + + + + + 活动已结束 + + + + + + 火热进行 + + + + + 已抢光 + + + + + + + + + + + + + + {{aitem.djs.day}}天 + {{aitem.djs.hou}}时 + {{aitem.djs.min}}分 + {{aitem.djs.sec}}秒 + + + + + + + {{aitem.title}} + ¥{{aitem.price}} + ¥{{aitem.market_price}} + + + + + + + + + + + + + + + + + + + + + {{aitem.title}} + + {{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_pregoods/diy_pregoods.wxss b/components/diy_pregoods/diy_pregoods.wxss new file mode 100644 index 0000000..f364ac3 --- /dev/null +++ b/components/diy_pregoods/diy_pregoods.wxss @@ -0,0 +1,291 @@ +.flex{ + display: flex; + align-items: center; +} +.top { + background-color: white; + height: 70rpx; + line-height: 70rpx; + color: #000; + border-bottom: 2rpx solid #eee; + padding:0rpx 20rpx; + display: flex; + justify-content: space-between; + font-size: 32rpx; +} + +.s_it { + width: 100%; + display: flex; + background-color: white; +} + +.s_prom { + width: 100%; + background-color: white; + min-height: 200rpx; +} + +swiper { + display: block; + height: 400rpx; +} + +.right_k { + width: 30rpx; +} +.right_k image{ + width: 30rpx; + height: 30rpx; +} + .t_left { + width: 10rpx; + height: 38rpx; + background: #c4182e; + margin-right: 10rpx; +} + + +.sp { + min-height: 300rpx; + width: 100%; + background-color: white; + padding: 18rpx; + display: flex; +} + +.sp .sp_top { + height: 220rpx; + min-width: 30%; +} + +.sp .sp_top .s_img { + width: 210rpx; + height: 100%; +} + +.sp .sp_top .s_img image { + width: 210rpx; + height: 100%; + position: relative; + top: -74rpx; + 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; + position: relative; + top: -6rpx; + width: 210rpx; + color: #fff; + text-align: center; +} + +.po { + position: absolute; +} + +.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); +} + +.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_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + margin-right: 10rpx; +} + +.sp_wz .sp_jgx { + color: #adadad; + text-decoration: line-through; + font-size: 24rpx; + overflow: hidden; + display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; +} + +.one { + margin-left: 14rpx; +} + +.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; +} + +.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; +} + +.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); +} + +.po1 { + position: absolute; +} + +.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); +} + +.sp2 { + width: 100%; + min-height: 240rpx; +} + +.sp2 .one1 { + background-color: white; + height: 285rpx; + display: flex; + padding:0rpx 20rpx; + border-bottom: 6rpx#eee solid; + align-items: center; +} + +.sp2 .one1 .o1_img { + width: 220rpx; + height: 220rpx; + margin-right: 25rpx; +} + +.o1_right .sp_wzi { + font-size: 30rpx; + margin-bottom: 6rpx; + text-align: left; + padding: 4rpx 0; + height: 48rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.o1_right .o1_sj_kill { + height: 60rpx; + margin-bottom: 10rpx; + font-size: 28rpx; +} + +.o1_right .o1_sj_kill text { + background-color: #fdcb08; + text-align: center; + border-radius: 10rpx; + padding: 4rpx; + margin-left: 6rpx; +} + +.o1_right .sp_jg { + color: #c4182e; + font-size: 30rpx; + overflow: hidden; + display: inline-block; + margin-right: 10rpx; +} + +.o1_right .sp_jgx { + color: #dcdcdc; + text-decoration: line-through; + font-size: 26rpx; + overflow: hidden; + display: inline-block; +} + +.o1_img image { + width: 220rpx; + height: 220rpx; +} +.o1_right{ + width: 465rpx; +} +.o1_right .wo { + background-color: #c4182e; + width: 150rpx; + height: 50rpx; + line-height: 50rpx; + color: white; + text-align: center; + 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