|
...
|
...
|
@@ -37,11 +37,32 @@ Page({ |
|
|
|
themeColor: '',
|
|
|
|
textColor: '',
|
|
|
|
navColor: '',
|
|
|
|
height:wx.getSystemInfoSync().windowWidth*1*2,
|
|
|
|
height2:wx.getSystemInfoSync().windowWidth,
|
|
|
|
height:wx.getSystemInfoSync().windowWidth*1,
|
|
|
|
height2:wx.getSystemInfoSync().windowWidth*1/2,
|
|
|
|
},
|
|
|
|
checkModal: '',
|
|
|
|
classifyModal: '',
|
|
|
|
imageLoad(e) {
|
|
|
|
const index = e.currentTarget.dataset['index'];
|
|
|
|
const indexs = e.currentTarget.dataset['indexs'];
|
|
|
|
//获取图片的原始宽度和高度
|
|
|
|
let originalWidth = e.detail.width;
|
|
|
|
let originalHeight = e.detail.height;
|
|
|
|
let imageSize = util.imageZoomHeightUtil(originalWidth,originalHeight);
|
|
|
|
let imageHeight = `cookbooklist[${indexs}].cookbooklist[0][${index}].imageHeight`;
|
|
|
|
let height=(imageSize && imageSize.imageHeight)?imageSize.imageHeight.toFixed(0):'';
|
|
|
|
this.setData({
|
|
|
|
[imageHeight]:height,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
preview(event){
|
|
|
|
const item = event.currentTarget.dataset['item'];
|
|
|
|
let currentUrl = item.image
|
|
|
|
wx.previewImage({
|
|
|
|
current: currentUrl, // 当前显示图片的http链接
|
|
|
|
urls: [currentUrl] // 需要预览的图片http链接列表
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
...
|
...
|
@@ -103,21 +124,6 @@ Page({ |
|
|
|
checkItem,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 获取点菜列表
|
|
|
|
getCheckCookList() {
|
|
|
|
let param = {
|
|
|
|
sellerid: this.data.options.sid,
|
|
|
|
identity: this.data.options.identity,
|
|
|
|
orderid: this.data.options.oid,
|
|
|
|
status: '0,1',
|
|
|
|
};
|
|
|
|
App.Cookbook.GetCookbookByClass(param).then(json => {
|
|
|
|
let cookbooklist = this.formatCookList(json.data[0].list)
|
|
|
|
this.setData({
|
|
|
|
cookbooklist
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 选择菜品分类
|
|
|
|
checkItem(e) {
|
|
|
|
const item = e.currentTarget.dataset['item'];
|
|
...
|
...
|
@@ -145,7 +151,7 @@ Page({ |
|
|
|
}
|
|
|
|
App.Advance.AddCart(params).then(res => {
|
|
|
|
this.closeModal()
|
|
|
|
this.getCheckCookList();
|
|
|
|
this.getCookList();
|
|
|
|
let orderItemCount = this.data.orderItemCount * 1 + 1
|
|
|
|
this.setData({
|
|
|
|
orderItemCount
|
|
...
|
...
|
@@ -196,7 +202,7 @@ Page({ |
|
|
|
identity: this.data.options.identity
|
|
|
|
}
|
|
|
|
App.Advance.AddCart(params).then(res => {
|
|
|
|
this.getCheckCookList();
|
|
|
|
this.getCookList();
|
|
|
|
let orderItemCount = this.data.orderItemCount * 1 + 1
|
|
|
|
this.setData({
|
|
|
|
orderItemCount
|
|
...
|
...
|
@@ -218,7 +224,7 @@ Page({ |
|
|
|
identity: this.data.options.identity
|
|
|
|
}
|
|
|
|
App.Advance.ReduceOrder(params).then(res => {
|
|
|
|
this.getCheckCookList();
|
|
|
|
this.getCookList();
|
|
|
|
let orderItemCount = this.data.orderItemCount * 1 - 1
|
|
|
|
this.setData({
|
|
|
|
orderItemCount
|
|
...
|
...
|
@@ -257,7 +263,6 @@ Page({ |
|
|
|
orderItemCount: orderItemCount,
|
|
|
|
checkCookbooklist: res.data.cookbooklist,
|
|
|
|
})
|
|
|
|
this.getCheckCookList();
|
|
|
|
})
|
|
|
|
},
|
|
|
|
// 过滤数据
|
|
...
|
...
|
@@ -352,6 +357,7 @@ Page({ |
|
|
|
cook.item_clear_num = item_clear_num;
|
|
|
|
cook.index = n; //分类下菜品的下标
|
|
|
|
cook.type = '1';
|
|
|
|
cook.imageHeight='';
|
|
|
|
let cook_style = cook.cook_style ? util.determine(cook.cook_style) : {
|
|
|
|
image_type: '1',
|
|
|
|
name_type: ''
|
|
...
|
...
|
@@ -467,7 +473,6 @@ Page({ |
|
|
|
isloading: false,
|
|
|
|
showSkeleton: false,
|
|
|
|
})
|
|
|
|
this.getCheckCookList()
|
|
|
|
}).catch(res => {
|
|
|
|
console.log(res);
|
|
|
|
});
|
...
|
...
|
|