Showing
13 changed files
with
317 additions
and
44 deletions
| @@ -37,8 +37,8 @@ | @@ -37,8 +37,8 @@ | ||
| 37 | <view class="flex-treble flex flex-direction"> | 37 | <view class="flex-treble flex flex-direction"> |
| 38 | <view class="txt-26-h text-bold" style="margin-bottom: 6rpx;">{{post.sellerinfo.sellername}}</view> | 38 | <view class="txt-26-h text-bold" style="margin-bottom: 6rpx;">{{post.sellerinfo.sellername}}</view> |
| 39 | <view class="flex txt-24-h text-gray"> | 39 | <view class="flex txt-24-h text-gray"> |
| 40 | - <view>{{post.sellerinfo.name}}</view> | ||
| 41 | - <view>{{post.sellerinfo.c_info}}</view> | 40 | + <view wx:if="{{post.sellerinfo.name}}">{{post.sellerinfo.name}}</view> |
| 41 | + <view wx:if="{{post.sellerinfo.c_info}}">{{post.sellerinfo.c_info}}</view> | ||
| 42 | <view wx:if="{{post.sellerinfo.average>0}}">¥{{post.sellerinfo.average}}/人</view> | 42 | <view wx:if="{{post.sellerinfo.average>0}}">¥{{post.sellerinfo.average}}/人</view> |
| 43 | </view> | 43 | </view> |
| 44 | </view> | 44 | </view> |
| 1 | // components/2.0/reserve/card.js | 1 | // components/2.0/reserve/card.js |
| 2 | import util from '../../../utils/util'; | 2 | import util from '../../../utils/util'; |
| 3 | import RS from '../../../utils/reserveStatus' | 3 | import RS from '../../../utils/reserveStatus' |
| 4 | +import App from '../../../utils/api'; | ||
| 4 | Component({ | 5 | Component({ |
| 5 | /** | 6 | /** |
| 6 | * 组件的属性列表 | 7 | * 组件的属性列表 |
| @@ -14,7 +15,7 @@ Component({ | @@ -14,7 +15,7 @@ Component({ | ||
| 14 | * 组件的初始数据 | 15 | * 组件的初始数据 |
| 15 | */ | 16 | */ |
| 16 | data: { | 17 | data: { |
| 17 | - | 18 | + ddate_Str:'', |
| 18 | }, | 19 | }, |
| 19 | attached(){ | 20 | attached(){ |
| 20 | //this.init() | 21 | //this.init() |
| @@ -38,9 +39,58 @@ Component({ | @@ -38,9 +39,58 @@ Component({ | ||
| 38 | }) | 39 | }) |
| 39 | detail.ddateStr=util.unixtoTime(detail.ddate,'MM月DD日,`DAY/周WW`') | 40 | detail.ddateStr=util.unixtoTime(detail.ddate,'MM月DD日,`DAY/周WW`') |
| 40 | console.log('detail.init',detail) | 41 | console.log('detail.init',detail) |
| 42 | + this.getLocalLunchTime(detail.sid,detail.date,detail.section) | ||
| 41 | this.setData({ | 43 | this.setData({ |
| 42 | reserve:detail, | 44 | reserve:detail, |
| 43 | }) | 45 | }) |
| 44 | - } | 46 | + }, |
| 47 | + //获取日期对应的多时段 | ||
| 48 | + getLocalLunchTime(sid,date,section){ | ||
| 49 | + App.Seller.getMealSectionByDay({ | ||
| 50 | + sellerid: sid, | ||
| 51 | + day: date, | ||
| 52 | + }).then(res => { | ||
| 53 | + let data = res.data; | ||
| 54 | + let lunchDinnerList = []; | ||
| 55 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 56 | + data.forEach(i => { | ||
| 57 | + if (i.mname == '早餐') { | ||
| 58 | + lunchDinnerList.push({ | ||
| 59 | + mname: "早餐", | ||
| 60 | + mdate: i.mdate, | ||
| 61 | + ddate_solt: 1, | ||
| 62 | + }) | ||
| 63 | + } | ||
| 64 | + if (i.mname == '午餐') { | ||
| 65 | + lunchDinnerList.push({ | ||
| 66 | + mname: "午餐", | ||
| 67 | + mdate: i.mdate, | ||
| 68 | + ddate_solt: 2, | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + if (i.mname == '晚餐') { | ||
| 72 | + lunchDinnerList.push({ | ||
| 73 | + mname: "晚餐", | ||
| 74 | + mdate: i.mdate, | ||
| 75 | + ddate_solt: 3, | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | + }) | ||
| 79 | + } else { | ||
| 80 | + lunchDinnerList = data; | ||
| 81 | + } | ||
| 82 | + lunchDinnerList.forEach((item,index)=>{ | ||
| 83 | + item.section = 'ket'+index | ||
| 84 | + }) | ||
| 85 | + let obj=lunchDinnerList.filter(item=>{return item.section == section}) | ||
| 86 | + if(obj && obj.length>0){ | ||
| 87 | + this.setData({ | ||
| 88 | + ddate_Str:obj[0].mname | ||
| 89 | + }) | ||
| 90 | + } | ||
| 91 | + }).catch(res => { | ||
| 92 | + console.log(res, '获取多时段失败'); | ||
| 93 | + }) | ||
| 94 | + }, | ||
| 45 | } | 95 | } |
| 46 | }) | 96 | }) |
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | <view class="view flex align-center" style="margin-bottom: 44rpx;"> | 16 | <view class="view flex align-center" style="margin-bottom: 44rpx;"> |
| 17 | <view class="view flex-sub bg-white Medium">预订时间</view> | 17 | <view class="view flex-sub bg-white Medium">预订时间</view> |
| 18 | <view class="view flex-treble text-bold" style="font-size: 36rpx;"> | 18 | <view class="view flex-treble text-bold" style="font-size: 36rpx;"> |
| 19 | - <view class="value">{{reserve.ddateStr}},{{util.reserveTimeSpace(reserve.section)}}</view> | 19 | + <view class="value">{{reserve.ddateStr}},{{ddate_Str}}</view> |
| 20 | </view> | 20 | </view> |
| 21 | </view> | 21 | </view> |
| 22 | <view class="view flex align-center"> | 22 | <view class="view flex align-center"> |
| @@ -15,7 +15,7 @@ Component({ | @@ -15,7 +15,7 @@ Component({ | ||
| 15 | * 组件的初始数据 | 15 | * 组件的初始数据 |
| 16 | */ | 16 | */ |
| 17 | data: { | 17 | data: { |
| 18 | - | 18 | + ddate_Str:'', |
| 19 | }, | 19 | }, |
| 20 | attached(){ | 20 | attached(){ |
| 21 | //this.init() | 21 | //this.init() |
| @@ -53,12 +53,65 @@ Component({ | @@ -53,12 +53,65 @@ Component({ | ||
| 53 | reserve:detail, | 53 | reserve:detail, |
| 54 | }) | 54 | }) |
| 55 | console.log('666666',detail); | 55 | console.log('666666',detail); |
| 56 | - | 56 | + this.getLocalLunchTime(detail) |
| 57 | if(this.data.tabType==6){ | 57 | if(this.data.tabType==6){ |
| 58 | this.remark('auto'); | 58 | this.remark('auto'); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | }, | 61 | }, |
| 62 | + //获取日期对应的多时段 | ||
| 63 | + getLocalLunchTime(detail){ | ||
| 64 | + let ddateStr = new Date(detail.ddate * 1000) | ||
| 65 | + let year = ddateStr.getFullYear(); | ||
| 66 | + let month = ddateStr.getMonth() + 1; | ||
| 67 | + let day = ddateStr.getDate(); | ||
| 68 | + let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + day; | ||
| 69 | + App.Seller.getMealSectionByDay({ | ||
| 70 | + sellerid: detail.seller.id, | ||
| 71 | + day: day1, | ||
| 72 | + }).then(res => { | ||
| 73 | + let data = res.data; | ||
| 74 | + let lunchDinnerList = []; | ||
| 75 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 76 | + data.forEach(i => { | ||
| 77 | + if (i.mname == '早餐') { | ||
| 78 | + lunchDinnerList.push({ | ||
| 79 | + mname: "早餐", | ||
| 80 | + mdate: i.mdate, | ||
| 81 | + ddate_solt: 1, | ||
| 82 | + }) | ||
| 83 | + } | ||
| 84 | + if (i.mname == '午餐') { | ||
| 85 | + lunchDinnerList.push({ | ||
| 86 | + mname: "午餐", | ||
| 87 | + mdate: i.mdate, | ||
| 88 | + ddate_solt: 2, | ||
| 89 | + }) | ||
| 90 | + } | ||
| 91 | + if (i.mname == '晚餐') { | ||
| 92 | + lunchDinnerList.push({ | ||
| 93 | + mname: "晚餐", | ||
| 94 | + mdate: i.mdate, | ||
| 95 | + ddate_solt: 3, | ||
| 96 | + }) | ||
| 97 | + } | ||
| 98 | + }) | ||
| 99 | + } else { | ||
| 100 | + lunchDinnerList = data; | ||
| 101 | + } | ||
| 102 | + lunchDinnerList.forEach((item,index)=>{ | ||
| 103 | + item.section = 'ket'+index | ||
| 104 | + }) | ||
| 105 | + let obj=lunchDinnerList.filter(item=>{return item.ddate_solt == detail.ddate_solt}) | ||
| 106 | + if(obj && obj.length>0){ | ||
| 107 | + this.setData({ | ||
| 108 | + ddate_Str:obj[0].mname | ||
| 109 | + }) | ||
| 110 | + } | ||
| 111 | + }).catch(res => { | ||
| 112 | + console.log(res, '获取多时段失败'); | ||
| 113 | + }) | ||
| 114 | + }, | ||
| 62 | openlocation(){ | 115 | openlocation(){ |
| 63 | console.log('6666666') | 116 | console.log('6666666') |
| 64 | wx.openLocation({ | 117 | wx.openLocation({ |
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | <view class="view flex-sub bg-white Medium">预订时间</view> | 25 | <view class="view flex-sub bg-white Medium">预订时间</view> |
| 26 | <view class="view flex-treble text-bold" style="font-size: 36rpx;"> | 26 | <view class="view flex-treble text-bold" style="font-size: 36rpx;"> |
| 27 | <view class="value" wx:if="{{reserve.hasOnlineReserve || reserve.hasUpdateDate || reserve.type==0}}"> | 27 | <view class="value" wx:if="{{reserve.hasOnlineReserve || reserve.hasUpdateDate || reserve.type==0}}"> |
| 28 | - <text wx:if="{{reserve.ddate>0}}">{{util.unixtoTime(reserve.ddate||'','MM月DD日')}} {{reserve.soltName}}</text> | 28 | + <text wx:if="{{reserve.ddate>0}}">{{util.unixtoTime(reserve.ddate||'','MM月DD日')}} {{ddate_Str}}</text> |
| 29 | </view> | 29 | </view> |
| 30 | <view class="value" wx:else="">{{reserve.rdateStr}}</view> | 30 | <view class="value" wx:else="">{{reserve.rdateStr}}</view> |
| 31 | </view> | 31 | </view> |
| 1 | // components/2.0/reserve/card.js | 1 | // components/2.0/reserve/card.js |
| 2 | import util from '../../../../utils/util'; | 2 | import util from '../../../../utils/util'; |
| 3 | import RS from '../../../../utils/reserveStatus' | 3 | import RS from '../../../../utils/reserveStatus' |
| 4 | +import App from '../../../../utils/api'; | ||
| 4 | Component({ | 5 | Component({ |
| 5 | /** | 6 | /** |
| 6 | * 组件的属性列表 | 7 | * 组件的属性列表 |
| @@ -13,7 +14,7 @@ Component({ | @@ -13,7 +14,7 @@ Component({ | ||
| 13 | * 组件的初始数据 | 14 | * 组件的初始数据 |
| 14 | */ | 15 | */ |
| 15 | data: { | 16 | data: { |
| 16 | - | 17 | + ddate_Str:'' |
| 17 | }, | 18 | }, |
| 18 | attached(){ | 19 | attached(){ |
| 19 | //this.init() | 20 | //this.init() |
| @@ -47,6 +48,7 @@ Component({ | @@ -47,6 +48,7 @@ Component({ | ||
| 47 | } | 48 | } |
| 48 | detail.tableFirst=tableFirst | 49 | detail.tableFirst=tableFirst |
| 49 | detail.tableSubInfo=tableSubInfo | 50 | detail.tableSubInfo=tableSubInfo |
| 51 | + this.getLocalLunchTime(detail) | ||
| 50 | this.setData({ | 52 | this.setData({ |
| 51 | reserve:detail, | 53 | reserve:detail, |
| 52 | }) | 54 | }) |
| @@ -54,5 +56,58 @@ Component({ | @@ -54,5 +56,58 @@ Component({ | ||
| 54 | asPhone(){ | 56 | asPhone(){ |
| 55 | this.selectComponent('#as-phone').show(this.data.reserve.seller); | 57 | this.selectComponent('#as-phone').show(this.data.reserve.seller); |
| 56 | }, | 58 | }, |
| 59 | + //获取日期对应的多时段 | ||
| 60 | + getLocalLunchTime(detail){ | ||
| 61 | + let ddateStr = new Date(detail.ddate * 1000) | ||
| 62 | + let year = ddateStr.getFullYear(); | ||
| 63 | + let month = ddateStr.getMonth() + 1; | ||
| 64 | + let day = ddateStr.getDate(); | ||
| 65 | + let day1 = year + '-' + (month < 10 ? '0' + month : month) + '-' + day; | ||
| 66 | + App.Seller.getMealSectionByDay({ | ||
| 67 | + sellerid: detail.sid, | ||
| 68 | + day: day1, | ||
| 69 | + }).then(res => { | ||
| 70 | + let data = res.data; | ||
| 71 | + let lunchDinnerList = []; | ||
| 72 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 73 | + data.forEach(i => { | ||
| 74 | + if (i.mname == '早餐') { | ||
| 75 | + lunchDinnerList.push({ | ||
| 76 | + mname: "早餐", | ||
| 77 | + mdate: i.mdate, | ||
| 78 | + ddate_solt: 1, | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + if (i.mname == '午餐') { | ||
| 82 | + lunchDinnerList.push({ | ||
| 83 | + mname: "午餐", | ||
| 84 | + mdate: i.mdate, | ||
| 85 | + ddate_solt: 2, | ||
| 86 | + }) | ||
| 87 | + } | ||
| 88 | + if (i.mname == '晚餐') { | ||
| 89 | + lunchDinnerList.push({ | ||
| 90 | + mname: "晚餐", | ||
| 91 | + mdate: i.mdate, | ||
| 92 | + ddate_solt: 3, | ||
| 93 | + }) | ||
| 94 | + } | ||
| 95 | + }) | ||
| 96 | + } else { | ||
| 97 | + lunchDinnerList = data; | ||
| 98 | + } | ||
| 99 | + lunchDinnerList.forEach((item,index)=>{ | ||
| 100 | + item.section = 'ket'+index | ||
| 101 | + }) | ||
| 102 | + let obj=lunchDinnerList.filter(item=>{return item.ddate_solt == detail.ddate_solt}) | ||
| 103 | + if(obj && obj.length>0){ | ||
| 104 | + this.setData({ | ||
| 105 | + ddate_Str:obj[0].mname | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + }).catch(res => { | ||
| 109 | + console.log(res, '获取多时段失败'); | ||
| 110 | + }) | ||
| 111 | + }, | ||
| 57 | } | 112 | } |
| 58 | }) | 113 | }) |
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | <view class="view flex-sub bg-white Medium" style="min-width: 172rpx;">预订时间</view> | 20 | <view class="view flex-sub bg-white Medium" style="min-width: 172rpx;">预订时间</view> |
| 21 | <view class="view flex-treble text-bold text-lg"> | 21 | <view class="view flex-treble text-bold text-lg"> |
| 22 | <view class="value" wx:if="{{reserve.hasOnlineReserve || reserve.hasUpdateDate || reserve.type==0}}"> | 22 | <view class="value" wx:if="{{reserve.hasOnlineReserve || reserve.hasUpdateDate || reserve.type==0}}"> |
| 23 | - <text wx:if="{{reserve.ddate>0}}">{{util.unixtoTime(reserve.ddate||'','MM月DD日')}} {{reserve.soltName}}</text> | 23 | + <text wx:if="{{reserve.ddate>0}}">{{util.unixtoTime(reserve.ddate||'','MM月DD日')}} {{ddate_Str}}</text> |
| 24 | </view> | 24 | </view> |
| 25 | <view class="value" wx:else="">{{reserve.rdateStr}}</view> | 25 | <view class="value" wx:else="">{{reserve.rdateStr}}</view> |
| 26 | </view> | 26 | </view> |
| @@ -14,12 +14,12 @@ Component({ | @@ -14,12 +14,12 @@ Component({ | ||
| 14 | attached(){ | 14 | attached(){ |
| 15 | }, | 15 | }, |
| 16 | observers: { | 16 | observers: { |
| 17 | - 'date'(newdate){ | 17 | + 'date': async function(newdate) { |
| 18 | console.log('section',this.data.date,newdate,this.data.section) | 18 | console.log('section',this.data.date,newdate,this.data.section) |
| 19 | //今天日期 | 19 | //今天日期 |
| 20 | if(newdate){ | 20 | if(newdate){ |
| 21 | let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); | 21 | let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); |
| 22 | - this.getsectionlist(); | 22 | + await this.getsectionlist(); |
| 23 | if(today==newdate){ | 23 | if(today==newdate){ |
| 24 | this.markoversection(); | 24 | this.markoversection(); |
| 25 | }else{ | 25 | }else{ |
| @@ -57,30 +57,62 @@ Component({ | @@ -57,30 +57,62 @@ Component({ | ||
| 57 | }, | 57 | }, |
| 58 | methods:{ | 58 | methods:{ |
| 59 | getsectionlist(){ | 59 | getsectionlist(){ |
| 60 | - let section={'morning':'早餐','noon':'午餐','night':'晚餐','midnight':'夜宵'}; | ||
| 61 | - let sectionlist=[]; | ||
| 62 | - for(let key in this.data.seller.daily){ | ||
| 63 | - if(this.data.seller.daily[key]!=""){ | ||
| 64 | - sectionlist.push({ | ||
| 65 | - section:key, | ||
| 66 | - sectiondur:this.data.seller.daily[key], | ||
| 67 | - showmark:section[key], | ||
| 68 | - overdate:false, | ||
| 69 | - isselected:false | ||
| 70 | - }) | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - this.setData({ | ||
| 74 | - sectionlist:sectionlist | ||
| 75 | - }) | ||
| 76 | - console.log(sectionlist) | 60 | + return new Promise((resolve) => { |
| 61 | + App.Seller.getMealSectionByDay({ | ||
| 62 | + sellerid: this.data.seller.id, | ||
| 63 | + day: this.data.date, | ||
| 64 | + }).then(res => { | ||
| 65 | + let data = res.data; | ||
| 66 | + let lunchDinnerList = []; | ||
| 67 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 68 | + data.forEach(i => { | ||
| 69 | + if (i.mname == '早餐') { | ||
| 70 | + lunchDinnerList.push({ | ||
| 71 | + mname: "早餐", | ||
| 72 | + mdate: i.mdate, | ||
| 73 | + ddate_solt: 1, | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + if (i.mname == '午餐') { | ||
| 77 | + lunchDinnerList.push({ | ||
| 78 | + mname: "午餐", | ||
| 79 | + mdate: i.mdate, | ||
| 80 | + ddate_solt: 2, | ||
| 81 | + }) | ||
| 82 | + } | ||
| 83 | + if (i.mname == '晚餐') { | ||
| 84 | + lunchDinnerList.push({ | ||
| 85 | + mname: "晚餐", | ||
| 86 | + mdate: i.mdate, | ||
| 87 | + ddate_solt: 3, | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + }) | ||
| 91 | + } else { | ||
| 92 | + lunchDinnerList = data; | ||
| 93 | + } | ||
| 94 | + lunchDinnerList.forEach((item,index)=>{ | ||
| 95 | + item.sectiondur = item.mdate; | ||
| 96 | + item.showmark = item.mname; | ||
| 97 | + item.section = 'ket'+index | ||
| 98 | + item.overdate = false; | ||
| 99 | + item.isselected = false; | ||
| 100 | + }) | ||
| 101 | + this.setData({ | ||
| 102 | + sectionlist:lunchDinnerList | ||
| 103 | + }) | ||
| 104 | + resolve(); | ||
| 105 | + }).catch(res => { | ||
| 106 | + console.log(res, '获取多时段失败'); | ||
| 107 | + }) | ||
| 108 | + }) | ||
| 77 | }, | 109 | }, |
| 78 | markoversection(){ | 110 | markoversection(){ |
| 79 | let sectionlist=this.data.sectionlist; | 111 | let sectionlist=this.data.sectionlist; |
| 80 | //今天日期 | 112 | //今天日期 |
| 81 | let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); | 113 | let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); |
| 82 | let curtimestamp=Math.ceil(new Date()/1000); | 114 | let curtimestamp=Math.ceil(new Date()/1000); |
| 83 | - let interval=[],flag=false; | 115 | + let interval=[],flag=false; |
| 84 | sectionlist.forEach((v,i)=>{ | 116 | sectionlist.forEach((v,i)=>{ |
| 85 | let sectionarr=v.sectiondur.split('-'); | 117 | let sectionarr=v.sectiondur.split('-'); |
| 86 | if(curtimestamp>Number(util.timetouUnix(today+' '+sectionarr[1]+':00'))){ | 118 | if(curtimestamp>Number(util.timetouUnix(today+' '+sectionarr[1]+':00'))){ |
| @@ -128,11 +160,10 @@ Component({ | @@ -128,11 +160,10 @@ Component({ | ||
| 128 | selectsection(e){ | 160 | selectsection(e){ |
| 129 | let _target=e.currentTarget.dataset; | 161 | let _target=e.currentTarget.dataset; |
| 130 | this.changesectionstyle(_target.section); | 162 | this.changesectionstyle(_target.section); |
| 131 | - this.tellsection(_target.section,'click',_target.index); | ||
| 132 | - console.log(_target.index); | 163 | + this.tellsection(_target.section,'click',_target.index,_target.ddate_solt); |
| 133 | }, | 164 | }, |
| 134 | //通知时段 | 165 | //通知时段 |
| 135 | - tellsection(selectsection,action,index){ | 166 | + tellsection(selectsection,action,index,ddate_solt){ |
| 136 | console.log(index); | 167 | console.log(index); |
| 137 | //2019-12-13修改 | 168 | //2019-12-13修改 |
| 138 | // let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); | 169 | // let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD'); |
| @@ -142,7 +173,8 @@ Component({ | @@ -142,7 +173,8 @@ Component({ | ||
| 142 | let endtimestamp=Number(util.timetouUnix(this.data.date+' '+sectionarr[1]+':00')); | 173 | let endtimestamp=Number(util.timetouUnix(this.data.date+' '+sectionarr[1]+':00')); |
| 143 | let obj={ | 174 | let obj={ |
| 144 | section:selectsection, | 175 | section:selectsection, |
| 145 | - action:action | 176 | + action:action, |
| 177 | + ddate_solt, | ||
| 146 | } | 178 | } |
| 147 | console.log(curtimestamp,starttimestamp) | 179 | console.log(curtimestamp,starttimestamp) |
| 148 | if(curtimestamp<starttimestamp){ | 180 | if(curtimestamp<starttimestamp){ |
| @@ -16,4 +16,25 @@ | @@ -16,4 +16,25 @@ | ||
| 16 | .section-single.bg-yellow{ | 16 | .section-single.bg-yellow{ |
| 17 | background: #F4FAFF; | 17 | background: #F4FAFF; |
| 18 | border: 2rpx solid #42A5FF; | 18 | border: 2rpx solid #42A5FF; |
| 19 | +} | ||
| 20 | +.Semibold { | ||
| 21 | + overflow: hidden; | ||
| 22 | + word-break: break-all; | ||
| 23 | + text-overflow: ellipsis; | ||
| 24 | + display: -webkit-box; | ||
| 25 | + -webkit-box-orient: vertical; | ||
| 26 | + -webkit-line-clamp: 1; | ||
| 27 | + height: 40rpx; | ||
| 28 | + height: 40rpx; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +.blue-font { | ||
| 32 | + overflow: hidden; | ||
| 33 | + word-break: break-all; | ||
| 34 | + text-overflow: ellipsis; | ||
| 35 | + display: -webkit-box; | ||
| 36 | + -webkit-box-orient: vertical; | ||
| 37 | + -webkit-line-clamp: 1; | ||
| 38 | + height: 40rpx; | ||
| 39 | + height: 40rpx; | ||
| 19 | } | 40 | } |
| @@ -14,6 +14,7 @@ Page({ | @@ -14,6 +14,7 @@ Page({ | ||
| 14 | loading:0, | 14 | loading:0, |
| 15 | seller:null, | 15 | seller:null, |
| 16 | hasFullHouse:false,//满房 | 16 | hasFullHouse:false,//满房 |
| 17 | + lunchDinnerList:[],//日期所对应的餐段 | ||
| 17 | }, | 18 | }, |
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| @@ -27,6 +28,7 @@ Page({ | @@ -27,6 +28,7 @@ Page({ | ||
| 27 | console.log('初次进入详情页---小米8测试',this.data.reserveDate ? this.data.reserveDate : '没有日期','openid:',getApp().openid) | 28 | console.log('初次进入详情页---小米8测试',this.data.reserveDate ? this.data.reserveDate : '没有日期','openid:',getApp().openid) |
| 28 | this.options=options | 29 | this.options=options |
| 29 | this.downloadImages() | 30 | this.downloadImages() |
| 31 | + this.getLocalLunchTime() | ||
| 30 | if(options.activeTab && options.activeTab!='detail'){ | 32 | if(options.activeTab && options.activeTab!='detail'){ |
| 31 | this.setData({ | 33 | this.setData({ |
| 32 | activeTab:options.activeTab||'detail', | 34 | activeTab:options.activeTab||'detail', |
| @@ -46,6 +48,52 @@ Page({ | @@ -46,6 +48,52 @@ Page({ | ||
| 46 | this.reserve.time=options.time; | 48 | this.reserve.time=options.time; |
| 47 | } | 49 | } |
| 48 | }, | 50 | }, |
| 51 | +//获取日期对应的多时段 | ||
| 52 | + getLocalLunchTime(){ | ||
| 53 | + let options=this.options | ||
| 54 | + App.Seller.getMealSectionByDay({ | ||
| 55 | + sellerid: options.id, | ||
| 56 | + day: this.reserve.date, | ||
| 57 | + }).then(res => { | ||
| 58 | + let data = res.data; | ||
| 59 | + let lunchDinnerList = []; | ||
| 60 | + if (data.length <= 3 && !data[0].ddate_solt) { | ||
| 61 | + data.forEach(i => { | ||
| 62 | + if (i.mname == '早餐') { | ||
| 63 | + lunchDinnerList.push({ | ||
| 64 | + mname: "早餐", | ||
| 65 | + mdate: i.mdate, | ||
| 66 | + ddate_solt: 1, | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + if (i.mname == '午餐') { | ||
| 70 | + lunchDinnerList.push({ | ||
| 71 | + mname: "午餐", | ||
| 72 | + mdate: i.mdate, | ||
| 73 | + ddate_solt: 2, | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + if (i.mname == '晚餐') { | ||
| 77 | + lunchDinnerList.push({ | ||
| 78 | + mname: "晚餐", | ||
| 79 | + mdate: i.mdate, | ||
| 80 | + ddate_solt: 3, | ||
| 81 | + }) | ||
| 82 | + } | ||
| 83 | + }) | ||
| 84 | + } else { | ||
| 85 | + lunchDinnerList = data; | ||
| 86 | + } | ||
| 87 | + lunchDinnerList.forEach((item,index)=>{ | ||
| 88 | + item.section = 'ket'+index | ||
| 89 | + }) | ||
| 90 | + this.setData({ | ||
| 91 | + lunchDinnerList | ||
| 92 | + }) | ||
| 93 | + }).catch(res => { | ||
| 94 | + console.log(res, '获取多时段失败'); | ||
| 95 | + }) | ||
| 96 | + }, | ||
| 49 | GetSellerDetail(){ | 97 | GetSellerDetail(){ |
| 50 | let options=this.options | 98 | let options=this.options |
| 51 | App.Customer.GetSellerDetail({ | 99 | App.Customer.GetSellerDetail({ |
| @@ -162,7 +210,7 @@ Page({ | @@ -162,7 +210,7 @@ Page({ | ||
| 162 | }, | 210 | }, |
| 163 | //时段改变 | 211 | //时段改变 |
| 164 | selectsection(e){ | 212 | selectsection(e){ |
| 165 | - console.log(e); | 213 | + this.getLocalLunchTime() |
| 166 | setTimeout(()=>{ | 214 | setTimeout(()=>{ |
| 167 | this.setData({ | 215 | this.setData({ |
| 168 | reserveSection:e.detail.section!='' ? e.detail.section : null, | 216 | reserveSection:e.detail.section!='' ? e.detail.section : null, |
| @@ -199,8 +247,13 @@ Page({ | @@ -199,8 +247,13 @@ Page({ | ||
| 199 | }else{ | 247 | }else{ |
| 200 | this.reserve.pnum = num; | 248 | this.reserve.pnum = num; |
| 201 | } | 249 | } |
| 202 | - | ||
| 203 | - App.Reserve.GetReserveIsExits({sid:this.reserve.sid,ddate_solt:slots[this.reserve.section],ddate:this.reserve.ddate}).then((json)=>{ | 250 | + let ddate_solt = ''; |
| 251 | + let obj=this.data.lunchDinnerList.filter(item=>{return item.section == this.reserve.section}) | ||
| 252 | + if(obj && obj[0]){ | ||
| 253 | + ddate_solt = obj[0].ddate_solt; | ||
| 254 | + } | ||
| 255 | + this.reserve.ddate_solt = ddate_solt | ||
| 256 | + App.Reserve.GetReserveIsExits({sid:this.reserve.sid,ddate_solt,ddate:this.reserve.ddate}).then((json)=>{ | ||
| 204 | console.log(json) | 257 | console.log(json) |
| 205 | if(json.ret==200){ | 258 | if(json.ret==200){ |
| 206 | if(json.data==1){ | 259 | if(json.data==1){ |
| @@ -231,6 +284,7 @@ Page({ | @@ -231,6 +284,7 @@ Page({ | ||
| 231 | }, | 284 | }, |
| 232 | selecttime(e){//时间改变 | 285 | selecttime(e){//时间改变 |
| 233 | console.log(e); | 286 | console.log(e); |
| 287 | + this.getLocalLunchTime() | ||
| 234 | if(!e.detail.time){//满房 | 288 | if(!e.detail.time){//满房 |
| 235 | this.setData({ | 289 | this.setData({ |
| 236 | hasFullHouse:true, | 290 | hasFullHouse:true, |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <nav hasHome class="navhome" backgroundColor="#0143a3" color="#fff" place="{{true}}">{{seller.sellName}}</nav> | 2 | <nav hasHome class="navhome" backgroundColor="#0143a3" color="#fff" place="{{true}}">{{seller.sellName}}</nav> |
| 3 | <view> | 3 | <view> |
| 4 | <view class="flex-vc {{home.image?'sellBox':'sellBox sellBox1'}}"> | 4 | <view class="flex-vc {{home.image?'sellBox':'sellBox sellBox1'}}"> |
| 5 | - <image wx:if="{{home.image}}" class="imgs" src="{{home.image}}" mode="scaleToFill" /> | 5 | + <image wx:if="{{home.image}}" class="imgs" src="{{home.image}}" mode="widthFix" /> |
| 6 | <view class="info flex-vl" style="background:#fff;"> | 6 | <view class="info flex-vl" style="background:#fff;"> |
| 7 | <view class="flex-lr"> | 7 | <view class="flex-lr"> |
| 8 | <view class="colorText font32r">{{seller.sellName}}</view> | 8 | <view class="colorText font32r">{{seller.sellName}}</view> |
| 1 | /* pages/reserve/shopHome.wxss */ | 1 | /* pages/reserve/shopHome.wxss */ |
| 2 | .imgs { | 2 | .imgs { |
| 3 | width: 100%; | 3 | width: 100%; |
| 4 | - height: 562rpx; | ||
| 5 | position: absolute; | 4 | position: absolute; |
| 6 | left: 0; | 5 | left: 0; |
| 7 | top: 0; | 6 | top: 0; |
| @@ -47,7 +46,8 @@ | @@ -47,7 +46,8 @@ | ||
| 47 | height: 38rpx; | 46 | height: 38rpx; |
| 48 | margin-left: 10rpx; | 47 | margin-left: 10rpx; |
| 49 | position: relative; | 48 | position: relative; |
| 50 | - top: 8rpx; | 49 | + top: 8rpx; |
| 50 | + flex-shrink: 0; | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | .colorText { | 53 | .colorText { |
| @@ -63,7 +63,15 @@ | @@ -63,7 +63,15 @@ | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | .colorFive { | 65 | .colorFive { |
| 66 | - color: #515151; | 66 | + color: #515151; |
| 67 | + display: flex; | ||
| 68 | + align-items: baseline; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +.colorFive text { | ||
| 72 | + display: flex; | ||
| 73 | + flex-wrap: wrap; | ||
| 74 | + word-break: break-all; | ||
| 67 | } | 75 | } |
| 68 | 76 | ||
| 69 | .introduce { | 77 | .introduce { |
| @@ -142,7 +142,7 @@ Page({ | @@ -142,7 +142,7 @@ Page({ | ||
| 142 | this.options.room_demand.forEach((v,i)=>{ | 142 | this.options.room_demand.forEach((v,i)=>{ |
| 143 | roomids.push(v.id) | 143 | roomids.push(v.id) |
| 144 | }) | 144 | }) |
| 145 | - console.log('ceshi',roomids); | 145 | + console.log('ceshi',roomids); |
| 146 | App.Customer.SetReserveInfo({ | 146 | App.Customer.SetReserveInfo({ |
| 147 | sid:this.options.sid, | 147 | sid:this.options.sid, |
| 148 | ddate:this.options.ddate, | 148 | ddate:this.options.ddate, |
| @@ -151,8 +151,8 @@ Page({ | @@ -151,8 +151,8 @@ Page({ | ||
| 151 | sex:this.user.sex, | 151 | sex:this.user.sex, |
| 152 | phone:this.user.phone, | 152 | phone:this.user.phone, |
| 153 | cusdem:this.user.remark||'', | 153 | cusdem:this.user.remark||'', |
| 154 | - ddate_solt:dur.indexOf(this.options.section)+1, | ||
| 155 | - roomids:roomids.toString(), | 154 | + ddate_solt:this.options.ddate_solt, |
| 155 | + roomids:roomids.toString(), | ||
| 156 | pnum: this.options.pnum ? this.options.pnum : 4, | 156 | pnum: this.options.pnum ? this.options.pnum : 4, |
| 157 | }).then(res=>{ | 157 | }).then(res=>{ |
| 158 | console.log('ceshi',this.hasSubmit,res); | 158 | console.log('ceshi',this.hasSubmit,res); |
-
Please register or login to post a comment