Commit d565257b3d65d1ebf7a3ecfb3943cf1740d9a764

Authored by pengye
1 parent 38fc4a2a

邀请函2-13页面代码重构

Too many changes to show.

To preserve performance only 6 of 6+ files are displayed.

// 公共方法:由 detail_owner_invitation2~13 中代码级一致的方法抽取,页面内请勿再重复定义同名方法
// 页面用法:import inviteBase from '../common/inviteBase'; Page({ ...inviteBase, ...页面配置 })
import util from '../../utils/util';
import App from '../../utils/api';
import canvas from '../../pages/customer/canvas';
const plugin = requirePlugin("WechatSI");
export default {
// 获取所有的券并且展示(2-13页面)
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupons.id,
number: coupons.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 持续旋转动画(2-13页面)
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;
},
// 拨打电话(2-13页面)
call(e) {
const phone = e.currentTarget.dataset['phone'];
wx.reportMonitor('1012', 1)
wx.makePhoneCall({
phoneNumber: phone
})
},
// 关闭优惠券弹框(更新已被领取数量)(2-13页面)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList, '1')
this.couponModal.closeModal()
this.setData({
isShow: '1',
})
setTimeout(() => {
this.startAnimation();
}, 800);
},
// 关闭截屏弹框(2-13页面)
closeModal() {
this.modal.closeModal()
},
// 复制微信号(2-13页面)
copyWeChat() {
if (this.data.staffinfo.wechat) {
wx.setClipboardData({
data: this.data.staffinfo.wechat,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data) // data
}
})
}
})
} else {
console.log('无微信号')
}
},
// 获取日期对应的时段(2-13页面)
getLocalLunchTime(lite_style) {
let detail = this.data.detail;
let ddateStr = new Date(detail.ddate * 1000);
let year = ddateStr.getFullYear();
let month = ddateStr.getMonth() + 1;
let day = ddateStr.getDate();
let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
App.Seller.getMealSectionByDay({
sellerid: detail.seller.id,
day: day1,
}).then(res => {
let data = res.data;
let lunchDinnerList = [];
let isMany = '0'; //0默认餐段 1多时段
if (data.length <= 3 && !data[0].ddate_solt) {
isMany = '0';
data.forEach(i => {
if (i.mname == '早餐') {
lunchDinnerList.push({
mname: "早餐",
mdate: i.mdate,
ddate_solt: 1,
})
}
if (i.mname == '午餐') {
lunchDinnerList.push({
mname: "午餐",
mdate: i.mdate,
ddate_solt: 2,
})
}
if (i.mname == '晚餐') {
lunchDinnerList.push({
mname: "晚餐",
mdate: i.mdate,
ddate_solt: 3,
})
}
})
} else {
isMany = '1';
lunchDinnerList = data;
}
let obj = lunchDinnerList.filter(i => {
return i.ddate_solt == detail.ddate_solt
})
var timeList = [];
if (obj && obj.length > 0) {
var time = obj[0].mdate.split("-");
timeList = this.computeHour(time[0], time[1], 15);
}
this.setData({
timeList,
isMany,
})
// 获取转发客人卡片设置
let lite = lite_style || '3';
let liteStyle = lite.split('-');
if (liteStyle[0] == '0') {
this.setData({
imgSrc: detail.seller.seller_image
})
} else {
this.painterBtn(lite);
}
}).catch(res => {
console.log(res, '获取多时段失败');
})
},
// 点击了解更多会员优惠政策(2-13页面)
gotoFavourableList() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1'
}, '/pack-cookbook/pages/favourableList')
wx.navigateTo({
url
})
},
// 处理优惠券不可用日期数据(2-13页面)
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : '';
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
// 预览其他图片(2-13页面)
lookImgs(e) {
const url = e.currentTarget.dataset['url'];
const imgs = e.currentTarget.dataset['imgs'];
let urls = imgs ? imgs : [url]
wx.previewImage({
current: url,
urls,
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
// 使用页面:2-13页面
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
// 使用页面:2-13页面
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
// 使用页面:2-13页面
onShareAppMessage: function () {
return this.sharesetting();
},
/**
* 监听用户点击分享到朋友圈按钮的操作
*/
// 使用页面:2-13页面
onShareTimeline() {
return this.sharesetting();
},
// 生成海报(2-13页面)
painterBtn(liteStyle, timeStr) {
let style = liteStyle.split('-');
let type1 = style[0];
let type2 = style[1];
let data = this.data.detail;
let isMany = this.data.isMany;
let img = data.seller.seller_image.replace(/^http:/, "https:");
let d = data.ddate_solt;
let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
let date2 = util.unixtoTime(data.ddate, 'MM/DD');
let week = ' ' + util.unixtoTime(data.ddate, '周WW');
let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname);
let timeSlot2 = ' ' + this.data.seller.soltName;
let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
time = timeStr ? timeStr : time;
let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
let section = ''
// 老样式123
if (type1 && !type2 && type1 != '4') {
section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
}
// 新样式
if (type1 && type2) {
if (type1 == '1') {
section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
}
if (type1 == '2') {
section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
}
if (type1 == '3' || type1 == '4') {
section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
}
}
if (type1 && !type2 && type1 == '4') {
section = week + timeSlot2;
}
this.setData({
wxml: canvas({
imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
info: {
sellerName: data.seller.sellername,
date: util.unixtoTime(data.ddate, 'MM月DD日'),
time: section,
oneTableName: data.oneTableName,
},
type1,
type2,
date2,
week,
day2,
})
})
},
// 再次预订(2-13页面)
secondbook() {
wx.reportMonitor('1013', 1)
wx.redirectTo({
url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
})
},
// 开启语音播报(2-13页面)
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()
},
// 开始倒计时(2-13页面)
startCountDown() {
let that = this;
const timer = setInterval(() => {
if (that.data.countDown <= 1) {
that.closeCouponModal()
clearInterval(timer);
that.setData({
timer: null
});
} else {
that.setData({
countDown: that.data.countDown - 1
});
}
}, 1000);
this.setData({
timer
});
},
// 出现商家有礼图标,并且晃动2下(2-13页面)
startSecondAnimation() {
const animation = wx.createAnimation({
duration: 200,
timingFunction: 'ease'
});
animation.scale(1).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(0).step();
this.setData({
animationData2: animation.export()
});
},
// 暂停/继续播放(2-13页面)
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;
}
},
// 文字转语音的方法(2-13页面)
textToSpeechFun(sid, reserve) {
console.log('reservereserve-----', reserve);
let play = (reserve && reserve.swich_voice == '1') ? '1' : '0';
let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : '';
let that = this;
let data = this.data;
App.Seller.GetVoiceWelcomeConfig({
sid
}).then((json) => {
let content = '';
// GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底
if (!json.data && reserve == '0') {
json.data = {
is_voice_welcome: 1,
welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
invitee_same_as_reserver: 0,
invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
is_invitee_special_enabled: 1,
invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
special_reserve_types: ["生日宴"]
};
}
console.log('jsondata----', json.data);
if (json.data) {
let config = json.data;
let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致
let isReserver = data.options.hasSellerShare == '1';
if (config.is_voice_welcome == '0') {
content = ''
} else if (sameAs == '1' || sameAs === 1) {
content = config.welcome_content || '';
} else if (sameAs == '0' || sameAs === 0) {
if (isReserver) {
content = config.welcome_content || '';
} else {
let specialEnabled = config.is_invitee_special_enabled == '1'; //为1被请人播特殊模板
let reserveType = data.detail.reserve_type || '';
let specialTypes = config.special_reserve_types || [];
let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1;
content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || '');
}
}
} else if (play == '1') {
content = voice_info;
}
console.log('content---', content);
if (!content) {
this.setData({
newStr: '',
})
return;
}
this.setData({
isPlay: '1',
})
data.detail.rname = data.detail.rname.trim()
let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
let charArray = data.seller.deskStr.split('');
let modifiedArray = charArray.map(char => char + ' ');
let resultString = modifiedArray.join('').slice(0, -1);
const replacements = {
"{店铺名}": data.seller.name,
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
"{包间名}": resultString,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '',
"{预订日期}": data.seller.yearMonthDay,
"{桌位}": resultString,
"{客人姓名}": data.detail.rname ? data.detail.rname : '',
"{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{客人姓氏}": data.detail.rname ? data.detail.rname : '',
"{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{用餐类型}": data.detail.reserve_type || '',
};
let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) {
return replacements[matched];
});
console.log('newStr---', newStr);
this.setData({
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)
}
})
}).catch((err) => {
console.log('GetVoiceWelcomeConfig请求失败', err);
this.setData({
newStr: '',
})
})
},
// 跳转登录页(2-12页面)
gotoLogin(event, type) {
const types = type ? type : event.currentTarget.dataset.types;
let params = {
types, //1邀请函领券 2赴约
id: this.id,
}
if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr)
let url = util.http_build_query(params, '/pages/customer/login')
wx.navigateTo({
url
})
},
// 获取是否点击过赴约(2-12页面)
getreal() {
App.Reserve.GetIsRelaSuccess({
openid: getApp().openid,
rid: this.id,
}).then((json) => {
if (json.ret == 200) {
console.log('是否点击赴约=-----', json.data);
this.setData({
isShowBtn: !json.data, //返回false 代表没有点赴约
})
if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn();
}
})
},
// 领券-获取code、手机号(2-12页面)
getPhoneNumberCouponFun(e) {
if (e.detail && e.detail.code && !this.data.purePhoneNumber) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
} else {
console.log('点了拒绝1');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
})
} else {
console.log('点了拒绝2');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
},
// 用户绑定手机号(2-12页面)
bindUserPhoneFun(purePhoneNumber) {
App.Wechat.BindUserPhone({
phone: purePhoneNumber,
openid: getApp().openid
}).then(res => {
if (res.ret == 200) {
this.setData({
purePhoneNumber
})
if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn();
this.setcouponFun()
}
})
},
// 获取code、手机号(2-12页面)
getPhoneNumberFun(e) {
console.log('获取code', e.detail);
if (e.detail && e.detail.code) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.setData({
purePhoneNumber: res.data.phone_info.purePhoneNumber,
})
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber)
} else {
util.toast('手机号获取失败!', 'none')
}
})
}
},
// 获取用户在商家的账户余额(2-12页面)
getUserRechargeInfo(phone) {
App.Activity.GetRechargeBalanceByOpenid({
openid: getApp().openid,
phone,
sellerid: this.data.seller.sid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (!data) {
this.createInfoFun(phone)
console.log('用户在商家没有账号');
}
}
})
},
// 如果该用户不存在账户 新增用户在商家的账户信息(2-12页面)
createInfoFun(phone) {
let params = {
openid: getApp().openid,
sellerid: this.data.seller.sid,
phone
}
App.Activity.CreateCustomerConsumeSeller(params).then(res => {
if (res.ret == 200) {
console.log('新增用户在商家的账户信息----', res);
}
})
},
// 赴约手机号传参(2-12页面)
confirmed() {
let userinfo = JSON.stringify({
openid: getApp().openid,
avatar: this.data.wxAvatar,
nickname: this.data.wxNickname,
})
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
is_agree: 1,
inviting_phone: this.data.purePhoneNumber,
userinfo
}).then(res => {
if (res.ret == 200) {
util.toast('赴约成功', 'none')
this.setData({
isShowBtn: false,
})
if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn();
}
})
},
// 检测用户是否绑定手机号(2-12页面)
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (data) {
this.setData({
purePhoneNumber: data.phone,
wxNickname: data.nickname ? data.nickname : '',
wxAvatar: data.headimgurl ? data.headimgurl : '',
})
if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn();
}
}
})
},
// 打开送券弹框(2-13页面)
showCouponModal() {
this.couponModal.showModal()
this.setData({
countDown: 5,
})
if (this.data.timer) {
clearInterval(this.data.timer);
}
this.startCountDown();
},
// 跳转到商家入驻页(2-13页面)
gotoJoinSeller() {
wx.navigateTo({
url: util.http_build_query({
laiyuan: '邀请函'
}, '/pages/customer/joinSeller')
})
},
// 导航(2-13页面)
looklocation: function () {
wx.reportMonitor('1015', 1)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.addr,
success: function (res) {
console.log(res)
}
})
},
// 获取商家版本,不是超能版或者没有开通对应模块,不显示(2-13页面)
getSellerVersionFun(sellerid) {
App.SellerVersion.GetSellerVersion({
sellerid
}).then((res) => {
let data = res.data;
console.log('版本列表', data);
if (data && data.length > 0) {
data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
// 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
console.log('当前版本', {
...obj
});
// 提前点餐功能:超能版 || 有提前点餐模块
const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
// 优惠券功能:超能版 || 高级版 || 有优惠券模块
const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
// 充值功能:超能版 || 有充值模块
const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
// 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
this.setData({
hasValueOrder,
hasValueCertificate,
hasValueRecharge,
hasValueBroadcast,
})
}
})
},
// 通过预订ID查收定金详情(2-13页面)
getPaymentStatus() {
App.Reserve.GetReserveDepositByRid({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data && res.data.length > 0) {
let data = res.data[0];
let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0';
let options = this.data.options
this.setData({
paymentId: data.id,
paymentStatus,
isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1',
})
if (typeof this.refreshActionBtn === 'function') this.refreshActionBtn();
}
})
},
// 点击支付定金(2-13页面)
paymentFun() {
let that = this;
let openid = getApp().openid;
if (!openid) return wx.showToast({
title: '请在小程序中支付订金!',
icon: 'none',
})
App.PayOnline.CombineTransactionsByDeposit({
id: this.data.paymentId,
openid,
}).then(res => {
if (res.ret == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(ress) {
console.log('微信支付结果', ress);
if (ress.errMsg == 'requestPayment:ok') {
console.log('支付成功', ress);
that.setData({
paymentStatus: '1',
toastBool: true,
toastText: '支付成功'
})
that.hideToast();
return
}
console.log('支付失败1', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
fail(ress) {
console.log('支付失败2', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
})
}
})
},
// 关闭支付失败或者成功弹框(2-13页面)
hideToast() {
setTimeout(() => {
this.setData({
toastBool: false
})
}, 1500)
},
// 使用页面:(2-13页面)
onImgOK(e) {
this.setData({
imgSrc: e.detail.path
})
console.log('海报生成成功', this.data.imgSrc);
},
// 设置虚拟到店时间(2-13页面)
bindPickerChange: function (e) {
let index = e.detail.value
let temp_ddate = this.data.timeList[index]
this.setData({
temp_ddate
})
let detailInfo = this.data.detail;
const reserveDate = new Date(detailInfo.ddate * 1000);
let reserveTime =
reserveDate.getFullYear() +
"-" +
(reserveDate.getMonth() + 1) +
"-" +
reserveDate.getDate();
let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000
App.Reserve.SetReserveTempDdate({
rid: this.id,
temp_ddate: times,
}).then(res => {
if (res.ret == 200) {
let lite_style = this.data.lite_style
lite_style = lite_style || '3';
let style = lite_style.split('-');
let type1 = style[0];
let type2 = style[1];
if ((type1 == '2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1 == '4' && !type2))) {
let time = temp_ddate || this.data.timeList[index]
this.painterBtn(
lite_style,
time
);
}
}
})
},
// ios 部分机型不兼容new Date() 转换字符串(2-13页面)
getNewDate(data) {
if (typeof data === 'string') {
let arr = data.split(/[- : \/]/)
if (arr[1] !== undefined || arr[1] !== null) {
arr[1] = arr[1] - 1
}
return new Date(...arr)
}
return new Date(data || new Date())
},
//根据起始时间(获取时间时间段)(2-13页面)
computeHour(time1, time2, interval) {
//time1 开始时间 time2结束时间 interval间隔时长
function getTimeList(time1, time2, interval) {
var timeList = [];
time1 = time1.split(":");
time2 = time2.split(":");
time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
interval = interval * 60 * 1000;
while (time1 <= time2) {
timeList.push(time1.format("hh:mm"));
time1 = new Date(time1.getTime() + interval);
}
return timeList;
}
Date.prototype.format = function (format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds(),
};
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length)
);
for (var k in date)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length == 1 ?
date[k] :
("00" + date[k]).substr(("" + date[k]).length)
);
return format;
};
return getTimeList(time1, time2, interval);
},
// 获取自定义图文内容(2-13页面)
getText() {
App.Reserve.GetReserveImgText({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data) {
let data = res.data;
let content = util.determine(data.content)
console.log('contentcontentcontent', content);
this.setData({
reserveData: {
title: data.title || '',
content,
}
})
}
})
},
// 修改detail数据(2-13页面)
formatDatail(detail, dateSmart) {
detail.rdateStr = dateSmart;
detail.tableFirst = detail.tables[0].name;
if (detail.tables.length > 1) {
detail.tableSubInfo = '等' + (detail.tables.length) + '个' +
(detail.tables[0].tid == 2 ? '包间' : '');
}
detail.rname = detail.rname.trim()
if (detail.rname && detail.sex != 3) {
let sexStr = detail.sex == 1 ? '先生' : detail.sex == 2 ? '女士' : detail.sex == 4 ? '贵宾' : '';
let str = this.data.options.showSex == '2' ? '' : sexStr;
detail.rnameStr = detail.rname + str
} else if (!detail.rname && detail.sex == 4) {
detail.rnameStr = '贵宾'
} else {
detail.rnameStr = detail.rname
}
detail.eatStr = '邀请您共进晚餐';
let hi = util.unixtoTime(detail.ddate, 'HHII');
if (hi < '10:00') {
detail.eatStr = '邀请您共进早餐';
} else if (hi < '15:00') {
detail.eatStr = '邀请您共进午餐';
}
return detail;
},
// 点击商家有礼(2-13页面)
gotoSellerGift(e) {
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
hasSellerShare: this.data.options.hasSellerShare,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 计算免费券有效期的起始、结束日期(2-13页面)
setTimeRange(cdate, startOffset, endOffset) {
console.log(cdate, startOffset, endOffset);
const startDate = new Date((cdate + startOffset * 86400) * 1000);
startDate.setHours(0, 0, 0, 0);
const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD');
const endDate = new Date((cdate + endOffset * 86400) * 1000);
endDate.setHours(23, 59, 59, 0);
const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD');
let useEtimeNum = endDate.getTime() / 1000;
return {
useStime,
useEtime,
useEtimeNum
};
},
// 底部操作栏状态计算(2~12 通用;13 号页在页面内覆盖)
refreshActionBtn(extraData) {
// 优先用调用方传入的最新数据(如刚setData的obj),避免setData异步/时序导致读到旧值;不传则读this.data
const data = extraData ? Object.assign({}, this.data, extraData) : this.data;
const {
detail,
options,
isMoreBtn,
isPaymenBtn,
isShareItem,
isShowBtn,
seller,
reserveOpenid,
openid,
wxNickname,
purePhoneNumber
} = data;
const notCancel = detail.status != '4';
const isOver = options.isOrder == '1';
const A = !!isMoreBtn;
const C = !A && !!seller.phone;
const D = notCancel && !!isPaymenBtn;
const E = notCancel && !!isShareItem;
const isOwner = options.hasSellerShare == '1';
const Y = reserveOpenid != openid && !isOver && !!isShowBtn;
const X = Y && !isOwner && options.isMeeting == '1';
const authorized = !!(wxNickname && purePhoneNumber);
this.setData({
barShow: !!(A || isOver || C || D || E),
showMoreOnline: A,
showMoreCall: C,
canPay: D,
canShare: E,
isOver,
isOwner,
canMeet: X,
needLogin: !authorized,
guestShareCls: Y ? 'paymenBtn paymenBtn1' : 'shareItem shareItem1',
threeBtnMore: (D || X) && (E || isOver) ? 'threeBtn' : '',
threeBtnCall: D && (E || isOver) ? 'threeBtn' : '',
threeBtnPay: (A || C) && (E || isOver) ? 'threeBtn' : '',
})
},
// 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨)(10-12页面)
processInfo(intel, type) {
let imgs = [];
intel.textInfo = '';
intel.imgsInfo = [];
intel.videoImgsInfo = [];
if (type == '1' && intel.is_introduce_all == '1') {
if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) {
intel.textInfo = intel.park_info;
imgs = intel.park_info_images
}
}
if (type == '2') {
imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : [];
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : '';
}
if (type == '3') {
imgs = intel.images || []
intel.textInfo = '';
}
if (type == '4') {
imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : []
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : '';
}
intel.imgsInfo = imgs;
if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') {
intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n');
intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content);
intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content));
}
return intel
},
// 选中充值活动(11-12页面)
checkRechargeData(e) {
let id = e.currentTarget.dataset['id'];
let obj = this.data.recharge_data.filter(item => {
return item.id == id
})
if (obj && obj.length > 0) {
this.setData({
activeData: obj[0]
})
}
},
};
\ No newline at end of file
... ...
<!-- 公共 wxml 片段(template):页面用 <import src="../common/parts.wxml" /> 引入 -->
<!-- richText 富文本:content 为数组,项 {type: 1图片/2文字/3视频, content}; imgs 可选整组预览图; textClass 文字字号类 -->
<template name="richText">
<block wx:for="{{content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{imgs}}" mode="widthFix" /><text wx:if="{{item.type == '2'}}" space="nbsp" class="texts {{textClass}}">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video>
</view>
</block>
</template>
<!-- 截屏提示弹窗 -->
<template name="payModal">
<my-modal id="payModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal">提示</view>
<view slot="modalContent">
<view class="explain">检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦!</view>
<view class="screenshotBtns">
<button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button><button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
</template>
<!-- 音乐开关 -->
<template name="musicImg">
<image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
</template>
<!-- 商家有礼悬浮入口 -->
<template name="giftImg">
<image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}" bindtap="gotoSellerGift" data-form="1" animation="{{animationData2}}" wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}" src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode="" />
</template>
<!-- 领券全屏浮层 -->
<template name="fullscreenMask">
<view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}">
<image src="https://qn.colorcun.com/getCouponIcon2.png" mode="" />
</view>
</template>
<!-- 已取消/已结束 状态角标 -->
<template name="statusBadge">
<image wx:if="{{detail && detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options && options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
</template>
<!-- 优惠券列表卡片(2~9 版) -->
<template name="couponCard">
<block wx:for="{{list}}" wx:key="index" wx:for-index="index">
<navigator wx:if="{{item.resultCoupon || !item.resultCoupon || item.is_type != '3'}}" url="/pack-activity/pack/receiveCoupon?id={{item.id}}&sid={{seller.sid}}&oid={{detail.id}}&types=1&StyleType={{StyleType}}&types=1&StyleType={{StyleType}}" hover-class="navigator-hover">
<view class="preferentialItems">
<view class="itemLeft">
<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 class="discountText1 font20r {{item.arule.is_accumulation == '1'?'discountText2':'discountText3'}}" wx:if="{{item.is_type == '3'}}">{{item.arule.is_accumulation == '1' ? '可' : '不可'}}叠加</view>
<view class="priceText" wx:if="{{item.price}}">
<view class="icons font24r">¥</view><text class="font48r">{{item.price}}</text>
</view>
<view class="icons font20r" wx:if="{{item.is_type == '3' && item.desc!='0'}}">消费满{{item.desc}}元可用</view>
</view>
<view class="couponLine"></view>
<view class="itemRight">
<view class="btns">
<text class="font32r anameText">{{item.aname}}</text>
<block wx:if="{{item.is_type == '1' || item.is_type == '2'}}">
<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>
<view wx:if="{{item.exp_date.is_birthday=='1' || item.exp_date.is_birthday===true}}" class="bottom font24r">会员生日当天可用{{item.desc?','+item.desc+'。':'。'}}</view>
</block>
<block wx:if="{{item.is_type == '3' || item.is_type == '4'}}">
<view wx:if="{{(item.useStime && item.useEtime) || item.foreverText}}" class="bottom font24r">有效期:{{item.foreverText?item.foreverText : ''}}</view>
<view wx:if="{{item.useStime && item.useEtime}}" class="bottom font24r nodate">{{item.useStime}} 至 {{item.useEtime}}</view>
<view wx:if="{{item.morText || item.noonText || item.noonText}}" class="bottom font24r">不可用日期:</view>
<view wx:if="{{item.morText}}" class="bottom font24r nodate">{{item.morText}}</view>
<view wx:if="{{item.noonText}}" class="bottom font24r nodate">{{item.noonText}}</view>
<view wx:if="{{item.nigText}}" class="bottom font24r nodate">{{item.nigText}}</view>
<view wx:if="{{item.exp_date.week_show=='无'}}" class="bottom font24r">无使用时间限制</view>
<view wx:if="{{item.is_type == '4' && item.desc!='0'}}" class="bottom font24r">消费满{{item.desc}}元可用</view>
</block>
</view>
<view class="btnBox" wx:if="{{item.is_type == '3'}}">
<view class="font24r orderingFood {{item.resultCoupon == '1'?'orderingFood1':'orderingFood2'}}">{{item.resultCoupon == '1'?'已领取':'领取'}}</view>
<view class="grantNum" wx:if="{{item.receiveNumText}}">
<view class="font24r">已被领取</view>
<view class="font24r">
<text>{{item.receiveNumText}}</text>
张
</view>
</view>
</view>
<view wx:if="{{item.is_type != '3'}}" class="font24r orderingFood">立即抢购</view>
</view>
</view>
</navigator>
</block>
</template>
<!-- 充值卡(2,3,4,5,7,8,9 版) -->
<template name="rechargeCard">
<view class="preferentialItems rechargeItems">
<view class="itemLeft">
<view class="itemTop font36r">{{recharge_data.rname}}</view>
<view class="itemBottom font24r" wx:if="{{priceInfo}}">{{priceInfo}}{{(recharge_data.recharge_list.is_coupons=='0' && recharge_data.recharge_list.is_score=='0')?'。':';'}}</view>
<view class="bottom font24r" wx:if="{{scoreInfo}}">{{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'?'会员充值满'+recharge_data.recharge_money+'元赠送'+certificate:''}}。</view>
</view>
<view class="font24r orderingFood">抢购</view>
</view>
</template>
<!-- 领券弹窗(2~12 通用;13 保持页面内独立) -->
<template name="couponModal">
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalContent">
<view class="titleModal">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode="" />
<view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal font28r" wx:if="{{totalPrice}}">
赠送给您代金券
<view class="counterText">
<view class="font36r">¥</view>
<scroll-number value="{{totalPrice}}"></scroll-number>
</view>
</view>
</view>
<view class="couponWrap">
<view class="couponInfo font48r">
<text class="font48r">到店微信扫码</text>
<text class="font48r">自动识别</text>
</view>
<block wx:if="{{!purePhoneNumber}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button>
</block>
<block wx:else>
<subscribe ids="{{[2]}}" bindtap="setcouponFun">
<view class="couponBtn couponBtn1 font40r">欣然收下</view>
</subscribe>
</block>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
<view class="closeBox font28r">{{countDown}} 秒后自动关闭</view>
</view>
</my-modal>
</template>
<!-- 底部操作栏(2~12 通用;barWrapClass 区分外层样式;13 保持页面内独立) -->
<template name="actionBar">
<view wx:if="{{barShow}}" class="{{barWrapClass}}">
<view wx:if="{{showMoreOnline}}" class="flex-cc font30r moreBtn {{threeBtnMore}}" bindtap="secondbook">再次预订</view>
<view wx:if="{{showMoreCall}}" class="flex-cc font30r moreBtn {{threeBtnCall}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view>
<view wx:if="{{canPay}}" class="flex-cc font30r paymenBtn {{threeBtnPay}}" bindtap="paymentFun">支付定金</view>
<block wx:if="{{isOwner}}">
<button wx:if="{{canShare}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button>
<button wx:if="{{isOver}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button>
</block>
<block wx:else>
<button wx:if="{{canShare}}" class="flex-cc font30r {{guestShareCls}}" open-type="share">转发邀请函</button>
<button wx:if="{{isOver}}" class="flex-cc font30r {{guestShareCls}}" data-type="2" open-type="share">转发邀请函</button>
<block wx:if="{{canMeet}}">
<button wx:if="{{needLogin}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button>
<button wx:else bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button>
</block>
</block>
</view>
</template>
\ No newline at end of file
... ...
... ... @@ -6,11 +6,26 @@ import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
import canvas from "../../pages/customer/canvas"
import inviteBase from '../common/inviteBase';
Page({
...inviteBase,
/**
* 页面的初始数据
*/
data: {
barShow: false, //底部操作栏是否显示
showMoreOnline: false, //再次预订-在线
showMoreCall: false, //再次预订-电话
canPay: false, //支付定金
canShare: false, //转发邀请函
isOver: false, //已结束/完成
isOwner: false, //商家(发起人)视角
canMeet: false, //客人可确认赴约
needLogin: true, //确认赴约需先登录/授权
guestShareCls: 'shareItem shareItem1', //客人转发按钮样式
threeBtnMore: '', //3按钮布局(在线再次预订)
threeBtnCall: '', //3按钮布局(电话再次预订)
threeBtnPay: '', //3按钮布局(支付定金)
options: {
tplid: ''
},
... ... @@ -118,137 +133,6 @@ Page({
})
this.couponModal = this.selectComponent("#couponModal");
},
// 跳转登录页
gotoLogin(event, type) {
const types = type ? type : event.currentTarget.dataset.types;
let params = {
types, //1邀请函领券 2赴约
id: this.id,
}
if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr)
let url = util.http_build_query(params, '/pages/customer/login')
wx.navigateTo({
url
})
},
// 获取是否点击过赴约
getreal() {
App.Reserve.GetIsRelaSuccess({
openid: getApp().openid,
rid: this.id,
}).then((json) => {
if (json.ret == 200) {
console.log('是否点击赴约=-----', json.data);
this.setData({
isShowBtn: !json.data, //返回false 代表没有点赴约
})
}
})
},
// 领券-获取code、手机号
getPhoneNumberCouponFun(e) {
if (e.detail && e.detail.code && !this.data.purePhoneNumber) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
} else {
console.log('点了拒绝1');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
})
} else {
console.log('点了拒绝2');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
},
// 用户绑定手机号
bindUserPhoneFun(purePhoneNumber) {
App.Wechat.BindUserPhone({
phone: purePhoneNumber,
openid: getApp().openid
}).then(res => {
if (res.ret == 200) {
this.setData({
purePhoneNumber
})
this.setcouponFun()
}
})
},
// 获取code、手机号
getPhoneNumberFun(e) {
console.log('获取code', e.detail);
if (e.detail && e.detail.code) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.setData({
purePhoneNumber: res.data.phone_info.purePhoneNumber,
})
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber)
} else {
util.toast('手机号获取失败!', 'none')
}
})
}
},
// 获取用户在商家的账户余额
getUserRechargeInfo(phone) {
App.Activity.GetRechargeBalanceByOpenid({
openid: getApp().openid,
phone,
sellerid: this.data.seller.sid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (!data) {
this.createInfoFun(phone)
console.log('用户在商家没有账号');
}
}
})
},
// 如果该用户不存在账户 新增用户在商家的账户信息
createInfoFun(phone) {
let params = {
openid: getApp().openid,
sellerid: this.data.seller.sid,
phone
}
App.Activity.CreateCustomerConsumeSeller(params).then(res => {
if (res.ret == 200) {
console.log('新增用户在商家的账户信息----', res);
}
})
},
// 赴约手机号传参
confirmed() {
let userinfo = JSON.stringify({
openid: getApp().openid,
avatar: this.data.wxAvatar,
nickname: this.data.wxNickname,
})
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
is_agree: 1,
inviting_phone: this.data.purePhoneNumber,
userinfo
}).then(res => {
if (res.ret == 200) {
util.toast('赴约成功', 'none')
this.setData({
isShowBtn: false,
})
}
})
},
//预览图片
previewImage(e) {
const item = e.target.dataset;
... ... @@ -257,56 +141,6 @@ Page({
urls: item.imgs,
})
},
// 打开送券弹框
showCouponModal() {
this.couponModal.showModal()
this.setData({
countDown: 5,
})
if (this.data.timer) {
clearInterval(this.data.timer);
}
this.startCountDown();
},
// 开始倒计时
startCountDown() {
let that = this;
const timer = setInterval(() => {
if (that.data.countDown <= 1) {
that.closeCouponModal()
clearInterval(timer);
that.setData({
timer: null
});
} else {
that.setData({
countDown: that.data.countDown - 1
});
}
}, 1000);
this.setData({
timer
});
},
// 打开截屏弹框
showModal() {
this.modal.showModal()
},
// 关闭截屏弹框
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框(更新已被领取数量)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList,'1')
this.couponModal.closeModal()
this.setData({
isShow: '1',
})
setTimeout(() => {
this.startAnimation();
}, 800);
},
// 页面滚动事件
onPageScroll: function (event) {
const scrollTop = event.scrollTop * 1 + this.screenHeight - 80; // 获取滚动的距离
... ... @@ -320,18 +154,6 @@ Page({
});
}
},
// 点击了解更多会员优惠政策
gotoFavourableList() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1'
}, '/pack-cookbook/pages/favourableList')
wx.navigateTo({
url
})
},
// 去评价
evaluateFun() {
let url = util.http_build_query({
... ... @@ -346,18 +168,6 @@ Page({
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.sharesetting();
},
/**
* 监听用户点击分享到朋友圈按钮的操作
*/
onShareTimeline() {
return this.sharesetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
... ... @@ -367,69 +177,6 @@ Page({
this.getCheckUserHavePhone()
this.getreal()
},
// 检测用户是否绑定手机号
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (data) {
this.setData({
purePhoneNumber: data.phone,
wxNickname: data.nickname ? data.nickname : '',
wxAvatar: data.headimgurl ? data.headimgurl : '',
})
}
}
})
},
// 复制微信号
copyWeChat() {
if (this.data.staffinfo.wechat) {
wx.setClipboardData({
data: this.data.staffinfo.wechat,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data)
}
})
}
})
} else {
console.log('无微信号')
}
},
// 拨打电话
call(e) {
const phone = e.currentTarget.dataset['phone'];
wx.reportMonitor('1012', 1)
wx.makePhoneCall({
phoneNumber: phone
})
},
// 跳转到商家入驻页
gotoJoinSeller() {
wx.navigateTo({
url: util.http_build_query({
laiyuan: '邀请函'
}, '/pages/customer/joinSeller')
})
},
// 导航
looklocation: function () {
wx.reportMonitor('1015', 1)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.addr,
success: function (res) {
console.log(res)
}
})
},
// 获取包间图片列表
getroomimage(sellerid) {
App.Tables.GetTablesPhoto({
... ... @@ -458,16 +205,6 @@ Page({
urls: this.urlsValue, // 需要预览的图片http链接列表
})
},
// 预览其他图片
lookImgs(e) {
const url = e.currentTarget.dataset['url'];
const imgs = e.currentTarget.dataset['imgs'];
let urls = imgs ? imgs : [url]
wx.previewImage({
current: url,
urls,
})
},
// 获取店铺详情
getDetail() {
App.Reserve.Detail({
... ... @@ -555,135 +292,6 @@ Page({
console.log(res, '详情请求失败');
})
},
// 获取商家版本,不是超能版或者没有开通对应模块,不显示
getSellerVersionFun(sellerid) {
App.SellerVersion.GetSellerVersion({
sellerid
}).then((res) => {
let data = res.data;
console.log('版本列表', data);
if (data && data.length > 0) {
data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
// 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
console.log('当前版本', {
...obj
});
// 提前点餐功能:超能版 || 有提前点餐模块
const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
// 优惠券功能:超能版 || 高级版 || 有优惠券模块
const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
// 充值功能:超能版 || 有充值模块
const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
// 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
this.setData({
hasValueOrder,
hasValueCertificate,
hasValueRecharge,
hasValueBroadcast,
})
}
})
},
// 通过预订ID查收定金详情
getPaymentStatus() {
App.Reserve.GetReserveDepositByRid({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data && res.data.length > 0) {
let data = res.data[0];
let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0';
let options = this.data.options
this.setData({
paymentId: data.id,
paymentStatus,
isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1',
})
}
})
},
// 获取自定义图文内容
getText() {
App.Reserve.GetReserveImgText({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data) {
let data = res.data;
let content = util.determine(data.content)
console.log('自定义图文内容content', content);
this.setData({
reserveData: {
title: data.title || '',
content,
}
})
}
})
},
// 点击支付定金
paymentFun() {
let that = this;
let openid = getApp().openid;
if (!openid) return wx.showToast({
title: '请在小程序中支付订金!',
icon: 'none',
})
App.PayOnline.CombineTransactionsByDeposit({
id: this.data.paymentId,
openid,
}).then(res => {
if (res.ret == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(ress) {
console.log('微信支付结果', ress);
if (ress.errMsg == 'requestPayment:ok') {
console.log('支付成功', ress);
that.setData({
paymentStatus: '1',
toastBool: true,
toastText: '支付成功'
})
that.hideToast();
return
}
console.log('支付失败1', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
fail(ress) {
console.log('支付失败2', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
})
}
})
},
// 关闭支付失败或者成功弹框
hideToast() {
setTimeout(() => {
this.setData({
toastBool: false
})
}, 1500)
},
// 客户经理获取基本信息
getstaffinfo(uid, sid) {
App.Activity.GetCustomerActivityBaseinfo({
... ... @@ -733,77 +341,18 @@ Page({
})
}
},
// 生成海报
painterBtn(liteStyle, timeStr) {
let style = liteStyle.split('-');
let type1 = style[0];
let type2 = style[1];
let data = this.data.detail;
let isMany = this.data.isMany;
let img = data.seller.seller_image.replace(/^http:/, "https:");
let d = data.ddate_solt;
let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
let date2 = util.unixtoTime(data.ddate, 'MM/DD');
let week = ' ' + util.unixtoTime(data.ddate, '周WW');
let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname);
let timeSlot2 = ' ' + this.data.seller.soltName;
let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
time = timeStr ? timeStr : time;
let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
let section = ''
// 老样式123
if (type1 && !type2 && type1 != '4') {
section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
}
// 新样式
if (type1 && type2) {
if (type1 == '1') {
section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
}
if (type1 == '2') {
section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
}
if (type1 == '3' || type1 == '4') {
section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
}
}
if (type1 && !type2 && type1 == '4') {
section = week + timeSlot2;
}
this.setData({
wxml: canvas({
imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
info: {
sellerName: data.seller.sellername,
date: util.unixtoTime(data.ddate, 'MM月DD日'),
time: section,
oneTableName: data.oneTableName,
},
type1,
type2,
date2,
week,
day2,
})
})
},
onImgOK(e) {
this.setData({
imgSrc: e.detail.path
})
console.log('海报生成成功', this.data.imgSrc);
},
// 分享
sharesetting() {
wx.reportMonitor('1017', 1)
this.closeModal()
if (this.data.options.isOrder == '1' && this.data.detail.status != '4') {
let img = this.data.detail.seller.seller_image.replace(/^http:/, "https:");
return {
title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店',
path: util.http_build_query({
id: this.data.detail.seller.id
}, '/pages/reserve/shopHome'),
imageUrl: this.data.detail.seller.seller_image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
}
} else {
let parmdata = {
... ... @@ -822,33 +371,6 @@ Page({
}
}
},
// 修改detail数据
formatDatail(details, dateSmart) {
details.rdateStr = dateSmart;
details.tableFirst = details.tables[0].name;
if (details.tables.length > 1) {
details.tableSubInfo = '等' + (details.tables.length) + '个' +
(details.tables[0].tid == 2 ? '包间' : '');
}
details.rname = details.rname.trim()
if (details.rname && details.sex != 3) {
let sexStr = details.sex == 1 ? '先生' : details.sex == 2 ? '女士' : details.sex == 4 ? '贵宾' : '';
let str = this.data.options.showSex == '2' ? '' : sexStr;
details.rnameStr = details.rname + str
} else if (!details.rname && details.sex == 4) {
details.rnameStr = '贵宾'
} else {
details.rnameStr = details.rname
}
details.eatStr = '邀请您共进晚餐';
let hi = util.unixtoTime(details.ddate, 'HHII');
if (hi < '10:00') {
details.eatStr = '邀请您共进早餐';
} else if (hi < '15:00') {
details.eatStr = '邀请您共进午餐';
}
return details;
},
// 获取商家设置营销信息
getSellerTemplateConfFun(sid) {
App.Seller.GetSellerTemplateConf({
... ... @@ -924,6 +446,7 @@ Page({
this.setData({
...obj
})
this.refreshActionBtn(obj)
// reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置
let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve;
this.textToSpeechFun(sid,i)
... ... @@ -931,266 +454,6 @@ Page({
console.log('GetSellerTemplateConf请求失败');
})
},
// 获取日期对应的时段
getLocalLunchTime(lite_style) {
let detail = this.data.detail;
let ddateStr = new Date(detail.ddate * 1000);
let year = ddateStr.getFullYear();
let month = ddateStr.getMonth() + 1;
let day = ddateStr.getDate();
let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
App.Seller.getMealSectionByDay({
sellerid: detail.seller.id,
day: day1,
}).then(res => {
let data = res.data;
let lunchDinnerList = [];
let isMany = '0';//0默认餐段 1多时段
if (data.length <= 3 && !data[0].ddate_solt) {
isMany = '0';
data.forEach(i => {
if (i.mname == '早餐') {
lunchDinnerList.push({
mname: "早餐",
mdate: i.mdate,
ddate_solt: 1,
})
}
if (i.mname == '午餐') {
lunchDinnerList.push({
mname: "午餐",
mdate: i.mdate,
ddate_solt: 2,
})
}
if (i.mname == '晚餐') {
lunchDinnerList.push({
mname: "晚餐",
mdate: i.mdate,
ddate_solt: 3,
})
}
})
} else {
isMany = '1';
lunchDinnerList = data;
}
let obj = lunchDinnerList.filter(i => {
return i.ddate_solt == detail.ddate_solt
})
var timeList = [];
if (obj && obj.length > 0) {
var time = obj[0].mdate.split("-");
timeList = this.computeHour(time[0], time[1], 15);
}
this.setData({
timeList,
isMany,
})
// 获取转发客人卡片设置
let lite = lite_style || '3';
let liteStyle = lite.split('-');
if (liteStyle[0] == '0') {
this.setData({
imgSrc: detail.seller.seller_image
})
} else {
this.painterBtn(lite);
}
}).catch(res => {
console.log(res, '获取多时段失败');
})
},
// 点击商家有礼
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
hasSellerShare: this.data.options.hasSellerShare,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
wx.reportMonitor('1013', 1)
wx.redirectTo({
url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(sid, reserve) {
console.log('reservereserve-----',reserve);
let play = (reserve && reserve.swich_voice == '1') ? '1' : '0';
let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : '';
let that = this;
let data = this.data;
App.Seller.GetVoiceWelcomeConfig({
sid
}).then((json) => {
let content = '';
// GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底
if (!json.data && reserve == '0') {
json.data = {
is_voice_welcome: 1,
welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
invitee_same_as_reserver: 0,
invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
is_invitee_special_enabled: 1,
invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
special_reserve_types: ["生日宴"]
};
}
console.log('jsondata----',json.data);
if (json.data) {
let config = json.data;
let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致
let isReserver = data.options.hasSellerShare == '1';
if (config.is_voice_welcome == '0') {
content = ''
} else if (sameAs == '1' || sameAs === 1) {
content = config.welcome_content || '';
} else if (sameAs == '0' || sameAs === 0) {
if (isReserver) {
content = config.welcome_content || '';
} else {
let specialEnabled = config.is_invitee_special_enabled == '1';//为1被请人播特殊模板
let reserveType = data.detail.reserve_type || '';
let specialTypes = config.special_reserve_types || [];
let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1;
content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || '');
}
}
} else if (play == '1') {
content = voice_info;
}
console.log('content---', content);
if (!content) {
this.setData({
newStr: '',
})
return;
}
this.setData({
isPlay: '1',
})
data.detail.rname = data.detail.rname.trim()
let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
let charArray = data.seller.deskStr.split('');
let modifiedArray = charArray.map(char => char + ' ');
let resultString = modifiedArray.join('').slice(0, -1);
const replacements = {
"{店铺名}": data.seller.name,
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
"{包间名}": resultString,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '',
"{预订日期}": data.seller.yearMonthDay,
"{桌位}": resultString,
"{客人姓名}": data.detail.rname ? data.detail.rname : '',
"{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{客人姓氏}": data.detail.rname ? data.detail.rname : '',
"{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{用餐类型}": data.detail.reserve_type || '',
};
let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) {
return replacements[matched];
});
console.log('newStr---', newStr);
this.setData({
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)
}
})
}).catch((err) => {
console.log('GetVoiceWelcomeConfig请求失败', err);
this.setData({
newStr: '',
})
})
},
// 开启语音播报
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({
... ... @@ -1221,18 +484,6 @@ Page({
}
})
},
// 选择充值活动
checkRechargeData(e) {
let id = e.currentTarget.dataset['id'];
let obj = this.data.recharge_data.filter(item => {
return item.id == id
})
if (obj && obj.length > 0) {
this.setData({
activeData: obj[0]
})
}
},
// 获取评价赠送的券最新详情
getEvaluateFun(id) {
App.Activity.GetActivityById({
... ... @@ -1422,24 +673,6 @@ Page({
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun() {
let arr = this.data.couponArr;
... ... @@ -1621,61 +854,6 @@ Page({
}
})
},
// 计算免费券有效期的起始、结束日期
setTimeRange(cdate, startOffset, endOffset) {
const startDate = new Date((cdate + startOffset * 86400) * 1000);
startDate.setHours(0, 0, 0, 0);
const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD');
const endDate = new Date((cdate + endOffset * 86400) * 1000);
endDate.setHours(23, 59, 59, 0);
const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD');
let useEtimeNum = endDate.getTime() / 1000;
return { useStime, useEtime,useEtimeNum };
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : '';
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ... @@ -1695,53 +873,6 @@ Page({
this.audioCtx.destroy(); // 释放音频资源
}
},
// 设置虚拟到店时间
bindPickerChange: function (e) {
let index = e.detail.value
let temp_ddate = this.data.timeList[index]
this.setData({
temp_ddate
})
let detailInfo = this.data.detail;
const reserveDate = new Date(detailInfo.ddate * 1000);
let reserveTime =
reserveDate.getFullYear() +
"-" +
(reserveDate.getMonth() + 1) +
"-" +
reserveDate.getDate();
let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000
App.Reserve.SetReserveTempDdate({
rid: this.id,
temp_ddate: times,
}).then(res => {
if (res.ret == 200) {
let lite_style = this.data.lite_style
lite_style = lite_style || '3';
let style =lite_style.split('-');
let type1 =style[0];
let type2 =style[1];
if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1=='4' && !type2))){
let time = temp_ddate || this.data.timeList[index]
this.painterBtn(
lite_style,
time
);
}
}
})
},
// ios 部分机型不兼容new Date() 转换字符串
getNewDate(data) {
if (typeof data === 'string') {
let arr = data.split(/[- : \/]/)
if (arr[1] !== undefined || arr[1] !== null) {
arr[1] = arr[1] - 1
}
return new Date(...arr)
}
return new Date(data || new Date())
},
// 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画
startAnimation() {
const animation = wx.createAnimation({
... ... @@ -1759,108 +890,4 @@ Page({
this.startSecondAnimation();
}, 800);
},
// 出现商家有礼图标,并且晃动2下
startSecondAnimation() {
const animation = wx.createAnimation({
duration: 200,
timingFunction: 'ease'
});
animation.scale(1).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(0).step();
this.setData({
animationData2: animation.export()
});
},
//根据起始时间(获取时间时间段)
computeHour(time1, time2, interval) {
//time1 开始时间 time2结束时间 interval间隔时长
function getTimeList(time1, time2, interval) {
var timeList = [];
time1 = time1.split(":");
time2 = time2.split(":");
time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
interval = interval * 60 * 1000;
while (time1 <= time2) {
timeList.push(time1.format("hh:mm"));
time1 = new Date(time1.getTime() + interval);
}
return timeList;
}
Date.prototype.format = function (format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds(),
};
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length)
);
for (var k in date)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length == 1 ?
date[k] :
("00" + date[k]).substr(("" + date[k]).length)
);
return format;
};
return getTimeList(time1, time2, interval);
},
// 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨)
processInfo(intel, type) {
let imgs = [];
intel.textInfo = '';
intel.imgsInfo = [];
intel.videoImgsInfo = [];
if (type == '1' && intel.is_introduce_all == '1') {
if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) {
intel.textInfo = intel.park_info;
imgs = intel.park_info_images
}
}
if (type == '2') {
imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : [];
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : '';
}
if (type == '3') {
imgs = intel.images || []
intel.textInfo = '';
}
if (type == '4') {
imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : []
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : '';
}
intel.imgsInfo = imgs;
if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') {
intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n');
intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content);
intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content));
}
return intel
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
})
\ No newline at end of file
... ...
<!--pack-invitation/pages/detail_owner_invitation10.wxml-->
<import src="../common/parts.wxml" />
<import src="../../pages/tpl/invitation"></import>
<nav hasHome class="navhome" backgroundColor="#ffeddc" place="{{true}}"></nav>
<scroll-view scroll-y class="viewBox">
<image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}"
bindtap="gotoSellerGift"
data-form="1"
animation="{{animationData2}}"
wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode=""/>
<view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}">
<image src="https://qn.colorcun.com/getCouponIcon2.png" mode=""/>
</view>
<!-- 音乐开关 -->
<template is="musicImg" data="{{newStr: newStr, isPlay: isPlay, attentionAnim: attentionAnim}}" />
<!-- 商家有礼悬浮入口 -->
<template is="giftImg" data="{{hasValueCertificate: hasValueCertificate, marketing: marketing, coupon_dataList: coupon_dataList, isFrame: isFrame, is_comments: is_comments, is_user_comments: is_user_comments, couponData: couponData, hasValueRecharge: hasValueRecharge, recharge_data: recharge_data, animationData2: animationData2}}" />
<!-- 领券全屏浮层 -->
<template is="fullscreenMask" data="{{isShow: isShow, animationData: animationData}}" />
<view class="targetPoint" style="top: 35%; right: 4%;"></view>
<image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
<!-- 已取消/已结束 状态角标 -->
<template is="statusBadge" data="{{detail: detail, options: options}}" />
<view class="reservationInfo {{options.bookType ? 'birthdaySty' : 'noBirthday'}} {{options.hasSellerShare == '1' ? 'noBirthday1' : '' }}">
<view class="infoTop">
<text space="nbsp" class="font48r">{{seller.name||reserve.seller_name}}</text>
... ... @@ -326,67 +323,10 @@
{{toastText}}
</view>
</scroll-view>
<!-- (开启在线预订 显示在线预订) || (未开启在线预订 显示再次预订(打商家电话)) -->
<!-- (未结束&&未取消 && 开启转发开关 显示 转发邀请函给客人) || (过了当前餐段结束时间||用餐完成||已取消 显示 转发店铺给好友) -->
<view wx:if="{{isMoreBtn || options.isOrder == '1' || (!isMoreBtn && seller.phone) || (detail.status !='4' && isPaymenBtn) || (detail.status !='4' && isShareItem)}}" class="flex-lr sharewidth">
<view wx:if="{{isMoreBtn}}" class="flex-cc font30r moreBtn {{(((detail.status !='4' && isPaymenBtn) || (reserveOpenid != openid && options.isOrder != '1' && options.hasSellerShare!='1' && isShowBtn && options.isMeeting == '1')) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="secondbook">再次预订</view>
<view wx:if="{{!isMoreBtn && seller.phone}}" class="flex-cc font30r moreBtn {{((detail.status !='4' && isPaymenBtn) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view>
<view wx:if="{{detail.status !='4' && isPaymenBtn}}" class="flex-cc font30r paymenBtn {{((isMoreBtn || (!isMoreBtn && seller.phone)) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="paymentFun">支付定金</view>
<block wx:if="{{options.hasSellerShare == '1'}}">
<button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button>
<button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button>
</block>
<block wx:if="{{options.hasSellerShare != '1'}}">
<button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" open-type="share">转发邀请函</button>
<button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" data-type="2" open-type="share">转发邀请函</button>
<block wx:if="{{wxNickname && purePhoneNumber && options.isMeeting == '1'}}">
<button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button>
</block>
<block wx:if="{{(!wxNickname || !purePhoneNumber) && options.isMeeting == '1'}}">
<button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button>
</block>
</block>
</view>
<!-- 底部操作栏 -->
<template is="actionBar" data="{{barWrapClass: 'flex-lr sharewidth', barShow: barShow, showMoreOnline: showMoreOnline, threeBtnMore: threeBtnMore, showMoreCall: showMoreCall, threeBtnCall: threeBtnCall, seller: seller, canPay: canPay, threeBtnPay: threeBtnPay, isOwner: isOwner, canShare: canShare, isOver: isOver, guestShareCls: guestShareCls, canMeet: canMeet, needLogin: needLogin}}" />
<painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" />
<my-modal id="payModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal">提示</view>
<view slot="modalContent">
<view class="explain">
检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦!
</view>
<view class="screenshotBtns">
<button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button>
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalContent">
<view class="titleModal">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode=""/>
<view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal font28r" wx:if="{{totalPrice}}">
赠送给您代金券
<view class="counterText">
<view class="font36r">¥</view><scroll-number value="{{totalPrice}}"></scroll-number>
</view>
</view>
</view>
<view class="couponWrap">
<view class="couponInfo font48r">
<text class="font48r">到店微信扫码</text>
<text class="font48r">自动识别</text>
</view>
<block wx:if="{{!purePhoneNumber}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button>
</block>
<block wx:else>
<subscribe ids="{{[2]}}" bindtap="setcouponFun">
<view class="couponBtn couponBtn1 font40r">欣然收下</view>
</subscribe>
</block>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
<view class="closeBox font28r">{{countDown}} 秒后自动关闭</view>
</view>
</my-modal>
\ No newline at end of file
<!-- 截屏提示弹窗 -->
<template is="payModal" data="{{detail: detail, options: options, marketing: marketing, imgSrc: imgSrc}}" />
<!-- 领券弹窗(2~12 通用;13 保持页面内独立) -->
<template is="couponModal" data="{{seller: seller, reserve: reserve, totalPrice: totalPrice, purePhoneNumber: purePhoneNumber, countDown: countDown}}" />
\ No newline at end of file
... ...
... ... @@ -6,11 +6,26 @@ import TP from '../../utils/tpls';
import RS from '../../utils/reserveStatus'
var plugin = requirePlugin("WechatSI");
import canvas from "../../pages/customer/canvas"
import inviteBase from '../common/inviteBase';
Page({
...inviteBase,
/**
* 页面的初始数据
*/
data: {
barShow: false, //底部操作栏是否显示
showMoreOnline: false, //再次预订-在线
showMoreCall: false, //再次预订-电话
canPay: false, //支付定金
canShare: false, //转发邀请函
isOver: false, //已结束/完成
isOwner: false, //商家(发起人)视角
canMeet: false, //客人可确认赴约
needLogin: true, //确认赴约需先登录/授权
guestShareCls: 'shareItem shareItem1', //客人转发按钮样式
threeBtnMore: '', //3按钮布局(在线再次预订)
threeBtnCall: '', //3按钮布局(电话再次预订)
threeBtnPay: '', //3按钮布局(支付定金)
show_white: false,
options: {
tplid: ''
... ... @@ -127,138 +142,6 @@ Page({
})
this.couponModal = this.selectComponent("#couponModal");
},
// 跳转登录页
gotoLogin(event, type) {
console.log(111);
const types = type ? type : event.currentTarget.dataset.types;
let params = {
types, //1邀请函领券 2赴约
id: this.id,
}
if (types == '1') params.couponArr = JSON.stringify(this.data.couponArr)
let url = util.http_build_query(params, '/pages/customer/login')
wx.navigateTo({
url
})
},
// 获取是否点击过赴约
getreal() {
App.Reserve.GetIsRelaSuccess({
openid: getApp().openid,
rid: this.id,
}).then((json) => {
if (json.ret == 200) {
console.log('是否点击赴约=-----', json.data);
this.setData({
isShowBtn: !json.data, //返回false 代表没有点赴约
})
}
})
},
// 领券-获取code、手机号
getPhoneNumberCouponFun(e) {
if (e.detail && e.detail.code && !this.data.purePhoneNumber) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
} else {
console.log('点了拒绝1');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
})
} else {
console.log('点了拒绝2');
this.couponModal.closeModal()
this.gotoLogin('', '1')
}
},
// 用户绑定手机号
bindUserPhoneFun(purePhoneNumber) {
App.Wechat.BindUserPhone({
phone: purePhoneNumber,
openid: getApp().openid
}).then(res => {
if (res.ret == 200) {
this.setData({
purePhoneNumber
})
this.setcouponFun()
}
})
},
// 获取code、手机号
getPhoneNumberFun(e) {
console.log('获取code', e.detail);
if (e.detail && e.detail.code) {
App.Wechat.GetUserPhoneNumber({
code: e.detail.code,
}).then(res => {
if (res.ret == 200 && res.data && res.data.phone_info && res.data.phone_info.purePhoneNumber) {
this.setData({
purePhoneNumber: res.data.phone_info.purePhoneNumber,
})
this.bindUserPhoneFun(res.data.phone_info.purePhoneNumber)
this.getUserRechargeInfo(res.data.phone_info.purePhoneNumber)
} else {
util.toast('手机号获取失败!', 'none')
}
})
}
},
// 获取用户在商家的账户余额
getUserRechargeInfo(phone) {
App.Activity.GetRechargeBalanceByOpenid({
openid: getApp().openid,
phone,
sellerid: this.data.seller.sid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (!data) {
this.createInfoFun(phone)
console.log('用户在商家没有账号');
}
}
})
},
// 如果该用户不存在账户 新增用户在商家的账户信息
createInfoFun(phone) {
let params = {
openid: getApp().openid,
sellerid: this.data.seller.sid,
phone
}
App.Activity.CreateCustomerConsumeSeller(params).then(res => {
if (res.ret == 200) {
console.log('新增用户在商家的账户信息----', res);
}
})
},
// 赴约手机号传参
confirmed() {
let userinfo = JSON.stringify({
openid: getApp().openid,
avatar: this.data.wxAvatar,
nickname: this.data.wxNickname,
})
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
is_agree: 1,
inviting_phone: this.data.purePhoneNumber,
userinfo
}).then(res => {
if (res.ret == 200) {
util.toast('赴约成功', 'none')
this.setData({
isShowBtn: false,
})
}
})
},
// 锚点定位
gotoModule(e) {
const type = e.currentTarget.dataset['type'];
... ... @@ -277,56 +160,6 @@ Page({
});
}
},
// 打开送券弹框
showCouponModal() {
this.couponModal.showModal()
this.setData({
countDown: 5,
})
if (this.data.timer) {
clearInterval(this.data.timer);
}
this.startCountDown();
},
// 开始倒计时
startCountDown() {
let that = this;
const timer = setInterval(() => {
if (that.data.countDown <= 1) {
that.closeCouponModal()
clearInterval(timer);
that.setData({
timer: null
});
} else {
that.setData({
countDown: that.data.countDown - 1
});
}
}, 1000);
this.setData({
timer
});
},
// 打开截屏弹框
showModal() {
this.modal.showModal()
},
// 关闭截屏弹框
closeModal() {
this.modal.closeModal()
},
// 关闭优惠券弹框(更新已被领取数量)
closeCouponModal() {
this.getActivityByIdFun(this.data.couponList,'1')
this.couponModal.closeModal()
this.setData({
isShow: '1',
})
setTimeout(() => {
this.startAnimation();
}, 800);
},
// 页面滚动事件
onPageScroll: function (event) {
if (event.scrollTop > 150) { //当页面滚动到某个位置时(这里设置为50),将导航栏背景颜色设置为白色
... ... @@ -349,18 +182,6 @@ Page({
});
}
},
// 点击了解更多会员优惠政策
gotoFavourableList() {
let url = util.http_build_query({
sellerName: this.data.seller.name,
sellerid: this.data.seller.sid,
oid: this.data.detail.id,
types: '1'
}, '/pack-cookbook/pages/favourableList')
wx.navigateTo({
url
})
},
// 去评价
evaluateFun() {
let url = util.http_build_query({
... ... @@ -375,18 +196,6 @@ Page({
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.sharesetting();
},
/**
* 监听用户点击分享到朋友圈按钮的操作
*/
onShareTimeline() {
return this.sharesetting();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
... ... @@ -399,69 +208,6 @@ Page({
this.getCheckUserHavePhone()
this.getreal()
},
// 检测用户是否绑定手机号
getCheckUserHavePhone() {
App.Wechat.CheckUserHavePhone({
openid: getApp().openid,
}).then((json) => {
if (json.ret == 200) {
let data = json.data;
if (data) {
this.setData({
purePhoneNumber: data.phone,
wxNickname: data.nickname ? data.nickname : '',
wxAvatar: data.headimgurl ? data.headimgurl : '',
})
}
}
})
},
// 复制微信号
copyWeChat() {
if (this.data.staffinfo.wechat) {
wx.setClipboardData({
data: this.data.staffinfo.wechat,
success(res) {
wx.getClipboardData({
success(res) {
console.log(res.data)
}
})
}
})
} else {
console.log('无微信号')
}
},
// 拨打电话
call(e) {
const phone = e.currentTarget.dataset['phone'];
wx.reportMonitor('1012', 1)
wx.makePhoneCall({
phoneNumber: phone
})
},
// 跳转到商家入驻页
gotoJoinSeller() {
wx.navigateTo({
url: util.http_build_query({
laiyuan: '邀请函'
}, '/pages/customer/joinSeller')
})
},
// 导航
looklocation: function () {
wx.reportMonitor('1015', 1)
wx.openLocation({
latitude: Number(this.data.seller.lat),
longitude: Number(this.data.seller.long),
scale: 17,
address: this.data.seller.addr,
success: function (res) {
console.log(res)
}
})
},
// 获取包间图片列表
getroomimage(sellerid, uid) {
App.Tables.GetTablesPhoto({
... ... @@ -487,16 +233,6 @@ Page({
}
})
},
// 预览图片
lookImgs(e) {
const url = e.currentTarget.dataset['url'];
const imgs = e.currentTarget.dataset['imgs'];
let urls = imgs ? imgs : [url]
wx.previewImage({
current: url,
urls,
})
},
// 获取店铺详情
getDetail() {
App.Reserve.Detail({
... ... @@ -574,135 +310,6 @@ Page({
console.log(res, '详情请求失败');
})
},
// 获取商家版本,不是超能版或者没有开通对应模块,不显示
getSellerVersionFun(sellerid) {
App.SellerVersion.GetSellerVersion({
sellerid
}).then((res) => {
let data = res.data;
console.log('版本列表', data);
if (data && data.length > 0) {
data.sort((a, b) => b.cdate * 1 - a.cdate * 1);
// 获取店铺当前版本 (cdate最大最后一个充入的 && 当前时间有效 && 当前版本)
let obj = data.find(item => item.vtype == 1 || item.vtype == 2 || item.vtype == 4);
console.log('当前版本', {
...obj
});
// 提前点餐功能:超能版 || 有提前点餐模块
const hasValueOrder = obj.vtype == '1' || data.some(item => item.vid == '6');
// 优惠券功能:超能版 || 高级版 || 有优惠券模块
const hasValueCertificate = obj.vtype == '1' || obj.vtype == '4' || data.some(item => item.vid == '8');
// 充值功能:超能版 || 有充值模块
const hasValueRecharge = obj.vtype == '1' || data.some(item => item.vid == '9');
// 播报功能:超能版 || 标准版 || 标准版首年 || 高级版
const hasValueBroadcast = obj.vtype == '1' || obj.vid == '4' || obj.vid == '13' || obj.vtype == '4';
this.setData({
hasValueOrder,
hasValueCertificate,
hasValueRecharge,
hasValueBroadcast,
})
}
})
},
// 通过预订ID查收定金详情
getPaymentStatus() {
App.Reserve.GetReserveDepositByRid({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data && res.data.length > 0) {
let data = res.data[0];
let paymentStatus = data.trade_state == 'SUCCESS' ? '1' : '0';
let options = this.data.options
this.setData({
paymentId: data.id,
paymentStatus,
isPaymenBtn: options.isOrder != '1' && data.id && paymentStatus == '0' && options.hasSellerShare == '1' && options.isDeposit == '1',
})
}
})
},
// 获取自定义图文内容
getText() {
App.Reserve.GetReserveImgText({
rid: this.data.options.id
}).then(res => {
if (res.ret == 200 && res.data) {
let data = res.data;
let content = util.determine(data.content)
console.log('自定义图文内容content', content);
this.setData({
reserveData: {
title: data.title || '',
content,
}
})
}
})
},
// 点击支付定金
paymentFun() {
let that = this;
let openid = getApp().openid;
if (!openid) return wx.showToast({
title: '请在小程序中支付订金!',
icon: 'none',
})
App.PayOnline.CombineTransactionsByDeposit({
id: this.data.paymentId,
openid,
}).then(res => {
if (res.ret == 200) {
wx.requestPayment({
timeStamp: res.data.timeStamp + '',
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
success(ress) {
console.log('微信支付结果', ress);
if (ress.errMsg == 'requestPayment:ok') {
console.log('支付成功', ress);
that.setData({
paymentStatus: '1',
toastBool: true,
toastText: '支付成功'
})
that.hideToast();
return
}
console.log('支付失败1', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
fail(ress) {
console.log('支付失败2', ress);
that.setData({
toastBool: true,
toastText: '支付失败,请重新支付'
})
that.hideToast();
},
})
} else {
wx.showToast({
title: res.msg,
icon: 'none',
})
}
})
},
// 关闭支付失败或者成功弹框
hideToast() {
setTimeout(() => {
this.setData({
toastBool: false
})
}, 1500)
},
// 客户经理获取基本信息
getstaffinfo(uid, sid) {
App.Activity.GetCustomerActivityBaseinfo({
... ... @@ -751,77 +358,18 @@ Page({
})
}
},
// 生成海报
painterBtn(liteStyle, timeStr) {
let style = liteStyle.split('-');
let type1 = style[0];
let type2 = style[1];
let data = this.data.detail;
let isMany = this.data.isMany;
let img = data.seller.seller_image.replace(/^http:/, "https:");
let d = data.ddate_solt;
let date1 = util.unixtoTime(data.ddate, 'MM月DD日');
let date2 = util.unixtoTime(data.ddate, 'MM/DD');
let week = ' ' + util.unixtoTime(data.ddate, '周WW');
let timeSlot1 = ' ' + (isMany == '0' ? (d == '1' ? '早上' : d == '2' ? '中午' : d == '3' ? '晚上' : '') : data.mname);
let timeSlot2 = ' ' + this.data.seller.soltName;
let time = this.data.temp_ddate ? ' ' + this.data.temp_ddate : ' ' + util.unixtoTime(data.ddate, 'HH:II')
time = timeStr ? timeStr : time;
let [day1, day2] = [...util.unixtoTime(data.ddate, '周WW')]
let section = ''
// 老样式123
if (type1 && !type2 && type1 != '4') {
section = type1 == '1' ? week + timeSlot1 : type1 == '2' ? week + time : type1 == '3' ? week + timeSlot2 : '';
}
// 新样式
if (type1 && type2) {
if (type1 == '1') {
section = type2 == '1' ? date1 + week + time + timeSlot2 : type2 == '2' ? date1 + week + timeSlot1 : type2 == '3' ? date1 + week + time : type2 == '4' ? date1 + week + timeSlot2 : '';
}
if (type1 == '2') {
section = type2 == '1' ? week + time + timeSlot2 : type2 == '2' ? week + timeSlot1 : type2 == '3' ? week + time : type2 == '4' ? week + timeSlot2 : '';
}
if (type1 == '3' || type1 == '4') {
section = type2 == '1' ? time + timeSlot2.trim() : type2 == '2' ? timeSlot1.trim() : type2 == '3' ? time.trim() : type2 == '4' ? timeSlot2.trim() : '';
}
}
if (type1 && !type2 && type1 == '4') {
section = week + timeSlot2;
}
this.setData({
wxml: canvas({
imgUrl: img || 'https://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
info: {
sellerName: data.seller.sellername,
date: util.unixtoTime(data.ddate, 'MM月DD日'),
time: section,
oneTableName: data.oneTableName,
},
type1,
type2,
date2,
week,
day2,
})
})
},
onImgOK(e) {
this.setData({
imgSrc: e.detail.path
})
console.log('海报生成成功', this.data.imgSrc);
},
// 分享
sharesetting() {
wx.reportMonitor('1017', 1)
this.closeModal()
if (this.data.options.isOrder == '1' && this.data.detail.status != '4') {
let img = this.data.detail.seller.seller_image.replace(/^http:/, "https:");
return {
title: '推荐' + this.data.seller.name + ',点击可查看详情并导航到店',
path: util.http_build_query({
id: this.data.detail.seller.id
}, '/pages/reserve/shopHome'),
imageUrl: this.data.detail.seller.seller_image || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
imageUrl: img || 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png',
}
} else {
let parmdata = {
... ... @@ -840,33 +388,6 @@ Page({
}
}
},
// 修改detail数据
formatDatail(details, dateSmart) {
details.rdateStr = dateSmart;
details.tableFirst = details.tables[0].name;
if (details.tables.length > 1) {
details.tableSubInfo = '等' + (details.tables.length) + '个' +
(details.tables[0].tid == 2 ? '包间' : '');
}
details.rname = details.rname.trim()
if (details.rname && details.sex != 3) {
let sexStr = details.sex == 1 ? '先生' : details.sex == 2 ? '女士' : details.sex == 4 ? '贵宾' : '';
let str = this.data.options.showSex == '2' ? '' : sexStr;
details.rnameStr = details.rname + str
} else if (!details.rname && details.sex == 4) {
details.rnameStr = '贵宾'
} else {
details.rnameStr = details.rname
}
details.eatStr = '邀请您共进晚餐';
let hi = util.unixtoTime(details.ddate, 'HHII');
if (hi < '10:00') {
details.eatStr = '邀请您共进早餐';
} else if (hi < '15:00') {
details.eatStr = '邀请您共进午餐';
}
return details;
},
// 获取商家设置营销信息
getSellerTemplateConfFun(sid) {
App.Seller.GetSellerTemplateConf({
... ... @@ -954,6 +475,7 @@ Page({
this.setData({
...obj
})
this.refreshActionBtn(obj)
// reserve为空 或 reserve里没有voice_info/swich_voice字段时,不开启商家自定义语音,走默认语音配置
let i = (reserve == null || !reserve.voice_info || !reserve.swich_voice) ? '0' : reserve;
this.textToSpeechFun(sid,i)
... ... @@ -961,266 +483,6 @@ Page({
console.log('GetSellerTemplateConf请求失败');
})
},
// 获取日期对应的时段
getLocalLunchTime(lite_style) {
let detail = this.data.detail;
let ddateStr = new Date(detail.ddate * 1000);
let year = ddateStr.getFullYear();
let month = ddateStr.getMonth() + 1;
let day = ddateStr.getDate();
let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
App.Seller.getMealSectionByDay({
sellerid: detail.seller.id,
day: day1,
}).then(res => {
let data = res.data;
let lunchDinnerList = [];
let isMany = '0';//0默认餐段 1多时段
if (data.length <= 3 && !data[0].ddate_solt) {
isMany = '0';
data.forEach(i => {
if (i.mname == '早餐') {
lunchDinnerList.push({
mname: "早餐",
mdate: i.mdate,
ddate_solt: 1,
})
}
if (i.mname == '午餐') {
lunchDinnerList.push({
mname: "午餐",
mdate: i.mdate,
ddate_solt: 2,
})
}
if (i.mname == '晚餐') {
lunchDinnerList.push({
mname: "晚餐",
mdate: i.mdate,
ddate_solt: 3,
})
}
})
} else {
isMany = '1';
lunchDinnerList = data;
}
let obj = lunchDinnerList.filter(i => {
return i.ddate_solt == detail.ddate_solt
})
var timeList = [];
if (obj && obj.length > 0) {
var time = obj[0].mdate.split("-");
timeList = this.computeHour(time[0], time[1], 15);
}
this.setData({
timeList,
isMany,
})
// 获取转发客人卡片设置
let lite = lite_style || '3';
let liteStyle = lite.split('-');
if (liteStyle[0] == '0') {
this.setData({
imgSrc: detail.seller.seller_image
})
} else {
this.painterBtn(lite);
}
}).catch(res => {
console.log(res, '获取多时段失败');
})
},
// 点击商家有礼
gotoSellerGift(e){
this.couponModal.closeModal()
const form = e.currentTarget.dataset['form'];
let url = util.http_build_query({
id: this.data.detail.id,
hasSellerShare: this.data.options.hasSellerShare,
form
}, '/pages/reserve/sellerGift')
wx.navigateTo({
url
})
},
// 再次预订
secondbook() {
wx.reportMonitor('1013', 1)
wx.redirectTo({
url: '/pages/reserve/shopHome?id=' + this.data.detail.seller.id
})
},
// 文字转语音的方法
textToSpeechFun(sid, reserve) {
console.log('reservereserve-----',reserve);
let play = (reserve && reserve.swich_voice == '1') ? '1' : '0';
let voice_info = (reserve && reserve.voice_info) ? reserve.voice_info : '';
let that = this;
let data = this.data;
App.Seller.GetVoiceWelcomeConfig({
sid
}).then((json) => {
let content = '';
// GetVoiceWelcomeConfig 返回为空且 reserve 为 0 时,使用默认语音欢迎配置兜底
if (!json.data && reserve == '0') {
json.data = {
is_voice_welcome: 1,
welcome_content: "尊敬的{客人姓名+称呼},您好!\n感谢您选择{店铺名}就餐!\n您在{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
invitee_same_as_reserver: 0,
invitee_default_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的用餐,坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
is_invitee_special_enabled: 1,
invitee_special_content: "尊敬的贵宾,您好!感谢您来到{店铺名}就餐!\n{客人姓名+称呼}预订的{年月日},{餐段}的{用餐类型},坐席位于{区域名+包间名}。\n预祝您用餐愉快,期待您的光临!",
special_reserve_types: ["生日宴"]
};
}
console.log('jsondata----',json.data);
if (json.data) {
let config = json.data;
let sameAs = config.invitee_same_as_reserver; // 不区分预订人/被请人 1不一致 0一致
let isReserver = data.options.hasSellerShare == '1';
if (config.is_voice_welcome == '0') {
content = ''
} else if (sameAs == '1' || sameAs === 1) {
content = config.welcome_content || '';
} else if (sameAs == '0' || sameAs === 0) {
if (isReserver) {
content = config.welcome_content || '';
} else {
let specialEnabled = config.is_invitee_special_enabled == '1';//为1被请人播特殊模板
let reserveType = data.detail.reserve_type || '';
let specialTypes = config.special_reserve_types || [];
let isSpecial = specialEnabled && specialTypes.indexOf(reserveType) > -1;
content = isSpecial ? (config.invitee_special_content || '') : (config.invitee_default_content || '');
}
}
} else if (play == '1') {
content = voice_info;
}
console.log('content---', content);
if (!content) {
this.setData({
newStr: '',
})
return;
}
this.setData({
isPlay: '1',
})
data.detail.rname = data.detail.rname.trim()
let str = data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 4 ? '贵宾' : '';
let charArray = data.seller.deskStr.split('');
let modifiedArray = charArray.map(char => char + ' ');
let resultString = modifiedArray.join('').slice(0, -1);
const replacements = {
"{店铺名}": data.seller.name,
"{年月日}": data.seller.yearMonthDay,
"{月日}": data.seller.yearMonth,
"{餐段}": data.seller.soltName,
"{就餐时间}": data.seller.dateStr + data.seller.dateStrDivide,
"{包间名}": resultString,
"{区域名+包间名}": data.seller.tablesText,
"{经理名字}": data.staffinfo.name,
"{客人姓名+称呼}": data.detail.rname ? (data.detail.rname + str) : str == '贵宾' ? '贵宾' : '',
"{预订日期}": data.seller.yearMonthDay,
"{桌位}": resultString,
"{客人姓名}": data.detail.rname ? data.detail.rname : '',
"{称呼}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{客人姓氏}": data.detail.rname ? data.detail.rname : '',
"{性别}": data.detail.sex == 1 ? '先生' : data.detail.sex == 2 ? '女士' : data.detail.sex == 3 ? '公司' : data.detail.sex == 4 ? '贵宾' : '',
"{用餐类型}": data.detail.reserve_type || '',
};
let newStr = content.replace(/{店铺名}|{客人姓氏}|{性别}|{预订日期}|{桌位}|{年月日}|{月日}|{餐段}|{就餐时间}|{包间名}|{区域名\+包间名}|{经理名字}|{客人姓名\+称呼}|{客人姓名}|{称呼}|{用餐类型}/g, function (matched) {
return replacements[matched];
});
console.log('newStr---', newStr);
this.setData({
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)
}
})
}).catch((err) => {
console.log('GetVoiceWelcomeConfig请求失败', err);
this.setData({
newStr: '',
})
})
},
// 开启语音播报
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() {
App.Activity.GetNewRechargeList({
... ... @@ -1304,18 +566,6 @@ Page({
}
})
},
// 选择充值活动
checkRechargeData(e) {
let id = e.currentTarget.dataset['id'];
let obj = this.data.recharge_data.filter(item => {
return item.id == id
})
if (obj && obj.length > 0) {
this.setData({
activeData: obj[0]
})
}
},
// 选择标题
checkTitleFun(e) {
console.log('e.currentTargete.currentTarget', e.currentTarget);
... ... @@ -1539,24 +789,6 @@ Page({
}
})
},
// 获取所有的券并且展示
addCoupons(coupons, couponList) {
if (coupons && util.getType(coupons) == 'object') {
couponList.push({
id: coupon.id,
number: coupon.number
});
}
if (coupons && util.getType(coupons) === 'array' && coupons.length > 0) {
coupons.forEach(item => {
couponList.push({
id: item.id,
number: item.number
});
});
}
return couponList
},
// 弹框领取免费券
setcouponFun() {
let arr = this.data.couponArr;
... ... @@ -1738,61 +970,6 @@ Page({
}
})
},
// 计算免费券有效期的起始、结束日期
setTimeRange(cdate, startOffset, endOffset) {
const startDate = new Date((cdate + startOffset * 86400) * 1000);
startDate.setHours(0, 0, 0, 0);
const useStime = util.unixtoTime(startDate.getTime() / 1000, 'YYYY-MM-DD');
const endDate = new Date((cdate + endOffset * 86400) * 1000);
endDate.setHours(23, 59, 59, 0);
const useEtime = util.unixtoTime(endDate.getTime() / 1000, 'YYYY-MM-DD');
let useEtimeNum = endDate.getTime() / 1000;
return { useStime, useEtime,useEtimeNum };
},
// 处理优惠券不可用日期数据
hasConsecutiveSelect(arr, type) {
let firstTitle = null;
let lastTitle = null;
let rArr = []
let num = 0
for (let i = 0; i < arr.length; i++) {
let str = type == '1' ? arr[i].selectMor : type == '2' ? arr[i].selectNoon : type == '3' ? arr[i].selectNig : '';
if (str) {
rArr.push(arr[i].title)
num++
if (num == 1) {
firstTitle = arr[i].title
}
if (num >= 5) {
lastTitle = arr[i].title
}
if (num >= 5 && i >= (arr.length - 1)) {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
} else {
if (num < 5) {
num = 0
firstTitle = null;
lastTitle = null;
} else {
let fi = rArr.findIndex((item) => {
return item == firstTitle
})
rArr.splice(fi, num, firstTitle + '至' + lastTitle)
num = 0
}
}
}
return {
rArr,
lastTitle,
firstTitle
};
},
/**
* 生命周期函数--监听页面隐藏
*/
... ... @@ -1812,53 +989,6 @@ Page({
this.audioCtx.destroy(); // 释放音频资源
}
},
// 设置虚拟到店时间
bindPickerChange: function (e) {
let index = e.detail.value
let temp_ddate = this.data.timeList[index]
this.setData({
temp_ddate
})
let detailInfo = this.data.detail;
const reserveDate = new Date(detailInfo.ddate * 1000);
let reserveTime =
reserveDate.getFullYear() +
"-" +
(reserveDate.getMonth() + 1) +
"-" +
reserveDate.getDate();
let times = this.getNewDate(reserveTime + " " + temp_ddate).getTime() / 1000
App.Reserve.SetReserveTempDdate({
rid: this.id,
temp_ddate: times,
}).then(res => {
if (res.ret == 200) {
let lite_style = this.data.lite_style
lite_style = lite_style || '3';
let style =lite_style.split('-');
let type1 =style[0];
let type2 =style[1];
if((type1=='2' && !type2) || (type2 && (type2 == '1' || type2 == '3') || (type1=='4' && !type2))){
let time = temp_ddate || this.data.timeList[index]
this.painterBtn(
lite_style,
time
);
}
}
})
},
// ios 部分机型不兼容new Date() 转换字符串
getNewDate(data) {
if (typeof data === 'string') {
let arr = data.split(/[- : \/]/)
if (arr[1] !== undefined || arr[1] !== null) {
arr[1] = arr[1] - 1
}
return new Date(...arr)
}
return new Date(data || new Date())
},
// 点击关闭领券弹框后,出现图片缩小到商家有礼的位置消失动画
startAnimation() {
const animation = wx.createAnimation({
... ... @@ -1883,108 +1013,4 @@ Page({
this.startSecondAnimation();
}, 800);
},
// 出现商家有礼图标,并且晃动2下
startSecondAnimation() {
const animation = wx.createAnimation({
duration: 200,
timingFunction: 'ease'
});
animation.scale(1).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(-15).step()
.rotate(15).step()
.rotate(0).step();
this.setData({
animationData2: animation.export()
});
},
//根据起始时间(获取时间时间段)
computeHour(time1, time2, interval) {
//time1 开始时间 time2结束时间 interval间隔时长
function getTimeList(time1, time2, interval) {
var timeList = [];
time1 = time1.split(":");
time2 = time2.split(":");
time1 = new Date(0, 0, 0, time1[0], time1[1], 0);
time2 = new Date(0, 0, 0, time2[0], time2[1], 0);
interval = interval * 60 * 1000;
while (time1 <= time2) {
timeList.push(time1.format("hh:mm"));
time1 = new Date(time1.getTime() + interval);
}
return timeList;
}
Date.prototype.format = function (format) {
var date = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
S: this.getMilliseconds(),
};
if (/(y+)/.test(format))
format = format.replace(
RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length)
);
for (var k in date)
if (new RegExp("(" + k + ")").test(format))
format = format.replace(
RegExp.$1,
RegExp.$1.length == 1 ?
date[k] :
("00" + date[k]).substr(("" + date[k]).length)
);
return format;
};
return getTimeList(time1, time2, interval);
},
// 模块文字、轮播图数据重组(停车、餐厅介绍、菜品、主厨)
processInfo(intel, type) {
let imgs = [];
intel.textInfo = '';
intel.imgsInfo = [];
intel.videoImgsInfo = [];
if (type == '1' && intel.is_introduce_all == '1') {
if (intel.swich_park == '1' && (intel.park_info || intel.park_info_images)) {
intel.textInfo = intel.park_info;
imgs = intel.park_info_images
}
}
if (type == '2') {
imgs = intel.images && intel.images.length > 0 && (!intel.is_images || intel.is_images !== '0') ? intel.images : [];
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce !== '0')) ? intel.introduce : '';
}
if (type == '3') {
imgs = intel.images || []
intel.textInfo = '';
}
if (type == '4') {
imgs = ((!intel.is_images || intel.is_images != '0') && intel.image) ? intel.image : []
intel.textInfo = (intel.introduce && (!intel.is_introduce || intel.is_introduce != '0')) ? intel.introduce : '';
}
intel.imgsInfo = imgs;
if (intel.content && intel.content.length > 0 && intel.is_introduce_all == '1') {
intel.textInfo = intel.content.filter(item => item.type === "2").map(item => item.content).join('\n');
intel.imgsInfo = intel.content.filter(item => item.type === "1" && item.content).map(item => item.content);
intel.videosInfo = intel.content.filter(item => (item.type === "3" && item.content));
}
return intel
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
})
\ No newline at end of file
... ...
<!--pack-invitation/pages/detail_owner_invitation11.wxml-->
<import src="../common/parts.wxml" />
<import src="../../pages/tpl/invitation"></import>
<nav hasHome class="navhome" backgroundColor="{{show_white ? colors : 'transparent'}}" place="{{false}}"></nav>
<scroll-view scroll-y class="viewBox viewBox{{bookType}}">
<image wx:if="{{newStr}}" class="musicImg" src="{{isPlay=='1'?'https://qn.colorcun.com/open.svg':'https://qn.colorcun.com/close.svg'}}" bindtap="stopMusic" animation="{{attentionAnim}}" />
<image class="giftImg {{(hasValueCertificate && marketing && coupon_dataList.length>0) && isFrame == '0' ? 'giftImg1' : '' }}"
bindtap="gotoSellerGift"
data-form="1"
animation="{{animationData2}}"
wx:if="{{(hasValueCertificate && marketing && coupon_dataList.length>0) || (is_comments=='1' && !is_user_comments && marketing.is_comments_coupon=='1' && couponData && couponData.showCoupon =='1') || (hasValueRecharge && marketing && marketing.is_recharge=='1' && recharge_data)}}"
src="https://nosqn.colorcun.com/sellerGiftTwo.png" mode=""/>
<view class="fullscreenMask" animation="{{animationData}}" wx:if="{{isShow=='1'}}">
<image src="https://qn.colorcun.com/getCouponIcon2.png" mode=""/>
</view>
<!-- 音乐开关 -->
<template is="musicImg" data="{{newStr: newStr, isPlay: isPlay, attentionAnim: attentionAnim}}" />
<!-- 商家有礼悬浮入口 -->
<template is="giftImg" data="{{hasValueCertificate: hasValueCertificate, marketing: marketing, coupon_dataList: coupon_dataList, isFrame: isFrame, is_comments: is_comments, is_user_comments: is_user_comments, couponData: couponData, hasValueRecharge: hasValueRecharge, recharge_data: recharge_data, animationData2: animationData2}}" />
<!-- 领券全屏浮层 -->
<template is="fullscreenMask" data="{{isShow: isShow, animationData: animationData}}" />
<view class="targetPoint" style="{{(bookType =='1' || bookType =='3')?'right: 4%;top: 35%;':'left: 2%;top: 27%;'}}"></view>
<image wx:if="{{detail.status =='4'}}" class="cannotImg" src="https://qn.colorcun.com/cancelImg.png" />
<image wx:if="{{options.isOrder == '1' && detail.status !='4'}}" class="cannotImg" src="https://qn.colorcun.com/overImg.png" />
<!-- 已取消/已结束 状态角标 -->
<template is="statusBadge" data="{{detail: detail, options: options}}" />
<view class="reservationInfoBox" wx:if="{{detail && detail.ddate}}">
<view class="reservationInfo reservationInfo{{make}}">
<view class="infoTop">
... ... @@ -481,13 +478,7 @@
</block>
</block>
<view class="labelBox" wx:if="{{store.content && store.content.length>0}}">
<block wx:for="{{store.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{store.imgsInfo}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video>
</view>
</block>
<template is="richText" data="{{content: store.content, imgs: store.imgsInfo, textClass: 'font28r'}}" />
</view>
</view>
<!-- 招牌菜品 -->
... ... @@ -500,13 +491,7 @@
<image src="{{item}}" bindtap="lookImgs" data-url="{{item}}" data-imgs="{{signboard.imgsInfo}}" mode="widthFix" />
</block>
<view class="labelBox" wx:if="{{signboard.content && signboard.content.length>0}}">
<block wx:for="{{signboard.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{signboard.imgsInfo}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video>
</view>
</block>
<template is="richText" data="{{content: signboard.content, imgs: signboard.imgsInfo, textClass: 'font28r'}}" />
</view>
<view class="orderBox" wx:if="{{hasValueOrder && openOrder == '1' && marketing.is_order=='1'}}">
<view class="font32r">提前点餐 到店不用等</view>
... ... @@ -530,13 +515,7 @@
</block>
</block>
<view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}">
<block wx:for="{{reserve.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{reserve.imgsInfo}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video>
</view>
</block>
<template is="richText" data="{{content: reserve.content, imgs: reserve.imgsInfo, textClass: 'font28r'}}" />
</view>
</view>
<!-- 主厨介绍 -->
... ... @@ -550,13 +529,7 @@
</view>
<image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" />
<view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}">
<block wx:for="{{chef.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" data-imgs="{{chef.imgsInfo}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font28r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video object-fit="contain" autoplay="{{true}}" loop="{{true}}" muted="{{true}}" show-mute-btn="{{true}}" vslide-gesture-in-fullscreen="{{true}}" src="{{item.content}}"></video>
</view>
</block>
<template is="richText" data="{{content: chef.content, imgs: chef.imgsInfo, textClass: 'font28r'}}" />
</view>
</view>
</block>
... ... @@ -580,21 +553,7 @@
</block>
</block>
<view class="labelBox" wx:if="{{store.content && store.content.length>0}}">
<block wx:for="{{store.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video
object-fit="contain"
autoplay="{{true}}"
loop="{{true}}"
muted="{{true}}"
show-mute-btn="{{true}}"
vslide-gesture-in-fullscreen="{{true}}"
src="{{item.content}}"
></video>
</view>
</block>
<template is="richText" data="{{content: store.content, imgs: '', textClass: 'font32r'}}" />
</view>
</view>
</block>
... ... @@ -637,21 +596,7 @@
</view>
<image wx:if="{{(!chef.is_images || chef.is_images!='0') && chef.image}}" src="{{chef.image}}" bindtap="lookImgs" data-url="{{chef.image}}" mode="widthFix" />
<view class="labelBox" wx:if="{{chef.content && chef.content.length>0}}">
<block wx:for="{{chef.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video
object-fit="contain"
autoplay="{{true}}"
loop="{{true}}"
muted="{{true}}"
show-mute-btn="{{true}}"
vslide-gesture-in-fullscreen="{{true}}"
src="{{item.content}}"
></video>
</view>
</block>
<template is="richText" data="{{content: chef.content, imgs: '', textClass: 'font32r'}}" />
</view>
</view>
</block>
... ... @@ -671,21 +616,7 @@
</block>
</block>
<view class="labelBox" wx:if="{{reserve.content && reserve.content.length>0}}">
<block wx:for="{{reserve.content}}" wx:key="index">
<image wx:if="{{item.type == '1'}}" bindtap="lookImgs" src="{{item.content}}" data-url="{{item.content}}" mode="widthFix" />
<text wx:if="{{item.type == '2'}}" space="nbsp" class="texts font32r">{{item.content}}</text>
<view wx:if="{{item.type == '3'}}" class="videoBox">
<video
object-fit="contain"
autoplay="{{true}}"
loop="{{true}}"
muted="{{true}}"
show-mute-btn="{{true}}"
vslide-gesture-in-fullscreen="{{true}}"
src="{{item.content}}"
></video>
</view>
</block>
<template is="richText" data="{{content: reserve.content, imgs: '', textClass: 'font32r'}}" />
</view>
</view>
<!-- 会员招募 -->
... ... @@ -734,68 +665,11 @@
<view class="toastBox" wx:if="{{toastBool}}">
{{toastText}}
</view>
<!-- (开启在线预订 显示在线预订) || (未开启在线预订 显示再次预订(打商家电话)) -->
<!-- (未结束&&未取消 && 开启转发开关 显示 转发邀请函给客人) || (过了当前餐段结束时间||用餐完成||已取消 显示 转发店铺给好友) -->
<view wx:if="{{isMoreBtn || options.isOrder == '1' || (!isMoreBtn && seller.phone) || (detail.status !='4' && isPaymenBtn) || (detail.status !='4' && isShareItem)}}" class="flex-lr sharewidth">
<view wx:if="{{isMoreBtn}}" class="flex-cc font30r moreBtn {{(((detail.status !='4' && isPaymenBtn) || (reserveOpenid != openid && options.isOrder != '1' && options.hasSellerShare!='1' && isShowBtn && options.isMeeting == '1')) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="secondbook">再次预订</view>
<view wx:if="{{!isMoreBtn && seller.phone}}" class="flex-cc font30r moreBtn {{((detail.status !='4' && isPaymenBtn) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="call" data-phone="{{seller.phone}}">再次预订</view>
<view wx:if="{{detail.status !='4' && isPaymenBtn}}" class="flex-cc font30r paymenBtn {{((isMoreBtn || (!isMoreBtn && seller.phone)) && ((detail.status !='4' && isShareItem) || options.isOrder == '1')) ? 'threeBtn' : ''}}" bindtap="paymentFun">支付定金</view>
<block wx:if="{{options.hasSellerShare == '1'}}">
<button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r shareItem" open-type="share">转发邀请函给客人</button>
<button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r shareItem" data-type="2" open-type="share">转发店铺给好友</button>
</block>
<block wx:if="{{options.hasSellerShare != '1'}}">
<button wx:if="{{detail.status !='4' && isShareItem}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" open-type="share">转发邀请函</button>
<button wx:if="{{options.isOrder == '1'}}" class="flex-cc font30r {{(reserveOpenid != openid && options.isOrder != '1' && isShowBtn)?'paymenBtn paymenBtn1':'shareItem shareItem1'}}" data-type="2" open-type="share">转发邀请函</button>
<block wx:if="{{wxNickname && purePhoneNumber && options.isMeeting == '1'}}">
<button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="confirmed" class="flex-cc font30r shareItem">确认赴约</button>
</block>
<block wx:if="{{(!wxNickname || !purePhoneNumber) && options.isMeeting == '1'}}">
<button wx:if="{{reserveOpenid != openid && options.isOrder != '1' && isShowBtn}}" bind:tap="gotoLogin" data-types="2" class="flex-cc font30r shareItem">确认赴约</button>
</block>
</block>
</view>
<!-- 底部操作栏 -->
<template is="actionBar" data="{{barWrapClass: 'flex-lr sharewidth', barShow: barShow, showMoreOnline: showMoreOnline, threeBtnMore: threeBtnMore, showMoreCall: showMoreCall, threeBtnCall: threeBtnCall, seller: seller, canPay: canPay, threeBtnPay: threeBtnPay, isOwner: isOwner, canShare: canShare, isOver: isOver, guestShareCls: guestShareCls, canMeet: canMeet, needLogin: needLogin}}" />
</scroll-view>
<painter palette="{{wxml}}" style="position: absolute; top: -9999rpx;" bind:imgOK="onImgOK" />
<my-modal id="payModal" fadeStyle="slideUp" height="240px">
<view slot="modalName" class="titleModal">提示</view>
<view slot="modalContent">
<view class="explain">
检测到您正在截屏,建议直接把邀请函转发给朋友更有仪式感哦!
</view>
<view class="screenshotBtns">
<button class="font32r btnsLeft" bindtap="closeModal">关闭弹窗</button>
<button wx:if="{{detail.status !='4' && options.isOrder != '1' && marketing.is_transpond=='1' && imgSrc}}" class="flex-cc font30r btnsRight" open-type="share">立即转发</button>
</view>
</view>
</my-modal>
<my-modal id="couponModal" fadeStyle="slideUp" height="240px">
<view slot="modalContent">
<view class="titleModal">
<image bindtap="closeCouponModal" class="closeImg" src="https://qn.colorcun.com/closeImg4.png" mode=""/>
<view class="nameInfo font28r">{{seller.name||reserve.seller_name}}</view>
<view class="couponTotal font28r" wx:if="{{totalPrice}}">
赠送给您代金券
<view class="counterText">
<view class="font36r">¥</view><scroll-number value="{{totalPrice}}"></scroll-number>
</view>
</view>
</view>
<view class="couponWrap">
<view class="couponInfo font48r">
<text class="font48r">到店微信扫码</text>
<text class="font48r">自动识别</text>
</view>
<block wx:if="{{!purePhoneNumber}}">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumberCouponFun" class="couponBtn font28r">欣然收下</button>
</block>
<block wx:else>
<subscribe ids="{{[2]}}" bindtap="setcouponFun">
<view class="couponBtn couponBtn1 font40r">欣然收下</view>
</subscribe>
</block>
<view class="couponText font24r" bindtap="gotoSellerGift" data-form="2">查看更多</view>
</view>
<view class="closeBox font28r">{{countDown}} 秒后自动关闭</view>
</view>
</my-modal>
\ No newline at end of file
<!-- 截屏提示弹窗 -->
<template is="payModal" data="{{detail: detail, options: options, marketing: marketing, imgSrc: imgSrc}}" />
<!-- 领券弹窗(2~12 通用;13 保持页面内独立) -->
<template is="couponModal" data="{{seller: seller, reserve: reserve, totalPrice: totalPrice, purePhoneNumber: purePhoneNumber, countDown: countDown}}" />
\ No newline at end of file
... ...