Commit 104fac5998212bf6ceccaa00f372b3010875868c

Authored by vking
1 parent 48999b8e

更换短信逻辑

Showing 1 changed file with 5 additions and 34 deletions
1 // pages/book/b_sms.js 1 // pages/book/b_sms.js
2 var util = require('../../../utils/util.js') 2 var util = require('../../../utils/util.js')
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
4 -import bcm from '../../../utils/bookCommon';  
5 -const {regeneratorRuntime} = global  
6 -import ST from '../../../utils/sms_tpls';  
7 -const tpls = {  
8 - SMS_154587043: '${guest},您好!${seller_name}已为您预订${date}的桌位:${region_room_name};地址:${seller_addr},电话:${seller_phone}\n客户经理${cusman},期待您的光临!',  
9 - SMS_162733710: '尊敬的贵宾,您好!${reserve_date}的用餐,为您安排在${seller_name_addr_room}房间,${cusman}期待您的光临,预祝就餐愉快!',  
10 - SMS_163050401: '尊敬的贵宾,您好!\n ${seller_name}已为您安排${date}的用餐,房间:${region_room_name}; \n地址:${seller_addr}; \n电话:${seller_phone} \n预祝用餐愉快,${cusman}期待您的光临!',  
11 -};  
12 Page({ 4 Page({
13 5
14 /** 6 /**
@@ -24,14 +16,8 @@ Page({ @@ -24,14 +16,8 @@ Page({
24 * 生命周期函数--监听页面加载 16 * 生命周期函数--监听页面加载
25 */ 17 */
26 onLoad: function (options) { 18 onLoad: function (options) {
27 - this.enter_params=util.cache('enter_params');  
28 - App.Reserve.SellerInfo(this.enter_params).then(res=>{  
29 - this.sc=res.data;  
30 - try{  
31 - this.tplsIndex=res.data.setting.template_code  
32 - }catch(e){}  
33 - this.getDetail(options.id);  
34 - }); 19 + this.options=options;
  20 + this.getDetail();
35 }, 21 },
36 22
37 /** 23 /**
@@ -62,30 +48,15 @@ Page({ @@ -62,30 +48,15 @@ Page({
62 48
63 }, 49 },
64 bookInfo: null, 50 bookInfo: null,
65 - async getDetail(id){  
66 - let params={rid: id}  
67 - let res=await App.Reserve.Detail(params);  
68 - this.bookInfo=res.data  
69 - if(res.data.operator_openid==2){//运营处理订单,强制使用运营短信  
70 - this.tplsIndex='SMS_173950289'  
71 - params.template_code=this.tplsIndex  
72 - }  
73 - let msg=await App.SendSMS.GetSmsContent(params);  
74 - //let tplMsg=await ST.getTplMsg(res.data,this.tplsIndex,this.sc) 51 + async getDetail(){
  52 + let msg=await App.SendSMS.GetSmsContent({rid: this.options.id});
75 console.log('tplMsg',msg.data.content) 53 console.log('tplMsg',msg.data.content)
76 this.setData({ 54 this.setData({
77 - bookInfo: res.data,  
78 tplMsg: msg.data.content 55 tplMsg: msg.data.content
79 }) 56 })
80 -  
81 -  
82 }, 57 },
83 sendsms(){ 58 sendsms(){
84 - App.SendSMS.NewMessage({  
85 - rid: this.bookInfo.id,  
86 - sid: this.bookInfo.seller.id,  
87 - template_code:this.tplsIndex,  
88 - }).then(res=>{ 59 + App.SendSMS.NewMessage({rid: this.options.id}).then(res=>{
89 if (res.ret != 200) { 60 if (res.ret != 200) {
90 return util.toast(res.msg, 'none'); 61 return util.toast(res.msg, 'none');
91 } 62 }