yuantianjiao 6 jaren geleden
bovenliggende
commit
047b2e6942

+ 741
- 2
package-lock.json
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 2
- 2
src/components/caseTableItem/index.vue Bestand weergeven

@@ -11,8 +11,8 @@
11 11
     </div>
12 12
     <div class="flex-item">
13 13
       <div>
14
-        <span>案场一号桌</span>
15
-        <router-link :to="{name: 'placeOrder', query: {}}">选择点单</router-link>
14
+        <span>{{item.TableNo}}</span>
15
+        <a>选择点单</a>
16 16
       </div>
17 17
     </div>
18 18
   </div>

+ 5
- 5
src/components/orderPopup/index.vue Bestand weergeven

@@ -99,11 +99,11 @@ export default {
99 99
       this.resetData()
100 100
     },
101 101
     resetData () { // 重置状态
102
-      this.activeIndex = ''
103
-      this.price = 0
104
-      this.num = 1
105
-      this.specName = ''
106
-      this.specId = ''
102
+      // this.activeIndex = ''
103
+      // this.price = 0
104
+      // this.num = 1
105
+      // this.specName = ''
106
+      // this.specId = ''
107 107
     },
108 108
   }
109 109
 }

+ 4
- 4
src/components/topCaseInfo/index.vue Bestand weergeven

@@ -1,10 +1,10 @@
1 1
 <template>
2 2
   <div class="topCaseInfo flex-h">
3 3
     <i class="iconfont icon-dingwei"></i>
4
-      <span>{{data.caseName}}</span>
5
-      <a v-if="data.showSelect" @click="selectCase">请选择</a>
4
+      <span>{{data.CaseName}}</span>
5
+      <a v-if="data.ShowSelect" @click="selectCase">请选择</a>
6 6
       <div class="flex-item">
7
-        <span>{{data.userName}}您好!</span>
7
+        <span>{{userName}}您好!</span>
8 8
       </div>
9 9
   </div>
10 10
 </template>
@@ -13,7 +13,7 @@
13 13
 
