Commit 72a68b2761db8b9a7df929aaad68bff5a4e52d1e

Authored by wangfan
1 parent fd7eb281

smsbatch

@@ -20,7 +20,8 @@ @@ -20,7 +20,8 @@
20 "pages/book/setting/index", 20 "pages/book/setting/index",
21 "pages/book/setting/sms", 21 "pages/book/setting/sms",
22 "pages/book/setting/sms_buy", 22 "pages/book/setting/sms_buy",
23 - "pages/book/smsbatch/index" 23 + "pages/book/smsbatch/index",
  24 + "pages/book/smsbatch/update"
24 ], 25 ],
25 "subpackages": [ 26 "subpackages": [
26 { 27 {
1 // pages/book/smsbatch/index.js 1 // pages/book/smsbatch/index.js
2 import util from '../../../utils/util'; 2 import util from '../../../utils/util';
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
4 Page({ 5 Page({
5 6
6 - /**  
7 - * 页面的初始数据  
8 - */  
9 - data: { 7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + hasScene:0,
  12 + seller_id:'',
  13 + },
10 14
11 - }, 15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + hasScene:0,
  19 + seller_id:'',
  20 + onLoad: function (options) {
  21 + //转化场景值到 options
  22 + if(options.scene){//扫码进入
  23 + let query=decodeURIComponent(options.scene);
  24 + query.split('&').forEach(q=>{
  25 + let _q=q.split('=');
  26 + options[_q[0]]=_q[1];
  27 + })
  28 + this.hasScene=1
  29 + }
  30 + if(!options.seller_id){
  31 + let enter_params=util.cache('enter_params');
  32 + options.seller_id=enter_params.seller_id;
  33 + }
  34 + this.seller_id=options.seller_id;
  35 + this.setData({
  36 + hasScene:this.hasScene,
  37 + seller_id:this.seller_id,
  38 + })
  39 + },
12 40
13 - /**  
14 - * 生命周期函数--监听页面加载  
15 - */  
16 - onLoad: function (options) { 41 + /**
  42 + * 生命周期函数--监听页面初次渲染完成
  43 + */
  44 + onReady: function () {
17 45
18 - }, 46 + },
19 47
20 - /**  
21 - * 生命周期函数--监听页面初次渲染完成  
22 - */  
23 - onReady: function () { 48 + /**
  49 + * 生命周期函数--监听页面显示
  50 + */
  51 + onShow: function () {
  52 + this.SmsBatchList();
  53 + },
24 54
25 - }, 55 + /**
  56 + * 生命周期函数--监听页面隐藏
  57 + */
  58 + onHide: function () {
26 59
27 - /**  
28 - * 生命周期函数--监听页面显示  
29 - */  
30 - onShow: function () { 60 + },
31 61
32 - }, 62 + /**
  63 + * 生命周期函数--监听页面卸载
  64 + */
  65 + onUnload: function () {
33 66
34 - /**  
35 - * 生命周期函数--监听页面隐藏  
36 - */  
37 - onHide: function () {  
38 -  
39 - },  
40 -  
41 - /**  
42 - * 生命周期函数--监听页面卸载  
43 - */  
44 - onUnload: function () {  
45 -  
46 - }, 67 + },
  68 + SmsBatchList(){
  69 + App.Reserve.SmsBatchList({
  70 + sid:this.seller_id,
  71 + offset:0,
  72 + limit:1,
  73 + })
  74 + },
47 }) 75 })
@@ -4,7 +4,8 @@ @@ -4,7 +4,8 @@
4 "navigationBarTextStyle":"black", 4 "navigationBarTextStyle":"black",
5 "usingComponents": { 5 "usingComponents": {
6 "userinfo":"/components/userinfo/userinfo", 6 "userinfo":"/components/userinfo/userinfo",
7 - "nav":"/components/nav/nav" 7 + "nav":"/components/nav/nav",
  8 + "formids":"/components/formids/formids"
8 } 9 }
9 10
10 } 11 }
@@ -2,5 +2,6 @@ @@ -2,5 +2,6 @@
2 <nav id="nav" hasHome>短信营销</nav> 2 <nav id="nav" hasHome>短信营销</nav>
3 <view class="page"> 3 <view class="page">
4 pages/book/smsbatch/index.wxml 4 pages/book/smsbatch/index.wxml
  5 + <formids url="./update?seller_id={{seller_id}}&hasScene={{hasScene}}">立即创建</formids>
5 <userinfo>发送</userinfo> 6 <userinfo>发送</userinfo>
6 </view> 7 </view>
  1 +// pages/book/smsbatch/update.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + form:{},
  12 + total:0,
  13 + },
  14 + reservePhonesMap:[],
  15 + reservePhones:[],
  16 + /**
  17 + * 生命周期函数--监听页面加载
  18 + */
  19 + onLoad: function (options) {
  20 +
  21 + App.Reserve.GetReservePhones({sid:options.seller_id}).then(res=>{
  22 + //this.reservePhones=res.data;
  23 + if(res.data.length>0){
  24 + let reservePhonesMap=[];
  25 + let reservePhones=[];
  26 + res.data.forEach(m=>{
  27 + if(/1[3-9]{1}[\d]{9}/.test(m.phone)){
  28 + reservePhonesMap.push(m);
  29 + reservePhones.push(m.phone);
  30 + }
  31 + })
  32 + this.setData({
  33 + total:reservePhones.length
  34 + })
  35 + }
  36 + })
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面初次渲染完成
  41 + */
  42 + onReady: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面显示
  48 + */
  49 + onShow: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 生命周期函数--监听页面隐藏
  55 + */
  56 + onHide: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 生命周期函数--监听页面卸载
  62 + */
  63 + onUnload: function () {
  64 +
  65 + },
  66 +
  67 + /**
  68 + * 页面相关事件处理函数--监听用户下拉动作
  69 + */
  70 + onPullDownRefresh: function () {
  71 +
  72 + },
  73 +
  74 + /**
  75 + * 页面上拉触底事件的处理函数
  76 + */
  77 + onReachBottom: function () {
  78 +
  79 + },
  80 +
  81 + /**
  82 + * 用户点击右上角分享
  83 + */
  84 + onShareAppMessage: function () {
  85 +
  86 + },
  87 + formValue(e){
  88 + let key=util.attr(e,'key');
  89 + let form=this.data.form;
  90 + form[key]=util.val(e);
  91 + this.setData({
  92 + form:form,
  93 + })
  94 + },
  95 + submit(){
  96 + let param={
  97 +
  98 + }
  99 + App.Reserve.SmsBatchUpdate(param);
  100 + },
  101 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "userinfo":"/components/userinfo/userinfo",
  7 + "nav":"/components/nav/nav",
  8 + "formids":"/components/formids/formids"
  9 + }
  10 +
  11 +}
  1 +<!--pages/book/smsbatch/update.wxml-->
  2 +<nav id="nav" hasHome>短信营销</nav>
  3 +<view class="page">
  4 + <view>会员({{total}})人</view>
  5 + <textarea bindinput="formValue" data-key="send_msg" placeholder="短信内容"></textarea>
  6 + <input placeholder="姓名" bindinput="formValue" data-key="name"/>
  7 + <input placeholder="电话" bindinput="formValue" data-key="phone" type="number"/>
  8 + <button bindtap="submit">提交</button>
  9 +</view>
  1 +/* pages/book/smsbatch/update.wxss */
  2 +.page{
  3 + width: 90%;
  4 + margin: 0 auto;
  5 + color: #353535;
  6 + padding-top: 28rpx;
  7 + font-size: 30rpx;
  8 + color: #353535;
  9 +}
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 26, 33 + "current": 27,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -234,6 +234,12 @@ @@ -234,6 +234,12 @@
234 "name": "pages/book/smsbatch/index", 234 "name": "pages/book/smsbatch/index",
235 "pathName": "pages/book/smsbatch/index", 235 "pathName": "pages/book/smsbatch/index",
236 "query": "seller_id=80" 236 "query": "seller_id=80"
  237 + },
  238 + {
  239 + "id": -1,
  240 + "name": "pages/book/smsbatch/update",
  241 + "pathName": "pages/book/smsbatch/update",
  242 + "query": "seller_id=80"
237 } 243 }
238 ] 244 ]
239 } 245 }
1 export default { 1 export default {
2 - //示例,JS接口名,和服务端接口名称保持一致  
3 - 'App.TestManagement.Test':{  
4 - silence:true, //静默,不带loading; 默认 true 不带loading  
5 - cachetime:0, //缓存 0无,-1永久,86400秒; 默认 0 不缓存  
6 - timeout:2000, //接口超时时间,默认2s  
7 - host:'' //默认空使用04服务器,测试填写 'https://xt05.colorcun.com/?s='  
8 - },  
9 -  
10 - //预定信息详情  
11 - 'App.Reserve.Detail':{  
12 - cachetime:60,  
13 - },  
14 -  
15 - //建立预定关系  
16 - 'App.Reserve.SetRelaOpenid':{  
17 - cachetime:-1,  
18 - },  
19 -  
20 - //增加顾客信息  
21 - 'App.Reserve.AddUser':{  
22 - cachetime:-1,  
23 - },  
24 -  
25 - //邀请详情页面----设置分享信息  
26 - 'App.Reserve.SetTopicFromShare':null,  
27 -  
28 - //列表----我的日程  
29 - 'App.Reserve.GetListFromScheAndRes':{  
30 - cachetime:30,  
31 - },  
32 -  
33 - //订座详情页面----我愿意  
34 - 'App.Reserve.SetRelaSuccess':null,  
35 -  
36 - //定个座儿 获取商户信息  
37 - 'App.Reserve.SellerInfo':{  
38 - cachetime:300,  
39 - },  
40 -  
41 - //设置客户经理  
42 - 'App.Reserve.SetReserveCusman':null,  
43 -  
44 - //发送短信  
45 - 'App.SendSMS.Message':{  
46 - silence:false,  
47 - },  
48 - //手机号搜索  
49 - 'App.Reserve.GetReserveUser':null,  
50 -  
51 - //预定列表  
52 - 'App.Reserve.GetReserveList':{  
53 - silence:false,  
54 - },  
55 -  
56 - //商家列表  
57 - 'App.Reserve.SellerList':null,  
58 -  
59 - //桌位列表  
60 - 'App.Tables.GetTableListsBySellerId':{  
61 - cachetime:60,  
62 - },  
63 -  
64 - // 修改当前预定状态 0:待确认,1:已定座,2:确认到店,3:用餐完成  
65 - 'App.Reserve.SetReserveStatus':{  
66 - silence:false,  
67 - },  
68 -  
69 - //修改当前桌子是否启用 0:未启用,1:启用  
70 - 'App.Reserve.SetSwitchStatus':{  
71 - silence:false,  
72 - },  
73 -  
74 - //进行商户判断  
75 - 'App.Reserve.SellerForOpenid':null,  
76 -  
77 - //商户端账号表增加订座儿openid  
78 - 'App.Reserve.UpdateSellerUser':{  
79 - cachetime:60,  
80 - },  
81 -  
82 - //导出  
83 - 'App.Reserve.ExportReserve':{  
84 - silence:false,  
85 - },  
86 -  
87 - //查询短信剩余及套餐  
88 - 'App.Reserve.SmsInfo':{  
89 - alias:'App.SendSMS.SmsInfo',  
90 - cachetime:60,  
91 - },  
92 -  
93 - //生成支付签名接口  
94 - 'App.Reserve.SmsBuy':{  
95 - alias:'App.Pay.WxPaySub',  
96 - },  
97 -  
98 -  
99 - /**提前点餐**/  
100 - //菜品列表  
101 - 'App.Cookbook.GetCookbookByClass':null,  
102 - //菜品规格  
103 - 'App.Cookbook.GetCookbookSelBySpecsId':null,  
104 - //添加到购物车  
105 - 'App.Orders.AddCart':null,  
106 - //减菜  
107 - 'App.Orders.ReduceOrder':null,  
108 - //清空购物车  
109 - 'App.Orders.ClearCookById':null,  
110 - //购物车  
111 - 'App.Orders.GetOrderById':null, 2 + //示例,JS接口名,和服务端接口名称保持一致
  3 + 'App.TestManagement.Test': {
  4 + silence: true, //静默,不带loading; 默认 true 不带loading
  5 + cachetime: 0, //缓存 0无,-1永久,86400秒; 默认 0 不缓存
  6 + timeout: 2000, //接口超时时间,默认2s
  7 + host: '' //默认空使用04服务器,测试填写 'https://xt05.colorcun.com/?s='
  8 + },
  9 +
  10 + //预定信息详情
  11 + 'App.Reserve.Detail': {
  12 + cachetime: 60,
  13 + },
  14 +
  15 + //建立预定关系
  16 + 'App.Reserve.SetRelaOpenid': {
  17 + cachetime: -1,
  18 + },
  19 +
  20 + //增加顾客信息
  21 + 'App.Reserve.AddUser': {
  22 + cachetime: -1,
  23 + },
  24 +
  25 + //邀请详情页面----设置分享信息
  26 + 'App.Reserve.SetTopicFromShare': null,
  27 +
  28 + //列表----我的日程
  29 + 'App.Reserve.GetListFromScheAndRes': {
  30 + cachetime: 30,
  31 + },
  32 +
  33 + //订座详情页面----我愿意
  34 + 'App.Reserve.SetRelaSuccess': null,
  35 +
  36 + //定个座儿 获取商户信息
  37 + 'App.Reserve.SellerInfo': {
  38 + cachetime: 300,
  39 + },
  40 +
  41 + //设置客户经理
  42 + 'App.Reserve.SetReserveCusman': null,
  43 +
  44 + //发送短信
  45 + 'App.SendSMS.Message': {
  46 + silence: false,
  47 + },
  48 + //手机号搜索
  49 + 'App.Reserve.GetReserveUser': null,
  50 +
  51 + //预定列表
  52 + 'App.Reserve.GetReserveList': {
  53 + silence: false,
  54 + },
  55 +
  56 + //商家列表
  57 + 'App.Reserve.SellerList': null,
  58 +
  59 + //桌位列表
  60 + 'App.Tables.GetTableListsBySellerId': {
  61 + cachetime: 60,
  62 + },
  63 +
  64 + // 修改当前预定状态 0:待确认,1:已定座,2:确认到店,3:用餐完成
  65 + 'App.Reserve.SetReserveStatus': {
  66 + silence: false,
  67 + },
  68 +
  69 + //修改当前桌子是否启用 0:未启用,1:启用
  70 + 'App.Reserve.SetSwitchStatus': {
  71 + silence: false,
  72 + },
  73 +
  74 + //进行商户判断
  75 + 'App.Reserve.SellerForOpenid': null,
  76 +
  77 + //商户端账号表增加订座儿openid
  78 + 'App.Reserve.UpdateSellerUser': {
  79 + cachetime: 60,
  80 + },
  81 +
  82 + //导出
  83 + 'App.Reserve.ExportReserve': {
  84 + silence: false,
  85 + },
  86 +
  87 + //查询短信剩余及套餐
  88 + 'App.Reserve.SmsInfo': {
  89 + alias: 'App.SendSMS.SmsInfo',
  90 + cachetime: 60,
  91 + },
  92 +
  93 + //生成支付签名接口
  94 + 'App.Reserve.SmsBuy': {
  95 + alias: 'App.Pay.WxPaySub',
  96 + },
  97 +
  98 + /**短信营销**/
  99 + //App.Reserve.SmsBatchUpdate 新增或编辑短信
  100 + 'App.Reserve.SmsBatchUpdate': null,
  101 + //App.Reserve.SmsBatchList 营销短信列表
  102 + 'App.Reserve.SmsBatchList': null,
  103 + //App.Reserve.SmsBatchInfo 营销短信详细
  104 + 'App.Reserve.SmsBatchInfo': null,
  105 + //App.Reserve.GetReservePhones 获取可发短信的客户列表
  106 + 'App.Reserve.GetReservePhones': null,
  107 + //App.Reserve.SmsBatchSend 短信发送
  108 + 'App.Reserve.SmsBatchSend': null,
  109 +
  110 + /**提前点餐**/
  111 + //菜品列表
  112 + 'App.Cookbook.GetCookbookByClass': null,
  113 + //菜品规格
  114 + 'App.Cookbook.GetCookbookSelBySpecsId': null,
  115 + //添加到购物车
  116 + 'App.Orders.AddCart': null,
  117 + //减菜
  118 + 'App.Orders.ReduceOrder': null,
  119 + //清空购物车
  120 + 'App.Orders.ClearCookById': null,
  121 + //购物车
  122 + 'App.Orders.GetOrderById': null,
112 } 123 }