index.js
2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// pages/book/setting/index.js
import util from '../../../../utils/util';
import App from '../../../../utils/api';
const {regeneratorRuntime} = global
import PubSub from '../../../../utils/PubSub'
Page({
/**
* 页面的初始数据
*/
data: {
NewCustomerTotal:0,
},
/**
* 生命周期函数--监听页面加载
*/
enter_params: {},
onLoad: function (options) {
this.enter_params = util.cache('enter_params');
App.Reserve.SellerInfo(this.enter_params).then(res => {
this.setData({
seller: res.data.seller,
user: res.data.seller_user
})
let role_name = res.data.seller_user.role_name;
let sellerInfo = util.cache('sellerInfo')
util.cache('sellerInfo',{
...sellerInfo,
role_name
})
})
PubSub.on(
'flushNewCustomer',
data=>{
console.log('flushNewCustomer',data)
this.selectComponent('#tabBar').hasDot();
}
)
},
onUnload(){
PubSub.off('flushNewCustomer')
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
App.Reserve.SmsInfo({seller_id: this.enter_params.seller_id}).then(res => {
if (res.ret == 404) {
res.data = {
last_num: 100,
meals: [
{id: 1, total: 550, price_ave: 0.09, price_old: 50, price: 50, discount: 0},
{id: 2, total: 1200, price_ave: 0.083, price_old: 100, price: 100, discount: 0},
{id: 3, total: 3650, price_ave: 0.082, price_old: 328, price: 300, discount: 9.1},
],
};
}
this.setData({
sms: res.data,
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onShareAppMessage: function () {
let path=util.http_build_query(
{
id:this.data.seller.id,
fromid:getApp().openid,
hasSellerShare:true,
},'/pages/reserve/shopHome')
return {
title:'请客订包间,就上周到安排',
imageUrl:'https://xt04.colorcun.com/sellerShare/Share_'+this.data.seller.id+'.png?'+Math.random(),
path: path,
}
},
NewCustomer(e){
this.setData({
NewCustomerTotal:e.detail.total
})
},
shareDisplay(){
this.selectComponent('#share').show()
},
gotoSellerShop(){
wx.navigateTo({
url:util.http_build_query({id:this.data.seller.id},'/pages/reserve/shopHome')
})
},
})