Showing
6 changed files
with
34 additions
and
63 deletions
| @@ -7,6 +7,10 @@ Component({ | @@ -7,6 +7,10 @@ Component({ | ||
| 7 | rid:{ | 7 | rid:{ |
| 8 | type:String, | 8 | type:String, |
| 9 | value:"", | 9 | value:"", |
| 10 | + }, | ||
| 11 | + order:{ | ||
| 12 | + type:Object, | ||
| 13 | + value:{}, | ||
| 10 | } | 14 | } |
| 11 | }, | 15 | }, |
| 12 | 16 | ||
| @@ -32,6 +36,14 @@ Component({ | @@ -32,6 +36,14 @@ Component({ | ||
| 32 | hidden:false, | 36 | hidden:false, |
| 33 | }) | 37 | }) |
| 34 | }, | 38 | }, |
| 39 | + auto(){ | ||
| 40 | + if(this.data.order.cookbooklist.length<1){ | ||
| 41 | + return this.hide(); | ||
| 42 | + } | ||
| 43 | + this.setData({ | ||
| 44 | + hidden:!this.data.hidden, | ||
| 45 | + }) | ||
| 46 | + }, | ||
| 35 | init(){ | 47 | init(){ |
| 36 | App.Advance.CreateOrder({ | 48 | App.Advance.CreateOrder({ |
| 37 | rid:this.data.rid | 49 | rid:this.data.rid |
| @@ -8,20 +8,18 @@ | @@ -8,20 +8,18 @@ | ||
| 8 | <view class="text">清空购物车</view> | 8 | <view class="text">清空购物车</view> |
| 9 | </view> | 9 | </view> |
| 10 | <view class="cart-body"> | 10 | <view class="cart-body"> |
| 11 | - <view class="cart-item flex-lr" wx:for="{{carts}}" wx:key="item.key"> | ||
| 12 | - <view class="name">{{item}}</view> | ||
| 13 | - <view class="price">¥125.00/份</view> | 11 | + <view class="cart-item flex-lr" wx:for="{{order.cookbooklist}}" wx:key="item.key"> |
| 12 | + <view class="name">{{item.cookname}}</view> | ||
| 13 | + <view class="price">¥{{item.price}}/份</view> | ||
| 14 | <view class="flex-lr opt"> | 14 | <view class="flex-lr opt"> |
| 15 | <foodSpec item="{{item}}" type="-" id="foodSpecDel" | 15 | <foodSpec item="{{item}}" type="-" id="foodSpecDel" |
| 16 | - sellerid="{{sellerid}}" orderid="{{orderid}}" | ||
| 17 | - fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" | 16 | + sellerid="{{order.sellerid}}" orderid="{{order.id}}" |
| 18 | bindfoodSpecCallback="foodSpecCallback"> | 17 | bindfoodSpecCallback="foodSpecCallback"> |
| 19 | <view class='jian'></view> | 18 | <view class='jian'></view> |
| 20 | </foodSpec> | 19 | </foodSpec> |
| 21 | <view class="t-align-c">{{item.num||10}}</view> | 20 | <view class="t-align-c">{{item.num||10}}</view> |
| 22 | <foodSpec item="{{item}}" type="+" | 21 | <foodSpec item="{{item}}" type="+" |
| 23 | - sellerid="{{sellerid}}" orderid="{{orderid}}" | ||
| 24 | - fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" | 22 | + sellerid="{{order.sellerid}}" orderid="{{order.id}}" |
| 25 | bindfoodSpecCallback="foodSpecCallback"> | 23 | bindfoodSpecCallback="foodSpecCallback"> |
| 26 | <view class='add'></view> | 24 | <view class='add'></view> |
| 27 | </foodSpec> | 25 | </foodSpec> |
| @@ -94,7 +94,7 @@ Component({ | @@ -94,7 +94,7 @@ Component({ | ||
| 94 | } | 94 | } |
| 95 | }) | 95 | }) |
| 96 | } | 96 | } |
| 97 | - App.Cookbook.GetCookbookSelBySpecsId({ | 97 | + App.Advance.GetCookbookSelBySpecsId({ |
| 98 | sellerid:this.data.sellerid, | 98 | sellerid:this.data.sellerid, |
| 99 | orderid: this.data.orderid, | 99 | orderid: this.data.orderid, |
| 100 | cookbookid: this.data.item.id, | 100 | cookbookid: this.data.item.id, |
| @@ -130,7 +130,7 @@ Component({ | @@ -130,7 +130,7 @@ Component({ | ||
| 130 | var foodMenuPrice=foodMenu[0].price; | 130 | var foodMenuPrice=foodMenu[0].price; |
| 131 | var practice_id=foodMenu[0].id; | 131 | var practice_id=foodMenu[0].id; |
| 132 | } | 132 | } |
| 133 | - App.Cookbook.GetCookbookSelBySpecsId({ | 133 | + App.Advance.GetCookbookSelBySpecsId({ |
| 134 | sellerid:this.data.sellerid, | 134 | sellerid:this.data.sellerid, |
| 135 | orderid: this.data.orderid, | 135 | orderid: this.data.orderid, |
| 136 | cookbookid: this.data.item.id, | 136 | cookbookid: this.data.item.id, |
| @@ -239,7 +239,7 @@ Component({ | @@ -239,7 +239,7 @@ Component({ | ||
| 239 | type:1, | 239 | type:1, |
| 240 | }); | 240 | }); |
| 241 | //this.matchArray(cookbookid,1,countTotal,countPirce) | 241 | //this.matchArray(cookbookid,1,countTotal,countPirce) |
| 242 | - App.Orders.AddCart({ | 242 | + App.Advance.AddCart({ |
| 243 | orderid: this.data.orderid, | 243 | orderid: this.data.orderid, |
| 244 | openid:util.cache('openid'), | 244 | openid:util.cache('openid'), |
| 245 | cookbookid:cookbookid, | 245 | cookbookid:cookbookid, |
| @@ -269,7 +269,7 @@ Component({ | @@ -269,7 +269,7 @@ Component({ | ||
| 269 | type:-1, | 269 | type:-1, |
| 270 | }); | 270 | }); |
| 271 | 271 | ||
| 272 | - App.Orders.ReduceOrder({ | 272 | + App.Advance.ReduceOrder({ |
| 273 | orderid: this.data.orderid, | 273 | orderid: this.data.orderid, |
| 274 | openid: getApp().openid, | 274 | openid: getApp().openid, |
| 275 | cookbookid: cookbookid, | 275 | cookbookid: cookbookid, |
| @@ -351,7 +351,7 @@ Component({ | @@ -351,7 +351,7 @@ Component({ | ||
| 351 | if(practice_id>0){ | 351 | if(practice_id>0){ |
| 352 | params.practiceid=practice_id; | 352 | params.practiceid=practice_id; |
| 353 | } | 353 | } |
| 354 | - App.Orders.ReduceOrder(params); | 354 | + App.Advance.ReduceOrder(params); |
| 355 | }, | 355 | }, |
| 356 | /** | 356 | /** |
| 357 | * | 357 | * |
| @@ -431,7 +431,7 @@ Component({ | @@ -431,7 +431,7 @@ Component({ | ||
| 431 | if(practice_id>0){ | 431 | if(practice_id>0){ |
| 432 | param.practiceid=practice_id; | 432 | param.practiceid=practice_id; |
| 433 | } | 433 | } |
| 434 | - App.Orders.AddCart(param); | 434 | + App.Advance.AddCart(param); |
| 435 | }, | 435 | }, |
| 436 | //清除订单下某菜品所有数量 | 436 | //清除订单下某菜品所有数量 |
| 437 | clean(){ | 437 | clean(){ |
| @@ -440,7 +440,7 @@ Component({ | @@ -440,7 +440,7 @@ Component({ | ||
| 440 | cookbookid:cookbookid, | 440 | cookbookid:cookbookid, |
| 441 | type:this.data.item.num*-1 | 441 | type:this.data.item.num*-1 |
| 442 | }); | 442 | }); |
| 443 | - App.Orders.ClearCookById({ | 443 | + App.Advance.ClearCookById({ |
| 444 | orderid: this.data.orderid, | 444 | orderid: this.data.orderid, |
| 445 | sellerid: this.data.sellerid, | 445 | sellerid: this.data.sellerid, |
| 446 | cookbookid:cookbookid | 446 | cookbookid:cookbookid |
| @@ -36,7 +36,8 @@ Page({ | @@ -36,7 +36,8 @@ Page({ | ||
| 36 | }, | 36 | }, |
| 37 | initOrder(){ | 37 | initOrder(){ |
| 38 | App.Advance.CreateOrder({ | 38 | App.Advance.CreateOrder({ |
| 39 | - rid: this.data.options.rid | 39 | + rid: this.data.options.rid, |
| 40 | + identity:this.data.options.identity | ||
| 40 | }).then(res => { | 41 | }).then(res => { |
| 41 | this.setData({ | 42 | this.setData({ |
| 42 | order: res.data, | 43 | order: res.data, |
| @@ -44,7 +45,7 @@ Page({ | @@ -44,7 +45,7 @@ Page({ | ||
| 44 | }) | 45 | }) |
| 45 | }, | 46 | }, |
| 46 | dispalyCart(){ | 47 | dispalyCart(){ |
| 47 | - this.selectComponent("#cart").show(); | 48 | + this.selectComponent("#cart").auto(); |
| 48 | }, | 49 | }, |
| 49 | /** | 50 | /** |
| 50 | * 生命周期函数--监听页面初次渲染完成 | 51 | * 生命周期函数--监听页面初次渲染完成 |
| @@ -171,12 +172,9 @@ Page({ | @@ -171,12 +172,9 @@ Page({ | ||
| 171 | getCookList: function (orderid) { | 172 | getCookList: function (orderid) { |
| 172 | let param = { | 173 | let param = { |
| 173 | sellerid: 80, | 174 | sellerid: 80, |
| 174 | - //status:this.data.fromSoucre!=''?1:'', | ||
| 175 | - identity: 1 | 175 | + identity: this.data.options.identity, |
| 176 | + orderid : this.data.options.oid | ||
| 176 | }; | 177 | }; |
| 177 | - if (orderid) { | ||
| 178 | - param.orderid = orderid; | ||
| 179 | - } | ||
| 180 | App.Advance.GetCookbookByClass(param).then(json => { | 178 | App.Advance.GetCookbookByClass(param).then(json => { |
| 181 | //菜单分类添加修饰 | 179 | //菜单分类添加修饰 |
| 182 | let cookbooklist = this.formatCookList(json.data[0].list); | 180 | let cookbooklist = this.formatCookList(json.data[0].list); |
| @@ -227,45 +225,8 @@ Page({ | @@ -227,45 +225,8 @@ Page({ | ||
| 227 | countTotal: this.data.countTotal + opt.type, | 225 | countTotal: this.data.countTotal + opt.type, |
| 228 | cookbooklist: books | 226 | cookbooklist: books |
| 229 | }); | 227 | }); |
| 230 | - this.getOrderInfo(); | ||
| 231 | - }, | ||
| 232 | - //订单详情 | ||
| 233 | - getOrderInfo: function () { | ||
| 234 | - App.Orders.GetOrderById({orderid: this.data.orderid}).then(json => { | ||
| 235 | - let order = json.data[0].order[0]; | ||
| 236 | - if (order.status < 2) { | ||
| 237 | - this.setData({aiOrderStatus: json.data[0].order[0].status}); | ||
| 238 | - } else { | ||
| 239 | - var title = '' | ||
| 240 | - if (json.data[0].order[0].status == 2 || json.data[0].order[0].status == 3) { | ||
| 241 | - if (this.data.fromSoucre || util.cache('identity') == 2) { | ||
| 242 | - return; | ||
| 243 | - } | ||
| 244 | - title = '手慢了,小伙伴已下单' | ||
| 245 | - } | ||
| 246 | - if (json.data[0].order[0].status == 5) { | ||
| 247 | - title = '订单已结账' | ||
| 248 | - } | ||
| 249 | - if (json.data[0].order[0].status == 7) { | ||
| 250 | - title = '订单已清台' | ||
| 251 | - } | ||
| 252 | - wx.showToast({ | ||
| 253 | - icon: 'none', | ||
| 254 | - title: title, | ||
| 255 | - duration: 1500, | ||
| 256 | - }); | ||
| 257 | - let that = this; | ||
| 258 | - setTimeout(function () { | ||
| 259 | - if (json.data[0].order[0].status > 5) { | ||
| 260 | - wx.reLaunch({ | ||
| 261 | - url: '/pages/menu/s_nothing?sellerid=' + that.data.sellerid + '&orderid=' + that.data.orderid, | ||
| 262 | - }) | ||
| 263 | - } else { | ||
| 264 | - that.goToOrder(that.data.orderid) | ||
| 265 | - } | ||
| 266 | - }, 1500) | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - }) | 228 | + setTimeout(()=>{ |
| 229 | + this.initOrder(); | ||
| 230 | + },100) | ||
| 270 | }, | 231 | }, |
| 271 | }) | 232 | }) |
| @@ -134,7 +134,7 @@ Page({ | @@ -134,7 +134,7 @@ Page({ | ||
| 134 | return util.toast(res.msg,'none') | 134 | return util.toast(res.msg,'none') |
| 135 | } | 135 | } |
| 136 | wx.navigateTo({ | 136 | wx.navigateTo({ |
| 137 | - url:util.http_build_query({rid:this.id,oid:res.data.id},'/pack-cookbook/pages/index') | 137 | + url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1},'/pack-cookbook/pages/index') |
| 138 | }); | 138 | }); |
| 139 | }) | 139 | }) |
| 140 | }, | 140 | }, |
| @@ -228,7 +228,7 @@ | @@ -228,7 +228,7 @@ | ||
| 228 | "id": 25, | 228 | "id": 25, |
| 229 | "name": "pack-cookbook/pages/index", | 229 | "name": "pack-cookbook/pages/index", |
| 230 | "pathName": "pack-cookbook/pages/index", | 230 | "pathName": "pack-cookbook/pages/index", |
| 231 | - "query": "rid=1196&oid=2" | 231 | + "query": "rid=1196&oid=2&identity=1" |
| 232 | }, | 232 | }, |
| 233 | { | 233 | { |
| 234 | "id": 26, | 234 | "id": 26, |
-
Please register or login to post a comment