wangfei пре 6 година
родитељ
комит
75e66131b4

+ 8
- 8
src/components/orderListItem/index.vue Прегледај датотеку

1
 <template>
1
 <template>
2
   <div class="orderListItem">
2
   <div class="orderListItem">
3
     <div class="title flex-h">
3
     <div class="title flex-h">
4
-      <div class="orange" v-if="data.status === 0">
4
+      <div class="orange" v-if="data.Status === 0">
5
         <i class="iconfont icon-dengdai"></i><br>
5
         <i class="iconfont icon-dengdai"></i><br>
6
         <span>制作中</span>
6
         <span>制作中</span>
7
       </div>
7
       </div>
8
-      <div class="grey" v-if="data.status === 1">
8
+      <div class="grey" v-if="data.Status === -1">
9
         <i class="iconfont icon-quxiao"></i><br>
9
         <i class="iconfont icon-quxiao"></i><br>
10
         <span>已取消</span>
10
         <span>已取消</span>
11
       </div>
11
       </div>
12
-      <div class="green" v-if="data.status === 2">
12
+      <div class="green" v-if="data.Status === 1">
13
         <i class="iconfont icon-gouxuan"></i><br>
13
         <i class="iconfont icon-gouxuan"></i><br>
14
         <span>已完成</span>
14
         <span>已完成</span>
15
       </div>
15
       </div>
16
       <div class="flex-item">
16
       <div class="flex-item">
17
         <div>
17
         <div>
18
-          <span>{{data.caseName}}</span>
18
+          <span>{{data.CaseName}}</span>
19
         </div>
19
         </div>
20
       </div>
20
       </div>
21
-      <span>{{data.creatTime}}</span>
21
+      <span>{{toolClass.dateFormat(data.CreateDate, 'MM/dd hh:mm')}}</span>
22
     </div>
22
     </div>
23
     <div class="line">
23
     <div class="line">
24
       <div>
24
       <div>
28
     <div class="list flex-h">
28
     <div class="list flex-h">
29
       <div class="flex-item">
29
       <div class="flex-item">
30
         <ul>
30
         <ul>
31
-          <li v-for="(subItem,subIndex) in data.goodsList" :key="subIndex">
32
-            <span>{{subItem.name}}</span>
31
+          <li v-for="(subItem,subIndex) in data.Goods" :key="subIndex">
32
+            <span>{{subItem.GoodsName + (subItem.SpecName!==''?'('+subItem.SpecName+')':'')}}</span>
33
             <div>
33
             <div>
34
-              <span>¥{{subItem.price === null ? subItem.specPrice : subItem.price}} x {{subItem.num === null ? subItem.specNum : subItem.num}}</span>
34
+              <span>¥{{subItem.Price}} x {{subItem.Number}}</span>
35
             </div>
35
             </div>
36
           </li>
36
           </li>
37
         </ul>
37
         </ul>

+ 12
- 2
src/pages/sales/coffeeIndex/index.vue Прегледај датотеку

13
             <div class="topInfo flex-h">
13
             <div class="topInfo flex-h">
14
               <div class="flex-item">
14
               <div class="flex-item">
15
                 <div>
15
                 <div>
16
-                  <span>共计已使用:45杯</span>
16
+                  <span>共计已使用:{{caseTotal.total}}杯</span>
17
                 </div>
17
                 </div>
18
               </div>
18
               </div>
19
               <div class="flex-item">
19
               <div class="flex-item">
20
                 <div>
20
                 <div>
21
-                  <span>本月已用:0杯</span>
21
+                  <span>本月已用:{{caseTotal.monthtotal}}杯</span>
22
                 </div>
22
                 </div>
23
               </div>
23
               </div>
24
               <a>点单记录</a>
24
               <a>点单记录</a>
87
 import { mapState, createNamespacedHelpers } from 'vuex'
87
 import { mapState, createNamespacedHelpers } from 'vuex'
88
 const { mapActions: actions } = createNamespacedHelpers('app')
88
 const { mapActions: actions } = createNamespacedHelpers('app')
89
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
89
 const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
90
+const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
90
 
91
 
91
 export default {
92
 export default {
92
   name: '',
93
   name: '',
152
       userInfo: x => x.userCenter.userInfo,
153
       userInfo: x => x.userCenter.userInfo,
153
       CaseList: x => x.app.CaseList,
154
       CaseList: x => x.app.CaseList,
154
       CaseTableList: x => x.placeOrderForCoffee.CaseTableList,
155
       CaseTableList: x => x.placeOrderForCoffee.CaseTableList,
156
+    }),
157
+    ...mapCaseState({
158
+      caseTotal: x => x.caseTotal,
155
     })
159
     })
156
   },
160
   },
157
   components: {
161
   components: {
167
       this.getCaseTableList({
171
       this.getCaseTableList({
168
         caseid: this.topCaseInfoData.CaseId
172
         caseid: this.topCaseInfoData.CaseId
169
       })
173
       })
174
+      this.getCaseTotal({
175
+        caseid: this.topCaseInfoData.CaseId
176
+      })
170
     })
