Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/wechat into dev

yuantianjiao 6 years ago
parent
commit
f18fb66091

+ 28
- 3
src/pages/sales/App.vue View File

1
 <template>
1
 <template>
2
-  <div id="app">
2
+  <div id="app" v-if="showPage">
3
     <router-view></router-view>
3
     <router-view></router-view>
4
   </div>
4
   </div>
5
 </template>
5
 </template>
6
 
6
 
7
 <script>
7
 <script>
8
-  import '../../common/css/reset.css'
8
+import '../../common/css/reset.css'
9
+import { mapState, createNamespacedHelpers } from 'vuex'
10
+const { mapActions: actions } = createNamespacedHelpers('userCenter')
9
 
11
 
10
   export default {
12
   export default {
11
     name: 'app',
13
     name: 'app',
12
-    components: {}
14
+    data () {
15
+      return {
16
+        showPage: false
17
+      }
18
+    },
19
+    computed: {
20
+      ...mapState({
21
+        userInfo: x => x.userCenter.userInfo,
22
+        org: x => x.app.orgId
23
+      })
24
+    },
25
+    created () {
26
+      if (location.search && this.toolClass.UrlSearch(location.search).code) {
27
+        this.code = this.toolClass.UrlSearch(location.search).code
28
+      } else {
29
+        this.code = null
30
+      }
31
+      this.getUserInfo({ org: this.org, code: this.code }).then(() => {
32
+        this.showPage = true
33
+      })
34
+    },
35
+    methods: {
36
+      ...actions(['getUserInfo'])
37
+    }
13
   }
38
   }
14
 </script>
39
 </script>
15
 
40
 

+ 8
- 2
src/pages/sales/login/index.vue View File

86
         if (this.seconds < 60 && this.seconds >= 1) {
86
         if (this.seconds < 60 && this.seconds >= 1) {
87
           this.runTime()
87
           this.runTime()
88
         } else if (this.seconds < 1) {
88
         } else if (this.seconds < 1) {
89
-          this.seconds = 60
89
+          this.seconds = 59
90
         }
90
         }
91
       }, 1000)
91
       }, 1000)
92
     },
92
     },
93
+    getUrl (val) {
94
+      var url = window.location.pathname
95
+      return url.replace('sales.html', 'user.html') + '#/' + val
96
+    },
93
     submit () {
97
     submit () {
94
       if (!this.postData.captcha) {
98
       if (!this.postData.captcha) {
95
         this.$toast('请先获取验证码')
99
         this.$toast('请先获取验证码')
96
         return
100
         return
97
       }
101
       }
102
+      // console.log(this.postData)
98
       this.submitData(this.postData).then((res) => {
103
       this.submitData(this.postData).then((res) => {
99
-        this.$toast(res)
104
+        // this.$toast(res)
105
+        window.location.href = this.getUrl('mainPage/coffeeIndex')
100
       })
106
       })
101
     }
107
     }
102
   }
108
   }

+ 8
- 4
src/pages/user/mainPage/coffeeIndex/index.vue View File

4
       <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer !== undefined ? userInfo.customer.CustomerName : ''" @selectCase="showVanPicker"></topCaseInfo>
4
       <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer !== undefined ? userInfo.customer.CustomerName : ''" @selectCase="showVanPicker"></topCaseInfo>
5
     </div>
5
     </div>
6
     <nav class="flex-h" v-if="userInfo.customer.MapUser !== ''">
6
     <nav class="flex-h" v-if="userInfo.customer.MapUser !== ''">
7
-      <a class="flex-item" v-for="(item,index) in cutNavList" :key="index" :class="{'active': navActive === index}" @click="cutNav(index)">{{item.value}}</a>
7
+      <a class="flex-item" v-for="(item,index) in cutNavList" :key="index" v-if="userInfo.customer.UserTypeId !== 'manager' || item.id !== '3'" :class="{'active': navActive === index}" @click="cutNav(index)">{{item.value}}</a>
8
     </nav>
8
     </nav>
9
     <div class="content flex-item">
9
     <div class="content flex-item">
10
       <div>
10
       <div>
21
                   <span>本月已用:{{caseTotal.monthtotal}}杯</span>
21
                   <span>本月已用:{{caseTotal.monthtotal}}杯</span>
22
                 </div>
22
                 </div>
23
               </div>
23
               </div>
24
-              <a>点单记录</a>
24
+              <router-link :to="{name: 'orderList'}">点单记录</router-link>
25
             </div>
25
             </div>
26
             <div class="areaListParent flex-h">
26
             <div class="areaListParent flex-h">
27
               <div class="flex-item">
27
               <div class="flex-item">
54
                     <span>万</span>
54
                     <span>万</span>
55
                   </div>
55
                   </div>
56
                 </div>
