Commit de6886d0eab26915744c5a43d51369f2d3a68d95

Authored by wangfan
1 parent a6fff603

快速预定

@@ -239,6 +239,7 @@ image{ @@ -239,6 +239,7 @@ 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;
242 } 243 }
243 .mask{ 244 .mask{
244 background-color: rgba(20,20,20,0.5); 245 background-color: rgba(20,20,20,0.5);
1 // pack-cookbook/pages/cart.js 1 // pack-cookbook/pages/cart.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
2 Page({ 5 Page({
3 6
4 - /**  
5 - * 页面的初始数据  
6 - */  
7 - data: {  
8 -  
9 - },  
10 -  
11 - /**  
12 - * 生命周期函数--监听页面加载  
13 - */  
14 - onLoad: function (options) {  
15 -  
16 - },  
17 -  
18 - /**  
19 - * 生命周期函数--监听页面初次渲染完成  
20 - */  
21 - onReady: function () {  
22 -  
23 - },  
24 -  
25 - /**  
26 - * 生命周期函数--监听页面显示  
27 - */  
28 - onShow: function () {  
29 -  
30 - },  
31 -  
32 - /**  
33 - * 生命周期函数--监听页面隐藏  
34 - */  
35 - onHide: function () {  
36 -  
37 - },  
38 -  
39 - /**  
40 - * 生命周期函数--监听页面卸载  
41 - */  
42 - onUnload: function () {  
43 -  
44 - },  
45 -  
46 - /**  
47 - * 页面相关事件处理函数--监听用户下拉动作  
48 - */  
49 - onPullDownRefresh: function () {  
50 -  
51 - },  
52 -  
53 - /**  
54 - * 页面上拉触底事件的处理函数  
55 - */  
56 - onReachBottom: function () {  
57 -  
58 - },  
59 -  
60 - /**  
61 - * 用户点击右上角分享  
62 - */  
63 - onShareAppMessage: function () {  
64 - 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.options.oid,
  76 + pnum:val,
  77 +
  78 + })
65 } 79 }
  80 + },
  81 + gotoRemark(){
  82 + wx.navigateTo({
  83 + url: util.http_build_query({...this.data.order},'./remark')
  84 + })
  85 + },
66 }) 86 })
@@ -4,17 +4,17 @@ @@ -4,17 +4,17 @@
4 </view> 4 </view>
5 <view class="page"> 5 <view class="page">
6 <view class="carts"> 6 <view class="carts">
7 - <view class="block">  
8 - <view class="title">123123</view> 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"> 9 <view class="cart-body">
10 - <view class="cart-item flex-lr" wx:for="{{[1]}}" wx:key="item.key"> 10 + <view class="cart-item flex-lr" wx:for="{{item.list}}" wx:key="item.list.key">
11 <view class="icon"> 11 <view class="icon">
12 - <image src="{{}}"></image> 12 + <image src="{{item.cookimg}}"></image>
13 </view> 13 </view>
14 - <view class="name">范德萨范德萨发{{item}}</view>  
15 - <view class="price">¥125.00/份</view> 14 + <view class="name">{{item.cookname}}</view>
  15 + <view class="price">¥{{item.price}}/{{item.cookunit}}</view>
16 <view class="opt"> 16 <view class="opt">
17 - {{item.num||10}} 17 + {{item.num}}
18 </view> 18 </view>
19 </view> 19 </view>
20 </view> 20 </view>
@@ -22,21 +22,25 @@ @@ -22,21 +22,25 @@
22 </view> 22 </view>
23 </view> 23 </view>
24 <view class="footer"> 24 <view class="footer">
25 - <view class="total">共计:¥88</view> 25 + <view class="total">共计:¥{{order.price}}</view>
26 <view class="infos"> 26 <view class="infos">
27 <view class="flex-lr item"> 27 <view class="flex-lr item">
28 <view>人数:</view> 28 <view>人数:</view>
29 <view> 29 <view>
30 - <input placeholder="请输入人数" type="number"/> 30 + <input placeholder="请输入人数" type="number" value="{{order.pnum||''}}" bindinput="updateOrder"/>
31 </view> 31 </view>
32 </view> 32 </view>
33 - <view class="flex-lr item">  
34 - <view>备注:</view>  
35 - <view class="flex-rr">  
36 - <view class="desc">口味、偏好等要求</view>  
37 - <view class="more"></view> 33 + <formids bindclick="gotoRemark">
  34 + <view class="flex-lr item">
  35 + <view>备注:</view>
  36 + <view class="flex-rr" style="max-width: 80%;">
  37 + <view class="desc">{{order.remark||'口味、偏好等要求'}}</view>
  38 + <view class="more"></view>
  39 + </view>