177
     })
171
   },
178
   },
172
   methods: {
179
   methods: {
176
     ...caseTableActions([
183
     ...caseTableActions([
177
       'getCaseTableList',
184
       'getCaseTableList',
178
     ]),
185
     ]),
186
+    ...mapCaseActions([
187
+      'getCaseTotal',
188
+    ]),
179
     selectCase (val) { // 选择案场
189
     selectCase (val) { // 选择案场
180
       this.topCaseInfoData.CaseName = val.CaseName
190
       this.topCaseInfoData.CaseName = val.CaseName
181
       this.topCaseInfoData.CaseId = val.CaseId
191
       this.topCaseInfoData.CaseId = val.CaseId

+ 5
- 2
src/pages/user/mainPage/userCenter/index.vue Прегледај датотеку

46
           <span>课程订单</span>
46
           <span>课程订单</span>
47
           <i class="iconfont icon-jiantou-right"></i>
47
           <i class="iconfont icon-jiantou-right"></i>
48
         </div>
48
         </div>
49
-        <div class="menu-item flex-h">
49
+        <div class="menu-item flex-h" @click="toGoodsOrder">
50
           <span>商品订单</span>
50
           <span>商品订单</span>
51
           <i class="iconfont icon-jiantou-right"></i>
51
           <i class="iconfont icon-jiantou-right"></i>
52
         </div>
52
         </div>
103
     },
103
     },
104
     bindMobile () {
104
     bindMobile () {
105
       this.$router.push({ name: 'bindMobile' })
105
       this.$router.push({ name: 'bindMobile' })
106
-    }
106
+    },
107
+    toGoodsOrder () {
108
+      this.$router.push({ name: 'orderList' })
109
+    },
107
   }
110
   }
108
 }
111
 }
109
 </script>
112
 </script>

+ 27
- 97
src/pages/user/orderList/index.vue Прегледај датотеку

1
 <template>
1
 <template>
2
   <div class="mainPage flex-v">
2
   <div class="mainPage flex-v">
3
-    <div class="top">
4
-      <topCaseInfo :data="topCaseInfoData"></topCaseInfo>
5
-    </div>
3
+    <!-- <div class="top">
4
+      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer != undefined ? userInfo.customer.CustomerName : ''"></topCaseInfo>
5
+    </div> -->
6
     <div class="flex-item">
6
     <div class="flex-item">
7
       <div class="flex-h">
7
       <div class="flex-h">
8
         <div class="flex-item">
8
         <div class="flex-item">
9
           <ul>
9
           <ul>
10
-            <li v-for="(item,index) in list" :key="index">
10
+            <li v-for="(item,index) in orders.list" :key="index">
11
               <orderListItem :data="item"></orderListItem>
11
               <orderListItem :data="item"></orderListItem>
12
             </li>
12
             </li>
13
           </ul>
13
           </ul>
20
 <script>
20
 <script>
21
 import topCaseInfo from '../../../components/topCaseInfo/index'
21
 import topCaseInfo from '../../../components/topCaseInfo/index'
22
 import orderListItem from '../../../components/orderListItem/index'
22
 import orderListItem from '../../../components/orderListItem/index'
23
+import { mapState, createNamespacedHelpers } from 'vuex'
24
+// const { mapActions: actions } = createNamespacedHelpers('app')
25
+
26
+const { mapState: mapOrdersState, mapActions: mapOrdersActions } = createNamespacedHelpers('goodsOrder')
23
 
27
 
