Commit 590d94e0b852be2093edf3312f36ffedde1d8f62

Authored by wangfan
1 parent 39ff7288

smsbatch

... ... @@ -17,10 +17,7 @@
</block>
<block wx:elif="{{item.status==1}}">
<view>
<userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}">
<view class="opt-but">立即发放</view>
</userinfo>
<sendsms wx:else="" item="{{item}}" bindsend="sendoff">
<sendsms item="{{item}}" bindsend="sendoff">
<view class="opt-but">立即发放</view>
</sendsms>
</view>
... ...
... ... @@ -3,81 +3,88 @@ import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
item:Object,
},
/**
* 组件的属性列表
*/
properties: {
item: Object,
},
/**
* 组件的初始数据
*/
data: {
showGopay:false,
/**
* 组件的初始数据
*/
data: {
showGopay: false,
hasScene:1,
},
attached(){
this.setData({
hasScene:util.cache('enter_params')?0:1,
})
console.log('hasScene',this.data.hasScene)
},
/**
* 组件的方法列表
*/
methods: {
hideGopay(){
this.setData({
showGopay: false,
})
},
goPay(){
this.hideGopay();
wx.navigateTo({
url: '/pages/book/setting/sms_buy?scene=' + encodeURI('seller_id=' + this.data.item.sid)
})
},
async sendMsg(e){
let sign_name = '一键订';
let item = this.data.item;
let ss = await App.Reserve.SmsInfo({seller_id: item.sid}, true);
let id = item.id;
let reduce_num = item.send_total;
let sl = (item.send_msg + sign_name).length
if (sl > 70) {
reduce_num = Math.ceil(sl / 67) * reduce_num;
}
if (parseInt(reduce_num) > parseInt(ss.data.last_num)) {
this.setData({
reduce_num: reduce_num,
last_num: ss.data.last_num,
showGopay: true,
})
return;
}
let note_name = '';
let enter_params = util.cache('enter_params');
/**
* 组件的方法列表
*/
methods: {
hideGopay(){
this.setData({
showGopay:false,
})
},
goPay(){
this.hideGopay();
wx.navigate({
url:'/pages/book/setting/sms_buy?scene='+encodeURI('seller_id='+this.data.item.sid)
})
},
async sendMsg(e){
let sign_name='一键订';
let item=this.data.item;
let ss=await App.Reserve.SmsInfo({seller_id:item.sid},true);
let id=item.id;
let reduce_num=item.send_total;
let sl=(item.send_msg+sign_name).length
if(sl>70){
reduce_num=Math.ceil(sl/67)*reduce_num;
}
if(parseInt(reduce_num)>parseInt(ss.data.last_num)){
this.setData({
reduce_num:reduce_num,
last_num:ss.data.last_num,
showGopay:true,
})
return;
}
let note_name='';
let enter_params=util.cache('enter_params');
if(enter_params){
try {
let si=App.Reserve.SellerInfo(enter_params);
note_name=si.data.seller_user.nick_name||si.data.seller_user.nickname
}catch (e){}
}
let param={
id:id,
sid:item.sid,
sender:note_name,
reduce_num:reduce_num,
sign_name:sign_name,
if (enter_params) {
try {
let si = App.Reserve.SellerInfo(enter_params);
note_name = si.data.seller_user.nick_name || si.data.seller_user.nickname
} catch (e) {
}
if(!note_name){
param.sender=e.detail.nickName
}
let param = {
id: id,
sid: item.sid,
sender: note_name,
reduce_num: reduce_num,
sign_name: sign_name,
}
if (!note_name) {
param.sender = e.detail.nickName
}
App.Reserve.SmsBatchSend(param).then(res => {
if (res.ret != 200) {
return util.toast(res.msg || '发送失败,请联系客服', 'none');
}
App.Reserve.SmsBatchSend(param).then(res=>{
if(res.ret!=200){
return util.toast(res.msg||'发送失败,请联系客服','none');
}
this.triggerEvent('send');
util.toast('已发送');
}).catch(res=>{
util.toast('发送失败,请联系客服','none');
});
},
}
this.triggerEvent('send');
util.toast('已发送');
}).catch(res => {
util.toast('发送失败,请联系客服', 'none');
});
},
}
})
... ...
{
"component": true,
"usingComponents": {}
"usingComponents": {
"userinfo":"/components/userinfo/userinfo"
}
}
\ No newline at end of file
... ...
<!--components/book/smsbatch/sendsms.wxml-->
<view bindtap="sendMsg">
<userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}">
<slot></slot>
</userinfo>
<view wx:else="" bindtap="sendMsg">
<slot ></slot>
</view>
<view hidden="{{!showGopay}}" class="mask" bindtap="hideGopay">
<view class="flex-vc showGopay" catchtap="none">
... ...
... ... @@ -4,72 +4,77 @@ import App from '../../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
App.Reserve.SmsBatchInfo({id:options.id}).then(res=>{
this.setData({
...res.data,
addtimeStr:util.unixtoTime(res.data.addtime,'YYYY-MM-DD HH:II'),
sendertimeStr:util.unixtoTime(res.data.stime ||'','YYYY-MM-DD HH:II'),
});
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
/**
* 页面的初始数据
*/
data: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getInfo(options.id)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
getInfo(id,flag=false){
App.Reserve.SmsBatchInfo({id: id},flag).then(res => {
this.setData({
item:res.data,
...res.data,
addtimeStr: util.unixtoTime(res.data.addtime, 'YYYY-MM-DD HH:II'),
sendertimeStr: util.unixtoTime(res.data.stime || '', 'YYYY-MM-DD HH:II'),
});
})
},
sendoff(){
this.getInfo(this.data.id,true)
},
})
\ No newline at end of file
... ...
... ... @@ -6,7 +6,8 @@
"userinfo":"/components/userinfo/userinfo",
"nav":"/components/nav/nav",
"formids":"/components/formids/formids",
"service":"/components/book/smsbatch/service"
"service":"/components/book/smsbatch/service",
"sendsms":"/components/book/smsbatch/sendsms"
}
}
\ No newline at end of file
... ...
... ... @@ -43,7 +43,7 @@
<service wx:if="{{status==-1}}">
<view class="opt-but">联系客服</view>
</service>
<sendsms wx:if="{{status==1}}">
<sendsms wx:if="{{status==1}}" bindsend="sendoff" item="{{item}}">
<view class="opt-but">立即发放</view>
</sendsms>
</view>
... ...
... ... @@ -23,7 +23,6 @@ Page({
*/
hasScene:0,
seller_id:'',
note_name:'',
list:{},
onLoad: function (options) {
//转化场景值到 options
... ... @@ -44,11 +43,6 @@ 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;
})
}
},
/**
... ...
... ... @@ -17,11 +17,12 @@ Page({
*/
options:{},
onLoad: function (options) {
console.log('options',options);
this.options=options
App.Reserve.SmsInfo({seller_id: options.seller_id}, true).then(res => {
this.setData({
total: options.total,
last_num:res.data.last_num,
total: parseInt(options.total),
last_num:parseInt(res.data.last_num),
})
})
},
... ... @@ -75,7 +76,7 @@ Page({
},
goPay(){
wx.navigate({
wx.navigateTo({
url:'/pages/book/setting/sms_buy?scene='+encodeURI('seller_id='+this.options.seller_id)
})
}
... ...
... ... @@ -148,7 +148,8 @@ Page({
}
App.Reserve.SmsBatchUpdate(param).then(res=>{
this.options.id=res.data.id;
this.options.total=this.data.totalSms*this.reservePhones.length
console.log('this.options.total',this.data.totalSms,this.reservePhonesMap.length)
this.options.total=this.data.totalSms*this.reservePhonesMap.length
wx.redirectTo({
url:util.http_build_query(this.options,'./result'),
});
... ...
... ... @@ -30,7 +30,7 @@
"list": []
},
"miniprogram": {
"current": 30,
"current": 31,
"list": [
{
"id": 0,
... ... @@ -230,10 +230,11 @@
"query": ""
},
{
"id": -1,
"id": 26,
"name": "pages/book/smsbatch/index",
"pathName": "pages/book/smsbatch/index",
"query": "seller_id=80"
"query": "scene=seller_id%3D80",
"scene": "1011"
},
{
"id": -1,
... ... @@ -259,6 +260,13 @@
"pathName": "pages/book/smsbatch/result",
"query": "seller_id=&id=6&total=10",
"scene": "1001"
},
{
"id": 31,
"name": "pages/book/smsbatch/index(普通)",
"pathName": "pages/book/smsbatch/index",
"query": "seller_id=80",
"scene": "1011"
}
]
}
... ...