Showing
11 changed files
with
203 additions
and
29 deletions
| @@ -15,7 +15,8 @@ | @@ -15,7 +15,8 @@ | ||
| 15 | "pages/reservr/index", | 15 | "pages/reservr/index", |
| 16 | "pages/me/setting", | 16 | "pages/me/setting", |
| 17 | "pages/me/list", | 17 | "pages/me/list", |
| 18 | - "pages/book/b_addnew" | 18 | + "pages/book/b_addnew", |
| 19 | + "pages/book/b_sms" | ||
| 19 | ], | 20 | ], |
| 20 | "window": { | 21 | "window": { |
| 21 | "navigationStyle": "custom", | 22 | "navigationStyle": "custom", |
| @@ -2,7 +2,7 @@ var util = require('../../../utils/util.js') | @@ -2,7 +2,7 @@ var util = require('../../../utils/util.js') | ||
| 2 | var uri=require('../../../utils/uri.js'); | 2 | var uri=require('../../../utils/uri.js'); |
| 3 | Component({ | 3 | Component({ |
| 4 | properties:{ | 4 | properties:{ |
| 5 | - phoneNumber:String | 5 | + bookInfo:Object |
| 6 | }, | 6 | }, |
| 7 | data:{ | 7 | data:{ |
| 8 | list:[ | 8 | list:[ |
| @@ -34,17 +34,23 @@ Component({ | @@ -34,17 +34,23 @@ Component({ | ||
| 34 | }, | 34 | }, |
| 35 | callcustom:function(e){ | 35 | callcustom:function(e){ |
| 36 | var idx=e.currentTarget.dataset.idx; | 36 | var idx=e.currentTarget.dataset.idx; |
| 37 | - if(idx==2){ | ||
| 38 | - var that=this; | ||
| 39 | - wx.makePhoneCall({ | ||
| 40 | - phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码 | ||
| 41 | - complete:function(){ | ||
| 42 | - that.close(); | ||
| 43 | - } | ||
| 44 | - }) | ||
| 45 | - } | ||
| 46 | - if(idx==0){ | ||
| 47 | - this.triggerEvent("share"); | 37 | + switch (idx){ |
| 38 | + case 0: | ||
| 39 | + this.triggerEvent("share"); | ||
| 40 | + break; | ||
| 41 | + case 1: | ||
| 42 | + wx.navigateTo({ | ||
| 43 | + url:'/pages/book/b_sms?id='+this.data.bookInfo.id | ||
| 44 | + }); | ||
| 45 | + break; | ||
| 46 | + case 2: | ||
| 47 | + wx.makePhoneCall({ | ||
| 48 | + phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码 | ||
| 49 | + complete:()=>{ | ||
| 50 | + this.close(); | ||
| 51 | + } | ||
| 52 | + }) | ||
| 53 | + break; | ||
| 48 | } | 54 | } |
| 49 | } | 55 | } |
| 50 | } | 56 | } |
| @@ -6,13 +6,6 @@ Page({ | @@ -6,13 +6,6 @@ Page({ | ||
| 6 | onLoad:function (opt) { | 6 | onLoad:function (opt) { |
| 7 | util.setBarTitle('预定详情'); | 7 | util.setBarTitle('预定详情'); |
| 8 | console.log(opt) | 8 | console.log(opt) |
| 9 | - opt.name=opt.name.length>3 ? opt.name.slice(0,3)+'...' : opt.name | ||
| 10 | - opt.rdateStr=util.unixtoTime(opt.rdate,"MM月DD日 HH:II") | ||
| 11 | - this.setData({ | ||
| 12 | - sellerid:util.cache('sellerid'), | ||
| 13 | - phoneNumber:opt.phone, | ||
| 14 | - bookInfo:opt | ||
| 15 | - }) | ||
| 16 | this.getDetail(opt.id); | 9 | this.getDetail(opt.id); |
| 17 | wx.showShareMenu({ | 10 | wx.showShareMenu({ |
| 18 | withShareTicket: true, | 11 | withShareTicket: true, |
| @@ -26,10 +19,10 @@ Page({ | @@ -26,10 +19,10 @@ Page({ | ||
| 26 | this.notice=this.selectComponent('#notice'); | 19 | this.notice=this.selectComponent('#notice'); |
| 27 | }, | 20 | }, |
| 28 | noticeCall:function(){ | 21 | noticeCall:function(){ |
| 29 | - this.notice.show(); | 22 | + this.selectComponent('#notice').show(); |
| 30 | }, | 23 | }, |
| 31 | onShareAppMessage: function () { | 24 | onShareAppMessage: function () { |
| 32 | - this.notice.close(); | 25 | + this.selectComponent('#notice').close(); |
| 33 | var obj=this.data.bookInfo; | 26 | var obj=this.data.bookInfo; |
| 34 | var path='/pages/customer/index?id='+this.data.bookInfo.id; | 27 | var path='/pages/customer/index?id='+this.data.bookInfo.id; |
| 35 | let nickname=""; | 28 | let nickname=""; |
| @@ -52,11 +45,10 @@ Page({ | @@ -52,11 +45,10 @@ Page({ | ||
| 52 | }; | 45 | }; |
| 53 | }, | 46 | }, |
| 54 | getcall:function(){ | 47 | getcall:function(){ |
| 55 | - var that=this; | ||
| 56 | wx.makePhoneCall({ | 48 | wx.makePhoneCall({ |
| 57 | phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码 | 49 | phoneNumber: this.data.phoneNumber, //仅为示例,并非真实的电话号码 |
| 58 | - complete:function(){ | ||
| 59 | - this.notice.close(); | 50 | + complete:()=>{ |
| 51 | + this.selectComponent('#notice').close(); | ||
| 60 | } | 52 | } |
| 61 | }) | 53 | }) |
| 62 | }, | 54 | }, |
| @@ -98,10 +90,12 @@ Page({ | @@ -98,10 +90,12 @@ Page({ | ||
| 98 | }, | 90 | }, |
| 99 | detailData:null, | 91 | detailData:null, |
| 100 | getDetail(id){ | 92 | getDetail(id){ |
| 101 | - App.Reserve.Detail({rid:id,openid:'1'}).then(res=>{ | 93 | + App.Reserve.Detail({rid:id,openid:''}).then(res=>{ |
| 94 | + res.data.rdateStr=util.unixtoTime(res.data.rdate,"MM月DD日 HH:II") | ||
| 102 | this.detailData=res.data; | 95 | this.detailData=res.data; |
| 103 | this.setData({ | 96 | this.setData({ |
| 104 | tables:res.data.tables, | 97 | tables:res.data.tables, |
| 98 | + bookInfo:res.data, | ||
| 105 | }) | 99 | }) |
| 106 | }) | 100 | }) |
| 107 | } | 101 | } |
| @@ -60,5 +60,5 @@ | @@ -60,5 +60,5 @@ | ||
| 60 | <!--通知预订人--> | 60 | <!--通知预订人--> |
| 61 | <block wx:if="{{bookInfo.code}}"> | 61 | <block wx:if="{{bookInfo.code}}"> |
| 62 | <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view> | 62 | <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view> |
| 63 | - <noticeCall id="notice" phoneNumber="{{phoneNumber}}"></noticeCall> | 63 | + <noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall> |
| 64 | </block> | 64 | </block> |
pages/book/b_sms.js
0 → 100644
| 1 | +// pages/book/b_sms.js | ||
| 2 | +var util = require('../../utils/util.js') | ||
| 3 | +import App from '../../utils/api'; | ||
| 4 | +const {regeneratorRuntime} = global | ||
| 5 | +const tpls=[ | ||
| 6 | + '尊敬的贵宾,您好!${seller_name}恭候您的光临!\n${date}为您预定在${region_room_name}\n人数:${reserve_pnum}\n地址:${seller_addr}\n电话:${seller_phone}\n客户经理${cusman} 电话${cusman_phone},期待您的光临!' | ||
| 7 | +]; | ||
| 8 | +Page({ | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 页面的初始数据 | ||
| 12 | + */ | ||
| 13 | + tplsIndex:0, | ||
| 14 | + data: { | ||
| 15 | + bookInfo:{}, | ||
| 16 | + tplMsg:'' | ||
| 17 | + }, | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 生命周期函数--监听页面加载 | ||
| 21 | + */ | ||
| 22 | + onLoad: function (options) { | ||
| 23 | + this.getDetail(options.id); | ||
| 24 | + }, | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 28 | + */ | ||
| 29 | + onReady: function () { | ||
| 30 | + | ||
| 31 | + }, | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 生命周期函数--监听页面显示 | ||
| 35 | + */ | ||
| 36 | + onShow: function () { | ||
| 37 | + | ||
| 38 | + }, | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 生命周期函数--监听页面隐藏 | ||
| 42 | + */ | ||
| 43 | + onHide: function () { | ||
| 44 | + | ||
| 45 | + }, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 生命周期函数--监听页面卸载 | ||
| 49 | + */ | ||
| 50 | + onUnload: function () { | ||
| 51 | + | ||
| 52 | + }, | ||
| 53 | + bookInfo:null, | ||
| 54 | + getDetail(id){ | ||
| 55 | + App.Reserve.Detail({rid:id,openid:''}).then(res=>{ | ||
| 56 | + res.data.rdateStr=util.unixtoTime(res.data.rdate,"MM月DD日 HH:II") | ||
| 57 | + this.bookInfo=res.data; | ||
| 58 | + this.setData({ | ||
| 59 | + bookInfo:res.data, | ||
| 60 | + tplMsg:this.getTplMsg() | ||
| 61 | + }) | ||
| 62 | + }) | ||
| 63 | + }, | ||
| 64 | + smsData:{}, | ||
| 65 | + getTplMsg(){ | ||
| 66 | + let region_room_name=this.bookInfo.tables[0].rname+' '+this.bookInfo.tables[0].name; | ||
| 67 | + if(this.bookInfo.tables.length>1){ | ||
| 68 | + region_room_name+='等'+this.bookInfo.tables.length+'桌' | ||
| 69 | + } | ||
| 70 | + let smsData={ | ||
| 71 | + seller_name:this.bookInfo.seller.sellername.substr(0,20), | ||
| 72 | + date:this.bookInfo.rdateStr, | ||
| 73 | + region_room_name:region_room_name.substr(0,20), | ||
| 74 | + reserve_pnum:this.bookInfo.pnum_str+'人', | ||
| 75 | + seller_addr:this.bookInfo.seller.map_address.substr(0,20), | ||
| 76 | + seller_phone:this.bookInfo.seller.phone.substr(0,20), | ||
| 77 | + cusman:(this.bookInfo.cusman||this.bookInfo.seller.sellername).substr(0,20), | ||
| 78 | + cusman_phone:(this.bookInfo.cusman_phone||this.bookInfo.seller.phone).substr(0,20), | ||
| 79 | + code:this.bookInfo.code, | ||
| 80 | + } | ||
| 81 | + let tpl=tpls[this.tplsIndex]; | ||
| 82 | + this.smsData=smsData; | ||
| 83 | + tpl=tpl.replace(/\${([^}]+)}/ig,function($0,$1){ | ||
| 84 | + console.log($0,$1); | ||
| 85 | + return smsData[$1]; | ||
| 86 | + }) | ||
| 87 | + return tpl | ||
| 88 | + }, | ||
| 89 | + sendsms(){ | ||
| 90 | + App.SendSMS.Message({ | ||
| 91 | + phone:15877556369,/*this.bookInfo.phone,*/ | ||
| 92 | + sign_name:'订个座儿', | ||
| 93 | + template_code:'SMS_145597605', | ||
| 94 | + template_param:JSON.stringify([this.smsData]) | ||
| 95 | + }).then(()=>{ | ||
| 96 | + util.toast('短信已发送'); | ||
| 97 | + this.setData({ | ||
| 98 | + hideSendsms:true, | ||
| 99 | + }) | ||
| 100 | + }) | ||
| 101 | + }, | ||
| 102 | + copysms(){ | ||
| 103 | + wx.setClipboardData({ | ||
| 104 | + data:this.data.tplMsg | ||
| 105 | + }) | ||
| 106 | + }, | ||
| 107 | +}) |
pages/book/b_sms.json
0 → 100644
pages/book/b_sms.wxml
0 → 100644
| 1 | +<!--pages/book/b_sms.wxml--> | ||
| 2 | +<nav>发送短信</nav> | ||
| 3 | +<view class="page"> | ||
| 4 | + <view class="tip">已自动生成通知短信,可修改或直接发送</view> | ||
| 5 | + <textarea class="tpl" auto-height value="{{tplMsg}}" maxlength="-1"> | ||
| 6 | + | ||
| 7 | + </textarea> | ||
| 8 | + <button class="sms-but send" bindtap="sendsms" hidden="{{hideSendsms}}">直接发送</button> | ||
| 9 | + <button class="sms-but copy" plain bindtap="copysms">复制短信</button> | ||
| 10 | +</view> | ||
| 11 | + |
pages/book/b_sms.wxss
0 → 100644
| 1 | +/* pages/book/b_sms.wxss */ | ||
| 2 | +.page{ | ||
| 3 | + width: 90%; | ||
| 4 | + margin: 60rpx 5% 0; | ||
| 5 | + font-size: 30rpx; | ||
| 6 | +} | ||
| 7 | +.tip{ | ||
| 8 | + margin-bottom: 34rpx; | ||
| 9 | +} | ||
| 10 | +.tpl{ | ||
| 11 | + border: solid 2rpx #999999; | ||
| 12 | + border-radius: 10rpx; | ||
| 13 | + width: 90%; | ||
| 14 | + padding: 5%; | ||
| 15 | + margin-bottom: 200rpx; | ||
| 16 | +} | ||
| 17 | +.sms-but,.sms-but[plain]{ | ||
| 18 | + margin-bottom: 18rpx; | ||
| 19 | + border: solid 2rpx #199095; | ||
| 20 | + font-size: 34rpx; | ||
| 21 | + height: 84rpx; | ||
| 22 | + line-height: 84rpx; | ||
| 23 | +} | ||
| 24 | +.sms-but.send{ | ||
| 25 | + background-color: #199095; | ||
| 26 | + color:#fff; | ||
| 27 | +} | ||
| 28 | +.sms-but.copy{ | ||
| 29 | + color:#199095; | ||
| 30 | +} |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | "list": [] | 30 | "list": [] |
| 31 | }, | 31 | }, |
| 32 | "miniprogram": { | 32 | "miniprogram": { |
| 33 | - "current": 14, | 33 | + "current": 16, |
| 34 | "list": [ | 34 | "list": [ |
| 35 | { | 35 | { |
| 36 | "id": 0, | 36 | "id": 0, |
| @@ -150,6 +150,18 @@ | @@ -150,6 +150,18 @@ | ||
| 150 | "pathName": "pages/book/b_addnew", | 150 | "pathName": "pages/book/b_addnew", |
| 151 | "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500", | 151 | "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500", |
| 152 | "scene": "1001" | 152 | "scene": "1001" |
| 153 | + }, | ||
| 154 | + { | ||
| 155 | + "id": -1, | ||
| 156 | + "name": "预定本详情", | ||
| 157 | + "pathName": "pages/book/b_detail", | ||
| 158 | + "query": "id=25" | ||
| 159 | + }, | ||
| 160 | + { | ||
| 161 | + "id": -1, | ||
| 162 | + "name": "预定本-发短信", | ||
| 163 | + "pathName": "pages/book/b_sms", | ||
| 164 | + "query": "id=25" | ||
| 153 | } | 165 | } |
| 154 | ] | 166 | ] |
| 155 | } | 167 | } |
| @@ -50,7 +50,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0, | @@ -50,7 +50,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0, | ||
| 50 | } | 50 | } |
| 51 | if(!silence){ | 51 | if(!silence){ |
| 52 | wx.showLoading({ | 52 | wx.showLoading({ |
| 53 | - title: '数据加载中', | 53 | + title: '处理中', |
| 54 | mask:true | 54 | mask:true |
| 55 | }) | 55 | }) |
| 56 | } | 56 | } |
-
Please register or login to post a comment