|
...
|
...
|
@@ -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 |
...
|
...
|
|