// index.js let myPro = require("../../../../utils/wxRequest.js"); let util = require("../../../../utils/util.js"); Page({ data: { dataList: [] }, onLoad: function (options) { // Do some initialize when page load. let that = this; }, onShow: function () { // Do something when page show. let that = this; that.getBusinessTime(); }, onReady: function () { // Do something when page ready. }, onHide: function () { // Do something when page hide. }, onUnload: function () { // Do something when page close. }, onPullDownRefresh: function () { // Do something when pull down. }, onReachBottom: function () { // Do something when page reach bottom. }, onShareAppMessage: function () { // return custom share data when user share. }, onPageScroll: function () { // Do something when page scroll }, onResize: function () { // Do something when page resize }, // 列表 getBusinessTime(){ let that = this; myPro.wxRequest("store/businessHours/list","GET",{}).then(res=>{ that.setData({ dataList: res.result }); }).catch(err=>{ console.log('报错信息',err); wx.showToast({ title: err, icon: "none" }) }) }, // 添加 toAddDetail(event){ let that = this; let id = event.currentTarget.dataset.id; let url = id ? '/pages/shopRole/businesstime/detail/index?id='+id : '/pages/shopRole/businesstime/detail/index'; wx.navigateTo({ url: url }); }, // 删除 toDelItem(event){ let that = this; let id = event.currentTarget.dataset.id; let params = { id: id }; myPro.wxRequest("store/businessHours/remove","POST",params).then(res=>{ wx.showToast({ title: res.msg, icon: "none" }); that.getBusinessTime(); }).catch(err=>{ console.log('报错信息',err); wx.showToast({ title: err, icon: "none" }) }) } });