Commit a6fff603ce8fb989939fa4c929ce7c0e26c22580

Authored by wangfan
1 parent fca4a1f7

快速预定

... ... @@ -7,6 +7,10 @@ Component({
rid:{
type:String,
value:"",
},
order:{
type:Object,
value:{},
}
},
... ... @@ -32,6 +36,14 @@ Component({
hidden:false,
})
},
auto(){
if(this.data.order.cookbooklist.length<1){
return this.hide();
}
this.setData({
hidden:!this.data.hidden,
})
},
init(){
App.Advance.CreateOrder({
rid:this.data.rid
... ...
... ... @@ -8,20 +8,18 @@
<view class="text">清空购物车</view>
</view>
<view class="cart-body">
<view class="cart-item flex-lr" wx:for="{{carts}}" wx:key="item.key">
<view class="name">{{item}}</view>
<view class="price">¥125.00/份</view>
<view class="cart-item flex-lr" wx:for="{{order.cookbooklist}}" wx:key="item.key">
<view class="name">{{item.cookname}}</view>
<view class="price">¥{{item.price}}/份</view>
<view class="flex-lr opt">
<foodSpec item="{{item}}" type="-" id="foodSpecDel"
sellerid="{{sellerid}}" orderid="{{orderid}}"
fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
sellerid="{{order.sellerid}}" orderid="{{order.id}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='jian'></view>
</foodSpec>
<view class="t-align-c">{{item.num||10}}</view>
<foodSpec item="{{item}}" type="+"
sellerid="{{sellerid}}" orderid="{{orderid}}"
fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
sellerid="{{order.sellerid}}" orderid="{{order.id}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='add'></view>
</foodSpec>
... ...
... ... @@ -94,7 +94,7 @@ Component({
}
})
}
App.Cookbook.GetCookbookSelBySpecsId({
App.Advance.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
... ... @@ -130,7 +130,7 @@ Component({
var foodMenuPrice=foodMenu[0].price;
var practice_id=foodMenu[0].id;
}
App.Cookbook.GetCookbookSelBySpecsId({
App.Advance.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
... ... @@ -239,7 +239,7 @@ Component({
type:1,
});
//this.matchArray(cookbookid,1,countTotal,countPirce)
App.Orders.AddCart({
App.Advance.AddCart({
orderid: this.data.orderid,
openid:util.cache('openid'),
cookbookid:cookbookid,
... ... @@ -269,7 +269,7 @@ Component({
type:-1,
});
App.Orders.ReduceOrder({
App.Advance.ReduceOrder({
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
... ... @@ -351,7 +351,7 @@ Component({
if(practice_id>0){
params.practiceid=practice_id;
}
App.Orders.ReduceOrder(params);
App.Advance.ReduceOrder(params);
},
/**
*
... ... @@ -431,7 +431,7 @@ Component({
if(practice_id>0){
param.practiceid=practice_id;
}
App.Orders.AddCart(param);
App.Advance.AddCart(param);
},
//清除订单下某菜品所有数量
clean(){
... ... @@ -440,7 +440,7 @@ Component({
cookbookid:cookbookid,
type:this.data.item.num*-1
});
App.Orders.ClearCookById({
App.Advance.ClearCookById({
orderid: this.data.orderid,
sellerid: this.data.sellerid,
cookbookid:cookbookid
... ...
... ... @@ -36,7 +36,8 @@ Page({
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid
rid: this.data.options.rid,
identity:this.data.options.identity
}).then(res => {
this.setData({
order: res.data,
... ... @@ -44,7 +45,7 @@ Page({
})
},
dispalyCart(){
this.selectComponent("#cart").show();
this.selectComponent("#cart").auto();
},
/**
* 生命周期函数--监听页面初次渲染完成
... ... @@ -171,12 +172,9 @@ Page({
getCookList: function (orderid) {
let param = {
sellerid: 80,
//status:this.data.fromSoucre!=''?1:'',
identity: 1
identity: this.data.options.identity,
orderid : this.data.options.oid
};
if (orderid) {
param.orderid = orderid;
}
App.Advance.GetCookbookByClass(param).then(json => {
//菜单分类添加修饰
let cookbooklist = this.formatCookList(json.data[0].list);
... ... @@ -227,45 +225,8 @@ Page({
countTotal: this.data.countTotal + opt.type,
cookbooklist: books
});
this.getOrderInfo();
},
//订单详情
getOrderInfo: function () {
App.Orders.GetOrderById({orderid: this.data.orderid}).then(json => {
let order = json.data[0].order[0];
if (order.status < 2) {
this.setData({aiOrderStatus: json.data[0].order[0].status});
} else {
var title = ''
if (json.data[0].order[0].status == 2 || json.data[0].order[0].status == 3) {
if (this.data.fromSoucre || util.cache('identity') == 2) {
return;
}
title = '手慢了,小伙伴已下单'
}
if (json.data[0].order[0].status == 5) {
title = '订单已结账'
}
if (json.data[0].order[0].status == 7) {
title = '订单已清台'
}
wx.showToast({
icon: 'none',
title: title,
duration: 1500,
});
let that = this;
setTimeout(function () {
if (json.data[0].order[0].status > 5) {
wx.reLaunch({
url: '/pages/menu/s_nothing?sellerid=' + that.data.sellerid + '&orderid=' + that.data.orderid,
})
} else {
that.goToOrder(that.data.orderid)
}
}, 1500)
}
})
setTimeout(()=>{
this.initOrder();
},100)
},
})
\ No newline at end of file
... ...
... ... @@ -134,7 +134,7 @@ Page({
return util.toast(res.msg,'none')
}
wx.navigateTo({
url:util.http_build_query({rid:this.id,oid:res.data.id},'/pack-cookbook/pages/index')
url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1},'/pack-cookbook/pages/index')
});
})
},
... ...
... ... @@ -228,7 +228,7 @@
"id": 25,
"name": "pack-cookbook/pages/index",
"pathName": "pack-cookbook/pages/index",
"query": "rid=1196&oid=2"
"query": "rid=1196&oid=2&identity=1"
},
{
"id": 26,
... ...