Showing
6 changed files
with
1398 additions
and
2206 deletions
Too many changes to show.
To preserve performance only 6 of 6+ files are displayed.
| 1 | +// 公共方法:由 detail_owner_invitation2~13 中代码级一致的方法抽取,页面内请勿再重复定义同名方法 | ||
| 2 | +// 页面用法:import inviteBase from '../common/inviteBase'; Page({ ...inviteBase, ...页面配置 }) | ||
| 3 | +import util from '../../utils/util'; | ||
| 4 | +import App from '../../utils/api'; | ||
| 5 | +import canvas from '../../pages/customer/canvas'; | ||
| 6 | +const plugin = requirePlugin("WechatSI"); | ||
| 7 | + | ||
| 8 | +export default { | ||
| 9 | + // 获取所有的券并且展示(2-13页面) | ||
| 10 | + addCoupons(coupons, couponList) { | ||
| 11 | + if (coupons && util.getType(coupons) == 'object') { | ||
| 12 | + couponList.push({ | ||
| 13 | + id: coupons.id, | ||
| 14 | + number: coupons.number | ||
| 15 | + }); | ||
| 16 | + } | ||
| 17 | + if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) { | ||
| 18 | + coupons.forEach(item => { | ||
| 19 | + couponList.push({ | ||
| 20 | + id: item.id, | ||
| 21 | + number: item.number | ||
| 22 | + }); | ||
| 23 | + }); | ||
| 24 | + } | ||
| 25 | + return couponList | ||
| 26 | + }, | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + // 持续旋转动画(2-13页面) | ||
| 31 | + animation() { | ||
| 32 | + let that = this; | ||
| 33 | + var time = setInterval(function () { | ||
| 34 | + this.n = this.n + 1; | ||
| 35 | + let attentionAnim = that.data._attentionAnim | ||
| 36 | + attentionAnim.rotate(180 * (this.n)).step() | ||
| 37 | + that.setData({ | ||
| 38 | + attentionAnim: attentionAnim.export(), | ||
| 39 | + }) | ||
| 40 | + }.bind(this), 1000) | ||
| 41 | + this.timers = time; | ||
| 42 | + }, | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + // 拨打电话(2-13页面) | ||
| 47 | + call(e) { | ||
| 48 | + const phone = e.currentTarget.dataset['phone']; | ||
| 49 | + wx.reportMonitor('1012', 1) | ||
| 50 | + wx.makePhoneCall({ | ||
| 51 | + phoneNumber: phone | ||
| 52 | + }) | ||
| 53 | + }, | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + // 关闭优惠券弹框(更新已被领取数量)(2-13页面) | ||
| 58 | + closeCouponModal() { | ||
| 59 | + this.getActivityByIdFun(this.data.couponList, '1') | ||
| 60 | + this.couponModal.closeModal() | ||
| 61 | + this.setData({ | ||
| 62 | + isShow: '1', | ||
| 63 | + }) | ||
| 64 | + setTimeout(() => { | ||
| 65 | + this.startAnimation(); | ||
| 66 | + }, 800); | ||
| 67 | + }, | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + // 关闭截屏弹框(2-13页面) | ||
| 72 | + closeModal() { | ||
| 73 | + this.modal.closeModal() | ||
| 74 | + }, | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + | ||
| 78 | + // 复制微信号(2-13页面) | ||
| 79 | + copyWeChat() { | ||
| 80 | + if (this.data.staffinfo.wechat) { | ||
| 81 | + wx.setClipboardData({ | ||
| 82 | + data: this.data.staffinfo.wechat, | ||
| 83 | + success(res) { | ||
| 84 | + wx.getClipboardData({ | ||
| 85 | + success(res) { | ||
| 86 | + console.log(res.data) // data | ||
| 87 | + } | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + }) | ||
| 91 | + } else { | ||
| 92 | + console.log('无微信号') | ||
| 93 | + } | ||
| 94 | + }, | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + | ||
| 98 | + // 获取日期对应的时段(2-13页面) | ||
| 99 | + getLocalLunchTime(lite_style) { | ||
| 100 | + let detail = this.data.detail; | ||
| 101 | + let ddateStr = new Date(detail.ddate * 1000); | ||
| 102 | + let year = ddateStr.getFullYear(); | ||
| 103 | + let month = ddateStr.getMonth() + 1; | ||
| 104 | + let day = ddateStr.getDate(); | ||
| 105 | + let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); | ||
| 106 | + App.Seller.getMealSectionByDay({ | ||
| 107 | + sellerid: detail.seller.id, | ||
| 108 | + day: day1, | ||
| 109 | + }).then(res => { | ||
| 110 | + let data = res.data; | ||
| 111 | + let lunchDinnerList = []; | ||
| 112 | + let isMany = '0'; //0默认餐段 1多时段 | ||
| 113 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 114 | + isMany = '0'; | ||
| 115 | + data.forEach(i => { | ||
| 116 | + if (i.mname == '早餐') { | ||
| 117 | + lunchDinnerList.push({ | ||
| 118 | + mname: "早餐", | ||
| 119 | + mdate: i.mdate, | ||
| 120 | + ddate_solt: 1, | ||
| 121 | + }) | ||
| 122 | + } | ||
| 123 | + if (i.mname == '午餐') { | ||
| 124 | + lunchDinnerList.push({ | ||
| 125 | + mname: "午餐", | ||
| 126 | + mdate: i.mdate, | ||
| 127 | + ddate_solt: 2, | ||
| 128 | + }) | ||
| 129 | + } | ||
| 130 | + if (i.mname == '晚餐') { | ||
| 131 | + lunchDinnerList.push({ | ||
| 132 | + mname: "晚餐", | ||
| 133 | + mdate: i.mdate, | ||
| 134 | + ddate_solt: 3, | ||
| 135 | + }) | ||
| 136 | + } | ||
| 137 | + }) | ||
| 138 | + } else { | ||
| 139 | + isMany = '1'; | ||
| 140 | + lunchDinnerList = data; | ||
| 141 | + } | ||
| 142 | + let obj = lunchDinnerList.filter(i => { | ||
| 143 | + return i.ddate_solt == detail.ddate_solt | ||
| 144 | + }) | ||
| 145 | + var timeList = []; | ||
| 146 | + if (obj && obj.length > 0) { | ||
| 147 | + var time = obj[0].mdate.split("-"); | ||
| 148 | + timeList = this.computeHour(time[0], time[1], 15); | ||
| 149 | + } | ||
| 150 | + this.setData({ | ||
| 151 | + timeList, | ||
| 152 | + isMany, | ||
| 153 | + }) | ||
| 154 | + // 获取转发客人卡片设置 | ||
| 155 | + let lite = lite_style || '3'; | ||
| 156 | + let liteStyle = lite.split('-'); | ||
| 157 | + if (liteStyle[0] == '0') { | ||
| 158 | + this.setData({ | ||
| 159 | + imgSrc: detail.seller.seller_image | ||
| 160 | + }) | ||
| 161 | + } else { | ||
| 162 | + this.painterBtn(lite); | ||
| 163 | + } | ||
| 164 | + }).catch(res => { | ||
| 165 | + console.log(res, '获取多时段失败'); | ||
| 166 | + }) | ||
| 167 | + }, | ||
| 168 | + | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + // 点击了解更多会员优惠政策(2-13页面) | ||
| 172 | + gotoFavourableList() { | ||
| 173 | + let url = util.http_build_query({ | ||
| 174 | + sellerName: this.data.seller.name, | ||
| 175 | + sellerid: this.data.seller.sid, | ||
| 176 | + oid: this.data.detail.id, | ||
| 177 | + types: '1' | ||
| 178 | + }, '/pack-cookbook/pages/favourableList') | ||
| 179 | + wx.navigateTo({ | ||
| 180 | + url | ||
| 181 | + }) | ||
| 182 | + }, | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + | ||
| 186 | + // 处理优惠券不可用日期数据(2-13页面) | ||
| 187 | + hasConsecutiveSelect(arr, type) { | ||
| 188 | + let firstTitle = null; | ||
| 189 | + let lastTitle = null; | ||
| 190 | + let rArr = [] | ||
| 191 | + let num = 0 | ||
| 192 | + for (let i = 0; i < arr.length; i++) { | ||
| 193 | + let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : ''; | ||
| 194 | + if (str) { | ||
| 195 | + rArr.push(arr[i].title) | ||
| 196 | + num++ | ||
| 197 | + if (num == 1) { | ||
| 198 | + firstTitle = arr[i].title | ||
| 199 | + } | ||
| 200 | + if (num >= 5) { | ||
| 201 | + lastTitle = arr[i].title | ||
| 202 | + } | ||
| 203 | + if (num >= 5 && i >= (arr.length - 1)) { | ||
| 204 | + let fi = rArr.findIndex((item) => { | ||
| 205 | + return item == firstTitle | ||
| 206 | + }) | ||
| 207 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 208 | + num = 0 | ||
| 209 | + } | ||
| 210 | + } else { | ||
| 211 | + if (num < 5) { | ||
| 212 | + num = 0 | ||
| 213 | + firstTitle = null; | ||
| 214 | + lastTitle = null; | ||
| 215 | + } else { | ||
| 216 | + let fi = rArr.findIndex((item) => { | ||
| 217 | + return item == firstTitle | ||
| 218 | + }) | ||
| 219 | + rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 220 | + num = 0 | ||
| 221 | + } | ||
| 222 | + } | ||
| 223 | + } | ||
| 224 | + return { | ||
| 225 | + rArr, | ||
| 226 | + lastTitle, | ||
| 227 | + firstTitle | ||
| 228 | + }; | ||
| 229 | + }, | ||
| 230 | + | ||
| 231 | + | ||
| 232 | + | ||
| 233 | + // 预览其他图片(2-13页面) | ||
| 234 | + lookImgs(e) { | ||
| 235 | + const url = e.currentTarget.dataset['url']; | ||
| 236 | + const imgs = e.currentTarget.dataset['imgs']; | ||
| 237 | + let urls = imgs ? imgs : [url] | ||
| 238 | + wx.previewImage({ | ||
| 239 | + current: url, | ||
| 240 | + urls, | ||
| 241 | + }) | ||
| 242 | + }, | ||
| 243 | + | ||
| 244 | + | ||
| 245 | + | ||
| 246 | + /** | ||
| 247 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 248 | + */ | ||
| 249 | + // 使用页面:2-13页面 | ||
| 250 | + onPullDownRefresh() { | ||
| 251 | + | ||
| 252 | + }, | ||
| 253 | + | ||
| 254 | + | ||
| 255 | + | ||
| 256 | + | ||
| 257 | + /** | ||
| 258 | + * 页面上拉触底事件的处理函数 | ||
| 259 | + */ | ||
| 260 | + // 使用页面:2-13页面 | ||
| 261 | + onReachBottom() { | ||
| 262 | + | ||
| 263 | + }, | ||
| 264 | + | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + /** | ||
| 268 | + * 用户点击右上角分享 | ||
| 269 | + */ | ||
| 270 | + // 使用页面:2-13页面 | ||
| 271 | + onShareAppMessage: function () { | ||
| 272 | + return this.sharesetting(); | ||
| 273 | + }, | ||
| 274 | + | ||
| 275 | + | ||
| 276 | + | ||
| 277 | + /** | ||
| 278 | + * 监听用户点击分享到朋友圈按钮的操作 | ||
| 279 | + */ | ||
| 280 | + // 使用页面:2-13页面 | ||
| 281 | + onShareTimeline() { | ||
| 282 | + return this.sharesetting(); | ||
| 283 | + }, | ||
| 284 | + | ||
| 285 | + | ||
| 286 | + | ||
| 287 | + // 生成海报(2-13页面) | ||
| 288 | + painterBtn(liteStyle, timeStr) { | ||
| 289 | + let style = liteStyle.split('-'); | ||
| 290 | + let type1 = style[0]; | ||
| 291 | + let type2 = style[1]; | ||
| 292 | + let data = this.data.detail; | ||
| 293 | + let isMany = this.data.isMany; | ||
| 294 | + let img = data.seller.seller_image.replace(/^http:/, "https:"); | ||
| 295 | + let d = data.ddate_solt; | ||
| 296 | + let date1 = util.unixtoTime(data.ddate, 'MM月DD日'); | ||
| 297 | + let date2 = util.unixtoTime(data.ddate, 'MM/DD'); | ||
| 298 | + let week = ' ' + util.unixtoTime(data.ddate, '周WW'); | ||
| 299 | + let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname); | ||
| 300 | + let timeSlot2 = ' ' + this.data.seller.soltName; | ||
| 301 | + let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II') | ||
| 302 | + time = timeStr ? timeStr : time; | ||
| 303 | + let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')] | ||
| 304 | + let section = '' | ||
| 305 | + // 老样式123 | ||
| 306 | + if (type1 && !type2 && type1 != '4') { | ||
| 307 | + section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : ''; | ||
| 308 | + } | ||
| 309 | + // 新样式 | ||
| 310 | + if (type1 && type2) { | ||
| 311 | + if (type1 == '1') { | ||
| 312 | + section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : ''; | ||
| 313 | + } | ||
| 314 | + if (type1 == '2') { | ||
| 315 | + section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : ''; | ||
| 316 | + } | ||
| 317 | + if (type1 == '3' || type1 == '4') { | ||
| 318 | + section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : ''; | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + if (type1 && !type2 && type1 == '4') { | ||
| 322 | + section = week + timeSlot2; | ||
| 323 | + } | ||
| 324 | + this.setData({ | ||
| 325 | + wxml: canvas({ | ||
| 326 | + imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', | ||
| 327 | + info: { | ||
| 328 | + sellerName: data.seller.sellername, | ||
| 329 | + date: util.unixtoTime(data.ddate, 'MM月DD日'), | ||
| 330 | + time: section, | ||
| 331 | + oneTableName: data.oneTableName, | ||
| 332 | + }, | ||
| 333 | + type1, | ||
| 334 | + type2, | ||
| 335 | + date2, | ||
| 336 | + week, | ||
| 337 | + day2, | ||
| 338 | + }) | ||
| 339 | + }) | ||
| 340 | + }, | ||
| 341 | + | ||
| 342 | + | ||
| 343 | + | ||
| 344 | + // 再次预订(2-13页面) | ||
| 345 | + secondbook() { | ||
| 346 | + wx.reportMonitor('1013', 1) | ||
| 347 | + wx.redirectTo({ | ||
| 348 | + url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id | ||
| 349 | + }) | ||
| 350 | + }, | ||
| 351 | + | ||
| 352 | + | ||
| 353 | + | ||
| 354 | + // 开启语音播报(2-13页面) | ||
| 355 | + speech() { | ||
| 356 | + var attentionAnim = wx.createAnimation({ | ||
| 357 | + duration: 1000, | ||
| 358 | + timingFunction: 'linear', | ||
| 359 | + }) | ||
| 360 | + this.attentionAnim = attentionAnim | ||
| 361 | + this.setData({ | ||
| 362 | + _attentionAnim: attentionAnim, | ||
| 363 | + attentionAnim: attentionAnim.export() | ||
| 364 | + }) | ||
| 365 | + this.audioCtx = wx.createInnerAudioContext() | ||
| 366 | + this.audioCtx.src = this.filename | ||
| 367 | + this.audioCtx.loop = true | ||
| 368 | + this.audioCtx.play() | ||
| 369 | + this.audioCtx.onPlay((e) => { | ||
| 370 | + this.setData({ | ||
| 371 | + isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 372 | + }) | ||
| 373 | + }) | ||
| 374 | + this.audioCtx.onPause((e) => { | ||
| 375 | + this.setData({ | ||
| 376 | + isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 377 | + }) | ||
| 378 | + }) | ||
| 379 | + clearInterval(this.timers) | ||
| 380 | + this.animation() | ||
| 381 | + }, | ||
| 382 | + | ||
| 383 | + | ||
| 384 | + | ||
| 385 | + // 开始倒计时(2-13页面) | ||
| 386 | + startCountDown() { | ||
| 387 | + let that = this; | ||
| 388 | + const timer = setInterval(() => { | ||
| 389 | + if (that.data.countDown <= 1) { | ||
| 390 | + that.closeCouponModal() | ||
| 391 | + clearInterval(timer); | ||
| 392 | + that.setData({ | ||
| 393 | + timer: null | ||
| 394 | + }); | ||
| 395 | + } else { | ||
| 396 | + that.setData({ | ||
| 397 | + countDown: that.data.countDown - 1 | ||
| 398 | + }); | ||
| 399 | + } | ||
| 400 | + }, 1000); | ||
| 401 | + this.setData({ | ||
| 402 | + timer | ||
| 403 | + }); | ||
| 404 | + }, | ||
| 405 | + | ||
| 406 | + | ||
| 407 | + | ||
| 408 | + // 出现商家有礼图标,并且晃动2下(2-13页面) | ||
| 409 | + startSecondAnimation() { | ||
| 410 | + const animation = wx.createAnimation({ | ||
| 411 | + duration: 200, | ||
| 412 | + timingFunction: 'ease' | ||
| 413 | + }); | ||
| 414 | + animation.scale(1).step() | ||
| 415 | + .rotate(-15).step() | ||
| 416 | + .rotate(15).step() | ||
| 417 | + .rotate(-15).step() | ||
| 418 | + .rotate(15).step() | ||
| 419 | + .rotate(0).step(); | ||
| 420 | + this.setData({ | ||
| 421 | + animationData2: animation.export() | ||
| 422 | + }); | ||
| 423 | + }, | ||
| 424 | + | ||
| 425 | + | ||
| 426 | + | ||
| 427 | + // 暂停/继续播放(2-13页面) | ||
| 428 | + stopMusic() { | ||
| 429 | + if (this.data.isPlay == '2') { // 2 暂停状态 | ||
| 430 | + console.log("开始"); | ||
| 431 | + clearInterval(this.timers) | ||
| 432 | + this.animation() | ||
| 433 | + this.audioCtx.play() //开始 | ||
| 434 | + return; | ||
| 435 | + } | ||
| 436 | + if (this.data.isPlay == '1') { // 1 运行状态 | ||
| 437 | + console.log('暂停'); | ||
| 438 | + if (this.n % 2 != 0) { | ||
| 439 | + this.n = this.n + 1; | ||
| 440 | + let attentionAnim = this.data._attentionAnim; | ||
| 441 | + attentionAnim.rotate(180 * this.n).step(); | ||
| 442 | + this.setData({ | ||
| 443 | + attentionAnim: attentionAnim.export(), | ||
| 444 | + }) | ||
| 445 | + } | ||
| 446 | + clearInterval(this.timers) | ||
| 447 | + this.audioCtx.pause() //暂停 | ||
| 448 | + return; | ||
| 449 | + } | ||
| 450 | + }, | ||
| 451 | + | ||
| 452 | + | ||
| 453 | + | ||
| 454 | + // 文字转语音的方法(2-13页面) | ||
| 455 | + textToSpeechFun(sid, reserve) { | ||
| 456 | + console.log('reservereserve-----', reserve); | ||
| 457 | + let play = (reserve && reserve.swich_voice == '1') ? '1' : '0'; | ||
| 458 | + let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : ''; | ||
| 459 | + let that = this; | ||
| 460 | + let data = this.data; | ||
| 461 | + App.Seller.GetVoiceWelcomeConfig({ | ||
| 462 | + sid | ||
| 463 | + }).then((json) => { | ||
| 464 | + let content = ''; | ||
| 465 | + // GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底 | ||
| 466 | + if (!json.data && reserve == '0') { | ||
| 467 | + json.data = { | ||
| 468 | + is_voice_welcome: 1, | ||
| 469 | + welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 470 | + invitee_same_as_reserver: 0, | ||
| 471 | + invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 472 | + is_invitee_special_enabled: 1, | ||
| 473 | + invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 474 | + special_reserve_types: ["生日宴"] | ||
| 475 | + }; | ||
| 476 | + } | ||
| 477 | + console.log('jsondata----', json.data); | ||
| 478 | + if (json.data) { | ||
| 479 | + let config = json.data; | ||
| 480 | + let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致 | ||
| 481 | + let isReserver = data.options.hasSellerShare == '1'; | ||
| 482 | + if (config.is_voice_welcome == '0') { | ||
| 483 | + content = '' | ||
| 484 | + } else if (sameAs == '1' || sameAs === 1) { | ||
| 485 | + content = config.welcome_content || ''; | ||
| 486 | + } else if (sameAs == '0' || sameAs === 0) { | ||
| 487 | + if (isReserver) { | ||
| 488 | + content = config.welcome_content || ''; | ||
| 489 | + } else { | ||
| 490 | + let specialEnabled = config.is_invitee_special_enabled == '1'; //为1被请人播特殊模板 | ||
| 491 | + let reserveType = data.detail.reserve_type || ''; | ||
| 492 | + let specialTypes = config.special_reserve_types || []; | ||
| 493 | + let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1; | ||
| 494 | + content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || ''); | ||
| 495 | + } | ||
| 496 | + } | ||
| 497 | + } else if (play == '1') { | ||
| 498 | + content = voice_info; | ||
| 499 | + } | ||
| 500 | + console.log('content---', content); | ||
| 501 | + if (!content) { | ||
| 502 | + this.setData({ | ||
| 503 | + newStr: '', | ||
| 504 | + }) | ||
| 505 | + return; | ||
| 506 | + } | ||
| 507 | + this.setData({ | ||
| 508 | + isPlay: '1', | ||
| 509 | + }) | ||
| 510 | + data.detail.rname = data.detail.rname.trim() | ||
| 511 | + let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : ''; | ||
| 512 | + let charArray = data.seller.deskStr.split(''); | ||
| 513 | + let modifiedArray = charArray.map(char => char + ' '); | ||
| 514 | + let resultString = modifiedArray.join('').slice(0, -1); | ||
| 515 | + const replacements = { | ||
| 516 | + "{店铺名}": data.seller.name, | ||
| 517 | + "{年月日}": data.seller.yearMonthDay, | ||
| 518 | + "{月日}": data.seller.yearMonth, | ||
| 519 | + "{餐段}": data.seller.soltName, | ||
| 520 | + "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide, | ||
| 521 | + "{包间名}": resultString, | ||
| 522 | + "{区域名+包间名}": data.seller.tablesText, | ||
| 523 | + "{经理名字}": data.staffinfo.name, | ||
| 524 | + "{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '', | ||
| 525 | + "{预订日期}": data.seller.yearMonthDay, | ||
| 526 | + "{桌位}": resultString, | ||
| 527 | + "{客人姓名}": data.detail.rname ? data.detail.rname : '', | ||
| 528 | + "{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 529 | + "{客人姓氏}": data.detail.rname ? data.detail.rname : '', | ||
| 530 | + "{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 531 | + "{用餐类型}": data.detail.reserve_type || '', | ||
| 532 | + }; | ||
| 533 | + let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) { | ||
| 534 | + return replacements[matched]; | ||
| 535 | + }); | ||
| 536 | + console.log('newStr---', newStr); | ||
| 537 | + this.setData({ | ||
| 538 | + newStr, | ||
| 539 | + }) | ||
| 540 | + plugin.textToSpeech({ | ||
| 541 | + lang: "zh_CN", | ||
| 542 | + tts: true, | ||
| 543 | + content: newStr, | ||
| 544 | + success: function (res) { | ||
| 545 | + that.filename = res.filename | ||
| 546 | + that.speech() | ||
| 547 | + }, | ||
| 548 | + fail: function (res) { | ||
| 549 | + console.log("fail tts", res) | ||
| 550 | + } | ||
| 551 | + }) | ||
| 552 | + }).catch((err) => { | ||
| 553 | + console.log('GetVoiceWelcomeConfig请求失败', err); | ||
| 554 | + this.setData({ | ||
| 555 | + newStr: '', | ||
| 556 | + }) | ||
| 557 | + }) | ||
| 558 | + }, | ||
| 559 | + | ||
| 560 | + | ||
| 561 | + // 跳转登录页(2-12页面) | ||
| 562 | + gotoLogin(event, type) { | ||
| 563 | + const types = type ? type : event.currentTarget.dataset.types; | ||
| 564 | + let params = { | ||
| 565 | + types, //1邀请函领券 2赴约 | ||
| 566 | + id: this.id, | ||
| 567 | + } | ||
| 568 | + if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr) | ||
| 569 | + let url = util.http_build_query(params, '/pages/customer/login') | ||
| 570 | + wx.navigateTo({ | ||
| 571 | + url | ||
| 572 | + }) | ||
| 573 | + }, | ||
| 574 | + | ||
| 575 | + | ||
| 576 | + // 获取是否点击过赴约(2-12页面) | ||
| 577 | + getreal() { | ||
| 578 | + App.Reserve.GetIsRelaSuccess({ | ||
| 579 | + openid: getApp().openid, | ||
| 580 | + rid: this.id, | ||
| 581 | + }).then((json) => { | ||
| 582 | + if (json.ret == 200) { | ||
| 583 | + console.log('是否点击赴约=-----', json.data); | ||
| 584 | + this.setData({ | ||
| 585 | + isShowBtn: !json.data, //返回false 代表没有点赴约 | ||
| 586 | + }) | ||
| 587 | + if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn(); | ||
| 588 | + } | ||
| 589 | + }) | ||
| 590 | + }, | ||
| 591 | + | ||
| 592 | + | ||
| 593 | + // 领券-获取code、手机号(2-12页面) | ||
| 594 | + getPhoneNumberCouponFun(e) { | ||
| 595 | + if (e.detail && e.detail.code && !this.data.purePhoneNumber) { | ||
| 596 | + App.Wechat.GetUserPhoneNumber({ | ||
| 597 | + code: e.detail.code, | ||
| 598 | + }).then(res => { | ||
| 599 | + if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 600 | + this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 601 | + } else { | ||
| 602 | + console.log('点了拒绝1'); | ||
| 603 | + this.couponModal.closeModal() | ||
| 604 | + this.gotoLogin('', '1') | ||
| 605 | + } | ||
| 606 | + }) | ||
| 607 | + } else { | ||
| 608 | + console.log('点了拒绝2'); | ||
| 609 | + this.couponModal.closeModal() | ||
| 610 | + this.gotoLogin('', '1') | ||
| 611 | + } | ||
| 612 | + }, | ||
| 613 | + | ||
| 614 | + | ||
| 615 | + // 用户绑定手机号(2-12页面) | ||
| 616 | + bindUserPhoneFun(purePhoneNumber) { | ||
| 617 | + App.Wechat.BindUserPhone({ | ||
| 618 | + phone: purePhoneNumber, | ||
| 619 | + openid: getApp().openid | ||
| 620 | + }).then(res => { | ||
| 621 | + if (res.ret == 200) { | ||
| 622 | + this.setData({ | ||
| 623 | + purePhoneNumber | ||
| 624 | + }) | ||
| 625 | + if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn(); | ||
| 626 | + this.setcouponFun() | ||
| 627 | + } | ||
| 628 | + }) | ||
| 629 | + }, | ||
| 630 | + | ||
| 631 | + | ||
| 632 | + // 获取code、手机号(2-12页面) | ||
| 633 | + getPhoneNumberFun(e) { | ||
| 634 | + console.log('获取code', e.detail); | ||
| 635 | + if (e.detail && e.detail.code) { | ||
| 636 | + App.Wechat.GetUserPhoneNumber({ | ||
| 637 | + code: e.detail.code, | ||
| 638 | + }).then(res => { | ||
| 639 | + if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 640 | + this.setData({ | ||
| 641 | + purePhoneNumber: res.data.phone_info.purePhoneNumber, | ||
| 642 | + }) | ||
| 643 | + this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 644 | + this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber) | ||
| 645 | + } else { | ||
| 646 | + util.toast('手机号获取失败!', 'none') | ||
| 647 | + } | ||
| 648 | + }) | ||
| 649 | + } | ||
| 650 | + }, | ||
| 651 | + | ||
| 652 | + | ||
| 653 | + // 获取用户在商家的账户余额(2-12页面) | ||
| 654 | + getUserRechargeInfo(phone) { | ||
| 655 | + App.Activity.GetRechargeBalanceByOpenid({ | ||
| 656 | + openid: getApp().openid, | ||
| 657 | + phone, | ||
| 658 | + sellerid: this.data.seller.sid, | ||
| 659 | + }).then((json) => { | ||
| 660 | + if (json.ret == 200) { | ||
| 661 | + let data = json.data; | ||
| 662 | + if (!data) { | ||
| 663 | + this.createInfoFun(phone) | ||
| 664 | + console.log('用户在商家没有账号'); | ||
| 665 | + } | ||
| 666 | + } | ||
| 667 | + }) | ||
| 668 | + }, | ||
| 669 | + | ||
| 670 | + | ||
| 671 | + // 如果该用户不存在账户 新增用户在商家的账户信息(2-12页面) | ||
| 672 | + createInfoFun(phone) { | ||
| 673 | + let params = { | ||
| 674 | + openid: getApp().openid, | ||
| 675 | + sellerid: this.data.seller.sid, | ||
| 676 | + phone | ||
| 677 | + } | ||
| 678 | + App.Activity.CreateCustomerConsumeSeller(params).then(res => { | ||
| 679 | + if (res.ret == 200) { | ||
| 680 | + console.log('新增用户在商家的账户信息----', res); | ||
| 681 | + } | ||
| 682 | + }) | ||
| 683 | + }, | ||
| 684 | + | ||
| 685 | + | ||
| 686 | + // 赴约手机号传参(2-12页面) | ||
| 687 | + confirmed() { | ||
| 688 | + let userinfo = JSON.stringify({ | ||
| 689 | + openid: getApp().openid, | ||
| 690 | + avatar: this.data.wxAvatar, | ||
| 691 | + nickname: this.data.wxNickname, | ||
| 692 | + }) | ||
| 693 | + App.Reserve.SetRelaSuccess({ | ||
| 694 | + rid: this.id, | ||
| 695 | + openid: getApp().openid, | ||
| 696 | + is_agree: 1, | ||
| 697 | + inviting_phone: this.data.purePhoneNumber, | ||
| 698 | + userinfo | ||
| 699 | + }).then(res => { | ||
| 700 | + if (res.ret == 200) { | ||
| 701 | + util.toast('赴约成功', 'none') | ||
| 702 | + this.setData({ | ||
| 703 | + isShowBtn: false, | ||
| 704 | + }) | ||
| 705 | + if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn(); | ||
| 706 | + } | ||
| 707 | + }) | ||
| 708 | + }, | ||
| 709 | + | ||
| 710 | + | ||
| 711 | + // 检测用户是否绑定手机号(2-12页面) | ||
| 712 | + getCheckUserHavePhone() { | ||
| 713 | + App.Wechat.CheckUserHavePhone({ | ||
| 714 | + openid: getApp().openid, | ||
| 715 | + }).then((json) => { | ||
| 716 | + if (json.ret == 200) { | ||
| 717 | + let data = json.data; | ||
| 718 | + if (data) { | ||
| 719 | + this.setData({ | ||
| 720 | + purePhoneNumber: data.phone, | ||
| 721 | + wxNickname: data.nickname ? data.nickname : '', | ||
| 722 | + wxAvatar: data.headimgurl ? data.headimgurl : '', | ||
| 723 | + }) | ||
| 724 | + if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn(); | ||
| 725 | + } | ||
| 726 | + } | ||
| 727 | + }) | ||
| 728 | + }, | ||
| 729 | + | ||
| 730 | + | ||
| 731 | + // 打开送券弹框(2-13页面) | ||
| 732 | + showCouponModal() { | ||
| 733 | + this.couponModal.showModal() | ||
| 734 | + this.setData({ | ||
| 735 | + countDown: 5, | ||
| 736 | + }) | ||
| 737 | + if (this.data.timer) { | ||
| 738 | + clearInterval(this.data.timer); | ||
| 739 | + } | ||
| 740 | + this.startCountDown(); | ||
| 741 | + }, | ||
| 742 | + | ||
| 743 | + | ||
| 744 | + // 跳转到商家入驻页(2-13页面) | ||
| 745 | + gotoJoinSeller() { | ||
| 746 | + wx.navigateTo({ | ||
| 747 | + url: util.http_build_query({ | ||
| 748 | + laiyuan: '邀请函' | ||
| 749 | + }, '/pages/customer/joinSeller') | ||
| 750 | + }) | ||
| 751 | + }, | ||
| 752 | + | ||
| 753 | + | ||
| 754 | + // 导航(2-13页面) | ||
| 755 | + looklocation: function () { | ||
| 756 | + wx.reportMonitor('1015', 1) | ||
| 757 | + wx.openLocation({ | ||
| 758 | + latitude: Number(this.data.seller.lat), | ||
| 759 | + longitude: Number(this.data.seller.long), | ||
| 760 | + scale: 17, | ||
| 761 | + address: this.data.seller.addr, | ||
| 762 | + success: function (res) { | ||
| 763 | + console.log(res) | ||
| 764 | + } | ||
| 765 | + }) | ||
| 766 | + }, | ||
| 767 | + | ||
| 768 | + // 获取商家版本,不是超能版或者没有开通对应模块,不显示(2-13页面) | ||
| 769 | + getSellerVersionFun(sellerid) { | ||
| 770 | + App.SellerVersion.GetSellerVersion({ | ||
| 771 | + sellerid | ||
| 772 | + }).then((res) => { | ||
| 773 | + let data = res.data; | ||
| 774 | + console.log('版本列表', data); | ||
| 775 | + if (data && data.length > 0) { | ||
| 776 | + data.sort((a, b) => b.cdate * 1 - a.cdate * 1); | ||
| 777 | + // 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本) | ||
| 778 | + let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4); | ||
| 779 | + console.log('当前版本', { | ||
| 780 | + ...obj | ||
| 781 | + }); | ||
| 782 | + // 提前点餐功能:超能版 || 有提前点餐模块 | ||
| 783 | + const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6'); | ||
| 784 | + // 优惠券功能:超能版 || 高级版 || 有优惠券模块 | ||
| 785 | + const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8'); | ||
| 786 | + // 充值功能:超能版 || 有充值模块 | ||
| 787 | + const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9'); | ||
| 788 | + // 播报功能:超能版 || 标准版 || 标准版首年 || 高级版 | ||
| 789 | + const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4'; | ||
| 790 | + this.setData({ | ||
| 791 | + hasValueOrder, | ||
| 792 | + hasValueCertificate, | ||
| 793 | + hasValueRecharge, | ||
| 794 | + hasValueBroadcast, | ||
| 795 | + }) | ||
| 796 | + } | ||
| 797 | + }) | ||
| 798 | + }, | ||
| 799 | + | ||
| 800 | + // 通过预订ID查收定金详情(2-13页面) | ||
| 801 | + getPaymentStatus() { | ||
| 802 | + App.Reserve.GetReserveDepositByRid({ | ||
| 803 | + rid: this.data.options.id | ||
| 804 | + }).then(res => { | ||
| 805 | + if (res.ret == 200 && res.data && res.data.length > 0) { | ||
| 806 | + let data = res.data[0]; | ||
| 807 | + let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0'; | ||
| 808 | + let options = this.data.options | ||
| 809 | + this.setData({ | ||
| 810 | + paymentId: data.id, | ||
| 811 | + paymentStatus, | ||
| 812 | + isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1', | ||
| 813 | + }) | ||
| 814 | + if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn(); | ||
| 815 | + } | ||
| 816 | + }) | ||
| 817 | + }, | ||
| 818 | + | ||
| 819 | + // 点击支付定金(2-13页面) | ||
| 820 | + paymentFun() { | ||
| 821 | + let that = this; | ||
| 822 | + let openid = getApp().openid; | ||
| 823 | + if (!openid) return wx.showToast({ | ||
| 824 | + title: '请在小程序中支付订金!', | ||
| 825 | + icon: 'none', | ||
| 826 | + }) | ||
| 827 | + App.PayOnline.CombineTransactionsByDeposit({ | ||
| 828 | + id: this.data.paymentId, | ||
| 829 | + openid, | ||
| 830 | + }).then(res => { | ||
| 831 | + if (res.ret == 200) { | ||
| 832 | + wx.requestPayment({ | ||
| 833 | + timeStamp: res.data.timeStamp + '', | ||
| 834 | + nonceStr: res.data.nonceStr, | ||
| 835 | + package: res.data.package, | ||
| 836 | + signType: res.data.signType, | ||
| 837 | + paySign: res.data.paySign, | ||
| 838 | + success(ress) { | ||
| 839 | + console.log('微信支付结果', ress); | ||
| 840 | + if (ress.errMsg == 'requestPayment:ok') { | ||
| 841 | + console.log('支付成功', ress); | ||
| 842 | + that.setData({ | ||
| 843 | + paymentStatus: '1', | ||
| 844 | + toastBool: true, | ||
| 845 | + toastText: '支付成功' | ||
| 846 | + }) | ||
| 847 | + that.hideToast(); | ||
| 848 | + return | ||
| 849 | + } | ||
| 850 | + console.log('支付失败1', ress); | ||
| 851 | + that.setData({ | ||
| 852 | + toastBool: true, | ||
| 853 | + toastText: '支付失败,请重新支付' | ||
| 854 | + }) | ||
| 855 | + that.hideToast(); | ||
| 856 | + }, | ||
| 857 | + fail(ress) { | ||
| 858 | + console.log('支付失败2', ress); | ||
| 859 | + that.setData({ | ||
| 860 | + toastBool: true, | ||
| 861 | + toastText: '支付失败,请重新支付' | ||
| 862 | + }) | ||
| 863 | + that.hideToast(); | ||
| 864 | + }, | ||
| 865 | + }) | ||
| 866 | + } else { | ||
| 867 | + wx.showToast({ | ||
| 868 | + title: res.msg, | ||
| 869 | + icon: 'none', | ||
| 870 | + }) | ||
| 871 | + } | ||
| 872 | + }) | ||
| 873 | + }, | ||
| 874 | + | ||
| 875 | + // 关闭支付失败或者成功弹框(2-13页面) | ||
| 876 | + hideToast() { | ||
| 877 | + setTimeout(() => { | ||
| 878 | + this.setData({ | ||
| 879 | + toastBool: false | ||
| 880 | + }) | ||
| 881 | + }, 1500) | ||
| 882 | + }, | ||
| 883 | + | ||
| 884 | + // 使用页面:(2-13页面) | ||
| 885 | + onImgOK(e) { | ||
| 886 | + this.setData({ | ||
| 887 | + imgSrc: e.detail.path | ||
| 888 | + }) | ||
| 889 | + console.log('海报生成成功', this.data.imgSrc); | ||
| 890 | + }, | ||
| 891 | + | ||
| 892 | + // 设置虚拟到店时间(2-13页面) | ||
| 893 | + bindPickerChange: function (e) { | ||
| 894 | + let index = e.detail.value | ||
| 895 | + let temp_ddate = this.data.timeList[index] | ||
| 896 | + this.setData({ | ||
| 897 | + temp_ddate | ||
| 898 | + }) | ||
| 899 | + let detailInfo = this.data.detail; | ||
| 900 | + const reserveDate = new Date(detailInfo.ddate * 1000); | ||
| 901 | + let reserveTime = | ||
| 902 | + reserveDate.getFullYear() + | ||
| 903 | + "-" + | ||
| 904 | + (reserveDate.getMonth() + 1) + | ||
| 905 | + "-" + | ||
| 906 | + reserveDate.getDate(); | ||
| 907 | + let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000 | ||
| 908 | + App.Reserve.SetReserveTempDdate({ | ||
| 909 | + rid: this.id, | ||
| 910 | + temp_ddate: times, | ||
| 911 | + }).then(res => { | ||
| 912 | + if (res.ret == 200) { | ||
| 913 | + let lite_style = this.data.lite_style | ||
| 914 | + lite_style = lite_style || '3'; | ||
| 915 | + let style = lite_style.split('-'); | ||
| 916 | + let type1 = style[0]; | ||
| 917 | + let type2 = style[1]; | ||
| 918 | + if ((type1 == '2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1 == '4' && !type2))) { | ||
| 919 | + let time = temp_ddate || this.data.timeList[index] | ||
| 920 | + this.painterBtn( | ||
| 921 | + lite_style, | ||
| 922 | + time | ||
| 923 | + ); | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + }) | ||
| 927 | + }, | ||
| 928 | + | ||
| 929 | + // ios 部分机型不兼容new Date() 转换字符串(2-13页面) | ||
| 930 | + getNewDate(data) { | ||
| 931 | + if (typeof data === 'string') { | ||
| 932 | + let arr = data.split(/[- : \/]/) | ||
| 933 | + if (arr[1] !== undefined || arr[1] !== null) { | ||
| 934 | + arr[1] = arr[1] - 1 | ||
| 935 | + } | ||
| 936 | + return new Date(...arr) | ||
| 937 | + } | ||
| 938 | + return new Date(data || new Date()) | ||
| 939 | + }, | ||
| 940 | + | ||
| 941 | + //根据起始时间(获取时间时间段)(2-13页面) | ||
| 942 | + computeHour(time1, time2, interval) { | ||
| 943 | + //time1 开始时间 time2结束时间 interval间隔时长 | ||
| 944 | + function getTimeList(time1, time2, interval) { | ||
| 945 | + var timeList = []; | ||
| 946 | + time1 = time1.split(":"); | ||
| 947 | + time2 = time2.split(":"); | ||
| 948 | + time1 = new Date(0, 0, 0, time1[0], time1[1], 0); | ||
| 949 | + time2 = new Date(0, 0, 0, time2[0], time2[1], 0); | ||
| 950 | + interval = interval * 60 * 1000; | ||
| 951 | + while (time1 <= time2) { | ||
| 952 | + timeList.push(time1.format("hh:mm")); | ||
| 953 | + time1 = new Date(time1.getTime() + interval); | ||
| 954 | + } | ||
| 955 | + return timeList; | ||
| 956 | + } | ||
| 957 | + Date.prototype.format = function (format) { | ||
| 958 | + var date = { | ||
| 959 | + "M+": this.getMonth() + 1, | ||
| 960 | + "d+": this.getDate(), | ||
| 961 | + "h+": this.getHours(), | ||
| 962 | + "m+": this.getMinutes(), | ||
| 963 | + "s+": this.getSeconds(), | ||
| 964 | + "q+": Math.floor((this.getMonth() + 3) / 3), | ||
| 965 | + S: this.getMilliseconds(), | ||
| 966 | + }; | ||
| 967 | + if (/(y+)/.test(format)) | ||
| 968 | + format = format.replace( | ||
| 969 | + RegExp.$1, | ||
| 970 | + (this.getFullYear() + "").substr(4 - RegExp.$1.length) | ||
| 971 | + ); | ||
| 972 | + for (var k in date) | ||
| 973 | + if (new RegExp("(" + k + ")").test(format)) | ||
| 974 | + format = format.replace( | ||
| 975 | + RegExp.$1, | ||
| 976 | + RegExp.$1.length == 1 ? | ||
| 977 | + date[k] : | ||
| 978 | + ("00" + date[k]).substr(("" + date[k]).length) | ||
| 979 | + ); | ||
| 980 | + return format; | ||
| 981 | + }; | ||
| 982 | + return getTimeList(time1, time2, interval); | ||
| 983 | + }, | ||
| 984 | + | ||
| 985 | + // 获取自定义图文内容(2-13页面) | ||
| 986 | + getText() { | ||
| 987 | + App.Reserve.GetReserveImgText({ | ||
| 988 | + rid: this.data.options.id | ||
| 989 | + }).then(res => { | ||
| 990 | + if (res.ret == 200 && res.data) { | ||
| 991 | + let data = res.data; | ||
| 992 | + let content = util.determine(data.content) | ||
| 993 | + console.log('contentcontentcontent', content); | ||
| 994 | + this.setData({ | ||
| 995 | + reserveData: { | ||
| 996 | + title: data.title || '', | ||
| 997 | + content, | ||
| 998 | + } | ||
| 999 | + }) | ||
| 1000 | + } | ||
| 1001 | + }) | ||
| 1002 | + }, | ||
| 1003 | + | ||
| 1004 | + // 修改detail数据(2-13页面) | ||
| 1005 | + formatDatail(detail, dateSmart) { | ||
| 1006 | + detail.rdateStr = dateSmart; | ||
| 1007 | + detail.tableFirst = detail.tables[0].name; | ||
| 1008 | + if (detail.tables.length > 1) { | ||
| 1009 | + detail.tableSubInfo = '等' + (detail.tables.length) + '个' + | ||
| 1010 | + (detail.tables[0].tid == 2 ? '包间' : ''); | ||
| 1011 | + } | ||
| 1012 | + detail.rname = detail.rname.trim() | ||
| 1013 | + if (detail.rname && detail.sex != 3) { | ||
| 1014 | + let sexStr = detail.sex == 1 ? '先生' : detail.sex == 2 ? '女士' : detail.sex == 4 ? '贵宾' : ''; | ||
| 1015 | + let str = this.data.options.showSex == '2' ? '' : sexStr; | ||
| 1016 | + detail.rnameStr = detail.rname + str | ||
| 1017 | + } else if (!detail.rname && detail.sex == 4) { | ||
| 1018 | + detail.rnameStr = '贵宾' | ||
| 1019 | + } else { | ||
| 1020 | + detail.rnameStr = detail.rname | ||
| 1021 | + } | ||
| 1022 | + detail.eatStr = '邀请您共进晚餐'; | ||
| 1023 | + let hi = util.unixtoTime(detail.ddate, 'HHII'); | ||
| 1024 | + if (hi < '10:00') { | ||
| 1025 | + detail.eatStr = '邀请您共进早餐'; | ||
| 1026 | + } else if (hi < '15:00') { | ||
| 1027 | + detail.eatStr = '邀请您共进午餐'; | ||
| 1028 | + } | ||
| 1029 | + return detail; | ||
| 1030 | + }, | ||
| 1031 | + | ||
| 1032 | + // 点击商家有礼(2-13页面) | ||
| 1033 | + gotoSellerGift(e) { | ||
| 1034 | + this.couponModal.closeModal() | ||
| 1035 | + const form = e.currentTarget.dataset['form']; | ||
| 1036 | + let url = util.http_build_query({ | ||
| 1037 | + id: this.data.detail.id, | ||
| 1038 | + hasSellerShare: this.data.options.hasSellerShare, | ||
| 1039 | + form | ||
| 1040 | + }, '/pages/reserve/sellerGift') | ||
| 1041 | + wx.navigateTo({ | ||
| 1042 | + url | ||
| 1043 | + }) | ||
| 1044 | + }, | ||
| 1045 | + | ||
| 1046 | + // 计算免费券有效期的起始、结束日期(2-13页面) | ||
| 1047 | + setTimeRange(cdate, startOffset, endOffset) { | ||
| 1048 | + console.log(cdate, startOffset, endOffset); | ||
| 1049 | + const startDate = new Date((cdate + startOffset * 86400) * 1000); | ||
| 1050 | + startDate.setHours(0, 0, 0, 0); | ||
| 1051 | + const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1052 | + const endDate = new Date((cdate + endOffset * 86400) * 1000); | ||
| 1053 | + endDate.setHours(23, 59, 59, 0); | ||
| 1054 | + const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1055 | + let useEtimeNum = endDate.getTime() / 1000; | ||
| 1056 | + return { | ||
| 1057 | + useStime, | ||
| 1058 | + useEtime, | ||
| 1059 | + useEtimeNum | ||
| 1060 | + }; | ||
| 1061 | + }, | ||
| 1062 | + | ||
| 1063 | + // 底部操作栏状态计算(2~12 通用;13 号页在页面内覆盖) | ||
| 1064 | + refreshActionBtn(extraData) { | ||
| 1065 | + // 优先用调用方传入的最新数据(如刚setData的obj),避免setData异步/时序导致读到旧值;不传则读this.data | ||
| 1066 | + const data = extraData ? Object.assign({}, this.data, extraData) : this.data; | ||
| 1067 | + const { | ||
| 1068 | + detail, | ||
| 1069 | + options, | ||
| 1070 | + isMoreBtn, | ||
| 1071 | + isPaymenBtn, | ||
| 1072 | + isShareItem, | ||
| 1073 | + isShowBtn, | ||
| 1074 | + seller, | ||
| 1075 | + reserveOpenid, | ||
| 1076 | + openid, | ||
| 1077 | + wxNickname, | ||
| 1078 | + purePhoneNumber | ||
| 1079 | + } = data; | ||
| 1080 | + const notCancel = detail.status != '4'; | ||
| 1081 | + const isOver = options.isOrder == '1'; | ||
| 1082 | + const A = !!isMoreBtn; | ||
| 1083 | + const C = !A && !!seller.phone; | ||
| 1084 | + const D = notCancel && !!isPaymenBtn; | ||
| 1085 | + const E = notCancel && !!isShareItem; | ||
| 1086 | + const isOwner = options.hasSellerShare == '1'; | ||
| 1087 | + const Y = reserveOpenid != openid && !isOver && !!isShowBtn; | ||
| 1088 | + const X = Y && !isOwner && options.isMeeting == '1'; | ||
| 1089 | + const authorized = !!(wxNickname && purePhoneNumber); | ||
| 1090 | + this.setData({ | ||
| 1091 | + barShow: !!(A || isOver || C || D || E), | ||
| 1092 | + showMoreOnline: A, | ||
| 1093 | + showMoreCall: C, | ||
| 1094 | + canPay: D, | ||
| 1095 | + canShare: E, | ||
| 1096 | + isOver, | ||
| 1097 | + isOwner, | ||
| 1098 | + canMeet: X, | ||
| 1099 | + needLogin: !authorized, | ||
| 1100 | + guestShareCls: Y ? 'paymenBtn paymenBtn1' : 'shareItem shareItem1', | ||
| 1101 | + threeBtnMore: (D || X) && (E || isOver) ? 'threeBtn' : '', | ||
| 1102 | + threeBtnCall: D && (E || isOver) ? 'threeBtn' : '', | ||
| 1103 | + threeBtnPay: (A || C) && (E || isOver) ? 'threeBtn' : '', | ||
| 1104 | + }) | ||
| 1105 | + }, | ||
| 1106 | + | ||
| 1107 | + // 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨)(10-12页面) | ||
| 1108 | + processInfo(intel, type) { | ||
| 1109 | + let imgs = []; | ||
| 1110 | + intel.textInfo = ''; | ||
| 1111 | + intel.imgsInfo = []; | ||
| 1112 | + intel.videoImgsInfo = []; | ||
| 1113 | + if (type == '1' && intel.is_introduce_all == '1') { | ||
| 1114 | + if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) { | ||
| 1115 | + intel.textInfo = intel.park_info; | ||
| 1116 | + imgs = intel.park_info_images | ||
| 1117 | + } | ||
| 1118 | + } | ||
| 1119 | + if (type == '2') { | ||
| 1120 | + imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : []; | ||
| 1121 | + intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : ''; | ||
| 1122 | + } | ||
| 1123 | + if (type == '3') { | ||
| 1124 | + imgs = intel.images || [] | ||
| 1125 | + intel.textInfo = ''; | ||
| 1126 | + } | ||
| 1127 | + if (type == '4') { | ||
| 1128 | + imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : [] | ||
| 1129 | + intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : ''; | ||
| 1130 | + } | ||
| 1131 | + intel.imgsInfo = imgs; | ||
| 1132 | + if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') { | ||
| 1133 | + intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n'); | ||
| 1134 | + intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content); | ||
| 1135 | + intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content)); | ||
| 1136 | + } | ||
| 1137 | + return intel | ||
| 1138 | + }, | ||
| 1139 | + | ||
| 1140 | + // 选中充值活动(11-12页面) | ||
| 1141 | + checkRechargeData(e) { | ||
| 1142 | + let id = e.currentTarget.dataset['id']; | ||
| 1143 | + let obj = this.data.recharge_data.filter(item => { | ||
| 1144 | + return item.id == id | ||
| 1145 | + }) | ||
| 1146 | + if (obj && obj.length > 0) { | ||
| 1147 | + this.setData({ | ||
| 1148 | + activeData: obj[0] | ||
| 1149 | + }) | ||
| 1150 | + } | ||
| 1151 | + }, | ||
| 1152 | +}; |
| 1 | +<!-- 公共 wxml 片段(template):页面用 <import src="../common/parts.wxml" /> 引入 --> | ||
| 2 | +<!-- richText 富文本:content 为数组,项 {type: 1图片/2文字/3视频, content}; imgs 可选整组预览图; textClass 文字字号类 --> | ||
| 3 | +<template name="richText"> | ||
| 4 | + <block wx:for="{{content}}" wx:key="index"> | ||
| 5 | + <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{imgs}}" mode="widthFix" /><text wx:if="{{item.type == '2'}}" space="nbsp" class="texts {{textClass}}">{{item.content}}</text> | ||
| 6 | + <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 7 | + <video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video> | ||
| 8 | + </view> | ||
| 9 | + </block> | ||
| 10 | +</template> | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +<!-- 截屏提示弹窗 --> | ||
| 14 | +<template name="payModal"> | ||
| 15 | + <my-modal id="payModal" fadeStyle="slideUp" height="240px"> | ||
| 16 | + <view slot="modalName" class="titleModal">提示</view> | ||
| 17 | + <view slot="modalContent"> | ||
| 18 | + <view class="explain">检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦!</view> | ||
| 19 | + <view class="screenshotBtns"> | ||
| 20 | + <button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button><button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> | ||
| 21 | + </view> | ||
| 22 | + </view> | ||
| 23 | + </my-modal> | ||
| 24 | +</template> | ||
| 25 | + | ||
| 26 | + | ||
| 27 | +<!-- 音乐开关 --> | ||
| 28 | +<template name="musicImg"> | ||
| 29 | + <image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" /> | ||
| 30 | +</template> | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +<!-- 商家有礼悬浮入口 --> | ||
| 34 | +<template name="giftImg"> | ||
| 35 | + <image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}" bindtap="gotoSellerGift" data-form="1" animation="{{animationData2}}" wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode="" /> | ||
| 36 | +</template> | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +<!-- 领券全屏浮层 --> | ||
| 40 | +<template name="fullscreenMask"> | ||
| 41 | + <view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}"> | ||
| 42 | + <image src="https://qn.colorcun.com/getCouponIcon2.png" mode="" /> | ||
| 43 | + </view> | ||
| 44 | +</template> | ||
| 45 | + | ||
| 46 | + | ||
| 47 | +<!-- 已取消/已结束 状态角标 --> | ||
| 48 | +<template name="statusBadge"> | ||
| 49 | + <image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> | ||
| 50 | + <image wx:if="{{options && options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" /> | ||
| 51 | +</template> | ||
| 52 | + | ||
| 53 | + | ||
| 54 | +<!-- 优惠券列表卡片(2~9 版) --> | ||
| 55 | +<template name="couponCard"> | ||
| 56 | + <block wx:for="{{list}}" wx:key="index" wx:for-index="index"> | ||
| 57 | + <navigator wx:if="{{item.resultCoupon || !item.resultCoupon || item.is_type != '3'}}" url="/pack-activity/pack/receiveCoupon?id={{item.id}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> | ||
| 58 | + <view class="preferentialItems"> | ||
| 59 | + <view class="itemLeft"> | ||
| 60 | + <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> | ||
| 61 | + <view class="discountText1 font20r {{item.arule.is_accumulation == '1'?'discountText2':'discountText3'}}" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view> | ||
| 62 | + <view class="priceText" wx:if="{{item.price}}"> | ||
| 63 | + <view class="icons font24r">¥</view><text class="font48r">{{item.price}}</text> | ||
| 64 | + </view> | ||
| 65 | + <view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view> | ||
| 66 | + </view> | ||
| 67 | + <view class="couponLine"></view> | ||
| 68 | + <view class="itemRight"> | ||
| 69 | + <view class="btns"> | ||
| 70 | + <text class="font32r anameText">{{item.aname}}</text> | ||
| 71 | + <block wx:if="{{item.is_type == '1' || item.is_type == '2'}}"> | ||
| 72 | + <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text> | ||
| 73 | + <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">无限制{{item.desc?','+item.desc+'。':'。'}}</view> | ||
| 74 | + <view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}</view> | ||
| 75 | + </block> | ||
| 76 | + <block wx:if="{{item.is_type == '3' || item.is_type == '4'}}"> | ||
| 77 | + <view wx:if="{{(item.useStime && item.useEtime) || item.foreverText}}" class="bottom font24r">有效期:{{item.foreverText?item.foreverText : ''}}</view> | ||
| 78 | + <view wx:if="{{item.useStime && item.useEtime}}" class="bottom font24r nodate">{{item.useStime}} 至 {{item.useEtime}}</view> | ||
| 79 | + <view wx:if="{{item.morText || item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view> | ||
| 80 | + <view wx:if="{{item.morText}}" class="bottom font24r nodate">{{item.morText}}</view> | ||
| 81 | + <view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view> | ||
| 82 | + <view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view> | ||
| 83 | + <view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view> | ||
| 84 | + <view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view> | ||
| 85 | + </block> | ||
| 86 | + </view> | ||
| 87 | + <view class="btnBox" wx:if="{{item.is_type == '3'}}"> | ||
| 88 | + <view class="font24r orderingFood {{item.resultCoupon == '1'?'orderingFood1':'orderingFood2'}}">{{item.resultCoupon == '1'?'已领取':'领取'}}</view> | ||
| 89 | + <view class="grantNum" wx:if="{{item.receiveNumText}}"> | ||
| 90 | + <view class="font24r">已被领取</view> | ||
| 91 | + <view class="font24r"> | ||
| 92 | + <text>{{item.receiveNumText}}</text> | ||
| 93 | + 张 | ||
| 94 | + </view> | ||
| 95 | + </view> | ||
| 96 | + </view> | ||
| 97 | + <view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">立即抢购</view> | ||
| 98 | + </view> | ||
| 99 | + </view> | ||
| 100 | + </navigator> | ||
| 101 | + </block> | ||
| 102 | +</template> | ||
| 103 | + | ||
| 104 | + | ||
| 105 | +<!-- 充值卡(2,3,4,5,7,8,9 版) --> | ||
| 106 | +<template name="rechargeCard"> | ||
| 107 | + <view class="preferentialItems rechargeItems"> | ||
| 108 | + <view class="itemLeft"> | ||
| 109 | + <view class="itemTop font36r">{{recharge_data.rname}}</view> | ||
| 110 | + <view class="itemBottom font24r" wx:if="{{priceInfo}}">{{priceInfo}}{{(recharge_data.recharge_list.is_coupons=='0' && recharge_data.recharge_list.is_score=='0')?'。':';'}}</view> | ||
| 111 | + <view class="bottom font24r" wx:if="{{scoreInfo}}">{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}</view> | ||
| 112 | + <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。</view> | ||
| 113 | + </view> | ||
| 114 | + <view class="font24r orderingFood">抢购</view> | ||
| 115 | + </view> | ||
| 116 | +</template> | ||
| 117 | + | ||
| 118 | +<!-- 领券弹窗(2~12 通用;13 保持页面内独立) --> | ||
| 119 | +<template name="couponModal"> | ||
| 120 | + <my-modal id="couponModal" fadeStyle="slideUp" height="240px"> | ||
| 121 | + <view slot="modalContent"> | ||
| 122 | + <view class="titleModal"> | ||
| 123 | + <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode="" /> | ||
| 124 | + <view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view> | ||
| 125 | + <view class="couponTotal font28r" wx:if="{{totalPrice}}"> | ||
| 126 | + 赠送给您代金券 | ||
| 127 | + <view class="counterText"> | ||
| 128 | + <view class="font36r">¥</view> | ||
| 129 | + <scroll-number value="{{totalPrice}}"></scroll-number> | ||
| 130 | + </view> | ||
| 131 | + </view> | ||
| 132 | + </view> | ||
| 133 | + <view class="couponWrap"> | ||
| 134 | + <view class="couponInfo font48r"> | ||
| 135 | + <text class="font48r">到店微信扫码</text> | ||
| 136 | + <text class="font48r">自动识别</text> | ||
| 137 | + </view> | ||
| 138 | + <block wx:if="{{!purePhoneNumber}}"> | ||
| 139 | + <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button> | ||
| 140 | + </block> | ||
| 141 | + <block wx:else> | ||
| 142 | + <subscribe ids="{{[2]}}" bindtap="setcouponFun"> | ||
| 143 | + <view class="couponBtn couponBtn1 font40r">欣然收下</view> | ||
| 144 | + </subscribe> | ||
| 145 | + </block> | ||
| 146 | + <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view> | ||
| 147 | + </view> | ||
| 148 | + <view class="closeBox font28r">{{countDown}} 秒后自动关闭</view> | ||
| 149 | + </view> | ||
| 150 | + </my-modal> | ||
| 151 | +</template> | ||
| 152 | + | ||
| 153 | + | ||
| 154 | +<!-- 底部操作栏(2~12 通用;barWrapClass 区分外层样式;13 保持页面内独立) --> | ||
| 155 | +<template name="actionBar"> | ||
| 156 | + <view wx:if="{{barShow}}" class="{{barWrapClass}}"> | ||
| 157 | + <view wx:if="{{showMoreOnline}}" class="flex-cc font30r moreBtn {{threeBtnMore}}" bindtap="secondbook">再次预订</view> | ||
| 158 | + <view wx:if="{{showMoreCall}}" class="flex-cc font30r moreBtn {{threeBtnCall}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view> | ||
| 159 | + <view wx:if="{{canPay}}" class="flex-cc font30r paymenBtn {{threeBtnPay}}" bindtap="paymentFun">支付定金</view> | ||
| 160 | + <block wx:if="{{isOwner}}"> | ||
| 161 | + <button wx:if="{{canShare}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button> | ||
| 162 | + <button wx:if="{{isOver}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button> | ||
| 163 | + </block> | ||
| 164 | + <block wx:else> | ||
| 165 | + <button wx:if="{{canShare}}" class="flex-cc font30r {{guestShareCls}}" open-type="share">转发邀请函</button> | ||
| 166 | + <button wx:if="{{isOver}}" class="flex-cc font30r {{guestShareCls}}" data-type="2" open-type="share">转发邀请函</button> | ||
| 167 | + <block wx:if="{{canMeet}}"> | ||
| 168 | + <button wx:if="{{needLogin}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 169 | + <button wx:else bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 170 | + </block> | ||
| 171 | + </block> | ||
| 172 | + </view> | ||
| 173 | +</template> |
| @@ -6,11 +6,26 @@ import TP from '../../utils/tpls'; | @@ -6,11 +6,26 @@ import TP from '../../utils/tpls'; | ||
| 6 | import RS from '../../utils/reserveStatus' | 6 | import RS from '../../utils/reserveStatus' |
| 7 | var plugin = requirePlugin("WechatSI"); | 7 | var plugin = requirePlugin("WechatSI"); |
| 8 | import canvas from "../../pages/customer/canvas" | 8 | import canvas from "../../pages/customer/canvas" |
| 9 | +import inviteBase from '../common/inviteBase'; | ||
| 9 | Page({ | 10 | Page({ |
| 11 | + ...inviteBase, | ||
| 10 | /** | 12 | /** |
| 11 | * 页面的初始数据 | 13 | * 页面的初始数据 |
| 12 | */ | 14 | */ |
| 13 | data: { | 15 | data: { |
| 16 | + barShow: false, //底部操作栏是否显示 | ||
| 17 | + showMoreOnline: false, //再次预订-在线 | ||
| 18 | + showMoreCall: false, //再次预订-电话 | ||
| 19 | + canPay: false, //支付定金 | ||
| 20 | + canShare: false, //转发邀请函 | ||
| 21 | + isOver: false, //已结束/完成 | ||
| 22 | + isOwner: false, //商家(发起人)视角 | ||
| 23 | + canMeet: false, //客人可确认赴约 | ||
| 24 | + needLogin: true, //确认赴约需先登录/授权 | ||
| 25 | + guestShareCls: 'shareItem shareItem1', //客人转发按钮样式 | ||
| 26 | + threeBtnMore: '', //3按钮布局(在线再次预订) | ||
| 27 | + threeBtnCall: '', //3按钮布局(电话再次预订) | ||
| 28 | + threeBtnPay: '', //3按钮布局(支付定金) | ||
| 14 | options: { | 29 | options: { |
| 15 | tplid: '' | 30 | tplid: '' |
| 16 | }, | 31 | }, |
| @@ -118,137 +133,6 @@ Page({ | @@ -118,137 +133,6 @@ Page({ | ||
| 118 | }) | 133 | }) |
| 119 | this.couponModal = this.selectComponent("#couponModal"); | 134 | this.couponModal = this.selectComponent("#couponModal"); |
| 120 | }, | 135 | }, |
| 121 | - // 跳转登录页 | ||
| 122 | - gotoLogin(event, type) { | ||
| 123 | - const types = type ? type : event.currentTarget.dataset.types; | ||
| 124 | - let params = { | ||
| 125 | - types, //1邀请函领券 2赴约 | ||
| 126 | - id: this.id, | ||
| 127 | - } | ||
| 128 | - if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr) | ||
| 129 | - let url = util.http_build_query(params, '/pages/customer/login') | ||
| 130 | - wx.navigateTo({ | ||
| 131 | - url | ||
| 132 | - }) | ||
| 133 | - }, | ||
| 134 | - // 获取是否点击过赴约 | ||
| 135 | - getreal() { | ||
| 136 | - App.Reserve.GetIsRelaSuccess({ | ||
| 137 | - openid: getApp().openid, | ||
| 138 | - rid: this.id, | ||
| 139 | - }).then((json) => { | ||
| 140 | - if (json.ret == 200) { | ||
| 141 | - console.log('是否点击赴约=-----', json.data); | ||
| 142 | - this.setData({ | ||
| 143 | - isShowBtn: !json.data, //返回false 代表没有点赴约 | ||
| 144 | - }) | ||
| 145 | - } | ||
| 146 | - }) | ||
| 147 | - }, | ||
| 148 | - // 领券-获取code、手机号 | ||
| 149 | - getPhoneNumberCouponFun(e) { | ||
| 150 | - if (e.detail && e.detail.code && !this.data.purePhoneNumber) { | ||
| 151 | - App.Wechat.GetUserPhoneNumber({ | ||
| 152 | - code: e.detail.code, | ||
| 153 | - }).then(res => { | ||
| 154 | - if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 155 | - this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 156 | - } else { | ||
| 157 | - console.log('点了拒绝1'); | ||
| 158 | - this.couponModal.closeModal() | ||
| 159 | - this.gotoLogin('', '1') | ||
| 160 | - } | ||
| 161 | - }) | ||
| 162 | - } else { | ||
| 163 | - console.log('点了拒绝2'); | ||
| 164 | - this.couponModal.closeModal() | ||
| 165 | - this.gotoLogin('', '1') | ||
| 166 | - } | ||
| 167 | - }, | ||
| 168 | - // 用户绑定手机号 | ||
| 169 | - bindUserPhoneFun(purePhoneNumber) { | ||
| 170 | - App.Wechat.BindUserPhone({ | ||
| 171 | - phone: purePhoneNumber, | ||
| 172 | - openid: getApp().openid | ||
| 173 | - }).then(res => { | ||
| 174 | - if (res.ret == 200) { | ||
| 175 | - this.setData({ | ||
| 176 | - purePhoneNumber | ||
| 177 | - }) | ||
| 178 | - this.setcouponFun() | ||
| 179 | - } | ||
| 180 | - }) | ||
| 181 | - }, | ||
| 182 | - // 获取code、手机号 | ||
| 183 | - getPhoneNumberFun(e) { | ||
| 184 | - console.log('获取code', e.detail); | ||
| 185 | - if (e.detail && e.detail.code) { | ||
| 186 | - App.Wechat.GetUserPhoneNumber({ | ||
| 187 | - code: e.detail.code, | ||
| 188 | - }).then(res => { | ||
| 189 | - if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 190 | - this.setData({ | ||
| 191 | - purePhoneNumber: res.data.phone_info.purePhoneNumber, | ||
| 192 | - }) | ||
| 193 | - this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 194 | - this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber) | ||
| 195 | - } else { | ||
| 196 | - util.toast('手机号获取失败!', 'none') | ||
| 197 | - } | ||
| 198 | - }) | ||
| 199 | - } | ||
| 200 | - }, | ||
| 201 | - // 获取用户在商家的账户余额 | ||
| 202 | - getUserRechargeInfo(phone) { | ||
| 203 | - App.Activity.GetRechargeBalanceByOpenid({ | ||
| 204 | - openid: getApp().openid, | ||
| 205 | - phone, | ||
| 206 | - sellerid: this.data.seller.sid, | ||
| 207 | - }).then((json) => { | ||
| 208 | - if (json.ret == 200) { | ||
| 209 | - let data = json.data; | ||
| 210 | - if (!data) { | ||
| 211 | - this.createInfoFun(phone) | ||
| 212 | - console.log('用户在商家没有账号'); | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | - }) | ||
| 216 | - }, | ||
| 217 | - // 如果该用户不存在账户 新增用户在商家的账户信息 | ||
| 218 | - createInfoFun(phone) { | ||
| 219 | - let params = { | ||
| 220 | - openid: getApp().openid, | ||
| 221 | - sellerid: this.data.seller.sid, | ||
| 222 | - phone | ||
| 223 | - } | ||
| 224 | - App.Activity.CreateCustomerConsumeSeller(params).then(res => { | ||
| 225 | - if (res.ret == 200) { | ||
| 226 | - console.log('新增用户在商家的账户信息----', res); | ||
| 227 | - } | ||
| 228 | - }) | ||
| 229 | - }, | ||
| 230 | - // 赴约手机号传参 | ||
| 231 | - confirmed() { | ||
| 232 | - let userinfo = JSON.stringify({ | ||
| 233 | - openid: getApp().openid, | ||
| 234 | - avatar: this.data.wxAvatar, | ||
| 235 | - nickname: this.data.wxNickname, | ||
| 236 | - }) | ||
| 237 | - App.Reserve.SetRelaSuccess({ | ||
| 238 | - rid: this.id, | ||
| 239 | - openid: getApp().openid, | ||
| 240 | - is_agree: 1, | ||
| 241 | - inviting_phone: this.data.purePhoneNumber, | ||
| 242 | - userinfo | ||
| 243 | - }).then(res => { | ||
| 244 | - if (res.ret == 200) { | ||
| 245 | - util.toast('赴约成功', 'none') | ||
| 246 | - this.setData({ | ||
| 247 | - isShowBtn: false, | ||
| 248 | - }) | ||
| 249 | - } | ||
| 250 | - }) | ||
| 251 | - }, | ||
| 252 | //预览图片 | 136 | //预览图片 |
| 253 | previewImage(e) { | 137 | previewImage(e) { |
| 254 | const item = e.target.dataset; | 138 | const item = e.target.dataset; |
| @@ -257,56 +141,6 @@ Page({ | @@ -257,56 +141,6 @@ Page({ | ||
| 257 | urls: item.imgs, | 141 | urls: item.imgs, |
| 258 | }) | 142 | }) |
| 259 | }, | 143 | }, |
| 260 | - // 打开送券弹框 | ||
| 261 | - showCouponModal() { | ||
| 262 | - this.couponModal.showModal() | ||
| 263 | - this.setData({ | ||
| 264 | - countDown: 5, | ||
| 265 | - }) | ||
| 266 | - if (this.data.timer) { | ||
| 267 | - clearInterval(this.data.timer); | ||
| 268 | - } | ||
| 269 | - this.startCountDown(); | ||
| 270 | - }, | ||
| 271 | - // 开始倒计时 | ||
| 272 | - startCountDown() { | ||
| 273 | - let that = this; | ||
| 274 | - const timer = setInterval(() => { | ||
| 275 | - if (that.data.countDown <= 1) { | ||
| 276 | - that.closeCouponModal() | ||
| 277 | - clearInterval(timer); | ||
| 278 | - that.setData({ | ||
| 279 | - timer: null | ||
| 280 | - }); | ||
| 281 | - } else { | ||
| 282 | - that.setData({ | ||
| 283 | - countDown: that.data.countDown - 1 | ||
| 284 | - }); | ||
| 285 | - } | ||
| 286 | - }, 1000); | ||
| 287 | - this.setData({ | ||
| 288 | - timer | ||
| 289 | - }); | ||
| 290 | - }, | ||
| 291 | - // 打开截屏弹框 | ||
| 292 | - showModal() { | ||
| 293 | - this.modal.showModal() | ||
| 294 | - }, | ||
| 295 | - // 关闭截屏弹框 | ||
| 296 | - closeModal() { | ||
| 297 | - this.modal.closeModal() | ||
| 298 | - }, | ||
| 299 | - // 关闭优惠券弹框(更新已被领取数量) | ||
| 300 | - closeCouponModal() { | ||
| 301 | - this.getActivityByIdFun(this.data.couponList,'1') | ||
| 302 | - this.couponModal.closeModal() | ||
| 303 | - this.setData({ | ||
| 304 | - isShow: '1', | ||
| 305 | - }) | ||
| 306 | - setTimeout(() => { | ||
| 307 | - this.startAnimation(); | ||
| 308 | - }, 800); | ||
| 309 | - }, | ||
| 310 | // 页面滚动事件 | 144 | // 页面滚动事件 |
| 311 | onPageScroll: function (event) { | 145 | onPageScroll: function (event) { |
| 312 | const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 | 146 | const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离 |
| @@ -320,18 +154,6 @@ Page({ | @@ -320,18 +154,6 @@ Page({ | ||
| 320 | }); | 154 | }); |
| 321 | } | 155 | } |
| 322 | }, | 156 | }, |
| 323 | - // 点击了解更多会员优惠政策 | ||
| 324 | - gotoFavourableList() { | ||
| 325 | - let url = util.http_build_query({ | ||
| 326 | - sellerName: this.data.seller.name, | ||
| 327 | - sellerid: this.data.seller.sid, | ||
| 328 | - oid: this.data.detail.id, | ||
| 329 | - types: '1' | ||
| 330 | - }, '/pack-cookbook/pages/favourableList') | ||
| 331 | - wx.navigateTo({ | ||
| 332 | - url | ||
| 333 | - }) | ||
| 334 | - }, | ||
| 335 | // 去评价 | 157 | // 去评价 |
| 336 | evaluateFun() { | 158 | evaluateFun() { |
| 337 | let url = util.http_build_query({ | 159 | let url = util.http_build_query({ |
| @@ -346,18 +168,6 @@ Page({ | @@ -346,18 +168,6 @@ Page({ | ||
| 346 | }) | 168 | }) |
| 347 | }, | 169 | }, |
| 348 | /** | 170 | /** |
| 349 | - * 用户点击右上角分享 | ||
| 350 | - */ | ||
| 351 | - onShareAppMessage: function () { | ||
| 352 | - return this.sharesetting(); | ||
| 353 | - }, | ||
| 354 | - /** | ||
| 355 | - * 监听用户点击分享到朋友圈按钮的操作 | ||
| 356 | - */ | ||
| 357 | - onShareTimeline() { | ||
| 358 | - return this.sharesetting(); | ||
| 359 | - }, | ||
| 360 | - /** | ||
| 361 | * 生命周期函数--监听页面显示 | 171 | * 生命周期函数--监听页面显示 |
| 362 | */ | 172 | */ |
| 363 | onShow: function () { | 173 | onShow: function () { |
| @@ -367,69 +177,6 @@ Page({ | @@ -367,69 +177,6 @@ Page({ | ||
| 367 | this.getCheckUserHavePhone() | 177 | this.getCheckUserHavePhone() |
| 368 | this.getreal() | 178 | this.getreal() |
| 369 | }, | 179 | }, |
| 370 | - // 检测用户是否绑定手机号 | ||
| 371 | - getCheckUserHavePhone() { | ||
| 372 | - App.Wechat.CheckUserHavePhone({ | ||
| 373 | - openid: getApp().openid, | ||
| 374 | - }).then((json) => { | ||
| 375 | - if (json.ret == 200) { | ||
| 376 | - let data = json.data; | ||
| 377 | - if (data) { | ||
| 378 | - this.setData({ | ||
| 379 | - purePhoneNumber: data.phone, | ||
| 380 | - wxNickname: data.nickname ? data.nickname : '', | ||
| 381 | - wxAvatar: data.headimgurl ? data.headimgurl : '', | ||
| 382 | - }) | ||
| 383 | - } | ||
| 384 | - } | ||
| 385 | - }) | ||
| 386 | - }, | ||
| 387 | - // 复制微信号 | ||
| 388 | - copyWeChat() { | ||
| 389 | - if (this.data.staffinfo.wechat) { | ||
| 390 | - wx.setClipboardData({ | ||
| 391 | - data: this.data.staffinfo.wechat, | ||
| 392 | - success(res) { | ||
| 393 | - wx.getClipboardData({ | ||
| 394 | - success(res) { | ||
| 395 | - console.log(res.data) | ||
| 396 | - } | ||
| 397 | - }) | ||
| 398 | - } | ||
| 399 | - }) | ||
| 400 | - } else { | ||
| 401 | - console.log('无微信号') | ||
| 402 | - } | ||
| 403 | - }, | ||
| 404 | - // 拨打电话 | ||
| 405 | - call(e) { | ||
| 406 | - const phone = e.currentTarget.dataset['phone']; | ||
| 407 | - wx.reportMonitor('1012', 1) | ||
| 408 | - wx.makePhoneCall({ | ||
| 409 | - phoneNumber: phone | ||
| 410 | - }) | ||
| 411 | - }, | ||
| 412 | - // 跳转到商家入驻页 | ||
| 413 | - gotoJoinSeller() { | ||
| 414 | - wx.navigateTo({ | ||
| 415 | - url: util.http_build_query({ | ||
| 416 | - laiyuan: '邀请函' | ||
| 417 | - }, '/pages/customer/joinSeller') | ||
| 418 | - }) | ||
| 419 | - }, | ||
| 420 | - // 导航 | ||
| 421 | - looklocation: function () { | ||
| 422 | - wx.reportMonitor('1015', 1) | ||
| 423 | - wx.openLocation({ | ||
| 424 | - latitude: Number(this.data.seller.lat), | ||
| 425 | - longitude: Number(this.data.seller.long), | ||
| 426 | - scale: 17, | ||
| 427 | - address: this.data.seller.addr, | ||
| 428 | - success: function (res) { | ||
| 429 | - console.log(res) | ||
| 430 | - } | ||
| 431 | - }) | ||
| 432 | - }, | ||
| 433 | // 获取包间图片列表 | 180 | // 获取包间图片列表 |
| 434 | getroomimage(sellerid) { | 181 | getroomimage(sellerid) { |
| 435 | App.Tables.GetTablesPhoto({ | 182 | App.Tables.GetTablesPhoto({ |
| @@ -458,16 +205,6 @@ Page({ | @@ -458,16 +205,6 @@ Page({ | ||
| 458 | urls: this.urlsValue, // 需要预览的图片http链接列表 | 205 | urls: this.urlsValue, // 需要预览的图片http链接列表 |
| 459 | }) | 206 | }) |
| 460 | }, | 207 | }, |
| 461 | - // 预览其他图片 | ||
| 462 | - lookImgs(e) { | ||
| 463 | - const url = e.currentTarget.dataset['url']; | ||
| 464 | - const imgs = e.currentTarget.dataset['imgs']; | ||
| 465 | - let urls = imgs ? imgs : [url] | ||
| 466 | - wx.previewImage({ | ||
| 467 | - current: url, | ||
| 468 | - urls, | ||
| 469 | - }) | ||
| 470 | - }, | ||
| 471 | // 获取店铺详情 | 208 | // 获取店铺详情 |
| 472 | getDetail() { | 209 | getDetail() { |
| 473 | App.Reserve.Detail({ | 210 | App.Reserve.Detail({ |
| @@ -555,135 +292,6 @@ Page({ | @@ -555,135 +292,6 @@ Page({ | ||
| 555 | console.log(res, '详情请求失败'); | 292 | console.log(res, '详情请求失败'); |
| 556 | }) | 293 | }) |
| 557 | }, | 294 | }, |
| 558 | - // 获取商家版本,不是超能版或者没有开通对应模块,不显示 | ||
| 559 | - getSellerVersionFun(sellerid) { | ||
| 560 | - App.SellerVersion.GetSellerVersion({ | ||
| 561 | - sellerid | ||
| 562 | - }).then((res) => { | ||
| 563 | - let data = res.data; | ||
| 564 | - console.log('版本列表', data); | ||
| 565 | - if (data && data.length > 0) { | ||
| 566 | - data.sort((a, b) => b.cdate * 1 - a.cdate * 1); | ||
| 567 | - // 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本) | ||
| 568 | - let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4); | ||
| 569 | - console.log('当前版本', { | ||
| 570 | - ...obj | ||
| 571 | - }); | ||
| 572 | - // 提前点餐功能:超能版 || 有提前点餐模块 | ||
| 573 | - const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6'); | ||
| 574 | - // 优惠券功能:超能版 || 高级版 || 有优惠券模块 | ||
| 575 | - const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8'); | ||
| 576 | - // 充值功能:超能版 || 有充值模块 | ||
| 577 | - const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9'); | ||
| 578 | - // 播报功能:超能版 || 标准版 || 标准版首年 || 高级版 | ||
| 579 | - const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4'; | ||
| 580 | - this.setData({ | ||
| 581 | - hasValueOrder, | ||
| 582 | - hasValueCertificate, | ||
| 583 | - hasValueRecharge, | ||
| 584 | - hasValueBroadcast, | ||
| 585 | - }) | ||
| 586 | - } | ||
| 587 | - }) | ||
| 588 | - }, | ||
| 589 | - // 通过预订ID查收定金详情 | ||
| 590 | - getPaymentStatus() { | ||
| 591 | - App.Reserve.GetReserveDepositByRid({ | ||
| 592 | - rid: this.data.options.id | ||
| 593 | - }).then(res => { | ||
| 594 | - if (res.ret == 200 && res.data && res.data.length > 0) { | ||
| 595 | - let data = res.data[0]; | ||
| 596 | - let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0'; | ||
| 597 | - let options = this.data.options | ||
| 598 | - this.setData({ | ||
| 599 | - paymentId: data.id, | ||
| 600 | - paymentStatus, | ||
| 601 | - isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1', | ||
| 602 | - }) | ||
| 603 | - } | ||
| 604 | - }) | ||
| 605 | - }, | ||
| 606 | - // 获取自定义图文内容 | ||
| 607 | - getText() { | ||
| 608 | - App.Reserve.GetReserveImgText({ | ||
| 609 | - rid: this.data.options.id | ||
| 610 | - }).then(res => { | ||
| 611 | - if (res.ret == 200 && res.data) { | ||
| 612 | - let data = res.data; | ||
| 613 | - let content = util.determine(data.content) | ||
| 614 | - console.log('自定义图文内容content', content); | ||
| 615 | - this.setData({ | ||
| 616 | - reserveData: { | ||
| 617 | - title: data.title || '', | ||
| 618 | - content, | ||
| 619 | - } | ||
| 620 | - }) | ||
| 621 | - } | ||
| 622 | - }) | ||
| 623 | - }, | ||
| 624 | - // 点击支付定金 | ||
| 625 | - paymentFun() { | ||
| 626 | - let that = this; | ||
| 627 | - let openid = getApp().openid; | ||
| 628 | - if (!openid) return wx.showToast({ | ||
| 629 | - title: '请在小程序中支付订金!', | ||
| 630 | - icon: 'none', | ||
| 631 | - }) | ||
| 632 | - App.PayOnline.CombineTransactionsByDeposit({ | ||
| 633 | - id: this.data.paymentId, | ||
| 634 | - openid, | ||
| 635 | - }).then(res => { | ||
| 636 | - if (res.ret == 200) { | ||
| 637 | - wx.requestPayment({ | ||
| 638 | - timeStamp: res.data.timeStamp + '', | ||
| 639 | - nonceStr: res.data.nonceStr, | ||
| 640 | - package: res.data.package, | ||
| 641 | - signType: res.data.signType, | ||
| 642 | - paySign: res.data.paySign, | ||
| 643 | - success(ress) { | ||
| 644 | - console.log('微信支付结果', ress); | ||
| 645 | - if (ress.errMsg == 'requestPayment:ok') { | ||
| 646 | - console.log('支付成功', ress); | ||
| 647 | - that.setData({ | ||
| 648 | - paymentStatus: '1', | ||
| 649 | - toastBool: true, | ||
| 650 | - toastText: '支付成功' | ||
| 651 | - }) | ||
| 652 | - that.hideToast(); | ||
| 653 | - return | ||
| 654 | - } | ||
| 655 | - console.log('支付失败1', ress); | ||
| 656 | - that.setData({ | ||
| 657 | - toastBool: true, | ||
| 658 | - toastText: '支付失败,请重新支付' | ||
| 659 | - }) | ||
| 660 | - that.hideToast(); | ||
| 661 | - }, | ||
| 662 | - fail(ress) { | ||
| 663 | - console.log('支付失败2', ress); | ||
| 664 | - that.setData({ | ||
| 665 | - toastBool: true, | ||
| 666 | - toastText: '支付失败,请重新支付' | ||
| 667 | - }) | ||
| 668 | - that.hideToast(); | ||
| 669 | - }, | ||
| 670 | - }) | ||
| 671 | - } else { | ||
| 672 | - wx.showToast({ | ||
| 673 | - title: res.msg, | ||
| 674 | - icon: 'none', | ||
| 675 | - }) | ||
| 676 | - } | ||
| 677 | - }) | ||
| 678 | - }, | ||
| 679 | - // 关闭支付失败或者成功弹框 | ||
| 680 | - hideToast() { | ||
| 681 | - setTimeout(() => { | ||
| 682 | - this.setData({ | ||
| 683 | - toastBool: false | ||
| 684 | - }) | ||
| 685 | - }, 1500) | ||
| 686 | - }, | ||
| 687 | // 客户经理获取基本信息 | 295 | // 客户经理获取基本信息 |
| 688 | getstaffinfo(uid, sid) { | 296 | getstaffinfo(uid, sid) { |
| 689 | App.Activity.GetCustomerActivityBaseinfo({ | 297 | App.Activity.GetCustomerActivityBaseinfo({ |
| @@ -733,77 +341,18 @@ Page({ | @@ -733,77 +341,18 @@ Page({ | ||
| 733 | }) | 341 | }) |
| 734 | } | 342 | } |
| 735 | }, | 343 | }, |
| 736 | - // 生成海报 | ||
| 737 | - painterBtn(liteStyle, timeStr) { | ||
| 738 | - let style = liteStyle.split('-'); | ||
| 739 | - let type1 = style[0]; | ||
| 740 | - let type2 = style[1]; | ||
| 741 | - let data = this.data.detail; | ||
| 742 | - let isMany = this.data.isMany; | ||
| 743 | - let img = data.seller.seller_image.replace(/^http:/, "https:"); | ||
| 744 | - let d = data.ddate_solt; | ||
| 745 | - let date1 = util.unixtoTime(data.ddate, 'MM月DD日'); | ||
| 746 | - let date2 = util.unixtoTime(data.ddate, 'MM/DD'); | ||
| 747 | - let week = ' ' + util.unixtoTime(data.ddate, '周WW'); | ||
| 748 | - let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname); | ||
| 749 | - let timeSlot2 = ' ' + this.data.seller.soltName; | ||
| 750 | - let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II') | ||
| 751 | - time = timeStr ? timeStr : time; | ||
| 752 | - let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')] | ||
| 753 | - let section = '' | ||
| 754 | - // 老样式123 | ||
| 755 | - if (type1 && !type2 && type1 != '4') { | ||
| 756 | - section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : ''; | ||
| 757 | - } | ||
| 758 | - // 新样式 | ||
| 759 | - if (type1 && type2) { | ||
| 760 | - if (type1 == '1') { | ||
| 761 | - section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : ''; | ||
| 762 | - } | ||
| 763 | - if (type1 == '2') { | ||
| 764 | - section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : ''; | ||
| 765 | - } | ||
| 766 | - if (type1 == '3' || type1 == '4') { | ||
| 767 | - section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : ''; | ||
| 768 | - } | ||
| 769 | - } | ||
| 770 | - if (type1 && !type2 && type1 == '4') { | ||
| 771 | - section = week + timeSlot2; | ||
| 772 | - } | ||
| 773 | - this.setData({ | ||
| 774 | - wxml: canvas({ | ||
| 775 | - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', | ||
| 776 | - info: { | ||
| 777 | - sellerName: data.seller.sellername, | ||
| 778 | - date: util.unixtoTime(data.ddate, 'MM月DD日'), | ||
| 779 | - time: section, | ||
| 780 | - oneTableName: data.oneTableName, | ||
| 781 | - }, | ||
| 782 | - type1, | ||
| 783 | - type2, | ||
| 784 | - date2, | ||
| 785 | - week, | ||
| 786 | - day2, | ||
| 787 | - }) | ||
| 788 | - }) | ||
| 789 | - }, | ||
| 790 | - onImgOK(e) { | ||
| 791 | - this.setData({ | ||
| 792 | - imgSrc: e.detail.path | ||
| 793 | - }) | ||
| 794 | - console.log('海报生成成功', this.data.imgSrc); | ||
| 795 | - }, | ||
| 796 | // 分享 | 344 | // 分享 |
| 797 | sharesetting() { | 345 | sharesetting() { |
| 798 | wx.reportMonitor('1017', 1) | 346 | wx.reportMonitor('1017', 1) |
| 799 | this.closeModal() | 347 | this.closeModal() |
| 800 | if (this.data.options.isOrder == '1' && this.data.detail.status != '4') { | 348 | if (this.data.options.isOrder == '1' && this.data.detail.status != '4') { |
| 349 | + let img = this.data.detail.seller.seller_image.replace(/^http:/, "https:"); | ||
| 801 | return { | 350 | return { |
| 802 | title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店', | 351 | title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店', |
| 803 | path: util.http_build_query({ | 352 | path: util.http_build_query({ |
| 804 | id: this.data.detail.seller.id | 353 | id: this.data.detail.seller.id |
| 805 | }, '/pages/reserve/shopHome'), | 354 | }, '/pages/reserve/shopHome'), |
| 806 | - imageUrl: this.data.detail.seller.seller_image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', | 355 | + imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', |
| 807 | } | 356 | } |
| 808 | } else { | 357 | } else { |
| 809 | let parmdata = { | 358 | let parmdata = { |
| @@ -822,33 +371,6 @@ Page({ | @@ -822,33 +371,6 @@ Page({ | ||
| 822 | } | 371 | } |
| 823 | } | 372 | } |
| 824 | }, | 373 | }, |
| 825 | - // 修改detail数据 | ||
| 826 | - formatDatail(details, dateSmart) { | ||
| 827 | - details.rdateStr = dateSmart; | ||
| 828 | - details.tableFirst = details.tables[0].name; | ||
| 829 | - if (details.tables.length > 1) { | ||
| 830 | - details.tableSubInfo = '等' + (details.tables.length) + '个' + | ||
| 831 | - (details.tables[0].tid == 2 ? '包间' : ''); | ||
| 832 | - } | ||
| 833 | - details.rname = details.rname.trim() | ||
| 834 | - if (details.rname && details.sex != 3) { | ||
| 835 | - let sexStr = details.sex == 1 ? '先生' : details.sex == 2 ? '女士' : details.sex == 4 ? '贵宾' : ''; | ||
| 836 | - let str = this.data.options.showSex == '2' ? '' : sexStr; | ||
| 837 | - details.rnameStr = details.rname + str | ||
| 838 | - } else if (!details.rname && details.sex == 4) { | ||
| 839 | - details.rnameStr = '贵宾' | ||
| 840 | - } else { | ||
| 841 | - details.rnameStr = details.rname | ||
| 842 | - } | ||
| 843 | - details.eatStr = '邀请您共进晚餐'; | ||
| 844 | - let hi = util.unixtoTime(details.ddate, 'HHII'); | ||
| 845 | - if (hi < '10:00') { | ||
| 846 | - details.eatStr = '邀请您共进早餐'; | ||
| 847 | - } else if (hi < '15:00') { | ||
| 848 | - details.eatStr = '邀请您共进午餐'; | ||
| 849 | - } | ||
| 850 | - return details; | ||
| 851 | - }, | ||
| 852 | // 获取商家设置营销信息 | 374 | // 获取商家设置营销信息 |
| 853 | getSellerTemplateConfFun(sid) { | 375 | getSellerTemplateConfFun(sid) { |
| 854 | App.Seller.GetSellerTemplateConf({ | 376 | App.Seller.GetSellerTemplateConf({ |
| @@ -924,6 +446,7 @@ Page({ | @@ -924,6 +446,7 @@ Page({ | ||
| 924 | this.setData({ | 446 | this.setData({ |
| 925 | ...obj | 447 | ...obj |
| 926 | }) | 448 | }) |
| 449 | + this.refreshActionBtn(obj) | ||
| 927 | // reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置 | 450 | // reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置 |
| 928 | let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve; | 451 | let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve; |
| 929 | this.textToSpeechFun(sid,i) | 452 | this.textToSpeechFun(sid,i) |
| @@ -931,266 +454,6 @@ Page({ | @@ -931,266 +454,6 @@ Page({ | ||
| 931 | console.log('GetSellerTemplateConf请求失败'); | 454 | console.log('GetSellerTemplateConf请求失败'); |
| 932 | }) | 455 | }) |
| 933 | }, | 456 | }, |
| 934 | - // 获取日期对应的时段 | ||
| 935 | - getLocalLunchTime(lite_style) { | ||
| 936 | - let detail = this.data.detail; | ||
| 937 | - let ddateStr = new Date(detail.ddate * 1000); | ||
| 938 | - let year = ddateStr.getFullYear(); | ||
| 939 | - let month = ddateStr.getMonth() + 1; | ||
| 940 | - let day = ddateStr.getDate(); | ||
| 941 | - let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); | ||
| 942 | - App.Seller.getMealSectionByDay({ | ||
| 943 | - sellerid: detail.seller.id, | ||
| 944 | - day: day1, | ||
| 945 | - }).then(res => { | ||
| 946 | - let data = res.data; | ||
| 947 | - let lunchDinnerList = []; | ||
| 948 | - let isMany = '0';//0默认餐段 1多时段 | ||
| 949 | - if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 950 | - isMany = '0'; | ||
| 951 | - data.forEach(i => { | ||
| 952 | - if (i.mname == '早餐') { | ||
| 953 | - lunchDinnerList.push({ | ||
| 954 | - mname: "早餐", | ||
| 955 | - mdate: i.mdate, | ||
| 956 | - ddate_solt: 1, | ||
| 957 | - }) | ||
| 958 | - } | ||
| 959 | - if (i.mname == '午餐') { | ||
| 960 | - lunchDinnerList.push({ | ||
| 961 | - mname: "午餐", | ||
| 962 | - mdate: i.mdate, | ||
| 963 | - ddate_solt: 2, | ||
| 964 | - }) | ||
| 965 | - } | ||
| 966 | - if (i.mname == '晚餐') { | ||
| 967 | - lunchDinnerList.push({ | ||
| 968 | - mname: "晚餐", | ||
| 969 | - mdate: i.mdate, | ||
| 970 | - ddate_solt: 3, | ||
| 971 | - }) | ||
| 972 | - } | ||
| 973 | - }) | ||
| 974 | - } else { | ||
| 975 | - isMany = '1'; | ||
| 976 | - lunchDinnerList = data; | ||
| 977 | - } | ||
| 978 | - let obj = lunchDinnerList.filter(i => { | ||
| 979 | - return i.ddate_solt == detail.ddate_solt | ||
| 980 | - }) | ||
| 981 | - var timeList = []; | ||
| 982 | - if (obj && obj.length > 0) { | ||
| 983 | - var time = obj[0].mdate.split("-"); | ||
| 984 | - timeList = this.computeHour(time[0], time[1], 15); | ||
| 985 | - } | ||
| 986 | - this.setData({ | ||
| 987 | - timeList, | ||
| 988 | - isMany, | ||
| 989 | - }) | ||
| 990 | - // 获取转发客人卡片设置 | ||
| 991 | - let lite = lite_style || '3'; | ||
| 992 | - let liteStyle = lite.split('-'); | ||
| 993 | - if (liteStyle[0] == '0') { | ||
| 994 | - this.setData({ | ||
| 995 | - imgSrc: detail.seller.seller_image | ||
| 996 | - }) | ||
| 997 | - } else { | ||
| 998 | - this.painterBtn(lite); | ||
| 999 | - } | ||
| 1000 | - }).catch(res => { | ||
| 1001 | - console.log(res, '获取多时段失败'); | ||
| 1002 | - }) | ||
| 1003 | - }, | ||
| 1004 | - // 点击商家有礼 | ||
| 1005 | - gotoSellerGift(e){ | ||
| 1006 | - this.couponModal.closeModal() | ||
| 1007 | - const form = e.currentTarget.dataset['form']; | ||
| 1008 | - let url = util.http_build_query({ | ||
| 1009 | - id: this.data.detail.id, | ||
| 1010 | - hasSellerShare: this.data.options.hasSellerShare, | ||
| 1011 | - form | ||
| 1012 | - }, '/pages/reserve/sellerGift') | ||
| 1013 | - wx.navigateTo({ | ||
| 1014 | - url | ||
| 1015 | - }) | ||
| 1016 | - }, | ||
| 1017 | - // 再次预订 | ||
| 1018 | - secondbook() { | ||
| 1019 | - wx.reportMonitor('1013', 1) | ||
| 1020 | - wx.redirectTo({ | ||
| 1021 | - url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id | ||
| 1022 | - }) | ||
| 1023 | - }, | ||
| 1024 | - // 文字转语音的方法 | ||
| 1025 | - textToSpeechFun(sid, reserve) { | ||
| 1026 | - console.log('reservereserve-----',reserve); | ||
| 1027 | - let play = (reserve && reserve.swich_voice == '1') ? '1' : '0'; | ||
| 1028 | - let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : ''; | ||
| 1029 | - let that = this; | ||
| 1030 | - let data = this.data; | ||
| 1031 | - App.Seller.GetVoiceWelcomeConfig({ | ||
| 1032 | - sid | ||
| 1033 | - }).then((json) => { | ||
| 1034 | - let content = ''; | ||
| 1035 | - // GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底 | ||
| 1036 | - if (!json.data && reserve == '0') { | ||
| 1037 | - json.data = { | ||
| 1038 | - is_voice_welcome: 1, | ||
| 1039 | - welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1040 | - invitee_same_as_reserver: 0, | ||
| 1041 | - invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1042 | - is_invitee_special_enabled: 1, | ||
| 1043 | - invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1044 | - special_reserve_types: ["生日宴"] | ||
| 1045 | - }; | ||
| 1046 | - } | ||
| 1047 | - console.log('jsondata----',json.data); | ||
| 1048 | - if (json.data) { | ||
| 1049 | - let config = json.data; | ||
| 1050 | - let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致 | ||
| 1051 | - let isReserver = data.options.hasSellerShare == '1'; | ||
| 1052 | - if (config.is_voice_welcome == '0') { | ||
| 1053 | - content = '' | ||
| 1054 | - } else if (sameAs == '1' || sameAs === 1) { | ||
| 1055 | - content = config.welcome_content || ''; | ||
| 1056 | - } else if (sameAs == '0' || sameAs === 0) { | ||
| 1057 | - if (isReserver) { | ||
| 1058 | - content = config.welcome_content || ''; | ||
| 1059 | - } else { | ||
| 1060 | - let specialEnabled = config.is_invitee_special_enabled == '1';//为1被请人播特殊模板 | ||
| 1061 | - let reserveType = data.detail.reserve_type || ''; | ||
| 1062 | - let specialTypes = config.special_reserve_types || []; | ||
| 1063 | - let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1; | ||
| 1064 | - content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || ''); | ||
| 1065 | - } | ||
| 1066 | - } | ||
| 1067 | - } else if (play == '1') { | ||
| 1068 | - content = voice_info; | ||
| 1069 | - } | ||
| 1070 | - console.log('content---', content); | ||
| 1071 | - if (!content) { | ||
| 1072 | - this.setData({ | ||
| 1073 | - newStr: '', | ||
| 1074 | - }) | ||
| 1075 | - return; | ||
| 1076 | - } | ||
| 1077 | - this.setData({ | ||
| 1078 | - isPlay: '1', | ||
| 1079 | - }) | ||
| 1080 | - data.detail.rname = data.detail.rname.trim() | ||
| 1081 | - let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : ''; | ||
| 1082 | - let charArray = data.seller.deskStr.split(''); | ||
| 1083 | - let modifiedArray = charArray.map(char => char + ' '); | ||
| 1084 | - let resultString = modifiedArray.join('').slice(0, -1); | ||
| 1085 | - const replacements = { | ||
| 1086 | - "{店铺名}": data.seller.name, | ||
| 1087 | - "{年月日}": data.seller.yearMonthDay, | ||
| 1088 | - "{月日}": data.seller.yearMonth, | ||
| 1089 | - "{餐段}": data.seller.soltName, | ||
| 1090 | - "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide, | ||
| 1091 | - "{包间名}": resultString, | ||
| 1092 | - "{区域名+包间名}": data.seller.tablesText, | ||
| 1093 | - "{经理名字}": data.staffinfo.name, | ||
| 1094 | - "{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '', | ||
| 1095 | - "{预订日期}": data.seller.yearMonthDay, | ||
| 1096 | - "{桌位}": resultString, | ||
| 1097 | - "{客人姓名}": data.detail.rname ? data.detail.rname : '', | ||
| 1098 | - "{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 1099 | - "{客人姓氏}": data.detail.rname ? data.detail.rname : '', | ||
| 1100 | - "{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 1101 | - "{用餐类型}": data.detail.reserve_type || '', | ||
| 1102 | - }; | ||
| 1103 | - let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) { | ||
| 1104 | - return replacements[matched]; | ||
| 1105 | - }); | ||
| 1106 | - console.log('newStr---', newStr); | ||
| 1107 | - this.setData({ | ||
| 1108 | - newStr, | ||
| 1109 | - }) | ||
| 1110 | - plugin.textToSpeech({ | ||
| 1111 | - lang: "zh_CN", | ||
| 1112 | - tts: true, | ||
| 1113 | - content: newStr, | ||
| 1114 | - success: function (res) { | ||
| 1115 | - that.filename = res.filename | ||
| 1116 | - that.speech() | ||
| 1117 | - }, | ||
| 1118 | - fail: function (res) { | ||
| 1119 | - console.log("fail tts", res) | ||
| 1120 | - } | ||
| 1121 | - }) | ||
| 1122 | - }).catch((err) => { | ||
| 1123 | - console.log('GetVoiceWelcomeConfig请求失败', err); | ||
| 1124 | - this.setData({ | ||
| 1125 | - newStr: '', | ||
| 1126 | - }) | ||
| 1127 | - }) | ||
| 1128 | - }, | ||
| 1129 | - // 开启语音播报 | ||
| 1130 | - speech() { | ||
| 1131 | - var attentionAnim = wx.createAnimation({ | ||
| 1132 | - duration: 1000, | ||
| 1133 | - timingFunction: 'linear', | ||
| 1134 | - }) | ||
| 1135 | - this.attentionAnim = attentionAnim | ||
| 1136 | - this.setData({ | ||
| 1137 | - _attentionAnim: attentionAnim, | ||
| 1138 | - attentionAnim: attentionAnim.export() | ||
| 1139 | - }) | ||
| 1140 | - this.audioCtx = wx.createInnerAudioContext() | ||
| 1141 | - this.audioCtx.src = this.filename | ||
| 1142 | - this.audioCtx.loop = true | ||
| 1143 | - this.audioCtx.play() | ||
| 1144 | - this.audioCtx.onPlay((e) => { | ||
| 1145 | - this.setData({ | ||
| 1146 | - isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 1147 | - }) | ||
| 1148 | - }) | ||
| 1149 | - this.audioCtx.onPause((e) => { | ||
| 1150 | - this.setData({ | ||
| 1151 | - isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 1152 | - }) | ||
| 1153 | - }) | ||
| 1154 | - clearInterval(this.timers) | ||
| 1155 | - this.animation() | ||
| 1156 | - }, | ||
| 1157 | - // 持续旋转动画 | ||
| 1158 | - animation() { | ||
| 1159 | - let that = this; | ||
| 1160 | - var time = setInterval(function () { | ||
| 1161 | - this.n = this.n + 1; | ||
| 1162 | - let attentionAnim = that.data._attentionAnim | ||
| 1163 | - attentionAnim.rotate(180 * (this.n)).step() | ||
| 1164 | - that.setData({ | ||
| 1165 | - attentionAnim: attentionAnim.export(), | ||
| 1166 | - }) | ||
| 1167 | - }.bind(this), 1000) | ||
| 1168 | - this.timers = time; | ||
| 1169 | - }, | ||
| 1170 | - // 暂停/继续播放 | ||
| 1171 | - stopMusic() { | ||
| 1172 | - if (this.data.isPlay == '2') { // 2 暂停状态 | ||
| 1173 | - console.log("开始"); | ||
| 1174 | - clearInterval(this.timers) | ||
| 1175 | - this.animation() | ||
| 1176 | - this.audioCtx.play() //开始 | ||
| 1177 | - return; | ||
| 1178 | - } | ||
| 1179 | - if (this.data.isPlay == '1') { // 1 运行状态 | ||
| 1180 | - console.log('暂停'); | ||
| 1181 | - if (this.n % 2 != 0) { | ||
| 1182 | - this.n = this.n + 1; | ||
| 1183 | - let attentionAnim = this.data._attentionAnim; | ||
| 1184 | - attentionAnim.rotate(180 * this.n).step(); | ||
| 1185 | - this.setData({ | ||
| 1186 | - attentionAnim: attentionAnim.export(), | ||
| 1187 | - }) | ||
| 1188 | - } | ||
| 1189 | - clearInterval(this.timers) | ||
| 1190 | - this.audioCtx.pause() //暂停 | ||
| 1191 | - return; | ||
| 1192 | - } | ||
| 1193 | - }, | ||
| 1194 | // 根据充值ID获取充值详情 | 457 | // 根据充值ID获取充值详情 |
| 1195 | getRechargeDetail(id) { | 458 | getRechargeDetail(id) { |
| 1196 | App.Activity.GetNewRecharge({ | 459 | App.Activity.GetNewRecharge({ |
| @@ -1221,18 +484,6 @@ Page({ | @@ -1221,18 +484,6 @@ Page({ | ||
| 1221 | } | 484 | } |
| 1222 | }) | 485 | }) |
| 1223 | }, | 486 | }, |
| 1224 | - // 选择充值活动 | ||
| 1225 | - checkRechargeData(e) { | ||
| 1226 | - let id = e.currentTarget.dataset['id']; | ||
| 1227 | - let obj = this.data.recharge_data.filter(item => { | ||
| 1228 | - return item.id == id | ||
| 1229 | - }) | ||
| 1230 | - if (obj && obj.length > 0) { | ||
| 1231 | - this.setData({ | ||
| 1232 | - activeData: obj[0] | ||
| 1233 | - }) | ||
| 1234 | - } | ||
| 1235 | - }, | ||
| 1236 | // 获取评价赠送的券最新详情 | 487 | // 获取评价赠送的券最新详情 |
| 1237 | getEvaluateFun(id) { | 488 | getEvaluateFun(id) { |
| 1238 | App.Activity.GetActivityById({ | 489 | App.Activity.GetActivityById({ |
| @@ -1422,24 +673,6 @@ Page({ | @@ -1422,24 +673,6 @@ Page({ | ||
| 1422 | } | 673 | } |
| 1423 | }) | 674 | }) |
| 1424 | }, | 675 | }, |
| 1425 | - // 获取所有的券并且展示 | ||
| 1426 | - addCoupons(coupons, couponList) { | ||
| 1427 | - if (coupons && util.getType(coupons) == 'object') { | ||
| 1428 | - couponList.push({ | ||
| 1429 | - id: coupon.id, | ||
| 1430 | - number: coupon.number | ||
| 1431 | - }); | ||
| 1432 | - } | ||
| 1433 | - if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) { | ||
| 1434 | - coupons.forEach(item => { | ||
| 1435 | - couponList.push({ | ||
| 1436 | - id: item.id, | ||
| 1437 | - number: item.number | ||
| 1438 | - }); | ||
| 1439 | - }); | ||
| 1440 | - } | ||
| 1441 | - return couponList | ||
| 1442 | - }, | ||
| 1443 | // 弹框领取免费券 | 676 | // 弹框领取免费券 |
| 1444 | setcouponFun() { | 677 | setcouponFun() { |
| 1445 | let arr = this.data.couponArr; | 678 | let arr = this.data.couponArr; |
| @@ -1621,61 +854,6 @@ Page({ | @@ -1621,61 +854,6 @@ Page({ | ||
| 1621 | } | 854 | } |
| 1622 | }) | 855 | }) |
| 1623 | }, | 856 | }, |
| 1624 | - // 计算免费券有效期的起始、结束日期 | ||
| 1625 | - setTimeRange(cdate, startOffset, endOffset) { | ||
| 1626 | - const startDate = new Date((cdate + startOffset * 86400) * 1000); | ||
| 1627 | - startDate.setHours(0, 0, 0, 0); | ||
| 1628 | - const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1629 | - const endDate = new Date((cdate + endOffset * 86400) * 1000); | ||
| 1630 | - endDate.setHours(23, 59, 59, 0); | ||
| 1631 | - const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1632 | - let useEtimeNum = endDate.getTime() / 1000; | ||
| 1633 | - return { useStime, useEtime,useEtimeNum }; | ||
| 1634 | - }, | ||
| 1635 | - // 处理优惠券不可用日期数据 | ||
| 1636 | - hasConsecutiveSelect(arr, type) { | ||
| 1637 | - let firstTitle = null; | ||
| 1638 | - let lastTitle = null; | ||
| 1639 | - let rArr = [] | ||
| 1640 | - let num = 0 | ||
| 1641 | - for (let i = 0; i < arr.length; i++) { | ||
| 1642 | - let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : ''; | ||
| 1643 | - if (str) { | ||
| 1644 | - rArr.push(arr[i].title) | ||
| 1645 | - num++ | ||
| 1646 | - if (num == 1) { | ||
| 1647 | - firstTitle = arr[i].title | ||
| 1648 | - } | ||
| 1649 | - if (num >= 5) { | ||
| 1650 | - lastTitle = arr[i].title | ||
| 1651 | - } | ||
| 1652 | - if (num >= 5 && i >= (arr.length - 1)) { | ||
| 1653 | - let fi = rArr.findIndex((item) => { | ||
| 1654 | - return item == firstTitle | ||
| 1655 | - }) | ||
| 1656 | - rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 1657 | - num = 0 | ||
| 1658 | - } | ||
| 1659 | - } else { | ||
| 1660 | - if (num < 5) { | ||
| 1661 | - num = 0 | ||
| 1662 | - firstTitle = null; | ||
| 1663 | - lastTitle = null; | ||
| 1664 | - } else { | ||
| 1665 | - let fi = rArr.findIndex((item) => { | ||
| 1666 | - return item == firstTitle | ||
| 1667 | - }) | ||
| 1668 | - rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 1669 | - num = 0 | ||
| 1670 | - } | ||
| 1671 | - } | ||
| 1672 | - } | ||
| 1673 | - return { | ||
| 1674 | - rArr, | ||
| 1675 | - lastTitle, | ||
| 1676 | - firstTitle | ||
| 1677 | - }; | ||
| 1678 | - }, | ||
| 1679 | /** | 857 | /** |
| 1680 | * 生命周期函数--监听页面隐藏 | 858 | * 生命周期函数--监听页面隐藏 |
| 1681 | */ | 859 | */ |
| @@ -1695,53 +873,6 @@ Page({ | @@ -1695,53 +873,6 @@ Page({ | ||
| 1695 | this.audioCtx.destroy(); // 释放音频资源 | 873 | this.audioCtx.destroy(); // 释放音频资源 |
| 1696 | } | 874 | } |
| 1697 | }, | 875 | }, |
| 1698 | - // 设置虚拟到店时间 | ||
| 1699 | - bindPickerChange: function (e) { | ||
| 1700 | - let index = e.detail.value | ||
| 1701 | - let temp_ddate = this.data.timeList[index] | ||
| 1702 | - this.setData({ | ||
| 1703 | - temp_ddate | ||
| 1704 | - }) | ||
| 1705 | - let detailInfo = this.data.detail; | ||
| 1706 | - const reserveDate = new Date(detailInfo.ddate * 1000); | ||
| 1707 | - let reserveTime = | ||
| 1708 | - reserveDate.getFullYear() + | ||
| 1709 | - "-" + | ||
| 1710 | - (reserveDate.getMonth() + 1) + | ||
| 1711 | - "-" + | ||
| 1712 | - reserveDate.getDate(); | ||
| 1713 | - let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000 | ||
| 1714 | - App.Reserve.SetReserveTempDdate({ | ||
| 1715 | - rid: this.id, | ||
| 1716 | - temp_ddate: times, | ||
| 1717 | - }).then(res => { | ||
| 1718 | - if (res.ret == 200) { | ||
| 1719 | - let lite_style = this.data.lite_style | ||
| 1720 | - lite_style = lite_style || '3'; | ||
| 1721 | - let style =lite_style.split('-'); | ||
| 1722 | - let type1 =style[0]; | ||
| 1723 | - let type2 =style[1]; | ||
| 1724 | - if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1=='4' && !type2))){ | ||
| 1725 | - let time = temp_ddate || this.data.timeList[index] | ||
| 1726 | - this.painterBtn( | ||
| 1727 | - lite_style, | ||
| 1728 | - time | ||
| 1729 | - ); | ||
| 1730 | - } | ||
| 1731 | - } | ||
| 1732 | - }) | ||
| 1733 | - }, | ||
| 1734 | - // ios 部分机型不兼容new Date() 转换字符串 | ||
| 1735 | - getNewDate(data) { | ||
| 1736 | - if (typeof data === 'string') { | ||
| 1737 | - let arr = data.split(/[- : \/]/) | ||
| 1738 | - if (arr[1] !== undefined || arr[1] !== null) { | ||
| 1739 | - arr[1] = arr[1] - 1 | ||
| 1740 | - } | ||
| 1741 | - return new Date(...arr) | ||
| 1742 | - } | ||
| 1743 | - return new Date(data || new Date()) | ||
| 1744 | - }, | ||
| 1745 | // 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画 | 876 | // 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画 |
| 1746 | startAnimation() { | 877 | startAnimation() { |
| 1747 | const animation = wx.createAnimation({ | 878 | const animation = wx.createAnimation({ |
| @@ -1759,108 +890,4 @@ Page({ | @@ -1759,108 +890,4 @@ Page({ | ||
| 1759 | this.startSecondAnimation(); | 890 | this.startSecondAnimation(); |
| 1760 | }, 800); | 891 | }, 800); |
| 1761 | }, | 892 | }, |
| 1762 | - // 出现商家有礼图标,并且晃动2下 | ||
| 1763 | - startSecondAnimation() { | ||
| 1764 | - const animation = wx.createAnimation({ | ||
| 1765 | - duration: 200, | ||
| 1766 | - timingFunction: 'ease' | ||
| 1767 | - }); | ||
| 1768 | - animation.scale(1).step() | ||
| 1769 | - .rotate(-15).step() | ||
| 1770 | - .rotate(15).step() | ||
| 1771 | - .rotate(-15).step() | ||
| 1772 | - .rotate(15).step() | ||
| 1773 | - .rotate(0).step(); | ||
| 1774 | - this.setData({ | ||
| 1775 | - animationData2: animation.export() | ||
| 1776 | - }); | ||
| 1777 | - }, | ||
| 1778 | - //根据起始时间(获取时间时间段) | ||
| 1779 | - computeHour(time1, time2, interval) { | ||
| 1780 | - //time1 开始时间 time2结束时间 interval间隔时长 | ||
| 1781 | - function getTimeList(time1, time2, interval) { | ||
| 1782 | - var timeList = []; | ||
| 1783 | - time1 = time1.split(":"); | ||
| 1784 | - time2 = time2.split(":"); | ||
| 1785 | - time1 = new Date(0, 0, 0, time1[0], time1[1], 0); | ||
| 1786 | - time2 = new Date(0, 0, 0, time2[0], time2[1], 0); | ||
| 1787 | - interval = interval * 60 * 1000; | ||
| 1788 | - while (time1 <= time2) { | ||
| 1789 | - timeList.push(time1.format("hh:mm")); | ||
| 1790 | - time1 = new Date(time1.getTime() + interval); | ||
| 1791 | - } | ||
| 1792 | - return timeList; | ||
| 1793 | - } | ||
| 1794 | - Date.prototype.format = function (format) { | ||
| 1795 | - var date = { | ||
| 1796 | - "M+": this.getMonth() + 1, | ||
| 1797 | - "d+": this.getDate(), | ||
| 1798 | - "h+": this.getHours(), | ||
| 1799 | - "m+": this.getMinutes(), | ||
| 1800 | - "s+": this.getSeconds(), | ||
| 1801 | - "q+": Math.floor((this.getMonth() + 3) / 3), | ||
| 1802 | - S: this.getMilliseconds(), | ||
| 1803 | - }; | ||
| 1804 | - if (/(y+)/.test(format)) | ||
| 1805 | - format = format.replace( | ||
| 1806 | - RegExp.$1, | ||
| 1807 | - (this.getFullYear() + "").substr(4 - RegExp.$1.length) | ||
| 1808 | - ); | ||
| 1809 | - for (var k in date) | ||
| 1810 | - if (new RegExp("(" + k + ")").test(format)) | ||
| 1811 | - format = format.replace( | ||
| 1812 | - RegExp.$1, | ||
| 1813 | - RegExp.$1.length == 1 ? | ||
| 1814 | - date[k] : | ||
| 1815 | - ("00" + date[k]).substr(("" + date[k]).length) | ||
| 1816 | - ); | ||
| 1817 | - return format; | ||
| 1818 | - }; | ||
| 1819 | - return getTimeList(time1, time2, interval); | ||
| 1820 | - }, | ||
| 1821 | - // 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨) | ||
| 1822 | - processInfo(intel, type) { | ||
| 1823 | - let imgs = []; | ||
| 1824 | - intel.textInfo = ''; | ||
| 1825 | - intel.imgsInfo = []; | ||
| 1826 | - intel.videoImgsInfo = []; | ||
| 1827 | - if (type == '1' && intel.is_introduce_all == '1') { | ||
| 1828 | - if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) { | ||
| 1829 | - intel.textInfo = intel.park_info; | ||
| 1830 | - imgs = intel.park_info_images | ||
| 1831 | - } | ||
| 1832 | - } | ||
| 1833 | - if (type == '2') { | ||
| 1834 | - imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : []; | ||
| 1835 | - intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : ''; | ||
| 1836 | - } | ||
| 1837 | - if (type == '3') { | ||
| 1838 | - imgs = intel.images || [] | ||
| 1839 | - intel.textInfo = ''; | ||
| 1840 | - } | ||
| 1841 | - if (type == '4') { | ||
| 1842 | - imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : [] | ||
| 1843 | - intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : ''; | ||
| 1844 | - } | ||
| 1845 | - intel.imgsInfo = imgs; | ||
| 1846 | - if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') { | ||
| 1847 | - intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n'); | ||
| 1848 | - intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content); | ||
| 1849 | - intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content)); | ||
| 1850 | - } | ||
| 1851 | - return intel | ||
| 1852 | - }, | ||
| 1853 | - /** | ||
| 1854 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
| 1855 | - */ | ||
| 1856 | - onPullDownRefresh() { | ||
| 1857 | - | ||
| 1858 | - }, | ||
| 1859 | - | ||
| 1860 | - /** | ||
| 1861 | - * 页面上拉触底事件的处理函数 | ||
| 1862 | - */ | ||
| 1863 | - onReachBottom() { | ||
| 1864 | - | ||
| 1865 | - }, | ||
| 1866 | }) | 893 | }) |
| 1 | <!--pack-invitation/pages/detail_owner_invitation10.wxml--> | 1 | <!--pack-invitation/pages/detail_owner_invitation10.wxml--> |
| 2 | +<import src="../common/parts.wxml" /> | ||
| 2 | <import src="../../pages/tpl/invitation"></import> | 3 | <import src="../../pages/tpl/invitation"></import> |
| 3 | <nav hasHome class="navhome" backgroundColor="#ffeddc" place="{{true}}"></nav> | 4 | <nav hasHome class="navhome" backgroundColor="#ffeddc" place="{{true}}"></nav> |
| 4 | <scroll-view scroll-y class="viewBox"> | 5 | <scroll-view scroll-y class="viewBox"> |
| 5 | - <image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" /> | ||
| 6 | - <image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}" | ||
| 7 | - bindtap="gotoSellerGift" | ||
| 8 | - data-form="1" | ||
| 9 | - animation="{{animationData2}}" | ||
| 10 | - wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" | ||
| 11 | - src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode=""/> | ||
| 12 | - <view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}"> | ||
| 13 | - <image src="https://qn.colorcun.com/getCouponIcon2.png" mode=""/> | ||
| 14 | - </view> | 6 | + <!-- 音乐开关 --> |
| 7 | + <template is="musicImg" data="{{newStr: newStr, isPlay: isPlay, attentionAnim: attentionAnim}}" /> | ||
| 8 | + <!-- 商家有礼悬浮入口 --> | ||
| 9 | + <template is="giftImg" data="{{hasValueCertificate: hasValueCertificate, marketing: marketing, coupon_dataList: coupon_dataList, isFrame: isFrame, is_comments: is_comments, is_user_comments: is_user_comments, couponData: couponData, hasValueRecharge: hasValueRecharge, recharge_data: recharge_data, animationData2: animationData2}}" /> | ||
| 10 | + <!-- 领券全屏浮层 --> | ||
| 11 | + <template is="fullscreenMask" data="{{isShow: isShow, animationData: animationData}}" /> | ||
| 15 | <view class="targetPoint" style="top: 35%; right: 4%;"></view> | 12 | <view class="targetPoint" style="top: 35%; right: 4%;"></view> |
| 16 | - <image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> | ||
| 17 | - <image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" /> | 13 | + <!-- 已取消/已结束 状态角标 --> |
| 14 | + <template is="statusBadge" data="{{detail: detail, options: options}}" /> | ||
| 18 | <view class="reservationInfo {{options.bookType ? 'birthdaySty' : 'noBirthday'}} {{options.hasSellerShare == '1' ? 'noBirthday1' : '' }}"> | 15 | <view class="reservationInfo {{options.bookType ? 'birthdaySty' : 'noBirthday'}} {{options.hasSellerShare == '1' ? 'noBirthday1' : '' }}"> |
| 19 | <view class="infoTop"> | 16 | <view class="infoTop"> |
| 20 | <text space="nbsp" class="font48r">{{seller.name||reserve.seller_name}}</text> | 17 | <text space="nbsp" class="font48r">{{seller.name||reserve.seller_name}}</text> |
| @@ -326,67 +323,10 @@ | @@ -326,67 +323,10 @@ | ||
| 326 | {{toastText}} | 323 | {{toastText}} |
| 327 | </view> | 324 | </view> |
| 328 | </scroll-view> | 325 | </scroll-view> |
| 329 | -<!-- (开启在线预订 显示在线预订) || (未开启在线预订 显示再次预订(打商家电话)) --> | ||
| 330 | -<!-- (未结束&&未取消 && 开启转发开关 显示 转发邀请函给客人) || (过了当前餐段结束时间||用餐完成||已取消 显示 转发店铺给好友) --> | ||
| 331 | -<view wx:if="{{isMoreBtn || options.isOrder == '1' || (!isMoreBtn && seller.phone) || (detail.status !='4' && isPaymenBtn) || (detail.status !='4' && isShareItem)}}" class="flex-lr sharewidth"> | ||
| 332 | - <view wx:if="{{isMoreBtn}}" class="flex-cc font30r moreBtn {{(((detail.status !='4' && isPaymenBtn) || (reserveOpenid != openid && options.isOrder != '1' && options.hasSellerShare!='1' && isShowBtn && options.isMeeting == '1')) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="secondbook">再次预订</view> | ||
| 333 | - <view wx:if="{{!isMoreBtn && seller.phone}}" class="flex-cc font30r moreBtn {{((detail.status !='4' && isPaymenBtn) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view> | ||
| 334 | - <view wx:if="{{detail.status !='4' && isPaymenBtn}}" class="flex-cc font30r paymenBtn {{((isMoreBtn || (!isMoreBtn && seller.phone)) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="paymentFun">支付定金</view> | ||
| 335 | - <block wx:if="{{options.hasSellerShare == '1'}}"> | ||
| 336 | - <button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button> | ||
| 337 | - <button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button> | ||
| 338 | - </block> | ||
| 339 | - <block wx:if="{{options.hasSellerShare != '1'}}"> | ||
| 340 | - <button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" open-type="share">转发邀请函</button> | ||
| 341 | - <button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" data-type="2" open-type="share">转发邀请函</button> | ||
| 342 | - <block wx:if="{{wxNickname && purePhoneNumber && options.isMeeting == '1'}}"> | ||
| 343 | - <button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 344 | - </block> | ||
| 345 | - <block wx:if="{{(!wxNickname || !purePhoneNumber) && options.isMeeting == '1'}}"> | ||
| 346 | - <button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 347 | - </block> | ||
| 348 | - </block> | ||
| 349 | -</view> | 326 | +<!-- 底部操作栏 --> |
| 327 | +<template is="actionBar" data="{{barWrapClass: 'flex-lr sharewidth', barShow: barShow, showMoreOnline: showMoreOnline, threeBtnMore: threeBtnMore, showMoreCall: showMoreCall, threeBtnCall: threeBtnCall, seller: seller, canPay: canPay, threeBtnPay: threeBtnPay, isOwner: isOwner, canShare: canShare, isOver: isOver, guestShareCls: guestShareCls, canMeet: canMeet, needLogin: needLogin}}" /> | ||
| 350 | <painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" /> | 328 | <painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" /> |
| 351 | -<my-modal id="payModal" fadeStyle="slideUp" height="240px"> | ||
| 352 | - <view slot="modalName" class="titleModal">提示</view> | ||
| 353 | - <view slot="modalContent"> | ||
| 354 | - <view class="explain"> | ||
| 355 | - 检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦! | ||
| 356 | - </view> | ||
| 357 | - <view class="screenshotBtns"> | ||
| 358 | - <button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button> | ||
| 359 | - <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> | ||
| 360 | - </view> | ||
| 361 | - </view> | ||
| 362 | -</my-modal> | ||
| 363 | -<my-modal id="couponModal" fadeStyle="slideUp" height="240px"> | ||
| 364 | - <view slot="modalContent"> | ||
| 365 | - <view class="titleModal"> | ||
| 366 | - <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode=""/> | ||
| 367 | - <view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view> | ||
| 368 | - <view class="couponTotal font28r" wx:if="{{totalPrice}}"> | ||
| 369 | - 赠送给您代金券 | ||
| 370 | - <view class="counterText"> | ||
| 371 | - <view class="font36r">¥</view><scroll-number value="{{totalPrice}}"></scroll-number> | ||
| 372 | - </view> | ||
| 373 | - </view> | ||
| 374 | - </view> | ||
| 375 | - <view class="couponWrap"> | ||
| 376 | - <view class="couponInfo font48r"> | ||
| 377 | - <text class="font48r">到店微信扫码</text> | ||
| 378 | - <text class="font48r">自动识别</text> | ||
| 379 | - </view> | ||
| 380 | - <block wx:if="{{!purePhoneNumber}}"> | ||
| 381 | - <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button> | ||
| 382 | - </block> | ||
| 383 | - <block wx:else> | ||
| 384 | - <subscribe ids="{{[2]}}" bindtap="setcouponFun"> | ||
| 385 | - <view class="couponBtn couponBtn1 font40r">欣然收下</view> | ||
| 386 | - </subscribe> | ||
| 387 | - </block> | ||
| 388 | - <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view> | ||
| 389 | - </view> | ||
| 390 | - <view class="closeBox font28r">{{countDown}} 秒后自动关闭</view> | ||
| 391 | - </view> | ||
| 392 | -</my-modal> | ||
| 329 | +<!-- 截屏提示弹窗 --> | ||
| 330 | +<template is="payModal" data="{{detail: detail, options: options, marketing: marketing, imgSrc: imgSrc}}" /> | ||
| 331 | +<!-- 领券弹窗(2~12 通用;13 保持页面内独立) --> | ||
| 332 | +<template is="couponModal" data="{{seller: seller, reserve: reserve, totalPrice: totalPrice, purePhoneNumber: purePhoneNumber, countDown: countDown}}" /> |
| @@ -6,11 +6,26 @@ import TP from '../../utils/tpls'; | @@ -6,11 +6,26 @@ import TP from '../../utils/tpls'; | ||
| 6 | import RS from '../../utils/reserveStatus' | 6 | import RS from '../../utils/reserveStatus' |
| 7 | var plugin = requirePlugin("WechatSI"); | 7 | var plugin = requirePlugin("WechatSI"); |
| 8 | import canvas from "../../pages/customer/canvas" | 8 | import canvas from "../../pages/customer/canvas" |
| 9 | +import inviteBase from '../common/inviteBase'; | ||
| 9 | Page({ | 10 | Page({ |
| 11 | + ...inviteBase, | ||
| 10 | /** | 12 | /** |
| 11 | * 页面的初始数据 | 13 | * 页面的初始数据 |
| 12 | */ | 14 | */ |
| 13 | data: { | 15 | data: { |
| 16 | + barShow: false, //底部操作栏是否显示 | ||
| 17 | + showMoreOnline: false, //再次预订-在线 | ||
| 18 | + showMoreCall: false, //再次预订-电话 | ||
| 19 | + canPay: false, //支付定金 | ||
| 20 | + canShare: false, //转发邀请函 | ||
| 21 | + isOver: false, //已结束/完成 | ||
| 22 | + isOwner: false, //商家(发起人)视角 | ||
| 23 | + canMeet: false, //客人可确认赴约 | ||
| 24 | + needLogin: true, //确认赴约需先登录/授权 | ||
| 25 | + guestShareCls: 'shareItem shareItem1', //客人转发按钮样式 | ||
| 26 | + threeBtnMore: '', //3按钮布局(在线再次预订) | ||
| 27 | + threeBtnCall: '', //3按钮布局(电话再次预订) | ||
| 28 | + threeBtnPay: '', //3按钮布局(支付定金) | ||
| 14 | show_white: false, | 29 | show_white: false, |
| 15 | options: { | 30 | options: { |
| 16 | tplid: '' | 31 | tplid: '' |
| @@ -127,138 +142,6 @@ Page({ | @@ -127,138 +142,6 @@ Page({ | ||
| 127 | }) | 142 | }) |
| 128 | this.couponModal = this.selectComponent("#couponModal"); | 143 | this.couponModal = this.selectComponent("#couponModal"); |
| 129 | }, | 144 | }, |
| 130 | - // 跳转登录页 | ||
| 131 | - gotoLogin(event, type) { | ||
| 132 | - console.log(111); | ||
| 133 | - const types = type ? type : event.currentTarget.dataset.types; | ||
| 134 | - let params = { | ||
| 135 | - types, //1邀请函领券 2赴约 | ||
| 136 | - id: this.id, | ||
| 137 | - } | ||
| 138 | - if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr) | ||
| 139 | - let url = util.http_build_query(params, '/pages/customer/login') | ||
| 140 | - wx.navigateTo({ | ||
| 141 | - url | ||
| 142 | - }) | ||
| 143 | - }, | ||
| 144 | - // 获取是否点击过赴约 | ||
| 145 | - getreal() { | ||
| 146 | - App.Reserve.GetIsRelaSuccess({ | ||
| 147 | - openid: getApp().openid, | ||
| 148 | - rid: this.id, | ||
| 149 | - }).then((json) => { | ||
| 150 | - if (json.ret == 200) { | ||
| 151 | - console.log('是否点击赴约=-----', json.data); | ||
| 152 | - this.setData({ | ||
| 153 | - isShowBtn: !json.data, //返回false 代表没有点赴约 | ||
| 154 | - }) | ||
| 155 | - } | ||
| 156 | - }) | ||
| 157 | - }, | ||
| 158 | - // 领券-获取code、手机号 | ||
| 159 | - getPhoneNumberCouponFun(e) { | ||
| 160 | - if (e.detail && e.detail.code && !this.data.purePhoneNumber) { | ||
| 161 | - App.Wechat.GetUserPhoneNumber({ | ||
| 162 | - code: e.detail.code, | ||
| 163 | - }).then(res => { | ||
| 164 | - if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 165 | - this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 166 | - } else { | ||
| 167 | - console.log('点了拒绝1'); | ||
| 168 | - this.couponModal.closeModal() | ||
| 169 | - this.gotoLogin('', '1') | ||
| 170 | - } | ||
| 171 | - }) | ||
| 172 | - } else { | ||
| 173 | - console.log('点了拒绝2'); | ||
| 174 | - this.couponModal.closeModal() | ||
| 175 | - this.gotoLogin('', '1') | ||
| 176 | - } | ||
| 177 | - }, | ||
| 178 | - // 用户绑定手机号 | ||
| 179 | - bindUserPhoneFun(purePhoneNumber) { | ||
| 180 | - App.Wechat.BindUserPhone({ | ||
| 181 | - phone: purePhoneNumber, | ||
| 182 | - openid: getApp().openid | ||
| 183 | - }).then(res => { | ||
| 184 | - if (res.ret == 200) { | ||
| 185 | - this.setData({ | ||
| 186 | - purePhoneNumber | ||
| 187 | - }) | ||
| 188 | - this.setcouponFun() | ||
| 189 | - } | ||
| 190 | - }) | ||
| 191 | - }, | ||
| 192 | - // 获取code、手机号 | ||
| 193 | - getPhoneNumberFun(e) { | ||
| 194 | - console.log('获取code', e.detail); | ||
| 195 | - if (e.detail && e.detail.code) { | ||
| 196 | - App.Wechat.GetUserPhoneNumber({ | ||
| 197 | - code: e.detail.code, | ||
| 198 | - }).then(res => { | ||
| 199 | - if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) { | ||
| 200 | - this.setData({ | ||
| 201 | - purePhoneNumber: res.data.phone_info.purePhoneNumber, | ||
| 202 | - }) | ||
| 203 | - this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber) | ||
| 204 | - this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber) | ||
| 205 | - } else { | ||
| 206 | - util.toast('手机号获取失败!', 'none') | ||
| 207 | - } | ||
| 208 | - }) | ||
| 209 | - } | ||
| 210 | - }, | ||
| 211 | - // 获取用户在商家的账户余额 | ||
| 212 | - getUserRechargeInfo(phone) { | ||
| 213 | - App.Activity.GetRechargeBalanceByOpenid({ | ||
| 214 | - openid: getApp().openid, | ||
| 215 | - phone, | ||
| 216 | - sellerid: this.data.seller.sid, | ||
| 217 | - }).then((json) => { | ||
| 218 | - if (json.ret == 200) { | ||
| 219 | - let data = json.data; | ||
| 220 | - if (!data) { | ||
| 221 | - this.createInfoFun(phone) | ||
| 222 | - console.log('用户在商家没有账号'); | ||
| 223 | - } | ||
| 224 | - } | ||
| 225 | - }) | ||
| 226 | - }, | ||
| 227 | - // 如果该用户不存在账户 新增用户在商家的账户信息 | ||
| 228 | - createInfoFun(phone) { | ||
| 229 | - let params = { | ||
| 230 | - openid: getApp().openid, | ||
| 231 | - sellerid: this.data.seller.sid, | ||
| 232 | - phone | ||
| 233 | - } | ||
| 234 | - App.Activity.CreateCustomerConsumeSeller(params).then(res => { | ||
| 235 | - if (res.ret == 200) { | ||
| 236 | - console.log('新增用户在商家的账户信息----', res); | ||
| 237 | - } | ||
| 238 | - }) | ||
| 239 | - }, | ||
| 240 | - // 赴约手机号传参 | ||
| 241 | - confirmed() { | ||
| 242 | - let userinfo = JSON.stringify({ | ||
| 243 | - openid: getApp().openid, | ||
| 244 | - avatar: this.data.wxAvatar, | ||
| 245 | - nickname: this.data.wxNickname, | ||
| 246 | - }) | ||
| 247 | - App.Reserve.SetRelaSuccess({ | ||
| 248 | - rid: this.id, | ||
| 249 | - openid: getApp().openid, | ||
| 250 | - is_agree: 1, | ||
| 251 | - inviting_phone: this.data.purePhoneNumber, | ||
| 252 | - userinfo | ||
| 253 | - }).then(res => { | ||
| 254 | - if (res.ret == 200) { | ||
| 255 | - util.toast('赴约成功', 'none') | ||
| 256 | - this.setData({ | ||
| 257 | - isShowBtn: false, | ||
| 258 | - }) | ||
| 259 | - } | ||
| 260 | - }) | ||
| 261 | - }, | ||
| 262 | // 锚点定位 | 145 | // 锚点定位 |
| 263 | gotoModule(e) { | 146 | gotoModule(e) { |
| 264 | const type = e.currentTarget.dataset['type']; | 147 | const type = e.currentTarget.dataset['type']; |
| @@ -277,56 +160,6 @@ Page({ | @@ -277,56 +160,6 @@ Page({ | ||
| 277 | }); | 160 | }); |
| 278 | } | 161 | } |
| 279 | }, | 162 | }, |
| 280 | - // 打开送券弹框 | ||
| 281 | - showCouponModal() { | ||
| 282 | - this.couponModal.showModal() | ||
| 283 | - this.setData({ | ||
| 284 | - countDown: 5, | ||
| 285 | - }) | ||
| 286 | - if (this.data.timer) { | ||
| 287 | - clearInterval(this.data.timer); | ||
| 288 | - } | ||
| 289 | - this.startCountDown(); | ||
| 290 | - }, | ||
| 291 | - // 开始倒计时 | ||
| 292 | - startCountDown() { | ||
| 293 | - let that = this; | ||
| 294 | - const timer = setInterval(() => { | ||
| 295 | - if (that.data.countDown <= 1) { | ||
| 296 | - that.closeCouponModal() | ||
| 297 | - clearInterval(timer); | ||
| 298 | - that.setData({ | ||
| 299 | - timer: null | ||
| 300 | - }); | ||
| 301 | - } else { | ||
| 302 | - that.setData({ | ||
| 303 | - countDown: that.data.countDown - 1 | ||
| 304 | - }); | ||
| 305 | - } | ||
| 306 | - }, 1000); | ||
| 307 | - this.setData({ | ||
| 308 | - timer | ||
| 309 | - }); | ||
| 310 | - }, | ||
| 311 | - // 打开截屏弹框 | ||
| 312 | - showModal() { | ||
| 313 | - this.modal.showModal() | ||
| 314 | - }, | ||
| 315 | - // 关闭截屏弹框 | ||
| 316 | - closeModal() { | ||
| 317 | - this.modal.closeModal() | ||
| 318 | - }, | ||
| 319 | - // 关闭优惠券弹框(更新已被领取数量) | ||
| 320 | - closeCouponModal() { | ||
| 321 | - this.getActivityByIdFun(this.data.couponList,'1') | ||
| 322 | - this.couponModal.closeModal() | ||
| 323 | - this.setData({ | ||
| 324 | - isShow: '1', | ||
| 325 | - }) | ||
| 326 | - setTimeout(() => { | ||
| 327 | - this.startAnimation(); | ||
| 328 | - }, 800); | ||
| 329 | - }, | ||
| 330 | // 页面滚动事件 | 163 | // 页面滚动事件 |
| 331 | onPageScroll: function (event) { | 164 | onPageScroll: function (event) { |
| 332 | if (event.scrollTop > 150) { //当页面滚动到某个位置时(这里设置为50),将导航栏背景颜色设置为白色 | 165 | if (event.scrollTop > 150) { //当页面滚动到某个位置时(这里设置为50),将导航栏背景颜色设置为白色 |
| @@ -349,18 +182,6 @@ Page({ | @@ -349,18 +182,6 @@ Page({ | ||
| 349 | }); | 182 | }); |
| 350 | } | 183 | } |
| 351 | }, | 184 | }, |
| 352 | - // 点击了解更多会员优惠政策 | ||
| 353 | - gotoFavourableList() { | ||
| 354 | - let url = util.http_build_query({ | ||
| 355 | - sellerName: this.data.seller.name, | ||
| 356 | - sellerid: this.data.seller.sid, | ||
| 357 | - oid: this.data.detail.id, | ||
| 358 | - types: '1' | ||
| 359 | - }, '/pack-cookbook/pages/favourableList') | ||
| 360 | - wx.navigateTo({ | ||
| 361 | - url | ||
| 362 | - }) | ||
| 363 | - }, | ||
| 364 | // 去评价 | 185 | // 去评价 |
| 365 | evaluateFun() { | 186 | evaluateFun() { |
| 366 | let url = util.http_build_query({ | 187 | let url = util.http_build_query({ |
| @@ -375,18 +196,6 @@ Page({ | @@ -375,18 +196,6 @@ Page({ | ||
| 375 | }) | 196 | }) |
| 376 | }, | 197 | }, |
| 377 | /** | 198 | /** |
| 378 | - * 用户点击右上角分享 | ||
| 379 | - */ | ||
| 380 | - onShareAppMessage: function () { | ||
| 381 | - return this.sharesetting(); | ||
| 382 | - }, | ||
| 383 | - /** | ||
| 384 | - * 监听用户点击分享到朋友圈按钮的操作 | ||
| 385 | - */ | ||
| 386 | - onShareTimeline() { | ||
| 387 | - return this.sharesetting(); | ||
| 388 | - }, | ||
| 389 | - /** | ||
| 390 | * 生命周期函数--监听页面显示 | 199 | * 生命周期函数--监听页面显示 |
| 391 | */ | 200 | */ |
| 392 | onShow: function () { | 201 | onShow: function () { |
| @@ -399,69 +208,6 @@ Page({ | @@ -399,69 +208,6 @@ Page({ | ||
| 399 | this.getCheckUserHavePhone() | 208 | this.getCheckUserHavePhone() |
| 400 | this.getreal() | 209 | this.getreal() |
| 401 | }, | 210 | }, |
| 402 | - // 检测用户是否绑定手机号 | ||
| 403 | - getCheckUserHavePhone() { | ||
| 404 | - App.Wechat.CheckUserHavePhone({ | ||
| 405 | - openid: getApp().openid, | ||
| 406 | - }).then((json) => { | ||
| 407 | - if (json.ret == 200) { | ||
| 408 | - let data = json.data; | ||
| 409 | - if (data) { | ||
| 410 | - this.setData({ | ||
| 411 | - purePhoneNumber: data.phone, | ||
| 412 | - wxNickname: data.nickname ? data.nickname : '', | ||
| 413 | - wxAvatar: data.headimgurl ? data.headimgurl : '', | ||
| 414 | - }) | ||
| 415 | - } | ||
| 416 | - } | ||
| 417 | - }) | ||
| 418 | - }, | ||
| 419 | - // 复制微信号 | ||
| 420 | - copyWeChat() { | ||
| 421 | - if (this.data.staffinfo.wechat) { | ||
| 422 | - wx.setClipboardData({ | ||
| 423 | - data: this.data.staffinfo.wechat, | ||
| 424 | - success(res) { | ||
| 425 | - wx.getClipboardData({ | ||
| 426 | - success(res) { | ||
| 427 | - console.log(res.data) | ||
| 428 | - } | ||
| 429 | - }) | ||
| 430 | - } | ||
| 431 | - }) | ||
| 432 | - } else { | ||
| 433 | - console.log('无微信号') | ||
| 434 | - } | ||
| 435 | - }, | ||
| 436 | - // 拨打电话 | ||
| 437 | - call(e) { | ||
| 438 | - const phone = e.currentTarget.dataset['phone']; | ||
| 439 | - wx.reportMonitor('1012', 1) | ||
| 440 | - wx.makePhoneCall({ | ||
| 441 | - phoneNumber: phone | ||
| 442 | - }) | ||
| 443 | - }, | ||
| 444 | - // 跳转到商家入驻页 | ||
| 445 | - gotoJoinSeller() { | ||
| 446 | - wx.navigateTo({ | ||
| 447 | - url: util.http_build_query({ | ||
| 448 | - laiyuan: '邀请函' | ||
| 449 | - }, '/pages/customer/joinSeller') | ||
| 450 | - }) | ||
| 451 | - }, | ||
| 452 | - // 导航 | ||
| 453 | - looklocation: function () { | ||
| 454 | - wx.reportMonitor('1015', 1) | ||
| 455 | - wx.openLocation({ | ||
| 456 | - latitude: Number(this.data.seller.lat), | ||
| 457 | - longitude: Number(this.data.seller.long), | ||
| 458 | - scale: 17, | ||
| 459 | - address: this.data.seller.addr, | ||
| 460 | - success: function (res) { | ||
| 461 | - console.log(res) | ||
| 462 | - } | ||
| 463 | - }) | ||
| 464 | - }, | ||
| 465 | // 获取包间图片列表 | 211 | // 获取包间图片列表 |
| 466 | getroomimage(sellerid, uid) { | 212 | getroomimage(sellerid, uid) { |
| 467 | App.Tables.GetTablesPhoto({ | 213 | App.Tables.GetTablesPhoto({ |
| @@ -487,16 +233,6 @@ Page({ | @@ -487,16 +233,6 @@ Page({ | ||
| 487 | } | 233 | } |
| 488 | }) | 234 | }) |
| 489 | }, | 235 | }, |
| 490 | - // 预览图片 | ||
| 491 | - lookImgs(e) { | ||
| 492 | - const url = e.currentTarget.dataset['url']; | ||
| 493 | - const imgs = e.currentTarget.dataset['imgs']; | ||
| 494 | - let urls = imgs ? imgs : [url] | ||
| 495 | - wx.previewImage({ | ||
| 496 | - current: url, | ||
| 497 | - urls, | ||
| 498 | - }) | ||
| 499 | - }, | ||
| 500 | // 获取店铺详情 | 236 | // 获取店铺详情 |
| 501 | getDetail() { | 237 | getDetail() { |
| 502 | App.Reserve.Detail({ | 238 | App.Reserve.Detail({ |
| @@ -574,135 +310,6 @@ Page({ | @@ -574,135 +310,6 @@ Page({ | ||
| 574 | console.log(res, '详情请求失败'); | 310 | console.log(res, '详情请求失败'); |
| 575 | }) | 311 | }) |
| 576 | }, | 312 | }, |
| 577 | - // 获取商家版本,不是超能版或者没有开通对应模块,不显示 | ||
| 578 | - getSellerVersionFun(sellerid) { | ||
| 579 | - App.SellerVersion.GetSellerVersion({ | ||
| 580 | - sellerid | ||
| 581 | - }).then((res) => { | ||
| 582 | - let data = res.data; | ||
| 583 | - console.log('版本列表', data); | ||
| 584 | - if (data && data.length > 0) { | ||
| 585 | - data.sort((a, b) => b.cdate * 1 - a.cdate * 1); | ||
| 586 | - // 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本) | ||
| 587 | - let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4); | ||
| 588 | - console.log('当前版本', { | ||
| 589 | - ...obj | ||
| 590 | - }); | ||
| 591 | - // 提前点餐功能:超能版 || 有提前点餐模块 | ||
| 592 | - const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6'); | ||
| 593 | - // 优惠券功能:超能版 || 高级版 || 有优惠券模块 | ||
| 594 | - const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8'); | ||
| 595 | - // 充值功能:超能版 || 有充值模块 | ||
| 596 | - const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9'); | ||
| 597 | - // 播报功能:超能版 || 标准版 || 标准版首年 || 高级版 | ||
| 598 | - const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4'; | ||
| 599 | - this.setData({ | ||
| 600 | - hasValueOrder, | ||
| 601 | - hasValueCertificate, | ||
| 602 | - hasValueRecharge, | ||
| 603 | - hasValueBroadcast, | ||
| 604 | - }) | ||
| 605 | - } | ||
| 606 | - }) | ||
| 607 | - }, | ||
| 608 | - // 通过预订ID查收定金详情 | ||
| 609 | - getPaymentStatus() { | ||
| 610 | - App.Reserve.GetReserveDepositByRid({ | ||
| 611 | - rid: this.data.options.id | ||
| 612 | - }).then(res => { | ||
| 613 | - if (res.ret == 200 && res.data && res.data.length > 0) { | ||
| 614 | - let data = res.data[0]; | ||
| 615 | - let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0'; | ||
| 616 | - let options = this.data.options | ||
| 617 | - this.setData({ | ||
| 618 | - paymentId: data.id, | ||
| 619 | - paymentStatus, | ||
| 620 | - isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1', | ||
| 621 | - }) | ||
| 622 | - } | ||
| 623 | - }) | ||
| 624 | - }, | ||
| 625 | - // 获取自定义图文内容 | ||
| 626 | - getText() { | ||
| 627 | - App.Reserve.GetReserveImgText({ | ||
| 628 | - rid: this.data.options.id | ||
| 629 | - }).then(res => { | ||
| 630 | - if (res.ret == 200 && res.data) { | ||
| 631 | - let data = res.data; | ||
| 632 | - let content = util.determine(data.content) | ||
| 633 | - console.log('自定义图文内容content', content); | ||
| 634 | - this.setData({ | ||
| 635 | - reserveData: { | ||
| 636 | - title: data.title || '', | ||
| 637 | - content, | ||
| 638 | - } | ||
| 639 | - }) | ||
| 640 | - } | ||
| 641 | - }) | ||
| 642 | - }, | ||
| 643 | - // 点击支付定金 | ||
| 644 | - paymentFun() { | ||
| 645 | - let that = this; | ||
| 646 | - let openid = getApp().openid; | ||
| 647 | - if (!openid) return wx.showToast({ | ||
| 648 | - title: '请在小程序中支付订金!', | ||
| 649 | - icon: 'none', | ||
| 650 | - }) | ||
| 651 | - App.PayOnline.CombineTransactionsByDeposit({ | ||
| 652 | - id: this.data.paymentId, | ||
| 653 | - openid, | ||
| 654 | - }).then(res => { | ||
| 655 | - if (res.ret == 200) { | ||
| 656 | - wx.requestPayment({ | ||
| 657 | - timeStamp: res.data.timeStamp + '', | ||
| 658 | - nonceStr: res.data.nonceStr, | ||
| 659 | - package: res.data.package, | ||
| 660 | - signType: res.data.signType, | ||
| 661 | - paySign: res.data.paySign, | ||
| 662 | - success(ress) { | ||
| 663 | - console.log('微信支付结果', ress); | ||
| 664 | - if (ress.errMsg == 'requestPayment:ok') { | ||
| 665 | - console.log('支付成功', ress); | ||
| 666 | - that.setData({ | ||
| 667 | - paymentStatus: '1', | ||
| 668 | - toastBool: true, | ||
| 669 | - toastText: '支付成功' | ||
| 670 | - }) | ||
| 671 | - that.hideToast(); | ||
| 672 | - return | ||
| 673 | - } | ||
| 674 | - console.log('支付失败1', ress); | ||
| 675 | - that.setData({ | ||
| 676 | - toastBool: true, | ||
| 677 | - toastText: '支付失败,请重新支付' | ||
| 678 | - }) | ||
| 679 | - that.hideToast(); | ||
| 680 | - }, | ||
| 681 | - fail(ress) { | ||
| 682 | - console.log('支付失败2', ress); | ||
| 683 | - that.setData({ | ||
| 684 | - toastBool: true, | ||
| 685 | - toastText: '支付失败,请重新支付' | ||
| 686 | - }) | ||
| 687 | - that.hideToast(); | ||
| 688 | - }, | ||
| 689 | - }) | ||
| 690 | - } else { | ||
| 691 | - wx.showToast({ | ||
| 692 | - title: res.msg, | ||
| 693 | - icon: 'none', | ||
| 694 | - }) | ||
| 695 | - } | ||
| 696 | - }) | ||
| 697 | - }, | ||
| 698 | - // 关闭支付失败或者成功弹框 | ||
| 699 | - hideToast() { | ||
| 700 | - setTimeout(() => { | ||
| 701 | - this.setData({ | ||
| 702 | - toastBool: false | ||
| 703 | - }) | ||
| 704 | - }, 1500) | ||
| 705 | - }, | ||
| 706 | // 客户经理获取基本信息 | 313 | // 客户经理获取基本信息 |
| 707 | getstaffinfo(uid, sid) { | 314 | getstaffinfo(uid, sid) { |
| 708 | App.Activity.GetCustomerActivityBaseinfo({ | 315 | App.Activity.GetCustomerActivityBaseinfo({ |
| @@ -751,77 +358,18 @@ Page({ | @@ -751,77 +358,18 @@ Page({ | ||
| 751 | }) | 358 | }) |
| 752 | } | 359 | } |
| 753 | }, | 360 | }, |
| 754 | - // 生成海报 | ||
| 755 | - painterBtn(liteStyle, timeStr) { | ||
| 756 | - let style = liteStyle.split('-'); | ||
| 757 | - let type1 = style[0]; | ||
| 758 | - let type2 = style[1]; | ||
| 759 | - let data = this.data.detail; | ||
| 760 | - let isMany = this.data.isMany; | ||
| 761 | - let img = data.seller.seller_image.replace(/^http:/, "https:"); | ||
| 762 | - let d = data.ddate_solt; | ||
| 763 | - let date1 = util.unixtoTime(data.ddate, 'MM月DD日'); | ||
| 764 | - let date2 = util.unixtoTime(data.ddate, 'MM/DD'); | ||
| 765 | - let week = ' ' + util.unixtoTime(data.ddate, '周WW'); | ||
| 766 | - let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname); | ||
| 767 | - let timeSlot2 = ' ' + this.data.seller.soltName; | ||
| 768 | - let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II') | ||
| 769 | - time = timeStr ? timeStr : time; | ||
| 770 | - let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')] | ||
| 771 | - let section = '' | ||
| 772 | - // 老样式123 | ||
| 773 | - if (type1 && !type2 && type1 != '4') { | ||
| 774 | - section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : ''; | ||
| 775 | - } | ||
| 776 | - // 新样式 | ||
| 777 | - if (type1 && type2) { | ||
| 778 | - if (type1 == '1') { | ||
| 779 | - section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : ''; | ||
| 780 | - } | ||
| 781 | - if (type1 == '2') { | ||
| 782 | - section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : ''; | ||
| 783 | - } | ||
| 784 | - if (type1 == '3' || type1 == '4') { | ||
| 785 | - section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : ''; | ||
| 786 | - } | ||
| 787 | - } | ||
| 788 | - if (type1 && !type2 && type1 == '4') { | ||
| 789 | - section = week + timeSlot2; | ||
| 790 | - } | ||
| 791 | - this.setData({ | ||
| 792 | - wxml: canvas({ | ||
| 793 | - imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', | ||
| 794 | - info: { | ||
| 795 | - sellerName: data.seller.sellername, | ||
| 796 | - date: util.unixtoTime(data.ddate, 'MM月DD日'), | ||
| 797 | - time: section, | ||
| 798 | - oneTableName: data.oneTableName, | ||
| 799 | - }, | ||
| 800 | - type1, | ||
| 801 | - type2, | ||
| 802 | - date2, | ||
| 803 | - week, | ||
| 804 | - day2, | ||
| 805 | - }) | ||
| 806 | - }) | ||
| 807 | - }, | ||
| 808 | - onImgOK(e) { | ||
| 809 | - this.setData({ | ||
| 810 | - imgSrc: e.detail.path | ||
| 811 | - }) | ||
| 812 | - console.log('海报生成成功', this.data.imgSrc); | ||
| 813 | - }, | ||
| 814 | // 分享 | 361 | // 分享 |
| 815 | sharesetting() { | 362 | sharesetting() { |
| 816 | wx.reportMonitor('1017', 1) | 363 | wx.reportMonitor('1017', 1) |
| 817 | this.closeModal() | 364 | this.closeModal() |
| 818 | if (this.data.options.isOrder == '1' && this.data.detail.status != '4') { | 365 | if (this.data.options.isOrder == '1' && this.data.detail.status != '4') { |
| 366 | + let img = this.data.detail.seller.seller_image.replace(/^http:/, "https:"); | ||
| 819 | return { | 367 | return { |
| 820 | title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店', | 368 | title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店', |
| 821 | path: util.http_build_query({ | 369 | path: util.http_build_query({ |
| 822 | id: this.data.detail.seller.id | 370 | id: this.data.detail.seller.id |
| 823 | }, '/pages/reserve/shopHome'), | 371 | }, '/pages/reserve/shopHome'), |
| 824 | - imageUrl: this.data.detail.seller.seller_image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', | 372 | + imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png', |
| 825 | } | 373 | } |
| 826 | } else { | 374 | } else { |
| 827 | let parmdata = { | 375 | let parmdata = { |
| @@ -840,33 +388,6 @@ Page({ | @@ -840,33 +388,6 @@ Page({ | ||
| 840 | } | 388 | } |
| 841 | } | 389 | } |
| 842 | }, | 390 | }, |
| 843 | - // 修改detail数据 | ||
| 844 | - formatDatail(details, dateSmart) { | ||
| 845 | - details.rdateStr = dateSmart; | ||
| 846 | - details.tableFirst = details.tables[0].name; | ||
| 847 | - if (details.tables.length > 1) { | ||
| 848 | - details.tableSubInfo = '等' + (details.tables.length) + '个' + | ||
| 849 | - (details.tables[0].tid == 2 ? '包间' : ''); | ||
| 850 | - } | ||
| 851 | - details.rname = details.rname.trim() | ||
| 852 | - if (details.rname && details.sex != 3) { | ||
| 853 | - let sexStr = details.sex == 1 ? '先生' : details.sex == 2 ? '女士' : details.sex == 4 ? '贵宾' : ''; | ||
| 854 | - let str = this.data.options.showSex == '2' ? '' : sexStr; | ||
| 855 | - details.rnameStr = details.rname + str | ||
| 856 | - } else if (!details.rname && details.sex == 4) { | ||
| 857 | - details.rnameStr = '贵宾' | ||
| 858 | - } else { | ||
| 859 | - details.rnameStr = details.rname | ||
| 860 | - } | ||
| 861 | - details.eatStr = '邀请您共进晚餐'; | ||
| 862 | - let hi = util.unixtoTime(details.ddate, 'HHII'); | ||
| 863 | - if (hi < '10:00') { | ||
| 864 | - details.eatStr = '邀请您共进早餐'; | ||
| 865 | - } else if (hi < '15:00') { | ||
| 866 | - details.eatStr = '邀请您共进午餐'; | ||
| 867 | - } | ||
| 868 | - return details; | ||
| 869 | - }, | ||
| 870 | // 获取商家设置营销信息 | 391 | // 获取商家设置营销信息 |
| 871 | getSellerTemplateConfFun(sid) { | 392 | getSellerTemplateConfFun(sid) { |
| 872 | App.Seller.GetSellerTemplateConf({ | 393 | App.Seller.GetSellerTemplateConf({ |
| @@ -954,6 +475,7 @@ Page({ | @@ -954,6 +475,7 @@ Page({ | ||
| 954 | this.setData({ | 475 | this.setData({ |
| 955 | ...obj | 476 | ...obj |
| 956 | }) | 477 | }) |
| 478 | + this.refreshActionBtn(obj) | ||
| 957 | // reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置 | 479 | // reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置 |
| 958 | let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve; | 480 | let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve; |
| 959 | this.textToSpeechFun(sid,i) | 481 | this.textToSpeechFun(sid,i) |
| @@ -961,266 +483,6 @@ Page({ | @@ -961,266 +483,6 @@ Page({ | ||
| 961 | console.log('GetSellerTemplateConf请求失败'); | 483 | console.log('GetSellerTemplateConf请求失败'); |
| 962 | }) | 484 | }) |
| 963 | }, | 485 | }, |
| 964 | - // 获取日期对应的时段 | ||
| 965 | - getLocalLunchTime(lite_style) { | ||
| 966 | - let detail = this.data.detail; | ||
| 967 | - let ddateStr = new Date(detail.ddate * 1000); | ||
| 968 | - let year = ddateStr.getFullYear(); | ||
| 969 | - let month = ddateStr.getMonth() + 1; | ||
| 970 | - let day = ddateStr.getDate(); | ||
| 971 | - let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); | ||
| 972 | - App.Seller.getMealSectionByDay({ | ||
| 973 | - sellerid: detail.seller.id, | ||
| 974 | - day: day1, | ||
| 975 | - }).then(res => { | ||
| 976 | - let data = res.data; | ||
| 977 | - let lunchDinnerList = []; | ||
| 978 | - let isMany = '0';//0默认餐段 1多时段 | ||
| 979 | - if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 980 | - isMany = '0'; | ||
| 981 | - data.forEach(i => { | ||
| 982 | - if (i.mname == '早餐') { | ||
| 983 | - lunchDinnerList.push({ | ||
| 984 | - mname: "早餐", | ||
| 985 | - mdate: i.mdate, | ||
| 986 | - ddate_solt: 1, | ||
| 987 | - }) | ||
| 988 | - } | ||
| 989 | - if (i.mname == '午餐') { | ||
| 990 | - lunchDinnerList.push({ | ||
| 991 | - mname: "午餐", | ||
| 992 | - mdate: i.mdate, | ||
| 993 | - ddate_solt: 2, | ||
| 994 | - }) | ||
| 995 | - } | ||
| 996 | - if (i.mname == '晚餐') { | ||
| 997 | - lunchDinnerList.push({ | ||
| 998 | - mname: "晚餐", | ||
| 999 | - mdate: i.mdate, | ||
| 1000 | - ddate_solt: 3, | ||
| 1001 | - }) | ||
| 1002 | - } | ||
| 1003 | - }) | ||
| 1004 | - } else { | ||
| 1005 | - isMany = '1'; | ||
| 1006 | - lunchDinnerList = data; | ||
| 1007 | - } | ||
| 1008 | - let obj = lunchDinnerList.filter(i => { | ||
| 1009 | - return i.ddate_solt == detail.ddate_solt | ||
| 1010 | - }) | ||
| 1011 | - var timeList = []; | ||
| 1012 | - if (obj && obj.length > 0) { | ||
| 1013 | - var time = obj[0].mdate.split("-"); | ||
| 1014 | - timeList = this.computeHour(time[0], time[1], 15); | ||
| 1015 | - } | ||
| 1016 | - this.setData({ | ||
| 1017 | - timeList, | ||
| 1018 | - isMany, | ||
| 1019 | - }) | ||
| 1020 | - // 获取转发客人卡片设置 | ||
| 1021 | - let lite = lite_style || '3'; | ||
| 1022 | - let liteStyle = lite.split('-'); | ||
| 1023 | - if (liteStyle[0] == '0') { | ||
| 1024 | - this.setData({ | ||
| 1025 | - imgSrc: detail.seller.seller_image | ||
| 1026 | - }) | ||
| 1027 | - } else { | ||
| 1028 | - this.painterBtn(lite); | ||
| 1029 | - } | ||
| 1030 | - }).catch(res => { | ||
| 1031 | - console.log(res, '获取多时段失败'); | ||
| 1032 | - }) | ||
| 1033 | - }, | ||
| 1034 | - // 点击商家有礼 | ||
| 1035 | - gotoSellerGift(e){ | ||
| 1036 | - this.couponModal.closeModal() | ||
| 1037 | - const form = e.currentTarget.dataset['form']; | ||
| 1038 | - let url = util.http_build_query({ | ||
| 1039 | - id: this.data.detail.id, | ||
| 1040 | - hasSellerShare: this.data.options.hasSellerShare, | ||
| 1041 | - form | ||
| 1042 | - }, '/pages/reserve/sellerGift') | ||
| 1043 | - wx.navigateTo({ | ||
| 1044 | - url | ||
| 1045 | - }) | ||
| 1046 | - }, | ||
| 1047 | - // 再次预订 | ||
| 1048 | - secondbook() { | ||
| 1049 | - wx.reportMonitor('1013', 1) | ||
| 1050 | - wx.redirectTo({ | ||
| 1051 | - url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id | ||
| 1052 | - }) | ||
| 1053 | - }, | ||
| 1054 | - // 文字转语音的方法 | ||
| 1055 | - textToSpeechFun(sid, reserve) { | ||
| 1056 | - console.log('reservereserve-----',reserve); | ||
| 1057 | - let play = (reserve && reserve.swich_voice == '1') ? '1' : '0'; | ||
| 1058 | - let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : ''; | ||
| 1059 | - let that = this; | ||
| 1060 | - let data = this.data; | ||
| 1061 | - App.Seller.GetVoiceWelcomeConfig({ | ||
| 1062 | - sid | ||
| 1063 | - }).then((json) => { | ||
| 1064 | - let content = ''; | ||
| 1065 | - // GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底 | ||
| 1066 | - if (!json.data && reserve == '0') { | ||
| 1067 | - json.data = { | ||
| 1068 | - is_voice_welcome: 1, | ||
| 1069 | - welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1070 | - invitee_same_as_reserver: 0, | ||
| 1071 | - invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1072 | - is_invitee_special_enabled: 1, | ||
| 1073 | - invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!", | ||
| 1074 | - special_reserve_types: ["生日宴"] | ||
| 1075 | - }; | ||
| 1076 | - } | ||
| 1077 | - console.log('jsondata----',json.data); | ||
| 1078 | - if (json.data) { | ||
| 1079 | - let config = json.data; | ||
| 1080 | - let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致 | ||
| 1081 | - let isReserver = data.options.hasSellerShare == '1'; | ||
| 1082 | - if (config.is_voice_welcome == '0') { | ||
| 1083 | - content = '' | ||
| 1084 | - } else if (sameAs == '1' || sameAs === 1) { | ||
| 1085 | - content = config.welcome_content || ''; | ||
| 1086 | - } else if (sameAs == '0' || sameAs === 0) { | ||
| 1087 | - if (isReserver) { | ||
| 1088 | - content = config.welcome_content || ''; | ||
| 1089 | - } else { | ||
| 1090 | - let specialEnabled = config.is_invitee_special_enabled == '1';//为1被请人播特殊模板 | ||
| 1091 | - let reserveType = data.detail.reserve_type || ''; | ||
| 1092 | - let specialTypes = config.special_reserve_types || []; | ||
| 1093 | - let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1; | ||
| 1094 | - content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || ''); | ||
| 1095 | - } | ||
| 1096 | - } | ||
| 1097 | - } else if (play == '1') { | ||
| 1098 | - content = voice_info; | ||
| 1099 | - } | ||
| 1100 | - console.log('content---', content); | ||
| 1101 | - if (!content) { | ||
| 1102 | - this.setData({ | ||
| 1103 | - newStr: '', | ||
| 1104 | - }) | ||
| 1105 | - return; | ||
| 1106 | - } | ||
| 1107 | - this.setData({ | ||
| 1108 | - isPlay: '1', | ||
| 1109 | - }) | ||
| 1110 | - data.detail.rname = data.detail.rname.trim() | ||
| 1111 | - let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : ''; | ||
| 1112 | - let charArray = data.seller.deskStr.split(''); | ||
| 1113 | - let modifiedArray = charArray.map(char => char + ' '); | ||
| 1114 | - let resultString = modifiedArray.join('').slice(0, -1); | ||
| 1115 | - const replacements = { | ||
| 1116 | - "{店铺名}": data.seller.name, | ||
| 1117 | - "{年月日}": data.seller.yearMonthDay, | ||
| 1118 | - "{月日}": data.seller.yearMonth, | ||
| 1119 | - "{餐段}": data.seller.soltName, | ||
| 1120 | - "{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide, | ||
| 1121 | - "{包间名}": resultString, | ||
| 1122 | - "{区域名+包间名}": data.seller.tablesText, | ||
| 1123 | - "{经理名字}": data.staffinfo.name, | ||
| 1124 | - "{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '', | ||
| 1125 | - "{预订日期}": data.seller.yearMonthDay, | ||
| 1126 | - "{桌位}": resultString, | ||
| 1127 | - "{客人姓名}": data.detail.rname ? data.detail.rname : '', | ||
| 1128 | - "{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 1129 | - "{客人姓氏}": data.detail.rname ? data.detail.rname : '', | ||
| 1130 | - "{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '', | ||
| 1131 | - "{用餐类型}": data.detail.reserve_type || '', | ||
| 1132 | - }; | ||
| 1133 | - let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) { | ||
| 1134 | - return replacements[matched]; | ||
| 1135 | - }); | ||
| 1136 | - console.log('newStr---', newStr); | ||
| 1137 | - this.setData({ | ||
| 1138 | - newStr, | ||
| 1139 | - }) | ||
| 1140 | - plugin.textToSpeech({ | ||
| 1141 | - lang: "zh_CN", | ||
| 1142 | - tts: true, | ||
| 1143 | - content: newStr, | ||
| 1144 | - success: function (res) { | ||
| 1145 | - that.filename = res.filename | ||
| 1146 | - that.speech() | ||
| 1147 | - }, | ||
| 1148 | - fail: function (res) { | ||
| 1149 | - console.log("fail tts", res) | ||
| 1150 | - } | ||
| 1151 | - }) | ||
| 1152 | - }).catch((err) => { | ||
| 1153 | - console.log('GetVoiceWelcomeConfig请求失败', err); | ||
| 1154 | - this.setData({ | ||
| 1155 | - newStr: '', | ||
| 1156 | - }) | ||
| 1157 | - }) | ||
| 1158 | - }, | ||
| 1159 | - // 开启语音播报 | ||
| 1160 | - speech() { | ||
| 1161 | - var attentionAnim = wx.createAnimation({ | ||
| 1162 | - duration: 1000, | ||
| 1163 | - timingFunction: 'linear', | ||
| 1164 | - }) | ||
| 1165 | - this.attentionAnim = attentionAnim | ||
| 1166 | - this.setData({ | ||
| 1167 | - _attentionAnim: attentionAnim, | ||
| 1168 | - attentionAnim: attentionAnim.export() | ||
| 1169 | - }) | ||
| 1170 | - this.audioCtx = wx.createInnerAudioContext() | ||
| 1171 | - this.audioCtx.src = this.filename | ||
| 1172 | - this.audioCtx.loop = true | ||
| 1173 | - this.audioCtx.play() | ||
| 1174 | - this.audioCtx.onPlay((e) => { | ||
| 1175 | - this.setData({ | ||
| 1176 | - isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 1177 | - }) | ||
| 1178 | - }) | ||
| 1179 | - this.audioCtx.onPause((e) => { | ||
| 1180 | - this.setData({ | ||
| 1181 | - isPlay: this.audioCtx.paused ? '2' : '1' | ||
| 1182 | - }) | ||
| 1183 | - }) | ||
| 1184 | - clearInterval(this.timers) | ||
| 1185 | - this.animation() | ||
| 1186 | - }, | ||
| 1187 | - // 持续旋转动画 | ||
| 1188 | - animation() { | ||
| 1189 | - let that = this; | ||
| 1190 | - var time = setInterval(function () { | ||
| 1191 | - this.n = this.n + 1; | ||
| 1192 | - let attentionAnim = that.data._attentionAnim | ||
| 1193 | - attentionAnim.rotate(180 * (this.n)).step() | ||
| 1194 | - that.setData({ | ||
| 1195 | - attentionAnim: attentionAnim.export(), | ||
| 1196 | - }) | ||
| 1197 | - }.bind(this), 1000) | ||
| 1198 | - this.timers = time; | ||
| 1199 | - }, | ||
| 1200 | - // 暂停/继续播放 | ||
| 1201 | - stopMusic() { | ||
| 1202 | - if (this.data.isPlay == '2') { // 2 暂停状态 | ||
| 1203 | - console.log("开始"); | ||
| 1204 | - clearInterval(this.timers) | ||
| 1205 | - this.animation() | ||
| 1206 | - this.audioCtx.play() //开始 | ||
| 1207 | - return; | ||
| 1208 | - } | ||
| 1209 | - if (this.data.isPlay == '1') { // 1 运行状态 | ||
| 1210 | - console.log('暂停'); | ||
| 1211 | - if (this.n % 2 != 0) { | ||
| 1212 | - this.n = this.n + 1; | ||
| 1213 | - let attentionAnim = this.data._attentionAnim; | ||
| 1214 | - attentionAnim.rotate(180 * this.n).step(); | ||
| 1215 | - this.setData({ | ||
| 1216 | - attentionAnim: attentionAnim.export(), | ||
| 1217 | - }) | ||
| 1218 | - } | ||
| 1219 | - clearInterval(this.timers) | ||
| 1220 | - this.audioCtx.pause() //暂停 | ||
| 1221 | - return; | ||
| 1222 | - } | ||
| 1223 | - }, | ||
| 1224 | // 根据充值ID获取充值详情 | 486 | // 根据充值ID获取充值详情 |
| 1225 | getRechargeDetail() { | 487 | getRechargeDetail() { |
| 1226 | App.Activity.GetNewRechargeList({ | 488 | App.Activity.GetNewRechargeList({ |
| @@ -1304,18 +566,6 @@ Page({ | @@ -1304,18 +566,6 @@ Page({ | ||
| 1304 | } | 566 | } |
| 1305 | }) | 567 | }) |
| 1306 | }, | 568 | }, |
| 1307 | - // 选择充值活动 | ||
| 1308 | - checkRechargeData(e) { | ||
| 1309 | - let id = e.currentTarget.dataset['id']; | ||
| 1310 | - let obj = this.data.recharge_data.filter(item => { | ||
| 1311 | - return item.id == id | ||
| 1312 | - }) | ||
| 1313 | - if (obj && obj.length > 0) { | ||
| 1314 | - this.setData({ | ||
| 1315 | - activeData: obj[0] | ||
| 1316 | - }) | ||
| 1317 | - } | ||
| 1318 | - }, | ||
| 1319 | // 选择标题 | 569 | // 选择标题 |
| 1320 | checkTitleFun(e) { | 570 | checkTitleFun(e) { |
| 1321 | console.log('e.currentTargete.currentTarget', e.currentTarget); | 571 | console.log('e.currentTargete.currentTarget', e.currentTarget); |
| @@ -1539,24 +789,6 @@ Page({ | @@ -1539,24 +789,6 @@ Page({ | ||
| 1539 | } | 789 | } |
| 1540 | }) | 790 | }) |
| 1541 | }, | 791 | }, |
| 1542 | - // 获取所有的券并且展示 | ||
| 1543 | - addCoupons(coupons, couponList) { | ||
| 1544 | - if (coupons && util.getType(coupons) == 'object') { | ||
| 1545 | - couponList.push({ | ||
| 1546 | - id: coupon.id, | ||
| 1547 | - number: coupon.number | ||
| 1548 | - }); | ||
| 1549 | - } | ||
| 1550 | - if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) { | ||
| 1551 | - coupons.forEach(item => { | ||
| 1552 | - couponList.push({ | ||
| 1553 | - id: item.id, | ||
| 1554 | - number: item.number | ||
| 1555 | - }); | ||
| 1556 | - }); | ||
| 1557 | - } | ||
| 1558 | - return couponList | ||
| 1559 | - }, | ||
| 1560 | // 弹框领取免费券 | 792 | // 弹框领取免费券 |
| 1561 | setcouponFun() { | 793 | setcouponFun() { |
| 1562 | let arr = this.data.couponArr; | 794 | let arr = this.data.couponArr; |
| @@ -1738,61 +970,6 @@ Page({ | @@ -1738,61 +970,6 @@ Page({ | ||
| 1738 | } | 970 | } |
| 1739 | }) | 971 | }) |
| 1740 | }, | 972 | }, |
| 1741 | - // 计算免费券有效期的起始、结束日期 | ||
| 1742 | - setTimeRange(cdate, startOffset, endOffset) { | ||
| 1743 | - const startDate = new Date((cdate + startOffset * 86400) * 1000); | ||
| 1744 | - startDate.setHours(0, 0, 0, 0); | ||
| 1745 | - const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1746 | - const endDate = new Date((cdate + endOffset * 86400) * 1000); | ||
| 1747 | - endDate.setHours(23, 59, 59, 0); | ||
| 1748 | - const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD'); | ||
| 1749 | - let useEtimeNum = endDate.getTime() / 1000; | ||
| 1750 | - return { useStime, useEtime,useEtimeNum }; | ||
| 1751 | - }, | ||
| 1752 | - // 处理优惠券不可用日期数据 | ||
| 1753 | - hasConsecutiveSelect(arr, type) { | ||
| 1754 | - let firstTitle = null; | ||
| 1755 | - let lastTitle = null; | ||
| 1756 | - let rArr = [] | ||
| 1757 | - let num = 0 | ||
| 1758 | - for (let i = 0; i < arr.length; i++) { | ||
| 1759 | - let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : ''; | ||
| 1760 | - if (str) { | ||
| 1761 | - rArr.push(arr[i].title) | ||
| 1762 | - num++ | ||
| 1763 | - if (num == 1) { | ||
| 1764 | - firstTitle = arr[i].title | ||
| 1765 | - } | ||
| 1766 | - if (num >= 5) { | ||
| 1767 | - lastTitle = arr[i].title | ||
| 1768 | - } | ||
| 1769 | - if (num >= 5 && i >= (arr.length - 1)) { | ||
| 1770 | - let fi = rArr.findIndex((item) => { | ||
| 1771 | - return item == firstTitle | ||
| 1772 | - }) | ||
| 1773 | - rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 1774 | - num = 0 | ||
| 1775 | - } | ||
| 1776 | - } else { | ||
| 1777 | - if (num < 5) { | ||
| 1778 | - num = 0 | ||
| 1779 | - firstTitle = null; | ||
| 1780 | - lastTitle = null; | ||
| 1781 | - } else { | ||
| 1782 | - let fi = rArr.findIndex((item) => { | ||
| 1783 | - return item == firstTitle | ||
| 1784 | - }) | ||
| 1785 | - rArr.splice(fi, num, firstTitle + '至' + lastTitle) | ||
| 1786 | - num = 0 | ||
| 1787 | - } | ||
| 1788 | - } | ||
| 1789 | - } | ||
| 1790 | - return { | ||
| 1791 | - rArr, | ||
| 1792 | - lastTitle, | ||
| 1793 | - firstTitle | ||
| 1794 | - }; | ||
| 1795 | - }, | ||
| 1796 | /** | 973 | /** |
| 1797 | * 生命周期函数--监听页面隐藏 | 974 | * 生命周期函数--监听页面隐藏 |
| 1798 | */ | 975 | */ |
| @@ -1812,53 +989,6 @@ Page({ | @@ -1812,53 +989,6 @@ Page({ | ||
| 1812 | this.audioCtx.destroy(); // 释放音频资源 | 989 | this.audioCtx.destroy(); // 释放音频资源 |
| 1813 | } | 990 | } |
| 1814 | }, | 991 | }, |
| 1815 | - // 设置虚拟到店时间 | ||
| 1816 | - bindPickerChange: function (e) { | ||
| 1817 | - let index = e.detail.value | ||
| 1818 | - let temp_ddate = this.data.timeList[index] | ||
| 1819 | - this.setData({ | ||
| 1820 | - temp_ddate | ||
| 1821 | - }) | ||
| 1822 | - let detailInfo = this.data.detail; | ||
| 1823 | - const reserveDate = new Date(detailInfo.ddate * 1000); | ||
| 1824 | - let reserveTime = | ||
| 1825 | - reserveDate.getFullYear() + | ||
| 1826 | - "-" + | ||
| 1827 | - (reserveDate.getMonth() + 1) + | ||
| 1828 | - "-" + | ||
| 1829 | - reserveDate.getDate(); | ||
| 1830 | - let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000 | ||
| 1831 | - App.Reserve.SetReserveTempDdate({ | ||
| 1832 | - rid: this.id, | ||
| 1833 | - temp_ddate: times, | ||
| 1834 | - }).then(res => { | ||
| 1835 | - if (res.ret == 200) { | ||
| 1836 | - let lite_style = this.data.lite_style | ||
| 1837 | - lite_style = lite_style || '3'; | ||
| 1838 | - let style =lite_style.split('-'); | ||
| 1839 | - let type1 =style[0]; | ||
| 1840 | - let type2 =style[1]; | ||
| 1841 | - if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1=='4' && !type2))){ | ||
| 1842 | - let time = temp_ddate || this.data.timeList[index] | ||
| 1843 | - this.painterBtn( | ||
| 1844 | - lite_style, | ||
| 1845 | - time | ||
| 1846 | - ); | ||
| 1847 | - } | ||
| 1848 | - } | ||
| 1849 | - }) | ||
| 1850 | - }, | ||
| 1851 | - // ios 部分机型不兼容new Date() 转换字符串 | ||
| 1852 | - getNewDate(data) { | ||
| 1853 | - if (typeof data === 'string') { | ||
| 1854 | - let arr = data.split(/[- : \/]/) | ||
| 1855 | - if (arr[1] !== undefined || arr[1] !== null) { | ||
| 1856 | - arr[1] = arr[1] - 1 | ||
| 1857 | - } | ||
| 1858 | - return new Date(...arr) | ||
| 1859 | - } | ||
| 1860 | - return new Date(data || new Date()) | ||
| 1861 | - }, | ||
| 1862 | // 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画 | 992 | // 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画 |
| 1863 | startAnimation() { | 993 | startAnimation() { |
| 1864 | const animation = wx.createAnimation({ | 994 | const animation = wx.createAnimation({ |
| @@ -1883,108 +1013,4 @@ Page({ | @@ -1883,108 +1013,4 @@ Page({ | ||
| 1883 | this.startSecondAnimation(); | 1013 | this.startSecondAnimation(); |
| 1884 | }, 800); | 1014 | }, 800); |
| 1885 | }, | 1015 | }, |
| 1886 | - // 出现商家有礼图标,并且晃动2下 | ||
| 1887 | - startSecondAnimation() { | ||
| 1888 | - const animation = wx.createAnimation({ | ||
| 1889 | - duration: 200, | ||
| 1890 | - timingFunction: 'ease' | ||
| 1891 | - }); | ||
| 1892 | - animation.scale(1).step() | ||
| 1893 | - .rotate(-15).step() | ||
| 1894 | - .rotate(15).step() | ||
| 1895 | - .rotate(-15).step() | ||
| 1896 | - .rotate(15).step() | ||
| 1897 | - .rotate(0).step(); | ||
| 1898 | - this.setData({ | ||
| 1899 | - animationData2: animation.export() | ||
| 1900 | - }); | ||
| 1901 | - }, | ||
| 1902 | - //根据起始时间(获取时间时间段) | ||
| 1903 | - computeHour(time1, time2, interval) { | ||
| 1904 | - //time1 开始时间 time2结束时间 interval间隔时长 | ||
| 1905 | - function getTimeList(time1, time2, interval) { | ||
| 1906 | - var timeList = []; | ||
| 1907 | - time1 = time1.split(":"); | ||
| 1908 | - time2 = time2.split(":"); | ||
| 1909 | - time1 = new Date(0, 0, 0, time1[0], time1[1], 0); | ||
| 1910 | - time2 = new Date(0, 0, 0, time2[0], time2[1], 0); | ||
| 1911 | - interval = interval * 60 * 1000; | ||
| 1912 | - while (time1 <= time2) { | ||
| 1913 | - timeList.push(time1.format("hh:mm")); | ||
| 1914 | - time1 = new Date(time1.getTime() + interval); | ||
| 1915 | - } | ||
| 1916 | - return timeList; | ||
| 1917 | - } | ||
| 1918 | - Date.prototype.format = function (format) { | ||
| 1919 | - var date = { | ||
| 1920 | - "M+": this.getMonth() + 1, | ||
| 1921 | - "d+": this.getDate(), | ||
| 1922 | - "h+": this.getHours(), | ||
| 1923 | - "m+": this.getMinutes(), | ||
| 1924 | - "s+": this.getSeconds(), | ||
| 1925 | - "q+": Math.floor((this.getMonth() + 3) / 3), | ||
| 1926 | - S: this.getMilliseconds(), | ||
| 1927 | - }; | ||
| 1928 | - if (/(y+)/.test(format)) | ||
| 1929 | - format = format.replace( | ||
| 1930 | - RegExp.$1, | ||
| 1931 | - (this.getFullYear() + "").substr(4 - RegExp.$1.length) | ||
| 1932 | - ); | ||
| 1933 | - for (var k in date) | ||
| 1934 | - if (new RegExp("(" + k + ")").test(format)) | ||
| 1935 | - format = format.replace( | ||
| 1936 | - RegExp.$1, | ||
| 1937 | - RegExp.$1.length == 1 ? | ||
| 1938 | - date[k] : | ||
| 1939 | - ("00" + date[k]).substr(("" + date[k]).length) | ||
| 1940 | - ); | ||
| 1941 | - return format; | ||
| 1942 | - }; | ||
| 1943 | - return getTimeList(time1, time2, interval); | ||
| 1944 | - }, | ||
| 1945 | - // 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨) | ||
| 1946 | - processInfo(intel, type) { | ||
| 1947 | - let imgs = []; | ||
| 1948 | - intel.textInfo = ''; | ||
| 1949 | - intel.imgsInfo = []; | ||
| 1950 | - intel.videoImgsInfo = []; | ||
| 1951 | - if (type == '1' && intel.is_introduce_all == '1') { | ||
| 1952 | - if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) { | ||
| 1953 | - intel.textInfo = intel.park_info; | ||
| 1954 | - imgs = intel.park_info_images | ||
| 1955 | - } | ||
| 1956 | - } | ||
| 1957 | - if (type == '2') { | ||
| 1958 | - imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : []; | ||
| 1959 | - intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : ''; | ||
| 1960 | - } | ||
| 1961 | - if (type == '3') { | ||
| 1962 | - imgs = intel.images || [] | ||
| 1963 | - intel.textInfo = ''; | ||
| 1964 | - } | ||
| 1965 | - if (type == '4') { | ||
| 1966 | - imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : [] | ||
| 1967 | - intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : ''; | ||
| 1968 | - } | ||
| 1969 | - intel.imgsInfo = imgs; | ||
| 1970 | - if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') { | ||
| 1971 | - intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n'); | ||
| 1972 | - intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content); | ||
| 1973 | - intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content)); | ||
| 1974 | - } | ||
| 1975 | - return intel | ||
| 1976 | - }, | ||
| 1977 | - /** | ||
| 1978 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
| 1979 | - */ | ||
| 1980 | - onPullDownRefresh() { | ||
| 1981 | - | ||
| 1982 | - }, | ||
| 1983 | - | ||
| 1984 | - /** | ||
| 1985 | - * 页面上拉触底事件的处理函数 | ||
| 1986 | - */ | ||
| 1987 | - onReachBottom() { | ||
| 1988 | - | ||
| 1989 | - }, | ||
| 1990 | }) | 1016 | }) |
| 1 | <!--pack-invitation/pages/detail_owner_invitation11.wxml--> | 1 | <!--pack-invitation/pages/detail_owner_invitation11.wxml--> |
| 2 | +<import src="../common/parts.wxml" /> | ||
| 2 | <import src="../../pages/tpl/invitation"></import> | 3 | <import src="../../pages/tpl/invitation"></import> |
| 3 | <nav hasHome class="navhome" backgroundColor="{{show_white ? colors : 'transparent'}}" place="{{false}}"></nav> | 4 | <nav hasHome class="navhome" backgroundColor="{{show_white ? colors : 'transparent'}}" place="{{false}}"></nav> |
| 4 | <scroll-view scroll-y class="viewBox viewBox{{bookType}}"> | 5 | <scroll-view scroll-y class="viewBox viewBox{{bookType}}"> |
| 5 | - <image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" /> | ||
| 6 | - <image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}" | ||
| 7 | - bindtap="gotoSellerGift" | ||
| 8 | - data-form="1" | ||
| 9 | - animation="{{animationData2}}" | ||
| 10 | - wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" | ||
| 11 | - src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode=""/> | ||
| 12 | - <view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}"> | ||
| 13 | - <image src="https://qn.colorcun.com/getCouponIcon2.png" mode=""/> | ||
| 14 | - </view> | 6 | + <!-- 音乐开关 --> |
| 7 | + <template is="musicImg" data="{{newStr: newStr, isPlay: isPlay, attentionAnim: attentionAnim}}" /> | ||
| 8 | + <!-- 商家有礼悬浮入口 --> | ||
| 9 | + <template is="giftImg" data="{{hasValueCertificate: hasValueCertificate, marketing: marketing, coupon_dataList: coupon_dataList, isFrame: isFrame, is_comments: is_comments, is_user_comments: is_user_comments, couponData: couponData, hasValueRecharge: hasValueRecharge, recharge_data: recharge_data, animationData2: animationData2}}" /> | ||
| 10 | + <!-- 领券全屏浮层 --> | ||
| 11 | + <template is="fullscreenMask" data="{{isShow: isShow, animationData: animationData}}" /> | ||
| 15 | <view class="targetPoint" style="{{(bookType =='1' || bookType =='3')?'right: 4%;top: 35%;':'left: 2%;top: 27%;'}}"></view> | 12 | <view class="targetPoint" style="{{(bookType =='1' || bookType =='3')?'right: 4%;top: 35%;':'left: 2%;top: 27%;'}}"></view> |
| 16 | - <image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" /> | ||
| 17 | - <image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" /> | 13 | + <!-- 已取消/已结束 状态角标 --> |
| 14 | + <template is="statusBadge" data="{{detail: detail, options: options}}" /> | ||
| 18 | <view class="reservationInfoBox" wx:if="{{detail && detail.ddate}}"> | 15 | <view class="reservationInfoBox" wx:if="{{detail && detail.ddate}}"> |
| 19 | <view class="reservationInfo reservationInfo{{make}}"> | 16 | <view class="reservationInfo reservationInfo{{make}}"> |
| 20 | <view class="infoTop"> | 17 | <view class="infoTop"> |
| @@ -481,13 +478,7 @@ | @@ -481,13 +478,7 @@ | ||
| 481 | </block> | 478 | </block> |
| 482 | </block> | 479 | </block> |
| 483 | <view class="labelBox" wx:if="{{store.content && store.content.length>0}}"> | 480 | <view class="labelBox" wx:if="{{store.content && store.content.length>0}}"> |
| 484 | - <block wx:for="{{store.content}}" wx:key="index"> | ||
| 485 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{store.imgsInfo}}" mode="widthFix" /> | ||
| 486 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text> | ||
| 487 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 488 | - <video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video> | ||
| 489 | - </view> | ||
| 490 | - </block> | 481 | + <template is="richText" data="{{content: store.content, imgs: store.imgsInfo, textClass: 'font28r'}}" /> |
| 491 | </view> | 482 | </view> |
| 492 | </view> | 483 | </view> |
| 493 | <!-- 招牌菜品 --> | 484 | <!-- 招牌菜品 --> |
| @@ -500,13 +491,7 @@ | @@ -500,13 +491,7 @@ | ||
| 500 | <image src="{{item}}" bindtap="lookImgs" data-url="{{item}}" data-imgs="{{signboard.imgsInfo}}" mode="widthFix" /> | 491 | <image src="{{item}}" bindtap="lookImgs" data-url="{{item}}" data-imgs="{{signboard.imgsInfo}}" mode="widthFix" /> |
| 501 | </block> | 492 | </block> |
| 502 | <view class="labelBox" wx:if="{{signboard.content && signboard.content.length>0}}"> | 493 | <view class="labelBox" wx:if="{{signboard.content && signboard.content.length>0}}"> |
| 503 | - <block wx:for="{{signboard.content}}" wx:key="index"> | ||
| 504 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{signboard.imgsInfo}}" mode="widthFix" /> | ||
| 505 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text> | ||
| 506 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 507 | - <video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video> | ||
| 508 | - </view> | ||
| 509 | - </block> | 494 | + <template is="richText" data="{{content: signboard.content, imgs: signboard.imgsInfo, textClass: 'font28r'}}" /> |
| 510 | </view> | 495 | </view> |
| 511 | <view class="orderBox" wx:if="{{hasValueOrder && openOrder == '1' && marketing.is_order=='1'}}"> | 496 | <view class="orderBox" wx:if="{{hasValueOrder && openOrder == '1' && marketing.is_order=='1'}}"> |
| 512 | <view class="font32r">提前点餐 到店不用等</view> | 497 | <view class="font32r">提前点餐 到店不用等</view> |
| @@ -530,13 +515,7 @@ | @@ -530,13 +515,7 @@ | ||
| 530 | </block> | 515 | </block> |
| 531 | </block> | 516 | </block> |
| 532 | <view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}"> | 517 | <view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}"> |
| 533 | - <block wx:for="{{reserve.content}}" wx:key="index"> | ||
| 534 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{reserve.imgsInfo}}" mode="widthFix" /> | ||
| 535 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text> | ||
| 536 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 537 | - <video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video> | ||
| 538 | - </view> | ||
| 539 | - </block> | 518 | + <template is="richText" data="{{content: reserve.content, imgs: reserve.imgsInfo, textClass: 'font28r'}}" /> |
| 540 | </view> | 519 | </view> |
| 541 | </view> | 520 | </view> |
| 542 | <!-- 主厨介绍 --> | 521 | <!-- 主厨介绍 --> |
| @@ -550,13 +529,7 @@ | @@ -550,13 +529,7 @@ | ||
| 550 | </view> | 529 | </view> |
| 551 | <image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" /> | 530 | <image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" /> |
| 552 | <view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}"> | 531 | <view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}"> |
| 553 | - <block wx:for="{{chef.content}}" wx:key="index"> | ||
| 554 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{chef.imgsInfo}}" mode="widthFix" /> | ||
| 555 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text> | ||
| 556 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 557 | - <video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video> | ||
| 558 | - </view> | ||
| 559 | - </block> | 532 | + <template is="richText" data="{{content: chef.content, imgs: chef.imgsInfo, textClass: 'font28r'}}" /> |
| 560 | </view> | 533 | </view> |
| 561 | </view> | 534 | </view> |
| 562 | </block> | 535 | </block> |
| @@ -580,21 +553,7 @@ | @@ -580,21 +553,7 @@ | ||
| 580 | </block> | 553 | </block> |
| 581 | </block> | 554 | </block> |
| 582 | <view class="labelBox" wx:if="{{store.content && store.content.length>0}}"> | 555 | <view class="labelBox" wx:if="{{store.content && store.content.length>0}}"> |
| 583 | - <block wx:for="{{store.content}}" wx:key="index"> | ||
| 584 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" /> | ||
| 585 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text> | ||
| 586 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 587 | - <video | ||
| 588 | - object-fit="contain" | ||
| 589 | - autoplay="{{true}}" | ||
| 590 | - loop="{{true}}" | ||
| 591 | - muted="{{true}}" | ||
| 592 | - show-mute-btn="{{true}}" | ||
| 593 | - vslide-gesture-in-fullscreen="{{true}}" | ||
| 594 | - src="{{item.content}}" | ||
| 595 | - ></video> | ||
| 596 | - </view> | ||
| 597 | - </block> | 556 | + <template is="richText" data="{{content: store.content, imgs: '', textClass: 'font32r'}}" /> |
| 598 | </view> | 557 | </view> |
| 599 | </view> | 558 | </view> |
| 600 | </block> | 559 | </block> |
| @@ -637,21 +596,7 @@ | @@ -637,21 +596,7 @@ | ||
| 637 | </view> | 596 | </view> |
| 638 | <image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" /> | 597 | <image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" /> |
| 639 | <view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}"> | 598 | <view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}"> |
| 640 | - <block wx:for="{{chef.content}}" wx:key="index"> | ||
| 641 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" /> | ||
| 642 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text> | ||
| 643 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 644 | - <video | ||
| 645 | - object-fit="contain" | ||
| 646 | - autoplay="{{true}}" | ||
| 647 | - loop="{{true}}" | ||
| 648 | - muted="{{true}}" | ||
| 649 | - show-mute-btn="{{true}}" | ||
| 650 | - vslide-gesture-in-fullscreen="{{true}}" | ||
| 651 | - src="{{item.content}}" | ||
| 652 | - ></video> | ||
| 653 | - </view> | ||
| 654 | - </block> | 599 | + <template is="richText" data="{{content: chef.content, imgs: '', textClass: 'font32r'}}" /> |
| 655 | </view> | 600 | </view> |
| 656 | </view> | 601 | </view> |
| 657 | </block> | 602 | </block> |
| @@ -671,21 +616,7 @@ | @@ -671,21 +616,7 @@ | ||
| 671 | </block> | 616 | </block> |
| 672 | </block> | 617 | </block> |
| 673 | <view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}"> | 618 | <view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}"> |
| 674 | - <block wx:for="{{reserve.content}}" wx:key="index"> | ||
| 675 | - <image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" /> | ||
| 676 | - <text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text> | ||
| 677 | - <view wx:if="{{item.type == '3'}}" class="videoBox"> | ||
| 678 | - <video | ||
| 679 | - object-fit="contain" | ||
| 680 | - autoplay="{{true}}" | ||
| 681 | - loop="{{true}}" | ||
| 682 | - muted="{{true}}" | ||
| 683 | - show-mute-btn="{{true}}" | ||
| 684 | - vslide-gesture-in-fullscreen="{{true}}" | ||
| 685 | - src="{{item.content}}" | ||
| 686 | - ></video> | ||
| 687 | - </view> | ||
| 688 | - </block> | 619 | + <template is="richText" data="{{content: reserve.content, imgs: '', textClass: 'font32r'}}" /> |
| 689 | </view> | 620 | </view> |
| 690 | </view> | 621 | </view> |
| 691 | <!-- 会员招募 --> | 622 | <!-- 会员招募 --> |
| @@ -734,68 +665,11 @@ | @@ -734,68 +665,11 @@ | ||
| 734 | <view class="toastBox" wx:if="{{toastBool}}"> | 665 | <view class="toastBox" wx:if="{{toastBool}}"> |
| 735 | {{toastText}} | 666 | {{toastText}} |
| 736 | </view> | 667 | </view> |
| 737 | - <!-- (开启在线预订 显示在线预订) || (未开启在线预订 显示再次预订(打商家电话)) --> | ||
| 738 | - <!-- (未结束&&未取消 && 开启转发开关 显示 转发邀请函给客人) || (过了当前餐段结束时间||用餐完成||已取消 显示 转发店铺给好友) --> | ||
| 739 | - <view wx:if="{{isMoreBtn || options.isOrder == '1' || (!isMoreBtn && seller.phone) || (detail.status !='4' && isPaymenBtn) || (detail.status !='4' && isShareItem)}}" class="flex-lr sharewidth"> | ||
| 740 | - <view wx:if="{{isMoreBtn}}" class="flex-cc font30r moreBtn {{(((detail.status !='4' && isPaymenBtn) || (reserveOpenid != openid && options.isOrder != '1' && options.hasSellerShare!='1' && isShowBtn && options.isMeeting == '1')) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="secondbook">再次预订</view> | ||
| 741 | - <view wx:if="{{!isMoreBtn && seller.phone}}" class="flex-cc font30r moreBtn {{((detail.status !='4' && isPaymenBtn) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view> | ||
| 742 | - <view wx:if="{{detail.status !='4' && isPaymenBtn}}" class="flex-cc font30r paymenBtn {{((isMoreBtn || (!isMoreBtn && seller.phone)) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="paymentFun">支付定金</view> | ||
| 743 | - <block wx:if="{{options.hasSellerShare == '1'}}"> | ||
| 744 | - <button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button> | ||
| 745 | - <button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button> | ||
| 746 | - </block> | ||
| 747 | - <block wx:if="{{options.hasSellerShare != '1'}}"> | ||
| 748 | - <button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" open-type="share">转发邀请函</button> | ||
| 749 | - <button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" data-type="2" open-type="share">转发邀请函</button> | ||
| 750 | - <block wx:if="{{wxNickname && purePhoneNumber && options.isMeeting == '1'}}"> | ||
| 751 | - <button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 752 | - </block> | ||
| 753 | - <block wx:if="{{(!wxNickname || !purePhoneNumber) && options.isMeeting == '1'}}"> | ||
| 754 | - <button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button> | ||
| 755 | - </block> | ||
| 756 | - </block> | ||
| 757 | - </view> | 668 | +<!-- 底部操作栏 --> |
| 669 | +<template is="actionBar" data="{{barWrapClass: 'flex-lr sharewidth', barShow: barShow, showMoreOnline: showMoreOnline, threeBtnMore: threeBtnMore, showMoreCall: showMoreCall, threeBtnCall: threeBtnCall, seller: seller, canPay: canPay, threeBtnPay: threeBtnPay, isOwner: isOwner, canShare: canShare, isOver: isOver, guestShareCls: guestShareCls, canMeet: canMeet, needLogin: needLogin}}" /> | ||
| 758 | </scroll-view> | 670 | </scroll-view> |
| 759 | <painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" /> | 671 | <painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" /> |
| 760 | -<my-modal id="payModal" fadeStyle="slideUp" height="240px"> | ||
| 761 | - <view slot="modalName" class="titleModal">提示</view> | ||
| 762 | - <view slot="modalContent"> | ||
| 763 | - <view class="explain"> | ||
| 764 | - 检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦! | ||
| 765 | - </view> | ||
| 766 | - <view class="screenshotBtns"> | ||
| 767 | - <button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button> | ||
| 768 | - <button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button> | ||
| 769 | - </view> | ||
| 770 | - </view> | ||
| 771 | -</my-modal> | ||
| 772 | -<my-modal id="couponModal" fadeStyle="slideUp" height="240px"> | ||
| 773 | - <view slot="modalContent"> | ||
| 774 | - <view class="titleModal"> | ||
| 775 | - <image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode=""/> | ||
| 776 | - <view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view> | ||
| 777 | - <view class="couponTotal font28r" wx:if="{{totalPrice}}"> | ||
| 778 | - 赠送给您代金券 | ||
| 779 | - <view class="counterText"> | ||
| 780 | - <view class="font36r">¥</view><scroll-number value="{{totalPrice}}"></scroll-number> | ||
| 781 | - </view> | ||
| 782 | - </view> | ||
| 783 | - </view> | ||
| 784 | - <view class="couponWrap"> | ||
| 785 | - <view class="couponInfo font48r"> | ||
| 786 | - <text class="font48r">到店微信扫码</text> | ||
| 787 | - <text class="font48r">自动识别</text> | ||
| 788 | - </view> | ||
| 789 | - <block wx:if="{{!purePhoneNumber}}"> | ||
| 790 | - <button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button> | ||
| 791 | - </block> | ||
| 792 | - <block wx:else> | ||
| 793 | - <subscribe ids="{{[2]}}" bindtap="setcouponFun"> | ||
| 794 | - <view class="couponBtn couponBtn1 font40r">欣然收下</view> | ||
| 795 | - </subscribe> | ||
| 796 | - </block> | ||
| 797 | - <view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view> | ||
| 798 | - </view> | ||
| 799 | - <view class="closeBox font28r">{{countDown}} 秒后自动关闭</view> | ||
| 800 | - </view> | ||
| 801 | -</my-modal> | ||
| 672 | +<!-- 截屏提示弹窗 --> | ||
| 673 | +<template is="payModal" data="{{detail: detail, options: options, marketing: marketing, imgSrc: imgSrc}}" /> | ||
| 674 | +<!-- 领券弹窗(2~12 通用;13 保持页面内独立) --> | ||
| 675 | +<template is="couponModal" data="{{seller: seller, reserve: reserve, totalPrice: totalPrice, purePhoneNumber: purePhoneNumber, countDown: countDown}}" /> |
-
Please register or login to post a comment