Commit 18cb2d993f81c088b841b5ffb6f2a19af793571d

Authored by wangfan
2 parents d948eac0 c8bff393

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

Showing 89 changed files with 4048 additions and 1622 deletions
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"
}
}
... ...
... ... @@ -3,20 +3,20 @@ import util from '../../utils/util';
import comm from '../../utils/bookCommon';
import App from '../../utils/api';
const {regeneratorRuntime} = global
const formTpl={
rid:'',
date:0,
time:0,
//pnum_str:'1-4',
pnum:6,
tabid:0,
const formTpl = {
rid: '',
date: 0,
time: 0,
//pnum_str:'1-4',
pnum: 6,
tabid: 0,
rname:'',
phone:'',
sex:1,
cusdem:'',
rname: '',
phone: '',
sex: 1,
cusdem: '',
tid:[],
tid: [],
}
Page({
... ... @@ -25,124 +25,127 @@ Page({
* 页面的初始数据
*/
data: {
dateStr:[],
form:JSON.parse(JSON.stringify(formTpl)),
tables:[],
grand:[
{
sex:1,
grand_title:'先生',
isselect:true
},
{
sex:2,
grand_title:'女士',
isselect:false
},
{
sex:3,
grand_title:'公司',
isselect:false
}
],
buttonhide:true,
calendarMaskLoad:false,
calendarMask:false,
dayStyle:[
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
],
timePickerArray:[
[],
[],
[],
],
timePickerIndex:[0,0,0],
tablesLength:0,
timePickerMask:false,
pnumInputFocus:false,
pageMarginBottom:0,
speciallist:[],
calendar:{
nextNum:0,
dateStr: [],
form: JSON.parse(JSON.stringify(formTpl)),
tables: [],
grand: [
{
sex: 1,
grand_title: '先生',
isselect: true
},
{
sex: 2,
grand_title: '女士',
isselect: false
},
{
sex: 3,
grand_title: '公司',
isselect: false
}
],
buttonhide: true,
calendarMaskLoad: false,
calendarMask: false,
dayStyle: [
{month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'},
{month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'}
],
timePickerArray: [
[],
[],
[],
],
timePickerIndex: [0, 0, 0],
tablesLength: 0,
timePickerMask: false,
pnumInputFocus: false,
pageMarginBottom: 0,
speciallist: [],
calendar: {
nextNum: 0,
},
defDtime:['','12:00','18:30'],
hasUseDefDtime:true,
defDtime: ['', '12:00', '18:30'],
hasUseDefDtime: true,
},
/**
* 生命周期函数--监听页面加载
*/
reserve_id:'',
reserve_id: '',
checkedTables:{},//已选中的桌子集合
onLoad: async function (options) {
this.initLoad(options)
this.initLoad(options)
},
async initLoad(options={}){
let nt=new Date()/1000;
let speciallist=[
{ date: util.unixtoTime(nt,'YYYY-MM-DD'), background: '', text:'今 天' },
{ date: util.unixtoTime(nt+86400,'YYYY-MM-DD'), background: '', text: '明 天' },
{ date: util.unixtoTime(nt+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' },
];
this.reserve_id=options.id||'';
async initLoad(options = {}){
let nt = new Date() / 1000;
let speciallist = [
{date: util.unixtoTime(nt, 'YYYY-MM-DD'), background: '', text: '今 天'},
{date: util.unixtoTime(nt + 86400, 'YYYY-MM-DD'), background: '', text: '明 天'},
{date: util.unixtoTime(nt + 86400 * 2, 'YYYY-MM-DD'), background: '', text: '后 天'},
];
this.reserve_id = options.id || '';
await this.setDateStr();
this.sellerid=util.cache('sellerid');
let timePickerArray= await comm.getDayTimeSpace();
this.sellerid = util.cache('sellerid');
let timePickerArray = await comm.getDayTimeSpace();
//判断hasUseDefDtime
let hasUseDefDtime=true;
let mmii=util.unixtoTime(new Date()/1000,'HH:II');
if(mmii>this.data.defDtime[this.data.form.time]){
hasUseDefDtime=false;
let hasUseDefDtime = true;
let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
if (mmii > this.data.defDtime[this.data.form.time]) {
hasUseDefDtime = false;
}
this.setData({
timePickerArray: timePickerArray,
speciallist:speciallist,
hasUseDefDtime:hasUseDefDtime,
speciallist: speciallist,
hasUseDefDtime: hasUseDefDtime,
})
if(this.reserve_id>0){
if (this.reserve_id > 0) {
this.initModify(this.reserve_id);
}else{
} else if(options.hasQuick==1){
this.initQuick(options);
} else {
this.getTables();
}
},
/**
*
* @param d
*
*/
async setDateStr(d=new Date()/1000){
let ns=new Date()/1000;
let dateStr=[
util.unixtoTime(ns,'MM-DD `DAY/周WW`'),
util.unixtoTime(parseInt(ns)+86400,'MM-DD `DAY/周WW`'),
];
//let dateStr=this.data.dateStr;
let nowStr=util.unixtoTime(d,'MM-DD `DAY/周WW`')
let form=this.data.form;
let timeObj = await comm.getTimeSpaceIndexData(d);
//form.time=await comm.getTimeSpaceIndex(d);
form.time=timeObj.timeIndex;
let ind=dateStr._indexOf(nowStr);
if(ind>-1){
form.date=ind
}else{
dateStr.push(nowStr.substr(0,5));
form.date=2;
}
let timePickerIndex=this.data.timePickerIndex;
timePickerIndex[timeObj.timeIndex]=timeObj.timeMatchIndex;
let obj={
dateStr:dateStr,
form:form,
timePickerIndex:timePickerIndex,
timeOpt:timeObj.timeOpt,
};
this.setData(obj)
return obj;
/**
*
* @param d
*
*/
async setDateStr(d = new Date() / 1000){
let ns = new Date() / 1000;
let dateStr = [
util.unixtoTime(ns, 'MM-DD `DAY/周WW`'),
util.unixtoTime(parseInt(ns) + 86400, 'MM-DD `DAY/周WW`'),
];
//let dateStr=this.data.dateStr;
let nowStr = util.unixtoTime(d, 'MM-DD `DAY/周WW`')
let form = this.data.form;
let timeObj = await comm.getTimeSpaceIndexData(d);
//form.time=await comm.getTimeSpaceIndex(d);
form.time = timeObj.timeIndex;
let ind = dateStr._indexOf(nowStr);
if (ind > -1) {
form.date = ind
} else {
dateStr.push(nowStr.substr(0, 5));
form.date = 2;
}
let timePickerIndex = this.data.timePickerIndex;
timePickerIndex[timeObj.timeIndex] = timeObj.timeMatchIndex;
let obj = {
dateStr: dateStr,
form: form,
timePickerIndex: timePickerIndex,
timeOpt: timeObj.timeOpt,
};
this.setData(obj)
return obj;
},
... ... @@ -157,16 +160,16 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
//if(!this.reserve_id || util.cache('tableid').length>0){
if(util.cache('tableid').length>0){
this.getTables();
}
setTimeout(()=>{
this.setData({
calendarMaskLoad:true,
})
},1000);
this.conditionInfo()
//if(!this.reserve_id || util.cache('tableid').length>0){
if (util.cache('tableid').length > 0) {
this.getTables();
}
setTimeout(() => {
this.setData({
calendarMaskLoad: true,
})
}, 1000);
this.conditionInfo()
},
/**
... ... @@ -203,401 +206,429 @@ Page({
onShareAppMessage: function () {
},
selectedValue(e){
console.log(e);
let key=util.attr(e,'key');
let val;
let sobj={};
if(e.type=='input' || e.type=='confirm'){
val=util.val(e);
if(key=='phone'){
var that=this;
if(e.detail.value!='' && e.detail.value.length>=3) {
App.Reserve.GetReserveUser(
{
keywords:e.detail.value,
sid:this.sellerid
}
).then(function(json){
if(json.ret==200 && json.data.length>0){
that.setData({
searchlist:json.data
})
}else{
that.setData({
searchlist:null
})
}
})
}else{
this.setData({
searchlist:null
})
}
}
if(key=='pnum'){
sobj.pnumInputFocus=true;
}
}else{
val=util.attr(e,'value');
}
if(key=='time'){
if(this.data.timeOpt[val]) return;
}
if((key=='time' && this.data.form.time==val) || (key=='date' && this.data.form.date==val) ){
if(util.attr(e,'display')!='block') {
return;
selectedValue(e){
console.log(e);
let key = util.attr(e, 'key');
let val;
let sobj = {};
if (e.type == 'input' || e.type == 'confirm') {
val = util.val(e);
if (key == 'phone') {
var that = this;
if (e.detail.value != '' && e.detail.value.length >= 3) {
App.Reserve.GetReserveUser(
{
keywords: e.detail.value,
sid: this.sellerid
}
).then(function (json) {
if (json.ret == 200 && json.data.length > 0) {
that.setData({
searchlist: json.data
})
} else {
that.setData({
searchlist: null
})
}
})
} else {
this.setData({
searchlist: null
})
}
}
let form=this.data.form;
if(key=='tid'){
let ts=this.data.tables;
if(ts[val].isselect){
ts[val].isselect=false;
form.tid.remove(ts[val].id);
}else{
ts[val].isselect=true;
form.tid.push(ts[val].id);
}
sobj.tables=ts;
}else{
form[key]=val;
if (key == 'pnum') {
sobj.pnumInputFocus = true;
}
console.log('ts',sobj.tables);
//console.log(e.type,key,val,form);
sobj.form=form;
sobj.buttonhide=true;
if(form.tid.length>0 && form.rname.length>0){
sobj.buttonhide=false;
} else {
val = util.attr(e, 'value');
}
if (key == 'time') {
if (this.data.timeOpt[val]) return;
}
if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
if (util.attr(e, 'display') != 'block') {
return;
}
let displayTimes=false;
if(key=='time'){
if(util.attr(e,'display')=='block'){
displayTimes=true;
sobj.timePickerMask=true;
}
}
let form = this.data.form;
if (key == 'tid') {
let ts = this.data.tables;
if (ts[val].isselect) {
ts[val].isselect = false;
form.tid.remove(ts[val].id);
delete this.checkedTables[ts[val].id]
} else {
ts[val].isselect = true;
form.tid.push(ts[val].id);
this.checkedTables[ts[val].id]=ts[val].name
}
if('date,time,pnum,pnum_str,tabid'.indexOf(key)>-1){
if(!displayTimes){
sobj.form.tid=[];
sobj.buttonhide=true;
this.getTables();
}
if(key=='date'){
let xtime=util.unixtoTime(new Date()/1000,'YYYY-'+(this.data.dateStr[val].substr(0,5))+' HH:II:SS');
this.setDateStr(util.timetouUnix(xtime));
}
sobj.tables = ts;
} else {
form[key] = val;
}
console.log('ts', sobj.tables,this.checkedTables);
//console.log(e.type,key,val,form);
sobj.form = form;
sobj.buttonhide = true;
if (form.tid.length > 0 && form.rname.length > 0) {
sobj.buttonhide = false;
}
let displayTimes = false;
if (key == 'time') {
if (util.attr(e, 'display') == 'block') {
displayTimes = true;
sobj.timePickerMask = true;
}
//判断hasUseDefDtime
if((key=='time' || key=='date') && !sobj.timePickerMask){
sobj.hasUseDefDtime=true
}
if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
if (!displayTimes) {
//sobj.form.tid = []; //切换日期时间清空桌位
sobj.buttonhide = true;
this.getTables();
}
if(this.data.form.date==0){//
let mmii=util.unixtoTime(new Date()/1000,'HH:II');
if(mmii>this.data.defDtime[key=='time'?val:this.data.form.time]){
sobj.hasUseDefDtime=false;
}
if (key == 'date') {
let xtime = util.unixtoTime(new Date() / 1000, 'YYYY-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
this.setDateStr(util.timetouUnix(xtime));
}
this.setData(sobj)
},
async getTables(){
let form=this.data.form;
let tableid=util.cache('tableid');
console.log('getTables-tableid',tableid.length,this.reserve_id);
if(tableid.length<1 && this.reserve_id){
tableid=this.data.form.tid;
}
console.log('getTables-tableid',tableid,tableid.length);
try{
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
App.Reserve.GetTableList({
sid:this.sellerid,
//pnum_str:form.pnum_str,
pnum:form.pnum,
rdate:rdate,
tid:form.tabid,
rid:this.reserve_id,
}).then(res=>{
let tables=[],tables_tmp=[];
let tablesLength=0;
if(tableid.length>0){
res.data.forEach(p=>{
//if(tables.length>=3) return true;
p.list.forEach(t=>{
tablesLength++;
if(tables.length>=3) return true;
if(tableid._indexOf(t.id)>-1){
t.isselect=true;
tables.push(t);
}
})
})
wx.removeStorage({key:'tableid'})
}else{
res.data.forEach(p=>{
p.list.forEach(t=>{
tablesLength++;
//if(tables.length>=3) return true;
if(t.tid==2) {
tables.push(t);
}else{
tables_tmp.push(t);
}
})
})
if(tables.length<3){
tables=tables.concat(tables_tmp);
}
if(tables.length>=3){
tables=tables.slice(0,3);
}
}
this.tablesLength=tablesLength;
this.setData({
tables:tables,
tablesLength:tablesLength
})
}
//判断hasUseDefDtime
if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
sobj.hasUseDefDtime = true
}
if (this.data.form.date == 0) {//
let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
sobj.hasUseDefDtime = false;
}
}
this.setData(sobj)
},
async getTables(){
let form = this.data.form;
let tableid = util.cache('tableid');
console.log('getTables-tableid', tableid.length, this.reserve_id);
//if (tableid.length < 1 && this.reserve_id) {
if (tableid.length < 1) {
tableid = this.data.form.tid;
}
console.log('getTables-tableid', tableid, tableid.length);
try {
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
console.log('rdate', this.data.dateStr[this.data.form.date], rdate);
App.Reserve.GetTableList({
sid: this.sellerid,
//pnum_str:form.pnum_str,
pnum: form.pnum,
rdate: rdate,
tid: form.tabid,
rid: this.reserve_id,
}).then(res => {
let tables = [], tables_tmp = [];
let tablesLength = 0;
if (tableid.length > 0) {
let toastTables={...this.checkedTables}
res.data.forEach(p => {
//if(tables.length>=3) return true;
p.list.forEach(t => {
delete toastTables[t.id]
tablesLength++;
if (tables.length >= 3) return true;
if (tableid._indexOf(t.id) > -1) {
t.isselect = true;
tables.push(t);
}
})
}catch (e){
})
console.log('toastTables',toastTables);
//清理已选中的桌位
let toastTablesInfo=[];
let tid=this.data.form.tid
Object.keys(this.checkedTables).forEach(ckid=>{
if(toastTables[ckid]){
delete this.checkedTables[ckid]
tid.remove(ckid);
toastTablesInfo.push(toastTables[ckid]);
}
})
if(toastTablesInfo.length>0){
this.setData({
tables:[]
[`form.tid`]:tid,
})
util.toast(toastTablesInfo.toString()+'已被占用啦','none');
}
wx.removeStorage({key: 'tableid'})
}
},
async formsubmit(){
if(this.data.buttonhide) return;
try {
let d_stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
this.data.form.time,d_stimestr);
let stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
this.data.form.time,stimestr);
console.log('stimestr', stimestr,this.data.form.time,this.data.timePickerIndex);
console.log('rdate', rdate);
this.setData({
buttonhide: true,
})
let form = JSON.parse(JSON.stringify(this.data.form));
console.log('typeof form.tid',typeof form.tid);
if(typeof form.tid=='object'){
let tid= new Set(form.tid);//tid 去重
form.tid = [...tid].toString();
}
if(!form.tid){
return util.toast('请选择桌子','none');
}
form.sid = this.sellerid;
form.rdate =rdate
if(!form.rid){
try{
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
let note_openid=enter_params.seller_openid;
let note_name=sc.seller_user.nickname;
form.note_openid=note_openid||'';
form.note_name=note_name||'';
}catch (e){}
}
form.ddate=d_rdate.substr(0,10);
if(this.data.hasUseDefDtime && this.data.form.time>0){//转为默认时间
let ddateStr=util.unixtoTime(form.ddate,"YYYY-MM-DD "+this.data.defDtime[this.data.form.time]+":00");
form.ddate=util.timetouUnix(ddateStr);
}
App.Reserve.SetReserveInfo(form).then(res => {
if(res.ret==200){
let _id=(res.data.id || res.data)
this.setData({
form:JSON.parse(JSON.stringify(formTpl)),
tables:[],
timePickerIndex:[0,0,0],
})
this.initLoad();
App.Reserve.Detail({rid:_id,openid:''},'clear')
wx.navigateTo({
url:'b_detail?id='+_id,
});
}else{
util.toast(res.msg,'none')
}
if(tables.length<1){
tablesLength=0;
tables_tmp = [];
res.data.forEach(p => {
p.list.forEach(t => {
tablesLength++;
//if(tables.length>=3) return true;
if (t.tid == 2) {
tables.push(t);
} else {
tables_tmp.push(t);
}
})
}catch (e){}
},
selectphone:function(e){
this.data.form.phone=e.detail.phone;
this.data.form.rname=e.detail.rname;
this.data.form.cusdem=e.detail.cusdem;
var form=this.data.form
this.data.form.sex=e.detail.sex;
this.setData({
form:this.data.form,
searchlist:null
})
this.conditionInfo();
},
calendarShow(){
this.setData({
calendarMask:true
})
},
dateChange(event){
console.log(event);
//let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
let cktime=util.timetouUnix(event.detail.date)
let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
if(cktime<day0){
util.toast('请选择有效日期','none');
return;
})
if (tables.length < 3) {
tables = tables.concat(tables_tmp);
}
if (tables.length >= 3) {
tables = tables.slice(0, 3);
}
}
let clickDay = event.detail.date.substr(8,2);
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.tablesLength = tablesLength;
this.setData({
[changeDay]: clickDay,
[changeBg]: "#84e7d0",
[`form.tid`]:[],
buttonhide:true,
})
this.setDateStr(cktime==day0?new Date()/1000:cktime)
this.getTables();
this.calendarClose();
},
calendarClose(){
this.setData({
calendarMask:false,
timePickerMask:false,
})
},
async selectdesk(){
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
console.log(this.data.form)
wx.navigateTo({
url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid
//+'&pnum_str='+this.data.form.pnum_str
+'&pnum='+this.data.form.pnum
+'&checked_tids='+this.data.form.tid
+'&rid='+this.reserve_id
tables: tables,
tablesLength: tablesLength
})
},
conditionInfo:function(){
var form=this.data.form
if(form.tid.length>0 && form.rname.length>0){
this.data.buttonhide=false;
})
} catch (e) {
this.setData({
tables: []
})
}
},
async formsubmit(){
if (this.data.buttonhide) return;
try {
let d_stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
this.data.form.time, d_stimestr);
let stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
this.data.form.time, stimestr);
console.log('stimestr', stimestr, this.data.form.time, this.data.timePickerIndex);
console.log('rdate', rdate);
this.setData({
buttonhide: true,
})
let form = JSON.parse(JSON.stringify(this.data.form));
console.log('typeof form.tid', typeof form.tid);
if (typeof form.tid == 'object') {
let tid = new Set(form.tid);//tid 去重
form.tid = [...tid].toString();
}
if (!form.tid) {
return util.toast('请选择桌子', 'none');
}
form.sid = this.sellerid;
form.rdate = rdate
if (!form.rid) {
try {
let enter_params = util.cache('enter_params');
let sc = (await App.Reserve.SellerInfo(enter_params)).data
let note_openid = enter_params.seller_openid;
let note_name = sc.seller_user.nickname;
form.note_openid = note_openid || '';
form.note_name = note_name || '';
} catch (e) {
}
this.setData({
buttonhide:this.data.buttonhide
})
},
/**
* 选中时间区域
*/
bindTimePickerChange(e){
let timeIndex=util.attr(e,'timeIndex');
if(timeIndex<0) return;
let timePickerIndex=this.data.timePickerIndex;
//timePickerIndex[timeIndex]=util.val(e);
timePickerIndex[timeIndex]=util.attr(e,'val');
console.log(e,timeIndex,util.attr(e,'val'));
this.setData({
timePickerIndex:timePickerIndex,
hasUseDefDtime:false,
})
},
/**
* 修改初始化
*/
async initModify(id){
try{
let res= await App.Reserve.Detail({rid:id,openid:''});
console.log('initModify',res);
//设置日期
let obj = await this.setDateStr(res.data.ddate);
//设置时间
let nd=util.unixtoTime(res.data.ddate,'HH:II');
let timePickerIndex=this.data.timePickerIndex
console.log('initModify-',this.data.timePickerArray,obj.form.time,nd)
this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{
console.log('initModify-',nd,dd)
if(nd==dd){
timePickerIndex[obj.form.time]=ii;
return true;
}
})
}
form.ddate = d_rdate.substr(0, 10);
if (this.data.hasUseDefDtime && this.data.form.time > 0) {//转为默认时间
let ddateStr = util.unixtoTime(form.ddate, "YYYY-MM-DD " + this.data.defDtime[this.data.form.time] + ":00");
form.ddate = util.timetouUnix(ddateStr);
}
App.Reserve.SetReserveInfo(form).then(res => {
if (res.ret == 200) {
let _id = (res.data.id || res.data)
this.setData({
form: JSON.parse(JSON.stringify(formTpl)),
tables: [],
timePickerIndex: [0, 0, 0],
})
this.initLoad();
this.checkedTables={};
App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
wx.navigateTo({
url: 'b_detail?id=' + _id,
});
} else {
util.toast(res.msg, 'none')
}
})
} catch (e) {
}
},
selectphone: function (e) {
this.data.form.phone = e.detail.phone;
this.data.form.rname = e.detail.rname;
this.data.form.cusdem = e.detail.cusdem;
var form = this.data.form
this.data.form.sex = e.detail.sex;
this.setData({
form: this.data.form,
searchlist: null
})
this.conditionInfo();
},
calendarShow(){
this.setData({
calendarMask: true
})
},
dateChange(event){
console.log(event);
//let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
let cktime = util.timetouUnix(event.detail.date)
let day0 = parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
if (cktime < day0) {
util.toast('请选择有效日期', 'none');
return;
}
let clickDay = event.detail.date.substr(8, 2);
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.setData({
[changeDay]: clickDay,
[changeBg]: "#84e7d0",
//[`form.tid`]: [], //切换日期时间清空桌位
buttonhide: true,
})
this.setDateStr(cktime == day0 ? new Date() / 1000 : cktime)
this.getTables();
this.calendarClose();
},
calendarClose(){
this.setData({
calendarMask: false,
timePickerMask: false,
})
},
async selectdesk(){
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
console.log(this.data.form)
wx.navigateTo({
url: 'b_desk?rdate=' + rdate + '&tid=' + this.data.form.tabid
//+'&pnum_str='+this.data.form.pnum_str
+ '&pnum=' + this.data.form.pnum
+ '&checked_tids=' + this.data.form.tid
+ '&rid=' + this.reserve_id
})
},
conditionInfo: function () {
var form = this.data.form
if (form.tid.length > 0 && form.rname.length > 0) {
this.data.buttonhide = false;
}
this.setData({
buttonhide: this.data.buttonhide
})
},
/**
* 选中时间区域
*/
bindTimePickerChange(e){
let timeIndex = util.attr(e, 'timeIndex');
if (timeIndex < 0) return;
let timePickerIndex = this.data.timePickerIndex;
//timePickerIndex[timeIndex]=util.val(e);
timePickerIndex[timeIndex] = util.attr(e, 'val');
console.log('initModify-timePickerIndex',timePickerIndex);
//obj.form.pnum_str=res.data.pnum_str;
obj.form.pnum=res.data.pnum||6;
obj.form.rname=res.data.rname;
obj.form.phone=res.data.phone;
obj.form.sex=res.data.sex;
obj.form.cusdem=res.data.cusdem;
obj.form.rid=id;
obj.form.tid=[];
let tablesed=[];
res.data.tables.forEach((t,ti)=>{
obj.form.tid.push(t.id)
if(ti>=3) return;
t.isselect=true
t["isselected"]=1
tablesed.push(t);
})
this.setData({
timePickerIndex:timePickerIndex,
form:obj.form,
//tablesed:tablesed,
hasUseDefDtime:false,
})
setTimeout(()=>{
this.getTables();
},300)
console.log(e, timeIndex, util.attr(e, 'val'));
this.setData({
timePickerIndex: timePickerIndex,
hasUseDefDtime: false,
})
},
/**
* 修改初始化
*/
async initModify(id){
try {
let res = await App.Reserve.Detail({rid: id, openid: ''});
}catch (e){
console.log('initModify',e)
console.log('initModify', res);
//设置日期
let obj = await this.setDateStr(res.data.ddate);
//设置时间
let nd = util.unixtoTime(res.data.ddate, 'HH:II');
let timePickerIndex = this.data.timePickerIndex
console.log('initModify-', this.data.timePickerArray, obj.form.time, nd)
this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
console.log('initModify-', nd, dd)
if (nd == dd) {
timePickerIndex[obj.form.time] = ii;
return true;
}
},
pnumInputFocusEvent(e){
console.log(e);
})
console.log('initModify-timePickerIndex', timePickerIndex);
//obj.form.pnum_str=res.data.pnum_str;
obj.form.pnum = res.data.pnum || 6;
obj.form.rname = res.data.rname;
obj.form.phone = res.data.phone || "";
obj.form.sex = res.data.sex;
obj.form.cusdem = res.data.cusdem;
obj.form.rid = id;
obj.form.tid = [];
let tablesed = [];
res.data.tables.forEach((t, ti) => {
obj.form.tid.push(t.id)
if (ti >= 3) return;
t.isselect = true
t["isselected"] = 1
tablesed.push(t);
})
this.setData({
pnumInputFocus:'focus'==e.type
timePickerIndex: timePickerIndex,
form: obj.form,
//tablesed:tablesed,
hasUseDefDtime: false,
})
setTimeout(() => {
this.getTables();
}, 300)
} catch (e) {
console.log('initModify', e)
}
},
pnumInputFocusEvent(e){
console.log(e);
this.setData({
pnumInputFocus: 'focus' == e.type
})
},
inputFocusTime:0,
blurTime:0,
inputFocusTime: 0,
blurTime: 0,
inputFocus(e){
console.log(e,this.inputFocusTime);
console.log(e, this.inputFocusTime);
return;
if(e.timeStamp>this.inputFocusTime){
this.inputFocusTime=e.timeStamp;
if(e.type=='focus' && this.data.pageMarginBottom==0){
if (e.timeStamp > this.inputFocusTime) {
this.inputFocusTime = e.timeStamp;
if (e.type == 'focus' && this.data.pageMarginBottom == 0) {
this.setData({
pageMarginBottom:300
pageMarginBottom: 300
})
setTimeout(res=>{
setTimeout(res => {
this.pageScrollToBottom();
},100)
}else{
if(this.blurTime>5){
this.blurTime=0;
}, 100)
} else {
if (this.blurTime > 5) {
this.blurTime = 0;
this.setData({
pageMarginBottom:0
pageMarginBottom: 0
})
}else{
setTimeout(res=>{
this.blurTime+=1;
} else {
setTimeout(res => {
this.blurTime += 1;
this.inputFocus(e);
},300)
}, 300)
}
}
}
},
pageScrollToBottom: function() {
wx.createSelectorQuery().select('#j_page').boundingClientRect(function(rect){
pageScrollToBottom: function () {
wx.createSelectorQuery().select('#j_page').boundingClientRect(function (rect) {
// 使页面滚动到底部
wx.pageScrollTo({
scrollTop: rect.bottom
... ... @@ -606,17 +637,64 @@ Page({
},
gotoday(e){
this.setData({
[`calendar.nextNum`]:0
[`calendar.nextNum`]: 0
})
},
nextMonth(e){
this.setData({
[`calendar.nextNum`]:this.data.calendar.nextNum+1
[`calendar.nextNum`]: this.data.calendar.nextNum + 1
})
},
prevMonth(e){
this.setData({
[`calendar.nextNum`]:this.data.calendar.nextNum-1
[`calendar.nextNum`]: this.data.calendar.nextNum - 1
})
},
/**
* 快速预定初始化
* tid
* tname
* ddate
* pnum
*/
async initQuick(options){
try {
console.log('initQuick', options);
this.checkedTables[options.tid]=options.tname
options.ddate=options.ddate.substr(0,10);
//设置日期
let obj = await this.setDateStr(options.ddate);
//设置时间
let nd = util.unixtoTime(options.ddate, 'HH:II');
let timePickerIndex = this.data.timePickerIndex
console.log('initQuick-', this.data.timePickerArray, obj.form.time, nd)
this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
console.log('initQuick-', nd, dd)
if (nd == dd) {
timePickerIndex[obj.form.time] = ii;
return true;
}
})
console.log('initQuick-timePickerIndex', timePickerIndex);
obj.form.pnum = options.pnum || 6;
obj.form.rname = "";
obj.form.phone = "";
obj.form.sex = 1;
obj.form.cusdem = "";
obj.form.rid = "";
obj.form.tid = [options.tid];
this.setData({
timePickerIndex: timePickerIndex,
form: obj.form,
hasUseDefDtime: false,
})
setTimeout(() => {
this.getTables();
}, 300)
} catch (e) {
console.log('initQuick', e)
}
},
})
\ No newline at end of file
... ...
... ... @@ -3,13 +3,14 @@
<view class="flex-lr" style="border-top:1rpx solid #E0E0E0">
<view class="menus" style="height: {{height}}px; overflow-y: auto;overflow-x: hidden;align-self:flex-start ">
<view class="menus-item flex-cc {{item.name==menu_active_id?'active':''}}"
wx:for="{{desklist}}" bindtap="switchMenu" data-id="{{item.name}}">
wx:for="{{desklist}}" wx:key="desklist.key"
bindtap="switchMenu" data-id="{{item.name}}">
<view class="name">{{item.name}}</view>
<view class="hip" wx:if="{{item.chenkNum>0}}">{{item.chenkNum}}</view>
</view>
</view>
<view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;">
<block wx:for="{{desklist}}">
<block wx:for="{{desklist}}" wx:key="desklist.key">
<orderDesk list="{{item.list}}" bind:changedesk="changedesk" wx:if="{{item.name==menu_active_id}}"></orderDesk>
</block>
... ...
... ... @@ -8,6 +8,7 @@ Page({
actionSheetItems:['客户取消','客户行程改变']
},
sc:{},
enter_params:{},
onLoad:async function (opt) {
util.setBarTitle('预定详情');
console.log(opt)
... ... @@ -18,8 +19,8 @@ Page({
console.log(res)
}
})
let enter_params=util.cache('enter_params');
this.sc=(await App.Reserve.SellerInfo(enter_params)).data;
this.enter_params=util.cache('enter_params');
this.sc=(await App.Reserve.SellerInfo(this.enter_params)).data;
console.log('this.sc',this.sc);
this.chooseManagerInit();
},
... ... @@ -33,6 +34,9 @@ Page({
this.selectComponent('#notice').close();
var obj=this.data.bookInfo;
var path='/pages/customer/index?id='+this.data.bookInfo.id;
if(this.enter_params){
path+='&fromid='+this.enter_params.seller_openid
}
let nickname="";
try{
nickname='"'+this.sc.seller_user.nickname+'"';
... ... @@ -41,9 +45,9 @@ Page({
console.log('App.Reserve.MakePic',imageUrl);
return {
//title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
title: '你收到一个邀请函,点击查看',
path: path+'&hasInvitation=1',
imageUrl:imageUrl,
title: '点击查看详情,发邀请函',
path: path+'&hasInvitation=1&hasSellerShare=1',
imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-anpai.jpg',
success: function (res) {
console.log(res,666666)
},
... ... @@ -124,7 +128,7 @@ Page({
async getDetail(id,force=false){
let res=await App.Reserve.Detail({rid:id,openid:''},force);
res.data.rdateStr=util.unixtoTime(res.data.ddate,"MM月DD日 HH:II")
res.data.phoneStr=res.data.phone;
res.data.phoneStr=res.data.phone||'';
let enter_params=util.cache('enter_params');
let sc=(await App.Reserve.SellerInfo(enter_params)).data
let note_openid=enter_params.seller_openid;
... ... @@ -137,7 +141,11 @@ Page({
return $1+'**'+$3;
})
}
if(res.data.status==4 && res.data.cancel){
res.data.cancel.cdateStr=util.unixtoTime(res.data.cancel.cdate,"YYYY.MM.DD HH:II")
}
this.detailData=res.data;
this.setData({
tables:res.data.tables,
bookInfo:res.data,
... ... @@ -149,10 +157,11 @@ Page({
})
},
cancelReserve(){
util.toast('不能取消预订','none');return;
this.setData({
actionSheetHidden:false
})
this.selectComponent('#cancel').show();
},
reserveCancel(e){
console.log('reserveCancel',e.detail);
this.getDetail(this.data.bookInfo.id,true);
},
actionSheetChange(e){
this.setData({
... ... @@ -166,5 +175,10 @@ Page({
}).then(()=>{
this.getDetail(this.data.bookInfo.id,true);
});
}
},
showOrder(){
wx.navigateTo({
url:util.http_build_query({rid:this.data.bookInfo.id,oid:this.data.bookInfo.orderid,identity:2},'/pack-cookbook/pages/success')
});
},
})
\ No newline at end of file
... ...
... ... @@ -6,6 +6,8 @@
"noticeCall":"/components/book/notice/notice",
"step":"/components/book/step/step",
"board":"/components/book/board/board",
"nav":"/components/nav/nav"
"cancel":"/components/book/reserveCancel/cancel",
"nav":"/components/nav/nav",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
... ... @@ -9,6 +9,9 @@
<view class="gray-deep-font font30r">用餐人数</view>
<view class="black-font font34r">{{bookInfo.pnum_str||bookInfo.pnum}}人</view>
</view>
<view class="reserve-status-tip" wx:if="{{bookInfo.status!=null}}">
<image src="http://qn.colorcun.com/custom/lite-yd/image/reserve-status-{{bookInfo.status}}.png"></image>
</view>
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">预定座位</view>
<view class="black-font font34r">{{tables.length}}个</view>
... ... @@ -16,7 +19,7 @@
<view class="flex-lr order-desk">
<view class="gray-deep-font font30r"></view>
<view class="flex-re" style="width:100%;flex-wrap:wrap;">
<block wx:for="{{tables}}">
<block wx:for="{{tables}}" wx:key="tables.key">
<board width="160" height="180" board="{{item}}" className="noBottom"
style="margin-left:20rpx;zoom: 0.8; margin-bottom: 20rpx;"></board>
</block>
... ... @@ -52,15 +55,34 @@
<view class="gray-deep-font font30r">记录人</view>
<view class="black-font font34r">{{bookInfo.note_name}}</view>
</view>
</view>
<view class="order-info" wx:if="{{bookInfo.status==4 && bookInfo.cancel}}">
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">取消原因</view>
<view class="flex-lr black-font font34r">
{{bookInfo.cancel.desc}}
</view>
</view>
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">取消时间</view>
<view class="black-font font34r">{{bookInfo.cancel.cdateStr}}</view>
</view>
<view class="flex-lr order-detail">
<view class="gray-deep-font font30r">操作人</view>
<view class="black-font font34r">{{bookInfo.cancel.uname}}</view>
</view>
</view>
<view style="height: 250rpx;"></view>
<!--通知预订人-->
<view class="notice-opt" wx:if="{{bookInfo.status==1}}">
<view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view>
<view class="notice-button-border font34r flex-lr">
<view bindtap="noticeCall">通知预订人</view>
<view wx:if="{{bookInfo.order && bookInfo.order.cookbooklist.length>0}}">
<formids bindclick="showOrder">查看菜品</formids>
</view>
</view>
<view class="notice-button-border font34r flex-lr">
<view bindtap="gotoModify">变更预定</view>
<view bindtap="cancelReserve">取消预定</view>
... ... @@ -72,7 +94,7 @@
</view>
<noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall>
<action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll">
<block wx:for-items="{{actionSheetItems}}">
<block wx:for-items="{{actionSheetItems}}" wx:key="actionSheetItems.key">
<action-sheet-item>{{item}}</action-sheet-item>
</block>
<action-sheet-item>
... ... @@ -80,4 +102,5 @@
</action-sheet-item>
<action-sheet-cancel >取消</action-sheet-cancel>
</action-sheet>
\ No newline at end of file
</action-sheet>
<cancel id="cancel" bindreserveCancel="reserveCancel" bookInfo="{{bookInfo}}"></cancel>
\ No newline at end of file
... ...
... ... @@ -112,7 +112,7 @@ view{
color: #199095;
}
.notice-button-border view{
width: 49%;
width: 100%;
border-right: 2rpx solid #199095;
text-align: center;
height: 50rpx;
... ... @@ -121,3 +121,14 @@ view{
.notice-button-border view:last-child{
border-right-width: 0;
}
.reserve-status-tip{
position: absolute;
top:300rpx;
right:200rpx;
width: 82rpx;
height: 52rpx;
}
.reserve-status-tip image{
width: 100%;
height: 100%;
}
\ No newline at end of file
... ...
var mta=require('mta-wechat-analysis')
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
var bookOrder=require('../../utils/bookCommon.js')
... ... @@ -32,6 +33,15 @@ Page({
indexOpt:null,
YYYY:'YYYY',
onLoad:async function(opt){
this.indexOpt=opt;
mta.Page.init({
"appID":"500667280",
"eventID":"500667287",
"statPullDownFresh":true,
"statShareApp":true,
"statReachBottom":true,
"lauchOpts":opt, //渠道分析
});
let d=new Date()/1000;
let dateStr=util.unixtoTime(d,'MM-DD DAY');
var radio=750/util.getsystem().windowWidth;
... ...
... ... @@ -50,7 +50,7 @@
</view>
<view class="book-list" style="padding-bottom:118rpx;">
<view class="book-list-body">
<block wx:for="{{bookList}}">
<block wx:for="{{bookList}}" wx:key="bookList.key">
<bookList item="{{item}}" class="orderbook"></bookList>
</block>
</view>
... ...
... ... @@ -24,6 +24,7 @@ Page({
calendar:{
nextNum:0,
},
rdate:'',
},
regions:[],
sellerid:0,
... ... @@ -142,6 +143,7 @@ Page({
let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time);
formdata.rdate=rdate;
formdata.status='1,2';
obj.rdate=rdate;
let tids={};
let reserves=await App.Reserve.GetReserveList(formdata);
if(reserves.data.length>0){
... ...
... ... @@ -35,6 +35,7 @@
<view class="items-disks flex-ll" style="flex-wrap: wrap"
wx:if="{{regions_active==item.name}}">
<board width="160" height="180" board="{{item}}"
ddate="{{rdate}}"
style="margin: 20rpx 0 0 20rpx"
bindboardEvent="boardEvent"
event="boardOpt"
... ...
// pages/book/setting/index.js
import util from '../../../utils/util';
import App from '../../../utils/api';
const {regeneratorRuntime} = global
Page({
offset: 0,
limit: 10,
hasMore: true,
list:{},
/**
* 页面的初始数据
*/
data: {
list:[],
hasMore:true,
},
/**
* 生命周期函数--监听页面加载
*/
enter_params: {},
onLoad: function (options) {
this.enter_params = util.cache('enter_params');
this.seller_id=options.seller_id||this.enter_params.seller_id;
this.getMembers();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.hasMore){
this.getMembers(true);
}
},
getMembers(hasReachBottom=false){
App.Reserve.Members({
sid: this.seller_id,
//manager_id:this.enter_params.manager_id,
manager_openid:this.enter_params.seller_openid,
offset: this.offset,
limit: this.limit,
}).then(res => {
let list = this.data.list;
let dl=res.data.length;
if (dl > 0) {
res.data.forEach(r => {
//r.addtimeStr = util.unixtoTime(r.addtime, 'MM/DD HH:II')
list.push(r)
this.list[r.id] = r;
})
}
let obj={list:list};
if(dl<this.limit && hasReachBottom){
this.hasMore=false;
obj.hasMore=false;
}else{
this.offset+=this.limit;
}
this.setData(obj)
})
},
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"light",
"usingComponents": {
"nav":"/components/nav/nav",
"tabBar":"/components/book/tabBar/tabBar",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
<!--pages/book/setting/index.wxml-->
<nav id="nav" backgroundColor="#199095" color="#fefefe">我的客户</nav>
<view class="page">
<block wx:if="{{list.length>0}}">
<view class="row flex-lr" wx:for="{{list}}" wx:key="list.key" >
<view class="flex-ll">
<view class="avatar">
<image src="{{item.headimgurl}}"></image>
</view>
<view class="nickname">{{item.nickname||''}}</view>
</view>
<view class="flex-rr">
<!--view class="more"></view-->
</view>
</view>
</block>
<view wx:else="" class="history-is-empty flex-vc Medium">
<image src="http://qn.colorcun.com/custom/lite-yd/image/history-is-empty.png"></image>
<view>暂时还没有客户</view>
</view>
<view wx:if="{{!hasMore}}" class="row flex-vc">已经到底了</view>
</view>
... ...
/* pages/book/setting/index.wxss */
/*
http://qn.colorcun.com/custom/lite-yd/image/icon-zk.png
http://qn.colorcun.com/custom/lite-yd/image/icon-cz.png
*/
.page{
width: 90%;
margin: 0 auto;
color: #353535;
}
.row{
font-size: 34rpx;
height: 106rpx;
border-bottom: 2rpx solid #F1F0F4;
padding-top: 34rpx;
}
.row .right{
font-size: 30rpx;
color:#999999;
}
.row .more{
margin-left: 20rpx;
}
.row:last-child{
border-bottom-width: 0;
}
.history-is-empty{
margin: 200rpx auto;
font-size: 34rpx;
}
.history-is-empty image{
width: 376rpx;
height: 310rpx;
margin-bottom: 122rpx;
}
.avatar{
width: 80rpx;
height: 80rpx;
border-radius: 50%;
overflow: hidden;
}
.avatar image{
width: 100%;
height: 100%;
}
.nickname{
margin-left: 40rpx;
font-size: 34rpx;
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
<view class="header">
<view class="info">
<view class="nick">{{user.nickname}}</view>
<view class="seller Medium">{{seller.sellername}} | {{user.role_name}}</view>
<view class="seller Medium">{{seller.sellername}} | {{user.role_name||''}}</view>
</view>
</view>
<view class="page">
... ... @@ -24,6 +24,14 @@
</view>
</view>
</formids>
<formids url="/pages/book/crm/index">
<view class="row flex-lr" style="padding-top: 34rpx;">
<view>我的客户</view>
<view class="flex-rr">
<view class="more"></view>
</view>
</view>
</formids>
<formids url="/pages/customer/index?islove=customer">
<view class="row flex-lr" style="padding-top: 34rpx;">
<view>切换到顾客模式</view>
... ...
... ... @@ -135,7 +135,7 @@ Page({
},'clear')
wx.navigateTo({
//id={{detail.id}}&rdate={{detail.rdate}}
url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,
url:'remind?id='+this.id+'&ddate='+this.data.detail.ddate,
});
})
}else{
... ...
... ... @@ -13,7 +13,7 @@
<formids bindclick="reserveCancel">
<view class="opt-button">取消</view>
</formids>
<formids url="./remind?id={{detail.id}}&rdate={{detail.rdate}}&remindtime={{detail.remindtime}}">
<formids url="./remind?id={{detail.id}}&ddate={{detail.ddate}}&remindtime={{detail.remindtime}}">
<view class="opt-button">提醒</view>
</formids>
<userinfo-share
... ...
... ... @@ -142,21 +142,22 @@ Page({
is_agree:1,
userinfo:userInfo
}).then(res=>{
this.setData({
[`detail.hasCanSuccess`]:true
})
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},'clear')
wx.navigateTo({
//id={{detail.id}}&rdate={{detail.rdate}}
url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,
});
util.toast('赴约成功','none')
})
}else{
// wx.navigateTo({
// url:'invite?id='+this.id,
// });
util.toast('赴约成功','none')
}
},
setUserInfoSuccess(){
util.toast('授权成功,可以继续转发','none');
},
reserveCancel(){
let userInfo = util.cache('userInfo');
if (userInfo) {
... ...
... ... @@ -4,9 +4,7 @@
"navigationBarTitleText":"订座详情",
"usingComponents": {
"userinfo": "/components/userinfo/userinfo",
"manager": "/components/manager/manager",
"nav":"/components/nav/nav",
"card":"/components/seller-card/seller-card",
"formids":"/components/formids/formids",
"userinfo-share": "/components/userinfo/share"
}
... ...
... ... @@ -5,16 +5,6 @@
<view class="invit-logo">
<image src="http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png"></image>
</view>
<!--
<view class="avatar">
<image src="{{detail.customers[0].headimgurl}}"></image>
</view>
<view class="invit flex-cc">
<view style="margin-right: 20rpx;">{{detail.rnameStr}}</view>
<view>{{detail.eatStr}}</view>
</view>
<view class="hr-one"></view>
-->
<view class="seller flex-vc">
<view class="title">餐厅</view>
<view class="content name">{{detail.seller.sellername}}</view>
... ... @@ -23,14 +13,25 @@
<view class="title">时间</view>
<view class="content">{{detail.rdateStr}}</view>
<view class="title">地址</view>
<view class="content flex-ll" bindtap="lookLocation">
<view class="content flex-ll" bindtap="lookLocation" style="align-items: flex-start">
<image src="http://qn.colorcun.com/custom/lite-yd/image/invit-addr.png" class="invit-addr"></image>
<view>{{detail.seller.real_address||detail.seller.map_address}}</view>
<view class="addr">{{detail.seller.real_address||detail.seller.map_address}}</view>
</view>
</view>
</view>
<view class="opt-button">
<view class="opt flex-cc">
<button class="but button-none flex-vc" bindtap="lookLocation">一键导航</button>
<button class="but button-none flex-vc" open-type="share" >转发给同行人</button>
<formids class="button-none flex-vc" bindclick="lookLocation">
<image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-1.png"></image>
</formids>
<userinfo-share class="button-none flex-vc" binduserinfo="toast">
<image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-2.png"></image>
</userinfo-share>
</view>
</view>
</view>
<view class="opt-view" wx:if="{{!detail.hasCanSuccess}}">
<userinfo class="button-none flex-vc" binduserinfo="userinfo">
<view class="buts-share"></view>
</userinfo>
</view>
... ...
/* pages/customer/detail_customer.wxss */
page{
.page{
color:#FFFFFF;
background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
background-size: 100%;
}
.page{
overflow-y: auto;
position: fixed;
top:40rpx;
top:0;
bottom: 0;
left:0;
right:0;
... ... @@ -41,44 +39,90 @@ image{
width: 90%;
}
.seller{
margin-top: 150rpx;
margin-top: 40rpx;
}
.seller .title{
font-size: 26rpx;
font-size: 28rpx;
color:#999999;
margin-bottom: 30rpx;
margin-bottom: 20rpx;
height: 40rpx;
line-height: 40rpx;
}
.seller .content{
margin-bottom: 30rpx;
font-size: 30rpx;
line-height: 30rpx;
margin-bottom: 40rpx;
font-size: 36rpx;
line-height: 50rpx;
height: 50rpx;
max-width: 80%;
}
.seller .name{
font-size: 42rpx;
line-height: 42rpx;
.seller .content .addr{
font-size: 32rpx;
line-height: 40rpx;
text-align: center;
}
.invit-addr{
width: 20rpx;
height: 20rpx;
width: 22rpx;
height: 28rpx;
margin-right: 18rpx;
min-width: 22rpx;
margin-top:6rpx ;
}
.opt-view{
position: fixed;
bottom: 100rpx;
width: 100%;
}
.opt{
margin-top: 52rpx;
width: 90%;
margin: 0 auto;
}
.opt .but{
width: 330rpx;
width: 100%;
height: 80rpx;
border: 2rpx solid #ECD9B7;
border-radius: 6rpx;
line-height: 80rpx;
line-height: 78rpx;
text-align: center;
font-size: 30rpx;
color:#ECD9B7;
margin-right: 20rpx;
margin-right: 5%;
padding-bottom: 4rpx!important;
}
.opt .but:last-child{
margin-right: 0;
}
.opt .buts{
width: 288rpx;
height: 80rpx;
}
.opt-button{
margin-top: 48rpx;
width: 100%;
}
.buts-share{
width: 560rpx;
height: 86rpx;
margin: 0 auto;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-3.png");
background-size: 100%;
background-repeat: no-repeat;
background-position: center center;
animation-name: butAnimation;
animation-duration: 0.7s;
animation-iteration-count:9999;
}
.opt-view-tip{
font-size: 26rpx;
color: #999999;
margin-bottom: 20rpx;
}
@keyframes butAnimation
{
50% {background-size:90%;}
}
@-webkit-keyframes butAnimation /* Safari 和 Chrome */
{
50% {background-size:90%;}
}
\ No newline at end of file
... ...
... ... @@ -73,7 +73,11 @@ Page({
// detail.cusman_account='wx:vking';
// }
let ns=new Date()/1000
detail.hasOvered=ns>detail.ddate
detail.hasCancel=detail.status==4
detail.hasOvered=false
if(!detail.hasCancel){
detail.hasOvered=ns>detail.ddate || detail.status>=2
}
return detail;
},
showManager(){
... ... @@ -92,6 +96,7 @@ Page({
},
userinfo(e){
console.log('userinfo',e)
util.toast('授权成功,可以继续转发','none');
// wx.navigateTo({
// url:'invite?id='+this.id,
// });
... ... @@ -121,5 +126,27 @@ Page({
obj.path=obj.path+'&hasInvitation=1';
}
return obj;
}
},
cookbook(){
if(this.data.detail.order && this.data.detail.order.cookbooklist.length>0){
wx.navigateTo({
url:util.http_build_query({rid:this.id,oid:this.data.detail.order.id,identity:1},'/pack-cookbook/pages/success')
});
}else{
App.Advance.CreateOrder({
rid:this.id,
}).then(res=>{
if(res.ret!=200){
return util.toast(res.msg,'none')
}
wx.navigateTo({
url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1,sid:res.data.sellerid},'/pack-cookbook/pages/index')
});
})
}
},
wineGo(){
util.toast('本区域暂无配送人员','none');
},
})
\ No newline at end of file
... ...
... ... @@ -4,8 +4,10 @@
"navigationBarTitleText":"订座详情",
"usingComponents": {
"userinfo-share": "/components/userinfo/share",
"userinfo": "/components/userinfo/userinfo",
"manager": "/components/manager/manager",
"nav":"/components/nav/nav",
"card":"/components/seller-card/seller-card"
"card":"/components/seller-card/seller-card",
"formids":"/components/formids/formids"
}
}
\ No newline at end of file
... ...
... ... @@ -2,8 +2,17 @@
<nav hasHome>订座详情</nav>
<view class="page">
<view class="flex-vc success">
<block wx:if="{{detail.hasOvered}}">
<view class="title Medium">已结束</view>
<block wx:if="{{detail.hasCancel}}">
<view class="icon">
<icon type="info" size="47" color="#C9C9C9"/>
</view>
<view class="title Medium">订座已取消</view>
</block>
<block wx:elif="{{detail.hasOvered}}">
<view class="icon">
<icon type="success" size="47" color="#C8B16D"/>
</view>
<view class="title Medium">订座已完成</view>
</block>
<block wx:else="">
<view class="icon">
... ... @@ -13,26 +22,42 @@
<view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view>
</block>
</view>
<view class="flex-lr share-view">
<!--
<userinfo-share wx:if="{{!detail.hasOvered}}"
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}"
share-act=""
class="share-but-view">
<view class="share-but Regular">邀请朋友</view>
</userinfo-share>
-->
<userinfo-share wx:if="{{!detail.hasOvered}}"
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular">发邀请函</view>
</userinfo-share>
</view>
<block wx:if="{{!detail.hasOvered && !detail.hasCancel}}">
<view class="flex-lr share-view" >
<userinfo-share
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular">发邀请函</view>
</userinfo-share>
</view>
<view class="flex-lr share-view-cookbook" >
<userinfo
binduserinfo="wineGo"
bindshare="share"
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular">自带酒水</view>
</userinfo>
<userinfo
binduserinfo="cookbook"
bindshare="share"
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular flex-cc" wx:if="{{detail.order && detail.order.cookbooklist.length>0}}">
<view>查看菜品</view>
<image class="order-cook" src="http://qn.colorcun.com/custom/lite-yd-cook/image/order-cook.png"></image>
</view>
<view class="share-but Regular" wx:else="">提前点餐</view>
</userinfo>
</view>
</block>
<view style="height: 40rpx;"></view>
<card seller="{{detail.seller}}" detail="{{detail}}"></card>
<view class="detail-info Medium" style="margin-top: 56rpx;">
... ... @@ -58,7 +83,7 @@
</view>
</view>
<view class="hr" style="margin-top: 52rpx;margin-bottom: 48rpx;"></view>
<navigator url="./detail_owner_part?id={{detail.id}}" hover-class="navigator-hover" wx:if="{{detail.customers.length>0}}">
<formids url="./detail_owner_part?id={{detail.id}}" hover-class="navigator-hover" wx:if="{{detail.customers.length>0}}">
<view class="flex-lr customers_view">
<view class="customers flex-ll">
<block wx:for="{{detail.customers}}" wx:key="detail.customers.key">
... ... @@ -68,7 +93,7 @@
</view>
<image src="http://qn.colorcun.com/custom/lite-yd/image/click.png" class="more"></image>
</view>
</navigator>
</formids>
<view class="detail-info Medium">
<view class="flex-lr">
<view>退订政策</view>
... ... @@ -79,4 +104,4 @@
</view>
<view style="height: 50rpx;"></view>
</view>
<manager manager="{{detail}}" id="manager"></manager>
<manager manager="{{detail}}" id="manager"></manager>
\ No newline at end of file
... ...
... ... @@ -43,9 +43,22 @@
width: 100%;
background-color: #262628;
}
.share-view-cookbook:last-child{
border-width: 0;
}
.share-view-cookbook{
margin-top: 58rpx;
margin-bottom: 20rpx;
height:80rpx;
line-height: 80rpx;
font-size: 34rpx;
border:2rpx solid #262628;
color:#262628;
width: 100%;
}
.share-but{
width: 100%;
text-align: center;
}
.seller{
... ... @@ -107,4 +120,9 @@
.more{
width: 14rpx;
height: 26rpx;
}
.order-cook{
width: 44rpx;
height: 30rpx;
margin-left: 10rpx;
}
\ No newline at end of file
... ...
// pages/customer/detail_owner.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
detail:null,
invite_name:''
},
id:null,
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.id=options.id;
let invite_names=wx.getStorageSync('invite_names') ||{};
let invite_name=invite_names[options.id];
if(invite_name){
this.setData({
invite_name:invite_name
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getDetail();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.shareSetting();
},
getDetail(fouce=false){
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},fouce).then(res => {
this.setData({
detail:this.formatDatail(res.data)
})
})
},
formatDatail(detail){
detail.rdateStr=util.unixtoTime(detail.ddate,'YYYY/MM/DD 星期WW HH:II');
detail.tableFirst=detail.tables[0].name;
if(detail.tables.length>1){
detail.tableSubInfo='等'+(detail.tables.length)+'个'
+(detail.tables[0].tid==2?'包间':'');
}
if(detail.sex!=3){
detail.rnameStr=detail.rname.substr(0,1)+(detail.sex==1?'先生':'女士')
}else{
detail.rnameStr=detail.rname
}
detail.eatStr='邀请您共进晚餐';
let hi=util.unixtoTime(detail.ddate,'HHII');
if(hi<'10:00'){
detail.eatStr='邀请您共进早餐';
}else if(hi<'15:00'){
detail.eatStr='邀请您共进午餐';
}
// if(!detail.cusman){
// detail.cusman='vking';
// detail.cusman_phone='15877556369';
// detail.cusman_account='wx:vking';
// }
detail.hasCanSuccess=false;
if(detail.customers && detail.customers.length>0){
let openid=getApp().openid;
detail.customers.forEach(item=>{
if(openid==item.openid){
detail.hasCanSuccess=true;
detail.remindtime=item.remind_date;
return true;
}
})
}
return detail;
},
showManager(){
if(this.data.detail.cusman_phone || this.data.detail.cusman_account){
this.selectComponent('#manager').show();
}
},
lookLocation:function(){
wx.openLocation({
latitude:Number(this.data.detail.seller.lat),
longitude:Number(this.data.detail.seller.long),
scale:17,
address:this.data.detail.seller.map_address,
success:function (res) {
console.log(res)
}
})
},
userinfo(){
if(!this.data.detail.hasCanSuccess){
let userInfo=util.cache('userInfo');
if(userInfo){
userInfo=JSON.stringify({
openid: getApp().openid,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
gender: userInfo.gender
})
}
App.Reserve.SetRelaSuccess({
rid:this.id,
openid:getApp().openid,
is_agree:1,
userinfo:userInfo
}).then(res=>{
App.Reserve.Detail({
openid: getApp().openid,
rid: this.id
},'clear')
wx.navigateTo({
//id={{detail.id}}&rdate={{detail.rdate}}
url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,
});
})
}else{
// wx.navigateTo({
// url:'invite?id='+this.id,
// });
}
},
setUserInfoSuccess(){
util.toast('授权成功,可以继续转发','none');
},
toast(){
util.toast('本区域暂无配送人员','none');
},
reserveCancel(){
let userInfo = util.cache('userInfo');
if (userInfo) {
userInfo = JSON.stringify({
openid: getApp().openid,
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
gender: userInfo.gender
})
}
App.Reserve.SetRelaSuccess({
rid: this.id,
openid: getApp().openid,
cancel: 'cancel',
is_agree: 0,
userinfo: userInfo
}).then(res => {
this.getDetail(true);
})
},
shareSetting(){
console.log('this.topicVal',this.topicVal)
if(this.topicVal && this.data.detail.openid==getApp().openid){
App.Reserve.SetTopicFromShare({
rid:this.id,
topic:this.topicVal
})
}
let nickname="";
try{
nickname=util.cache('userInfo').nickName;
}catch(e){}
return {
//title: (nickname||'')+'给你发了一个邀请,点击查看',
title: '你收到一个邀请函,点击查看',
path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1',
imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,
}
},
cookbook(){
if(this.data.detail.order && this.data.detail.order.cookbooklist.length>0){
wx.navigateTo({
url:util.http_build_query({rid:this.id,oid:this.data.detail.order.id,identity:1},'/pack-cookbook/pages/success')
});
}else{
App.Advance.CreateOrder({
rid:this.id,
}).then(res=>{
if(res.ret!=200){
return util.toast(res.msg,'none')
}
wx.navigateTo({
url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1,sid:res.data.sellerid},'/pack-cookbook/pages/index')
});
})
}
},
})
... ...
{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "light",
"navigationBarTitleText":"订座详情",
"usingComponents": {
"userinfo": "/components/userinfo/userinfo",
"nav":"/components/nav/nav",
"formids":"/components/formids/formids",
"userinfo-share": "/components/userinfo/share"
}
}
\ No newline at end of file
... ...
<!--pages/customer/detail_owner.wxml-->
<nav hasHome backgroundColor="rgba(0,0,0,0)" color="#ffffff"></nav>
<view class="page">
<view class="flex-vc" style="position: relative;">
<view class="invit-logo">
<image src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-1.png"></image>
</view>
<view class="seller flex-vc">
<view class="title">餐厅</view>
<view class="content name">{{detail.seller.sellername}}</view>
<view class="title">包间</view>
<view class="content">{{detail.tableFirst}}{{detail.tableSubInfo}}</view>
<view class="title">时间</view>
<view class="content">{{detail.rdateStr}}</view>
</view>
</view>
<view class="opt-button">
<view class="opt flex-cc">
<userinfo class="button-none flex-vc" binduserinfo="toast">
<image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-2.png"></image>
</userinfo>
<formids class="button-none flex-vc" bindclick="cookbook">
<image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-3.png"></image>
</formids>
</view>
</view>
</view>
<view class="opt-view flex-vc">
<view class="opt-view-tip">发邀请函给朋友,获知朋友反馈</view>
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess">
<view class="buts-share"></view>
</userinfo-share>
</view>
... ...
/* pages/customer/detail_customer.wxss */
.page{
color:#FFFFFF;
background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
background-size: 100%;
overflow-y: auto;
position: fixed;
top:0;
bottom: 0;
left:0;
right:0;
}
image{
width: 100%;
height: 100%;
}
.invit-logo{
width: 400rpx;
height: 170rpx;
margin-top: 156rpx;
}
.avatar{
width: 88rpx;
height: 88rpx;
border-radius: 50%;
margin-top: 50rpx;
margin-bottom: 22rpx;
overflow: hidden;
}
.invit{
font-size: 26rpx;
color:#FDFCFD;
}
.hr-one{
margin-top: 50rpx;
margin-bottom: 54rpx;
height: 2rpx;
background-color: #999999;
width: 90%;
}
.seller{
margin-top: 80rpx;
}
.seller .title{
font-size: 28rpx;
color:#999999;
margin-bottom: 18rpx;
height: 40rpx;
line-height: 40rpx;
}
.seller .content{
margin-bottom: 40rpx;
font-size: 36rpx;
line-height: 50rpx;
height: 50rpx;
}
.invit-addr{
width: 20rpx;
height: 20rpx;
margin-right: 18rpx;
}
.opt-button{
margin-top: 100rpx;
width: 100%;
}
.opt-view{
position: fixed;
bottom: 100rpx;
width: 100%;
}
.opt{
width: 90%;
margin: 0 auto;
}
.opt .buts{
width: 288rpx;
height: 80rpx;
}
.buts-share{
width: 560rpx;
height: 86rpx;
margin: 0 auto;
background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-5.png");
background-size: 100%;
background-repeat: no-repeat;
background-position: center center;
animation-name: butAnimation;
animation-duration: 0.7s;
animation-iteration-count:9999;
}
.opt-view-tip{
font-size: 26rpx;
color: #999999;
margin-bottom: 20rpx;
}
@keyframes butAnimation
{
50% {background-size:90%;}
}
@-webkit-keyframes butAnimation /* Safari 和 Chrome */
{
50% {background-size:90%;}
}
\ No newline at end of file
... ...
// pages/customer/index.js
var mta=require('mta-wechat-analysis')
import App from '../../utils/api';
import util from '../../utils/util'
const {regeneratorRuntime} = global
... ... @@ -7,7 +8,9 @@ Page({
/**
* 页面的初始数据
*/
data: {},
data: {
loadHidden:false,
},
/**
* 生命周期函数--监听页面加载
... ... @@ -15,7 +18,7 @@ Page({
islove:'',//用户在哪端
enter_params:'',//商户入口参数
async onLoad(opt) {
console.log('onLoad', opt);
console.log('onLoad', opt,mta);
//转化场景值到opt
this.selectComponent("#network").debug(opt, 'opt');
if (opt.scene) {//扫码进入
... ... @@ -26,7 +29,14 @@ Page({
})
this.selectComponent("#network").debug(opt, 'scene');
}
mta.Page.init({
"appID":"500667280",
"eventID":"500667287",
"statPullDownFresh":true,
"statShareApp":true,
"statReachBottom":true,
"lauchOpts":opt, //渠道分析
});
opt.openid = await this.getOpenid();
if (!opt.openid) {
console.log('App.Orders.CheckOrder no openid');
... ... @@ -65,7 +75,7 @@ Page({
App.Reserve.Detail(param).then(res => {
console.log(this.enter_params.seller_openid)
if(this.enter_params){//商户
if(res.data.sid==this.enter_params.seller_id && !opt.fromid){//不是客户端分享,且是同一个店的
if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的
util.cache('enter_params',this.enter_params)
url = '/pages/book/b_detail';
}
... ... @@ -79,6 +89,9 @@ Page({
})
if (!res.data.openid) {//无预订人
url = '/pages/customer/detail_owner';
if(opt.hasInvitation==1){
url = '/pages/customer/detail_owner_invitation';
}
} else {
url = '/pages/customer/detail_customer';
if(opt.hasInvitation==1){
... ... @@ -86,6 +99,9 @@ Page({
}
if (res.data.openid == opt.openid) {
url = '/pages/customer/detail_owner';
if(opt.hasInvitation==1){
url = '/pages/customer/detail_owner_invitation';
}
}
}
}
... ... @@ -185,5 +201,14 @@ Page({
// return true
// }
return false
}
},
networkEvent(e){
console.log('networkEvent',e.detail);
if(!e.detail.hasWork){
this.setData({
loadHidden:true,
})
}
},
})
\ No newline at end of file
... ...
<view class="page">
<loading>数据加载中</loading>
<loading hidden="{{loadHidden}}">数据加载中</loading>
</view>
<network id="network"></network>
\ No newline at end of file
<network id="network" bindnetwork="networkEvent"></network>
\ No newline at end of file
... ...
... ... @@ -133,7 +133,11 @@ Page({
openid:getApp().openid,
is_agree:1,
}).then(res=>{
this.getListData(true);
App.Reserve.Detail({
openid: getApp().openid,
rid: id
},'clear')
this.getListData(true);
})
}
})
\ No newline at end of file
... ...
... ... @@ -51,7 +51,7 @@
<card hasListShare
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare">
<userinfo
<userinfo wx:if="{{detail.status}}"
id="userinfo-share-{{detail.id}}"
data-id="{{detail.id}}"
binduserinfo="accept">
... ...
... ... @@ -20,7 +20,7 @@ Page({
},
remind_date:0,
id:null,
rdate:0,
ddate:0,
/**
* 生命周期函数--监听页面加载
... ... @@ -28,15 +28,19 @@ Page({
onLoad: function (options) {
console.log('onLoad',options);
this.id=options.id;
this.rdate=options.rdate;
if(new Date()/1000+1800>options.rdate){
this.ddate=options.ddate;
if(options.remindtime=='NaN'){
options.remindtime=0;
}
this.remind_date=options.remindtime;
if(new Date()/1000+1800>parseInt(options.ddate)){
this.setData({
reminds:[{val:0,label:'不提醒'}]
})
}else{
if(options.remindtime>0){
if(parseInt(options.remindtime)>0){
this.setData({
remindtime:(options.rdate-options.remindtime)/60
remindtime:(parseInt(options.ddate)-parseInt(options.remindtime))/60
})
}
}
... ... @@ -75,7 +79,7 @@ Page({
console.log(val);
this.remind_date=0;
if(val>0){
this.remind_date=parseInt(this.rdate)-parseInt(val*60);
this.remind_date=parseInt(this.ddate)-parseInt(val*60);
}
},
remind(){
... ...
... ... @@ -5,7 +5,8 @@
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true
"newFeature": true,
"nodeModules": true
},
"compileType": "miniprogram",
"libVersion": "2.4.2",
... ... @@ -30,7 +31,7 @@
"list": []
},
"miniprogram": {
"current": 6,
"current": 37,
"list": [
{
"id": 0,
... ... @@ -73,7 +74,7 @@
"id": 6,
"name": "pages/customer/index",
"pathName": "pages/customer/index",
"query": "id=1196&fromid=1111&hasInvitation=1",
"query": "id=1762&fromid=1111&hasInvitation=1",
"scene": "1044",
"shareInfo": {
"groupName": "测试模拟群1",
... ... @@ -155,7 +156,8 @@
"id": 15,
"name": "预定本详情",
"pathName": "pages/book/b_detail",
"query": "id=74"
"query": "id=1762",
"scene": "1001"
},
{
"id": -1,
... ... @@ -224,10 +226,11 @@
"scene": "1001"
},
{
"id": -1,
"id": 25,
"name": "pack-cookbook/pages/index",
"pathName": "pack-cookbook/pages/index",
"query": ""
"query": "rid=1196&oid=1&identity=1&sid=80",
"scene": "1001"
},
{
"id": 26,
... ... @@ -274,6 +277,50 @@
"pathName": "pages/reserve/index",
"query": "",
"scene": "1001"
},
{
"id": -1,
"name": "我的客户 pages/book/crm/index ",
"pathName": "pages/book/crm/index",
"query": "",
"scene": "1044",
"shareInfo": {
"groupName": "测试模拟群1",
"shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
"shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
}
},
{
"id": 34,
"name": "pack-cookbook/pages/cart",
"pathName": "pack-cookbook/pages/cart",
"query": "rid=1196&oid=2&identity=1",
"scene": "1001"
},
{
"id": 35,
"name": "pack-cookbook/pages/success",
"pathName": "pack-cookbook/pages/success",
"query": "rid=1196&oid=1&identity=1&hasSuccess=1",
"scene": "1001"
},
{
"id": -1,
"name": "pack-cookbook/pages/remark",
"pathName": "pack-cookbook/pages/remark",
"query": ""
},
{
"id": -1,
"name": "pages/customer/index 1803 iphone动画",
"pathName": "pages/customer/detail_owner_invitation",
"query": "id=1803&fromid=1111&hasInvitation=1",
"scene": "1044",
"shareInfo": {
"groupName": "测试模拟群1",
"shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
"shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
}
}
]
}
... ...
... ... @@ -39,15 +39,12 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
}
if(!fouce && cachetime!=0){//优先使用缓存
let getCache= cache(cache_key);
//console.log('getCache.'+getCache,cache_key);
if(getCache!=-99999){
return new Promise((success,fail)=>{
if(true){
getCache.isCache=true;
console.log(cache_key+'\nuse cache',getCache);
success(getCache);
}else{
fail();
}
getCache.isCache=true;
console.log(cache_key+'\nuse cache',getCache);
success(getCache);
})
}
}
... ... @@ -78,7 +75,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
console.log('request.api==>',host+cache_key+'\nrequest.success',res.data);
// return;
if(res.data){
if(cachetime!=0 && res.data.ret==200 && res.data.data){
if(cachetime!=0 && res.data.ret==200){
cache(cache_key,res.data,cachetime);//.then().catch();
}
if(res.data.ret!==200){
... ... @@ -166,7 +163,7 @@ function cache(key,val=-99999,timeout=-1){
}
let res=wx.getStorageSync(key);
let time=Date.parse(new Date())/1000;
if(res && (res.timeout==-1 || res.timeout>time) && res.data.data){
if(res && (res.timeout==-1 || res.timeout>time) && res.data){
return res.data;
}else{
return -99999
... ...
... ... @@ -10,7 +10,7 @@ export default {
//预定信息详情
'App.Reserve.Detail': {
cachetime: 60,
cachetime: 30,
},
//建立预定关系
... ... @@ -28,7 +28,7 @@ export default {
//列表----我的日程
'App.Reserve.GetListFromScheAndRes': {
cachetime: 30,
//cachetime: 30,
},
//订座详情页面----我愿意
... ... @@ -118,16 +118,30 @@ export default {
},
/**提前点餐**/
'App.Advance.CreateOrder':{
//silence: false,
},
//菜品列表
'App.Cookbook.GetCookbookByClass': null,
'App.Advance.GetCookbookByClass': null,
//菜品规格
'App.Cookbook.GetCookbookSelBySpecsId': null,
'App.Advance.GetCookbookSelBySpecsId': null,
//添加到购物车
'App.Orders.AddCart': null,
'App.Advance.AddCart': null,
//减菜
'App.Orders.ReduceOrder': null,
'App.Advance.ReduceOrder': null,
//设置人数,设置备注
'App.Advance.SetOrderById':null,
//清空购物车
'App.Orders.ClearCookById': null,
//购物车
'App.Orders.GetOrderById': null,
'App.Advance.RemoveCart': {
silence: false,
},
//菜品备注tags
'App.Advance.GetRemarkBySellerid':{
cachetime: 300,
},
//下单
'App.Advance.PlaceOrder':null,
/**crm**/
'App.Reserve.Members':null,
}
\ No newline at end of file
... ...
//application id got from MTAMTA analysis
var MTA_APP_ID = ''; //常规统计id
var MTA_EVENT_ID = ''; //自定义事件id
//data report remote address
var MTA_API_BASE = 'https://pingtas.qq.com/pingd';
//MTA wechat apps analysis storage key prefix
var MTA_VAR_PREFIX = '_mta_';
function getNetworkType(a){wx.getNetworkType({success:function(b){a(b.networkType)}})}function getSystemInfo(){var a=wx.getSystemInfoSync();return{adt:a.model,scl:a.pixelRatio,scr:a.windowWidth+"x"+a.windowHeight,lg:a.language,fl:a.version}}function getUID(){try{return wx.getStorageSync(MTA_VAR_PREFIX+"auid")}catch(a){}}function setUID(){try{var a=getRandom();wx.setStorageSync(MTA_VAR_PREFIX+"auid",a);return a}catch(b){}}
function getSID(){try{return wx.getStorageSync(MTA_VAR_PREFIX+"ssid")}catch(a){}}function setSID(){try{var a="s"+getRandom();wx.setStorageSync(MTA_VAR_PREFIX+"ssid",a);return a}catch(b){}}function getRandom(a){return(a||"")+Math.round(2147483647*(Math.random()||.5))*+new Date%1E10}function getPagePath(){try{var a=getCurrentPages(),b="/";0<a.length&&(b=a.pop().__route__);return b}catch(e){console.log("get current page path error:"+e)}}
function getMainInfo(){var a={dm:"wechat.apps.xx",url:getPagePath(),pvi:"",si:"",ty:2};a.pvi=function(){var b=getUID();b||(a.ty=1,b=setUID());return b}();a.si=function(){var a=getSID();a||(a=setSID());return a}();return a}function getBasicInfo(){var a=getSystemInfo();getNetworkType(function(a){wx.setStorageSync(MTA_VAR_PREFIX+"ntdata",a)});a.ct=wx.getStorageSync(MTA_VAR_PREFIX+"ntdata")||"4g";return a}function getExtentInfo(){return{r2:MTA_APP_ID,r4:"wx"}}
module.exports={initLaunch:function(){setSID()},rptMain:function(){if(""!=MTA_APP_ID){for(var a=[],b=0,e=[getMainInfo(),getBasicInfo(),getExtentInfo(),{random:+new Date}],d=e.length;b<d;b++)for(var f in e[b])e[b].hasOwnProperty(f)&&a.push(f+"="+(e[b][f]||""));wx.request({url:MTA_API_BASE+"?"+a.join("&").toLowerCase()})}},eventStat:function(a,b){if(""!=MTA_EVENT_ID){var e=[],d=getMainInfo(),f=getExtentInfo();d.dm="wxapps.click";d.url=a;f.r2=MTA_EVENT_ID;var c;c="undefined"===typeof b?{}:b;var k=[],
g;for(g in c)c.hasOwnProperty(g)&&k.push(g+"="+c[g]);c=k.join(";");f.r5=c;c=0;d=[d,getBasicInfo(),f,{random:+new Date}];for(f=d.length;c<f;c++)for(var h in d[c])d[c].hasOwnProperty(h)&&e.push(h+"="+(d[c][h]||""));wx.request({url:MTA_API_BASE+"?"+e.join("&").toLowerCase()})}}};
\ No newline at end of file
//正式
var uri={
HOST__LINE:'https://xt05.colorcun.com/?s=',
HOST__LINE:'https://xt04.colorcun.com/?s=',
//获取商家信息
CGI__USER_GETSELLERBYID: 'App.Seller.GetSellerById',
... ...
... ... @@ -440,7 +440,8 @@ module.exports = {
html=html.replace(/&quot;/ig,'');
return html;
},
val:function(e){
val:function(e,key=''){
if(key!='') return e.detail.value[key]||'';
return e.detail.value;
},
attr:function(e,key=''){
... ...