zhaojs
2023-09-27 74098f1401afe40f961d1d167bb18dd0a71c4d59
H5/pages/sendsms/index.vue
@@ -14,15 +14,18 @@
            <view style="position: absolute; top: 0.4rem;">
               {{smsSign}}
            </view>
            <textarea maxlength="500" v-model="smscontent" @input="CountSms" class="smstxt"
               placeholder="请输入发信内容"
            <textarea maxlength="500" v-model="smscontent" @input="CountSms" class="smstxt" placeholder="请输入发信内容"
               placeholder-class="text-color-assist font-size-base"></textarea>
            <view class="smsbottom">
               <view v-if="tdTxt!=''" style="color: #000;">
                  {{tdTxt}}
               </view>
               按照70个字/条计算,当前 <span class="smsword">{{wordcount}}</span>字,<span
                  class="smsword">{{smscount}}</span>条短信
               <span @click="choosetemplate()" class="chooseTemplateTxt">
                  内置模板
               </span>
               <span>按照70个字/条计算,当前 <span class="smsword">{{wordcount}}</span>字,<span
                     class="smsword">{{smscount}}</span>条短信</span>
            </view>
         </view>
      </view>
@@ -77,22 +80,20 @@
            smscount: 0,
            smsSign: '',
            tdTxt: '',
            text:'请勿发送欺诈/辱骂等违规内容,发现一律报警处理'
            text: '请勿发送欺诈/辱骂等违规内容,发现一律报警处理'
         }
      },
      onLoad(option) {
         if (option.mobile) {
            this.mobile = option.mobile;
         }
         if(option.templateTxt)
         {
            this.smscontent=option.templateTxt;
         if (option.templateTxt) {
            this.smscontent = option.templateTxt;
         }
         this.getSmsSet();
         let memberinfo = uni.getStorageSync('smsmemberinfo');
         if(memberinfo==null||memberinfo.smscount==0)
         {//未注册或没有短信余额
         if (memberinfo == null || memberinfo.smscount == 0) { //未注册或没有短信余额
            uni.showModal({
               title: '提示',
               content: '当前短信余额为0,请充值后发送!',
@@ -106,11 +107,10 @@
         }
      },
      methods: {
         getSmsSet()
         {
         getSmsSet() {
            this.$http.post('/smsapi/SmsBusiness/GetSmsSet', {}).then(e => {
               this.smsSign="【"+e.result.smsname+"】";
               this.tdTxt=e.result.suffix;
               this.smsSign = "【" + e.result.smsname + "】";
               this.tdTxt = e.result.suffix;
               this.CountSms();
            }).catch(function(err) {
               console.log(err);
@@ -144,60 +144,58 @@
               OpenId: this.openId
            }
            this.$http.post('/smsapi/SmsBusiness/GetMemberInfo', data).then(e => {
               if (e.result != null) {
                  if (e.result.smscount >= that.smscount) {
                     //提交短信任务
                     let Wantsendtype = that.sendtime == "" ? 1 : 2;
                     var sendTime = that.sendtime == "" ? new Date().toLocaleString() : that.sendtime;
                     let sendData = {
                        Mobile: that.mobile,
                        Smscontent: that.smscontent,
                        Memberid: e.result.id,
                        Wantsendtype: Wantsendtype,
                        Wantsendtime: sendTime
                  if (e.result != null) {
                     if (e.result.smscount >= that.smscount) {
                        //提交短信任务
                        let Wantsendtype = that.sendtime == "" ? 1 : 2;
                        var sendTime = that.sendtime == "" ? new Date().toLocaleString() : that.sendtime;
                        let sendData = {
                           Mobile: that.mobile,
                           Smscontent: that.smscontent,
                           Memberid: e.result.id,
                           Wantsendtype: Wantsendtype,
                           Wantsendtime: sendTime
                        }
                        that.$http.post('/smsapi/SmsBusiness/AddSmsSend', sendData).then(e => {
                           if (e.result == true) { //提交成功
                              uni.showModal({
                                 title: '提示',
                                 content: '任务提交成功!',
                                 showCancel: false,
                                 success: function(bac) {
                                    uni.switchTab({
                                       url: '/pages/charthistory/index'
                                    })
                                 }
                              })
                           } else {
                              uni.showToast({
                                 title: '任务提交失败,请联系客服!',
                                 icon: 'none'
                              });
                           }
                        }).catch(function(err) {
                           console.log(err);
                        })
                     } else {
                        uni.showModal({
                           title: '提示',
                           content: '当前短信余额为0,请充值后发送!',
                           showCancel: false,
                           success: function(bac) {
                              uni.switchTab({
                                 url: '/pages/mine/mine'
                              })
                           }
                        })
                     }
                     that.$http.post('/smsapi/SmsBusiness/AddSmsSend', sendData).then(e => {
                        if (e.result == true) { //提交成功
                           uni.showModal({
                              title: '提示',
                              content: '任务提交成功!',
                              showCancel: false,
                              success: function(bac) {
                                 uni.switchTab({
                                    url: '/pages/charthistory/index'
                                 })
                              }
                           })
                        } else {
                           uni.showToast({
                              title: '任务提交失败,请联系客服!',
                              icon: 'none'
                           });
                        }
                     }).catch(function(err) {
                        console.log(err);
                     })
                  }
                  else
                  {
                     uni.showModal({
                        title: '提示',
                        content: '当前短信余额为0,请充值后发送!',
                        showCancel: false,
                        success: function(bac) {
                           uni.switchTab({
                              url: '/pages/mine/mine'
                           })
                        }
                     })
                  }
               }
               uni.hideLoading()
            })
            .catch(function(err) {
               uni.hideLoading()
               console.log(err);
            })
                  uni.hideLoading()
               })
               .catch(function(err) {
                  uni.hideLoading()
                  console.log(err);
               })
         },
         changeTime(timestr, timespan) {
            this.sendtime = timestr;
@@ -214,6 +212,11 @@
            this.wordcount = count
            var smsCount = Math.ceil(count / 70)
            this.smscount = smsCount
         },
         choosetemplate() {
            uni.navigateTo({
               url: '/pages/smstemplate/index'
            })
         },
         checkIsNull(value) {
            if (value == undefined || value == '') {
@@ -232,6 +235,13 @@
   }
   /* #endif */
   .chooseTemplateTxt {
      float: left;
      margin-left: 1rem;
      color: rgb(245, 108, 108);
      font-size: 15px;
      font-weight: 600;
   }
   .changeTime {
      width: 100%;
@@ -258,8 +268,7 @@
   }
   .sendtip {
      margin: 0.5rem 0 0.5rem 0;
      background: #fff;
      margin: 0.5rem 0 0 0;
      padding: 0.8rem;
      font-size: 14px;
      font-weight: 600;
@@ -282,7 +291,7 @@
      width: 100%;
      height: 15rem;
      padding: 10px;
      padding-bottom: 2rem;
      padding-bottom: 2.5rem;
      text-indent: 120rpx;
   }