Commit f2e84505af8e102ebba8291a5768695fc410cb15

Authored by wangfan
1 parent e093fb40

快速预定

@@ -72,7 +72,7 @@ Page({ @@ -72,7 +72,7 @@ Page({
72 let val=util.val(e).trim(); 72 let val=util.val(e).trim();
73 if(val>0){ 73 if(val>0){
74 App.Advance.SetOrderById({ 74 App.Advance.SetOrderById({
75 - orderid:this.data.options.oid, 75 + orderid:this.data.order.id||this.data.options.oid,
76 pnum:val, 76 pnum:val,
77 77
78 }) 78 })
@@ -83,4 +83,14 @@ Page({ @@ -83,4 +83,14 @@ Page({
83 url: util.http_build_query({...this.data.order},'./remark') 83 url: util.http_build_query({...this.data.order},'./remark')
84 }) 84 })
85 }, 85 },
  86 + submitOrder(){
  87 + App.Advance.PlaceOrder({
  88 + orderid:this.data.order.id||this.data.options.oid,
  89 + identity:this.data.options.identity,
  90 + }).then(res=>{
  91 + wx.redirectTo({
  92 + url: util.http_build_query({...this.data.options,hasSuccess:1},'./success')
  93 + })
  94 + })
  95 + },
86 }) 96 })
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 </view> 40 </view>
41 </formids> 41 </formids>
42 </view> 42 </view>
43 - <formids class="submit"> 43 + <formids class="submit" bindclick="submitOrder">
44 <view class="submit">确认下单</view> 44 <view class="submit">确认下单</view>
45 </formids> 45 </formids>
46 </view> 46 </view>
@@ -46,6 +46,7 @@ Page({ @@ -46,6 +46,7 @@ Page({
46 orderItemCount+=parseInt(cb.num) 46 orderItemCount+=parseInt(cb.num)
47 }) 47 })
48 this.setData({ 48 this.setData({
  49 + [`options.oid`]:res.data.id,
49 order: res.data, 50 order: res.data,
50 orderItemCount:orderItemCount, 51 orderItemCount:orderItemCount,
51 }) 52 })
1 // pack-cookbook/pages/success.js 1 // pack-cookbook/pages/success.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +const {regeneratorRuntime} = global
2 Page({ 5 Page({
3 6
4 /** 7 /**
5 * 页面的初始数据 8 * 页面的初始数据
6 */ 9 */
7 data: { 10 data: {
  11 + moreDisplay:false,
8 }, 12 },
9 13
10 /** 14 /**
@@ -63,7 +67,12 @@ Page({ @@ -63,7 +67,12 @@ Page({
63 * 用户点击右上角分享 67 * 用户点击右上角分享
64 */ 68 */
65 onShareAppMessage: function () { 69 onShareAppMessage: function () {
66 - 70 + let options={...this.data.options};
  71 + delete options.hasSuccess
  72 + return {
  73 + title:'邀你一起点菜',
  74 + path:util.http_build_query(options,'./success')
  75 + }
67 }, 76 },
68 77
69 initOrder(){ 78 initOrder(){
@@ -71,9 +80,37 @@ Page({ @@ -71,9 +80,37 @@ Page({
71 rid: this.data.options.rid, 80 rid: this.data.options.rid,
72 identity:this.data.options.identity 81 identity:this.data.options.identity
73 }).then(res => { 82 }).then(res => {
  83 + res.data.cdateStr=util.unixtoTime(res.data.cdate,'YYYY-MM-DD')
  84 + let cookbooklist={};
  85 + let i=0;
  86 + let moreDisplay=true;
  87 + res.data.cookbooklist.forEach(ck=>{
  88 + if(!cookbooklist[ck.classid]){
  89 + cookbooklist[ck.classid]={'name':ck.class_name,list:[],moreDisplay:moreDisplay}
  90 + }
  91 + ck.moreDisplay=moreDisplay
  92 + cookbooklist[ck.classid].list.push(ck)
  93 + i++;
  94 + if(i>=4){
  95 + moreDisplay=false;
  96 + }
  97 + })
  98 + res.data.booklist=cookbooklist;
74 this.setData({ 99 this.setData({
75 order: res.data, 100 order: res.data,
76 }) 101 })
77 }) 102 })
78 }, 103 },
  104 + moreDisplay(){
  105 + this.setData({
  106 + moreDisplay:!this.data.moreDisplay
  107 + })
  108 + },
  109 + gotoEditor(){
  110 + let options={...this.data.options};
  111 + delete options.hasSuccess
  112 + wx.redirectTo({
  113 + url: util.http_build_query(options,'./index')
  114 + })
  115 + }
79 }) 116 })
@@ -8,8 +8,10 @@ @@ -8,8 +8,10 @@
8 <view class="title Medium">订单提交成功</view> 8 <view class="title Medium">订单提交成功</view>
9 <view class="optx flex-vc"> 9 <view class="optx flex-vc">
10 <view class="opt-view flex-ll"> 10 <view class="opt-view flex-ll">
11 - <view class="but editor">修改菜品</view>  
12 - <view class="but share">分享</view> 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>
13 </view> 15 </view>
14 </view> 16 </view>
15 </view> 17 </view>
@@ -17,34 +19,41 @@ @@ -17,34 +19,41 @@
17 </view> 19 </view>
18 <view class="pages"> 20 <view class="pages">
19 <view class="carts"> 21 <view class="carts">
20 - <view class="block">  
21 - <view class="title">123123</view>  
22 - <view class="cart-body">  
23 - <view class="cart-item flex-lr" wx:for="{{[1]}}" wx:key="item.key">  
24 - <view class="icon">  
25 - <image src="{{}}"></image>  
26 - </view>  
27 - <view class="name">范德萨范德萨发{{item}}</view>  
28 - <view class="price">¥125.00/份</view>  
29 - <view class="opt">  
30 - {{item.num||10}}  
31 - </view> 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="name">{{item.cookname}}</view>
  32 + <view class="price">¥{{item.price}}/份</view>
  33 + <view class="opt">
  34 + {{item.num}}
  35 + </view>
  36 + </view>
  37 + </block>
