Commit 57e716fb261cfbdd07c2483bda26917954c30b8b

Authored by pengye
1 parent 81edb5d3

2-8模板的邀请函做语音播报功能、券和充值改为根据ID获取详情 、模板6的logo图片设置为原图高度

@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -48,10 +48,16 @@ Page({ @@ -48,10 +48,16 @@ Page({
48 hasValueOrder:false,//商家是否开通提前点餐功能 48 hasValueOrder:false,//商家是否开通提前点餐功能
49 hasValueCertificate:false,//商家是否开通优惠券功能 49 hasValueCertificate:false,//商家是否开通优惠券功能
50 hasValueRecharge:false,//商家是否开通充值功能 50 hasValueRecharge:false,//商家是否开通充值功能
  51 + _attentionAnim: {},
  52 + isPlay: '1',
51 }, 53 },
52 tablestr: '', 54 tablestr: '',
53 urlsValue: [], 55 urlsValue: [],
54 screenHeight: '', 56 screenHeight: '',
  57 + attentionAnim: {},
  58 + audioCtx: '', //播报
  59 + timers: null, // 动画定时器
  60 + n: 0,
55 /** 61 /**
56 * 生命周期函数--监听页面加载 62 * 生命周期函数--监听页面加载
57 */ 63 */
@@ -211,12 +217,14 @@ Page({ @@ -211,12 +217,14 @@ Page({
211 rid: this.data.options.id 217 rid: this.data.options.id
212 }).then(res => { 218 }).then(res => {
213 let tablesText = '', //桌子信息 219 let tablesText = '', //桌子信息
  220 + deskStr = '',
214 tableNum = 0; 221 tableNum = 0;
215 let tableinfo = util.determine(res.data.tableinfo); 222 let tableinfo = util.determine(res.data.tableinfo);
216 console.log('tableinfo', tableinfo); 223 console.log('tableinfo', tableinfo);
217 res.data.tables.forEach((t, i) => { 224 res.data.tables.forEach((t, i) => {
218 tableNum += t.table_pnum * 1 225 tableNum += t.table_pnum * 1
219 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 226 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  227 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
220 }) 228 })
221 let tabaleids = []; 229 let tabaleids = [];
222 res.data.tables.forEach(t => { 230 res.data.tables.forEach(t => {
@@ -235,6 +243,9 @@ Page({ @@ -235,6 +243,9 @@ Page({
235 } else { 243 } else {
236 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 244 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
237 } 245 }
  246 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  247 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  248 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
238 console.log('dateSmart', dateSmart); 249 console.log('dateSmart', dateSmart);
239 this.setData({ 250 this.setData({
240 detail: this.formatDatail(reserev, dateSmart), 251 detail: this.formatDatail(reserev, dateSmart),
@@ -258,14 +269,17 @@ Page({ @@ -258,14 +269,17 @@ Page({
258 lat: reserev.seller.lat, 269 lat: reserev.seller.lat,
259 long: reserev.seller.long, 270 long: reserev.seller.long,
260 seller_tel: reserev.seller.seller_tel, 271 seller_tel: reserev.seller.seller_tel,
  272 + yearMonthDay,
  273 + yearMonth,
  274 + dateStr,
  275 + deskStr,
261 } 276 }
262 }) 277 })
263 console.log('reserev reserev', reserev); 278 console.log('reserev reserev', reserev);
264 console.log('seller seller', this.data.seller); 279 console.log('seller seller', this.data.seller);
265 console.log('detail detail', this.data.detail); 280 console.log('detail detail', this.data.detail);
266 setTimeout(() => { 281 setTimeout(() => {
267 - this.getSellerTemplateConfFun(reserev.sid);  
268 - this.getstaffinfo(res.data.uid) 282 + this.getstaffinfo(res.data.uid, reserev.sid);
269 this.getroomimage(reserev.sid) 283 this.getroomimage(reserev.sid)
270 this.getSellerVersionFun(reserev.sid); 284 this.getSellerVersionFun(reserev.sid);
271 }, 0); 285 }, 0);
@@ -292,7 +306,7 @@ Page({ @@ -292,7 +306,7 @@ Page({
292 }) 306 })
293 }, 307 },
294 // 客户经理获取基本信息 308 // 客户经理获取基本信息
295 - getstaffinfo(uid) { 309 + getstaffinfo(uid, sid) {
296 console.log('sellerid', this.data.detail.seller.id); 310 console.log('sellerid', this.data.detail.seller.id);
297 App.Activity.GetCustomerActivityBaseinfo({ 311 App.Activity.GetCustomerActivityBaseinfo({
298 sellerid: this.data.detail.seller.id, 312 sellerid: this.data.detail.seller.id,
@@ -303,6 +317,7 @@ Page({ @@ -303,6 +317,7 @@ Page({
303 this.setData({ 317 this.setData({
304 staffinfo: json.data 318 staffinfo: json.data
305 }) 319 })
  320 + this.getSellerTemplateConfFun(sid);
306 } 321 }
307 }) 322 })
308 }, 323 },
@@ -389,8 +404,8 @@ Page({ @@ -389,8 +404,8 @@ Page({
389 }).then(res => { 404 }).then(res => {
390 let data = res.data 405 let data = res.data
391 console.log('data', data); 406 console.log('data', data);
392 - let coupon_dataList = []  
393 - let themeColor, StyleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 407 + let couponList = []
  408 + let themeColor, StyleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
394 chef = util.determine(data.chef); 409 chef = util.determine(data.chef);
395 reserve = util.determine(data.reserve); 410 reserve = util.determine(data.reserve);
396 marketing = util.determine(data.marketing); 411 marketing = util.determine(data.marketing);
@@ -406,28 +421,18 @@ Page({ @@ -406,28 +421,18 @@ Page({
406 } 421 }
407 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 422 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
408 if (coupon && util.getType(coupon) == 'object') { 423 if (coupon && util.getType(coupon) == 'object') {
409 - coupon.stringifyUse = JSON.stringify(coupon.use)  
410 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
411 - let cash = coupon.use.cash * 1;  
412 - let price = coupon.price * 1;  
413 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
414 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
415 - }  
416 - coupon_dataList.push(coupon); 424 + couponList.push({
  425 + id: coupon.id
  426 + });
417 } 427 }
418 if (coupon && util.getType(coupon) == 'array') { 428 if (coupon && util.getType(coupon) == 'array') {
419 if (coupon.length > 0) { 429 if (coupon.length > 0) {
420 coupon.forEach(item => { 430 coupon.forEach(item => {
421 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
422 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
423 - let cash = item.use.cash * 1;  
424 - let price = item.price * 1;  
425 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
426 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
427 - } 431 + couponList.push({
  432 + id: item.id
  433 + })
428 }) 434 })
429 } 435 }
430 - coupon_dataList = coupon;  
431 } 436 }
432 let obj = { 437 let obj = {
433 chef, 438 chef,
@@ -436,9 +441,8 @@ Page({ @@ -436,9 +441,8 @@ Page({
436 signboard, 441 signboard,
437 store, 442 store,
438 home, 443 home,
439 - stringifyUse,  
440 coupon, 444 coupon,
441 - coupon_dataList, 445 + couponList,
442 swich_phone, 446 swich_phone,
443 is_comments, 447 is_comments,
444 StyleType, 448 StyleType,
@@ -447,24 +451,12 @@ Page({ @@ -447,24 +451,12 @@ Page({
447 console.log('获取数据', { 451 console.log('获取数据', {
448 ...obj 452 ...obj
449 }); 453 });
  454 + // 根据券ID获取券详情
  455 + this.getActivityByIdFun(couponList, couponList.length)
  456 + // 根据充值ID获取充值详情
450 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 457 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
451 - let recharge_data = marketing.recharge_data  
452 - recharge_list = marketing.recharge_data.recharge_list  
453 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
454 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
455 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
456 - console.log('scoreInfo', scoreInfo);  
457 - console.log('priceInfo', priceInfo);  
458 - this.setData({  
459 - recharge_data: marketing.recharge_data,  
460 - certificate  
461 - })  
462 - console.log('recharge_data', recharge_data); 458 + this.getRechargeDetail(marketing.recharge_data.id)
463 } 459 }
464 - this.setData({  
465 - coupon_dataList,  
466 - stringifyUse  
467 - })  
468 if (store && store.images.length > 0) store.images = util.determine(store.images); 460 if (store && store.images.length > 0) store.images = util.determine(store.images);
469 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 461 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
470 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 462 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -520,14 +512,19 @@ Page({ @@ -520,14 +512,19 @@ Page({
520 reserve, 512 reserve,
521 signboard, 513 signboard,
522 store, 514 store,
523 - priceInfo,  
524 - scoreInfo,  
525 swich_phone, 515 swich_phone,
526 is_comments, 516 is_comments,
527 StyleType, 517 StyleType,
528 themeColor, 518 themeColor,
529 themeSixteen, 519 themeSixteen,
530 }) 520 })
  521 + // 开启语音播报
  522 + if (reserve && reserve.swich_voice == '1') {
  523 + this.setData({
  524 + isPlay: '1',
  525 + })
  526 + this.textToSpeechFun(reserve.voice_info)
  527 + }
531 }).catch(res => { 528 }).catch(res => {
532 console.log('GetSellerTemplateConf请求失败'); 529 console.log('GetSellerTemplateConf请求失败');
533 }) 530 })
@@ -539,11 +536,159 @@ Page({ @@ -539,11 +536,159 @@ Page({
539 url: '../reserve/detail?id=' + this.data.detail.seller.id 536 url: '../reserve/detail?id=' + this.data.detail.seller.id
540 }) 537 })
541 }, 538 },
  539 + // 文字转语音的方法
  540 + textToSpeechFun(voice_info) {
  541 + console.log('voice_info', voice_info);
  542 + let that = this;
  543 + let data = this.data;
  544 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  545 + const replacements = {
  546 + "{年月日}": data.seller.yearMonthDay,
  547 + "{月日}": data.seller.yearMonth,
  548 + "{餐段}": data.seller.soltName,
  549 + "{就餐时间}": data.seller.dateStr,
  550 + "{包间名}": data.seller.deskStr,
  551 + "{区域名+包间名}": data.seller.tablesText,
  552 + "{经理名字}": data.staffinfo.name,
  553 + "{客人姓名}": data.detail.rname + str,
  554 + };
  555 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  556 + return replacements[matched];
  557 + });
  558 + console.log('newStr', newStr);
  559 + plugin.textToSpeech({
  560 + lang: "zh_CN",
  561 + tts: true,
  562 + content: newStr,
  563 + success: function (res) {
  564 + that.filename = res.filename
  565 + that.speech()
  566 + },
  567 + fail: function (res) {
  568 + console.log("fail tts", res)
  569 + }
  570 + })
  571 + },
  572 + // 开启语音播报
  573 + speech() {
  574 + var attentionAnim = wx.createAnimation({
  575 + duration: 1000,
  576 + timingFunction: 'linear',
  577 + })
  578 + this.attentionAnim = attentionAnim
  579 + this.setData({
  580 + _attentionAnim: attentionAnim,
  581 + attentionAnim: attentionAnim.export()
  582 + })
  583 + this.audioCtx = wx.createInnerAudioContext()
  584 + this.audioCtx.src = this.filename
  585 + this.audioCtx.loop = true
  586 + this.audioCtx.play()
  587 + this.audioCtx.onPlay((e) => {
  588 + this.setData({
  589 + isPlay: this.audioCtx.paused ? '2' : '1'
  590 + })
  591 + })
  592 + this.audioCtx.onPause((e) => {
  593 + this.setData({
  594 + isPlay: this.audioCtx.paused ? '2' : '1'
  595 + })
  596 + })
  597 + clearInterval(this.timers)
  598 + this.animation()
  599 + },
  600 + // 持续旋转动画
  601 + animation() {
  602 + let that = this;
  603 + var time = setInterval(function () {
  604 + this.n = this.n + 1;
  605 + let attentionAnim = that.data._attentionAnim
  606 + attentionAnim.rotate(180 * (this.n)).step()
  607 + that.setData({
  608 + attentionAnim: attentionAnim.export(),
  609 + })
  610 + }.bind(this), 1000)
  611 + this.timers = time;
  612 + },
  613 + // 暂停/继续播放
  614 + stopMusic() {
  615 + if (this.data.isPlay == '2') { // 2 暂停状态
  616 + console.log("开始");
  617 + clearInterval(this.timers)
  618 + this.animation()
  619 + this.audioCtx.play() //开始
  620 + return;
  621 + }
  622 + if (this.data.isPlay == '1') { // 1 运行状态
  623 + console.log('暂停');
  624 + if (this.n % 2 != 0) {
  625 + this.n = this.n + 1;
  626 + let attentionAnim = this.data._attentionAnim;
  627 + attentionAnim.rotate(180 * this.n).step();
  628 + this.setData({
  629 + attentionAnim: attentionAnim.export(),
  630 + })
  631 + }
  632 + clearInterval(this.timers)
  633 + this.audioCtx.pause() //暂停
  634 + return;
  635 + }
  636 + },
  637 + // 根据充值ID获取充值详情
  638 + getRechargeDetail(id) {
  639 + App.Activity.GetNewRecharge({
  640 + id
  641 + }).then(res => {
  642 + let detail = res.data
  643 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  644 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  645 + let priceInfo, scoreInfo, certificate;
  646 + detail.recharge_list = recharge_list;
  647 + detail.exp_date = exp_date;
  648 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  649 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  650 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  651 + this.setData({
  652 + recharge_data: detail,
  653 + scoreInfo,
  654 + priceInfo,
  655 + certificate
  656 + })
  657 + })
  658 + },
  659 + // 根据券ID获取券详情
  660 + getActivityByIdFun(ids, length) {
  661 + let coupon_dataList = [];
  662 + ids.forEach(i => {
  663 + App.Activity.GetActivityById({
  664 + id: i.id
  665 + }).then(res => {
  666 + if (res.data.length > 0) {
  667 + let detail = res.data[0];
  668 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  669 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  670 + detail.use = detail.use ? util.determine(detail.use) : '';
  671 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  672 + let cash = detail.use.cash * 1;
  673 + let price = detail.price * 1;
  674 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  675 + }
  676 + coupon_dataList.push(detail);
  677 + if (length === ids.length) {
  678 + this.setData({
  679 + coupon_dataList,
  680 + })
  681 + }
  682 + }
  683 + })
  684 + })
  685 + },
542 /** 686 /**
543 * 生命周期函数--监听页面隐藏 687 * 生命周期函数--监听页面隐藏
544 */ 688 */
545 onHide() { 689 onHide() {
546 - 690 + clearInterval(this.timers)
  691 + this.audioCtx.pause() //暂停
547 }, 692 },
548 693
549 /** 694 /**
@@ -2,6 +2,13 @@ @@ -2,6 +2,13 @@
2 <import src="../tpl/invitation"></import> 2 <import src="../tpl/invitation"></import>
3 <nav hasHome backgroundColor="{{themeSixteen}}" color="#fff" class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 3 <nav hasHome backgroundColor="{{themeSixteen}}" color="#fff" class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
4 <scroll-view scroll-y class="{{themeColor}}"> 4 <scroll-view scroll-y class="{{themeColor}}">
  5 + <image
  6 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  7 + class="musicImg"
  8 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  9 + bindtap="stopMusic"
  10 + animation="{{attentionAnim}}"
  11 + />
5 <view class="positioningBox"> 12 <view class="positioningBox">
6 <view class="positioning"> 13 <view class="positioning">
7 <text class="font48r">{{seller.name || reserve.seller_name}}</text> 14 <text class="font48r">{{seller.name || reserve.seller_name}}</text>
@@ -15,6 +22,9 @@ @@ -15,6 +22,9 @@
15 </view> 22 </view>
16 </view> 23 </view>
17 <view class="reservationInfo"> 24 <view class="reservationInfo">
  25 + <view class="begin" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
  26 + <view class="font36r">{{reserve && reserve.book_info}}</view>
  27 + </view>
18 <view class="flex-11" wx:if="{{seller.date}}"> 28 <view class="flex-11" wx:if="{{seller.date}}">
19 <view class="label font36r">【就餐日期】</view> 29 <view class="label font36r">【就餐日期】</view>
20 <view class="contentData font36r">{{seller.date}}</view> 30 <view class="contentData font36r">{{seller.date}}</view>
@@ -74,9 +84,7 @@ @@ -74,9 +84,7 @@
74 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 84 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
75 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 85 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
76 </view> 86 </view>
77 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
78 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
79 - </view> 87 + <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>
80 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 88 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
81 无限制{{item.desc?','+item.desc+'。':'。'}} 89 无限制{{item.desc?','+item.desc+'。':'。'}}
82 </view> 90 </view>
@@ -176,7 +184,7 @@ @@ -176,7 +184,7 @@
176 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 184 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
177 </view> 185 </view>
178 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 186 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
179 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 187 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
180 </view> 188 </view>
181 </view> 189 </view>
182 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 190 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -22,6 +22,12 @@ @@ -22,6 +22,12 @@
22 border-bottom-right-radius: 10rpx; 22 border-bottom-right-radius: 10rpx;
23 } 23 }
24 24
  25 +.reservationInfo .begin {
  26 + margin: 0 30rpx 0 45rpx;
  27 + line-height: 64rpx;
  28 + font-family: PingFang SC;
  29 + font-size: 32rpx;
  30 +}
25 31
26 .reservationInfo .flex-11 { 32 .reservationInfo .flex-11 {
27 margin: 0 30rpx; 33 margin: 0 30rpx;
@@ -335,7 +341,6 @@ @@ -335,7 +341,6 @@
335 color: #515151; 341 color: #515151;
336 font-family: PingFang SC; 342 font-family: PingFang SC;
337 font-weight: 500; 343 font-weight: 500;
338 - font-size: 20rpx;  
339 display: -webkit-box; 344 display: -webkit-box;
340 word-break: break-all; 345 word-break: break-all;
341 word-wrap: break-word; 346 word-wrap: break-word;
@@ -566,6 +571,19 @@ @@ -566,6 +571,19 @@
566 -webkit-box-orient: vertical; 571 -webkit-box-orient: vertical;
567 } 572 }
568 573
  574 +.musicImg {
  575 + width: 62rpx;
  576 + height: 62rpx;
  577 + position: fixed !important;
  578 + right: 8%;
  579 + top: 15%;
  580 + z-index: 200;
  581 +}
  582 +
  583 +.bookData{
  584 + margin-left: 0;
  585 +}
  586 +
569 /* 深中国红 */ 587 /* 深中国红 */
570 .crimson .reservationInfo, 588 .crimson .reservationInfo,
571 .crimson .positioningBox { 589 .crimson .positioningBox {
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -49,10 +49,16 @@ Page({ @@ -49,10 +49,16 @@ Page({
49 hasValueOrder:false,//商家是否开通提前点餐功能 49 hasValueOrder:false,//商家是否开通提前点餐功能
50 hasValueCertificate:false,//商家是否开通优惠券功能 50 hasValueCertificate:false,//商家是否开通优惠券功能
51 hasValueRecharge:false,//商家是否开通充值功能 51 hasValueRecharge:false,//商家是否开通充值功能
  52 + _attentionAnim: {},
  53 + isPlay: '1',
52 }, 54 },
53 tablestr: '', 55 tablestr: '',
54 urlsValue: [], 56 urlsValue: [],
55 screenHeight: '', 57 screenHeight: '',
  58 + attentionAnim: {},
  59 + audioCtx: '', //播报
  60 + timers: null, // 动画定时器
  61 + n: 0,
56 /** 62 /**
57 * 生命周期函数--监听页面加载 63 * 生命周期函数--监听页面加载
58 */ 64 */
@@ -212,12 +218,14 @@ Page({ @@ -212,12 +218,14 @@ Page({
212 rid: this.data.options.id 218 rid: this.data.options.id
213 }).then(res => { 219 }).then(res => {
214 let tablesText = '', //桌子信息 220 let tablesText = '', //桌子信息
  221 + deskStr = '',
215 tableNum = 0; 222 tableNum = 0;
216 let tableinfo = util.determine(res.data.tableinfo); 223 let tableinfo = util.determine(res.data.tableinfo);
217 console.log('tableinfo', tableinfo); 224 console.log('tableinfo', tableinfo);
218 res.data.tables.forEach((t, i) => { 225 res.data.tables.forEach((t, i) => {
219 tableNum += t.table_pnum * 1 226 tableNum += t.table_pnum * 1
220 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 227 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  228 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
221 }) 229 })
222 let tabaleids = []; 230 let tabaleids = [];
223 res.data.tables.forEach(t => { 231 res.data.tables.forEach(t => {
@@ -236,6 +244,9 @@ Page({ @@ -236,6 +244,9 @@ Page({
236 } else { 244 } else {
237 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 245 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
238 } 246 }
  247 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  248 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  249 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
239 console.log('dateSmart', dateSmart); 250 console.log('dateSmart', dateSmart);
240 this.setData({ 251 this.setData({
241 detail: this.formatDatail(reserev, dateSmart), 252 detail: this.formatDatail(reserev, dateSmart),
@@ -259,14 +270,17 @@ Page({ @@ -259,14 +270,17 @@ Page({
259 lat: reserev.seller.lat, 270 lat: reserev.seller.lat,
260 long: reserev.seller.long, 271 long: reserev.seller.long,
261 seller_tel: reserev.seller.seller_tel, 272 seller_tel: reserev.seller.seller_tel,
  273 + yearMonthDay,
  274 + yearMonth,
  275 + dateStr,
  276 + deskStr,
262 } 277 }
263 }) 278 })
264 console.log('reserev reserev', reserev); 279 console.log('reserev reserev', reserev);
265 console.log('seller seller', this.data.seller); 280 console.log('seller seller', this.data.seller);
266 console.log('detail detail', this.data.detail); 281 console.log('detail detail', this.data.detail);
267 setTimeout(() => { 282 setTimeout(() => {
268 - this.getSellerTemplateConfFun(reserev.sid);  
269 - this.getstaffinfo(res.data.uid) 283 + this.getstaffinfo(res.data.uid, reserev.sid);
270 this.getroomimage(reserev.sid) 284 this.getroomimage(reserev.sid)
271 this.getSellerVersionFun(reserev.sid); 285 this.getSellerVersionFun(reserev.sid);
272 }, 0); 286 }, 0);
@@ -293,7 +307,7 @@ Page({ @@ -293,7 +307,7 @@ Page({
293 }) 307 })
294 }, 308 },
295 // 客户经理获取基本信息 309 // 客户经理获取基本信息
296 - getstaffinfo(uid) { 310 + getstaffinfo(uid, sid) {
297 console.log('sellerid', this.data.detail.seller.id); 311 console.log('sellerid', this.data.detail.seller.id);
298 App.Activity.GetCustomerActivityBaseinfo({ 312 App.Activity.GetCustomerActivityBaseinfo({
299 sellerid: this.data.detail.seller.id, 313 sellerid: this.data.detail.seller.id,
@@ -304,6 +318,7 @@ Page({ @@ -304,6 +318,7 @@ Page({
304 this.setData({ 318 this.setData({
305 staffinfo: json.data 319 staffinfo: json.data
306 }) 320 })
  321 + this.getSellerTemplateConfFun(sid);
307 } 322 }
308 }) 323 })
309 }, 324 },
@@ -390,8 +405,8 @@ Page({ @@ -390,8 +405,8 @@ Page({
390 }).then(res => { 405 }).then(res => {
391 let data = res.data 406 let data = res.data
392 console.log('data', data); 407 console.log('data', data);
393 - let coupon_dataList = []  
394 - let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 408 + let couponList = []
  409 + let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
395 chef = util.determine(data.chef); 410 chef = util.determine(data.chef);
396 reserve = util.determine(data.reserve); 411 reserve = util.determine(data.reserve);
397 marketing = util.determine(data.marketing); 412 marketing = util.determine(data.marketing);
@@ -407,28 +422,18 @@ Page({ @@ -407,28 +422,18 @@ Page({
407 } 422 }
408 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 423 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
409 if (coupon && util.getType(coupon) == 'object') { 424 if (coupon && util.getType(coupon) == 'object') {
410 - coupon.stringifyUse = JSON.stringify(coupon.use)  
411 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
412 - let cash = coupon.use.cash * 1;  
413 - let price = coupon.price * 1;  
414 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
415 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
416 - }  
417 - coupon_dataList.push(coupon); 425 + couponList.push({
  426 + id: coupon.id
  427 + });
418 } 428 }
419 if (coupon && util.getType(coupon) == 'array') { 429 if (coupon && util.getType(coupon) == 'array') {
420 if (coupon.length > 0) { 430 if (coupon.length > 0) {
421 coupon.forEach(item => { 431 coupon.forEach(item => {
422 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
423 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
424 - let cash = item.use.cash * 1;  
425 - let price = item.price * 1;  
426 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
427 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
428 - } 432 + couponList.push({
  433 + id: item.id
  434 + })
429 }) 435 })
430 } 436 }
431 - coupon_dataList = coupon;  
432 } 437 }
433 let obj = { 438 let obj = {
434 chef, 439 chef,
@@ -437,9 +442,8 @@ Page({ @@ -437,9 +442,8 @@ Page({
437 signboard, 442 signboard,
438 store, 443 store,
439 home, 444 home,
440 - stringifyUse,  
441 coupon, 445 coupon,
442 - coupon_dataList, 446 + couponList,
443 swich_phone, 447 swich_phone,
444 is_comments, 448 is_comments,
445 StyleType, 449 StyleType,
@@ -448,24 +452,12 @@ Page({ @@ -448,24 +452,12 @@ Page({
448 console.log('获取数据', { 452 console.log('获取数据', {
449 ...obj 453 ...obj
450 }); 454 });
  455 + // 根据券ID获取券详情
  456 + this.getActivityByIdFun(couponList, couponList.length)
  457 + // 根据充值ID获取充值详情
451 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 458 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
452 - let recharge_data = marketing.recharge_data  
453 - recharge_list = marketing.recharge_data.recharge_list  
454 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
455 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
456 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
457 - console.log('scoreInfo', scoreInfo);  
458 - console.log('priceInfo', priceInfo);  
459 - this.setData({  
460 - recharge_data: marketing.recharge_data,  
461 - certificate  
462 - })  
463 - console.log('recharge_data', recharge_data); 459 + this.getRechargeDetail(marketing.recharge_data.id)
464 } 460 }
465 - this.setData({  
466 - coupon_dataList,  
467 - stringifyUse  
468 - })  
469 if (store && store.images.length > 0) store.images = util.determine(store.images); 461 if (store && store.images.length > 0) store.images = util.determine(store.images);
470 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 462 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
471 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 463 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -485,14 +477,19 @@ Page({ @@ -485,14 +477,19 @@ Page({
485 reserve, 477 reserve,
486 signboard, 478 signboard,
487 store, 479 store,
488 - priceInfo,  
489 - scoreInfo,  
490 swich_phone, 480 swich_phone,
491 is_comments, 481 is_comments,
492 StyleType, 482 StyleType,
493 themeColor, 483 themeColor,
494 whiteBj, 484 whiteBj,
495 }) 485 })
  486 + // 开启语音播报
  487 + if (reserve && reserve.swich_voice == '1') {
  488 + this.setData({
  489 + isPlay: '1',
  490 + })
  491 + this.textToSpeechFun(reserve.voice_info)
  492 + }
496 }).catch(res => { 493 }).catch(res => {
497 console.log('GetSellerTemplateConf请求失败'); 494 console.log('GetSellerTemplateConf请求失败');
498 }) 495 })
@@ -504,11 +501,159 @@ Page({ @@ -504,11 +501,159 @@ Page({
504 url: '../reserve/detail?id=' + this.data.detail.seller.id 501 url: '../reserve/detail?id=' + this.data.detail.seller.id
505 }) 502 })
506 }, 503 },
  504 + // 文字转语音的方法
  505 + textToSpeechFun(voice_info) {
  506 + console.log('voice_info', voice_info);
  507 + let that = this;
  508 + let data = this.data;
  509 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  510 + const replacements = {
  511 + "{年月日}": data.seller.yearMonthDay,
  512 + "{月日}": data.seller.yearMonth,
  513 + "{餐段}": data.seller.soltName,
  514 + "{就餐时间}": data.seller.dateStr,
  515 + "{包间名}": data.seller.deskStr,
  516 + "{区域名+包间名}": data.seller.tablesText,
  517 + "{经理名字}": data.staffinfo.name,
  518 + "{客人姓名}": data.detail.rname + str,
  519 + };
  520 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  521 + return replacements[matched];
  522 + });
  523 + console.log('newStr', newStr);
  524 + plugin.textToSpeech({
  525 + lang: "zh_CN",
  526 + tts: true,
  527 + content: newStr,
  528 + success: function (res) {
  529 + that.filename = res.filename
  530 + that.speech()
  531 + },
  532 + fail: function (res) {
  533 + console.log("fail tts", res)
  534 + }
  535 + })
  536 + },
  537 + // 开启语音播报
  538 + speech() {
  539 + var attentionAnim = wx.createAnimation({
  540 + duration: 1000,
  541 + timingFunction: 'linear',
  542 + })
  543 + this.attentionAnim = attentionAnim
  544 + this.setData({
  545 + _attentionAnim: attentionAnim,
  546 + attentionAnim: attentionAnim.export()
  547 + })
  548 + this.audioCtx = wx.createInnerAudioContext()
  549 + this.audioCtx.src = this.filename
  550 + this.audioCtx.loop = true
  551 + this.audioCtx.play()
  552 + this.audioCtx.onPlay((e) => {
  553 + this.setData({
  554 + isPlay: this.audioCtx.paused ? '2' : '1'
  555 + })
  556 + })
  557 + this.audioCtx.onPause((e) => {
  558 + this.setData({
  559 + isPlay: this.audioCtx.paused ? '2' : '1'
  560 + })
  561 + })
  562 + clearInterval(this.timers)
  563 + this.animation()
  564 + },
  565 + // 持续旋转动画
  566 + animation() {
  567 + let that = this;
  568 + var time = setInterval(function () {
  569 + this.n = this.n + 1;
  570 + let attentionAnim = that.data._attentionAnim
  571 + attentionAnim.rotate(180 * (this.n)).step()
  572 + that.setData({
  573 + attentionAnim: attentionAnim.export(),
  574 + })
  575 + }.bind(this), 1000)
  576 + this.timers = time;
  577 + },
  578 + // 暂停/继续播放
  579 + stopMusic() {
  580 + if (this.data.isPlay == '2') { // 2 暂停状态
  581 + console.log("开始");
  582 + clearInterval(this.timers)
  583 + this.animation()
  584 + this.audioCtx.play() //开始
  585 + return;
  586 + }
  587 + if (this.data.isPlay == '1') { // 1 运行状态
  588 + console.log('暂停');
  589 + if (this.n % 2 != 0) {
  590 + this.n = this.n + 1;
  591 + let attentionAnim = this.data._attentionAnim;
  592 + attentionAnim.rotate(180 * this.n).step();
  593 + this.setData({
  594 + attentionAnim: attentionAnim.export(),
  595 + })
  596 + }
  597 + clearInterval(this.timers)
  598 + this.audioCtx.pause() //暂停
  599 + return;
  600 + }
  601 + },
  602 + // 根据充值ID获取充值详情
  603 + getRechargeDetail(id) {
  604 + App.Activity.GetNewRecharge({
  605 + id
  606 + }).then(res => {
  607 + let detail = res.data
  608 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  609 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  610 + let priceInfo, scoreInfo, certificate;
  611 + detail.recharge_list = recharge_list;
  612 + detail.exp_date = exp_date;
  613 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  614 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  615 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  616 + this.setData({
  617 + recharge_data: detail,
  618 + scoreInfo,
  619 + priceInfo,
  620 + certificate
  621 + })
  622 + })
  623 + },
  624 + // 根据券ID获取券详情
  625 + getActivityByIdFun(ids, length) {
  626 + let coupon_dataList = [];
  627 + ids.forEach(i => {
  628 + App.Activity.GetActivityById({
  629 + id: i.id
  630 + }).then(res => {
  631 + if (res.data.length > 0) {
  632 + let detail = res.data[0];
  633 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  634 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  635 + detail.use = detail.use ? util.determine(detail.use) : '';
  636 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  637 + let cash = detail.use.cash * 1;
  638 + let price = detail.price * 1;
  639 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  640 + }
  641 + coupon_dataList.push(detail);
  642 + if (length === ids.length) {
  643 + this.setData({
  644 + coupon_dataList,
  645 + })
  646 + }
  647 + }
  648 + })
  649 + })
  650 + },
507 /** 651 /**
508 * 生命周期函数--监听页面隐藏 652 * 生命周期函数--监听页面隐藏
509 */ 653 */
510 onHide() { 654 onHide() {
511 - 655 + clearInterval(this.timers)
  656 + this.audioCtx.pause() //暂停
512 }, 657 },
513 658
514 /** 659 /**
@@ -2,6 +2,13 @@ @@ -2,6 +2,13 @@
2 <import src="../tpl/invitation"></import> 2 <import src="../tpl/invitation"></import>
3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
4 <scroll-view scroll-y class="{{themeColor}}"> 4 <scroll-view scroll-y class="{{themeColor}}">
  5 + <image
  6 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  7 + class="musicImg"
  8 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  9 + bindtap="stopMusic"
  10 + animation="{{attentionAnim}}"
  11 + />
5 <view class="reservationInfo"> 12 <view class="reservationInfo">
6 <view class="titleImg"> 13 <view class="titleImg">
7 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image> 14 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
@@ -16,6 +23,9 @@ @@ -16,6 +23,9 @@
16 <text>{{item.name}}</text> 23 <text>{{item.name}}</text>
17 </view> 24 </view>
18 </view> 25 </view>
  26 + <view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
  27 + <view class="font40r">{{reserve && reserve.book_info}}</view>
  28 + </view>
19 <view class="begin"> 29 <view class="begin">
20 <view class="font40r">尊敬的贵宾,您好!</view> 30 <view class="font40r">尊敬的贵宾,您好!</view>
21 <view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view> 31 <view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view>
@@ -82,9 +92,7 @@ @@ -82,9 +92,7 @@
82 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 92 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
83 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 93 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
84 </view> 94 </view>
85 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
86 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
87 - </view> 95 + <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>
88 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 96 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
89 无限制{{item.desc?','+item.desc+'。':'。'}} 97 无限制{{item.desc?','+item.desc+'。':'。'}}
90 </view> 98 </view>
@@ -184,7 +192,7 @@ @@ -184,7 +192,7 @@
184 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 192 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
185 </view> 193 </view>
186 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 194 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
187 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 195 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
188 </view> 196 </view>
189 </view> 197 </view>
190 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 198 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -49,11 +49,15 @@ @@ -49,11 +49,15 @@
49 } 49 }
50 50
51 .begin { 51 .begin {
52 - margin: 20rpx 30rpx 30rpx 30rpx; 52 + margin: 0 30rpx 0 30rpx;
53 color: #FBF6F1; 53 color: #FBF6F1;
54 font-family: PingFang SC; 54 font-family: PingFang SC;
55 } 55 }
56 56
  57 +.beginTop{
  58 + margin: 30rpx 30rpx 0;
  59 +}
  60 +
57 .begin view { 61 .begin view {
58 line-height: 64rpx; 62 line-height: 64rpx;
59 } 63 }
@@ -376,7 +380,6 @@ @@ -376,7 +380,6 @@
376 color: #515151; 380 color: #515151;
377 font-family: PingFang SC; 381 font-family: PingFang SC;
378 font-weight: 500; 382 font-weight: 500;
379 - font-size: 20rpx;  
380 display: -webkit-box; 383 display: -webkit-box;
381 word-break: break-all; 384 word-break: break-all;
382 word-wrap: break-word; 385 word-wrap: break-word;
@@ -625,6 +628,19 @@ @@ -625,6 +628,19 @@
625 -webkit-box-orient: vertical; 628 -webkit-box-orient: vertical;
626 } 629 }
627 630
  631 +.musicImg{
  632 + width: 62rpx;
  633 + height: 62rpx;
  634 + position: fixed !important;
  635 + right: 8%;
  636 + top: 13%;
  637 + z-index: 200;
  638 +}
  639 +
  640 +.bookData{
  641 + margin-left: 0;
  642 +}
  643 +
628 /* 黑蓝过渡 */ 644 /* 黑蓝过渡 */
629 .blackBlueGradient .reservationInfo { 645 .blackBlueGradient .reservationInfo {
630 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 646 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -49,10 +49,16 @@ Page({ @@ -49,10 +49,16 @@ Page({
49 hasValueOrder:false,//商家是否开通提前点餐功能 49 hasValueOrder:false,//商家是否开通提前点餐功能
50 hasValueCertificate:false,//商家是否开通优惠券功能 50 hasValueCertificate:false,//商家是否开通优惠券功能
51 hasValueRecharge:false,//商家是否开通充值功能 51 hasValueRecharge:false,//商家是否开通充值功能
  52 + _attentionAnim: {},
  53 + isPlay: '1',
52 }, 54 },
53 tablestr: '', 55 tablestr: '',
54 urlsValue: [], 56 urlsValue: [],
55 screenHeight: '', 57 screenHeight: '',
  58 + attentionAnim: {},
  59 + audioCtx: '', //播报
  60 + timers: null, // 动画定时器
  61 + n: 0,
56 /** 62 /**
57 * 生命周期函数--监听页面加载 63 * 生命周期函数--监听页面加载
58 */ 64 */
@@ -212,12 +218,14 @@ Page({ @@ -212,12 +218,14 @@ Page({
212 rid: this.data.options.id 218 rid: this.data.options.id
213 }).then(res => { 219 }).then(res => {
214 let tablesText = '', //桌子信息 220 let tablesText = '', //桌子信息
  221 + deskStr = '',
215 tableNum = 0; 222 tableNum = 0;
216 let tableinfo = util.determine(res.data.tableinfo); 223 let tableinfo = util.determine(res.data.tableinfo);
217 console.log('tableinfo', tableinfo); 224 console.log('tableinfo', tableinfo);
218 res.data.tables.forEach((t, i) => { 225 res.data.tables.forEach((t, i) => {
219 tableNum += t.table_pnum * 1 226 tableNum += t.table_pnum * 1
220 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 227 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  228 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
221 }) 229 })
222 let tabaleids = []; 230 let tabaleids = [];
223 res.data.tables.forEach(t => { 231 res.data.tables.forEach(t => {
@@ -236,6 +244,9 @@ Page({ @@ -236,6 +244,9 @@ Page({
236 } else { 244 } else {
237 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 245 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
238 } 246 }
  247 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  248 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  249 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
239 console.log('dateSmart', dateSmart); 250 console.log('dateSmart', dateSmart);
240 this.setData({ 251 this.setData({
241 detail: this.formatDatail(reserev, dateSmart), 252 detail: this.formatDatail(reserev, dateSmart),
@@ -259,14 +270,17 @@ Page({ @@ -259,14 +270,17 @@ Page({
259 lat: reserev.seller.lat, 270 lat: reserev.seller.lat,
260 long: reserev.seller.long, 271 long: reserev.seller.long,
261 seller_tel: reserev.seller.seller_tel, 272 seller_tel: reserev.seller.seller_tel,
  273 + yearMonthDay,
  274 + yearMonth,
  275 + dateStr,
  276 + deskStr,
262 } 277 }
263 }) 278 })
264 console.log('reserev reserev', reserev); 279 console.log('reserev reserev', reserev);
265 console.log('seller seller', this.data.seller); 280 console.log('seller seller', this.data.seller);
266 console.log('detail detail', this.data.detail); 281 console.log('detail detail', this.data.detail);
267 setTimeout(() => { 282 setTimeout(() => {
268 - this.getSellerTemplateConfFun(reserev.sid);  
269 - this.getstaffinfo(res.data.uid) 283 + this.getstaffinfo(res.data.uid, reserev.sid);
270 this.getroomimage(reserev.sid) 284 this.getroomimage(reserev.sid)
271 this.getSellerVersionFun(reserev.sid); 285 this.getSellerVersionFun(reserev.sid);
272 }, 0); 286 }, 0);
@@ -293,7 +307,7 @@ Page({ @@ -293,7 +307,7 @@ Page({
293 }) 307 })
294 }, 308 },
295 // 客户经理获取基本信息 309 // 客户经理获取基本信息
296 - getstaffinfo(uid) { 310 + getstaffinfo(uid, sid) {
297 console.log('sellerid', this.data.detail.seller.id); 311 console.log('sellerid', this.data.detail.seller.id);
298 App.Activity.GetCustomerActivityBaseinfo({ 312 App.Activity.GetCustomerActivityBaseinfo({
299 sellerid: this.data.detail.seller.id, 313 sellerid: this.data.detail.seller.id,
@@ -304,6 +318,7 @@ Page({ @@ -304,6 +318,7 @@ Page({
304 this.setData({ 318 this.setData({
305 staffinfo: json.data 319 staffinfo: json.data
306 }) 320 })
  321 + this.getSellerTemplateConfFun(sid);
307 } 322 }
308 }) 323 })
309 }, 324 },
@@ -390,8 +405,8 @@ Page({ @@ -390,8 +405,8 @@ Page({
390 }).then(res => { 405 }).then(res => {
391 let data = res.data 406 let data = res.data
392 console.log('data', data); 407 console.log('data', data);
393 - let coupon_dataList = []  
394 - let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 408 + let couponList = []
  409 + let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
395 chef = util.determine(data.chef); 410 chef = util.determine(data.chef);
396 reserve = util.determine(data.reserve); 411 reserve = util.determine(data.reserve);
397 marketing = util.determine(data.marketing); 412 marketing = util.determine(data.marketing);
@@ -407,28 +422,18 @@ Page({ @@ -407,28 +422,18 @@ Page({
407 } 422 }
408 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 423 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
409 if (coupon && util.getType(coupon) == 'object') { 424 if (coupon && util.getType(coupon) == 'object') {
410 - coupon.stringifyUse = JSON.stringify(coupon.use)  
411 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
412 - let cash = coupon.use.cash * 1;  
413 - let price = coupon.price * 1;  
414 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
415 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
416 - }  
417 - coupon_dataList.push(coupon); 425 + couponList.push({
  426 + id: coupon.id
  427 + });
418 } 428 }
419 if (coupon && util.getType(coupon) == 'array') { 429 if (coupon && util.getType(coupon) == 'array') {
420 if (coupon.length > 0) { 430 if (coupon.length > 0) {
421 coupon.forEach(item => { 431 coupon.forEach(item => {
422 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
423 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
424 - let cash = item.use.cash * 1;  
425 - let price = item.price * 1;  
426 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
427 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
428 - } 432 + couponList.push({
  433 + id: item.id
  434 + })
429 }) 435 })
430 } 436 }
431 - coupon_dataList = coupon;  
432 } 437 }
433 let obj = { 438 let obj = {
434 chef, 439 chef,
@@ -437,9 +442,8 @@ Page({ @@ -437,9 +442,8 @@ Page({
437 signboard, 442 signboard,
438 store, 443 store,
439 home, 444 home,
440 - stringifyUse,  
441 coupon, 445 coupon,
442 - coupon_dataList, 446 + couponList,
443 swich_phone, 447 swich_phone,
444 is_comments, 448 is_comments,
445 StyleType, 449 StyleType,
@@ -448,24 +452,12 @@ Page({ @@ -448,24 +452,12 @@ Page({
448 console.log('获取数据', { 452 console.log('获取数据', {
449 ...obj 453 ...obj
450 }); 454 });
  455 + // 根据券ID获取券详情
  456 + this.getActivityByIdFun(couponList, couponList.length)
  457 + // 根据充值ID获取充值详情
451 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 458 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
452 - let recharge_data = marketing.recharge_data  
453 - recharge_list = marketing.recharge_data.recharge_list  
454 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
455 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
456 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
457 - console.log('scoreInfo', scoreInfo);  
458 - console.log('priceInfo', priceInfo);  
459 - this.setData({  
460 - recharge_data: marketing.recharge_data,  
461 - certificate  
462 - })  
463 - console.log('recharge_data', recharge_data); 459 + this.getRechargeDetail(marketing.recharge_data.id)
464 } 460 }
465 - this.setData({  
466 - coupon_dataList,  
467 - stringifyUse  
468 - })  
469 if (store && store.images.length > 0) store.images = util.determine(store.images); 461 if (store && store.images.length > 0) store.images = util.determine(store.images);
470 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 462 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
471 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 463 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -485,14 +477,19 @@ Page({ @@ -485,14 +477,19 @@ Page({
485 reserve, 477 reserve,
486 signboard, 478 signboard,
487 store, 479 store,
488 - priceInfo,  
489 - scoreInfo,  
490 swich_phone, 480 swich_phone,
491 is_comments, 481 is_comments,
492 StyleType, 482 StyleType,
493 themeColor, 483 themeColor,
494 whiteBj, 484 whiteBj,
495 }) 485 })
  486 + // 开启语音播报
  487 + if (reserve && reserve.swich_voice == '1') {
  488 + this.setData({
  489 + isPlay: '1',
  490 + })
  491 + this.textToSpeechFun(reserve.voice_info)
  492 + }
496 }).catch(res => { 493 }).catch(res => {
497 console.log('GetSellerTemplateConf请求失败'); 494 console.log('GetSellerTemplateConf请求失败');
498 }) 495 })
@@ -504,11 +501,159 @@ Page({ @@ -504,11 +501,159 @@ Page({
504 url: '../reserve/detail?id=' + this.data.detail.seller.id 501 url: '../reserve/detail?id=' + this.data.detail.seller.id
505 }) 502 })
506 }, 503 },
  504 + // 文字转语音的方法
  505 + textToSpeechFun(voice_info) {
  506 + console.log('voice_info', voice_info);
  507 + let that = this;
  508 + let data = this.data;
  509 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  510 + const replacements = {
  511 + "{年月日}": data.seller.yearMonthDay,
  512 + "{月日}": data.seller.yearMonth,
  513 + "{餐段}": data.seller.soltName,
  514 + "{就餐时间}": data.seller.dateStr,
  515 + "{包间名}": data.seller.deskStr,
  516 + "{区域名+包间名}": data.seller.tablesText,
  517 + "{经理名字}": data.staffinfo.name,
  518 + "{客人姓名}": data.detail.rname + str,
  519 + };
  520 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  521 + return replacements[matched];
  522 + });
  523 + console.log('newStr', newStr);
  524 + plugin.textToSpeech({
  525 + lang: "zh_CN",
  526 + tts: true,
  527 + content: newStr,
  528 + success: function (res) {
  529 + that.filename = res.filename
  530 + that.speech()
  531 + },
  532 + fail: function (res) {
  533 + console.log("fail tts", res)
  534 + }
  535 + })
  536 + },
  537 + // 开启语音播报
  538 + speech() {
  539 + var attentionAnim = wx.createAnimation({
  540 + duration: 1000,
  541 + timingFunction: 'linear',
  542 + })
  543 + this.attentionAnim = attentionAnim
  544 + this.setData({
  545 + _attentionAnim: attentionAnim,
  546 + attentionAnim: attentionAnim.export()
  547 + })
  548 + this.audioCtx = wx.createInnerAudioContext()
  549 + this.audioCtx.src = this.filename
  550 + this.audioCtx.loop = true
  551 + this.audioCtx.play()
  552 + this.audioCtx.onPlay((e) => {
  553 + this.setData({
  554 + isPlay: this.audioCtx.paused ? '2' : '1'
  555 + })
  556 + })
  557 + this.audioCtx.onPause((e) => {
  558 + this.setData({
  559 + isPlay: this.audioCtx.paused ? '2' : '1'
  560 + })
  561 + })
  562 + clearInterval(this.timers)
  563 + this.animation()
  564 + },
  565 + // 持续旋转动画
  566 + animation() {
  567 + let that = this;
  568 + var time = setInterval(function () {
  569 + this.n = this.n + 1;
  570 + let attentionAnim = that.data._attentionAnim
  571 + attentionAnim.rotate(180 * (this.n)).step()
  572 + that.setData({
  573 + attentionAnim: attentionAnim.export(),
  574 + })
  575 + }.bind(this), 1000)
  576 + this.timers = time;
  577 + },
  578 + // 暂停/继续播放
  579 + stopMusic() {
  580 + if (this.data.isPlay == '2') { // 2 暂停状态
  581 + console.log("开始");
  582 + clearInterval(this.timers)
  583 + this.animation()
  584 + this.audioCtx.play() //开始
  585 + return;
  586 + }
  587 + if (this.data.isPlay == '1') { // 1 运行状态
  588 + console.log('暂停');
  589 + if (this.n % 2 != 0) {
  590 + this.n = this.n + 1;
  591 + let attentionAnim = this.data._attentionAnim;
  592 + attentionAnim.rotate(180 * this.n).step();
  593 + this.setData({
  594 + attentionAnim: attentionAnim.export(),
  595 + })
  596 + }
  597 + clearInterval(this.timers)
  598 + this.audioCtx.pause() //暂停
  599 + return;
  600 + }
  601 + },
  602 + // 根据充值ID获取充值详情
  603 + getRechargeDetail(id) {
  604 + App.Activity.GetNewRecharge({
  605 + id
  606 + }).then(res => {
  607 + let detail = res.data
  608 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  609 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  610 + let priceInfo, scoreInfo, certificate;
  611 + detail.recharge_list = recharge_list;
  612 + detail.exp_date = exp_date;
  613 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  614 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  615 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  616 + this.setData({
  617 + recharge_data: detail,
  618 + scoreInfo,
  619 + priceInfo,
  620 + certificate
  621 + })
  622 + })
  623 + },
  624 + // 根据券ID获取券详情
  625 + getActivityByIdFun(ids, length) {
  626 + let coupon_dataList = [];
  627 + ids.forEach(i => {
  628 + App.Activity.GetActivityById({
  629 + id: i.id
  630 + }).then(res => {
  631 + if (res.data.length > 0) {
  632 + let detail = res.data[0];
  633 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  634 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  635 + detail.use = detail.use ? util.determine(detail.use) : '';
  636 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  637 + let cash = detail.use.cash * 1;
  638 + let price = detail.price * 1;
  639 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  640 + }
  641 + coupon_dataList.push(detail);
  642 + if (length === ids.length) {
  643 + this.setData({
  644 + coupon_dataList,
  645 + })
  646 + }
  647 + }
  648 + })
  649 + })
  650 + },
507 /** 651 /**
508 * 生命周期函数--监听页面隐藏 652 * 生命周期函数--监听页面隐藏
509 */ 653 */
510 onHide() { 654 onHide() {
511 - 655 + clearInterval(this.timers)
  656 + this.audioCtx.pause() //暂停
512 }, 657 },
513 658
514 /** 659 /**
1 <!--pages/customer/detail_owner_invitation4.wxml--> 1 <!--pages/customer/detail_owner_invitation4.wxml-->
2 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 2 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
3 <scroll-view scroll-y class="{{themeColor}}"> 3 <scroll-view scroll-y class="{{themeColor}}">
  4 + <image
  5 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  6 + class="musicImg"
  7 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  8 + bindtap="stopMusic"
  9 + animation="{{attentionAnim}}"
  10 + />
4 <view class="reservationInfo"> 11 <view class="reservationInfo">
5 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image> 12 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
6 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj2.png':'https://qn.colorcun.com/leaf1.png'}}" class="bjIcon"></image> 13 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj2.png':'https://qn.colorcun.com/leaf1.png'}}" class="bjIcon"></image>
@@ -8,12 +15,16 @@ @@ -8,12 +15,16 @@
8 <view class="boxLeft"> 15 <view class="boxLeft">
9 <view class="title">{{seller.name}}</view> 16 <view class="title">{{seller.name}}</view>
10 <view class="leftLine"></view> 17 <view class="leftLine"></view>
11 - <view class="leftInfo font36r">{{seller.date}} {{seller.soltName}}</view>  
12 - <view class="leftInfo font36r">{{seller.time}}</view>  
13 - <view class="leftInfo font36r over">{{seller.tablesText}}</view>  
14 - <view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view> 18 + <view class="lineBox">
  19 + <view class="leftInfo font36r"
  20 + wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}"
  21 + >{{reserve && reserve.book_info}}</view>
  22 + <view class="leftInfo font36r">{{seller.date}} {{seller.soltName}}</view>
  23 + <view class="leftInfo font36r">{{seller.time}}</view>
  24 + <view class="leftInfo font36r over">{{seller.tablesText}}</view>
  25 + <view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
  26 + </view>
15 </view> 27 </view>
16 - <view class="line"></view>  
17 <view class="infoBoxRight"> 28 <view class="infoBoxRight">
18 <text>邀请函</text> 29 <text>邀请函</text>
19 </view> 30 </view>
@@ -60,9 +71,7 @@ @@ -60,9 +71,7 @@
60 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 71 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
61 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text> 72 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
62 </view> 73 </view>
63 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
64 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
65 - </view> 74 + <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>
66 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 75 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
67 无限制{{item.desc?','+item.desc+'。':'。'}} 76 无限制{{item.desc?','+item.desc+'。':'。'}}
68 </view> 77 </view>
@@ -159,7 +168,7 @@ @@ -159,7 +168,7 @@
159 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 168 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
160 </view> 169 </view>
161 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 170 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
162 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 171 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
163 </view> 172 </view>
164 </view> 173 </view>
165 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 174 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -43,7 +43,12 @@ @@ -43,7 +43,12 @@
43 display: flex; 43 display: flex;
44 flex-direction: column; 44 flex-direction: column;
45 align-items: flex-end; 45 align-items: flex-end;
46 - margin: 20rpx 0 20rpx 40rpx; 46 + padding: 16rpx 0 16rpx 20rpx;
  47 +}
  48 +
  49 +.lineBox{
  50 + padding-right: 30rpx;
  51 + border-right: 2rpx solid #FFD200;
47 } 52 }
48 53
49 .leftLine { 54 .leftLine {
@@ -327,14 +332,13 @@ @@ -327,14 +332,13 @@
327 display: flex; 332 display: flex;
328 width: 100%; 333 width: 100%;
329 align-items: center; 334 align-items: center;
  335 + margin-bottom: 20rpx;
330 } 336 }
331 337
332 .bottom { 338 .bottom {
333 - margin-top: 20rpx;  
334 color: #515151; 339 color: #515151;
335 font-family: PingFang SC; 340 font-family: PingFang SC;
336 font-weight: 500; 341 font-weight: 500;
337 - font-size: 20rpx;  
338 display: -webkit-box; 342 display: -webkit-box;
339 word-break: break-all; 343 word-break: break-all;
340 word-wrap: break-word; 344 word-wrap: break-word;
@@ -578,6 +582,19 @@ @@ -578,6 +582,19 @@
578 height: 30rpx; 582 height: 30rpx;
579 } 583 }
580 584
  585 +.musicImg{
  586 + width: 62rpx;
  587 + height: 62rpx;
  588 + position: fixed !important;
  589 + right: 8%;
  590 + top: 15%;
  591 + z-index: 200;
  592 +}
  593 +
  594 +.bookData{
  595 + margin-left: 0;
  596 +}
  597 +
581 /* 黑蓝过渡 */ 598 /* 黑蓝过渡 */
582 .blackBlueGradient .reservationInfo { 599 .blackBlueGradient .reservationInfo {
583 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 600 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -48,10 +48,16 @@ Page({ @@ -48,10 +48,16 @@ Page({
48 hasValueOrder:false,//商家是否开通提前点餐功能 48 hasValueOrder:false,//商家是否开通提前点餐功能
49 hasValueCertificate:false,//商家是否开通优惠券功能 49 hasValueCertificate:false,//商家是否开通优惠券功能
50 hasValueRecharge:false,//商家是否开通充值功能 50 hasValueRecharge:false,//商家是否开通充值功能
  51 + _attentionAnim: {},
  52 + isPlay: '1',
51 }, 53 },
52 tablestr: '', 54 tablestr: '',
53 urlsValue: [], 55 urlsValue: [],
54 screenHeight: '', 56 screenHeight: '',
  57 + attentionAnim: {},
  58 + audioCtx: '', //播报
  59 + timers: null, // 动画定时器
  60 + n: 0,
55 /** 61 /**
56 * 生命周期函数--监听页面加载 62 * 生命周期函数--监听页面加载
57 */ 63 */
@@ -211,12 +217,14 @@ Page({ @@ -211,12 +217,14 @@ Page({
211 rid: this.data.options.id 217 rid: this.data.options.id
212 }).then(res => { 218 }).then(res => {
213 let tablesText = '', //桌子信息 219 let tablesText = '', //桌子信息
  220 + deskStr = '',
214 tableNum = 0; 221 tableNum = 0;
215 let tableinfo = util.determine(res.data.tableinfo); 222 let tableinfo = util.determine(res.data.tableinfo);
216 console.log('tableinfo', tableinfo); 223 console.log('tableinfo', tableinfo);
217 res.data.tables.forEach((t, i) => { 224 res.data.tables.forEach((t, i) => {
218 tableNum += t.table_pnum * 1 225 tableNum += t.table_pnum * 1
219 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 226 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  227 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
220 }) 228 })
221 let tabaleids = []; 229 let tabaleids = [];
222 res.data.tables.forEach(t => { 230 res.data.tables.forEach(t => {
@@ -235,6 +243,9 @@ Page({ @@ -235,6 +243,9 @@ Page({
235 } else { 243 } else {
236 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 244 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
237 } 245 }
  246 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  247 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  248 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
238 console.log('dateSmart', dateSmart); 249 console.log('dateSmart', dateSmart);
239 this.setData({ 250 this.setData({
240 detail: this.formatDatail(reserev, dateSmart), 251 detail: this.formatDatail(reserev, dateSmart),
@@ -258,14 +269,17 @@ Page({ @@ -258,14 +269,17 @@ Page({
258 lat: reserev.seller.lat, 269 lat: reserev.seller.lat,
259 long: reserev.seller.long, 270 long: reserev.seller.long,
260 seller_tel: reserev.seller.seller_tel, 271 seller_tel: reserev.seller.seller_tel,
  272 + yearMonthDay,
  273 + yearMonth,
  274 + dateStr,
  275 + deskStr,
261 } 276 }
262 }) 277 })
263 console.log('reserev reserev', reserev); 278 console.log('reserev reserev', reserev);
264 console.log('seller seller', this.data.seller); 279 console.log('seller seller', this.data.seller);
265 console.log('detail detail', this.data.detail); 280 console.log('detail detail', this.data.detail);
266 setTimeout(() => { 281 setTimeout(() => {
267 - this.getSellerTemplateConfFun(reserev.sid);  
268 - this.getstaffinfo(res.data.uid) 282 + this.getstaffinfo(res.data.uid, reserev.sid);
269 this.getroomimage(reserev.sid) 283 this.getroomimage(reserev.sid)
270 this.getSellerVersionFun(reserev.sid); 284 this.getSellerVersionFun(reserev.sid);
271 }, 0); 285 }, 0);
@@ -292,7 +306,7 @@ Page({ @@ -292,7 +306,7 @@ Page({
292 }) 306 })
293 }, 307 },
294 // 客户经理获取基本信息 308 // 客户经理获取基本信息
295 - getstaffinfo(uid) { 309 + getstaffinfo(uid, sid) {
296 console.log('sellerid', this.data.detail.seller.id); 310 console.log('sellerid', this.data.detail.seller.id);
297 App.Activity.GetCustomerActivityBaseinfo({ 311 App.Activity.GetCustomerActivityBaseinfo({
298 sellerid: this.data.detail.seller.id, 312 sellerid: this.data.detail.seller.id,
@@ -303,6 +317,7 @@ Page({ @@ -303,6 +317,7 @@ Page({
303 this.setData({ 317 this.setData({
304 staffinfo: json.data 318 staffinfo: json.data
305 }) 319 })
  320 + this.getSellerTemplateConfFun(sid);
306 } 321 }
307 }) 322 })
308 }, 323 },
@@ -389,8 +404,8 @@ Page({ @@ -389,8 +404,8 @@ Page({
389 }).then(res => { 404 }).then(res => {
390 let data = res.data 405 let data = res.data
391 console.log('data', data); 406 console.log('data', data);
392 - let coupon_dataList = []  
393 - let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 407 + let couponList = []
  408 + let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
394 chef = util.determine(data.chef); 409 chef = util.determine(data.chef);
395 reserve = util.determine(data.reserve); 410 reserve = util.determine(data.reserve);
396 marketing = util.determine(data.marketing); 411 marketing = util.determine(data.marketing);
@@ -406,28 +421,18 @@ Page({ @@ -406,28 +421,18 @@ Page({
406 } 421 }
407 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 422 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
408 if (coupon && util.getType(coupon) == 'object') { 423 if (coupon && util.getType(coupon) == 'object') {
409 - coupon.stringifyUse = JSON.stringify(coupon.use)  
410 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
411 - let cash = coupon.use.cash * 1;  
412 - let price = coupon.price * 1;  
413 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
414 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
415 - }  
416 - coupon_dataList.push(coupon); 424 + couponList.push({
  425 + id: coupon.id
  426 + });
417 } 427 }
418 if (coupon && util.getType(coupon) == 'array') { 428 if (coupon && util.getType(coupon) == 'array') {
419 if (coupon.length > 0) { 429 if (coupon.length > 0) {
420 coupon.forEach(item => { 430 coupon.forEach(item => {
421 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
422 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
423 - let cash = item.use.cash * 1;  
424 - let price = item.price * 1;  
425 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
426 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
427 - } 431 + couponList.push({
  432 + id: item.id
  433 + })
428 }) 434 })
429 } 435 }
430 - coupon_dataList = coupon;  
431 } 436 }
432 let obj = { 437 let obj = {
433 chef, 438 chef,
@@ -436,9 +441,8 @@ Page({ @@ -436,9 +441,8 @@ Page({
436 signboard, 441 signboard,
437 store, 442 store,
438 home, 443 home,
439 - stringifyUse,  
440 coupon, 444 coupon,
441 - coupon_dataList, 445 + couponList,
442 swich_phone, 446 swich_phone,
443 is_comments, 447 is_comments,
444 StyleType, 448 StyleType,
@@ -447,24 +451,12 @@ Page({ @@ -447,24 +451,12 @@ Page({
447 console.log('获取数据', { 451 console.log('获取数据', {
448 ...obj 452 ...obj
449 }); 453 });
  454 + // 根据券ID获取券详情
  455 + this.getActivityByIdFun(couponList, couponList.length)
  456 + // 根据充值ID获取充值详情
450 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 457 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
451 - let recharge_data = marketing.recharge_data  
452 - recharge_list = marketing.recharge_data.recharge_list  
453 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
454 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
455 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
456 - console.log('scoreInfo', scoreInfo);  
457 - console.log('priceInfo', priceInfo);  
458 - this.setData({  
459 - recharge_data: marketing.recharge_data,  
460 - certificate  
461 - })  
462 - console.log('recharge_data', recharge_data); 458 + this.getRechargeDetail(marketing.recharge_data.id)
463 } 459 }
464 - this.setData({  
465 - coupon_dataList,  
466 - stringifyUse  
467 - })  
468 if (store && store.images.length > 0) store.images = util.determine(store.images); 460 if (store && store.images.length > 0) store.images = util.determine(store.images);
469 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 461 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
470 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 462 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -484,14 +476,19 @@ Page({ @@ -484,14 +476,19 @@ Page({
484 reserve, 476 reserve,
485 signboard, 477 signboard,
486 store, 478 store,
487 - priceInfo,  
488 - scoreInfo,  
489 swich_phone, 479 swich_phone,
490 is_comments, 480 is_comments,
491 StyleType, 481 StyleType,
492 themeColor, 482 themeColor,
493 whiteBj, 483 whiteBj,
494 }) 484 })
  485 + // 开启语音播报
  486 + if (reserve && reserve.swich_voice == '1') {
  487 + this.setData({
  488 + isPlay: '1',
  489 + })
  490 + this.textToSpeechFun(reserve.voice_info)
  491 + }
495 }).catch(res => { 492 }).catch(res => {
496 console.log('GetSellerTemplateConf请求失败'); 493 console.log('GetSellerTemplateConf请求失败');
497 }) 494 })
@@ -503,11 +500,159 @@ Page({ @@ -503,11 +500,159 @@ Page({
503 url: '../reserve/detail?id=' + this.data.detail.seller.id 500 url: '../reserve/detail?id=' + this.data.detail.seller.id
504 }) 501 })
505 }, 502 },
  503 + // 文字转语音的方法
  504 + textToSpeechFun(voice_info) {
  505 + console.log('voice_info', voice_info);
  506 + let that = this;
  507 + let data = this.data;
  508 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  509 + const replacements = {
  510 + "{年月日}": data.seller.yearMonthDay,
  511 + "{月日}": data.seller.yearMonth,
  512 + "{餐段}": data.seller.soltName,
  513 + "{就餐时间}": data.seller.dateStr,
  514 + "{包间名}": data.seller.deskStr,
  515 + "{区域名+包间名}": data.seller.tablesText,
  516 + "{经理名字}": data.staffinfo.name,
  517 + "{客人姓名}": data.detail.rname + str,
  518 + };
  519 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  520 + return replacements[matched];
  521 + });
  522 + console.log('newStr', newStr);
  523 + plugin.textToSpeech({
  524 + lang: "zh_CN",
  525 + tts: true,
  526 + content: newStr,
  527 + success: function (res) {
  528 + that.filename = res.filename
  529 + that.speech()
  530 + },
  531 + fail: function (res) {
  532 + console.log("fail tts", res)
  533 + }
  534 + })
  535 + },
  536 + // 开启语音播报
  537 + speech() {
  538 + var attentionAnim = wx.createAnimation({
  539 + duration: 1000,
  540 + timingFunction: 'linear',
  541 + })
  542 + this.attentionAnim = attentionAnim
  543 + this.setData({
  544 + _attentionAnim: attentionAnim,
  545 + attentionAnim: attentionAnim.export()
  546 + })
  547 + this.audioCtx = wx.createInnerAudioContext()
  548 + this.audioCtx.src = this.filename
  549 + this.audioCtx.loop = true
  550 + this.audioCtx.play()
  551 + this.audioCtx.onPlay((e) => {
  552 + this.setData({
  553 + isPlay: this.audioCtx.paused ? '2' : '1'
  554 + })
  555 + })
  556 + this.audioCtx.onPause((e) => {
  557 + this.setData({
  558 + isPlay: this.audioCtx.paused ? '2' : '1'
  559 + })
  560 + })
  561 + clearInterval(this.timers)
  562 + this.animation()
  563 + },
  564 + // 持续旋转动画
  565 + animation() {
  566 + let that = this;
  567 + var time = setInterval(function () {
  568 + this.n = this.n + 1;
  569 + let attentionAnim = that.data._attentionAnim
  570 + attentionAnim.rotate(180 * (this.n)).step()
  571 + that.setData({
  572 + attentionAnim: attentionAnim.export(),
  573 + })
  574 + }.bind(this), 1000)
  575 + this.timers = time;
  576 + },
  577 + // 暂停/继续播放
  578 + stopMusic() {
  579 + if (this.data.isPlay == '2') { // 2 暂停状态
  580 + console.log("开始");
  581 + clearInterval(this.timers)
  582 + this.animation()
  583 + this.audioCtx.play() //开始
  584 + return;
  585 + }
  586 + if (this.data.isPlay == '1') { // 1 运行状态
  587 + console.log('暂停');
  588 + if (this.n % 2 != 0) {
  589 + this.n = this.n + 1;
  590 + let attentionAnim = this.data._attentionAnim;
  591 + attentionAnim.rotate(180 * this.n).step();
  592 + this.setData({
  593 + attentionAnim: attentionAnim.export(),
  594 + })
  595 + }
  596 + clearInterval(this.timers)
  597 + this.audioCtx.pause() //暂停
  598 + return;
  599 + }
  600 + },
  601 + // 根据充值ID获取充值详情
  602 + getRechargeDetail(id) {
  603 + App.Activity.GetNewRecharge({
  604 + id
  605 + }).then(res => {
  606 + let detail = res.data
  607 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  608 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  609 + let priceInfo, scoreInfo, certificate;
  610 + detail.recharge_list = recharge_list;
  611 + detail.exp_date = exp_date;
  612 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  613 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  614 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  615 + this.setData({
  616 + recharge_data: detail,
  617 + scoreInfo,
  618 + priceInfo,
  619 + certificate
  620 + })
  621 + })
  622 + },
  623 + // 根据券ID获取券详情
  624 + getActivityByIdFun(ids, length) {
  625 + let coupon_dataList = [];
  626 + ids.forEach(i => {
  627 + App.Activity.GetActivityById({
  628 + id: i.id
  629 + }).then(res => {
  630 + if (res.data.length > 0) {
  631 + let detail = res.data[0];
  632 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  633 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  634 + detail.use = detail.use ? util.determine(detail.use) : '';
  635 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  636 + let cash = detail.use.cash * 1;
  637 + let price = detail.price * 1;
  638 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  639 + }
  640 + coupon_dataList.push(detail);
  641 + if (length === ids.length) {
  642 + this.setData({
  643 + coupon_dataList,
  644 + })
  645 + }
  646 + }
  647 + })
  648 + })
  649 + },
506 /** 650 /**
507 * 生命周期函数--监听页面隐藏 651 * 生命周期函数--监听页面隐藏
508 */ 652 */
509 onHide() { 653 onHide() {
510 - 654 + clearInterval(this.timers)
  655 + this.audioCtx.pause() //暂停
511 }, 656 },
512 657
513 /** 658 /**
1 <!--pages/customer/detail_owner_invitation5.wxml--> 1 <!--pages/customer/detail_owner_invitation5.wxml-->
2 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 2 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
3 <scroll-view scroll-y class="{{themeColor}}"> 3 <scroll-view scroll-y class="{{themeColor}}">
  4 + <image
  5 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  6 + class="musicImg"
  7 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  8 + bindtap="stopMusic"
  9 + animation="{{attentionAnim}}"
  10 + />
4 <view class="reservationInfo"> 11 <view class="reservationInfo">
5 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image> 12 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
6 <view class="infoBox"> 13 <view class="infoBox">
7 <view class="infoBoxRight">邀请函</view> 14 <view class="infoBoxRight">邀请函</view>
8 - <view class="line"></view>  
9 <view class="boxLeft"> 15 <view class="boxLeft">
10 <view class="title font48r">{{seller.name}}</view> 16 <view class="title font48r">{{seller.name}}</view>
11 <view class="leftLine"></view> 17 <view class="leftLine"></view>
12 - <view class="leftInfo font32r">{{seller.date}} {{seller.soltName}}</view>  
13 - <view class="leftInfo font32r">{{seller.time}}</view>  
14 - <view class="leftInfo font32r over">{{seller.tablesText}}</view>  
15 - <view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>  
16 - <view class="font32r addressInfo" wx:if="{{seller.addr|| reserev.seller.map_address}}">  
17 - <text>{{seller.addr|| reserev.seller.map_address}}</text>  
18 - <button bindtap="looklocation" class="flex-cc font24r mapBtn">  
19 - <image src="https://qn.colorcun.com/address.png" mode="" />  
20 - 查看定位  
21 - </button> 18 + <view class="lineBox">
  19 + <view class="leftInfo font32r"
  20 + wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}"
  21 + >{{reserve && reserve.book_info}}</view>
  22 + <view class="leftInfo font32r">{{seller.date}} {{seller.soltName}}</view>
  23 + <view class="leftInfo font32r">{{seller.time}}</view>
  24 + <view class="leftInfo font32r over">{{seller.tablesText}}</view>
  25 + <view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
  26 + <view class="font32r addressInfo" wx:if="{{seller.addr|| reserev.seller.map_address}}">
  27 + <text>{{seller.addr|| reserev.seller.map_address}}</text>
  28 + <button bindtap="looklocation" class="flex-cc font24r mapBtn">
  29 + <image src="https://qn.colorcun.com/address.png" mode="" />
  30 + 查看定位
  31 + </button>
  32 + </view>
22 </view> 33 </view>
23 </view> 34 </view>
24 </view> 35 </view>
@@ -57,9 +68,7 @@ @@ -57,9 +68,7 @@
57 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 68 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
58 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text> 69 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
59 </view> 70 </view>
60 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
61 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
62 - </view> 71 + <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>
63 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 72 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
64 无限制{{item.desc?','+item.desc+'。':'。'}} 73 无限制{{item.desc?','+item.desc+'。':'。'}}
65 </view> 74 </view>
@@ -156,7 +165,7 @@ @@ -156,7 +165,7 @@
156 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 165 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
157 </view> 166 </view>
158 <view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 167 <view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
159 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 168 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
160 </view> 169 </view>
161 </view> 170 </view>
162 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 171 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -33,7 +33,12 @@ @@ -33,7 +33,12 @@
33 display: flex; 33 display: flex;
34 flex-direction: column; 34 flex-direction: column;
35 flex: 1; 35 flex: 1;
36 - padding: 16rpx 0; 36 + padding: 16rpx 0 16rpx 20rpx;
  37 +}
  38 +
  39 +.lineBox{
  40 + padding-left: 30rpx;
  41 + border-left: 2rpx solid #FFD200;
37 } 42 }
38 43
39 .leftLine { 44 .leftLine {
@@ -109,13 +114,6 @@ @@ -109,13 +114,6 @@
109 flex: 1; 114 flex: 1;
110 } 115 }
111 116
112 -.line {  
113 - width: 2rpx;  
114 - height: 500rpx;  
115 - background: #FFD200;  
116 - margin: 10rpx 20rpx 0 20rpx;  
117 -}  
118 -  
119 .handleInfo { 117 .handleInfo {
120 margin: 50rpx 40rpx 0 40rpx; 118 margin: 50rpx 40rpx 0 40rpx;
121 display: flex; 119 display: flex;
@@ -316,14 +314,14 @@ @@ -316,14 +314,14 @@
316 display: flex; 314 display: flex;
317 width: 100%; 315 width: 100%;
318 align-items: center; 316 align-items: center;
  317 + margin-bottom: 20rpx;
319 } 318 }
320 319
321 .bottom { 320 .bottom {
322 - margin-top: 20rpx;  
323 color: #515151; 321 color: #515151;
324 font-family: PingFang SC; 322 font-family: PingFang SC;
325 font-weight: 500; 323 font-weight: 500;
326 - font-size: 20rpx; 324 + font-size: 24rpx;
327 display: -webkit-box; 325 display: -webkit-box;
328 word-break: break-all; 326 word-break: break-all;
329 word-wrap: break-word; 327 word-wrap: break-word;
@@ -574,6 +572,19 @@ @@ -574,6 +572,19 @@
574 height: 30rpx; 572 height: 30rpx;
575 } 573 }
576 574
  575 +.musicImg{
  576 + width: 62rpx;
  577 + height: 62rpx;
  578 + position: fixed !important;
  579 + right: 8%;
  580 + top: 15%;
  581 + z-index: 200;
  582 +}
  583 +
  584 +.bookData{
  585 + margin-left: 0;
  586 +}
  587 +
577 /* 黑蓝过渡 */ 588 /* 黑蓝过渡 */
578 .blackBlueGradient .reservationInfo { 589 .blackBlueGradient .reservationInfo {
579 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 590 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -26,7 +27,6 @@ Page({ @@ -26,7 +27,6 @@ Page({
26 store: {}, 27 store: {},
27 recharge_data: {}, 28 recharge_data: {},
28 coupon_dataList: [], 29 coupon_dataList: [],
29 - stringifyUse: '',  
30 current: 0, 30 current: 0,
31 seller: { 31 seller: {
32 name: '', 32 name: '',
@@ -49,8 +49,14 @@ Page({ @@ -49,8 +49,14 @@ Page({
49 hasValueOrder:false,//商家是否开通提前点餐功能 49 hasValueOrder:false,//商家是否开通提前点餐功能
50 hasValueCertificate:false,//商家是否开通优惠券功能 50 hasValueCertificate:false,//商家是否开通优惠券功能
51 hasValueRecharge:false,//商家是否开通充值功能 51 hasValueRecharge:false,//商家是否开通充值功能
  52 + _attentionAnim: {},
  53 + isPlay: '1',
52 }, 54 },
53 screenHeight: '', 55 screenHeight: '',
  56 + attentionAnim: {},
  57 + audioCtx: '', //播报
  58 + timers: null, // 动画定时器
  59 + n: 0,
54 /** 60 /**
55 * 生命周期函数--监听页面加载 61 * 生命周期函数--监听页面加载
56 */ 62 */
@@ -175,10 +181,12 @@ Page({ @@ -175,10 +181,12 @@ Page({
175 rid: this.data.options.id 181 rid: this.data.options.id
176 }).then(res => { 182 }).then(res => {
177 let tablesText = '', //桌子信息 183 let tablesText = '', //桌子信息
  184 + deskStr = '',
178 tableNum = 0; 185 tableNum = 0;
179 res.data.tables.forEach((t, i) => { 186 res.data.tables.forEach((t, i) => {
180 tableNum += t.table_pnum * 1 187 tableNum += t.table_pnum * 1
181 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 188 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  189 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
182 }) 190 })
183 let reserev = RS.reserve(res.data) 191 let reserev = RS.reserve(res.data)
184 let dateSmart 192 let dateSmart
@@ -192,6 +200,9 @@ Page({ @@ -192,6 +200,9 @@ Page({
192 } else { 200 } else {
193 dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr) 201 dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
194 } 202 }
  203 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  204 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  205 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
195 this.setData({ 206 this.setData({
196 detail: this.formatDatail(reserev, dateSmart), 207 detail: this.formatDatail(reserev, dateSmart),
197 tableNum, 208 tableNum,
@@ -212,14 +223,17 @@ Page({ @@ -212,14 +223,17 @@ Page({
212 lat: reserev.seller.lat, 223 lat: reserev.seller.lat,
213 long: reserev.seller.long, 224 long: reserev.seller.long,
214 seller_tel: reserev.seller.seller_tel, 225 seller_tel: reserev.seller.seller_tel,
  226 + yearMonthDay,
  227 + yearMonth,
  228 + dateStr,
  229 + deskStr,
215 } 230 }
216 }) 231 })
217 console.log('reserev reserev', reserev); 232 console.log('reserev reserev', reserev);
218 console.log('seller seller', this.data.seller); 233 console.log('seller seller', this.data.seller);
219 console.log('detail detail', this.data.detail); 234 console.log('detail detail', this.data.detail);
220 setTimeout(() => { 235 setTimeout(() => {
221 - this.getSellerTemplateConfFun(reserev.sid);  
222 - this.getstaffinfo(res.data.uid) 236 + this.getstaffinfo(res.data.uid, reserev.sid);
223 this.getSellerVersionFun(reserev.sid); 237 this.getSellerVersionFun(reserev.sid);
224 }, 0); 238 }, 0);
225 }).catch(res => { 239 }).catch(res => {
@@ -244,7 +258,8 @@ Page({ @@ -244,7 +258,8 @@ Page({
244 } 258 }
245 }) 259 })
246 }, 260 },
247 - getstaffinfo(uid) { 261 + // 客户经理获取基本信息
  262 + getstaffinfo(uid, sid) {
248 console.log('sellerid', this.data.detail.seller.id); 263 console.log('sellerid', this.data.detail.seller.id);
249 App.Activity.GetCustomerActivityBaseinfo({ 264 App.Activity.GetCustomerActivityBaseinfo({
250 sellerid: this.data.detail.seller.id, 265 sellerid: this.data.detail.seller.id,
@@ -255,6 +270,7 @@ Page({ @@ -255,6 +270,7 @@ Page({
255 this.setData({ 270 this.setData({
256 staffinfo: json.data 271 staffinfo: json.data
257 }) 272 })
  273 + this.getSellerTemplateConfFun(sid);
258 } 274 }
259 }) 275 })
260 }, 276 },
@@ -337,8 +353,8 @@ Page({ @@ -337,8 +353,8 @@ Page({
337 }).then(res => { 353 }).then(res => {
338 let data = res.data 354 let data = res.data
339 console.log('data', data); 355 console.log('data', data);
340 - let coupon_dataList = []  
341 - let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 356 + let couponList = []
  357 + let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
342 chef = util.determine(data.chef); 358 chef = util.determine(data.chef);
343 reserve = util.determine(data.reserve); 359 reserve = util.determine(data.reserve);
344 marketing = util.determine(data.marketing); 360 marketing = util.determine(data.marketing);
@@ -352,31 +368,21 @@ Page({ @@ -352,31 +368,21 @@ Page({
352 is_comments = marketing.is_comments ? marketing.is_comments : ''; 368 is_comments = marketing.is_comments ? marketing.is_comments : '';
353 coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : ''; 369 coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
354 } 370 }
355 - // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示  
356 - if (coupon && util.getType(coupon) == 'object') {  
357 - coupon.stringifyUse = JSON.stringify(coupon.use)  
358 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
359 - let cash = coupon.use.cash * 1;  
360 - let price = coupon.price * 1;  
361 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
362 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
363 - }  
364 - coupon_dataList.push(coupon);  
365 - }  
366 - if (coupon && util.getType(coupon) == 'array') {  
367 - if (coupon.length > 0) {  
368 - coupon.forEach(item => {  
369 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
370 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
371 - let cash = item.use.cash * 1;  
372 - let price = item.price * 1;  
373 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
374 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
375 - }  
376 - })  
377 - }  
378 - coupon_dataList = coupon;  
379 - } 371 + // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
  372 + if (coupon && util.getType(coupon) == 'object') {
  373 + couponList.push({
  374 + id: coupon.id
  375 + });
  376 + }
  377 + if (coupon && util.getType(coupon) == 'array') {
  378 + if (coupon.length > 0) {
  379 + coupon.forEach(item => {
  380 + couponList.push({
  381 + id: item.id
  382 + })
  383 + })
  384 + }
  385 + }
380 let obj = { 386 let obj = {
381 chef, 387 chef,
382 reserve, 388 reserve,
@@ -384,9 +390,8 @@ Page({ @@ -384,9 +390,8 @@ Page({
384 signboard, 390 signboard,
385 store, 391 store,
386 home, 392 home,
387 - stringifyUse,  
388 coupon, 393 coupon,
389 - coupon_dataList, 394 + couponList,
390 swich_phone, 395 swich_phone,
391 is_comments, 396 is_comments,
392 StyleType, 397 StyleType,
@@ -395,24 +400,12 @@ Page({ @@ -395,24 +400,12 @@ Page({
395 console.log('获取数据', { 400 console.log('获取数据', {
396 ...obj 401 ...obj
397 }); 402 });
398 - if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {  
399 - let recharge_data = marketing.recharge_data  
400 - recharge_list = marketing.recharge_data.recharge_list  
401 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
402 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
403 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
404 - console.log('scoreInfo', scoreInfo);  
405 - console.log('priceInfo', priceInfo);  
406 - this.setData({  
407 - recharge_data: marketing.recharge_data,  
408 - certificate  
409 - })  
410 - console.log('recharge_data', recharge_data);  
411 - }  
412 - this.setData({  
413 - coupon_dataList,  
414 - stringifyUse  
415 - }) 403 + // 根据券ID获取券详情
  404 + this.getActivityByIdFun(couponList, couponList.length)
  405 + // 根据充值ID获取充值详情
  406 + if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
  407 + this.getRechargeDetail(marketing.recharge_data.id)
  408 + }
416 if (store && store.images.length > 0) store.images = util.determine(store.images); 409 if (store && store.images.length > 0) store.images = util.determine(store.images);
417 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 410 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
418 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 411 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -432,14 +425,19 @@ Page({ @@ -432,14 +425,19 @@ Page({
432 reserve, 425 reserve,
433 signboard, 426 signboard,
434 store, 427 store,
435 - priceInfo,  
436 - scoreInfo,  
437 swich_phone, 428 swich_phone,
438 is_comments, 429 is_comments,
439 StyleType, 430 StyleType,
440 themeColor, 431 themeColor,
441 whiteBj, 432 whiteBj,
442 }) 433 })
  434 + // 开启语音播报
  435 + if (reserve && reserve.swich_voice == '1') {
  436 + this.setData({
  437 + isPlay: '1',
  438 + })
  439 + this.textToSpeechFun(reserve.voice_info)
  440 + }
443 }).catch(res => { 441 }).catch(res => {
444 console.log('GetSellerTemplateConf请求失败'); 442 console.log('GetSellerTemplateConf请求失败');
445 }) 443 })
@@ -451,12 +449,160 @@ Page({ @@ -451,12 +449,160 @@ Page({
451 url: '../reserve/detail?id=' + this.data.detail.seller.id 449 url: '../reserve/detail?id=' + this.data.detail.seller.id
452 }) 450 })
453 }, 451 },
  452 + // 文字转语音的方法
  453 + textToSpeechFun(voice_info) {
  454 + console.log('voice_info', voice_info);
  455 + let that = this;
  456 + let data = this.data;
  457 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  458 + const replacements = {
  459 + "{年月日}": data.seller.yearMonthDay,
  460 + "{月日}": data.seller.yearMonth,
  461 + "{餐段}": data.seller.soltName,
  462 + "{就餐时间}": data.seller.dateStr,
  463 + "{包间名}": data.seller.deskStr,
  464 + "{区域名+包间名}": data.seller.tablesText,
  465 + "{经理名字}": data.staffinfo.name,
  466 + "{客人姓名}": data.detail.rname + str,
  467 + };
  468 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  469 + return replacements[matched];
  470 + });
  471 + console.log('newStr', newStr);
  472 + plugin.textToSpeech({
  473 + lang: "zh_CN",
  474 + tts: true,
  475 + content: newStr,
  476 + success: function (res) {
  477 + that.filename = res.filename
  478 + that.speech()
  479 + },
  480 + fail: function (res) {
  481 + console.log("fail tts", res)
  482 + }
  483 + })
  484 + },
  485 + // 开启语音播报
  486 + speech() {
  487 + var attentionAnim = wx.createAnimation({
  488 + duration: 1000,
  489 + timingFunction: 'linear',
  490 + })
  491 + this.attentionAnim = attentionAnim
  492 + this.setData({
  493 + _attentionAnim: attentionAnim,
  494 + attentionAnim: attentionAnim.export()
  495 + })
  496 + this.audioCtx = wx.createInnerAudioContext()
  497 + this.audioCtx.src = this.filename
  498 + this.audioCtx.loop = true
  499 + this.audioCtx.play()
  500 + this.audioCtx.onPlay((e) => {
  501 + this.setData({
  502 + isPlay: this.audioCtx.paused ? '2' : '1'
  503 + })
  504 + })
  505 + this.audioCtx.onPause((e) => {
  506 + this.setData({
  507 + isPlay: this.audioCtx.paused ? '2' : '1'
  508 + })
  509 + })
  510 + clearInterval(this.timers)
  511 + this.animation()
  512 + },
  513 + // 持续旋转动画
  514 + animation() {
  515 + let that = this;
  516 + var time = setInterval(function () {
  517 + this.n = this.n + 1;
  518 + let attentionAnim = that.data._attentionAnim
  519 + attentionAnim.rotate(180 * (this.n)).step()
  520 + that.setData({
  521 + attentionAnim: attentionAnim.export(),
  522 + })
  523 + }.bind(this), 1000)
  524 + this.timers = time;
  525 + },
  526 + // 暂停/继续播放
  527 + stopMusic() {
  528 + if (this.data.isPlay == '2') { // 2 暂停状态
  529 + console.log("开始");
  530 + clearInterval(this.timers)
  531 + this.animation()
  532 + this.audioCtx.play() //开始
  533 + return;
  534 + }
  535 + if (this.data.isPlay == '1') { // 1 运行状态
  536 + console.log('暂停');
  537 + if (this.n % 2 != 0) {
  538 + this.n = this.n + 1;
  539 + let attentionAnim = this.data._attentionAnim;
  540 + attentionAnim.rotate(180 * this.n).step();
  541 + this.setData({
  542 + attentionAnim: attentionAnim.export(),
  543 + })
  544 + }
  545 + clearInterval(this.timers)
  546 + this.audioCtx.pause() //暂停
  547 + return;
  548 + }
  549 + },
  550 + // 根据充值ID获取充值详情
  551 + getRechargeDetail(id) {
  552 + App.Activity.GetNewRecharge({
  553 + id
  554 + }).then(res => {
  555 + let detail = res.data
  556 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  557 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  558 + let priceInfo, scoreInfo, certificate;
  559 + detail.recharge_list = recharge_list;
  560 + detail.exp_date = exp_date;
  561 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  562 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  563 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  564 + this.setData({
  565 + recharge_data: detail,
  566 + scoreInfo,
  567 + priceInfo,
  568 + certificate
  569 + })
  570 + })
  571 + },
  572 + // 根据券ID获取券详情
  573 + getActivityByIdFun(ids, length) {
  574 + let coupon_dataList = [];
  575 + ids.forEach(i => {
  576 + App.Activity.GetActivityById({
  577 + id: i.id
  578 + }).then(res => {
  579 + if (res.data.length > 0) {
  580 + let detail = res.data[0];
  581 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  582 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  583 + detail.use = detail.use ? util.determine(detail.use) : '';
  584 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  585 + let cash = detail.use.cash * 1;
  586 + let price = detail.price * 1;
  587 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  588 + }
  589 + coupon_dataList.push(detail);
  590 + if (length === ids.length) {
  591 + this.setData({
  592 + coupon_dataList,
  593 + })
  594 + }
  595 + }
  596 + })
  597 + })
  598 + },
454 /** 599 /**
455 * 生命周期函数--监听页面隐藏 600 * 生命周期函数--监听页面隐藏
456 */ 601 */
457 - onHide() {  
458 -  
459 - }, 602 + onHide() {
  603 + clearInterval(this.timers)
  604 + this.audioCtx.pause() //暂停
  605 + },
460 606
461 /** 607 /**
462 * 生命周期函数--监听页面卸载 608 * 生命周期函数--监听页面卸载
@@ -2,6 +2,13 @@ @@ -2,6 +2,13 @@
2 <import src="../tpl/invitation"></import> 2 <import src="../tpl/invitation"></import>
3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
4 <scroll-view scroll-y class="{{themeColor}}"> 4 <scroll-view scroll-y class="{{themeColor}}">
  5 + <image
  6 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  7 + class="musicImg"
  8 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  9 + bindtap="stopMusic"
  10 + animation="{{attentionAnim}}"
  11 + />
5 <view class="titleImg"> 12 <view class="titleImg">
6 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image> 13 <image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
7 <view class="title">{{seller.name?seller.name:reserve.seller_name}}</view> 14 <view class="title">{{seller.name?seller.name:reserve.seller_name}}</view>
@@ -14,6 +21,9 @@ @@ -14,6 +21,9 @@
14 <view class="line"> 21 <view class="line">
15 </view> 22 </view>
16 <view class="infoRight"> 23 <view class="infoRight">
  24 + <view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
  25 + <view class="font40r">{{reserve && reserve.book_info}}</view>
  26 + </view>
17 <view class="begin"> 27 <view class="begin">
18 <view class="font40r">尊敬的贵宾,您好!</view> 28 <view class="font40r">尊敬的贵宾,您好!</view>
19 <view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view> 29 <view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view>
@@ -81,9 +91,7 @@ @@ -81,9 +91,7 @@
81 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 91 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
82 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text> 92 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
83 </view> 93 </view>
84 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
85 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
86 - </view> 94 + <text wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r oneBottom">{{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}</text>
87 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 95 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
88 无限制{{item.desc?','+item.desc+'。':'。'}} 96 无限制{{item.desc?','+item.desc+'。':'。'}}
89 </view> 97 </view>
@@ -234,7 +242,7 @@ @@ -234,7 +242,7 @@
234 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 242 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
235 </view> 243 </view>
236 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 244 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
237 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 245 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
238 </view> 246 </view>
239 </view> 247 </view>
240 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 248 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -248,7 +256,7 @@ @@ -248,7 +256,7 @@
248 <view wx:if="{{hasValueRecharge && marketing.is_link=='1'}}" class="font24r favouredPolicy" bindtap="gotoFavourableList"> 256 <view wx:if="{{hasValueRecharge && marketing.is_link=='1'}}" class="font24r favouredPolicy" bindtap="gotoFavourableList">
249 点击了解更多会员优惠政策 257 点击了解更多会员优惠政策
250 </view> 258 </view>
251 - <image wx:if="{{marketing && marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')}}" src="{{marketing.logo?marketing.logo:''}}" mode="aspectFill" /> 259 + <image wx:if="{{marketing && marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')}}" src="{{marketing.logo?marketing.logo:''}}" mode="" />
252 <text class="businessBox"> 260 <text class="businessBox">
253 周到安排提供技术支持<text bindtap="call" data-phone="4000009690">4000009690</text>,餐厅入驻请点击<text bindtap="gotoJoinSeller" style="text-decoration: underline;">这里</text> 261 周到安排提供技术支持<text bindtap="call" data-phone="4000009690">4000009690</text>,餐厅入驻请点击<text bindtap="gotoJoinSeller" style="text-decoration: underline;">这里</text>
254 </text> 262 </text>
@@ -58,11 +58,15 @@ @@ -58,11 +58,15 @@
58 } 58 }
59 59
60 .begin { 60 .begin {
61 - margin-top: 20rpx; 61 + margin: 0 30rpx 0 30rpx;
62 color: #000000; 62 color: #000000;
63 font-family: PingFang SC; 63 font-family: PingFang SC;
64 } 64 }
65 65
  66 +.beginTop{
  67 + margin: 30rpx 30rpx 0;
  68 +}
  69 +
66 .begin view { 70 .begin view {
67 line-height: 64rpx; 71 line-height: 64rpx;
68 } 72 }
@@ -498,15 +502,14 @@ @@ -498,15 +502,14 @@
498 display: flex; 502 display: flex;
499 width: 100%; 503 width: 100%;
500 align-items: center; 504 align-items: center;
  505 + margin-bottom: 20rpx;
501 } 506 }
502 507
503 .bottom { 508 .bottom {
504 width: 95%; 509 width: 95%;
505 - margin-top: 20rpx;  
506 color: #515151; 510 color: #515151;
507 font-family: PingFang SC; 511 font-family: PingFang SC;
508 font-weight: 500; 512 font-weight: 500;
509 - font-size: 20rpx;  
510 display: -webkit-box; 513 display: -webkit-box;
511 word-break: break-all; 514 word-break: break-all;
512 word-wrap: break-word; 515 word-wrap: break-word;
@@ -701,6 +704,19 @@ @@ -701,6 +704,19 @@
701 -webkit-box-orient: vertical; 704 -webkit-box-orient: vertical;
702 } 705 }
703 706
  707 +.musicImg{
  708 + width: 62rpx;
  709 + height: 62rpx;
  710 + position: fixed !important;
  711 + right: 8%;
  712 + top: 22%;
  713 + z-index: 200;
  714 +}
  715 +
  716 +.bookData{
  717 + margin-left: 0;
  718 +}
  719 +
704 /* 黑蓝过渡 */ 720 /* 黑蓝过渡 */
705 .blackBlueGradient .titleImg { 721 .blackBlueGradient .titleImg {
706 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 722 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -48,10 +48,16 @@ Page({ @@ -48,10 +48,16 @@ Page({
48 hasValueOrder:false,//商家是否开通提前点餐功能 48 hasValueOrder:false,//商家是否开通提前点餐功能
49 hasValueCertificate:false,//商家是否开通优惠券功能 49 hasValueCertificate:false,//商家是否开通优惠券功能
50 hasValueRecharge:false,//商家是否开通充值功能 50 hasValueRecharge:false,//商家是否开通充值功能
  51 + _attentionAnim: {},
  52 + isPlay: '1',
51 }, 53 },
52 tablestr: '', 54 tablestr: '',
53 urlsValue: [], 55 urlsValue: [],
54 screenHeight: '', 56 screenHeight: '',
  57 + attentionAnim: {},
  58 + audioCtx: '', //播报
  59 + timers: null, // 动画定时器
  60 + n: 0,
55 /** 61 /**
56 * 生命周期函数--监听页面加载 62 * 生命周期函数--监听页面加载
57 */ 63 */
@@ -211,12 +217,14 @@ Page({ @@ -211,12 +217,14 @@ Page({
211 rid: this.data.options.id 217 rid: this.data.options.id
212 }).then(res => { 218 }).then(res => {
213 let tablesText = '', //桌子信息 219 let tablesText = '', //桌子信息
  220 + deskStr = '',
214 tableNum = 0; 221 tableNum = 0;
215 let tableinfo = util.determine(res.data.tableinfo); 222 let tableinfo = util.determine(res.data.tableinfo);
216 console.log('tableinfo', tableinfo); 223 console.log('tableinfo', tableinfo);
217 res.data.tables.forEach((t, i) => { 224 res.data.tables.forEach((t, i) => {
218 tableNum += t.table_pnum * 1 225 tableNum += t.table_pnum * 1
219 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 226 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  227 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
220 }) 228 })
221 let tabaleids = []; 229 let tabaleids = [];
222 res.data.tables.forEach(t => { 230 res.data.tables.forEach(t => {
@@ -235,6 +243,9 @@ Page({ @@ -235,6 +243,9 @@ Page({
235 } else { 243 } else {
236 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 244 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
237 } 245 }
  246 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  247 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  248 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
238 console.log('dateSmart', dateSmart); 249 console.log('dateSmart', dateSmart);
239 this.setData({ 250 this.setData({
240 detail: this.formatDatail(reserev, dateSmart), 251 detail: this.formatDatail(reserev, dateSmart),
@@ -258,14 +269,17 @@ Page({ @@ -258,14 +269,17 @@ Page({
258 lat: reserev.seller.lat, 269 lat: reserev.seller.lat,
259 long: reserev.seller.long, 270 long: reserev.seller.long,
260 seller_tel: reserev.seller.seller_tel, 271 seller_tel: reserev.seller.seller_tel,
  272 + yearMonthDay,
  273 + yearMonth,
  274 + dateStr,
  275 + deskStr,
261 } 276 }
262 }) 277 })
263 console.log('reserev reserev', reserev); 278 console.log('reserev reserev', reserev);
264 console.log('seller seller', this.data.seller); 279 console.log('seller seller', this.data.seller);
265 console.log('detail detail', this.data.detail); 280 console.log('detail detail', this.data.detail);
266 setTimeout(() => { 281 setTimeout(() => {
267 - this.getSellerTemplateConfFun(reserev.sid);  
268 - this.getstaffinfo(res.data.uid) 282 + this.getstaffinfo(res.data.uid, reserev.sid);
269 this.getroomimage(reserev.sid) 283 this.getroomimage(reserev.sid)
270 this.getSellerVersionFun(reserev.sid); 284 this.getSellerVersionFun(reserev.sid);
271 }, 0); 285 }, 0);
@@ -292,7 +306,7 @@ Page({ @@ -292,7 +306,7 @@ Page({
292 }) 306 })
293 }, 307 },
294 // 客户经理获取基本信息 308 // 客户经理获取基本信息
295 - getstaffinfo(uid) { 309 + getstaffinfo(uid, sid) {
296 console.log('sellerid', this.data.detail.seller.id); 310 console.log('sellerid', this.data.detail.seller.id);
297 App.Activity.GetCustomerActivityBaseinfo({ 311 App.Activity.GetCustomerActivityBaseinfo({
298 sellerid: this.data.detail.seller.id, 312 sellerid: this.data.detail.seller.id,
@@ -303,6 +317,7 @@ Page({ @@ -303,6 +317,7 @@ Page({
303 this.setData({ 317 this.setData({
304 staffinfo: json.data 318 staffinfo: json.data
305 }) 319 })
  320 + this.getSellerTemplateConfFun(sid);
306 } 321 }
307 }) 322 })
308 }, 323 },
@@ -389,8 +404,8 @@ Page({ @@ -389,8 +404,8 @@ Page({
389 }).then(res => { 404 }).then(res => {
390 let data = res.data 405 let data = res.data
391 console.log('data', data); 406 console.log('data', data);
392 - let coupon_dataList = []  
393 - let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 407 + let couponList = []
  408 + let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
394 chef = util.determine(data.chef); 409 chef = util.determine(data.chef);
395 reserve = util.determine(data.reserve); 410 reserve = util.determine(data.reserve);
396 marketing = util.determine(data.marketing); 411 marketing = util.determine(data.marketing);
@@ -406,28 +421,18 @@ Page({ @@ -406,28 +421,18 @@ Page({
406 } 421 }
407 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 422 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
408 if (coupon && util.getType(coupon) == 'object') { 423 if (coupon && util.getType(coupon) == 'object') {
409 - coupon.stringifyUse = JSON.stringify(coupon.use)  
410 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
411 - let cash = coupon.use.cash * 1;  
412 - let price = coupon.price * 1;  
413 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
414 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
415 - }  
416 - coupon_dataList.push(coupon); 424 + couponList.push({
  425 + id: coupon.id
  426 + });
417 } 427 }
418 if (coupon && util.getType(coupon) == 'array') { 428 if (coupon && util.getType(coupon) == 'array') {
419 if (coupon.length > 0) { 429 if (coupon.length > 0) {
420 coupon.forEach(item => { 430 coupon.forEach(item => {
421 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
422 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
423 - let cash = item.use.cash * 1;  
424 - let price = item.price * 1;  
425 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
426 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
427 - } 431 + couponList.push({
  432 + id: item.id
  433 + })
428 }) 434 })
429 } 435 }
430 - coupon_dataList = coupon;  
431 } 436 }
432 let obj = { 437 let obj = {
433 chef, 438 chef,
@@ -436,9 +441,8 @@ Page({ @@ -436,9 +441,8 @@ Page({
436 signboard, 441 signboard,
437 store, 442 store,
438 home, 443 home,
439 - stringifyUse,  
440 coupon, 444 coupon,
441 - coupon_dataList, 445 + couponList,
442 swich_phone, 446 swich_phone,
443 is_comments, 447 is_comments,
444 StyleType, 448 StyleType,
@@ -447,24 +451,12 @@ Page({ @@ -447,24 +451,12 @@ Page({
447 console.log('获取数据', { 451 console.log('获取数据', {
448 ...obj 452 ...obj
449 }); 453 });
  454 + // 根据券ID获取券详情
  455 + this.getActivityByIdFun(couponList, couponList.length)
  456 + // 根据充值ID获取充值详情
450 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 457 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
451 - let recharge_data = marketing.recharge_data  
452 - recharge_list = marketing.recharge_data.recharge_list  
453 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
454 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
455 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
456 - console.log('scoreInfo', scoreInfo);  
457 - console.log('priceInfo', priceInfo);  
458 - this.setData({  
459 - recharge_data: marketing.recharge_data,  
460 - certificate  
461 - })  
462 - console.log('recharge_data', recharge_data); 458 + this.getRechargeDetail(marketing.recharge_data.id)
463 } 459 }
464 - this.setData({  
465 - coupon_dataList,  
466 - stringifyUse  
467 - })  
468 if (store && store.images.length > 0) store.images = util.determine(store.images); 460 if (store && store.images.length > 0) store.images = util.determine(store.images);
469 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 461 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
470 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 462 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -479,13 +471,18 @@ Page({ @@ -479,13 +471,18 @@ Page({
479 reserve, 471 reserve,
480 signboard, 472 signboard,
481 store, 473 store,
482 - priceInfo,  
483 - scoreInfo,  
484 swich_phone, 474 swich_phone,
485 is_comments, 475 is_comments,
486 StyleType, 476 StyleType,
487 themeColor, 477 themeColor,
488 }) 478 })
  479 + // 开启语音播报
  480 + if (reserve && reserve.swich_voice == '1') {
  481 + this.setData({
  482 + isPlay: '1',
  483 + })
  484 + this.textToSpeechFun(reserve.voice_info)
  485 + }
489 }).catch(res => { 486 }).catch(res => {
490 console.log('GetSellerTemplateConf请求失败'); 487 console.log('GetSellerTemplateConf请求失败');
491 }) 488 })
@@ -497,11 +494,159 @@ Page({ @@ -497,11 +494,159 @@ Page({
497 url: '../reserve/detail?id=' + this.data.detail.seller.id 494 url: '../reserve/detail?id=' + this.data.detail.seller.id
498 }) 495 })
499 }, 496 },
  497 + // 文字转语音的方法
  498 + textToSpeechFun(voice_info) {
  499 + console.log('voice_info', voice_info);
  500 + let that = this;
  501 + let data = this.data;
  502 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  503 + const replacements = {
  504 + "{年月日}": data.seller.yearMonthDay,
  505 + "{月日}": data.seller.yearMonth,
  506 + "{餐段}": data.seller.soltName,
  507 + "{就餐时间}": data.seller.dateStr,
  508 + "{包间名}": data.seller.deskStr,
  509 + "{区域名+包间名}": data.seller.tablesText,
  510 + "{经理名字}": data.staffinfo.name,
  511 + "{客人姓名}": data.detail.rname + str,
  512 + };
  513 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  514 + return replacements[matched];
  515 + });
  516 + console.log('newStr', newStr);
  517 + plugin.textToSpeech({
  518 + lang: "zh_CN",
  519 + tts: true,
  520 + content: newStr,
  521 + success: function (res) {
  522 + that.filename = res.filename
  523 + that.speech()
  524 + },
  525 + fail: function (res) {
  526 + console.log("fail tts", res)
  527 + }
  528 + })
  529 + },
  530 + // 开启语音播报
  531 + speech() {
  532 + var attentionAnim = wx.createAnimation({
  533 + duration: 1000,
  534 + timingFunction: 'linear',
  535 + })
  536 + this.attentionAnim = attentionAnim
  537 + this.setData({
  538 + _attentionAnim: attentionAnim,
  539 + attentionAnim: attentionAnim.export()
  540 + })
  541 + this.audioCtx = wx.createInnerAudioContext()
  542 + this.audioCtx.src = this.filename
  543 + this.audioCtx.loop = true
  544 + this.audioCtx.play()
  545 + this.audioCtx.onPlay((e) => {
  546 + this.setData({
  547 + isPlay: this.audioCtx.paused ? '2' : '1'
  548 + })
  549 + })
  550 + this.audioCtx.onPause((e) => {
  551 + this.setData({
  552 + isPlay: this.audioCtx.paused ? '2' : '1'
  553 + })
  554 + })
  555 + clearInterval(this.timers)
  556 + this.animation()
  557 + },
  558 + // 持续旋转动画
  559 + animation() {
  560 + let that = this;
  561 + var time = setInterval(function () {
  562 + this.n = this.n + 1;
  563 + let attentionAnim = that.data._attentionAnim
  564 + attentionAnim.rotate(180 * (this.n)).step()
  565 + that.setData({
  566 + attentionAnim: attentionAnim.export(),
  567 + })
  568 + }.bind(this), 1000)
  569 + this.timers = time;
  570 + },
  571 + // 暂停/继续播放
  572 + stopMusic() {
  573 + if (this.data.isPlay == '2') { // 2 暂停状态
  574 + console.log("开始");
  575 + clearInterval(this.timers)
  576 + this.animation()
  577 + this.audioCtx.play() //开始
  578 + return;
  579 + }
  580 + if (this.data.isPlay == '1') { // 1 运行状态
  581 + console.log('暂停');
  582 + if (this.n % 2 != 0) {
  583 + this.n = this.n + 1;
  584 + let attentionAnim = this.data._attentionAnim;
  585 + attentionAnim.rotate(180 * this.n).step();
  586 + this.setData({
  587 + attentionAnim: attentionAnim.export(),
  588 + })
  589 + }
  590 + clearInterval(this.timers)
  591 + this.audioCtx.pause() //暂停
  592 + return;
  593 + }
  594 + },
  595 + // 根据充值ID获取充值详情
  596 + getRechargeDetail(id) {
  597 + App.Activity.GetNewRecharge({
  598 + id
  599 + }).then(res => {
  600 + let detail = res.data
  601 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  602 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  603 + let priceInfo, scoreInfo, certificate;
  604 + detail.recharge_list = recharge_list;
  605 + detail.exp_date = exp_date;
  606 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  607 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  608 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  609 + this.setData({
  610 + recharge_data: detail,
  611 + scoreInfo,
  612 + priceInfo,
  613 + certificate
  614 + })
  615 + })
  616 + },
  617 + // 根据券ID获取券详情
  618 + getActivityByIdFun(ids, length) {
  619 + let coupon_dataList = [];
  620 + ids.forEach(i => {
  621 + App.Activity.GetActivityById({
  622 + id: i.id
  623 + }).then(res => {
  624 + if (res.data.length > 0) {
  625 + let detail = res.data[0];
  626 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  627 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  628 + detail.use = detail.use ? util.determine(detail.use) : '';
  629 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  630 + let cash = detail.use.cash * 1;
  631 + let price = detail.price * 1;
  632 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  633 + }
  634 + coupon_dataList.push(detail);
  635 + if (length === ids.length) {
  636 + this.setData({
  637 + coupon_dataList,
  638 + })
  639 + }
  640 + }
  641 + })
  642 + })
  643 + },
500 /** 644 /**
501 * 生命周期函数--监听页面隐藏 645 * 生命周期函数--监听页面隐藏
502 */ 646 */
503 onHide() { 647 onHide() {
504 - 648 + clearInterval(this.timers)
  649 + this.audioCtx.pause() //暂停
505 }, 650 },
506 651
507 /** 652 /**
@@ -2,8 +2,18 @@ @@ -2,8 +2,18 @@
2 <import src="../tpl/invitation"></import> 2 <import src="../tpl/invitation"></import>
3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
4 <scroll-view scroll-y class="{{themeColor}}"> 4 <scroll-view scroll-y class="{{themeColor}}">
  5 + <image
  6 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  7 + class="musicImg"
  8 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  9 + bindtap="stopMusic"
  10 + animation="{{attentionAnim}}"
  11 + />
5 <view class="reservationInfo"> 12 <view class="reservationInfo">
6 <image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image> 13 <image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image>
  14 + <view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
  15 + <view class="font40r">{{reserve && reserve.book_info}}</view>
  16 + </view>
7 <view class="begin"> 17 <view class="begin">
8 <view class="font40r">尊敬的贵宾,您好!非常感谢您选择</view> 18 <view class="font40r">尊敬的贵宾,您好!非常感谢您选择</view>
9 <view class="centerBox font40r">【{{seller.name?seller.name:reserve.seller_name}}】</view> 19 <view class="centerBox font40r">【{{seller.name?seller.name:reserve.seller_name}}】</view>
@@ -76,9 +86,7 @@ @@ -76,9 +86,7 @@
76 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 86 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
77 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 87 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
78 </view> 88 </view>
79 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
80 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
81 - </view> 89 + <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>
82 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 90 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
83 无限制{{item.desc?','+item.desc+'。':'。'}} 91 无限制{{item.desc?','+item.desc+'。':'。'}}
84 </view> 92 </view>
@@ -178,7 +186,7 @@ @@ -178,7 +186,7 @@
178 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 186 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
179 </view> 187 </view>
180 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 188 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
181 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 189 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
182 </view> 190 </view>
183 </view> 191 </view>
184 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 192 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -6,11 +6,15 @@ @@ -6,11 +6,15 @@
6 } 6 }
7 7
8 .begin { 8 .begin {
9 - margin: 20rpx 30rpx 30rpx 30rpx; 9 + margin: 0 30rpx 0 30rpx;
10 color: #FBF6F1; 10 color: #FBF6F1;
11 font-family: PingFang SC; 11 font-family: PingFang SC;
12 } 12 }
13 13
  14 +.beginTop{
  15 + margin: 30rpx 30rpx 0;
  16 +}
  17 +
14 .begin view { 18 .begin view {
15 line-height: 64rpx; 19 line-height: 64rpx;
16 } 20 }
@@ -340,7 +344,6 @@ @@ -340,7 +344,6 @@
340 color: #515151; 344 color: #515151;
341 font-family: PingFang SC; 345 font-family: PingFang SC;
342 font-weight: 500; 346 font-weight: 500;
343 - font-size: 20rpx;  
344 display: -webkit-box; 347 display: -webkit-box;
345 word-break: break-all; 348 word-break: break-all;
346 word-wrap: break-word; 349 word-wrap: break-word;
@@ -598,6 +601,19 @@ @@ -598,6 +601,19 @@
598 -webkit-box-orient: vertical; 601 -webkit-box-orient: vertical;
599 } 602 }
600 603
  604 +.musicImg{
  605 + width: 62rpx;
  606 + height: 62rpx;
  607 + position: fixed !important;
  608 + right: 8%;
  609 + top: 22%;
  610 + z-index: 200;
  611 +}
  612 +
  613 +.bookData{
  614 + margin-left: 0;
  615 +}
  616 +
601 /* 黑蓝过渡 */ 617 /* 黑蓝过渡 */
602 .blackBlueGradient .reservationInfo { 618 .blackBlueGradient .reservationInfo {
603 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 619 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
@@ -4,6 +4,7 @@ import util from '../../utils/util'; @@ -4,6 +4,7 @@ import util from '../../utils/util';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 import TP from '../../utils/tpls'; 5 import TP from '../../utils/tpls';
6 import RS from '../../utils/reserveStatus' 6 import RS from '../../utils/reserveStatus'
  7 +var plugin = requirePlugin("WechatSI");
7 Page({ 8 Page({
8 /** 9 /**
9 * 页面的初始数据 10 * 页面的初始数据
@@ -24,7 +25,6 @@ Page({ @@ -24,7 +25,6 @@ Page({
24 store: {}, 25 store: {},
25 recharge_data: {}, 26 recharge_data: {},
26 coupon_dataList: [], 27 coupon_dataList: [],
27 - stringifyUse: '',  
28 current: 0, 28 current: 0,
29 seller: { 29 seller: {
30 name: '', 30 name: '',
@@ -48,10 +48,16 @@ Page({ @@ -48,10 +48,16 @@ Page({
48 hasValueOrder:false,//商家是否开通提前点餐功能 48 hasValueOrder:false,//商家是否开通提前点餐功能
49 hasValueCertificate:false,//商家是否开通优惠券功能 49 hasValueCertificate:false,//商家是否开通优惠券功能
50 hasValueRecharge:false,//商家是否开通充值功能 50 hasValueRecharge:false,//商家是否开通充值功能
  51 + _attentionAnim: {},
  52 + isPlay: '1',
51 }, 53 },
52 tablestr: '', 54 tablestr: '',
53 urlsValue: [], 55 urlsValue: [],
54 screenHeight: '', 56 screenHeight: '',
  57 + attentionAnim: {},
  58 + audioCtx: '', //播报
  59 + timers: null, // 动画定时器
  60 + n: 0,
55 /** 61 /**
56 * 生命周期函数--监听页面加载 62 * 生命周期函数--监听页面加载
57 */ 63 */
@@ -211,12 +217,14 @@ Page({ @@ -211,12 +217,14 @@ Page({
211 rid: this.data.options.id 217 rid: this.data.options.id
212 }).then(res => { 218 }).then(res => {
213 let tablesText = '', //桌子信息 219 let tablesText = '', //桌子信息
  220 + deskStr = '',
214 tableNum = 0; 221 tableNum = 0;
215 let tableinfo = util.determine(res.data.tableinfo); 222 let tableinfo = util.determine(res.data.tableinfo);
216 console.log('tableinfo', tableinfo); 223 console.log('tableinfo', tableinfo);
217 res.data.tables.forEach((t, i) => { 224 res.data.tables.forEach((t, i) => {
218 tableNum += t.table_pnum * 1 225 tableNum += t.table_pnum * 1
219 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、'); 226 tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
  227 + deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
220 }) 228 })
221 let tabaleids = []; 229 let tabaleids = [];
222 res.data.tables.forEach(t => { 230 res.data.tables.forEach(t => {
@@ -235,6 +243,9 @@ Page({ @@ -235,6 +243,9 @@ Page({
235 } else { 243 } else {
236 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW') 244 dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
237 } 245 }
  246 + let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
  247 + let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
  248 + let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
238 console.log('dateSmart', dateSmart); 249 console.log('dateSmart', dateSmart);
239 this.setData({ 250 this.setData({
240 detail: this.formatDatail(reserev, dateSmart), 251 detail: this.formatDatail(reserev, dateSmart),
@@ -257,14 +268,17 @@ Page({ @@ -257,14 +268,17 @@ Page({
257 time: util.unixtoTime(reserev.ddate, '星期WW HH:II'), 268 time: util.unixtoTime(reserev.ddate, '星期WW HH:II'),
258 lat: reserev.seller.lat, 269 lat: reserev.seller.lat,
259 long: reserev.seller.long, 270 long: reserev.seller.long,
  271 + yearMonthDay,
  272 + yearMonth,
  273 + dateStr,
  274 + deskStr,
260 } 275 }
261 }) 276 })
262 console.log('reserev reserev', reserev); 277 console.log('reserev reserev', reserev);
263 console.log('seller seller', this.data.seller); 278 console.log('seller seller', this.data.seller);
264 console.log('detail detail', this.data.detail); 279 console.log('detail detail', this.data.detail);
265 setTimeout(() => { 280 setTimeout(() => {
266 - this.getSellerTemplateConfFun(reserev.sid);  
267 - this.getstaffinfo(res.data.uid) 281 + this.getstaffinfo(res.data.uid, reserev.sid);
268 this.getroomimage(reserev.sid) 282 this.getroomimage(reserev.sid)
269 this.getSellerVersionFun(reserev.sid); 283 this.getSellerVersionFun(reserev.sid);
270 }, 0); 284 }, 0);
@@ -291,7 +305,7 @@ Page({ @@ -291,7 +305,7 @@ Page({
291 }) 305 })
292 }, 306 },
293 // 客户经理获取基本信息 307 // 客户经理获取基本信息
294 - getstaffinfo(uid) { 308 + getstaffinfo(uid, sid) {
295 console.log('sellerid', this.data.detail.seller.id); 309 console.log('sellerid', this.data.detail.seller.id);
296 App.Activity.GetCustomerActivityBaseinfo({ 310 App.Activity.GetCustomerActivityBaseinfo({
297 sellerid: this.data.detail.seller.id, 311 sellerid: this.data.detail.seller.id,
@@ -302,6 +316,7 @@ Page({ @@ -302,6 +316,7 @@ Page({
302 this.setData({ 316 this.setData({
303 staffinfo: json.data 317 staffinfo: json.data
304 }) 318 })
  319 + this.getSellerTemplateConfFun(sid);
305 } 320 }
306 }) 321 })
307 }, 322 },
@@ -388,8 +403,8 @@ Page({ @@ -388,8 +403,8 @@ Page({
388 }).then(res => { 403 }).then(res => {
389 let data = res.data 404 let data = res.data
390 console.log('data', data); 405 console.log('data', data);
391 - let coupon_dataList = []  
392 - let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse; 406 + let couponList = []
  407 + let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
393 chef = util.determine(data.chef); 408 chef = util.determine(data.chef);
394 reserve = util.determine(data.reserve); 409 reserve = util.determine(data.reserve);
395 marketing = util.determine(data.marketing); 410 marketing = util.determine(data.marketing);
@@ -405,28 +420,18 @@ Page({ @@ -405,28 +420,18 @@ Page({
405 } 420 }
406 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 421 // is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
407 if (coupon && util.getType(coupon) == 'object') { 422 if (coupon && util.getType(coupon) == 'object') {
408 - coupon.stringifyUse = JSON.stringify(coupon.use)  
409 - if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {  
410 - let cash = coupon.use.cash * 1;  
411 - let price = coupon.price * 1;  
412 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
413 - coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
414 - }  
415 - coupon_dataList.push(coupon); 423 + couponList.push({
  424 + id: coupon.id
  425 + });
416 } 426 }
417 if (coupon && util.getType(coupon) == 'array') { 427 if (coupon && util.getType(coupon) == 'array') {
418 if (coupon.length > 0) { 428 if (coupon.length > 0) {
419 coupon.forEach(item => { 429 coupon.forEach(item => {
420 - item.stringifyUse = item.use?JSON.stringify(item.use):'';  
421 - if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {  
422 - let cash = item.use.cash * 1;  
423 - let price = item.price * 1;  
424 - console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));  
425 - item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';  
426 - } 430 + couponList.push({
  431 + id: item.id
  432 + })
427 }) 433 })
428 } 434 }
429 - coupon_dataList = coupon;  
430 } 435 }
431 let obj = { 436 let obj = {
432 chef, 437 chef,
@@ -435,9 +440,8 @@ Page({ @@ -435,9 +440,8 @@ Page({
435 signboard, 440 signboard,
436 store, 441 store,
437 home, 442 home,
438 - stringifyUse,  
439 coupon, 443 coupon,
440 - coupon_dataList, 444 + couponList,
441 swich_phone, 445 swich_phone,
442 is_comments, 446 is_comments,
443 StyleType, 447 StyleType,
@@ -446,24 +450,12 @@ Page({ @@ -446,24 +450,12 @@ Page({
446 console.log('获取数据', { 450 console.log('获取数据', {
447 ...obj 451 ...obj
448 }); 452 });
  453 + // 根据券ID获取券详情
  454 + this.getActivityByIdFun(couponList, couponList.length)
  455 + // 根据充值ID获取充值详情
449 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) { 456 if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
450 - let recharge_data = marketing.recharge_data  
451 - recharge_list = marketing.recharge_data.recharge_list  
452 - if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';  
453 - if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';  
454 - if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');  
455 - console.log('scoreInfo', scoreInfo);  
456 - console.log('priceInfo', priceInfo);  
457 - this.setData({  
458 - recharge_data: marketing.recharge_data,  
459 - certificate  
460 - })  
461 - console.log('recharge_data', recharge_data); 457 + this.getRechargeDetail(marketing.recharge_data.id)
462 } 458 }
463 - this.setData({  
464 - coupon_dataList,  
465 - stringifyUse  
466 - })  
467 if (store && store.images.length > 0) store.images = util.determine(store.images); 459 if (store && store.images.length > 0) store.images = util.determine(store.images);
468 if (signboard && signboard.images) signboard.images = util.determine(signboard.images); 460 if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
469 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') { 461 if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
@@ -478,13 +470,18 @@ Page({ @@ -478,13 +470,18 @@ Page({
478 reserve, 470 reserve,
479 signboard, 471 signboard,
480 store, 472 store,
481 - priceInfo,  
482 - scoreInfo,  
483 swich_phone, 473 swich_phone,
484 is_comments, 474 is_comments,
485 StyleType, 475 StyleType,
486 themeColor, 476 themeColor,
487 }) 477 })
  478 + // 开启语音播报
  479 + if (reserve && reserve.swich_voice == '1') {
  480 + this.setData({
  481 + isPlay: '1',
  482 + })
  483 + this.textToSpeechFun(reserve.voice_info)
  484 + }
488 }).catch(res => { 485 }).catch(res => {
489 console.log('GetSellerTemplateConf请求失败'); 486 console.log('GetSellerTemplateConf请求失败');
490 }) 487 })
@@ -496,11 +493,159 @@ Page({ @@ -496,11 +493,159 @@ Page({
496 url: '../reserve/detail?id=' + this.data.detail.seller.id 493 url: '../reserve/detail?id=' + this.data.detail.seller.id
497 }) 494 })
498 }, 495 },
  496 + // 文字转语音的方法
  497 + textToSpeechFun(voice_info) {
  498 + console.log('voice_info', voice_info);
  499 + let that = this;
  500 + let data = this.data;
  501 + let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
  502 + const replacements = {
  503 + "{年月日}": data.seller.yearMonthDay,
  504 + "{月日}": data.seller.yearMonth,
  505 + "{餐段}": data.seller.soltName,
  506 + "{就餐时间}": data.seller.dateStr,
  507 + "{包间名}": data.seller.deskStr,
  508 + "{区域名+包间名}": data.seller.tablesText,
  509 + "{经理名字}": data.staffinfo.name,
  510 + "{客人姓名}": data.detail.rname + str,
  511 + };
  512 + let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
  513 + return replacements[matched];
  514 + });
  515 + console.log('newStr', newStr);
  516 + plugin.textToSpeech({
  517 + lang: "zh_CN",
  518 + tts: true,
  519 + content: newStr,
  520 + success: function (res) {
  521 + that.filename = res.filename
  522 + that.speech()
  523 + },
  524 + fail: function (res) {
  525 + console.log("fail tts", res)
  526 + }
  527 + })
  528 + },
  529 + // 开启语音播报
  530 + speech() {
  531 + var attentionAnim = wx.createAnimation({
  532 + duration: 1000,
  533 + timingFunction: 'linear',
  534 + })
  535 + this.attentionAnim = attentionAnim
  536 + this.setData({
  537 + _attentionAnim: attentionAnim,
  538 + attentionAnim: attentionAnim.export()
  539 + })
  540 + this.audioCtx = wx.createInnerAudioContext()
  541 + this.audioCtx.src = this.filename
  542 + this.audioCtx.loop = true
  543 + this.audioCtx.play()
  544 + this.audioCtx.onPlay((e) => {
  545 + this.setData({
  546 + isPlay: this.audioCtx.paused ? '2' : '1'
  547 + })
  548 + })
  549 + this.audioCtx.onPause((e) => {
  550 + this.setData({
  551 + isPlay: this.audioCtx.paused ? '2' : '1'
  552 + })
  553 + })
  554 + clearInterval(this.timers)
  555 + this.animation()
  556 + },
  557 + // 持续旋转动画
  558 + animation() {
  559 + let that = this;
  560 + var time = setInterval(function () {
  561 + this.n = this.n + 1;
  562 + let attentionAnim = that.data._attentionAnim
  563 + attentionAnim.rotate(180 * (this.n)).step()
  564 + that.setData({
  565 + attentionAnim: attentionAnim.export(),
  566 + })
  567 + }.bind(this), 1000)
  568 + this.timers = time;
  569 + },
  570 + // 暂停/继续播放
  571 + stopMusic() {
  572 + if (this.data.isPlay == '2') { // 2 暂停状态
  573 + console.log("开始");
  574 + clearInterval(this.timers)
  575 + this.animation()
  576 + this.audioCtx.play() //开始
  577 + return;
  578 + }
  579 + if (this.data.isPlay == '1') { // 1 运行状态
  580 + console.log('暂停');
  581 + if (this.n % 2 != 0) {
  582 + this.n = this.n + 1;
  583 + let attentionAnim = this.data._attentionAnim;
  584 + attentionAnim.rotate(180 * this.n).step();
  585 + this.setData({
  586 + attentionAnim: attentionAnim.export(),
  587 + })
  588 + }
  589 + clearInterval(this.timers)
  590 + this.audioCtx.pause() //暂停
  591 + return;
  592 + }
  593 + },
  594 + // 根据充值ID获取充值详情
  595 + getRechargeDetail(id) {
  596 + App.Activity.GetNewRecharge({
  597 + id
  598 + }).then(res => {
  599 + let detail = res.data
  600 + let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
  601 + let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
  602 + let priceInfo, scoreInfo, certificate;
  603 + detail.recharge_list = recharge_list;
  604 + detail.exp_date = exp_date;
  605 + if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
  606 + if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
  607 + if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
  608 + this.setData({
  609 + recharge_data: detail,
  610 + scoreInfo,
  611 + priceInfo,
  612 + certificate
  613 + })
  614 + })
  615 + },
  616 + // 根据券ID获取券详情
  617 + getActivityByIdFun(ids, length) {
  618 + let coupon_dataList = [];
  619 + ids.forEach(i => {
  620 + App.Activity.GetActivityById({
  621 + id: i.id
  622 + }).then(res => {
  623 + if (res.data.length > 0) {
  624 + let detail = res.data[0];
  625 + detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
  626 + detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
  627 + detail.use = detail.use ? util.determine(detail.use) : '';
  628 + if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
  629 + let cash = detail.use.cash * 1;
  630 + let price = detail.price * 1;
  631 + detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
  632 + }
  633 + coupon_dataList.push(detail);
  634 + if (length === ids.length) {
  635 + this.setData({
  636 + coupon_dataList,
  637 + })
  638 + }
  639 + }
  640 + })
  641 + })
  642 + },
499 /** 643 /**
500 * 生命周期函数--监听页面隐藏 644 * 生命周期函数--监听页面隐藏
501 */ 645 */
502 onHide() { 646 onHide() {
503 - 647 + clearInterval(this.timers)
  648 + this.audioCtx.pause() //暂停
504 }, 649 },
505 650
506 /** 651 /**
@@ -2,12 +2,22 @@ @@ -2,12 +2,22 @@
2 <import src="../tpl/invitation"></import> 2 <import src="../tpl/invitation"></import>
3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav> 3 <nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
4 <scroll-view scroll-y class="{{themeColor}}"> 4 <scroll-view scroll-y class="{{themeColor}}">
  5 + <image
  6 + wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
  7 + class="musicImg"
  8 + src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
  9 + bindtap="stopMusic"
  10 + animation="{{attentionAnim}}"
  11 + />
5 <view class="reservationInfo"> 12 <view class="reservationInfo">
6 <view class="infoImg"> 13 <view class="infoImg">
7 <image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image> 14 <image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image>
8 <view class="infoImgName font48r"><text>【{{seller.name||reserve.seller_name}}】</text></view> 15 <view class="infoImgName font48r"><text>【{{seller.name||reserve.seller_name}}】</text></view>
9 </view> 16 </view>
10 - <view class="infoItem oneInfoItem" wx:if="{{seller.date}}"> 17 + <view class="infoItem" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
  18 + <view class="contentData font40r bookData ">{{reserve && reserve.book_info}}</view>
  19 + </view>
  20 + <view class="infoItem" wx:if="{{seller.date}}">
11 <view class="label font28r">【宴会日期】</view> 21 <view class="label font28r">【宴会日期】</view>
12 <view class="contentData font40r">{{seller.date}}</view> 22 <view class="contentData font40r">{{seller.date}}</view>
13 </view> 23 </view>
@@ -54,7 +64,7 @@ @@ -54,7 +64,7 @@
54 <view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}"> 64 <view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
55 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index"> 65 <block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
56 <view class="preferentialItems" wx:if="{{dataStr<(item.etime*1)}}"> 66 <view class="preferentialItems" wx:if="{{dataStr<(item.etime*1)}}">
57 - <view class="itemLeft"> 67 + <view class="itemLeft couponItem">
58 <view class="itemTop"> 68 <view class="itemTop">
59 <text class="font28r">{{item.aname}}</text> 69 <text class="font28r">{{item.aname}}</text>
60 <view class="priceText font24r" wx:if="{{item.price}}"> 70 <view class="priceText font24r" wx:if="{{item.price}}">
@@ -63,9 +73,7 @@ @@ -63,9 +73,7 @@
63 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 --> 73 <!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
64 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text> 74 <text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
65 </view> 75 </view>
66 - <view wx:if="{{item.exp_date.is_week=='1' || item.exp_date.is_week===true}}" class="bottom font24r">  
67 - {{item.exp_date.week_show?item.exp_date.week_show+'可用':''}}{{item.desc?','+item.desc+'。':'。'}}  
68 - </view> 76 + <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>
69 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r"> 77 <view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
70 无限制{{item.desc?','+item.desc+'。':'。'}} 78 无限制{{item.desc?','+item.desc+'。':'。'}}
71 </view> 79 </view>
@@ -165,7 +173,7 @@ @@ -165,7 +173,7 @@
165 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}} 173 {{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
166 </view> 174 </view>
167 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}"> 175 <view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
168 - {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。 176 + {{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
169 </view> 177 </view>
170 </view> 178 </view>
171 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover"> 179 <navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
@@ -6,10 +6,10 @@ @@ -6,10 +6,10 @@
6 } 6 }
7 7
8 .infoImg { 8 .infoImg {
9 - margin-top: 10rpx;  
10 display: flex; 9 display: flex;
11 justify-content: center; 10 justify-content: center;
12 position: relative; 11 position: relative;
  12 + margin: 10rpx 0 110rpx 0;
13 } 13 }
14 14
15 .infoImgName { 15 .infoImgName {
@@ -60,10 +60,6 @@ @@ -60,10 +60,6 @@
60 font-family: PingFang SC; 60 font-family: PingFang SC;
61 } 61 }
62 62
63 -.reservationInfo .oneInfoItem{  
64 - margin-top: 94rpx;  
65 -}  
66 -  
67 .label { 63 .label {
68 flex-shrink: 0; 64 flex-shrink: 0;
69 font-family: PingFang SC; 65 font-family: PingFang SC;
@@ -359,7 +355,6 @@ @@ -359,7 +355,6 @@
359 display: flex; 355 display: flex;
360 width: 100%; 356 width: 100%;
361 align-items: center; 357 align-items: center;
362 - margin-bottom: 20rpx;  
363 } 358 }
364 359
365 .itemBottom { 360 .itemBottom {
@@ -367,7 +362,6 @@ @@ -367,7 +362,6 @@
367 color: #515151; 362 color: #515151;
368 font-family: PingFang SC; 363 font-family: PingFang SC;
369 font-weight: 500; 364 font-weight: 500;
370 - font-size: 20rpx;  
371 display: -webkit-box; 365 display: -webkit-box;
372 word-break: break-all; 366 word-break: break-all;
373 word-wrap: break-word; 367 word-wrap: break-word;
@@ -622,6 +616,35 @@ @@ -622,6 +616,35 @@
622 justify-content: center; 616 justify-content: center;
623 } 617 }
624 618
  619 +.bottom {
  620 + width: 95%;
  621 + color: #515151;
  622 + font-family: PingFang SC;
  623 + font-weight: 500;
  624 + display: -webkit-box;
  625 + word-break: break-all;
  626 + word-wrap: break-word;
  627 + overflow: hidden;
  628 + text-align: left;
  629 +}
  630 +
  631 +.couponItem .bottom {
  632 + margin-top: 20rpx;
  633 +}
  634 +
  635 +.musicImg{
  636 + width: 62rpx;
  637 + height: 62rpx;
  638 + position: fixed !important;
  639 + right: 8%;
  640 + top: 22%;
  641 + z-index: 200;
  642 +}
  643 +
  644 +.bookData{
  645 + margin-left: 0;
  646 +}
  647 +
625 /* 黑蓝过渡 */ 648 /* 黑蓝过渡 */
626 .blackBlueGradient .reservationInfo { 649 .blackBlueGradient .reservationInfo {
627 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%); 650 background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);