24
 export default {
28
 export default {
25
   name: '',
29
   name: '',
26
   data () {
30
   data () {
27
     return {
31
     return {
28
-      topCaseInfoData: {
29
-        caseName: 'xxx',
30
-        caseId: '',
31
-        showSelect: false,
32
-        userName: 'xxx'
33
-      },
34
-      list: [{
35
-        status: 0,
36
-        caseName: '案场名称',
37
-        creatTime: '02/16 14:20',
38
-        goodsList: [{
39
-          name: '商品名称1',
40
-          specName: '加冰',
41
-          price: null,
42
-          specPrice: 20,
43
-          num: null,
44
-          specNum: 2,
45
-        },{
46
-          name: '商品名称2',
47
-          specName: null,
48
-          price: 100,
49
-          specPrice: null,
50
-          num: 1,
51
-          specNum: null,
52
-        },{
53
-          name: '商品名称3',
54
-          specName: null,
55
-          price: 100,
56
-          specPrice: null,
57
-          num: 1,
58
-          specNum: null,
59
-        },{
60
-          name: '商品名称4',
61
-          specName: null,
62
-          price: 100,
63
-          specPrice: null,
64
-          num: 1,
65
-          specNum: null,
66
-        },{
67
-          name: '商品名称5',
68
-          specName: null,
69
-          price: 100,
70
-          specPrice: null,
71
-          num: 1,
72
-          specNum: null,
73
-        },{
74
-          name: '商品名称6',
75
-          specName: null,
76
-          price: 100,
77
-          specPrice: null,
78
-          num: 1,
79
-          specNum: null,
80
-        }],
81
-      },{
82
-        status: 1,
83
-        caseName: '案场名称',
84
-        creatTime: '02/16 14:20',
85
-        goodsList: [{
86
-          name: '商品名称1',
87
-          specName: '加冰',
88
-          price: null,
89
-          specPrice: 20,
90
-          num: null,
91
-          specNum: 2,
92
-        }],
93
-      },{
94
-        status: 2,
95
-        caseName: '案场名称',
96
-        creatTime: '02/16 14:20',
97
-        goodsList: [{
98
-          name: '商品名称1',
99
-          specName: '加冰',
100
-          price: null,
101
-          specPrice: 20,
102
-          num: null,
103
-          specNum: 2,
104
-        }],
105
-      },{
106
-        status: 0,
107
-        caseName: '案场名称',
108
-        creatTime: '02/16 14:20',
109
-        goodsList: [{
110
-          name: '商品名称1',
111
-          specName: '加冰',
112
-          price: null,
113
-          specPrice: 20,
114
-          num: null,
115
-          specNum: 2,
116
-        }],
117
-      }],
32
+      page: 1,
33
+      pagesize: 10,
118
     }
34
     }
119
   },
35
   },
120
-  computed: {},
36
+  computed: {
37
+    ...mapState({
38
+      userInfo: x => x.userCenter.userInfo,
39
+    }),
40
+    ...mapOrdersState({
41
+      orders: x => x.orders,
42
+    }),
43
+  },
121
   components: {
44
   components: {
122
     topCaseInfo,
45
     topCaseInfo,
123
     orderListItem,
46
     orderListItem,
124
   },
47
   },
125
-  created () { },
48
+  created () {
49
+    this.getCustomerGoodsOrder({
50
+      page: this.page,
51
+      pagesize: this.pagesize,
52
+    })
53
+  },
126
   methods: {
54
   methods: {
127
-    
55
+    ...mapOrdersActions([
56
+      'getCustomerGoodsOrder',
57
+    ])
128
   }
58
   }
129
 }
59
 }
130
 </script>
60
 </script>

+ 32
- 0
src/store/case/case.js Прегледај датотеку

1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+// 请求数据
5
+export default {
6
+  namespaced: true,
7
+  state: {
8
+    caseTotal: {},
9
+  },
10
+  mutations: {
11
+    setCaseTotal (state, data) { // 获取案场下单数量信息
12
+      state.caseTotal = data
13
+    },
14
+  },
15
+  actions: {
16
+    getCaseTotal ({ commit }, { caseid }) {
17
+      return new Promise((resolve, reject) => {
18
+        Ajax(api.case.total.url, {
19
+          method: api.case.total.method,
20
+          urlData: {
21
+            caseid
22
+          }
23
+        }).then(res => {
24
+          commit("setCaseTotal", res)
25
+          resolve(res)
26
+        }).catch((err) => {
27
+          reject(err)
28
+        })
29
+      })
30
+    },
31
+  }
32
+}

+ 31
- 0
src/store/goods/order.js Прегледај датотеку

1
+import Ajax from '../../util/ajax'
2
+import api from '../../util/api'
3
+
4
+export default {
5
+  namespaced: true,
6
+  state: {
7
+    orders: {},
8
+  },
9
+  mutations: {
10
+    setGoodsOrders (state, data) { // 获取案场下单数量信息
11
+      state.orders = data
12
+    },
13
+  },
14
+  actions: {
15
+    getCustomerGoodsOrder ({ commit }, payload) {
16
+      return new Promise((resolve, reject) => {
17
+        Ajax(api.goods.getCustOrders.url, {
18
+          method: api.goods.getCustOrders.method,
19
+          queryData: {
20
+            ...payload
21
+          },
22
+        }).then(res => {
23
+          commit("setGoodsOrders", res)
24
+          resolve(res)
25
+        }).catch((err) => {
26
+          reject(err)
27
+        })
28
+      })
29
+    },
30
+  }
31
+}

+ 2
- 0
src/store/index.js Прегледај датотеку

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

+ 14
- 2
src/util/api.js Прегледај датотеку

89
       url: `${baseUrl}${guest}/cms/location`
89
       url: `${baseUrl}${guest}/cms/location`
90
     },
90
     },
91
   },
91
   },
92
-  login:{ // 主管、销售端登陆
92
+  login: { // 主管、销售端登陆
93
     login: {
93
     login: {
94
       method: 'post',
94
       method: 'post',
95
       url: `${baseUrl}${guest}/wxsignin`
95
       url: `${baseUrl}${guest}/wxsignin`
96
     }
96
     }
97
-  }
97
+  },
98
+  case: {
99
+    total: {
100
+      method: 'get',
101
+      url: `${baseUrl}${wechat}/goods/case/:caseid`
102
+    },
103
+  },
104
+  goods: {
105
+    getCustOrders: {
106
+      method: 'get',
107
+      url: `${baseUrl}${wechat}/goods/user`
108
+    }
109
+  },
98
 }
110
 }
99
 export default $api
111
 export default $api