32 </view> 38 </view>
33 </view> 39 </view>
34 - </view> 40 + </block>
35 </view> 41 </view>
36 - <view class="total">共计:¥88</view> 42 + <view class="moreDisplay flex-vc"
  43 + bindtap="moreDisplay"
  44 + wx:if="{{order.cookbooklist.length>4}}">{{!moreDisplay?'查看更多':'收起'}}</view>
  45 + <view class="total">共计:¥{{order.price}}</view>
37 </view> 46 </view>
38 <view class="hr"></view> 47 <view class="hr"></view>
39 <view class="pages"> 48 <view class="pages">
40 <view class="infos"> 49 <view class="infos">
41 <view class="flex-lr item"> 50 <view class="flex-lr item">
42 <view>备注:</view> 51 <view>备注:</view>
43 - <view class="">口味、偏好等要求</view> 52 + <view class="" style="max-width: 85%;line-height: 40rpx; ">{{order.remark||''}}</view>
44 </view> 53 </view>
45 <view class="flex-lr item"> 54 <view class="flex-lr item">
46 <view>人数:</view> 55 <view>人数:</view>
47 - <view class="">111</view> 56 + <view class="">{{order.pnum||''}}</view>
48 </view> 57 </view>
49 </view> 58 </view>
50 </view> 59 </view>
@@ -56,11 +65,11 @@ @@ -56,11 +65,11 @@
56 </view> 65 </view>
57 <view class="flex-ll item"> 66 <view class="flex-ll item">
58 <view>订单编号:</view> 67 <view>订单编号:</view>
59 - <view class="">22333445678</view> 68 + <view class="">{{order.no}}</view>
60 </view> 69 </view>
61 <view class="flex-ll item"> 70 <view class="flex-ll item">
62 <view>下单时间:</view> 71 <view>下单时间:</view>
63 - <view class="">2018-07-12</view> 72 + <view class="">{{order.cdateStr}}</view>
64 </view> 73 </view>
65 </view> 74 </view>
66 </view> 75 </view>
@@ -142,4 +142,11 @@ @@ -142,4 +142,11 @@
142 .success .info{ 142 .success .info{
143 font-size: 26rpx; 143 font-size: 26rpx;
144 color:#999999 144 color:#999999
  145 +}
  146 +
  147 +.moreDisplay{
  148 + height: 100rpx;
  149 + line-height: 100rpx;
  150 + color: #999999;
  151 + font-size: 28rpx;
145 } 152 }
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 34, 33 + "current": 35,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -299,7 +299,7 @@ @@ -299,7 +299,7 @@
299 "id": 35, 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": "rid=1196&oid=2&identity=1&hasSuccess=1", 302 + "query": "rid=1196&oid=1&identity=1&hasSuccess=1",
303 "scene": "1001" 303 "scene": "1001"
304 }, 304 },
305 { 305 {
@@ -137,6 +137,8 @@ export default { @@ -137,6 +137,8 @@ export default {
137 'App.Orders.GetRemarkBySellerid':{ 137 'App.Orders.GetRemarkBySellerid':{
138 cachetime: 300, 138 cachetime: 300,
139 }, 139 },
  140 + //下单
  141 + 'App.Advance.PlaceOrder':null,
140 142
141 /**crm**/ 143 /**crm**/
142 'App.Reserve.Members':null, 144 'App.Reserve.Members':null,