56
                 </div>
57
-                <a :href="getUrl('salesRecord')">销售记录</a>
57
+                <a @click="toSalesHistory">销售记录</a>
58
                 <!-- <router-link :to="{name: 'salesRecord',query: {}}">销售记录</router-link> -->
58
                 <!-- <router-link :to="{name: 'salesRecord',query: {}}">销售记录</router-link> -->
59
               </div>
59
               </div>
60
               <myCard v-for="(item,index) in cardList" :key="index" :data='item' @share='share'></myCard>
60
               <myCard v-for="(item,index) in cardList" :key="index" :data='item' @share='share'></myCard>
173
     ...mapCaseActions([
173
     ...mapCaseActions([
174
       'getCaseTotal',
174
       'getCaseTotal',
175
     ]),
175
     ]),
176
+    toSalesHistory () {
177
+      console.log(this.getUrl('salesRecord'))
178
+      window.location.href = this.getUrl('salesRecord')
179
+    },
176
     getUrl (val) {
180
     getUrl (val) {
177
       var url = window.location.pathname
181
       var url = window.location.pathname
178
-      return url.replace('user.html', 'sales.html') + '' + val
182
+      return url.replace('user.html', 'sales.html') + '#/' + val
179
     },
183
     },
180
     showVanPicker () {
184
     showVanPicker () {
181
       this.showSelect = true
185
       this.showSelect = true

+ 7
- 0
src/pages/user/orderList/index.vue View File

17
                 <orderListItem :data="item"></orderListItem>
17
                 <orderListItem :data="item"></orderListItem>
18
               </li>
18
               </li>
19
             </ul>
19
             </ul>
20
+            <span v-if="noData" style="width:100%;display:block;text-align:center;font-size:.11rem;color:#ccc;">暂无数据</span>
20
           </scroll>
21
           </scroll>
21
         </div>
22
         </div>
22
       </div>
23
       </div>
38
   name: '',
39
   name: '',
39
   data () {
40
   data () {
40
     return {
41
     return {
42
+      noData: false,
41
       pullUpLoad: true,
43
       pullUpLoad: true,
42
       pullUpLoadThreshold: 40,
44
       pullUpLoadThreshold: 40,
43
       startY: 0,
45
       startY: 0,
76
     this.getCustomerGoodsOrder({
78
     this.getCustomerGoodsOrder({
77
       page: this.page,
79
       page: this.page,
78
       pagesize: this.pagesize,
80
       pagesize: this.pagesize,
81
+    }).then((res) => {
82
+      // console.log(JSON.stringify(res))
83
+      if(res.list === null){
84
+        this.noData = true
85
+      }
79
     })
86
     })
80
   },
87
   },
81
   methods: {
88
   methods: {

+ 71
- 46
src/pages/user/placeOrder/index.vue View File

16
         <div class="flex-item">
16
         <div class="flex-item">
17
           <div>
17
           <div>
18
             <span>桌号:{{tableNo}}</span>
18
             <span>桌号:{{tableNo}}</span>
19
-            <!-- <span>本月已用:150杯</span> -->
19
+            <span v-if="userInfo.customer.MapUser !== ''">本月已用:{{caseTotal.monthtotal}}杯</span>
20
           </div>
20
           </div>
21
         </div>
21
         </div>
22
         <a @click="reback">返回选择桌号</a>
22
         <a @click="reback">返回选择桌号</a>
78
 <script>
78
 <script>
79
 import { mapState, createNamespacedHelpers } from 'vuex'
79
 import { mapState, createNamespacedHelpers } from 'vuex'
80
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
80
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
81
+const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
81
 import orderItem from '../../../components/orderItem/index'
82
 import orderItem from '../../../components/orderItem/index'
82
 import orderPopup from '../../../components/orderPopup/index'
83
 import orderPopup from '../../../components/orderPopup/index'
83
 import calcMenu from '../../../components/calcMenu/index'
84
 import calcMenu from '../../../components/calcMenu/index'
89
   data () {
90
   data () {
90
     const _self = this
91
     const _self = this
91
     return {
92
     return {
93
+      postData: {
94
+        info: {
95
+          CaseId: decodeURI(_self.$route.query.caseid),
96
+          AreaId: decodeURI(_self.$route.query.areaid),
97
+          AreaName: decodeURI(_self.$route.query.areaname),
98
+          TableId: decodeURI(_self.$route.query.tableid),
99
+          TableNo: decodeURI(_self.$route.query.tableno),
100
+          Amount: 0, // 订单金额
101
+          OrdersNum: 0,
102
+          Remark: '',
103
+        },
104
+        detail: [],
105
+        coupon: [],
106
+      },
92
       tableNo: decodeURI(this.$route.query.tableno),
107
       tableNo: decodeURI(this.$route.query.tableno),
93
       tableId: decodeURI(this.$route.query.tableid),
108
       tableId: decodeURI(this.$route.query.tableid),
94
       areaId: decodeURI(this.$route.query.areaid),
109
       areaId: decodeURI(this.$route.query.areaid),
131
       goodsTypeList: x => x.placeOrderForCoffee.goodsTypeList,
146
       goodsTypeList: x => x.placeOrderForCoffee.goodsTypeList,
132
       goodsList: x => x.placeOrderForCoffee.goodsList
147
       goodsList: x => x.placeOrderForCoffee.goodsList
133
     }),
148
     }),
149
+    ...mapCaseState({
150
+      caseTotal: x => x.caseTotal,
151
+    }),
134
     MySwiper () {
152
     MySwiper () {
135
       return this.$refs.mySwiper.swiper
153
       return this.$refs.mySwiper.swiper
136
     },
154
     },
147
     sumPrice () {
165
     sumPrice () {
148
       let price = 0
166
       let price = 0
149
       this.selGoods.map(x => {
167
       this.selGoods.map(x => {
150
-        price += x.price*x.num - 0
168
+        price += x.price * x.num - 0
151
       })
169
       })
152
       return price
170
       return price
153
     }
171
     }
170
         // console.log(JSON.stringify(res))
188
         // console.log(JSON.stringify(res))
171
         this.mapArr()
189
         this.mapArr()
172
       })
190
       })
191
+      this.getCaseTotal({
192
+        caseid: this.caseId
193
+      })
173
     })
