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
  1 +var mta=require('mta-wechat-analysis')
1 var uri_dc = require('utils/uri.js') 2 var uri_dc = require('utils/uri.js')
2 global.regeneratorRuntime = require('lib/regenerator/runtime-module') 3 global.regeneratorRuntime = require('lib/regenerator/runtime-module')
3 4
@@ -20,12 +21,21 @@ App({ @@ -20,12 +21,21 @@ App({
20 shareTicket:"", 21 shareTicket:"",
21 onLaunch: async function (opt) { 22 onLaunch: async function (opt) {
22 console.log('onLaunch',opt); 23 console.log('onLaunch',opt);
  24 + mta.App.init({
  25 + "appID":"500667280",
  26 + "eventID":"500667287",
  27 + "statPullDownFresh":true,
  28 + "statShareApp":true,
  29 + "statReachBottom":true,
  30 + "lauchOpts":opt, //渠道分析
  31 + });
23 if(opt.shareTicket){ 32 if(opt.shareTicket){
24 this.shareTicket=opt.shareTicket; 33 this.shareTicket=opt.shareTicket;
25 } 34 }
26 this.getSystemInfo(); 35 this.getSystemInfo();
27 this.openid=await this.getOpenid(); 36 this.openid=await this.getOpenid();
28 - console.log('this.openid',this.openid); 37 + console.log('this.openid',this.openid,mta);
  38 +
29 }, 39 },
30 onShow:async function(){ 40 onShow:async function(){
31 if (wx.canIUse('getUpdateManager')) { 41 if (wx.canIUse('getUpdateManager')) {
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "pages/customer/detail_owner_part", 8 "pages/customer/detail_owner_part",
9 "pages/customer/detail_customer", 9 "pages/customer/detail_customer",
10 "pages/customer/detail_invitation", 10 "pages/customer/detail_invitation",
  11 + "pages/customer/detail_owner_invitation",
11 "pages/customer/invite", 12 "pages/customer/invite",
12 "pages/customer/list", 13 "pages/customer/list",
13 "pages/customer/remind", 14 "pages/customer/remind",
@@ -21,6 +22,7 @@ @@ -21,6 +22,7 @@
21 "pages/book/setting/index", 22 "pages/book/setting/index",
22 "pages/book/setting/sms", 23 "pages/book/setting/sms",
23 "pages/book/setting/sms_buy", 24 "pages/book/setting/sms_buy",
  25 + "pages/book/crm/index",
24 "pages/book/smsbatch/index", 26 "pages/book/smsbatch/index",
25 "pages/book/smsbatch/update", 27 "pages/book/smsbatch/update",
26 "pages/book/smsbatch/detail", 28 "pages/book/smsbatch/detail",
@@ -32,10 +34,21 @@ @@ -32,10 +34,21 @@
32 "root": "pack-cookbook", 34 "root": "pack-cookbook",
33 "name": "提前点餐包", 35 "name": "提前点餐包",
34 "pages": [ 36 "pages": [
35 - "pages/index" 37 + "pages/index",
  38 + "pages/cart",
  39 + "pages/success",
  40 + "pages/remark"
36 ] 41 ]
37 } 42 }
38 ], 43 ],
  44 + "preloadRule": {
  45 + "pages/customer/detail_owner": {
  46 + "network": "all",
  47 + "packages": [
  48 + "pack-cookbook"
  49 + ]
  50 + }
  51 + },
39 "window": { 52 "window": {
40 "navigationStyle": "custom", 53 "navigationStyle": "custom",
41 "backgroundTextStyle": "light", 54 "backgroundTextStyle": "light",
@@ -239,4 +239,30 @@ image{ @@ -239,4 +239,30 @@ image{
239 height: 22rpx; 239 height: 22rpx;
240 background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png"); 240 background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png");
241 background-size: 100%; 241 background-size: 100%;
  242 + min-width: 12rpx;
  243 +}
  244 +.mask{
  245 + background-color: rgba(20,20,20,0.5);
  246 + position: fixed;
  247 + top:0;
  248 + right: 0;
  249 + bottom: 0;
  250 + left: 0;
  251 + z-index: 9999;
  252 +}
  253 +.flex-tb{
  254 + display: flex;
  255 + display: -webkit-flex;
  256 + justify-content: space-between;
  257 + align-items:flex-start;
  258 + flex-direction: column ;
  259 + -webkit-flex-direction: column ;
  260 +}
  261 +.flex-bl{
  262 + display: flex;
  263 + display: -webkit-flex;
  264 + justify-content: flex-end;
  265 + align-items:flex-start;
  266 + flex-direction: column ;
  267 + -webkit-flex-direction: column ;
242 } 268 }
@@ -26,14 +26,18 @@ Component({ @@ -26,14 +26,18 @@ Component({
26 className:{ 26 className:{
27 type:String, 27 type:String,
28 value:'', 28 value:'',
29 - } 29 + },
  30 + ddate:{ //带入预定时间 time1-time2
  31 + type:String,
  32 + value:'',
  33 + },
30 }, 34 },
31 35
32 /** 36 /**
33 * 组件的初始数据 37 * 组件的初始数据
34 */ 38 */
35 data: { 39 data: {
36 - 40 + itemList:[],
37 }, 41 },
38 42
39 /** 43 /**
@@ -45,35 +49,54 @@ Component({ @@ -45,35 +49,54 @@ Component({
45 if(!this.data.event) return; 49 if(!this.data.event) return;
46 this[this.data.event]() 50 this[this.data.event]()
47 }, 51 },
  52 + boardClickCallback(e){
  53 + let board=this.data.board;
  54 + switch (e.detail.value){
  55 + case '查看详情':
  56 + wx.navigateTo({
  57 + url:'b_detail?id='+board.reserve_id,
  58 + });
  59 + break;
  60 + case '启用桌位':
  61 + this.boardEnable(1)
  62 + break;
  63 + case '停用桌位':
  64 + this.boardEnable(0)
  65 + break;
  66 + case '订座':
  67 + wx.navigateTo({
  68 + url:'b_addnew?hasQuick=1&tid='+board.id
  69 + +'&tname='+board.name
  70 + +'&pnum='+(board.most_pnum>board.table_pnum?board.most_pnum:board.table_pnum)
  71 + +'&ddate='+this.data.ddate,
  72 + });
  73 + break;
  74 + }
  75 + },
48 //桌位操作 76 //桌位操作
49 boardOpt(){ 77 boardOpt(){
50 let itemList=[] 78 let itemList=[]
  79 + if(!this.data.board.reserve_id && this.data.board.enable==1){
  80 + if(this.data.ddate){
  81 + let t=new Date()/1000;
  82 + //console.log('this.data.ddate.substr(11,10)',this.data.ddate.substr(11,10))
  83 + if(parseInt(this.data.ddate.substr(11,10))>t){
  84 + itemList.push('订座')
  85 + }
  86 + }
  87 +
  88 + }
51 if(this.data.board.reserve_id>0){ 89 if(this.data.board.reserve_id>0){
52 itemList.push('查看详情') 90 itemList.push('查看详情')
53 } 91 }
54 itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位') 92 itemList.push(this.data.board.enable==1?'停用桌位':'启用桌位')
55 //console.log(getApp().system) 93 //console.log(getApp().system)
56 - if(getApp().system.system.toLowerCase().indexOf('ios')<0){  
57 - itemList.push('取消')  
58 - }  
59 this.itemList=itemList; 94 this.itemList=itemList;
60 - wx.showActionSheet({  
61 - itemList:this.itemList,  
62 - success:(res)=>{  
63 - console.log(res.tapIndex,this.itemList[res.tapIndex]);  
64 - if('启用桌位'==this.itemList[res.tapIndex]){  
65 - this.boardEnable(1)  
66 - }  
67 - if('停用桌位'==this.itemList[res.tapIndex]){  
68 - this.boardEnable(0)  
69 - }  
70 - if('查看详情'==this.itemList[res.tapIndex]){  
71 - wx.navigateTo({  
72 - url:'b_detail?id='+this.data.board.reserve_id,  
73 - });  
74 - }  
75 - }, 95 + this.setData({
  96 + itemList:itemList,
76 }) 97 })
  98 + this.selectComponent('#boardas').show();
  99 + console.log('this.data.board',this.data.board)
77 }, 100 },
78 //桌位选择 101 //桌位选择
79 boardChoose(){ 102 boardChoose(){
1 { 1 {
2 "component": true, 2 "component": true,
3 - "usingComponents": {} 3 + "usingComponents": {
  4 + "as":"../../actionSheet/index"
  5 + }
4 } 6 }
@@ -12,3 +12,6 @@ @@ -12,3 +12,6 @@
12 <view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view> 12 <view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view>
13 <icon type="success" size="20" color="#199095" class="desk-active" wx:if="{{board.isselect==true}}"/> 13 <icon type="success" size="20" color="#199095" class="desk-active" wx:if="{{board.isselect==true}}"/>
14 </view> 14 </view>
  15 +<as items="{{itemList}}"
  16 + id="boardas"
  17 + bindclick="boardClickCallback"><view style="font-size: 30rpx;">{{board.name}}</view></as>
1 var util = require('../../../utils/util.js') 1 var util = require('../../../utils/util.js')
2 -var uri=require('../../../utils/uri.js'); 2 +var uri = require('../../../utils/uri.js');
3 Component({ 3 Component({
4 - properties:{  
5 - list:Array  
6 - },  
7 - data:{  
8 -  
9 - },  
10 - methods:{  
11 - selectdesk:function(e){  
12 - var tebleid=e.currentTarget.dataset.id;  
13 - var tables=util.cache('tableid') ? util.cache('tableid') : [];  
14 - var list=this.data.list;  
15 - list.forEach(function(v,i){  
16 - if(v.id==tebleid){  
17 - if(v.isselect==true){  
18 - var thisindex=tables.indexOf(tebleid);  
19 - tables.splice(thisindex,1)  
20 - }else{  
21 - tables.push(tebleid)  
22 - }  
23 - v.isselect=!v.isselect  
24 - }  
25 - })  
26 - var pages = getCurrentPages();  
27 - pages[pages.length-2].data.form.tid=tables;  
28 - pages[pages.length-2].setData({  
29 - form:pages[pages.length-2].data.form  
30 - })  
31 - util.cache('tableid',tables);  
32 - this.triggerEvent("changedesk");  
33 - this.setData({  
34 - list:list  
35 - }) 4 + properties: {
  5 + list: Array
  6 + },
  7 + data: {},
  8 + methods: {
  9 + selectdesk: function (e) {
  10 + var tebleid = e.currentTarget.dataset.id;
  11 + var tables = util.cache('tableid') ? util.cache('tableid') : [];
  12 + var list = this.data.list;
  13 + var pages = getCurrentPages();
  14 + var addnewPage=pages[pages.length - 2];
  15 + list.forEach(function (v, i) {
  16 + if (v.id == tebleid) {
  17 + if (v.isselect == true) {
  18 + var thisindex = tables.indexOf(tebleid);
  19 + tables.splice(thisindex, 1)
  20 + delete addnewPage.checkedTables[tebleid]
  21 + } else {
  22 + tables.push(tebleid)
  23 + addnewPage.checkedTables[tebleid]=v.name;
  24 + }
  25 + v.isselect = !v.isselect
36 } 26 }
  27 + })
  28 + addnewPage.data.form.tid = tables;
  29 + addnewPage.setData({
  30 + form: addnewPage.data.form
  31 + })
  32 + console.log('checkedTables',addnewPage.checkedTables);
  33 + util.cache('tableid', tables);
  34 + this.triggerEvent("changedesk");
  35 + this.setData({
  36 + list: list
  37 + })
37 } 38 }
  39 + }
38 }) 40 })
1 <view class="desk-list flex-rs"> 1 <view class="desk-list flex-rs">
2 - <block wx:for="{{list}}"> 2 + <block wx:for="{{list}}" wx:key="list.key">
3 <board width="160" height="180" board="{{item}}" 3 <board width="160" height="180" board="{{item}}"
4 style="margin: 20rpx 0 0 20rpx" 4 style="margin: 20rpx 0 0 20rpx"
5 event="boardChoose" className="noBottom" 5 event="boardChoose" className="noBottom"
1 <formids bindtap="detail"> 1 <formids bindtap="detail">
2 - <view class="book-list-tds flex-lr font30r black-font"> 2 + <view class="book-list-tds flex-lr font30r black-font reserve-status-{{vitem.status}}">
3 <view class="book-list-td flex-vc"> 3 <view class="book-list-td flex-vc">
4 <view class="Medium" style="font-size: 30rpx; width: 100%;text-align: left;max-height:40px;overflow:hidden;">{{vitem.name}}</view> 4 <view class="Medium" style="font-size: 30rpx; width: 100%;text-align: left;max-height:40px;overflow:hidden;">{{vitem.name}}</view>
5 <view class="Medium" style="font-size: 28rpx;width: 100%;text-align: left" wx:if="{{vitem.table_ids.length>1}}">等{{vitem.table_ids.length}}桌</view> 5 <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 @@ @@ -13,4 +13,10 @@
13 .book-list-info{ 13 .book-list-info{
14 width:100%; 14 width:100%;
15 line-height:1.2; 15 line-height:1.2;
  16 +}
  17 +.reserve-status-4,.reserve-status-3{
  18 + color:#999999;
  19 +}
  20 +.reserve-status-4 .green-font,.reserve-status-3 .green-font{
  21 + color:#999999;
16 } 22 }
1 <view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view> 1 <view class="notice-mask" hidden="{{noticeHidden}}" bindtap="close"></view>
2 <view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}"> 2 <view class="notice-fixed flex-lr {{noticeHidden==false ? 'notice-fixed-active' : ''}}">
3 - <block wx:for="{{list}}"> 3 + <block wx:for="{{list}}" wx:key="list.key">
4 <block wx:if="{{index!=0}}"> 4 <block wx:if="{{index!=0}}">
5 <view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}"> 5 <view class="notice-single flex-vc" bindtap="callcustom" data-idx="{{index}}">
6 <view class="notice-image flex-vc"> 6 <view class="notice-image flex-vc">
  1 +// components/book/reserveCancel/cancel.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +const items=[{name:'顾客取消'},{name:'顾客行程有变'},{name:'信息填写有误'},{name:'操作失误'},{name:'其他原因'}];
  6 +
  7 +Component({
  8 + /**
  9 + * 组件的属性列表
  10 + */
  11 + properties: {
  12 + bookInfo:{
  13 + type:Object,
  14 + value:{},
  15 + }
  16 + },
  17 +
  18 + /**
  19 + * 组件的初始数据
  20 + */
  21 + data: {
  22 + hidden: true,
  23 + otherInputHidden:true,
  24 + items:JSON.parse(JSON.stringify(items)),
  25 + _cause:'',
  26 + cause:'',
  27 + },
  28 + /**
  29 + * 组件的方法列表
  30 + */
  31 + methods: {
  32 + show(){
  33 + this.setData({
  34 + hidden:false,
  35 + })
  36 + },
  37 + hide(){
  38 + this.setData({
  39 + hidden:true,
  40 + })
  41 + },
  42 + radioChange(e){
  43 + let val=util.val(e);
  44 + if(val=='其他原因'){
  45 + this.setData({
  46 + otherInputHidden:false,
  47 + _cause:val
  48 + })
  49 + }else{
  50 + this.setData({
  51 + otherInputHidden:true,
  52 + _cause:val
  53 + })
  54 + }
  55 + },
  56 + otherInput(e){
  57 + let val=util.val(e);
  58 + this.setData({
  59 + cause:val
  60 + })
  61 + },
  62 + async submit(e){
  63 + console.log(e,);
  64 + let cause=this.data._cause;
  65 + let hasInput=false;
  66 + if(cause=='其他原因'){
  67 + cause=this.data.cause;
  68 + hasInput=true;
  69 + }
  70 + cause=cause.trim();
  71 + if(!cause){
  72 + return util.toast(hasInput?'请填写原因':'请选择原因','none')
  73 + }
  74 +
  75 + let enter_params=util.cache('enter_params');
  76 + let sc=(await App.Reserve.SellerInfo(enter_params)).data
  77 + cause={desc:cause}
  78 + if(enter_params){
  79 + cause.uid=enter_params.manager_id;
  80 + }
  81 + if(sc.seller_user){
  82 + cause.uname=(sc.seller_user.nick_name||sc.seller_user.nickname)
  83 + }
  84 + App.Reserve.SetReserveStatus({
  85 + rid:this.data.bookInfo.id,
  86 + status:4,
  87 + cause:JSON.stringify(cause),
  88 + }).then(()=>{
  89 + this.hide()
  90 + this.triggerEvent('reserveCancel',{hasCancel:true});
  91 + //this.getDetail(this.data.bookInfo.id,true);
  92 + })
  93 + }
  94 + }
  95 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "formids":"../../formids/formids"
  5 + }
  6 +}
  1 +<!--components/book/reserveCancel/cancel.wxml-->
  2 +<view class="mask flex-vc" hidden="{{hidden}}" bindtap="hide">
  3 + <view class="cancel" catchtap="catchtap">
  4 + <view class="flex-rr">
  5 + <view class="close" bindtap="hide">
  6 + <image src="http://qn.colorcun.com/custom/lite-yd/image/close.png"></image>
  7 + </view>
  8 + </view>
  9 + <view class="title Semibold flex-vc">请选择取消原因</view>
  10 + <radio-group class="radio-group flex-vl" bindchange="radioChange">
  11 + <label class="radio" wx:for="{{items}}" wx:key="items.key">
  12 + <radio value="{{item.name}}" checked="{{item.checked}}" />
  13 + {{item.name}}
  14 + </label>
  15 + </radio-group>
  16 + <view class="flex-rr other-view">
  17 + <input class="other" bindinput="otherInput" placeholder="请填写原因" hidden="{{otherInputHidden}}"/>
  18 + </view>
  19 + <formids class="flex-vc" bindclick="submit">
  20 + <view class="button">确认</view>
  21 + </formids>
  22 + </view>
  23 +</view>
  1 +/* components/book/reserveCancel/cancel.wxss */
  2 +@import "../../../app.wxss";
  3 +.cancel{
  4 + width: 90%;
  5 + background-color: #fefefe;
  6 + border-radius: 10rpx;
  7 + font-size: 32rpx;
  8 + padding-bottom: 52rpx;
  9 +}
  10 +.cancel image{
  11 + width: 100%;
  12 + height: 100%;
  13 +}
  14 +.close{
  15 + width: 32rpx;
  16 + height: 32rpx;
  17 + margin-top: 12rpx;
  18 + margin-right: 12rpx;
  19 +}
  20 +.title{
  21 + font-size: 34rpx;
  22 +}
  23 +.button{
  24 + width: 300rpx;
  25 + height: 80rpx;
  26 + line-height: 80rpx;
  27 + border-radius: 4rpx;
  28 + background-color: #199095;
  29 + font-size: 34rpx;
  30 + color: #fefefe;
  31 +}
  32 +.radio-group{
  33 + margin: 44rpx 5% 0rpx;
  34 +}
  35 +.radio{
  36 + margin-bottom: 40rpx;
  37 + height: 40rpx;
  38 + line-height: 40rpx;
  39 +}
  40 +.radio:last-child{
  41 + margin-bottom: 0;
  42 +}
  43 +.radio radio{
  44 + margin-right: 30rpx;
  45 +}
  46 +.other-view{
  47 + height: 110rpx;
  48 + line-height: 110rpx;
  49 +}
  50 +.other{
  51 + border-bottom: 2rpx solid #E0E0E0;
  52 + width: 75%;
  53 + margin-right: 40rpx;
  54 +}
@@ -34,7 +34,8 @@ Component({ @@ -34,7 +34,8 @@ Component({
34 */ 34 */
35 methods: { 35 methods: {
36 back(){ 36 back(){
37 - wx.navigateBack() 37 + this.triggerEvent('NavEvent');
  38 + wx.navigateBack();
38 }, 39 },
39 home(){ 40 home(){
40 if(!this.data.disHome) return; 41 if(!this.data.disHome) return;
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 .nav-main{ 3 .nav-main{
4 position:fixed; 4 position:fixed;
5 width: 100%; 5 width: 100%;
6 - z-index: 9999;  
7 } 6 }
8 .nav{ 7 .nav{
9 font-size: 30rpx; 8 font-size: 30rpx;
@@ -25,11 +25,13 @@ Component({ @@ -25,11 +25,13 @@ Component({
25 this.setData({ 25 this.setData({
26 network:true, 26 network:true,
27 }) 27 })
  28 + this.triggerEvent('network',res);
28 }).catch(res=>{ 29 }).catch(res=>{
29 this.setData({ 30 this.setData({
30 network:false, 31 network:false,
31 msg:res.msg 32 msg:res.msg
32 }) 33 })
  34 + this.triggerEvent('network',res);
33 }) 35 })
34 }, 36 },
35 detached(){ 37 detached(){
@@ -44,12 +46,13 @@ Component({ @@ -44,12 +46,13 @@ Component({
44 wx.getNetworkType({ 46 wx.getNetworkType({
45 success: function (res) { 47 success: function (res) {
46 var title = '' 48 var title = ''
47 - if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') {  
48 - fail({type:res.networkType,msg:'当前网络不给力,请稍后重试'}); 49 + //if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') {
  50 + if (res.networkType == 'unknown') {
  51 + fail({hasWork:false,type:res.networkType,msg:'当前网络不给力,请稍后重试'});
49 } else if (res.networkType == 'none') { 52 } else if (res.networkType == 'none') {
50 - fail({type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'}); 53 + fail({hasWork:false,type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'});
51 } else { 54 } else {
52 - success({type:res.networkType}); 55 + success({hasWork:true,type:res.networkType});
53 } 56 }
54 } 57 }
55 }); 58 });
@@ -73,6 +76,8 @@ Component({ @@ -73,6 +76,8 @@ Component({
73 wx.reLaunch({ 76 wx.reLaunch({
74 url: '/'+p.route+'?'+param.join('&') 77 url: '/'+p.route+'?'+param.join('&')
75 }) 78 })
  79 + }).catch((res)=>{
  80 + console.log('this.network.catch',res)
76 }) 81 })
77 }, 82 },
78 show(msg=''){ 83 show(msg=''){
@@ -61,24 +61,33 @@ Component({ @@ -61,24 +61,33 @@ Component({
61 +')'; 61 +')';
62 } 62 }
63 let tableSubInfo='' 63 let tableSubInfo=''
  64 + let tableFirst='';
64 if(this.data.detail.tableFirst){ 65 if(this.data.detail.tableFirst){
65 tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||''); 66 tableSubInfo=(this.data.detail.tableFirst||'')+' '+(this.data.detail.tableSubInfo||'');
66 - 67 + tableFirst=this.data.detail.tableFirst
67 }else{ 68 }else{
  69 + tableFirst=this.data.detail.tables[0].name
68 tableSubInfo=this.data.detail.tables[0].name; 70 tableSubInfo=this.data.detail.tables[0].name;
69 if(this.data.detail.tables.length>1){ 71 if(this.data.detail.tables.length>1){
70 tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个' 72 tableSubInfo+=' 等'+(this.data.detail.tables.length)+'个'
71 +(this.data.detail.tables[0].tid==2?'包间':''); 73 +(this.data.detail.tables[0].tid==2?'包间':'');
  74 + tableFirst+='等';
72 } 75 }
73 } 76 }
74 let obj={ 77 let obj={
75 rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'), 78 rdateStr:util.unixtoTime(this.data.detail.ddate,'MM月DD日 HH:II'),
76 tableSubInfo:tableSubInfo, 79 tableSubInfo:tableSubInfo,
  80 + tableFirst:tableFirst,
77 masterMan:masterMan, 81 masterMan:masterMan,
78 } 82 }
79 if(this.data.hasShowStatus){ 83 if(this.data.hasShowStatus){
80 let ns=new Date()/1000 84 let ns=new Date()/1000
81 - obj.showStatusStr=ns>this.data.detail.ddate?'已结束':'已预定'; 85 + obj.showStatusStr='已预定'
  86 + if(this.data.detail.status==4){
  87 + obj.showStatusStr='已取消'
  88 + }else if(this.data.detail.status>=2 || ns>this.data.detail.ddate){
  89 + obj.showStatusStr='已完成'
  90 + }
82 } 91 }
83 this.setData(obj) 92 this.setData(obj)
84 } 93 }
@@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
21 </view> 21 </view>
22 <view class="line"></view> 22 <view class="line"></view>
23 <view class="right info Medium"> 23 <view class="right info Medium">
24 - <view class="label">包间</view>  
25 - <view class="value">{{tableSubInfo}}</view> 24 + <view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>
  25 + <view class="value">{{tableFirst}}</view>
26 </view> 26 </view>
27 </view> 27 </view>
28 <view class="seller address flex-ll" catchtap="lookLocation"> 28 <view class="seller address flex-ll" catchtap="lookLocation">
  1 +// pack-cookbook/components/cart/cart.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Component({
  6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + rid:{
  11 + type:String,
  12 + value:"",
  13 + },
  14 + order:{
  15 + type:Object,
  16 + value:{},
  17 + },
  18 + identity:{
  19 + type:String,
  20 + value:"",
  21 + }
  22 + },
  23 +
  24 + /**
  25 + * 组件的初始数据
  26 + */
  27 + data: {
  28 + hidden: true,
  29 + carts: ['啦啦啦', '啦啦啦啦啦', '啦啦', '啦', '啦啦啦啦啦', '啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦', '啦啦啦啦', '啦啦', '啦', '啦啦啦', '啦啦啦'],
  30 + },
  31 +
  32 + /**
  33 + * 组件的方法列表
  34 + */
  35 + methods: {
  36 + hide(){
  37 + this.setData({
  38 + hidden:true,
  39 + })
  40 + },
  41 + show(){
  42 + this.setData({
  43 + hidden:false,
  44 + })
  45 + },
  46 + auto(){
  47 + if(this.data.order.cookbooklist.length<1){
  48 + return this.hide();
  49 + }
  50 + this.setData({
  51 + hidden:!this.data.hidden,
  52 + })
  53 + },
  54 + init(){
  55 + App.Advance.CreateOrder({
  56 + rid:this.data.rid
  57 + }).then(res=>{
  58 +
  59 + })
  60 + },
  61 + //规格 增加/减少 回调
  62 + foodSpecCallback(e){
  63 + let opt=e.detail;
  64 + this.triggerEvent('foodCardCallback',opt);
  65 + },
  66 + RemoveCart(){
  67 + App.Advance.RemoveCart({
  68 + orderid:this.data.order.id,
  69 + identity:this.data.identity,
  70 + }).then(res=>{
  71 + this.hide();
  72 + this.triggerEvent('foodCardCallback',{type:'flushOrder',num:0});
  73 + })
  74 + },
  75 + },
  76 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "foodSpec": "../food-spec/food-spec"
  5 + }
  6 +}
  1 +<!--pack-cookbook/components/cart/cart.wxml-->
  2 +<view class="mask flex-bc" style="bottom: 103rpx; align-items: flex-end;" hidden="{{hidden}}" bindtap="hide">
  3 + <view class="cart" catchtap="catchtap">
  4 + <view class="cart-title flex-rr">
  5 + <view class="icon">
  6 + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/empty.png"></image>
  7 + </view>
  8 + <view class="text" bindtap="RemoveCart">清空购物车</view>
  9 + </view>
  10 + <view class="cart-body">
  11 + <view class="cart-item flex-lr" wx:for="{{order.cookbooklist}}" wx:key="item.key">
  12 + <view class="flex-ll name">
  13 + <view class="name">{{item.cookname}}</view>
  14 + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
  15 + </view>
  16 + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
  17 + <view class="flex-lr opt">
  18 + <foodSpec item="{{item}}" type="-" id="foodSpecDel"
  19 + sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}"
  20 + bindfoodSpecCallback="foodSpecCallback">
  21 + <view class='jian'></view>
  22 + </foodSpec>
  23 + <view class="t-align-c">{{item.num}}</view>
  24 + <foodSpec item="{{item}}" type="+"
  25 + sellerid="{{order.sellerid}}" orderid="{{order.id}}" identity="{{identity}}"
  26 + bindfoodSpecCallback="foodSpecCallback">
  27 + <view class='add'></view>
  28 + </foodSpec>
  29 + </view>
  30 + </view>
  31 + </view>
  32 + </view>
  33 +</view>
  1 +/* pack-cookbook/components/cart/cart.wxss */
  2 +@import "/app.wxss";
  3 +.cart{
  4 + background-color: #fefefe;
  5 + border-radius: 10rpx 10rpx 0 0;
  6 + width: 100%;
  7 +}
  8 +.cart image{width: 100%; height: 100%;}
  9 +.cart-title{
  10 + line-height: 60rpx;
  11 + height: 60rpx;
  12 + background-color: #F5F5F5;
  13 + color:#999999;
  14 + font-size: 24rpx;
  15 + border-radius: 10rpx 10rpx 0 0;
  16 +}
  17 +.cart-title .icon{
  18 + width: 26rpx;
  19 + height: 26rpx;
  20 + margin-right: 20rpx;
  21 +}
  22 +.cart-title .text{
  23 + margin-right: 5%;
  24 +}
  25 +.cart-body{
  26 + max-height: 620rpx;
  27 + overflow-y: auto;
  28 + padding: 0 5%;
  29 +}
  30 +.cart-item{
  31 + height: 100rpx;
  32 + line-height: 100rpx;
  33 + font-size: 30rpx;
  34 +}
  35 +.cart-item .name{
  36 + width: 60%;
  37 + overflow: hidden;
  38 + white-space:nowrap;
  39 +}
  40 +.cart-item .name .name{
  41 + width: auto;
  42 + max-width: 80%;
  43 +}
  44 +.cart-item .price{
  45 + width: 32%;
  46 + white-space:nowrap;
  47 + margin: 0 4%;
  48 +}
  49 +.cart-item .opt{
  50 + font-size: 36rpx;
  51 + font-weight: bold;
  52 + min-width: 160rpx;
  53 + width: 160rpx;
  54 +}
  55 +
  56 +
  57 +.jian,.add{
  58 + width: 60rpx;
  59 + height: 60rpx;
  60 + position: relative;
  61 +}
  62 +.jian::after{
  63 + position: absolute;
  64 + content: '';
  65 + top: 0;
  66 + left: 0;
  67 + right: 0;
  68 + bottom: 0;
  69 + margin: auto;
  70 + width: 60%;
  71 + height: 6rpx;
  72 + background-color: #999;
  73 + border-radius: 10rpx;
  74 +}
  75 +.cart-item .jian,.hasListModel .add{
  76 + width:36rpx;
  77 + height: 36rpx;
  78 + border-radius: 50%;
  79 +}
  80 +.cart-item .jian{
  81 + border: 2rpx solid #262628;
  82 +
  83 +}
  84 +.cart-item .jian:after{
  85 + width: 75%;
  86 + height: 4rpx;
  87 + background-color: #262628;
  88 +}
  89 +.cart-item .add{
  90 + background-color: #fefefe;
  91 + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
  92 + background-size: 100%;
  93 + width: 40rpx;
  94 + height: 40rpx;
  95 +}
  96 +.practice_name{
  97 + border: 2rpx solid #C8B16D;
  98 + font-size: 24rpx;
  99 + height: 30rpx;
  100 + line-height: 30rpx;
  101 + color:#C8B16D;
  102 + padding: 0 6rpx;
  103 + margin-left: 18rpx;
  104 +}
@@ -41,6 +41,11 @@ Component({ @@ -41,6 +41,11 @@ Component({
41 this.setData({ 41 this.setData({
42 menuHidden:true 42 menuHidden:true
43 }) 43 })
44 - } 44 + },
  45 + activeMenuID(id){
  46 + this.setData({
  47 + activeMenuID:id
  48 + })
  49 + },
45 } 50 }
46 }) 51 })
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 top:0; 5 top:0;
6 left:0; 6 left:0;
7 bottom:0; 7 bottom:0;
8 - background:#e14553; 8 + background:#353535;
9 z-index:1000; 9 z-index:1000;
10 padding-top:80rpx; 10 padding-top:80rpx;
11 box-sizing:border-box; 11 box-sizing:border-box;
@@ -74,10 +74,10 @@ @@ -74,10 +74,10 @@
74 left:0; 74 left:0;
75 width: 4rpx; 75 width: 4rpx;
76 height: 100%; 76 height: 100%;
77 - background-color: #E14553; 77 + background-color: #353535;
78 } 78 }
79 .hasListModel .line2more{ 79 .hasListModel .line2more{
80 - height: 84rpx; 80 + height: 90rpx;
81 width:140rpx; 81 width:140rpx;
82 vertical-align: middle; 82 vertical-align: middle;
83 overflow: hidden; 83 overflow: hidden;
@@ -3,108 +3,118 @@ import util from '../../../utils/util'; @@ -3,108 +3,118 @@ import util from '../../../utils/util';
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
4 const {regeneratorRuntime} = global 4 const {regeneratorRuntime} = global
5 Component({ 5 Component({
6 - /**  
7 - * 组件的属性列表  
8 - */  
9 - properties: {  
10 - item: {  
11 - type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)  
12 - },  
13 - sellerid:{  
14 - type:Number  
15 - },  
16 - orderid:{  
17 - type:Number  
18 - },  
19 - fromSoucre:{  
20 - type:Number,  
21 - value:0  
22 - },  
23 - request_uri:{  
24 - type:Boolean,  
25 - value:false,  
26 - },  
27 - hasListModel:{  
28 - type:Boolean,  
29 - value:false,  
30 - }, 6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + item: {
  11 + type: Object, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
31 }, 12 },
  13 + sellerid: {
  14 + type: Number
  15 + },
  16 + orderid: {
  17 + type: Number
  18 + },
  19 + fromSoucre: {
  20 + type: Number,
  21 + value: 0
  22 + },
  23 + request_uri: {
  24 + type: Boolean,
  25 + value: false,
  26 + },
  27 + hasListModel: {
  28 + type: Boolean,
  29 + value: false,
  30 + },
  31 + identity: {
  32 + type: String,
  33 + value: '',
  34 + },
  35 + },
32 36
33 - /**  
34 - * 组件的初始数据  
35 - */  
36 - data: {  
37 - item_clear_num:null,  
38 - hasIPhone:false, 37 + /**
  38 + * 组件的初始数据
  39 + */
  40 + data: {
  41 + item_clear_num: null,
  42 + hasIPhone: false,
  43 + labelIcon: {
  44 + 'https://xt05.colorcun.com/uploads/label/lijie.png': '力荐',
  45 + 'https://xt05.colorcun.com/uploads/label/tejia.png': '特价',
  46 + 'https://xt05.colorcun.com/uploads/label/xinpin.png': '新品',
  47 + 'https://xt05.colorcun.com/uploads/label/zhaopai.png': '招牌',
39 }, 48 },
40 - attached () {  
41 - console.log('food-card-ready',this.data.orderid,this.data.fromSoucre)  
42 - let item=this.data.item;  
43 - let item_clear_num;  
44 - if(typeof item.item_clear_num!='undefined'){  
45 - item_clear_num=item.item_clear_num;  
46 - }else{  
47 - item_clear_num=item.clear_num;  
48 - if(item.spec){  
49 - let clear_num=null;  
50 - item.spec.forEach(spec=>{  
51 - if(spec.clear_num==0){  
52 - clear_num=0;  
53 - }else{  
54 - clear_num=null;  
55 - }  
56 - })  
57 - if(clear_num==0){  
58 - item_clear_num=0;  
59 - }  
60 - } 49 + },
  50 + attached () {
  51 + console.log('food-card-ready', this.data.orderid, this.data.fromSoucre)
  52 + let item = this.data.item;
  53 + let item_clear_num;
  54 + if (typeof item.item_clear_num != 'undefined') {
  55 + item_clear_num = item.item_clear_num;
  56 + } else {
  57 + item_clear_num = item.clear_num;
  58 + if (item.spec) {
  59 + let clear_num = null;
  60 + item.spec.forEach(spec => {
  61 + if (spec.clear_num == 0) {
  62 + clear_num = 0;
  63 + } else {
  64 + clear_num = null;
  65 + }
  66 + })
  67 + if (clear_num == 0) {
  68 + item_clear_num = 0;
61 } 69 }
  70 + }
  71 + }
62 72
63 - this.setData({  
64 - item_clear_num:item_clear_num,  
65 - hasIPhone:getApp().system.model.indexOf('iPhone')>-1  
66 - });  
67 - },  
68 - detached(){ 73 + this.setData({
  74 + item_clear_num: item_clear_num,
  75 + hasIPhone: getApp().system.model.indexOf('iPhone') > -1
  76 + });
  77 + },
  78 + detached(){
69 79
  80 + },
  81 + /**
  82 + * 组件的方法列表
  83 + */
  84 + methods: {
  85 + //规格 增加/减少 回调
  86 + foodSpecCallback(e){
  87 + let opt = e.detail;
  88 + console.log('foodSpecCallback', opt);
  89 + if (opt.type == 'specWin') {
  90 + return this.triggerEvent('foodCardCallback', opt);
  91 + }
  92 + let item = this.data.item;
  93 + let oldNum = (item.num || 0);
  94 + item.num = (item.num || 0) + opt.type;
  95 + let rotateFlag = (oldNum == 0 || item.num == 0);
  96 + console.log('num_rotate', rotateFlag);
  97 + this.setData({item: item, rotate_id: rotateFlag ? item.id : ''});
  98 + opt.num = item.num;
  99 + this.triggerEvent('foodCardCallback', opt);
70 }, 100 },
71 - /**  
72 - * 组件的方法列表  
73 - */  
74 - methods: {  
75 - //规格 增加/减少 回调  
76 - foodSpecCallback(e){  
77 - let opt=e.detail;  
78 - console.log('foodSpecCallback',opt);  
79 - if(opt.type=='specWin'){  
80 - return this.triggerEvent('foodCardCallback',opt);  
81 - }  
82 - let item=this.data.item;  
83 - let oldNum=(item.num||0);  
84 - item.num=(item.num||0)+opt.type;  
85 - let rotateFlag=(oldNum==0 || item.num==0);  
86 - console.log('num_rotate',rotateFlag);  
87 - this.setData({item:item,rotate_id:rotateFlag?item.id:''});  
88 - opt.num=item.num;  
89 - this.triggerEvent('foodCardCallback',opt);  
90 - },  
91 101
92 - //清除订单下某菜品所有数量  
93 - delOrderCook:function(){  
94 - this.selectComponent("#foodSpecDel").clean();  
95 - },  
96 - //triggerAdd  
97 - triggerAdd(e){  
98 - console.log('triggerAdd',e)  
99 - if(this.data.item_clear_num==0) return;  
100 - this.selectComponent("#foodSpecAddOne").addCook();  
101 - },  
102 - //viewIMage  
103 - viewImage(){  
104 - wx.previewImage({  
105 - current: this.data.item.image, // 当前显示图片的http链接  
106 - urls: [this.data.item.image], // 需要预览的图片http链接列表  
107 - })  
108 - } 102 + //清除订单下某菜品所有数量
  103 + delOrderCook: function () {
  104 + this.selectComponent("#foodSpecDel").clean();
  105 + },
  106 + //triggerAdd
  107 + triggerAdd(e){
  108 + console.log('triggerAdd', e)
  109 + if (this.data.item_clear_num == 0) return;
  110 + this.selectComponent("#foodSpecAddOne").addCook();
  111 + },
  112 + //viewIMage
  113 + viewImage(){
  114 + wx.previewImage({
  115 + current: this.data.item.image, // 当前显示图片的http链接
  116 + urls: [this.data.item.image], // 需要预览的图片http链接列表
  117 + })
109 } 118 }
  119 + }
110 }) 120 })
1 -<view class="flex-ll-top hasListModel" style="width:100%;"> 1 +<view class="flex-ll hasListModel" style="width:100%;">
2 <view class="avatar"> 2 <view class="avatar">
3 <image mode="aspectFill" lazy-load="true" src="{{item.image}}"/> 3 <image mode="aspectFill" lazy-load="true" src="{{item.image}}"/>
4 </view> 4 </view>
5 - <view class="content">  
6 - <view class="name Semibold">  
7 - {{item.name}}  
8 - </view>  
9 - <view class="desc">  
10 - {{item.desc||''}}  
11 - </view>  
12 - <view class="label"> 5 + <view class="content flex-tb">
  6 + <view class="name Semibold">{{item.name}}</view>
  7 + <view class="desc">{{item.desc||''}}</view>
  8 + <view class="label flex-ll">
13 <block wx:if="{{item.labelList}}"> 9 <block wx:if="{{item.labelList}}">
14 - <view class="menu-ptop-mark">  
15 - <block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">  
16 - <image class="labelListImg" src="{{son.icon}}" mode="aspectFit"></image>  
17 - </block>  
18 - </view> 10 + <block wx:for="{{item.labelList}}" wx:for-item="son" wx:key="labelList-key">
  11 + <view class="labelListImg flex-vc" wx:if="{{labelIcon[son.icon]}}">{{labelIcon[son.icon]}}</view>
  12 + <image class="labelListImg" wx:else="" src="{{son.icon}}" mode="aspectFit"></image>
  13 + </block>
19 </block> 14 </block>
20 </view> 15 </view>
21 - <view class="flex-lr price">  
22 - <view class="flex-ll">  
23 - <view class="rmb">¥</view>  
24 - <view class="money">{{item.spec[0].price>0 ? item.spec[0].price : item.price}}</view>  
25 - </view>  
26 - <view class="opt flex-ll"> 16 + <view class="price">¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}}
  17 + <view class="opt flex-cc">
27 <block wx:if="{{item_clear_num==0}}"> 18 <block wx:if="{{item_clear_num==0}}">
28 <image 19 <image
29 class="avater" 20 class="avater"
@@ -34,7 +25,7 @@ @@ -34,7 +25,7 @@
34 <block wx:else=""> 25 <block wx:else="">
35 <block wx:if="{{item.num>0}}"> 26 <block wx:if="{{item.num>0}}">
36 <foodSpec item="{{item}}" type="-" id="foodSpecDel" 27 <foodSpec item="{{item}}" type="-" id="foodSpecDel"
37 - sellerid="{{sellerid}}" orderid="{{orderid}}" 28 + sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}"
38 fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" 29 fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
39 bindfoodSpecCallback="foodSpecCallback"> 30 bindfoodSpecCallback="foodSpecCallback">
40 <view class='jian'></view> 31 <view class='jian'></view>
@@ -42,7 +33,7 @@ @@ -42,7 +33,7 @@
42 <view class="t-align-c">{{item.num}}</view> 33 <view class="t-align-c">{{item.num}}</view>
43 </block> 34 </block>
44 <foodSpec item="{{item}}" type="+" 35 <foodSpec item="{{item}}" type="+"
45 - sellerid="{{sellerid}}" orderid="{{orderid}}" 36 + sellerid="{{sellerid}}" orderid="{{orderid}}" identity="{{identity}}"
46 fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" 37 fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}"
47 bindfoodSpecCallback="foodSpecCallback"> 38 bindfoodSpecCallback="foodSpecCallback">
48 <view class='add'></view> 39 <view class='add'></view>
@@ -50,9 +41,11 @@ @@ -50,9 +41,11 @@
50 </block> 41 </block>
51 </view> 42 </view>
52 </view> 43 </view>
  44 + <!--
53 <view wx:if="{{item_clear_num>0}}" style="padding:0rpx 10rpx;"> 45 <view wx:if="{{item_clear_num>0}}" style="padding:0rpx 10rpx;">
54 <text class="food-clear-content">剩{{item_clear_num}}份</text> 46 <text class="food-clear-content">剩{{item_clear_num}}份</text>
55 </view> 47 </view>
  48 + -->
56 </view> 49 </view>
57 </view> 50 </view>
58 51
1 -@import '../../app.wxss'; 1 +@import '/app.wxss';
2 .cookWapper{ 2 .cookWapper{
3 border-radius:4px; 3 border-radius:4px;
4 position: relative; 4 position: relative;
@@ -78,32 +78,7 @@ @@ -78,32 +78,7 @@
78 background-color: #999; 78 background-color: #999;
79 border-radius: 10rpx; 79 border-radius: 10rpx;
80 } 80 }
81 -.add::after{  
82 - position: absolute;  
83 - content: '';  
84 - top: 0;  
85 - left: 0;  
86 - right: 0;  
87 - bottom: 0;  
88 - margin: auto;  
89 - width: 60%;  
90 - height: 6rpx;  
91 - background-color: red;  
92 - border-radius: 10rpx;  
93 -}  
94 -.add::before{  
95 - position: absolute;  
96 - content: '';  
97 - top: 0;  
98 - left: 0;  
99 - right: 0;  
100 - bottom: 0;  
101 - margin: auto;  
102 - width: 6rpx;  
103 - height: 60%;  
104 - background-color: red;  
105 - border-radius: 10rpx;  
106 -} 81 +
107 82
108 .ptop5 { 83 .ptop5 {
109 padding-top:5px; 84 padding-top:5px;
@@ -119,22 +94,21 @@ @@ -119,22 +94,21 @@
119 } 94 }
120 95
121 .menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex} 96 .menu-ptop-mark{ width:100%; height: 13px; padding-top:0; display: flex}
122 -.labelListImg{  
123 - width: 50rpx; height: 30rpx; margin-right: 10rpx;  
124 -} 97 +
125 98
126 .hasListModel{ 99 .hasListModel{
127 /*列表模式*/ 100 /*列表模式*/
  101 + height: 160rpx;
  102 + padding: 20rpx 0;
128 } 103 }
129 .hasListModel .avatar{ 104 .hasListModel .avatar{
130 - width: 138rpx;  
131 - min-width: 138rpx;  
132 - height: 140rpx;  
133 - margin-right: 18rpx; 105 + width: 160rpx;
  106 + min-width: 160rpx;
  107 + height: 160rpx;
  108 + margin-right: 20rpx;
134 border-radius: 10rpx; 109 border-radius: 10rpx;
135 overflow: hidden; 110 overflow: hidden;
136 background-color: #D8D8D8; 111 background-color: #D8D8D8;
137 - margin-top: 10rpx;  
138 } 112 }
139 .hasListModel .avatar image{ 113 .hasListModel .avatar image{
140 width: 100%; 114 width: 100%;
@@ -145,54 +119,61 @@ @@ -145,54 +119,61 @@
145 .hasListModel .content{ 119 .hasListModel .content{
146 overflow: hidden; 120 overflow: hidden;
147 width: 100%; 121 width: 100%;
  122 + height: 160rpx;
148 } 123 }
149 .hasListModel .name{ 124 .hasListModel .name{
150 - height: 48rpx;  
151 - line-height:48rpx;  
152 - font-size: 34rpx; 125 + height: 30rpx;
  126 + line-height:30rpx;
  127 + font-size: 30rpx;
153 overflow: hidden; 128 overflow: hidden;
154 text-overflow:ellipsis; 129 text-overflow:ellipsis;
155 white-space: nowrap; 130 white-space: nowrap;
156 } 131 }
157 .hasListModel .desc{ 132 .hasListModel .desc{
158 - height: 34rpx;  
159 - line-height:34rpx;  
160 - font-size: 24rpx; 133 + height: 20rpx;
  134 + line-height:20rpx;
  135 + font-size: 20rpx;
161 overflow: hidden; 136 overflow: hidden;
162 text-overflow:ellipsis; 137 text-overflow:ellipsis;
163 white-space: nowrap; 138 white-space: nowrap;
  139 + color:#999999;
164 } 140 }
165 .hasListModel .label{ 141 .hasListModel .label{
166 height: 22rpx; 142 height: 22rpx;
167 line-height:22rpx; 143 line-height:22rpx;
168 - overflow: hidden;  
169 - margin-top: 12rpx;  
170 - margin-bottom: 4rpx; 144 + font-size: 22rpx;
171 } 145 }
172 -.hasListModel .label .menu-ptop-mark,.hasListModel .label .labelListImg{  
173 - height: 100%;  
174 - margin-right: 4rpx; 146 +.labelListImg{
  147 + width: 50rpx;
  148 + height: 22rpx;
  149 + margin-right: 10rpx;
  150 + line-height: 22rpx;
  151 + font-size: 18rpx;
  152 + color:#FEFEFE;
  153 + background: linear-gradient(to right, #C8B16D, #ECD48B);
175 } 154 }
176 .hasListModel .price{ 155 .hasListModel .price{
177 - height: 40rpx;  
178 - overflow: hidden;  
179 - padding:0 10rpx;  
180 - line-height: 40rpx; 156 + height: 28rpx;
181 font-size: 28rpx; 157 font-size: 28rpx;
  158 + line-height: 28rpx;
  159 + position: relative;
  160 + width: 100%;
182 } 161 }
183 -.hasListModel .price .flex-ll-bottom{ 162 +.hasListModel .price .opt{
  163 + position: absolute;
  164 + right:20rpx;
  165 + top:-16rpx;
184 height: 40rpx; 166 height: 40rpx;
  167 + line-height: 40rpx;
185 } 168 }
186 -.hasListModel .price .rmb{  
187 - /*line-height:26rpx;  
188 - height:26rpx;  
189 - font-size: 24rpx;*/  
190 - margin-right: 10rpx;  
191 -}  
192 -.hasListModel .price .money{  
193 - /*height: 30rpx;  
194 - font-size: 28rpx;  
195 - line-height:30rpx;*/ 169 +.hasListModel .t-align-c{
  170 + margin: 0 10rpx;
  171 + font-size: 36rpx;
  172 + font-weight: bold;
  173 + padding: 0;
  174 + width: 50rpx;
  175 + overflow-x: hidden;
  176 + text-align: center;
196 } 177 }
197 178
198 .hasListModel .food-clear-content{ 179 .hasListModel .food-clear-content{
@@ -207,34 +188,20 @@ @@ -207,34 +188,20 @@
207 border-radius: 50%; 188 border-radius: 50%;
208 } 189 }
209 .hasListModel .jian{ 190 .hasListModel .jian{
210 - border: 2rpx solid #B4B2B2; 191 + border: 2rpx solid #262628;
211 192
212 } 193 }
213 .hasListModel .jian:after{ 194 .hasListModel .jian:after{
214 width: 75%; 195 width: 75%;
215 height: 4rpx; 196 height: 4rpx;
216 - background-color: #B4B2B2; 197 + background-color: #262628;
217 } 198 }
218 .hasListModel .add{ 199 .hasListModel .add{
219 - border: 2rpx solid #E14553;  
220 - background-color:#E14553;  
221 -}  
222 -.hasListModel .add:after,.hasListModel .add:before{  
223 - background-color: #fff;  
224 -}  
225 -.hasListModel .add:after{  
226 - width: 75%;  
227 - height: 4rpx;  
228 -}  
229 -.hasListModel .add:before{  
230 - height: 75%;  
231 - width: 4rpx;  
232 -}  
233 -.hasListModel .t-align-c{  
234 - margin: 0 10rpx;  
235 - font-size: 36rpx;  
236 - font-weight: bold;  
237 - padding: 0;  
238 - width: 50rpx;  
239 - overflow: hidden; 200 + background-color: #fefefe;
  201 + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
  202 + background-size: 100%;
  203 + width: 40rpx;
  204 + height: 40rpx;
240 } 205 }
  206 +
  207 +
@@ -3,448 +3,462 @@ import util from '../../../utils/util'; @@ -3,448 +3,462 @@ import util from '../../../utils/util';
3 import App from '../../../utils/api'; 3 import App from '../../../utils/api';
4 const {regeneratorRuntime} = global 4 const {regeneratorRuntime} = global
5 Component({ 5 Component({
6 - /**  
7 - * 组件的属性列表  
8 - */  
9 - properties: {  
10 - item:{  
11 - type:Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)  
12 - },  
13 - type:{  
14 - type:String,  
15 - default:'+'  
16 - },  
17 - sellerid:{  
18 - type:Number  
19 - },  
20 - orderid:{  
21 - type:Number  
22 - },  
23 - fromSoucre:{  
24 - type:Number,  
25 - value:0  
26 - },  
27 - request_uri:{  
28 - type:Boolean,  
29 - value:false,  
30 - }  
31 - 6 + /**
  7 + * 组件的属性列表
  8 + */
  9 + properties: {
  10 + item: {
  11 + type: Object // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
32 }, 12 },
33 -  
34 - /**  
35 - * 组件的初始数据  
36 - */  
37 - data: {  
38 - hiddenFoodSpec:true,//加菜规格  
39 - hiddenFoodSpecReduce:true,//减菜规格  
40 - selectKind:[{title:'xxxxx'},{title:'yyyyy'}], 13 + type: {
  14 + type: String,
  15 + default: '+'
41 }, 16 },
42 - ready () {  
43 - 17 + sellerid: {
  18 + type: Number
44 }, 19 },
45 - detached(){  
46 - 20 + orderid: {
  21 + type: Number
47 }, 22 },
48 - /**  
49 - * 组件的方法列表  
50 - */  
51 - methods: {  
52 - init(){  
53 - console.log('food-spec init');  
54 - this.setData({  
55 - hiddenFoodSpec:false  
56 - })  
57 - },  
58 - //关闭规格框  
59 - close:function(){  
60 - this.setData({  
61 - hiddenFoodSpec:true,  
62 - hiddenFoodSpecReduce:true,  
63 - })  
64 - //关闭了规格窗口  
65 - this.triggerEvent('foodSpecCallback',{  
66 - type:'specWin',  
67 - value:'hide'  
68 - });  
69 - },  
70 - //构造KindMenu  
71 - initKindMenu(){  
72 - return new Promise((success,fail)=>{  
73 - let price=this.data.item.price;  
74 - let hasSpec = this.data.item.spec.length>0;  
75 - let hasPractice = this.data.item.practice.length>0;  
76 - if(hasSpec || hasPractice){  
77 - var specs = this.data.item.spec//规格  
78 - var practice = this.data.item.practice//做法  
79 - var kind = []  
80 - var foodMenu=[]  
81 - if(this.data.type=='-'){  
82 - if(specs){  
83 - specs.map(function(r,n){  
84 - if(r.id){//某规格卖光了 就不显示 && r.clear_num>1  
85 - kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})  
86 - }  
87 - })  
88 - } 23 + fromSoucre: {
  24 + type: Number,
  25 + value: 0
  26 + },
  27 + request_uri: {
  28 + type: Boolean,
  29 + value: false,
  30 + },
  31 + identity: {
  32 + type: String,
  33 + value: "",
  34 + }
89 35
90 - if(practice) {  
91 - practice.map(function (r, n) {  
92 - if (r.id) {  
93 - foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})  
94 - }  
95 - })  
96 - }  
97 - App.Cookbook.GetCookbookSelBySpecsId({  
98 - sellerid:this.data.sellerid,  
99 - orderid: this.data.orderid,  
100 - cookbookid: this.data.item.id,  
101 - status:this.data.fromSoucre!=''?2:'',//只查没有下单的  
102 - }).then(res=>{  
103 - this.setData({  
104 - selectKind:res.data[0],  
105 - hiddenFoodSpecReduce:false,  
106 - kind:kind?kind:'',  
107 - foodMenu:foodMenu,  
108 - })  
109 - })  
110 - }else{  
111 - specs.map(function(r,n){  
112 - if ((r.id && r.clear_num > 0) || r.clear_num==null){//某规格卖光了 就不显示 && r.clear_num>1  
113 - kind.push({id:r.id,price:r.price,title:r.specs,iskind:false})  
114 - }  
115 - })  
116 - if(kind.length>0){  
117 - kind[0].iskind=true;  
118 - var kindPrice=kind[0].price;  
119 - var specs_id=kind[0].id;  
120 - } 36 + },
121 37
122 - practice.map(function(r,n){  
123 - if(r.id){  
124 - foodMenu.push({id:r.id,price:price,title:r.name,iskind:false})  
125 - }  
126 - }) 38 + /**
  39 + * 组件的初始数据
  40 + */
  41 + data: {
  42 + hiddenFoodSpec: true,//加菜规格
  43 + hiddenFoodSpecReduce: true,//减菜规格
  44 + selectKind: [{title: 'xxxxx'}, {title: 'yyyyy'}],
  45 + },
  46 + ready () {
127 47
128 - if(foodMenu.length>0){  
129 - foodMenu[0].iskind=true;  
130 - var foodMenuPrice=foodMenu[0].price;  
131 - var practice_id=foodMenu[0].id;  
132 - }  
133 - App.Cookbook.GetCookbookSelBySpecsId({  
134 - sellerid:this.data.sellerid,  
135 - orderid: this.data.orderid,  
136 - cookbookid: this.data.item.id,  
137 - status:this.data.fromSoucre!=''?2:'',//只查没有下单的  
138 - }).then(res=>{  
139 - this.setData({  
140 - selectKind:res.data[0],  
141 - hiddenFoodSpec:false,  
142 - kind:kind,  
143 - foodMenu:foodMenu,  
144 - showSpecsPrice:false,  
145 - cookbook_name:this.data.item.name,  
146 - cookbook_id:this.data.item.id,  
147 - specs_id:specs_id ? specs_id :'',  
148 - practice_id:practice_id ? practice_id : '',  
149 - selectPrice:kindPrice>0 ? kindPrice : foodMenuPrice,  
150 - add_target:''  
151 - })  
152 - })  
153 - }  
154 - success();  
155 - }else{  
156 - fail();  
157 - }  
158 - });  
159 - },  
160 - //选择规格  
161 - kindSelect: function (e) {  
162 - var index = e.currentTarget.dataset.key  
163 - var specsid = e.currentTarget.id  
164 - var price = e.currentTarget.dataset.price  
165 - for (var i = 0; i < this.data.kind.length; i++) {  
166 - if (i == index) {  
167 - this.data.kind[i].iskind = true;  
168 - } else {  
169 - this.data.kind[i].iskind = false;  
170 - }  
171 - }  
172 - var is_show = ''  
173 - if(this.data.foodMenu==''){  
174 - is_show=1  
175 - }else if(specsid && this.data.practice_id){  
176 - is_show=1  
177 - }  
178 - this.setData({  
179 - kind: this.data.kind,  
180 - selectPrice:price,  
181 - specs_id:specsid,  
182 - foodMenu:this.data.foodMenu?this.data.foodMenu:'',  
183 - showSpecsPrice:price?false:true,  
184 - showAdd:is_show?false:true//showAdd:specsid?false:true  
185 - });  
186 - },  
187 - //选择做法  
188 - menuSelect: function (e) {  
189 - var index = e.currentTarget.dataset.key  
190 - var practiceid = e.currentTarget.id  
191 - var price = e.currentTarget.dataset.price  
192 - for (var i = 0; i < this.data.foodMenu.length; i++) {  
193 - if (i == index) {  
194 - this.data.foodMenu[i].iskind = true;  
195 - } else {  
196 - this.data.foodMenu[i].iskind = false;  
197 - }  
198 - }  
199 - var is_show = ''  
200 - if(this.data.kind==''){  
201 - is_show=1  
202 - }else if(this.data.specs_id && practiceid){  
203 - is_show=1  
204 - }  
205 - this.setData({  
206 - foodMenu: this.data.foodMenu,  
207 - foodMenuPrice:price,  
208 - practice_id:practiceid,  
209 - showAdd:is_show?false:true  
210 - });  
211 - },  
212 - //加菜面板  
213 - addCook:function(e){  
214 - console.log('addCook',this.data.item,e);  
215 - var cookbookid = this.data.item.id  
216 - var price=this.data.item.price; 48 + },
  49 + detached(){
217 50
218 - this.initKindMenu().then(res=>{  
219 - //打开了规格窗口  
220 - this.triggerEvent('foodSpecCallback',{  
221 - type:'specWin',  
222 - value:'show'  
223 - });  
224 - }).catch(res=>{  
225 - console.log('initKindMenu',res);  
226 - if( this.data.item.clear_num && this.data.item.clear_num>0  
227 - && this.data.item.num+1 > this.data.item.clear_num){  
228 - wx.showToast({  
229 - title:'该菜品最多能点'+this.data.item.clear_num+'份',  
230 - duration:2000,  
231 - mask:true,  
232 - icon:'none'  
233 - });  
234 - return; 51 + },
  52 + /**
  53 + * 组件的方法列表
  54 + */
  55 + methods: {
  56 + init(){
  57 + console.log('food-spec init');
  58 + this.setData({
  59 + hiddenFoodSpec: false
  60 + })
  61 + },
  62 + //关闭规格框
  63 + close: function () {
  64 + this.setData({
  65 + hiddenFoodSpec: true,
  66 + hiddenFoodSpecReduce: true,
  67 + })
  68 + //关闭了规格窗口
  69 + this.triggerEvent('foodSpecCallback', {
  70 + type: 'specWin',
  71 + value: 'hide'
  72 + });
  73 + },
  74 + //构造KindMenu
  75 + initKindMenu(){
  76 + return new Promise((success, fail) => {
  77 + let price = this.data.item.price;
  78 + let hasSpec = this.data.item.spec.length > 0;
  79 + let hasPractice = this.data.item.practice.length > 0;
  80 + if (hasSpec || hasPractice) {
  81 + var specs = this.data.item.spec//规格
  82 + var practice = this.data.item.practice//做法
  83 + var kind = []
  84 + var foodMenu = []
  85 + if (this.data.type == '-') {
  86 + if (specs) {
  87 + specs.map(function (r, n) {
  88 + if (r.id) {//某规格卖光了 就不显示 && r.clear_num>1
  89 + kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
235 } 90 }
236 - //通知  
237 - this.triggerEvent('foodSpecCallback',{  
238 - cookbookid:cookbookid,  
239 - type:1,  
240 - });  
241 - //this.matchArray(cookbookid,1,countTotal,countPirce)  
242 - App.Orders.AddCart({  
243 - orderid: this.data.orderid,  
244 - openid:util.cache('openid'),  
245 - cookbookid:cookbookid,  
246 - price: price,  
247 - source: 1,  
248 - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识  
249 - fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',  
250 - identity:util.cache('identity')  
251 - });  
252 - });  
253 - },  
254 - //减菜面板  
255 - subtractCook(){  
256 - console.log('addFunction',this.data.item);  
257 - var cookbookid = this.data.item.id  
258 - var price=this.data.item.price;  
259 - this.initKindMenu().then(res=>{  
260 - //打开了规格窗口  
261 - this.triggerEvent('foodSpecCallback',{  
262 - type:'specWin',  
263 - value:'show'  
264 - });  
265 - }).catch(res=>{  
266 - //通知  
267 - this.triggerEvent('foodSpecCallback',{  
268 - cookbookid:cookbookid,  
269 - type:-1,  
270 - });  
271 -  
272 - App.Orders.ReduceOrder({  
273 - orderid: this.data.orderid,  
274 - openid: getApp().openid,  
275 - cookbookid: cookbookid,  
276 - //specid: specid ? specid : '',  
277 - //practiceid: specid ? specid : '',  
278 - fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',  
279 - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识  
280 - status:this.data.fromSoucre!=''?2:'',//只查没有下单的  
281 - source: 2,  
282 - });  
283 - });  
284 - },  
285 - //减菜面板加菜按钮  
286 - add:function(e){  
287 - console.log('add',util.attr(e,'cookbookid'),e);  
288 - let index=util.attr(e,'index');  
289 - let selectKind=this.data.selectKind; 91 + })
  92 + }
290 93
291 - console.log('selectKind',selectKind,index);  
292 - let specs=this.data.item.spec;  
293 - let clear_num=null;  
294 - specs.forEach(spec=>{  
295 - if(spec.id==selectKind[index].specid){  
296 - clear_num=spec.clear_num; 94 + if (practice) {
  95 + practice.map(function (r, n) {
  96 + if (r.id) {
  97 + foodMenu.push({id: r.id, price: r.price, title: r.name, iskind: false})
297 } 98 }
  99 + })
  100 + }
  101 + App.Advance.GetCookbookSelBySpecsId({
  102 + sellerid: this.data.sellerid,
  103 + orderid: this.data.orderid,
  104 + cookbookid: this.data.item.id,
  105 + status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
  106 + identity: this.data.identity
  107 + }).then(res => {
  108 + this.setData({
  109 + selectKind: res.data,
  110 + hiddenFoodSpecReduce: false,
  111 + kind: kind ? kind : '',
  112 + foodMenu: foodMenu,
  113 + })
  114 + })
  115 + } else {
  116 + specs.map(function (r, n) {
  117 + if ((r.id && r.clear_num > 0) || r.clear_num == null) {//某规格卖光了 就不显示 && r.clear_num>1
  118 + kind.push({id: r.id, price: r.price, title: r.specs, iskind: false})
  119 + }
298 }) 120 })
299 - if( clear_num && clear_num>0  
300 - && selectKind[index].foodNum+1 > clear_num){  
301 - wx.showToast({  
302 - title:'该菜品最多能点'+clear_num+'份',  
303 - duration:2000,  
304 - mask:true,  
305 - icon:'none'  
306 - });  
307 - return; 121 + if (kind.length > 0) {
  122 + kind[0].iskind = true;
  123 + var kindPrice = kind[0].price;
  124 + var specs_id = kind[0].id;
308 } 125 }
309 126
310 - selectKind[index].foodNum=parseInt(selectKind[index].foodNum)+1;  
311 - this.setData({selectKind:selectKind});  
312 - this.formSubmit(e,true);  
313 - },  
314 - //减菜面板减菜按钮  
315 - reduce(e){  
316 - console.log('reduce',util.attr(e,'cookbookid'),e);  
317 - var cookbookid = util.attr(e,'cookbookid')  
318 - var specid = util.attr(e,'specid')  
319 - var practice_id = util.attr(e,'practiceid')  
320 - var price = util.attr(e,'price') 127 + practice.map(function (r, n) {
  128 + if (r.id) {
  129 + foodMenu.push({id: r.id, price: price, title: r.name, iskind: false})
  130 + }
  131 + })
321 132
322 - let index=util.attr(e,'index');  
323 - let selectKind=this.data.selectKind;  
324 - selectKind[index].foodNum-=1;  
325 - if(selectKind[index].foodNum<=0){  
326 - selectKind.splice(index,1);  
327 - }  
328 - this.setData({selectKind:selectKind});  
329 - if(selectKind.length<1){  
330 - this.close(); 133 + if (foodMenu.length > 0) {
  134 + foodMenu[0].iskind = true;
  135 + var foodMenuPrice = foodMenu[0].price;
  136 + var practice_id = foodMenu[0].id;
331 } 137 }
  138 + this.setData({
  139 + selectKind: [],
  140 + hiddenFoodSpec: false,
  141 + kind: kind,
  142 + foodMenu: foodMenu,
  143 + showSpecsPrice: false,
  144 + cookbook_name: this.data.item.name,
  145 + cookbook_id: this.data.item.id,
  146 + specs_id: specs_id ? specs_id : '',
  147 + practice_id: practice_id ? practice_id : '',
  148 + selectPrice: kindPrice > 0 ? kindPrice : foodMenuPrice,
  149 + add_target: ''
  150 + })
  151 + }
  152 + success();
  153 + } else {
  154 + fail();
  155 + }
  156 + });
  157 + },
  158 + //选择规格
  159 + kindSelect: function (e) {
  160 + var index = e.currentTarget.dataset.key
  161 + var specsid = e.currentTarget.id
  162 + var price = e.currentTarget.dataset.price
  163 + for (var i = 0; i < this.data.kind.length; i++) {
  164 + if (i == index) {
  165 + this.data.kind[i].iskind = true;
  166 + } else {
  167 + this.data.kind[i].iskind = false;
  168 + }
  169 + }
  170 + var is_show = ''
  171 + if (this.data.foodMenu == '') {
  172 + is_show = 1
  173 + } else if (specsid && this.data.practice_id) {
  174 + is_show = 1
  175 + }
  176 + this.setData({
  177 + kind: this.data.kind,
  178 + selectPrice: price,
  179 + specs_id: specsid,
  180 + foodMenu: this.data.foodMenu ? this.data.foodMenu : '',
  181 + showSpecsPrice: price ? false : true,
  182 + showAdd: is_show ? false : true//showAdd:specsid?false:true
  183 + });
  184 + },
  185 + //选择做法
  186 + menuSelect: function (e) {
  187 + var index = e.currentTarget.dataset.key
  188 + var practiceid = e.currentTarget.id
  189 + var price = e.currentTarget.dataset.price
  190 + for (var i = 0; i < this.data.foodMenu.length; i++) {
  191 + if (i == index) {
  192 + this.data.foodMenu[i].iskind = true;
  193 + } else {
  194 + this.data.foodMenu[i].iskind = false;
  195 + }
  196 + }
  197 + var is_show = ''
  198 + if (this.data.kind == '') {
  199 + is_show = 1
  200 + } else if (this.data.specs_id && practiceid) {
  201 + is_show = 1
  202 + }
  203 + this.setData({
  204 + foodMenu: this.data.foodMenu,
  205 + foodMenuPrice: price,
  206 + practice_id: practiceid,
  207 + showAdd: is_show ? false : true
  208 + });
  209 + },
  210 + //加菜面板
  211 + addCook: function (e) {
  212 + console.log('addCook', this.data.item, e);
  213 + var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
  214 + var price = this.data.item.price;
332 215
333 - this.triggerEvent('foodSpecCallback',{  
334 - cookbookid:cookbookid,  
335 - type:-1  
336 - }); 216 + this.initKindMenu().then(res => {
  217 + //打开了规格窗口
  218 + this.triggerEvent('foodSpecCallback', {
  219 + type: 'specWin',
  220 + value: 'show'
  221 + });
  222 + }).catch(res => {
  223 + console.log('initKindMenu', res);
  224 + if (this.data.item.clear_num && this.data.item.clear_num > 0
  225 + && this.data.item.num + 1 > this.data.item.clear_num) {
  226 + wx.showToast({
  227 + title: '该菜品最多能点' + this.data.item.clear_num + '份',
  228 + duration: 2000,
  229 + mask: true,
  230 + icon: 'none'
  231 + });
  232 + return;
  233 + }
  234 + //通知
  235 + this.triggerEvent('foodSpecCallback', {
  236 + cookbookid: cookbookid,
  237 + type: 1,
  238 + });
  239 + //this.matchArray(cookbookid,1,countTotal,countPirce)
  240 + let params={
  241 + orderid: this.data.orderid,
  242 + openid: util.cache('openid'),
  243 + cookbookid: cookbookid,
  244 + price: price,
  245 + source: 1,
  246 + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
  247 + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
  248 + identity: this.data.identity
  249 + }
  250 + if(this.data.item.specid>0){
  251 + params.specid=this.data.item.specid;
  252 + }
  253 + if(this.data.item.practiceid>0){
  254 + params.practiceid=this.data.item.practiceid;
  255 + }
  256 + App.Advance.AddCart(params);
  257 + });
  258 + },
  259 + //减菜面板
  260 + subtractCook(){
  261 + console.log('subtractCook', this.data.item);
  262 + var cookbookid = this.data.item.identity>=0?this.data.item.cookbookid:this.data.item.id
  263 + var price = this.data.item.price;
  264 + this.initKindMenu().then(res => {
  265 + //打开了规格窗口
  266 + this.triggerEvent('foodSpecCallback', {
  267 + type: 'specWin',
  268 + value: 'show'
  269 + });
  270 + }).catch(res => {
  271 + //通知
  272 + this.triggerEvent('foodSpecCallback', {
  273 + cookbookid: cookbookid,
  274 + type: -1,
  275 + });
  276 + let params={
  277 + orderid: this.data.orderid,
  278 + openid: getApp().openid,
  279 + cookbookid: cookbookid,
  280 + //specid: specid ? specid : '',
  281 + //practiceid: specid ? specid : '',
  282 + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
  283 + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
  284 + status: this.data.fromSoucre != '' ? 2 : '',//只查没有下单的
  285 + source: 2,
  286 + identity: this.data.identity
  287 + }
  288 + if(this.data.item.specid>0){
  289 + params.specid=this.data.item.specid;
  290 + }
  291 + if(this.data.item.practiceid>0){
  292 + params.practiceid=this.data.item.practiceid;
  293 + }
  294 + App.Advance.ReduceOrder(params);
  295 + });
  296 + },
  297 + //减菜面板加菜按钮
  298 + add: function (e) {
  299 + console.log('add', util.attr(e, 'cookbookid'), e);
  300 + let index = util.attr(e, 'index');
  301 + let selectKind = this.data.selectKind;
337 302
338 - //执行删除操作  
339 - let params={  
340 - orderid: this.data.orderid,  
341 - openid: getApp().openid,  
342 - cookbookid: cookbookid,  
343 - fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',  
344 - status:this.data.fromSoucre?2:'',//只查没有下单的  
345 - request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识  
346 - source: 2,  
347 - };  
348 - if(specid>0){  
349 - params.specid=specid;  
350 - }  
351 - if(practice_id>0){  
352 - params.practiceid=practice_id;  
353 - }  
354 - App.Orders.ReduceOrder(params);  
355 - },  
356 - /**  
357 - *  
358 - * @param e  
359 - * @param subtractCook 减菜面板  
360 - */  
361 - formSubmit(e,subtractCook=false){  
362 - if(subtractCook){//减菜面板  
363 - var cookbookid = util.attr(e,'cookbookid')  
364 - var specid = util.attr(e,'specid')  
365 - var practice_id = util.attr(e,'practiceid')  
366 - var price = util.attr(e,'price')  
367 - }else{  
368 - var cookbookid = util.val(e,'cookbookid')  
369 - var specid = util.val(e,'specs_id')  
370 - var practice_id = util.val(e,'practice_id')  
371 - var price = util.val(e,'price')  
372 - if(this.data.selectPrice){  
373 - console.log(666666,this.data.selectPrice)  
374 - price=this.data.selectPrice  
375 - }else{  
376 - console.log('yyyyyy',this.data.foodMenuPrice)  
377 - price=this.data.foodMenuPrice  
378 - }  
379 - this.close();  
380 - }  
381 - console.log('formSubmit',specid,practice_id,price) 303 + console.log('selectKind', selectKind, index);
  304 + let specs = this.data.item.spec;
  305 + let clear_num = null;
  306 + specs.forEach(spec => {
  307 + if (spec.id == selectKind[index].specid) {
  308 + clear_num = spec.clear_num;
  309 + }
  310 + })
  311 + if (clear_num && clear_num > 0
  312 + && selectKind[index].foodNum + 1 > clear_num) {
  313 + wx.showToast({
  314 + title: '该菜品最多能点' + clear_num + '份',
  315 + duration: 2000,
  316 + mask: true,
  317 + icon: 'none'
  318 + });
  319 + return;
  320 + }
382 321
  322 + selectKind[index].foodNum = parseInt(selectKind[index].foodNum) + 1;
  323 + this.setData({selectKind: selectKind});
  324 + this.formSubmit(e, true);
  325 + },
  326 + //减菜面板减菜按钮
  327 + reduce(e){
  328 + console.log('reduce', util.attr(e, 'cookbookid'), e);
  329 + var cookbookid = util.attr(e, 'cookbookid')
  330 + var specid = util.attr(e, 'specid')
  331 + var practice_id = util.attr(e, 'practiceid')
  332 + var price = util.attr(e, 'price')
383 333
384 - let selectKindNum=0;  
385 - if(this.data.selectKind){  
386 - this.data.selectKind.forEach((kind)=>{  
387 - if(kind.specid==specid){  
388 - selectKindNum=kind.foodNum  
389 - }  
390 - })  
391 - }  
392 - console.log('selectKindNum',this.data.selectKind,selectKindNum);  
393 - if(selectKindNum>0){  
394 - let clear_num=null;  
395 - let specs=this.data.item.spec;  
396 - specs.forEach(spec=>{  
397 - if(spec.id==specid){  
398 - clear_num=spec.clear_num;  
399 - }  
400 - })  
401 - if( clear_num && clear_num>0  
402 - && selectKindNum+1 > clear_num){  
403 - wx.showToast({  
404 - title:'该菜品最多能点'+clear_num+'份',  
405 - duration:2000,  
406 - mask:true,  
407 - icon:'none'  
408 - });  
409 - return;  
410 - }  
411 - } 334 + let index = util.attr(e, 'index');
  335 + let selectKind = this.data.selectKind;
  336 + selectKind[index].foodNum -= 1;
  337 + if (selectKind[index].foodNum <= 0) {
  338 + selectKind.splice(index, 1);
  339 + }
  340 + this.setData({selectKind: selectKind});
  341 + if (selectKind.length < 1) {
  342 + this.close();
  343 + }
412 344
  345 + this.triggerEvent('foodSpecCallback', {
  346 + cookbookid: cookbookid,
  347 + type: -1
  348 + });
413 349
414 - this.triggerEvent('foodSpecCallback',{  
415 - cookbookid:cookbookid,  
416 - type:1  
417 - });  
418 - let param={  
419 - orderid: this.data.orderid,  
420 - openid:util.cache('openid'),  
421 - cookbookid:this.data.item.id,  
422 - price: price,  
423 - source: 1,  
424 - request_uri: this.data.request_uri==true?1:'',//服务员通过消息通知进来 又加菜的标识  
425 - fromSoucre:this.data.fromSoucre?this.data.fromSoucre:'',  
426 - identity:util.cache('identity')  
427 - }  
428 - if(specid>0){  
429 - param.specid=specid;  
430 - }  
431 - if(practice_id>0){  
432 - param.practiceid=practice_id;  
433 - }  
434 - App.Orders.AddCart(param);  
435 - },  
436 - //清除订单下某菜品所有数量  
437 - clean(){  
438 - let cookbookid=this.data.item.id  
439 - this.triggerEvent('foodSpecCallback',{  
440 - cookbookid:cookbookid,  
441 - type:this.data.item.num*-1  
442 - });  
443 - App.Orders.ClearCookById({  
444 - orderid: this.data.orderid,  
445 - sellerid: this.data.sellerid,  
446 - cookbookid:cookbookid  
447 - }); 350 + //执行删除操作
  351 + let params = {
  352 + orderid: this.data.orderid,
  353 + openid: getApp().openid,
  354 + cookbookid: cookbookid,
  355 + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
  356 + status: this.data.fromSoucre ? 2 : '',//只查没有下单的
  357 + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
  358 + source: 2,
  359 + identity: this.data.identity
  360 + };
  361 + if (specid > 0) {
  362 + params.specid = specid;
  363 + }
  364 + if (practice_id > 0) {
  365 + params.practiceid = practice_id;
  366 + }
  367 + App.Advance.ReduceOrder(params);
  368 + },
  369 + /**
  370 + *
  371 + * @param e
  372 + * @param subtractCook 减菜面板
  373 + */
  374 + formSubmit(e, subtractCook = false){
  375 + if (subtractCook) {//减菜面板
  376 + var cookbookid = util.attr(e, 'cookbookid')
  377 + var specid = util.attr(e, 'specid')
  378 + var practice_id = util.attr(e, 'practiceid')
  379 + var price = util.attr(e, 'price')
  380 + } else {
  381 + var cookbookid = util.val(e, 'cookbookid')
  382 + var specid = util.val(e, 'specs_id')
  383 + var practice_id = util.val(e, 'practice_id')
  384 + var price = util.val(e, 'price')
  385 + if (this.data.selectPrice) {
  386 + console.log(666666, this.data.selectPrice)
  387 + price = this.data.selectPrice
  388 + } else {
  389 + console.log('yyyyyy', this.data.foodMenuPrice)
  390 + price = this.data.foodMenuPrice
  391 + }
  392 + this.close();
  393 + }
  394 + console.log('formSubmit', cookbookid,specid, practice_id, price)
  395 + //return;
  396 +
  397 + let selectKindNum = 0;
  398 + if (this.data.selectKind) {
  399 + this.data.selectKind.forEach((kind) => {
  400 + if (kind.specid == specid) {
  401 + selectKindNum = kind.foodNum
  402 + }
  403 + })
  404 + }
  405 + console.log('selectKindNum', this.data.selectKind, selectKindNum);
  406 + if (selectKindNum > 0) {
  407 + let clear_num = null;
  408 + let specs = this.data.item.spec;
  409 + specs.forEach(spec => {
  410 + if (spec.id == specid) {
  411 + clear_num = spec.clear_num;
  412 + }
  413 + })
  414 + if (clear_num && clear_num > 0
  415 + && selectKindNum + 1 > clear_num) {
  416 + wx.showToast({
  417 + title: '该菜品最多能点' + clear_num + '份',
  418 + duration: 2000,
  419 + mask: true,
  420 + icon: 'none'
  421 + });
  422 + return;
448 } 423 }
  424 + }
  425 +
  426 +
  427 + this.triggerEvent('foodSpecCallback', {
  428 + cookbookid: cookbookid,
  429 + type: 1
  430 + });
  431 +
  432 + let param = {
  433 + orderid: this.data.orderid,
  434 + openid: util.cache('openid'),
  435 + cookbookid: cookbookid,
  436 + price: price,
  437 + source: 1,
  438 + request_uri: this.data.request_uri == true ? 1 : '',//服务员通过消息通知进来 又加菜的标识
  439 + fromSoucre: this.data.fromSoucre ? this.data.fromSoucre : '',
  440 + identity: this.data.identity
  441 + }
  442 + if (specid > 0) {
  443 + param.specid = specid;
  444 + }
  445 + if (practice_id > 0) {
  446 + param.practiceid = practice_id;
  447 + }
  448 + App.Advance.AddCart(param);
  449 + },
  450 + //清除订单下某菜品所有数量
  451 + clean(){
  452 + let cookbookid = this.data.item.id
  453 + this.triggerEvent('foodSpecCallback', {
  454 + cookbookid: cookbookid,
  455 + type: this.data.item.num * -1
  456 + });
  457 + App.Advance.ClearCookById({
  458 + orderid: this.data.orderid,
  459 + sellerid: this.data.sellerid,
  460 + cookbookid: cookbookid
  461 + });
449 } 462 }
  463 + }
450 }) 464 })
@@ -2,56 +2,56 @@ @@ -2,56 +2,56 @@
2 <slot></slot> 2 <slot></slot>
3 </view> 3 </view>
4 <view hidden="{{hiddenFoodSpec}}" class="hiddenFoodSpec"> 4 <view hidden="{{hiddenFoodSpec}}" class="hiddenFoodSpec">
5 - <view class="toast-mask"></view>  
6 - <view class="toast-content">  
7 - <form bindsubmit="formSubmit">  
8 - <input value="{{cookbook_id}}" name="cookbookid" hidden="true"/>  
9 - <view class="toast-content-title">{{cookbook_name}}</view>  
10 - <block wx:if="{{kind.length>0}}">  
11 - <view class="toast-content-kind" style="margin-bottom:{{foodMenu.length==0 ? '80rpx' : '0rpx'}}">  
12 - <view class="toast-kind-title">规格</view>  
13 - <view class="toast-kind-menu">  
14 - <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>  
15 - <input value="{{specs_id}}" name="specs_id" hidden="true"/>  
16 - <input value="{{selectPrice}}" name="price" hidden="true"/> 5 + <view class="toast-mask flex-vc" bindtap="close">
  6 + <view class="toast-content" catchtap="catchtap">
  7 + <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image>
  8 + <form bindsubmit="formSubmit">
  9 + <input value="{{cookbook_id}}" name="cookbookid" hidden="true"/>
  10 + <view class="toast-content-title">{{cookbook_name}}</view>
  11 + <block wx:if="{{kind.length>0}}">
  12 + <view class="toast-content-kind">
  13 + <view class="toast-kind-title">规格</view>
  14 + <view class="toast-kind-menu flex-ll">
  15 + <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>
  16 + <input value="{{specs_id}}" name="specs_id" hidden="true"/>
  17 + <input value="{{selectPrice}}" name="price" hidden="true"/>
  18 + </view>
17 </view> 19 </view>
18 - </view>  
19 - </block>  
20 - <block wx:if="{{foodMenu.length>0}}">  
21 - <view class="toast-content-kind" style="margin-bottom:{{kind.length==0 ? '235rpx' : '40rpx'}};">  
22 - <view class="toast-kind-title">做法</view>  
23 - <view class="toast-kind-menu">  
24 - <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>  
25 - <input value="{{practice_id}}" name="practice_id" hidden="true"/> 20 + </block>
  21 + <block wx:if="{{foodMenu.length>0}}">
  22 + <view class="toast-content-kind">
  23 + <view class="toast-kind-title">做法</view>
  24 + <view class="toast-kind-menu flex-ll">
  25 + <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>
  26 + <input value="{{practice_id}}" name="practice_id" hidden="true"/>
  27 + </view>
26 </view> 28 </view>
  29 + </block>
  30 + <view class="toast-content-end">
  31 + <view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view>
  32 + <button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button>
27 </view> 33 </view>
28 - </block>  
29 - <block wx:else>  
30 - <view class="toast-content-kind" style="height:73px;">  
31 - </view>  
32 - </block>  
33 - <view class="toast-content-end">  
34 - <view class="toast-content-money" hidden="{{showSpecsPrice}}">¥{{selectPrice}}</view>  
35 - <button class="toast-content-add" formType="submit" hidden="{{showAdd}}">确定</button>  
36 - </view>  
37 - </form>  
38 - <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite/image/close.png" background-size="cover"></image> 34 + </form>
  35 + </view>
39 </view> 36 </view>
40 </view> 37 </view>
41 <view hidden="{{hiddenFoodSpecReduce}}" class="hiddenFoodSpec"> 38 <view hidden="{{hiddenFoodSpecReduce}}" class="hiddenFoodSpec">
42 - <view class="reduce-mask"></view>  
43 - <view class="reduce-conent">  
44 - <view class="reduce-content-title">{{item.name}}</view>  
45 - <view class="reduce-content-list">  
46 - <view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem">  
47 - <view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title?':':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view>  
48 - <view class="reduce-list-info flex-rr">  
49 - <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>  
50 - <view class="reduce-list-reduce">{{kindItem.foodNum}}</view>  
51 - <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> 39 + <view class="reduce-mask flex-vc" bindtap="close">
  40 + <view class="reduce-conent" catchtap="catchtap">
  41 + <image class="toast-content-close" bindtap="close" src="http://qn.colorcun.com/custom/lite-yd-cook/image/close-cookbook.png" background-size="cover"></image>
  42 + <view class="reduce-content-title">{{item.name}}</view>
  43 + <view class="reduce-content-list">
  44 + <view class='reduce-content-large' wx:for="{{selectKind}}" wx:key="selectKind-key" wx:for-item="kindItem">
  45 + <view class="reduce-list-title">{{kindItem.title?kindItem.title:''}}{{kindItem.title && kindItem.ptitle?'、':''}}{{kindItem.ptitle?kindItem.ptitle:''}}</view>
  46 + <view class="reduce-list-info flex-rr">
  47 + <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>
  48 + <view class="reduce-list-reduce">{{kindItem.foodNum}}</view>
  49 + <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>
  50 + </view>
52 </view> 51 </view>
53 </view> 52 </view>
54 </view> 53 </view>
55 <image src="http://qn.colorcun.com/custom/lite/image/close.png" class="reduce-close" bindtap="close"></image> 54 <image src="http://qn.colorcun.com/custom/lite/image/close.png" class="reduce-close" bindtap="close"></image>
56 </view> 55 </view>
  56 +
57 </view> 57 </view>
@@ -13,17 +13,9 @@ @@ -13,17 +13,9 @@
13 } 13 }
14 .toast-content{ 14 .toast-content{
15 width:542rpx; 15 width:542rpx;
16 - min-height: 300px;  
17 height:auto; 16 height:auto;
18 background: #fff; 17 background: #fff;
19 border-radius: 10rpx; 18 border-radius: 10rpx;
20 - position: fixed;  
21 - top: 35%;  
22 - left:0;  
23 - right:0;  
24 - margin:0 auto;  
25 - margin-top:-150px;  
26 - z-index: 9999;  
27 /* overflow: hidden; */ 19 /* overflow: hidden; */
28 } 20 }
29 .toast-content-title{ 21 .toast-content-title{
@@ -36,22 +28,20 @@ @@ -36,22 +28,20 @@
36 .toast-content-kind{ 28 .toast-content-kind{
37 width: 100%; 29 width: 100%;
38 height: auto; 30 height: auto;
39 - padding:0 19rpx; 31 + padding:0 42rpx;
40 box-sizing: border-box; 32 box-sizing: border-box;
41 - padding-top: 20px; 33 + margin-bottom: 34rpx;
42 } 34 }
43 .toast-kind-title{ 35 .toast-kind-title{
44 width: 100%; 36 width: 100%;
45 color:#353535; 37 color:#353535;
46 font-size:16px; 38 font-size:16px;
47 - padding-left:19rpx;  
48 - box-sizing:border-box; 39 + margin-bottom: 24rpx;
49 } 40 }
50 .toast-kind-menu{ 41 .toast-kind-menu{
51 width: 100%; 42 width: 100%;
52 height: auto; 43 height: auto;
53 box-sizing: border-box; 44 box-sizing: border-box;
54 - padding-bottom:10px;  
55 } 45 }
56 .toast-kind-menu:after{ 46 .toast-kind-menu:after{
57 width:0; 47 width:0;
@@ -61,17 +51,14 @@ @@ -61,17 +51,14 @@
61 clear:both; 51 clear:both;
62 } 52 }
63 .toast-kind-single{ 53 .toast-kind-single{
64 - float:left;  
65 - width: 130rpx;  
66 - height: 25px;  
67 - border:1px solid #ccc;  
68 - box-sizing: border-box;  
69 - color:#353535;  
70 - font-size:14px;  
71 - line-height: 23px; 54 + width: 102rpx;
  55 + height: 42rpx;
  56 + border:1px solid #C8B16D;
  57 + color:#C8B16D;
  58 + font-size:28rpx;
  59 + line-height: 42rpx;
72 text-align: center; 60 text-align: center;
73 - margin:0 19rpx;  
74 - margin-top: 10px; 61 + margin-right: 38rpx;
75 } 62 }
76 .toast-kind-single:last-child{ 63 .toast-kind-single:last-child{
77 margin-right: 0; 64 margin-right: 0;
@@ -81,22 +68,22 @@ @@ -81,22 +68,22 @@
81 height: 57px; 68 height: 57px;
82 padding:15px 38rpx; 69 padding:15px 38rpx;
83 box-sizing: border-box; 70 box-sizing: border-box;
84 - margin-top: 22px;  
85 background: #f2f2f2; 71 background: #f2f2f2;
86 border-bottom-left-radius: 6px; 72 border-bottom-left-radius: 6px;
87 border-bottom-right-radius: 6px; 73 border-bottom-right-radius: 6px;
88 } 74 }
89 .toast-content-money{ 75 .toast-content-money{
90 float: left; 76 float: left;
91 - color: #e14553;  
92 - font-size:17px;  
93 - line-height: 28px; 77 + color: #353535;
  78 + font-size:36rpx;
  79 + line-height: 50rpx;
  80 + font-weight: bold;
94 } 81 }
95 .toast-content-add{ 82 .toast-content-add{
96 float: right; 83 float: right;
97 width: 95px; 84 width: 95px;
98 height: 28px; 85 height: 28px;
99 - background: #e14553; 86 + background: #C8B16D;
100 border-radius:28px; 87 border-radius:28px;
101 color: #fff; 88 color: #fff;
102 font-size:13px; 89 font-size:13px;
@@ -104,18 +91,15 @@ @@ -104,18 +91,15 @@
104 text-align: center; 91 text-align: center;
105 } 92 }
106 .toast-kind-single.kind-active{ 93 .toast-kind-single.kind-active{
107 - border:1px solid #e14553;  
108 - color:#e14553; 94 + border-width:0;
  95 + color:#ffffff;
  96 + background: linear-gradient(to right, #ECDB99, #C8B16D);
109 } 97 }
110 .toast-content-close{ 98 .toast-content-close{
111 - width: 60rpx;  
112 - height: 60rpx;  
113 - position: absolute;  
114 - left: 0;  
115 - right: 0;  
116 - bottom:-140rpx;  
117 - margin:0 auto;  
118 - background: transparent; 99 + width: 30rpx;
  100 + height: 30rpx;
  101 + float: right;
  102 + margin: 10rpx;
119 } 103 }
120 104
121 /*删除规格遮罩*/ 105 /*删除规格遮罩*/
@@ -160,39 +144,57 @@ @@ -160,39 +144,57 @@
160 } 144 }
161 .reduce-content-large{ 145 .reduce-content-large{
162 width: 100%; 146 width: 100%;
163 - height: 25px; 147 + height: 42rpx;
  148 + line-height: 42rpx;
164 padding-top: 50rpx; 149 padding-top: 50rpx;
165 } 150 }
166 .reduce-list-title{ 151 .reduce-list-title{
167 float:left; 152 float:left;
168 - padding:0 26rpx;  
169 - height: 25px;  
170 - border:1rpx solid #ccc; 153 + padding:0 10rpx;
  154 + height: 42rpx;
171 box-sizing: border-box; 155 box-sizing: border-box;
172 - color:#353535;  
173 - font-size:14px;  
174 - line-height: 25px; 156 + color:#fefefe;
  157 + font-size:28rpx;
  158 + line-height: 42rpx;
175 text-align: center; 159 text-align: center;
  160 + background: linear-gradient(to right, #C8B16D, #E6D9A6);
  161 + min-width: 100rpx;
176 } 162 }
177 .reduce-list-info{ 163 .reduce-list-info{
178 height: 25px; 164 height: 25px;
179 line-height: 25px; 165 line-height: 25px;
180 } 166 }
181 .reduce-list-reduce{ 167 .reduce-list-reduce{
182 - padding:0 10rpx; 168 + padding:0 20rpx;
183 font-size:32rpx; 169 font-size:32rpx;
184 - line-height: 25px; 170 + line-height: 42rpx;
185 text-align: center; 171 text-align: center;
186 } 172 }
187 .reduce-list-first{ 173 .reduce-list-first{
188 - width:15px;  
189 - height:2px;  
190 - background:#fff; 174 + width:36rpx;
  175 + height:36rpx;
  176 + border: 2rpx solid #262628;
  177 + border-radius: 50%;
  178 + overflow: hidden;
  179 + position: relative;
  180 +}
  181 +.reduce-list-first:after{
  182 + position: absolute;
  183 + content: '';
  184 + top: 0;
  185 + left: 0;
  186 + right: 0;
  187 + bottom: 0;
  188 + margin: auto;
  189 + width: 75%;
  190 + height: 4rpx;
  191 + background-color: #262628;
191 } 192 }
192 .reduce-list-last{ 193 .reduce-list-last{
193 - width:15px;  
194 - height:15px;  
195 - background:#fff; 194 + width:40rpx;
  195 + height:40rpx;
  196 + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/add.png");
  197 + background-size: 100% 100%;
196 } 198 }
197 .reduce-close{ 199 .reduce-close{
198 width: 60rpx; 200 width: 60rpx;
  1 +// pack-cookbook/pages/cart.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + order:{},
  12 + },
  13 +
  14 + /**
  15 + * 生命周期函数--监听页面加载
  16 + */
  17 + onLoad: function (options) {
  18 + this.setData({
  19 + options:options,
  20 + })
  21 +
  22 + },
  23 +
  24 + /**
  25 + * 生命周期函数--监听页面初次渲染完成
  26 + */
  27 + onReady: function () {
  28 +
  29 + },
  30 +
  31 + /**
  32 + * 生命周期函数--监听页面显示
  33 + */
  34 + onShow: function () {
  35 + this.initOrder();
  36 + },
  37 +
  38 + /**
  39 + * 生命周期函数--监听页面隐藏
  40 + */
  41 + onHide: function () {
  42 +
  43 + },
  44 +
  45 + /**
  46 + * 生命周期函数--监听页面卸载
  47 + */
  48 + onUnload: function () {
  49 +
  50 + },
  51 +
  52 + initOrder(){
  53 + App.Advance.CreateOrder({
  54 + rid: this.data.options.rid,
  55 + identity:this.data.options.identity,
  56 + status:'0,1'
  57 + }).then(res => {
  58 + let cookbooklist={};
  59 + res.data.cookbooklist.forEach(ck=>{
  60 + if(!cookbooklist[ck.classid]){
  61 + cookbooklist[ck.classid]={'name':ck.class_name,list:[]}
  62 + }
  63 + cookbooklist[ck.classid].list.push(ck)
  64 + })
  65 + res.data.cookbooklist=cookbooklist;
  66 + this.setData({
  67 + order: res.data,
  68 + })
  69 + })
  70 + },
  71 + updateOrder(e){
  72 + let val=util.val(e).trim();
  73 + if(val>0){
  74 + App.Advance.SetOrderById({
  75 + orderid:this.data.order.id||this.data.options.oid,
  76 + pnum:val,
  77 +
  78 + })
  79 + }
  80 + },
  81 + gotoRemark(){
  82 + wx.navigateTo({
  83 + url: util.http_build_query({...this.data.order},'./remark')
  84 + })
  85 + },
  86 + submitOrder(){
  87 + App.Advance.PlaceOrder({
  88 + orderid:this.data.order.id||this.data.options.oid,
  89 + rid:this.data.options.rid,
  90 + identity:this.data.options.identity,
  91 + }).then(res=>{
  92 + wx.redirectTo({
  93 + url: util.http_build_query({...this.data.options,hasSuccess:1},'./success')
  94 + })
  95 + })
  96 + },
  97 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"light",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "formids":"/components/formids/formids"
  8 + }
  9 +}
  1 +<!--pack-cookbook/pages/cart.wxml-->
  2 +<nav id="nav" hasHome backgroundColor="#262628" color="#fefefe">提交订单</nav>
  3 +<view class="header">
  4 +</view>
  5 +<view class="page">
  6 + <view class="carts">
  7 + <view class="block" wx:for="{{order.cookbooklist}}" wx:key="order.cookbooklist.key">
  8 + <view class="title">{{item.name}}</view>
  9 + <view class="cart-body">
  10 + <view class="cart-item flex-lr" wx:for="{{item.list}}" wx:key="item.list.key">
  11 + <view class="icon">
  12 + <image src="{{item.cookimg}}"></image>
  13 + </view>
  14 + <view class="flex-ll name">
  15 + <view class="name">{{item.cookname}}</view>
  16 + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
  17 + </view>
  18 + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
  19 + <view class="opt">{{item.num}}</view>
  20 + </view>
  21 + </view>
  22 + </view>
  23 + </view>
  24 +</view>
  25 +<view class="footer">
  26 + <view class="total">共计:¥{{order.price}}</view>
  27 + <view class="infos">
  28 + <view class="flex-lr item">
  29 + <view class="item-label">人数:</view>
  30 + <view>
  31 + <input placeholder="请输入人数" type="number" value="{{order.pnum||''}}" bindinput="updateOrder"/>
  32 + </view>
  33 + </view>
  34 + <formids bindclick="gotoRemark">
  35 + <view class="flex-lr item">
  36 + <view class="item-label">备注:</view>
  37 + <view class="flex-rr" style="max-width: 80%;">
  38 + <view class="desc">{{order.remark||'口味、偏好等要求'}}</view>
  39 + <view class="more"></view>
  40 + </view>
  41 + </view>
  42 + </formids>
  43 + </view>
  44 + <formids class="submit" bindclick="submitOrder">
  45 + <view class="submit">确认下单</view>
  46 + </formids>
  47 +</view>
  1 +/* pack-cookbook/pages/cart.wxss */
  2 +page{
  3 + background-color: #F5F5F5;
  4 +}
  5 +.header{
  6 + height: 280rpx;
  7 + background-color: #262628;
  8 + margin-top: -2rpx;
  9 + color:#FEFEFE;
  10 + font-size: 34rpx;
  11 +}
  12 +.page{
  13 + position: fixed;
  14 + top:150rpx;
  15 + bottom: 0;
  16 + left: 10rpx;
  17 + right: 10rpx;
  18 + background-color: #fefefe;
  19 + border-radius: 10rpx;
  20 + overflow-y: auto;
  21 +}
  22 +.footer{
  23 + position: fixed;
  24 + bottom: 0;
  25 + left: 0;
  26 + right: 0;
  27 + text-align: center;
  28 + background-color: #f5f5f5;
  29 +}
  30 +.footer .infos{
  31 + margin: 0 10rpx 20rpx;
  32 + background-color: #fefefe;
  33 + border-radius: 10rpx 10rpx 0 0;
  34 + font-size: 28rpx;
  35 + padding: 0 20rpx;
  36 +}
  37 +.footer .infos .item{
  38 + height: 100rpx;
  39 + line-height: 100rpx;
  40 +}
  41 +.infos input{
  42 + text-align: right;
  43 +}
  44 +.infos .desc{
  45 + margin-right: 20rpx;
  46 + white-space:nowrap;
  47 + overflow: hidden;
  48 + max-width: 95%;
  49 + color: #999999;
  50 + line-height: 100rpx;
  51 +}
  52 +.infos .item-label{
  53 + min-width: 100rpx;
  54 + overflow: hidden;
  55 + white-space:nowrap;
  56 + text-align: left;
  57 +}
  58 +
  59 +.footer .submit{
  60 + height: 98rpx;
  61 + line-height: 98rpx;
  62 + background-color: #262628;
  63 + color:#fefefe;
  64 + font-size: 34rpx;
  65 +}
  66 +.total{
  67 + height: 140rpx;
  68 + line-height: 140rpx;
  69 + border-top: 2rpx solid #F5F5F5;
  70 + border-radius: 0 0 10rpx 10rpx;
  71 + margin:0 10rpx 20rpx;
  72 + text-align: right;
  73 + background-color: #fefefe;
  74 + font-weight: bold;
  75 + font-size: 36rpx;
  76 + padding-right: 34rpx;
  77 +}
  78 +
  79 +
  80 +
  81 +.carts{
  82 + overflow-y: auto;
  83 + padding: 0 5% 680rpx;
  84 +}
  85 +.carts image{
  86 + width: 100%;
  87 + height: 100%;
  88 +}
  89 +.carts .icon{
  90 + width: 48rpx;
  91 + min-width: 48rpx;
  92 + height: 48rpx;
  93 + background-color: #f5f5f5;
  94 + border-radius: 50%;
  95 + overflow: hidden;
  96 + margin-right: 20rpx;
  97 +}
  98 +.carts .title{
  99 + height:80rpx;
  100 + line-height: 80rpx;
  101 + font-size: 28rpx;
  102 + border-bottom: 2rpx solid #F5F5F5;
  103 +}
  104 +.cart-body{
  105 +
  106 +}
  107 +.cart-item{
  108 + height: 100rpx;
  109 + line-height: 100rpx;
  110 + font-size: 30rpx;
  111 +}
  112 +.cart-item .name{
  113 + width: 60%;
  114 + overflow: hidden;
  115 + white-space:nowrap;
  116 +}
  117 +.cart-item .name .name{
  118 + width: auto;
  119 + max-width: 80%;
  120 +}
  121 +.cart-item .price{
  122 + width: 200rpx;
  123 + min-width: 200rpx;
  124 + white-space:nowrap;
  125 + margin-left: 20rpx;
  126 + overflow: hidden;
  127 +}
  128 +.cart-item .opt{
  129 + font-size: 30rpx;
  130 + min-width: 50rpx;
  131 + width: 50rpx;
  132 + text-align: right;
  133 +}
  134 +.practice_name{
  135 + border: 2rpx solid #C8B16D;
  136 + font-size: 24rpx;
  137 + height: 30rpx;
  138 + line-height: 30rpx;
  139 + color:#C8B16D;
  140 + padding: 0 6rpx;
  141 + margin-left: 18rpx;
  142 +}
@@ -4,147 +4,179 @@ import App from '../../utils/api'; @@ -4,147 +4,179 @@ import App from '../../utils/api';
4 const {regeneratorRuntime} = global 4 const {regeneratorRuntime} = global
5 Page({ 5 Page({
6 6
7 - /**  
8 - * 页面的初始数据  
9 - */  
10 - data: {  
11 - scrollTop:0,  
12 - isloading:true,  
13 - toView:"",  
14 - hasEnter:false,  
15 -  
16 - totalWidth:getApp().system.windowWidth,  
17 - singleWidth:parseInt((getApp().system.windowWidth*0.92-16)/2),  
18 - totalHeight:getApp().system.windowHeight,  
19 - kindHeight:getApp().system.windowHeight-68,  
20 - hasListModel:true,  
21 -  
22 - cookbooklist:[{},{},{},{},{},{},{},],  
23 - showSkeleton: true  
24 - },  
25 -  
26 - /**  
27 - * 生命周期函数--监听页面加载  
28 - */  
29 - onLoad: function (options) {  
30 - this.getCookList();  
31 - },  
32 -  
33 - /**  
34 - * 生命周期函数--监听页面初次渲染完成  
35 - */  
36 - onReady: function () {  
37 -  
38 - },  
39 -  
40 - /**  
41 - * 生命周期函数--监听页面显示  
42 - */  
43 - onShow: function () { 7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + scrollTop: 0,
  12 + isloading: true,
  13 + toView: "",
  14 + hasEnter: false,
  15 +
  16 + totalWidth: getApp().system.windowWidth,
  17 + singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2),
  18 + totalHeight: getApp().system.windowHeight,
  19 + kindHeight: getApp().system.windowHeight - 68,
  20 + hasListModel: true,
  21 +
  22 + cookbooklist: [{}, {}, {}, {}, {}, {}, {},],
  23 + showSkeleton: true,
  24 + order: {},
  25 + orderItemCount:0,
  26 + },
  27 +
  28 + /**
  29 + * 生命周期函数--监听页面加载
  30 + */
  31 + onLoad: function (options) {
  32 + this.setData({
  33 + options: options,
  34 + })
  35 + this.getCookList();
  36 + this.initOrder();
  37 + },
  38 + initOrder(){
  39 + App.Advance.CreateOrder({
  40 + rid: this.data.options.rid,
  41 + identity:this.data.options.identity,
  42 + status:'0,1'
  43 + }).then(res => {
  44 + let orderItemCount=0;
  45 + res.data.cookbooklist.forEach(cb=>{
  46 + orderItemCount+=parseInt(cb.num)
  47 + })
44 this.setData({ 48 this.setData({
45 - totalWidth:getApp().system.windowWidth,  
46 - singleWidth:parseInt((getApp().system.windowWidth*0.92-16)/2),  
47 - totalHeight:getApp().system.windowHeight,  
48 - kindHeight:getApp().system.windowHeight-68 49 + [`options.oid`]:res.data.id,
  50 + order: res.data,
  51 + orderItemCount:orderItemCount,
49 }) 52 })
50 - }, 53 + })
  54 + },
  55 + dispalyCart(){
  56 + this.selectComponent("#cart").auto();
  57 + },
  58 + /**
  59 + * 生命周期函数--监听页面初次渲染完成
  60 + */
  61 + onReady: function () {
  62 +
  63 + },
  64 +
  65 + /**
  66 + * 生命周期函数--监听页面显示
  67 + */
  68 + onShow: function () {
  69 + this.setData({
  70 + totalWidth: getApp().system.windowWidth,
  71 + singleWidth: parseInt((getApp().system.windowWidth * 0.92 - 16) / 2),
  72 + totalHeight: getApp().system.windowHeight,
  73 + kindHeight: getApp().system.windowHeight - 68
  74 + })
  75 + setTimeout(()=>{
  76 + this.initScrollHeightList();
  77 + },1000)
51 78
52 - /**  
53 - * 生命周期函数--监听页面隐藏  
54 - */  
55 - onHide: function () { 79 + },
56 80
57 - }, 81 + /**
  82 + * 生命周期函数--监听页面隐藏
  83 + */
  84 + onHide: function () {
58 85
59 - /**  
60 - * 生命周期函数--监听页面卸载  
61 - */  
62 - onUnload: function () { 86 + },
63 87
64 - }, 88 + /**
  89 + * 生命周期函数--监听页面卸载
  90 + */
  91 + onUnload: function () {
65 92
66 - /**  
67 - * 页面相关事件处理函数--监听用户下拉动作  
68 - */  
69 - onPullDownRefresh: function () { 93 + },
70 94
71 - }, 95 + /**
  96 + * 页面相关事件处理函数--监听用户下拉动作
  97 + */
  98 + onPullDownRefresh: function () {
72 99
73 - /**  
74 - * 页面上拉触底事件的处理函数  
75 - */  
76 - onReachBottom: function () { 100 + },
77 101
78 - }, 102 + /**
  103 + * 页面上拉触底事件的处理函数
  104 + */
  105 + onReachBottom: function () {
79 106
80 - /**  
81 - * 用户点击右上角分享  
82 - */  
83 - onShareAppMessage: function () { 107 + },
84 108
85 - }, 109 + /**
  110 + * 用户点击右上角分享
  111 + */
  112 + onShareAppMessage: function () {
  113 + return {
  114 + title:'一起来点菜啦!',
  115 + imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-go.jpg',
  116 + }
  117 + },
86 formatCookList(list){ 118 formatCookList(list){
87 //原栏目下显示 119 //原栏目下显示
88 - let hasShowClass=false; 120 + let hasShowClass = false;
89 121
90 //菜单中展示沽清的菜品 122 //菜单中展示沽清的菜品
91 - let hasClearCookbook=false; 123 + let hasClearCookbook = false;
92 124
93 //十道必选菜 125 //十道必选菜
94 - let has10CaiOpen=false;  
95 - let flist=[];  
96 - if(list.length>0) {  
97 - has10CaiOpen=list[0].status==1; 126 + let has10CaiOpen = false;
  127 + let flist = [];
  128 + if (list.length > 0) {
  129 + has10CaiOpen = list[0].status == 1;
98 list.forEach(function (cate, i) { 130 list.forEach(function (cate, i) {
99 if (cate.status == 1 && cate.cookbooklist[0].length > 0) { 131 if (cate.status == 1 && cate.cookbooklist[0].length > 0) {
100 - let cooks=[]; 132 + let cooks = [];
101 //let cooks_order=[]; 133 //let cooks_order=[];
102 - cate.cookbooklist[0].forEach(function(cook,n){  
103 - if(cook.status==1){  
104 - let flag=true;  
105 - if(has10CaiOpen){  
106 - if(cate.class_type==2 && !hasShowClass && flist.length>0 && flist[0].class_type==1){  
107 - for(let fi=0;fi<flist[0].cookbooklist[0].length;fi++){  
108 - if(flist[0].cookbooklist[0][fi].id==cook.id){  
109 - flag=false; 134 + cate.cookbooklist[0].forEach(function (cook, n) {
  135 + if (cook.status == 1) {
  136 + let flag = true;
  137 + if (has10CaiOpen) {
  138 + if (cate.class_type == 2 && !hasShowClass && flist.length > 0 && flist[0].class_type == 1) {
  139 + for (let fi = 0; fi < flist[0].cookbooklist[0].length; fi++) {
  140 + if (flist[0].cookbooklist[0][fi].id == cook.id) {
  141 + flag = false;
110 break; 142 break;
111 } 143 }
112 } 144 }
113 } 145 }
114 } 146 }
115 - cook.item_clear_num=cook.clear_num;  
116 - if(!hasClearCookbook){//不显示卖光了  
117 - let item_clear_num=cook.clear_num;  
118 - if(cook.spec){  
119 - let clear_num=null;  
120 - cook.spec.forEach(spec=>{  
121 - if(spec.clear_num==0){  
122 - clear_num=0;  
123 - }else{  
124 - clear_num=null; 147 + cook.item_clear_num = cook.clear_num;
  148 + if (!hasClearCookbook) {//不显示卖光了
  149 + let item_clear_num = cook.clear_num;
  150 + if (cook.spec) {
  151 + let clear_num = null;
  152 + cook.spec.forEach(spec => {
  153 + if (spec.clear_num == 0) {
  154 + clear_num = 0;
  155 + } else {
  156 + clear_num = null;
125 } 157 }
126 }) 158 })
127 - if(clear_num==0){  
128 - item_clear_num=0; 159 + if (clear_num == 0) {
  160 + item_clear_num = 0;
129 } 161 }
130 } 162 }
131 - cook.item_clear_num=item_clear_num;  
132 - if(item_clear_num==0){  
133 - flag=false; 163 + cook.item_clear_num = item_clear_num;
  164 + if (item_clear_num == 0) {
  165 + flag = false;
134 } 166 }
135 } 167 }
136 168
137 - if(flag){ 169 + if (flag) {
138 cooks.push(cook); 170 cooks.push(cook);
139 //cooks_order.push(cook.order_o); 171 //cooks_order.push(cook.order_o);
140 } 172 }
141 173
142 } 174 }
143 }) 175 })
144 - if(cooks.length>0){ 176 + if (cooks.length > 0) {
145 //cooks 排序... 177 //cooks 排序...
146 178
147 - cate.cookbooklist[0]=cooks; 179 + cate.cookbooklist[0] = cooks;
148 flist.push(cate) 180 flist.push(cate)
149 } 181 }
150 } 182 }
@@ -152,104 +184,125 @@ Page({ @@ -152,104 +184,125 @@ Page({
152 } 184 }
153 return flist; 185 return flist;
154 }, 186 },
155 - getCookList:function(orderid){  
156 - let param={  
157 - sellerid: 80,  
158 - //status:this.data.fromSoucre!=''?1:'',  
159 - identity:1 187 + getCookList: function (orderid) {
  188 + let param = {
  189 + sellerid: this.data.options.sid,
  190 + identity: this.data.options.identity,
  191 + orderid : this.data.options.oid,
  192 + status:'0,1',
160 }; 193 };
161 - if(orderid){  
162 - param.orderid=orderid;  
163 - }  
164 - App.Cookbook.GetCookbookByClass(param).then(json=>{ 194 + App.Advance.GetCookbookByClass(param).then(json => {
165 //菜单分类添加修饰 195 //菜单分类添加修饰
166 let cookbooklist = this.formatCookList(json.data[0].list); 196 let cookbooklist = this.formatCookList(json.data[0].list);
167 - setTimeout(()=>{ 197 + setTimeout(() => {
168 this.setData({ 198 this.setData({
169 cookbooklist: cookbooklist, 199 cookbooklist: cookbooklist,
170 - countPirce:json.data[0].countPirce ? json.data[0].countPirce : 0,  
171 - countTotal:json.data[0].countTotal ? json.data[0].countTotal : 0,  
172 - isloading:false,  
173 - showSkeleton:false, 200 + countPirce: json.data[0].countPirce ? json.data[0].countPirce : 0,
  201 + countTotal: json.data[0].countTotal ? json.data[0].countTotal : 0,
  202 + isloading: false,
  203 + showSkeleton: false,
174 }) 204 })
175 - },1000) 205 + }, 0)
176 206
177 - }).catch(res=>{  
178 - console.log('getCookList-catch',res); 207 + }).catch(res => {
  208 + console.log('getCookList-catch', res);
179 this.selectComponent("#network").show('网络不给力,请检查网络后重试'); 209 this.selectComponent("#network").show('网络不给力,请检查网络后重试');
180 }); 210 });
181 }, 211 },
182 //菜品分类操作 212 //菜品分类操作
183 changeList: function (e) { 213 changeList: function (e) {
184 - var _id=e.detail.id;  
185 - console.log('changeList','inToView' + _id) 214 + var _id = e.detail.id;
  215 + console.log('changeList', 'inToView' + _id)
186 this.setData({ 216 this.setData({
187 toView: 'inToView' + _id, 217 toView: 'inToView' + _id,
188 }); 218 });
189 219
190 }, 220 },
191 foodCardCallback(e){ 221 foodCardCallback(e){
192 - let opt=e.detail;  
193 - console.log('foodCardCallback',opt);  
194 - if(opt.type=='specWin'){  
195 - if(opt.value=='show'){  
196 - this.setData({scrollZindex:9999});  
197 - }else{  
198 - this.setData({scrollZindex:'auto'}); 222 + let opt = e.detail;
  223 + console.log('foodCardCallback', opt);
  224 + if (opt.type == 'specWin') {
  225 + if (opt.value == 'show') {
  226 + this.setData({scrollZindex: 9999});
  227 + } else {
  228 + this.setData({scrollZindex: 'auto'});
199 } 229 }
200 return; 230 return;
201 } 231 }
202 - let books=this.data.cookbooklist;  
203 - books.forEach(menu=>{  
204 - menu.cookbooklist[0].forEach(book=>{  
205 - if(book.id==opt.cookbookid){  
206 - book.num=opt.num; 232 +
  233 + let books = this.data.cookbooklist;
  234 + books.forEach(menu => {
  235 + menu.cookbooklist[0].forEach(book => {
  236 + if (book.id == opt.cookbookid || 'flushOrder'==opt.type) {
  237 + book.num = opt.num;
207 } 238 }
208 }) 239 })
209 }) 240 })
210 - this.setData({  
211 - countTotal:this.data.countTotal+opt.type,  
212 - cookbooklist:books  
213 - });  
214 - this.getOrderInfo();  
215 - },  
216 - //订单详情  
217 - getOrderInfo:function(){  
218 - App.Orders.GetOrderById({orderid:this.data.orderid}).then(json=>{  
219 - let order=json.data[0].order[0];  
220 - if(order.status<2){  
221 - this.setData({aiOrderStatus:json.data[0].order[0].status});  
222 - }else{  
223 - var title=''  
224 - if(json.data[0].order[0].status==2 || json.data[0].order[0].status==3){  
225 - if(this.data.fromSoucre || util.cache('identity')==2){  
226 - return;  
227 - }  
228 - title='手慢了,小伙伴已下单'  
229 - }  
230 - if(json.data[0].order[0].status==5){  
231 - title='订单已结账'  
232 - }  
233 - if(json.data[0].order[0].status==7){  
234 - title='订单已清台' 241 + if('flushOrder'==opt.type){
  242 + this.setData({
  243 + countTotal: 0,
  244 + cookbooklist: books
  245 + });
  246 + }else{
  247 + this.setData({
  248 + countTotal: this.data.countTotal + opt.type,
  249 + cookbooklist: books
  250 + });
  251 + }
  252 +
  253 + setTimeout(()=>{
  254 + this.initOrder();
  255 + },100)
  256 + },
  257 + gotoCart(){
  258 + if(this.data.orderItemCount<1){
  259 + return util.toast('请添加菜品','none');
  260 + }
  261 + //购物车
  262 + wx.navigateTo({
  263 + url: util.http_build_query(this.data.options,'./cart')
  264 + })
  265 + },
  266 + getClassNameFlag:true,
  267 + bindscroll(e){
  268 + if(!this.getClassNameFlag) return;
  269 + this.getClassNameFlag=false;
  270 + //console.log('this.scrollHeightList',this.scrollHeightList)
  271 + let maxMX=9999999;
  272 + let activeId='';
  273 + Object.keys(this.scrollHeightList).forEach(tid=>{
  274 + let mx=parseInt(e.detail.scrollTop)-parseInt(this.scrollHeightList[tid].top)
  275 + if(mx>-100){
  276 + if(mx<maxMX) {
  277 + maxMX=mx;
  278 + activeId=tid;
235 } 279 }
236 - wx.showToast({  
237 - icon:'none',  
238 - title:title,  
239 - duration:1500,  
240 - });  
241 - let that=this;  
242 - setTimeout(function(){  
243 - if(json.data[0].order[0].status>5){  
244 - wx.reLaunch({  
245 - url:'/pages/menu/s_nothing?sellerid='+that.data.sellerid+'&orderid='+that.data.orderid,  
246 - })  
247 - }else{  
248 - that.goToOrder(that.data.orderid)  
249 - }  
250 - },1500)  
251 } 280 }
252 - 281 + })
  282 + if(activeId && this.data.activeId!=activeId){
  283 + console.log(activeId, this.scrollHeightList[activeId].dataset.name)
  284 + this.setData({
  285 + activeId:activeId,
  286 + })
  287 + this.selectComponent("#menu").activeMenuID(activeId);
  288 + }
  289 + this.getClassNameFlag=true;
  290 + },
  291 + scrollHeightList:{},
  292 + initScrollHeightList(scroll){
  293 + //if(Object.keys(this.scrollHeightList).length>0) return;
  294 + let that=this;
  295 + return new Promise(function(success,fail){
  296 + var query = wx.createSelectorQuery();
  297 + query.selectAll('.list-model-masonry').boundingClientRect()
  298 + query.exec(function (res) {
  299 + for(let i=0;i<res[0].length;i++){
  300 + let x=res[0][i];
  301 + //x.top=parseInt(scroll.detail.scrollTop)+parseInt(x.top);
  302 + that.scrollHeightList[x.id]=x;
  303 + }
  304 + success()
  305 + })
253 }) 306 })
254 }, 307 },
255 }) 308 })
@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 "usingComponents": { 5 "usingComponents": {
6 "foodCard": "../components/food-card/food-card", 6 "foodCard": "../components/food-card/food-card",
7 "cookClass": "../components/cook-class/cook-class", 7 "cookClass": "../components/cook-class/cook-class",
8 - "nav":"/components/nav/nav" 8 + "nav":"/components/nav/nav",
  9 + "cart":"../components/cart/cart",
  10 + "formids":"/components/formids/formids",
  11 + "userinfo":"/components/userinfo/userinfo",
  12 + "network":"/components/network/network"
9 } 13 }
10 } 14 }
@@ -8,48 +8,52 @@ @@ -8,48 +8,52 @@
8 style = "height:{{totalHeight}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;" 8 style = "height:{{totalHeight}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;"
9 scroll-into-view = "{{toView}}" 9 scroll-into-view = "{{toView}}"
10 scroll-with-animation 10 scroll-with-animation
  11 + bindscroll="bindscroll"
11 > 12 >
12 <view style = "padding-left:180rpx;"> 13 <view style = "padding-left:180rpx;">
13 <view class="section" wx:for="{{cookbooklist}}" wx:key="cookbooklist-key"> 14 <view class="section" wx:for="{{cookbooklist}}" wx:key="cookbooklist-key">
14 - <view id="{{'inToView'+item.id}}"></view>  
15 - <view class="list-model-masonry" > 15 + <view id="{{'inToView'+item.id}}" class="class_name {{activeId==item.id?'class_name-active11':''}}">
  16 + <view class="text">{{item.class_name}}</view>
  17 + </view>
  18 + <view class="list-model-masonry" id="{{item.id}}" data-name="{{item.class_name}}">
16 <view class="list-model-column"> 19 <view class="list-model-column">
17 <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" > 20 <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" >
18 <view class="item"> 21 <view class="item">
19 <foodCard item="{{item}}" 22 <foodCard item="{{item}}"
20 - sellerid="{{sellerid}}" orderid="{{orderid}}"  
21 - fromSoucre="{{fromSoucre}}" request_uri="{{request_uri}}" 23 + sellerid="{{order.sellerid}}" orderid="{{order.id}}"
  24 + identity="{{options.identity}}"
22 bindfoodCardCallback="foodCardCallback" 25 bindfoodCardCallback="foodCardCallback"
23 - hasListModel="{{hasListModel}}"  
24 ></foodCard> 26 ></foodCard>
25 </view> 27 </view>
26 </block> 28 </block>
27 </view> 29 </view>
28 </view> 30 </view>
29 </view> 31 </view>
30 - <view style="height: 80px;width: 100%;"></view> 32 + <view style="height: 110px;width: 100%;"></view>
31 </view> 33 </view>
32 </scroll-view> 34 </scroll-view>
33 - <view class="white flex-lr" style="position:fixed;bottom:0px;width:100%;padding:5px 0;z-index:2000;height:58px;">  
34 -  
35 - <view class="body-view">  
36 -  
37 - </view>  
38 - <view class="shopping-total flex-vc list-layout-buttom-opt">  
39 -  
40 - <image src="http://qn.colorcun.com/custom/lite/image/cook-list-gwc.png" class="icon" />  
41 - <view style="color:#fff;font-size:24rpx;margin-top:-2px;text-align:center;" class="smooth">下单</view>  
42 - <block wx:if="{{countTotal>0}}">  
43 - <view class="show-num fwhite flex-cc smooth">{{countTotal}}</view>  
44 - </block>  
45 - <button bindgetuserinfo="bindChooseOk" open-type="getUserInfo" class="shop-button"></button>  
46 - <bubble id="bubble"></bubble> 35 + <view class="white flex-lr bottom-view">
  36 + <button class="share flex-vc button-none" open-type="share">
  37 + <view class="flex-vc">
  38 + <view class="icon">
  39 + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image>
  40 + </view>
  41 + <view class="text">一起点</view>
  42 + </view>
  43 + </button>
  44 + <view class="cart flex-ll" bindtap="dispalyCart">
  45 + <view class="icon">
  46 + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart-black.png"/>
  47 + <view class="dot" wx:if="{{orderItemCount>0}}">{{orderItemCount}}</view>
  48 + </view>
  49 + <view class="text Semibold">¥{{order.price}}</view>
47 </view> 50 </view>
48 -  
49 - <!--只有点菜后才显示点好了按钮--> 51 + <userinfo class="place flex-vc" binduserinfo="gotoCart">选好了</userinfo>
50 </view> 52 </view>
51 </view> 53 </view>
52 54
53 <cookClass id="menu" bind:changeList="changeList" 55 <cookClass id="menu" bind:changeList="changeList"
54 cooklist="{{cookbooklist}}" hasListModel="{{hasListModel}}"> 56 cooklist="{{cookbooklist}}" hasListModel="{{hasListModel}}">
55 </cookClass> 57 </cookClass>
  58 +<cart rid="{{options.rid}}" id="cart" order="{{order}}" identity="{{options.identity}}" bindfoodCardCallback="foodCardCallback"></cart>
  59 +<network id="network"></network>
@@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
111 } 111 }
112 .column { display: flex; flex-direction: column; width: 50%; max-width:50%; } 112 .column { display: flex; flex-direction: column; width: 50%; max-width:50%; }
113 .column-space { width: 20px; } 113 .column-space { width: 20px; }
114 -.column .item{margin-bottom: 20px;width:100%; overflow: hidden; border-radius: 10rpx;} 114 +.column .item{width:100%; overflow: hidden; border-radius: 10rpx;}
115 115
116 /** 116 /**
117 列表模式 117 列表模式
@@ -125,8 +125,6 @@ @@ -125,8 +125,6 @@
125 .list-model .item{ 125 .list-model .item{
126 border-radius: 0rpx; 126 border-radius: 0rpx;
127 border-bottom: 2rpx solid #F5F5F5; 127 border-bottom: 2rpx solid #F5F5F5;
128 - padding-bottom: 28rpx;  
129 - margin-top: 14rpx;  
130 } 128 }
131 .list-layout-buttom-opt{ 129 .list-layout-buttom-opt{
132 background-color: #353535; 130 background-color: #353535;
@@ -160,4 +158,105 @@ @@ -160,4 +158,105 @@
160 width: 100%; 158 width: 100%;
161 height: 300rpx; 159 height: 300rpx;
162 margin-bottom: 10rpx; 160 margin-bottom: 10rpx;
  161 +}
  162 +
  163 +.bottom-view{
  164 + position:fixed;
  165 + bottom:0;
  166 + width:100%;
  167 + z-index:2000;
  168 + height:100rpx;
  169 + background-color: #fefefe;
  170 + color:#353535;
  171 + border-top: 2rpx solid #f5f5f5;
  172 +}
  173 +.bottom-view image{
  174 + width: 100%;
  175 + height: 100%;
  176 +
  177 +}
  178 +.share{
  179 + width: 180rpx;
  180 + min-width: 180rpx;
  181 + border-right: 2rpx solid #E0E0E0;
  182 +}
  183 +.share .icon{
  184 + width: 38rpx;
  185 + height: 34rpx;
  186 +}
  187 +.share .text{
  188 + font-size: 20rpx;
  189 + line-height: 28rpx;
  190 + height: 28rpx;
  191 + margin-top: 8rpx;
  192 +}
  193 +
  194 +.cart{
  195 + width: 100%;
  196 +}
  197 +.cart .icon{
  198 + margin-left: 54rpx;
  199 + width: 44rpx;
  200 + height: 44rpx;
  201 + position: relative;
  202 +}
  203 +.cart .icon .dot{
  204 + position: absolute;
  205 + top:-15rpx;
  206 + right: -15rpx;
  207 + background-color: #E14553;
  208 + color:#fefefe;
  209 + font-size: 20rpx;
  210 + width: 30rpx;
  211 + height: 30rpx;
  212 + line-height: 30rpx;
  213 + border-radius: 50%;
  214 + text-align: center;
  215 +}
  216 +.cart .text{
  217 + font-size: 36rpx;
  218 + margin-left: 34rpx;
  219 +}
  220 +
  221 +.place{
  222 + width: 238rpx;
  223 + min-width: 238rpx;
  224 + background-color: #262628;
  225 + color: #fefefe;
  226 + font-size: 34rpx;
  227 + height: 100%;
  228 +}
  229 +.class_name{
  230 + font-size: 26rpx;
  231 + font-weight: bold;
  232 + height: 120rpx;
  233 + line-height: 120rpx;
  234 + position: relative;
  235 + width: 100%;
  236 + background-color: #fefefe;
  237 +}
  238 +.class_name .text{
  239 + background-color: #fefefe;
  240 + position: absolute;
  241 + padding-right: 20rpx;
  242 +}
  243 +.class_name:before{
  244 + position: absolute;
  245 + content: '';
  246 + top: 0;
  247 + left: 0;
  248 + right: 0;
  249 + bottom: 0;
  250 + margin: auto;
  251 + width: 100%;
  252 + height: 2rpx;
  253 + background-color: #F5F5F5;
  254 +}
  255 +.class_name-active{
  256 + position: fixed;
  257 + top:100rpx;
  258 + z-index: 999;
  259 + left:200rpx;
  260 + height: 140rpx;
  261 + line-height: 140rpx;
163 } 262 }
  1 +// pack-cookbook/pages/remark.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + tags:[],
  12 + remark:'',
  13 + },
  14 +
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + orderid:'',
  19 + onLoad: function (options) {
  20 + this.orderid=options.id;
  21 + App.Advance.GetRemarkBySellerid({
  22 + sellerid:options.sellerid,
  23 + }).then(res=>{
  24 + let obj={
  25 + remark:options.remark,
  26 + }
  27 + obj.tags=res.data;
  28 + if(options.remarkid){
  29 + let remarkid=options.remarkid.split(',')
  30 + res.data.forEach((t)=>{
  31 + if(remarkid._indexOf(t.id)>-1){
  32 + t.active=true
  33 + }
  34 + })
  35 + }
  36 + this.setData(obj)
  37 + })
  38 + },
  39 +
  40 + /**
  41 + * 生命周期函数--监听页面初次渲染完成
  42 + */
  43 + onReady: function () {
  44 +
  45 + },
  46 +
  47 + /**
  48 + * 生命周期函数--监听页面显示
  49 + */
  50 + onShow: function () {
  51 +
  52 + },
  53 +
  54 + /**
  55 + * 生命周期函数--监听页面隐藏
  56 + */
  57 + onHide: function () {
  58 +
  59 + },
  60 + activeRemark(e){
  61 + let i=util.attr(e,'index');
  62 + let tags=this.data.tags;
  63 + tags[i].active=!tags[i].active;
  64 + console.log(i,tags);
  65 + let remark=this.data.remark;
  66 + remark=remark.replace(tags[i].remark+'、','')
  67 + if(tags[i].active){
  68 + remark+=tags[i].remark+'、'
  69 + }
  70 + this.setData({
  71 + remark:remark,
  72 + tags:tags,
  73 + })
  74 + },
  75 + inputRemark(e){
  76 + let remark=util.val(e).trim();
  77 + this.setData({
  78 + remark:remark,
  79 + })
  80 + },
  81 + submit(){
  82 + let remarkid=[];
  83 + let tags=this.data.tags;
  84 + tags.forEach(t=>{
  85 + if(t.active)
  86 + remarkid.push(t.id);
  87 + })
  88 + if(!this.data.remark){
  89 + return util.toast('请填写或选择备注信息','none')
  90 + }
  91 + App.Advance.SetOrderById({
  92 + orderid:this.orderid,
  93 + remark:this.data.remark,
  94 + remarkid:remarkid.toString(),
  95 + }).then(res=>{
  96 + wx.navigateBack();
  97 + })
  98 + }
  99 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "formids":"/components/formids/formids"
  8 + }
  9 +}
  1 +<!--pack-cookbook/pages/remark.wxml-->
  2 +<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav>
  3 +<view class="pages">
  4 + <textarea class="textarea" bindinput="inputRemark" value="{{remark}}">
  5 +
  6 + </textarea>
  7 + <view class="tip">快捷标签</view>
  8 + <view class="tags flex-ll" style="flex-wrap:wrap;">
  9 + <block wx:for="{{tags}}" wx:key="tags.key">
  10 + <view class="tag {{item.active?'active':''}}"
  11 + bindtap="activeRemark"
  12 + data-index="{{index}}">{{item.remark}}</view>
  13 + </block>
  14 + </view>
  15 + <formids bindclick="submit">
  16 + <view class="submit">保存</view>
  17 + </formids>
  18 +</view>
  1 +/* pack-cookbook/pages/remark.wxss */
  2 +.pages{
  3 + width: 90%;
  4 + margin: 40rpx auto 0;
  5 +}
  6 +.textarea{
  7 + border: 2rpx solid #999999;
  8 + width: 100%;
  9 + height: 240rpx;
  10 +}
  11 +.tip{
  12 + margin-top: 40rpx;
  13 + margin-bottom: 40rpx;
  14 + font-size: 24rpx;
  15 + color: #999999;
  16 +}
  17 +.tags {
  18 + font-size: 30rpx;
  19 + color: #C2AC6A;
  20 +}
  21 +.tag{
  22 + border: 2rpx solid #C2AC6A;
  23 + height: 50rpx;
  24 + line-height: 50rpx;
  25 + padding: 0 16rpx;
  26 + margin: 0 40rpx 40rpx 0;
  27 +}
  28 +.tag.active{
  29 + background: linear-gradient(to right, #C0AA68, #DFCE8E);
  30 + border-width: 0;
  31 + color: #fefefe;
  32 +}
  33 +.submit{
  34 + font-size: 34rpx;
  35 + width: 300rpx;
  36 + height: 80rpx;
  37 + line-height: 80rpx;
  38 + color:#fefefe;
  39 + background-color: #C8B16D;
  40 + border-radius: 40rpx;
  41 + margin: 300rpx auto 20rpx;
  42 + text-align: center;
  43 +}
  44 +.submit.fouce{
  45 + margin: 32rpx auto;
  46 +}
  1 +// pack-cookbook/pages/success.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + moreDisplay:false,
  12 + detail:{},
  13 + },
  14 +
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + onLoad: function (options) {
  19 + this.setData({
  20 + options:options
  21 + })
  22 + this.initOrder()
  23 + this.getDetail()
  24 + },
  25 +
  26 + /**
  27 + * 生命周期函数--监听页面初次渲染完成
  28 + */
  29 + onReady: function () {
  30 +
  31 + },
  32 +
  33 + /**
  34 + * 生命周期函数--监听页面显示
  35 + */
  36 + onShow: function () {
  37 +
  38 + },
  39 +
  40 + /**
  41 + * 生命周期函数--监听页面隐藏
  42 + */
  43 + onHide: function () {
  44 +
  45 + },
  46 +
  47 + /**
  48 + * 生命周期函数--监听页面卸载
  49 + */
  50 + onUnload: function () {
  51 +
  52 + },
  53 +
  54 + /**
  55 + * 页面相关事件处理函数--监听用户下拉动作
  56 + */
  57 + onPullDownRefresh: function () {
  58 +
  59 + },
  60 +
  61 + /**
  62 + * 页面上拉触底事件的处理函数
  63 + */
  64 + onReachBottom: function () {
  65 +
  66 + },
  67 +
  68 + /**
  69 + * 用户点击右上角分享
  70 + */
  71 + onShareAppMessage: function () {
  72 + let options={...this.data.options,hasOnlyShow:1};
  73 + delete options.hasSuccess
  74 + return {
  75 + title:'菜品已点好,快来看看都点了什么~',
  76 + path:util.http_build_query(options,'/pack-cookbook/pages/success'),
  77 + imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-show.jpg',
  78 + }
  79 + },
  80 +
  81 + initOrder(){
  82 + App.Advance.CreateOrder({
  83 + rid: this.data.options.rid,
  84 + identity:this.data.options.identity,
  85 + status:1,
  86 + }).then(res => {
  87 + res.data.cdateStr=util.unixtoTime(res.data.cdate,'YYYY-MM-DD')
  88 + let cookbooklist={};
  89 + let i=0;
  90 + let moreDisplay=true;
  91 + res.data.cookbooklist.forEach(ck=>{
  92 + if(!cookbooklist[ck.classid]){
  93 + cookbooklist[ck.classid]={'name':ck.class_name,list:[],moreDisplay:moreDisplay}
  94 + }
  95 + ck.moreDisplay=moreDisplay
  96 + cookbooklist[ck.classid].list.push(ck)
  97 + i++;
  98 + if(i>=4){
  99 + moreDisplay=false;
  100 + }
  101 + })
  102 + res.data.booklist=cookbooklist;
  103 + this.setData({
  104 + order: res.data,
  105 + })
  106 + })
  107 + },
  108 + moreDisplay(){
  109 + this.setData({
  110 + moreDisplay:!this.data.moreDisplay
  111 + })
  112 + },
  113 + gotoEditor(){
  114 + let options={...this.data.options,sid:this.data.order.sellerid};
  115 + delete options.hasSuccess
  116 + wx.redirectTo({
  117 + url: util.http_build_query(options,'./index')
  118 + })
  119 + },
  120 + getDetail(fouce=false){
  121 + App.Reserve.Detail({
  122 + rid: this.data.options.rid,
  123 + openid: getApp().openid
  124 + },fouce).then(res => {
  125 + this.setData({
  126 + detail:this.formatDatail(res.data)
  127 + })
  128 + })
  129 + },
  130 + formatDatail(detail){
  131 + detail.rdateStr=util.unixtoTime(detail.ddate,'MM月DD日 WW HH:II');
  132 + detail.tableSubInfo=[];
  133 + detail.tables.forEach(t=>{
  134 + detail.tableSubInfo.push(t.name);
  135 + })
  136 + detail.tableSubInfo=detail.tableSubInfo.join('、')
  137 + return detail;
  138 + },
  139 + navEvent(){
  140 + wx.navigateBack(2);
  141 + },
  142 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "formids":"/components/formids/formids"
  8 + }
  9 +}
  1 +<!--pack-cookbook/pages/success.wxml-->
  2 +<nav id="nav" hasHome backgroundColor="#ffffff" color="#000000" bindNavEvent="navEvent">已点菜品</nav>
  3 +<view wx:if="{{options.hasSuccess==1}}">
  4 + <view class="pages flex-vc success">
  5 + <view class="icon">
  6 + <icon type="success" size="47" color="#C8B16D"/>
  7 + </view>
  8 + <view class="title Medium">订单提交成功</view>
  9 + <view class="optx flex-vc">
  10 + <view class="opt-view flex-ll">
  11 + <formids bindclick="gotoEditor" class="width:50%;">
  12 + <view class="but editor" style="width: 100%;">修改菜品</view>
  13 + </formids>
  14 + <button class="but share button-none" open-type="share">分享</button>
  15 + </view>
  16 + </view>
  17 + </view>
  18 + <view class="hr"></view>
  19 +</view>
  20 +<view class="pages">
  21 + <view class="carts">
  22 + <block wx:for="{{order.booklist}}" wx:key="order.booklist.key">
  23 + <view class="block" hidden="{{!moreDisplay && !item.moreDisplay}}">
  24 + <view class="title">{{item.name}}</view>
  25 + <view class="cart-body">
  26 + <block wx:for="{{item.list}}" wx:key="item.key">
  27 + <view class="cart-item flex-lr" hidden="{{!moreDisplay && !item.moreDisplay}}">
  28 + <view class="icon">
  29 + <image src="{{item.cookimage}}"></image>
  30 + </view>
  31 + <view class="flex-ll name">
  32 + <view class="name">{{item.cookname}}</view>
  33 + <view class="practice_name" wx:if="{{item.practice_name}}">{{item.practice_name}}</view>
  34 + </view>
  35 + <view class="price">¥{{item.price}}/{{item.spec_name||item.cookunit}}</view>
  36 + <view class="opt">{{item.num}}</view>
  37 + </view>
  38 + </block>
  39 + </view>
  40 + </view>
  41 + </block>
  42 + </view>
  43 + <view class="moreDisplay flex-vc"
  44 + bindtap="moreDisplay"
  45 + wx:if="{{order.cookbooklist.length>4}}">{{!moreDisplay?'查看更多':'收起'}}</view>
  46 + <view class="total">共计:¥{{order.price}}</view>
  47 +</view>
  48 +<view class="hr"></view>
  49 +<view class="pages">
  50 + <view class="infos">
  51 + <view class="flex-lr item" wx:if="{{order.remark}}">
  52 + <view class="item-label">备注:</view>
  53 + <view class="" style="max-width: 85%;line-height: 40rpx; ">{{order.remark||''}}</view>
  54 + </view>
  55 + <view class="flex-lr item">
  56 + <view class="item-label">人数:</view>
  57 + <view class="">{{order.pnum||''}}</view>
  58 + </view>
  59 + <view class="flex-lr item">
  60 + <view class="item-label">桌位:</view>
  61 + <view class="" style="max-width: 85%;line-height: 40rpx; ">{{detail.tableSubInfo}}</view>
  62 + </view>
  63 + </view>
  64 +</view>
  65 +<view class="hr"></view>
  66 +<view class="pages">
  67 + <view class="infos">
  68 + <view class="item">
  69 + 订单信息
  70 + </view>
  71 + <view class="flex-ll item">
  72 + <view>订单编号:</view>
  73 + <view class="">{{order.no}}</view>
  74 + </view>
  75 + <view class="flex-ll item">
  76 + <view>下单时间:</view>
  77 + <view class="">{{order.cdateStr}}</view>
  78 + </view>
  79 + </view>
  80 +</view>
  81 +<view style="height: 150rpx;width: 100%;"></view>
  82 +<view class="optx flex-vc" wx:if="{{options.hasSuccess!=1 && options.hasOnlyShow!=1}}">
  83 + <view class="opt-view flex-ll">
  84 + <formids bindclick="gotoEditor" class="width:50%;">
  85 + <view class="but editor" style="width: 100%;">修改菜品</view>
  86 + </formids>
  87 + <button class="but share button-none" open-type="share">分享</button>
  88 + </view>
  89 +</view>
  1 +/* pack-cookbook/pages/success.wxss */
  2 +.pages{
  3 + padding: 40rpx 5% 0;
  4 +}
  5 +
  6 +
  7 +.carts{
  8 + overflow-y: auto;
  9 +}
  10 +.carts image{
  11 + width: 100%;
  12 + height: 100%;
  13 +}
  14 +.carts .icon{
  15 + width: 48rpx;
  16 + min-width: 48rpx;
  17 + height: 48rpx;
  18 + background-color: #f5f5f5;
  19 + border-radius: 50%;
  20 + overflow: hidden;
  21 + margin-right: 20rpx;
  22 +}
  23 +.carts .title{
  24 + height:80rpx;
  25 + line-height: 80rpx;
  26 + font-size: 28rpx;
  27 + border-bottom: 2rpx solid #F5F5F5;
  28 +}
  29 +.cart-body{
  30 +
  31 +}
  32 +.cart-item{
  33 + height: 100rpx;
  34 + line-height: 100rpx;
  35 + font-size: 30rpx;
  36 +}
  37 +.cart-item .name{
  38 + width: 60%;
  39 + overflow: hidden;
  40 + white-space:nowrap;
  41 +}
  42 +.cart-item .name .name{
  43 + width: auto;
  44 + max-width: 80%;
  45 +}
  46 +.cart-item .price{
  47 + width: 200rpx;
  48 + min-width: 200rpx;
  49 + white-space:nowrap;
  50 + margin-left: 20rpx;
  51 + overflow: hidden;
  52 +}
  53 +.cart-item .opt{
  54 + font-size: 30rpx;
  55 + min-width: 50rpx;
  56 + width: 50rpx;
  57 + text-align: right;
  58 +}
  59 +.total{
  60 + height: 140rpx;
  61 + line-height: 140rpx;
  62 + border-top: 2rpx solid #F5F5F5;
  63 + border-radius: 0 0 10rpx 10rpx;
  64 + margin:0 10rpx 20rpx;
  65 + text-align: right;
  66 + font-weight: bold;
  67 + font-size: 36rpx;
  68 + padding-right: 34rpx;
  69 +}
  70 +.hr{
  71 + height: 20rpx;
  72 + background-color: #f5f5f5;
  73 + width: 100%;
  74 +}
  75 +.infos{
  76 + background-color: #fefefe;
  77 + font-size: 28rpx;
  78 + padding-bottom: 20rpx;
  79 +}
  80 +.infos .item{
  81 + height: 80rpx;
  82 + line-height: 80rpx;
  83 + border-bottom: 2rpx solid #F5F5F5;
  84 +}
  85 +.infos input{
  86 + text-align: right;
  87 +}
  88 +.infos .desc{
  89 + margin-right: 20rpx;
  90 + white-space:nowrap;
  91 + overflow: hidden;
  92 + max-width: 95%;
  93 + color: #999999;
  94 +}
  95 +.infos .item:last-child{
  96 + border-bottom-width:0;
  97 +}
  98 +.infos .item-label{
  99 + min-width: 100rpx;
  100 + overflow: hidden;
  101 + white-space:nowrap;
  102 +}
  103 +.optx{
  104 + height: 96rpx;
  105 + line-height: 96rpx;
  106 + background-color: #262628;
  107 + position: fixed;
  108 + bottom: 0;
  109 + left:0;
  110 + right: 0;
  111 + color:#fefefe;
  112 + font-size: 34rpx;
  113 +}
  114 +.opt-view{
  115 + height: 50rpx;
  116 + line-height: 50rpx;
  117 + width: 100%;
  118 +}
  119 +.opt-view .but{
  120 + width: 50%;
  121 + text-align: center;
  122 +
  123 +}
  124 +.opt-view .but:first-child{
  125 + border-right: 2rpx solid #979797;
  126 +}
  127 +.pages .optx{
  128 + position: relative;
  129 + background-color: #fefefe;
  130 + color: #262628;
  131 + border: 2rpx solid #262628;
  132 + height: 80rpx;
  133 + line-height: 80rpx;
  134 + margin-bottom: 74rpx;
  135 + width: 100%;
  136 +}
  137 +.success image{
  138 + width: 100%;
  139 + height: 100%;
  140 +}
  141 +.success .icon{
  142 + width: 100rpx;
  143 + height: 100rpx;
  144 + margin-top: 46rpx;
  145 +}
  146 +.success .title{
  147 + font-size: 36rpx;
  148 + margin-top: 36rpx;
  149 + margin-bottom: 100rpx;
  150 +}
  151 +.success .info{
  152 + font-size: 26rpx;
  153 + color:#999999
  154 +}
  155 +
  156 +.moreDisplay{
  157 + height: 100rpx;
  158 + line-height: 100rpx;
  159 + color: #999999;
  160 + font-size: 28rpx;
  161 +}
  162 +.practice_name{
  163 + border: 2rpx solid #C8B16D;
  164 + font-size: 24rpx;
  165 + height: 30rpx;
  166 + line-height: 30rpx;
  167 + color:#C8B16D;
  168 + padding: 0 6rpx;
  169 + margin-left: 18rpx;
  170 +}
  1 +{
  2 + "name": "xcx-book",
  3 + "version": "1.0.0",
  4 + "description": "",
  5 + "main": "app.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1"
  8 + },
  9 + "repository": {
  10 + "type": "git",
  11 + "url": "http://123.56.79.57/xt/xcx-book.git"
  12 + },
  13 + "author": "",
  14 + "license": "ISC",
  15 + "dependencies": {
  16 + "mta-wechat-analysis": "^1.3.7"
  17 + }
  18 +}
