Commit 18cb2d993f81c088b841b5ffb6f2a19af793571d

Authored by wangfan
2 parents d948eac0 c8bff393

Merge remote-tracking branch 'origin/master' into online-reserve

Showing 49 changed files with 2530 additions and 988 deletions

Too many changes to show.

To preserve performance only 49 of 49+ files are displayed.

var mta=require('mta-wechat-analysis')
var uri_dc = require('utils/uri.js')
global.regeneratorRuntime = require('lib/regenerator/runtime-module')
... ... @@ -20,12 +21,21 @@ App({
shareTicket:"",
onLaunch: async function (opt) {
console.log('onLaunch',opt);
mta.App.init({
"appID":"500667280",
"eventID":"500667287",
"statPullDownFresh":true,
"statShareApp":true,
"statReachBottom":true,
"lauchOpts":opt, //渠道分析
});
if(opt.shareTicket){
this.shareTicket=opt.shareTicket;
}
this.getSystemInfo();
this.openid=await this.getOpenid();
console.log('this.openid',this.openid);
console.log('this.openid',this.openid,mta);
},
onShow:async function(){
if (wx.canIUse('getUpdateManager')) {
... ...
... ... @@ -8,6 +8,7 @@
"pages/customer/detail_owner_part",
"pages/customer/detail_customer",
"pages/customer/detail_invitation",
"pages/customer/detail_owner_invitation",
"pages/customer/invite",
"pages/customer/list",
"pages/customer/remind",
... ... @@ -21,6 +22,7 @@
"pages/book/setting/index",
"pages/book/setting/sms",
"pages/book/setting/sms_buy",
"pages/book/crm/index",
"pages/book/smsbatch/index",
"pages/book/smsbatch/update",
"pages/book/smsbatch/detail",
... ... @@ -32,10 +34,21 @@
"root": "pack-cookbook",
"name": "提前点餐包",
"pages": [
"pages/index"
"pages/index",
"pages/cart",
"pages/success",
"pages/remark"
]
}
],
"preloadRule": {
"pages/customer/detail_owner": {
"network": "all",
"packages": [
"pack-cookbook"
]
}
},
"window": {
"navigationStyle": "custom",
"backgroundTextStyle": "light",
... ...
... ... @@ -239,4 +239,30 @@ image{
height: 22rpx;
background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png");
background-size: 100%;
min-width: 12rpx;
}
.mask{
background-color: rgba(20,20,20,0.5);
position: fixed;
top:0;
right: 0;
bottom: 0;
left: 0;
z-index: 9999;
}
.flex-tb{
display: flex;
display: -webkit-flex;
justify-content: space-between;
align-items:flex-start;
flex-direction: column ;
-webkit-flex-direction: column ;
}
.flex-bl{
display: flex;
display: -webkit-flex;
justify-content: flex-end;
align-items:flex-start;
flex-direction: column ;
-webkit-flex-direction: column ;
}
\ No newline at end of file
... ...
... ... @@ -26,14 +26,18 @@ Component({
className:{
type:String,
value:'',
}
},
ddate:{ //带入预定时间 time1-time2
type:String,
value:'',
},
},
/**
* 组件的初始数据
*/
data: {
itemList:[],
},
/**
... ... @@ -45,35 +49,54 @@ Component({
if(!this.data.event) return;
this[this.data.event]()
},
boardClickCallback(e){
let board=this.data.board;
switch (e.detail.value){
case '查看详情':
wx.navigateTo({
url:'b_detail?id='+board.reserve_id,
});
break;
case '启用桌位':
this.boardEnable(1)
break;
case '停用桌位':
this.boardEnable(0)
break;
case '订座':
wx.navigateTo({
url:'b_addnew?hasQuick=1&tid='+board.id
+'&tname='+board.name
+'&pnum='+(board.most_pnum>board.table_pnum?board.most_pnum:board.table_pnum)
+'&ddate='+this.data.ddate,
});
break;
}
},
//桌位操作
boardOpt(){
let itemList=[]
if(!this.data.board.reserve_id && this.data.board.enable==1){
if(this.data.ddate){
let t=new Date()/1000;
//console.log('this.data.ddate.substr(11,10)',this.data.ddate.substr(11,10))
if(parseInt(this.data.ddate.substr(11,10))>t){
itemList.push('订座')
}
}
}
if(this.data.board.reserve_id>0){
itemList.push('查看详情')
}
itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位')
//console.log(getApp().system)
if(getApp().system.system.toLowerCase().indexOf('ios')<0){
itemList.push('取消')
}
this.itemList=itemList;
wx.showActionSheet({
itemList:this.itemList,
success:(res)=>{
console.log(res.tapIndex,this.itemList[res.tapIndex]);
if('启用桌位'==this.itemList[res.tapIndex]){
this.boardEnable(1)
}
if('停用桌位'==this.itemList[res.tapIndex]){
this.boardEnable(0)
}
if('查看详情'==this.itemList[res.tapIndex]){
wx.navigateTo({
url:'b_detail?id='+this.data.board.reserve_id,
});
}
},
this.setData({
itemList:itemList,
})
this.selectComponent('#boardas').show();
console.log('this.data.board',this.data.board)
},
//桌位选择
boardChoose(){
... ...
{
"component": true,
"usingComponents": {}
"usingComponents": {
"as":"../../actionSheet/index"
}
}
\ No newline at end of file
... ...
... ... @@ -12,3 +12,6 @@
<view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view>
<icon type="success" size="20" color="#199095" class="desk-active" wx:if="{{board.isselect==true}}"/>
</view>
<as items="{{itemList}}"
id="boardas"
bindclick="boardClickCallback"><view style="font-size: 30rpx;">{{board.name}}</view></as>
... ...
var util = require('../../../utils/util.js')
var uri=require('../../../utils/uri.js');
var uri = require('../../../utils/uri.js');
Component({
properties:{
list:Array
},
data:{
},
methods:{
selectdesk:function(e){
var tebleid=e.currentTarget.dataset.id;
var tables=util.cache('tableid') ? util.cache('tableid') : [];
var list=this.data.list;
list.forEach(function(v,i){
if(v.id==tebleid){
if(v.isselect==true){
var thisindex=tables.indexOf(tebleid);
tables.splice(thisindex,1)
}else{
tables.push(tebleid)
}
v.isselect=!v.isselect
}
})
var pages = getCurrentPages();
pages[pages.length-2].data.form.tid=tables;
pages[pages.length-2].setData({
form:pages[pages.length-2].data.form
})
util.cache('tableid',tables);
this.triggerEvent("changedesk");
this.setData({
list:list
})
properties: {
list: Array
},
data: {},
methods: {
selectdesk: function (e) {
var tebleid = e.currentTarget.dataset.id;
var tables = util.cache('tableid') ? util.cache('tableid') : [];
var list = this.data.list;
var pages = getCurrentPages();
var addnewPage=pages[pages.length - 2];
list.forEach(function (v, i) {
if (v.id == tebleid) {
if (v.isselect == true) {
var thisindex = tables.indexOf(tebleid);
tables.splice(thisindex, 1)
delete addnewPage.checkedTables[tebleid]
} else {
tables.push(tebleid)
addnewPage.checkedTables[tebleid]=v.name;
}
v.isselect = !v.isselect
}
})
addnewPage.data.form.tid = tables;
addnewPage.setData({
form: addnewPage.data.form
})
console.log('checkedTables',addnewPage.checkedTables);
util.cache('tableid', tables);
this.triggerEvent("changedesk");
this.setData({
list: list
})
}
}
})
\ No newline at end of file
... ...
<view class="desk-list flex-rs">
<block wx:for="{{list}}">
<block wx:for="{{list}}" wx:key="list.key">
<board width="160" height="180" board="{{item}}"
style="margin: 20rpx 0 0 20rpx"
event="boardChoose" className="noBottom"
... ...
<formids bindtap="detail">
<view class="book-list-tds flex-lr font30r black-font">
<view class="book-list-tds flex-lr font30r black-font reserve-status-{{vitem.status}}">
<view class="book-list-td flex-vc">
<view class="Medium" style="font-size: 30rpx; width: 100%;text-align: left;max-height:40px;overflow:hidden;">{{vitem.name}}</view>
<view class="Medium" style="font-size: 28rpx;width: 100%;text-align: left" wx:if="{{vitem.table_ids.length>1}}">等{{vitem.table_ids.length}}桌</view>
... ...
... ... @@ -13,4 +13,10 @@
.book-list-info{
width:100%;
line-height:1.2;
}
.reserve-status-4,.reserve-status-3{
color:#999999;
}
.reserve-status-4 .green-font,.reserve-status-3 .green-font{
color:#999999;
}
\ No newline at end of file
... ...
<view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view>
<view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}">
<block wx:for="{{list}}">
<block wx:for="{{list}}" wx:key="list.key">
<block wx:if="{{index!=0}}">
<view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}">
<view class="notice-image flex-vc">
... ...
// components/book/reserveCancel/cancel.js
import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
const items=[{name:'顾客取消'},{name:'顾客行程有变'},{name:'信息填写有误'},{name:'操作失误'},{name:'其他原因'}];
Component({
/**
* 组件的属性列表
*/
properties: {
bookInfo:{
type:Object,
value:{},
}
},
/**
* 组件的初始数据
*/
data: {
hidden: true,
otherInputHidden:true,
items:JSON.parse(JSON.stringify(items)),
_cause:'',
cause:'',
},
/**
* 组件的方法列表
*/
methods: {
show(){
this.setData({
hidden:false,
})
},
hide(){
this.setData({
hidden:true,
})
},
radioChange(e){
let val=util.val(e);
if(val=='其他原因'){
this.setData({
otherInputHidden:false,
_cause:val
})
}else{
this.setData({
otherInputHidden:true,
_cause:val
})
}
},
otherInput(e){
let val=util.val(e);
this.setData({
cause:val
})
},
async submit(e){
console.log(e,);
let cause=this.data._cause;
let hasInput=false;
if(cause=='其他原因'){
cause=this.data.cause;
hasInput=true;
}
cause=cause.trim();
if(!cause){
return util.toast(hasInput?'请填写原因':'请选择原因','none')
}
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
cause={desc:cause}
if(enter_params){
cause.uid=enter_params.manager_id;
}
if(sc.seller_user){
cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname)
}
App.Reserve.SetReserveStatus({
rid:this.data.bookInfo.id,
status:4,
cause:JSON.stringify(cause),
}).then(()=>{
this.hide()
this.triggerEvent('reserveCancel',{hasCancel:true});
//this.getDetail(this.data.bookInfo.id,true);
})
}
}
})
... ...
{
"component": true,
"usingComponents": {
"formids":"../../formids/formids"
}
}
\ No newline at end of file
... ...
<!--components/book/reserveCancel/cancel.wxml-->
<view class="mask flex-vc" hidden="{{hidden}}" bindtap="hide">
<view class="cancel" catchtap="catchtap">
<view class="flex-rr">
<view class="close" bindtap="hide">
<image src="http://qn.colorcun.com/custom/lite-yd/image/close.png"></image>
</view>
</view>
<view class="title Semibold flex-vc">请选择取消原因</view>
<radio-group class="radio-group flex-vl" bindchange="radioChange">
<label class="radio" wx:for="{{items}}" wx:key="items.key">
<radio value="{{item.name}}" checked="{{item.checked}}" />
{{item.name}}
</label>
</radio-group>
<view class="flex-rr other-view">
<input class="other" bindinput="otherInput" placeholder="请填写原因" hidden="{{otherInputHidden}}"/>
</view>
<formids class="flex-vc" bindclick="submit">
<view class="button">确认</view>
</formids>
</view>
</view>
... ...
/* components/book/reserveCancel/cancel.wxss */
@import "../../../app.wxss";
.cancel{
width: 90%;
background-color: #fefefe;
border-radius: 10rpx;
font-size: 32rpx;
padding-bottom: 52rpx;
}
.cancel image{
width: 100%;
height: 100%;
}
.close{
width: 32rpx;
height: 32rpx;
margin-top: 12rpx;
margin-right: 12rpx;
}
.title{
font-size: 34rpx;
}
.button{
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 4rpx;
background-color: #199095;
font-size: 34rpx;
color: #fefefe;
}
.radio-group{
margin: 44rpx 5% 0rpx;
}
.radio{
margin-bottom: 40rpx;
height: 40rpx;
line-height: 40rpx;
}
.radio:last-child{
margin-bottom: 0;
}
.radio radio{
margin-right: 30rpx;
}
.other-view{
height: 110rpx;
line-height: 110rpx;
}
.other{
border-bottom: 2rpx solid #E0E0E0;
width: 75%;
margin-right: 40rpx;
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,8 @@ Component({
*/
methods: {
back(){
wx.navigateBack()
this.triggerEvent('NavEvent');
wx.navigateBack();
},
home(){
if(!this.data.disHome) return;
... ...
... ... @@ -3,7 +3,6 @@
.nav-main{
position:fixed;
width: 100%;
z-index: 9999;
}
.nav{
font-size: 30rpx;
... ...
... ... @@ -25,11 +25,13 @@ Component({
this.setData({
network:true,
})
this.triggerEvent('network',res);
}).catch(res=>{
this.setData({
network:false,
msg:res.msg
})
this.triggerEvent('network',res);
})
},
detached(){
... ... @@ -44,12 +46,13 @@ Component({
wx.getNetworkType({
success: function (res) {
var title = ''
if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') {
fail({type:res.networkType,msg:'当前网络不给力,请稍后重试'});
//if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') {
if (res.networkType == 'unknown') {
fail({hasWork:false,type:res.networkType,msg:'当前网络不给力,请稍后重试'});
} else if (res.networkType == 'none') {
fail({type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'});
fail({hasWork:false,type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'});
} else {
success({type:res.networkType});
success({hasWork:true,type:res.networkType});
}
}
});
... ... @@ -73,6 +76,8 @@ Component({
wx.reLaunch({
url: '/'+p.route+'?'+param.join('&')
})
}).catch((res)=>{
console.log('this.network.catch',res)
})
},
show(msg=''){
... ...
... ... @@ -61,24 +61,33 @@ Component({
+')';
}
let tableSubInfo=''
let tableFirst='';
if(this.data.detail.tableFirst){
tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||'');
tableFirst=this.data.detail.tableFirst
}else{
tableFirst=this.data.detail.tables[0].name
tableSubInfo=this.data.detail.tables[0].name;
if(this.data.detail.tables.length>1){
tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个'
+(this.data.detail.tables[0].tid==2?'包间':'');
tableFirst+='等';
}
}
let obj={
rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'),
tableSubInfo:tableSubInfo,
tableFirst:tableFirst,
masterMan:masterMan,
}
if(this.data.hasShowStatus){
let ns=new Date()/1000
obj.showStatusStr=ns>this.data.detail.ddate?'已结束':'已预定';
obj.showStatusStr='已预定'
if(this.data.detail.status==4){
obj.showStatusStr='已取消'
}else if(this.data.detail.status>=2 || ns>this.data.detail.ddate){
obj.showStatusStr='已完成'
}
}
this.setData(obj)
}
... ...
... ... @@ -21,8 +21,8 @@
</view>
<view class="line"></view>
<view class="right info Medium">
<view class="label">包间</view>
<view class="value">{{tableSubInfo}}</view>
<view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>
<view class="value">{{tableFirst}}</view>
</view>
</view>
<view class="seller address flex-ll" catchtap="lookLocation">
... ...
// pack-cookbook/components/cart/cart.js
import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
rid:{
type:String,
value:"",
},
order:{
type:Object,
value:{},
},
identity:{
type:String,
value:"",
}
},
/**
* 组件的初始数据
*/
data: {
hidden: true,
carts: ['啦啦啦', '啦啦啦啦啦', '啦啦', '啦', '啦啦啦啦啦', '啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦', '啦啦啦啦', '啦啦', '啦', '啦啦啦', '啦啦啦'],
},
/**
* 组件的方法列表
*/
methods: {
hide(){
this.setData({
hidden:true,
})
},
show(){
this.setData({
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
}).then(res=>{
})
},
//规格 增加/减少 回调
foodSpecCallback(e){
let opt=e.detail;
this.triggerEvent('foodCardCallback',opt);
},
RemoveCart(){
App.Advance.RemoveCart({
orderid:this.data.order.id,
identity:this.data.identity,
}).then(res=>{
this.hide();
this.triggerEvent('foodCardCallback',{type:'flushOrder',num:0});
})
},
},
})
... ...
{
"component": true,
"usingComponents": {
"foodSpec": "../food-spec/food-spec"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/components/cart/cart.wxml-->
<view class="mask flex-bc" style="bottom: 103rpx; align-items: flex-end;" hidden="{{hidden}}" bindtap="hide">
<view class="cart" catchtap="catchtap">
<view class="cart-title flex-rr">
<view class="icon">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/empty.png"></image>
</view>
<view class="text" bindtap="RemoveCart">清空购物车</view>
</view>
<view class="cart-body">
<view class="cart-item flex-lr" wx:for="{{order.cookbooklist}}" wx:key="item.key">
<view class="flex-ll name">
<view class="name">{{item.cookname}}</view>
<view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
</view>
<view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
<view class="flex-lr opt">
<foodSpec item="{{item}}" type="-" id="foodSpecDel"
sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='jian'></view>
</foodSpec>
<view class="t-align-c">{{item.num}}</view>
<foodSpec item="{{item}}" type="+"
sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='add'></view>
</foodSpec>
</view>
</view>
</view>
</view>
</view>
... ...
/* pack-cookbook/components/cart/cart.wxss */
@import "/app.wxss";
.cart{
background-color: #fefefe;
border-radius: 10rpx 10rpx 0 0;
width: 100%;
}
.cart image{width: 100%; height: 100%;}
.cart-title{
line-height: 60rpx;
height: 60rpx;
background-color: #F5F5F5;
color:#999999;
font-size: 24rpx;
border-radius: 10rpx 10rpx 0 0;
}
.cart-title .icon{
width: 26rpx;
height: 26rpx;
margin-right: 20rpx;
}
.cart-title .text{
margin-right: 5%;
}
.cart-body{
max-height: 620rpx;
overflow-y: auto;
padding: 0 5%;
}
.cart-item{
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
}
.cart-item .name{
width: 60%;
overflow: hidden;
white-space:nowrap;
}
.cart-item .name .name{
width: auto;
max-width: 80%;
}
.cart-item .price{
width: 32%;
white-space:nowrap;
margin: 0 4%;
}
.cart-item .opt{
font-size: 36rpx;
font-weight: bold;
min-width: 160rpx;
width: 160rpx;
}
.jian,.add{
width: 60rpx;
height: 60rpx;
position: relative;
}
.jian::after{
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 60%;
height: 6rpx;
background-color: #999;
border-radius: 10rpx;
}
.cart-item .jian,.hasListModel .add{
width:36rpx;
height: 36rpx;
border-radius: 50%;
}
.cart-item .jian{
border: 2rpx solid #262628;
}
.cart-item .jian:after{
width: 75%;
height: 4rpx;
background-color: #262628;
}
.cart-item .add{
background-color: #fefefe;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
background-size: 100%;
width: 40rpx;
height: 40rpx;
}
.practice_name{
border: 2rpx solid #C8B16D;
font-size: 24rpx;
height: 30rpx;
line-height: 30rpx;
color:#C8B16D;
padding: 0 6rpx;
margin-left: 18rpx;
}
\ No newline at end of file
... ...
... ... @@ -41,6 +41,11 @@ Component({
this.setData({
menuHidden:true
})
}
},
activeMenuID(id){
this.setData({
activeMenuID:id
})
},
}
})
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
top:0;
left:0;
bottom:0;
background:#e14553;
background:#353535;
z-index:1000;
padding-top:80rpx;
box-sizing:border-box;
... ... @@ -74,10 +74,10 @@
left:0;
width: 4rpx;
height: 100%;
background-color: #E14553;
background-color: #353535;
}
.hasListModel .line2more{
height: 84rpx;
height: 90rpx;
width:140rpx;
vertical-align: middle;
overflow: hidden;
... ...
... ... @@ -3,108 +3,118 @@ import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
sellerid:{
type:Number
},
orderid:{
type:Number
},
fromSoucre:{
type:Number,
value:0
},
request_uri:{
type:Boolean,
value:false,
},
hasListModel:{
type:Boolean,
value:false,
},
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
sellerid: {
type: Number
},
orderid: {
type: Number
},
fromSoucre: {
type: Number,
value: 0
},
request_uri: {
type: Boolean,
value: false,
},
hasListModel: {
type: Boolean,
value: false,
},
identity: {
type: String,
value: '',
},
},
/**
* 组件的初始数据
*/
data: {
item_clear_num:null,
hasIPhone:false,
/**
* 组件的初始数据
*/
data: {
item_clear_num: null,
hasIPhone: false,
labelIcon: {
'https://xt05.colorcun.com/uploads/label/lijie.png': '力荐',
'https://xt05.colorcun.com/uploads/label/tejia.png': '特价',
'https://xt05.colorcun.com/uploads/label/xinpin.png': '新品',
'https://xt05.colorcun.com/uploads/label/zhaopai.png': '招牌',
},
attached () {
console.log('food-card-ready',this.data.orderid,this.data.fromSoucre)
let item=this.data.item;
let item_clear_num;
if(typeof item.item_clear_num!='undefined'){
item_clear_num=item.item_clear_num;
}else{
item_clear_num=item.clear_num;
if(item.spec){
let clear_num=null;
item.spec.forEach(spec=>{
if(spec.clear_num==0){
clear_num=0;
}else{
clear_num=null;
}
})
if(clear_num==0){
item_clear_num=0;
}
}
},
attached () {
console.log('food-card-ready', this.data.orderid, this.data.fromSoucre)
let item = this.data.item;
let item_clear_num;
if (typeof item.item_clear_num != 'undefined') {
item_clear_num = item.item_clear_num;
} else {
item_clear_num = item.clear_num;
if (item.spec) {
let clear_num = null;
item.spec.forEach(spec => {
if (spec.clear_num == 0) {
clear_num = 0;
} else {
clear_num = null;
}
})
if (clear_num == 0) {
item_clear_num = 0;
}
}
}
this.setData({
item_clear_num:item_clear_num,
hasIPhone:getApp().system.model.indexOf('iPhone')>-1
});
},
detached(){
this.setData({
item_clear_num: item_clear_num,
hasIPhone: getApp().system.model.indexOf('iPhone') > -1
});
},
detached(){
},
/**
* 组件的方法列表
*/
methods: {
//规格 增加/减少 回调
foodSpecCallback(e){
let opt = e.detail;
console.log('foodSpecCallback', opt);
if (opt.type == 'specWin') {
return this.triggerEvent('foodCardCallback', opt);
}
let item = this.data.item;
let oldNum = (item.num || 0);
item.num = (item.num || 0) + opt.type;
let rotateFlag = (oldNum == 0 || item.num == 0);
console.log('num_rotate', rotateFlag);
this.setData({item: item, rotate_id: rotateFlag ? item.id : ''});
opt.num = item.num;
this.triggerEvent('foodCardCallback', opt);
},
/**
* 组件的方法列表
*/
methods: {
//规格 增加/减少 回调
foodSpecCallback(e){
let opt=e.detail;
console.log('foodSpecCallback',opt);
if(opt.type=='specWin'){
return this.triggerEvent('foodCardCallback',opt);
}
let item=this.data.item;
let oldNum=(item.num||0);
item.num=(item.num||0)+opt.type;
let rotateFlag=(oldNum==0 || item.num==0);
console.log('num_rotate',rotateFlag);
this.setData({item:item,rotate_id:rotateFlag?item.id:''});
opt.num=item.num;
this.triggerEvent('foodCardCallback',opt);
},
//清除订单下某菜品所有数量
delOrderCook:function(){
this.selectComponent("#foodSpecDel").clean();
},
//triggerAdd
triggerAdd(e){
console.log('triggerAdd',e)
if(this.data.item_clear_num==0) return;
this.selectComponent("#foodSpecAddOne").addCook();
},
//viewIMage
viewImage(){
wx.previewImage({
current: this.data.item.image, // 当前显示图片的http链接
urls: [this.data.item.image], // 需要预览的图片http链接列表
})
}
//清除订单下某菜品所有数量
delOrderCook: function () {
this.selectComponent("#foodSpecDel").clean();
},
//triggerAdd
triggerAdd(e){
console.log('triggerAdd', e)
if (this.data.item_clear_num == 0) return;
this.selectComponent("#foodSpecAddOne").addCook();
},
//viewIMage
viewImage(){
wx.previewImage({
current: this.data.item.image, // 当前显示图片的http链接
urls: [this.data.item.image], // 需要预览的图片http链接列表
})
}
}
})
... ...
<view class="flex-ll-top hasListModel" style="width:100%;">
<view class="flex-ll hasListModel" style="width:100%;">
<view class="avatar">
<image mode="aspectFill" lazy-load="true" src="{{item.image}}"/>
</view>
<view class="content">
<view class="name Semibold">
{{item.name}}
</view>
<view class="desc">
{{item.desc||''}}
</view>
<view class="label">
<view class="content flex-tb">
<view class="name Semibold">{{item.name}}</view>
<view class="desc">{{item.desc||''}}</view>
<view class="label flex-ll">
<block wx:if="{{item.labelList}}">
<view class="menu-ptop-mark">
<block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">
<image class="labelListImg" src="{{son.icon}}" mode="aspectFit"></image>
</block>
</view>
<block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">
<view class="labelListImg flex-vc" wx:if="{{labelIcon[son.icon]}}">{{labelIcon[son.icon]}}</view>
<image class="labelListImg" wx:else="" src="{{son.icon}}" mode="aspectFit"></image>
</block>
</block>
</view>
<view class="flex-lr price">
<view class="flex-ll">
<view class="rmb">¥</view>
<view class="money">{{item.spec[0].price>0 ? item.spec[0].price : item.price}}</view>
</view>
<view class="opt flex-ll">
<view class="price">¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}}
<view class="opt flex-cc">
<block wx:if="{{item_clear_num==0}}">
<image
class="avater"
... ... @@ -34,7 +25,7 @@
<block wx:else="">
<block wx:if="{{item.num>0}}">
<foodSpec item="{{item}}" type="-" id="foodSpecDel"
sellerid="{{sellerid}}" orderid="{{orderid}}"
sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}"
fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='jian'></view>
... ... @@ -42,7 +33,7 @@
<view class="t-align-c">{{item.num}}</view>
</block>
<foodSpec item="{{item}}" type="+"
sellerid="{{sellerid}}" orderid="{{orderid}}"
sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}"
fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
bindfoodSpecCallback="foodSpecCallback">
<view class='add'></view>
... ... @@ -50,9 +41,11 @@
</block>
</view>
</view>
<!--
<view wx:if="{{item_clear_num>0}}" style="padding:0rpx 10rpx;">
<text class="food-clear-content">剩{{item_clear_num}}份</text>
</view>
-->
</view>
</view>
... ...
@import '../../app.wxss';
@import '/app.wxss';
.cookWapper{
border-radius:4px;
position: relative;
... ... @@ -78,32 +78,7 @@
background-color: #999;
border-radius: 10rpx;
}
.add::after{
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 60%;
height: 6rpx;
background-color: red;
border-radius: 10rpx;
}
.add::before{
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 6rpx;
height: 60%;
background-color: red;
border-radius: 10rpx;
}
.ptop5 {
padding-top:5px;
... ... @@ -119,22 +94,21 @@
}
.menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex}
.labelListImg{
width: 50rpx; height: 30rpx; margin-right: 10rpx;
}
.hasListModel{
/*列表模式*/
height: 160rpx;
padding: 20rpx 0;
}
.hasListModel .avatar{
width: 138rpx;
min-width: 138rpx;
height: 140rpx;
margin-right: 18rpx;
width: 160rpx;
min-width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
border-radius: 10rpx;
overflow: hidden;
background-color: #D8D8D8;
margin-top: 10rpx;
}
.hasListModel .avatar image{
width: 100%;
... ... @@ -145,54 +119,61 @@
.hasListModel .content{
overflow: hidden;
width: 100%;
height: 160rpx;
}
.hasListModel .name{
height: 48rpx;
line-height:48rpx;
font-size: 34rpx;
height: 30rpx;
line-height:30rpx;
font-size: 30rpx;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.hasListModel .desc{
height: 34rpx;
line-height:34rpx;
font-size: 24rpx;
height: 20rpx;
line-height:20rpx;
font-size: 20rpx;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
color:#999999;
}
.hasListModel .label{
height: 22rpx;
line-height:22rpx;
overflow: hidden;
margin-top: 12rpx;
margin-bottom: 4rpx;
font-size: 22rpx;
}
.hasListModel .label .menu-ptop-mark,.hasListModel .label .labelListImg{
height: 100%;
margin-right: 4rpx;
.labelListImg{
width: 50rpx;
height: 22rpx;
margin-right: 10rpx;
line-height: 22rpx;
font-size: 18rpx;
color:#FEFEFE;
background: linear-gradient(to right, #C8B16D, #ECD48B);
}
.hasListModel .price{
height: 40rpx;
overflow: hidden;
padding:0 10rpx;
line-height: 40rpx;
height: 28rpx;
font-size: 28rpx;
line-height: 28rpx;
position: relative;
width: 100%;
}
.hasListModel .price .flex-ll-bottom{
.hasListModel .price .opt{
position: absolute;
right:20rpx;
top:-16rpx;
height: 40rpx;
line-height: 40rpx;
}
.hasListModel .price .rmb{
/*line-height:26rpx;
height:26rpx;
font-size: 24rpx;*/
margin-right: 10rpx;
}
.hasListModel .price .money{
/*height: 30rpx;
font-size: 28rpx;
line-height:30rpx;*/
.hasListModel .t-align-c{
margin: 0 10rpx;
font-size: 36rpx;
font-weight: bold;
padding: 0;
width: 50rpx;
overflow-x: hidden;
text-align: center;
}
.hasListModel .food-clear-content{
... ... @@ -207,34 +188,20 @@
border-radius: 50%;
}
.hasListModel .jian{
border: 2rpx solid #B4B2B2;
border: 2rpx solid #262628;
}
.hasListModel .jian:after{
width: 75%;
height: 4rpx;
background-color: #B4B2B2;
background-color: #262628;
}
.hasListModel .add{
border: 2rpx solid #E14553;
background-color:#E14553;
}
.hasListModel .add:after,.hasListModel .add:before{
background-color: #fff;
}
.hasListModel .add:after{
width: 75%;
height: 4rpx;
}
.hasListModel .add:before{
height: 75%;
width: 4rpx;
}
.hasListModel .t-align-c{
margin: 0 10rpx;
font-size: 36rpx;
font-weight: bold;
padding: 0;
width: 50rpx;
overflow: hidden;
background-color: #fefefe;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
background-size: 100%;
width: 40rpx;
height: 40rpx;
}
... ...
... ... @@ -3,448 +3,462 @@ import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Component({
/**
* 组件的属性列表
*/
properties: {
item:{
type:Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
type:{
type:String,
default:'+'
},
sellerid:{
type:Number
},
orderid:{
type:Number
},
fromSoucre:{
type:Number,
value:0
},
request_uri:{
type:Boolean,
value:false,
}
/**
* 组件的属性列表
*/
properties: {
item: {
type: Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
},
/**
* 组件的初始数据
*/
data: {
hiddenFoodSpec:true,//加菜规格
hiddenFoodSpecReduce:true,//减菜规格
selectKind:[{title:'xxxxx'},{title:'yyyyy'}],
type: {
type: String,
default: '+'
},
ready () {
sellerid: {
type: Number
},
detached(){
orderid: {
type: Number
},
/**
* 组件的方法列表
*/
methods: {
init(){
console.log('food-spec init');
this.setData({
hiddenFoodSpec:false
})
},
//关闭规格框
close:function(){
this.setData({
hiddenFoodSpec:true,
hiddenFoodSpecReduce:true,
})
//关闭了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'hide'
});
},
//构造KindMenu
initKindMenu(){
return new Promise((success,fail)=>{
let price=this.data.item.price;
let hasSpec = this.data.item.spec.length>0;
let hasPractice = this.data.item.practice.length>0;
if(hasSpec || hasPractice){
var specs = this.data.item.spec//规格
var practice = this.data.item.practice//做法
var kind = []
var foodMenu=[]
if(this.data.type=='-'){
if(specs){
specs.map(function(r,n){
if(r.id){//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})
}
})
}
fromSoucre: {
type: Number,
value: 0
},
request_uri: {
type: Boolean,
value: false,
},
identity: {
type: String,
value: "",
}
if(practice) {
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})
}
})
}
App.Cookbook.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
}).then(res=>{
this.setData({
selectKind:res.data[0],
hiddenFoodSpecReduce:false,
kind:kind?kind:'',
foodMenu:foodMenu,
})
})
}else{
specs.map(function(r,n){
if ((r.id && r.clear_num > 0) || r.clear_num==null){//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})
}
})
if(kind.length>0){
kind[0].iskind=true;
var kindPrice=kind[0].price;
var specs_id=kind[0].id;
}
},
practice.map(function(r,n){
if(r.id){
foodMenu.push({id:r.id,price:price,title:r.name,iskind:false})
}
})
/**
* 组件的初始数据
*/
data: {
hiddenFoodSpec: true,//加菜规格
hiddenFoodSpecReduce: true,//减菜规格
selectKind: [{title: 'xxxxx'}, {title: 'yyyyy'}],
},
ready () {
if(foodMenu.length>0){
foodMenu[0].iskind=true;
var foodMenuPrice=foodMenu[0].price;
var practice_id=foodMenu[0].id;
}
App.Cookbook.GetCookbookSelBySpecsId({
sellerid:this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
}).then(res=>{
this.setData({
selectKind:res.data[0],
hiddenFoodSpec:false,
kind:kind,
foodMenu:foodMenu,
showSpecsPrice:false,
cookbook_name:this.data.item.name,
cookbook_id:this.data.item.id,
specs_id:specs_id ? specs_id :'',
practice_id:practice_id ? practice_id : '',
selectPrice:kindPrice>0 ? kindPrice : foodMenuPrice,
add_target:''
})
})
}
success();
}else{
fail();
}
});
},
//选择规格
kindSelect: function (e) {
var index = e.currentTarget.dataset.key
var specsid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.kind.length; i++) {
if (i == index) {
this.data.kind[i].iskind = true;
} else {
this.data.kind[i].iskind = false;
}
}
var is_show = ''
if(this.data.foodMenu==''){
is_show=1
}else if(specsid && this.data.practice_id){
is_show=1
}
this.setData({
kind: this.data.kind,
selectPrice:price,
specs_id:specsid,
foodMenu:this.data.foodMenu?this.data.foodMenu:'',
showSpecsPrice:price?false:true,
showAdd:is_show?false:true//showAdd:specsid?false:true
});
},
//选择做法
menuSelect: function (e) {
var index = e.currentTarget.dataset.key
var practiceid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.foodMenu.length; i++) {
if (i == index) {
this.data.foodMenu[i].iskind = true;
} else {
this.data.foodMenu[i].iskind = false;
}
}
var is_show = ''
if(this.data.kind==''){
is_show=1
}else if(this.data.specs_id && practiceid){
is_show=1
}
this.setData({
foodMenu: this.data.foodMenu,
foodMenuPrice:price,
practice_id:practiceid,
showAdd:is_show?false:true
});
},
//加菜面板
addCook:function(e){
console.log('addCook',this.data.item,e);
var cookbookid = this.data.item.id
var price=this.data.item.price;
},
detached(){
this.initKindMenu().then(res=>{
//打开了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'show'
});
}).catch(res=>{
console.log('initKindMenu',res);
if( this.data.item.clear_num && this.data.item.clear_num>0
&& this.data.item.num+1 > this.data.item.clear_num){
wx.showToast({
title:'该菜品最多能点'+this.data.item.clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
},
/**
* 组件的方法列表
*/
methods: {
init(){
console.log('food-spec init');
this.setData({
hiddenFoodSpec: false
})
},
//关闭规格框
close: function () {
this.setData({
hiddenFoodSpec: true,
hiddenFoodSpecReduce: true,
})
//关闭了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'hide'
});
},
//构造KindMenu
initKindMenu(){
return new Promise((success, fail) => {
let price = this.data.item.price;
let hasSpec = this.data.item.spec.length > 0;
let hasPractice = this.data.item.practice.length > 0;
if (hasSpec || hasPractice) {
var specs = this.data.item.spec//规格
var practice = this.data.item.practice//做法
var kind = []
var foodMenu = []
if (this.data.type == '-') {
if (specs) {
specs.map(function (r, n) {
if (r.id) {//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
}
//通知
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:1,
});
//this.matchArray(cookbookid,1,countTotal,countPirce)
App.Orders.AddCart({
orderid: this.data.orderid,
openid:util.cache('openid'),
cookbookid:cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',
identity:util.cache('identity')
});
});
},
//减菜面板
subtractCook(){
console.log('addFunction',this.data.item);
var cookbookid = this.data.item.id
var price=this.data.item.price;
this.initKindMenu().then(res=>{
//打开了规格窗口
this.triggerEvent('foodSpecCallback',{
type:'specWin',
value:'show'
});
}).catch(res=>{
//通知
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:-1,
});
App.Orders.ReduceOrder({
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
//specid: specid ? specid : '',
//practiceid: specid ? specid : '',
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
status:this.data.fromSoucre!=''?2:'',//只查没有下单的
source: 2,
});
});
},
//减菜面板加菜按钮
add:function(e){
console.log('add',util.attr(e,'cookbookid'),e);
let index=util.attr(e,'index');
let selectKind=this.data.selectKind;
})
}
console.log('selectKind',selectKind,index);
let specs=this.data.item.spec;
let clear_num=null;
specs.forEach(spec=>{
if(spec.id==selectKind[index].specid){
clear_num=spec.clear_num;
if (practice) {
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})
}
})
}
App.Advance.GetCookbookSelBySpecsId({
sellerid: this.data.sellerid,
orderid: this.data.orderid,
cookbookid: this.data.item.id,
status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
identity: this.data.identity
}).then(res => {
this.setData({
selectKind: res.data,
hiddenFoodSpecReduce: false,
kind: kind ? kind : '',
foodMenu: foodMenu,
})
})
} else {
specs.map(function (r, n) {
if ((r.id && r.clear_num > 0) || r.clear_num == null) {//某规格卖光了 就不显示 && r.clear_num>1
kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
}
})
if( clear_num && clear_num>0
&& selectKind[index].foodNum+1 > clear_num){
wx.showToast({
title:'该菜品最多能点'+clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
if (kind.length > 0) {
kind[0].iskind = true;
var kindPrice = kind[0].price;
var specs_id = kind[0].id;
}
selectKind[index].foodNum=parseInt(selectKind[index].foodNum)+1;
this.setData({selectKind:selectKind});
this.formSubmit(e,true);
},
//减菜面板减菜按钮
reduce(e){
console.log('reduce',util.attr(e,'cookbookid'),e);
var cookbookid = util.attr(e,'cookbookid')
var specid = util.attr(e,'specid')
var practice_id = util.attr(e,'practiceid')
var price = util.attr(e,'price')
practice.map(function (r, n) {
if (r.id) {
foodMenu.push({id: r.id, price: price, title: r.name, iskind: false})
}
})
let index=util.attr(e,'index');
let selectKind=this.data.selectKind;
selectKind[index].foodNum-=1;
if(selectKind[index].foodNum<=0){
selectKind.splice(index,1);
}
this.setData({selectKind:selectKind});
if(selectKind.length<1){
this.close();
if (foodMenu.length > 0) {
foodMenu[0].iskind = true;
var foodMenuPrice = foodMenu[0].price;
var practice_id = foodMenu[0].id;
}
this.setData({
selectKind: [],
hiddenFoodSpec: false,
kind: kind,
foodMenu: foodMenu,
showSpecsPrice: false,
cookbook_name: this.data.item.name,
cookbook_id: this.data.item.id,
specs_id: specs_id ? specs_id : '',
practice_id: practice_id ? practice_id : '',
selectPrice: kindPrice > 0 ? kindPrice : foodMenuPrice,
add_target: ''
})
}
success();
} else {
fail();
}
});
},
//选择规格
kindSelect: function (e) {
var index = e.currentTarget.dataset.key
var specsid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.kind.length; i++) {
if (i == index) {
this.data.kind[i].iskind = true;
} else {
this.data.kind[i].iskind = false;
}
}
var is_show = ''
if (this.data.foodMenu == '') {
is_show = 1
} else if (specsid && this.data.practice_id) {
is_show = 1
}
this.setData({
kind: this.data.kind,
selectPrice: price,
specs_id: specsid,
foodMenu: this.data.foodMenu ? this.data.foodMenu : '',
showSpecsPrice: price ? false : true,
showAdd: is_show ? false : true//showAdd:specsid?false:true
});
},
//选择做法
menuSelect: function (e) {
var index = e.currentTarget.dataset.key
var practiceid = e.currentTarget.id
var price = e.currentTarget.dataset.price
for (var i = 0; i < this.data.foodMenu.length; i++) {
if (i == index) {
this.data.foodMenu[i].iskind = true;
} else {
this.data.foodMenu[i].iskind = false;
}
}
var is_show = ''
if (this.data.kind == '') {
is_show = 1
} else if (this.data.specs_id && practiceid) {
is_show = 1
}
this.setData({
foodMenu: this.data.foodMenu,
foodMenuPrice: price,
practice_id: practiceid,
showAdd: is_show ? false : true
});
},
//加菜面板
addCook: function (e) {
console.log('addCook', this.data.item, e);
var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
var price = this.data.item.price;
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:-1
});
this.initKindMenu().then(res => {
//打开了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'show'
});
}).catch(res => {
console.log('initKindMenu', res);
if (this.data.item.clear_num && this.data.item.clear_num > 0
&& this.data.item.num + 1 > this.data.item.clear_num) {
wx.showToast({
title: '该菜品最多能点' + this.data.item.clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
//通知
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: 1,
});
//this.matchArray(cookbookid,1,countTotal,countPirce)
let params={
orderid: this.data.orderid,
openid: util.cache('openid'),
cookbookid: cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
identity: this.data.identity
}
if(this.data.item.specid>0){
params.specid=this.data.item.specid;
}
if(this.data.item.practiceid>0){
params.practiceid=this.data.item.practiceid;
}
App.Advance.AddCart(params);
});
},
//减菜面板
subtractCook(){
console.log('subtractCook', this.data.item);
var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
var price = this.data.item.price;
this.initKindMenu().then(res => {
//打开了规格窗口
this.triggerEvent('foodSpecCallback', {
type: 'specWin',
value: 'show'
});
}).catch(res => {
//通知
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: -1,
});
let params={
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
//specid: specid ? specid : '',
//practiceid: specid ? specid : '',
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
source: 2,
identity: this.data.identity
}
if(this.data.item.specid>0){
params.specid=this.data.item.specid;
}
if(this.data.item.practiceid>0){
params.practiceid=this.data.item.practiceid;
}
App.Advance.ReduceOrder(params);
});
},
//减菜面板加菜按钮
add: function (e) {
console.log('add', util.attr(e, 'cookbookid'), e);
let index = util.attr(e, 'index');
let selectKind = this.data.selectKind;
//执行删除操作
let params={
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
status:this.data.fromSoucre?2:'',//只查没有下单的
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
source: 2,
};
if(specid>0){
params.specid=specid;
}
if(practice_id>0){
params.practiceid=practice_id;
}
App.Orders.ReduceOrder(params);
},
/**
*
* @param e
* @param subtractCook 减菜面板
*/
formSubmit(e,subtractCook=false){
if(subtractCook){//减菜面板
var cookbookid = util.attr(e,'cookbookid')
var specid = util.attr(e,'specid')
var practice_id = util.attr(e,'practiceid')
var price = util.attr(e,'price')
}else{
var cookbookid = util.val(e,'cookbookid')
var specid = util.val(e,'specs_id')
var practice_id = util.val(e,'practice_id')
var price = util.val(e,'price')
if(this.data.selectPrice){
console.log(666666,this.data.selectPrice)
price=this.data.selectPrice
}else{
console.log('yyyyyy',this.data.foodMenuPrice)
price=this.data.foodMenuPrice
}
this.close();
}
console.log('formSubmit',specid,practice_id,price)
console.log('selectKind', selectKind, index);
let specs = this.data.item.spec;
let clear_num = null;
specs.forEach(spec => {
if (spec.id == selectKind[index].specid) {
clear_num = spec.clear_num;
}
})
if (clear_num && clear_num > 0
&& selectKind[index].foodNum + 1 > clear_num) {
wx.showToast({
title: '该菜品最多能点' + clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
selectKind[index].foodNum = parseInt(selectKind[index].foodNum) + 1;
this.setData({selectKind: selectKind});
this.formSubmit(e, true);
},
//减菜面板减菜按钮
reduce(e){
console.log('reduce', util.attr(e, 'cookbookid'), e);
var cookbookid = util.attr(e, 'cookbookid')
var specid = util.attr(e, 'specid')
var practice_id = util.attr(e, 'practiceid')
var price = util.attr(e, 'price')
let selectKindNum=0;
if(this.data.selectKind){
this.data.selectKind.forEach((kind)=>{
if(kind.specid==specid){
selectKindNum=kind.foodNum
}
})
}
console.log('selectKindNum',this.data.selectKind,selectKindNum);
if(selectKindNum>0){
let clear_num=null;
let specs=this.data.item.spec;
specs.forEach(spec=>{
if(spec.id==specid){
clear_num=spec.clear_num;
}
})
if( clear_num && clear_num>0
&& selectKindNum+1 > clear_num){
wx.showToast({
title:'该菜品最多能点'+clear_num+'份',
duration:2000,
mask:true,
icon:'none'
});
return;
}
}
let index = util.attr(e, 'index');
let selectKind = this.data.selectKind;
selectKind[index].foodNum -= 1;
if (selectKind[index].foodNum <= 0) {
selectKind.splice(index, 1);
}
this.setData({selectKind: selectKind});
if (selectKind.length < 1) {
this.close();
}
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: -1
});
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:1
});
let param={
orderid: this.data.orderid,
openid:util.cache('openid'),
cookbookid:this.data.item.id,
price: price,
source: 1,
request_uri: this.data.request_uri==true?1:'',//服务员通过消息通知进来 又加菜的标识
fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',
identity:util.cache('identity')
}
if(specid>0){
param.specid=specid;
}
if(practice_id>0){
param.practiceid=practice_id;
}
App.Orders.AddCart(param);
},
//清除订单下某菜品所有数量
clean(){
let cookbookid=this.data.item.id
this.triggerEvent('foodSpecCallback',{
cookbookid:cookbookid,
type:this.data.item.num*-1
});
App.Orders.ClearCookById({
orderid: this.data.orderid,
sellerid: this.data.sellerid,
cookbookid:cookbookid
});
//执行删除操作
let params = {
orderid: this.data.orderid,
openid: getApp().openid,
cookbookid: cookbookid,
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
status: this.data.fromSoucre ? 2 : '',//只查没有下单的
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
source: 2,
identity: this.data.identity
};
if (specid > 0) {
params.specid = specid;
}
if (practice_id > 0) {
params.practiceid = practice_id;
}
App.Advance.ReduceOrder(params);
},
/**
*
* @param e
* @param subtractCook 减菜面板
*/
formSubmit(e, subtractCook = false){
if (subtractCook) {//减菜面板
var cookbookid = util.attr(e, 'cookbookid')
var specid = util.attr(e, 'specid')
var practice_id = util.attr(e, 'practiceid')
var price = util.attr(e, 'price')
} else {
var cookbookid = util.val(e, 'cookbookid')
var specid = util.val(e, 'specs_id')
var practice_id = util.val(e, 'practice_id')
var price = util.val(e, 'price')
if (this.data.selectPrice) {
console.log(666666, this.data.selectPrice)
price = this.data.selectPrice
} else {
console.log('yyyyyy', this.data.foodMenuPrice)
price = this.data.foodMenuPrice
}
this.close();
}
console.log('formSubmit', cookbookid,specid, practice_id, price)
//return;
let selectKindNum = 0;
if (this.data.selectKind) {
this.data.selectKind.forEach((kind) => {
if (kind.specid == specid) {
selectKindNum = kind.foodNum
}
})
}
console.log('selectKindNum', this.data.selectKind, selectKindNum);
if (selectKindNum > 0) {
let clear_num = null;
let specs = this.data.item.spec;
specs.forEach(spec => {
if (spec.id == specid) {
clear_num = spec.clear_num;
}
})
if (clear_num && clear_num > 0
&& selectKindNum + 1 > clear_num) {
wx.showToast({
title: '该菜品最多能点' + clear_num + '份',
duration: 2000,
mask: true,
icon: 'none'
});
return;
}
}
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: 1
});
let param = {
orderid: this.data.orderid,
openid: util.cache('openid'),
cookbookid: cookbookid,
price: price,
source: 1,
request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
identity: this.data.identity
}
if (specid > 0) {
param.specid = specid;
}
if (practice_id > 0) {
param.practiceid = practice_id;
}
App.Advance.AddCart(param);
},
//清除订单下某菜品所有数量
clean(){
let cookbookid = this.data.item.id
this.triggerEvent('foodSpecCallback', {
cookbookid: cookbookid,
type: this.data.item.num * -1
});
App.Advance.ClearCookById({
orderid: this.data.orderid,
sellerid: this.data.sellerid,
cookbookid: cookbookid
});
}
}
})
... ...
... ... @@ -2,56 +2,56 @@
<slot></slot>
</view>
<view hidden="{{hiddenFoodSpec}}" class="hiddenFoodSpec">
<view class="toast-mask"></view>
<view class="toast-content">
<form bindsubmit="formSubmit">
<input value="{{cookbook_id}}" name="cookbookid" hidden="true"/>
<view class="toast-content-title">{{cookbook_name}}</view>
<block wx:if="{{kind.length>0}}">
<view class="toast-content-kind" style="margin-bottom:{{foodMenu.length==0 ? '80rpx' : '0rpx'}}">
<view class="toast-kind-title">规格</view>
<view class="toast-kind-menu">
<view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{kind}}" wx:key="kind-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap="kindSelect">{{item.title}}</view>
<input value="{{specs_id}}" name="specs_id" hidden="true"/>
<input value="{{selectPrice}}" name="price" hidden="true"/>
<view class="toast-mask flex-vc" bindtap="close">
<view class="toast-content" catchtap="catchtap">
<image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image>
<form bindsubmit="formSubmit">
<input value="{{cookbook_id}}" name="cookbookid" hidden="true"/>
<view class="toast-content-title">{{cookbook_name}}</view>
<block wx:if="{{kind.length>0}}">
<view class="toast-content-kind">
<view class="toast-kind-title">规格</view>
<view class="toast-kind-menu flex-ll">
<view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{kind}}" wx:key="kind-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap="kindSelect">{{item.title}}</view>
<input value="{{specs_id}}" name="specs_id" hidden="true"/>
<input value="{{selectPrice}}" name="price" hidden="true"/>
</view>
</view>
</view>
</block>
<block wx:if="{{foodMenu.length>0}}">
<view class="toast-content-kind" style="margin-bottom:{{kind.length==0 ? '235rpx' : '40rpx'}};">
<view class="toast-kind-title">做法</view>
<view class="toast-kind-menu">
<view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{foodMenu}}" wx:key="foodmenu-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap='menuSelect'>{{item.title}}</view>
<input value="{{practice_id}}" name="practice_id" hidden="true"/>
</block>
<block wx:if="{{foodMenu.length>0}}">
<view class="toast-content-kind">
<view class="toast-kind-title">做法</view>
<view class="toast-kind-menu flex-ll">
<view class="toast-kind-single {{item.iskind==true?'kind-active':''}}" wx:for="{{foodMenu}}" wx:key="foodmenu-key" data-key="{{index}}" id="{{item.id}}" data-price="{{item.price}}" bindtap='menuSelect'>{{item.title}}</view>
<input value="{{practice_id}}" name="practice_id" hidden="true"/>
</view>
</view>
</block>
<view class="toast-content-end">
<view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view>
<button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button>
</view>
</block>
<block wx:else>
<view class="toast-content-kind" style="height:73px;">
</view>
</block>
<view class="toast-content-end">
<view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view>
<button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button>
</view>
</form>
<image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite/image/close.png" background-size="cover"></image>
</form>
</view>
</view>
</view>
<view hidden="{{hiddenFoodSpecReduce}}" class="hiddenFoodSpec">
<view class="reduce-mask"></view>
<view class="reduce-conent">
<view class="reduce-content-title">{{item.name}}</view>
<view class="reduce-content-list">
<view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem">
<view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title?':':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view>
<view class="reduce-list-info flex-rr">
<image class="reduce-list-reduce reduce-list-first" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap="reduce" src="http://qn.colorcun.com/custom/lite/image/subtractCook.png" style="padding-right:18rpx;"></image>
<view class="reduce-list-reduce">{{kindItem.foodNum}}</view>
<image class="reduce-list-reduce reduce-list-last" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap='add' src="http://qn.colorcun.com/custom/lite/image/add.png"></image>
<view class="reduce-mask flex-vc" bindtap="close">
<view class="reduce-conent" catchtap="catchtap">
<image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image>
<view class="reduce-content-title">{{item.name}}</view>
<view class="reduce-content-list">
<view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem">
<view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title && kindItem.ptitle?'、':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view>
<view class="reduce-list-info flex-rr">
<view class="reduce-list-first" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap="reduce" ></view>
<view class="reduce-list-reduce">{{kindItem.foodNum}}</view>
<view class="reduce-list-last" data-index="{{index}}" data-cookbookid="{{kindItem.cookbookid}}" data-practiceid="{{kindItem.practiceid}}" data-specid="{{kindItem.specid}}" data-price="{{kindItem.price}}" bindtap='add' ></view>
</view>
</view>
</view>
</view>
<image src="http://qn.colorcun.com/custom/lite/image/close.png" class="reduce-close" bindtap="close"></image>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -13,17 +13,9 @@
}
.toast-content{
width:542rpx;
min-height: 300px;
height:auto;
background: #fff;
border-radius: 10rpx;
position: fixed;
top: 35%;
left:0;
right:0;
margin:0 auto;
margin-top:-150px;
z-index: 9999;
/* overflow: hidden; */
}
.toast-content-title{
... ... @@ -36,22 +28,20 @@
.toast-content-kind{
width: 100%;
height: auto;
padding:0 19rpx;
padding:0 42rpx;
box-sizing: border-box;
padding-top: 20px;
margin-bottom: 34rpx;
}
.toast-kind-title{
width: 100%;
color:#353535;
font-size:16px;
padding-left:19rpx;
box-sizing:border-box;
margin-bottom: 24rpx;
}
.toast-kind-menu{
width: 100%;
height: auto;
box-sizing: border-box;
padding-bottom:10px;
}
.toast-kind-menu:after{
width:0;
... ... @@ -61,17 +51,14 @@
clear:both;
}
.toast-kind-single{
float:left;
width: 130rpx;
height: 25px;
border:1px solid #ccc;
box-sizing: border-box;
color:#353535;
font-size:14px;
line-height: 23px;
width: 102rpx;
height: 42rpx;
border:1px solid #C8B16D;
color:#C8B16D;
font-size:28rpx;
line-height: 42rpx;
text-align: center;
margin:0 19rpx;
margin-top: 10px;
margin-right: 38rpx;
}
.toast-kind-single:last-child{
margin-right: 0;
... ... @@ -81,22 +68,22 @@
height: 57px;
padding:15px 38rpx;
box-sizing: border-box;
margin-top: 22px;
background: #f2f2f2;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
.toast-content-money{
float: left;
color: #e14553;
font-size:17px;
line-height: 28px;
color: #353535;
font-size:36rpx;
line-height: 50rpx;
font-weight: bold;
}
.toast-content-add{
float: right;
width: 95px;
height: 28px;
background: #e14553;
background: #C8B16D;
border-radius:28px;
color: #fff;
font-size:13px;
... ... @@ -104,18 +91,15 @@
text-align: center;
}
.toast-kind-single.kind-active{
border:1px solid #e14553;
color:#e14553;
border-width:0;
color:#ffffff;
background: linear-gradient(to right, #ECDB99, #C8B16D);
}
.toast-content-close{
width: 60rpx;
height: 60rpx;
position: absolute;
left: 0;
right: 0;
bottom:-140rpx;
margin:0 auto;
background: transparent;
width: 30rpx;
height: 30rpx;
float: right;
margin: 10rpx;
}
/*删除规格遮罩*/
... ... @@ -160,39 +144,57 @@
}
.reduce-content-large{
width: 100%;
height: 25px;
height: 42rpx;
line-height: 42rpx;
padding-top: 50rpx;
}
.reduce-list-title{
float:left;
padding:0 26rpx;
height: 25px;
border:1rpx solid #ccc;
padding:0 10rpx;
height: 42rpx;
box-sizing: border-box;
color:#353535;
font-size:14px;
line-height: 25px;
color:#fefefe;
font-size:28rpx;
line-height: 42rpx;
text-align: center;
background: linear-gradient(to right, #C8B16D, #E6D9A6);
min-width: 100rpx;
}
.reduce-list-info{
height: 25px;
line-height: 25px;
}
.reduce-list-reduce{
padding:0 10rpx;
padding:0 20rpx;
font-size:32rpx;
line-height: 25px;
line-height: 42rpx;
text-align: center;
}
.reduce-list-first{
width:15px;
height:2px;
background:#fff;
width:36rpx;
height:36rpx;
border: 2rpx solid #262628;
border-radius: 50%;
overflow: hidden;
position: relative;
}
.reduce-list-first:after{
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 75%;
height: 4rpx;
background-color: #262628;
}
.reduce-list-last{
width:15px;
height:15px;
background:#fff;
width:40rpx;
height:40rpx;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
background-size: 100% 100%;
}
.reduce-close{
width: 60rpx;
... ...
// pack-cookbook/pages/cart.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
order:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options:options,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.initOrder();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity,
status:'0,1'
}).then(res => {
let cookbooklist={};
res.data.cookbooklist.forEach(ck=>{
if(!cookbooklist[ck.classid]){
cookbooklist[ck.classid]={'name':ck.class_name,list:[]}
}
cookbooklist[ck.classid].list.push(ck)
})
res.data.cookbooklist=cookbooklist;
this.setData({
order: res.data,
})
})
},
updateOrder(e){
let val=util.val(e).trim();
if(val>0){
App.Advance.SetOrderById({
orderid:this.data.order.id||this.data.options.oid,
pnum:val,
})
}
},
gotoRemark(){
wx.navigateTo({
url: util.http_build_query({...this.data.order},'./remark')
})
},
submitOrder(){
App.Advance.PlaceOrder({
orderid:this.data.order.id||this.data.options.oid,
rid:this.data.options.rid,
identity:this.data.options.identity,
}).then(res=>{
wx.redirectTo({
url: util.http_build_query({...this.data.options,hasSuccess:1},'./success')
})
})
},
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"light",
"usingComponents": {
"nav":"/components/nav/nav",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/pages/cart.wxml-->
<nav id="nav" hasHome backgroundColor="#262628" color="#fefefe">提交订单</nav>
<view class="header">
</view>
<view class="page">
<view class="carts">
<view class="block" wx:for="{{order.cookbooklist}}" wx:key="order.cookbooklist.key">
<view class="title">{{item.name}}</view>
<view class="cart-body">
<view class="cart-item flex-lr" wx:for="{{item.list}}" wx:key="item.list.key">
<view class="icon">
<image src="{{item.cookimg}}"></image>
</view>
<view class="flex-ll name">
<view class="name">{{item.cookname}}</view>
<view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
</view>
<view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
<view class="opt">{{item.num}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="total">共计:¥{{order.price}}</view>
<view class="infos">
<view class="flex-lr item">
<view class="item-label">人数:</view>
<view>
<input placeholder="请输入人数" type="number" value="{{order.pnum||''}}" bindinput="updateOrder"/>
</view>
</view>
<formids bindclick="gotoRemark">
<view class="flex-lr item">
<view class="item-label">备注:</view>
<view class="flex-rr" style="max-width: 80%;">
<view class="desc">{{order.remark||'口味、偏好等要求'}}</view>
<view class="more"></view>
</view>
</view>
</formids>
</view>
<formids class="submit" bindclick="submitOrder">
<view class="submit">确认下单</view>
</formids>
</view>
... ...
/* pack-cookbook/pages/cart.wxss */
page{
background-color: #F5F5F5;
}
.header{
height: 280rpx;
background-color: #262628;
margin-top: -2rpx;
color:#FEFEFE;
font-size: 34rpx;
}
.page{
position: fixed;
top:150rpx;
bottom: 0;
left: 10rpx;
right: 10rpx;
background-color: #fefefe;
border-radius: 10rpx;
overflow-y: auto;
}
.footer{
position: fixed;
bottom: 0;
left: 0;
right: 0;
text-align: center;
background-color: #f5f5f5;
}
.footer .infos{
margin: 0 10rpx 20rpx;
background-color: #fefefe;
border-radius: 10rpx 10rpx 0 0;
font-size: 28rpx;
padding: 0 20rpx;
}
.footer .infos .item{
height: 100rpx;
line-height: 100rpx;
}
.infos input{
text-align: right;
}
.infos .desc{
margin-right: 20rpx;
white-space:nowrap;
overflow: hidden;
max-width: 95%;
color: #999999;
line-height: 100rpx;
}
.infos .item-label{
min-width: 100rpx;
overflow: hidden;
white-space:nowrap;
text-align: left;
}
.footer .submit{
height: 98rpx;
line-height: 98rpx;
background-color: #262628;
color:#fefefe;
font-size: 34rpx;
}
.total{
height: 140rpx;
line-height: 140rpx;
border-top: 2rpx solid #F5F5F5;
border-radius: 0 0 10rpx 10rpx;
margin:0 10rpx 20rpx;
text-align: right;
background-color: #fefefe;
font-weight: bold;
font-size: 36rpx;
padding-right: 34rpx;
}
.carts{
overflow-y: auto;
padding: 0 5% 680rpx;
}
.carts image{
width: 100%;
height: 100%;
}
.carts .icon{
width: 48rpx;
min-width: 48rpx;
height: 48rpx;
background-color: #f5f5f5;
border-radius: 50%;
overflow: hidden;
margin-right: 20rpx;
}
.carts .title{
height:80rpx;
line-height: 80rpx;
font-size: 28rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.cart-body{
}
.cart-item{
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
}
.cart-item .name{
width: 60%;
overflow: hidden;
white-space:nowrap;
}
.cart-item .name .name{
width: auto;
max-width: 80%;
}
.cart-item .price{
width: 200rpx;
min-width: 200rpx;
white-space:nowrap;
margin-left: 20rpx;
overflow: hidden;
}
.cart-item .opt{
font-size: 30rpx;
min-width: 50rpx;
width: 50rpx;
text-align: right;
}
.practice_name{
border: 2rpx solid #C8B16D;
font-size: 24rpx;
height: 30rpx;
line-height: 30rpx;
color:#C8B16D;
padding: 0 6rpx;
margin-left: 18rpx;
}
\ No newline at end of file
... ...
... ... @@ -4,147 +4,179 @@ import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
scrollTop:0,
isloading:true,
toView:"",
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
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getCookList();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
/**
* 页面的初始数据
*/
data: {
scrollTop: 0,
isloading: true,
toView: "",
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,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options: options,
})
this.getCookList();
this.initOrder();
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity,
status:'0,1'
}).then(res => {
let orderItemCount=0;
res.data.cookbooklist.forEach(cb=>{
orderItemCount+=parseInt(cb.num)
})
this.setData({
totalWidth:getApp().system.windowWidth,
singleWidth:parseInt((getApp().system.windowWidth*0.92-16)/2),
totalHeight:getApp().system.windowHeight,
kindHeight:getApp().system.windowHeight-68
[`options.oid`]:res.data.id,
order: res.data,
orderItemCount:orderItemCount,
})
},
})
},
dispalyCart(){
this.selectComponent("#cart").auto();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.setData({
totalWidth: getApp().system.windowWidth,
singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2),
totalHeight: getApp().system.windowHeight,
kindHeight: getApp().system.windowHeight - 68
})
setTimeout(()=>{
this.initScrollHeightList();
},1000)
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title:'一起来点菜啦!',
imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-go.jpg',
}
},
formatCookList(list){
//原栏目下显示
let hasShowClass=false;
let hasShowClass = false;
//菜单中展示沽清的菜品
let hasClearCookbook=false;
let hasClearCookbook = false;
//十道必选菜
let has10CaiOpen=false;
let flist=[];
if(list.length>0) {
has10CaiOpen=list[0].status==1;
let has10CaiOpen = false;
let flist = [];
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 = [];
//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;
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;
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;
if (clear_num == 0) {
item_clear_num = 0;
}
}
cook.item_clear_num=item_clear_num;
if(item_clear_num==0){
flag=false;
cook.item_clear_num = item_clear_num;
if (item_clear_num == 0) {
flag = false;
}
}
if(flag){
if (flag) {
cooks.push(cook);
//cooks_order.push(cook.order_o);
}
}
})
if(cooks.length>0){
if (cooks.length > 0) {
//cooks 排序...
cate.cookbooklist[0]=cooks;
cate.cookbooklist[0] = cooks;
flist.push(cate)
}
}
... ... @@ -152,104 +184,125 @@ Page({
}
return flist;
},
getCookList:function(orderid){
let param={
sellerid: 80,
//status:this.data.fromSoucre!=''?1:'',
identity:1
getCookList: function (orderid) {
let param = {
sellerid: this.data.options.sid,
identity: this.data.options.identity,
orderid : this.data.options.oid,
status:'0,1',
};
if(orderid){
param.orderid=orderid;
}
App.Cookbook.GetCookbookByClass(param).then(json=>{
App.Advance.GetCookbookByClass(param).then(json => {
//菜单分类添加修饰
let cookbooklist = this.formatCookList(json.data[0].list);
setTimeout(()=>{
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,
countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0,
countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0,
isloading: false,
showSkeleton: false,
})
},1000)
}, 0)
}).catch(res=>{
console.log('getCookList-catch',res);
}).catch(res => {
console.log('getCookList-catch', res);
this.selectComponent("#network").show('网络不给力,请检查网络后重试');
});
},
//菜品分类操作
changeList: function (e) {
var _id=e.detail.id;
console.log('changeList','inToView' + _id)
var _id = e.detail.id;
console.log('changeList', 'inToView' + _id)
this.setData({
toView: 'inToView' + _id,
});
},
foodCardCallback(e){
let opt=e.detail;
console.log('foodCardCallback',opt);
if(opt.type=='specWin'){
if(opt.value=='show'){
this.setData({scrollZindex:9999});
}else{
this.setData({scrollZindex:'auto'});
let opt = e.detail;
console.log('foodCardCallback', opt);
if (opt.type == 'specWin') {
if (opt.value == 'show') {
this.setData({scrollZindex: 9999});
} else {
this.setData({scrollZindex: 'auto'});
}
return;
}
let books=this.data.cookbooklist;
books.forEach(menu=>{
menu.cookbooklist[0].forEach(book=>{
if(book.id==opt.cookbookid){
book.num=opt.num;
let books = this.data.cookbooklist;
books.forEach(menu => {
menu.cookbooklist[0].forEach(book => {
if (book.id == opt.cookbookid || 'flushOrder'==opt.type) {
book.num = opt.num;
}
})
})
this.setData({
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='订单已清台'
if('flushOrder'==opt.type){
this.setData({
countTotal: 0,
cookbooklist: books
});
}else{
this.setData({
countTotal: this.data.countTotal + opt.type,
cookbooklist: books
});
}
setTimeout(()=>{
this.initOrder();
},100)
},
gotoCart(){
if(this.data.orderItemCount<1){
return util.toast('请添加菜品','none');
}
//购物车
wx.navigateTo({
url: util.http_build_query(this.data.options,'./cart')
})
},
getClassNameFlag:true,
bindscroll(e){
if(!this.getClassNameFlag) return;
this.getClassNameFlag=false;
//console.log('this.scrollHeightList',this.scrollHeightList)
let maxMX=9999999;
let activeId='';
Object.keys(this.scrollHeightList).forEach(tid=>{
let mx=parseInt(e.detail.scrollTop)-parseInt(this.scrollHeightList[tid].top)
if(mx>-100){
if(mx<maxMX) {
maxMX=mx;
activeId=tid;
}
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)
}
})
if(activeId && this.data.activeId!=activeId){
console.log(activeId, this.scrollHeightList[activeId].dataset.name)
this.setData({
activeId:activeId,
})
this.selectComponent("#menu").activeMenuID(activeId);
}
this.getClassNameFlag=true;
},
scrollHeightList:{},
initScrollHeightList(scroll){
//if(Object.keys(this.scrollHeightList).length>0) return;
let that=this;
return new Promise(function(success,fail){
var query = wx.createSelectorQuery();
query.selectAll('.list-model-masonry').boundingClientRect()
query.exec(function (res) {
for(let i=0;i<res[0].length;i++){
let x=res[0][i];
//x.top=parseInt(scroll.detail.scrollTop)+parseInt(x.top);
that.scrollHeightList[x.id]=x;
}
success()
})
})
},
})
\ No newline at end of file
... ...
... ... @@ -5,6 +5,10 @@
"usingComponents": {
"foodCard": "../components/food-card/food-card",
"cookClass": "../components/cook-class/cook-class",
"nav":"/components/nav/nav"
"nav":"/components/nav/nav",
"cart":"../components/cart/cart",
"formids":"/components/formids/formids",
"userinfo":"/components/userinfo/userinfo",
"network":"/components/network/network"
}
}
\ No newline at end of file
... ...
... ... @@ -8,48 +8,52 @@
style = "height:{{totalHeight}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;"
scroll-into-view = "{{toView}}"
scroll-with-animation
bindscroll="bindscroll"
>
<view style = "padding-left:180rpx;">
<view class="section" wx:for="{{cookbooklist}}" wx:key="cookbooklist-key">
<view id="{{'inToView'+item.id}}"></view>
<view class="list-model-masonry" >
<view id="{{'inToView'+item.id}}" class="class_name {{activeId==item.id?'class_name-active11':''}}">
<view class="text">{{item.class_name}}</view>
</view>
<view class="list-model-masonry" id="{{item.id}}" data-name="{{item.class_name}}">
<view class="list-model-column">
<block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" >
<view class="item">
<foodCard item="{{item}}"
sellerid="{{sellerid}}" orderid="{{orderid}}"
fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
sellerid="{{order.sellerid}}" orderid="{{order.id}}"
identity="{{options.identity}}"
bindfoodCardCallback="foodCardCallback"
hasListModel="{{hasListModel}}"
></foodCard>
</view>
</block>
</view>
</view>
</view>
<view style="height: 80px;width: 100%;"></view>
<view style="height: 110px;width: 100%;"></view>
</view>
</scroll-view>
<view class="white flex-lr" style="position:fixed;bottom:0px;width:100%;padding:5px 0;z-index:2000;height:58px;">
<view class="body-view">
</view>
<view class="shopping-total flex-vc list-layout-buttom-opt">
<image src="http://qn.colorcun.com/custom/lite/image/cook-list-gwc.png" class="icon" />
<view style="color:#fff;font-size:24rpx;margin-top:-2px;text-align:center;" class="smooth">下单</view>
<block wx:if="{{countTotal>0}}">
<view class="show-num fwhite flex-cc smooth">{{countTotal}}</view>
</block>
<button bindgetuserinfo="bindChooseOk" open-type="getUserInfo" class="shop-button"></button>
<bubble id="bubble"></bubble>
<view class="white flex-lr bottom-view">
<button class="share flex-vc button-none" open-type="share">
<view class="flex-vc">
<view class="icon">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image>
</view>
<view class="text">一起点</view>
</view>
</button>
<view class="cart flex-ll" bindtap="dispalyCart">
<view class="icon">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart-black.png"/>
<view class="dot" wx:if="{{orderItemCount>0}}">{{orderItemCount}}</view>
</view>
<view class="text Semibold">¥{{order.price}}</view>
</view>
<!--只有点菜后才显示点好了按钮-->
<userinfo class="place flex-vc" binduserinfo="gotoCart">选好了</userinfo>
</view>
</view>
<cookClass id="menu" bind:changeList="changeList"
cooklist="{{cookbooklist}}" hasListModel="{{hasListModel}}">
</cookClass>
<cart rid="{{options.rid}}" id="cart" order="{{order}}" identity="{{options.identity}}" bindfoodCardCallback="foodCardCallback"></cart>
<network id="network"></network>
\ No newline at end of file
... ...
... ... @@ -111,7 +111,7 @@
}
.column { display: flex; flex-direction: column; width: 50%; max-width:50%; }
.column-space { width: 20px; }
.column .item{margin-bottom: 20px;width:100%; overflow: hidden; border-radius: 10rpx;}
.column .item{width:100%; overflow: hidden; border-radius: 10rpx;}
/**
列表模式
... ... @@ -125,8 +125,6 @@
.list-model .item{
border-radius: 0rpx;
border-bottom: 2rpx solid #F5F5F5;
padding-bottom: 28rpx;
margin-top: 14rpx;
}
.list-layout-buttom-opt{
background-color: #353535;
... ... @@ -160,4 +158,105 @@
width: 100%;
height: 300rpx;
margin-bottom: 10rpx;
}
.bottom-view{
position:fixed;
bottom:0;
width:100%;
z-index:2000;
height:100rpx;
background-color: #fefefe;
color:#353535;
border-top: 2rpx solid #f5f5f5;
}
.bottom-view image{
width: 100%;
height: 100%;
}
.share{
width: 180rpx;
min-width: 180rpx;
border-right: 2rpx solid #E0E0E0;
}
.share .icon{
width: 38rpx;
height: 34rpx;
}
.share .text{
font-size: 20rpx;
line-height: 28rpx;
height: 28rpx;
margin-top: 8rpx;
}
.cart{
width: 100%;
}
.cart .icon{
margin-left: 54rpx;
width: 44rpx;
height: 44rpx;
position: relative;
}
.cart .icon .dot{
position: absolute;
top:-15rpx;
right: -15rpx;
background-color: #E14553;
color:#fefefe;
font-size: 20rpx;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
border-radius: 50%;
text-align: center;
}
.cart .text{
font-size: 36rpx;
margin-left: 34rpx;
}
.place{
width: 238rpx;
min-width: 238rpx;
background-color: #262628;
color: #fefefe;
font-size: 34rpx;
height: 100%;
}
.class_name{
font-size: 26rpx;
font-weight: bold;
height: 120rpx;
line-height: 120rpx;
position: relative;
width: 100%;
background-color: #fefefe;
}
.class_name .text{
background-color: #fefefe;
position: absolute;
padding-right: 20rpx;
}
.class_name:before{
position: absolute;
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 100%;
height: 2rpx;
background-color: #F5F5F5;
}
.class_name-active{
position: fixed;
top:100rpx;
z-index: 999;
left:200rpx;
height: 140rpx;
line-height: 140rpx;
}
\ No newline at end of file
... ...
// pack-cookbook/pages/remark.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
tags:[],
remark:'',
},
/**
* 生命周期函数--监听页面加载
*/
orderid:'',
onLoad: function (options) {
this.orderid=options.id;
App.Advance.GetRemarkBySellerid({
sellerid:options.sellerid,
}).then(res=>{
let obj={
remark:options.remark,
}
obj.tags=res.data;
if(options.remarkid){
let remarkid=options.remarkid.split(',')
res.data.forEach((t)=>{
if(remarkid._indexOf(t.id)>-1){
t.active=true
}
})
}
this.setData(obj)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
activeRemark(e){
let i=util.attr(e,'index');
let tags=this.data.tags;
tags[i].active=!tags[i].active;
console.log(i,tags);
let remark=this.data.remark;
remark=remark.replace(tags[i].remark+'、','')
if(tags[i].active){
remark+=tags[i].remark+'、'
}
this.setData({
remark:remark,
tags:tags,
})
},
inputRemark(e){
let remark=util.val(e).trim();
this.setData({
remark:remark,
})
},
submit(){
let remarkid=[];
let tags=this.data.tags;
tags.forEach(t=>{
if(t.active)
remarkid.push(t.id);
})
if(!this.data.remark){
return util.toast('请填写或选择备注信息','none')
}
App.Advance.SetOrderById({
orderid:this.orderid,
remark:this.data.remark,
remarkid:remarkid.toString(),
}).then(res=>{
wx.navigateBack();
})
}
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"black",
"usingComponents": {
"nav":"/components/nav/nav",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/pages/remark.wxml-->
<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav>
<view class="pages">
<textarea class="textarea" bindinput="inputRemark" value="{{remark}}">
</textarea>
<view class="tip">快捷标签</view>
<view class="tags flex-ll" style="flex-wrap:wrap;">
<block wx:for="{{tags}}" wx:key="tags.key">
<view class="tag {{item.active?'active':''}}"
bindtap="activeRemark"
data-index="{{index}}">{{item.remark}}</view>
</block>
</view>
<formids bindclick="submit">
<view class="submit">保存</view>
</formids>
</view>
\ No newline at end of file
... ...
/* pack-cookbook/pages/remark.wxss */
.pages{
width: 90%;
margin: 40rpx auto 0;
}
.textarea{
border: 2rpx solid #999999;
width: 100%;
height: 240rpx;
}
.tip{
margin-top: 40rpx;
margin-bottom: 40rpx;
font-size: 24rpx;
color: #999999;
}
.tags {
font-size: 30rpx;
color: #C2AC6A;
}
.tag{
border: 2rpx solid #C2AC6A;
height: 50rpx;
line-height: 50rpx;
padding: 0 16rpx;
margin: 0 40rpx 40rpx 0;
}
.tag.active{
background: linear-gradient(to right, #C0AA68, #DFCE8E);
border-width: 0;
color: #fefefe;
}
.submit{
font-size: 34rpx;
width: 300rpx;
height: 80rpx;
line-height: 80rpx;
color:#fefefe;
background-color: #C8B16D;
border-radius: 40rpx;
margin: 300rpx auto 20rpx;
text-align: center;
}
.submit.fouce{
margin: 32rpx auto;
}
\ No newline at end of file
... ...
// pack-cookbook/pages/success.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
moreDisplay:false,
detail:{},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
options:options
})
this.initOrder()
this.getDetail()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
let options={...this.data.options,hasOnlyShow:1};
delete options.hasSuccess
return {
title:'菜品已点好,快来看看都点了什么~',
path:util.http_build_query(options,'/pack-cookbook/pages/success'),
imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-show.jpg',
}
},
initOrder(){
App.Advance.CreateOrder({
rid: this.data.options.rid,
identity:this.data.options.identity,
status:1,
}).then(res => {
res.data.cdateStr=util.unixtoTime(res.data.cdate,'YYYY-MM-DD')
let cookbooklist={};
let i=0;
let moreDisplay=true;
res.data.cookbooklist.forEach(ck=>{
if(!cookbooklist[ck.classid]){
cookbooklist[ck.classid]={'name':ck.class_name,list:[],moreDisplay:moreDisplay}
}
ck.moreDisplay=moreDisplay
cookbooklist[ck.classid].list.push(ck)
i++;
if(i>=4){
moreDisplay=false;
}
})
res.data.booklist=cookbooklist;
this.setData({
order: res.data,
})
})
},
moreDisplay(){
this.setData({
moreDisplay:!this.data.moreDisplay
})
},
gotoEditor(){
let options={...this.data.options,sid:this.data.order.sellerid};
delete options.hasSuccess
wx.redirectTo({
url: util.http_build_query(options,'./index')
})
},
getDetail(fouce=false){
App.Reserve.Detail({
rid: this.data.options.rid,
openid: getApp().openid
},fouce).then(res => {
this.setData({
detail:this.formatDatail(res.data)
})
})
},
formatDatail(detail){
detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II');
detail.tableSubInfo=[];
detail.tables.forEach(t=>{
detail.tableSubInfo.push(t.name);
})
detail.tableSubInfo=detail.tableSubInfo.join('、')
return detail;
},
navEvent(){
wx.navigateBack(2);
},
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"black",
"usingComponents": {
"nav":"/components/nav/nav",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
<!--pack-cookbook/pages/success.wxml-->
<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000" bindNavEvent="navEvent">已点菜品</nav>
<view wx:if="{{options.hasSuccess==1}}">
<view class="pages flex-vc success">
<view class="icon">
<icon type="success" size="47" color="#C8B16D"/>
</view>
<view class="title Medium">订单提交成功</view>
<view class="optx flex-vc">
<view class="opt-view flex-ll">
<formids bindclick="gotoEditor" class="width:50%;">
<view class="but editor" style="width: 100%;">修改菜品</view>
</formids>
<button class="but share button-none" open-type="share">分享</button>
</view>
</view>
</view>
<view class="hr"></view>
</view>
<view class="pages">
<view class="carts">
<block wx:for="{{order.booklist}}" wx:key="order.booklist.key">
<view class="block" hidden="{{!moreDisplay && !item.moreDisplay}}">
<view class="title">{{item.name}}</view>
<view class="cart-body">
<block wx:for="{{item.list}}" wx:key="item.key">
<view class="cart-item flex-lr" hidden="{{!moreDisplay && !item.moreDisplay}}">
<view class="icon">
<image src="{{item.cookimage}}"></image>
</view>
<view class="flex-ll name">
<view class="name">{{item.cookname}}</view>
<view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
</view>
<view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
<view class="opt">{{item.num}}</view>
</view>
</block>
</view>
</view>
</block>
</view>
<view class="moreDisplay flex-vc"
bindtap="moreDisplay"
wx:if="{{order.cookbooklist.length>4}}">{{!moreDisplay?'查看更多':'收起'}}</view>
<view class="total">共计:¥{{order.price}}</view>
</view>
<view class="hr"></view>
<view class="pages">
<view class="infos">
<view class="flex-lr item" wx:if="{{order.remark}}">
<view class="item-label">备注:</view>
<view class="" style="max-width: 85%;line-height: 40rpx; ">{{order.remark||''}}</view>
</view>
<view class="flex-lr item">
<view class="item-label">人数:</view>
<view class="">{{order.pnum||''}}</view>
</view>
<view class="flex-lr item">
<view class="item-label">桌位:</view>
<view class="" style="max-width: 85%;line-height: 40rpx; ">{{detail.tableSubInfo}}</view>
</view>
</view>
</view>
<view class="hr"></view>
<view class="pages">
<view class="infos">
<view class="item">
订单信息
</view>
<view class="flex-ll item">
<view>订单编号:</view>
<view class="">{{order.no}}</view>
</view>
<view class="flex-ll item">
<view>下单时间:</view>
<view class="">{{order.cdateStr}}</view>
</view>
</view>
</view>
<view style="height: 150rpx;width: 100%;"></view>
<view class="optx flex-vc" wx:if="{{options.hasSuccess!=1 && options.hasOnlyShow!=1}}">
<view class="opt-view flex-ll">
<formids bindclick="gotoEditor" class="width:50%;">
<view class="but editor" style="width: 100%;">修改菜品</view>
</formids>
<button class="but share button-none" open-type="share">分享</button>
</view>
</view>
\ No newline at end of file
... ...
/* pack-cookbook/pages/success.wxss */
.pages{
padding: 40rpx 5% 0;
}
.carts{
overflow-y: auto;
}
.carts image{
width: 100%;
height: 100%;
}
.carts .icon{
width: 48rpx;
min-width: 48rpx;
height: 48rpx;
background-color: #f5f5f5;
border-radius: 50%;
overflow: hidden;
margin-right: 20rpx;
}
.carts .title{
height:80rpx;
line-height: 80rpx;
font-size: 28rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.cart-body{
}
.cart-item{
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
}
.cart-item .name{
width: 60%;
overflow: hidden;
white-space:nowrap;
}
.cart-item .name .name{
width: auto;
max-width: 80%;
}
.cart-item .price{
width: 200rpx;
min-width: 200rpx;
white-space:nowrap;
margin-left: 20rpx;
overflow: hidden;
}
.cart-item .opt{
font-size: 30rpx;
min-width: 50rpx;
width: 50rpx;
text-align: right;
}
.total{
height: 140rpx;
line-height: 140rpx;
border-top: 2rpx solid #F5F5F5;
border-radius: 0 0 10rpx 10rpx;
margin:0 10rpx 20rpx;
text-align: right;
font-weight: bold;
font-size: 36rpx;
padding-right: 34rpx;
}
.hr{
height: 20rpx;
background-color: #f5f5f5;
width: 100%;
}
.infos{
background-color: #fefefe;
font-size: 28rpx;
padding-bottom: 20rpx;
}
.infos .item{
height: 80rpx;
line-height: 80rpx;
border-bottom: 2rpx solid #F5F5F5;
}
.infos input{
text-align: right;
}
.infos .desc{
margin-right: 20rpx;
white-space:nowrap;
overflow: hidden;
max-width: 95%;
color: #999999;
}
.infos .item:last-child{
border-bottom-width:0;
}
.infos .item-label{
min-width: 100rpx;
overflow: hidden;
white-space:nowrap;
}
.optx{
height: 96rpx;
line-height: 96rpx;
background-color: #262628;
position: fixed;
bottom: 0;
left:0;
right: 0;
color:#fefefe;
font-size: 34rpx;
}
.opt-view{
height: 50rpx;
line-height: 50rpx;
width: 100%;
}
.opt-view .but{
width: 50%;
text-align: center;
}
.opt-view .but:first-child{
border-right: 2rpx solid #979797;
}
.pages .optx{
position: relative;
background-color: #fefefe;
color: #262628;
border: 2rpx solid #262628;
height: 80rpx;
line-height: 80rpx;
margin-bottom: 74rpx;
width: 100%;
}
.success image{
width: 100%;
height: 100%;
}
.success .icon{
width: 100rpx;
height: 100rpx;
margin-top: 46rpx;
}
.success .title{
font-size: 36rpx;
margin-top: 36rpx;
margin-bottom: 100rpx;
}
.success .info{
font-size: 26rpx;
color:#999999
}
.moreDisplay{
height: 100rpx;
line-height: 100rpx;
color: #999999;
font-size: 28rpx;
}
.practice_name{
border: 2rpx solid #C8B16D;
font-size: 24rpx;
height: 30rpx;
line-height: 30rpx;
color:#C8B16D;
padding: 0 6rpx;
margin-left: 18rpx;
}
\ No newline at end of file
... ...
{
"name": "xcx-book",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "http://123.56.79.57/xt/xcx-book.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"mta-wechat-analysis": "^1.3.7"
}
}
... ...