|
|
|
// pages/customer/detail_owner_invitation_new1.js
|
|
|
|
// pages/customer/detail_owner_invitation6.js
|
|
|
|
var mta = require('mta-wechat-analysis')
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
import TP from '../../utils/tpls';
|
|
|
|
import RS from '../../utils/reserveStatus'
|
|
|
|
Page({
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
options: {
|
|
|
|
tplid: ''
|
|
|
|
},
|
|
|
|
tableNum:0,
|
|
|
|
detail:{},
|
|
|
|
staffinfo:{},
|
|
|
|
between: false,
|
|
|
|
id: null,
|
|
|
|
msgTpl: '',
|
|
|
|
chef: {},
|
|
|
|
marketing: {},
|
|
|
|
home: {},
|
|
|
|
reserve: {},
|
|
|
|
signboard: {},
|
|
|
|
store: {},
|
|
|
|
recharge_data:{},
|
|
|
|
coupon_dataList:[],
|
|
|
|
homeColor: '',
|
|
|
|
stringifyUse:'',
|
|
|
|
current: 0,
|
|
|
|
theme: 'blackGold', //blue green blackGold
|
|
|
|
seller: {
|
|
|
|
name: '',
|
|
|
|
tablesText: '',
|
|
|
|
date: '',
|
|
|
|
addr: ''
|
|
|
|
},
|
|
|
|
priceInfo:'',
|
|
|
|
scoreInfo:'',
|
|
|
|
discount:'',
|
|
|
|
certificate:'',
|
|
|
|
dataStr:Date.now()*1/1000,
|
|
|
|
swich_phone:'0',
|
|
|
|
is_comments:'0',
|
|
|
|
is_user_comments:false,
|
|
|
|
StyleType:'',
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
this.id = options.id
|
|
|
|
let param = {
|
|
|
|
options: options,
|
|
|
|
hasOwner: options.hasSellerShare == 1, //是否为发起人
|
|
|
|
}
|
|
|
|
param.tpls = [TP.tpls(options.tplid)]
|
|
|
|
console.log(param);
|
|
|
|
console.log(options);
|
|
|
|
this.setData(param)
|
|
|
|
mta.Page.init({
|
|
|
|
"appID": "500667280",
|
|
|
|
"eventID": "500667287",
|
|
|
|
"statPullDownFresh": true,
|
|
|
|
"statShareApp": true,
|
|
|
|
"statReachBottom": true,
|
|
|
|
"lauchOpts": options, //渠道分析
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
options: {
|
|
|
|
tplid: ''
|
|
|
|
},
|
|
|
|
tableNum: 0,
|
|
|
|
detail: {},
|
|
|
|
staffinfo: {},
|
|
|
|
between: false,
|
|
|
|
id: null,
|
|
|
|
msgTpl: '',
|
|
|
|
chef: {},
|
|
|
|
marketing: {},
|
|
|
|
home: {},
|
|
|
|
reserve: {},
|
|
|
|
signboard: {},
|
|
|
|
store: {},
|
|
|
|
recharge_data: {},
|
|
|
|
coupon_dataList: [],
|
|
|
|
homeColor: '',
|
|
|
|
stringifyUse: '',
|
|
|
|
current: 0,
|
|
|
|
theme: 'blackGold', //blue green blackGold
|
|
|
|
seller: {
|
|
|
|
name: '',
|
|
|
|
tablesText: '',
|
|
|
|
date: '',
|
|
|
|
addr: ''
|
|
|
|
},
|
|
|
|
priceInfo: '',
|
|
|
|
scoreInfo: '',
|
|
|
|
discount: '',
|
|
|
|
certificate: '',
|
|
|
|
dataStr: Date.now() * 1 / 1000,
|
|
|
|
swich_phone: '0',
|
|
|
|
is_comments: '0',
|
|
|
|
is_user_comments: false,
|
|
|
|
StyleType: '',
|
|
|
|
showMoreTip: true,
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
this.id = options.id
|
|
|
|
let param = {
|
|
|
|
options: options,
|
|
|
|
hasOwner: options.hasSellerShare == 1, //是否为发起人
|
|
|
|
}
|
|
|
|
param.tpls = [TP.tpls(options.tplid)]
|
|
|
|
console.log(param);
|
|
|
|
console.log(options);
|
|
|
|
this.setData(param)
|
|
|
|
mta.Page.init({
|
|
|
|
"appID": "500667280",
|
|
|
|
"eventID": "500667287",
|
|
|
|
"statPullDownFresh": true,
|
|
|
|
"statShareApp": true,
|
|
|
|
"statReachBottom": true,
|
|
|
|
"lauchOpts": options, //渠道分析
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onPageScroll: function (event) {
|
|
|
|
let that = this;
|
|
|
|
// 获取滚动条的位置
|
|
|
|
var scrollTop = event.scrollTop;
|
|
|
|
// 获取屏幕的高度
|
|
|
|
wx.getSystemInfo({
|
|
|
|
success(res) {
|
|
|
|
var screenHeight = res.windowHeight;
|
|
|
|
if (scrollTop > screenHeight || scrollTop < 10) {
|
|
|
|
that.setData({
|
|
|
|
showMoreTip: true
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
that.setData({
|
|
|
|
showMoreTip: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
// 点击了解更多会员优惠政策
|
|
|
|
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')
|
|
|
|
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
|
|
|
|
url
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 去评价
|
|
|
|
evaluateFun(){
|
|
|
|
let url=util.http_build_query({
|
|
|
|
sellerName:this.data.seller.name,
|
|
|
|
sellerid:this.data.seller.sid,
|
|
|
|
oid:this.data.detail.id,
|
|
|
|
types:'1',
|
|
|
|
},'/pages/pinglun/createOpinion')
|
|
|
|
},
|
|
|
|
// 去评价
|
|
|
|
evaluateFun() {
|
|
|
|
let url = util.http_build_query({
|
|
|
|
sellerName: this.data.seller.name,
|
|
|
|
sellerid: this.data.seller.sid,
|
|
|
|
oid: this.data.detail.id,
|
|
|
|
types: '1',
|
|
|
|
}, '/pages/pinglun/createOpinion')
|
|
|
|
wx.navigateTo({
|
|
|
|
url
|
|
|
|
url
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
return this.sharesetting();
|
|
|
|
},
|
|
|
|
onShareTimeline() {
|
|
|
|
return this.sharesetting();
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
this.getDetail()
|
|
|
|
},
|
|
|
|
cli() {
|
|
|
|
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('无微信号')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
call() {
|
|
|
|
wx.reportMonitor('1012', 1)
|
|
|
|
wx.makePhoneCall({
|
|
|
|
phoneNumber: this.data.staffinfo.phone
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getDetail() {
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.data.options.id
|
|
|
|
}).then(res => {
|
|
|
|
let tablesText = '', //桌子信息
|
|
|
|
tableNum =0;
|
|
|
|
res.data.tables.forEach((t,i) => {
|
|
|
|
tableNum+=t.table_pnum*1
|
|
|
|
tablesText+=t.rname+t.name+(i==(res.data.tables.length-1)?'':'、');
|
|
|
|
})
|
|
|
|
let reserev = RS.reserve(res.data)
|
|
|
|
let dateSmart
|
|
|
|
if (res.data.type == 1) {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[0])
|
|
|
|
if (res.data.is_set_ddate == 1) {
|
|
|
|
dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[1])
|
|
|
|
} else {
|
|
|
|
dateSmart += ' ' + reserev.soltName
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
detail: this.formatDatail(reserev, dateSmart),
|
|
|
|
tableNum,
|
|
|
|
is_user_comments:res.data.is_user_comments,
|
|
|
|
seller: {
|
|
|
|
name: reserev.seller.sellername,
|
|
|
|
sid:reserev.sid,
|
|
|
|
date: dateSmart,
|
|
|
|
tablesText,
|
|
|
|
addr: reserev.seller.real_address || reserev.seller.map_address,
|
|
|
|
image: reserev.image_url,
|
|
|
|
hasOwner: true,
|
|
|
|
type: reserev.type,
|
|
|
|
is_set_ddate: reserev.is_set_ddate,
|
|
|
|
hasUpTime: reserev.type == 1 && reserev.hasRunning && reserev.status != 2,
|
|
|
|
tel: reserev.seller.seller_tel.split(',')[0],
|
|
|
|
soltName: reserev.soltName,
|
|
|
|
lat:reserev.seller.lat,
|
|
|
|
long:reserev.seller.long,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
console.log('reserev reserev',reserev);
|
|
|
|
console.log('seller seller',this.data.seller);
|
|
|
|
console.log('detail detail',this.data.detail);
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getSellerTemplateConfFun(reserev.sid);
|
|
|
|
this.getstaffinfo(res.data.uid)
|
|
|
|
}, 0);
|
|
|
|
}).catch(res=>{
|
|
|
|
console.log(res,'详情请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getstaffinfo(uid){
|
|
|
|
console.log('sellerid',this.data.detail.seller.id);
|
|
|
|
App.Activity.GetCustomerActivityBaseinfo({
|
|
|
|
sellerid:this.data.detail.seller.id,
|
|
|
|
uid
|
|
|
|
}).then((json)=>{
|
|
|
|
if(json.ret==200) {
|
|
|
|
console.log('staffinfostaffinfostaffinfo', json.data)
|
|
|
|
this.setData({
|
|
|
|
staffinfo:json.data
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
cookbook() {
|
|
|
|
if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
|
|
|
|
let data = {
|
|
|
|
rid: this.id,
|
|
|
|
oid: this.data.detail.order.id,
|
|
|
|
sellerName: this.data.seller.name,
|
|
|
|
sid: this.data.seller.sid,
|
|
|
|
identity: '1',
|
|
|
|
hasSuccess:'1',
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
App.Advance.CreateOrder({
|
|
|
|
rid: this.id,
|
|
|
|
openid: getApp().openid,
|
|
|
|
}).then(res => {
|
|
|
|
if (res.ret != 200) {
|
|
|
|
return util.toast(res.msg, 'none')
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: util.http_build_query({
|
|
|
|
rid: this.id,
|
|
|
|
oid: res.data.id,
|
|
|
|
sid: res.data.sellerid,
|
|
|
|
sellerName: this.data.seller.name,
|
|
|
|
identity: '1',
|
|
|
|
}, '/pack-cookbook/pages/index_new')
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sharesetting() {
|
|
|
|
wx.reportMonitor('1017', 1)
|
|
|
|
let parmdata = {
|
|
|
|
id: this.id,
|
|
|
|
fromid: getApp().openid,
|
|
|
|
hasInvitation: 1,
|
|
|
|
tplid: this.data.options.tplid
|
|
|
|
}
|
|
|
|
if (this.data.options.uid) {
|
|
|
|
parmdata.uid = this.data.options.uid;
|
|
|
|
}
|
|
|
|
console.log('seller_imageseller_imageseller_imageseller_imageseller_image',this.data.detail.seller.seller_image);
|
|
|
|
return {
|
|
|
|
title: '邀请您于'+this.data.seller.date+'一起共进'+this.data.seller.soltName+'。点击查看详情',
|
|
|
|
path: util.http_build_query(parmdata, '/pages/customer/index'),
|
|
|
|
imageUrl: this.data.detail.seller.seller_image,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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 ? '包间' : '');
|
|
|
|
}
|
|
|
|
if (detail.rname && detail.sex != 3) {
|
|
|
|
detail.rnameStr = detail.rname.substr(0, 1) + (detail.sex == 1 ? '先生' : '女士')
|
|
|
|
} 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;
|
|
|
|
},
|
|
|
|
getSellerTemplateConfFun(sid) {
|
|
|
|
console.log(sid,'sidsidsidsid');
|
|
|
|
App.Seller.GetSellerTemplateConf({
|
|
|
|
sid
|
|
|
|
}).then(res => {
|
|
|
|
let data=res.data
|
|
|
|
console.log('data',data);
|
|
|
|
let coupon_dataList=[]
|
|
|
|
let home,chef,marketing,coupon,reserve,swich_phone,is_comments,signboard,store,homeColor,priceInfo,certificate,scoreInfo,recharge_list,stringifyUse;
|
|
|
|
chef = util.determine(data.chef);
|
|
|
|
reserve = util.determine(data.reserve);
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
signboard = util.determine(data.signboard);
|
|
|
|
store = util.determine(data.store);
|
|
|
|
home = util.determine(data.home);
|
|
|
|
swich_phone = reserve && reserve.swich_phone?reserve.swich_phone:'';
|
|
|
|
if(marketing){
|
|
|
|
is_comments = marketing.is_comments?marketing.is_comments:'';
|
|
|
|
coupon=marketing.coupon_data?util.determine(marketing.coupon_data):'';
|
|
|
|
}
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if(coupon && util.getType(coupon)=='object'){
|
|
|
|
coupon.stringifyUse=JSON.stringify(coupon.use)
|
|
|
|
if(marketing.is_coupon=='1' && coupon && (!coupon.use.is_cash || coupon.use.is_cash=='1')){
|
|
|
|
let cash=coupon.use.cash*1;
|
|
|
|
let price=coupon.price*1;
|
|
|
|
console.log('cash',cash+'---'+'price',price+'---'+'discount',((price/cash)*10).toFixed(2));
|
|
|
|
coupon.discount=cash!=0?((price/cash)*10).toFixed(2):'';
|
|
|
|
}
|
|
|
|
coupon_dataList.push(coupon);
|
|
|
|
}
|
|
|
|
if(coupon && util.getType(coupon)=='array'){
|
|
|
|
if(coupon.length>0){
|
|
|
|
coupon.forEach(item=>{
|
|
|
|
item.stringifyUse=JSON.stringify(item.use)
|
|
|
|
if((!item.use.is_cash || item.use.is_cash=='1')){
|
|
|
|
let cash=item.use.cash*1;
|
|
|
|
let price=item.price*1;
|
|
|
|
console.log('cash',cash+'---'+'price',price+'---'+'discount',((price/cash)*10).toFixed(2));
|
|
|
|
item.discount=cash!=0?((price/cash)*10).toFixed(2):'';
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
coupon_dataList=coupon;
|
|
|
|
}
|
|
|
|
let obj={
|
|
|
|
chef,
|
|
|
|
reserve,
|
|
|
|
marketing,
|
|
|
|
signboard,
|
|
|
|
store,
|
|
|
|
home,
|
|
|
|
stringifyUse,
|
|
|
|
coupon,
|
|
|
|
coupon_dataList,
|
|
|
|
swich_phone,
|
|
|
|
is_comments,
|
|
|
|
StyleType:res.data.type,
|
|
|
|
}
|
|
|
|
console.log('获取数据', {...obj});
|
|
|
|
if(marketing && marketing.is_recharge=='1' && marketing.recharge_data){
|
|
|
|
let recharge_data=marketing.recharge_data
|
|
|
|
recharge_list=marketing.recharge_data.recharge_list
|
|
|
|
if(recharge_list.is_price=='1') priceInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.price+'元余额';
|
|
|
|
if(recharge_list.is_score=='1') scoreInfo='会员充值满'+recharge_data.recharge_money+'元赠送'+recharge_list.score+'积分';
|
|
|
|
if(recharge_list.is_coupons=='1' && recharge_data.recharge_list.coupons_names.length>0) certificate=recharge_data.recharge_list.coupons_names.join('、');
|
|
|
|
console.log('scoreInfo',scoreInfo);
|
|
|
|
console.log('priceInfo',priceInfo);
|
|
|
|
this.setData({
|
|
|
|
recharge_data:marketing.recharge_data,
|
|
|
|
certificate
|
|
|
|
})
|
|
|
|
console.log('recharge_data',recharge_data);
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
coupon_dataList,
|
|
|
|
stringifyUse
|
|
|
|
})
|
|
|
|
if(store && store.images.length>0) store.images =util.determine(store.images);
|
|
|
|
if(signboard && signboard.images) signboard.images = util.determine(signboard.images);
|
|
|
|
if (marketing && marketing.is_online_book=='1' && marketing.is_transpond =='1') {
|
|
|
|
this.setData({
|
|
|
|
between: true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(home && home.red && home.green && home.blue && home.alpha){
|
|
|
|
homeColor=home.red + ',' + home.green + ',' + home.blue + ',' + home.alpha
|
|
|
|
}else{
|
|
|
|
homeColor ='67,142,147,1'
|
|
|
|
}
|
|
|
|
console.log('homeColor',homeColor);
|
|
|
|
this.setData({
|
|
|
|
chef,
|
|
|
|
marketing,
|
|
|
|
home,
|
|
|
|
reserve,
|
|
|
|
signboard,
|
|
|
|
store,
|
|
|
|
homeColor, //home主题颜色
|
|
|
|
priceInfo,
|
|
|
|
scoreInfo,
|
|
|
|
swich_phone,
|
|
|
|
is_comments,
|
|
|
|
StyleType:res.data.type,
|
|
|
|
})
|
|
|
|
if (home && home.red == '1' && home.green == '67' && home.blue == '163') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'blue'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (home && home.red == '67' && home.green == '142' && home.blue == '147') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'green'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (home && home.red == '12' && home.green == '15' && home.blue == '14') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'blackGold'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}).catch(res=>{
|
|
|
|
this.setData({
|
|
|
|
theme:'green',
|
|
|
|
homeColor:'67,142,147,1'
|
|
|
|
})
|
|
|
|
console.log(this.data.homeColor,'GetSellerTemplateConf请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 再次预订
|
|
|
|
secondbook() {
|
|
|
|
wx.reportMonitor('1013', 1)
|
|
|
|
wx.redirectTo({
|
|
|
|
url: '../reserve/detail?id=' + this.data.detail.seller.id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
return this.sharesetting();
|
|
|
|
},
|
|
|
|
onShareTimeline() {
|
|
|
|
return this.sharesetting();
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
this.getDetail()
|
|
|
|
},
|
|
|
|
cli() {
|
|
|
|
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('无微信号')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
call() {
|
|
|
|
wx.reportMonitor('1012', 1)
|
|
|
|
wx.makePhoneCall({
|
|
|
|
phoneNumber: this.data.staffinfo.phone
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getDetail() {
|
|
|
|
App.Reserve.Detail({
|
|
|
|
openid: getApp().openid,
|
|
|
|
rid: this.data.options.id
|
|
|
|
}).then(res => {
|
|
|
|
let tablesText = '', //桌子信息
|
|
|
|
tableNum = 0;
|
|
|
|
res.data.tables.forEach((t, i) => {
|
|
|
|
tableNum += t.table_pnum * 1
|
|
|
|
tablesText += t.rname + t.name + (i == (res.data.tables.length - 1) ? '' : '、');
|
|
|
|
})
|
|
|
|
let reserev = RS.reserve(res.data)
|
|
|
|
let dateSmart
|
|
|
|
if (res.data.type == 1) {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[0])
|
|
|
|
if (res.data.is_set_ddate == 1) {
|
|
|
|
dateSmart += ' ' + util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStrSmart[1])
|
|
|
|
} else {
|
|
|
|
dateSmart += ' ' + reserev.soltName
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dateSmart = util.unixtoTime(reserev.ddate, this.data.tpls[this.data.current].timeStr)
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
detail: this.formatDatail(reserev, dateSmart),
|
|
|
|
tableNum,
|
|
|
|
is_user_comments: res.data.is_user_comments,
|
|
|
|
seller: {
|
|
|
|
name: reserev.seller.sellername,
|
|
|
|
sid: reserev.sid,
|
|
|
|
date: dateSmart,
|
|
|
|
tablesText,
|
|
|
|
addr: reserev.seller.real_address || reserev.seller.map_address,
|
|
|
|
image: reserev.image_url,
|
|
|
|
hasOwner: true,
|
|
|
|
type: reserev.type,
|
|
|
|
is_set_ddate: reserev.is_set_ddate,
|
|
|
|
hasUpTime: reserev.type == 1 && reserev.hasRunning && reserev.status != 2,
|
|
|
|
tel: reserev.seller.seller_tel.split(',')[0],
|
|
|
|
soltName: reserev.soltName,
|
|
|
|
lat: reserev.seller.lat,
|
|
|
|
long: reserev.seller.long,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
console.log('reserev reserev', reserev);
|
|
|
|
console.log('seller seller', this.data.seller);
|
|
|
|
console.log('detail detail', this.data.detail);
|
|
|
|
setTimeout(() => {
|
|
|
|
this.getSellerTemplateConfFun(reserev.sid);
|
|
|
|
this.getstaffinfo(res.data.uid)
|
|
|
|
}, 0);
|
|
|
|
}).catch(res => {
|
|
|
|
console.log(res, '详情请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getstaffinfo(uid) {
|
|
|
|
console.log('sellerid', this.data.detail.seller.id);
|
|
|
|
App.Activity.GetCustomerActivityBaseinfo({
|
|
|
|
sellerid: this.data.detail.seller.id,
|
|
|
|
uid
|
|
|
|
}).then((json) => {
|
|
|
|
if (json.ret == 200) {
|
|
|
|
console.log('staffinfostaffinfostaffinfo', json.data)
|
|
|
|
this.setData({
|
|
|
|
staffinfo: json.data
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
cookbook() {
|
|
|
|
if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
|
|
|
|
let data = {
|
|
|
|
rid: this.id,
|
|
|
|
oid: this.data.detail.order.id,
|
|
|
|
sellerName: this.data.seller.name,
|
|
|
|
sid: this.data.seller.sid,
|
|
|
|
identity: '1',
|
|
|
|
hasSuccess: '1',
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/pack-cookbook/pages/success_new?hasSuccess=${data.hasSuccess}&identity=${data.identity}&oid=${data.oid}&rid=${data.rid}&sellerName=${data.sellerName}&sid=${data.sid}`,
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
App.Advance.CreateOrder({
|
|
|
|
rid: this.id,
|
|
|
|
openid: getApp().openid,
|
|
|
|
}).then(res => {
|
|
|
|
if (res.ret != 200) {
|
|
|
|
return util.toast(res.msg, 'none')
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: util.http_build_query({
|
|
|
|
rid: this.id,
|
|
|
|
oid: res.data.id,
|
|
|
|
sid: res.data.sellerid,
|
|
|
|
sellerName: this.data.seller.name,
|
|
|
|
identity: '1',
|
|
|
|
}, '/pack-cookbook/pages/index_new')
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
sharesetting() {
|
|
|
|
wx.reportMonitor('1017', 1)
|
|
|
|
let parmdata = {
|
|
|
|
id: this.id,
|
|
|
|
fromid: getApp().openid,
|
|
|
|
hasInvitation: 1,
|
|
|
|
tplid: this.data.options.tplid
|
|
|
|
}
|
|
|
|
if (this.data.options.uid) {
|
|
|
|
parmdata.uid = this.data.options.uid;
|
|
|
|
}
|
|
|
|
console.log('seller_imageseller_imageseller_imageseller_imageseller_image', this.data.detail.seller.seller_image);
|
|
|
|
return {
|
|
|
|
title: '邀请您于' + this.data.seller.date + '一起共进' + this.data.seller.soltName + '。点击查看详情',
|
|
|
|
path: util.http_build_query(parmdata, '/pages/customer/index'),
|
|
|
|
imageUrl: this.data.detail.seller.seller_image,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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 ? '包间' : '');
|
|
|
|
}
|
|
|
|
if (detail.rname && detail.sex != 3) {
|
|
|
|
detail.rnameStr = detail.rname.substr(0, 1) + (detail.sex == 1 ? '先生' : '女士')
|
|
|
|
} 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;
|
|
|
|
},
|
|
|
|
getSellerTemplateConfFun(sid) {
|
|
|
|
console.log(sid, 'sidsidsidsid');
|
|
|
|
App.Seller.GetSellerTemplateConf({
|
|
|
|
sid
|
|
|
|
}).then(res => {
|
|
|
|
let data = res.data
|
|
|
|
console.log('data', data);
|
|
|
|
let coupon_dataList = []
|
|
|
|
let home, chef, marketing, coupon, reserve, swich_phone, is_comments, signboard, store, homeColor, priceInfo, certificate, scoreInfo, recharge_list, stringifyUse;
|
|
|
|
chef = util.determine(data.chef);
|
|
|
|
reserve = util.determine(data.reserve);
|
|
|
|
marketing = util.determine(data.marketing);
|
|
|
|
signboard = util.determine(data.signboard);
|
|
|
|
store = util.determine(data.store);
|
|
|
|
home = util.determine(data.home);
|
|
|
|
swich_phone = reserve && reserve.swich_phone ? reserve.swich_phone : '';
|
|
|
|
if (marketing) {
|
|
|
|
is_comments = marketing.is_comments ? marketing.is_comments : '';
|
|
|
|
coupon = marketing.coupon_data ? util.determine(marketing.coupon_data) : '';
|
|
|
|
}
|
|
|
|
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
|
|
|
|
if (coupon && util.getType(coupon) == 'object') {
|
|
|
|
coupon.stringifyUse = JSON.stringify(coupon.use)
|
|
|
|
if (marketing.is_coupon == '1' && coupon && (!coupon.use.is_cash || coupon.use.is_cash == '1')) {
|
|
|
|
let cash = coupon.use.cash * 1;
|
|
|
|
let price = coupon.price * 1;
|
|
|
|
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(2));
|
|
|
|
coupon.discount = cash != 0 ? ((price / cash) * 10).toFixed(2) : '';
|
|
|
|
}
|
|
|
|
coupon_dataList.push(coupon);
|
|
|
|
}
|
|
|
|
if (coupon && util.getType(coupon) == 'array') {
|
|
|
|
if (coupon.length > 0) {
|
|
|
|
coupon.forEach(item => {
|
|
|
|
item.stringifyUse = JSON.stringify(item.use)
|
|
|
|
if ((!item.use.is_cash || item.use.is_cash == '1')) {
|
|
|
|
let cash = item.use.cash * 1;
|
|
|
|
let price = item.price * 1;
|
|
|
|
console.log('cash', cash + '---' + 'price', price + '---' + 'discount', ((price / cash) * 10).toFixed(2));
|
|
|
|
item.discount = cash != 0 ? ((price / cash) * 10).toFixed(2) : '';
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
coupon_dataList = coupon;
|
|
|
|
}
|
|
|
|
let obj = {
|
|
|
|
chef,
|
|
|
|
reserve,
|
|
|
|
marketing,
|
|
|
|
signboard,
|
|
|
|
store,
|
|
|
|
home,
|
|
|
|
stringifyUse,
|
|
|
|
coupon,
|
|
|
|
coupon_dataList,
|
|
|
|
swich_phone,
|
|
|
|
is_comments,
|
|
|
|
StyleType: res.data.type,
|
|
|
|
}
|
|
|
|
console.log('获取数据', {
|
|
|
|
...obj
|
|
|
|
});
|
|
|
|
if (marketing && marketing.is_recharge == '1' && marketing.recharge_data) {
|
|
|
|
let recharge_data = marketing.recharge_data
|
|
|
|
recharge_list = marketing.recharge_data.recharge_list
|
|
|
|
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
|
|
|
|
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
|
|
|
|
if (recharge_list.is_coupons == '1' && recharge_data.recharge_list.coupons_names.length > 0) certificate = recharge_data.recharge_list.coupons_names.join('、');
|
|
|
|
console.log('scoreInfo', scoreInfo);
|
|
|
|
console.log('priceInfo', priceInfo);
|
|
|
|
this.setData({
|
|
|
|
recharge_data: marketing.recharge_data,
|
|
|
|
certificate
|
|
|
|
})
|
|
|
|
console.log('recharge_data', recharge_data);
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
coupon_dataList,
|
|
|
|
stringifyUse
|
|
|
|
})
|
|
|
|
if (store && store.images.length > 0) store.images = util.determine(store.images);
|
|
|
|
if (signboard && signboard.images) signboard.images = util.determine(signboard.images);
|
|
|
|
if (marketing && marketing.is_online_book == '1' && marketing.is_transpond == '1') {
|
|
|
|
this.setData({
|
|
|
|
between: true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (home && home.red && home.green && home.blue && home.alpha) {
|
|
|
|
homeColor = home.red + ',' + home.green + ',' + home.blue + ',' + home.alpha
|
|
|
|
} else {
|
|
|
|
homeColor = '67,142,147,1'
|
|
|
|
}
|
|
|
|
console.log('homeColor', homeColor);
|
|
|
|
this.setData({
|
|
|
|
chef,
|
|
|
|
marketing,
|
|
|
|
home,
|
|
|
|
reserve,
|
|
|
|
signboard,
|
|
|
|
store,
|
|
|
|
homeColor, //home主题颜色
|
|
|
|
priceInfo,
|
|
|
|
scoreInfo,
|
|
|
|
swich_phone,
|
|
|
|
is_comments,
|
|
|
|
StyleType: res.data.type,
|
|
|
|
})
|
|
|
|
if (home && home.red == '1' && home.green == '67' && home.blue == '163') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'blue'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (home && home.red == '67' && home.green == '142' && home.blue == '147') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'green'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if (home && home.red == '12' && home.green == '15' && home.blue == '14') {
|
|
|
|
this.setData({
|
|
|
|
theme: 'blackGold'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}).catch(res => {
|
|
|
|
this.setData({
|
|
|
|
theme: 'green',
|
|
|
|
homeColor: '67,142,147,1'
|
|
|
|
})
|
|
|
|
console.log(this.data.homeColor, 'GetSellerTemplateConf请求失败');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 再次预订
|
|
|
|
secondbook() {
|
|
|
|
wx.reportMonitor('1013', 1)
|
|
|
|
wx.redirectTo({
|
|
|
|
url: '../reserve/detail?id=' + this.data.detail.seller.id
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|