Commit 18cb2d993f81c088b841b5ffb6f2a19af793571d
Merge remote-tracking branch 'origin/master' into online-reserve
Showing
49 changed files
with
2530 additions
and
988 deletions
Too many changes to show.
To preserve performance only 49 of 49+ files are displayed.
| 1 | +var mta=require('mta-wechat-analysis') | ||
| 1 | var uri_dc = require('utils/uri.js') | 2 | var uri_dc = require('utils/uri.js') |
| 2 | global.regeneratorRuntime = require('lib/regenerator/runtime-module') | 3 | global.regeneratorRuntime = require('lib/regenerator/runtime-module') |
| 3 | 4 | ||
| @@ -20,12 +21,21 @@ App({ | @@ -20,12 +21,21 @@ App({ | ||
| 20 | shareTicket:"", | 21 | shareTicket:"", |
| 21 | onLaunch: async function (opt) { | 22 | onLaunch: async function (opt) { |
| 22 | console.log('onLaunch',opt); | 23 | console.log('onLaunch',opt); |
| 24 | + mta.App.init({ | ||
| 25 | + "appID":"500667280", | ||
| 26 | + "eventID":"500667287", | ||
| 27 | + "statPullDownFresh":true, | ||
| 28 | + "statShareApp":true, | ||
| 29 | + "statReachBottom":true, | ||
| 30 | + "lauchOpts":opt, //渠道分析 | ||
| 31 | + }); | ||
| 23 | if(opt.shareTicket){ | 32 | if(opt.shareTicket){ |
| 24 | this.shareTicket=opt.shareTicket; | 33 | this.shareTicket=opt.shareTicket; |
| 25 | } | 34 | } |
| 26 | this.getSystemInfo(); | 35 | this.getSystemInfo(); |
| 27 | this.openid=await this.getOpenid(); | 36 | this.openid=await this.getOpenid(); |
| 28 | - console.log('this.openid',this.openid); | 37 | + console.log('this.openid',this.openid,mta); |
| 38 | + | ||
| 29 | }, | 39 | }, |
| 30 | onShow:async function(){ | 40 | onShow:async function(){ |
| 31 | if (wx.canIUse('getUpdateManager')) { | 41 | if (wx.canIUse('getUpdateManager')) { |
| @@ -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", |
| @@ -21,6 +22,7 @@ | @@ -21,6 +22,7 @@ | ||
| 21 | "pages/book/setting/index", | 22 | "pages/book/setting/index", |
| 22 | "pages/book/setting/sms", | 23 | "pages/book/setting/sms", |
| 23 | "pages/book/setting/sms_buy", | 24 | "pages/book/setting/sms_buy", |
| 25 | + "pages/book/crm/index", | ||
| 24 | "pages/book/smsbatch/index", | 26 | "pages/book/smsbatch/index", |
| 25 | "pages/book/smsbatch/update", | 27 | "pages/book/smsbatch/update", |
| 26 | "pages/book/smsbatch/detail", | 28 | "pages/book/smsbatch/detail", |
| @@ -32,10 +34,21 @@ | @@ -32,10 +34,21 @@ | ||
| 32 | "root": "pack-cookbook", | 34 | "root": "pack-cookbook", |
| 33 | "name": "提前点餐包", | 35 | "name": "提前点餐包", |
| 34 | "pages": [ | 36 | "pages": [ |
| 35 | - "pages/index" | 37 | + "pages/index", |
| 38 | + "pages/cart", | ||
| 39 | + "pages/success", | ||
| 40 | + "pages/remark" | ||
| 36 | ] | 41 | ] |
| 37 | } | 42 | } |
| 38 | ], | 43 | ], |
| 44 | + "preloadRule": { | ||
| 45 | + "pages/customer/detail_owner": { | ||
| 46 | + "network": "all", | ||
| 47 | + "packages": [ | ||
| 48 | + "pack-cookbook" | ||
| 49 | + ] | ||
| 50 | + } | ||
| 51 | + }, | ||
| 39 | "window": { | 52 | "window": { |
| 40 | "navigationStyle": "custom", | 53 | "navigationStyle": "custom", |
| 41 | "backgroundTextStyle": "light", | 54 | "backgroundTextStyle": "light", |
| @@ -239,4 +239,30 @@ image{ | @@ -239,4 +239,30 @@ image{ | ||
| 239 | height: 22rpx; | 239 | height: 22rpx; |
| 240 | background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png"); | 240 | background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png"); |
| 241 | background-size: 100%; | 241 | background-size: 100%; |
| 242 | + min-width: 12rpx; | ||
| 243 | +} | ||
| 244 | +.mask{ | ||
| 245 | + background-color: rgba(20,20,20,0.5); | ||
| 246 | + position: fixed; | ||
| 247 | + top:0; | ||
| 248 | + right: 0; | ||
| 249 | + bottom: 0; | ||
| 250 | + left: 0; | ||
| 251 | + z-index: 9999; | ||
| 252 | +} | ||
| 253 | +.flex-tb{ | ||
| 254 | + display: flex; | ||
| 255 | + display: -webkit-flex; | ||
| 256 | + justify-content: space-between; | ||
| 257 | + align-items:flex-start; | ||
| 258 | + flex-direction: column ; | ||
| 259 | + -webkit-flex-direction: column ; | ||
| 260 | +} | ||
| 261 | +.flex-bl{ | ||
| 262 | + display: flex; | ||
| 263 | + display: -webkit-flex; | ||
| 264 | + justify-content: flex-end; | ||
| 265 | + align-items:flex-start; | ||
| 266 | + flex-direction: column ; | ||
| 267 | + -webkit-flex-direction: column ; | ||
| 242 | } | 268 | } |
| @@ -26,14 +26,18 @@ Component({ | @@ -26,14 +26,18 @@ Component({ | ||
| 26 | className:{ | 26 | className:{ |
| 27 | type:String, | 27 | type:String, |
| 28 | value:'', | 28 | value:'', |
| 29 | - } | 29 | + }, |
| 30 | + ddate:{ //带入预定时间 time1-time2 | ||
| 31 | + type:String, | ||
| 32 | + value:'', | ||
| 33 | + }, | ||
| 30 | }, | 34 | }, |
| 31 | 35 | ||
| 32 | /** | 36 | /** |
| 33 | * 组件的初始数据 | 37 | * 组件的初始数据 |
| 34 | */ | 38 | */ |
| 35 | data: { | 39 | data: { |
| 36 | - | 40 | + itemList:[], |
| 37 | }, | 41 | }, |
| 38 | 42 | ||
| 39 | /** | 43 | /** |
| @@ -45,35 +49,54 @@ Component({ | @@ -45,35 +49,54 @@ Component({ | ||
| 45 | if(!this.data.event) return; | 49 | if(!this.data.event) return; |
| 46 | this[this.data.event]() | 50 | this[this.data.event]() |
| 47 | }, | 51 | }, |
| 52 | + boardClickCallback(e){ | ||
| 53 | + let board=this.data.board; | ||
| 54 | + switch (e.detail.value){ | ||
| 55 | + case '查看详情': | ||
| 56 | + wx.navigateTo({ | ||
| 57 | + url:'b_detail?id='+board.reserve_id, | ||
| 58 | + }); | ||
| 59 | + break; | ||
| 60 | + case '启用桌位': | ||
| 61 | + this.boardEnable(1) | ||
| 62 | + break; | ||
| 63 | + case '停用桌位': | ||
| 64 | + this.boardEnable(0) | ||
| 65 | + break; | ||
| 66 | + case '订座': | ||
| 67 | + wx.navigateTo({ | ||
| 68 | + url:'b_addnew?hasQuick=1&tid='+board.id | ||
| 69 | + +'&tname='+board.name | ||
| 70 | + +'&pnum='+(board.most_pnum>board.table_pnum?board.most_pnum:board.table_pnum) | ||
| 71 | + +'&ddate='+this.data.ddate, | ||
| 72 | + }); | ||
| 73 | + break; | ||
| 74 | + } | ||
| 75 | + }, | ||
| 48 | //桌位操作 | 76 | //桌位操作 |
| 49 | boardOpt(){ | 77 | boardOpt(){ |
| 50 | let itemList=[] | 78 | let itemList=[] |
| 79 | + if(!this.data.board.reserve_id && this.data.board.enable==1){ | ||
| 80 | + if(this.data.ddate){ | ||
| 81 | + let t=new Date()/1000; | ||
| 82 | + //console.log('this.data.ddate.substr(11,10)',this.data.ddate.substr(11,10)) | ||
| 83 | + if(parseInt(this.data.ddate.substr(11,10))>t){ | ||
| 84 | + itemList.push('订座') | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + } | ||
| 51 | if(this.data.board.reserve_id>0){ | 89 | if(this.data.board.reserve_id>0){ |
| 52 | itemList.push('查看详情') | 90 | itemList.push('查看详情') |
| 53 | } | 91 | } |
| 54 | itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位') | 92 | itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位') |
| 55 | //console.log(getApp().system) | 93 | //console.log(getApp().system) |
| 56 | - if(getApp().system.system.toLowerCase().indexOf('ios')<0){ | ||
| 57 | - itemList.push('取消') | ||
| 58 | - } | ||
| 59 | this.itemList=itemList; | 94 | this.itemList=itemList; |
| 60 | - wx.showActionSheet({ | ||
| 61 | - itemList:this.itemList, | ||
| 62 | - success:(res)=>{ | ||
| 63 | - console.log(res.tapIndex,this.itemList[res.tapIndex]); | ||
| 64 | - if('启用桌位'==this.itemList[res.tapIndex]){ | ||
| 65 | - this.boardEnable(1) | ||
| 66 | - } | ||
| 67 | - if('停用桌位'==this.itemList[res.tapIndex]){ | ||
| 68 | - this.boardEnable(0) | ||
| 69 | - } | ||
| 70 | - if('查看详情'==this.itemList[res.tapIndex]){ | ||
| 71 | - wx.navigateTo({ | ||
| 72 | - url:'b_detail?id='+this.data.board.reserve_id, | ||
| 73 | - }); | ||
| 74 | - } | ||
| 75 | - }, | 95 | + this.setData({ |
| 96 | + itemList:itemList, | ||
| 76 | }) | 97 | }) |
| 98 | + this.selectComponent('#boardas').show(); | ||
| 99 | + console.log('this.data.board',this.data.board) | ||
| 77 | }, | 100 | }, |
| 78 | //桌位选择 | 101 | //桌位选择 |
| 79 | boardChoose(){ | 102 | boardChoose(){ |
| @@ -12,3 +12,6 @@ | @@ -12,3 +12,6 @@ | ||
| 12 | <view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view> | 12 | <view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view> |
| 13 | <icon type="success" size="20" color="#199095" class="desk-active" wx:if="{{board.isselect==true}}"/> | 13 | <icon type="success" size="20" color="#199095" class="desk-active" wx:if="{{board.isselect==true}}"/> |
| 14 | </view> | 14 | </view> |
| 15 | +<as items="{{itemList}}" | ||
| 16 | + id="boardas" | ||
| 17 | + bindclick="boardClickCallback"><view style="font-size: 30rpx;">{{board.name}}</view></as> |
| 1 | var util = require('../../../utils/util.js') | 1 | var util = require('../../../utils/util.js') |
| 2 | -var uri=require('../../../utils/uri.js'); | 2 | +var uri = require('../../../utils/uri.js'); |
| 3 | Component({ | 3 | Component({ |
| 4 | - properties:{ | ||
| 5 | - list:Array | ||
| 6 | - }, | ||
| 7 | - data:{ | ||
| 8 | - | ||
| 9 | - }, | ||
| 10 | - methods:{ | ||
| 11 | - selectdesk:function(e){ | ||
| 12 | - var tebleid=e.currentTarget.dataset.id; | ||
| 13 | - var tables=util.cache('tableid') ? util.cache('tableid') : []; | ||
| 14 | - var list=this.data.list; | ||
| 15 | - list.forEach(function(v,i){ | ||
| 16 | - if(v.id==tebleid){ | ||
| 17 | - if(v.isselect==true){ | ||
| 18 | - var thisindex=tables.indexOf(tebleid); | ||
| 19 | - tables.splice(thisindex,1) | ||
| 20 | - }else{ | ||
| 21 | - tables.push(tebleid) | ||
| 22 | - } | ||
| 23 | - v.isselect=!v.isselect | ||
| 24 | - } | ||
| 25 | - }) | ||
| 26 | - var pages = getCurrentPages(); | ||
| 27 | - pages[pages.length-2].data.form.tid=tables; | ||
| 28 | - pages[pages.length-2].setData({ | ||
| 29 | - form:pages[pages.length-2].data.form | ||
| 30 | - }) | ||
| 31 | - util.cache('tableid',tables); | ||
| 32 | - this.triggerEvent("changedesk"); | ||
| 33 | - this.setData({ | ||
| 34 | - list:list | ||
| 35 | - }) | 4 | + properties: { |
| 5 | + list: Array | ||
| 6 | + }, | ||
| 7 | + data: {}, | ||
| 8 | + methods: { | ||
| 9 | + selectdesk: function (e) { | ||
| 10 | + var tebleid = e.currentTarget.dataset.id; | ||
| 11 | + var tables = util.cache('tableid') ? util.cache('tableid') : []; | ||
| 12 | + var list = this.data.list; | ||
| 13 | + var pages = getCurrentPages(); | ||
| 14 | + var addnewPage=pages[pages.length - 2]; | ||
| 15 | + list.forEach(function (v, i) { | ||
| 16 | + if (v.id == tebleid) { | ||
| 17 | + if (v.isselect == true) { | ||
| 18 | + var thisindex = tables.indexOf(tebleid); | ||
| 19 | + tables.splice(thisindex, 1) | ||
| 20 | + delete addnewPage.checkedTables[tebleid] | ||
| 21 | + } else { | ||
| 22 | + tables.push(tebleid) | ||
| 23 | + addnewPage.checkedTables[tebleid]=v.name; | ||
| 24 | + } | ||
| 25 | + v.isselect = !v.isselect | ||
| 36 | } | 26 | } |
| 27 | + }) | ||
| 28 | + addnewPage.data.form.tid = tables; | ||
| 29 | + addnewPage.setData({ | ||
| 30 | + form: addnewPage.data.form | ||
| 31 | + }) | ||
| 32 | + console.log('checkedTables',addnewPage.checkedTables); | ||
| 33 | + util.cache('tableid', tables); | ||
| 34 | + this.triggerEvent("changedesk"); | ||
| 35 | + this.setData({ | ||
| 36 | + list: list | ||
| 37 | + }) | ||
| 37 | } | 38 | } |
| 39 | + } | ||
| 38 | }) | 40 | }) |
| 1 | <view class="desk-list flex-rs"> | 1 | <view class="desk-list flex-rs"> |
| 2 | - <block wx:for="{{list}}"> | 2 | + <block wx:for="{{list}}" wx:key="list.key"> |
| 3 | <board width="160" height="180" board="{{item}}" | 3 | <board width="160" height="180" board="{{item}}" |
| 4 | style="margin: 20rpx 0 0 20rpx" | 4 | style="margin: 20rpx 0 0 20rpx" |
| 5 | event="boardChoose" className="noBottom" | 5 | event="boardChoose" className="noBottom" |
| 1 | <formids bindtap="detail"> | 1 | <formids bindtap="detail"> |
| 2 | - <view class="book-list-tds flex-lr font30r black-font"> | 2 | + <view class="book-list-tds flex-lr font30r black-font reserve-status-{{vitem.status}}"> |
| 3 | <view class="book-list-td flex-vc"> | 3 | <view class="book-list-td flex-vc"> |
| 4 | <view class="Medium" style="font-size: 30rpx; width: 100%;text-align: left;max-height:40px;overflow:hidden;">{{vitem.name}}</view> | 4 | <view class="Medium" style="font-size: 30rpx; width: 100%;text-align: left;max-height:40px;overflow:hidden;">{{vitem.name}}</view> |
| 5 | <view class="Medium" style="font-size: 28rpx;width: 100%;text-align: left" wx:if="{{vitem.table_ids.length>1}}">等{{vitem.table_ids.length}}桌</view> | 5 | <view class="Medium" style="font-size: 28rpx;width: 100%;text-align: left" wx:if="{{vitem.table_ids.length>1}}">等{{vitem.table_ids.length}}桌</view> |
| @@ -13,4 +13,10 @@ | @@ -13,4 +13,10 @@ | ||
| 13 | .book-list-info{ | 13 | .book-list-info{ |
| 14 | width:100%; | 14 | width:100%; |
| 15 | line-height:1.2; | 15 | line-height:1.2; |
| 16 | +} | ||
| 17 | +.reserve-status-4,.reserve-status-3{ | ||
| 18 | + color:#999999; | ||
| 19 | +} | ||
| 20 | +.reserve-status-4 .green-font,.reserve-status-3 .green-font{ | ||
| 21 | + color:#999999; | ||
| 16 | } | 22 | } |
| 1 | <view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view> | 1 | <view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view> |
| 2 | <view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}"> | 2 | <view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}"> |
| 3 | - <block wx:for="{{list}}"> | 3 | + <block wx:for="{{list}}" wx:key="list.key"> |
| 4 | <block wx:if="{{index!=0}}"> | 4 | <block wx:if="{{index!=0}}"> |
| 5 | <view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}"> | 5 | <view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}"> |
| 6 | <view class="notice-image flex-vc"> | 6 | <view class="notice-image flex-vc"> |
components/book/reserveCancel/cancel.js
0 → 100644
| 1 | +// components/book/reserveCancel/cancel.js | ||
| 2 | +import util from '../../../utils/util'; | ||
| 3 | +import App from '../../../utils/api'; | ||
| 4 | +const {regeneratorRuntime} = global | ||
| 5 | +const items=[{name:'顾客取消'},{name:'顾客行程有变'},{name:'信息填写有误'},{name:'操作失误'},{name:'其他原因'}]; | ||
| 6 | + | ||
| 7 | +Component({ | ||
| 8 | + /** | ||
| 9 | + * 组件的属性列表 | ||
| 10 | + */ | ||
| 11 | + properties: { | ||
| 12 | + bookInfo:{ | ||
| 13 | + type:Object, | ||
| 14 | + value:{}, | ||
| 15 | + } | ||
| 16 | + }, | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 组件的初始数据 | ||
| 20 | + */ | ||
| 21 | + data: { | ||
| 22 | + hidden: true, | ||
| 23 | + otherInputHidden:true, | ||
| 24 | + items:JSON.parse(JSON.stringify(items)), | ||
| 25 | + _cause:'', | ||
| 26 | + cause:'', | ||
| 27 | + }, | ||
| 28 | + /** | ||
| 29 | + * 组件的方法列表 | ||
| 30 | + */ | ||
| 31 | + methods: { | ||
| 32 | + show(){ | ||
| 33 | + this.setData({ | ||
| 34 | + hidden:false, | ||
| 35 | + }) | ||
| 36 | + }, | ||
| 37 | + hide(){ | ||
| 38 | + this.setData({ | ||
| 39 | + hidden:true, | ||
| 40 | + }) | ||
| 41 | + }, | ||
| 42 | + radioChange(e){ | ||
| 43 | + let val=util.val(e); | ||
| 44 | + if(val=='其他原因'){ | ||
| 45 | + this.setData({ | ||
| 46 | + otherInputHidden:false, | ||
| 47 | + _cause:val | ||
| 48 | + }) | ||
| 49 | + }else{ | ||
| 50 | + this.setData({ | ||
| 51 | + otherInputHidden:true, | ||
| 52 | + _cause:val | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + otherInput(e){ | ||
| 57 | + let val=util.val(e); | ||
| 58 | + this.setData({ | ||
| 59 | + cause:val | ||
| 60 | + }) | ||
| 61 | + }, | ||
| 62 | + async submit(e){ | ||
| 63 | + console.log(e,); | ||
| 64 | + let cause=this.data._cause; | ||
| 65 | + let hasInput=false; | ||
| 66 | + if(cause=='其他原因'){ | ||
| 67 | + cause=this.data.cause; | ||
| 68 | + hasInput=true; | ||
| 69 | + } | ||
| 70 | + cause=cause.trim(); | ||
| 71 | + if(!cause){ | ||
| 72 | + return util.toast(hasInput?'请填写原因':'请选择原因','none') | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + let enter_params=util.cache('enter_params'); | ||
| 76 | + let sc=(await App.Reserve.SellerInfo(enter_params)).data | ||
| 77 | + cause={desc:cause} | ||
| 78 | + if(enter_params){ | ||
| 79 | + cause.uid=enter_params.manager_id; | ||
| 80 | + } | ||
| 81 | + if(sc.seller_user){ | ||
| 82 | + cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname) | ||
| 83 | + } | ||
| 84 | + App.Reserve.SetReserveStatus({ | ||
| 85 | + rid:this.data.bookInfo.id, | ||
| 86 | + status:4, | ||
| 87 | + cause:JSON.stringify(cause), | ||
| 88 | + }).then(()=>{ | ||
| 89 | + this.hide() | ||
| 90 | + this.triggerEvent('reserveCancel',{hasCancel:true}); | ||
| 91 | + //this.getDetail(this.data.bookInfo.id,true); | ||
| 92 | + }) | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | +}) |
components/book/reserveCancel/cancel.json
0 → 100644
components/book/reserveCancel/cancel.wxml
0 → 100644
| 1 | +<!--components/book/reserveCancel/cancel.wxml--> | ||
| 2 | +<view class="mask flex-vc" hidden="{{hidden}}" bindtap="hide"> | ||
| 3 | + <view class="cancel" catchtap="catchtap"> | ||
| 4 | + <view class="flex-rr"> | ||
| 5 | + <view class="close" bindtap="hide"> | ||
| 6 | + <image src="http://qn.colorcun.com/custom/lite-yd/image/close.png"></image> | ||
| 7 | + </view> | ||
| 8 | + </view> | ||
| 9 | + <view class="title Semibold flex-vc">请选择取消原因</view> | ||
| 10 | + <radio-group class="radio-group flex-vl" bindchange="radioChange"> | ||
| 11 | + <label class="radio" wx:for="{{items}}" wx:key="items.key"> | ||
| 12 | + <radio value="{{item.name}}" checked="{{item.checked}}" /> | ||
| 13 | + {{item.name}} | ||
| 14 | + </label> | ||
| 15 | + </radio-group> | ||
| 16 | + <view class="flex-rr other-view"> | ||
| 17 | + <input class="other" bindinput="otherInput" placeholder="请填写原因" hidden="{{otherInputHidden}}"/> | ||
| 18 | + </view> | ||
| 19 | + <formids class="flex-vc" bindclick="submit"> | ||
| 20 | + <view class="button">确认</view> | ||
| 21 | + </formids> | ||
| 22 | + </view> | ||
| 23 | +</view> |
components/book/reserveCancel/cancel.wxss
0 → 100644
| 1 | +/* components/book/reserveCancel/cancel.wxss */ | ||
| 2 | +@import "../../../app.wxss"; | ||
| 3 | +.cancel{ | ||
| 4 | + width: 90%; | ||
| 5 | + background-color: #fefefe; | ||
| 6 | + border-radius: 10rpx; | ||
| 7 | + font-size: 32rpx; | ||
| 8 | + padding-bottom: 52rpx; | ||
| 9 | +} | ||
| 10 | +.cancel image{ | ||
| 11 | + width: 100%; | ||
| 12 | + height: 100%; | ||
| 13 | +} | ||
| 14 | +.close{ | ||
| 15 | + width: 32rpx; | ||
| 16 | + height: 32rpx; | ||
| 17 | + margin-top: 12rpx; | ||
| 18 | + margin-right: 12rpx; | ||
| 19 | +} | ||
| 20 | +.title{ | ||
| 21 | + font-size: 34rpx; | ||
| 22 | +} | ||
| 23 | +.button{ | ||
| 24 | + width: 300rpx; | ||
| 25 | + height: 80rpx; | ||
| 26 | + line-height: 80rpx; | ||
| 27 | + border-radius: 4rpx; | ||
| 28 | + background-color: #199095; | ||
| 29 | + font-size: 34rpx; | ||
| 30 | + color: #fefefe; | ||
| 31 | +} | ||
| 32 | +.radio-group{ | ||
| 33 | + margin: 44rpx 5% 0rpx; | ||
| 34 | +} | ||
| 35 | +.radio{ | ||
| 36 | + margin-bottom: 40rpx; | ||
| 37 | + height: 40rpx; | ||
| 38 | + line-height: 40rpx; | ||
| 39 | +} | ||
| 40 | +.radio:last-child{ | ||
| 41 | + margin-bottom: 0; | ||
| 42 | +} | ||
| 43 | +.radio radio{ | ||
| 44 | + margin-right: 30rpx; | ||
| 45 | +} | ||
| 46 | +.other-view{ | ||
| 47 | + height: 110rpx; | ||
| 48 | + line-height: 110rpx; | ||
| 49 | +} | ||
| 50 | +.other{ | ||
| 51 | + border-bottom: 2rpx solid #E0E0E0; | ||
| 52 | + width: 75%; | ||
| 53 | + margin-right: 40rpx; | ||
| 54 | +} |
| @@ -34,7 +34,8 @@ Component({ | @@ -34,7 +34,8 @@ Component({ | ||
| 34 | */ | 34 | */ |
| 35 | methods: { | 35 | methods: { |
| 36 | back(){ | 36 | back(){ |
| 37 | - wx.navigateBack() | 37 | + this.triggerEvent('NavEvent'); |
| 38 | + wx.navigateBack(); | ||
| 38 | }, | 39 | }, |
| 39 | home(){ | 40 | home(){ |
| 40 | if(!this.data.disHome) return; | 41 | if(!this.data.disHome) return; |
| @@ -25,11 +25,13 @@ Component({ | @@ -25,11 +25,13 @@ Component({ | ||
| 25 | this.setData({ | 25 | this.setData({ |
| 26 | network:true, | 26 | network:true, |
| 27 | }) | 27 | }) |
| 28 | + this.triggerEvent('network',res); | ||
| 28 | }).catch(res=>{ | 29 | }).catch(res=>{ |
| 29 | this.setData({ | 30 | this.setData({ |
| 30 | network:false, | 31 | network:false, |
| 31 | msg:res.msg | 32 | msg:res.msg |
| 32 | }) | 33 | }) |
| 34 | + this.triggerEvent('network',res); | ||
| 33 | }) | 35 | }) |
| 34 | }, | 36 | }, |
| 35 | detached(){ | 37 | detached(){ |
| @@ -44,12 +46,13 @@ Component({ | @@ -44,12 +46,13 @@ Component({ | ||
| 44 | wx.getNetworkType({ | 46 | wx.getNetworkType({ |
| 45 | success: function (res) { | 47 | success: function (res) { |
| 46 | var title = '' | 48 | var title = '' |
| 47 | - if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') { | ||
| 48 | - fail({type:res.networkType,msg:'当前网络不给力,请稍后重试'}); | 49 | + //if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') { |
| 50 | + if (res.networkType == 'unknown') { | ||
| 51 | + fail({hasWork:false,type:res.networkType,msg:'当前网络不给力,请稍后重试'}); | ||
| 49 | } else if (res.networkType == 'none') { | 52 | } else if (res.networkType == 'none') { |
| 50 | - fail({type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'}); | 53 | + fail({hasWork:false,type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'}); |
| 51 | } else { | 54 | } else { |
| 52 | - success({type:res.networkType}); | 55 | + success({hasWork:true,type:res.networkType}); |
| 53 | } | 56 | } |
| 54 | } | 57 | } |
| 55 | }); | 58 | }); |
| @@ -73,6 +76,8 @@ Component({ | @@ -73,6 +76,8 @@ Component({ | ||
| 73 | wx.reLaunch({ | 76 | wx.reLaunch({ |
| 74 | url: '/'+p.route+'?'+param.join('&') | 77 | url: '/'+p.route+'?'+param.join('&') |
| 75 | }) | 78 | }) |
| 79 | + }).catch((res)=>{ | ||
| 80 | + console.log('this.network.catch',res) | ||
| 76 | }) | 81 | }) |
| 77 | }, | 82 | }, |
| 78 | show(msg=''){ | 83 | show(msg=''){ |
| @@ -61,24 +61,33 @@ Component({ | @@ -61,24 +61,33 @@ Component({ | ||
| 61 | +')'; | 61 | +')'; |
| 62 | } | 62 | } |
| 63 | let tableSubInfo='' | 63 | let tableSubInfo='' |
| 64 | + let tableFirst=''; | ||
| 64 | if(this.data.detail.tableFirst){ | 65 | if(this.data.detail.tableFirst){ |
| 65 | tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||''); | 66 | tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||''); |
| 66 | - | 67 | + tableFirst=this.data.detail.tableFirst |
| 67 | }else{ | 68 | }else{ |
| 69 | + tableFirst=this.data.detail.tables[0].name | ||
| 68 | tableSubInfo=this.data.detail.tables[0].name; | 70 | tableSubInfo=this.data.detail.tables[0].name; |
| 69 | if(this.data.detail.tables.length>1){ | 71 | if(this.data.detail.tables.length>1){ |
| 70 | tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个' | 72 | tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个' |
| 71 | +(this.data.detail.tables[0].tid==2?'包间':''); | 73 | +(this.data.detail.tables[0].tid==2?'包间':''); |
| 74 | + tableFirst+='等'; | ||
| 72 | } | 75 | } |
| 73 | } | 76 | } |
| 74 | let obj={ | 77 | let obj={ |
| 75 | rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'), | 78 | rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'), |
| 76 | tableSubInfo:tableSubInfo, | 79 | tableSubInfo:tableSubInfo, |
| 80 | + tableFirst:tableFirst, | ||
| 77 | masterMan:masterMan, | 81 | masterMan:masterMan, |
| 78 | } | 82 | } |
| 79 | if(this.data.hasShowStatus){ | 83 | if(this.data.hasShowStatus){ |
| 80 | let ns=new Date()/1000 | 84 | let ns=new Date()/1000 |
| 81 | - obj.showStatusStr=ns>this.data.detail.ddate?'已结束':'已预定'; | 85 | + obj.showStatusStr='已预定' |
| 86 | + if(this.data.detail.status==4){ | ||
| 87 | + obj.showStatusStr='已取消' | ||
| 88 | + }else if(this.data.detail.status>=2 || ns>this.data.detail.ddate){ | ||
| 89 | + obj.showStatusStr='已完成' | ||
| 90 | + } | ||
| 82 | } | 91 | } |
| 83 | this.setData(obj) | 92 | this.setData(obj) |
| 84 | } | 93 | } |
| @@ -21,8 +21,8 @@ | @@ -21,8 +21,8 @@ | ||
| 21 | </view> | 21 | </view> |
| 22 | <view class="line"></view> | 22 | <view class="line"></view> |
| 23 | <view class="right info Medium"> | 23 | <view class="right info Medium"> |
| 24 | - <view class="label">包间</view> | ||
| 25 | - <view class="value">{{tableSubInfo}}</view> | 24 | + <view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view> |
| 25 | + <view class="value">{{tableFirst}}</view> | ||
| 26 | </view> | 26 | </view> |
| 27 | </view> | 27 | </view> |
| 28 | <view class="seller address flex-ll" catchtap="lookLocation"> | 28 | <view class="seller address flex-ll" catchtap="lookLocation"> |
pack-cookbook/components/cart/cart.js
0 → 100644
| 1 | +// pack-cookbook/components/cart/cart.js | ||
| 2 | +import util from '../../../utils/util'; | ||
| 3 | +import App from '../../../utils/api'; | ||
| 4 | +const {regeneratorRuntime} = global | ||
| 5 | +Component({ | ||
| 6 | + /** | ||
| 7 | + * 组件的属性列表 | ||
| 8 | + */ | ||
| 9 | + properties: { | ||
| 10 | + rid:{ | ||
| 11 | + type:String, | ||
| 12 | + value:"", | ||
| 13 | + }, | ||
| 14 | + order:{ | ||
| 15 | + type:Object, | ||
| 16 | + value:{}, | ||
| 17 | + }, | ||
| 18 | + identity:{ | ||
| 19 | + type:String, | ||
| 20 | + value:"", | ||
| 21 | + } | ||
| 22 | + }, | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 组件的初始数据 | ||
| 26 | + */ | ||
| 27 | + data: { | ||
| 28 | + hidden: true, | ||
| 29 | + carts: ['啦啦啦', '啦啦啦啦啦', '啦啦', '啦', '啦啦啦啦啦', '啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦', '啦啦啦啦', '啦啦', '啦', '啦啦啦', '啦啦啦'], | ||
| 30 | + }, | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * 组件的方法列表 | ||
| 34 | + */ | ||
| 35 | + methods: { | ||
| 36 | + hide(){ | ||
| 37 | + this.setData({ | ||
| 38 | + hidden:true, | ||
| 39 | + }) | ||
| 40 | + }, | ||
| 41 | + show(){ | ||
| 42 | + this.setData({ | ||
| 43 | + hidden:false, | ||
| 44 | + }) | ||
| 45 | + }, | ||
| 46 | + auto(){ | ||
| 47 | + if(this.data.order.cookbooklist.length<1){ | ||
| 48 | + return this.hide(); | ||
| 49 | + } | ||
| 50 | + this.setData({ | ||
| 51 | + hidden:!this.data.hidden, | ||
| 52 | + }) | ||
| 53 | + }, | ||
| 54 | + init(){ | ||
| 55 | + App.Advance.CreateOrder({ | ||
| 56 | + rid:this.data.rid | ||
| 57 | + }).then(res=>{ | ||
| 58 | + | ||
| 59 | + }) | ||
| 60 | + }, | ||
| 61 | + //规格 增加/减少 回调 | ||
| 62 | + foodSpecCallback(e){ | ||
| 63 | + let opt=e.detail; | ||
| 64 | + this.triggerEvent('foodCardCallback',opt); | ||
| 65 | + }, | ||
| 66 | + RemoveCart(){ | ||
| 67 | + App.Advance.RemoveCart({ | ||
| 68 | + orderid:this.data.order.id, | ||
| 69 | + identity:this.data.identity, | ||
| 70 | + }).then(res=>{ | ||
| 71 | + this.hide(); | ||
| 72 | + this.triggerEvent('foodCardCallback',{type:'flushOrder',num:0}); | ||
| 73 | + }) | ||
| 74 | + }, | ||
| 75 | + }, | ||
| 76 | +}) |
pack-cookbook/components/cart/cart.json
0 → 100644
pack-cookbook/components/cart/cart.wxml
0 → 100644
| 1 | +<!--pack-cookbook/components/cart/cart.wxml--> | ||
| 2 | +<view class="mask flex-bc" style="bottom: 103rpx; align-items: flex-end;" hidden="{{hidden}}" bindtap="hide"> | ||
| 3 | + <view class="cart" catchtap="catchtap"> | ||
| 4 | + <view class="cart-title flex-rr"> | ||
| 5 | + <view class="icon"> | ||
| 6 | + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/empty.png"></image> | ||
| 7 | + </view> | ||
| 8 | + <view class="text" bindtap="RemoveCart">清空购物车</view> | ||
| 9 | + </view> | ||
| 10 | + <view class="cart-body"> | ||
| 11 | + <view class="cart-item flex-lr" wx:for="{{order.cookbooklist}}" wx:key="item.key"> | ||
| 12 | + <view class="flex-ll name"> | ||
| 13 | + <view class="name">{{item.cookname}}</view> | ||
| 14 | + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view> | ||
| 15 | + </view> | ||
| 16 | + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view> | ||
| 17 | + <view class="flex-lr opt"> | ||
| 18 | + <foodSpec item="{{item}}" type="-" id="foodSpecDel" | ||
| 19 | + sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}" | ||
| 20 | + bindfoodSpecCallback="foodSpecCallback"> | ||
| 21 | + <view class='jian'></view> | ||
| 22 | + </foodSpec> | ||
| 23 | + <view class="t-align-c">{{item.num}}</view> | ||
| 24 | + <foodSpec item="{{item}}" type="+" | ||
| 25 | + sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}" | ||
| 26 | + bindfoodSpecCallback="foodSpecCallback"> | ||
| 27 | + <view class='add'></view> | ||
| 28 | + </foodSpec> | ||
| 29 | + </view> | ||
| 30 | + </view> | ||
| 31 | + </view> | ||
| 32 | + </view> | ||
| 33 | +</view> |
pack-cookbook/components/cart/cart.wxss
0 → 100644
| 1 | +/* pack-cookbook/components/cart/cart.wxss */ | ||
| 2 | +@import "/app.wxss"; | ||
| 3 | +.cart{ | ||
| 4 | + background-color: #fefefe; | ||
| 5 | + border-radius: 10rpx 10rpx 0 0; | ||
| 6 | + width: 100%; | ||
| 7 | +} | ||
| 8 | +.cart image{width: 100%; height: 100%;} | ||
| 9 | +.cart-title{ | ||
| 10 | + line-height: 60rpx; | ||
| 11 | + height: 60rpx; | ||
| 12 | + background-color: #F5F5F5; | ||
| 13 | + color:#999999; | ||
| 14 | + font-size: 24rpx; | ||
| 15 | + border-radius: 10rpx 10rpx 0 0; | ||
| 16 | +} | ||
| 17 | +.cart-title .icon{ | ||
| 18 | + width: 26rpx; | ||
| 19 | + height: 26rpx; | ||
| 20 | + margin-right: 20rpx; | ||
| 21 | +} | ||
| 22 | +.cart-title .text{ | ||
| 23 | + margin-right: 5%; | ||
| 24 | +} | ||
| 25 | +.cart-body{ | ||
| 26 | + max-height: 620rpx; | ||
| 27 | + overflow-y: auto; | ||
| 28 | + padding: 0 5%; | ||
| 29 | +} | ||
| 30 | +.cart-item{ | ||
| 31 | + height: 100rpx; | ||
| 32 | + line-height: 100rpx; | ||
| 33 | + font-size: 30rpx; | ||
| 34 | +} | ||
| 35 | +.cart-item .name{ | ||
| 36 | + width: 60%; | ||
| 37 | + overflow: hidden; | ||
| 38 | + white-space:nowrap; | ||
| 39 | +} | ||
| 40 | +.cart-item .name .name{ | ||
| 41 | + width: auto; | ||
| 42 | + max-width: 80%; | ||
| 43 | +} | ||
| 44 | +.cart-item .price{ | ||
| 45 | + width: 32%; | ||
| 46 | + white-space:nowrap; | ||
| 47 | + margin: 0 4%; | ||
| 48 | +} | ||
| 49 | +.cart-item .opt{ | ||
| 50 | + font-size: 36rpx; | ||
| 51 | + font-weight: bold; | ||
| 52 | + min-width: 160rpx; | ||
| 53 | + width: 160rpx; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | + | ||
| 57 | +.jian,.add{ | ||
| 58 | + width: 60rpx; | ||
| 59 | + height: 60rpx; | ||
| 60 | + position: relative; | ||
| 61 | +} | ||
| 62 | +.jian::after{ | ||
| 63 | + position: absolute; | ||
| 64 | + content: ''; | ||
| 65 | + top: 0; | ||
| 66 | + left: 0; | ||
| 67 | + right: 0; | ||
| 68 | + bottom: 0; | ||
| 69 | + margin: auto; | ||
| 70 | + width: 60%; | ||
| 71 | + height: 6rpx; | ||
| 72 | + background-color: #999; | ||
| 73 | + border-radius: 10rpx; | ||
| 74 | +} | ||
| 75 | +.cart-item .jian,.hasListModel .add{ | ||
| 76 | + width:36rpx; | ||
| 77 | + height: 36rpx; | ||
| 78 | + border-radius: 50%; | ||
| 79 | +} | ||
| 80 | +.cart-item .jian{ | ||
| 81 | + border: 2rpx solid #262628; | ||
| 82 | + | ||
| 83 | +} | ||
| 84 | +.cart-item .jian:after{ | ||
| 85 | + width: 75%; | ||
| 86 | + height: 4rpx; | ||
| 87 | + background-color: #262628; | ||
| 88 | +} | ||
| 89 | +.cart-item .add{ | ||
| 90 | + background-color: #fefefe; | ||
| 91 | + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png"); | ||
| 92 | + background-size: 100%; | ||
| 93 | + width: 40rpx; | ||
| 94 | + height: 40rpx; | ||
| 95 | +} | ||
| 96 | +.practice_name{ | ||
| 97 | + border: 2rpx solid #C8B16D; | ||
| 98 | + font-size: 24rpx; | ||
| 99 | + height: 30rpx; | ||
| 100 | + line-height: 30rpx; | ||
| 101 | + color:#C8B16D; | ||
| 102 | + padding: 0 6rpx; | ||
| 103 | + margin-left: 18rpx; | ||
| 104 | +} |
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | top:0; | 5 | top:0; |
| 6 | left:0; | 6 | left:0; |
| 7 | bottom:0; | 7 | bottom:0; |
| 8 | - background:#e14553; | 8 | + background:#353535; |
| 9 | z-index:1000; | 9 | z-index:1000; |
| 10 | padding-top:80rpx; | 10 | padding-top:80rpx; |
| 11 | box-sizing:border-box; | 11 | box-sizing:border-box; |
| @@ -74,10 +74,10 @@ | @@ -74,10 +74,10 @@ | ||
| 74 | left:0; | 74 | left:0; |
| 75 | width: 4rpx; | 75 | width: 4rpx; |
| 76 | height: 100%; | 76 | height: 100%; |
| 77 | - background-color: #E14553; | 77 | + background-color: #353535; |
| 78 | } | 78 | } |
| 79 | .hasListModel .line2more{ | 79 | .hasListModel .line2more{ |
| 80 | - height: 84rpx; | 80 | + height: 90rpx; |
| 81 | width:140rpx; | 81 | width:140rpx; |
| 82 | vertical-align: middle; | 82 | vertical-align: middle; |
| 83 | overflow: hidden; | 83 | overflow: hidden; |
| @@ -3,108 +3,118 @@ import util from '../../../utils/util'; | @@ -3,108 +3,118 @@ import util from '../../../utils/util'; | ||
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | const {regeneratorRuntime} = global | 4 | const {regeneratorRuntime} = global |
| 5 | Component({ | 5 | Component({ |
| 6 | - /** | ||
| 7 | - * 组件的属性列表 | ||
| 8 | - */ | ||
| 9 | - properties: { | ||
| 10 | - item: { | ||
| 11 | - type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) | ||
| 12 | - }, | ||
| 13 | - sellerid:{ | ||
| 14 | - type:Number | ||
| 15 | - }, | ||
| 16 | - orderid:{ | ||
| 17 | - type:Number | ||
| 18 | - }, | ||
| 19 | - fromSoucre:{ | ||
| 20 | - type:Number, | ||
| 21 | - value:0 | ||
| 22 | - }, | ||
| 23 | - request_uri:{ | ||
| 24 | - type:Boolean, | ||
| 25 | - value:false, | ||
| 26 | - }, | ||
| 27 | - hasListModel:{ | ||
| 28 | - type:Boolean, | ||
| 29 | - value:false, | ||
| 30 | - }, | 6 | + /** |
| 7 | + * 组件的属性列表 | ||
| 8 | + */ | ||
| 9 | + properties: { | ||
| 10 | + item: { | ||
| 11 | + type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) | ||
| 31 | }, | 12 | }, |
| 13 | + sellerid: { | ||
| 14 | + type: Number | ||
| 15 | + }, | ||
| 16 | + orderid: { | ||
| 17 | + type: Number | ||
| 18 | + }, | ||
| 19 | + fromSoucre: { | ||
| 20 | + type: Number, | ||
| 21 | + value: 0 | ||
| 22 | + }, | ||
| 23 | + request_uri: { | ||
| 24 | + type: Boolean, | ||
| 25 | + value: false, | ||
| 26 | + }, | ||
| 27 | + hasListModel: { | ||
| 28 | + type: Boolean, | ||
| 29 | + value: false, | ||
| 30 | + }, | ||
| 31 | + identity: { | ||
| 32 | + type: String, | ||
| 33 | + value: '', | ||
| 34 | + }, | ||
| 35 | + }, | ||
| 32 | 36 | ||
| 33 | - /** | ||
| 34 | - * 组件的初始数据 | ||
| 35 | - */ | ||
| 36 | - data: { | ||
| 37 | - item_clear_num:null, | ||
| 38 | - hasIPhone:false, | 37 | + /** |
| 38 | + * 组件的初始数据 | ||
| 39 | + */ | ||
| 40 | + data: { | ||
| 41 | + item_clear_num: null, | ||
| 42 | + hasIPhone: false, | ||
| 43 | + labelIcon: { | ||
| 44 | + 'https://xt05.colorcun.com/uploads/label/lijie.png': '力荐', | ||
| 45 | + 'https://xt05.colorcun.com/uploads/label/tejia.png': '特价', | ||
| 46 | + 'https://xt05.colorcun.com/uploads/label/xinpin.png': '新品', | ||
| 47 | + 'https://xt05.colorcun.com/uploads/label/zhaopai.png': '招牌', | ||
| 39 | }, | 48 | }, |
| 40 | - attached () { | ||
| 41 | - console.log('food-card-ready',this.data.orderid,this.data.fromSoucre) | ||
| 42 | - let item=this.data.item; | ||
| 43 | - let item_clear_num; | ||
| 44 | - if(typeof item.item_clear_num!='undefined'){ | ||
| 45 | - item_clear_num=item.item_clear_num; | ||
| 46 | - }else{ | ||
| 47 | - item_clear_num=item.clear_num; | ||
| 48 | - if(item.spec){ | ||
| 49 | - let clear_num=null; | ||
| 50 | - item.spec.forEach(spec=>{ | ||
| 51 | - if(spec.clear_num==0){ | ||
| 52 | - clear_num=0; | ||
| 53 | - }else{ | ||
| 54 | - clear_num=null; | ||
| 55 | - } | ||
| 56 | - }) | ||
| 57 | - if(clear_num==0){ | ||
| 58 | - item_clear_num=0; | ||
| 59 | - } | ||
| 60 | - } | 49 | + }, |
| 50 | + attached () { | ||
| 51 | + console.log('food-card-ready', this.data.orderid, this.data.fromSoucre) | ||
| 52 | + let item = this.data.item; | ||
| 53 | + let item_clear_num; | ||
| 54 | + if (typeof item.item_clear_num != 'undefined') { | ||
| 55 | + item_clear_num = item.item_clear_num; | ||
| 56 | + } else { | ||
| 57 | + item_clear_num = item.clear_num; | ||
| 58 | + if (item.spec) { | ||
| 59 | + let clear_num = null; | ||
| 60 | + item.spec.forEach(spec => { | ||
| 61 | + if (spec.clear_num == 0) { | ||
| 62 | + clear_num = 0; | ||
| 63 | + } else { | ||
| 64 | + clear_num = null; | ||
| 65 | + } | ||
| 66 | + }) | ||
| 67 | + if (clear_num == 0) { | ||
| 68 | + item_clear_num = 0; | ||
| 61 | } | 69 | } |
| 70 | + } | ||
| 71 | + } | ||
| 62 | 72 | ||
| 63 | - this.setData({ | ||
| 64 | - item_clear_num:item_clear_num, | ||
| 65 | - hasIPhone:getApp().system.model.indexOf('iPhone')>-1 | ||
| 66 | - }); | ||
| 67 | - }, | ||
| 68 | - detached(){ | 73 | + this.setData({ |
| 74 | + item_clear_num: item_clear_num, | ||
| 75 | + hasIPhone: getApp().system.model.indexOf('iPhone') > -1 | ||
| 76 | + }); | ||
| 77 | + }, | ||
| 78 | + detached(){ | ||
| 69 | 79 | ||
| 80 | + }, | ||
| 81 | + /** | ||
| 82 | + * 组件的方法列表 | ||
| 83 | + */ | ||
| 84 | + methods: { | ||
| 85 | + //规格 增加/减少 回调 | ||
| 86 | + foodSpecCallback(e){ | ||
| 87 | + let opt = e.detail; | ||
| 88 | + console.log('foodSpecCallback', opt); | ||
| 89 | + if (opt.type == 'specWin') { | ||
| 90 | + return this.triggerEvent('foodCardCallback', opt); | ||
| 91 | + } | ||
| 92 | + let item = this.data.item; | ||
| 93 | + let oldNum = (item.num || 0); | ||
| 94 | + item.num = (item.num || 0) + opt.type; | ||
| 95 | + let rotateFlag = (oldNum == 0 || item.num == 0); | ||
| 96 | + console.log('num_rotate', rotateFlag); | ||
| 97 | + this.setData({item: item, rotate_id: rotateFlag ? item.id : ''}); | ||
| 98 | + opt.num = item.num; | ||
| 99 | + this.triggerEvent('foodCardCallback', opt); | ||
| 70 | }, | 100 | }, |
| 71 | - /** | ||
| 72 | - * 组件的方法列表 | ||
| 73 | - */ | ||
| 74 | - methods: { | ||
| 75 | - //规格 增加/减少 回调 | ||
| 76 | - foodSpecCallback(e){ | ||
| 77 | - let opt=e.detail; | ||
| 78 | - console.log('foodSpecCallback',opt); | ||
| 79 | - if(opt.type=='specWin'){ | ||
| 80 | - return this.triggerEvent('foodCardCallback',opt); | ||
| 81 | - } | ||
| 82 | - let item=this.data.item; | ||
| 83 | - let oldNum=(item.num||0); | ||
| 84 | - item.num=(item.num||0)+opt.type; | ||
| 85 | - let rotateFlag=(oldNum==0 || item.num==0); | ||
| 86 | - console.log('num_rotate',rotateFlag); | ||
| 87 | - this.setData({item:item,rotate_id:rotateFlag?item.id:''}); | ||
| 88 | - opt.num=item.num; | ||
| 89 | - this.triggerEvent('foodCardCallback',opt); | ||
| 90 | - }, | ||
| 91 | 101 | ||
| 92 | - //清除订单下某菜品所有数量 | ||
| 93 | - delOrderCook:function(){ | ||
| 94 | - this.selectComponent("#foodSpecDel").clean(); | ||
| 95 | - }, | ||
| 96 | - //triggerAdd | ||
| 97 | - triggerAdd(e){ | ||
| 98 | - console.log('triggerAdd',e) | ||
| 99 | - if(this.data.item_clear_num==0) return; | ||
| 100 | - this.selectComponent("#foodSpecAddOne").addCook(); | ||
| 101 | - }, | ||
| 102 | - //viewIMage | ||
| 103 | - viewImage(){ | ||
| 104 | - wx.previewImage({ | ||
| 105 | - current: this.data.item.image, // 当前显示图片的http链接 | ||
| 106 | - urls: [this.data.item.image], // 需要预览的图片http链接列表 | ||
| 107 | - }) | ||
| 108 | - } | 102 | + //清除订单下某菜品所有数量 |
| 103 | + delOrderCook: function () { | ||
| 104 | + this.selectComponent("#foodSpecDel").clean(); | ||
| 105 | + }, | ||
| 106 | + //triggerAdd | ||
| 107 | + triggerAdd(e){ | ||
| 108 | + console.log('triggerAdd', e) | ||
| 109 | + if (this.data.item_clear_num == 0) return; | ||
| 110 | + this.selectComponent("#foodSpecAddOne").addCook(); | ||
| 111 | + }, | ||
| 112 | + //viewIMage | ||
| 113 | + viewImage(){ | ||
| 114 | + wx.previewImage({ | ||
| 115 | + current: this.data.item.image, // 当前显示图片的http链接 | ||
| 116 | + urls: [this.data.item.image], // 需要预览的图片http链接列表 | ||
| 117 | + }) | ||
| 109 | } | 118 | } |
| 119 | + } | ||
| 110 | }) | 120 | }) |
| 1 | -<view class="flex-ll-top hasListModel" style="width:100%;"> | 1 | +<view class="flex-ll hasListModel" style="width:100%;"> |
| 2 | <view class="avatar"> | 2 | <view class="avatar"> |
| 3 | <image mode="aspectFill" lazy-load="true" src="{{item.image}}"/> | 3 | <image mode="aspectFill" lazy-load="true" src="{{item.image}}"/> |
| 4 | </view> | 4 | </view> |
| 5 | - <view class="content"> | ||
| 6 | - <view class="name Semibold"> | ||
| 7 | - {{item.name}} | ||
| 8 | - </view> | ||
| 9 | - <view class="desc"> | ||
| 10 | - {{item.desc||''}} | ||
| 11 | - </view> | ||
| 12 | - <view class="label"> | 5 | + <view class="content flex-tb"> |
| 6 | + <view class="name Semibold">{{item.name}}</view> | ||
| 7 | + <view class="desc">{{item.desc||''}}</view> | ||
| 8 | + <view class="label flex-ll"> | ||
| 13 | <block wx:if="{{item.labelList}}"> | 9 | <block wx:if="{{item.labelList}}"> |
| 14 | - <view class="menu-ptop-mark"> | ||
| 15 | - <block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key"> | ||
| 16 | - <image class="labelListImg" src="{{son.icon}}" mode="aspectFit"></image> | ||
| 17 | - </block> | ||
| 18 | - </view> | 10 | + <block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key"> |
| 11 | + <view class="labelListImg flex-vc" wx:if="{{labelIcon[son.icon]}}">{{labelIcon[son.icon]}}</view> | ||
| 12 | + <image class="labelListImg" wx:else="" src="{{son.icon}}" mode="aspectFit"></image> | ||
| 13 | + </block> | ||
| 19 | </block> | 14 | </block> |
| 20 | </view> | 15 | </view> |
| 21 | - <view class="flex-lr price"> | ||
| 22 | - <view class="flex-ll"> | ||
| 23 | - <view class="rmb">¥</view> | ||
| 24 | - <view class="money">{{item.spec[0].price>0 ? item.spec[0].price : item.price}}</view> | ||
| 25 | - </view> | ||
| 26 | - <view class="opt flex-ll"> | 16 | + <view class="price">¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}} |
| 17 | + <view class="opt flex-cc"> | ||
| 27 | <block wx:if="{{item_clear_num==0}}"> | 18 | <block wx:if="{{item_clear_num==0}}"> |
| 28 | <image | 19 | <image |
| 29 | class="avater" | 20 | class="avater" |
| @@ -34,7 +25,7 @@ | @@ -34,7 +25,7 @@ | ||
| 34 | <block wx:else=""> | 25 | <block wx:else=""> |
| 35 | <block wx:if="{{item.num>0}}"> | 26 | <block wx:if="{{item.num>0}}"> |
| 36 | <foodSpec item="{{item}}" type="-" id="foodSpecDel" | 27 | <foodSpec item="{{item}}" type="-" id="foodSpecDel" |
| 37 | - sellerid="{{sellerid}}" orderid="{{orderid}}" | 28 | + sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}" |
| 38 | fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" | 29 | fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" |
| 39 | bindfoodSpecCallback="foodSpecCallback"> | 30 | bindfoodSpecCallback="foodSpecCallback"> |
| 40 | <view class='jian'></view> | 31 | <view class='jian'></view> |
| @@ -42,7 +33,7 @@ | @@ -42,7 +33,7 @@ | ||
| 42 | <view class="t-align-c">{{item.num}}</view> | 33 | <view class="t-align-c">{{item.num}}</view> |
| 43 | </block> | 34 | </block> |
| 44 | <foodSpec item="{{item}}" type="+" | 35 | <foodSpec item="{{item}}" type="+" |
| 45 | - sellerid="{{sellerid}}" orderid="{{orderid}}" | 36 | + sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}" |
| 46 | fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" | 37 | fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" |
| 47 | bindfoodSpecCallback="foodSpecCallback"> | 38 | bindfoodSpecCallback="foodSpecCallback"> |
| 48 | <view class='add'></view> | 39 | <view class='add'></view> |
| @@ -50,9 +41,11 @@ | @@ -50,9 +41,11 @@ | ||
| 50 | </block> | 41 | </block> |
| 51 | </view> | 42 | </view> |
| 52 | </view> | 43 | </view> |
| 44 | + <!-- | ||
| 53 | <view wx:if="{{item_clear_num>0}}" style="padding:0rpx 10rpx;"> | 45 | <view wx:if="{{item_clear_num>0}}" style="padding:0rpx 10rpx;"> |
| 54 | <text class="food-clear-content">剩{{item_clear_num}}份</text> | 46 | <text class="food-clear-content">剩{{item_clear_num}}份</text> |
| 55 | </view> | 47 | </view> |
| 48 | + --> | ||
| 56 | </view> | 49 | </view> |
| 57 | </view> | 50 | </view> |
| 58 | 51 |
| 1 | -@import '../../app.wxss'; | 1 | +@import '/app.wxss'; |
| 2 | .cookWapper{ | 2 | .cookWapper{ |
| 3 | border-radius:4px; | 3 | border-radius:4px; |
| 4 | position: relative; | 4 | position: relative; |
| @@ -78,32 +78,7 @@ | @@ -78,32 +78,7 @@ | ||
| 78 | background-color: #999; | 78 | background-color: #999; |
| 79 | border-radius: 10rpx; | 79 | border-radius: 10rpx; |
| 80 | } | 80 | } |
| 81 | -.add::after{ | ||
| 82 | - position: absolute; | ||
| 83 | - content: ''; | ||
| 84 | - top: 0; | ||
| 85 | - left: 0; | ||
| 86 | - right: 0; | ||
| 87 | - bottom: 0; | ||
| 88 | - margin: auto; | ||
| 89 | - width: 60%; | ||
| 90 | - height: 6rpx; | ||
| 91 | - background-color: red; | ||
| 92 | - border-radius: 10rpx; | ||
| 93 | -} | ||
| 94 | -.add::before{ | ||
| 95 | - position: absolute; | ||
| 96 | - content: ''; | ||
| 97 | - top: 0; | ||
| 98 | - left: 0; | ||
| 99 | - right: 0; | ||
| 100 | - bottom: 0; | ||
| 101 | - margin: auto; | ||
| 102 | - width: 6rpx; | ||
| 103 | - height: 60%; | ||
| 104 | - background-color: red; | ||
| 105 | - border-radius: 10rpx; | ||
| 106 | -} | 81 | + |
| 107 | 82 | ||
| 108 | .ptop5 { | 83 | .ptop5 { |
| 109 | padding-top:5px; | 84 | padding-top:5px; |
| @@ -119,22 +94,21 @@ | @@ -119,22 +94,21 @@ | ||
| 119 | } | 94 | } |
| 120 | 95 | ||
| 121 | .menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex} | 96 | .menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex} |
| 122 | -.labelListImg{ | ||
| 123 | - width: 50rpx; height: 30rpx; margin-right: 10rpx; | ||
| 124 | -} | 97 | + |
| 125 | 98 | ||
| 126 | .hasListModel{ | 99 | .hasListModel{ |
| 127 | /*列表模式*/ | 100 | /*列表模式*/ |
| 101 | + height: 160rpx; | ||
| 102 | + padding: 20rpx 0; | ||
| 128 | } | 103 | } |
| 129 | .hasListModel .avatar{ | 104 | .hasListModel .avatar{ |
| 130 | - width: 138rpx; | ||
| 131 | - min-width: 138rpx; | ||
| 132 | - height: 140rpx; | ||
| 133 | - margin-right: 18rpx; | 105 | + width: 160rpx; |
| 106 | + min-width: 160rpx; | ||
| 107 | + height: 160rpx; | ||
| 108 | + margin-right: 20rpx; | ||
| 134 | border-radius: 10rpx; | 109 | border-radius: 10rpx; |
| 135 | overflow: hidden; | 110 | overflow: hidden; |
| 136 | background-color: #D8D8D8; | 111 | background-color: #D8D8D8; |
| 137 | - margin-top: 10rpx; | ||
| 138 | } | 112 | } |
| 139 | .hasListModel .avatar image{ | 113 | .hasListModel .avatar image{ |
| 140 | width: 100%; | 114 | width: 100%; |
| @@ -145,54 +119,61 @@ | @@ -145,54 +119,61 @@ | ||
| 145 | .hasListModel .content{ | 119 | .hasListModel .content{ |
| 146 | overflow: hidden; | 120 | overflow: hidden; |
| 147 | width: 100%; | 121 | width: 100%; |
| 122 | + height: 160rpx; | ||
| 148 | } | 123 | } |
| 149 | .hasListModel .name{ | 124 | .hasListModel .name{ |
| 150 | - height: 48rpx; | ||
| 151 | - line-height:48rpx; | ||
| 152 | - font-size: 34rpx; | 125 | + height: 30rpx; |
| 126 | + line-height:30rpx; | ||
| 127 | + font-size: 30rpx; | ||
| 153 | overflow: hidden; | 128 | overflow: hidden; |
| 154 | text-overflow:ellipsis; | 129 | text-overflow:ellipsis; |
| 155 | white-space: nowrap; | 130 | white-space: nowrap; |
| 156 | } | 131 | } |
| 157 | .hasListModel .desc{ | 132 | .hasListModel .desc{ |
| 158 | - height: 34rpx; | ||
| 159 | - line-height:34rpx; | ||
| 160 | - font-size: 24rpx; | 133 | + height: 20rpx; |
| 134 | + line-height:20rpx; | ||
| 135 | + font-size: 20rpx; | ||
| 161 | overflow: hidden; | 136 | overflow: hidden; |
| 162 | text-overflow:ellipsis; | 137 | text-overflow:ellipsis; |
| 163 | white-space: nowrap; | 138 | white-space: nowrap; |
| 139 | + color:#999999; | ||
| 164 | } | 140 | } |
| 165 | .hasListModel .label{ | 141 | .hasListModel .label{ |
| 166 | height: 22rpx; | 142 | height: 22rpx; |
| 167 | line-height:22rpx; | 143 | line-height:22rpx; |
| 168 | - overflow: hidden; | ||
| 169 | - margin-top: 12rpx; | ||
| 170 | - margin-bottom: 4rpx; | 144 | + font-size: 22rpx; |
| 171 | } | 145 | } |
| 172 | -.hasListModel .label .menu-ptop-mark,.hasListModel .label .labelListImg{ | ||
| 173 | - height: 100%; | ||
| 174 | - margin-right: 4rpx; | 146 | +.labelListImg{ |
| 147 | + width: 50rpx; | ||
| 148 | + height: 22rpx; | ||
| 149 | + margin-right: 10rpx; | ||
| 150 | + line-height: 22rpx; | ||
| 151 | + font-size: 18rpx; | ||
| 152 | + color:#FEFEFE; | ||
| 153 | + background: linear-gradient(to right, #C8B16D, #ECD48B); | ||
| 175 | } | 154 | } |
| 176 | .hasListModel .price{ | 155 | .hasListModel .price{ |
| 177 | - height: 40rpx; | ||
| 178 | - overflow: hidden; | ||
| 179 | - padding:0 10rpx; | ||
| 180 | - line-height: 40rpx; | 156 | + height: 28rpx; |
| 181 | font-size: 28rpx; | 157 | font-size: 28rpx; |
| 158 | + line-height: 28rpx; | ||
| 159 | + position: relative; | ||
| 160 | + width: 100%; | ||
| 182 | } | 161 | } |
| 183 | -.hasListModel .price .flex-ll-bottom{ | 162 | +.hasListModel .price .opt{ |
| 163 | + position: absolute; | ||
| 164 | + right:20rpx; | ||
| 165 | + top:-16rpx; | ||
| 184 | height: 40rpx; | 166 | height: 40rpx; |
| 167 | + line-height: 40rpx; | ||
| 185 | } | 168 | } |
| 186 | -.hasListModel .price .rmb{ | ||
| 187 | - /*line-height:26rpx; | ||
| 188 | - height:26rpx; | ||
| 189 | - font-size: 24rpx;*/ | ||
| 190 | - margin-right: 10rpx; | ||
| 191 | -} | ||
| 192 | -.hasListModel .price .money{ | ||
| 193 | - /*height: 30rpx; | ||
| 194 | - font-size: 28rpx; | ||
| 195 | - line-height:30rpx;*/ | 169 | +.hasListModel .t-align-c{ |
| 170 | + margin: 0 10rpx; | ||
| 171 | + font-size: 36rpx; | ||
| 172 | + font-weight: bold; | ||
| 173 | + padding: 0; | ||
| 174 | + width: 50rpx; | ||
| 175 | + overflow-x: hidden; | ||
| 176 | + text-align: center; | ||
| 196 | } | 177 | } |
| 197 | 178 | ||
| 198 | .hasListModel .food-clear-content{ | 179 | .hasListModel .food-clear-content{ |
| @@ -207,34 +188,20 @@ | @@ -207,34 +188,20 @@ | ||
| 207 | border-radius: 50%; | 188 | border-radius: 50%; |
| 208 | } | 189 | } |
| 209 | .hasListModel .jian{ | 190 | .hasListModel .jian{ |
| 210 | - border: 2rpx solid #B4B2B2; | 191 | + border: 2rpx solid #262628; |
| 211 | 192 | ||
| 212 | } | 193 | } |
| 213 | .hasListModel .jian:after{ | 194 | .hasListModel .jian:after{ |
| 214 | width: 75%; | 195 | width: 75%; |
| 215 | height: 4rpx; | 196 | height: 4rpx; |
| 216 | - background-color: #B4B2B2; | 197 | + background-color: #262628; |
| 217 | } | 198 | } |
| 218 | .hasListModel .add{ | 199 | .hasListModel .add{ |
| 219 | - border: 2rpx solid #E14553; | ||
| 220 | - background-color:#E14553; | ||
| 221 | -} | ||
| 222 | -.hasListModel .add:after,.hasListModel .add:before{ | ||
| 223 | - background-color: #fff; | ||
| 224 | -} | ||
| 225 | -.hasListModel .add:after{ | ||
| 226 | - width: 75%; | ||
| 227 | - height: 4rpx; | ||
| 228 | -} | ||
| 229 | -.hasListModel .add:before{ | ||
| 230 | - height: 75%; | ||
| 231 | - width: 4rpx; | ||
| 232 | -} | ||
| 233 | -.hasListModel .t-align-c{ | ||
| 234 | - margin: 0 10rpx; | ||
| 235 | - font-size: 36rpx; | ||
| 236 | - font-weight: bold; | ||
| 237 | - padding: 0; | ||
| 238 | - width: 50rpx; | ||
| 239 | - overflow: hidden; | 200 | + background-color: #fefefe; |
| 201 | + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png"); | ||
| 202 | + background-size: 100%; | ||
| 203 | + width: 40rpx; | ||
| 204 | + height: 40rpx; | ||
| 240 | } | 205 | } |
| 206 | + | ||
| 207 | + |
| @@ -3,448 +3,462 @@ import util from '../../../utils/util'; | @@ -3,448 +3,462 @@ import util from '../../../utils/util'; | ||
| 3 | import App from '../../../utils/api'; | 3 | import App from '../../../utils/api'; |
| 4 | const {regeneratorRuntime} = global | 4 | const {regeneratorRuntime} = global |
| 5 | Component({ | 5 | Component({ |
| 6 | - /** | ||
| 7 | - * 组件的属性列表 | ||
| 8 | - */ | ||
| 9 | - properties: { | ||
| 10 | - item:{ | ||
| 11 | - type:Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) | ||
| 12 | - }, | ||
| 13 | - type:{ | ||
| 14 | - type:String, | ||
| 15 | - default:'+' | ||
| 16 | - }, | ||
| 17 | - sellerid:{ | ||
| 18 | - type:Number | ||
| 19 | - }, | ||
| 20 | - orderid:{ | ||
| 21 | - type:Number | ||
| 22 | - }, | ||
| 23 | - fromSoucre:{ | ||
| 24 | - type:Number, | ||
| 25 | - value:0 | ||
| 26 | - }, | ||
| 27 | - request_uri:{ | ||
| 28 | - type:Boolean, | ||
| 29 | - value:false, | ||
| 30 | - } | ||
| 31 | - | 6 | + /** |
| 7 | + * 组件的属性列表 | ||
| 8 | + */ | ||
| 9 | + properties: { | ||
| 10 | + item: { | ||
| 11 | + type: Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型) | ||
| 32 | }, | 12 | }, |
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 组件的初始数据 | ||
| 36 | - */ | ||
| 37 | - data: { | ||
| 38 | - hiddenFoodSpec:true,//加菜规格 | ||
| 39 | - hiddenFoodSpecReduce:true,//减菜规格 | ||
| 40 | - selectKind:[{title:'xxxxx'},{title:'yyyyy'}], | 13 | + type: { |
| 14 | + type: String, | ||
| 15 | + default: '+' | ||
| 41 | }, | 16 | }, |
| 42 | - ready () { | ||
| 43 | - | 17 | + sellerid: { |
| 18 | + type: Number | ||
| 44 | }, | 19 | }, |
| 45 | - detached(){ | ||
| 46 | - | 20 | + orderid: { |
| 21 | + type: Number | ||
| 47 | }, | 22 | }, |
| 48 | - /** | ||
| 49 | - * 组件的方法列表 | ||
| 50 | - */ | ||
| 51 | - methods: { | ||
| 52 | - init(){ | ||
| 53 | - console.log('food-spec init'); | ||
| 54 | - this.setData({ | ||
| 55 | - hiddenFoodSpec:false | ||
| 56 | - }) | ||
| 57 | - }, | ||
| 58 | - //关闭规格框 | ||
| 59 | - close:function(){ | ||
| 60 | - this.setData({ | ||
| 61 | - hiddenFoodSpec:true, | ||
| 62 | - hiddenFoodSpecReduce:true, | ||
| 63 | - }) | ||
| 64 | - //关闭了规格窗口 | ||
| 65 | - this.triggerEvent('foodSpecCallback',{ | ||
| 66 | - type:'specWin', | ||
| 67 | - value:'hide' | ||
| 68 | - }); | ||
| 69 | - }, | ||
| 70 | - //构造KindMenu | ||
| 71 | - initKindMenu(){ | ||
| 72 | - return new Promise((success,fail)=>{ | ||
| 73 | - let price=this.data.item.price; | ||
| 74 | - let hasSpec = this.data.item.spec.length>0; | ||
| 75 | - let hasPractice = this.data.item.practice.length>0; | ||
| 76 | - if(hasSpec || hasPractice){ | ||
| 77 | - var specs = this.data.item.spec//规格 | ||
| 78 | - var practice = this.data.item.practice//做法 | ||
| 79 | - var kind = [] | ||
| 80 | - var foodMenu=[] | ||
| 81 | - if(this.data.type=='-'){ | ||
| 82 | - if(specs){ | ||
| 83 | - specs.map(function(r,n){ | ||
| 84 | - if(r.id){//某规格卖光了 就不显示 && r.clear_num>1 | ||
| 85 | - kind.push({id:r.id,price:r.price,title:r.specs,iskind:false}) | ||
| 86 | - } | ||
| 87 | - }) | ||
| 88 | - } | 23 | + fromSoucre: { |
| 24 | + type: Number, | ||
| 25 | + value: 0 | ||
| 26 | + }, | ||
| 27 | + request_uri: { | ||
| 28 | + type: Boolean, | ||
| 29 | + value: false, | ||
| 30 | + }, | ||
| 31 | + identity: { | ||
| 32 | + type: String, | ||
| 33 | + value: "", | ||
| 34 | + } | ||
| 89 | 35 | ||
| 90 | - if(practice) { | ||
| 91 | - practice.map(function (r, n) { | ||
| 92 | - if (r.id) { | ||
| 93 | - foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false}) | ||
| 94 | - } | ||
| 95 | - }) | ||
| 96 | - } | ||
| 97 | - App.Cookbook.GetCookbookSelBySpecsId({ | ||
| 98 | - sellerid:this.data.sellerid, | ||
| 99 | - orderid: this.data.orderid, | ||
| 100 | - cookbookid: this.data.item.id, | ||
| 101 | - status:this.data.fromSoucre!=''?2:'',//只查没有下单的 | ||
| 102 | - }).then(res=>{ | ||
| 103 | - this.setData({ | ||
| 104 | - selectKind:res.data[0], | ||
| 105 | - hiddenFoodSpecReduce:false, | ||
| 106 | - kind:kind?kind:'', | ||
| 107 | - foodMenu:foodMenu, | ||
| 108 | - }) | ||
| 109 | - }) | ||
| 110 | - }else{ | ||
| 111 | - specs.map(function(r,n){ | ||
| 112 | - if ((r.id && r.clear_num > 0) || r.clear_num==null){//某规格卖光了 就不显示 && r.clear_num>1 | ||
| 113 | - kind.push({id:r.id,price:r.price,title:r.specs,iskind:false}) | ||
| 114 | - } | ||
| 115 | - }) | ||
| 116 | - if(kind.length>0){ | ||
| 117 | - kind[0].iskind=true; | ||
| 118 | - var kindPrice=kind[0].price; | ||
| 119 | - var specs_id=kind[0].id; | ||
| 120 | - } | 36 | + }, |
| 121 | 37 | ||
| 122 | - practice.map(function(r,n){ | ||
| 123 | - if(r.id){ | ||
| 124 | - foodMenu.push({id:r.id,price:price,title:r.name,iskind:false}) | ||
| 125 | - } | ||
| 126 | - }) | 38 | + /** |
| 39 | + * 组件的初始数据 | ||
| 40 | + */ | ||
| 41 | + data: { | ||
| 42 | + hiddenFoodSpec: true,//加菜规格 | ||
| 43 | + hiddenFoodSpecReduce: true,//减菜规格 | ||
| 44 | + selectKind: [{title: 'xxxxx'}, {title: 'yyyyy'}], | ||
| 45 | + }, | ||
| 46 | + ready () { | ||
| 127 | 47 | ||
| 128 | - if(foodMenu.length>0){ | ||
| 129 | - foodMenu[0].iskind=true; | ||
| 130 | - var foodMenuPrice=foodMenu[0].price; | ||
| 131 | - var practice_id=foodMenu[0].id; | ||
| 132 | - } | ||
| 133 | - App.Cookbook.GetCookbookSelBySpecsId({ | ||
| 134 | - sellerid:this.data.sellerid, | ||
| 135 | - orderid: this.data.orderid, | ||
| 136 | - cookbookid: this.data.item.id, | ||
| 137 | - status:this.data.fromSoucre!=''?2:'',//只查没有下单的 | ||
| 138 | - }).then(res=>{ | ||
| 139 | - this.setData({ | ||
| 140 | - selectKind:res.data[0], | ||
| 141 | - hiddenFoodSpec:false, | ||
| 142 | - kind:kind, | ||
| 143 | - foodMenu:foodMenu, | ||
| 144 | - showSpecsPrice:false, | ||
| 145 | - cookbook_name:this.data.item.name, | ||
| 146 | - cookbook_id:this.data.item.id, | ||
| 147 | - specs_id:specs_id ? specs_id :'', | ||
| 148 | - practice_id:practice_id ? practice_id : '', | ||
| 149 | - selectPrice:kindPrice>0 ? kindPrice : foodMenuPrice, | ||
| 150 | - add_target:'' | ||
| 151 | - }) | ||
| 152 | - }) | ||
| 153 | - } | ||
| 154 | - success(); | ||
| 155 | - }else{ | ||
| 156 | - fail(); | ||
| 157 | - } | ||
| 158 | - }); | ||
| 159 | - }, | ||
| 160 | - //选择规格 | ||
| 161 | - kindSelect: function (e) { | ||
| 162 | - var index = e.currentTarget.dataset.key | ||
| 163 | - var specsid = e.currentTarget.id | ||
| 164 | - var price = e.currentTarget.dataset.price | ||
| 165 | - for (var i = 0; i < this.data.kind.length; i++) { | ||
| 166 | - if (i == index) { | ||
| 167 | - this.data.kind[i].iskind = true; | ||
| 168 | - } else { | ||
| 169 | - this.data.kind[i].iskind = false; | ||
| 170 | - } | ||
| 171 | - } | ||
| 172 | - var is_show = '' | ||
| 173 | - if(this.data.foodMenu==''){ | ||
| 174 | - is_show=1 | ||
| 175 | - }else if(specsid && this.data.practice_id){ | ||
| 176 | - is_show=1 | ||
| 177 | - } | ||
| 178 | - this.setData({ | ||
| 179 | - kind: this.data.kind, | ||
| 180 | - selectPrice:price, | ||
| 181 | - specs_id:specsid, | ||
| 182 | - foodMenu:this.data.foodMenu?this.data.foodMenu:'', | ||
| 183 | - showSpecsPrice:price?false:true, | ||
| 184 | - showAdd:is_show?false:true//showAdd:specsid?false:true | ||
| 185 | - }); | ||
| 186 | - }, | ||
| 187 | - //选择做法 | ||
| 188 | - menuSelect: function (e) { | ||
| 189 | - var index = e.currentTarget.dataset.key | ||
| 190 | - var practiceid = e.currentTarget.id | ||
| 191 | - var price = e.currentTarget.dataset.price | ||
| 192 | - for (var i = 0; i < this.data.foodMenu.length; i++) { | ||
| 193 | - if (i == index) { | ||
| 194 | - this.data.foodMenu[i].iskind = true; | ||
| 195 | - } else { | ||
| 196 | - this.data.foodMenu[i].iskind = false; | ||
| 197 | - } | ||
| 198 | - } | ||
| 199 | - var is_show = '' | ||
| 200 | - if(this.data.kind==''){ | ||
| 201 | - is_show=1 | ||
| 202 | - }else if(this.data.specs_id && practiceid){ | ||
| 203 | - is_show=1 | ||
| 204 | - } | ||
| 205 | - this.setData({ | ||
| 206 | - foodMenu: this.data.foodMenu, | ||
| 207 | - foodMenuPrice:price, | ||
| 208 | - practice_id:practiceid, | ||
| 209 | - showAdd:is_show?false:true | ||
| 210 | - }); | ||
| 211 | - }, | ||
| 212 | - //加菜面板 | ||
| 213 | - addCook:function(e){ | ||
| 214 | - console.log('addCook',this.data.item,e); | ||
| 215 | - var cookbookid = this.data.item.id | ||
| 216 | - var price=this.data.item.price; | 48 | + }, |
| 49 | + detached(){ | ||
| 217 | 50 | ||
| 218 | - this.initKindMenu().then(res=>{ | ||
| 219 | - //打开了规格窗口 | ||
| 220 | - this.triggerEvent('foodSpecCallback',{ | ||
| 221 | - type:'specWin', | ||
| 222 | - value:'show' | ||
| 223 | - }); | ||
| 224 | - }).catch(res=>{ | ||
| 225 | - console.log('initKindMenu',res); | ||
| 226 | - if( this.data.item.clear_num && this.data.item.clear_num>0 | ||
| 227 | - && this.data.item.num+1 > this.data.item.clear_num){ | ||
| 228 | - wx.showToast({ | ||
| 229 | - title:'该菜品最多能点'+this.data.item.clear_num+'份', | ||
| 230 | - duration:2000, | ||
| 231 | - mask:true, | ||
| 232 | - icon:'none' | ||
| 233 | - }); | ||
| 234 | - return; | 51 | + }, |
| 52 | + /** | ||
| 53 | + * 组件的方法列表 | ||
| 54 | + */ | ||
| 55 | + methods: { | ||
| 56 | + init(){ | ||
| 57 | + console.log('food-spec init'); | ||
| 58 | + this.setData({ | ||
| 59 | + hiddenFoodSpec: false | ||
| 60 | + }) | ||
| 61 | + }, | ||
| 62 | + //关闭规格框 | ||
| 63 | + close: function () { | ||
| 64 | + this.setData({ | ||
| 65 | + hiddenFoodSpec: true, | ||
| 66 | + hiddenFoodSpecReduce: true, | ||
| 67 | + }) | ||
| 68 | + //关闭了规格窗口 | ||
| 69 | + this.triggerEvent('foodSpecCallback', { | ||
| 70 | + type: 'specWin', | ||
| 71 | + value: 'hide' | ||
| 72 | + }); | ||
| 73 | + }, | ||
| 74 | + //构造KindMenu | ||
| 75 | + initKindMenu(){ | ||
| 76 | + return new Promise((success, fail) => { | ||
| 77 | + let price = this.data.item.price; | ||
| 78 | + let hasSpec = this.data.item.spec.length > 0; | ||
| 79 | + let hasPractice = this.data.item.practice.length > 0; | ||
| 80 | + if (hasSpec || hasPractice) { | ||
| 81 | + var specs = this.data.item.spec//规格 | ||
| 82 | + var practice = this.data.item.practice//做法 | ||
| 83 | + var kind = [] | ||
| 84 | + var foodMenu = [] | ||
| 85 | + if (this.data.type == '-') { | ||
| 86 | + if (specs) { | ||
| 87 | + specs.map(function (r, n) { | ||
| 88 | + if (r.id) {//某规格卖光了 就不显示 && r.clear_num>1 | ||
| 89 | + kind.push({id: r.id, price: r.price, title: r.specs, iskind: false}) | ||
| 235 | } | 90 | } |
| 236 | - //通知 | ||
| 237 | - this.triggerEvent('foodSpecCallback',{ | ||
| 238 | - cookbookid:cookbookid, | ||
| 239 | - type:1, | ||
| 240 | - }); | ||
| 241 | - //this.matchArray(cookbookid,1,countTotal,countPirce) | ||
| 242 | - App.Orders.AddCart({ | ||
| 243 | - orderid: this.data.orderid, | ||
| 244 | - openid:util.cache('openid'), | ||
| 245 | - cookbookid:cookbookid, | ||
| 246 | - price: price, | ||
| 247 | - source: 1, | ||
| 248 | - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 249 | - fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'', | ||
| 250 | - identity:util.cache('identity') | ||
| 251 | - }); | ||
| 252 | - }); | ||
| 253 | - }, | ||
| 254 | - //减菜面板 | ||
| 255 | - subtractCook(){ | ||
| 256 | - console.log('addFunction',this.data.item); | ||
| 257 | - var cookbookid = this.data.item.id | ||
| 258 | - var price=this.data.item.price; | ||
| 259 | - this.initKindMenu().then(res=>{ | ||
| 260 | - //打开了规格窗口 | ||
| 261 | - this.triggerEvent('foodSpecCallback',{ | ||
| 262 | - type:'specWin', | ||
| 263 | - value:'show' | ||
| 264 | - }); | ||
| 265 | - }).catch(res=>{ | ||
| 266 | - //通知 | ||
| 267 | - this.triggerEvent('foodSpecCallback',{ | ||
| 268 | - cookbookid:cookbookid, | ||
| 269 | - type:-1, | ||
| 270 | - }); | ||
| 271 | - | ||
| 272 | - App.Orders.ReduceOrder({ | ||
| 273 | - orderid: this.data.orderid, | ||
| 274 | - openid: getApp().openid, | ||
| 275 | - cookbookid: cookbookid, | ||
| 276 | - //specid: specid ? specid : '', | ||
| 277 | - //practiceid: specid ? specid : '', | ||
| 278 | - fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 279 | - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 280 | - status:this.data.fromSoucre!=''?2:'',//只查没有下单的 | ||
| 281 | - source: 2, | ||
| 282 | - }); | ||
| 283 | - }); | ||
| 284 | - }, | ||
| 285 | - //减菜面板加菜按钮 | ||
| 286 | - add:function(e){ | ||
| 287 | - console.log('add',util.attr(e,'cookbookid'),e); | ||
| 288 | - let index=util.attr(e,'index'); | ||
| 289 | - let selectKind=this.data.selectKind; | 91 | + }) |
| 92 | + } | ||
| 290 | 93 | ||
| 291 | - console.log('selectKind',selectKind,index); | ||
| 292 | - let specs=this.data.item.spec; | ||
| 293 | - let clear_num=null; | ||
| 294 | - specs.forEach(spec=>{ | ||
| 295 | - if(spec.id==selectKind[index].specid){ | ||
| 296 | - clear_num=spec.clear_num; | 94 | + if (practice) { |
| 95 | + practice.map(function (r, n) { | ||
| 96 | + if (r.id) { | ||
| 97 | + foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false}) | ||
| 297 | } | 98 | } |
| 99 | + }) | ||
| 100 | + } | ||
| 101 | + App.Advance.GetCookbookSelBySpecsId({ | ||
| 102 | + sellerid: this.data.sellerid, | ||
| 103 | + orderid: this.data.orderid, | ||
| 104 | + cookbookid: this.data.item.id, | ||
| 105 | + status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的 | ||
| 106 | + identity: this.data.identity | ||
| 107 | + }).then(res => { | ||
| 108 | + this.setData({ | ||
| 109 | + selectKind: res.data, | ||
| 110 | + hiddenFoodSpecReduce: false, | ||
| 111 | + kind: kind ? kind : '', | ||
| 112 | + foodMenu: foodMenu, | ||
| 113 | + }) | ||
| 114 | + }) | ||
| 115 | + } else { | ||
| 116 | + specs.map(function (r, n) { | ||
| 117 | + if ((r.id && r.clear_num > 0) || r.clear_num == null) {//某规格卖光了 就不显示 && r.clear_num>1 | ||
| 118 | + kind.push({id: r.id, price: r.price, title: r.specs, iskind: false}) | ||
| 119 | + } | ||
| 298 | }) | 120 | }) |
| 299 | - if( clear_num && clear_num>0 | ||
| 300 | - && selectKind[index].foodNum+1 > clear_num){ | ||
| 301 | - wx.showToast({ | ||
| 302 | - title:'该菜品最多能点'+clear_num+'份', | ||
| 303 | - duration:2000, | ||
| 304 | - mask:true, | ||
| 305 | - icon:'none' | ||
| 306 | - }); | ||
| 307 | - return; | 121 | + if (kind.length > 0) { |
| 122 | + kind[0].iskind = true; | ||
| 123 | + var kindPrice = kind[0].price; | ||
| 124 | + var specs_id = kind[0].id; | ||
| 308 | } | 125 | } |
| 309 | 126 | ||
| 310 | - selectKind[index].foodNum=parseInt(selectKind[index].foodNum)+1; | ||
| 311 | - this.setData({selectKind:selectKind}); | ||
| 312 | - this.formSubmit(e,true); | ||
| 313 | - }, | ||
| 314 | - //减菜面板减菜按钮 | ||
| 315 | - reduce(e){ | ||
| 316 | - console.log('reduce',util.attr(e,'cookbookid'),e); | ||
| 317 | - var cookbookid = util.attr(e,'cookbookid') | ||
| 318 | - var specid = util.attr(e,'specid') | ||
| 319 | - var practice_id = util.attr(e,'practiceid') | ||
| 320 | - var price = util.attr(e,'price') | 127 | + practice.map(function (r, n) { |
| 128 | + if (r.id) { | ||
| 129 | + foodMenu.push({id: r.id, price: price, title: r.name, iskind: false}) | ||
| 130 | + } | ||
| 131 | + }) | ||
| 321 | 132 | ||
| 322 | - let index=util.attr(e,'index'); | ||
| 323 | - let selectKind=this.data.selectKind; | ||
| 324 | - selectKind[index].foodNum-=1; | ||
| 325 | - if(selectKind[index].foodNum<=0){ | ||
| 326 | - selectKind.splice(index,1); | ||
| 327 | - } | ||
| 328 | - this.setData({selectKind:selectKind}); | ||
| 329 | - if(selectKind.length<1){ | ||
| 330 | - this.close(); | 133 | + if (foodMenu.length > 0) { |
| 134 | + foodMenu[0].iskind = true; | ||
| 135 | + var foodMenuPrice = foodMenu[0].price; | ||
| 136 | + var practice_id = foodMenu[0].id; | ||
| 331 | } | 137 | } |
| 138 | + this.setData({ | ||
| 139 | + selectKind: [], | ||
| 140 | + hiddenFoodSpec: false, | ||
| 141 | + kind: kind, | ||
| 142 | + foodMenu: foodMenu, | ||
| 143 | + showSpecsPrice: false, | ||
| 144 | + cookbook_name: this.data.item.name, | ||
| 145 | + cookbook_id: this.data.item.id, | ||
| 146 | + specs_id: specs_id ? specs_id : '', | ||
| 147 | + practice_id: practice_id ? practice_id : '', | ||
| 148 | + selectPrice: kindPrice > 0 ? kindPrice : foodMenuPrice, | ||
| 149 | + add_target: '' | ||
| 150 | + }) | ||
| 151 | + } | ||
| 152 | + success(); | ||
| 153 | + } else { | ||
| 154 | + fail(); | ||
| 155 | + } | ||
| 156 | + }); | ||
| 157 | + }, | ||
| 158 | + //选择规格 | ||
| 159 | + kindSelect: function (e) { | ||
| 160 | + var index = e.currentTarget.dataset.key | ||
| 161 | + var specsid = e.currentTarget.id | ||
| 162 | + var price = e.currentTarget.dataset.price | ||
| 163 | + for (var i = 0; i < this.data.kind.length; i++) { | ||
| 164 | + if (i == index) { | ||
| 165 | + this.data.kind[i].iskind = true; | ||
| 166 | + } else { | ||
| 167 | + this.data.kind[i].iskind = false; | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + var is_show = '' | ||
| 171 | + if (this.data.foodMenu == '') { | ||
| 172 | + is_show = 1 | ||
| 173 | + } else if (specsid && this.data.practice_id) { | ||
| 174 | + is_show = 1 | ||
| 175 | + } | ||
| 176 | + this.setData({ | ||
| 177 | + kind: this.data.kind, | ||
| 178 | + selectPrice: price, | ||
| 179 | + specs_id: specsid, | ||
| 180 | + foodMenu: this.data.foodMenu ? this.data.foodMenu : '', | ||
| 181 | + showSpecsPrice: price ? false : true, | ||
| 182 | + showAdd: is_show ? false : true//showAdd:specsid?false:true | ||
| 183 | + }); | ||
| 184 | + }, | ||
| 185 | + //选择做法 | ||
| 186 | + menuSelect: function (e) { | ||
| 187 | + var index = e.currentTarget.dataset.key | ||
| 188 | + var practiceid = e.currentTarget.id | ||
| 189 | + var price = e.currentTarget.dataset.price | ||
| 190 | + for (var i = 0; i < this.data.foodMenu.length; i++) { | ||
| 191 | + if (i == index) { | ||
| 192 | + this.data.foodMenu[i].iskind = true; | ||
| 193 | + } else { | ||
| 194 | + this.data.foodMenu[i].iskind = false; | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + var is_show = '' | ||
| 198 | + if (this.data.kind == '') { | ||
| 199 | + is_show = 1 | ||
| 200 | + } else if (this.data.specs_id && practiceid) { | ||
| 201 | + is_show = 1 | ||
| 202 | + } | ||
| 203 | + this.setData({ | ||
| 204 | + foodMenu: this.data.foodMenu, | ||
| 205 | + foodMenuPrice: price, | ||
| 206 | + practice_id: practiceid, | ||
| 207 | + showAdd: is_show ? false : true | ||
| 208 | + }); | ||
| 209 | + }, | ||
| 210 | + //加菜面板 | ||
| 211 | + addCook: function (e) { | ||
| 212 | + console.log('addCook', this.data.item, e); | ||
| 213 | + var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id | ||
| 214 | + var price = this.data.item.price; | ||
| 332 | 215 | ||
| 333 | - this.triggerEvent('foodSpecCallback',{ | ||
| 334 | - cookbookid:cookbookid, | ||
| 335 | - type:-1 | ||
| 336 | - }); | 216 | + this.initKindMenu().then(res => { |
| 217 | + //打开了规格窗口 | ||
| 218 | + this.triggerEvent('foodSpecCallback', { | ||
| 219 | + type: 'specWin', | ||
| 220 | + value: 'show' | ||
| 221 | + }); | ||
| 222 | + }).catch(res => { | ||
| 223 | + console.log('initKindMenu', res); | ||
| 224 | + if (this.data.item.clear_num && this.data.item.clear_num > 0 | ||
| 225 | + && this.data.item.num + 1 > this.data.item.clear_num) { | ||
| 226 | + wx.showToast({ | ||
| 227 | + title: '该菜品最多能点' + this.data.item.clear_num + '份', | ||
| 228 | + duration: 2000, | ||
| 229 | + mask: true, | ||
| 230 | + icon: 'none' | ||
| 231 | + }); | ||
| 232 | + return; | ||
| 233 | + } | ||
| 234 | + //通知 | ||
| 235 | + this.triggerEvent('foodSpecCallback', { | ||
| 236 | + cookbookid: cookbookid, | ||
| 237 | + type: 1, | ||
| 238 | + }); | ||
| 239 | + //this.matchArray(cookbookid,1,countTotal,countPirce) | ||
| 240 | + let params={ | ||
| 241 | + orderid: this.data.orderid, | ||
| 242 | + openid: util.cache('openid'), | ||
| 243 | + cookbookid: cookbookid, | ||
| 244 | + price: price, | ||
| 245 | + source: 1, | ||
| 246 | + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 247 | + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 248 | + identity: this.data.identity | ||
| 249 | + } | ||
| 250 | + if(this.data.item.specid>0){ | ||
| 251 | + params.specid=this.data.item.specid; | ||
| 252 | + } | ||
| 253 | + if(this.data.item.practiceid>0){ | ||
| 254 | + params.practiceid=this.data.item.practiceid; | ||
| 255 | + } | ||
| 256 | + App.Advance.AddCart(params); | ||
| 257 | + }); | ||
| 258 | + }, | ||
| 259 | + //减菜面板 | ||
| 260 | + subtractCook(){ | ||
| 261 | + console.log('subtractCook', this.data.item); | ||
| 262 | + var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id | ||
| 263 | + var price = this.data.item.price; | ||
| 264 | + this.initKindMenu().then(res => { | ||
| 265 | + //打开了规格窗口 | ||
| 266 | + this.triggerEvent('foodSpecCallback', { | ||
| 267 | + type: 'specWin', | ||
| 268 | + value: 'show' | ||
| 269 | + }); | ||
| 270 | + }).catch(res => { | ||
| 271 | + //通知 | ||
| 272 | + this.triggerEvent('foodSpecCallback', { | ||
| 273 | + cookbookid: cookbookid, | ||
| 274 | + type: -1, | ||
| 275 | + }); | ||
| 276 | + let params={ | ||
| 277 | + orderid: this.data.orderid, | ||
| 278 | + openid: getApp().openid, | ||
| 279 | + cookbookid: cookbookid, | ||
| 280 | + //specid: specid ? specid : '', | ||
| 281 | + //practiceid: specid ? specid : '', | ||
| 282 | + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 283 | + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 284 | + status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的 | ||
| 285 | + source: 2, | ||
| 286 | + identity: this.data.identity | ||
| 287 | + } | ||
| 288 | + if(this.data.item.specid>0){ | ||
| 289 | + params.specid=this.data.item.specid; | ||
| 290 | + } | ||
| 291 | + if(this.data.item.practiceid>0){ | ||
| 292 | + params.practiceid=this.data.item.practiceid; | ||
| 293 | + } | ||
| 294 | + App.Advance.ReduceOrder(params); | ||
| 295 | + }); | ||
| 296 | + }, | ||
| 297 | + //减菜面板加菜按钮 | ||
| 298 | + add: function (e) { | ||
| 299 | + console.log('add', util.attr(e, 'cookbookid'), e); | ||
| 300 | + let index = util.attr(e, 'index'); | ||
| 301 | + let selectKind = this.data.selectKind; | ||
| 337 | 302 | ||
| 338 | - //执行删除操作 | ||
| 339 | - let params={ | ||
| 340 | - orderid: this.data.orderid, | ||
| 341 | - openid: getApp().openid, | ||
| 342 | - cookbookid: cookbookid, | ||
| 343 | - fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 344 | - status:this.data.fromSoucre?2:'',//只查没有下单的 | ||
| 345 | - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 346 | - source: 2, | ||
| 347 | - }; | ||
| 348 | - if(specid>0){ | ||
| 349 | - params.specid=specid; | ||
| 350 | - } | ||
| 351 | - if(practice_id>0){ | ||
| 352 | - params.practiceid=practice_id; | ||
| 353 | - } | ||
| 354 | - App.Orders.ReduceOrder(params); | ||
| 355 | - }, | ||
| 356 | - /** | ||
| 357 | - * | ||
| 358 | - * @param e | ||
| 359 | - * @param subtractCook 减菜面板 | ||
| 360 | - */ | ||
| 361 | - formSubmit(e,subtractCook=false){ | ||
| 362 | - if(subtractCook){//减菜面板 | ||
| 363 | - var cookbookid = util.attr(e,'cookbookid') | ||
| 364 | - var specid = util.attr(e,'specid') | ||
| 365 | - var practice_id = util.attr(e,'practiceid') | ||
| 366 | - var price = util.attr(e,'price') | ||
| 367 | - }else{ | ||
| 368 | - var cookbookid = util.val(e,'cookbookid') | ||
| 369 | - var specid = util.val(e,'specs_id') | ||
| 370 | - var practice_id = util.val(e,'practice_id') | ||
| 371 | - var price = util.val(e,'price') | ||
| 372 | - if(this.data.selectPrice){ | ||
| 373 | - console.log(666666,this.data.selectPrice) | ||
| 374 | - price=this.data.selectPrice | ||
| 375 | - }else{ | ||
| 376 | - console.log('yyyyyy',this.data.foodMenuPrice) | ||
| 377 | - price=this.data.foodMenuPrice | ||
| 378 | - } | ||
| 379 | - this.close(); | ||
| 380 | - } | ||
| 381 | - console.log('formSubmit',specid,practice_id,price) | 303 | + console.log('selectKind', selectKind, index); |
| 304 | + let specs = this.data.item.spec; | ||
| 305 | + let clear_num = null; | ||
| 306 | + specs.forEach(spec => { | ||
| 307 | + if (spec.id == selectKind[index].specid) { | ||
| 308 | + clear_num = spec.clear_num; | ||
| 309 | + } | ||
| 310 | + }) | ||
| 311 | + if (clear_num && clear_num > 0 | ||
| 312 | + && selectKind[index].foodNum + 1 > clear_num) { | ||
| 313 | + wx.showToast({ | ||
| 314 | + title: '该菜品最多能点' + clear_num + '份', | ||
| 315 | + duration: 2000, | ||
| 316 | + mask: true, | ||
| 317 | + icon: 'none' | ||
| 318 | + }); | ||
| 319 | + return; | ||
| 320 | + } | ||
| 382 | 321 | ||
| 322 | + selectKind[index].foodNum = parseInt(selectKind[index].foodNum) + 1; | ||
| 323 | + this.setData({selectKind: selectKind}); | ||
| 324 | + this.formSubmit(e, true); | ||
| 325 | + }, | ||
| 326 | + //减菜面板减菜按钮 | ||
| 327 | + reduce(e){ | ||
| 328 | + console.log('reduce', util.attr(e, 'cookbookid'), e); | ||
| 329 | + var cookbookid = util.attr(e, 'cookbookid') | ||
| 330 | + var specid = util.attr(e, 'specid') | ||
| 331 | + var practice_id = util.attr(e, 'practiceid') | ||
| 332 | + var price = util.attr(e, 'price') | ||
| 383 | 333 | ||
| 384 | - let selectKindNum=0; | ||
| 385 | - if(this.data.selectKind){ | ||
| 386 | - this.data.selectKind.forEach((kind)=>{ | ||
| 387 | - if(kind.specid==specid){ | ||
| 388 | - selectKindNum=kind.foodNum | ||
| 389 | - } | ||
| 390 | - }) | ||
| 391 | - } | ||
| 392 | - console.log('selectKindNum',this.data.selectKind,selectKindNum); | ||
| 393 | - if(selectKindNum>0){ | ||
| 394 | - let clear_num=null; | ||
| 395 | - let specs=this.data.item.spec; | ||
| 396 | - specs.forEach(spec=>{ | ||
| 397 | - if(spec.id==specid){ | ||
| 398 | - clear_num=spec.clear_num; | ||
| 399 | - } | ||
| 400 | - }) | ||
| 401 | - if( clear_num && clear_num>0 | ||
| 402 | - && selectKindNum+1 > clear_num){ | ||
| 403 | - wx.showToast({ | ||
| 404 | - title:'该菜品最多能点'+clear_num+'份', | ||
| 405 | - duration:2000, | ||
| 406 | - mask:true, | ||
| 407 | - icon:'none' | ||
| 408 | - }); | ||
| 409 | - return; | ||
| 410 | - } | ||
| 411 | - } | 334 | + let index = util.attr(e, 'index'); |
| 335 | + let selectKind = this.data.selectKind; | ||
| 336 | + selectKind[index].foodNum -= 1; | ||
| 337 | + if (selectKind[index].foodNum <= 0) { | ||
| 338 | + selectKind.splice(index, 1); | ||
| 339 | + } | ||
| 340 | + this.setData({selectKind: selectKind}); | ||
| 341 | + if (selectKind.length < 1) { | ||
| 342 | + this.close(); | ||
| 343 | + } | ||
| 412 | 344 | ||
| 345 | + this.triggerEvent('foodSpecCallback', { | ||
| 346 | + cookbookid: cookbookid, | ||
| 347 | + type: -1 | ||
| 348 | + }); | ||
| 413 | 349 | ||
| 414 | - this.triggerEvent('foodSpecCallback',{ | ||
| 415 | - cookbookid:cookbookid, | ||
| 416 | - type:1 | ||
| 417 | - }); | ||
| 418 | - let param={ | ||
| 419 | - orderid: this.data.orderid, | ||
| 420 | - openid:util.cache('openid'), | ||
| 421 | - cookbookid:this.data.item.id, | ||
| 422 | - price: price, | ||
| 423 | - source: 1, | ||
| 424 | - request_uri: this.data.request_uri==true?1:'',//服务员通过消息通知进来 又加菜的标识 | ||
| 425 | - fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'', | ||
| 426 | - identity:util.cache('identity') | ||
| 427 | - } | ||
| 428 | - if(specid>0){ | ||
| 429 | - param.specid=specid; | ||
| 430 | - } | ||
| 431 | - if(practice_id>0){ | ||
| 432 | - param.practiceid=practice_id; | ||
| 433 | - } | ||
| 434 | - App.Orders.AddCart(param); | ||
| 435 | - }, | ||
| 436 | - //清除订单下某菜品所有数量 | ||
| 437 | - clean(){ | ||
| 438 | - let cookbookid=this.data.item.id | ||
| 439 | - this.triggerEvent('foodSpecCallback',{ | ||
| 440 | - cookbookid:cookbookid, | ||
| 441 | - type:this.data.item.num*-1 | ||
| 442 | - }); | ||
| 443 | - App.Orders.ClearCookById({ | ||
| 444 | - orderid: this.data.orderid, | ||
| 445 | - sellerid: this.data.sellerid, | ||
| 446 | - cookbookid:cookbookid | ||
| 447 | - }); | 350 | + //执行删除操作 |
| 351 | + let params = { | ||
| 352 | + orderid: this.data.orderid, | ||
| 353 | + openid: getApp().openid, | ||
| 354 | + cookbookid: cookbookid, | ||
| 355 | + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 356 | + status: this.data.fromSoucre ? 2 : '',//只查没有下单的 | ||
| 357 | + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 358 | + source: 2, | ||
| 359 | + identity: this.data.identity | ||
| 360 | + }; | ||
| 361 | + if (specid > 0) { | ||
| 362 | + params.specid = specid; | ||
| 363 | + } | ||
| 364 | + if (practice_id > 0) { | ||
| 365 | + params.practiceid = practice_id; | ||
| 366 | + } | ||
| 367 | + App.Advance.ReduceOrder(params); | ||
| 368 | + }, | ||
| 369 | + /** | ||
| 370 | + * | ||
| 371 | + * @param e | ||
| 372 | + * @param subtractCook 减菜面板 | ||
| 373 | + */ | ||
| 374 | + formSubmit(e, subtractCook = false){ | ||
| 375 | + if (subtractCook) {//减菜面板 | ||
| 376 | + var cookbookid = util.attr(e, 'cookbookid') | ||
| 377 | + var specid = util.attr(e, 'specid') | ||
| 378 | + var practice_id = util.attr(e, 'practiceid') | ||
| 379 | + var price = util.attr(e, 'price') | ||
| 380 | + } else { | ||
| 381 | + var cookbookid = util.val(e, 'cookbookid') | ||
| 382 | + var specid = util.val(e, 'specs_id') | ||
| 383 | + var practice_id = util.val(e, 'practice_id') | ||
| 384 | + var price = util.val(e, 'price') | ||
| 385 | + if (this.data.selectPrice) { | ||
| 386 | + console.log(666666, this.data.selectPrice) | ||
| 387 | + price = this.data.selectPrice | ||
| 388 | + } else { | ||
| 389 | + console.log('yyyyyy', this.data.foodMenuPrice) | ||
| 390 | + price = this.data.foodMenuPrice | ||
| 391 | + } | ||
| 392 | + this.close(); | ||
| 393 | + } | ||
| 394 | + console.log('formSubmit', cookbookid,specid, practice_id, price) | ||
| 395 | + //return; | ||
| 396 | + | ||
| 397 | + let selectKindNum = 0; | ||
| 398 | + if (this.data.selectKind) { | ||
| 399 | + this.data.selectKind.forEach((kind) => { | ||
| 400 | + if (kind.specid == specid) { | ||
| 401 | + selectKindNum = kind.foodNum | ||
| 402 | + } | ||
| 403 | + }) | ||
| 404 | + } | ||
| 405 | + console.log('selectKindNum', this.data.selectKind, selectKindNum); | ||
| 406 | + if (selectKindNum > 0) { | ||
| 407 | + let clear_num = null; | ||
| 408 | + let specs = this.data.item.spec; | ||
| 409 | + specs.forEach(spec => { | ||
| 410 | + if (spec.id == specid) { | ||
| 411 | + clear_num = spec.clear_num; | ||
| 412 | + } | ||
| 413 | + }) | ||
| 414 | + if (clear_num && clear_num > 0 | ||
| 415 | + && selectKindNum + 1 > clear_num) { | ||
| 416 | + wx.showToast({ | ||
| 417 | + title: '该菜品最多能点' + clear_num + '份', | ||
| 418 | + duration: 2000, | ||
| 419 | + mask: true, | ||
| 420 | + icon: 'none' | ||
| 421 | + }); | ||
| 422 | + return; | ||
| 448 | } | 423 | } |
| 424 | + } | ||
| 425 | + | ||
| 426 | + | ||
| 427 | + this.triggerEvent('foodSpecCallback', { | ||
| 428 | + cookbookid: cookbookid, | ||
| 429 | + type: 1 | ||
| 430 | + }); | ||
| 431 | + | ||
| 432 | + let param = { | ||
| 433 | + orderid: this.data.orderid, | ||
| 434 | + openid: util.cache('openid'), | ||
| 435 | + cookbookid: cookbookid, | ||
| 436 | + price: price, | ||
| 437 | + source: 1, | ||
| 438 | + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识 | ||
| 439 | + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '', | ||
| 440 | + identity: this.data.identity | ||
| 441 | + } | ||
| 442 | + if (specid > 0) { | ||
| 443 | + param.specid = specid; | ||
| 444 | + } | ||
| 445 | + if (practice_id > 0) { | ||
| 446 | + param.practiceid = practice_id; | ||
| 447 | + } | ||
| 448 | + App.Advance.AddCart(param); | ||
| 449 | + }, | ||
| 450 | + //清除订单下某菜品所有数量 | ||
| 451 | + clean(){ | ||
| 452 | + let cookbookid = this.data.item.id | ||
| 453 | + this.triggerEvent('foodSpecCallback', { | ||
| 454 | + cookbookid: cookbookid, | ||
| 455 | + type: this.data.item.num * -1 | ||
| 456 | + }); | ||
| 457 | + App.Advance.ClearCookById({ | ||
| 458 | + orderid: this.data.orderid, | ||
| 459 | + sellerid: this.data.sellerid, | ||
| 460 | + cookbookid: cookbookid | ||
| 461 | + }); | ||
| 449 | } | 462 | } |
| 463 | + } | ||
| 450 | }) | 464 | }) |
| @@ -2,56 +2,56 @@ | @@ -2,56 +2,56 @@ | ||
| 2 | <slot></slot> | 2 | <slot></slot> |
| 3 | </view> | 3 | </view> |
| 4 | <view hidden="{{hiddenFoodSpec}}" class="hiddenFoodSpec"> | 4 | <view hidden="{{hiddenFoodSpec}}" class="hiddenFoodSpec"> |
| 5 | - <view class="toast-mask"></view> | ||
| 6 | - <view class="toast-content"> | ||
| 7 | - <form bindsubmit="formSubmit"> | ||
| 8 | - <input value="{{cookbook_id}}" name="cookbookid" hidden="true"/> | ||
| 9 | - <view class="toast-content-title">{{cookbook_name}}</view> | ||
| 10 | - <block wx:if="{{kind.length>0}}"> | ||
| 11 | - <view class="toast-content-kind" style="margin-bottom:{{foodMenu.length==0 ? '80rpx' : '0rpx'}}"> | ||
| 12 | - <view class="toast-kind-title">规格</view> | ||
| 13 | - <view class="toast-kind-menu"> | ||
| 14 | - <view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{kind}}" wx:key="kind-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap="kindSelect">{{item.title}}</view> | ||
| 15 | - <input value="{{specs_id}}" name="specs_id" hidden="true"/> | ||
| 16 | - <input value="{{selectPrice}}" name="price" hidden="true"/> | 5 | + <view class="toast-mask flex-vc" bindtap="close"> |
| 6 | + <view class="toast-content" catchtap="catchtap"> | ||
| 7 | + <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image> | ||
| 8 | + <form bindsubmit="formSubmit"> | ||
| 9 | + <input value="{{cookbook_id}}" name="cookbookid" hidden="true"/> | ||
| 10 | + <view class="toast-content-title">{{cookbook_name}}</view> | ||
| 11 | + <block wx:if="{{kind.length>0}}"> | ||
| 12 | + <view class="toast-content-kind"> | ||
| 13 | + <view class="toast-kind-title">规格</view> | ||
| 14 | + <view class="toast-kind-menu flex-ll"> | ||
| 15 | + <view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{kind}}" wx:key="kind-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap="kindSelect">{{item.title}}</view> | ||
| 16 | + <input value="{{specs_id}}" name="specs_id" hidden="true"/> | ||
| 17 | + <input value="{{selectPrice}}" name="price" hidden="true"/> | ||
| 18 | + </view> | ||
| 17 | </view> | 19 | </view> |
| 18 | - </view> | ||
| 19 | - </block> | ||
| 20 | - <block wx:if="{{foodMenu.length>0}}"> | ||
| 21 | - <view class="toast-content-kind" style="margin-bottom:{{kind.length==0 ? '235rpx' : '40rpx'}};"> | ||
| 22 | - <view class="toast-kind-title">做法</view> | ||
| 23 | - <view class="toast-kind-menu"> | ||
| 24 | - <view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{foodMenu}}" wx:key="foodmenu-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap='menuSelect'>{{item.title}}</view> | ||
| 25 | - <input value="{{practice_id}}" name="practice_id" hidden="true"/> | 20 | + </block> |
| 21 | + <block wx:if="{{foodMenu.length>0}}"> | ||
| 22 | + <view class="toast-content-kind"> | ||
| 23 | + <view class="toast-kind-title">做法</view> | ||
| 24 | + <view class="toast-kind-menu flex-ll"> | ||
| 25 | + <view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{foodMenu}}" wx:key="foodmenu-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap='menuSelect'>{{item.title}}</view> | ||
| 26 | + <input value="{{practice_id}}" name="practice_id" hidden="true"/> | ||
| 27 | + </view> | ||
| 26 | </view> | 28 | </view> |
| 29 | + </block> | ||
| 30 | + <view class="toast-content-end"> | ||
| 31 | + <view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view> | ||
| 32 | + <button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button> | ||
| 27 | </view> | 33 | </view> |
| 28 | - </block> | ||
| 29 | - <block wx:else> | ||
| 30 | - <view class="toast-content-kind" style="height:73px;"> | ||
| 31 | - </view> | ||
| 32 | - </block> | ||
| 33 | - <view class="toast-content-end"> | ||
| 34 | - <view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view> | ||
| 35 | - <button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button> | ||
| 36 | - </view> | ||
| 37 | - </form> | ||
| 38 | - <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite/image/close.png" background-size="cover"></image> | 34 | + </form> |
| 35 | + </view> | ||
| 39 | </view> | 36 | </view> |
| 40 | </view> | 37 | </view> |
| 41 | <view hidden="{{hiddenFoodSpecReduce}}" class="hiddenFoodSpec"> | 38 | <view hidden="{{hiddenFoodSpecReduce}}" class="hiddenFoodSpec"> |
| 42 | - <view class="reduce-mask"></view> | ||
| 43 | - <view class="reduce-conent"> | ||
| 44 | - <view class="reduce-content-title">{{item.name}}</view> | ||
| 45 | - <view class="reduce-content-list"> | ||
| 46 | - <view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem"> | ||
| 47 | - <view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title?':':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view> | ||
| 48 | - <view class="reduce-list-info flex-rr"> | ||
| 49 | - <image class="reduce-list-reduce reduce-list-first" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap="reduce" src="http://qn.colorcun.com/custom/lite/image/subtractCook.png" style="padding-right:18rpx;"></image> | ||
| 50 | - <view class="reduce-list-reduce">{{kindItem.foodNum}}</view> | ||
| 51 | - <image class="reduce-list-reduce reduce-list-last" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap='add' src="http://qn.colorcun.com/custom/lite/image/add.png"></image> | 39 | + <view class="reduce-mask flex-vc" bindtap="close"> |
| 40 | + <view class="reduce-conent" catchtap="catchtap"> | ||
| 41 | + <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image> | ||
| 42 | + <view class="reduce-content-title">{{item.name}}</view> | ||
| 43 | + <view class="reduce-content-list"> | ||
| 44 | + <view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem"> | ||
| 45 | + <view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title && kindItem.ptitle?'、':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view> | ||
| 46 | + <view class="reduce-list-info flex-rr"> | ||
| 47 | + <view class="reduce-list-first" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap="reduce" ></view> | ||
| 48 | + <view class="reduce-list-reduce">{{kindItem.foodNum}}</view> | ||
| 49 | + <view class="reduce-list-last" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap='add' ></view> | ||
| 50 | + </view> | ||
| 52 | </view> | 51 | </view> |
| 53 | </view> | 52 | </view> |
| 54 | </view> | 53 | </view> |
| 55 | <image src="http://qn.colorcun.com/custom/lite/image/close.png" class="reduce-close" bindtap="close"></image> | 54 | <image src="http://qn.colorcun.com/custom/lite/image/close.png" class="reduce-close" bindtap="close"></image> |
| 56 | </view> | 55 | </view> |
| 56 | + | ||
| 57 | </view> | 57 | </view> |
| @@ -13,17 +13,9 @@ | @@ -13,17 +13,9 @@ | ||
| 13 | } | 13 | } |
| 14 | .toast-content{ | 14 | .toast-content{ |
| 15 | width:542rpx; | 15 | width:542rpx; |
| 16 | - min-height: 300px; | ||
| 17 | height:auto; | 16 | height:auto; |
| 18 | background: #fff; | 17 | background: #fff; |
| 19 | border-radius: 10rpx; | 18 | border-radius: 10rpx; |
| 20 | - position: fixed; | ||
| 21 | - top: 35%; | ||
| 22 | - left:0; | ||
| 23 | - right:0; | ||
| 24 | - margin:0 auto; | ||
| 25 | - margin-top:-150px; | ||
| 26 | - z-index: 9999; | ||
| 27 | /* overflow: hidden; */ | 19 | /* overflow: hidden; */ |
| 28 | } | 20 | } |
| 29 | .toast-content-title{ | 21 | .toast-content-title{ |
| @@ -36,22 +28,20 @@ | @@ -36,22 +28,20 @@ | ||
| 36 | .toast-content-kind{ | 28 | .toast-content-kind{ |
| 37 | width: 100%; | 29 | width: 100%; |
| 38 | height: auto; | 30 | height: auto; |
| 39 | - padding:0 19rpx; | 31 | + padding:0 42rpx; |
| 40 | box-sizing: border-box; | 32 | box-sizing: border-box; |
| 41 | - padding-top: 20px; | 33 | + margin-bottom: 34rpx; |
| 42 | } | 34 | } |
| 43 | .toast-kind-title{ | 35 | .toast-kind-title{ |
| 44 | width: 100%; | 36 | width: 100%; |
| 45 | color:#353535; | 37 | color:#353535; |
| 46 | font-size:16px; | 38 | font-size:16px; |
| 47 | - padding-left:19rpx; | ||
| 48 | - box-sizing:border-box; | 39 | + margin-bottom: 24rpx; |
| 49 | } | 40 | } |
| 50 | .toast-kind-menu{ | 41 | .toast-kind-menu{ |
| 51 | width: 100%; | 42 | width: 100%; |
| 52 | height: auto; | 43 | height: auto; |
| 53 | box-sizing: border-box; | 44 | box-sizing: border-box; |
| 54 | - padding-bottom:10px; | ||
| 55 | } | 45 | } |
| 56 | .toast-kind-menu:after{ | 46 | .toast-kind-menu:after{ |
| 57 | width:0; | 47 | width:0; |
| @@ -61,17 +51,14 @@ | @@ -61,17 +51,14 @@ | ||
| 61 | clear:both; | 51 | clear:both; |
| 62 | } | 52 | } |
| 63 | .toast-kind-single{ | 53 | .toast-kind-single{ |
| 64 | - float:left; | ||
| 65 | - width: 130rpx; | ||
| 66 | - height: 25px; | ||
| 67 | - border:1px solid #ccc; | ||
| 68 | - box-sizing: border-box; | ||
| 69 | - color:#353535; | ||
| 70 | - font-size:14px; | ||
| 71 | - line-height: 23px; | 54 | + width: 102rpx; |
| 55 | + height: 42rpx; | ||
| 56 | + border:1px solid #C8B16D; | ||
| 57 | + color:#C8B16D; | ||
| 58 | + font-size:28rpx; | ||
| 59 | + line-height: 42rpx; | ||
| 72 | text-align: center; | 60 | text-align: center; |
| 73 | - margin:0 19rpx; | ||
| 74 | - margin-top: 10px; | 61 | + margin-right: 38rpx; |
| 75 | } | 62 | } |
| 76 | .toast-kind-single:last-child{ | 63 | .toast-kind-single:last-child{ |
| 77 | margin-right: 0; | 64 | margin-right: 0; |
| @@ -81,22 +68,22 @@ | @@ -81,22 +68,22 @@ | ||
| 81 | height: 57px; | 68 | height: 57px; |
| 82 | padding:15px 38rpx; | 69 | padding:15px 38rpx; |
| 83 | box-sizing: border-box; | 70 | box-sizing: border-box; |
| 84 | - margin-top: 22px; | ||
| 85 | background: #f2f2f2; | 71 | background: #f2f2f2; |
| 86 | border-bottom-left-radius: 6px; | 72 | border-bottom-left-radius: 6px; |
| 87 | border-bottom-right-radius: 6px; | 73 | border-bottom-right-radius: 6px; |
| 88 | } | 74 | } |
| 89 | .toast-content-money{ | 75 | .toast-content-money{ |
| 90 | float: left; | 76 | float: left; |
| 91 | - color: #e14553; | ||
| 92 | - font-size:17px; | ||
| 93 | - line-height: 28px; | 77 | + color: #353535; |
| 78 | + font-size:36rpx; | ||
| 79 | + line-height: 50rpx; | ||
| 80 | + font-weight: bold; | ||
| 94 | } | 81 | } |
| 95 | .toast-content-add{ | 82 | .toast-content-add{ |
| 96 | float: right; | 83 | float: right; |
| 97 | width: 95px; | 84 | width: 95px; |
| 98 | height: 28px; | 85 | height: 28px; |
| 99 | - background: #e14553; | 86 | + background: #C8B16D; |
| 100 | border-radius:28px; | 87 | border-radius:28px; |
| 101 | color: #fff; | 88 | color: #fff; |
| 102 | font-size:13px; | 89 | font-size:13px; |
| @@ -104,18 +91,15 @@ | @@ -104,18 +91,15 @@ | ||
| 104 | text-align: center; | 91 | text-align: center; |
| 105 | } | 92 | } |
| 106 | .toast-kind-single.kind-active{ | 93 | .toast-kind-single.kind-active{ |
| 107 | - border:1px solid #e14553; | ||
| 108 | - color:#e14553; | 94 | + border-width:0; |
| 95 | + color:#ffffff; | ||
| 96 | + background: linear-gradient(to right, #ECDB99, #C8B16D); | ||
| 109 | } | 97 | } |
| 110 | .toast-content-close{ | 98 | .toast-content-close{ |
| 111 | - width: 60rpx; | ||
| 112 | - height: 60rpx; | ||
| 113 | - position: absolute; | ||
| 114 | - left: 0; | ||
| 115 | - right: 0; | ||
| 116 | - bottom:-140rpx; | ||
| 117 | - margin:0 auto; | ||
| 118 | - background: transparent; | 99 | + width: 30rpx; |
| 100 | + height: 30rpx; | ||
| 101 | + float: right; | ||
| 102 | + margin: 10rpx; | ||
| 119 | } | 103 | } |
| 120 | 104 | ||
| 121 | /*删除规格遮罩*/ | 105 | /*删除规格遮罩*/ |
| @@ -160,39 +144,57 @@ | @@ -160,39 +144,57 @@ | ||
| 160 | } | 144 | } |
| 161 | .reduce-content-large{ | 145 | .reduce-content-large{ |
| 162 | width: 100%; | 146 | width: 100%; |
| 163 | - height: 25px; | 147 | + height: 42rpx; |
| 148 | + line-height: 42rpx; | ||
| 164 | padding-top: 50rpx; | 149 | padding-top: 50rpx; |
| 165 | } | 150 | } |
| 166 | .reduce-list-title{ | 151 | .reduce-list-title{ |
| 167 | float:left; | 152 | float:left; |
| 168 | - padding:0 26rpx; | ||
| 169 | - height: 25px; | ||
| 170 | - border:1rpx solid #ccc; | 153 | + padding:0 10rpx; |
| 154 | + height: 42rpx; | ||
| 171 | box-sizing: border-box; | 155 | box-sizing: border-box; |
| 172 | - color:#353535; | ||
| 173 | - font-size:14px; | ||
| 174 | - line-height: 25px; | 156 | + color:#fefefe; |
| 157 | + font-size:28rpx; | ||
| 158 | + line-height: 42rpx; | ||
| 175 | text-align: center; | 159 | text-align: center; |
| 160 | + background: linear-gradient(to right, #C8B16D, #E6D9A6); | ||
| 161 | + min-width: 100rpx; | ||
| 176 | } | 162 | } |
| 177 | .reduce-list-info{ | 163 | .reduce-list-info{ |
| 178 | height: 25px; | 164 | height: 25px; |
| 179 | line-height: 25px; | 165 | line-height: 25px; |
| 180 | } | 166 | } |
| 181 | .reduce-list-reduce{ | 167 | .reduce-list-reduce{ |
| 182 | - padding:0 10rpx; | 168 | + padding:0 20rpx; |
| 183 | font-size:32rpx; | 169 | font-size:32rpx; |
| 184 | - line-height: 25px; | 170 | + line-height: 42rpx; |
| 185 | text-align: center; | 171 | text-align: center; |
| 186 | } | 172 | } |
| 187 | .reduce-list-first{ | 173 | .reduce-list-first{ |
| 188 | - width:15px; | ||
| 189 | - height:2px; | ||
| 190 | - background:#fff; | 174 | + width:36rpx; |
| 175 | + height:36rpx; | ||
| 176 | + border: 2rpx solid #262628; | ||
| 177 | + border-radius: 50%; | ||
| 178 | + overflow: hidden; | ||
| 179 | + position: relative; | ||
| 180 | +} | ||
| 181 | +.reduce-list-first:after{ | ||
| 182 | + position: absolute; | ||
| 183 | + content: ''; | ||
| 184 | + top: 0; | ||
| 185 | + left: 0; | ||
| 186 | + right: 0; | ||
| 187 | + bottom: 0; | ||
| 188 | + margin: auto; | ||
| 189 | + width: 75%; | ||
| 190 | + height: 4rpx; | ||
| 191 | + background-color: #262628; | ||
| 191 | } | 192 | } |
| 192 | .reduce-list-last{ | 193 | .reduce-list-last{ |
| 193 | - width:15px; | ||
| 194 | - height:15px; | ||
| 195 | - background:#fff; | 194 | + width:40rpx; |
| 195 | + height:40rpx; | ||
| 196 | + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png"); | ||
| 197 | + background-size: 100% 100%; | ||
| 196 | } | 198 | } |
| 197 | .reduce-close{ | 199 | .reduce-close{ |
| 198 | width: 60rpx; | 200 | width: 60rpx; |
pack-cookbook/pages/cart.js
0 → 100644
| 1 | +// pack-cookbook/pages/cart.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 | + order:{}, | ||
| 12 | + }, | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 生命周期函数--监听页面加载 | ||
| 16 | + */ | ||
| 17 | + onLoad: function (options) { | ||
| 18 | + this.setData({ | ||
| 19 | + options:options, | ||
| 20 | + }) | ||
| 21 | + | ||
| 22 | + }, | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 26 | + */ | ||
| 27 | + onReady: function () { | ||
| 28 | + | ||
| 29 | + }, | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 生命周期函数--监听页面显示 | ||
| 33 | + */ | ||
| 34 | + onShow: function () { | ||
| 35 | + this.initOrder(); | ||
| 36 | + }, | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 生命周期函数--监听页面隐藏 | ||
| 40 | + */ | ||
| 41 | + onHide: function () { | ||
| 42 | + | ||
| 43 | + }, | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 生命周期函数--监听页面卸载 | ||
| 47 | + */ | ||
| 48 | + onUnload: function () { | ||
| 49 | + | ||
| 50 | + }, | ||
| 51 | + | ||
| 52 | + initOrder(){ | ||
| 53 | + App.Advance.CreateOrder({ | ||
| 54 | + rid: this.data.options.rid, | ||
| 55 | + identity:this.data.options.identity, | ||
| 56 | + status:'0,1' | ||
| 57 | + }).then(res => { | ||
| 58 | + let cookbooklist={}; | ||
| 59 | + res.data.cookbooklist.forEach(ck=>{ | ||
| 60 | + if(!cookbooklist[ck.classid]){ | ||
| 61 | + cookbooklist[ck.classid]={'name':ck.class_name,list:[]} | ||
| 62 | + } | ||
| 63 | + cookbooklist[ck.classid].list.push(ck) | ||
| 64 | + }) | ||
| 65 | + res.data.cookbooklist=cookbooklist; | ||
| 66 | + this.setData({ | ||
| 67 | + order: res.data, | ||
| 68 | + }) | ||
| 69 | + }) | ||
| 70 | + }, | ||
| 71 | + updateOrder(e){ | ||
| 72 | + let val=util.val(e).trim(); | ||
| 73 | + if(val>0){ | ||
| 74 | + App.Advance.SetOrderById({ | ||
| 75 | + orderid:this.data.order.id||this.data.options.oid, | ||
| 76 | + pnum:val, | ||
| 77 | + | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + }, | ||
| 81 | + gotoRemark(){ | ||
| 82 | + wx.navigateTo({ | ||
| 83 | + url: util.http_build_query({...this.data.order},'./remark') | ||
| 84 | + }) | ||
| 85 | + }, | ||
| 86 | + submitOrder(){ | ||
| 87 | + App.Advance.PlaceOrder({ | ||
| 88 | + orderid:this.data.order.id||this.data.options.oid, | ||
| 89 | + rid:this.data.options.rid, | ||
| 90 | + identity:this.data.options.identity, | ||
| 91 | + }).then(res=>{ | ||
| 92 | + wx.redirectTo({ | ||
| 93 | + url: util.http_build_query({...this.data.options,hasSuccess:1},'./success') | ||
| 94 | + }) | ||
| 95 | + }) | ||
| 96 | + }, | ||
| 97 | +}) |
pack-cookbook/pages/cart.json
0 → 100644
pack-cookbook/pages/cart.wxml
0 → 100644
| 1 | +<!--pack-cookbook/pages/cart.wxml--> | ||
| 2 | +<nav id="nav" hasHome backgroundColor="#262628" color="#fefefe">提交订单</nav> | ||
| 3 | +<view class="header"> | ||
| 4 | +</view> | ||
| 5 | +<view class="page"> | ||
| 6 | + <view class="carts"> | ||
| 7 | + <view class="block" wx:for="{{order.cookbooklist}}" wx:key="order.cookbooklist.key"> | ||
| 8 | + <view class="title">{{item.name}}</view> | ||
| 9 | + <view class="cart-body"> | ||
| 10 | + <view class="cart-item flex-lr" wx:for="{{item.list}}" wx:key="item.list.key"> | ||
| 11 | + <view class="icon"> | ||
| 12 | + <image src="{{item.cookimg}}"></image> | ||
| 13 | + </view> | ||
| 14 | + <view class="flex-ll name"> | ||
| 15 | + <view class="name">{{item.cookname}}</view> | ||
| 16 | + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view> | ||
| 17 | + </view> | ||
| 18 | + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view> | ||
| 19 | + <view class="opt">{{item.num}}</view> | ||
| 20 | + </view> | ||
| 21 | + </view> | ||
| 22 | + </view> | ||
| 23 | + </view> | ||
| 24 | +</view> | ||
| 25 | +<view class="footer"> | ||
| 26 | + <view class="total">共计:¥{{order.price}}</view> | ||
| 27 | + <view class="infos"> | ||
| 28 | + <view class="flex-lr item"> | ||
| 29 | + <view class="item-label">人数:</view> | ||
| 30 | + <view> | ||
| 31 | + <input placeholder="请输入人数" type="number" value="{{order.pnum||''}}" bindinput="updateOrder"/> | ||
| 32 | + </view> | ||
| 33 | + </view> | ||
| 34 | + <formids bindclick="gotoRemark"> | ||
| 35 | + <view class="flex-lr item"> | ||
| 36 | + <view class="item-label">备注:</view> | ||
| 37 | + <view class="flex-rr" style="max-width: 80%;"> | ||
| 38 | + <view class="desc">{{order.remark||'口味、偏好等要求'}}</view> | ||
| 39 | + <view class="more"></view> | ||
| 40 | + </view> | ||
| 41 | + </view> | ||
| 42 | + </formids> | ||
| 43 | + </view> | ||
| 44 | + <formids class="submit" bindclick="submitOrder"> | ||
| 45 | + <view class="submit">确认下单</view> | ||
| 46 | + </formids> | ||
| 47 | +</view> |
pack-cookbook/pages/cart.wxss
0 → 100644
| 1 | +/* pack-cookbook/pages/cart.wxss */ | ||
| 2 | +page{ | ||
| 3 | + background-color: #F5F5F5; | ||
| 4 | +} | ||
| 5 | +.header{ | ||
| 6 | + height: 280rpx; | ||
| 7 | + background-color: #262628; | ||
| 8 | + margin-top: -2rpx; | ||
| 9 | + color:#FEFEFE; | ||
| 10 | + font-size: 34rpx; | ||
| 11 | +} | ||
| 12 | +.page{ | ||
| 13 | + position: fixed; | ||
| 14 | + top:150rpx; | ||
| 15 | + bottom: 0; | ||
| 16 | + left: 10rpx; | ||
| 17 | + right: 10rpx; | ||
| 18 | + background-color: #fefefe; | ||
| 19 | + border-radius: 10rpx; | ||
| 20 | + overflow-y: auto; | ||
| 21 | +} | ||
| 22 | +.footer{ | ||
| 23 | + position: fixed; | ||
| 24 | + bottom: 0; | ||
| 25 | + left: 0; | ||
| 26 | + right: 0; | ||
| 27 | + text-align: center; | ||
| 28 | + background-color: #f5f5f5; | ||
| 29 | +} | ||
| 30 | +.footer .infos{ | ||
| 31 | + margin: 0 10rpx 20rpx; | ||
| 32 | + background-color: #fefefe; | ||
| 33 | + border-radius: 10rpx 10rpx 0 0; | ||
| 34 | + font-size: 28rpx; | ||
| 35 | + padding: 0 20rpx; | ||
| 36 | +} | ||
| 37 | +.footer .infos .item{ | ||
| 38 | + height: 100rpx; | ||
| 39 | + line-height: 100rpx; | ||
| 40 | +} | ||
| 41 | +.infos input{ | ||
| 42 | + text-align: right; | ||
| 43 | +} | ||
| 44 | +.infos .desc{ | ||
| 45 | + margin-right: 20rpx; | ||
| 46 | + white-space:nowrap; | ||
| 47 | + overflow: hidden; | ||
| 48 | + max-width: 95%; | ||
| 49 | + color: #999999; | ||
| 50 | + line-height: 100rpx; | ||
| 51 | +} | ||
| 52 | +.infos .item-label{ | ||
| 53 | + min-width: 100rpx; | ||
| 54 | + overflow: hidden; | ||
| 55 | + white-space:nowrap; | ||
| 56 | + text-align: left; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +.footer .submit{ | ||
| 60 | + height: 98rpx; | ||
| 61 | + line-height: 98rpx; | ||
| 62 | + background-color: #262628; | ||
| 63 | + color:#fefefe; | ||
| 64 | + font-size: 34rpx; | ||
| 65 | +} | ||
| 66 | +.total{ | ||
| 67 | + height: 140rpx; | ||
| 68 | + line-height: 140rpx; | ||
| 69 | + border-top: 2rpx solid #F5F5F5; | ||
| 70 | + border-radius: 0 0 10rpx 10rpx; | ||
| 71 | + margin:0 10rpx 20rpx; | ||
| 72 | + text-align: right; | ||
| 73 | + background-color: #fefefe; | ||
| 74 | + font-weight: bold; | ||
| 75 | + font-size: 36rpx; | ||
| 76 | + padding-right: 34rpx; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + | ||
| 81 | +.carts{ | ||
| 82 | + overflow-y: auto; | ||
| 83 | + padding: 0 5% 680rpx; | ||
| 84 | +} | ||
| 85 | +.carts image{ | ||
| 86 | + width: 100%; | ||
| 87 | + height: 100%; | ||
| 88 | +} | ||
| 89 | +.carts .icon{ | ||
| 90 | + width: 48rpx; | ||
| 91 | + min-width: 48rpx; | ||
| 92 | + height: 48rpx; | ||
| 93 | + background-color: #f5f5f5; | ||
| 94 | + border-radius: 50%; | ||
| 95 | + overflow: hidden; | ||
| 96 | + margin-right: 20rpx; | ||
| 97 | +} | ||
| 98 | +.carts .title{ | ||
| 99 | + height:80rpx; | ||
| 100 | + line-height: 80rpx; | ||
| 101 | + font-size: 28rpx; | ||
| 102 | + border-bottom: 2rpx solid #F5F5F5; | ||
| 103 | +} | ||
| 104 | +.cart-body{ | ||
| 105 | + | ||
| 106 | +} | ||
| 107 | +.cart-item{ | ||
| 108 | + height: 100rpx; | ||
| 109 | + line-height: 100rpx; | ||
| 110 | + font-size: 30rpx; | ||
| 111 | +} | ||
| 112 | +.cart-item .name{ | ||
| 113 | + width: 60%; | ||
| 114 | + overflow: hidden; | ||
| 115 | + white-space:nowrap; | ||
| 116 | +} | ||
| 117 | +.cart-item .name .name{ | ||
| 118 | + width: auto; | ||
| 119 | + max-width: 80%; | ||
| 120 | +} | ||
| 121 | +.cart-item .price{ | ||
| 122 | + width: 200rpx; | ||
| 123 | + min-width: 200rpx; | ||
| 124 | + white-space:nowrap; | ||
| 125 | + margin-left: 20rpx; | ||
| 126 | + overflow: hidden; | ||
| 127 | +} | ||
| 128 | +.cart-item .opt{ | ||
| 129 | + font-size: 30rpx; | ||
| 130 | + min-width: 50rpx; | ||
| 131 | + width: 50rpx; | ||
| 132 | + text-align: right; | ||
| 133 | +} | ||
| 134 | +.practice_name{ | ||
| 135 | + border: 2rpx solid #C8B16D; | ||
| 136 | + font-size: 24rpx; | ||
| 137 | + height: 30rpx; | ||
| 138 | + line-height: 30rpx; | ||
| 139 | + color:#C8B16D; | ||
| 140 | + padding: 0 6rpx; | ||
| 141 | + margin-left: 18rpx; | ||
| 142 | +} |
| @@ -4,147 +4,179 @@ import App from '../../utils/api'; | @@ -4,147 +4,179 @@ import App from '../../utils/api'; | ||
| 4 | const {regeneratorRuntime} = global | 4 | const {regeneratorRuntime} = global |
| 5 | Page({ | 5 | Page({ |
| 6 | 6 | ||
| 7 | - /** | ||
| 8 | - * 页面的初始数据 | ||
| 9 | - */ | ||
| 10 | - data: { | ||
| 11 | - scrollTop:0, | ||
| 12 | - isloading:true, | ||
| 13 | - toView:"", | ||
| 14 | - hasEnter:false, | ||
| 15 | - | ||
| 16 | - totalWidth:getApp().system.windowWidth, | ||
| 17 | - singleWidth:parseInt((getApp().system.windowWidth*0.92-16)/2), | ||
| 18 | - totalHeight:getApp().system.windowHeight, | ||
| 19 | - kindHeight:getApp().system.windowHeight-68, | ||
| 20 | - hasListModel:true, | ||
| 21 | - | ||
| 22 | - cookbooklist:[{},{},{},{},{},{},{},], | ||
| 23 | - showSkeleton: true | ||
| 24 | - }, | ||
| 25 | - | ||
| 26 | - /** | ||
| 27 | - * 生命周期函数--监听页面加载 | ||
| 28 | - */ | ||
| 29 | - onLoad: function (options) { | ||
| 30 | - this.getCookList(); | ||
| 31 | - }, | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 生命周期函数--监听页面初次渲染完成 | ||
| 35 | - */ | ||
| 36 | - onReady: function () { | ||
| 37 | - | ||
| 38 | - }, | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * 生命周期函数--监听页面显示 | ||
| 42 | - */ | ||
| 43 | - onShow: function () { | 7 | + /** |
| 8 | + * 页面的初始数据 | ||
| 9 | + */ | ||
| 10 | + data: { | ||
| 11 | + scrollTop: 0, | ||
| 12 | + isloading: true, | ||
| 13 | + toView: "", | ||
| 14 | + hasEnter: false, | ||
| 15 | + | ||
| 16 | + totalWidth: getApp().system.windowWidth, | ||
| 17 | + singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2), | ||
| 18 | + totalHeight: getApp().system.windowHeight, | ||
| 19 | + kindHeight: getApp().system.windowHeight - 68, | ||
| 20 | + hasListModel: true, | ||
| 21 | + | ||
| 22 | + cookbooklist: [{}, {}, {}, {}, {}, {}, {},], | ||
| 23 | + showSkeleton: true, | ||
| 24 | + order: {}, | ||
| 25 | + orderItemCount:0, | ||
| 26 | + }, | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 生命周期函数--监听页面加载 | ||
| 30 | + */ | ||
| 31 | + onLoad: function (options) { | ||
| 32 | + this.setData({ | ||
| 33 | + options: options, | ||
| 34 | + }) | ||
| 35 | + this.getCookList(); | ||
| 36 | + this.initOrder(); | ||
| 37 | + }, | ||
| 38 | + initOrder(){ | ||
| 39 | + App.Advance.CreateOrder({ | ||
| 40 | + rid: this.data.options.rid, | ||
| 41 | + identity:this.data.options.identity, | ||
| 42 | + status:'0,1' | ||
| 43 | + }).then(res => { | ||
| 44 | + let orderItemCount=0; | ||
| 45 | + res.data.cookbooklist.forEach(cb=>{ | ||
| 46 | + orderItemCount+=parseInt(cb.num) | ||
| 47 | + }) | ||
| 44 | this.setData({ | 48 | this.setData({ |
| 45 | - totalWidth:getApp().system.windowWidth, | ||
| 46 | - singleWidth:parseInt((getApp().system.windowWidth*0.92-16)/2), | ||
| 47 | - totalHeight:getApp().system.windowHeight, | ||
| 48 | - kindHeight:getApp().system.windowHeight-68 | 49 | + [`options.oid`]:res.data.id, |
| 50 | + order: res.data, | ||
| 51 | + orderItemCount:orderItemCount, | ||
| 49 | }) | 52 | }) |
| 50 | - }, | 53 | + }) |
| 54 | + }, | ||
| 55 | + dispalyCart(){ | ||
| 56 | + this.selectComponent("#cart").auto(); | ||
| 57 | + }, | ||
| 58 | + /** | ||
| 59 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 60 | + */ | ||
| 61 | + onReady: function () { | ||
| 62 | + | ||
| 63 | + }, | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 生命周期函数--监听页面显示 | ||
| 67 | + */ | ||
| 68 | + onShow: function () { | ||
| 69 | + this.setData({ | ||
| 70 | + totalWidth: getApp().system.windowWidth, | ||
| 71 | + singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2), | ||
| 72 | + totalHeight: getApp().system.windowHeight, | ||
| 73 | + kindHeight: getApp().system.windowHeight - 68 | ||
| 74 | + }) | ||
| 75 | + setTimeout(()=>{ | ||
| 76 | + this.initScrollHeightList(); | ||
| 77 | + },1000) | ||
| 51 | 78 | ||
| 52 | - /** | ||
| 53 | - * 生命周期函数--监听页面隐藏 | ||
| 54 | - */ | ||
| 55 | - onHide: function () { | 79 | + }, |
| 56 | 80 | ||
| 57 | - }, | 81 | + /** |
| 82 | + * 生命周期函数--监听页面隐藏 | ||
| 83 | + */ | ||
| 84 | + onHide: function () { | ||
| 58 | 85 | ||
| 59 | - /** | ||
| 60 | - * 生命周期函数--监听页面卸载 | ||
| 61 | - */ | ||
| 62 | - onUnload: function () { | 86 | + }, |
| 63 | 87 | ||
| 64 | - }, | 88 | + /** |
| 89 | + * 生命周期函数--监听页面卸载 | ||
| 90 | + */ | ||
| 91 | + onUnload: function () { | ||
| 65 | 92 | ||
| 66 | - /** | ||
| 67 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
| 68 | - */ | ||
| 69 | - onPullDownRefresh: function () { | 93 | + }, |
| 70 | 94 | ||
| 71 | - }, | 95 | + /** |
| 96 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 97 | + */ | ||
| 98 | + onPullDownRefresh: function () { | ||
| 72 | 99 | ||
| 73 | - /** | ||
| 74 | - * 页面上拉触底事件的处理函数 | ||
| 75 | - */ | ||
| 76 | - onReachBottom: function () { | 100 | + }, |
| 77 | 101 | ||
| 78 | - }, | 102 | + /** |
| 103 | + * 页面上拉触底事件的处理函数 | ||
| 104 | + */ | ||
| 105 | + onReachBottom: function () { | ||
| 79 | 106 | ||
| 80 | - /** | ||
| 81 | - * 用户点击右上角分享 | ||
| 82 | - */ | ||
| 83 | - onShareAppMessage: function () { | 107 | + }, |
| 84 | 108 | ||
| 85 | - }, | 109 | + /** |
| 110 | + * 用户点击右上角分享 | ||
| 111 | + */ | ||
| 112 | + onShareAppMessage: function () { | ||
| 113 | + return { | ||
| 114 | + title:'一起来点菜啦!', | ||
| 115 | + imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-go.jpg', | ||
| 116 | + } | ||
| 117 | + }, | ||
| 86 | formatCookList(list){ | 118 | formatCookList(list){ |
| 87 | //原栏目下显示 | 119 | //原栏目下显示 |
| 88 | - let hasShowClass=false; | 120 | + let hasShowClass = false; |
| 89 | 121 | ||
| 90 | //菜单中展示沽清的菜品 | 122 | //菜单中展示沽清的菜品 |
| 91 | - let hasClearCookbook=false; | 123 | + let hasClearCookbook = false; |
| 92 | 124 | ||
| 93 | //十道必选菜 | 125 | //十道必选菜 |
| 94 | - let has10CaiOpen=false; | ||
| 95 | - let flist=[]; | ||
| 96 | - if(list.length>0) { | ||
| 97 | - has10CaiOpen=list[0].status==1; | 126 | + let has10CaiOpen = false; |
| 127 | + let flist = []; | ||
| 128 | + if (list.length > 0) { | ||
| 129 | + has10CaiOpen = list[0].status == 1; | ||
| 98 | list.forEach(function (cate, i) { | 130 | list.forEach(function (cate, i) { |
| 99 | if (cate.status == 1 && cate.cookbooklist[0].length > 0) { | 131 | if (cate.status == 1 && cate.cookbooklist[0].length > 0) { |
| 100 | - let cooks=[]; | 132 | + let cooks = []; |
| 101 | //let cooks_order=[]; | 133 | //let cooks_order=[]; |
| 102 | - cate.cookbooklist[0].forEach(function(cook,n){ | ||
| 103 | - if(cook.status==1){ | ||
| 104 | - let flag=true; | ||
| 105 | - if(has10CaiOpen){ | ||
| 106 | - if(cate.class_type==2 && !hasShowClass && flist.length>0 && flist[0].class_type==1){ | ||
| 107 | - for(let fi=0;fi<flist[0].cookbooklist[0].length;fi++){ | ||
| 108 | - if(flist[0].cookbooklist[0][fi].id==cook.id){ | ||
| 109 | - flag=false; | 134 | + cate.cookbooklist[0].forEach(function (cook, n) { |
| 135 | + if (cook.status == 1) { | ||
| 136 | + let flag = true; | ||
| 137 | + if (has10CaiOpen) { | ||
| 138 | + if (cate.class_type == 2 && !hasShowClass && flist.length > 0 && flist[0].class_type == 1) { | ||
| 139 | + for (let fi = 0; fi < flist[0].cookbooklist[0].length; fi++) { | ||
| 140 | + if (flist[0].cookbooklist[0][fi].id == cook.id) { | ||
| 141 | + flag = false; | ||
| 110 | break; | 142 | break; |
| 111 | } | 143 | } |
| 112 | } | 144 | } |
| 113 | } | 145 | } |
| 114 | } | 146 | } |
| 115 | - cook.item_clear_num=cook.clear_num; | ||
| 116 | - if(!hasClearCookbook){//不显示卖光了 | ||
| 117 | - let item_clear_num=cook.clear_num; | ||
| 118 | - if(cook.spec){ | ||
| 119 | - let clear_num=null; | ||
| 120 | - cook.spec.forEach(spec=>{ | ||
| 121 | - if(spec.clear_num==0){ | ||
| 122 | - clear_num=0; | ||
| 123 | - }else{ | ||
| 124 | - clear_num=null; | 147 | + cook.item_clear_num = cook.clear_num; |
| 148 | + if (!hasClearCookbook) {//不显示卖光了 | ||
| 149 | + let item_clear_num = cook.clear_num; | ||
| 150 | + if (cook.spec) { | ||
| 151 | + let clear_num = null; | ||
| 152 | + cook.spec.forEach(spec => { | ||
| 153 | + if (spec.clear_num == 0) { | ||
| 154 | + clear_num = 0; | ||
| 155 | + } else { | ||
| 156 | + clear_num = null; | ||
| 125 | } | 157 | } |
| 126 | }) | 158 | }) |
| 127 | - if(clear_num==0){ | ||
| 128 | - item_clear_num=0; | 159 | + if (clear_num == 0) { |
| 160 | + item_clear_num = 0; | ||
| 129 | } | 161 | } |
| 130 | } | 162 | } |
| 131 | - cook.item_clear_num=item_clear_num; | ||
| 132 | - if(item_clear_num==0){ | ||
| 133 | - flag=false; | 163 | + cook.item_clear_num = item_clear_num; |
| 164 | + if (item_clear_num == 0) { | ||
| 165 | + flag = false; | ||
| 134 | } | 166 | } |
| 135 | } | 167 | } |
| 136 | 168 | ||
| 137 | - if(flag){ | 169 | + if (flag) { |
| 138 | cooks.push(cook); | 170 | cooks.push(cook); |
| 139 | //cooks_order.push(cook.order_o); | 171 | //cooks_order.push(cook.order_o); |
| 140 | } | 172 | } |
| 141 | 173 | ||
| 142 | } | 174 | } |
| 143 | }) | 175 | }) |
| 144 | - if(cooks.length>0){ | 176 | + if (cooks.length > 0) { |
| 145 | //cooks 排序... | 177 | //cooks 排序... |
| 146 | 178 | ||
| 147 | - cate.cookbooklist[0]=cooks; | 179 | + cate.cookbooklist[0] = cooks; |
| 148 | flist.push(cate) | 180 | flist.push(cate) |
| 149 | } | 181 | } |
| 150 | } | 182 | } |
| @@ -152,104 +184,125 @@ Page({ | @@ -152,104 +184,125 @@ Page({ | ||
| 152 | } | 184 | } |
| 153 | return flist; | 185 | return flist; |
| 154 | }, | 186 | }, |
| 155 | - getCookList:function(orderid){ | ||
| 156 | - let param={ | ||
| 157 | - sellerid: 80, | ||
| 158 | - //status:this.data.fromSoucre!=''?1:'', | ||
| 159 | - identity:1 | 187 | + getCookList: function (orderid) { |
| 188 | + let param = { | ||
| 189 | + sellerid: this.data.options.sid, | ||
| 190 | + identity: this.data.options.identity, | ||
| 191 | + orderid : this.data.options.oid, | ||
| 192 | + status:'0,1', | ||
| 160 | }; | 193 | }; |
| 161 | - if(orderid){ | ||
| 162 | - param.orderid=orderid; | ||
| 163 | - } | ||
| 164 | - App.Cookbook.GetCookbookByClass(param).then(json=>{ | 194 | + App.Advance.GetCookbookByClass(param).then(json => { |
| 165 | //菜单分类添加修饰 | 195 | //菜单分类添加修饰 |
| 166 | let cookbooklist = this.formatCookList(json.data[0].list); | 196 | let cookbooklist = this.formatCookList(json.data[0].list); |
| 167 | - setTimeout(()=>{ | 197 | + setTimeout(() => { |
| 168 | this.setData({ | 198 | this.setData({ |
| 169 | cookbooklist: cookbooklist, | 199 | cookbooklist: cookbooklist, |
| 170 | - countPirce:json.data[0].countPirce ? json.data[0].countPirce : 0, | ||
| 171 | - countTotal:json.data[0].countTotal ? json.data[0].countTotal : 0, | ||
| 172 | - isloading:false, | ||
| 173 | - showSkeleton:false, | 200 | + countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0, |
| 201 | + countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0, | ||
| 202 | + isloading: false, | ||
| 203 | + showSkeleton: false, | ||
| 174 | }) | 204 | }) |
| 175 | - },1000) | 205 | + }, 0) |
| 176 | 206 | ||
| 177 | - }).catch(res=>{ | ||
| 178 | - console.log('getCookList-catch',res); | 207 | + }).catch(res => { |
| 208 | + console.log('getCookList-catch', res); | ||
| 179 | this.selectComponent("#network").show('网络不给力,请检查网络后重试'); | 209 | this.selectComponent("#network").show('网络不给力,请检查网络后重试'); |
| 180 | }); | 210 | }); |
| 181 | }, | 211 | }, |
| 182 | //菜品分类操作 | 212 | //菜品分类操作 |
| 183 | changeList: function (e) { | 213 | changeList: function (e) { |
| 184 | - var _id=e.detail.id; | ||
| 185 | - console.log('changeList','inToView' + _id) | 214 | + var _id = e.detail.id; |
| 215 | + console.log('changeList', 'inToView' + _id) | ||
| 186 | this.setData({ | 216 | this.setData({ |
| 187 | toView: 'inToView' + _id, | 217 | toView: 'inToView' + _id, |
| 188 | }); | 218 | }); |
| 189 | 219 | ||
| 190 | }, | 220 | }, |
| 191 | foodCardCallback(e){ | 221 | foodCardCallback(e){ |
| 192 | - let opt=e.detail; | ||
| 193 | - console.log('foodCardCallback',opt); | ||
| 194 | - if(opt.type=='specWin'){ | ||
| 195 | - if(opt.value=='show'){ | ||
| 196 | - this.setData({scrollZindex:9999}); | ||
| 197 | - }else{ | ||
| 198 | - this.setData({scrollZindex:'auto'}); | 222 | + let opt = e.detail; |
| 223 | + console.log('foodCardCallback', opt); | ||
| 224 | + if (opt.type == 'specWin') { | ||
| 225 | + if (opt.value == 'show') { | ||
| 226 | + this.setData({scrollZindex: 9999}); | ||
| 227 | + } else { | ||
| 228 | + this.setData({scrollZindex: 'auto'}); | ||
| 199 | } | 229 | } |
| 200 | return; | 230 | return; |
| 201 | } | 231 | } |
| 202 | - let books=this.data.cookbooklist; | ||
| 203 | - books.forEach(menu=>{ | ||
| 204 | - menu.cookbooklist[0].forEach(book=>{ | ||
| 205 | - if(book.id==opt.cookbookid){ | ||
| 206 | - book.num=opt.num; | 232 | + |
| 233 | + let books = this.data.cookbooklist; | ||
| 234 | + books.forEach(menu => { | ||
| 235 | + menu.cookbooklist[0].forEach(book => { | ||
| 236 | + if (book.id == opt.cookbookid || 'flushOrder'==opt.type) { | ||
| 237 | + book.num = opt.num; | ||
| 207 | } | 238 | } |
| 208 | }) | 239 | }) |
| 209 | }) | 240 | }) |
| 210 | - this.setData({ | ||
| 211 | - countTotal:this.data.countTotal+opt.type, | ||
| 212 | - cookbooklist:books | ||
| 213 | - }); | ||
| 214 | - this.getOrderInfo(); | ||
| 215 | - }, | ||
| 216 | - //订单详情 | ||
| 217 | - getOrderInfo:function(){ | ||
| 218 | - App.Orders.GetOrderById({orderid:this.data.orderid}).then(json=>{ | ||
| 219 | - let order=json.data[0].order[0]; | ||
| 220 | - if(order.status<2){ | ||
| 221 | - this.setData({aiOrderStatus:json.data[0].order[0].status}); | ||
| 222 | - }else{ | ||
| 223 | - var title='' | ||
| 224 | - if(json.data[0].order[0].status==2 || json.data[0].order[0].status==3){ | ||
| 225 | - if(this.data.fromSoucre || util.cache('identity')==2){ | ||
| 226 | - return; | ||
| 227 | - } | ||
| 228 | - title='手慢了,小伙伴已下单' | ||
| 229 | - } | ||
| 230 | - if(json.data[0].order[0].status==5){ | ||
| 231 | - title='订单已结账' | ||
| 232 | - } | ||
| 233 | - if(json.data[0].order[0].status==7){ | ||
| 234 | - title='订单已清台' | 241 | + if('flushOrder'==opt.type){ |
| 242 | + this.setData({ | ||
| 243 | + countTotal: 0, | ||
| 244 | + cookbooklist: books | ||
| 245 | + }); | ||
| 246 | + }else{ | ||
| 247 | + this.setData({ | ||
| 248 | + countTotal: this.data.countTotal + opt.type, | ||
| 249 | + cookbooklist: books | ||
| 250 | + }); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + setTimeout(()=>{ | ||
| 254 | + this.initOrder(); | ||
| 255 | + },100) | ||
| 256 | + }, | ||
| 257 | + gotoCart(){ | ||
| 258 | + if(this.data.orderItemCount<1){ | ||
| 259 | + return util.toast('请添加菜品','none'); | ||
| 260 | + } | ||
| 261 | + //购物车 | ||
| 262 | + wx.navigateTo({ | ||
| 263 | + url: util.http_build_query(this.data.options,'./cart') | ||
| 264 | + }) | ||
| 265 | + }, | ||
| 266 | + getClassNameFlag:true, | ||
| 267 | + bindscroll(e){ | ||
| 268 | + if(!this.getClassNameFlag) return; | ||
| 269 | + this.getClassNameFlag=false; | ||
| 270 | + //console.log('this.scrollHeightList',this.scrollHeightList) | ||
| 271 | + let maxMX=9999999; | ||
| 272 | + let activeId=''; | ||
| 273 | + Object.keys(this.scrollHeightList).forEach(tid=>{ | ||
| 274 | + let mx=parseInt(e.detail.scrollTop)-parseInt(this.scrollHeightList[tid].top) | ||
| 275 | + if(mx>-100){ | ||
| 276 | + if(mx<maxMX) { | ||
| 277 | + maxMX=mx; | ||
| 278 | + activeId=tid; | ||
| 235 | } | 279 | } |
| 236 | - wx.showToast({ | ||
| 237 | - icon:'none', | ||
| 238 | - title:title, | ||
| 239 | - duration:1500, | ||
| 240 | - }); | ||
| 241 | - let that=this; | ||
| 242 | - setTimeout(function(){ | ||
| 243 | - if(json.data[0].order[0].status>5){ | ||
| 244 | - wx.reLaunch({ | ||
| 245 | - url:'/pages/menu/s_nothing?sellerid='+that.data.sellerid+'&orderid='+that.data.orderid, | ||
| 246 | - }) | ||
| 247 | - }else{ | ||
| 248 | - that.goToOrder(that.data.orderid) | ||
| 249 | - } | ||
| 250 | - },1500) | ||
| 251 | } | 280 | } |
| 252 | - | 281 | + }) |
| 282 | + if(activeId && this.data.activeId!=activeId){ | ||
| 283 | + console.log(activeId, this.scrollHeightList[activeId].dataset.name) | ||
| 284 | + this.setData({ | ||
| 285 | + activeId:activeId, | ||
| 286 | + }) | ||
| 287 | + this.selectComponent("#menu").activeMenuID(activeId); | ||
| 288 | + } | ||
| 289 | + this.getClassNameFlag=true; | ||
| 290 | + }, | ||
| 291 | + scrollHeightList:{}, | ||
| 292 | + initScrollHeightList(scroll){ | ||
| 293 | + //if(Object.keys(this.scrollHeightList).length>0) return; | ||
| 294 | + let that=this; | ||
| 295 | + return new Promise(function(success,fail){ | ||
| 296 | + var query = wx.createSelectorQuery(); | ||
| 297 | + query.selectAll('.list-model-masonry').boundingClientRect() | ||
| 298 | + query.exec(function (res) { | ||
| 299 | + for(let i=0;i<res[0].length;i++){ | ||
| 300 | + let x=res[0][i]; | ||
| 301 | + //x.top=parseInt(scroll.detail.scrollTop)+parseInt(x.top); | ||
| 302 | + that.scrollHeightList[x.id]=x; | ||
| 303 | + } | ||
| 304 | + success() | ||
| 305 | + }) | ||
| 253 | }) | 306 | }) |
| 254 | }, | 307 | }, |
| 255 | }) | 308 | }) |
| @@ -5,6 +5,10 @@ | @@ -5,6 +5,10 @@ | ||
| 5 | "usingComponents": { | 5 | "usingComponents": { |
| 6 | "foodCard": "../components/food-card/food-card", | 6 | "foodCard": "../components/food-card/food-card", |
| 7 | "cookClass": "../components/cook-class/cook-class", | 7 | "cookClass": "../components/cook-class/cook-class", |
| 8 | - "nav":"/components/nav/nav" | 8 | + "nav":"/components/nav/nav", |
| 9 | + "cart":"../components/cart/cart", | ||
| 10 | + "formids":"/components/formids/formids", | ||
| 11 | + "userinfo":"/components/userinfo/userinfo", | ||
| 12 | + "network":"/components/network/network" | ||
| 9 | } | 13 | } |
| 10 | } | 14 | } |
| @@ -8,48 +8,52 @@ | @@ -8,48 +8,52 @@ | ||
| 8 | style = "height:{{totalHeight}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;" | 8 | style = "height:{{totalHeight}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;" |
| 9 | scroll-into-view = "{{toView}}" | 9 | scroll-into-view = "{{toView}}" |
| 10 | scroll-with-animation | 10 | scroll-with-animation |
| 11 | + bindscroll="bindscroll" | ||
| 11 | > | 12 | > |
| 12 | <view style = "padding-left:180rpx;"> | 13 | <view style = "padding-left:180rpx;"> |
| 13 | <view class="section" wx:for="{{cookbooklist}}" wx:key="cookbooklist-key"> | 14 | <view class="section" wx:for="{{cookbooklist}}" wx:key="cookbooklist-key"> |
| 14 | - <view id="{{'inToView'+item.id}}"></view> | ||
| 15 | - <view class="list-model-masonry" > | 15 | + <view id="{{'inToView'+item.id}}" class="class_name {{activeId==item.id?'class_name-active11':''}}"> |
| 16 | + <view class="text">{{item.class_name}}</view> | ||
| 17 | + </view> | ||
| 18 | + <view class="list-model-masonry" id="{{item.id}}" data-name="{{item.class_name}}"> | ||
| 16 | <view class="list-model-column"> | 19 | <view class="list-model-column"> |
| 17 | <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" > | 20 | <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" > |
| 18 | <view class="item"> | 21 | <view class="item"> |
| 19 | <foodCard item="{{item}}" | 22 | <foodCard item="{{item}}" |
| 20 | - sellerid="{{sellerid}}" orderid="{{orderid}}" | ||
| 21 | - fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" | 23 | + sellerid="{{order.sellerid}}" orderid="{{order.id}}" |
| 24 | + identity="{{options.identity}}" | ||
| 22 | bindfoodCardCallback="foodCardCallback" | 25 | bindfoodCardCallback="foodCardCallback" |
| 23 | - hasListModel="{{hasListModel}}" | ||
| 24 | ></foodCard> | 26 | ></foodCard> |
| 25 | </view> | 27 | </view> |
| 26 | </block> | 28 | </block> |
| 27 | </view> | 29 | </view> |
| 28 | </view> | 30 | </view> |
| 29 | </view> | 31 | </view> |
| 30 | - <view style="height: 80px;width: 100%;"></view> | 32 | + <view style="height: 110px;width: 100%;"></view> |
| 31 | </view> | 33 | </view> |
| 32 | </scroll-view> | 34 | </scroll-view> |
| 33 | - <view class="white flex-lr" style="position:fixed;bottom:0px;width:100%;padding:5px 0;z-index:2000;height:58px;"> | ||
| 34 | - | ||
| 35 | - <view class="body-view"> | ||
| 36 | - | ||
| 37 | - </view> | ||
| 38 | - <view class="shopping-total flex-vc list-layout-buttom-opt"> | ||
| 39 | - | ||
| 40 | - <image src="http://qn.colorcun.com/custom/lite/image/cook-list-gwc.png" class="icon" /> | ||
| 41 | - <view style="color:#fff;font-size:24rpx;margin-top:-2px;text-align:center;" class="smooth">下单</view> | ||
| 42 | - <block wx:if="{{countTotal>0}}"> | ||
| 43 | - <view class="show-num fwhite flex-cc smooth">{{countTotal}}</view> | ||
| 44 | - </block> | ||
| 45 | - <button bindgetuserinfo="bindChooseOk" open-type="getUserInfo" class="shop-button"></button> | ||
| 46 | - <bubble id="bubble"></bubble> | 35 | + <view class="white flex-lr bottom-view"> |
| 36 | + <button class="share flex-vc button-none" open-type="share"> | ||
| 37 | + <view class="flex-vc"> | ||
| 38 | + <view class="icon"> | ||
| 39 | + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image> | ||
| 40 | + </view> | ||
| 41 | + <view class="text">一起点</view> | ||
| 42 | + </view> | ||
| 43 | + </button> | ||
| 44 | + <view class="cart flex-ll" bindtap="dispalyCart"> | ||
| 45 | + <view class="icon"> | ||
| 46 | + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart-black.png"/> | ||
| 47 | + <view class="dot" wx:if="{{orderItemCount>0}}">{{orderItemCount}}</view> | ||
| 48 | + </view> | ||
| 49 | + <view class="text Semibold">¥{{order.price}}</view> | ||
| 47 | </view> | 50 | </view> |
| 48 | - | ||
| 49 | - <!--只有点菜后才显示点好了按钮--> | 51 | + <userinfo class="place flex-vc" binduserinfo="gotoCart">选好了</userinfo> |
| 50 | </view> | 52 | </view> |
| 51 | </view> | 53 | </view> |
| 52 | 54 | ||
| 53 | <cookClass id="menu" bind:changeList="changeList" | 55 | <cookClass id="menu" bind:changeList="changeList" |
| 54 | cooklist="{{cookbooklist}}" hasListModel="{{hasListModel}}"> | 56 | cooklist="{{cookbooklist}}" hasListModel="{{hasListModel}}"> |
| 55 | </cookClass> | 57 | </cookClass> |
| 58 | +<cart rid="{{options.rid}}" id="cart" order="{{order}}" identity="{{options.identity}}" bindfoodCardCallback="foodCardCallback"></cart> | ||
| 59 | +<network id="network"></network> |
| @@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
| 111 | } | 111 | } |
| 112 | .column { display: flex; flex-direction: column; width: 50%; max-width:50%; } | 112 | .column { display: flex; flex-direction: column; width: 50%; max-width:50%; } |
| 113 | .column-space { width: 20px; } | 113 | .column-space { width: 20px; } |
| 114 | -.column .item{margin-bottom: 20px;width:100%; overflow: hidden; border-radius: 10rpx;} | 114 | +.column .item{width:100%; overflow: hidden; border-radius: 10rpx;} |
| 115 | 115 | ||
| 116 | /** | 116 | /** |
| 117 | 列表模式 | 117 | 列表模式 |
| @@ -125,8 +125,6 @@ | @@ -125,8 +125,6 @@ | ||
| 125 | .list-model .item{ | 125 | .list-model .item{ |
| 126 | border-radius: 0rpx; | 126 | border-radius: 0rpx; |
| 127 | border-bottom: 2rpx solid #F5F5F5; | 127 | border-bottom: 2rpx solid #F5F5F5; |
| 128 | - padding-bottom: 28rpx; | ||
| 129 | - margin-top: 14rpx; | ||
| 130 | } | 128 | } |
| 131 | .list-layout-buttom-opt{ | 129 | .list-layout-buttom-opt{ |
| 132 | background-color: #353535; | 130 | background-color: #353535; |
| @@ -160,4 +158,105 @@ | @@ -160,4 +158,105 @@ | ||
| 160 | width: 100%; | 158 | width: 100%; |
| 161 | height: 300rpx; | 159 | height: 300rpx; |
| 162 | margin-bottom: 10rpx; | 160 | margin-bottom: 10rpx; |
| 161 | +} | ||
| 162 | + | ||
| 163 | +.bottom-view{ | ||
| 164 | + position:fixed; | ||
| 165 | + bottom:0; | ||
| 166 | + width:100%; | ||
| 167 | + z-index:2000; | ||
| 168 | + height:100rpx; | ||
| 169 | + background-color: #fefefe; | ||
| 170 | + color:#353535; | ||
| 171 | + border-top: 2rpx solid #f5f5f5; | ||
| 172 | +} | ||
| 173 | +.bottom-view image{ | ||
| 174 | + width: 100%; | ||
| 175 | + height: 100%; | ||
| 176 | + | ||
| 177 | +} | ||
| 178 | +.share{ | ||
| 179 | + width: 180rpx; | ||
| 180 | + min-width: 180rpx; | ||
| 181 | + border-right: 2rpx solid #E0E0E0; | ||
| 182 | +} | ||
| 183 | +.share .icon{ | ||
| 184 | + width: 38rpx; | ||
| 185 | + height: 34rpx; | ||
| 186 | +} | ||
| 187 | +.share .text{ | ||
| 188 | + font-size: 20rpx; | ||
| 189 | + line-height: 28rpx; | ||
| 190 | + height: 28rpx; | ||
| 191 | + margin-top: 8rpx; | ||
| 192 | +} | ||
| 193 | + | ||
| 194 | +.cart{ | ||
| 195 | + width: 100%; | ||
| 196 | +} | ||
| 197 | +.cart .icon{ | ||
| 198 | + margin-left: 54rpx; | ||
| 199 | + width: 44rpx; | ||
| 200 | + height: 44rpx; | ||
| 201 | + position: relative; | ||
| 202 | +} | ||
| 203 | +.cart .icon .dot{ | ||
| 204 | + position: absolute; | ||
| 205 | + top:-15rpx; | ||
| 206 | + right: -15rpx; | ||
| 207 | + background-color: #E14553; | ||
| 208 | + color:#fefefe; | ||
| 209 | + font-size: 20rpx; | ||
| 210 | + width: 30rpx; | ||
| 211 | + height: 30rpx; | ||
| 212 | + line-height: 30rpx; | ||
| 213 | + border-radius: 50%; | ||
| 214 | + text-align: center; | ||
| 215 | +} | ||
| 216 | +.cart .text{ | ||
| 217 | + font-size: 36rpx; | ||
| 218 | + margin-left: 34rpx; | ||
| 219 | +} | ||
| 220 | + | ||
| 221 | +.place{ | ||
| 222 | + width: 238rpx; | ||
| 223 | + min-width: 238rpx; | ||
| 224 | + background-color: #262628; | ||
| 225 | + color: #fefefe; | ||
| 226 | + font-size: 34rpx; | ||
| 227 | + height: 100%; | ||
| 228 | +} | ||
| 229 | +.class_name{ | ||
| 230 | + font-size: 26rpx; | ||
| 231 | + font-weight: bold; | ||
| 232 | + height: 120rpx; | ||
| 233 | + line-height: 120rpx; | ||
| 234 | + position: relative; | ||
| 235 | + width: 100%; | ||
| 236 | + background-color: #fefefe; | ||
| 237 | +} | ||
| 238 | +.class_name .text{ | ||
| 239 | + background-color: #fefefe; | ||
| 240 | + position: absolute; | ||
| 241 | + padding-right: 20rpx; | ||
| 242 | +} | ||
| 243 | +.class_name:before{ | ||
| 244 | + position: absolute; | ||
| 245 | + content: ''; | ||
| 246 | + top: 0; | ||
| 247 | + left: 0; | ||
| 248 | + right: 0; | ||
| 249 | + bottom: 0; | ||
| 250 | + margin: auto; | ||
| 251 | + width: 100%; | ||
| 252 | + height: 2rpx; | ||
| 253 | + background-color: #F5F5F5; | ||
| 254 | +} | ||
| 255 | +.class_name-active{ | ||
| 256 | + position: fixed; | ||
| 257 | + top:100rpx; | ||
| 258 | + z-index: 999; | ||
| 259 | + left:200rpx; | ||
| 260 | + height: 140rpx; | ||
| 261 | + line-height: 140rpx; | ||
| 163 | } | 262 | } |
pack-cookbook/pages/remark.js
0 → 100644
| 1 | +// pack-cookbook/pages/remark.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 | + tags:[], | ||
| 12 | + remark:'', | ||
| 13 | + }, | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 生命周期函数--监听页面加载 | ||
| 17 | + */ | ||
| 18 | + orderid:'', | ||
| 19 | + onLoad: function (options) { | ||
| 20 | + this.orderid=options.id; | ||
| 21 | + App.Advance.GetRemarkBySellerid({ | ||
| 22 | + sellerid:options.sellerid, | ||
| 23 | + }).then(res=>{ | ||
| 24 | + let obj={ | ||
| 25 | + remark:options.remark, | ||
| 26 | + } | ||
| 27 | + obj.tags=res.data; | ||
| 28 | + if(options.remarkid){ | ||
| 29 | + let remarkid=options.remarkid.split(',') | ||
| 30 | + res.data.forEach((t)=>{ | ||
| 31 | + if(remarkid._indexOf(t.id)>-1){ | ||
| 32 | + t.active=true | ||
| 33 | + } | ||
| 34 | + }) | ||
| 35 | + } | ||
| 36 | + this.setData(obj) | ||
| 37 | + }) | ||
| 38 | + }, | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 42 | + */ | ||
| 43 | + onReady: function () { | ||
| 44 | + | ||
| 45 | + }, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 生命周期函数--监听页面显示 | ||
| 49 | + */ | ||
| 50 | + onShow: function () { | ||
| 51 | + | ||
| 52 | + }, | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 生命周期函数--监听页面隐藏 | ||
| 56 | + */ | ||
| 57 | + onHide: function () { | ||
| 58 | + | ||
| 59 | + }, | ||
| 60 | + activeRemark(e){ | ||
| 61 | + let i=util.attr(e,'index'); | ||
| 62 | + let tags=this.data.tags; | ||
| 63 | + tags[i].active=!tags[i].active; | ||
| 64 | + console.log(i,tags); | ||
| 65 | + let remark=this.data.remark; | ||
| 66 | + remark=remark.replace(tags[i].remark+'、','') | ||
| 67 | + if(tags[i].active){ | ||
| 68 | + remark+=tags[i].remark+'、' | ||
| 69 | + } | ||
| 70 | + this.setData({ | ||
| 71 | + remark:remark, | ||
| 72 | + tags:tags, | ||
| 73 | + }) | ||
| 74 | + }, | ||
| 75 | + inputRemark(e){ | ||
| 76 | + let remark=util.val(e).trim(); | ||
| 77 | + this.setData({ | ||
| 78 | + remark:remark, | ||
| 79 | + }) | ||
| 80 | + }, | ||
| 81 | + submit(){ | ||
| 82 | + let remarkid=[]; | ||
| 83 | + let tags=this.data.tags; | ||
| 84 | + tags.forEach(t=>{ | ||
| 85 | + if(t.active) | ||
| 86 | + remarkid.push(t.id); | ||
| 87 | + }) | ||
| 88 | + if(!this.data.remark){ | ||
| 89 | + return util.toast('请填写或选择备注信息','none') | ||
| 90 | + } | ||
| 91 | + App.Advance.SetOrderById({ | ||
| 92 | + orderid:this.orderid, | ||
| 93 | + remark:this.data.remark, | ||
| 94 | + remarkid:remarkid.toString(), | ||
| 95 | + }).then(res=>{ | ||
| 96 | + wx.navigateBack(); | ||
| 97 | + }) | ||
| 98 | + } | ||
| 99 | +}) |
pack-cookbook/pages/remark.json
0 → 100644
pack-cookbook/pages/remark.wxml
0 → 100644
| 1 | +<!--pack-cookbook/pages/remark.wxml--> | ||
| 2 | +<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav> | ||
| 3 | +<view class="pages"> | ||
| 4 | + <textarea class="textarea" bindinput="inputRemark" value="{{remark}}"> | ||
| 5 | + | ||
| 6 | + </textarea> | ||
| 7 | + <view class="tip">快捷标签</view> | ||
| 8 | + <view class="tags flex-ll" style="flex-wrap:wrap;"> | ||
| 9 | + <block wx:for="{{tags}}" wx:key="tags.key"> | ||
| 10 | + <view class="tag {{item.active?'active':''}}" | ||
| 11 | + bindtap="activeRemark" | ||
| 12 | + data-index="{{index}}">{{item.remark}}</view> | ||
| 13 | + </block> | ||
| 14 | + </view> | ||
| 15 | + <formids bindclick="submit"> | ||
| 16 | + <view class="submit">保存</view> | ||
| 17 | + </formids> | ||
| 18 | +</view> |
pack-cookbook/pages/remark.wxss
0 → 100644
| 1 | +/* pack-cookbook/pages/remark.wxss */ | ||
| 2 | +.pages{ | ||
| 3 | + width: 90%; | ||
| 4 | + margin: 40rpx auto 0; | ||
| 5 | +} | ||
| 6 | +.textarea{ | ||
| 7 | + border: 2rpx solid #999999; | ||
| 8 | + width: 100%; | ||
| 9 | + height: 240rpx; | ||
| 10 | +} | ||
| 11 | +.tip{ | ||
| 12 | + margin-top: 40rpx; | ||
| 13 | + margin-bottom: 40rpx; | ||
| 14 | + font-size: 24rpx; | ||
| 15 | + color: #999999; | ||
| 16 | +} | ||
| 17 | +.tags { | ||
| 18 | + font-size: 30rpx; | ||
| 19 | + color: #C2AC6A; | ||
| 20 | +} | ||
| 21 | +.tag{ | ||
| 22 | + border: 2rpx solid #C2AC6A; | ||
| 23 | + height: 50rpx; | ||
| 24 | + line-height: 50rpx; | ||
| 25 | + padding: 0 16rpx; | ||
| 26 | + margin: 0 40rpx 40rpx 0; | ||
| 27 | +} | ||
| 28 | +.tag.active{ | ||
| 29 | + background: linear-gradient(to right, #C0AA68, #DFCE8E); | ||
| 30 | + border-width: 0; | ||
| 31 | + color: #fefefe; | ||
| 32 | +} | ||
| 33 | +.submit{ | ||
| 34 | + font-size: 34rpx; | ||
| 35 | + width: 300rpx; | ||
| 36 | + height: 80rpx; | ||
| 37 | + line-height: 80rpx; | ||
| 38 | + color:#fefefe; | ||
| 39 | + background-color: #C8B16D; | ||
| 40 | + border-radius: 40rpx; | ||
| 41 | + margin: 300rpx auto 20rpx; | ||
| 42 | + text-align: center; | ||
| 43 | +} | ||
| 44 | +.submit.fouce{ | ||
| 45 | + margin: 32rpx auto; | ||
| 46 | +} |
pack-cookbook/pages/success.js
0 → 100644
| 1 | +// pack-cookbook/pages/success.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 | + moreDisplay:false, | ||
| 12 | + detail:{}, | ||
| 13 | + }, | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * 生命周期函数--监听页面加载 | ||
| 17 | + */ | ||
| 18 | + onLoad: function (options) { | ||
| 19 | + this.setData({ | ||
| 20 | + options:options | ||
| 21 | + }) | ||
| 22 | + this.initOrder() | ||
| 23 | + this.getDetail() | ||
| 24 | + }, | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 生命周期函数--监听页面初次渲染完成 | ||
| 28 | + */ | ||
| 29 | + onReady: function () { | ||
| 30 | + | ||
| 31 | + }, | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 生命周期函数--监听页面显示 | ||
| 35 | + */ | ||
| 36 | + onShow: function () { | ||
| 37 | + | ||
| 38 | + }, | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 生命周期函数--监听页面隐藏 | ||
| 42 | + */ | ||
| 43 | + onHide: function () { | ||
| 44 | + | ||
| 45 | + }, | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 生命周期函数--监听页面卸载 | ||
| 49 | + */ | ||
| 50 | + onUnload: function () { | ||
| 51 | + | ||
| 52 | + }, | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
| 56 | + */ | ||
| 57 | + onPullDownRefresh: function () { | ||
| 58 | + | ||
| 59 | + }, | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 页面上拉触底事件的处理函数 | ||
| 63 | + */ | ||
| 64 | + onReachBottom: function () { | ||
| 65 | + | ||
| 66 | + }, | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 用户点击右上角分享 | ||
| 70 | + */ | ||
| 71 | + onShareAppMessage: function () { | ||
| 72 | + let options={...this.data.options,hasOnlyShow:1}; | ||
| 73 | + delete options.hasSuccess | ||
| 74 | + return { | ||
| 75 | + title:'菜品已点好,快来看看都点了什么~', | ||
| 76 | + path:util.http_build_query(options,'/pack-cookbook/pages/success'), | ||
| 77 | + imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-show.jpg', | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + | ||
| 81 | + initOrder(){ | ||
| 82 | + App.Advance.CreateOrder({ | ||
| 83 | + rid: this.data.options.rid, | ||
| 84 | + identity:this.data.options.identity, | ||
| 85 | + status:1, | ||
| 86 | + }).then(res => { | ||
| 87 | + res.data.cdateStr=util.unixtoTime(res.data.cdate,'YYYY-MM-DD') | ||
| 88 | + let cookbooklist={}; | ||
| 89 | + let i=0; | ||
| 90 | + let moreDisplay=true; | ||
| 91 | + res.data.cookbooklist.forEach(ck=>{ | ||
| 92 | + if(!cookbooklist[ck.classid]){ | ||
| 93 | + cookbooklist[ck.classid]={'name':ck.class_name,list:[],moreDisplay:moreDisplay} | ||
| 94 | + } | ||
| 95 | + ck.moreDisplay=moreDisplay | ||
| 96 | + cookbooklist[ck.classid].list.push(ck) | ||
| 97 | + i++; | ||
| 98 | + if(i>=4){ | ||
| 99 | + moreDisplay=false; | ||
| 100 | + } | ||
| 101 | + }) | ||
| 102 | + res.data.booklist=cookbooklist; | ||
| 103 | + this.setData({ | ||
| 104 | + order: res.data, | ||
| 105 | + }) | ||
| 106 | + }) | ||
| 107 | + }, | ||
| 108 | + moreDisplay(){ | ||
| 109 | + this.setData({ | ||
| 110 | + moreDisplay:!this.data.moreDisplay | ||
| 111 | + }) | ||
| 112 | + }, | ||
| 113 | + gotoEditor(){ | ||
| 114 | + let options={...this.data.options,sid:this.data.order.sellerid}; | ||
| 115 | + delete options.hasSuccess | ||
| 116 | + wx.redirectTo({ | ||
| 117 | + url: util.http_build_query(options,'./index') | ||
| 118 | + }) | ||
| 119 | + }, | ||
| 120 | + getDetail(fouce=false){ | ||
| 121 | + App.Reserve.Detail({ | ||
| 122 | + rid: this.data.options.rid, | ||
| 123 | + openid: getApp().openid | ||
| 124 | + },fouce).then(res => { | ||
| 125 | + this.setData({ | ||
| 126 | + detail:this.formatDatail(res.data) | ||
| 127 | + }) | ||
| 128 | + }) | ||
| 129 | + }, | ||
| 130 | + formatDatail(detail){ | ||
| 131 | + detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II'); | ||
| 132 | + detail.tableSubInfo=[]; | ||
| 133 | + detail.tables.forEach(t=>{ | ||
| 134 | + detail.tableSubInfo.push(t.name); | ||
| 135 | + }) | ||
| 136 | + detail.tableSubInfo=detail.tableSubInfo.join('、') | ||
| 137 | + return detail; | ||
| 138 | + }, | ||
| 139 | + navEvent(){ | ||
| 140 | + wx.navigateBack(2); | ||
| 141 | + }, | ||
| 142 | +}) |
pack-cookbook/pages/success.json
0 → 100644
pack-cookbook/pages/success.wxml
0 → 100644
| 1 | +<!--pack-cookbook/pages/success.wxml--> | ||
| 2 | +<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000" bindNavEvent="navEvent">已点菜品</nav> | ||
| 3 | +<view wx:if="{{options.hasSuccess==1}}"> | ||
| 4 | + <view class="pages flex-vc success"> | ||
| 5 | + <view class="icon"> | ||
| 6 | + <icon type="success" size="47" color="#C8B16D"/> | ||
| 7 | + </view> | ||
| 8 | + <view class="title Medium">订单提交成功</view> | ||
| 9 | + <view class="optx flex-vc"> | ||
| 10 | + <view class="opt-view flex-ll"> | ||
| 11 | + <formids bindclick="gotoEditor" class="width:50%;"> | ||
| 12 | + <view class="but editor" style="width: 100%;">修改菜品</view> | ||
| 13 | + </formids> | ||
| 14 | + <button class="but share button-none" open-type="share">分享</button> | ||
| 15 | + </view> | ||
| 16 | + </view> | ||
| 17 | + </view> | ||
| 18 | + <view class="hr"></view> | ||
| 19 | +</view> | ||
| 20 | +<view class="pages"> | ||
| 21 | + <view class="carts"> | ||
| 22 | + <block wx:for="{{order.booklist}}" wx:key="order.booklist.key"> | ||
| 23 | + <view class="block" hidden="{{!moreDisplay && !item.moreDisplay}}"> | ||
| 24 | + <view class="title">{{item.name}}</view> | ||
| 25 | + <view class="cart-body"> | ||
| 26 | + <block wx:for="{{item.list}}" wx:key="item.key"> | ||
| 27 | + <view class="cart-item flex-lr" hidden="{{!moreDisplay && !item.moreDisplay}}"> | ||
| 28 | + <view class="icon"> | ||
| 29 | + <image src="{{item.cookimage}}"></image> | ||
| 30 | + </view> | ||
| 31 | + <view class="flex-ll name"> | ||
| 32 | + <view class="name">{{item.cookname}}</view> | ||
| 33 | + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view> | ||
| 34 | + </view> | ||
| 35 | + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view> | ||
| 36 | + <view class="opt">{{item.num}}</view> | ||
| 37 | + </view> | ||
| 38 | + </block> | ||
| 39 | + </view> | ||
| 40 | + </view> | ||
| 41 | + </block> | ||
| 42 | + </view> | ||
| 43 | + <view class="moreDisplay flex-vc" | ||
| 44 | + bindtap="moreDisplay" | ||
| 45 | + wx:if="{{order.cookbooklist.length>4}}">{{!moreDisplay?'查看更多':'收起'}}</view> | ||
| 46 | + <view class="total">共计:¥{{order.price}}</view> | ||
| 47 | +</view> | ||
| 48 | +<view class="hr"></view> | ||
| 49 | +<view class="pages"> | ||
| 50 | + <view class="infos"> | ||
| 51 | + <view class="flex-lr item" wx:if="{{order.remark}}"> | ||
| 52 | + <view class="item-label">备注:</view> | ||
| 53 | + <view class="" style="max-width: 85%;line-height: 40rpx; ">{{order.remark||''}}</view> | ||
| 54 | + </view> | ||
| 55 | + <view class="flex-lr item"> | ||
| 56 | + <view class="item-label">人数:</view> | ||
| 57 | + <view class="">{{order.pnum||''}}</view> | ||
| 58 | + </view> | ||
| 59 | + <view class="flex-lr item"> | ||
| 60 | + <view class="item-label">桌位:</view> | ||
| 61 | + <view class="" style="max-width: 85%;line-height: 40rpx; ">{{detail.tableSubInfo}}</view> | ||
| 62 | + </view> | ||
| 63 | + </view> | ||
| 64 | +</view> | ||
| 65 | +<view class="hr"></view> | ||
| 66 | +<view class="pages"> | ||
| 67 | + <view class="infos"> | ||
| 68 | + <view class="item"> | ||
| 69 | + 订单信息 | ||
| 70 | + </view> | ||
| 71 | + <view class="flex-ll item"> | ||
| 72 | + <view>订单编号:</view> | ||
| 73 | + <view class="">{{order.no}}</view> | ||
| 74 | + </view> | ||
| 75 | + <view class="flex-ll item"> | ||
| 76 | + <view>下单时间:</view> | ||
| 77 | + <view class="">{{order.cdateStr}}</view> | ||
| 78 | + </view> | ||
| 79 | + </view> | ||
| 80 | +</view> | ||
| 81 | +<view style="height: 150rpx;width: 100%;"></view> | ||
| 82 | +<view class="optx flex-vc" wx:if="{{options.hasSuccess!=1 && options.hasOnlyShow!=1}}"> | ||
| 83 | + <view class="opt-view flex-ll"> | ||
| 84 | + <formids bindclick="gotoEditor" class="width:50%;"> | ||
| 85 | + <view class="but editor" style="width: 100%;">修改菜品</view> | ||
| 86 | + </formids> | ||
| 87 | + <button class="but share button-none" open-type="share">分享</button> | ||
| 88 | + </view> | ||
| 89 | +</view> |
pack-cookbook/pages/success.wxss
0 → 100644
| 1 | +/* pack-cookbook/pages/success.wxss */ | ||
| 2 | +.pages{ | ||
| 3 | + padding: 40rpx 5% 0; | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +.carts{ | ||
| 8 | + overflow-y: auto; | ||
| 9 | +} | ||
| 10 | +.carts image{ | ||
| 11 | + width: 100%; | ||
| 12 | + height: 100%; | ||
| 13 | +} | ||
| 14 | +.carts .icon{ | ||
| 15 | + width: 48rpx; | ||
| 16 | + min-width: 48rpx; | ||
| 17 | + height: 48rpx; | ||
| 18 | + background-color: #f5f5f5; | ||
| 19 | + border-radius: 50%; | ||
| 20 | + overflow: hidden; | ||
| 21 | + margin-right: 20rpx; | ||
| 22 | +} | ||
| 23 | +.carts .title{ | ||
| 24 | + height:80rpx; | ||
| 25 | + line-height: 80rpx; | ||
| 26 | + font-size: 28rpx; | ||
| 27 | + border-bottom: 2rpx solid #F5F5F5; | ||
| 28 | +} | ||
| 29 | +.cart-body{ | ||
| 30 | + | ||
| 31 | +} | ||
| 32 | +.cart-item{ | ||
| 33 | + height: 100rpx; | ||
| 34 | + line-height: 100rpx; | ||
| 35 | + font-size: 30rpx; | ||
| 36 | +} | ||
| 37 | +.cart-item .name{ | ||
| 38 | + width: 60%; | ||
| 39 | + overflow: hidden; | ||
| 40 | + white-space:nowrap; | ||
| 41 | +} | ||
| 42 | +.cart-item .name .name{ | ||
| 43 | + width: auto; | ||
| 44 | + max-width: 80%; | ||
| 45 | +} | ||
| 46 | +.cart-item .price{ | ||
| 47 | + width: 200rpx; | ||
| 48 | + min-width: 200rpx; | ||
| 49 | + white-space:nowrap; | ||
| 50 | + margin-left: 20rpx; | ||
| 51 | + overflow: hidden; | ||
| 52 | +} | ||
| 53 | +.cart-item .opt{ | ||
| 54 | + font-size: 30rpx; | ||
| 55 | + min-width: 50rpx; | ||
| 56 | + width: 50rpx; | ||
| 57 | + text-align: right; | ||
| 58 | +} | ||
| 59 | +.total{ | ||
| 60 | + height: 140rpx; | ||
| 61 | + line-height: 140rpx; | ||
| 62 | + border-top: 2rpx solid #F5F5F5; | ||
| 63 | + border-radius: 0 0 10rpx 10rpx; | ||
| 64 | + margin:0 10rpx 20rpx; | ||
| 65 | + text-align: right; | ||
| 66 | + font-weight: bold; | ||
| 67 | + font-size: 36rpx; | ||
| 68 | + padding-right: 34rpx; | ||
| 69 | +} | ||
| 70 | +.hr{ | ||
| 71 | + height: 20rpx; | ||
| 72 | + background-color: #f5f5f5; | ||
| 73 | + width: 100%; | ||
| 74 | +} | ||
| 75 | +.infos{ | ||
| 76 | + background-color: #fefefe; | ||
| 77 | + font-size: 28rpx; | ||
| 78 | + padding-bottom: 20rpx; | ||
| 79 | +} | ||
| 80 | +.infos .item{ | ||
| 81 | + height: 80rpx; | ||
| 82 | + line-height: 80rpx; | ||
| 83 | + border-bottom: 2rpx solid #F5F5F5; | ||
| 84 | +} | ||
| 85 | +.infos input{ | ||
| 86 | + text-align: right; | ||
| 87 | +} | ||
| 88 | +.infos .desc{ | ||
| 89 | + margin-right: 20rpx; | ||
| 90 | + white-space:nowrap; | ||
| 91 | + overflow: hidden; | ||
| 92 | + max-width: 95%; | ||
| 93 | + color: #999999; | ||
| 94 | +} | ||
| 95 | +.infos .item:last-child{ | ||
| 96 | + border-bottom-width:0; | ||
| 97 | +} | ||
| 98 | +.infos .item-label{ | ||
| 99 | + min-width: 100rpx; | ||
| 100 | + overflow: hidden; | ||
| 101 | + white-space:nowrap; | ||
| 102 | +} | ||
| 103 | +.optx{ | ||
| 104 | + height: 96rpx; | ||
| 105 | + line-height: 96rpx; | ||
| 106 | + background-color: #262628; | ||
| 107 | + position: fixed; | ||
| 108 | + bottom: 0; | ||
| 109 | + left:0; | ||
| 110 | + right: 0; | ||
| 111 | + color:#fefefe; | ||
| 112 | + font-size: 34rpx; | ||
| 113 | +} | ||
| 114 | +.opt-view{ | ||
| 115 | + height: 50rpx; | ||
| 116 | + line-height: 50rpx; | ||
| 117 | + width: 100%; | ||
| 118 | +} | ||
| 119 | +.opt-view .but{ | ||
| 120 | + width: 50%; | ||
| 121 | + text-align: center; | ||
| 122 | + | ||
| 123 | +} | ||
| 124 | +.opt-view .but:first-child{ | ||
| 125 | + border-right: 2rpx solid #979797; | ||
| 126 | +} | ||
| 127 | +.pages .optx{ | ||
| 128 | + position: relative; | ||
| 129 | + background-color: #fefefe; | ||
| 130 | + color: #262628; | ||
| 131 | + border: 2rpx solid #262628; | ||
| 132 | + height: 80rpx; | ||
| 133 | + line-height: 80rpx; | ||
| 134 | + margin-bottom: 74rpx; | ||
| 135 | + width: 100%; | ||
| 136 | +} | ||
| 137 | +.success image{ | ||
| 138 | + width: 100%; | ||
| 139 | + height: 100%; | ||
| 140 | +} | ||
| 141 | +.success .icon{ | ||
| 142 | + width: 100rpx; | ||
| 143 | + height: 100rpx; | ||
| 144 | + margin-top: 46rpx; | ||
| 145 | +} | ||
| 146 | +.success .title{ | ||
| 147 | + font-size: 36rpx; | ||
| 148 | + margin-top: 36rpx; | ||
| 149 | + margin-bottom: 100rpx; | ||
| 150 | +} | ||
| 151 | +.success .info{ | ||
| 152 | + font-size: 26rpx; | ||
| 153 | + color:#999999 | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +.moreDisplay{ | ||
| 157 | + height: 100rpx; | ||
| 158 | + line-height: 100rpx; | ||
| 159 | + color: #999999; | ||
| 160 | + font-size: 28rpx; | ||
| 161 | +} | ||
| 162 | +.practice_name{ | ||
| 163 | + border: 2rpx solid #C8B16D; | ||
| 164 | + font-size: 24rpx; | ||
| 165 | + height: 30rpx; | ||
| 166 | + line-height: 30rpx; | ||
| 167 | + color:#C8B16D; | ||
| 168 | + padding: 0 6rpx; | ||
| 169 | + margin-left: 18rpx; | ||
| 170 | +} |
package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "xcx-book", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "", | ||
| 5 | + "main": "app.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "repository": { | ||
| 10 | + "type": "git", | ||
| 11 | + "url": "http://123.56.79.57/xt/xcx-book.git" | ||
| 12 | + }, | ||
| 13 | + "author": "", | ||
| 14 | + "license": "ISC", | ||
| 15 | + "dependencies": { | ||
| 16 | + "mta-wechat-analysis": "^1.3.7" | ||
| 17 | + } | ||
| 18 | +} |
-
Please register or login to post a comment