Commit 49e7ddd48c254481669d8c7e7784ce8397caa5ff
1 parent
ea72eafe
提交预约bug修复
Showing
1 changed file
with
126 additions
and
117 deletions
pages/user/my_service/appment_main.js
| ... | ... | @@ -88,122 +88,104 @@ Page({ |
| 88 | 88 | var th = this; |
| 89 | 89 | var store = th.data.store_name; //门店名称 |
| 90 | 90 | var bea_name = th.data.beautician_name; //美容师名称 |
| 91 | - var time = th.data.time + ":00"; //预约时间 | |
| 91 | + var time = th.data.time; //预约时间 | |
| 92 | 92 | var is_sub = th.data.is_sub; //是否重复提交 |
| 93 | - //提交预约前的判断 | |
| 94 | - if (store == "") { | |
| 95 | - getApp().my_warnning("请选择服务门店", 0, th); | |
| 96 | - th.settime(); | |
| 97 | - return false; | |
| 98 | - } else if (bea_name == "") { | |
| 99 | - getApp().my_warnning("请选择美容师", 0, th); | |
| 100 | - th.settime(); | |
| 101 | - return false; | |
| 102 | - } else if (time == "") { | |
| 103 | - getApp().my_warnning("请选择预约时间", 0, th); | |
| 104 | - th.settime(); | |
| 105 | - return false; | |
| 106 | - } else { | |
| 107 | - wx.showLoading({ | |
| 108 | - title: '加载中', | |
| 109 | - }) | |
| 110 | - var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 | |
| 111 | - var serviceId = th.data.itemId; //服务id | |
| 112 | - var beauticianID = th.data.beauticianID; //美容师id | |
| 113 | - var buyType = th.data.buyType; //服务项目类型 | |
| 114 | - var storeId = a.stoid; //商家id | |
| 115 | - var storageId = th.data.storageId; //门店id | |
| 116 | - var userId = d.user_id; //用户id | |
| 117 | - var remarks = th.data.remarks; //用户备注 | |
| 118 | - var project_id = th.data.project_id; //项目id | |
| 119 | - var validay = th.data.validay; | |
| 120 | - var json = { | |
| 121 | - "arrangeTime": time, | |
| 122 | - "beauticianId": beauticianID, | |
| 123 | - "buyType": buyType, | |
| 124 | - "effectiveDay": "", | |
| 125 | - "number": "", | |
| 126 | - "projectId": project_id, | |
| 127 | - "remark": remarks, | |
| 128 | - "serviceId": serviceId, | |
| 129 | - "states": 0, | |
| 130 | - "storageId": storageId, | |
| 131 | - "storeId": storeId, | |
| 132 | - "userId": userId, | |
| 133 | - "validay": validay | |
| 134 | - } | |
| 135 | - var data = JSON.stringify(json); | |
| 136 | - wx.request({ | |
| 137 | - url: url, | |
| 138 | - data: json, | |
| 139 | - method: 'post', | |
| 140 | - header: { | |
| 141 | - 'content-type': 'application/json' | |
| 142 | - }, // 设置请求的 header | |
| 143 | - success: function(res) { | |
| 144 | - th.setData({ | |
| 145 | - is_sub: 0 | |
| 93 | + wx.showLoading({ | |
| 94 | + title: '加载中', | |
| 95 | + }) | |
| 96 | + var url = th.data.inurl + "/api/weshop/marketing/reservation/reservation/insert"; //接口路径 | |
| 97 | + var serviceId = th.data.itemId; //服务id | |
| 98 | + var beauticianID = th.data.beauticianID; //美容师id | |
| 99 | + var buyType = th.data.buyType; //服务项目类型 | |
| 100 | + var storeId = a.stoid; //商家id | |
| 101 | + var storageId = th.data.storageId; //门店id | |
| 102 | + var userId = d.user_id; //用户id | |
| 103 | + var remarks = th.data.remarks; //用户备注 | |
| 104 | + var project_id = th.data.project_id; //项目id | |
| 105 | + var validay = th.data.validay; | |
| 106 | + var json = { | |
| 107 | + "arrangeTime": time + ":00", | |
| 108 | + "beauticianId": beauticianID, | |
| 109 | + "buyType": buyType, | |
| 110 | + "effectiveDay": "", | |
| 111 | + "number": "", | |
| 112 | + "projectId": project_id, | |
| 113 | + "remark": remarks, | |
| 114 | + "serviceId": serviceId, | |
| 115 | + "states": 0, | |
| 116 | + "storageId": storageId, | |
| 117 | + "storeId": storeId, | |
| 118 | + "userId": userId, | |
| 119 | + "validay": validay | |
| 120 | + } | |
| 121 | + var data = JSON.stringify(json); | |
| 122 | + wx.request({ | |
| 123 | + url: url, | |
| 124 | + data: json, | |
| 125 | + method: 'post', | |
| 126 | + header: { | |
| 127 | + 'content-type': 'application/json' | |
| 128 | + }, // 设置请求的 header | |
| 129 | + success: function(res) { | |
| 130 | + th.setData({ | |
| 131 | + is_sub: 0 | |
| 132 | + }) | |
| 133 | + wx.hideLoading(); | |
| 134 | + if (res.data.code == 0) { | |
| 135 | + getApp().my_warnning("预约成功", 1, th); | |
| 136 | + var store_name = th.data.store_name; //预约门店 | |
| 137 | + var number = res.data.data.Number; | |
| 138 | + var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 | |
| 139 | + var userinfo = getApp().globalData.userInfo; | |
| 140 | + var name = d.userInfo.nickname; | |
| 141 | + var json = { | |
| 142 | + // "formId": formid, | |
| 143 | + "keyWord": [{ | |
| 144 | + "keyword": res.data.data.ServiceName | |
| 145 | + }, | |
| 146 | + { | |
| 147 | + "keyword": time.substring(0, 16) | |
| 148 | + }, { | |
| 149 | + "keyword": res.data.data.BeauticianName | |
| 150 | + }, { | |
| 151 | + "keyword": res.data.data.StorageName | |
| 152 | + }, { | |
| 153 | + "keyword": res.data.data.Address | |
| 154 | + } | |
| 155 | + ], | |
| 156 | + "page": "/pages/user/my_service/tment_details?number=" + number, | |
| 157 | + "storeId": a.stoid, | |
| 158 | + "typeId": "1011", | |
| 159 | + "userId": d.user_id | |
| 160 | + }; | |
| 161 | + var data = JSON.stringify(json); | |
| 162 | + //调用发送预约成功模版接口 | |
| 163 | + wx.request({ | |
| 164 | + url: th.data.inurl + temp_url, | |
| 165 | + data: data, | |
| 166 | + method: 'post', | |
| 167 | + header: { | |
| 168 | + 'content-type': 'application/json' | |
| 169 | + }, // 设置请求的 header | |
| 170 | + success: function(data) {} | |
| 146 | 171 | }) |
| 147 | - wx.hideLoading(); | |
| 148 | - if (res.data.code == 0) { | |
| 149 | - getApp().my_warnning("预约成功", 1, th); | |
| 150 | - var store_name = th.data.store_name; //预约门店 | |
| 151 | - var number = res.data.data.Number; | |
| 152 | - var temp_url = "/api/wx/open/app/user/sendSubscribeMsg"; //模版接口 | |
| 153 | - var userinfo = getApp().globalData.userInfo; | |
| 154 | - var name = d.userInfo.nickname; | |
| 155 | - var json = { | |
| 156 | - // "formId": formid, | |
| 157 | - "keyWord": [{ | |
| 158 | - "keyword": res.data.data.ServiceName | |
| 159 | - }, | |
| 160 | - { | |
| 161 | - "keyword": time.substring(0, 16) | |
| 162 | - }, { | |
| 163 | - "keyword": res.data.data.BeauticianName | |
| 164 | - }, { | |
| 165 | - "keyword": res.data.data.StorageName | |
| 166 | - }, { | |
| 167 | - "keyword": res.data.data.Address | |
| 168 | - } | |
| 169 | - ], | |
| 170 | - "page": "/pages/user/my_service/tment_details?number=" + number, | |
| 171 | - "storeId": a.stoid, | |
| 172 | - "typeId": "1011", | |
| 173 | - "userId": d.user_id | |
| 174 | - }; | |
| 175 | - var data = JSON.stringify(json); | |
| 176 | - //调用发送预约成功模版接口 | |
| 177 | - wx.request({ | |
| 178 | - url: th.data.inurl + temp_url, | |
| 179 | - data: data, | |
| 180 | - method: 'post', | |
| 181 | - header: { | |
| 182 | - 'content-type': 'application/json' | |
| 183 | - }, // 设置请求的 header | |
| 184 | - success: function(data) {} | |
| 185 | - }) | |
| 186 | - setTimeout(function() { | |
| 187 | - wx.redirectTo({ | |
| 188 | - url: "/pages/user/my_service/tment_details?number=" + number | |
| 189 | - }); | |
| 190 | - }, 1000); | |
| 191 | - } else { | |
| 192 | - getApp().my_warnning(res.data.msg, 0, th); | |
| 193 | - th.settime(); | |
| 194 | - th.setData({ | |
| 195 | - is_sub: 0 | |
| 196 | - }) | |
| 197 | - } | |
| 172 | + setTimeout(function() { | |
| 173 | + wx.redirectTo({ | |
| 174 | + url: "/pages/user/my_service/tment_details?number=" + number | |
| 175 | + }); | |
| 176 | + }, 1000); | |
| 177 | + } else { | |
| 178 | + getApp().my_warnning(res.data.msg, 0, th); | |
| 179 | + th.settime(); | |
| 198 | 180 | } |
| 199 | - }) | |
| 200 | - } | |
| 181 | + } | |
| 182 | + }) | |
| 201 | 183 | |
| 202 | 184 | }, |
| 203 | 185 | //定时显示texteat |
| 204 | - settime:function(){ | |
| 186 | + settime: function() { | |
| 205 | 187 | var th = this; |
| 206 | - setTimeout(function () { | |
| 188 | + setTimeout(function() { | |
| 207 | 189 | th.setData({ |
| 208 | 190 | is_textea: 1 |
| 209 | 191 | }) |
| ... | ... | @@ -217,10 +199,28 @@ Page({ |
| 217 | 199 | if (th.data.is_sub == 1) { |
| 218 | 200 | return false; |
| 219 | 201 | } |
| 202 | + var store = th.data.store_name; //门店名称 | |
| 203 | + var bea_name = th.data.beautician_name; //美容师名称 | |
| 204 | + var time = th.data.time; //预约时间 | |
| 205 | + var is_sub = th.data.is_sub; //是否重复提交 | |
| 220 | 206 | th.setData({ |
| 221 | 207 | is_textea: 0, |
| 222 | 208 | is_sub: 1 |
| 223 | 209 | }) |
| 210 | + //提交预约前的判断 | |
| 211 | + if (store == "") { | |
| 212 | + getApp().my_warnning("请选择服务门店", 0, th); | |
| 213 | + th.settime(); | |
| 214 | + return false; | |
| 215 | + } else if (bea_name == "") { | |
| 216 | + getApp().my_warnning("请选择美容师", 0, th); | |
| 217 | + th.settime(); | |
| 218 | + return false; | |
| 219 | + } else if (time == "") { | |
| 220 | + getApp().my_warnning("请选择预约时间", 0, th); | |
| 221 | + th.settime(); | |
| 222 | + return false; | |
| 223 | + }else{ | |
| 224 | 224 | //获取模版id |
| 225 | 225 | getApp().request.promiseGet(temp_url, { |
| 226 | 226 | data: { |
| ... | ... | @@ -228,23 +228,29 @@ Page({ |
| 228 | 228 | typeid: "1011" |
| 229 | 229 | } |
| 230 | 230 | }).then(res => { |
| 231 | - if (res.data.code == 0 && res.data.data.pageData.length>0) { | |
| 231 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | |
| 232 | 232 | template_id = res.data.data.pageData[0].template_id; |
| 233 | 233 | // //授权订阅 |
| 234 | 234 | wx.requestSubscribeMessage({ |
| 235 | 235 | tmplIds: [template_id], |
| 236 | - success(res) { th.success();}, | |
| 237 | - fail(res) { th.success();} | |
| 236 | + success(res) { | |
| 237 | + th.success(); | |
| 238 | + }, | |
| 239 | + fail(res) { | |
| 240 | + th.success(); | |
| 241 | + } | |
| 238 | 242 | }) |
| 239 | 243 | } else { |
| 240 | 244 | th.success(); |
| 241 | 245 | } |
| 242 | 246 | }) |
| 247 | + } | |
| 243 | 248 | }, |
| 244 | 249 | goto: function(e) { |
| 245 | 250 | var th = this; |
| 246 | 251 | th.setData({ |
| 247 | - beautician: 0 | |
| 252 | + beautician: 0, | |
| 253 | + is_textea: 0 | |
| 248 | 254 | }) |
| 249 | 255 | if (th.data.store_name == "") { |
| 250 | 256 | getApp().my_warnning("请选择服务门店", 0, th); |
| ... | ... | @@ -253,6 +259,9 @@ Page({ |
| 253 | 259 | getApp().my_warnning("请选择美容师", 0, th); |
| 254 | 260 | th.settime(); |
| 255 | 261 | } else { |
| 262 | + th.setData({ | |
| 263 | + is_textea: 1 | |
| 264 | + }) | |
| 256 | 265 | var url = e.currentTarget.dataset.url; |
| 257 | 266 | getApp().goto(url); |
| 258 | 267 | } |
| ... | ... | @@ -284,7 +293,7 @@ Page({ |
| 284 | 293 | store: 0, |
| 285 | 294 | store_name: store_name, |
| 286 | 295 | storageId: Id, |
| 287 | - is_textea:1 | |
| 296 | + is_textea: 1 | |
| 288 | 297 | }) |
| 289 | 298 | }, |
| 290 | 299 | onReachBottom: function() { |
| ... | ... | @@ -449,7 +458,7 @@ Page({ |
| 449 | 458 | wx.navigateTo({ |
| 450 | 459 | url: "/pages/user/my_service/cosmetology_list?" + 'storageId=' + storageId + '&' + 'itemId=' + itemId + '&' + "projectId=" + project_id |
| 451 | 460 | }); |
| 452 | - | |
| 461 | + | |
| 453 | 462 | } |
| 454 | 463 | }, |
| 455 | 464 | /** |
| ... | ... | @@ -533,7 +542,7 @@ Page({ |
| 533 | 542 | } |
| 534 | 543 | th.setData({ |
| 535 | 544 | time: th.data.time.substring(0, 16), |
| 536 | - is_textea:1 | |
| 545 | + is_textea: 1 | |
| 537 | 546 | }) |
| 538 | 547 | th.query_project(); |
| 539 | 548 | }, |
| ... | ... | @@ -554,7 +563,7 @@ Page({ |
| 554 | 563 | validay: res.data.data.pageData[0].Validay |
| 555 | 564 | }) |
| 556 | 565 | } else { |
| 557 | - getApp().my_warnning(res.data.msg, 0, th); | |
| 566 | + getApp().my_warnning(res.data.msg, 0, th); | |
| 558 | 567 | th.settime(); |
| 559 | 568 | } |
| 560 | 569 | }) | ... | ... |