Commit 91dd6dce83ef7d1f29f1cd1a9a07102bd935c5b6

Authored by wangfan
1 parent e8a7c605

fixbug year

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 "pages/customer/detail_owner", 7 "pages/customer/detail_owner",
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/invite", 11 "pages/customer/invite",
11 "pages/customer/list", 12 "pages/customer/list",
12 "pages/customer/remind", 13 "pages/customer/remind",
@@ -5,6 +5,10 @@ Component({ @@ -5,6 +5,10 @@ Component({
5 */ 5 */
6 properties: { 6 properties: {
7 share:Object, 7 share:Object,
  8 + shareAct:{
  9 + type:String,
  10 + value:'',
  11 + },
8 }, 12 },
9 13
10 /** 14 /**
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 </userinfo> 5 </userinfo>
6 </block> 6 </block>
7 <block wx:else=""> 7 <block wx:else="">
8 - <button class="button-none" open-type="share" data-id="{{share.id}}" catchtap="share"> 8 + <button class="button-none" open-type="share" data-id="{{share.id}}" data-act="{{shareAct}}" catchtap="share">
9 <slot></slot> 9 <slot></slot>
10 </button> 10 </button>
11 </block> 11 </block>
@@ -71,7 +71,7 @@ Page({ @@ -71,7 +71,7 @@ Page({
71 }) 71 })
72 }, 72 },
73 formatDatail(detail){ 73 formatDatail(detail){
74 - detail.rdateStr=util.unixtoTime(detail.rdate,'MM月DD日 WW HH:II'); 74 + detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II');
75 detail.tableFirst=detail.tables[0].name; 75 detail.tableFirst=detail.tables[0].name;
76 if(detail.tables.length>1){ 76 if(detail.tables.length>1){
77 detail.tableSubInfo='等'+(detail.tables.length)+'个' 77 detail.tableSubInfo='等'+(detail.tables.length)+'个'
  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 + reserveCancel(){
  161 + let userInfo = util.cache('userInfo');
  162 + if (userInfo) {
  163 + userInfo = JSON.stringify({
  164 + openid: getApp().openid,
  165 + avatar: userInfo.avatarUrl,
  166 + nickname: userInfo.nickName,
  167 + gender: userInfo.gender
  168 + })
  169 + }
  170 + App.Reserve.SetRelaSuccess({
  171 + rid: this.id,
  172 + openid: getApp().openid,
  173 + cancel: 'cancel',
  174 + is_agree: 0,
  175 + userinfo: userInfo
  176 + }).then(res => {
  177 + this.getDetail(true);
  178 + })
  179 + },
  180 + shareSetting(){
  181 + console.log('this.topicVal',this.topicVal)
  182 + if(this.topicVal && this.data.detail.openid==getApp().openid){
  183 + App.Reserve.SetTopicFromShare({
  184 + rid:this.id,
  185 + topic:this.topicVal
  186 + })
  187 + }
  188 + let nickname="";
  189 + try{
  190 + nickname=util.cache('userInfo').nickName;
  191 + }catch(e){}
  192 + return {
  193 + title: (nickname||'')+'给你发了一个邀请,点击查看',
  194 + path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname,
  195 + imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,
  196 + }
  197 + }
  198 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "navigationBarTitleText":"订座详情",
  5 + "usingComponents": {
  6 + "userinfo": "/components/userinfo/userinfo",
  7 + "manager": "/components/manager/manager",
  8 + "nav":"/components/nav/nav",
  9 + "card":"/components/seller-card/seller-card",
  10 + "formids":"/components/formids/formids",
  11 + "userinfo-share": "/components/userinfo/share"
  12 + }
  13 +}
  1 +<!--pages/customer/detail_owner.wxml-->
  2 +<view class="page flex-vc">
  3 + <view class="invit-logo">
  4 + <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png"></image>
  5 + </view>
  6 + <view class="avatar">
  7 + <image src="{{detail.customers[0].headimgurl}}"></image>
  8 + </view>
  9 + <view class="invit flex-cc">
  10 + <view style="margin-right: 20rpx;">{{detail.rnameStr}}</view>
  11 + <view>{{detail.eatStr}}</view>
  12 + </view>
  13 + <view class="hr-one"></view>
  14 + <view class="seller flex-vc">
  15 + <view class="title">餐厅</view>
  16 + <view class="content name">{{detail.seller.sellername}}</view>
  17 + <view class="title">包间</view>
  18 + <view class="content">{{detail.tableFirst}}{{detail.tableSubInfo}}</view>
  19 + <view class="title">时间</view>
  20 + <view class="content">{{detail.rdateStr}}</view>
  21 + <view class="title">地址</view>
  22 + <view class="content flex-ll" bindtap="lookLocation">
  23 + <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-addr.png" class="invit-addr"></image>
  24 + <view>{{detail.seller.real_address}}</view>
  25 + </view>
  26 + </view>
  27 + <view class="opt flex-cc">
  28 + <view class="but">餐厅详情</view>
  29 + <view class="but" bindtap="lookLocation">一键导航</view>
  30 + </view>
  31 +</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 +}
  6 +image{
  7 + width: 100%;
  8 + height: 100%;
  9 +}
  10 +.invit-logo{
  11 + width: 352rpx;
  12 + height: 164rpx;
  13 + margin-top: 156rpx;
  14 +}
  15 +.avatar{
  16 + width: 88rpx;
  17 + height: 88rpx;
  18 + border-radius: 50%;
  19 + margin-top: 50rpx;
  20 + margin-bottom: 22rpx;
  21 + overflow: hidden;
  22 +}
  23 +.invit{
  24 + font-size: 26rpx;
  25 + color:#FDFCFD;
  26 +}
  27 +.hr-one{
  28 + margin-top: 50rpx;
  29 + margin-bottom: 54rpx;
  30 + height: 2rpx;
  31 + background-color: #999999;
  32 + width: 90%;
  33 +}
  34 +.seller{
  35 +
  36 +}
  37 +.seller .title{
  38 + font-size: 26rpx;
  39 + color:#999999;
  40 + margin-bottom: 30rpx;
  41 +}
  42 +.seller .content{
  43 + margin-bottom: 30rpx;
  44 + font-size: 30rpx;
  45 + line-height: 30rpx;
  46 +}
  47 +.seller .name{
  48 + font-size: 42rpx;
  49 + line-height: 42rpx;
  50 +}
  51 +.invit-addr{
  52 + width: 20rpx;
  53 + height: 20rpx;
  54 + margin-right: 18rpx;
  55 +}
  56 +
  57 +
  58 +
  59 +.opt{
  60 + margin-bottom: 180rpx;
  61 + margin-top: 52rpx;
  62 +}
  63 +.opt .but{
  64 + width: 330rpx;
  65 + height: 70rpx;
  66 + border: 2rpx solid #ECD9B7;
  67 + border-radius: 6rpx;
  68 + line-height: 70rpx;
  69 + text-align: center;
  70 + font-size: 30rpx;
  71 + color:#ECD9B7;
  72 + margin-right: 20rpx;
  73 +}
  74 +.opt .but:last-child{
  75 + margin-right: 0;
  76 +}
@@ -56,9 +56,9 @@ Page({ @@ -56,9 +56,9 @@ Page({
56 /** 56 /**
57 * 用户点击右上角分享 57 * 用户点击右上角分享
58 */ 58 */
59 - onShareAppMessage: function () { 59 + onShareAppMessage: function (e) {
60 console.log('onShareAppMessage',arguments) 60 console.log('onShareAppMessage',arguments)
61 - return this.shareSetting(); 61 + return this.shareSetting(e);
62 }, 62 },
63 formatDatail(detail){ 63 formatDatail(detail){
64 detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II'); 64 detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II');
@@ -96,22 +96,29 @@ Page({ @@ -96,22 +96,29 @@ Page({
96 // url:'invite?id='+this.id, 96 // url:'invite?id='+this.id,
97 // }); 97 // });
98 }, 98 },
99 - shareSetting(){  
100 - console.log('this.topicVal',this.topicVal)  
101 - if(this.topicVal && this.data.detail.openid==getApp().openid){  
102 - App.Reserve.SetTopicFromShare({  
103 - rid:this.id,  
104 - topic:this.topicVal  
105 - })  
106 - }  
107 - let nickname="";  
108 - try{  
109 - nickname=util.cache('userInfo').nickName;  
110 - }catch(e){}  
111 - return {  
112 - title: (nickname||'')+'给你发了一个邀请,点击查看',  
113 - path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname,  
114 - imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,  
115 - } 99 + shareSetting(e){
  100 + console.log('shareSetting',e.target.dataset);
  101 + let hasInvitation=e.target.dataset.act=='invitation';
  102 + if (this.topicVal && this.data.detail.openid == getApp().openid) {
  103 + App.Reserve.SetTopicFromShare({
  104 + rid: this.id,
  105 + topic: this.topicVal
  106 + })
  107 + }
  108 + let nickname = "";
  109 + try {
  110 + nickname = util.cache('userInfo').nickName;
  111 + } catch (e) {
  112 + }
  113 + let obj={
  114 + title: (nickname || '') + '给你发了一个邀请,点击查看',
  115 + path: '/pages/customer/index?id=' + this.id + '&fromid=' + getApp().openid + '&invite_name=' + nickname,
  116 + imageUrl: util.cgi('App.Reserve.MakePic&rid=') + this.id,
  117 + }
  118 + if(hasInvitation){
  119 + obj.title=(nickname || '') + '给你发了一个邀请函,点击查看';
  120 + obj.path=obj.path+'&hasInvitation=1';
116 } 121 }
  122 + return obj;
  123 + }
117 }) 124 })
@@ -13,13 +13,24 @@ @@ -13,13 +13,24 @@
13 <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view> 13 <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view>
14 </block> 14 </block>
15 </view> 15 </view>
16 - <userinfo-share wx:if="{{!detail.hasOvered}}"  
17 - binduserinfo="userinfo"  
18 - bindshare="share"  
19 - share="{{detail}}"  
20 - class="share-but-view">  
21 - <view class="share-but Regular">邀请同行的朋友</view>  
22 - </userinfo-share> 16 + <view class="flex-lr share-view">
  17 + <userinfo-share wx:if="{{!detail.hasOvered}}"
  18 + binduserinfo="userinfo"
  19 + bindshare="share"
  20 + share="{{detail}}"
  21 + share-act=""
  22 + class="share-but-view">
  23 + <view class="share-but Regular">邀请朋友</view>
  24 + </userinfo-share>
  25 + <userinfo-share wx:if="{{!detail.hasOvered}}"
  26 + binduserinfo="userinfo"
  27 + bindshare="share"
  28 + share="{{detail}}"
  29 + share-act="invitation"
  30 + class="share-but-view">
  31 + <view class="share-but Regular">发邀请函</view>
  32 + </userinfo-share>
  33 + </view>
23 <view style="height: 40rpx;"></view> 34 <view style="height: 40rpx;"></view>
24 <card seller="{{detail.seller}}" detail="{{detail}}"></card> 35 <card seller="{{detail.seller}}" detail="{{detail}}"></card>
25 <view class="detail-info Medium" style="margin-top: 56rpx;"> 36 <view class="detail-info Medium" style="margin-top: 56rpx;">
@@ -23,18 +23,30 @@ @@ -23,18 +23,30 @@
23 color:#999999 23 color:#999999
24 } 24 }
25 .share-but-view{ 25 .share-but-view{
  26 + display: block;
  27 + width: 49%;
  28 + border-right:2rpx solid #262628;
  29 + height:60rpx;
  30 + line-height: 60rpx;
  31 +}
  32 +.share-but-view:last-child{
  33 + border-width: 0;
  34 +}
  35 +.share-view{
26 margin-top: 58rpx; 36 margin-top: 58rpx;
27 margin-bottom: 20rpx; 37 margin-bottom: 20rpx;
28 - display: block; 38 + height:80rpx;
  39 + line-height: 80rpx;
  40 + font-size: 34rpx;
  41 + border:2rpx solid #262628;
  42 + color:#262628;
  43 + width: 100%;
29 } 44 }
30 .share-but{ 45 .share-but{
31 - color:#FEFEFE;  
32 - background: #262628;  
33 width: 100%; 46 width: 100%;
34 - line-height: 80rpx;  
35 - font-size: 34rpx;  
36 - text-align: center; 47 +
37 } 48 }
  49 +
38 .seller{ 50 .seller{
39 height: 84rpx; 51 height: 84rpx;
40 } 52 }
@@ -81,6 +81,9 @@ Page({ @@ -81,6 +81,9 @@ Page({
81 url = '/pages/customer/detail_owner'; 81 url = '/pages/customer/detail_owner';
82 } else { 82 } else {
83 url = '/pages/customer/detail_customer'; 83 url = '/pages/customer/detail_customer';
  84 + if(opt.hasInvitation==1){
  85 + url = '/pages/customer/detail_invitation';
  86 + }
84 if (res.data.openid == opt.openid) { 87 if (res.data.openid == opt.openid) {
85 url = '/pages/customer/detail_owner'; 88 url = '/pages/customer/detail_owner';
86 } 89 }
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 "id": 6, 73 "id": 6,
74 "name": "pages/customer/index", 74 "name": "pages/customer/index",
75 "pathName": "pages/customer/index", 75 "pathName": "pages/customer/index",
76 - "query": "id=1156", 76 + "query": "id=1196&fromid=1111&hasInvitation=1",
77 "scene": "1044", 77 "scene": "1044",
78 "shareInfo": { 78 "shareInfo": {
79 "groupName": "测试模拟群1", 79 "groupName": "测试模拟群1",
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 "id": 8, 91 "id": 8,
92 "name": "邀请进入 pages/customer/index", 92 "name": "邀请进入 pages/customer/index",
93 "pathName": "pages/customer/index", 93 "pathName": "pages/customer/index",
94 - "query": "id=64&fromid=test", 94 + "query": "id=1196&fromid=test",
95 "scene": "1001" 95 "scene": "1001"
96 }, 96 },
97 { 97 {