| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // 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"
- })
- })
- }
- });
|