|
|
|
// pages/reserve/share.js
|
|
|
|
import util from '../../utils/util';
|
|
|
|
import App from '../../utils/api';
|
|
|
|
const {regeneratorRuntime} = global
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
seller:{},
|
|
|
|
paletteImageSrc:'',
|
|
|
|
palette:null,
|
|
|
|
hasLoadData:false,
|
|
|
|
act:'',
|
|
|
|
hasActName:'',
|
|
|
|
hasSellerShare:false,
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.options=options;
|
|
|
|
this.setData({
|
|
|
|
actType:options.act,
|
|
|
|
hasSellerShare:options.hasSellerShare||false,
|
|
|
|
})
|
|
|
|
this.GetSellerDetail();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
GetSellerDetail(){
|
|
|
|
let options=this.options
|
|
|
|
App.Customer.GetSellerDetail({
|
|
|
|
sid:options.id,
|
|
|
|
}).then(async res=>{
|
|
|
|
if(res.ret==200){
|
|
|
|
let seller=res.data
|
|
|
|
console.log('App',App)
|
|
|
|
let openid=await getApp().getOpenid()
|
|
|
|
let qrcode=await App.Other.generate_qrcode({
|
|
|
|
tpl_id: 25415,
|
|
|
|
code_type: 'wxcode',
|
|
|
|
'param_value[0]':options.id,
|
|
|
|
'param_value[1]':openid,
|
|
|
|
'param_value[2]':this.options.hasSellerShare
|
|
|
|
});
|
|
|
|
this.setData({
|
|
|
|
seller:seller,
|
|
|
|
qrcode:qrcode.data.replace('http://','https://'),
|
|
|
|
hasLoadData:true,
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.initImage()
|
|
|
|
},0);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initImage(){
|
|
|
|
let palette={}
|
|
|
|
if(this.options.act=='quanzi'){
|
|
|
|
let seller=this.data.seller
|
|
|
|
let pw=getApp().system.windowWidth-20;
|
|
|
|
let ph=pw/355*558;
|
|
|
|
let tagsHeight=60//rpx
|
|
|
|
if(seller.activity.length==0){
|
|
|
|
ph=pw/355*500;
|
|
|
|
}
|
|
|
|
let cai_jiu_bao=[]//菜酒包
|
|
|
|
if(seller.cate.length>0){
|
|
|
|
cai_jiu_bao.push(seller.cate[0])
|
|
|
|
}
|
|
|
|
cai_jiu_bao.push(seller.is_belt_wine==1?'不可带酒水':'可自带酒水');
|
|
|
|
if(seller.room_num>0){
|
|
|
|
cai_jiu_bao.push(seller.room_num+'个包间')
|
|
|
|
}
|
|
|
|
cai_jiu_bao=cai_jiu_bao.join(' | ')
|
|
|
|
let tags=[];
|
|
|
|
tags=tags.join(' | ')
|
|
|
|
if(!tags){
|
|
|
|
ph=ph-tagsHeight/2
|
|
|
|
tagsHeight=0
|
|
|
|
}
|
|
|
|
let share_image=seller.share_image
|
|
|
|
.replace('http://','https://')
|
|
|
|
+'?imageView2/1/w/750/h/500/q/100'
|
|
|
|
console.log('share_image:',share_image)
|
|
|
|
palette={
|
|
|
|
background: '#fff',
|
|
|
|
width: pw+'px',
|
|
|
|
height: ph+'px',
|
|
|
|
views: [
|
|
|
|
{
|
|
|
|
type:'image',
|
|
|
|
url:share_image,
|
|
|
|
css:{
|
|
|
|
width:pw+'px',
|
|
|
|
height:470+'rpx',
|
|
|
|
mode:'aspectFill'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: seller.sellername,
|
|
|
|
id:'seller-name',
|
|
|
|
css:{
|
|
|
|
fontSize:'36rpx',
|
|
|
|
color:'#353535',
|
|
|
|
top:520+'rpx',
|
|
|
|
left:'30rpx',
|
|
|
|
fontWeight:'bold',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: seller.rank,
|
|
|
|
css:{
|
|
|
|
fontSize:'20rpx',
|
|
|
|
color:'#ffffff',
|
|
|
|
top:531+'rpx',
|
|
|
|
left:['60rpx', 'seller-name', 1] ,
|
|
|
|
background:'#F57E32',
|
|
|
|
padding:'2rpx 8rpx',
|
|
|
|
lineHeight:'28rpx'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: cai_jiu_bao,
|
|
|
|
css:{
|
|
|
|
fontSize:'26rpx',
|
|
|
|
color:'#999999',
|
|
|
|
top: '578rpx',
|
|
|
|
left: '30rpx',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: tags,
|
|
|
|
css:{
|
|
|
|
fontSize:'22rpx',
|
|
|
|
color:'#C0A369',
|
|
|
|
top: '638rpx',
|
|
|
|
left: '42rpx',
|
|
|
|
background:'#FFEFDF',
|
|
|
|
lineHeight:'28rpx',
|
|
|
|
padding:'10rpx 12rpx',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'rect',
|
|
|
|
css:{
|
|
|
|
color:'#F5F5F5',
|
|
|
|
top:(634+tagsHeight)+'rpx',
|
|
|
|
left:'30rpx',
|
|
|
|
width:(pw-30)+'px',
|
|
|
|
height:'1px'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/*
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: "陕西风味面馆",
|
|
|
|
css:{
|
|
|
|
fontSize:'14px',
|
|
|
|
color:'#f00',
|
|
|
|
background:'#ff0',
|
|
|
|
padding:'8px 20px',
|
|
|
|
top:(480*(getApp().system.windowWidth/600)+20)+'px',
|
|
|
|
left:'16px',
|
|
|
|
lineHeight:'18px'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'rect',
|
|
|
|
css:{
|
|
|
|
color:'rgba(0,0,0,0.5)',
|
|
|
|
top:(480*(getApp().system.windowWidth/600)+12)+'px',
|
|
|
|
left:'0px',
|
|
|
|
width:'320px',
|
|
|
|
height:'34px'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
type: 'image',
|
|
|
|
url: this.data.qrcode,
|
|
|
|
css: {
|
|
|
|
bottom: '112rpx',
|
|
|
|
left: (pw / 2) + 'px',
|
|
|
|
width: '140rpx',
|
|
|
|
height: '140rpx',
|
|
|
|
align: 'center',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type:'text',
|
|
|
|
text: '长按或扫描二维码,预订、导航',
|
|
|
|
css:{
|
|
|
|
fontSize:'22rpx',
|
|
|
|
color:'#999999',
|
|
|
|
bottom: '50rpx',
|
|
|
|
left: (pw / 2) + 'px',
|
|
|
|
align: 'center',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
if(seller.activity.length>0){
|
|
|
|
//活动
|
|
|
|
let activity=[];
|
|
|
|
seller.activity.forEach(act=>{
|
|
|
|
activity.push(act.title)
|
|
|
|
})
|
|
|
|
activity='活动: '+activity.join(' | ')
|
|
|
|
palette.views.push({
|
|
|
|
type:'text',
|
|
|
|
text: activity,
|
|
|
|
css:{
|
|
|
|
fontSize:'30rpx',
|
|
|
|
color:'#353535',
|
|
|
|
top: (676+tagsHeight)+'rpx',
|
|
|
|
left: '30rpx',
|
|
|
|
lineHeight:'38rpx',
|
|
|
|
maxLines:1,
|
|
|
|
width:(pw-30)+'px',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
palette.views.push({
|
|
|
|
type:'rect',
|
|
|
|
css:{
|
|
|
|
color:'#F5F5F5',
|
|
|
|
top:(754+tagsHeight)+'rpx',
|
|
|
|
left:'30rpx',
|
|
|
|
width:(pw-30)+'px',
|
|
|
|
height:'1px'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
palette={
|
|
|
|
background: '#fff',
|
|
|
|
width: '400rpx',
|
|
|
|
height: '400rpx',
|
|
|
|
views: [
|
|
|
|
{
|
|
|
|
type: 'image',
|
|
|
|
url: this.data.qrcode,
|
|
|
|
css: {
|
|
|
|
mode:'scaleToFill',
|
|
|
|
width: '400rpx',
|
|
|
|
height: '400rpx',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setData({
|
|
|
|
palette:palette
|
|
|
|
})
|
|
|
|
},
|
|
|
|
onImgOK(e){
|
|
|
|
console.log('onImgOK',e.detail.path)
|
|
|
|
wx.getImageInfo({
|
|
|
|
src:e.detail.path,
|
|
|
|
success:res=>{
|
|
|
|
let w=getApp().system.windowWidth-24
|
|
|
|
console.log('getImageInfo',res)
|
|
|
|
this.setData({
|
|
|
|
paletteImageWidth:w,
|
|
|
|
paletteImageHeight:w/res.width*res.height,
|
|
|
|
paletteImageSrc:e.detail.path,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
reviewImage(){
|
|
|
|
wx.previewImage({
|
|
|
|
urls:[this.data.paletteImageSrc],
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|