Commit 57e716fb261cfbdd07c2483bda26917954c30b8b

Authored by pengye
1 parent 81edb5d3

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

... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -48,10 +48,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -211,12 +217,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -235,6 +243,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -258,14 +269,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -292,7 +306,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -303,6 +317,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -389,8 +404,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, themeSixteen, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -406,28 +421,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -436,9 +441,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -447,24 +451,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -520,14 +512,19 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
themeSixteen,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -539,11 +536,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
... ... @@ -2,6 +2,13 @@
<import src="../tpl/invitation"></import>
<nav hasHome backgroundColor="{{themeSixteen}}" color="#fff" class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="positioningBox">
<view class="positioning">
<text class="font48r">{{seller.name || reserve.seller_name}}</text>
... ... @@ -15,6 +22,9 @@
</view>
</view>
<view class="reservationInfo">
<view class="begin" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
<view class="font36r">{{reserve && reserve.book_info}}</view>
</view>
<view class="flex-11" wx:if="{{seller.date}}">
<view class="label font36r">【就餐日期】</view>
<view class="contentData font36r">{{seller.date}}</view>
... ... @@ -74,9 +84,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -176,7 +184,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
border-bottom-right-radius: 10rpx;
}
.reservationInfo .begin {
margin: 0 30rpx 0 45rpx;
line-height: 64rpx;
font-family: PingFang SC;
font-size: 32rpx;
}
.reservationInfo .flex-11 {
margin: 0 30rpx;
... ... @@ -335,7 +341,6 @@
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -566,6 +571,19 @@
-webkit-box-orient: vertical;
}
.musicImg {
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 15%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 深中国红 */
.crimson .reservationInfo,
.crimson .positioningBox {
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -49,10 +49,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -212,12 +218,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -236,6 +244,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -259,14 +270,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -293,7 +307,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -304,6 +318,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -390,8 +405,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -407,28 +422,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -437,9 +442,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -448,24 +452,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -485,14 +477,19 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
whiteBj,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -504,11 +501,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
... ... @@ -2,6 +2,13 @@
<import src="../tpl/invitation"></import>
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="reservationInfo">
<view class="titleImg">
<image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
... ... @@ -16,6 +23,9 @@
<text>{{item.name}}</text>
</view>
</view>
<view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
<view class="font40r">{{reserve && reserve.book_info}}</view>
</view>
<view class="begin">
<view class="font40r">尊敬的贵宾,您好!</view>
<view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view>
... ... @@ -82,9 +92,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -184,7 +192,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
}
.begin {
margin: 20rpx 30rpx 30rpx 30rpx;
margin: 0 30rpx 0 30rpx;
color: #FBF6F1;
font-family: PingFang SC;
}
.beginTop{
margin: 30rpx 30rpx 0;
}
.begin view {
line-height: 64rpx;
}
... ... @@ -376,7 +380,6 @@
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -625,6 +628,19 @@
-webkit-box-orient: vertical;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 13%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .reservationInfo {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -49,10 +49,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -212,12 +218,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -236,6 +244,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -259,14 +270,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -293,7 +307,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -304,6 +318,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -390,8 +405,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -407,28 +422,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -437,9 +442,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -448,24 +452,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -485,14 +477,19 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
whiteBj,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -504,11 +501,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
<!--pages/customer/detail_owner_invitation4.wxml-->
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="reservationInfo">
<image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
<image src="{{whiteBj?'https://qn.colorcun.com/whiteBj2.png':'https://qn.colorcun.com/leaf1.png'}}" class="bjIcon"></image>
... ... @@ -8,12 +15,16 @@
<view class="boxLeft">
<view class="title">{{seller.name}}</view>
<view class="leftLine"></view>
<view class="leftInfo font36r">{{seller.date}} {{seller.soltName}}</view>
<view class="leftInfo font36r">{{seller.time}}</view>
<view class="leftInfo font36r over">{{seller.tablesText}}</view>
<view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
<view class="lineBox">
<view class="leftInfo font36r"
wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}"
>{{reserve && reserve.book_info}}</view>
<view class="leftInfo font36r">{{seller.date}} {{seller.soltName}}</view>
<view class="leftInfo font36r">{{seller.time}}</view>
<view class="leftInfo font36r over">{{seller.tablesText}}</view>
<view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
</view>
</view>
<view class="line"></view>
<view class="infoBoxRight">
<text>邀请函</text>
</view>
... ... @@ -60,9 +71,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -159,7 +168,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
display: flex;
flex-direction: column;
align-items: flex-end;
margin: 20rpx 0 20rpx 40rpx;
padding: 16rpx 0 16rpx 20rpx;
}
.lineBox{
padding-right: 30rpx;
border-right: 2rpx solid #FFD200;
}
.leftLine {
... ... @@ -327,14 +332,13 @@
display: flex;
width: 100%;
align-items: center;
margin-bottom: 20rpx;
}
.bottom {
margin-top: 20rpx;
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -578,6 +582,19 @@
height: 30rpx;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 15%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .reservationInfo {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -48,10 +48,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -211,12 +217,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -235,6 +243,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -258,14 +269,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -292,7 +306,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -303,6 +317,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -389,8 +404,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -406,28 +421,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -436,9 +441,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -447,24 +451,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -484,14 +476,19 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
whiteBj,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -503,11 +500,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
<!--pages/customer/detail_owner_invitation5.wxml-->
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="reservationInfo">
<image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
<view class="infoBox">
<view class="infoBoxRight">邀请函</view>
<view class="line"></view>
<view class="boxLeft">
<view class="title font48r">{{seller.name}}</view>
<view class="leftLine"></view>
<view class="leftInfo font32r">{{seller.date}} {{seller.soltName}}</view>
<view class="leftInfo font32r">{{seller.time}}</view>
<view class="leftInfo font32r over">{{seller.tablesText}}</view>
<view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
<view class="font32r addressInfo" wx:if="{{seller.addr|| reserev.seller.map_address}}">
<text>{{seller.addr|| reserev.seller.map_address}}</text>
<button bindtap="looklocation" class="flex-cc font24r mapBtn">
<image src="https://qn.colorcun.com/address.png" mode="" />
查看定位
</button>
<view class="lineBox">
<view class="leftInfo font32r"
wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}"
>{{reserve && reserve.book_info}}</view>
<view class="leftInfo font32r">{{seller.date}} {{seller.soltName}}</view>
<view class="leftInfo font32r">{{seller.time}}</view>
<view class="leftInfo font32r over">{{seller.tablesText}}</view>
<view class="leftInfo font36r tables" wx:if="{{swich_phone!='0' && seller && reserve && seller.seller_tel}}">预订台 {{seller.seller_tel}}</view>
<view class="font32r addressInfo" wx:if="{{seller.addr|| reserev.seller.map_address}}">
<text>{{seller.addr|| reserev.seller.map_address}}</text>
<button bindtap="looklocation" class="flex-cc font24r mapBtn">
<image src="https://qn.colorcun.com/address.png" mode="" />
查看定位
</button>
</view>
</view>
</view>
</view>
... ... @@ -57,9 +68,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -156,7 +165,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
display: flex;
flex-direction: column;
flex: 1;
padding: 16rpx 0;
padding: 16rpx 0 16rpx 20rpx;
}
.lineBox{
padding-left: 30rpx;
border-left: 2rpx solid #FFD200;
}
.leftLine {
... ... @@ -109,13 +114,6 @@
flex: 1;
}
.line {
width: 2rpx;
height: 500rpx;
background: #FFD200;
margin: 10rpx 20rpx 0 20rpx;
}
.handleInfo {
margin: 50rpx 40rpx 0 40rpx;
display: flex;
... ... @@ -316,14 +314,14 @@
display: flex;
width: 100%;
align-items: center;
margin-bottom: 20rpx;
}
.bottom {
margin-top: 20rpx;
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
font-size: 24rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -574,6 +572,19 @@
height: 30rpx;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 15%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .reservationInfo {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -26,7 +27,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -49,8 +49,14 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -175,10 +181,12 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let reserev = RS.reserve(res.data)
let dateSmart
... ... @@ -192,6 +200,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
this.setData({
detail: this.formatDatail(reserev, dateSmart),
tableNum,
... ... @@ -212,14 +223,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getSellerVersionFun(reserev.sid);
}, 0);
}).catch(res => {
... ... @@ -244,7 +258,8 @@ Page({
}
})
},
getstaffinfo(uid) {
// 客户经理获取基本信息
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -255,6 +270,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -337,8 +353,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, whiteBj, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -352,31 +368,21 @@ Page({
is_comments = marketing.is_comments ? marketing.is_comments : '';
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
})
}
coupon_dataList = coupon;
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
couponList.push({
id: item.id
})
})
}
}
let obj = {
chef,
reserve,
... ... @@ -384,9 +390,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -395,24 +400,12 @@ Page({
console.log('获取数据', {
...obj
});
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
}
this.setData({
coupon_dataList,
stringifyUse
})
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
this.getRechargeDetail(marketing.recharge_data.id)
}
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -432,14 +425,19 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
whiteBj,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -451,12 +449,160 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
* 生命周期函数--监听页面卸载
... ...
... ... @@ -2,6 +2,13 @@
<import src="../tpl/invitation"></import>
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="titleImg">
<image src="{{whiteBj?'https://qn.colorcun.com/whiteBj1.png':'https://qn.colorcun.com/leaf.png'}}" class="titleIcon"></image>
<view class="title">{{seller.name?seller.name:reserve.seller_name}}</view>
... ... @@ -14,6 +21,9 @@
<view class="line">
</view>
<view class="infoRight">
<view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
<view class="font40r">{{reserve && reserve.book_info}}</view>
</view>
<view class="begin">
<view class="font40r">尊敬的贵宾,您好!</view>
<view class="font40r">非常感谢您选择【{{seller.name?seller.name:reserve.seller_name}}】!</view>
... ... @@ -81,9 +91,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discount font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -234,7 +242,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
<view wx:if="{{hasValueRecharge && marketing.is_link=='1'}}" class="font24r favouredPolicy" bindtap="gotoFavourableList">
点击了解更多会员优惠政策
</view>
<image wx:if="{{marketing && marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')}}" src="{{marketing.logo?marketing.logo:''}}" mode="aspectFill" />
<image wx:if="{{marketing && marketing.logo && (!marketing.is_logo || marketing.is_logo!='0')}}" src="{{marketing.logo?marketing.logo:''}}" mode="" />
<text class="businessBox">
周到安排提供技术支持<text bindtap="call" data-phone="4000009690">4000009690</text>,餐厅入驻请点击<text bindtap="gotoJoinSeller" style="text-decoration: underline;">这里</text>
</text>
... ...
... ... @@ -58,11 +58,15 @@
}
.begin {
margin-top: 20rpx;
margin: 0 30rpx 0 30rpx;
color: #000000;
font-family: PingFang SC;
}
.beginTop{
margin: 30rpx 30rpx 0;
}
.begin view {
line-height: 64rpx;
}
... ... @@ -498,15 +502,14 @@
display: flex;
width: 100%;
align-items: center;
margin-bottom: 20rpx;
}
.bottom {
width: 95%;
margin-top: 20rpx;
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -701,6 +704,19 @@
-webkit-box-orient: vertical;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 22%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .titleImg {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -48,10 +48,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -211,12 +217,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -235,6 +243,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -258,14 +269,17 @@ Page({
lat: reserev.seller.lat,
long: reserev.seller.long,
seller_tel: reserev.seller.seller_tel,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -292,7 +306,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -303,6 +317,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -389,8 +404,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -406,28 +421,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -436,9 +441,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -447,24 +451,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -479,13 +471,18 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -497,11 +494,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
... ... @@ -2,8 +2,18 @@
<import src="../tpl/invitation"></import>
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="reservationInfo">
<image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image>
<view class="begin beginTop" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
<view class="font40r">{{reserve && reserve.book_info}}</view>
</view>
<view class="begin">
<view class="font40r">尊敬的贵宾,您好!非常感谢您选择</view>
<view class="centerBox font40r">【{{seller.name?seller.name:reserve.seller_name}}】</view>
... ... @@ -76,9 +86,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -178,7 +186,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
}
.begin {
margin: 20rpx 30rpx 30rpx 30rpx;
margin: 0 30rpx 0 30rpx;
color: #FBF6F1;
font-family: PingFang SC;
}
.beginTop{
margin: 30rpx 30rpx 0;
}
.begin view {
line-height: 64rpx;
}
... ... @@ -340,7 +344,6 @@
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -598,6 +601,19 @@
-webkit-box-orient: vertical;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 22%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .reservationInfo {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...
... ... @@ -4,6 +4,7 @@ import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
Page({
/**
* 页面的初始数据
... ... @@ -24,7 +25,6 @@ Page({
store: {},
recharge_data: {},
coupon_dataList: [],
stringifyUse: '',
current: 0,
seller: {
name: '',
... ... @@ -48,10 +48,16 @@ Page({
hasValueOrder:false,//商家是否开通提前点餐功能
hasValueCertificate:false,//商家是否开通优惠券功能
hasValueRecharge:false,//商家是否开通充值功能
_attentionAnim: {},
isPlay: '1',
},
tablestr: '',
urlsValue: [],
screenHeight: '',
attentionAnim: {},
audioCtx: '', //播报
timers: null, // 动画定时器
n: 0,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -211,12 +217,14 @@ Page({
rid: this.data.options.id
}).then(res => {
let tablesText = '', //桌子信息
deskStr = '',
tableNum = 0;
let tableinfo = util.determine(res.data.tableinfo);
console.log('tableinfo', tableinfo);
res.data.tables.forEach((t, i) => {
tableNum += t.table_pnum * 1
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
deskStr += t.name + (i == (res.data.tables.length - 1) ? '' : '、');
})
let tabaleids = [];
res.data.tables.forEach(t => {
... ... @@ -235,6 +243,9 @@ Page({
} else {
dateSmart = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日 星期WW')
}
let yearMonthDay = util.unixtoTime(reserev.ddate, 'YYYY年MM月DD日')
let yearMonth = util.unixtoTime(reserev.ddate, 'MM月DD日')
let dateStr = util.unixtoTime(reserev.ddate, 'HH点II分')
console.log('dateSmart', dateSmart);
this.setData({
detail: this.formatDatail(reserev, dateSmart),
... ... @@ -257,14 +268,17 @@ Page({
time: util.unixtoTime(reserev.ddate, '星期WW HH:II'),
lat: reserev.seller.lat,
long: reserev.seller.long,
yearMonthDay,
yearMonth,
dateStr,
deskStr,
}
})
console.log('reserev reserev', reserev);
console.log('seller seller', this.data.seller);
console.log('detail detail', this.data.detail);
setTimeout(() => {
this.getSellerTemplateConfFun(reserev.sid);
this.getstaffinfo(res.data.uid)
this.getstaffinfo(res.data.uid, reserev.sid);
this.getroomimage(reserev.sid)
this.getSellerVersionFun(reserev.sid);
}, 0);
... ... @@ -291,7 +305,7 @@ Page({
})
},
// 客户经理获取基本信息
getstaffinfo(uid) {
getstaffinfo(uid, sid) {
console.log('sellerid', this.data.detail.seller.id);
App.Activity.GetCustomerActivityBaseinfo({
sellerid: this.data.detail.seller.id,
... ... @@ -302,6 +316,7 @@ Page({
this.setData({
staffinfo: json.data
})
this.getSellerTemplateConfFun(sid);
}
})
},
... ... @@ -388,8 +403,8 @@ Page({
}).then(res => {
let data = res.data
console.log('data', data);
let coupon_dataList = []
let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
let couponList = []
let themeColor, StyleType, home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store;
chef = util.determine(data.chef);
reserve = util.determine(data.reserve);
marketing = util.determine(data.marketing);
... ... @@ -405,28 +420,18 @@ Page({
}
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (coupon && util.getType(coupon) == 'object') {
coupon.stringifyUse = JSON.stringify(coupon.use)
if (marketing.is_coupon == '1' && coupon && coupon.use && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
let cash = coupon.use.cash * 1;
let price = coupon.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(coupon);
couponList.push({
id: coupon.id
});
}
if (coupon && util.getType(coupon) == 'array') {
if (coupon.length > 0) {
coupon.forEach(item => {
item.stringifyUse = item.use?JSON.stringify(item.use):'';
if ((item.use && (!item.use.is_cash || item.use.is_cash == '1'))) {
let cash = item.use.cash * 1;
let price = item.price * 1;
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(1));
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
couponList.push({
id: item.id
})
})
}
coupon_dataList = coupon;
}
let obj = {
chef,
... ... @@ -435,9 +440,8 @@ Page({
signboard,
store,
home,
stringifyUse,
coupon,
coupon_dataList,
couponList,
swich_phone,
is_comments,
StyleType,
... ... @@ -446,24 +450,12 @@ Page({
console.log('获取数据', {
...obj
});
// 根据券ID获取券详情
this.getActivityByIdFun(couponList, couponList.length)
// 根据充值ID获取充值详情
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data,
certificate
})
console.log('recharge_data', recharge_data);
this.getRechargeDetail(marketing.recharge_data.id)
}
this.setData({
coupon_dataList,
stringifyUse
})
if (store && store.images.length > 0) store.images = util.determine(store.images);
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
... ... @@ -478,13 +470,18 @@ Page({
reserve,
signboard,
store,
priceInfo,
scoreInfo,
swich_phone,
is_comments,
StyleType,
themeColor,
})
// 开启语音播报
if (reserve && reserve.swich_voice == '1') {
this.setData({
isPlay: '1',
})
this.textToSpeechFun(reserve.voice_info)
}
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
... ... @@ -496,11 +493,159 @@ Page({
url: '../reserve/detail?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(voice_info) {
console.log('voice_info', voice_info);
let that = this;
let data = this.data;
let str = data.detail.sex == '1' ? '先生' : data.detail.sex == '2' ? '女士' : '';
const replacements = {
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr,
"{包间名}": data.seller.deskStr,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名}": data.detail.rname + str,
};
let newStr = voice_info.replace(/{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名}/g, function (matched) {
return replacements[matched];
});
console.log('newStr', newStr);
plugin.textToSpeech({
lang: "zh_CN",
tts: true,
content: newStr,
success: function (res) {
that.filename = res.filename
that.speech()
},
fail: function (res) {
console.log("fail tts", res)
}
})
},
// 开启语音播报
speech() {
var attentionAnim = wx.createAnimation({
duration: 1000,
timingFunction: 'linear',
})
this.attentionAnim = attentionAnim
this.setData({
_attentionAnim: attentionAnim,
attentionAnim: attentionAnim.export()
})
this.audioCtx = wx.createInnerAudioContext()
this.audioCtx.src = this.filename
this.audioCtx.loop = true
this.audioCtx.play()
this.audioCtx.onPlay((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
this.audioCtx.onPause((e) => {
this.setData({
isPlay: this.audioCtx.paused ? '2' : '1'
})
})
clearInterval(this.timers)
this.animation()
},
// 持续旋转动画
animation() {
let that = this;
var time = setInterval(function () {
this.n = this.n + 1;
let attentionAnim = that.data._attentionAnim
attentionAnim.rotate(180 * (this.n)).step()
that.setData({
attentionAnim: attentionAnim.export(),
})
}.bind(this), 1000)
this.timers = time;
},
// 暂停/继续播放
stopMusic() {
if (this.data.isPlay == '2') { // 2 暂停状态
console.log("开始");
clearInterval(this.timers)
this.animation()
this.audioCtx.play() //开始
return;
}
if (this.data.isPlay == '1') { // 1 运行状态
console.log('暂停');
if (this.n % 2 != 0) {
this.n = this.n + 1;
let attentionAnim = this.data._attentionAnim;
attentionAnim.rotate(180 * this.n).step();
this.setData({
attentionAnim: attentionAnim.export(),
})
}
clearInterval(this.timers)
this.audioCtx.pause() //暂停
return;
}
},
// 根据充值ID获取充值详情
getRechargeDetail(id) {
App.Activity.GetNewRecharge({
id
}).then(res => {
let detail = res.data
let exp_date = res.data.exp_date ? JSON.parse(res.data.exp_date) : ''
let recharge_list = res.data.recharge_list ? JSON.parse(res.data.recharge_list) : ''
let priceInfo, scoreInfo, certificate;
detail.recharge_list = recharge_list;
detail.exp_date = exp_date;
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + detail.recharge_money + '元赠送' + recharge_list.score + '积分';
if (recharge_list.is_coupons == '1' && recharge_list.coupons_names.length > 0) certificate = recharge_list.coupons_names.join('、');
this.setData({
recharge_data: detail,
scoreInfo,
priceInfo,
certificate
})
})
},
// 根据券ID获取券详情
getActivityByIdFun(ids, length) {
let coupon_dataList = [];
ids.forEach(i => {
App.Activity.GetActivityById({
id: i.id
}).then(res => {
if (res.data.length > 0) {
let detail = res.data[0];
detail.stringifyUse = detail.use ? JSON.stringify(detail.use) : '';
detail.exp_date = detail.exp_date ? util.determine(detail.exp_date) : '';
detail.use = detail.use ? util.determine(detail.use) : '';
if ((detail.use && (!detail.use.is_cash || detail.use.is_cash == '1'))) {
let cash = detail.use.cash * 1;
let price = detail.price * 1;
detail.discount = cash != 0 ? ((price / cash) * 10).toFixed(1) : '';
}
coupon_dataList.push(detail);
if (length === ids.length) {
this.setData({
coupon_dataList,
})
}
}
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
clearInterval(this.timers)
this.audioCtx.pause() //暂停
},
/**
... ...
... ... @@ -2,12 +2,22 @@
<import src="../tpl/invitation"></import>
<nav hasHome class="navhome" place="{{true}}">{{seller.name||reserve.seller_name}}</nav>
<scroll-view scroll-y class="{{themeColor}}">
<image
wx:if="{{reserve && reserve.swich_voice && reserve.swich_voice=='1'}}"
class="musicImg"
src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}"
bindtap="stopMusic"
animation="{{attentionAnim}}"
/>
<view class="reservationInfo">
<view class="infoImg">
<image wx:if="{{home.image && (!home.id_first_image || home.id_first_image!='0')}}" src="{{home.image}}" class="homeImage" mode="widthFix"></image>
<view class="infoImgName font48r"><text>【{{seller.name||reserve.seller_name}}】</text></view>
</view>
<view class="infoItem oneInfoItem" wx:if="{{seller.date}}">
<view class="infoItem" wx:if="{{reserve && reserve.swich_booking=='1' && reserve.book_info}}">
<view class="contentData font40r bookData ">{{reserve && reserve.book_info}}</view>
</view>
<view class="infoItem" wx:if="{{seller.date}}">
<view class="label font28r">【宴会日期】</view>
<view class="contentData font40r">{{seller.date}}</view>
</view>
... ... @@ -54,7 +64,7 @@
<view class="preferential" wx:if="{{hasValueCertificate && marketing && marketing.is_coupon=='1' && coupon_dataList.length>0}}">
<block wx:for="{{coupon_dataList}}" wx:key="index" wx:for-index="index">
<view class="preferentialItems" wx:if="{{dataStr<(item.etime*1)}}">
<view class="itemLeft">
<view class="itemLeft couponItem">
<view class="itemTop">
<text class="font28r">{{item.aname}}</text>
<view class="priceText font24r" wx:if="{{item.price}}">
... ... @@ -63,9 +73,7 @@
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{item.discount!='0.00' && (item.use.is_cash=='1' || item.use.is_cash) && item.discount}}" class="discountText font24r">{{item.discount}}折</text>
</view>
<view 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+'。':'。'}}
</view>
<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>
<view wx:if="{{item.exp_date.is_none=='1' || item.exp_date.is_none===true}}" class="bottom font24r">
无限制{{item.desc?','+item.desc+'。':'。'}}
</view>
... ... @@ -165,7 +173,7 @@
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom font24r" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送'+certificate:''}}。
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。
</view>
</view>
<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 @@
}
.infoImg {
margin-top: 10rpx;
display: flex;
justify-content: center;
position: relative;
margin: 10rpx 0 110rpx 0;
}
.infoImgName {
... ... @@ -60,10 +60,6 @@
font-family: PingFang SC;
}
.reservationInfo .oneInfoItem{
margin-top: 94rpx;
}
.label {
flex-shrink: 0;
font-family: PingFang SC;
... ... @@ -359,7 +355,6 @@
display: flex;
width: 100%;
align-items: center;
margin-bottom: 20rpx;
}
.itemBottom {
... ... @@ -367,7 +362,6 @@
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
... ... @@ -622,6 +616,35 @@
justify-content: center;
}
.bottom {
width: 95%;
color: #515151;
font-family: PingFang SC;
font-weight: 500;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
overflow: hidden;
text-align: left;
}
.couponItem .bottom {
margin-top: 20rpx;
}
.musicImg{
width: 62rpx;
height: 62rpx;
position: fixed !important;
right: 8%;
top: 22%;
z-index: 200;
}
.bookData{
margin-left: 0;
}
/* 黑蓝过渡 */
.blackBlueGradient .reservationInfo {
background: linear-gradient(104.24deg, #42a5ff -57.47%, #000000 55.72%, #42a5ff 182.69%);
... ...