|
|
|
// pages/customer/invite.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
const {regeneratorRuntime} = global
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
detail:null,
|
|
|
|
},
|
|
|
|
id:null,
|
|
|
|
topicVal:'',
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.id=options.id;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.id
|
|
|
|
}).then(res => {
|
|
|
|
this.setData({
|
|
|
|
detail:this.formatDatail(res.data)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
return {
|
|
|
|
title: this.topicVal,
|
|
|
|
path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
formatDatail(detail){
|
|
|
|
detail.rdateStr=util.unixtoTime(detail.rdate,'MM月DD日 WW HH:II');
|
|
|
|
detail.tableFirst=detail.tables[0].name;
|
|
|
|
if(detail.tables.length>1){
|
|
|
|
detail.tableSubInfo='等'+(detail.tables.length)+'个'
|
|
|
|
+(detail.tables[0].tid==2?'包间':'');
|
|
|
|
}
|
|
|
|
if(!detail.cusman){
|
|
|
|
detail.cusman='vking';
|
|
|
|
detail.cusman_phone='15877556369';
|
|
|
|
detail.cusman_account='wx:vking';
|
|
|
|
}
|
|
|
|
return detail;
|
|
|
|
},
|
|
|
|
topic(e){
|
|
|
|
let val=util.val(e);
|
|
|
|
this.topicVal=val.trim();
|
|
|
|
},
|
|
|
|
userinfo(){
|
|
|
|
console.log('this.topicVal',this.topicVal)
|
|
|
|
if (!this.topicVal) {
|
|
|
|
wx.showToast({
|
|
|
|
title: '请填写邀请主题',
|
|
|
|
icon: "none"
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(this.data.detail.openid!=getApp().openid){
|
|
|
|
wx.showToast({
|
|
|
|
title: '只有发起人才能设置',
|
|
|
|
icon: "none"
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
App.Reserve.SetTopicFromShare({
|
|
|
|
rid:this.id,
|
|
|
|
topic:this.topicVal
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|