|
|
|
// pages/book/b_sms.js
|
|
|
|
var util = require('../../../utils/util.js')
|
|
|
|
import App from '../../../utils/api';
|
|
|
|
import bcm from '../../../utils/bookCommon';
|
|
|
|
const {regeneratorRuntime} = global
|
|
|
|
import ST from '../../../utils/sms_tpls';
|
|
|
|
const tpls = {
|
|
|
|
SMS_154587043: '${guest},您好!${seller_name}已为您预订${date}的桌位:${region_room_name};地址:${seller_addr},电话:${seller_phone}\n客户经理${cusman},期待您的光临!',
|
|
|
|
SMS_162733710: '尊敬的贵宾,您好!${reserve_date}的用餐,为您安排在${seller_name_addr_room}房间,${cusman}期待您的光临,预祝就餐愉快!',
|
|
|
|
SMS_163050401: '尊敬的贵宾,您好!\n ${seller_name}已为您安排${date}的用餐,房间:${region_room_name}; \n地址:${seller_addr}; \n电话:${seller_phone} \n预祝用餐愉快,${cusman}期待您的光临!',
|
|
|
|
};
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -24,14 +16,8 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.enter_params=util.cache('enter_params');
|
|
|
|
App.Reserve.SellerInfo(this.enter_params).then(res=>{
|
|
|
|
this.sc=res.data;
|
|
|
|
try{
|
|
|
|
this.tplsIndex=res.data.setting.template_code
|
|
|
|
}catch(e){}
|
|
|
|
this.getDetail(options.id);
|
|
|
|
});
|
|
|
|
this.options=options;
|
|
|
|
this.getDetail();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -62,30 +48,15 @@ Page({ |
|
|
|
|
|
|
|
},
|
|
|
|
bookInfo: null,
|
|
|
|
async getDetail(id){
|
|
|
|
let params={rid: id}
|
|
|
|
let res=await App.Reserve.Detail(params);
|
|
|
|
this.bookInfo=res.data
|
|
|
|
if(res.data.operator_openid==2){//运营处理订单,强制使用运营短信
|
|
|
|
this.tplsIndex='SMS_173950289'
|
|
|
|
params.template_code=this.tplsIndex
|
|
|
|
}
|
|
|
|
let msg=await App.SendSMS.GetSmsContent(params);
|
|
|
|
//let tplMsg=await ST.getTplMsg(res.data,this.tplsIndex,this.sc)
|
|
|
|
async getDetail(){
|
|
|
|
let msg=await App.SendSMS.GetSmsContent({rid: this.options.id});
|
|
|
|
console.log('tplMsg',msg.data.content)
|
|
|
|
this.setData({
|
|
|
|
bookInfo: res.data,
|
|
|
|
tplMsg: msg.data.content
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
sendsms(){
|
|
|
|
App.SendSMS.NewMessage({
|
|
|
|
rid: this.bookInfo.id,
|
|
|
|
sid: this.bookInfo.seller.id,
|
|
|
|
template_code:this.tplsIndex,
|
|
|
|
}).then(res=>{
|
|
|
|
App.SendSMS.NewMessage({rid: this.options.id}).then(res=>{
|
|
|
|
if (res.ret != 200) {
|
|
|
|
return util.toast(res.msg, 'none');
|
|
|
|
}
|
...
|
...
|
|