Showing
4 changed files
with
86 additions
and
9 deletions
| @@ -10,6 +10,7 @@ Page({ | @@ -10,6 +10,7 @@ Page({ | ||
| 10 | data: { | 10 | data: { |
| 11 | hasScene:0, | 11 | hasScene:0, |
| 12 | seller_id:'', | 12 | seller_id:'', |
| 13 | + list:[], | ||
| 13 | }, | 14 | }, |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| @@ -17,6 +18,8 @@ Page({ | @@ -17,6 +18,8 @@ Page({ | ||
| 17 | */ | 18 | */ |
| 18 | hasScene:0, | 19 | hasScene:0, |
| 19 | seller_id:'', | 20 | seller_id:'', |
| 21 | + note_name:'', | ||
| 22 | + list:{}, | ||
| 20 | onLoad: function (options) { | 23 | onLoad: function (options) { |
| 21 | //转化场景值到 options | 24 | //转化场景值到 options |
| 22 | if(options.scene){//扫码进入 | 25 | if(options.scene){//扫码进入 |
| @@ -36,6 +39,11 @@ Page({ | @@ -36,6 +39,11 @@ Page({ | ||
| 36 | hasScene:this.hasScene, | 39 | hasScene:this.hasScene, |
| 37 | seller_id:this.seller_id, | 40 | seller_id:this.seller_id, |
| 38 | }) | 41 | }) |
| 42 | + if(this.hasScene!=1){ | ||
| 43 | + App.Reserve.SellerInfo(util.cache('enter_params')).then(res=>{ | ||
| 44 | + this.note_name=res.data.seller_user.nickname; | ||
| 45 | + }) | ||
| 46 | + } | ||
| 39 | }, | 47 | }, |
| 40 | 48 | ||
| 41 | /** | 49 | /** |
| @@ -70,6 +78,35 @@ Page({ | @@ -70,6 +78,35 @@ Page({ | ||
| 70 | sid:this.seller_id, | 78 | sid:this.seller_id, |
| 71 | offset:0, | 79 | offset:0, |
| 72 | limit:1, | 80 | limit:1, |
| 81 | + }).then(res=>{ | ||
| 82 | + let list=[]; | ||
| 83 | + if(res.data.length>0){ | ||
| 84 | + res.data.forEach(r=>{ | ||
| 85 | + r.addtimeStr=util.unixtoTime(r.addtime,'MM-DD HH:II') | ||
| 86 | + list.push(r) | ||
| 87 | + this.list[r.id]=r; | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + this.setData({ | ||
| 91 | + list:list, | ||
| 92 | + }) | ||
| 73 | }) | 93 | }) |
| 74 | }, | 94 | }, |
| 95 | + sendMsg(e){ | ||
| 96 | + let id=util.attr(e,'id'); | ||
| 97 | + let reduce_num=this.list[id].reduce_num; | ||
| 98 | + let sl=(this.list[id].send_msg+'【一键订】').length | ||
| 99 | + if(sl>70){ | ||
| 100 | + reduce_num=parseInt(sl/67)*reduce_num; | ||
| 101 | + } | ||
| 102 | + let param={ | ||
| 103 | + id:id, | ||
| 104 | + sender:this.note_name, | ||
| 105 | + reduce_num:reduce_num, | ||
| 106 | + } | ||
| 107 | + if(this.hasScene==1){ | ||
| 108 | + param.sender=e.detail.nickName | ||
| 109 | + } | ||
| 110 | + App.Reserve.SmsBatchSend(param); | ||
| 111 | + }, | ||
| 75 | }) | 112 | }) |
| @@ -3,5 +3,15 @@ | @@ -3,5 +3,15 @@ | ||
| 3 | <view class="page"> | 3 | <view class="page"> |
| 4 | pages/book/smsbatch/index.wxml | 4 | pages/book/smsbatch/index.wxml |
| 5 | <formids url="./update?seller_id={{seller_id}}&hasScene={{hasScene}}">立即创建</formids> | 5 | <formids url="./update?seller_id={{seller_id}}&hasScene={{hasScene}}">立即创建</formids> |
| 6 | - <userinfo>发送</userinfo> | 6 | + |
| 7 | + <view> | ||
| 8 | + <view class="flex-lr" wx:for="{{list}}" wx:key="list.key"> | ||
| 9 | + <view>发送{{item.send_total}}人</view> | ||
| 10 | + <view>{{item.addtimeStr}}</view> | ||
| 11 | + <view> | ||
| 12 | + <userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}">发送</userinfo> | ||
| 13 | + <button wx:else="" bindtap="sendMsg" data-id="{{item.id}}">发送</button> | ||
| 14 | + </view> | ||
| 15 | + </view> | ||
| 16 | + </view> | ||
| 7 | </view> | 17 | </view> |
| @@ -2,22 +2,38 @@ | @@ -2,22 +2,38 @@ | ||
| 2 | import util from '../../../utils/util'; | 2 | import util from '../../../utils/util'; |
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | const {regeneratorRuntime} = global | 4 | const {regeneratorRuntime} = global |
| 5 | +const form={ | ||
| 6 | + send_total:0, | ||
| 7 | + send_msg:'', | ||
| 8 | + name:'', | ||
| 9 | + phone:'', | ||
| 10 | +} | ||
| 5 | Page({ | 11 | Page({ |
| 6 | 12 | ||
| 7 | /** | 13 | /** |
| 8 | * 页面的初始数据 | 14 | * 页面的初始数据 |
| 9 | */ | 15 | */ |
| 10 | data: { | 16 | data: { |
| 11 | - form:{}, | ||
| 12 | - total:0, | 17 | + form:JSON.parse(JSON.stringify(form)), |
| 18 | + options:{ | ||
| 19 | + hasScene:0, | ||
| 20 | + seller_id:'', | ||
| 21 | + } | ||
| 13 | }, | 22 | }, |
| 14 | reservePhonesMap:[], | 23 | reservePhonesMap:[], |
| 15 | reservePhones:[], | 24 | reservePhones:[], |
| 25 | + note_name:'', | ||
| 16 | /** | 26 | /** |
| 17 | * 生命周期函数--监听页面加载 | 27 | * 生命周期函数--监听页面加载 |
| 18 | */ | 28 | */ |
| 29 | + options:{}, | ||
| 19 | onLoad: function (options) { | 30 | onLoad: function (options) { |
| 20 | - | 31 | + this.options=options; |
| 32 | + if(options.hasScene!=1){ | ||
| 33 | + App.Reserve.SellerInfo(util.cache('enter_params')).then(res=>{ | ||
| 34 | + this.note_name=res.data.seller_user.nickname; | ||
| 35 | + }) | ||
| 36 | + } | ||
| 21 | App.Reserve.GetReservePhones({sid:options.seller_id}).then(res=>{ | 37 | App.Reserve.GetReservePhones({sid:options.seller_id}).then(res=>{ |
| 22 | //this.reservePhones=res.data; | 38 | //this.reservePhones=res.data; |
| 23 | if(res.data.length>0){ | 39 | if(res.data.length>0){ |
| @@ -29,8 +45,11 @@ Page({ | @@ -29,8 +45,11 @@ Page({ | ||
| 29 | reservePhones.push(m.phone); | 45 | reservePhones.push(m.phone); |
| 30 | } | 46 | } |
| 31 | }) | 47 | }) |
| 48 | + this.reservePhonesMap=reservePhonesMap; | ||
| 49 | + this.reservePhones=reservePhones.toString(); | ||
| 32 | this.setData({ | 50 | this.setData({ |
| 33 | - total:reservePhones.length | 51 | + options:options, |
| 52 | + [`form.send_total`]:reservePhonesMap.length | ||
| 34 | }) | 53 | }) |
| 35 | } | 54 | } |
| 36 | }) | 55 | }) |
| @@ -92,9 +111,15 @@ Page({ | @@ -92,9 +111,15 @@ Page({ | ||
| 92 | form:form, | 111 | form:form, |
| 93 | }) | 112 | }) |
| 94 | }, | 113 | }, |
| 95 | - submit(){ | 114 | + submit(e){ |
| 96 | let param={ | 115 | let param={ |
| 97 | - | 116 | + ...this.data.form, |
| 117 | + send_phones:this.reservePhones, | ||
| 118 | + sid:this.options.seller_id, | ||
| 119 | + note_name:this.note_name, | ||
| 120 | + } | ||
| 121 | + if(this.options.hasScene==1){ | ||
| 122 | + param.note_name=e.detail.nickName | ||
| 98 | } | 123 | } |
| 99 | App.Reserve.SmsBatchUpdate(param); | 124 | App.Reserve.SmsBatchUpdate(param); |
| 100 | }, | 125 | }, |
| 1 | <!--pages/book/smsbatch/update.wxml--> | 1 | <!--pages/book/smsbatch/update.wxml--> |
| 2 | <nav id="nav" hasHome>短信营销</nav> | 2 | <nav id="nav" hasHome>短信营销</nav> |
| 3 | <view class="page"> | 3 | <view class="page"> |
| 4 | - <view>会员({{total}})人</view> | 4 | + <view>会员({{form.send_total}})人</view> |
| 5 | <textarea bindinput="formValue" data-key="send_msg" placeholder="短信内容"></textarea> | 5 | <textarea bindinput="formValue" data-key="send_msg" placeholder="短信内容"></textarea> |
| 6 | <input placeholder="姓名" bindinput="formValue" data-key="name"/> | 6 | <input placeholder="姓名" bindinput="formValue" data-key="name"/> |
| 7 | <input placeholder="电话" bindinput="formValue" data-key="phone" type="number"/> | 7 | <input placeholder="电话" bindinput="formValue" data-key="phone" type="number"/> |
| 8 | - <button bindtap="submit">提交</button> | 8 | + <block wx:if="{{options.hasScene==1}}"> |
| 9 | + <userinfo binduserinfo="submit">提交</userinfo> | ||
| 10 | + </block> | ||
| 11 | + <block wx:else=""> | ||
| 12 | + <button bindtap="submit">提交</button> | ||
| 13 | + </block> | ||
| 9 | </view> | 14 | </view> |
-
Please register or login to post a comment