@@ -3,20 +3,20 @@ import util from '../../utils/util'; @@ -3,20 +3,20 @@ import util from '../../utils/util';
3 import comm from '../../utils/bookCommon'; 3 import comm from '../../utils/bookCommon';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
6 -const formTpl={  
7 - rid:'',  
8 - date:0,  
9 - time:0,  
10 - //pnum_str:'1-4',  
11 - pnum:6,  
12 - tabid:0, 6 +const formTpl = {
  7 + rid: '',
  8 + date: 0,
  9 + time: 0,
  10 + //pnum_str:'1-4',
  11 + pnum: 6,
  12 + tabid: 0,
13 13
14 - rname:'',  
15 - phone:'',  
16 - sex:1,  
17 - cusdem:'', 14 + rname: '',
  15 + phone: '',
  16 + sex: 1,
  17 + cusdem: '',
18 18
19 - tid:[], 19 + tid: [],
20 20
21 } 21 }
22 Page({ 22 Page({
@@ -25,124 +25,127 @@ Page({ @@ -25,124 +25,127 @@ Page({
25 * 页面的初始数据 25 * 页面的初始数据
26 */ 26 */
27 data: { 27 data: {
28 - dateStr:[],  
29 - form:JSON.parse(JSON.stringify(formTpl)),  
30 - tables:[],  
31 - grand:[  
32 - {  
33 - sex:1,  
34 - grand_title:'先生',  
35 - isselect:true  
36 - },  
37 - {  
38 - sex:2,  
39 - grand_title:'女士',  
40 - isselect:false  
41 - },  
42 - {  
43 - sex:3,  
44 - grand_title:'公司',  
45 - isselect:false  
46 - }  
47 - ],  
48 - buttonhide:true,  
49 -  
50 - calendarMaskLoad:false,  
51 - calendarMask:false,  
52 - dayStyle:[  
53 - { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },  
54 - { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }  
55 - ],  
56 - timePickerArray:[  
57 - [],  
58 - [],  
59 - [],  
60 - ],  
61 - timePickerIndex:[0,0,0],  
62 - tablesLength:0,  
63 -  
64 - timePickerMask:false,  
65 - pnumInputFocus:false,  
66 - pageMarginBottom:0,  
67 - speciallist:[],  
68 - calendar:{  
69 - nextNum:0, 28 + dateStr: [],
  29 + form: JSON.parse(JSON.stringify(formTpl)),
  30 + tables: [],
  31 + grand: [
  32 + {
  33 + sex: 1,
  34 + grand_title: '先生',
  35 + isselect: true
  36 + },
  37 + {
  38 + sex: 2,
  39 + grand_title: '女士',
  40 + isselect: false
  41 + },
  42 + {
  43 + sex: 3,
  44 + grand_title: '公司',
  45 + isselect: false
  46 + }
  47 + ],
  48 + buttonhide: true,
  49 +
  50 + calendarMaskLoad: false,
  51 + calendarMask: false,
  52 + dayStyle: [
  53 + {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'},
  54 + {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'}
  55 + ],
  56 + timePickerArray: [
  57 + [],
  58 + [],
  59 + [],
  60 + ],
  61 + timePickerIndex: [0, 0, 0],
  62 + tablesLength: 0,
  63 +
  64 + timePickerMask: false,
  65 + pnumInputFocus: false,
  66 + pageMarginBottom: 0,
  67 + speciallist: [],
  68 + calendar: {
  69 + nextNum: 0,
70 }, 70 },
71 - defDtime:['','12:00','18:30'],  
72 - hasUseDefDtime:true, 71 + defDtime: ['', '12:00', '18:30'],
  72 + hasUseDefDtime: true,
73 }, 73 },
74 /** 74 /**
75 * 生命周期函数--监听页面加载 75 * 生命周期函数--监听页面加载
76 */ 76 */
77 - reserve_id:'', 77 + reserve_id: '',
  78 + checkedTables:{},//已选中的桌子集合
78 onLoad: async function (options) { 79 onLoad: async function (options) {
79 - this.initLoad(options) 80 + this.initLoad(options)
80 }, 81 },
81 - async initLoad(options={}){  
82 - let nt=new Date()/1000;  
83 - let speciallist=[  
84 - { date: util.unixtoTime(nt,'YYYY-MM-DD'), background: '', text:'今 天' },  
85 - { date: util.unixtoTime(nt+86400,'YYYY-MM-DD'), background: '', text: '明 天' },  
86 - { date: util.unixtoTime(nt+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' },  
87 - ];  
88 - this.reserve_id=options.id||''; 82 + async initLoad(options = {}){
  83 + let nt = new Date() / 1000;
  84 + let speciallist = [
  85 + {date: util.unixtoTime(nt, 'YYYY-MM-DD'), background: '', text: '今 天'},
  86 + {date: util.unixtoTime(nt + 86400, 'YYYY-MM-DD'), background: '', text: '明 天'},
  87 + {date: util.unixtoTime(nt + 86400 * 2, 'YYYY-MM-DD'), background: '', text: '后 天'},
  88 + ];
  89 + this.reserve_id = options.id || '';
89 await this.setDateStr(); 90 await this.setDateStr();
90 - this.sellerid=util.cache('sellerid');  
91 - let timePickerArray= await comm.getDayTimeSpace(); 91 + this.sellerid = util.cache('sellerid');
  92 + let timePickerArray = await comm.getDayTimeSpace();
92 //判断hasUseDefDtime 93 //判断hasUseDefDtime
93 - let hasUseDefDtime=true;  
94 - let mmii=util.unixtoTime(new Date()/1000,'HH:II');  
95 - if(mmii>this.data.defDtime[this.data.form.time]){  
96 - hasUseDefDtime=false; 94 + let hasUseDefDtime = true;
  95 + let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
  96 + if (mmii > this.data.defDtime[this.data.form.time]) {
  97 + hasUseDefDtime = false;
97 } 98 }
98 99
99 this.setData({ 100 this.setData({
100 timePickerArray: timePickerArray, 101 timePickerArray: timePickerArray,
101 - speciallist:speciallist,  
102 - hasUseDefDtime:hasUseDefDtime, 102 + speciallist: speciallist,
  103 + hasUseDefDtime: hasUseDefDtime,
103 }) 104 })
104 - if(this.reserve_id>0){ 105 + if (this.reserve_id > 0) {
105 this.initModify(this.reserve_id); 106 this.initModify(this.reserve_id);
106 - }else{ 107 + } else if(options.hasQuick==1){
  108 + this.initQuick(options);
  109 + } else {
107 this.getTables(); 110 this.getTables();
108 } 111 }
109 }, 112 },
110 - /**  
111 - *  
112 - * @param d  
113 - *  
114 - */  
115 - async setDateStr(d=new Date()/1000){  
116 - let ns=new Date()/1000;  
117 - let dateStr=[  
118 - util.unixtoTime(ns,'MM-DD `DAY/周WW`'),  
119 - util.unixtoTime(parseInt(ns)+86400,'MM-DD `DAY/周WW`'),  
120 - ];  
121 - //let dateStr=this.data.dateStr;  
122 - let nowStr=util.unixtoTime(d,'MM-DD `DAY/周WW`')  
123 - let form=this.data.form;  
124 -  
125 - let timeObj = await comm.getTimeSpaceIndexData(d);  
126 - //form.time=await comm.getTimeSpaceIndex(d);  
127 - form.time=timeObj.timeIndex;  
128 -  
129 - let ind=dateStr._indexOf(nowStr);  
130 - if(ind>-1){  
131 - form.date=ind  
132 - }else{  
133 - dateStr.push(nowStr.substr(0,5));  
134 - form.date=2;  
135 - }  
136 - let timePickerIndex=this.data.timePickerIndex;  
137 - timePickerIndex[timeObj.timeIndex]=timeObj.timeMatchIndex;  
138 - let obj={  
139 - dateStr:dateStr,  
140 - form:form,  
141 - timePickerIndex:timePickerIndex,  
142 - timeOpt:timeObj.timeOpt,  
143 - };  
144 - this.setData(obj)  
145 - return obj; 113 + /**
  114 + *
  115 + * @param d
  116 + *
  117 + */
  118 + async setDateStr(d = new Date() / 1000){
  119 + let ns = new Date() / 1000;
  120 + let dateStr = [
  121 + util.unixtoTime(ns, 'MM-DD `DAY/周WW`'),
  122 + util.unixtoTime(parseInt(ns) + 86400, 'MM-DD `DAY/周WW`'),
  123 + ];
  124 + //let dateStr=this.data.dateStr;
  125 + let nowStr = util.unixtoTime(d, 'MM-DD `DAY/周WW`')
  126 + let form = this.data.form;
  127 +
  128 + let timeObj = await comm.getTimeSpaceIndexData(d);
  129 + //form.time=await comm.getTimeSpaceIndex(d);
  130 + form.time = timeObj.timeIndex;
  131 +
  132 + let ind = dateStr._indexOf(nowStr);
  133 + if (ind > -1) {
  134 + form.date = ind
  135 + } else {
  136 + dateStr.push(nowStr.substr(0, 5));
  137 + form.date = 2;
  138 + }
  139 + let timePickerIndex = this.data.timePickerIndex;
  140 + timePickerIndex[timeObj.timeIndex] = timeObj.timeMatchIndex;
  141 + let obj = {
  142 + dateStr: dateStr,
  143 + form: form,
  144 + timePickerIndex: timePickerIndex,
  145 + timeOpt: timeObj.timeOpt,
  146 + };
  147 + this.setData(obj)
  148 + return obj;
146 149
147 }, 150 },
148 151
@@ -157,16 +160,16 @@ Page({ @@ -157,16 +160,16 @@ Page({
157 * 生命周期函数--监听页面显示 160 * 生命周期函数--监听页面显示
158 */ 161 */
159 onShow: function () { 162 onShow: function () {
160 - //if(!this.reserve_id || util.cache('tableid').length>0){  
161 - if(util.cache('tableid').length>0){  
162 - this.getTables();  
163 - }  
164 - setTimeout(()=>{  
165 - this.setData({  
166 - calendarMaskLoad:true,  
167 - })  
168 - },1000);  
169 - this.conditionInfo() 163 + //if(!this.reserve_id || util.cache('tableid').length>0){
  164 + if (util.cache('tableid').length > 0) {
  165 + this.getTables();
  166 + }
  167 + setTimeout(() => {
  168 + this.setData({
  169 + calendarMaskLoad: true,
  170 + })
  171 + }, 1000);
  172 + this.conditionInfo()
170 }, 173 },
171 174
172 /** 175 /**
@@ -203,401 +206,429 @@ Page({ @@ -203,401 +206,429 @@ Page({
203 onShareAppMessage: function () { 206 onShareAppMessage: function () {
204 207
205 }, 208 },
206 - selectedValue(e){  
207 - console.log(e);  
208 - let key=util.attr(e,'key');  
209 - let val;  
210 - let sobj={};  
211 - if(e.type=='input' || e.type=='confirm'){  
212 - val=util.val(e);  
213 - if(key=='phone'){  
214 - var that=this;  
215 - if(e.detail.value!='' && e.detail.value.length>=3) {  
216 - App.Reserve.GetReserveUser(  
217 - {  
218 - keywords:e.detail.value,  
219 - sid:this.sellerid  
220 - }  
221 - ).then(function(json){  
222 - if(json.ret==200 && json.data.length>0){  
223 - that.setData({  
224 - searchlist:json.data  
225 - })  
226 - }else{  
227 - that.setData({  
228 - searchlist:null  
229 - })  
230 - }  
231 - })  
232 - }else{  
233 - this.setData({  
234 - searchlist:null  
235 - })  
236 - }  
237 - }  
238 - if(key=='pnum'){  
239 - sobj.pnumInputFocus=true;  
240 - }  
241 - }else{  
242 - val=util.attr(e,'value');  
243 - }  
244 - if(key=='time'){  
245 - if(this.data.timeOpt[val]) return;  
246 - }  
247 - if((key=='time' && this.data.form.time==val) || (key=='date' && this.data.form.date==val) ){  
248 - if(util.attr(e,'display')!='block') {  
249 - return; 209 + selectedValue(e){
  210 + console.log(e);
  211 + let key = util.attr(e, 'key');
  212 + let val;
  213 + let sobj = {};
  214 + if (e.type == 'input' || e.type == 'confirm') {
  215 + val = util.val(e);
  216 + if (key == 'phone') {
  217 + var that = this;
  218 + if (e.detail.value != '' && e.detail.value.length >= 3) {
  219 + App.Reserve.GetReserveUser(
  220 + {
  221 + keywords: e.detail.value,
  222 + sid: this.sellerid
  223 + }
  224 + ).then(function (json) {
  225 + if (json.ret == 200 && json.data.length > 0) {
  226 + that.setData({
  227 + searchlist: json.data
  228 + })
  229 + } else {
  230 + that.setData({
  231 + searchlist: null
  232 + })
  233 + }
  234 + })
  235 + } else {
  236 + this.setData({
  237 + searchlist: null
  238 + })
250 } 239 }
251 } 240 }
252 - let form=this.data.form;  
253 -  
254 - if(key=='tid'){  
255 - let ts=this.data.tables;  
256 - if(ts[val].isselect){  
257 - ts[val].isselect=false;  
258 - form.tid.remove(ts[val].id);  
259 - }else{  
260 - ts[val].isselect=true;  
261 - form.tid.push(ts[val].id);  
262 - }  
263 - sobj.tables=ts;  
264 - }else{  
265 - form[key]=val; 241 + if (key == 'pnum') {
  242 + sobj.pnumInputFocus = true;
266 } 243 }
267 - console.log('ts',sobj.tables);  
268 - //console.log(e.type,key,val,form);  
269 - sobj.form=form;  
270 - sobj.buttonhide=true;  
271 - if(form.tid.length>0 && form.rname.length>0){  
272 - sobj.buttonhide=false; 244 + } else {
  245 + val = util.attr(e, 'value');
  246 + }
  247 + if (key == 'time') {
  248 + if (this.data.timeOpt[val]) return;
  249 + }
  250 + if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
  251 + if (util.attr(e, 'display') != 'block') {
  252 + return;
273 } 253 }
274 - let displayTimes=false;  
275 - if(key=='time'){  
276 - if(util.attr(e,'display')=='block'){  
277 - displayTimes=true;  
278 - sobj.timePickerMask=true;  
279 - } 254 + }
  255 + let form = this.data.form;
  256 +
  257 + if (key == 'tid') {
  258 + let ts = this.data.tables;
  259 + if (ts[val].isselect) {
  260 + ts[val].isselect = false;
  261 + form.tid.remove(ts[val].id);
  262 + delete this.checkedTables[ts[val].id]
  263 + } else {
  264 + ts[val].isselect = true;
  265 + form.tid.push(ts[val].id);
  266 + this.checkedTables[ts[val].id]=ts[val].name
280 } 267 }
281 - if('date,time,pnum,pnum_str,tabid'.indexOf(key)>-1){  
282 - if(!displayTimes){  
283 - sobj.form.tid=[];  
284 - sobj.buttonhide=true;  
285 - this.getTables();  
286 - }  
287 - if(key=='date'){  
288 - let xtime=util.unixtoTime(new Date()/1000,'YYYY-'+(this.data.dateStr[val].substr(0,5))+' HH:II:SS');  
289 - this.setDateStr(util.timetouUnix(xtime));  
290 - } 268 + sobj.tables = ts;
  269 + } else {
  270 + form[key] = val;
  271 + }
  272 + console.log('ts', sobj.tables,this.checkedTables);
  273 + //console.log(e.type,key,val,form);
  274 + sobj.form = form;
  275 + sobj.buttonhide = true;
  276 + if (form.tid.length > 0 && form.rname.length > 0) {
  277 + sobj.buttonhide = false;
  278 + }
  279 + let displayTimes = false;
  280 + if (key == 'time') {
  281 + if (util.attr(e, 'display') == 'block') {
  282 + displayTimes = true;
  283 + sobj.timePickerMask = true;
291 } 284 }
292 - //判断hasUseDefDtime  
293 - if((key=='time' || key=='date') && !sobj.timePickerMask){  
294 - sobj.hasUseDefDtime=true 285 + }
  286 + if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
  287 + if (!displayTimes) {
  288 + //sobj.form.tid = []; //切换日期时间清空桌位
  289 + sobj.buttonhide = true;
  290 + this.getTables();
295 } 291 }
296 - if(this.data.form.date==0){//  
297 - let mmii=util.unixtoTime(new Date()/1000,'HH:II');  
298 - if(mmii>this.data.defDtime[key=='time'?val:this.data.form.time]){  
299 - sobj.hasUseDefDtime=false;  
300 - } 292 + if (key == 'date') {
  293 + let xtime = util.unixtoTime(new Date() / 1000, 'YYYY-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
  294 + this.setDateStr(util.timetouUnix(xtime));
301 } 295 }
302 - this.setData(sobj)  
303 - },  
304 - async getTables(){  
305 - let form=this.data.form;  
306 - let tableid=util.cache('tableid');  
307 - console.log('getTables-tableid',tableid.length,this.reserve_id);  
308 - if(tableid.length<1 && this.reserve_id){  
309 - tableid=this.data.form.tid;  
310 - }  
311 - console.log('getTables-tableid',tableid,tableid.length);  
312 - try{  
313 - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);  
314 - console.log('rdate',this.data.dateStr[this.data.form.date],rdate);  
315 - App.Reserve.GetTableList({  
316 - sid:this.sellerid,  
317 - //pnum_str:form.pnum_str,  
318 - pnum:form.pnum,  
319 - rdate:rdate,  
320 - tid:form.tabid,  
321 - rid:this.reserve_id,  
322 - }).then(res=>{  
323 - let tables=[],tables_tmp=[];  
324 - let tablesLength=0;  
325 - if(tableid.length>0){  
326 - res.data.forEach(p=>{  
327 - //if(tables.length>=3) return true;  
328 - p.list.forEach(t=>{  
329 - tablesLength++;  
330 - if(tables.length>=3) return true;  
331 - if(tableid._indexOf(t.id)>-1){  
332 - t.isselect=true;  
333 - tables.push(t);  
334 - }  
335 - })  
336 - })  
337 - wx.removeStorage({key:'tableid'})  
338 - }else{  
339 - res.data.forEach(p=>{  
340 - p.list.forEach(t=>{  
341 - tablesLength++;  
342 - //if(tables.length>=3) return true;  
343 - if(t.tid==2) {  
344 - tables.push(t);  
345 - }else{  
346 - tables_tmp.push(t);  
347 - }  
348 - })  
349 - })  
350 - if(tables.length<3){  
351 - tables=tables.concat(tables_tmp);  
352 - }  
353 - if(tables.length>=3){  
354 - tables=tables.slice(0,3);  
355 - }  
356 - }  
357 - this.tablesLength=tablesLength;  
358 - this.setData({  
359 - tables:tables,  
360 - tablesLength:tablesLength  
361 - }) 296 + }
  297 + //判断hasUseDefDtime
  298 + if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
  299 + sobj.hasUseDefDtime = true
  300 + }
  301 + if (this.data.form.date == 0) {//
  302 + let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
  303 + if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
  304 + sobj.hasUseDefDtime = false;
  305 + }
  306 + }
  307 + this.setData(sobj)
  308 + },
  309 + async getTables(){
  310 + let form = this.data.form;
  311 + let tableid = util.cache('tableid');
  312 + console.log('getTables-tableid', tableid.length, this.reserve_id);
  313 + //if (tableid.length < 1 && this.reserve_id) {
  314 + if (tableid.length < 1) {
  315 + tableid = this.data.form.tid;
  316 + }
  317 + console.log('getTables-tableid', tableid, tableid.length);
  318 + try {
  319 + let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
  320 + console.log('rdate', this.data.dateStr[this.data.form.date], rdate);
  321 + App.Reserve.GetTableList({
  322 + sid: this.sellerid,
  323 + //pnum_str:form.pnum_str,
  324 + pnum: form.pnum,
  325 + rdate: rdate,
  326 + tid: form.tabid,
  327 + rid: this.reserve_id,
  328 + }).then(res => {
  329 + let tables = [], tables_tmp = [];
  330 + let tablesLength = 0;
  331 + if (tableid.length > 0) {
  332 + let toastTables={...this.checkedTables}
  333 + res.data.forEach(p => {
  334 + //if(tables.length>=3) return true;
  335 + p.list.forEach(t => {
  336 + delete toastTables[t.id]
  337 + tablesLength++;
  338 + if (tables.length >= 3) return true;
  339 + if (tableid._indexOf(t.id) > -1) {
  340 + t.isselect = true;
  341 + tables.push(t);
  342 + }
362 }) 343 })
363 - }catch (e){ 344 + })
  345 + console.log('toastTables',toastTables);
  346 + //清理已选中的桌位
  347 + let toastTablesInfo=[];
  348 + let tid=this.data.form.tid
  349 + Object.keys(this.checkedTables).forEach(ckid=>{
  350 + if(toastTables[ckid]){
  351 + delete this.checkedTables[ckid]
  352 + tid.remove(ckid);
  353 + toastTablesInfo.push(toastTables[ckid]);
  354 + }
  355 + })
  356 + if(toastTablesInfo.length>0){
364 this.setData({ 357 this.setData({
365 - tables:[] 358 + [`form.tid`]:tid,
366 }) 359 })
  360 + util.toast(toastTablesInfo.toString()+'已被占用啦','none');
  361 + }
  362 + wx.removeStorage({key: 'tableid'})
367 } 363 }
368 - },  
369 - async formsubmit(){  
370 - if(this.data.buttonhide) return;  
371 - try {  
372 - let d_stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];  
373 - let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],  
374 - this.data.form.time,d_stimestr);  
375 - let stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];  
376 - let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],  
377 - this.data.form.time,stimestr);  
378 - console.log('stimestr', stimestr,this.data.form.time,this.data.timePickerIndex);  
379 - console.log('rdate', rdate);  
380 - this.setData({  
381 - buttonhide: true,  
382 - })  
383 - let form = JSON.parse(JSON.stringify(this.data.form));  
384 - console.log('typeof form.tid',typeof form.tid);  
385 - if(typeof form.tid=='object'){  
386 - let tid= new Set(form.tid);//tid 去重  
387 - form.tid = [...tid].toString();  
388 - }  
389 - if(!form.tid){  
390 - return util.toast('请选择桌子','none');  
391 - }  
392 - form.sid = this.sellerid;  
393 - form.rdate =rdate  
394 - if(!form.rid){  
395 - try{  
396 - let enter_params=util.cache('enter_params');  
397 - let sc=(await App.Reserve.SellerInfo(enter_params)).data  
398 - let note_openid=enter_params.seller_openid;  
399 - let note_name=sc.seller_user.nickname;  
400 - form.note_openid=note_openid||'';  
401 - form.note_name=note_name||'';  
402 - }catch (e){}  
403 - }  
404 - form.ddate=d_rdate.substr(0,10);  
405 - if(this.data.hasUseDefDtime && this.data.form.time>0){//转为默认时间  
406 - let ddateStr=util.unixtoTime(form.ddate,"YYYY-MM-DD "+this.data.defDtime[this.data.form.time]+":00");  
407 - form.ddate=util.timetouUnix(ddateStr);  
408 - }  
409 - App.Reserve.SetReserveInfo(form).then(res => {  
410 - if(res.ret==200){  
411 - let _id=(res.data.id || res.data)  
412 - this.setData({  
413 - form:JSON.parse(JSON.stringify(formTpl)),  
414 - tables:[],  
415 - timePickerIndex:[0,0,0],  
416 - })  
417 - this.initLoad();  
418 - App.Reserve.Detail({rid:_id,openid:''},'clear')  
419 - wx.navigateTo({  
420 - url:'b_detail?id='+_id,  
421 - });  
422 - }else{  
423 - util.toast(res.msg,'none')  
424 - } 364 + if(tables.length<1){
  365 + tablesLength=0;
  366 + tables_tmp = [];
  367 + res.data.forEach(p => {
  368 + p.list.forEach(t => {
  369 + tablesLength++;
  370 + //if(tables.length>=3) return true;
  371 + if (t.tid == 2) {
  372 + tables.push(t);
  373 + } else {
  374 + tables_tmp.push(t);
  375 + }
425 }) 376 })
426 - }catch (e){}  
427 - },  
428 - selectphone:function(e){  
429 - this.data.form.phone=e.detail.phone;  
430 - this.data.form.rname=e.detail.rname;  
431 - this.data.form.cusdem=e.detail.cusdem;  
432 - var form=this.data.form  
433 - this.data.form.sex=e.detail.sex;  
434 - this.setData({  
435 - form:this.data.form,  
436 - searchlist:null  
437 - })  
438 - this.conditionInfo();  
439 - },  
440 - calendarShow(){  
441 - this.setData({  
442 - calendarMask:true  
443 - })  
444 - },  
445 - dateChange(event){  
446 - console.log(event);  
447 - //let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)  
448 - let cktime=util.timetouUnix(event.detail.date)  
449 - let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);  
450 - if(cktime<day0){  
451 - util.toast('请选择有效日期','none');  
452 - return; 377 + })
  378 + if (tables.length < 3) {
  379 + tables = tables.concat(tables_tmp);
  380 + }
  381 + if (tables.length >= 3) {
  382 + tables = tables.slice(0, 3);
  383 + }
453 } 384 }
454 - let clickDay = event.detail.date.substr(8,2);  
455 - let changeDay = `dayStyle[1].day`;  
456 - let changeBg = `dayStyle[1].background`; 385 + this.tablesLength = tablesLength;
457 this.setData({ 386 this.setData({
458 - [changeDay]: clickDay,  
459 - [changeBg]: "#84e7d0",  
460 - [`form.tid`]:[],  
461 - buttonhide:true,  
462 - })  
463 - this.setDateStr(cktime==day0?new Date()/1000:cktime)  
464 - this.getTables();  
465 - this.calendarClose();  
466 - },  
467 - calendarClose(){  
468 - this.setData({  
469 - calendarMask:false,  
470 - timePickerMask:false,  
471 - })  
472 - },  
473 - async selectdesk(){  
474 - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);  
475 - console.log(this.data.form)  
476 - wx.navigateTo({  
477 - url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid  
478 - //+'&pnum_str='+this.data.form.pnum_str  
479 - +'&pnum='+this.data.form.pnum  
480 - +'&checked_tids='+this.data.form.tid  
481 - +'&rid='+this.reserve_id 387 + tables: tables,
  388 + tablesLength: tablesLength
482 }) 389 })
483 - },  
484 - conditionInfo:function(){  
485 - var form=this.data.form  
486 - if(form.tid.length>0 && form.rname.length>0){  
487 - this.data.buttonhide=false; 390 + })
  391 + } catch (e) {
  392 + this.setData({
  393 + tables: []
  394 + })
  395 + }
  396 + },
  397 + async formsubmit(){
  398 + if (this.data.buttonhide) return;
  399 + try {
  400 + let d_stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
  401 + let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
  402 + this.data.form.time, d_stimestr);
  403 + let stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];
  404 + let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
  405 + this.data.form.time, stimestr);
  406 + console.log('stimestr', stimestr, this.data.form.time, this.data.timePickerIndex);
  407 + console.log('rdate', rdate);
  408 + this.setData({
  409 + buttonhide: true,
  410 + })
  411 + let form = JSON.parse(JSON.stringify(this.data.form));
  412 + console.log('typeof form.tid', typeof form.tid);
  413 + if (typeof form.tid == 'object') {
  414 + let tid = new Set(form.tid);//tid 去重
  415 + form.tid = [...tid].toString();
  416 + }
  417 + if (!form.tid) {
  418 + return util.toast('请选择桌子', 'none');
  419 + }
  420 + form.sid = this.sellerid;
  421 + form.rdate = rdate
  422 + if (!form.rid) {
  423 + try {
  424 + let enter_params = util.cache('enter_params');
  425 + let sc = (await App.Reserve.SellerInfo(enter_params)).data
  426 + let note_openid = enter_params.seller_openid;
  427 + let note_name = sc.seller_user.nickname;
  428 + form.note_openid = note_openid || '';
  429 + form.note_name = note_name || '';
  430 + } catch (e) {
488 } 431 }
489 - this.setData({  
490 - buttonhide:this.data.buttonhide  
491 - })  
492 - },  
493 - /**  
494 - * 选中时间区域  
495 - */  
496 - bindTimePickerChange(e){  
497 - let timeIndex=util.attr(e,'timeIndex');  
498 - if(timeIndex<0) return;  
499 - let timePickerIndex=this.data.timePickerIndex;  
500 - //timePickerIndex[timeIndex]=util.val(e);  
501 - timePickerIndex[timeIndex]=util.attr(e,'val');  
502 -  
503 - console.log(e,timeIndex,util.attr(e,'val'));  
504 - this.setData({  
505 - timePickerIndex:timePickerIndex,  
506 - hasUseDefDtime:false,  
507 - })  
508 - },  
509 - /**  
510 - * 修改初始化  
511 - */  
512 - async initModify(id){  
513 - try{  
514 - let res= await App.Reserve.Detail({rid:id,openid:''});  
515 -  
516 - console.log('initModify',res);  
517 - //设置日期  
518 - let obj = await this.setDateStr(res.data.ddate);  
519 - //设置时间  
520 - let nd=util.unixtoTime(res.data.ddate,'HH:II');  
521 - let timePickerIndex=this.data.timePickerIndex  
522 - console.log('initModify-',this.data.timePickerArray,obj.form.time,nd)  
523 - this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{  
524 - console.log('initModify-',nd,dd)  
525 - if(nd==dd){  
526 - timePickerIndex[obj.form.time]=ii;  
527 - return true;  
528 - }  
529 - }) 432 + }
  433 + form.ddate = d_rdate.substr(0, 10);
  434 + if (this.data.hasUseDefDtime && this.data.form.time > 0) {//转为默认时间
  435 + let ddateStr = util.unixtoTime(form.ddate, "YYYY-MM-DD " + this.data.defDtime[this.data.form.time] + ":00");
  436 + form.ddate = util.timetouUnix(ddateStr);
  437 + }
  438 + App.Reserve.SetReserveInfo(form).then(res => {
  439 + if (res.ret == 200) {
  440 + let _id = (res.data.id || res.data)
  441 + this.setData({
  442 + form: JSON.parse(JSON.stringify(formTpl)),
  443 + tables: [],
  444 + timePickerIndex: [0, 0, 0],
  445 + })
  446 + this.initLoad();
  447 + this.checkedTables={};
  448 + App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
  449 + wx.navigateTo({
  450 + url: 'b_detail?id=' + _id,
  451 + });
  452 + } else {
  453 + util.toast(res.msg, 'none')
  454 + }
  455 + })
  456 + } catch (e) {
  457 + }
  458 + },
  459 + selectphone: function (e) {
  460 + this.data.form.phone = e.detail.phone;
  461 + this.data.form.rname = e.detail.rname;
  462 + this.data.form.cusdem = e.detail.cusdem;
  463 + var form = this.data.form
  464 + this.data.form.sex = e.detail.sex;
  465 + this.setData({
  466 + form: this.data.form,
  467 + searchlist: null
  468 + })
  469 + this.conditionInfo();
  470 + },
  471 + calendarShow(){
  472 + this.setData({
  473 + calendarMask: true
  474 + })
  475 + },
  476 + dateChange(event){
  477 + console.log(event);
  478 + //let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
  479 + let cktime = util.timetouUnix(event.detail.date)
  480 + let day0 = parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
  481 + if (cktime < day0) {
  482 + util.toast('请选择有效日期', 'none');
  483 + return;
  484 + }
  485 + let clickDay = event.detail.date.substr(8, 2);
  486 + let changeDay = `dayStyle[1].day`;
  487 + let changeBg = `dayStyle[1].background`;
  488 + this.setData({
  489 + [changeDay]: clickDay,
  490 + [changeBg]: "#84e7d0",
  491 + //[`form.tid`]: [], //切换日期时间清空桌位
  492 + buttonhide: true,
  493 + })
  494 + this.setDateStr(cktime == day0 ? new Date() / 1000 : cktime)
  495 + this.getTables();
  496 + this.calendarClose();
  497 + },
  498 + calendarClose(){
  499 + this.setData({
  500 + calendarMask: false,
  501 + timePickerMask: false,
  502 + })
  503 + },
  504 + async selectdesk(){
  505 + let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
  506 + console.log(this.data.form)
  507 + wx.navigateTo({
  508 + url: 'b_desk?rdate=' + rdate + '&tid=' + this.data.form.tabid
  509 + //+'&pnum_str='+this.data.form.pnum_str
  510 + + '&pnum=' + this.data.form.pnum
  511 + + '&checked_tids=' + this.data.form.tid
  512 + + '&rid=' + this.reserve_id
  513 + })
  514 + },
  515 + conditionInfo: function () {
  516 + var form = this.data.form
  517 + if (form.tid.length > 0 && form.rname.length > 0) {
  518 + this.data.buttonhide = false;
  519 + }
  520 + this.setData({
  521 + buttonhide: this.data.buttonhide
  522 + })
  523 + },
  524 + /**
  525 + * 选中时间区域
  526 + */
  527 + bindTimePickerChange(e){
  528 + let timeIndex = util.attr(e, 'timeIndex');
  529 + if (timeIndex < 0) return;
  530 + let timePickerIndex = this.data.timePickerIndex;
  531 + //timePickerIndex[timeIndex]=util.val(e);
  532 + timePickerIndex[timeIndex] = util.attr(e, 'val');
530 533
531 - console.log('initModify-timePickerIndex',timePickerIndex);  
532 - //obj.form.pnum_str=res.data.pnum_str;  
533 - obj.form.pnum=res.data.pnum||6;  
534 - obj.form.rname=res.data.rname;  
535 - obj.form.phone=res.data.phone;  
536 - obj.form.sex=res.data.sex;  
537 - obj.form.cusdem=res.data.cusdem;  
538 - obj.form.rid=id;  
539 - obj.form.tid=[];  
540 - let tablesed=[];  
541 - res.data.tables.forEach((t,ti)=>{  
542 - obj.form.tid.push(t.id)  
543 - if(ti>=3) return;  
544 - t.isselect=true  
545 - t["isselected"]=1  
546 - tablesed.push(t);  
547 - })  
548 - this.setData({  
549 - timePickerIndex:timePickerIndex,  
550 - form:obj.form,  
551 - //tablesed:tablesed,  
552 - hasUseDefDtime:false,  
553 - })  
554 - setTimeout(()=>{  
555 - this.getTables();  
556 - },300) 534 + console.log(e, timeIndex, util.attr(e, 'val'));
  535 + this.setData({
  536 + timePickerIndex: timePickerIndex,
  537 + hasUseDefDtime: false,
  538 + })
  539 + },
  540 + /**
  541 + * 修改初始化
  542 + */
  543 + async initModify(id){
  544 + try {
  545 + let res = await App.Reserve.Detail({rid: id, openid: ''});
557 546
558 - }catch (e){  
559 - console.log('initModify',e) 547 + console.log('initModify', res);
  548 + //设置日期
  549 + let obj = await this.setDateStr(res.data.ddate);
  550 + //设置时间
  551 + let nd = util.unixtoTime(res.data.ddate, 'HH:II');
  552 + let timePickerIndex = this.data.timePickerIndex
  553 + console.log('initModify-', this.data.timePickerArray, obj.form.time, nd)
  554 + this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
  555 + console.log('initModify-', nd, dd)
  556 + if (nd == dd) {
  557 + timePickerIndex[obj.form.time] = ii;
  558 + return true;
560 } 559 }
561 - },  
562 - pnumInputFocusEvent(e){  
563 - console.log(e); 560 + })
  561 +
  562 + console.log('initModify-timePickerIndex', timePickerIndex);
  563 + //obj.form.pnum_str=res.data.pnum_str;
  564 + obj.form.pnum = res.data.pnum || 6;
  565 + obj.form.rname = res.data.rname;
  566 + obj.form.phone = res.data.phone || "";
  567 + obj.form.sex = res.data.sex;
  568 + obj.form.cusdem = res.data.cusdem;
  569 + obj.form.rid = id;
  570 + obj.form.tid = [];
  571 + let tablesed = [];
  572 + res.data.tables.forEach((t, ti) => {
  573 + obj.form.tid.push(t.id)
  574 + if (ti >= 3) return;
  575 + t.isselect = true
  576 + t["isselected"] = 1
  577 + tablesed.push(t);
  578 + })
564 this.setData({ 579 this.setData({
565 - pnumInputFocus:'focus'==e.type 580 + timePickerIndex: timePickerIndex,
  581 + form: obj.form,
  582 + //tablesed:tablesed,
  583 + hasUseDefDtime: false,
566 }) 584 })
  585 + setTimeout(() => {
  586 + this.getTables();
  587 + }, 300)
  588 +
  589 + } catch (e) {
  590 + console.log('initModify', e)
  591 + }
  592 + },
  593 + pnumInputFocusEvent(e){
  594 + console.log(e);
  595 + this.setData({
  596 + pnumInputFocus: 'focus' == e.type
  597 + })
567 }, 598 },
568 - inputFocusTime:0,  
569 - blurTime:0, 599 + inputFocusTime: 0,
  600 + blurTime: 0,
570 inputFocus(e){ 601 inputFocus(e){
571 - console.log(e,this.inputFocusTime); 602 + console.log(e, this.inputFocusTime);
572 return; 603 return;
573 - if(e.timeStamp>this.inputFocusTime){  
574 - this.inputFocusTime=e.timeStamp;  
575 - if(e.type=='focus' && this.data.pageMarginBottom==0){ 604 + if (e.timeStamp > this.inputFocusTime) {
  605 + this.inputFocusTime = e.timeStamp;
  606 + if (e.type == 'focus' && this.data.pageMarginBottom == 0) {
576 this.setData({ 607 this.setData({
577 - pageMarginBottom:300 608 + pageMarginBottom: 300
578 }) 609 })
579 - setTimeout(res=>{ 610 + setTimeout(res => {
580 this.pageScrollToBottom(); 611 this.pageScrollToBottom();
581 - },100)  
582 - }else{  
583 - if(this.blurTime>5){  
584 - this.blurTime=0; 612 + }, 100)
  613 + } else {
  614 + if (this.blurTime > 5) {
  615 + this.blurTime = 0;
585 this.setData({ 616 this.setData({
586 - pageMarginBottom:0 617 + pageMarginBottom: 0
587 }) 618 })
588 - }else{  
589 - setTimeout(res=>{  
590 - this.blurTime+=1; 619 + } else {
  620 + setTimeout(res => {
  621 + this.blurTime += 1;
591 this.inputFocus(e); 622 this.inputFocus(e);
592 - },300) 623 + }, 300)
593 } 624 }
594 625
595 } 626 }
596 627
597 } 628 }
598 }, 629 },
599 - pageScrollToBottom: function() {  
600 - wx.createSelectorQuery().select('#j_page').boundingClientRect(function(rect){ 630 + pageScrollToBottom: function () {
  631 + wx.createSelectorQuery().select('#j_page').boundingClientRect(function (rect) {
601 // 使页面滚动到底部 632 // 使页面滚动到底部
602 wx.pageScrollTo({ 633 wx.pageScrollTo({
603 scrollTop: rect.bottom 634 scrollTop: rect.bottom
@@ -606,17 +637,64 @@ Page({ @@ -606,17 +637,64 @@ Page({
606 }, 637 },
607 gotoday(e){ 638 gotoday(e){
608 this.setData({ 639 this.setData({
609 - [`calendar.nextNum`]:0 640 + [`calendar.nextNum`]: 0
610 }) 641 })
611 }, 642 },
612 nextMonth(e){ 643 nextMonth(e){
613 this.setData({ 644 this.setData({
614 - [`calendar.nextNum`]:this.data.calendar.nextNum+1 645 + [`calendar.nextNum`]: this.data.calendar.nextNum + 1
615 }) 646 })
616 }, 647 },
617 prevMonth(e){ 648 prevMonth(e){
618 this.setData({ 649 this.setData({
619 - [`calendar.nextNum`]:this.data.calendar.nextNum-1 650 + [`calendar.nextNum`]: this.data.calendar.nextNum - 1
620 }) 651 })
621 }, 652 },
  653 + /**
  654 + * 快速预定初始化
  655 + * tid
  656 + * tname
  657 + * ddate
  658 + * pnum
  659 + */
  660 + async initQuick(options){
  661 + try {
  662 + console.log('initQuick', options);
  663 + this.checkedTables[options.tid]=options.tname
  664 + options.ddate=options.ddate.substr(0,10);
  665 + //设置日期
  666 + let obj = await this.setDateStr(options.ddate);
  667 + //设置时间
  668 + let nd = util.unixtoTime(options.ddate, 'HH:II');
  669 + let timePickerIndex = this.data.timePickerIndex
  670 + console.log('initQuick-', this.data.timePickerArray, obj.form.time, nd)
  671 + this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
  672 + console.log('initQuick-', nd, dd)
  673 + if (nd == dd) {
  674 + timePickerIndex[obj.form.time] = ii;
  675 + return true;
  676 + }
  677 + })
  678 +
  679 + console.log('initQuick-timePickerIndex', timePickerIndex);
  680 + obj.form.pnum = options.pnum || 6;
  681 + obj.form.rname = "";
  682 + obj.form.phone = "";
  683 + obj.form.sex = 1;
  684 + obj.form.cusdem = "";
  685 + obj.form.rid = "";
  686 + obj.form.tid = [options.tid];
  687 + this.setData({
  688 + timePickerIndex: timePickerIndex,
  689 + form: obj.form,
  690 + hasUseDefDtime: false,
  691 + })
  692 + setTimeout(() => {
  693 + this.getTables();
  694 + }, 300)
  695 +
  696 + } catch (e) {
  697 + console.log('initQuick', e)
  698 + }
  699 + },
622 }) 700 })
@@ -3,13 +3,14 @@ @@ -3,13 +3,14 @@
3 <view class="flex-lr" style="border-top:1rpx solid #E0E0E0"> 3 <view class="flex-lr" style="border-top:1rpx solid #E0E0E0">
4 <view class="menus" style="height: {{height}}px; overflow-y: auto;overflow-x: hidden;align-self:flex-start "> 4 <view class="menus" style="height: {{height}}px; overflow-y: auto;overflow-x: hidden;align-self:flex-start ">
5 <view class="menus-item flex-cc {{item.name==menu_active_id?'active':''}}" 5 <view class="menus-item flex-cc {{item.name==menu_active_id?'active':''}}"
6 - wx:for="{{desklist}}" bindtap="switchMenu" data-id="{{item.name}}"> 6 + wx:for="{{desklist}}" wx:key="desklist.key"
  7 + bindtap="switchMenu" data-id="{{item.name}}">
7 <view class="name">{{item.name}}</view> 8 <view class="name">{{item.name}}</view>
8 <view class="hip" wx:if="{{item.chenkNum>0}}">{{item.chenkNum}}</view> 9 <view class="hip" wx:if="{{item.chenkNum>0}}">{{item.chenkNum}}</view>
9 </view> 10 </view>
10 </view> 11 </view>
11 <view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;"> 12 <view style="height: {{height-80}}px;overflow-y: auto;padding-bottom: 160rpx;overflow-x: hidden;width: 100%;">
12 - <block wx:for="{{desklist}}"> 13 + <block wx:for="{{desklist}}" wx:key="desklist.key">
13 <orderDesk list="{{item.list}}" bind:changedesk="changedesk" wx:if="{{item.name==menu_active_id}}"></orderDesk> 14 <orderDesk list="{{item.list}}" bind:changedesk="changedesk" wx:if="{{item.name==menu_active_id}}"></orderDesk>
14 </block> 15 </block>
15 16
@@ -8,6 +8,7 @@ Page({ @@ -8,6 +8,7 @@ Page({
8 actionSheetItems:['客户取消','客户行程改变'] 8 actionSheetItems:['客户取消','客户行程改变']
9 }, 9 },
10 sc:{}, 10 sc:{},
  11 + enter_params:{},
11 onLoad:async function (opt) { 12 onLoad:async function (opt) {
12 util.setBarTitle('预定详情'); 13 util.setBarTitle('预定详情');
13 console.log(opt) 14 console.log(opt)
@@ -18,8 +19,8 @@ Page({ @@ -18,8 +19,8 @@ Page({
18 console.log(res) 19 console.log(res)
19 } 20 }
20 }) 21 })
21 - let enter_params=util.cache('enter_params');  
22 - this.sc=(await App.Reserve.SellerInfo(enter_params)).data; 22 + this.enter_params=util.cache('enter_params');
  23 + this.sc=(await App.Reserve.SellerInfo(this.enter_params)).data;
23 console.log('this.sc',this.sc); 24 console.log('this.sc',this.sc);
24 this.chooseManagerInit(); 25 this.chooseManagerInit();
25 }, 26 },
@@ -33,6 +34,9 @@ Page({ @@ -33,6 +34,9 @@ Page({
33 this.selectComponent('#notice').close(); 34 this.selectComponent('#notice').close();
34 var obj=this.data.bookInfo; 35 var obj=this.data.bookInfo;
35 var path='/pages/customer/index?id='+this.data.bookInfo.id; 36 var path='/pages/customer/index?id='+this.data.bookInfo.id;
  37 + if(this.enter_params){
  38 + path+='&fromid='+this.enter_params.seller_openid
  39 + }
36 let nickname=""; 40 let nickname="";
37 try{ 41 try{
38 nickname='"'+this.sc.seller_user.nickname+'"'; 42 nickname='"'+this.sc.seller_user.nickname+'"';
@@ -41,9 +45,9 @@ Page({ @@ -41,9 +45,9 @@ Page({
41 console.log('App.Reserve.MakePic',imageUrl); 45 console.log('App.Reserve.MakePic',imageUrl);
42 return { 46 return {
43 //title: (nickname||'')+'给你发送了一个订座信息,点击查看详情', 47 //title: (nickname||'')+'给你发送了一个订座信息,点击查看详情',
44 - title: '你收到一个邀请函,点击查看',  
45 - path: path+'&hasInvitation=1',  
46 - imageUrl:imageUrl, 48 + title: '点击查看详情,发邀请函',
  49 + path: path+'&hasInvitation=1&hasSellerShare=1',
  50 + imageUrl:'http://qn.colorcun.com/custom/lite-yd-cook/image/share-anpai.jpg',
47 success: function (res) { 51 success: function (res) {
48 console.log(res,666666) 52 console.log(res,666666)
49 }, 53 },
@@ -124,7 +128,7 @@ Page({ @@ -124,7 +128,7 @@ Page({
124 async getDetail(id,force=false){ 128 async getDetail(id,force=false){
125 let res=await App.Reserve.Detail({rid:id,openid:''},force); 129 let res=await App.Reserve.Detail({rid:id,openid:''},force);
126 res.data.rdateStr=util.unixtoTime(res.data.ddate,"MM月DD日 HH:II") 130 res.data.rdateStr=util.unixtoTime(res.data.ddate,"MM月DD日 HH:II")
127 - res.data.phoneStr=res.data.phone; 131 + res.data.phoneStr=res.data.phone||'';
128 let enter_params=util.cache('enter_params'); 132 let enter_params=util.cache('enter_params');
129 let sc=(await App.Reserve.SellerInfo(enter_params)).data 133 let sc=(await App.Reserve.SellerInfo(enter_params)).data
130 let note_openid=enter_params.seller_openid; 134 let note_openid=enter_params.seller_openid;
@@ -137,7 +141,11 @@ Page({ @@ -137,7 +141,11 @@ Page({
137 return $1+'**'+$3; 141 return $1+'**'+$3;
138 }) 142 })
139 } 143 }
  144 + if(res.data.status==4 && res.data.cancel){
  145 + res.data.cancel.cdateStr=util.unixtoTime(res.data.cancel.cdate,"YYYY.MM.DD HH:II")
  146 + }
140 this.detailData=res.data; 147 this.detailData=res.data;
  148 +
141 this.setData({ 149 this.setData({
142 tables:res.data.tables, 150 tables:res.data.tables,
143 bookInfo:res.data, 151 bookInfo:res.data,
@@ -149,10 +157,11 @@ Page({ @@ -149,10 +157,11 @@ Page({
149 }) 157 })
150 }, 158 },
151 cancelReserve(){ 159 cancelReserve(){
152 - util.toast('不能取消预订','none');return;  
153 - this.setData({  
154 - actionSheetHidden:false  
155 - }) 160 + this.selectComponent('#cancel').show();
  161 + },
  162 + reserveCancel(e){
  163 + console.log('reserveCancel',e.detail);
  164 + this.getDetail(this.data.bookInfo.id,true);
156 }, 165 },
157 actionSheetChange(e){ 166 actionSheetChange(e){
158 this.setData({ 167 this.setData({
@@ -166,5 +175,10 @@ Page({ @@ -166,5 +175,10 @@ Page({
166 }).then(()=>{ 175 }).then(()=>{
167 this.getDetail(this.data.bookInfo.id,true); 176 this.getDetail(this.data.bookInfo.id,true);
168 }); 177 });
169 - } 178 + },
  179 + showOrder(){
  180 + wx.navigateTo({
  181 + url:util.http_build_query({rid:this.data.bookInfo.id,oid:this.data.bookInfo.orderid,identity:2},'/pack-cookbook/pages/success')
  182 + });
  183 + },
170 }) 184 })
@@ -6,6 +6,8 @@ @@ -6,6 +6,8 @@
6 "noticeCall":"/components/book/notice/notice", 6 "noticeCall":"/components/book/notice/notice",
7 "step":"/components/book/step/step", 7 "step":"/components/book/step/step",
8 "board":"/components/book/board/board", 8 "board":"/components/book/board/board",
9 - "nav":"/components/nav/nav" 9 + "cancel":"/components/book/reserveCancel/cancel",
  10 + "nav":"/components/nav/nav",
  11 + "formids":"/components/formids/formids"
10 } 12 }
11 } 13 }
@@ -9,6 +9,9 @@ @@ -9,6 +9,9 @@
9 <view class="gray-deep-font font30r">用餐人数</view> 9 <view class="gray-deep-font font30r">用餐人数</view>
10 <view class="black-font font34r">{{bookInfo.pnum_str||bookInfo.pnum}}人</view> 10 <view class="black-font font34r">{{bookInfo.pnum_str||bookInfo.pnum}}人</view>
11 </view> 11 </view>
  12 + <view class="reserve-status-tip" wx:if="{{bookInfo.status!=null}}">
  13 + <image src="http://qn.colorcun.com/custom/lite-yd/image/reserve-status-{{bookInfo.status}}.png"></image>
  14 + </view>
12 <view class="flex-lr order-detail"> 15 <view class="flex-lr order-detail">
13 <view class="gray-deep-font font30r">预定座位</view> 16 <view class="gray-deep-font font30r">预定座位</view>
14 <view class="black-font font34r">{{tables.length}}个</view> 17 <view class="black-font font34r">{{tables.length}}个</view>
@@ -16,7 +19,7 @@ @@ -16,7 +19,7 @@
16 <view class="flex-lr order-desk"> 19 <view class="flex-lr order-desk">
17 <view class="gray-deep-font font30r"></view> 20 <view class="gray-deep-font font30r"></view>
18 <view class="flex-re" style="width:100%;flex-wrap:wrap;"> 21 <view class="flex-re" style="width:100%;flex-wrap:wrap;">
19 - <block wx:for="{{tables}}"> 22 + <block wx:for="{{tables}}" wx:key="tables.key">
20 <board width="160" height="180" board="{{item}}" className="noBottom" 23 <board width="160" height="180" board="{{item}}" className="noBottom"
21 style="margin-left:20rpx;zoom: 0.8; margin-bottom: 20rpx;"></board> 24 style="margin-left:20rpx;zoom: 0.8; margin-bottom: 20rpx;"></board>
22 </block> 25 </block>
@@ -52,15 +55,34 @@ @@ -52,15 +55,34 @@
52 <view class="gray-deep-font font30r">记录人</view> 55 <view class="gray-deep-font font30r">记录人</view>
53 <view class="black-font font34r">{{bookInfo.note_name}}</view> 56 <view class="black-font font34r">{{bookInfo.note_name}}</view>
54 </view> 57 </view>
55 -  
56 </view> 58 </view>
57 - 59 +<view class="order-info" wx:if="{{bookInfo.status==4 && bookInfo.cancel}}">
  60 + <view class="flex-lr order-detail">
  61 + <view class="gray-deep-font font30r">取消原因</view>
  62 + <view class="flex-lr black-font font34r">
  63 + {{bookInfo.cancel.desc}}
  64 + </view>
  65 + </view>
  66 + <view class="flex-lr order-detail">
  67 + <view class="gray-deep-font font30r">取消时间</view>
  68 + <view class="black-font font34r">{{bookInfo.cancel.cdateStr}}</view>
  69 + </view>
  70 + <view class="flex-lr order-detail">
  71 + <view class="gray-deep-font font30r">操作人</view>
  72 + <view class="black-font font34r">{{bookInfo.cancel.uname}}</view>
  73 + </view>
  74 +</view>
58 75
59 <view style="height: 250rpx;"></view> 76 <view style="height: 250rpx;"></view>
60 77
61 <!--通知预订人--> 78 <!--通知预订人-->
62 <view class="notice-opt" wx:if="{{bookInfo.status==1}}"> 79 <view class="notice-opt" wx:if="{{bookInfo.status==1}}">
63 - <view class="notice-button white-font font34r flex-cc" bindtap="noticeCall">通知预订人</view> 80 + <view class="notice-button-border font34r flex-lr">
  81 + <view bindtap="noticeCall">通知预订人</view>
  82 + <view wx:if="{{bookInfo.order && bookInfo.order.cookbooklist.length>0}}">
  83 + <formids bindclick="showOrder">查看菜品</formids>
  84 + </view>
  85 + </view>
64 <view class="notice-button-border font34r flex-lr"> 86 <view class="notice-button-border font34r flex-lr">
65 <view bindtap="gotoModify">变更预定</view> 87 <view bindtap="gotoModify">变更预定</view>
66 <view bindtap="cancelReserve">取消预定</view> 88 <view bindtap="cancelReserve">取消预定</view>
@@ -72,7 +94,7 @@ @@ -72,7 +94,7 @@
72 </view> 94 </view>
73 <noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall> 95 <noticeCall id="notice" bookInfo="{{bookInfo}}"></noticeCall>
74 <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll"> 96 <action-sheet hidden="{{actionSheetHidden}}" bindchange="actionSheetChange" class="flex-ll">
75 - <block wx:for-items="{{actionSheetItems}}"> 97 + <block wx:for-items="{{actionSheetItems}}" wx:key="actionSheetItems.key">
76 <action-sheet-item>{{item}}</action-sheet-item> 98 <action-sheet-item>{{item}}</action-sheet-item>
77 </block> 99 </block>
78 <action-sheet-item> 100 <action-sheet-item>
@@ -80,4 +102,5 @@ @@ -80,4 +102,5 @@
80 </action-sheet-item> 102 </action-sheet-item>
81 <action-sheet-cancel >取消</action-sheet-cancel> 103 <action-sheet-cancel >取消</action-sheet-cancel>
82 104
83 -</action-sheet>  
  105 +</action-sheet>
  106 +<cancel id="cancel" bindreserveCancel="reserveCancel" bookInfo="{{bookInfo}}"></cancel>
@@ -112,7 +112,7 @@ view{ @@ -112,7 +112,7 @@ view{
112 color: #199095; 112 color: #199095;
113 } 113 }
114 .notice-button-border view{ 114 .notice-button-border view{
115 - width: 49%; 115 + width: 100%;
116 border-right: 2rpx solid #199095; 116 border-right: 2rpx solid #199095;
117 text-align: center; 117 text-align: center;
118 height: 50rpx; 118 height: 50rpx;
@@ -121,3 +121,14 @@ view{ @@ -121,3 +121,14 @@ view{
121 .notice-button-border view:last-child{ 121 .notice-button-border view:last-child{
122 border-right-width: 0; 122 border-right-width: 0;
123 } 123 }
  124 +.reserve-status-tip{
  125 + position: absolute;
  126 + top:300rpx;
  127 + right:200rpx;
  128 + width: 82rpx;
  129 + height: 52rpx;
  130 +}
  131 +.reserve-status-tip image{
  132 + width: 100%;
  133 + height: 100%;
  134 +}
  1 +var mta=require('mta-wechat-analysis')
1 var util = require('../../utils/util.js') 2 var util = require('../../utils/util.js')
2 var uri=require('../../utils/uri.js') 3 var uri=require('../../utils/uri.js')
3 var bookOrder=require('../../utils/bookCommon.js') 4 var bookOrder=require('../../utils/bookCommon.js')
@@ -32,6 +33,15 @@ Page({ @@ -32,6 +33,15 @@ Page({
32 indexOpt:null, 33 indexOpt:null,
33 YYYY:'YYYY', 34 YYYY:'YYYY',
34 onLoad:async function(opt){ 35 onLoad:async function(opt){
  36 + this.indexOpt=opt;
  37 + mta.Page.init({
  38 + "appID":"500667280",
  39 + "eventID":"500667287",
  40 + "statPullDownFresh":true,
  41 + "statShareApp":true,
  42 + "statReachBottom":true,
  43 + "lauchOpts":opt, //渠道分析
  44 + });
35 let d=new Date()/1000; 45 let d=new Date()/1000;
36 let dateStr=util.unixtoTime(d,'MM-DD DAY'); 46 let dateStr=util.unixtoTime(d,'MM-DD DAY');
37 var radio=750/util.getsystem().windowWidth; 47 var radio=750/util.getsystem().windowWidth;
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 </view> 50 </view>
51 <view class="book-list" style="padding-bottom:118rpx;"> 51 <view class="book-list" style="padding-bottom:118rpx;">
52 <view class="book-list-body"> 52 <view class="book-list-body">
53 - <block wx:for="{{bookList}}"> 53 + <block wx:for="{{bookList}}" wx:key="bookList.key">
54 <bookList item="{{item}}" class="orderbook"></bookList> 54 <bookList item="{{item}}" class="orderbook"></bookList>
55 </block> 55 </block>
56 </view> 56 </view>
@@ -24,6 +24,7 @@ Page({ @@ -24,6 +24,7 @@ Page({
24 calendar:{ 24 calendar:{
25 nextNum:0, 25 nextNum:0,
26 }, 26 },
  27 + rdate:'',
27 }, 28 },
28 regions:[], 29 regions:[],
29 sellerid:0, 30 sellerid:0,
@@ -142,6 +143,7 @@ Page({ @@ -142,6 +143,7 @@ Page({
142 let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time); 143 let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time);
143 formdata.rdate=rdate; 144 formdata.rdate=rdate;
144 formdata.status='1,2'; 145 formdata.status='1,2';
  146 + obj.rdate=rdate;
145 let tids={}; 147 let tids={};
146 let reserves=await App.Reserve.GetReserveList(formdata); 148 let reserves=await App.Reserve.GetReserveList(formdata);
147 if(reserves.data.length>0){ 149 if(reserves.data.length>0){
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 <view class="items-disks flex-ll" style="flex-wrap: wrap" 35 <view class="items-disks flex-ll" style="flex-wrap: wrap"
36 wx:if="{{regions_active==item.name}}"> 36 wx:if="{{regions_active==item.name}}">
37 <board width="160" height="180" board="{{item}}" 37 <board width="160" height="180" board="{{item}}"
  38 + ddate="{{rdate}}"
38 style="margin: 20rpx 0 0 20rpx" 39 style="margin: 20rpx 0 0 20rpx"
39 bindboardEvent="boardEvent" 40 bindboardEvent="boardEvent"
40 event="boardOpt" 41 event="boardOpt"
  1 +// pages/book/setting/index.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 + offset: 0,
  7 + limit: 10,
  8 + hasMore: true,
  9 + list:{},
  10 + /**
  11 + * 页面的初始数据
  12 + */
  13 + data: {
  14 + list:[],
  15 + hasMore:true,
  16 + },
  17 +
  18 + /**
  19 + * 生命周期函数--监听页面加载
  20 + */
  21 + enter_params: {},
  22 + onLoad: function (options) {
  23 + this.enter_params = util.cache('enter_params');
  24 + this.seller_id=options.seller_id||this.enter_params.seller_id;
  25 + this.getMembers();
  26 + },
  27 +
  28 + /**
  29 + * 生命周期函数--监听页面初次渲染完成
  30 + */
  31 + onReady: function () {
  32 +
  33 + },
  34 +
  35 + /**
  36 + * 生命周期函数--监听页面显示
  37 + */
  38 + onShow: function () {
  39 +
  40 + },
  41 +
  42 + /**
  43 + * 生命周期函数--监听页面隐藏
  44 + */
  45 + onHide: function () {
  46 +
  47 + },
  48 + /**
  49 + * 页面上拉触底事件的处理函数
  50 + */
  51 + onReachBottom: function () {
  52 + if(this.hasMore){
  53 + this.getMembers(true);
  54 + }
  55 + },
  56 + getMembers(hasReachBottom=false){
  57 + App.Reserve.Members({
  58 + sid: this.seller_id,
  59 + //manager_id:this.enter_params.manager_id,
  60 + manager_openid:this.enter_params.seller_openid,
  61 + offset: this.offset,
  62 + limit: this.limit,
  63 + }).then(res => {
  64 + let list = this.data.list;
  65 + let dl=res.data.length;
  66 + if (dl > 0) {
  67 + res.data.forEach(r => {
  68 + //r.addtimeStr = util.unixtoTime(r.addtime, 'MM/DD HH:II')
  69 + list.push(r)
  70 + this.list[r.id] = r;
  71 + })
  72 + }
  73 + let obj={list:list};
  74 + if(dl<this.limit && hasReachBottom){
  75 + this.hasMore=false;
  76 + obj.hasMore=false;
  77 + }else{
  78 + this.offset+=this.limit;
  79 + }
  80 + this.setData(obj)
  81 + })
  82 + },
  83 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"light",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "tabBar":"/components/book/tabBar/tabBar",
  8 + "formids":"/components/formids/formids"
  9 + }
  10 +}
  1 +<!--pages/book/setting/index.wxml-->
  2 +<nav id="nav" backgroundColor="#199095" color="#fefefe">我的客户</nav>
  3 +<view class="page">
  4 + <block wx:if="{{list.length>0}}">
  5 + <view class="row flex-lr" wx:for="{{list}}" wx:key="list.key" >
  6 + <view class="flex-ll">
  7 + <view class="avatar">
  8 + <image src="{{item.headimgurl}}"></image>
  9 + </view>
  10 + <view class="nickname">{{item.nickname||''}}</view>
  11 + </view>
  12 + <view class="flex-rr">
  13 + <!--view class="more"></view-->
  14 + </view>
  15 + </view>
  16 + </block>
  17 + <view wx:else="" class="history-is-empty flex-vc Medium">
  18 + <image src="http://qn.colorcun.com/custom/lite-yd/image/history-is-empty.png"></image>
  19 + <view>暂时还没有客户</view>
  20 + </view>
  21 + <view wx:if="{{!hasMore}}" class="row flex-vc">已经到底了</view>
  22 +</view>
  1 +/* pages/book/setting/index.wxss */
  2 +/*
  3 +http://qn.colorcun.com/custom/lite-yd/image/icon-zk.png
  4 +http://qn.colorcun.com/custom/lite-yd/image/icon-cz.png
  5 +*/
  6 +.page{
  7 + width: 90%;
  8 + margin: 0 auto;
  9 + color: #353535;
  10 +}
  11 +.row{
  12 + font-size: 34rpx;
  13 + height: 106rpx;
  14 + border-bottom: 2rpx solid #F1F0F4;
  15 + padding-top: 34rpx;
  16 +}
  17 +.row .right{
  18 + font-size: 30rpx;
  19 + color:#999999;
  20 +}
  21 +.row .more{
  22 + margin-left: 20rpx;
  23 +}
  24 +.row:last-child{
  25 + border-bottom-width: 0;
  26 +}
  27 +
  28 +.history-is-empty{
  29 + margin: 200rpx auto;
  30 + font-size: 34rpx;
  31 +
  32 +}
  33 +.history-is-empty image{
  34 + width: 376rpx;
  35 + height: 310rpx;
  36 + margin-bottom: 122rpx;
  37 +}
  38 +.avatar{
  39 + width: 80rpx;
  40 + height: 80rpx;
  41 + border-radius: 50%;
  42 + overflow: hidden;
  43 +}
  44 +.avatar image{
  45 + width: 100%;
  46 + height: 100%;
  47 +}
  48 +.nickname{
  49 + margin-left: 40rpx;
  50 + font-size: 34rpx;
  51 +}
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <view class="header"> 3 <view class="header">
4 <view class="info"> 4 <view class="info">
5 <view class="nick">{{user.nickname}}</view> 5 <view class="nick">{{user.nickname}}</view>
6 - <view class="seller Medium">{{seller.sellername}} | {{user.role_name}}</view> 6 + <view class="seller Medium">{{seller.sellername}} | {{user.role_name||''}}</view>
7 </view> 7 </view>
8 </view> 8 </view>
9 <view class="page"> 9 <view class="page">
@@ -24,6 +24,14 @@ @@ -24,6 +24,14 @@
24 </view> 24 </view>
25 </view> 25 </view>
26 </formids> 26 </formids>
  27 + <formids url="/pages/book/crm/index">
  28 + <view class="row flex-lr" style="padding-top: 34rpx;">
  29 + <view>我的客户</view>
  30 + <view class="flex-rr">
  31 + <view class="more"></view>
  32 + </view>
  33 + </view>
  34 + </formids>
27 <formids url="/pages/customer/index?islove=customer"> 35 <formids url="/pages/customer/index?islove=customer">
28 <view class="row flex-lr" style="padding-top: 34rpx;"> 36 <view class="row flex-lr" style="padding-top: 34rpx;">
29 <view>切换到顾客模式</view> 37 <view>切换到顾客模式</view>
@@ -135,7 +135,7 @@ Page({ @@ -135,7 +135,7 @@ Page({
135 },'clear') 135 },'clear')
136 wx.navigateTo({ 136 wx.navigateTo({
137 //id={{detail.id}}&rdate={{detail.rdate}} 137 //id={{detail.id}}&rdate={{detail.rdate}}
138 - url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate, 138 + url:'remind?id='+this.id+'&ddate='+this.data.detail.ddate,
139 }); 139 });
140 }) 140 })
141 }else{ 141 }else{
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <formids bindclick="reserveCancel"> 13 <formids bindclick="reserveCancel">
14 <view class="opt-button">取消</view> 14 <view class="opt-button">取消</view>
15 </formids> 15 </formids>
16 - <formids url="./remind?id={{detail.id}}&rdate={{detail.rdate}}&remindtime={{detail.remindtime}}"> 16 + <formids url="./remind?id={{detail.id}}&ddate={{detail.ddate}}&remindtime={{detail.remindtime}}">
17 <view class="opt-button">提醒</view> 17 <view class="opt-button">提醒</view>
18 </formids> 18 </formids>
19 <userinfo-share 19 <userinfo-share
@@ -142,21 +142,22 @@ Page({ @@ -142,21 +142,22 @@ Page({
142 is_agree:1, 142 is_agree:1,
143 userinfo:userInfo 143 userinfo:userInfo
144 }).then(res=>{ 144 }).then(res=>{
  145 + this.setData({
  146 + [`detail.hasCanSuccess`]:true
  147 + })
145 App.Reserve.Detail({ 148 App.Reserve.Detail({
146 openid: getApp().openid, 149 openid: getApp().openid,
147 rid: this.id 150 rid: this.id
148 },'clear') 151 },'clear')
149 - wx.navigateTo({  
150 - //id={{detail.id}}&rdate={{detail.rdate}}  
151 - url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,  
152 - }); 152 + util.toast('赴约成功','none')
153 }) 153 })
154 }else{ 154 }else{
155 - // wx.navigateTo({  
156 - // url:'invite?id='+this.id,  
157 - // }); 155 + util.toast('赴约成功','none')
158 } 156 }
159 }, 157 },
  158 + setUserInfoSuccess(){
  159 + util.toast('授权成功,可以继续转发','none');
  160 + },
160 reserveCancel(){ 161 reserveCancel(){
161 let userInfo = util.cache('userInfo'); 162 let userInfo = util.cache('userInfo');
162 if (userInfo) { 163 if (userInfo) {
@@ -4,9 +4,7 @@ @@ -4,9 +4,7 @@
4 "navigationBarTitleText":"订座详情", 4 "navigationBarTitleText":"订座详情",
5 "usingComponents": { 5 "usingComponents": {
6 "userinfo": "/components/userinfo/userinfo", 6 "userinfo": "/components/userinfo/userinfo",
7 - "manager": "/components/manager/manager",  
8 "nav":"/components/nav/nav", 7 "nav":"/components/nav/nav",
9 - "card":"/components/seller-card/seller-card",  
10 "formids":"/components/formids/formids", 8 "formids":"/components/formids/formids",
11 "userinfo-share": "/components/userinfo/share" 9 "userinfo-share": "/components/userinfo/share"
12 } 10 }
@@ -5,16 +5,6 @@ @@ -5,16 +5,6 @@
5 <view class="invit-logo"> 5 <view class="invit-logo">
6 <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png"></image> 6 <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-logo.png"></image>
7 </view> 7 </view>
8 - <!--  
9 - <view class="avatar">  
10 - <image src="{{detail.customers[0].headimgurl}}"></image>  
11 - </view>  
12 - <view class="invit flex-cc">  
13 - <view style="margin-right: 20rpx;">{{detail.rnameStr}}</view>  
14 - <view>{{detail.eatStr}}</view>  
15 - </view>  
16 - <view class="hr-one"></view>  
17 - -->  
18 <view class="seller flex-vc"> 8 <view class="seller flex-vc">
19 <view class="title">餐厅</view> 9 <view class="title">餐厅</view>
20 <view class="content name">{{detail.seller.sellername}}</view> 10 <view class="content name">{{detail.seller.sellername}}</view>
@@ -23,14 +13,25 @@ @@ -23,14 +13,25 @@
23 <view class="title">时间</view> 13 <view class="title">时间</view>
24 <view class="content">{{detail.rdateStr}}</view> 14 <view class="content">{{detail.rdateStr}}</view>
25 <view class="title">地址</view> 15 <view class="title">地址</view>
26 - <view class="content flex-ll" bindtap="lookLocation"> 16 + <view class="content flex-ll" bindtap="lookLocation" style="align-items: flex-start">
27 <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-addr.png" class="invit-addr"></image> 17 <image src="http://qn.colorcun.com/custom/lite-yd/image/invit-addr.png" class="invit-addr"></image>
28 - <view>{{detail.seller.real_address||detail.seller.map_address}}</view> 18 + <view class="addr">{{detail.seller.real_address||detail.seller.map_address}}</view>
29 </view> 19 </view>
30 </view> 20 </view>
  21 + </view>
  22 + <view class="opt-button">
31 <view class="opt flex-cc"> 23 <view class="opt flex-cc">
32 - <button class="but button-none flex-vc" bindtap="lookLocation">一键导航</button>  
33 - <button class="but button-none flex-vc" open-type="share" >转发给同行人</button> 24 + <formids class="button-none flex-vc" bindclick="lookLocation">
  25 + <image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-1.png"></image>
  26 + </formids>
  27 + <userinfo-share class="button-none flex-vc" binduserinfo="toast">
  28 + <image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-2.png"></image>
  29 + </userinfo-share>
34 </view> 30 </view>
35 </view> 31 </view>
36 </view> 32 </view>
  33 +<view class="opt-view" wx:if="{{!detail.hasCanSuccess}}">
  34 + <userinfo class="button-none flex-vc" binduserinfo="userinfo">
  35 + <view class="buts-share"></view>
  36 + </userinfo>
  37 +</view>
1 /* pages/customer/detail_customer.wxss */ 1 /* pages/customer/detail_customer.wxss */
2 -page{ 2 +.page{
3 color:#FFFFFF; 3 color:#FFFFFF;
4 background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334; 4 background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
5 background-size: 100%; 5 background-size: 100%;
6 -}  
7 -.page{  
8 overflow-y: auto; 6 overflow-y: auto;
9 position: fixed; 7 position: fixed;
10 - top:40rpx; 8 + top:0;
11 bottom: 0; 9 bottom: 0;
12 left:0; 10 left:0;
13 right:0; 11 right:0;
@@ -41,44 +39,90 @@ image{ @@ -41,44 +39,90 @@ image{
41 width: 90%; 39 width: 90%;
42 } 40 }
43 .seller{ 41 .seller{
44 - margin-top: 150rpx; 42 + margin-top: 40rpx;
45 } 43 }
46 .seller .title{ 44 .seller .title{
47 - font-size: 26rpx; 45 + font-size: 28rpx;
48 color:#999999; 46 color:#999999;
49 - margin-bottom: 30rpx; 47 + margin-bottom: 20rpx;
  48 + height: 40rpx;
  49 + line-height: 40rpx;
50 } 50 }
51 .seller .content{ 51 .seller .content{
52 - margin-bottom: 30rpx;  
53 - font-size: 30rpx;  
54 - line-height: 30rpx; 52 + margin-bottom: 40rpx;
  53 + font-size: 36rpx;
  54 + line-height: 50rpx;
  55 + height: 50rpx;
  56 + max-width: 80%;
55 } 57 }
56 -.seller .name{  
57 - font-size: 42rpx;  
58 - line-height: 42rpx; 58 +.seller .content .addr{
  59 + font-size: 32rpx;
  60 + line-height: 40rpx;
  61 + text-align: center;
59 } 62 }
60 .invit-addr{ 63 .invit-addr{
61 - width: 20rpx;  
62 - height: 20rpx; 64 + width: 22rpx;
  65 + height: 28rpx;
63 margin-right: 18rpx; 66 margin-right: 18rpx;
  67 + min-width: 22rpx;
  68 + margin-top:6rpx ;
64 } 69 }
65 70
66 71
67 - 72 +.opt-view{
  73 + position: fixed;
  74 + bottom: 100rpx;
  75 + width: 100%;
  76 +}
68 .opt{ 77 .opt{
69 - margin-top: 52rpx; 78 + width: 90%;
  79 + margin: 0 auto;
70 } 80 }
71 .opt .but{ 81 .opt .but{
72 - width: 330rpx; 82 + width: 100%;
73 height: 80rpx; 83 height: 80rpx;
74 border: 2rpx solid #ECD9B7; 84 border: 2rpx solid #ECD9B7;
75 border-radius: 6rpx; 85 border-radius: 6rpx;
76 - line-height: 80rpx; 86 + line-height: 78rpx;
77 text-align: center; 87 text-align: center;
78 font-size: 30rpx; 88 font-size: 30rpx;
79 color:#ECD9B7; 89 color:#ECD9B7;
80 - margin-right: 20rpx; 90 + margin-right: 5%;
  91 + padding-bottom: 4rpx!important;
81 } 92 }
82 .opt .but:last-child{ 93 .opt .but:last-child{
83 margin-right: 0; 94 margin-right: 0;
84 } 95 }
  96 +.opt .buts{
  97 + width: 288rpx;
  98 + height: 80rpx;
  99 +}
  100 +.opt-button{
  101 + margin-top: 48rpx;
  102 + width: 100%;
  103 +}
  104 +.buts-share{
  105 + width: 560rpx;
  106 + height: 86rpx;
  107 + margin: 0 auto;
  108 + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/detail_invitation-3.png");
  109 + background-size: 100%;
  110 + background-repeat: no-repeat;
  111 + background-position: center center;
  112 + animation-name: butAnimation;
  113 + animation-duration: 0.7s;
  114 + animation-iteration-count:9999;
  115 +}
  116 +.opt-view-tip{
  117 + font-size: 26rpx;
  118 + color: #999999;
  119 + margin-bottom: 20rpx;
  120 +}
  121 +@keyframes butAnimation
  122 +{
  123 + 50% {background-size:90%;}
  124 +}
  125 +@-webkit-keyframes butAnimation /* Safari 和 Chrome */
  126 +{
  127 + 50% {background-size:90%;}
  128 +}
@@ -73,7 +73,11 @@ Page({ @@ -73,7 +73,11 @@ Page({
73 // detail.cusman_account='wx:vking'; 73 // detail.cusman_account='wx:vking';
74 // } 74 // }
75 let ns=new Date()/1000 75 let ns=new Date()/1000
76 - detail.hasOvered=ns>detail.ddate 76 + detail.hasCancel=detail.status==4
  77 + detail.hasOvered=false
  78 + if(!detail.hasCancel){
  79 + detail.hasOvered=ns>detail.ddate || detail.status>=2
  80 + }
77 return detail; 81 return detail;
78 }, 82 },
79 showManager(){ 83 showManager(){
@@ -92,6 +96,7 @@ Page({ @@ -92,6 +96,7 @@ Page({
92 }, 96 },
93 userinfo(e){ 97 userinfo(e){
94 console.log('userinfo',e) 98 console.log('userinfo',e)
  99 + util.toast('授权成功,可以继续转发','none');
95 // wx.navigateTo({ 100 // wx.navigateTo({
96 // url:'invite?id='+this.id, 101 // url:'invite?id='+this.id,
97 // }); 102 // });
@@ -121,5 +126,27 @@ Page({ @@ -121,5 +126,27 @@ Page({
121 obj.path=obj.path+'&hasInvitation=1'; 126 obj.path=obj.path+'&hasInvitation=1';
122 } 127 }
123 return obj; 128 return obj;
124 - } 129 + },
  130 + cookbook(){
  131 + if(this.data.detail.order && this.data.detail.order.cookbooklist.length>0){
  132 + wx.navigateTo({
  133 + url:util.http_build_query({rid:this.id,oid:this.data.detail.order.id,identity:1},'/pack-cookbook/pages/success')
  134 + });
  135 + }else{
  136 + App.Advance.CreateOrder({
  137 + rid:this.id,
  138 + }).then(res=>{
  139 + if(res.ret!=200){
  140 + return util.toast(res.msg,'none')
  141 + }
  142 + wx.navigateTo({
  143 + url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1,sid:res.data.sellerid},'/pack-cookbook/pages/index')
  144 + });
  145 + })
  146 + }
  147 +
  148 + },
  149 + wineGo(){
  150 + util.toast('本区域暂无配送人员','none');
  151 + },
125 }) 152 })
@@ -4,8 +4,10 @@ @@ -4,8 +4,10 @@
4 "navigationBarTitleText":"订座详情", 4 "navigationBarTitleText":"订座详情",
5 "usingComponents": { 5 "usingComponents": {
6 "userinfo-share": "/components/userinfo/share", 6 "userinfo-share": "/components/userinfo/share",
  7 + "userinfo": "/components/userinfo/userinfo",
7 "manager": "/components/manager/manager", 8 "manager": "/components/manager/manager",
8 "nav":"/components/nav/nav", 9 "nav":"/components/nav/nav",
9 - "card":"/components/seller-card/seller-card" 10 + "card":"/components/seller-card/seller-card",
  11 + "formids":"/components/formids/formids"
10 } 12 }
11 } 13 }
@@ -2,8 +2,17 @@ @@ -2,8 +2,17 @@
2 <nav hasHome>订座详情</nav> 2 <nav hasHome>订座详情</nav>
3 <view class="page"> 3 <view class="page">
4 <view class="flex-vc success"> 4 <view class="flex-vc success">
5 - <block wx:if="{{detail.hasOvered}}">  
6 - <view class="title Medium">已结束</view> 5 + <block wx:if="{{detail.hasCancel}}">
  6 + <view class="icon">
  7 + <icon type="info" size="47" color="#C9C9C9"/>
  8 + </view>
  9 + <view class="title Medium">订座已取消</view>
  10 + </block>
  11 + <block wx:elif="{{detail.hasOvered}}">
  12 + <view class="icon">
  13 + <icon type="success" size="47" color="#C8B16D"/>
  14 + </view>
  15 + <view class="title Medium">订座已完成</view>
7 </block> 16 </block>
8 <block wx:else=""> 17 <block wx:else="">
9 <view class="icon"> 18 <view class="icon">
@@ -13,26 +22,42 @@ @@ -13,26 +22,42 @@
13 <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view> 22 <view class="info">分享订座信息给朋友,及时获知朋友们的反馈</view>
14 </block> 23 </block>
15 </view> 24 </view>
16 - <view class="flex-lr share-view">  
17 - <!--  
18 - <userinfo-share wx:if="{{!detail.hasOvered}}"  
19 - binduserinfo="userinfo"  
20 - bindshare="share"  
21 - share="{{detail}}"  
22 - share-act=""  
23 - class="share-but-view">  
24 - <view class="share-but Regular">邀请朋友</view>  
25 - </userinfo-share>  
26 - -->  
27 - <userinfo-share wx:if="{{!detail.hasOvered}}"  
28 - binduserinfo="userinfo"  
29 - bindshare="share"  
30 - share="{{detail}}"  
31 - share-act="invitation"  
32 - class="share-but-view">  
33 - <view class="share-but Regular">发邀请函</view>  
34 - </userinfo-share>  
35 - </view> 25 +
  26 + <block wx:if="{{!detail.hasOvered && !detail.hasCancel}}">
  27 + <view class="flex-lr share-view" >
  28 + <userinfo-share
  29 + binduserinfo="userinfo"
  30 + bindshare="share"
  31 + share="{{detail}}"
  32 + share-act="invitation"
  33 + class="share-but-view">
  34 + <view class="share-but Regular">发邀请函</view>
  35 + </userinfo-share>
  36 + </view>
  37 + <view class="flex-lr share-view-cookbook" >
  38 + <userinfo
  39 + binduserinfo="wineGo"
  40 + bindshare="share"
  41 + share="{{detail}}"
  42 + share-act="invitation"
  43 + class="share-but-view">
  44 + <view class="share-but Regular">自带酒水</view>
  45 + </userinfo>
  46 + <userinfo
  47 + binduserinfo="cookbook"
  48 + bindshare="share"
  49 + share="{{detail}}"
  50 + share-act="invitation"
  51 + class="share-but-view">
  52 + <view class="share-but Regular flex-cc" wx:if="{{detail.order && detail.order.cookbooklist.length>0}}">
  53 + <view>查看菜品</view>
  54 + <image class="order-cook" src="http://qn.colorcun.com/custom/lite-yd-cook/image/order-cook.png"></image>
  55 + </view>
  56 + <view class="share-but Regular" wx:else="">提前点餐</view>
  57 + </userinfo>
  58 + </view>
  59 + </block>
  60 +
36 <view style="height: 40rpx;"></view> 61 <view style="height: 40rpx;"></view>
37 <card seller="{{detail.seller}}" detail="{{detail}}"></card> 62 <card seller="{{detail.seller}}" detail="{{detail}}"></card>
38 <view class="detail-info Medium" style="margin-top: 56rpx;"> 63 <view class="detail-info Medium" style="margin-top: 56rpx;">
@@ -58,7 +83,7 @@ @@ -58,7 +83,7 @@
58 </view> 83 </view>
59 </view> 84 </view>
60 <view class="hr" style="margin-top: 52rpx;margin-bottom: 48rpx;"></view> 85 <view class="hr" style="margin-top: 52rpx;margin-bottom: 48rpx;"></view>
61 - <navigator url="./detail_owner_part?id={{detail.id}}" hover-class="navigator-hover" wx:if="{{detail.customers.length>0}}"> 86 + <formids url="./detail_owner_part?id={{detail.id}}" hover-class="navigator-hover" wx:if="{{detail.customers.length>0}}">
62 <view class="flex-lr customers_view"> 87 <view class="flex-lr customers_view">
63 <view class="customers flex-ll"> 88 <view class="customers flex-ll">
64 <block wx:for="{{detail.customers}}" wx:key="detail.customers.key"> 89 <block wx:for="{{detail.customers}}" wx:key="detail.customers.key">
@@ -68,7 +93,7 @@ @@ -68,7 +93,7 @@
68 </view> 93 </view>
69 <image src="http://qn.colorcun.com/custom/lite-yd/image/click.png" class="more"></image> 94 <image src="http://qn.colorcun.com/custom/lite-yd/image/click.png" class="more"></image>
70 </view> 95 </view>
71 - </navigator> 96 + </formids>
72 <view class="detail-info Medium"> 97 <view class="detail-info Medium">
73 <view class="flex-lr"> 98 <view class="flex-lr">
74 <view>退订政策</view> 99 <view>退订政策</view>
@@ -79,4 +104,4 @@ @@ -79,4 +104,4 @@
79 </view> 104 </view>
80 <view style="height: 50rpx;"></view> 105 <view style="height: 50rpx;"></view>
81 </view> 106 </view>
82 -<manager manager="{{detail}}" id="manager"></manager> 107 +<manager manager="{{detail}}" id="manager"></manager>
@@ -43,9 +43,22 @@ @@ -43,9 +43,22 @@
43 width: 100%; 43 width: 100%;
44 background-color: #262628; 44 background-color: #262628;
45 } 45 }
  46 +.share-view-cookbook:last-child{
  47 + border-width: 0;
  48 +}
  49 +.share-view-cookbook{
  50 + margin-top: 58rpx;
  51 + margin-bottom: 20rpx;
  52 + height:80rpx;
  53 + line-height: 80rpx;
  54 + font-size: 34rpx;
  55 + border:2rpx solid #262628;
  56 + color:#262628;
  57 + width: 100%;
  58 +}
46 .share-but{ 59 .share-but{
47 width: 100%; 60 width: 100%;
48 - 61 + text-align: center;
49 } 62 }
50 63
51 .seller{ 64 .seller{
@@ -107,4 +120,9 @@ @@ -107,4 +120,9 @@
107 .more{ 120 .more{
108 width: 14rpx; 121 width: 14rpx;
109 height: 26rpx; 122 height: 26rpx;
  123 +}
  124 +.order-cook{
  125 + width: 44rpx;
  126 + height: 30rpx;
  127 + margin-left: 10rpx;
110 } 128 }
  1 +// pages/customer/detail_owner.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +Page({
  6 +
  7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + detail:null,
  12 + invite_name:''
  13 + },
  14 + id:null,
  15 + /**
  16 + * 生命周期函数--监听页面加载
  17 + */
  18 + onLoad: function (options) {
  19 + this.id=options.id;
  20 + let invite_names=wx.getStorageSync('invite_names') ||{};
  21 + let invite_name=invite_names[options.id];
  22 + if(invite_name){
  23 + this.setData({
  24 + invite_name:invite_name
  25 + })
  26 + }
  27 + },
  28 +
  29 + /**
  30 + * 生命周期函数--监听页面初次渲染完成
  31 + */
  32 + onReady: function () {
  33 +
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面显示
  38 + */
  39 + onShow: function () {
  40 + this.getDetail();
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面隐藏
  45 + */
  46 + onHide: function () {
  47 +
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面卸载
  52 + */
  53 + onUnload: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 用户点击右上角分享
  59 + */
  60 + onShareAppMessage: function () {
  61 + return this.shareSetting();
  62 + },
  63 + getDetail(fouce=false){
  64 + App.Reserve.Detail({
  65 + openid: getApp().openid,
  66 + rid: this.id
  67 + },fouce).then(res => {
  68 + this.setData({
  69 + detail:this.formatDatail(res.data)
  70 + })
  71 + })
  72 + },
  73 + formatDatail(detail){
  74 + detail.rdateStr=util.unixtoTime(detail.ddate,'YYYY/MM/DD 星期WW HH:II');
  75 + detail.tableFirst=detail.tables[0].name;
  76 + if(detail.tables.length>1){
  77 + detail.tableSubInfo='等'+(detail.tables.length)+'个'
  78 + +(detail.tables[0].tid==2?'包间':'');
  79 + }
  80 + if(detail.sex!=3){
  81 + detail.rnameStr=detail.rname.substr(0,1)+(detail.sex==1?'先生':'女士')
  82 + }else{
  83 + detail.rnameStr=detail.rname
  84 + }
  85 + detail.eatStr='邀请您共进晚餐';
  86 + let hi=util.unixtoTime(detail.ddate,'HHII');
  87 + if(hi<'10:00'){
  88 + detail.eatStr='邀请您共进早餐';
  89 + }else if(hi<'15:00'){
  90 + detail.eatStr='邀请您共进午餐';
  91 + }
  92 +
  93 + // if(!detail.cusman){
  94 + // detail.cusman='vking';
  95 + // detail.cusman_phone='15877556369';
  96 + // detail.cusman_account='wx:vking';
  97 + // }
  98 + detail.hasCanSuccess=false;
  99 + if(detail.customers && detail.customers.length>0){
  100 + let openid=getApp().openid;
  101 + detail.customers.forEach(item=>{
  102 + if(openid==item.openid){
  103 + detail.hasCanSuccess=true;
  104 + detail.remindtime=item.remind_date;
  105 + return true;
  106 + }
  107 + })
  108 + }
  109 + return detail;
  110 + },
  111 + showManager(){
  112 + if(this.data.detail.cusman_phone || this.data.detail.cusman_account){
  113 + this.selectComponent('#manager').show();
  114 + }
  115 +
  116 + },
  117 + lookLocation:function(){
  118 + wx.openLocation({
  119 + latitude:Number(this.data.detail.seller.lat),
  120 + longitude:Number(this.data.detail.seller.long),
  121 + scale:17,
  122 + address:this.data.detail.seller.map_address,
  123 + success:function (res) {
  124 + console.log(res)
  125 + }
  126 + })
  127 + },
  128 + userinfo(){
  129 + if(!this.data.detail.hasCanSuccess){
  130 + let userInfo=util.cache('userInfo');
  131 + if(userInfo){
  132 + userInfo=JSON.stringify({
  133 + openid: getApp().openid,
  134 + avatar: userInfo.avatarUrl,
  135 + nickname: userInfo.nickName,
  136 + gender: userInfo.gender
  137 + })
  138 + }
  139 + App.Reserve.SetRelaSuccess({
  140 + rid:this.id,
  141 + openid:getApp().openid,
  142 + is_agree:1,
  143 + userinfo:userInfo
  144 + }).then(res=>{
  145 + App.Reserve.Detail({
  146 + openid: getApp().openid,
  147 + rid: this.id
  148 + },'clear')
  149 + wx.navigateTo({
  150 + //id={{detail.id}}&rdate={{detail.rdate}}
  151 + url:'remind?id='+this.id+'&rdate='+this.data.detail.rdate,
  152 + });
  153 + })
  154 + }else{
  155 + // wx.navigateTo({
  156 + // url:'invite?id='+this.id,
  157 + // });
  158 + }
  159 + },
  160 + setUserInfoSuccess(){
  161 + util.toast('授权成功,可以继续转发','none');
  162 + },
  163 + toast(){
  164 + util.toast('本区域暂无配送人员','none');
  165 + },
  166 + reserveCancel(){
  167 + let userInfo = util.cache('userInfo');
  168 + if (userInfo) {
  169 + userInfo = JSON.stringify({
  170 + openid: getApp().openid,
  171 + avatar: userInfo.avatarUrl,
  172 + nickname: userInfo.nickName,
  173 + gender: userInfo.gender
  174 + })
  175 + }
  176 + App.Reserve.SetRelaSuccess({
  177 + rid: this.id,
  178 + openid: getApp().openid,
  179 + cancel: 'cancel',
  180 + is_agree: 0,
  181 + userinfo: userInfo
  182 + }).then(res => {
  183 + this.getDetail(true);
  184 + })
  185 + },
  186 + shareSetting(){
  187 + console.log('this.topicVal',this.topicVal)
  188 + if(this.topicVal && this.data.detail.openid==getApp().openid){
  189 + App.Reserve.SetTopicFromShare({
  190 + rid:this.id,
  191 + topic:this.topicVal
  192 + })
  193 + }
  194 + let nickname="";
  195 + try{
  196 + nickname=util.cache('userInfo').nickName;
  197 + }catch(e){}
  198 + return {
  199 + //title: (nickname||'')+'给你发了一个邀请,点击查看',
  200 + title: '你收到一个邀请函,点击查看',
  201 + path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1',
  202 + imageUrl:util.cgi('App.Reserve.MakePic&rid=')+this.id,
  203 + }
  204 + },
  205 + cookbook(){
  206 + if(this.data.detail.order && this.data.detail.order.cookbooklist.length>0){
  207 + wx.navigateTo({
  208 + url:util.http_build_query({rid:this.id,oid:this.data.detail.order.id,identity:1},'/pack-cookbook/pages/success')
  209 + });
  210 + }else{
  211 + App.Advance.CreateOrder({
  212 + rid:this.id,
  213 + }).then(res=>{
  214 + if(res.ret!=200){
  215 + return util.toast(res.msg,'none')
  216 + }
  217 + wx.navigateTo({
  218 + url:util.http_build_query({rid:this.id,oid:res.data.id,identity:1,sid:res.data.sellerid},'/pack-cookbook/pages/index')
  219 + });
  220 + })
  221 + }
  222 +
  223 + },
  224 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "light",
  4 + "navigationBarTitleText":"订座详情",
  5 + "usingComponents": {
  6 + "userinfo": "/components/userinfo/userinfo",
  7 + "nav":"/components/nav/nav",
  8 + "formids":"/components/formids/formids",
  9 + "userinfo-share": "/components/userinfo/share"
  10 + }
  11 +}
  1 +<!--pages/customer/detail_owner.wxml-->
  2 +<nav hasHome backgroundColor="rgba(0,0,0,0)" color="#ffffff"></nav>
  3 +<view class="page">
  4 + <view class="flex-vc" style="position: relative;">
  5 + <view class="invit-logo">
  6 + <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-1.png"></image>
  7 + </view>
  8 + <view class="seller flex-vc">
  9 + <view class="title">餐厅</view>
  10 + <view class="content name">{{detail.seller.sellername}}</view>
  11 + <view class="title">包间</view>
  12 + <view class="content">{{detail.tableFirst}}{{detail.tableSubInfo}}</view>
  13 + <view class="title">时间</view>
  14 + <view class="content">{{detail.rdateStr}}</view>
  15 + </view>
  16 + </view>
  17 + <view class="opt-button">
  18 + <view class="opt flex-cc">
  19 + <userinfo class="button-none flex-vc" binduserinfo="toast">
  20 + <image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-2.png"></image>
  21 + </userinfo>
  22 + <formids class="button-none flex-vc" bindclick="cookbook">
  23 + <image class="buts" src="http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-3.png"></image>
  24 + </formids>
  25 + </view>
  26 + </view>
  27 +</view>
  28 +<view class="opt-view flex-vc">
  29 + <view class="opt-view-tip">发邀请函给朋友,获知朋友反馈</view>
  30 + <userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess">
  31 + <view class="buts-share"></view>
  32 + </userinfo-share>
  33 +</view>
  1 +/* pages/customer/detail_customer.wxss */
  2 +.page{
  3 + color:#FFFFFF;
  4 + background: url("http://qn.colorcun.com/custom/lite-yd/image/invit-bg.png") #353334;
  5 + background-size: 100%;
  6 + overflow-y: auto;
  7 + position: fixed;
  8 + top:0;
  9 + bottom: 0;
  10 + left:0;
  11 + right:0;
  12 +}
  13 +image{
  14 + width: 100%;
  15 + height: 100%;
  16 +}
  17 +.invit-logo{
  18 + width: 400rpx;
  19 + height: 170rpx;
  20 + margin-top: 156rpx;
  21 +}
  22 +.avatar{
  23 + width: 88rpx;
  24 + height: 88rpx;
  25 + border-radius: 50%;
  26 + margin-top: 50rpx;
  27 + margin-bottom: 22rpx;
  28 + overflow: hidden;
  29 +}
  30 +.invit{
  31 + font-size: 26rpx;
  32 + color:#FDFCFD;
  33 +}
  34 +.hr-one{
  35 + margin-top: 50rpx;
  36 + margin-bottom: 54rpx;
  37 + height: 2rpx;
  38 + background-color: #999999;
  39 + width: 90%;
  40 +}
  41 +.seller{
  42 + margin-top: 80rpx;
  43 +}
  44 +.seller .title{
  45 + font-size: 28rpx;
  46 + color:#999999;
  47 + margin-bottom: 18rpx;
  48 + height: 40rpx;
  49 + line-height: 40rpx;
  50 +}
  51 +.seller .content{
  52 + margin-bottom: 40rpx;
  53 + font-size: 36rpx;
  54 + line-height: 50rpx;
  55 + height: 50rpx;
  56 +}
  57 +.invit-addr{
  58 + width: 20rpx;
  59 + height: 20rpx;
  60 + margin-right: 18rpx;
  61 +}
  62 +.opt-button{
  63 + margin-top: 100rpx;
  64 + width: 100%;
  65 +}
  66 +
  67 +.opt-view{
  68 + position: fixed;
  69 + bottom: 100rpx;
  70 + width: 100%;
  71 +}
  72 +.opt{
  73 + width: 90%;
  74 + margin: 0 auto;
  75 +}
  76 +
  77 +.opt .buts{
  78 + width: 288rpx;
  79 + height: 80rpx;
  80 +}
  81 +.buts-share{
  82 + width: 560rpx;
  83 + height: 86rpx;
  84 + margin: 0 auto;
  85 + background-image: url("http://qn.colorcun.com/custom/lite-yd-cook/image/detail_owner_invitation-5.png");
  86 + background-size: 100%;
  87 + background-repeat: no-repeat;
  88 + background-position: center center;
  89 + animation-name: butAnimation;
  90 + animation-duration: 0.7s;
  91 + animation-iteration-count:9999;
  92 +}
  93 +.opt-view-tip{
  94 + font-size: 26rpx;
  95 + color: #999999;
  96 + margin-bottom: 20rpx;
  97 +}
  98 +@keyframes butAnimation
  99 +{
  100 + 50% {background-size:90%;}
  101 +}
  102 +@-webkit-keyframes butAnimation /* Safari 和 Chrome */
  103 +{
  104 + 50% {background-size:90%;}
  105 +}
1 // pages/customer/index.js 1 // pages/customer/index.js
  2 +var mta=require('mta-wechat-analysis')
2 import App from '../../utils/api'; 3 import App from '../../utils/api';
3 import util from '../../utils/util' 4 import util from '../../utils/util'
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
@@ -7,7 +8,9 @@ Page({ @@ -7,7 +8,9 @@ Page({
7 /** 8 /**
8 * 页面的初始数据 9 * 页面的初始数据
9 */ 10 */
10 - data: {}, 11 + data: {
  12 + loadHidden:false,
  13 + },
11 14
12 /** 15 /**
13 * 生命周期函数--监听页面加载 16 * 生命周期函数--监听页面加载
@@ -15,7 +18,7 @@ Page({ @@ -15,7 +18,7 @@ Page({
15 islove:'',//用户在哪端 18 islove:'',//用户在哪端
16 enter_params:'',//商户入口参数 19 enter_params:'',//商户入口参数
17 async onLoad(opt) { 20 async onLoad(opt) {
18 - console.log('onLoad', opt); 21 + console.log('onLoad', opt,mta);
19 //转化场景值到opt 22 //转化场景值到opt
20 this.selectComponent("#network").debug(opt, 'opt'); 23 this.selectComponent("#network").debug(opt, 'opt');
21 if (opt.scene) {//扫码进入 24 if (opt.scene) {//扫码进入
@@ -26,7 +29,14 @@ Page({ @@ -26,7 +29,14 @@ Page({
26 }) 29 })
27 this.selectComponent("#network").debug(opt, 'scene'); 30 this.selectComponent("#network").debug(opt, 'scene');
28 } 31 }
29 - 32 + mta.Page.init({
  33 + "appID":"500667280",
  34 + "eventID":"500667287",
  35 + "statPullDownFresh":true,
  36 + "statShareApp":true,
  37 + "statReachBottom":true,
  38 + "lauchOpts":opt, //渠道分析
  39 + });
30 opt.openid = await this.getOpenid(); 40 opt.openid = await this.getOpenid();
31 if (!opt.openid) { 41 if (!opt.openid) {
32 console.log('App.Orders.CheckOrder no openid'); 42 console.log('App.Orders.CheckOrder no openid');
@@ -65,7 +75,7 @@ Page({ @@ -65,7 +75,7 @@ Page({
65 App.Reserve.Detail(param).then(res => { 75 App.Reserve.Detail(param).then(res => {
66 console.log(this.enter_params.seller_openid) 76 console.log(this.enter_params.seller_openid)
67 if(this.enter_params){//商户 77 if(this.enter_params){//商户
68 - if(res.data.sid==this.enter_params.seller_id && !opt.fromid){//不是客户端分享,且是同一个店的 78 + if(res.data.sid==this.enter_params.seller_id && opt.hasSellerShare==1){//不是客户端分享,且是同一个店的
69 util.cache('enter_params',this.enter_params) 79 util.cache('enter_params',this.enter_params)
70 url = '/pages/book/b_detail'; 80 url = '/pages/book/b_detail';
71 } 81 }
@@ -79,6 +89,9 @@ Page({ @@ -79,6 +89,9 @@ Page({
79 }) 89 })
80 if (!res.data.openid) {//无预订人 90 if (!res.data.openid) {//无预订人
81 url = '/pages/customer/detail_owner'; 91 url = '/pages/customer/detail_owner';
  92 + if(opt.hasInvitation==1){
  93 + url = '/pages/customer/detail_owner_invitation';
  94 + }
82 } else { 95 } else {
83 url = '/pages/customer/detail_customer'; 96 url = '/pages/customer/detail_customer';
84 if(opt.hasInvitation==1){ 97 if(opt.hasInvitation==1){
@@ -86,6 +99,9 @@ Page({ @@ -86,6 +99,9 @@ Page({
86 } 99 }
87 if (res.data.openid == opt.openid) { 100 if (res.data.openid == opt.openid) {
88 url = '/pages/customer/detail_owner'; 101 url = '/pages/customer/detail_owner';
  102 + if(opt.hasInvitation==1){
  103 + url = '/pages/customer/detail_owner_invitation';
  104 + }
89 } 105 }
90 } 106 }
91 } 107 }
@@ -185,5 +201,14 @@ Page({ @@ -185,5 +201,14 @@ Page({
185 // return true 201 // return true
186 // } 202 // }
187 return false 203 return false
188 - } 204 + },
  205 + networkEvent(e){
  206 + console.log('networkEvent',e.detail);
  207 + if(!e.detail.hasWork){
  208 + this.setData({
  209 + loadHidden:true,
  210 + })
  211 + }
  212 +
  213 + },
189 }) 214 })
1 <view class="page"> 1 <view class="page">
2 - <loading>数据加载中</loading> 2 + <loading hidden="{{loadHidden}}">数据加载中</loading>
3 </view> 3 </view>
4 -<network id="network"></network>  
  4 +<network id="network" bindnetwork="networkEvent"></network>
@@ -133,7 +133,11 @@ Page({ @@ -133,7 +133,11 @@ Page({
133 openid:getApp().openid, 133 openid:getApp().openid,
134 is_agree:1, 134 is_agree:1,
135 }).then(res=>{ 135 }).then(res=>{
136 - this.getListData(true); 136 + App.Reserve.Detail({
  137 + openid: getApp().openid,
  138 + rid: id
  139 + },'clear')
  140 + this.getListData(true);
137 }) 141 })
138 } 142 }
139 }) 143 })
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 <card hasListShare 51 <card hasListShare
52 seller="{{detail.seller}}" detail="{{detail}}"> 52 seller="{{detail.seller}}" detail="{{detail}}">
53 <view slot="listshare"> 53 <view slot="listshare">
54 - <userinfo 54 + <userinfo wx:if="{{detail.status}}"
55 id="userinfo-share-{{detail.id}}" 55 id="userinfo-share-{{detail.id}}"
56 data-id="{{detail.id}}" 56 data-id="{{detail.id}}"
57 binduserinfo="accept"> 57 binduserinfo="accept">
@@ -20,7 +20,7 @@ Page({ @@ -20,7 +20,7 @@ Page({
20 }, 20 },
21 remind_date:0, 21 remind_date:0,
22 id:null, 22 id:null,
23 - rdate:0, 23 + ddate:0,
24 24
25 /** 25 /**
26 * 生命周期函数--监听页面加载 26 * 生命周期函数--监听页面加载
@@ -28,15 +28,19 @@ Page({ @@ -28,15 +28,19 @@ Page({
28 onLoad: function (options) { 28 onLoad: function (options) {
29 console.log('onLoad',options); 29 console.log('onLoad',options);
30 this.id=options.id; 30 this.id=options.id;
31 - this.rdate=options.rdate;  
32 - if(new Date()/1000+1800>options.rdate){ 31 + this.ddate=options.ddate;
  32 + if(options.remindtime=='NaN'){
  33 + options.remindtime=0;
  34 + }
  35 + this.remind_date=options.remindtime;
  36 + if(new Date()/1000+1800>parseInt(options.ddate)){
33 this.setData({ 37 this.setData({
34 reminds:[{val:0,label:'不提醒'}] 38 reminds:[{val:0,label:'不提醒'}]
35 }) 39 })
36 }else{ 40 }else{
37 - if(options.remindtime>0){ 41 + if(parseInt(options.remindtime)>0){
38 this.setData({ 42 this.setData({
39 - remindtime:(options.rdate-options.remindtime)/60 43 + remindtime:(parseInt(options.ddate)-parseInt(options.remindtime))/60
40 }) 44 })
41 } 45 }
42 } 46 }
@@ -75,7 +79,7 @@ Page({ @@ -75,7 +79,7 @@ Page({
75 console.log(val); 79 console.log(val);
76 this.remind_date=0; 80 this.remind_date=0;
77 if(val>0){ 81 if(val>0){
78 - this.remind_date=parseInt(this.rdate)-parseInt(val*60); 82 + this.remind_date=parseInt(this.ddate)-parseInt(val*60);
79 } 83 }
80 }, 84 },
81 remind(){ 85 remind(){
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 "es6": true, 5 "es6": true,
6 "postcss": true, 6 "postcss": true,
7 "minified": true, 7 "minified": true,
8 - "newFeature": true 8 + "newFeature": true,
  9 + "nodeModules": true
9 }, 10 },
10 "compileType": "miniprogram", 11 "compileType": "miniprogram",
11 "libVersion": "2.4.2", 12 "libVersion": "2.4.2",
@@ -30,7 +31,7 @@ @@ -30,7 +31,7 @@
30 "list": [] 31 "list": []
31 }, 32 },
32 "miniprogram": { 33 "miniprogram": {
33 - "current": 6, 34 + "current": 37,
34 "list": [ 35 "list": [
35 { 36 {
36 "id": 0, 37 "id": 0,
@@ -73,7 +74,7 @@ @@ -73,7 +74,7 @@
73 "id": 6, 74 "id": 6,
74 "name": "pages/customer/index", 75 "name": "pages/customer/index",
75 "pathName": "pages/customer/index", 76 "pathName": "pages/customer/index",
76 - "query": "id=1196&fromid=1111&hasInvitation=1", 77 + "query": "id=1762&fromid=1111&hasInvitation=1",
77 "scene": "1044", 78 "scene": "1044",
78 "shareInfo": { 79 "shareInfo": {
79 "groupName": "测试模拟群1", 80 "groupName": "测试模拟群1",
@@ -155,7 +156,8 @@ @@ -155,7 +156,8 @@
155 "id": 15, 156 "id": 15,
156 "name": "预定本详情", 157 "name": "预定本详情",
157 "pathName": "pages/book/b_detail", 158 "pathName": "pages/book/b_detail",
158 - "query": "id=74" 159 + "query": "id=1762",
  160 + "scene": "1001"
159 }, 161 },
160 { 162 {
161 "id": -1, 163 "id": -1,
@@ -224,10 +226,11 @@ @@ -224,10 +226,11 @@
224 "scene": "1001" 226 "scene": "1001"
225 }, 227 },
226 { 228 {
227 - "id": -1, 229 + "id": 25,
228 "name": "pack-cookbook/pages/index", 230 "name": "pack-cookbook/pages/index",
229 "pathName": "pack-cookbook/pages/index", 231 "pathName": "pack-cookbook/pages/index",
230 - "query": "" 232 + "query": "rid=1196&oid=1&identity=1&sid=80",
  233 + "scene": "1001"
231 }, 234 },
232 { 235 {
233 "id": 26, 236 "id": 26,
@@ -274,6 +277,50 @@ @@ -274,6 +277,50 @@
274 "pathName": "pages/reserve/index", 277 "pathName": "pages/reserve/index",
275 "query": "", 278 "query": "",
276 "scene": "1001" 279 "scene": "1001"
  280 + },
  281 + {
  282 + "id": -1,
  283 + "name": "我的客户 pages/book/crm/index ",
  284 + "pathName": "pages/book/crm/index",
  285 + "query": "",
  286 + "scene": "1044",
  287 + "shareInfo": {
  288 + "groupName": "测试模拟群1",
  289 + "shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
  290 + "shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
  291 + }
  292 + },
  293 + {
  294 + "id": 34,
  295 + "name": "pack-cookbook/pages/cart",
  296 + "pathName": "pack-cookbook/pages/cart",
  297 + "query": "rid=1196&oid=2&identity=1",
  298 + "scene": "1001"
  299 + },
  300 + {
  301 + "id": 35,
  302 + "name": "pack-cookbook/pages/success",
  303 + "pathName": "pack-cookbook/pages/success",
  304 + "query": "rid=1196&oid=1&identity=1&hasSuccess=1",
  305 + "scene": "1001"
  306 + },
  307 + {
  308 + "id": -1,
  309 + "name": "pack-cookbook/pages/remark",
  310 + "pathName": "pack-cookbook/pages/remark",
  311 + "query": ""
  312 + },
  313 + {
  314 + "id": -1,
  315 + "name": "pages/customer/index 1803 iphone动画",
  316 + "pathName": "pages/customer/detail_owner_invitation",
  317 + "query": "id=1803&fromid=1111&hasInvitation=1",
  318 + "scene": "1044",
  319 + "shareInfo": {
  320 + "groupName": "测试模拟群1",
  321 + "shareName": "8DEbIRpK4pa9mH_QY2vU4ZUKYPuI97WoQ4BQoFej-Q8@cr4dev",
  322 + "shareKey": "PZhnqMlY2TnRuHhATyGeSamVmBQUDXXr_WtjRSddeeFK17UAiOP-HNOdhxiEN7PFub5S1DjAeUl0IXOdW-VDqg~~"
  323 + }
277 } 324 }
278 ] 325 ]
279 } 326 }
@@ -39,15 +39,12 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0, @@ -39,15 +39,12 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
39 } 39 }
40 if(!fouce && cachetime!=0){//优先使用缓存 40 if(!fouce && cachetime!=0){//优先使用缓存
41 let getCache= cache(cache_key); 41 let getCache= cache(cache_key);
  42 + //console.log('getCache.'+getCache,cache_key);
42 if(getCache!=-99999){ 43 if(getCache!=-99999){
43 return new Promise((success,fail)=>{ 44 return new Promise((success,fail)=>{
44 - if(true){  
45 - getCache.isCache=true;  
46 - console.log(cache_key+'\nuse cache',getCache);  
47 - success(getCache);  
48 - }else{  
49 - fail();  
50 - } 45 + getCache.isCache=true;
  46 + console.log(cache_key+'\nuse cache',getCache);
  47 + success(getCache);
51 }) 48 })
52 } 49 }
53 } 50 }
@@ -78,7 +75,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0, @@ -78,7 +75,7 @@ function rpc(host='',act,data={},fouce=false,header={},silence=true,cachetime=0,
78 console.log('request.api==>',host+cache_key+'\nrequest.success',res.data); 75 console.log('request.api==>',host+cache_key+'\nrequest.success',res.data);
79 // return; 76 // return;
80 if(res.data){ 77 if(res.data){
81 - if(cachetime!=0 && res.data.ret==200 && res.data.data){ 78 + if(cachetime!=0 && res.data.ret==200){
82 cache(cache_key,res.data,cachetime);//.then().catch(); 79 cache(cache_key,res.data,cachetime);//.then().catch();
83 } 80 }
84 if(res.data.ret!==200){ 81 if(res.data.ret!==200){
@@ -166,7 +163,7 @@ function cache(key,val=-99999,timeout=-1){ @@ -166,7 +163,7 @@ function cache(key,val=-99999,timeout=-1){
166 } 163 }
167 let res=wx.getStorageSync(key); 164 let res=wx.getStorageSync(key);
168 let time=Date.parse(new Date())/1000; 165 let time=Date.parse(new Date())/1000;
169 - if(res && (res.timeout==-1 || res.timeout>time) && res.data.data){ 166 + if(res && (res.timeout==-1 || res.timeout>time) && res.data){
170 return res.data; 167 return res.data;
171 }else{ 168 }else{
172 return -99999 169 return -99999
@@ -10,7 +10,7 @@ export default { @@ -10,7 +10,7 @@ export default {
10 10
11 //预定信息详情 11 //预定信息详情
12 'App.Reserve.Detail': { 12 'App.Reserve.Detail': {
13 - cachetime: 60, 13 + cachetime: 30,
14 }, 14 },
15 15
16 //建立预定关系 16 //建立预定关系
@@ -28,7 +28,7 @@ export default { @@ -28,7 +28,7 @@ export default {
28 28
29 //列表----我的日程 29 //列表----我的日程
30 'App.Reserve.GetListFromScheAndRes': { 30 'App.Reserve.GetListFromScheAndRes': {
31 - cachetime: 30, 31 + //cachetime: 30,
32 }, 32 },
33 33
34 //订座详情页面----我愿意 34 //订座详情页面----我愿意
@@ -118,16 +118,30 @@ export default { @@ -118,16 +118,30 @@ export default {
118 }, 118 },
119 119
120 /**提前点餐**/ 120 /**提前点餐**/
  121 + 'App.Advance.CreateOrder':{
  122 + //silence: false,
  123 + },
121 //菜品列表 124 //菜品列表
122 - 'App.Cookbook.GetCookbookByClass': null, 125 + 'App.Advance.GetCookbookByClass': null,
123 //菜品规格 126 //菜品规格
124 - 'App.Cookbook.GetCookbookSelBySpecsId': null, 127 + 'App.Advance.GetCookbookSelBySpecsId': null,
125 //添加到购物车 128 //添加到购物车
126 - 'App.Orders.AddCart': null, 129 + 'App.Advance.AddCart': null,
127 //减菜 130 //减菜
128 - 'App.Orders.ReduceOrder': null, 131 + 'App.Advance.ReduceOrder': null,
  132 + //设置人数,设置备注
  133 + 'App.Advance.SetOrderById':null,
129 //清空购物车 134 //清空购物车
130 - 'App.Orders.ClearCookById': null,  
131 - //购物车  
132 - 'App.Orders.GetOrderById': null, 135 + 'App.Advance.RemoveCart': {
  136 + silence: false,
  137 + },
  138 + //菜品备注tags
  139 + 'App.Advance.GetRemarkBySellerid':{
  140 + cachetime: 300,
  141 + },
  142 + //下单
  143 + 'App.Advance.PlaceOrder':null,
  144 +
  145 + /**crm**/
  146 + 'App.Reserve.Members':null,
133 } 147 }
1 -//application id got from MTAMTA analysis  
2 -var MTA_APP_ID = ''; //常规统计id  
3 -var MTA_EVENT_ID = ''; //自定义事件id  
4 -//data report remote address  
5 -var MTA_API_BASE = 'https://pingtas.qq.com/pingd';  
6 -//MTA wechat apps analysis storage key prefix  
7 -var MTA_VAR_PREFIX = '_mta_';  
8 -  
9 -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){}}  
10 -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)}}  
11 -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"}}  
12 -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=[],  
13 -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()})}}};  
1 //正式 1 //正式
2 var uri={ 2 var uri={
3 3
4 - HOST__LINE:'https://xt05.colorcun.com/?s=', 4 + HOST__LINE:'https://xt04.colorcun.com/?s=',
5 5
6 //获取商家信息 6 //获取商家信息
7 CGI__USER_GETSELLERBYID: 'App.Seller.GetSellerById', 7 CGI__USER_GETSELLERBYID: 'App.Seller.GetSellerById',
@@ -440,7 +440,8 @@ module.exports = { @@ -440,7 +440,8 @@ module.exports = {
440 html=html.replace(/&quot;/ig,''); 440 html=html.replace(/&quot;/ig,'');
441 return html; 441 return html;
442 }, 442 },
443 - val:function(e){ 443 + val:function(e,key=''){
  444 + if(key!='') return e.detail.value[key]||'';
444 return e.detail.value; 445 return e.detail.value;
445 }, 446 },
446 attr:function(e,key=''){ 447 attr:function(e,key=''){