| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- let myPro = require("../../../utils/wxRequest.js");
- let util = require("../../../utils/util.js");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: getApp().globalData.imgUrl,
- begin_at: '',
- end_at: '',
- status: 1, //
- is_ziti: 1,
- info: null, // 店铺详情
- showBegin: false, // 开店 时间pop
- currentBegin: '',
- showEnd: false, // 闭店 时间pop
- currentEnd: '',
- is_delivery: 1 // 1允许配送 0不允许
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let that = this;
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- var that = this
- that.getShopInfo();
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- onPageScroll: function (event) {
- // Do something when page scroll
-
- },
- onResize: function () {
- // Do something when page resize
- },
- // 获取店铺信息
- getShopInfo(){
- let that = this;
- myPro.wxRequest("store/info","GET",{}).then(res=>{
- that.setData({
- info: res.result,
- begin_at: res.result.begin_at,
- end_at: res.result.end_at,
- status: res.result.status,
- is_ziti: res.result.is_ziti,
- is_delivery: res.result.is_delivery
- });
- }).catch(err=>{
- console.log('报错信息',err)
- wx.showToast({
- title: err,
- icon: "none"
- });
- });
- },
- // 去个人资料
- goMyIndex(){
- wx.reLaunch({
- url: '/pages/user/index/index'
- })
- },
- // 是否营业
- onChangeSell(event){
- let that = this;
- that.setData({
- status: event.detail,
- });
- that.editShop()
- },
- // 是否自提
- onChangeZiti(event){
- let that = this;
- that.setData({
- is_ziti: event.detail,
- });
- that.editShop()
- },
- // 是否允许配送
- onChangeDelivery(event){
- let that = this;
- that.setData({
- is_delivery: event.detail,
- });
- that.editShop()
- },
- // 去门店订单
- goShopOrder(event){
- let that = this;
- let status = event.currentTarget.dataset.status
- // console.log('订单状态',event)
- wx.navigateTo({
- url: '/pages/shopRole/order/index?status='+ status
- })
- },
- // 开店时间
- beginTimeFun(){
- let that = this;
- that.setData({
- showBegin: true
- })
- },
- confirmBeginTime(event){
- // console.log('开始时间',event)
- let that = this;
- that.setData({
- begin_at: event.detail,
- showBegin: false
- })
- that.editShop()
- },
- closeBeginTimePop(){
- let that = this;
- that.setData({
- showBegin: false
- })
- },
- // 闭店时间
- endTimeFun(){
- let that = this;
- that.setData({
- showEnd: true
- })
- },
- confirmEndTime(event){
- // console.log('闭店时间',event)
- let that = this;
- that.setData({
- end_at: event.detail,
- showEnd: false
- })
- that.editShop()
- },
- closeEndTimePop(){
- let that = this;
- that.setData({
- showEnd: false
- })
- },
- // 编辑店铺信息
- editShop(){
- let that = this;
- let params = {
- status: that.data.status,
- is_ziti: that.data.is_ziti,
- begin_at: that.data.begin_at,
- end_at: that.data.end_at,
- is_delivery: that.data.is_delivery
- };
- myPro.wxRequest("store/editInfo","POST",params).then(res=>{
- wx.showToast({
- title: res.msg,
- icon: "none"
- });
- // 重新获取详情
- that.getShopInfo()
- }).catch(err=>{
- console.log('报错信息',err);
- wx.showToast({
- title: err,
- icon: "none"
- });
- })
- },
- // 提现
- goCashOut(){
- wx.navigateTo({
- url: '/pages/shopRole/cashout/index'
- })
- },
- // 提现记录
- goCashOutlog(){
- wx.navigateTo({
- url: '/pages/shopRole/cashoutlog/index'
- })
- },
- // 优惠券使用统计
- goShopCoupons(){
- let that = this;
- wx.navigateTo({
- url: '/pages/shopRole/usedcoupons/index'
- })
- },
- // 设置营业时间
- goBusinessTime(){
- let that = this;
- wx.navigateTo({
- url: "/pages/shopRole/businesstime/list/index"
- })
- }
- })
|