Commit ca10f17fb9deb4b66249826493da3cb97e3c6ff9

Authored by wangfan
1 parent debd1056

seller-Invitation

// pages/customer/detail_owner.js
var mta=require('mta-wechat-analysis')
var mta = require('mta-wechat-analysis')
import util from '../../utils/util';
import App from '../../utils/api';
import TP from '../../utils/tpls';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
detail:null,
invite_name:''
},
id:null,
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.id=options.id;
let invite_names=wx.getStorageSync('invite_names') ||{};
let invite_name=invite_names[options.id];
if(invite_name){
this.setData({
invite_name:invite_name
})
}
mta.Page.init({
"appID":"500667280",
"eventID":"500667287",
"statPullDownFresh":true,
"statShareApp":true,
"statReachBottom":true,
"lauchOpts":options, //渠道分析
});
/**
* 页面的初始数据
*/
data: {
detail: null,
height: 667,
current: 0,
tpls: [],
seller: {
name: '',
room: '',
date: '',
addr: ''
},
options: {tplid: ''},
hasOwner: false,//是否为发起人
animation: 'animation',
},
id: null,
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.id = options.id;
let param={
options:options,
hasOwner:options.hasSellerShare==1,//是否为发起人
}
param.tpls=[TP.tpls(options.tplid)]
this.setData(param)
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": options, //渠道分析
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getDetail();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getDetail();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.shareSetting();
},
getDetail(fouce=false){
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},fouce).then(res => {
this.setData({
detail:this.formatDatail(res.data)
})
})
},
formatDatail(detail){
detail.rdateStr=util.unixtoTime(detail.ddate,'YYYY/MM/DD 星期WW HH:II');
detail.tableFirst=detail.tables[0].name;
if(detail.tables.length>1){
detail.tableSubInfo='等'+(detail.tables.length)+'个'
+(detail.tables[0].tid==2?'包间':'');
}
if(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='邀请您共进午餐';
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.shareSetting();
},
getDetail(fouce = false){
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}, fouce).then(res => {
let tables=[];
res.data.tables.forEach(t=>{
tables.push(t.name);
})
this.setData({
detail: this.formatDatail(res.data),
seller:{
name:res.data.seller.sellername,
room:tables.join('、'),
date:util.unixtoTime(res.data.ddate,this.data.tpls[this.data.current].timeStr),
addr:res.data.seller.real_address||res.data.seller.map_address,
image:res.data.image_url,
}
})
})
},
formatDatail(detail){
detail.rdateStr = util.unixtoTime(detail.ddate, 'YYYY/MM/DD 星期WW HH:II');
detail.tableFirst = detail.tables[0].name;
if (detail.tables.length > 1) {
detail.tableSubInfo = '等' + (detail.tables.length) + '个'
+ (detail.tables[0].tid == 2 ? '包间' : '');
}
if (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 = '邀请您共进午餐';
}
// if(!detail.cusman){
// detail.cusman='vking';
// detail.cusman_phone='15877556369';
// detail.cusman_account='wx:vking';
// }
detail.hasCanSuccess=false;
if(detail.customers.length>0){
let openid=getApp().openid;
detail.customers.forEach(item=>{
if(openid==item.openid){
detail.hasCanSuccess=true;
detail.remindtime=item.remind_date;
return true;
}
})
}
return detail;
},
showManager(){
if(this.data.detail.cusman_phone || this.data.detail.cusman_account){
this.selectComponent('#manager').show();
// if(!detail.cusman){
// detail.cusman='vking';
// detail.cusman_phone='15877556369';
// detail.cusman_account='wx:vking';
// }
detail.hasCanSuccess = false;
if (detail.customers.length > 0) {
let openid = getApp().openid;
detail.customers.forEach(item => {
if (openid == item.openid) {
detail.hasCanSuccess = true;
detail.remindtime = item.remind_date;
return true;
}
})
}
return detail;
},
showManager(){
if (this.data.detail.cusman_phone || this.data.detail.cusman_account) {
this.selectComponent('#manager').show();
}
},
lookLocation:function(){
wx.openLocation({
latitude:Number(this.data.detail.seller.lat),
longitude:Number(this.data.detail.seller.long),
scale:17,
address:this.data.detail.seller.map_address,
success:function (res) {
console.log(res)
}
})
},
userinfo(){
if(!this.data.detail.hasCanSuccess){
let userInfo=util.cache('userInfo');
if(userInfo){
userInfo=JSON.stringify({
openid: getApp().openid,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
gender: userInfo.gender
})
}
App.Reserve.SetRelaSuccess({
rid:this.id,
openid:getApp().openid,
is_agree:1,
userinfo:userInfo
}).then(res=>{
this.setData({
[`detail.hasCanSuccess`]:true
})
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},'clear')
util.toast('赴约成功','none')
})
}else{
util.toast('赴约成功','none')
}
},
setUserInfoSuccess(){
util.toast('授权成功,可以继续转发','none');
},
reserveCancel(){
},
lookLocation: function () {
wx.openLocation({
latitude: Number(this.data.detail.seller.lat),
longitude: Number(this.data.detail.seller.long),
scale: 17,
address: this.data.detail.seller.map_address,
success: function (res) {
console.log(res)
}
})
},
userinfo(){
if (!this.data.detail.hasCanSuccess) {
let userInfo = util.cache('userInfo');
if (userInfo) {
userInfo = JSON.stringify({
... ... @@ -180,30 +170,63 @@ Page({
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
cancel: 'cancel',
is_agree: 0,
is_agree: 1,
userinfo: userInfo
}).then(res => {
this.getDetail(true);
this.setData({
[`detail.hasCanSuccess`]: true
})
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
}, 'clear')
util.toast('赴约成功', 'none')
})
},
shareSetting(){
console.log('this.topicVal',this.topicVal)
if(this.topicVal && this.data.detail.openid==getApp().openid){
App.Reserve.SetTopicFromShare({
rid:this.id,
topic:this.topicVal
})
}
let nickname="";
try{
nickname=util.cache('userInfo').nickName;
}catch(e){}
return {
//title: (nickname||'')+'给你发了一个邀请,点击查看',
title: '你收到一个邀请函,点击查看',
path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1',
imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,
}
} else {
util.toast('赴约成功', 'none')
}
},
setUserInfoSuccess(){
util.toast('授权成功,可以继续转发', 'none');
},
reserveCancel(){
let userInfo = util.cache('userInfo');
if (userInfo) {
userInfo = JSON.stringify({
openid: getApp().openid,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
gender: userInfo.gender
})
}
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
cancel: 'cancel',
is_agree: 0,
userinfo: userInfo
}).then(res => {
this.getDetail(true);
})
},
shareSetting(){
console.log('this.topicVal', this.topicVal)
if (this.topicVal && this.data.detail.openid == getApp().openid) {
App.Reserve.SetTopicFromShare({
rid: this.id,
topic: this.topicVal
})
}
let nickname = "";
try {
nickname = util.cache('userInfo').nickName;
} catch (e) {
}
return {
//title: (nickname||'')+'给你发了一个邀请,点击查看',
title: '你收到一个邀请函,点击查看',
path: '/pages/customer/index?id=' + this.id + '&fromid=' + getApp().openid + '&invite_name=' + nickname + '&hasInvitation=1',
imageUrl: util.cgi('App.Reserve.MakePic&rid=') + this.id,
}
}
})
... ...
<!--pages/customer/detail_owner.wxml-->
<nav hasHome backgroundColor="rgba(0,0,0,0)" color="#ffffff"></nav>
<import src="../tpl/invitation"></import>
<nav backgroundColor="rgba(0,0,0,0)" hasHome style="position: fixed;z-index: 1;"></nav>
<view class="pages bg-{{options.tplid}} flex-vc" style="height:{{height}}px;" wx:if="{{options.tplid}}">
<template is="tpl-{{options.tplid}}" data="{{seller,options,hasOwner,animation}}"></template>
<view class="opt-view flex-vc">
<block wx:if="{{!hasCanSuccess}}">
<userinfo class="button-none flex-vc" binduserinfo="confirmed" wx:if="{{options.rid}}" catchtap="catchtap">
<view class="buts-share animation customer"></view>
</userinfo>
</block>
</view>
</view>
<view class="opt-button flex-vc">
<view class="opt flex-cc">
<formids class="button-none flex-vc" bindclick="lookLocation">
<view class="opt-text flex-cc">
<image class="buts-dh" src="http://qn.colorcun.com/manager-invitation/wx2/%E4%B8%80%E9%94%AE%E5%AF%BC%E8%88%AA.png"></image>
<view class="buts-text">一键导航</view>
</view>
</formids>
<userinfo-share class="button-none flex-vc" binduserinfo="toast">
<view class="opt-text flex-cc">
<image class="buts-sh" src="http://qn.colorcun.com/manager-invitation/wx2/%E8%BD%AC%E5%8F%91%E7%BB%99%E5%A5%BD%E5%8F%8B.png"></image>
<view class="buts-text">转发给好友</view>
</view>
</userinfo-share>
</view>
</view>
<!--
<view class="pages">
<view class="flex-vc" style="position: relative;">
<view class="invit-logo">
... ... @@ -35,3 +63,15 @@
<view class="buts-share"></view>
</userinfo>
</view>
-->
<!--//商务-->
<template name="tpl-1">
<view class="flex-vc shangwu" bindtap="{{options.rid?'goEditor':''}}">
<template is="tpl-shangwu" data="{{...seller,options}}"></template>
</view>
</template>
<!--//温馨-->
<template name="tpl-2">
<template is="tpl-wenxin" data="{{...seller,options}}"></template>
</template>
... ...
/* pages/customer/detail_customer.wxss */
@import "../manager-invitation/tpls.wxss";
.pages{
color:#FFFFFF;
background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
background-size: 100%;
overflow-y: auto;
font-size: 34rpx;
position: fixed;
top:0;
bottom: 0;
left:0;
right:0;
width: 100%;
}
image{
width: 100%;
height: 100%;
}
.invit-logo{
width: 352rpx;
height: 164rpx;
margin-top: 156rpx;
}
.avatar{
width: 88rpx;
height: 88rpx;
border-radius: 50%;
margin-top: 50rpx;
margin-bottom: 22rpx;
overflow: hidden;
}
.invit{
font-size: 26rpx;
color:#FDFCFD;
}
.hr-one{
margin-top: 50rpx;
margin-bottom: 54rpx;
height: 2rpx;
background-color: #999999;
width: 90%;
.buts-share{
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E5%8F%91%E9%82%80%E8%AF%B7%E5%87%BD.png");
}
.seller{
margin-top: 40rpx;
width: 100%;
.buts-share.customer{
background-image: url("http://qn.colorcun.com/manager-invitation/wx/%E7%A1%AE%E8%AE%A4%E6%94%B6%E5%88%B0.png");
}
.seller .title{
font-size: 28rpx;
color:#999999;
margin-bottom: 20rpx;
height: 40rpx;
line-height: 40rpx;
.shangwu{
margin-top: 52rpx;
}
.seller .content{
margin-bottom: 40rpx;
font-size: 36rpx;
line-height: 50rpx;
height: 50rpx;
max-width: 80%;
.shangwu .seller{
margin-bottom: 42rpx;
}
.seller .content .addr{
font-size: 32rpx;
line-height: 40rpx;
text-align: center;
.shangwu .invit-logo.owner{
width: 380rpx;
height: 200rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92.png");
}
.invit-addr{
width: 22rpx;
height: 28rpx;
margin-right: 18rpx;
min-width: 22rpx;
margin-top:6rpx ;
.shangwu .invit-logo.customer{
width: 352rpx;
height: 164rpx;
background-image: url("http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png");
}
.opt-view{
position: fixed;
bottom: 100rpx;
width: 100%;
}
.opt{
width: 90%;
margin: 0 auto;
}
.opt .but{
width: 100%;
height: 80rpx;
border: 2rpx solid #ECD9B7;
border-radius: 6rpx;
line-height: 78rpx;
text-align: center;
font-size: 30rpx;
color:#ECD9B7;
margin-right: 5%;
padding-bottom: 4rpx!important;
}
.opt .but:last-child{
margin-right: 0;
.wenxin-mask{
margin-top: 20rpx;
}
.opt .buts{
width: 288rpx;
height: 80rpx;
.wenxin-baitou{
margin-top: 20rpx;
}
.opt-button{
margin-top: 48rpx;
width: 100%;
}
.buts-share{
width: 560rpx;
height: 86rpx;
margin: 0 auto;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-3.png");
background-size: 100%;
background-repeat: no-repeat;
background-position: center center;
animation-name: butAnimation;
animation-duration: 0.7s;
animation-iteration-count:9999;
}
.opt-view-tip{
font-size: 26rpx;
color: #999999;
margin-bottom: 20rpx;
.wenxin .seller{
margin-bottom: 22rpx;
}
@keyframes butAnimation
{
50% {background-size:90%;}
.wenxin .invit-logo.owner{
width: 340rpx;
height: 184rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92-%E6%B8%A9%E9%A6%A8.png");
}
@-webkit-keyframes butAnimation
{
50% {background-size:90%;}
.wenxin .invit-logo.customer{
width: 344rpx;
height: 198rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx/%E9%82%80%E8%AF%B7%E5%87%BD.png");
}
\ No newline at end of file
... ...
... ... @@ -13,6 +13,48 @@ image{
.buts-share{
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E5%8F%91%E9%82%80%E8%AF%B7%E5%87%BD.png");
}
.buts-share.customer{
background-image: url("http://qn.colorcun.com/manager-invitation/wx/%E7%A1%AE%E8%AE%A4%E6%94%B6%E5%88%B0.png");
}
.shangwu{
margin-top: 52rpx;
}
.shangwu .seller{
margin-bottom: 42rpx;
}
.shangwu .invit-logo.owner{
width: 380rpx;
height: 200rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92.png");
}
.shangwu .invit-logo.customer{
width: 352rpx;
height: 164rpx;
background-image: url("http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png");
}
.wenxin-mask{
margin-top: 20rpx;
}
.wenxin-baitou{
margin-top: 20rpx;
}
.wenxin .seller{
margin-bottom: 22rpx;
}
.wenxin .invit-logo.owner{
width: 340rpx;
height: 184rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92-%E6%B8%A9%E9%A6%A8.png");
}
.wenxin .invit-logo.customer{
width: 344rpx;
height: 198rpx;
background-image: url("http://qn.colorcun.com/manager-invitation/wx/%E9%82%80%E8%AF%B7%E5%87%BD.png");
}
.bottom{
position: fixed;
bottom: 0;
... ...
/* pages/manager-invitation/review.wxss */
@import "tpls.wxss";
.pages{
font-size: 200rpx;
background-size: 100%;
font-size: 34rpx;
position: fixed;
... ...
<!--//商务-->
<template name="tpl-shangwu">
<view class="invit-logo">
<image src="http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92.png"></image>
<view class="quick-editor" wx:if="{{options.rid}}">修改内容</view>
</view>
<view class="invit-logo {{hasOwner?'owner':'customer'}}"></view>
<view class="shangwu-line"></view>
<view class="seller flex-vc">
<view class="title flex-cc">
... ... @@ -24,12 +21,12 @@
<view class="title-right"></view>
</view>
<view class="content">{{date}}</view>
<view class="title flex-cc">
<view class="title title-addr-view flex-cc" bindtap="lookLocation">
<view class="title-addr"></view>
地址导航
<view class="title-more"></view>
</view>
<view class="content flex-cc addr">
<view class="content flex-cc addr" bindtap="lookLocation">
{{addr}}
</view>
</view>
... ... @@ -39,11 +36,8 @@
<template name="tpl-wenxin">
<view class="wenxin-top"></view>
<view class="wenxin-bottom"></view>
<view class="flex-vc wenxin" bindtap="{{options.rid?'goEditor':''}}">
<view class="invit-logo">
<image src="http://qn.colorcun.com/manager-invitation/wx2/%E9%A2%84%E8%AE%A2%E5%AE%89%E6%8E%92-%E6%B8%A9%E9%A6%A8.png"></image>
<view class="quick-editor" wx:if="{{options.rid}}">修改内容</view>
</view>
<view class="flex-vc wenxin">
<view class="invit-logo {{hasOwner?'owner':'customer'}}"></view>
<view class="wenxin-mask">
<view class="wenxin-mask-bg" style="background-image: url({{image||'http://qn.colorcun.com/manager-invitation/wx/hunshazhao3.jpg'}})"></view>
<view class="wenxin-mask-img"></view>
... ... @@ -53,7 +47,7 @@
<view class="content">{{date}}</view>
<view class="content">{{name}}</view>
<view class="content">{{room}}</view>
<view class="content flex-cc addr">
<view class="content flex-cc addr" bindtap="lookLocation">
<image src="http://qn.colorcun.com/manager-invitation/wx/address.png" class="invit-addr"></image>
{{addr}}
</view>
... ...
... ... @@ -31,7 +31,7 @@
"list": []
},
"miniprogram": {
"current": 40,
"current": 8,
"list": [
{
"id": 0,
... ... @@ -92,7 +92,7 @@
"id": 8,
"name": "邀请进入 pages/customer/index",
"pathName": "pages/customer/index",
"query": "id=2639&fromid=test&hasInvitation=1&hasSellerShare=1",
"query": "id=2639&fromid=test&hasInvitation=1&hasSellerShare=1&tplid=1",
"scene": 1001
},
{
... ...