14 14
 export default {
15 15
   name: '',
16
-  props: ['data'],
16
+  props: ['data','userName'],
17 17
   data () {
18 18
     return {
19 19
 

+ 42
- 39
src/pages/user/mainPage/coffeeIndex/index.vue Bestand weergeven

@@ -1,23 +1,23 @@
1 1
 <template>
2 2
   <div class="mainPage flex-v">
3 3
     <div class="top">
4
-      <topCaseInfo :data="topCaseInfoData" @selectCase="showSelect = true"></topCaseInfo>
4
+      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer != undefined ? userInfo.customer.CustomerName : ''" @selectCase="ShowSelect = true"></topCaseInfo>
5 5
     </div>
6 6
     <div class="content flex-item">
7 7
       <div>
8 8
         <div class="flex-h">
9 9
           <div class="flex-item">
10 10
             <ul class="areaList">
11
-              <li v-for="(item,index) in list" :key="index">
11
+              <li v-for="(item,index) in CaseTableList" :key="index">
12 12
                 <div class="title">
13 13
                   <i class="iconfont icon-yinchenglogo"></i>
14
-                  <span>{{item.name}}</span>
14
+                  <span>{{item.AreaName}}</span>
15 15
                 </div>
16 16
                 <ul class="subAreaList flex-h">
17
-                  <li class="flex-item flex-h" v-for="(subItem,subIndex) in item.list" :key="subIndex">
17
+                  <router-link tag="li" class="flex-item flex-h" v-for="(subItem,subIndex) in item.Tables" :key="subIndex" :to="{name: 'placeOrder', query: { tableid: encodeURI(subItem.TableId), tableno: encodeURI(subItem.TableNo), caseid: encodeURI(subItem.CaseId), casename: encodeURI(topCaseInfoData.CaseName), areaid: encodeURI(subItem.AreaId), areaname: encodeURI(item.AreaName)}}">
18 18
                     <caseTableItem :item="subItem" :index="subIndex"></caseTableItem>
19
-                  </li>
20
-                  <li class="flex-item noData" v-if="item.list.length % 2 != 0"></li>
19
+                  </router-link>
20
+                  <li class="flex-item noData" v-if="item.Tables.length % 2 != 0"></li>
21 21
                 </ul>
22 22
               </li>
23 23
             </ul>
@@ -25,19 +25,22 @@
25 25
         </div>
26 26
       </div>
27 27
     </div>
28
-    <div class="selectCase" :hidden="!showSelect"></div>
29
-    <van-picker :hidden="!showSelect"
28
+    <div class="selectCase" :hidden="!ShowSelect"></div>
29
+    <van-picker :hidden="!ShowSelect"
30 30
       show-toolbar
31 31
       title="选择案场"
32
-      :columns="caseList"
33
-      @cancel="showSelect = false"
32
+      :columns="CaseList"
33
+      @cancel="ShowSelect = false"
34 34
       @confirm="selectCase"
35
-      value-key="value"
35
+      value-key="CaseName"
36 36
     />
37 37
   </div>
38 38
 </template>
39 39
 
40 40
 <script>
41
+import { mapState, createNamespacedHelpers } from 'vuex'
42
+const { mapActions: actions } = createNamespacedHelpers('app')
43
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
41 44
 import caseTableItem from '../../../../components/caseTableItem/index'
42 45
 import topCaseInfo from '../../../../components/topCaseInfo/index'
43 46
 
@@ -46,29 +49,11 @@ export default {
46 49
   data () {
47 50
     return {
48 51
       topCaseInfoData: {
49
-        caseName: '',
50
-        caseId: '',
51
-        showSelect: true,
52
-        userName: 'xxx'
52
+        CaseName: '',
53
+        CaseId: '',
54
+        ShowSelect: true,
53 55
       },
54
-      caseInfo: {
55
-        value: '',
56
-        id: ''
57
-      },
58
-      showSelect: false,
59
-      caseList: [{
60
-        value: '案场一',
61
-        id: ''
62
-      }, {
63
-        value: '案场二',
64
-        id: ''
65
-      }, {
66
-        value: '案场三',
67
-        id: ''
68
-      }, {
69
-        value: '案场四',
70
-        id: ''
71
-      }],
56
+      ShowSelect: false,
72 57
       list: [{
73 58
         name: '案场名称1',
74 59
         list: [{}, {}, {}, {}, {}],
@@ -79,21 +64,39 @@ export default {
79 64
     }
80 65
   },
81 66
   computed: {
82
-
67
+    ...mapState({
68
+      userInfo: x => x.userCenter.userInfo,
69
+      CaseList: x => x.app.CaseList,
70
+      CaseTableList: x => x.placeOrderForCoffee.CaseTableList,
71
+    })
83 72
   },
84 73
   components: {
85 74
     topCaseInfo,
86 75
     caseTableItem,
87 76
   },
88 77
   created () {
89
-
78
+    this.getCaseList().then((res) => {
79
+      this.topCaseInfoData.CaseName = res.cases[0].CaseName
80
+      this.topCaseInfoData.CaseId = res.cases[0].CaseId
81
+      this.getCaseTableList({
82
+        caseid: this.topCaseInfoData.CaseId
83
+      })
84
+    })
90 85
   },
91 86
   methods: {
87
+    ...actions([
88
+      'getCaseList',
89
+    ]),
90
+    ...caseTableActions([
91
+      'getCaseTableList',
92
+    ]),
92 93
     selectCase (val) { // 选择案场
93
-      this.caseInfo = val
94
-      this.topCaseInfoData.caseName = val.value
95
-      this.topCaseInfoData.caseId = val.id
96
-      this.showSelect = false
94
+      this.topCaseInfoData.CaseName = val.CaseName
95
+      this.topCaseInfoData.CaseId = val.CaseId
96
+      this.getCaseTableList({
97
+        caseid: this.topCaseInfoData.CaseId
98
+      })
99
+      this.ShowSelect = false
97 100
     },
98 101
   }
99 102
 }

+ 179
- 105
src/pages/user/placeOrder/index.vue Bestand weergeven

@@ -6,17 +6,17 @@
6 6
         <div class="bannerInfo flex-h">
7 7
           <div class="flex-item">
8 8
             <div>
9
-              <span>项目名称:xxxx</span>
9
+              <span>项目名称:{{caseName}}</span>
10 10
             </div>
11 11
           </div>
12
-          <span>xxx您好!</span>
12
+          <span>{{userInfo.customer != undefined ? userInfo.customer.CustomerName : ''}}您好!</span>
13 13
         </div>
14 14
       </div>
15 15
       <div class="tableInfo flex-h">
16 16
         <div class="flex-item">
17 17
           <div>
18
-            <span>桌号:案场11号桌</span>
19
-            <span>本月已用:150杯</span>
18
+            <span>桌号:{{tableNo}}</span>
19
+            <!-- <span>本月已用:150杯</span> -->
20 20
           </div>
21 21
         </div>
22 22
         <router-link :to="{name: 'coffeeIndex', query: {}}">返回选择桌号</router-link>
@@ -66,7 +66,7 @@
66 66
           <i class="iconfont" :class="{'icon-jiantou-up': !showCalcMenu,'icon-jiantou-down': showCalcMenu}" @click="showCalcMenu = true"></i>
67 67
         </div>
68 68
       </div>
69
-      <router-link :to="{name: 'placeOrderDetail', query: {info: JSON.stringify(settlementList)}}">下单</router-link>
69
+      <router-link :to="{name: 'placeOrderDetail', query: {info: JSON.stringify(settlementList), caseid: encodeURI(caseId), areaid: encodeURI(areaId), areaname: encodeURI(areaName), areaid: encodeURI(areaId), tableid: encodeURI(tableId), tableno: encodeURI(tableNo)}}">下单</router-link>
70 70
       <!-- <a @click="showCalcMenu = true">下单</a> -->
71 71
     </div>
72 72
     <orderPopup :show="showPopup" :data="currentSpec" @closePopup="closePopup" @returnData="calcMenus"></orderPopup>
@@ -75,6 +75,8 @@
75 75
 </template>
76 76
 
77 77
 <script>
78
+import { mapState, createNamespacedHelpers } from 'vuex'
79
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
78 80
 import orderItem from '../../../components/orderItem/index'
79 81
 import orderPopup from '../../../components/orderPopup/index'
80 82
 import calcMenu from '../../../components/calcMenu/index'
@@ -86,6 +88,12 @@ export default {
86 88
   data () {
87 89
     const _self = this
88 90
     return {
91
+      tableNo: decodeURI(this.$route.query.tableno),
92
+      tableId: decodeURI(this.$route.query.tableid),
93
+      areaId: decodeURI(this.$route.query.areaid),
94
+      areaName: decodeURI(this.$route.query.areaname),
95
+      caseName: decodeURI(this.$route.query.casename),
96
+      caseId: decodeURI(this.$route.query.caseid),
89 97
       totalCupNum: 0, // 共计使用杯数
90 98
       showCalcMenu: false, // 显隐已点菜单弹窗
91 99
       currentSpec: null, // 当前选择规格
@@ -94,103 +102,105 @@ export default {
94 102
       totalPrice: 0, // 总价格
95 103
       settlementList: [], // 商品选择清单
96 104
       slideMenusActive: 0, // 左侧菜单选中索引值
97
-      menuList: [{ // 商品数据
98
-        value: '咖啡',
99
-        eValue: 'Coffee',
100
-        id: '1',
101
-        status: 1,
102
-        list: [{
103
-          img: '',
104
-          name: '商品名称',
105
-          id: '1-1',
106
-          status: 1,
107
-          spec: [{
108
-            value: '去冰',
109
-            id: '1-1-1',
110
-            num: 0,
111
-            status: 0,
112
-            price: '10',
113
-          }, {
114
-            value: '少冰',
115
-            id: '1-1-2',
116
-            num: 0,
117
-            status: 1,
118
-            price: '15',
119
-          }, {
120
-            value: '正常',
121
-            id: '1-1-3',
122
-            num: 0,
123
-            status: 1,
124
-            price: '20',
125
-          }, {
126
-            value: '多冰',
127
-            id: '1-1-4',
128
-            num: 0,
129
-            status: 1,
130
-            price: '25',
131
-          }],
132
-          price: '100',
133
-        }, {
134
-          img: '',
135
-          name: '商品名称',
136
-          id: '1-2',
137
-          spec: [],
138
-          status: 0,
139
-          price: '100',
140
-        }, {
141
-          img: '',
142
-          name: '商品名称',
143
-          id: '1-3',
144
-          spec: [],
145
-          status: 1,
146
-          price: '100',
147
-        }, {
148
-          img: '',
149
-          name: '商品名称',
150
-          id: '1-4',
151
-          spec: [],
152
-          status: 1,
153
-          price: '100',
154
-        }, {
155
-          img: '',
156
-          name: '商品名称',
157
-          id: '1-5',
158
-          spec: [],
159
-          status: 1,
160
-          price: '100',
161
-        }, {
162
-          img: '',
163
-          name: '商品名称',
164
-          id: '1-6',
165
-          spec: [],
166
-          status: 1,
167
-          price: '100',
168
-        }],
169
-      }, {
170
-        value: '咖啡一',
171
-        eValue: 'Coffee',
172
-        id: '2',
173
-        status: 1,
174
-        list: [],
175
-      }, {
176
-        value: '咖啡二',
177
-        eValue: 'Coffee',
178
-        id: '3',
179
-        status: 1,
180
-        list: [],
181
-      }, {
182
-        value: '咖啡三',
183
-        eValue: 'Coffee',
184
-        id: '4',
185
-        status: 1,
186
-        list: [],
187
-      }, {
188
-        value: '咖啡四',
189
-        eValue: 'Coffee',
190
-        id: '5',
191
-        status: 1,
192
-        list: [],
193
-      }],
105
+      menuList: [ // 商品数据
106
+      //   {
107
+      //   value: '咖啡',
108
+      //   eValue: 'Coffee',
109
+      //   id: '1',
110
+      //   status: 1,
111
+      //   list: [{
112
+      //     img: '',
113
+      //     name: '商品名称',
114
+      //     id: '1-1',
115
+      //     status: 1,
116
+      //     spec: [{
117
+      //       value: '去冰',
118
+      //       id: '1-1-1',
119
+      //       num: 0,
120
+      //       status: 0,
121
+      //       price: '10',
122
+      //     }, {
123
+      //       value: '少冰',
124
+      //       id: '1-1-2',
125
+      //       num: 0,
126
+      //       status: 1,
127
+      //       price: '15',
128
+      //     }, {
129
+      //       value: '正常',
130
+      //       id: '1-1-3',
131
+      //       num: 0,
132
+      //       status: 1,
133
+      //       price: '20',
134
+      //     }, {
135
+      //       value: '多冰',
136
+      //       id: '1-1-4',
137
+      //       num: 0,
138
+      //       status: 1,
139
+      //       price: '25',
140
+      //     }],
141
+      //     price: '100',
142
+      //   }, {
143
+      //     img: '',
144
+      //     name: '商品名称',
145
+      //     id: '1-2',
146
+      //     spec: [],
147
+      //     status: 0,
148
+      //     price: '100',
149
+      //   }, {
150
+      //     img: '',
151
+      //     name: '商品名称',
152
+      //     id: '1-3',
153
+      //     spec: [],
154
+      //     status: 1,
155
+      //     price: '100',
156
+      //   }, {
157
+      //     img: '',
158
+      //     name: '商品名称',
159
+      //     id: '1-4',
160
+      //     spec: [],
161
+      //     status: 1,
162
+      //     price: '100',
163
+      //   }, {
164
+      //     img: '',
165
+      //     name: '商品名称',
166
+      //     id: '1-5',
167
+      //     spec: [],
168
+      //     status: 1,
169
+      //     price: '100',
170
+      //   }, {
171
+      //     img: '',
172
+      //     name: '商品名称',
173
+      //     id: '1-6',
174
+      //     spec: [],
175
+      //     status: 1,
176
+      //     price: '100',
177
+      //   }],
178
+      // }, {
179
+      //   value: '咖啡一',
180
+      //   eValue: 'Coffee',
181
+      //   id: '2',
182
+      //   status: 1,
183
+      //   list: [],
184
+      // }, {
185
+      //   value: '咖啡二',
186
+      //   eValue: 'Coffee',
187
+      //   id: '3',
188
+      //   status: 1,
189
+      //   list: [],
190
+      // }, {
191
+      //   value: '咖啡三',
192
+      //   eValue: 'Coffee',
193
+      //   id: '4',
194
+      //   status: 1,
195
+      //   list: [],
196
+      // }, {
197
+      //   value: '咖啡四',
198
+      //   eValue: 'Coffee',
199
+      //   id: '5',
200
+      //   status: 1,
201
+      //   list: [],
202
+      // }
203
+      ],
194 204
       swiperOption: {
195 205
         observer: true,
196 206
         direction: 'vertical',
@@ -211,6 +221,11 @@ export default {
211 221
     }
212 222
   },
213 223
   computed: {
224
+    ...mapState({
225
+      userInfo: x => x.userCenter.userInfo,
226
+      goodsTypeList: x => x.placeOrderForCoffee.goodsTypeList,
227
+      goodsList: x => x.placeOrderForCoffee.goodsList
228
+    }),
214 229
     MySwiper () {
215 230
       return this.$refs.mySwiper.swiper
216 231
     },
@@ -225,10 +240,69 @@ export default {
225 240
     orderPopup,
226 241
     calcMenu,
227 242
   },
228
-  created () { },
243
+  created () {
244
+    this.getGoodsTypeList({
245
+      caseid: this.caseId,
246
+    }).then((res) => {
247
+      // console.log(JSON.stringify(res))
248
+      this.getGoodsList({
249
+        caseid: this.caseId,
250
+      }).then((res) => {
251
+        // console.log(JSON.stringify(res))
252
+        this.mapArr()
253
+      })
254
+    })
255
+  },
229 256
   methods: {
257
+    ...caseTableActions([
258
+      'getGoodsTypeList',
259
+      'getGoodsList',
260
+    ]),
261
+    mapArr () { // 匹配商品规格
262
+      var aArr = this.goodsTypeList, bArr = this.goodsList
263
+      for (var n = 0; n < aArr.length; n++) {
264
+        aArr[n].list = []
265
+        for (var a = 0; a < bArr.length; a++) {
266
+          if (aArr[n].TypeId === bArr[a].TypeId) {
267
+            aArr[n].list.push(bArr[a])
268
+          }
269
+        }
270
+      }
271
+      this.menuList = []
272
+      for (var x = 0; x < aArr.length; x++) {
273
+        this.menuList.push({
274
+          value: aArr[x].TypeName,
275
+          eValue: aArr[x].EnglishName,
276
+          id: aArr[x].TypeId,
277
+          status: aArr[x].Status,
278
+          list: []
279
+        })
280
+        for (var y = 0; y < aArr[x].list.length; y++) {
281
+          this.menuList[x].list.push({
282
+            img: aArr[x].list[y].Images,
283
+            name: aArr[x].list[y].GoodsName,
284
+            id: aArr[x].list[y].GoodsId,
285
+            spec: [],
286
+            status: aArr[x].list[y].Status,
287
+            price: aArr[x].list[y].Price,
288
+          })
289
+          if(aArr[x].list[y].Specs !== null){
290
+            for (var z = 0; z < aArr[x].list[y].Specs.length; z++) {
291
+              this.menuList[x].list[y].spec.push({
292
+                value: aArr[x].list[y].Specs[z].SpecName,
293
+                id: aArr[x].list[y].Specs[z].SpecId,
294
+                num: 0,
295
+                status: aArr[x].list[y].Specs[z].Status,
296
+                price: aArr[x].list[y].Specs[z].GoodsPrice,
297
+              })
298
+            }
299
+          }
300
+        }
301
+      }
302
+      // console.log(JSON.stringify(this.menuList))
303
+    },
230 304
     placeOrder () { // 下单
231
-      this.$router.push({name: 'orderList', query: {}})
305
+      this.$router.push({ name: 'orderList', query: {} })
232 306
     },
233 307
     closeCalcMenu () { // 关闭已选菜单
234 308
       this.showCalcMenu = false
@@ -304,5 +378,5 @@ export default {
304 378
 
305 379
 <!-- Add "scoped" attribute to limit CSS to this component only -->
306 380
 <style lang="scss" scoped>
307
-@import "page.scss";
381
+@import 'page.scss';
308 382
 </style>

+ 95
- 15
src/pages/user/placeOrderDetail/index.vue Bestand weergeven

@@ -5,18 +5,18 @@
5 5
       <div class="list flex-h">
6 6
         <div class="flex-item">
7 7
           <ul>
8
-            <li class="flex-h" v-for="(item,index) in 10" :key="index">
8
+            <li class="flex-h" v-for="(item,index) in orderInfo" :key="index">
9 9
               <div class="flex-item">
10
-                <div><span>美式特浓</span></div>
10
+                <div><span>{{item.name}}</span></div>
11 11
               </div>
12 12
               <div class="flex-item">
13
-                <div><span>加冰</span></div>
13
+                <div><span>{{item.specName}}</span></div>
14 14
               </div>
15 15
               <div class="flex-item">
16
-                <div><span>x1</span></div>
16
+                <div><span>x{{item.defaultNum === null ? item.num : item.defaultNum}}</span></div>
17 17
               </div>
18 18
               <div class="flex-item">
19
-                <div><span>¥20</span></div>
19
+                <div><span>¥{{item.defaultPrice === null ? item.price : item.defaultPrice}}</span></div>
20 20
               </div>
21 21
             </li>
22 22
             <li class="flex-h">
@@ -35,14 +35,14 @@
35 35
       <div class="remark flex-h">
36 36
         <div class="flex-item flex-h">
37 37
           <div class="flex-h">
38
-            <textarea class="flex-item" cols="30" rows="10"></textarea>
38
+            <textarea class="flex-item" cols="30" rows="10" v-model="postData.info.Remark"></textarea>
39 39
           </div>
40 40
         </div>
41 41
       </div>
42
-      <span>下单人:小五子 18267901393</span>
42
+      <span>下单人:{{userInfo.CustomerName}} {{userInfo.Phone}}</span>
43 43
       <div class="bottom">
44 44
         <a>取消</a>
45
-        <a>确定</a>
45
+        <a @click="toPayer">确定</a>
46 46
       </div>
47 47
     </div>
48 48
     <div class="selectLayer" :class="{'show': showSelect}">
@@ -61,14 +61,42 @@
61 61
 </template>
62 62
 
63 63
 <script>
64
+import { mapState, createNamespacedHelpers } from 'vuex'
65
+const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
64 66
 
65 67
 export default {
66 68
   name: '',
67 69
   data () {
70
+    var _self = this
68 71
     return {
69 72
       postData: {
70
-        ticketId: '',
71
-        ticketName: '',
73
+        info: {
74
+          CaseId: decodeURI(_self.$route.query.caseid),
75
+          AreaId: decodeURI(_self.$route.query.areaid),
76
+          AreaName: decodeURI(_self.$route.query.areaname),
77
+          TableId: decodeURI(_self.$route.query.tableid),
78
+          TableNo: decodeURI(_self.$route.query.tableno),
79
+          Amount: String(_self.returnAmount()[0]), // 订单金额
80
+          UserType: 'customer',
81
+          OrdersNum: Number(_self.returnAmount()[1]),
82
+          Remark: '',
83
+        },
84
+        detail: [],
85
+        coupon: [
86
+        //   {
87
+        //   OrdersCouponId: '',
88
+        //   OrdersId: '',
89
+        //   OrdersNo: '',
90
+        //   CouponId: '',
91
+        //   CouponName: '',
92
+        //   OrgId: '',
93
+        //   GoodsId: '',
94
+        //   GoodsName: '',
95
+        //   UsedAmount: '',
96
+        //   Status: '',
97
+        //   CreateDate: '',
98
+        // }
99
+        ],
72 100
       },
73 101
       ticketList: [{
74 102
         value: '优惠券1',
@@ -81,23 +109,75 @@ export default {
81 109
         id: '3',
82 110
       }],
83 111
       showSelect: false,
84
-      orderInfo: JSON.parse(this.$route.query.info)
112
+      orderInfo: JSON.parse(_self.$route.query.info) || []
85 113
     }
86 114
   },
115
+  computed: {
116
+    ...mapState({
117
+      userInfo: x => x.userCenter.userInfo,
118
+      orgId: x => x.app.orgId,
119
+    })
120
+  },
87 121
   created () {
88
-
122
+    // console.log(this.$route.query.info)
123
+    // console.log(JSON.stringify(this.postData))
89 124
   },
90 125
   methods: {
126
+    ...caseTableActions([
127
+      'toPay',
128
+    ]),
129
+    returnAmount () { // 返回总金额  
130
+      var amount = 0, num = 0, info = JSON.parse(this.$route.query.info)
131
+      for (var n = 0; n < info.length; n++) {
132
+        if (info[n].defaultPrice === null) {
133
+          amount += info[n].price * info[n].num
134
+          num += info[n].num
135
+        } else {
136
+          amount += info[n].defaultPrice * info[n].defaultNum
137
+          num += info[n].defaultNum
138
+        }
139
+      }
140
+      return [amount, num]
141
+    },
91 142
     onConfirm (value, index) {
92
-      this.postData.ticketName = value.value
93
-      this.postData.ticketId = value.id
143
+      this.postData.coupon.CouponName = value.value
144
+      this.postData.coupon.CouponId = value.id
94 145
       this.showSelect = false
95 146
     },
147
+    toPayer () { // 下单
148
+      this.postData.info.OrgId = this.orgId
149
+      this.postData.info.UserId = this.userInfo.CustomerId
150
+      this.postData.info.UserName = this.userInfo.CustomerName
151
+      this.postData.info.PayType = this.postData.coupon.length ? 'coupon' : 'vip'
152
+      var orderInfo = JSON.parse(this.$route.query.info)
153
+      for (var n = 0; n < orderInfo.length; n++) {
154
+        this.postData.detail.push({
155
+          GoodsId: orderInfo[n].id,
156
+          GoodsName: orderInfo[n].name,
157
+          SpecId: orderInfo[n].specId,
158
+          SpecName: orderInfo[n].specName,
159
+          Number: orderInfo[n].defaultNum === null ? orderInfo[n].num - 0 : orderInfo[n].defaultNum - 0,
160
+          Price: orderInfo[n].defaultNum === null ? String(orderInfo[n].price) : String(orderInfo[n].defaultPrice),
161
+        })
162
+      }
163
+      console.log(JSON.stringify(this.postData))
164
+      this.toPay({
165
+        info: JSON.stringify(this.postData.info),
166
+        detail: JSON.stringify(this.postData.detail),
167
+        coupon: JSON.stringify(this.postData.coupon)
168
+      }).then((res) => {
169
+        this.$dialog.alert({
170
+          message: '下单成功!'
171
+        }).then(() => {
172
+          window.history.go(-2)
173
+        })
174
+      })
175
+    },
96 176
   }
97 177
 }
98 178
 </script>
99 179
 
100 180
 <!-- Add "scoped" attribute to limit CSS to this component only -->
101 181
 <style lang="scss" scoped>
102
-@import "page.scss";
182
+@import 'page.scss';
103 183
 </style>

+ 20
- 4
src/store/app/app.js Bestand weergeven

@@ -1,24 +1,40 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
1 3
 
2 4
 export default {
3 5
   namespaced: true,
4 6
   state: {
5
-    orgId: '1'
7
+    orgId: '1',
8
+    CaseList: []
6 9
   },
7 10
   mutations: {
8 11
     init (state, data) { // 这里的state对应着上面这个state
9 12
       state.orgId = '2'
10
-    }
13
+    },
14
+    setCaseList (state, data) { // 设置案场信息
15
+      state.CaseList = data
16
+    },
11 17
   },
12 18
   actions: {
13 19
     updateLocationInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
14 20
       return new Promise((resolve) => {
15
-        this.$ajax(this.$api.cms.location.url, {
16
-          method: this.$api.cms.location.method
21
+        Ajax(api.index.cms.location.url, {
22
+          method: api.index.cms.location.method
17 23
         }).then(res => {
18 24
           context.commit('init', res)
19 25
           resolve()
20 26
         })
21 27
       })
28
+    },
29
+    getCaseList (context) { // 获取案场信息
30
+      return new Promise((resolve) => {
31
+        Ajax(api.user.getCaseList.url, {
32
+          method: api.user.getCaseList.method
33
+        }).then(res => {
34
+          context.commit('setCaseList', res.cases)
35
+          resolve(res)
36
+        })
37
+      })
22 38
     }
23 39
   }
24 40
 }

+ 1
- 0
src/store/index.js Bestand weergeven

@@ -15,6 +15,7 @@ export const modules = {
15 15
   fiveA: () => require('./fiveA/fiveA').default,
16 16
   userCenter: () => require('./userCenter/userCenter').default,
17 17
   majorProjects: () => require('./majorProjects/majorProjects').default,
18
+  placeOrderForCoffee: () => require('./placeOrderForCoffee/index').default,
18 19
 }
19 20
 
20 21
 Object.keys(modules).forEach((modKey) => {

+ 15
- 0
src/store/majorProjects/majorProjects.js Bestand weergeven

@@ -17,6 +17,21 @@ export default {
17 17
     }
18 18
   },
19 19
   actions: {
20
+    placeOrderForCourse (context, { order, coupons = [] }) { // 课程下单
21
+      return new Promise((resolve, reject) => {
22
+        Ajax(api.majorProjects.placeCourseOrder.url, {
23
+          method: api.majorProjects.placeCourseOrder.method,
24
+          data: {
25
+            info: window.JSON.stringify(order),
26
+            coupons: window.JSON.stringify(coupons),
27
+          }
28
+        }).then(res => {
29
+          resolve(res)
30
+        }).catch((err) => {
31
+          reject(err)
32
+        })
33
+      })
34
+    },
20 35
     getProjectInfo (context, { id }) { // 获取课程列表
21 36
       return new Promise((resolve) => {
22 37
         Ajax(api.majorProjects.getCourseList.url, {

+ 81
- 0
src/store/placeOrderForCoffee/index.js Bestand weergeven

@@ -0,0 +1,81 @@
1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    CaseTableList: [],
8
+    goodsTypeList: [],
9
+    goodsList: [],
10
+  },
11
+  mutations: {
12
+    emptyCaseTableList (state, data) { // 清空案场桌位信息
13
+      state.CaseTableList = []
14
+    },
15
+    setCaseTableList (state, data) { // 设置案场桌位信息
16
+      state.CaseTableList = data
17
+    },
18
+    setGoodsTypeList (state, data) { // 设置商品分类列表信息
19
+      state.goodsTypeList = data
20
+    },
21
+    setGoodsList (state, data) { // 设置商品列表信息
22
+      state.goodsList = data
23
+    },
24
+  },
25
+  actions: {
26
+    getCaseTableList (context, { caseid }) { // 获取案场桌位信息
27
+      return new Promise((resolve) => {
28
+        context.commit('emptyCaseTableList')
29
+        Ajax(api.caseForCoffee.getCaseTableList.url, {
30
+          method: api.caseForCoffee.getCaseTableList.method,
31
+          queryData: {
32
+            caseid,
33
+          },
34
+        }).then(res => {
35
+          context.commit('setCaseTableList', res)
36
+          resolve(res)
37
+        })
38
+      })
39
+    },
40
+    getGoodsTypeList (context, { caseid }) { // 获取商品分类列表信息
41
+      return new Promise((resolve) => {
42
+        Ajax(api.caseForCoffee.getGoodsTypeList.url, {
43
+          method: api.caseForCoffee.getGoodsTypeList.method,
44
+          queryData: {
45
+            caseid,
46
+          },
47
+        }).then(res => {
48
+          context.commit('setGoodsTypeList', res)
49
+          resolve(res)
50
+        })
51
+      })
52
+    },
53
+    getGoodsList (context, { caseid }) { // 获取商品列表信息
54
+      return new Promise((resolve) => {
55
+        Ajax(api.caseForCoffee.getGoodsList.url, {
56
+          method: api.caseForCoffee.getGoodsList.method,
57
+          queryData: {
58
+            caseid,
59
+          },
60
+        }).then(res => {
61
+          context.commit('setGoodsList', res.list)
62
+          resolve(res)
63
+        })
64
+      })
65
+    },
66
+    toPay (context, { info, detail, coupon }) { // 下单
67
+      return new Promise((resolve) => {
68
+        Ajax(api.caseForCoffee.placeGoodsOrder.url, {
69
+          method: api.caseForCoffee.placeGoodsOrder.method,
70
+          data: {
71
+            info,
72
+            detail,
73
+            coupon,
74
+          },
75
+        }).then(res => {
76
+          resolve(res)
77
+        })
78
+      })
79
+    },
80
+  }
81
+}

+ 31
- 1
src/store/userCenter/userCenter.js Bestand weergeven

@@ -72,7 +72,37 @@ http.submitData = (data) => { // 绑定手机号
72 72
 export default {
73 73
   namespaced: true,
74 74
   state: {
75
-    userInfo: {},
75
+    userInfo: {
76
+      AccountInfo: {
77
+        "city": "CITY",
78
+        "country": "COUNTRY",
79
+        "headimgurl": "http://thirdwx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/46",
80
+        "nickname": "NICKNAME",
81
+        "openid": "OPENID",
82
+        "province": "PROVINCE",
83
+        "sex": "1",
84
+        "unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL"
85
+      },
86
+      AccountType: "wechat",
87
+      CreateDate: "0001-01-01T00:00:00Z",
88
+      CustomerId: "1",
89
+      CustomerName: "测试",
90
+      Headimgurl: "",
91
+      MapUser: "",
92
+      MappingId: "1",
93
+      Name: "测试",
94
+      Openid: "OPENID",
95
+      OrgId: "1",
96
+      Phone: "13823838438",
97
+      Points: 0,
98
+      RecommendCase: "1",
99
+      RecommendId: "0",
100
+      RecommendName: "",
101
+      Sex: 1,
102
+      Status: 1,
103
+      UserType: "customer",
104
+      Uuid: "",
105
+    },
76 106
     caseInfo: {}
77 107
   },
78 108
   mutations: {

+ 3
- 2
src/util/ajax.js Bestand weergeven

@@ -1,6 +1,7 @@
1 1
 import axios from 'axios'
2 2
 import qs from 'qs'
3 3
 import toolClass from './util'
4
+import { Toast } from '../../node_modules/vant';
4 5
 
5 6
 const Axios = axios.create({
6 7
   timeout: 60000,
@@ -15,7 +16,7 @@ const Axios = axios.create({
15 16
 
16 17
 Axios.interceptors.request.use((config) => {
17 18
   // 处理请求data,若为get请求,拼到url后面,若为post请求,直接添加到body中
18
-  config.urlData = {...config.urlData, org: 1}
19
+  config.urlData = {...config.urlData, org: 'MQ'}
19 20
   let urlData = qs.stringify(config.urlData)
20 21
   let queryData = qs.stringify(config.queryData)
21 22
   // 判断是通过斜杠传参还是通过query传参
@@ -55,7 +56,7 @@ const ajax = (...args) => {
55 56
         // reject(code)
56 57
         toolClass.getCode()
57 58
       } else {
58
-        Message({
59
+        Toast({
59 60
           message: message,
60 61
           type: 'error'
61 62
         })

+ 27
- 1
src/util/api.js Bestand weergeven

@@ -26,6 +26,24 @@ const $api = {
26 26
       url: `${baseUrl}${guest}/cms/news`
27 27
     }
28 28
   },
29
+  caseForCoffee: {
30
+    getCaseTableList: { // 获取案场桌位列表
31
+      method: 'get',
32
+      url: `${baseUrl}${guest}/cms/area`
33
+    },
34
+    getGoodsTypeList: { // 获取商品分类列表
35
+      method: 'get',
36
+      url: `${baseUrl}${guest}/type/goods`
37
+    },
38
+    getGoodsList: { // 获取商品列表
39
+      method: 'get',
40
+      url: `${baseUrl}${guest}/goods`
41
+    },
42
+    placeGoodsOrder: { // 商品下单
43
+      method: 'post',
44
+      url: `${baseUrl}${wechat}/order/goods`
45
+    }
46
+  },
29 47
   majorProjects: { // 项目专题
30 48
     getCourseList: { // 获取课程列表
31 49
       method: 'get',
@@ -35,6 +53,10 @@ const $api = {
35 53
       method: 'get',
36 54
       url: `${baseUrl}${guest}/course/:id`
37 55
     },
56
+    placeCourseOrder: { // 课程下单
57
+      method: 'post',
58
+      url: `${baseUrl}${wechat}/order/course`
59
+    },
38 60
   },
39 61
   user: {
40 62
     info: { // 获取用户信息
@@ -52,7 +74,11 @@ const $api = {
52 74
     captcha: { // 获取手机验证码
53 75
       method: 'get',
54 76
       url: `${baseUrl}${guest}/captcha`
55
-    }
77
+    },
78
+    getCaseList: { // 获取案场信息
79
+      method: 'get',
80
+      url: `${baseUrl}${guest}/case`
81
+    },
56 82
   },
57 83
   login:{ // 主管、销售端登陆
58 84
     login: {