Commit 85365c54f2fc29920d50ffff254167bcdaa9e59a

Authored by liuxuqinfhp1220
2 parents 40ee51af 5eec5616

no message

@@ -38,7 +38,7 @@ App({ @@ -38,7 +38,7 @@ App({
38 console.log('this.openid',this.openid,mta); 38 console.log('this.openid',this.openid,mta);
39 }, 39 },
40 onShow:async function(){ 40 onShow:async function(){
41 - this._getOpenid(); 41 + //this._getOpenid();
42 if (wx.canIUse('getUpdateManager')) { 42 if (wx.canIUse('getUpdateManager')) {
43 const updateManager = wx.getUpdateManager(); 43 const updateManager = wx.getUpdateManager();
44 updateManager.onCheckForUpdate(function (res) { 44 updateManager.onCheckForUpdate(function (res) {
@@ -105,6 +105,7 @@ App({ @@ -105,6 +105,7 @@ App({
105 return new Promise((success,fail)=>{ 105 return new Promise((success,fail)=>{
106 wx.login({ 106 wx.login({
107 success: (login_res)=>{ 107 success: (login_res)=>{
  108 + console.log('wx.login',login_res)
108 success(login_res); 109 success(login_res);
109 }, 110 },
110 fail:(res)=>{ 111 fail:(res)=>{
@@ -126,6 +127,7 @@ App({ @@ -126,6 +127,7 @@ App({
126 try{ 127 try{
127 let openid=res.data.data.openid; 128 let openid=res.data.data.openid;
128 wx.setStorage({key:'customer_openid',data:openid}); 129 wx.setStorage({key:'customer_openid',data:openid});
  130 + wx.setStorage({key:'customer_session_key',data:res.data.data.session_key});
129 success(openid); 131 success(openid);
130 }catch(e){ 132 }catch(e){
131 console.log(res); 133 console.log(res);
@@ -143,8 +145,9 @@ App({ @@ -143,8 +145,9 @@ App({
143 try{ 145 try{
144 let login_res=await this._login(); 146 let login_res=await this._login();
145 let openid=await this._getLiteOpenidByCode(login_res.code) 147 let openid=await this._getLiteOpenidByCode(login_res.code)
146 - return openid; 148 + return openid
147 }catch(e){ 149 }catch(e){
  150 + console.log('_getOpenid.catch',e)
148 return this._getOpenid(); 151 return this._getOpenid();
149 } 152 }
150 }, 153 },
  1 +Component({
  2 + data: {
  3 + curYear: new Date().getFullYear(), // 年份
  4 + curMonth: new Date().getMonth() + 1,// 月份 1-12
  5 + day: new Date().getDate(), // 日期 1-31 若日期超过该月天数,月份自动增加
  6 + header_show: true, // 主标题是否显示
  7 + prev: true, // 上一个月按钮是否显示
  8 + next: true, // 下一个月按钮是否显示
  9 + },
  10 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "calendar": "plugin://bmCalendar/calendar"
  5 + }
  6 +}
  1 +<calendar
  2 +cur-year="{{curYear}}"
  3 +cur-month="{{curMonth}}"
  4 +day="{{day}}"
  5 +header_show='{{header_show}}'
  6 +prev='{{prev}}'
  7 +next='{{next}}'
  8 +calendar-style="calendar-style"
  9 +weektitle-style="week-style"
  10 +datefont-style="datefont-style"
  11 +header-style="header-style"
  12 +active-colort="active-colort"/>
  1 +.calendar-style{
  2 + background: #FFFBF2;
  3 +}
  4 +.week-style{
  5 + color:#999;
  6 + font-size:28rpx;
  7 + font-weight:bold;
  8 +}
  9 +.datefont-style{
  10 + color:#353535;
  11 + font-size:30rpx;
  12 + font-weight:bold;
  13 +}
  14 +.header-style{
  15 + color:#353535;
  16 + font-size:30rpx;
  17 + font-weight:bold;
  18 +}
  19 +.active-colort{
  20 +
  21 +}
1 // pages/customer/detail_owner.js 1 // pages/customer/detail_owner.js
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
  4 +
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 import TP from '../../utils/tpls'; 6 import TP from '../../utils/tpls';
  7 +
6 Page({ 8 Page({
7 9
8 /** 10 /**
9 * 页面的初始数据 11 * 页面的初始数据
10 */ 12 */
11 data: { 13 data: {
12 - detail:null, 14 + detail: null,
  15 + hasOnlineReserve: false,
13 }, 16 },
14 - id:null,  
15 - tpls:TP.tpls(), 17 + id: null,
  18 + tpls: TP.tpls(),
16 /** 19 /**
17 * 生命周期函数--监听页面加载 20 * 生命周期函数--监听页面加载
18 */ 21 */
19 onLoad: function (options) { 22 onLoad: function (options) {
20 - this.id=options.id; 23 + this.id = options.id;
21 }, 24 },
22 25
23 /** 26 /**
@@ -31,81 +34,83 @@ Page({ @@ -31,81 +34,83 @@ Page({
31 * 生命周期函数--监听页面显示 34 * 生命周期函数--监听页面显示
32 */ 35 */
33 onShow: function () { 36 onShow: function () {
34 - App.Reserve.Detail({  
35 - openid: getApp().openid,  
36 - rid: this.id  
37 - }).then(res => {  
38 - this.setData({  
39 - detail:this.formatDatail(res.data)  
40 - }) 37 + App.Reserve.Detail({
  38 + openid: getApp().openid,
  39 + rid: this.id
  40 + }).then(res => {
  41 + this.setData({
  42 + detail: this.formatDatail(res.data),
  43 + hasOnlineReserve:res.data.type==0,
41 }) 44 })
  45 + })
42 }, 46 },
43 47
44 /** 48 /**
45 * 生命周期函数--监听页面隐藏 49 * 生命周期函数--监听页面隐藏
46 */ 50 */
47 onHide: function () { 51 onHide: function () {
48 - 52 +
49 }, 53 },
50 54
51 /** 55 /**
52 * 生命周期函数--监听页面卸载 56 * 生命周期函数--监听页面卸载
53 */ 57 */
54 onUnload: function () { 58 onUnload: function () {
55 - 59 +
56 }, 60 },
57 61
58 /** 62 /**
59 * 用户点击右上角分享 63 * 用户点击右上角分享
60 */ 64 */
61 onShareAppMessage: function (e) { 65 onShareAppMessage: function (e) {
62 - console.log('onShareAppMessage',arguments) 66 + console.log('onShareAppMessage', arguments)
63 return this.shareSetting(e); 67 return this.shareSetting(e);
64 }, 68 },
65 - formatDatail(detail){  
66 - detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II');  
67 - detail.tableFirst=detail.tables[0].name;  
68 - if(detail.tables.length>1){  
69 - detail.tableSubInfo='等'+(detail.tables.length)+'个'  
70 - +(detail.tables[0].tid==2?'包间':'');  
71 - }  
72 - // if(!detail.cusman){  
73 - // detail.cusman='vking';  
74 - // detail.cusman_phone='15877556369';  
75 - // detail.cusman_account='wx:vking';  
76 - // }  
77 - let ns=new Date()/1000  
78 - detail.hasCancel=detail.status==4  
79 - detail.hasOvered=false  
80 - if(!detail.hasCancel){  
81 - detail.hasOvered=ns>detail.ddate || detail.status>=2 69 + formatDatail(detail) {
  70 + detail.rdateStr = util.unixtoTime(detail.ddate, 'MM月DD日 WW HH:II');
  71 + detail.tableFirst = detail.tables[0].name;
  72 + if (detail.tables.length > 1) {
  73 + detail.tableSubInfo = '等' + (detail.tables.length) + '个'
  74 + + (detail.tables[0].tid == 2 ? '包间' : '');
82 } 75 }
83 - return detail;  
84 - },  
85 - showManager(){  
86 - this.selectComponent('#manager').show();  
87 - },  
88 - lookLocation:function(){  
89 - wx.openLocation({  
90 - latitude:Number(this.data.detail.seller.lat),  
91 - longitude:Number(this.data.detail.seller.long),  
92 - scale:17,  
93 - address:this.data.detail.seller.map_address,  
94 - success:function (res) {  
95 - console.log(res)  
96 - }  
97 - })  
98 - },  
99 - userinfo(e){  
100 - console.log('userinfo',e)  
101 - util.toast('授权成功,可以继续转发','none');  
102 - // wx.navigateTo({  
103 - // url:'invite?id='+this.id,  
104 - // });  
105 - },  
106 - shareSetting(e){  
107 - console.log('shareSetting',e.target.dataset);  
108 - let hasInvitation=e.target.dataset.act=='invitation'; 76 + // if(!detail.cusman){
  77 + // detail.cusman='vking';
  78 + // detail.cusman_phone='15877556369';
  79 + // detail.cusman_account='wx:vking';
  80 + // }
  81 + let ns = new Date() / 1000
  82 + detail.hasCancel = detail.status == 4
  83 + detail.hasOvered = false
  84 + if (!detail.hasCancel) {
  85 + detail.hasOvered = ns > detail.ddate || detail.status >= 2
  86 + }
  87 + detail.seller.seller_tel=detail.seller.seller_tel.split(',');
  88 + return detail;
  89 + },
  90 + showManager() {
  91 + this.selectComponent('#manager').show();
  92 + },
  93 + lookLocation: function () {
  94 + wx.openLocation({
  95 + latitude: Number(this.data.detail.seller.lat),
  96 + longitude: Number(this.data.detail.seller.long),
  97 + scale: 17,
  98 + address: this.data.detail.seller.map_address,
  99 + success: function (res) {
  100 + console.log(res)
  101 + }
  102 + })
  103 + },
  104 + userinfo(e) {
  105 + console.log('userinfo', e)
  106 + util.toast('授权成功,可以继续转发', 'none');
  107 + // wx.navigateTo({
  108 + // url:'invite?id='+this.id,
  109 + // });
  110 + },
  111 + shareSetting(e) {
  112 + console.log('shareSetting', e.target.dataset);
  113 + let hasInvitation = e.target.dataset.act == 'invitation';
109 if (this.topicVal && this.data.detail.openid == getApp().openid) { 114 if (this.topicVal && this.data.detail.openid == getApp().openid) {
110 App.Reserve.SetTopicFromShare({ 115 App.Reserve.SetTopicFromShare({
111 rid: this.id, 116 rid: this.id,
@@ -117,39 +122,68 @@ Page({ @@ -117,39 +122,68 @@ Page({
117 nickname = util.cache('userInfo').nickName; 122 nickname = util.cache('userInfo').nickName;
118 } catch (e) { 123 } catch (e) {
119 } 124 }
120 - let obj={ 125 + let obj = {
121 //title: (nickname || '') + '给你发了一个邀请,点击查看', 126 //title: (nickname || '') + '给你发了一个邀请,点击查看',
122 title: this.tpls[0].shareTitle, 127 title: this.tpls[0].shareTitle,
123 - path: '/pages/customer/index?id=' + this.id + '&fromid=' + getApp().openid + '&invite_name=' + nickname+'&hasInvitation=1&tplid=1', 128 + path: '/pages/customer/index?id=' + this.id + '&fromid=' + getApp().openid + '&invite_name=' + nickname + '&hasInvitation=1&tplid=1',
124 imageUrl: this.tpls[0].shareImage, 129 imageUrl: this.tpls[0].shareImage,
125 } 130 }
126 - if(hasInvitation){ 131 + if (hasInvitation) {
127 //obj.title=(nickname || '') + '给你发了一个邀请函,点击查看'; 132 //obj.title=(nickname || '') + '给你发了一个邀请函,点击查看';
128 - obj.path=obj.path+'&hasInvitation=1'; 133 + obj.path = obj.path + '&hasInvitation=1';
129 } 134 }
130 return obj; 135 return obj;
131 }, 136 },
132 - cookbook(){  
133 - if(this.data.detail.order && this.data.detail.order.cookbooklist.length>0){ 137 + cookbook() {
  138 + if (this.data.detail.order && this.data.detail.order.cookbooklist.length > 0) {
134 wx.navigateTo({ 139 wx.navigateTo({
135 - url:util.http_build_query({rid:this.id,oid:this.data.detail.order.id,identity:1},'/pack-cookbook/pages/success') 140 + url: util.http_build_query({
  141 + rid: this.id,
  142 + oid: this.data.detail.order.id,
  143 + identity: 1
  144 + }, '/pack-cookbook/pages/success')
136 }); 145 });
137 - }else{ 146 + } else {
138 App.Advance.CreateOrder({ 147 App.Advance.CreateOrder({
139 - rid:this.id,  
140 - openid:getApp().openid,  
141 - }).then(res=>{  
142 - if(res.ret!=200){  
143 - return util.toast(res.msg,'none') 148 + rid: this.id,
  149 + openid: getApp().openid,
  150 + }).then(res => {
  151 + if (res.ret != 200) {
  152 + return util.toast(res.msg, 'none')
144 } 153 }
145 wx.navigateTo({ 154 wx.navigateTo({
146 - url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1,sid:res.data.sellerid},'/pack-cookbook/pages/index') 155 + url: util.http_build_query({
  156 + rid: this.id,
  157 + oid: res.data.id,
  158 + identity: 1,
  159 + sid: res.data.sellerid
  160 + }, '/pack-cookbook/pages/index')
147 }); 161 });
148 }) 162 })
149 } 163 }
150 164
151 }, 165 },
152 - wineGo(){  
153 - util.toast('本区域暂无配送人员','none'); 166 + wineGo() {
  167 + util.toast('本区域暂无配送人员', 'none');
  168 + },
  169 + callSeller(){
  170 + let seller_tel=this.data.detail.seller.seller_tel
  171 + if(seller_tel.length<1) return util.toast('商家电话错误','none')
  172 + if(seller_tel.length==1){//只有一个电话
  173 + let phone=seller_tel[0].replace(/[^\d]/,'')
  174 + wx.makePhoneCall({
  175 + phoneNumber:phone
  176 + })
  177 + }else{
  178 + this.selectComponent('#as').show();
  179 + }
  180 + },
  181 + callSellerPhone(e){
  182 + if(e.detail.value){
  183 + let phone=e.detail.value.replace(/[^\d]/,'')
  184 + wx.makePhoneCall({
  185 + phoneNumber:phone
  186 + })
  187 + }
154 }, 188 },
155 }) 189 })
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "manager": "/components/manager/manager", 8 "manager": "/components/manager/manager",
9 "nav":"/components/nav/nav", 9 "nav":"/components/nav/nav",
10 "card":"/components/seller-card/seller-card", 10 "card":"/components/seller-card/seller-card",
11 - "formids":"/components/formids/formids" 11 + "formids":"/components/formids/formids",
  12 + "as":"/components/actionSheet/index"
12 } 13 }
13 } 14 }
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 </block> 59 </block>
60 60
61 <view style="height: 40rpx;"></view> 61 <view style="height: 40rpx;"></view>
62 - <card seller="{{detail.seller}}" detail="{{detail}}"></card> 62 + <card seller="{{detail.seller}}" detail="{{detail}}" hasOnlineReserve="{{hasOnlineReserve}}"></card>
63 <view class="detail-info Medium" style="margin-top: 56rpx;"> 63 <view class="detail-info Medium" style="margin-top: 56rpx;">
64 <view class="flex-lr"> 64 <view class="flex-lr">
65 <view>预订人</view> 65 <view>预订人</view>
@@ -94,14 +94,13 @@ @@ -94,14 +94,13 @@
94 <image src="http://qn.colorcun.com/custom/lite-yd/image/click.png" class="more"></image> 94 <image src="http://qn.colorcun.com/custom/lite-yd/image/click.png" class="more"></image>
95 </view> 95 </view>
96 </formids> 96 </formids>
97 - <view class="detail-info Medium">  
98 - <view class="flex-lr">  
99 - <view>退订政策</view>  
100 - </view>  
101 - <view class="flex-lr" style="margin-top: 43rpx;">  
102 - <view>免费退订,已提前点菜,交押金,无法退订</view> 97 + <view class="detail-info Medium tuiding">
  98 + <view class="flex-rr">
  99 + <view class="item" bindtap="callSeller">联系商家</view>
  100 + <view class="item" bindtap="callSeller">取消预订</view>
103 </view> 101 </view>
104 </view> 102 </view>
105 <view style="height: 50rpx;"></view> 103 <view style="height: 50rpx;"></view>
106 </view> 104 </view>
107 -<manager manager="{{detail}}" id="manager"></manager>  
  105 +<manager manager="{{detail}}" id="manager"></manager>
  106 +<as id="as" items="{{detail.seller.seller_tel}}" bindclick="callSellerPhone">拨打电话</as>
@@ -125,4 +125,11 @@ @@ -125,4 +125,11 @@
125 width: 44rpx; 125 width: 44rpx;
126 height: 30rpx; 126 height: 30rpx;
127 margin-left: 10rpx; 127 margin-left: 10rpx;
  128 +}
  129 +.tuiding{
  130 + font-size: 30rpx;
  131 +}
  132 +.tuiding .item{
  133 + margin-left: 40rpx;
  134 + text-decoration: underline;
128 } 135 }
@@ -253,4 +253,16 @@ Page({ @@ -253,4 +253,16 @@ Page({
253 activeTab:util.attr(e,'act'), 253 activeTab:util.attr(e,'act'),
254 }) 254 })
255 }, 255 },
  256 + reserve:{},
  257 + selectpeople(e){
  258 + console.log(e);
  259 + this.reserve.pnum=e.detail.people;
  260 + if(e.detail.action=='click'){
  261 + this.reserve.sid=this.options.id
  262 + this.reserve.ddate=util.timetouUnix(this.reserve.date+' '+this.reserve.time+':00')
  263 + wx.navigateTo({
  264 + url:util.http_build_query(this.reserve,'./submit')
  265 + })
  266 + }
  267 + },
256 }) 268 })
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 "getpos":"/components/userinfo/getpos", 12 "getpos":"/components/userinfo/getpos",
13 "discount":"/components/reserve/discount", 13 "discount":"/components/reserve/discount",
14 "share":"/components/reserve/share/share", 14 "share":"/components/reserve/share/share",
15 - "people":"/components/reserve/people/people",  
16 - "dur":"/components/reserve/dur/dur" 15 + "people":"/components/reserve/people/people",
  16 + "dur":"/components/reserve/dur/dur"
17 } 17 }
18 } 18 }
@@ -196,6 +196,6 @@ @@ -196,6 +196,6 @@
196 </block> 196 </block>
197 <block wx:if="{{activeTab=='reserve'}}"> 197 <block wx:if="{{activeTab=='reserve'}}">
198 <view class="olreserve"> 198 <view class="olreserve">
199 - 199 + <people seller="{{seller}}" bindselectpeople="selectpeople"></people>
200 </view> 200 </view>
201 </block> 201 </block>
@@ -464,10 +464,15 @@ @@ -464,10 +464,15 @@
464 "scene": null 464 "scene": null
465 }, 465 },
466 { 466 {
  467 +<<<<<<< HEAD
467 "id": 56, 468 "id": 56,
468 "name": "测试组件", 469 "name": "测试组件",
469 "pathName": "pages/reserve/detail", 470 "pathName": "pages/reserve/detail",
470 "query": "id=154", 471 "query": "id=154",
  472 + "id": -1,
  473 + "name": "pages/customer/detail_owner",
  474 + "pathName": "pages/customer/detail_owner",
  475 + "query": "id=18599",
471 "scene": null 476 "scene": null
472 } 477 }
473 ] 478 ]