Commit 36d043b5523b13fb324890720947e04bd1a29ca8

Authored by wangfan
1 parent b558cb0d

smsbatch

Showing 1 changed file with 75 additions and 66 deletions
1 var util = require('../../../utils/util.js') 1 var util = require('../../../utils/util.js')
2 -var uri=require('../../../utils/uri.js'); 2 +var uri = require('../../../utils/uri.js');
3 Component({ 3 Component({
4 - properties:{  
5 - bookInfo:Object 4 + properties: {
  5 + bookInfo: Object
  6 + },
  7 + data: {
  8 + list: [
  9 + {
  10 + imgurl: 'http://qn.colorcun.com/custom/lite-yd/image/notice-wx.png',
  11 + title: '微信'
  12 + },
  13 + {
  14 + imgurl: 'http://qn.colorcun.com/custom/lite-yd/image/notice-msg.png',
  15 + title: '短信'
  16 + },
  17 + {
  18 + imgurl: 'http://qn.colorcun.com/custom/lite-yd/image/notice-call.png',
  19 + title: '电话'
  20 + }
  21 + ],
  22 + noticeHidden: true
  23 + },
  24 + methods: {
  25 + show: function () {
  26 + let list=this.data.list
  27 + let pl = this.data.bookInfo.phone ? this.data.bookInfo.phone.length : 0;
  28 + if (pl < 3) {
  29 + list[2].imgurl='http://qn.colorcun.com/custom/lite-yd/image/notice-call-disabled.png'
  30 + }
  31 + if (!/^1\d{10}$/.test(this.data.bookInfo.phone)) {
  32 + list[1].imgurl='http://qn.colorcun.com/custom/lite-yd/image/notice-msg-disabled.png'
  33 + }
  34 + this.setData({
  35 + list:list,
  36 + noticeHidden: false
  37 + })
6 }, 38 },
7 - data:{  
8 - list:[  
9 - {  
10 - imgurl:'http://qn.colorcun.com/custom/lite-yd/image/notice-wx.png',  
11 - title:'微信'  
12 - },  
13 - {  
14 - imgurl:'http://qn.colorcun.com/custom/lite-yd/image/notice-msg.png',  
15 - title:'短信'  
16 - },  
17 - {  
18 - imgurl:'http://qn.colorcun.com/custom/lite-yd/image/notice-call.png',  
19 - title:'电话'  
20 - }  
21 - ],  
22 - noticeHidden:true 39 + close: function () {
  40 + this.setData({
  41 + noticeHidden: true
  42 + })
23 }, 43 },
24 - methods:{  
25 - show:function(){  
26 - this.setData({  
27 - noticeHidden:false  
28 - })  
29 - },  
30 - close:function(){  
31 - this.setData({  
32 - noticeHidden:true  
33 - })  
34 - },  
35 - callcustom:function(e){  
36 - var idx=e.currentTarget.dataset.idx;  
37 - switch (idx){  
38 - case 0:  
39 - this.triggerEvent("share");  
40 - break;  
41 - case 1:  
42 - if(!this.data.bookInfo.phone){  
43 - util.toast('未填写手机号码','none')  
44 - return;  
45 - }else if(!/^1\d{10}$/.test(this.data.bookInfo.phone)){  
46 - util.toast('手机号码错误','none')  
47 - return;  
48 - }  
49 - this.close();  
50 - wx.navigateTo({  
51 - url:'/pages/book/b_sms?id='+this.data.bookInfo.id  
52 - });  
53 - break;  
54 - case 2:  
55 - if(!this.data.bookInfo.hasOwner){  
56 - return util.toast('只有记录人可以拨打','none');  
57 - }  
58 - console.log('this.data.bookInfo',this.data.bookInfo);  
59 - let pl=this.data.bookInfo.phone?this.data.bookInfo.phone.length:0;  
60 - if(pl<3){  
61 - return util.toast(pl==0?'未填写手机号码':'手机号码错误','none');  
62 - }  
63 - wx.makePhoneCall({  
64 - phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码  
65 - complete:()=>{  
66 - this.close();  
67 - }  
68 - })  
69 - break; 44 + callcustom: function (e) {
  45 + var idx = e.currentTarget.dataset.idx;
  46 + switch (idx) {
  47 + case 0:
  48 + this.triggerEvent("share");
  49 + break;
  50 + case 1:
  51 + if (!this.data.bookInfo.phone) {
  52 + util.toast('未填写手机号码', 'none')
  53 + return;
  54 + } else if (!/^1\d{10}$/.test(this.data.bookInfo.phone)) {
  55 + util.toast('手机号码错误', 'none')
  56 + return;
  57 + }
  58 + this.close();
  59 + wx.navigateTo({
  60 + url: '/pages/book/b_sms?id=' + this.data.bookInfo.id
  61 + });
  62 + break;
  63 + case 2:
  64 + if (!this.data.bookInfo.hasOwner) {
  65 + return util.toast('只有记录人可以拨打', 'none');
  66 + }
  67 + console.log('this.data.bookInfo', this.data.bookInfo);
  68 + let pl = this.data.bookInfo.phone ? this.data.bookInfo.phone.length : 0;
  69 + if (pl < 3) {
  70 + return util.toast(pl == 0 ? '未填写手机号码' : '手机号码错误', 'none');
  71 + }
  72 + wx.makePhoneCall({
  73 + phoneNumber: this.data.bookInfo.phone, //仅为示例,并非真实的电话号码
  74 + complete: () => {
  75 + this.close();
70 } 76 }
71 - } 77 + })
  78 + break;
  79 + }
72 } 80 }
  81 + }
73 }) 82 })