Commit 9570b05422c49d6bc134b9c78b256375cd188306

Authored by yiren
1 parent b7a1b0a5

提前点餐页面

... ... @@ -100,7 +100,8 @@
"pages/cart",
"pages/success",
"pages/remark",
"pages/index_new"
"pages/index_new",
"pages/cart_new"
]
},
{
... ...
// pack-cookbook/pages/cart_new.js
Page({
/**
* 页面的初始数据
*/
data: {
options:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options);
this.setData({
options: options,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"white",
"usingComponents": {
"nav":"/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/pages/cart_new.wxml-->
<nav backgroundColor="#4d4e50" color="#fff">{{options.sellerName||'提交订单'}}</nav>
... ...
/* pack-cookbook/pages/cart_new.wxss */
\ No newline at end of file
... ...
... ... @@ -8,64 +8,27 @@ Page({
* 页面的初始数据
*/
data: {
type:'C',//样式A,B,C
type:'A',//样式A,B,C
scrollTop: 0,
check1:0,//做法
check2:0,//规格
options:{},
check1:'',//做法
check2:'',//规格
isloading: true,
toView: "",
countPirce:'',
countTotal:'',
hasEnter: false,
totalWidth: getApp().system.windowWidth,
singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2),
totalHeight: getApp().system.windowHeight,
kindHeight: getApp().system.windowHeight - 68,
hasListModel: true,
cookbooklist: [{}, {}, {}, {}, {}, {}, {},],
cookbooklist: [],
showSkeleton: true,
order: {},
orderItemCount:0,
checkObj:'',
quantum:'',
arr1:[
{
name:'香辣',
},
{
name:'清蒸',
},
{
name:'爆炒',
},
{
name:'清汤',
},
{
name:'爆炒',
},
{
name:'清汤',
},
],
arr2:[
{
name:'小份',
},
{
name:'中份',
},
{
name:'份',
},
{
name:'位',
},
{
name:'例',
},
{
name:'两只',
},
],
normsList:[
{
text:'做饭',
... ... @@ -74,29 +37,6 @@ Page({
text:'规格',
}
],
twoList:[
{
title:'烤鸽子',
info:'¥48/位 ',
vip:'会员 ¥38/位',
image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
quantum:0,
},
{
title:'烤鸽子',
info:'¥48/位 ',
vip:'会员 ¥38/位',
image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
quantum:0,
},
{
title:'烤鸽子',
info:'¥48/位 ',
vip:'会员 ¥38/位',
image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
quantum:0,
}
],
assortArr:[
{name:'淮扬热菜'},
{name:'精品凉菜'},
... ... @@ -106,34 +46,6 @@ Page({
{name:'四季时蔬'},
{name:'酒水'},
],
dishList:[
{
image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
title:'默认菜品样式A',
info:'¥168/份 会员 ¥160/份',
normsInfo:'味型:咸鲜 烹调:熬煮',
dw:'1个 (如果没有会员价,则不显示会员价)',
zs:'有图大',
quantum:1,
js:'有(菜品录入了就有,没录入就没有)',
xz:'否,只显示加号',
ggInfo:'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
gg:'菜品名称(味型/烹调)和价格在顶部分开(默认),菜品味型/烹调 录入了才有,没录入没有。'
},
{
image:'https://img.zcool.cn/community/0143e15b0239e4a801218cf4503272.jpg@3000w_1l_0o_100sh.jpg',
title:'默认菜品样式A',
info:'¥168/份 会员 ¥160/份',
normsInfo:'味型:咸鲜 烹调:熬煮',
dw:'1个 (如果没有会员价,则不显示会员价)',
zs:'有图大',
quantum:0,
js:'有(菜品录入了就有,没录入就没有)',
xz:'否,只显示加号',
ggInfo:'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
gg:'菜品名称(味型/烹调)和价格在顶部分开(默认),菜品味型/烹调 录入了才有,没录入没有。'
},
]
},
checkModal:'',
classifyModal:'',
... ... @@ -141,22 +53,23 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options: options,
})
this.getCookList();
this.initOrder();
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": options, //渠道分析
});
this.checkModal = this.selectComponent("#checkModal");
this.classifyModal = this.selectComponent("#classifyModal");
},
console.log('options',options);
this.setData({
options: options,
})
this.getCookList();
this.initOrder();
mta.Page.init({
"appID": "500667280",
"eventID": "500667287",
"statPullDownFresh": true,
"statShareApp": true,
"statReachBottom": true,
"lauchOpts": options, //渠道分析
});
this.checkModal = this.selectComponent("#checkModal");
this.classifyModal = this.selectComponent("#classifyModal");
},
/**
* 生命周期函数--监听页面初次渲染完成
... ... @@ -166,14 +79,31 @@ Page({
},
// 选择做法
checkSingle1(e){
const check1= e.currentTarget.dataset['index'];
const check1= e.currentTarget.dataset['item'];
console.log('check1',check1);
this.setData({
check1
})
},
// 已选菜单页面跳转
gotoShoppingCart(){
let arr=[]
this.data.cookbooklist.forEach(item=>{
if(item.quantum!='0'){
arr.push(item)
}
})
console.log(arr);
// wx.navigateTo({
// url: util.http_build_query({
// sellerName:this.data.options.sellerName,
// arr:[]
// }, '/pack-cookbook/pages/cart_new')
// })
},
// 选择规格
checkSingle2(e){
const check2= e.currentTarget.dataset['index'];
const check2= e.currentTarget.dataset['item'];
this.setData({
check2
})
... ... @@ -201,22 +131,35 @@ Page({
},
// 选择做法和规格后点击确定
determineFun(){
let checkObj =this.data.checkObj;
let index =this.data.checkObj.index;
let indexs =this.data.checkObj.indexs;
let quantum =this.data.quantum;
let check1 = this.data.check1;
console.log(this.data.cookbooklist[indexs].cookbooklist[0][index].arr1[check1]);
let checkObj=`cookbooklist[${indexs}].cookbooklist[0][${index}].quantum`;
let arr1=`cookbooklist[${indexs}].cookbooklist[0][${index}].arr1[${check1}]`;
let practice=`cookbooklist[${indexs}].cookbooklist[0][${index}].practice`;
this.setData({
[checkObj]:quantum,
[practice]:check1
})
console.log(this.data.check1);
console.log(this.data.cookbooklist[indexs].cookbooklist[0][index]);
this.closeModal()
},
// 点击加号
addition(e){
const item= e.currentTarget.dataset['item'];
const index= e.currentTarget.dataset['key'];
const type= e.currentTarget.dataset['type'];
const index= e.currentTarget.dataset['key'];//菜下标
const indexs= e.currentTarget.dataset['indexs'];//分类下标
let quantum = item.quantum * 1 + 1;
let checkObj;
if(type=='one') checkObj=`dishList[${index}].quantum`;
if(type=='two') checkObj=`twoList[${index}].quantum`;
console.log('index',index);
console.log('indexs',indexs);
console.log('indexs',indexs);
let checkObj={
indexs,
index
};
console.log(checkObj,quantum);
this.showModal()
this.setData({
... ... @@ -227,12 +170,10 @@ Page({
// 点击减号
subtraction(e){
const item= e.currentTarget.dataset['item'];
const index= e.currentTarget.dataset['key'];
const type= e.currentTarget.dataset['type'];
const index= e.currentTarget.dataset['key'];//菜下标
const indexs= e.currentTarget.dataset['indexs'];//分类下标
let quantum = item.quantum * 1 - 1;
let checkObj;
if(type=='one') checkObj=`dishList[${index}].quantum`;
if(type=='two') checkObj=`twoList[${index}].quantum`;
let checkObj=`cookbooklist[${indexs}].cookbooklist[${index}]`;
this.setData({
checkObj,
quantum,
... ... @@ -275,6 +216,8 @@ Page({
//十道必选菜
let has10CaiOpen = false;
let flist = [];
let check1='';
let check2='';
if (list.length > 0) {
has10CaiOpen = list[0].status == 1;
list.forEach(function (cate, i) {
... ... @@ -311,6 +254,13 @@ Page({
}
}
cook.item_clear_num = item_clear_num;
cook.quantum=0;
cook.index=n;
cook.practice='';
cook.arr1=['香辣','清蒸','爆炒','清汤'];
cook.arr2=['小份','中份','份','例','两只'];
check1=cook.arr1[0];
check2=cook.arr2[0];
if (item_clear_num == 0) {
flag = false;
}
... ... @@ -325,13 +275,19 @@ Page({
})
if (cooks.length > 0) {
//cooks 排序...
cate.cookbooklist[0] = cooks;
flist.push(cate)
}
}
})
}
setTimeout(() => {
this.setData({
check1,
check2
})
}, 1);
return flist;
},
// 获取所有分类下所有菜品列表
... ... @@ -345,6 +301,7 @@ Page({
App.Advance.GetCookbookByClass(param).then(json => {
//菜单分类添加修饰
let cookbooklist = this.formatCookList(json.data[0].list);
console.log({...cookbooklist[1].cookbooklist[0][0]});
setTimeout(() => {
this.setData({
cookbooklist: cookbooklist,
... ...
<!--pack-cookbook/pages/index_new.wxml-->
<nav backgroundColor="#4d4e50" color="#fff">{{options.seeAll||order.seller.sellername||'提前点菜'}}</nav>
<nav backgroundColor="#4d4e50" color="#fff">{{options.sellerName||'提前点菜'}}</nav>
<loading wx:if="{{isloading}}">数据加载中</loading>
<view class="wrapIine"></view>
<view wx:if="{{type=='A'}}" class="heand flex-vc flex-cc">
<view class="style_round flex-vc flex-cc">
<view class="round"></view>
<view class="line"></view>
</view>
<view class="title">10道必点菜</view>
<view class="style_round flex-vc flex-cc">
<view class="line"></view>
<view class="round"></view>
</view>
</view>
<view wx:if="{{type=='A'}}" class="wrapIine"></view>
<view class="dishWrap" wx:for="{{dishList}}" wx:key="index">
<block wx:if="{{type=='A'}}">
<view class="dishItem flex-lr">
<view class="dishLeft dishTexts">
{{item.title}}
</view>
<view class="dishTexts dishRight">
{{item.info}}
</view>
</view>
<view class="norms">
{{item.normsInfo}}
</view>
</block>
<block wx:if="{{type=='B'}}">
<view class="dishItem typeB">
<view class="dishLeft dishTexts">
{{item.title}}
</view>
<view class="dishTexts dishRight">
{{item.normsInfo}}
</view>
</view>
<view class="norms normsB">
{{item.info}}
</view>
</block>
<block wx:if="{{type=='C'}}">
<view class="dishItem">
<view class="dishLeft dishTexts">
{{item.title}}
</view>
<view class="dishTexts dishRight">
{{item.normsInfo}}
</view>
</view>
<view class="norms">
{{item.info}}
</view>
</block>
<image src="{{item.image}}" class="dishImg" mode="widthFix" />
<view class="greens">
<view class="news">
{{item.ggInfo}}
</view>
<view class="news">
<text class="Textcolor">样式说明:</text>{{item.gg}}
</view>
<view class="news">
<text class="Textcolor">售卖单位:</text>{{item.dw}}
</view>
<view class="news">
<text class="Textcolor">展示大小:</text>{{item.zs}}
</view>
<view class="news">
<text class="Textcolor">菜品介绍:</text>{{item.js}}
</view>
<view class="news">
<text class="Textcolor">是否选中:</text>{{item.xz}}
</view>
</view>
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr">
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
</view>
<view wx:else class="algorithmImg flex-lr calculate">
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="one" />
<view class="box flex-cc">
<view class="num flex-cc">
{{item.quantum}}<view>份</view>
</view>
<view class="practice">
清蒸
<block wx:for="{{cookbooklist}}" wx:key="cookbooklist-key" wx:for-index="indexs">
<view class="dishWrap">
<block wx:if="{{type=='A'}}">
<view class="heand flex-vc flex-cc">
<view class="style_round flex-vc flex-cc">
<view class="round"></view>
<view class="line"></view>
</view>
<view class="title">{{item.class_name}}</view>
<view class="style_round flex-vc flex-cc">
<view class="line"></view>
<view class="round"></view>
</view>
</view>
</view>
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="one" />
</view>
<view class="wrapIine"></view>
</view>
<view class="twoBox flex-rs">
<view class="twoItem" wx:for="{{twoList}}" wx:key="index">
<view class="twoTitle">
{{item.title}}
</view>
<view class="twoInfo">
{{item.info}}{{item.vip}}
</view>
{{item.quantum}}
<image src="{{item.image}}" mode="aspectFill" />
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr oneImg">
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
</view>
<view wx:else class="algorithmImg flex-lr twoImgs">
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-type="two" />
<view class="box flex-cc">
<view class="num flex-cc">
</block>
<block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="index">
<view class="dishWrap">
<view class="dishItem flex-lr">
<view class="dishLeft dishTexts">
{{item.name}}
</view>
<view class="dishTexts dishRight">
{{item.first_name}}
</view>
</view>
<view class="norms">
{{item.first_name}}
</view>
<block wx:if="{{type=='B'}}">
<view class="dishItem typeB">
<view class="dishLeft dishTexts">
{{item.title}}
</view>
<view class="dishTexts dishRight">
{{item.first_name}}
</view>
</view>
<view class="norms normsB">
{{item.first_name}}
</view>
</block>
<block wx:if="{{type=='C'}}">
<view class="dishItem">
<view class="dishLeft dishTexts">
{{item.title}}
</view>
<view class="dishTexts dishRight">
{{item.first_name}}
</view>
</view>
<view class="norms">
{{item.first_name}}
</view>
</block>
<image src="{{item.image}}" class="dishImg" mode="widthFix" />
<view class="greens">
<view class="news">
{{item.first_name}}
</view>
</view>
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr">
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-indexs="{{indexs}}" />
</view>
<view wx:else class="algorithmImg flex-lr calculate">
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}" data-indexs="{{indexs}}" />
<view class="box flex-cc">
<view class="num flex-cc">
{{item.quantum}}<view>份</view>
</view>
<view class="practice">
{{item.practice}}
</view>
</view>
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{indexs}}" data-indexs="{{indexs}}" />
</view>
<view class="wrapIine"></view>
<view class="twoBox flex-rs">
<!-- <view class="twoItem">
<view class="twoTitle">
{{item.title}}
</view>
<view class="twoInfo">
{{item.info}}{{item.vip}}
</view>
{{item.quantum}}
<image src="{{item.image}}" mode="aspectFill" />
<view wx:if="{{item.quantum==0}}" class="algorithmImg flex-rr oneImg">
<image src="https://qn.colorcun.com/WechatIMG696.png" class="imgs" mode="aspectFill" bindtap="addition" data-item="{{item}}" data-key="{{index}}"/>
</view>
<view wx:else class="algorithmImg flex-lr twoImgs">
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}"/>
<view class="box flex-cc">
<view class="num flex-cc">
{{item.quantum}}
</view>
</view>
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}"/>
</view>
</view> -->
</view>
</view>
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-type="two" />
</view>
</block>
</view>
</view>
<view class="fixedBox flex-lr">
<view class="left flex-cmc" bindtap="showClassifyModal">
<image src="https://qn.colorcun.com/WechatIMG700.png" mode="" />
<view class="fixedName">
菜品分类
<view class="fixedBox flex-lr">
<view class="left flex-cmc" bindtap="showClassifyModal">
<image src="https://qn.colorcun.com/WechatIMG700.png" mode="" />
<view class="fixedName">
菜品分类
</view>
</view>
</view>
<view class="right flex-cmc">
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
已选菜品
<view class="right flex-cmc" bindtap="gotoShoppingCart">
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
已选菜品
</view>
</view>
</view>
</view>
</block>
<my-modal id="checkModal" height="410px" fadeStyle="center">
<view slot="modalContent" class="normsModel">
<scroll-view scroll-y style="height: 78%;overflow: auto;">
<view class="textSty">
做法
</view>
<view class="itemBox">
<view class="single {{check1==index?'active':''}}" bindtap="checkSingle1" wx:for="{{arr1}}" data-index="{{index}}">
{{item.name}}</view>
</view>
<view class="checkLine"></view>
<view class="textSty">
规格
</view>
<view class="itemBox">
<view class="single {{check2==index?'active':''}}" bindtap="checkSingle2" wx:for="{{arr2}}" data-index="{{index}}">{{item.name}}</view>
<block wx:for="{{cookbooklist}}" wx:key="cookbooklist-key" wx:for-index="indexs">
<block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="index">
<view slot="modalContent" class="normsModel">
<scroll-view scroll-y style="height: 78%;overflow: auto;">
<view class="textSty">
做法
</view>
<view class="itemBox">
<view class="single {{check1==item?'active':''}}" bindtap="checkSingle1" wx:for="{{item.arr1}}" data-item="{{item}}">
{{item}}</view>
</view>
<view class="checkLine"></view>
<view class="textSty">
规格
</view>
<view class="itemBox">
<view class="single {{check2==item?'active':''}}" bindtap="checkSingle2" wx:for="{{item.arr2}}" data-item="{{item}}">{{item}}</view>
</view>
</scroll-view>
<view class="btns">
<button class="font32r cancellation btn" bindtap="closeModal">取消</button>
<button class="font32r determine btn" bindtap="determineFun">确定</button>
</view>
</view>
</scroll-view>
<view class="btns">
<button class="font32r cancellation btn" bindtap="closeModal">取消</button>
<button class="font32r determine btn" bindtap="determineFun">确定</button>
</view>
</view>
</block>
</block>
</my-modal>
<my-modal id="classifyModal" fadeStyle="slideDown" height="100%">
<view slot="modalContent" class="assortModel">
... ... @@ -162,6 +156,6 @@
<view wx:for="{{assortArr}}" class="assortItem font48r" data-item="{{item}}" bindtap="checkItem">
{{item.name}}
</view>
<image class="assortImg" bindtap="closeClassifyModal" src="https://qn.colorcun.com/WechatIMG807.png" mode=""/>
<image class="assortImg" bindtap="closeClassifyModal" src="https://qn.colorcun.com/WechatIMG807.png" mode="" />
</view>
</my-modal>
\ No newline at end of file
... ...
... ... @@ -74,9 +74,6 @@ page {
font-size: 24rpx;
}
.Textcolor {
color: #EBDD3C;
}
.algorithmImg {
height: 60rpx;
... ...
... ... @@ -212,8 +212,9 @@ Page({
rid: this.id,
oid: res.data.id,
identity: 1,
sid: res.data.sellerid
}, '/pack-cookbook/pages/index')
sid: res.data.sellerid,
sellerName:this.data.seller.name
}, '/pack-cookbook/pages/index_new')
});
})
}
... ...