Commit 81076b4198eed237a8527f659a44e9e79925778f

Authored by yiren
1 parent 9570b054

提前点餐流程页面

... ... @@ -101,7 +101,8 @@
"pages/success",
"pages/remark",
"pages/index_new",
"pages/cart_new"
"pages/cart_new",
"pages/success_new"
]
},
{
... ...
// pack-cookbook/pages/cart_new.js
Page({
/**
* 页面的初始数据
*/
data: {
options:{},
checkList: [],
sellerName: '',
probablyPrice: '',
sellerid: '',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options);
this.setData({
options: options,
checkList: JSON.parse(options.arr),
sellerName: options.sellerName,
sellerid: options.sellerid
})
console.log(this.data.checkList);
let probablyPrice = 0;
this.data.checkList.forEach(items => {
items.arr.forEach(item => {
let price = item.quantum * 1 * (item.price * 1)
probablyPrice += price
})
})
this.setData({
probablyPrice
})
},
determineFun() {
console.log('sellerid', this.data.sellerid);
wx.navigateTo({
url: `/pack-cookbook/pages/success_new?arr=${JSON.stringify(this.data.checkList)}&sellerName=${this.data.sellerName}&sellerid=${this.data.sellerid}`,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ...
<!--pack-cookbook/pages/cart_new.wxml-->
<nav backgroundColor="#4d4e50" color="#fff">{{options.sellerName||'提交订单'}}</nav>
<nav backgroundColor="#4d4e50" color="#fff">{{sellerName||'提交订单'}}</nav>
<scroll-view class="main">
<view class="info flex-lr">
<view class="texts font28r">就餐时间:</view>
<view class="texts_right font28r">2023年4月18日 午餐</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">桌位台号:</view>
<view class="texts_right font28r">二楼包间 南京</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">就餐人数:</view>
<view class="texts font28r">8</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">备注信息:</view>
<input type="text" placeholder="点击录入口味,偏好等要求" placeholder-style="color:#fff" />
</view>
<view class="line"></view>
<view class="checkMenu">
<block wx:for="{{checkList}}" wx:key="{{item.id}}" wx:for-index="indexs">
<view class="title flex-lr">
<view class="leftTitle">{{item.class_name}}</view>
<view class="rightTitle">{{item.arr.length}}道</view>
</view>
<view class="content flex-lr" wx:for="{{item.arr}}" wx:key="{{item.id}}" wx:for-index="index">
<view class="single">{{item.name}}<text>({{item.practice}})</text></view>
<view class="price">{{item.price}}元/{{item.unit}}</view>
<view class="count">
<image src="https://qn.colorcun.com/WechatIMG809.png" class="img1" mode="" />
{{item.quantum}}
<image src="https://qn.colorcun.com/WechatIMG810.png" class="img2" mode="" />
</view>
</view>
</block>
</view>
<view class="probably">预计金额:{{probablyPrice}}元</view>
</scroll-view>
<view class="btns flex-cc">
<button class="font32r continue flex-cc" bindtap="continueOrdering">继续点菜</button>
<button class="font32r determine flex-cc" bindtap="determineFun">确认下单</button>
</view>
\ No newline at end of file
... ...
/* pack-cookbook/pages/cart_new.wxss */
\ No newline at end of file
/* pack-cookbook/pages/cart_new.wxss */
page {
background: #4d4e50;
}
.main {
padding: 0 20rpx 148rpx 20rpx;
font-family: PingFang SC;
width: 100%;
box-sizing: border-box;
}
.info {
margin-bottom: 16rpx;
}
.texts {
color: #ffffff;
font-weight: 500;
}
.texts_right {
color: #999999;
font-weight: 500;
}
.info input {
color: #fff;
text-align: right;
flex: 1;
margin-left: 20rpx;
font-size: 28rpx;
}
.line {
margin-bottom: 8rpx;
height: 2rpx;
background: #999999;
}
.checkMenu {
border-radius: 10rpx;
background: #ffffff;
padding: 0 40rpx;
}
.title {
padding: 36rpx 0 4rpx 0;
border-bottom: 2rpx solid #DBDBDB;
}
.leftTitle {
color: #515151;
font-family: PingFang SC;
font-weight: 600;
font-size: 32rpx;
}
.rightTitle {
color: #515151;
font-family: PingFang SC;
font-size: 28rpx;
}
.content {
padding: 20rpx 0;
}
.count text {
font-weight: bold;
color: #515151;
}
.img1 {
width: 28rpx;
height: 24rpx;
}
.img2 {
width: 24rpx;
height: 24rpx;
}
.probably {
color: #999;
margin-top: 36rpx;
}
.btns {
width: 100%;
position: fixed;
bottom: 0;
height: 128rpx;
z-index: 10;
}
.btns button {
width: 50%;
box-sizing: border-box;
color: #fff;
height: 100%;
border-radius: 0;
}
.continue {
background: #4d4e50;
border: 2rpx solid #094ba4;
}
.determine {
background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
}
\ No newline at end of file
... ...
... ... @@ -4,358 +4,385 @@ import util from '../../utils/util';
import App from '../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
type:'A',//样式A,B,C
scrollTop: 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: [],
showSkeleton: true,
order: {},
orderItemCount:0,
checkObj:'',
quantum:'',
normsList:[
{
text:'做饭',
},
{
text:'规格',
}
],
assortArr:[
{name:'淮扬热菜'},
{name:'精品凉菜'},
{name:'广式烧腊'},
{name:'海鲜'},
{name:'汤羹'},
{name:'四季时蔬'},
{name:'酒水'},
],
},
checkModal:'',
classifyModal:'',
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
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");
},
/**
* 页面的初始数据
*/
data: {
type: 'A', //样式A,B,C
scrollTop: 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: [],
checkItem: {},
showSkeleton: true,
order: {},
orderItemCount: 0,
checkObj: '',
quantum: '',
normsList: [{
text: '做饭',
},
{
text: '规格',
}
],
assortArr: [],
},
checkModal: '',
classifyModal: '',
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
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");
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
// 选择做法
checkSingle1(e){
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)
},
// 选择做法
checkSingle1(e) {
const check1 = e.currentTarget.dataset['item'];
this.setData({
check1
})
},
// 已选菜单页面跳转
gotoShoppingCart() {
let arr = [];
this.data.cookbooklist.forEach(item => {
let obj = {
class_name: item.class_name,
id: item.id,
status: item.status,
class_type: item.class_type,
arr: [],
}
item.cookbooklist[0].forEach(i => {
if (i.quantum != '0') {
obj.arr.push(i)
}
})
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['item'];
this.setData({
check2
})
},
// 展示做法规格弹窗
showModal() {
this.checkModal.showModal()
},
// 关闭做法规格弹窗
closeModal() {
this.checkModal.closeModal()
},
// 展示菜品分类弹框
showClassifyModal() {
this.classifyModal.showModal()
},
// 关闭菜品分类弹框
closeClassifyModal() {
this.classifyModal.closeModal()
},
// 选择菜品分类
checkItem(e){
const item= e.currentTarget.dataset['item'];
console.log(item);
},
// 选择做法和规格后点击确定
determineFun(){
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 indexs= e.currentTarget.dataset['indexs'];//分类下标
let quantum = item.quantum * 1 + 1;
console.log('index',index);
console.log('indexs',indexs);
console.log('indexs',indexs);
let checkObj={
arr.push(obj)
})
console.log(arr);
let sellerName = this.data.options.sellerName
wx.navigateTo({
url: `/pack-cookbook/pages/cart_new?arr=${JSON.stringify(arr)}&sellerName=${sellerName}&sellerid=${this.data.options.sid}`,
})
},
// 选择规格
checkSingle2(e) {
const check2 = e.currentTarget.dataset['item'];
this.setData({
check2
})
},
// 展示做法规格弹窗
showModal() {
console.log(this.data.checkItem);
this.checkModal.showModal()
},
// 关闭做法规格弹窗
closeModal() {
this.checkModal.closeModal()
},
// 展示菜品分类弹框
showClassifyModal() {
this.classifyModal.showModal()
},
// 关闭菜品分类弹框
closeClassifyModal() {
this.classifyModal.closeModal()
},
// 选择菜品分类
checkItem(e) {
const item = e.currentTarget.dataset['item'];
console.log(item);
},
// 选择做法和规格后点击确定
determineFun() {
let index = this.data.checkObj.index;
let indexs = this.data.checkObj.indexs;
let quantum = this.data.quantum;
let check1 = this.data.check1;
let check2 = this.data.check2;
let checkObj = `cookbooklist[${indexs}].cookbooklist[0][${index}].quantum`;
let practice = `cookbooklist[${indexs}].cookbooklist[0][${index}].practice`;
let unit = `cookbooklist[${indexs}].cookbooklist[0][${index}].unit`;
this.setData({
[checkObj]: quantum,
[practice]: check1,
[unit]: check2,
})
console.log('cookbooklist', this.data.cookbooklist);
this.closeModal()
},
// 点击加号
addition(e) {
const item = e.currentTarget.dataset['item'];
const index = e.currentTarget.dataset['key']; //菜下标
const indexs = e.currentTarget.dataset['indexs']; //分类下标
let quantum = item.quantum * 1 + 1;
this.setData({
checkObj: {
indexs,
index,
},
quantum,
checkItem: item
})
console.log('index', index);
console.log('indexs', indexs);
console.log('checkItem', this.data.checkItem);
this.showModal()
},
// 点击减号
subtraction(e) {
const item = e.currentTarget.dataset['item'];
const index = e.currentTarget.dataset['key']; //菜下标
const indexs = e.currentTarget.dataset['indexs']; //分类下标
let quantum = item.quantum * 1 - 1;
console.log('index', index);
console.log('indexs', indexs);
let quantumObj = `cookbooklist[${indexs}].cookbooklist[0][${index}].quantum`;
let practice = `cookbooklist[${indexs}].cookbooklist[0][${index}].practice`;
let unit = `cookbooklist[${indexs}].cookbooklist[0][${index}].unit`;
this.setData({
checkObj: {
indexs,
index
};
console.log(checkObj,quantum);
this.showModal()
},
quantum,
[quantumObj]: quantum,
[practice]: this.data.check1,
[unit]: this.data.check2,
})
},
// 扫桌码点餐
initOrder() {
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity: this.data.options.identity,
status: '0,1',
openid: getApp().openid,
}).then(res => {
let orderItemCount = 0;
res.data.cookbooklist.forEach(cb => {
if (this.data.options.identity == 1 && cb.status > 0) {
wx.redirectTo({
url: util.http_build_query({
rid: this.data.options.rid,
oid: res.data.id,
identity: 1,
sellerid: this.data.options.sid,
}, '/pack-cookbook/pages/success')
});
return false;
}
orderItemCount += parseInt(cb.num)
})
this.setData({
checkObj,
quantum,
[`options.oid`]: res.data.id,
order: res.data,
orderItemCount: orderItemCount,
})
},
// 点击减号
subtraction(e){
const item= e.currentTarget.dataset['item'];
const index= e.currentTarget.dataset['key'];//菜下标
const indexs= e.currentTarget.dataset['indexs'];//分类下标
let quantum = item.quantum * 1 - 1;
let checkObj=`cookbooklist[${indexs}].cookbooklist[${index}]`;
this.setData({
checkObj,
quantum,
})
},
// 扫桌码点餐
initOrder() {
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity: this.data.options.identity,
status: '0,1',
openid: getApp().openid,
}).then(res => {
let orderItemCount = 0;
res.data.cookbooklist.forEach(cb => {
if (this.data.options.identity == 1 && cb.status > 0) {
wx.redirectTo({
url: util.http_build_query({
rid: this.data.options.rid,
oid: res.data.id,
identity: 1
}, '/pack-cookbook/pages/success')
});
return false;
}
orderItemCount += parseInt(cb.num)
})
this.setData({
[`options.oid`]: res.data.id,
order: res.data,
orderItemCount: orderItemCount,
})
})
},
formatCookList(list){
//原栏目下显示
let hasShowClass = false;
//菜单中展示沽清的菜品
let hasClearCookbook = false;
//十道必选菜
let has10CaiOpen = false;
let flist = [];
let check1='';
let check2='';
if (list.length > 0) {
has10CaiOpen = list[0].status == 1;
list.forEach(function (cate, i) {
if (cate.status == 1 && cate.cookbooklist[0].length > 0) {
let cooks = [];
//let cooks_order=[];
cate.cookbooklist[0].forEach(function (cook, n) {
if (cook.status == 1) {
let flag = true;
if (has10CaiOpen) {
if (cate.class_type == 2 && !hasShowClass && flist.length > 0 && flist[0].class_type == 1) {
for (let fi = 0; fi < flist[0].cookbooklist[0].length; fi++) {
if (flist[0].cookbooklist[0][fi].id == cook.id) {
flag = false;
break;
}
})
},
formatCookList(list) {
//原栏目下显示
let hasShowClass = false;
//菜单中展示沽清的菜品
let hasClearCookbook = false;
//十道必选菜
let has10CaiOpen = false;
let flist = [];
let assortArr = [];
let check1 = '';
let check2 = '';
if (list.length > 0) {
has10CaiOpen = list[0].status == 1;
list.forEach(function (cate, i) {
let obj = {
class_name: cate.class_name,
class_type: cate.class_type,
id: cate.id,
order: cate.order,
status: cate.status,
}
assortArr.push(obj)
if (cate.status == 1 && cate.cookbooklist[0].length > 0) {
let cooks = [];
//let cooks_order=[];
cate.cookbooklist[0].forEach(function (cook, n) {
if (cook.status == 1) {
let flag = true;
if (has10CaiOpen) {
if (cate.class_type == 2 && !hasShowClass && flist.length > 0 && flist[0].class_type == 1) {
for (let fi = 0; fi < flist[0].cookbooklist[0].length; fi++) {
if (flist[0].cookbooklist[0][fi].id == cook.id) {
flag = false;
break;
}
}
}
cook.item_clear_num = cook.clear_num;
if (!hasClearCookbook) {//不显示卖光了
let item_clear_num = cook.clear_num;
if (cook.spec) {
let clear_num = null;
cook.spec.forEach(spec => {
if (spec.clear_num == 0) {
clear_num = 0;
} else {
clear_num = null;
}
})
if (clear_num == 0) {
item_clear_num = 0;
}
cook.item_clear_num = cook.clear_num;
if (!hasClearCookbook) { //不显示卖光了
let item_clear_num = cook.clear_num;
if (cook.spec) {
let clear_num = null;
cook.spec.forEach(spec => {
if (spec.clear_num == 0) {
clear_num = 0;
} else {
clear_num = null;
}
}
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;
})
if (clear_num == 0) {
item_clear_num = 0;
}
}
if (flag) {
cooks.push(cook);
//cooks_order.push(cook.order_o);
cook.item_clear_num = item_clear_num;
cook.quantum = 0; //选择的数量
cook.index = n; //分类下菜品的下标
cook.practice = ''; //做法
cook.unit = ''; //规格
// let type;//模拟种类 1为一行显示1个 2为一行显示2个
// if(n=='0' || n=='3'){
// type='1'
// }else{
// type='2'
// }
cook.type = '1';
cook.arr1 = ['香辣', '清蒸', '爆炒', '清汤'];
cook.arr2 = ['小份', '中份', '份', '例', '两只'];
check1 = cook.arr1[0];
check2 = cook.arr2[0];
if (item_clear_num == 0) {
flag = false;
}
}
})
if (cooks.length > 0) {
//cooks 排序...
cate.cookbooklist[0] = cooks;
flist.push(cate)
if (flag) {
cooks.push(cook);
//cooks_order.push(cook.order_o);
}
}
})
if (cooks.length > 0) {
//cooks 排序...
cate.cookbooklist[0] = cooks;
flist.push(cate)
}
})
}
}
})
}
setTimeout(() => {
this.setData({
check1,
check2,
assortArr
})
}, 1);
console.log('flist', flist);
return flist;
},
// 获取所有分类下所有菜品列表
getCookList(orderid) {
let param = {
sellerid: this.data.options.sid,
identity: this.data.options.identity,
orderid: this.data.options.oid,
status: '0,1',
};
App.Advance.GetCookbookByClass(param).then(json => {
//菜单分类添加修饰
let cookbooklist = this.formatCookList(json.data[0].list);
setTimeout(() => {
this.setData({
check1,
check2
cookbooklist: cookbooklist,
countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0,
countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0,
isloading: false,
showSkeleton: false,
})
}, 1);
return flist;
},
// 获取所有分类下所有菜品列表
getCookList(orderid) {
let param = {
sellerid: this.data.options.sid,
identity: this.data.options.identity,
orderid : this.data.options.oid,
status:'0,1',
};
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,
countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0,
countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0,
isloading: false,
showSkeleton: false,
})
}, 0)
}).catch(res => {
console.log('getCookList-catch', res);
this.selectComponent("#network").show('网络不给力,请检查网络后重试');
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
}, 0)
},
}).catch(res => {
this.selectComponent("#network").show('网络不给力,请检查网络后重试');
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
}
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
... ...
... ... @@ -18,143 +18,107 @@
</view>
</block>
<block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="index">
<view class="dishWrap">
<view wx:if="{{item.type=='1'}}" 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 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 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 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" />
<image src="{{item.image}}" class="dishImg" mode="aspectFill" />
<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 class="news">{{item.first_name}}</view>
</view>
<view wx:else class="algorithmImg flex-lr calculate">
<view wx:if="{{item.quantum!=0}}" 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}}
{{item.quantum}}<view>{{item.unit}}</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}}" />
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-indexs="{{indexs}}" />
</view>
<view 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 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}}
</view>
<view wx:else class="twoBox flex-rs">
<view class="twoItem">
<view class="twoTitle">{{item.name}}</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}}"/>
<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 twoImgs">
<image src="https://qn.colorcun.com/WechatIMG697.png" mode="aspectFill" class="reduceImg" bindtap="subtraction" data-item="{{item}}" data-key="{{index}}"/>
<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 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}}"/>
<image src="https://qn.colorcun.com/WechatIMG696.png" mode="aspectFill" class="imgs" bindtap="addition" data-item="{{item}}" data-key="{{index}}" data-indexs="{{indexs}}" />
</view>
</view> -->
</view>
</view>
</block>
</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>
</block>
<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 class="right flex-cmc" bindtap="gotoShoppingCart">
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
已选菜品
</view>
</view>
<view class="right flex-cmc" bindtap="gotoShoppingCart">
<image src="https://qn.colorcun.com/WechatIMG701.png" mode="" />
<view class="fixedName">
已选菜品
</view>
</view>
</block>
</view>
<my-modal id="checkModal" height="410px" fadeStyle="center">
<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 slot="modalContent" class="normsModel">
<scroll-view scroll-y style="height: 78%;overflow: auto;">
<view class="textSty">做法</view>
<view class="itemBox">
<block wx:for="{{checkItem.arr1}}">
<view class="single {{check1==item?'active':''}}" data-item="{{item}}" bindtap="checkSingle1">
{{item}}</view>
</block>
</view>
</block>
</block>
<view class="checkLine"></view>
<view class="textSty">规格</view>
<view class="itemBox">
<view class="single {{check2==item?'active':''}}" bindtap="checkSingle2" wx:for="{{checkItem.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>
</my-modal>
<my-modal id="classifyModal" fadeStyle="slideDown" height="100%">
<view slot="modalContent" class="assortModel">
<view class="assortItem items font48r">
10道必点菜
</view>
<!-- underline -->
<view wx:for="{{assortArr}}" class="assortItem font48r" data-item="{{item}}" bindtap="checkItem">
{{item.name}}
{{item.class_name}}
</view>
<image class="assortImg" bindtap="closeClassifyModal" src="https://qn.colorcun.com/WechatIMG807.png" mode="" />
</view>
... ...
/* pack-cookbook/pages/index_new.wxss */
page {
background-color: #4d4e50;
width: 100%;
height: 100vh;
display: block;
overflow-y: auto;
/* 重点 */
overflow-x: hidden;
box-sizing: border-box;
}
.wrapIine {
... ... @@ -65,6 +72,7 @@ page {
.dishImg {
width: 100%;
height: calc(100vw * 0.67) !important;
}
.greens {
... ... @@ -294,6 +302,7 @@ page {
flex-direction: column;
align-items: center;
padding-top: 20%;
position: relative;
background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
}
... ... @@ -304,11 +313,13 @@ page {
padding: 30rpx 0;
}
.items {
.underline {
text-decoration: underline;
}
.assortImg {
position: absolute !important;
bottom: 30%;
margin-top: 30rpx;
width: 100rpx;
height: 100rpx;
... ...
// pack-cookbook/pages/success_new.js
import App from '../../utils/api';
Page({
/**
* 页面的初始数据
*/
data: {
checkList: [],
sellerName: '',
sellerid: '',
probablyPrice: '',
marketing: {},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('options', options);
this.setData({
checkList: JSON.parse(options.arr),
sellerName: options.sellerName,
sellerid: options.sellerid,
})
console.log(this.data.checkList);
let probablyPrice = 0;
this.data.checkList.forEach(items => {
items.arr.forEach(item => {
let price = item.quantum * 1 * (item.price * 1)
probablyPrice += price
})
})
this.setData({
probablyPrice
})
this.getSellerTemplateConfFun()
},
determineFun() {
wx.navigateTo({
url: `/pack-cookbook/pages/success_new?arr=${JSON.stringify(this.data.checkList)}&sellerName=${this.data.sellerName}`,
})
},
getSellerTemplateConfFun(sid) {
console.log(sid, 'sidsidsidsid');
App.Seller.GetSellerTemplateConf({
sid: this.data.sellerid
}).then(res => {
let data = res.data
console.log('data', data);
let marketing, coupon_data, priceInfo, scoreInfo, recharge_list, stringifyUse;
marketing = data.marketing ? JSON.parse(data.marketing) : '';
console.log('marketing', marketing);
if (marketing.coupon_data) {
coupon_data = marketing.coupon_data;
stringifyUse = JSON.stringify(marketing.coupon_data.use)
}
console.log('coupon_data', coupon_data);
console.log('stringifyUse', stringifyUse);
if (marketing.is_recharge == '1' && marketing.recharge_data) {
let recharge_data = marketing.recharge_data
recharge_list = marketing.recharge_data.recharge_list
if (recharge_list.is_price == '1') priceInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.price + '元余额';
if (recharge_list.is_score == '1') scoreInfo = '会员充值满' + recharge_data.recharge_money + '元赠送' + recharge_list.score + '积分';
console.log('scoreInfo', scoreInfo);
console.log('priceInfo', priceInfo);
this.setData({
recharge_data: marketing.recharge_data
})
console.log('recharge_data', recharge_data);
}
this.setData({
coupon_data,
stringifyUse
})
// is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示
if (marketing.is_coupon == '1' && coupon_data && (!coupon_data.use.is_cash || coupon_data.use.is_cash == '1')) {
let cash = coupon_data.use.cash;
let price = coupon_data.price * 1;
let discount = ((price / cash) * 10).toFixed(2);
console.log('cash', cash);
console.log('price', price);
console.log('discount', discount);
this.setData({
discount
})
}
this.setData({
marketing,
priceInfo,
scoreInfo
})
}).catch(res => {
console.log('GetSellerTemplateConf请求失败');
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
... ...
{
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#4d4e50",
"navigationBarTextStyle": "white",
"usingComponents": {
"nav": "/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/pages/success_new.wxml-->
<nav backgroundColor="#4d4e50" color="#fff">{{sellerName||'提交订单'}}</nav>
<scroll-view class="main">
<view class="info flex-lr">
<view class="texts font28r">就餐时间:</view>
<view class="texts_right font28r">2023年4月18日 午餐</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">桌位台号:</view>
<view class="texts_right font28r">二楼包间 南京</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">就餐人数:</view>
<view class="texts font28r">8</view>
</view>
<view class="info flex-lr">
<view class="texts font28r">备注信息:</view>
<input type="text" placeholder="点击录入口味,偏好等要求" placeholder-style="color:#fff" />
</view>
<view class="line"></view>
<view class="checkMenu">
<block wx:for="{{checkList}}" wx:key="{{item.id}}" wx:for-index="indexs">
<view class="title flex-lr">
<view class="leftTitle">{{item.class_name}}</view>
<view class="rightTitle">{{item.arr.length}}道</view>
</view>
<view class="content flex-lr" wx:for="{{item.arr}}" wx:key="{{item.id}}" wx:for-index="index">
<view class="single">{{item.name}}<text>({{item.practice}})</text></view>
<view class="price">{{item.price}}元/{{item.unit}}</view>
<view class="count">
<image src="https://qn.colorcun.com/WechatIMG809.png" class="img1" mode="" />
{{item.quantum}}
<image src="https://qn.colorcun.com/WechatIMG810.png" class="img2" mode="" />
</view>
</view>
</block>
<view class="probably flex-ll">
<view class="tariff font24r">预计金额:<text class="font32r">{{probablyPrice}}</text>元</view>
<view class="tariff font24r">会员价:<text class="font32r">{{probablyPrice}}</text>元</view>
</view>
<view class="information font36r">特别优惠</view>
<view class="poop font24r">根据您选择的菜品,我们推荐您参加以下活动,本次消费可用,预计可以节约大笔开销!</view>
<view class="preferential" wx:if="{{marketing && (marketing.is_coupon=='1' || marketing.is_recharge=='1')}}">
<view class="rubric rubric1">
特别优惠
</view>
<view class="preferentialItems" wx:if="{{marketing && marketing.is_coupon=='1' && dataStr<(coupon_data.etime*1)}}">
<view class="left">
<view class="top">
<text>{{coupon_data.aname}}</text>
<text class="price" wx:if="{{coupon_data.price}}">¥{{coupon_data.price}}</text>
<!-- is_cash 代金券 is_discount折扣券 is_dish菜品券 只有代金券有几折显示 -->
<text wx:if="{{discount!='0.00' && (coupon_data.use.is_cash=='1' || coupon_data.use.is_cash)}}" class="discount">{{discount}}折</text>
</view>
<view wx:if="{{coupon_data.exp_date.is_week=='1' || coupon_data.exp_date.is_week===true}}" class="bottom">
{{coupon_data.exp_date.week_show?coupon_data.exp_date.week_show+'可用':''}}{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_none=='1' || coupon_data.exp_date.is_none===true}}" class="bottom">
无限制{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
<view wx:if="{{coupon_data.exp_date.is_birthday=='1' || coupon_data.exp_date.is_birthday===true}}" class="bottom">
会员生日当天可用{{coupon_data.desc?','+coupon_data.desc+'。':'。'}}
</view>
</view>
<navigator url="/pack-activity/pack/buyCoupon?id={{coupon_data.id}}&name={{seller.name}}&use={{stringifyUse}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
<view class="font24r orderingFood">
去抢购
</view>
</navigator>
</view>
<!-- 当前日期要大于限制结束日期 -->
<view class="preferentialItems" wx:if="{{marketing && marketing.is_recharge=='1' && recharge_data && (is_fix!='1' || (is_fix=='1' && dataStr<(recharge_data.exp_date.fix_edate*1)))}}">
<view class="left">
<view class="top">
<text>{{recharge_data.rname}}</text>
</view>
<view class="bottom" wx:if="{{priceInfo}}">
{{priceInfo}}{{(recharge_data.recharge_list.is_coupons=='0' && recharge_data.recharge_list.is_score=='0')?'。':';'}}
</view>
<view class="bottom" wx:if="{{scoreInfo}}">
{{scoreInfo}}{{recharge_data.recharge_list.is_coupons=='0'?'。':';'}}
</view>
<view class="bottom" wx:if="{{recharge_data.recharge_list.is_coupons=='1'}}">
{{recharge_data.recharge_list.is_coupons=='1'?'会员充值满'+marketing.recharge_data.recharge_money+'元赠送优惠券':''}}。
</view>
</view>
<navigator url="/pack-activity/pack/vipRecharge?id={{recharge_data.id}}&name={{seller.name}}&sid={{seller.sid}}&oid={{detail.id}}" hover-class="navigator-hover">
<view class="font24r orderingFood">
去充值
</view>
</navigator>
</view>
</view>
</view>
</scroll-view>
<view class="btns flex-cc">
<button class="font32r continue flex-cc" bindtap="continueOrdering">继续点菜</button>
<button class="font32r determine flex-cc" bindtap="determineFun">确认下单</button>
</view>
\ No newline at end of file
... ...
/* pack-cookbook/pages/success_new.wxss */
page {
background: #4d4e50;
}
.main {
padding: 0 20rpx 148rpx 20rpx;
font-family: PingFang SC;
width: 100%;
box-sizing: border-box;
}
.info {
margin-bottom: 16rpx;
}
.texts {
color: #ffffff;
font-weight: 500;
}
.texts_right {
color: #999999;
font-weight: 500;
}
.info input {
color: #fff;
text-align: right;
flex: 1;
margin-left: 20rpx;
font-size: 28rpx;
}
.line {
margin-bottom: 8rpx;
height: 2rpx;
background: #999999;
}
.checkMenu {
border-radius: 10rpx;
background: #ffffff;
}
.title {
padding: 36rpx 0 4rpx 0;
margin: 0 40rpx;
border-bottom: 2rpx solid #DBDBDB;
}
.leftTitle {
color: #515151;
font-family: PingFang SC;
font-weight: 600;
font-size: 32rpx;
}
.rightTitle {
color: #515151;
font-family: PingFang SC;
font-size: 28rpx;
}
.content {
padding: 20rpx 40rpx;
}
.count text {
font-weight: bold;
color: #515151;
}
.img1 {
width: 28rpx;
height: 24rpx;
}
.img2 {
width: 24rpx;
height: 24rpx;
}
.probably {
border-top: 2rpx solid #DBDBDB;
color: #515151;
font-family: PingFang SC;
padding: 30rpx 40rpx 52rpx 40rpx;
}
.tariff {
width: 50%;
}
.btns {
width: 100%;
position: fixed;
bottom: 0;
height: 128rpx;
z-index: 10;
}
.btns button {
width: 50%;
box-sizing: border-box;
color: #fff;
height: 100%;
border-radius: 0;
}
.information {
color: #515151;
font-weight: 500;
margin: 0 40rpx;
}
.continue {
background: #4d4e50;
border: 2rpx solid #094ba4;
}
.poop {
margin: 20rpx 40rpx;
}
.determine {
background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
}
.orderingFood {
padding: 4rpx 20rpx;
color: #fff;
border-radius: 22rpx;
text-align: center;
background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
margin: 20rpx 0;
line-height: 50rpx;
height: 50rpx;
}
.preferential {
margin: 16rpx 40rpx;
}
.preferentialItems {
border: 2rpx solid #DBDBDB;
border-radius: 16rpx;
padding: 16rpx 16rpx 16rpx 24rpx;
margin-bottom: 20rpx;
display: flex;
justify-content: space-between;
}
.rubric1 {
margin: 30rpx 0;
}
.left {
flex: 1;
margin-right: 20rpx;
}
.top {
display: flex;
width: 100%;
align-items: center;
}
.bottom {
margin-top: 20rpx;
color: #515151;
font-family: PingFang SC;
font-weight: 500;
font-size: 20rpx;
display: -webkit-box;
word-break: break-all;
word-wrap: break-word;
overflow: hidden;
text-align: left;
}
.top text:nth-of-type(1) {
font-size: 30rpx;
font-weight: 600;
}
.top .discount {
padding: 0 10rpx;
color: #E34D59;
border: 2rpx solid #E34D59;
border-radius: 6rpx;
margin: 0 10rpx 0 20rpx;
font-family: PingFang SC;
font-size: 14rpx;
height: 30rpx;
line-height: 30rpx;
}
.top .price {
color: #E34D59;
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,7 @@
.blueTitleImg {
background: #0143A3;
}
.greenTitleImg {
background: #438E93;
}
... ... @@ -160,9 +161,11 @@
height: 110rpx;
justify-content: space-between;
}
.handlePhone{
.handlePhone {
height: 100rpx;
}
.brownFont {
padding: 4rpx 16rpx;
color: #0143A3;
... ... @@ -178,9 +181,11 @@
.handle text {
margin-bottom: 20rpx;
}
.handle text:nth-of-type(2){
.handle text:nth-of-type(2) {
margin-bottom: 0;
}
.positioning {
margin: 16rpx 26rpx;
display: flex;
... ... @@ -238,10 +243,12 @@
.imgMask {
position: relative;
}
.imgMask image{
height: calc(100vw * 353/430) !important;
.imgMask image {
height: calc(100vw * 0.82) !important;
margin-bottom: 18rpx;
}
.introduce .chief {
top: 0;
left: 0;
... ... @@ -287,9 +294,11 @@
-webkit-line-clamp: 10;
padding-left: 20rpx;
}
.labelBox2 .label {
height: 400rpx;
}
.labelBox .styleLabel {
color: #999999;
}
... ... @@ -305,9 +314,11 @@
.labelBox1 .line {
margin: 0 0 0 16rpx;
}
.labelBox .line1{
.labelBox .line1 {
margin: 0 0 0 16rpx;
}
.IntroductionItems image {
width: 100%;
display: block;
... ... @@ -343,9 +354,11 @@
text-align: right;
box-sizing: border-box;
}
.famousChefBox .styleSeparate2 image{
.famousChefBox .styleSeparate2 image {
width: 100%;
}
.vegetableBox .IntroduceColor {
top: 0;
right: 0;
... ... @@ -591,23 +604,28 @@
background: linear-gradient(104.24deg, #4c8dad -57.47%, #0143a3 55.72%, #42a5ff 148.72%);
color: #fff;
}
.sharewidth .shareItem{
.sharewidth .shareItem {
width: 100% !important;
}
.between .shareItem{
.between .shareItem {
width: 65% !important;
}
.book-item-font {
width: 40% !important;
}
.menu-item{
.menu-item {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
justify-content: center;
align-items: center;
}
.cook{
.cook {
height: 100% !important;
background: linear-gradient(104.24deg, rgba(76, 141, 173, 1) -57.47%, rgba(1, 67, 163, 1) 55.72%, rgba(66, 165, 255, 1) 148.72%);
color: #fff !important;
... ...