// var e = function(e) { // return e && e.__esModule ? e : { // default: e // }; // }(require("../../utils/LoadMore3.js")), // n = new e.default(), 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 regeneratorRuntime = require('../../utils/runtime.js'); Component({ properties: { // 这里定义了innerText属性,属性值可以在组件使用时指定 object: { type: Object, value: null, }, goods_array: { type: Array, value: [] }, newTime: { type: Number, value: 0 }, }, data: { // 这里是一些组件内部数据 yc: false, someData: null, ylp_img: "https://mshopimg.yolipai.net/", imghost: os.imghost, timer: null, }, ready: function() { console.log("ready"); var g_id = this.data.object.data; console.log(g_id); this.init(g_id); }, detached() { // 页面被被销毁的时候,清除定时器 clearInterval(this.data.timer); }, methods: { // 这里是一个自定义方法 customMethod: function() {}, init: function(g_id) { var th = this, app = getApp(),all_array = [], goodsidlist=""; //--先把商品ID串起来-- g_id.forEach(function(val, ind) { var item = {}; goodsidlist+=val.goodsid+","; }) goodsidlist=ut.sub_last(goodsidlist); //--调用接口,读取秒杀-- app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id=" +os.stoid+"&goodsidlist="+goodsidlist, {}).then(res => { //如果秒杀的数组为空的时候 var goodslist=res.data.data; if(goodslist.length==0) return false; // 判断火热,预热 var newTime = ut.gettimestamp(); th.setData({newTime:newTime}); // for(var a=0;a< goodslist.length;a++){ // var starTime=goodslist[a].start_time; // var msStr=[]; // console.log(2222222222) // console.log(starTime+":"+newTime) // if (starTime>newTime){ // msStr.push() // //th.setData({msText:'即将开始'}); // } // if (starTime 0) { let time = (endTime - newTime); // 获取天、时、分、秒 let day = parseInt(time / (60 * 60 * 24)); let hou = parseInt(time % (60 * 60 * 24) / 3600); let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); obj = { day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec) } } else { //活动已结束,全部设置为'00' obj = { day: '00', hou: '00', min: '00', sec: '00' } } var txt = "goods_array[" + j + "][" + i + "].djs"; ee.setData({ [txt]: obj }); } } }, //图片失败,默认图片 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:"/pages/activity/seckill_list/seckill_list" }); } }, })