Commit 94bd85cb56939009da258618a7a6b76a3af81e73

Authored by wangfan
1 parent 256abe05

预约安排

@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "pages/customer/detail_owner_part", 8 "pages/customer/detail_owner_part",
9 "pages/customer/detail_customer", 9 "pages/customer/detail_customer",
10 "pages/customer/detail_invitation", 10 "pages/customer/detail_invitation",
  11 + "pages/customer/detail_owner_invitation",
11 "pages/customer/invite", 12 "pages/customer/invite",
12 "pages/customer/list", 13 "pages/customer/list",
13 "pages/customer/remind", 14 "pages/customer/remind",
  1 +// pages/customer/detail_owner.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + detail:null,
  12 + invite_name:''
  13 + },
  14 + id:null,
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + onLoad: function (options) {
  19 + this.id=options.id;
  20 + let invite_names=wx.getStorageSync('invite_names') ||{};
  21 + let invite_name=invite_names[options.id];
  22 + if(invite_name){
  23 + this.setData({
  24 + invite_name:invite_name
  25 + })
  26 + }
  27 + },
  28 +
  29 + /**
  30 + * 生命周期函数--监听页面初次渲染完成
  31 + */
  32 + onReady: function () {
  33 +
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面显示
  38 + */
  39 + onShow: function () {
  40 + this.getDetail();
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面隐藏
  45 + */
  46 + onHide: function () {
  47 +
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面卸载
  52 + */
  53 + onUnload: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 用户点击右上角分享
  59 + */
  60 + onShareAppMessage: function () {
  61 + return this.shareSetting();
  62 + },
  63 + getDetail(fouce=false){
  64 + App.Reserve.Detail({
  65 + openid: getApp().openid,
  66 + rid: this.id
  67 + },fouce).then(res => {
  68 + this.setData({
  69 + detail:this.formatDatail(res.data)
  70 + })
  71 + })
  72 + },
  73 + formatDatail(detail){
  74 + detail.rdateStr=util.unixtoTime(detail.ddate,'YYYY/MM/DD 星期WW HH:II');
  75 + detail.tableFirst=detail.tables[0].name;
  76 + if(detail.tables.length>1){
  77 + detail.tableSubInfo='等'+(detail.tables.length)+'个'
  78 + +(detail.tables[0].tid==2?'包间':'');
  79 + }
  80 + if(detail.sex!=3){
  81 + detail.rnameStr=detail.rname.substr(0,1)+(detail.sex==1?'先生':'女士')
  82 + }else{
  83 + detail.rnameStr=detail.rname
  84 + }
  85 + detail.eatStr='邀请您共进晚餐';
  86 + let hi=util.unixtoTime(detail.ddate,'HHII');
  87 + if(hi<'10:00'){
  88 + detail.eatStr='邀请您共进早餐';
  89 + }else if(hi<'15:00'){
  90 + detail.eatStr='邀请您共进午餐';
  91 + }
  92 +
  93 + // if(!detail.cusman){
  94 + // detail.cusman='vking';
  95 + // detail.cusman_phone='15877556369';
  96 + // detail.cusman_account='wx:vking';
  97 + // }
  98 + detail.hasCanSuccess=false;
  99 + if(detail.customers.length>0){
  100 + let openid=getApp().openid;
  101 + detail.customers.forEach(item=>{
  102 + if(openid==item.openid){
  103 + detail.hasCanSuccess=true;
  104 + detail.remindtime=item.remind_date;
  105 + return true;
  106 + }
  107 + })
  108 + }
  109 + return detail;
  110 + },
  111 + showManager(){
  112 + if(this.data.detail.cusman_phone || this.data.detail.cusman_account){
  113 + this.selectComponent('#manager').show();
  114 + }
  115 +
  116 + },
  117 + lookLocation:function(){
  118 + wx.openLocation({
  119 + latitude:Number(this.data.detail.seller.lat),
  120 + longitude:Number(this.data.detail.seller.long),
  121 + scale:17,
  122 + address:this.data.detail.seller.map_address,
  123 + success:function (res) {
  124 + console.log(res)
  125 + }
  126 + })
  127 + },
  128 + userinfo(){
  129 + if(!this.data.detail.hasCanSuccess){
  130 + let userInfo=util.cache('userInfo');
  131 + if(userInfo){
  132 + userInfo=JSON.stringify({
  133 + openid: getApp().openid,
  134 + avatar: userInfo.avatarUrl,
  135 + nickname: userInfo.nickName,
  136 + gender: userInfo.gender
  137 + })
  138 + }
  139 + App.Reserve.SetRelaSuccess({
  140 + rid:this.id,
  141 + openid:getApp().openid,
  142 + is_agree:1,
  143 + userinfo:userInfo
  144 + }).then(res=>{
  145 + App.Reserve.Detail({
  146 + openid: getApp().openid,
  147 + rid: this.id
  148 + },'clear')
  149 + wx.navigateTo({
  150 + //id={{detail.id}}&rdate={{detail.rdate}}
  151 + url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,
  152 + });
  153 + })
  154 + }else{
  155 + // wx.navigateTo({
  156 + // url:'invite?id='+this.id,
  157 + // });
  158 + }
  159 + },
  160 + setUserInfoSuccess(){
  161 + util.toast('授权成功,可以继续转发','none');
  162 + },
  163 + reserveCancel(){
  164 + let userInfo = util.cache('userInfo');
  165 + if (userInfo) {
  166 + userInfo = JSON.stringify({
  167 + openid: getApp().openid,
  168 + avatar: userInfo.avatarUrl,
  169 + nickname: userInfo.nickName,
  170 + gender: userInfo.gender
  171 + })
  172 + }
  173 + App.Reserve.SetRelaSuccess({
  174 + rid: this.id,
  175 + openid: getApp().openid,
  176 + cancel: 'cancel',
  177 + is_agree: 0,
  178 + userinfo: userInfo
  179 + }).then(res => {
  180 + this.getDetail(true);
  181 + })
  182 + },
  183 + shareSetting(){
  184 + console.log('this.topicVal',this.topicVal)
  185 + if(this.topicVal && this.data.detail.openid==getApp().openid){
  186 + App.Reserve.SetTopicFromShare({
  187 + rid:this.id,
  188 + topic:this.topicVal
  189 + })
  190 + }
  191 + let nickname="";
  192 + try{
  193 + nickname=util.cache('userInfo').nickName;
  194 + }catch(e){}
  195 + return {
  196 + //title: (nickname||'')+'给你发了一个邀请,点击查看',
  197 + title: '你收到一个邀请函,点击查看',
  198 + path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1',
  199 + imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,
  200 + }
  201 + }
  202 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "light",
  4 + "navigationBarTitleText":"订座详情",
  5 + "usingComponents": {
  6 + "userinfo": "/components/userinfo/userinfo",
  7 + "nav":"/components/nav/nav",
  8 + "formids":"/components/formids/formids",
  9 + "userinfo-share": "/components/userinfo/share"
  10 + }
  11 +}
  1 +<!--pages/customer/detail_owner.wxml-->
  2 +<nav hasHome backgroundColor="rgba(0,0,0,0)" color="#ffffff"></nav>
  3 +<view class="page">
  4 + <view class="flex-vc" style="position: relative;">
  5 + <view class="invit-logo">
  6 + <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png"></image>
  7 + </view>
  8 + <!--
  9 + <view class="avatar">
  10 + <image src="{{detail.customers[0].headimgurl}}"></image>
  11 + </view>
  12 + <view class="invit flex-cc">
  13 + <view style="margin-right: 20rpx;">{{detail.rnameStr}}</view>
  14 + <view>{{detail.eatStr}}</view>
  15 + </view>
  16 + <view class="hr-one"></view>
  17 + -->
  18 + <view class="seller flex-vc">
  19 + <view class="title">餐厅</view>
  20 + <view class="content name">{{detail.seller.sellername}}</view>
  21 + <view class="title">包间</view>
  22 + <view class="content">{{detail.tableFirst}}{{detail.tableSubInfo}}</view>
  23 + <view class="title">时间</view>
  24 + <view class="content">{{detail.rdateStr}}</view>
  25 + <view class="title">地址</view>
  26 + <view class="content flex-ll" bindtap="lookLocation">
  27 + <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-addr.png" class="invit-addr"></image>
  28 + <view>{{detail.seller.real_address||detail.seller.map_address}}</view>
  29 + </view>
  30 + </view>
  31 + </view>
  32 +</view>
  33 +<view class="opt-view">
  34 + <view class="opt flex-cc">
  35 + <formids class="but button-none flex-vc" bindclick="lookLocation">一键导航</formids>
  36 + <userinfo-share class="but button-none flex-vc" binduserinfo="setUserInfoSuccess">转发好友</userinfo-share>
  37 + </view>
  38 +</view>
  1 +/* pages/customer/detail_customer.wxss */
  2 +.page{
  3 + color:#FFFFFF;
  4 + background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
  5 + background-size: 100%;
  6 + overflow-y: auto;
  7 + position: fixed;
  8 + top:0;
  9 + bottom: 0;
  10 + left:0;
  11 + right:0;
  12 +}
  13 +image{
  14 + width: 100%;
  15 + height: 100%;
  16 +}
  17 +.invit-logo{
  18 + width: 352rpx;
  19 + height: 164rpx;
  20 + margin-top: 156rpx;
  21 +}
  22 +.avatar{
  23 + width: 88rpx;
  24 + height: 88rpx;
  25 + border-radius: 50%;
  26 + margin-top: 50rpx;
  27 + margin-bottom: 22rpx;
  28 + overflow: hidden;
  29 +}
  30 +.invit{
  31 + font-size: 26rpx;
  32 + color:#FDFCFD;
  33 +}
  34 +.hr-one{
  35 + margin-top: 50rpx;
  36 + margin-bottom: 54rpx;
  37 + height: 2rpx;
  38 + background-color: #999999;
  39 + width: 90%;
  40 +}
  41 +.seller{
  42 + margin-top: 110rpx;
  43 +}
  44 +.seller .title{
  45 + font-size: 28rpx;
  46 + color:#999999;
  47 + margin-bottom: 32rpx;
  48 +}
  49 +.seller .content{
  50 + margin-bottom: 68rpx;
  51 + font-size: 30rpx;
  52 + line-height: 30rpx;
  53 +}
  54 +.seller .name{
  55 + font-size: 44rpx;
  56 + line-height: 44rpx;
  57 +}
  58 +.invit-addr{
  59 + width: 20rpx;
  60 + height: 20rpx;
  61 + margin-right: 18rpx;
  62 +}
  63 +
  64 +
  65 +.opt-view{
  66 + position: fixed;
  67 + bottom: 120rpx;
  68 + width: 100%;
  69 +}
  70 +.opt{
  71 + width: 90%;
  72 + margin: 0 auto;
  73 +}
  74 +.opt .but{
  75 + width: 100%;
  76 + height: 80rpx;
  77 + border: 2rpx solid #ECD9B7;
  78 + border-radius: 6rpx;
  79 + line-height: 78rpx;
  80 + text-align: center;
  81 + font-size: 30rpx;
  82 + color:#ECD9B7;
  83 + margin-right: 5%;
  84 + padding-bottom: 4rpx!important;
  85 +}
  86 +.opt .but:last-child{
  87 + margin-right: 0;
  88 +}
@@ -96,6 +96,9 @@ Page({ @@ -96,6 +96,9 @@ Page({
96 } 96 }
97 if (res.data.openid == opt.openid) { 97 if (res.data.openid == opt.openid) {
98 url = '/pages/customer/detail_owner'; 98 url = '/pages/customer/detail_owner';
  99 + if(opt.hasInvitation==1){
  100 + url = '/pages/customer/detail_owner_invitation';
  101 + }
99 } 102 }
100 } 103 }
101 } 104 }