const app = getApp(); var util = require('../../utils/util.js'); var api = require('../../utils/service-api.js'); Page({ /** * 页面的初始数据 */ data: { userInfo: '', //用户信息 interval: 2000, duration: 1000, imgUrls: [], imagetext: ['商品介绍', '规格与包装'], currentTabsIndex: 0, checkCollect: true, goodsInfo: {}, normspopup: false, currentIndex: 0, id: '', num: 1, whetherSpecification: false, //是否选择规格 specification: '', //规格 specificationId: '', //规格id specificationPrice: '', //规格价格 price: '', //价格 originalPrice: '', //划线价 normsList: [], currentIndexs: 0, currentIndex: 0, hidden: false, limit: 10, offset: 0, inform: true, hidden: true, shareShow: false, cartProductId: "", //商品id title: "", //商品名 imgSrc: "", //商品图片 isShare: 0, qrcode: false, djsTime: {}, //倒计时 isFirst: 1,//是否第一次进入页面 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var _this = this; var id = options.id; //秒杀id var shopId = options.shopId; var needGetShopInfo = false; if (id == undefined) { //通过二维码进入 const scene = decodeURIComponent(options.scene); var params = scene.split(","); console.log("扫码参数", params); shopId = params[0]; id = params[1]; app.shopInfo = { id: shopId }; needGetShopInfo = true; } //未获取到活动id if (!id) { wx.showModal({ title: '提示', content: '产品信息加载失败', showCancel: false }) return; } else { _this.setData({ id: id }); } //检测用户登录 if (!getApp().loginToken) { util.userLogin(function() { _this.getPageInfo(id); }); } else { this.getPageInfo(id); } //获取门店信息 if (needGetShopInfo) { setShopInf(shopId); } }, /** * 秒杀数据 */ getPageInfo(id) { var _this = this; //处理产品信息 util.request({ api: api.seckill.findSecKillGoodsInfo + id, method: 'GET', checkLogin: true, callback: function(data) { let msActivitInfo=data.mapInfo.goodsInfo; let goodsInfo = data.mapInfo.goodsInfo.goods; if (goodsInfo.mobileDetails != null) { goodsInfo.mobileDetails = goodsInfo.mobileDetails.replace(/