Commit d4723b7e46b921d2eac7479e4f5c980dfd395739

Authored by wangfan
1 parent 8f45cf87

smsbatch

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 "component": true, 2 "component": true,
3 "usingComponents": { 3 "usingComponents": {
4 "service":"/components/book/smsbatch/service", 4 "service":"/components/book/smsbatch/service",
5 - "formids":"/components/formids/formids" 5 + "formids":"/components/formids/formids",
  6 + "sendsms":"/components/book/smsbatch/sendsms"
6 } 7 }
7 } 8 }
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}"> 20 <userinfo wx:if="{{hasScene==1}}" binduserinfo="sendMsg" data-id="{{item.id}}">
21 <view class="opt-but">立即发放</view> 21 <view class="opt-but">立即发放</view>
22 </userinfo> 22 </userinfo>
23 - <sendsms wx:else="" bindtap="sendMsg" data-id="{{item.id}}"> 23 + <sendsms wx:else="" item="{{item}}">
24 <view class="opt-but">立即发放</view> 24 <view class="opt-but">立即发放</view>
25 </sendsms> 25 </sendsms>
26 </view> 26 </view>
  1 +// components/book/smsbatch/sendsms.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Component({
  6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + item:Object,
  11 + },
  12 +
  13 + /**
  14 + * 组件的初始数据
  15 + */
  16 + data: {
  17 + showGopay:true,
  18 + },
  19 +
  20 + /**
  21 + * 组件的方法列表
  22 + */
  23 + methods: {
  24 + hideGopay(){
  25 + this.setData({
  26 + showGopay:false,
  27 + })
  28 + },
  29 + goPay(){
  30 + this.hideGopay();
  31 + wx.navigate({
  32 + url:'/pages/book/setting/sms_buy?scene='+encodeURI('seller_id='+this.data.item.sid)
  33 + })
  34 + },
  35 + async sendMsg(e){
  36 + let sign_name='一键订';
  37 + let item=this.data.item;
  38 + let ss=await App.Reserve.SmsInfo({seller_id:item.sid},true);
  39 + let id=item.id;
  40 + let reduce_num=item.send_total;
  41 + let sl=(item.send_msg+sign_name).length
  42 + if(sl>70){
  43 + reduce_num=parseInt(sl/67)*reduce_num;
  44 + }
  45 + if(reduce_num>ss.data.last_num){
  46 + this.setData({
  47 + reduce_num:reduce_num,
  48 + last_num:ss.data.last_num,
  49 + showGopay:true,
  50 + })
  51 + return;
  52 + }
  53 + return;
  54 + let param={
  55 + id:id,
  56 + sid:this.seller_id,
  57 + sender:this.note_name,
  58 + reduce_num:reduce_num,
  59 + sign_name:sign_name,
  60 + }
  61 + if(e.detail.nickName){
  62 + param.sender=e.detail.nickName
  63 + }
  64 + App.Reserve.SmsBatchSend(param).then(res=>{
  65 + if(res.ret!=200){
  66 + return util.toast(res.msg,'none');
  67 + }
  68 + });
  69 + },
  70 + }
  71 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/book/smsbatch/sendsms.wxml-->
  2 +<view bindtap="sendMsg">
  3 + <slot></slot>
  4 +</view>
  5 +<view hidden="{{!showGopay}}" class="mask" bindtap="hideGopay">
  6 + <view class="flex-vc showGopay" catchtap="none">
  7 + <view class="info Medium">
  8 + <view>本次群发{{reduce_num}}条,当前短信剩余{{last_num}}条</view>
  9 + <view>请立即充值</view>
  10 + </view>
  11 + <view class="opt-but" catchtap="goPay">立即充值</view>
  12 + </view>
  13 +</view>
  1 +/* components/book/smsbatch/sendsms.wxss */
  2 +@import "/app.wxss";
  3 +.mask{
  4 + position: fixed;
  5 + bottom: 0;
  6 + top:0;
  7 + left: 0;
  8 + right:0;
  9 + background-color: rgba(13,13,13,0.5);
  10 + z-index: 9999;
  11 +}
  12 +.showGopay{
  13 + position: fixed;
  14 + bottom: 0;
  15 + background-color: #fefefe;
  16 + z-index: 9999;
  17 + width: 100%;
  18 +}
  19 +.showGopay .info{
  20 + width: 65%;
  21 + line-height: 48rpx;
  22 + margin-top: 68rpx;
  23 + margin-bottom: 84rpx;
  24 +}
  25 +.showGopay .opt-but{
  26 + margin-bottom: 68rpx;
  27 + height: 80rpx;
  28 + line-height: 80rpx;
  29 + width: 200rpx;
  30 + text-align: center;
  31 + background-color: #199095;
  32 + border-radius: 10rpx;
  33 + color:#FFFFFF;
  34 +}
@@ -15,7 +15,7 @@ Page({ @@ -15,7 +15,7 @@ Page({
15 list:[], 15 list:[],
16 hasMore:true, 16 hasMore:true,
17 height:350, 17 height:350,
18 - hiddenQuestion:false, 18 + hiddenQuestion:true,
19 }, 19 },
20 20
21 /** 21 /**
@@ -114,29 +114,6 @@ Page({ @@ -114,29 +114,6 @@ Page({
114 this.setData(obj) 114 this.setData(obj)
115 }) 115 })
116 }, 116 },
117 - sendMsg(e){  
118 - let id=util.attr(e,'id');  
119 - let reduce_num=this.list[id].reduce_num;  
120 - let sl=(this.list[id].send_msg+'【一键订】').length  
121 - if(sl>70){  
122 - reduce_num=parseInt(sl/67)*reduce_num;  
123 - }  
124 - let param={  
125 - id:id,  
126 - sid:this.seller_id,  
127 - sender:this.note_name,  
128 - reduce_num:reduce_num,  
129 - sign_name:'一键订',  
130 - }  
131 - if(this.hasScene==1){  
132 - param.sender=e.detail.nickName  
133 - }  
134 - App.Reserve.SmsBatchSend(param).then(res=>{  
135 - if(res.ret!=200){  
136 - return util.toast(res.msg,'none');  
137 - }  
138 - });  
139 - },  
140 showQuestion(){ 117 showQuestion(){
141 this.setData({ 118 this.setData({
142 hiddenQuestion:false, 119 hiddenQuestion:false,