import utils from '../../utils/util'; const app = getApp(); Component({ /** * 组件的属性列表 */ options: { addGlobalClass:true, // styleIsolation: 'apply-shared' // multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, properties: { groupBuyingList:{ type: Array, // observer(newVal, oldVal, changedPath){ // console.log(newVal); // console.log(oldVal); // } }, isCanBuy:{ type:Boolean, value:true }, goodsItem:{ type: Object, value: {} } }, /** * 组件的初始数据 */ data: { // groupBuyingList:[[{ // name:'秒杀1', // avatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608381894659&di=5a3f6ce38dcab5cd39439eb4af59f344&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201508%2F18%2F20150818213048_vAdhz.jpeg', // },{ // avatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608381907857&di=0e3d112b4520299836f115df354eaf3b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201901%2F19%2F20190119231949_buetu.jpg', // name:'秒杀2', // }],[{ // name:'秒杀3', // avatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608381894659&di=5a3f6ce38dcab5cd39439eb4af59f344&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201508%2F18%2F20150818213048_vAdhz.jpeg', // },{ // avatar:'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1608381907857&di=0e3d112b4520299836f115df354eaf3b&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201901%2F19%2F20190119231949_buetu.jpg', // name:'秒杀4', // }]], // positionTop: 410, }, lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { console.log('99',this.data.groupBuyingList); }, moved() { }, detached() { }, }, pageLifetimes: { // 组件所在页面的生命周期函数 show() { }, hide() { }, }, /** * 组件的方法列表 */ methods: { showDialog(){ let dialogLayer = this.selectComponent('#dialogLayer'); dialogLayer.showDialog(); }, closeDialog(){ let dialogLayer = this.selectComponent('#dialogLayer'); dialogLayer.closeDialog(); }, showDialog2(){ let dialogLayer = this.selectComponent('#dialogLayer2'); dialogLayer.showDialog(); this.setData({ isShowDetails:true }) }, bindCloseDialog(){ // console.log(999); this.setData({ isShowDetails:false }) }, closeDialog2(){ let dialogLayer = this.selectComponent('#dialogLayer2'); dialogLayer.closeDialog(); }, goIndex(){ this.triggerEvent('goIndex', { isShow: false }) }, goCart(){ this.triggerEvent('goCart', { isShow: false }) }, buyTap(e){ let name = e.currentTarget.dataset.name; this.triggerEvent('buyTap', { name }) }, groupBuying(e){ this.closeDialog(); if (!this.data.isCanBuy) return; this.triggerEvent('buyTap', { name:'group', groupCode:e.currentTarget.dataset.groupCode, }) }, async showGroupBuyingOrderList(e){ let groupBuyingDocCode = e.currentTarget.dataset.groupCode; this.showDialog2(); let [errMsg,listRes] = await this.getGroupBuyingOrderList(groupBuyingDocCode); if (errMsg) { return; } console.log(listRes); this.setData({ groupBuyingListDetail:listRes.groupBuyingList, }); }, async getGroupBuyingOrderList(groupCode){ let data = {}; // let groupBuyingDocCode = groupCode; data.groupBuyingDocCode = groupCode; console.log(data); let [errMsg,res] = await utils.to( wx.$http.request({ url:'/shopping/groupBuyingOrderList.do', data }) ) return [errMsg,res]; }, // onCountDownFinish(){ // console.log('0000'); // this.setData({ // isDisabled:true // }) // } } });