194
     })
174
   },
195
   },
175
   methods: {
196
   methods: {
176
     ...caseTableActions([
197
     ...caseTableActions([
177
       'getGoodsTypeList',
198
       'getGoodsTypeList',
178
       'getGoodsList',
199
       'getGoodsList',
200
+      'toPay',
201
+    ]),
202
+    ...mapCaseActions([
203
+      'getCaseTotal',
179
     ]),
204
     ]),
180
     toPlaceOrder () { // 下单 
205
     toPlaceOrder () { // 下单 
181
-      if(this.selGoods.length){
182
-        this.$router.push({name: 'placeOrderDetail', query: {info: JSON.stringify(this.selGoods), caseid: encodeURI(this.caseId), areaid: encodeURI(this.areaId), areaname: encodeURI(this.areaName), areaid: encodeURI(this.areaId), tableid: encodeURI(this.tableId), tableno: encodeURI(this.tableNo)}})
183
-      }else{
206
+      if (this.selGoods.length) {
207
+        if (this.userInfo.customer.MapUser === '') {
208
+          this.$router.push({ name: 'placeOrderDetail', query: { info: JSON.stringify(this.selGoods), caseid: encodeURI(this.caseId), areaid: encodeURI(this.areaId), areaname: encodeURI(this.areaName), areaid: encodeURI(this.areaId), tableid: encodeURI(this.tableId), tableno: encodeURI(this.tableNo) } })
209
+        } else {
210
+          this.showCalcMenu = true
211
+        } 
212
+      } else {
184
         this.$toast('您还没有选择商品哦~')
213
         this.$toast('您还没有选择商品哦~')
185
       }
214
       }
186
     },
215
     },
236
       })
265
       })
237
     },
266
     },
238
     placeOrder () { // 下单
267
     placeOrder () { // 下单
239
-      this.$router.push({ name: 'orderList', query: {} })
268
+      // this.$router.push({ name: 'orderList', query: {} })
269
+      this.postData.info.OrgId = this.orgId
270
+      this.postData.info.UserId = this.userInfo.CustomerId
271
+      this.postData.info.UserName = this.userInfo.customer.CustomerName
272
+      this.postData.info.PayType = 'sys user'
273
+      var orderInfo = this.selGoods
274
+      this.postData.detail = []
275
+      var amount = 0
276
+      var num = 0
277
+      for (var n = 0; n < orderInfo.length; n++) {
278
+        this.postData.detail.push({
279
+          GoodsId: orderInfo[n].id,
280
+          GoodsName: orderInfo[n].name,
281
+          SpecId: orderInfo[n].spec,
282
+          SpecName: orderInfo[n].specname,
283
+          Number: orderInfo[n].num - 0,
284
+          Price: String(orderInfo[n].price-0),
285
+        })
286
+        amount += (orderInfo[n].price-0) * orderInfo[n].num
287
+        num += orderInfo[n].num-0
288
+      }
289
+      this.postData.info.Amount = String(amount)
290
+      this.postData.info.OrdersNum = num
291
+      // console.log(JSON.stringify(this.postData))
292
+      this.toPay({
293
+        info: JSON.stringify(this.postData.info),
294
+        detail: JSON.stringify(this.postData.detail),
295
+        coupon: JSON.stringify(this.postData.coupon)
296
+      }).then((res) => {
297
+        this.$dialog.alert({
298
+          message: '下单成功!'
299
+        }).then(() => {
300
+          this.$router.push({name: 'orderList'})
301
+        })
302
+      })
240
     },
303
     },
