Commit 2297f52346e7e4797411001ae158f7753dfa92bf

Authored by wangfan
1 parent 08efb265

smsbatch

... ... @@ -10,6 +10,7 @@ Page({
data: {
hasScene:0,
seller_id:'',
list:[],
},
/**
... ... @@ -17,6 +18,8 @@ Page({
*/
hasScene:0,
seller_id:'',
note_name:'',
list:{},
onLoad: function (options) {
//转化场景值到 options
if(options.scene){//扫码进入
... ... @@ -36,6 +39,11 @@ Page({
hasScene:this.hasScene,
seller_id:this.seller_id,
})
if(this.hasScene!=1){
App.Reserve.SellerInfo(util.cache('enter_params')).then(res=>{
this.note_name=res.data.seller_user.nickname;
})
}
},
/**
... ... @@ -70,6 +78,35 @@ Page({
sid:this.seller_id,
offset:0,
limit:1,
}).then(res=>{
let list=[];
if(res.data.length>0){
res.data.forEach(r=>{
r.addtimeStr=util.unixtoTime(r.addtime,'MM-DD HH:II')
list.push(r)
this.list[r.id]=r;
})
}
this.setData({
list:list,
})
})
},
sendMsg(e){
let id=util.attr(e,'id');
let reduce_num=this.list[id].reduce_num;
let sl=(this.list[id].send_msg+'【一键订】').length
if(sl>70){
reduce_num=parseInt(sl/67)*reduce_num;
}
let param={
id:id,
sender:this.note_name,
reduce_num:reduce_num,
}
if(this.hasScene==1){
param.sender=e.detail.nickName
}
App.Reserve.SmsBatchSend(param);
},
})
\ No newline at end of file
... ...
... ... @@ -3,5 +3,15 @@
<view class="page">
pages/book/smsbatch/index.wxml
<formids url="./update?seller_id={{seller_id}}&hasScene={{hasScene}}">立即创建</formids>
<userinfo>发送</userinfo>
<view>
<view class="flex-lr" wx:for="{{list}}" wx:key="list.key">
<view>发送{{item.send_total}}人</view>
<view>{{item.addtimeStr}}</view>
<view>
<userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}">发送</userinfo>
<button wx:else="" bindtap="sendMsg" data-id="{{item.id}}">发送</button>
</view>
</view>
</view>
</view>
... ...
... ... @@ -2,22 +2,38 @@
import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
const form={
send_total:0,
send_msg:'',
name:'',
phone:'',
}
Page({
/**
* 页面的初始数据
*/
data: {
form:{},
total:0,
form:JSON.parse(JSON.stringify(form)),
options:{
hasScene:0,
seller_id:'',
}
},
reservePhonesMap:[],
reservePhones:[],
note_name:'',
/**
* 生命周期函数--监听页面加载
*/
options:{},
onLoad: function (options) {
this.options=options;
if(options.hasScene!=1){
App.Reserve.SellerInfo(util.cache('enter_params')).then(res=>{
this.note_name=res.data.seller_user.nickname;
})
}
App.Reserve.GetReservePhones({sid:options.seller_id}).then(res=>{
//this.reservePhones=res.data;
if(res.data.length>0){
... ... @@ -29,8 +45,11 @@ Page({
reservePhones.push(m.phone);
}
})
this.reservePhonesMap=reservePhonesMap;
this.reservePhones=reservePhones.toString();
this.setData({
total:reservePhones.length
options:options,
[`form.send_total`]:reservePhonesMap.length
})
}
})
... ... @@ -92,9 +111,15 @@ Page({
form:form,
})
},
submit(){
submit(e){
let param={
...this.data.form,
send_phones:this.reservePhones,
sid:this.options.seller_id,
note_name:this.note_name,
}
if(this.options.hasScene==1){
param.note_name=e.detail.nickName
}
App.Reserve.SmsBatchUpdate(param);
},
... ...
<!--pages/book/smsbatch/update.wxml-->
<nav id="nav" hasHome>短信营销</nav>
<view class="page">
<view>会员({{total}})人</view>
<view>会员({{form.send_total}})人</view>
<textarea bindinput="formValue" data-key="send_msg" placeholder="短信内容"></textarea>
<input placeholder="姓名" bindinput="formValue" data-key="name"/>
<input placeholder="电话" bindinput="formValue" data-key="phone" type="number"/>
<button bindtap="submit">提交</button>
<block wx:if="{{options.hasScene==1}}">
<userinfo binduserinfo="submit">提交</userinfo>
</block>
<block wx:else="">
<button bindtap="submit">提交</button>
</block>
</view>
... ...