From 317b55b89055c27d447394b5707b0e11664776d8 Mon Sep 17 00:00:00 2001 From: DESKTOP-QHAFKU5\iceling Date: Wed, 4 Dec 2019 17:48:03 +0800 Subject: [PATCH] 预约模板发送 --- pages/user/my_service/appment_main.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- pages/user/my_service/appment_main.wxml | 4 ++-- pages/user/my_service/i_service.js | 1 - 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/pages/user/my_service/appment_main.js b/pages/user/my_service/appment_main.js index 6916ba4..14dd47e 100644 --- a/pages/user/my_service/appment_main.js +++ b/pages/user/my_service/appment_main.js @@ -47,13 +47,29 @@ Page({ }, //控制备注输入 check_text: function() { + wx.requestSubscribeMessage({ + tmplIds: ['Jg7Tj-wPlDfsairz_EHBQdoQnzLLF4nVhT1weCBEmTE'], + success(res) { + console.log("222222222222222222222222222222"); + }, + + fail(res) { + + console.log('fail 失败') + + console.log(res) + + logger.warn('订阅消息fail', res) + + } + }) + var th = this; var is_textea = th.data.is_textea; th.setData({ is_textea: 1, beautician: 0 }) - }, onclickstore: function() { var th = this; @@ -82,13 +98,12 @@ Page({ remarks: remarks }) }, - //提交预约 - sub_success: function(e) { + //提交成功及发送模版代码 + success: function() { var th = this; th.setData({ is_textea: 0 }) - var formid = e.detail.formId; //发送预约成功模版信息 var store = th.data.store_name; //门店名称 var bea_name = th.data.beautician_name; //美容师名称 var time = th.data.time; //预约时间 @@ -149,11 +164,11 @@ Page({ getApp().my_warnning("预约成功", 1, th); var store_name = th.data.store_name; //预约门店 var number = res.data.data.Number; - var temp_url = "/api/wx/open/app/user/templatMessageSend"; //模版接口 + var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 var userinfo = getApp().globalData.userInfo; var name = d.userInfo.nickname; var json = { - "formId": formid, + // "formId": formid, "keyWord": [{ "keyword": res.data.data.ServiceName }, @@ -199,10 +214,41 @@ Page({ } } }, + //提交预约 + sub_success: function(e) { + var th = this; + var temp_url = "/api/wx/weappSendlist/page"; + var template_id = ""; + //获取模版id + getApp().request.promiseGet(temp_url, { + data: { + store_id: a.stoid, + typeid: "1011" + } + }).then(res => { + if (res.data.code == 0) { + template_id = res.data.data.pageData[0].template_id; + // //授权订阅 + wx.requestSubscribeMessage({ + tmplIds: [template_id], + success(res) { + th.success(); + }, + fail(res) { + th.success(); + } + }) + }else{ + th.success(); + } + }) + + }, goto: function(e) { var th = this; th.setData({ - beautician: 0 + beautician: 0, + is_textea: 0 }) if (th.data.store_name == "") { getApp().my_warnning("请选择服务门店", 0, th); diff --git a/pages/user/my_service/appment_main.wxml b/pages/user/my_service/appment_main.wxml index 7013609..9621fce 100644 --- a/pages/user/my_service/appment_main.wxml +++ b/pages/user/my_service/appment_main.wxml @@ -68,7 +68,7 @@ - + @@ -87,7 +87,7 @@ 我的预约 -
+ diff --git a/pages/user/my_service/i_service.js b/pages/user/my_service/i_service.js index 2c9e854..6796f87 100644 --- a/pages/user/my_service/i_service.js +++ b/pages/user/my_service/i_service.js @@ -32,7 +32,6 @@ Page({ var userinfo = getApp().globalData.userInfo; if (userinfo == null) { //界面必须使用warn 做ID,并调用 - getApp().my_warnning("会员为空", 0, this); return false; } this.setData({ -- libgit2 0.21.4