241
     closeCalcMenu () { // 关闭已选菜单
304
     closeCalcMenu () { // 关闭已选菜单
242
       this.showCalcMenu = false
305
       this.showCalcMenu = false
249
       this.currentSpec = null
312
       this.currentSpec = null
250
     },
313
     },
251
     selectSpec (val) { // 选规格
314
     selectSpec (val) { // 选规格
252
-      console.log(val)
253
       this.currentSpec = val
315
       this.currentSpec = val
254
       this.showPopup = true
316
       this.showPopup = true
255
     },
317
     },
259
     calcMenus (val) { // 计算清单
321
     calcMenus (val) { // 计算清单
260
       var ishas = false
322
       var ishas = false
261
       const _that = this
323
       const _that = this
262
-      this.selGoods.map((goods,inx) => {
263
-        if(goods.id === val.id && goods.spec === (val.spec || '')){
324
+      this.selGoods.map((goods, inx) => {
325
+        if (goods.id === val.id && goods.spec === (val.spec || '')) {
264
           ishas = true
326
           ishas = true
265
           _that.selGoods[inx].num = val.defaultNum
327
           _that.selGoods[inx].num = val.defaultNum
266
         }
328
         }
275
           specname: (val.specname || ''),
337
           specname: (val.specname || ''),
276
         })
338
         })
277
       }
339
       }
278
-      console.log(this.selGoods)
279
-      // var settlementList = this.settlementList
280
-      // val.spec.map(spec => {
281
-      //   settlementList.filter
282
-      // })
283
-
284
-
285
-      // var bool = true, arr = this.settlementList.slice()
286
-      // if (val.specId === null) {
287
-      //   for (var n = 0; n < arr.length; n++) {
288
-      //     if (arr[n].id === val.id && arr[n].specId === null) {
289
-      //       bool = false
290
-      //       arr[n] = val
291
-      //     }
292
-      //   }
293
-      //   if (bool) {
294
-      //     arr.push(val)
295
-      //   }
296
-      // } else {
297
-      //   for (var n = 0; n < arr.length; n++) {
298
-      //     if (arr[n].specId === val.specId) {
299
-      //       bool = false
300
-      //       arr[n] = val
301
-      //     }
302
-      //   }
303
-      //   if (bool) {
304
-      //     arr.push(val)
305
-      //   }
306
-      // }
307
-      // for (var n = 0; n < arr.length; n++) {
308
-      //   if (arr[n].num === 0 || arr[n].defaultNum === 0) {
309
-      //     arr.splice(n, 1)
310
-      //   }
311
-      // }
312
-      // this.settlementList = arr
313
-      // console.log(JSON.stringify(this.settlementList))
314
-      // this.calcTotalNum()
315
     },
340
     },
316
     calcTotalNum () { // 计算总数量、价格
341
     calcTotalNum () { // 计算总数量、价格
317
       var num = 0, price = 0
342
       var num = 0, price = 0

+ 1
- 0
src/store/index.js View File

18
   placeOrderForCoffee: () => require('./placeOrderForCoffee/index').default,
18
   placeOrderForCoffee: () => require('./placeOrderForCoffee/index').default,
19
   case: () => require('./case/case').default,
19
   case: () => require('./case/case').default,
20
   goodsOrder: () => require('./goods/order').default,
20
   goodsOrder: () => require('./goods/order').default,
21
+  login: () => require('./login/login').default,
21
 }
22
 }
22
 
23
 
23
 Object.keys(modules).forEach((modKey) => {
24
 Object.keys(modules).forEach((modKey) => {

+ 2
- 2
src/store/login/login.js View File

37
   state: {},
37
   state: {},
38
   mutations: {},
38
   mutations: {},
39
   actions: {
39
   actions: {
40
-    getCaptcha (data) {
40
+    getCaptcha ({ commit }, data) {
41
       return new Promise((resolve) => {
41
       return new Promise((resolve) => {
42
         http.getCaptcha(data).then((res) => {
42
         http.getCaptcha(data).then((res) => {
43
           resolve(res)
43
           resolve(res)
44
         })
44
         })
45
       })
45
       })
46
     },
46
     },
47
-    submitData(data) {
47
+    submitData({ commit }, data) {
48
       return new Promise((resolve) => {
48
       return new Promise((resolve) => {
49
         http.submitData(data).then((res) => {
49
         http.submitData(data).then((res) => {
50
           resolve(res)
50
           resolve(res)