38 </view> 40 </view>
39 - </view> 41 + </formids>
40 </view> 42 </view>
41 - <view class="submit">确认下单</view> 43 + <formids class="submit">
  44 + <view class="submit">确认下单</view>
  45 + </formids>
42 </view> 46 </view>
@@ -47,6 +47,7 @@ page{ @@ -47,6 +47,7 @@ page{
47 overflow: hidden; 47 overflow: hidden;
48 max-width: 95%; 48 max-width: 95%;
49 color: #999999; 49 color: #999999;
  50 + line-height: 100rpx;
50 } 51 }
51 52
52 .footer .submit{ 53 .footer .submit{
@@ -37,7 +37,8 @@ Page({ @@ -37,7 +37,8 @@ Page({
37 initOrder(){ 37 initOrder(){
38 App.Advance.CreateOrder({ 38 App.Advance.CreateOrder({
39 rid: this.data.options.rid, 39 rid: this.data.options.rid,
40 - identity:this.data.options.identity 40 + identity:this.data.options.identity,
  41 + status:'0,1'
41 }).then(res => { 42 }).then(res => {
42 this.setData({ 43 this.setData({
43 order: res.data, 44 order: res.data,
@@ -98,7 +99,9 @@ Page({ @@ -98,7 +99,9 @@ Page({
98 * 用户点击右上角分享 99 * 用户点击右上角分享
99 */ 100 */
100 onShareAppMessage: function () { 101 onShareAppMessage: function () {
101 - 102 + return {
  103 + title:'邀你一起点菜',
  104 + }
102 }, 105 },
103 formatCookList(list){ 106 formatCookList(list){
104 //原栏目下显示 107 //原栏目下显示
@@ -229,4 +232,13 @@ Page({ @@ -229,4 +232,13 @@ Page({
229 this.initOrder(); 232 this.initOrder();
230 },100) 233 },100)
231 }, 234 },
  235 + gotoCart(){
  236 + if(this.data.order.cookbooklist.length<1){
  237 + return util.toast('请添加菜品','none');
  238 + }
  239 + //购物车
  240 + wx.navigateTo({
  241 + url: util.http_build_query(this.data.options,'./cart')
  242 + })
  243 + },
232 }) 244 })
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
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", 9 "cart":"../components/cart/cart",
10 - "formids":"/components/formids/formids" 10 + "formids":"/components/formids/formids",
  11 + "userinfo":"/components/userinfo/userinfo"
11 } 12 }
12 } 13 }
@@ -29,12 +29,12 @@ @@ -29,12 +29,12 @@
29 </view> 29 </view>
30 </scroll-view> 30 </scroll-view>
31 <view class="white flex-lr bottom-view"> 31 <view class="white flex-lr bottom-view">
32 - <view class="share flex-vc"> 32 + <button class="share flex-vc button-none" open-type="share">
33 <view class="icon"> 33 <view class="icon">
34 <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image> 34 <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/share.png"></image>
35 </view> 35 </view>
36 <view class="text">一起点</view> 36 <view class="text">一起点</view>
37 - </view> 37 + </button>
38 <view class="cart flex-ll" bindtap="dispalyCart"> 38 <view class="cart flex-ll" bindtap="dispalyCart">
39 <view class="icon"> 39 <view class="icon">
40 <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart.png"/> 40 <image src="http://qn.colorcun.com/custom/lite-yd-cook/image/cart.png"/>
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 </view> 42 </view>
43 <view class="text Semibold">¥{{order.price}}</view> 43 <view class="text Semibold">¥{{order.price}}</view>
44 </view> 44 </view>
45 - <view class="place flex-vc">选好了</view> 45 + <userinfo class="place flex-vc" binduserinfo="gotoCart">选好了</userinfo>
46 </view> 46 </view>
47 </view> 47 </view>
48 48
1 // pack-cookbook/pages/remark.js 1 // pack-cookbook/pages/remark.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
2 Page({ 5 Page({
3 6
4 - /**  
5 - * 页面的初始数据  
6 - */  
7 - data: {  
8 -  
9 - },  
10 -  
11 - /**  
12 - * 生命周期函数--监听页面加载  
13 - */  
14 - onLoad: function (options) {  
15 -  
16 - },  
17 -  
18 - /**  
19 - * 生命周期函数--监听页面初次渲染完成  
20 - */  
21 - onReady: function () {  
22 -  
23 - },  
24 -  
25 - /**  
26 - * 生命周期函数--监听页面显示  
27 - */  
28 - onShow: function () {  
29 -  
30 - },  
31 -  
32 - /**  
33 - * 生命周期函数--监听页面隐藏  
34 - */  
35 - onHide: function () {  
36 -  
37 - },  
38 -  
39 - /**  
40 - * 生命周期函数--监听页面卸载  
41 - */  
42 - onUnload: function () {  
43 -  
44 - },  
45 -  
46 - /**  
47 - * 页面相关事件处理函数--监听用户下拉动作  
48 - */  
49 - onPullDownRefresh: function () {  
50 -  
51 - },  
52 -  
53 - /**  
54 - * 页面上拉触底事件的处理函数  
55 - */  
56 - onReachBottom: function () {  
57 -  
58 - },  
59 -  
60 - /**  
61 - * 用户点击右上角分享  
62 - */  
63 - onShareAppMessage: function () {  
64 - 7 + /**
  8 + * 页面的初始数据
  9 + */
  10 + data: {
  11 + tags:[
  12 + {id:11,name:'不要盐'},
  13 + {id:12,name:'不要糖'},
  14 + {id:13,name:'不要辣'},
  15 + {id:14,name:'不要酸'},
  16 + {id:15,name:'不要苦'},
  17 + ],
  18 + remark:'',
  19 + },
  20 +
  21 + /**
  22 + * 生命周期函数--监听页面加载
  23 + */
  24 + orderid:'',
  25 + onLoad: function (options) {
  26 + this.orderid=options.id;
  27 + App.Orders.GetRemarkBySellerid({
  28 + sellerid:options.sellerid,
  29 + }).then(res=>{
  30 + let obj={
  31 + remark:options.remark,
  32 + }
  33 + //obj.tags=res.data;
  34 + if(options.remarkid){
  35 + let remarkid=options.remarkid.split(',')
  36 + res.data.forEach((t)=>{
  37 + if(remarkid._indexOf(t.id)>-1){
  38 + t.active=true
  39 + }
  40 + })
  41 + }
  42 + this.setData(obj)
  43 + })
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面初次渲染完成
  48 + */
  49 + onReady: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 生命周期函数--监听页面显示
  55 + */
  56 + onShow: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 生命周期函数--监听页面隐藏
  62 + */
  63 + onHide: function () {
  64 +
  65 + },
  66 + activeRemark(e){
  67 + let i=util.attr(e,'index');
  68 + let tags=this.data.tags;
  69 + tags[i].active=!tags[i].active;
  70 + console.log(i,tags);
  71 + let remark=this.data.remark;
  72 + remark=remark.replace(tags[i].name+'、','')
  73 + if(tags[i].active){
  74 + remark+=tags[i].name+'、'
  75 + }
  76 + this.setData({
  77 + remark:remark,
  78 + tags:tags,
  79 + })
  80 + },
  81 + inputRemark(e){
  82 + let remark=util.val(e).trim();
  83 + this.setData({
  84 + remark:remark,
  85 + })
  86 + },
  87 + submit(){
  88 + let remarkid=[];
  89 + let tags=this.data.tags;
  90 + tags.forEach(t=>{
  91 + if(t.active)
  92 + remarkid.push(t.id);
  93 + })
  94 + if(!this.data.remark){
  95 + return util.toast('请填写或选择备注信息','none')
65 } 96 }
  97 + App.Advance.SetOrderById({
  98 + orderid:this.orderid,
  99 + remark:this.data.remark,
  100 + remarkid:remarkid.toString(),
  101 + }).then(res=>{
  102 + wx.navigateBack();
  103 + })
  104 + }
66 }) 105 })
1 <!--pack-cookbook/pages/remark.wxml--> 1 <!--pack-cookbook/pages/remark.wxml-->
2 <nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav> 2 <nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">添加备注</nav>
3 <view class="page"> 3 <view class="page">
4 - <textarea class="textarea"></textarea> 4 + <textarea class="textarea" bindinput="inputRemark" value="{{remark}}">
  5 +
  6 + </textarea>
5 <view class="tip">快捷标签</view> 7 <view class="tip">快捷标签</view>
6 <view class="tags flex-ll" style="flex-wrap:wrap;"> 8 <view class="tags flex-ll" style="flex-wrap:wrap;">
7 - <block wx:for="{{[1,2,3,4,5,6,7,8]}}">  
8 - <view class="tag active">大师傅</view> 9 + <block wx:for="{{tags}}" wx:key="tags.key">
  10 + <view class="tag {{item.active?'active':''}}"
  11 + bindtap="activeRemark"
  12 + data-index="{{index}}">{{item.name}}</view>
9 </block> 13 </block>
10 </view> 14 </view>
  15 + <formids bindclick="submit">
11 <view class="submit">保存</view> 16 <view class="submit">保存</view>
  17 + </formids>
12 </view> 18 </view>
1 // pack-cookbook/pages/success.js 1 // pack-cookbook/pages/success.js
2 Page({ 2 Page({
3 3
4 - /**  
5 - * 页面的初始数据  
6 - */  
7 - data: {  
8 -  
9 - },  
10 -  
11 - /**  
12 - * 生命周期函数--监听页面加载  
13 - */  
14 - onLoad: function (options) {  
15 -  
16 - },  
17 -  
18 - /**  
19 - * 生命周期函数--监听页面初次渲染完成  
20 - */  
21 - onReady: function () {  
22 -  
23 - },  
24 -  
25 - /**  
26 - * 生命周期函数--监听页面显示  
27 - */  
28 - onShow: function () {  
29 -  
30 - },  
31 -  
32 - /**  
33 - * 生命周期函数--监听页面隐藏  
34 - */  
35 - onHide: function () {  
36 -  
37 - },  
38 -  
39 - /**  
40 - * 生命周期函数--监听页面卸载  
41 - */  
42 - onUnload: function () {  
43 -  
44 - },  
45 -  
46 - /**  
47 - * 页面相关事件处理函数--监听用户下拉动作  
48 - */  
49 - onPullDownRefresh: function () {  
50 -  
51 - },  
52 -  
53 - /**  
54 - * 页面上拉触底事件的处理函数  
55 - */  
56 - onReachBottom: function () {  
57 -  
58 - },  
59 -  
60 - /**  
61 - * 用户点击右上角分享  
62 - */  
63 - onShareAppMessage: function () {  
64 -  
65 - } 4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + },
  9 +
  10 + /**
  11 + * 生命周期函数--监听页面加载
  12 + */
  13 + onLoad: function (options) {
  14 + this.setData({
  15 + options:options
  16 + })
  17 + this.initOrder()
  18 + },
  19 +
  20 + /**
  21 + * 生命周期函数--监听页面初次渲染完成
  22 + */
  23 + onReady: function () {
  24 +
  25 + },
  26 +
  27 + /**
  28 + * 生命周期函数--监听页面显示
  29 + */
  30 + onShow: function () {
  31 +
  32 + },
  33 +
  34 + /**
  35 + * 生命周期函数--监听页面隐藏
  36 + */
  37 + onHide: function () {
  38 +
  39 + },
  40 +
  41 + /**
  42 + * 生命周期函数--监听页面卸载
  43 + */
  44 + onUnload: function () {
  45 +
  46 + },
  47 +
  48 + /**
  49 + * 页面相关事件处理函数--监听用户下拉动作
  50 + */
  51 + onPullDownRefresh: function () {
  52 +
  53 + },
  54 +
  55 + /**
  56 + * 页面上拉触底事件的处理函数
  57 + */
  58 + onReachBottom: function () {
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 用户点击右上角分享
  64 + */
  65 + onShareAppMessage: function () {
  66 +
  67 + },
  68 +
  69 + initOrder(){
  70 + App.Advance.CreateOrder({
  71 + rid: this.data.options.rid,
  72 + identity:this.data.options.identity
  73 + }).then(res => {
  74 + this.setData({
  75 + order: res.data,
  76 + })
  77 + })
  78 + },
66 }) 79 })
1 <!--pack-cookbook/pages/success.wxml--> 1 <!--pack-cookbook/pages/success.wxml-->
2 <nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">已点菜品</nav> 2 <nav id="nav" hasHome backgroundColor="#ffffff" color="#000000">已点菜品</nav>
3 -<view> 3 +<view wx:if="{{options.hasSuccess==1}}">
4 <view class="pages flex-vc success"> 4 <view class="pages flex-vc success">
5 <view class="icon"> 5 <view class="icon">
6 <icon type="success" size="47" color="#C8B16D"/> 6 <icon type="success" size="47" color="#C8B16D"/>
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 </view> 65 </view>
66 </view> 66 </view>
67 <view style="height: 150rpx;width: 100%;"></view> 67 <view style="height: 150rpx;width: 100%;"></view>
68 -<view class="optx flex-vc"> 68 +<view class="optx flex-vc" wx:if="{{options.hasSuccess!=1}}">
69 <view class="opt-view flex-ll"> 69 <view class="opt-view flex-ll">
70 <view class="but editor">修改菜品</view> 70 <view class="but editor">修改菜品</view>
71 <view class="but share">分享</view> 71 <view class="but share">分享</view>
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 25, 33 + "current": 34,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -289,17 +289,17 @@ @@ -289,17 +289,17 @@
289 } 289 }
290 }, 290 },
291 { 291 {
292 - "id": -1, 292 + "id": 34,
293 "name": "pack-cookbook/pages/cart", 293 "name": "pack-cookbook/pages/cart",
294 "pathName": "pack-cookbook/pages/cart", 294 "pathName": "pack-cookbook/pages/cart",
295 - "query": "", 295 + "query": "rid=1196&oid=2&identity=1",
296 "scene": "1001" 296 "scene": "1001"
297 }, 297 },
298 { 298 {
299 - "id": -1, 299 + "id": 35,
300 "name": "pack-cookbook/pages/success", 300 "name": "pack-cookbook/pages/success",
301 "pathName": "pack-cookbook/pages/success", 301 "pathName": "pack-cookbook/pages/success",
302 - "query": "", 302 + "query": "rid=1196&oid=2&identity=1&hasSuccess=1",
303 "scene": "1001" 303 "scene": "1001"
304 }, 304 },
305 { 305 {
@@ -133,8 +133,10 @@ export default { @@ -133,8 +133,10 @@ export default {
133 'App.Advance.SetOrderById':null, 133 'App.Advance.SetOrderById':null,
134 //清空购物车 134 //清空购物车
135 'App.Orders.ClearCookById': null, 135 'App.Orders.ClearCookById': null,
136 - //购物车  
137 - 'App.Orders.GetOrderById': null, 136 + //菜品备注tags
  137 + 'App.Orders.GetRemarkBySellerid':{
  138 + cachetime: 300,
  139 + },
138 140
139 /**crm**/ 141 /**crm**/
140 'App.Reserve.Members':null, 142 'App.Reserve.Members':null,