许成详 6 years ago
parent
commit
101dbfd6f1
1 changed files with 19 additions and 25 deletions
  1. 19
    25
      src/pages/user/mainPage/coffeeIndex/index.vue

+ 19
- 25
src/pages/user/mainPage/coffeeIndex/index.vue View File

1
 <template>
1
 <template>
2
   <div class="mainPage flex-v">
2
   <div class="mainPage flex-v">
3
     <div class="top">
3
     <div class="top">
4
-      <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer != undefined ? userInfo.customer.CustomerName : ''" @selectCase="ShowSelect = true"></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" :class="{'active': navActive === index}" @click="cutNav(index)">{{item.value}}</a>
36
                         <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)}}">
36
                         <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)}}">
37
                           <caseTableItem :item="subItem" :index="subIndex"></caseTableItem>
37
                           <caseTableItem :item="subItem" :index="subIndex"></caseTableItem>
38
                         </router-link>
38
                         </router-link>
39
-                        <li class="flex-item noData" v-if="item.Tables.length % 2 != 0"></li>
39
+                        <li class="flex-item noData" v-if="(item.Tables || []).length % 2 != 0"></li>
40
                       </ul>
40
                       </ul>
41
                     </li>
41
                     </li>
42
                   </ul>
42
                   </ul>
54
                     <span>万</span>
54
                     <span>万</span>
55
                   </div>
55
                   </div>
56
                 </div>
56
                 </div>
57
-                <router-link :to="{name: 'salesRecord',query: {}}">销售记录</router-link>
57
+                <a :href="getUrl('salesRecord')">销售记录</a>
58
+                <!-- <router-link :to="{name: 'salesRecord',query: {}}">销售记录</router-link> -->
58
               </div>
59
               </div>
59
               <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>
60
             </div>
61
             </div>
71
     <van-picker :hidden="!showSelect"
72
     <van-picker :hidden="!showSelect"
72
       show-toolbar
73
       show-toolbar
73
       title="选择案场"
74
       title="选择案场"
74
-      :columns="caseList"
75
+      :columns="CaseList"
75
       @cancel="showSelect = false"
76
       @cancel="showSelect = false"
76
       @confirm="selectCase"
77
       @confirm="selectCase"
77
-      value-key="value"
78
+      value-key="CaseName"
78
     />
79
     />
79
   </div>
80
   </div>
80
 </template>
81
 </template>
105
         id: '3',
106
         id: '3',
106
       }],
107
       }],
107
       topCaseInfoData: {
108
       topCaseInfoData: {
108
-        caseName: '',
109
-        caseId: '',
110
-        showSelect: true,
111
-        userName: ''
109
+        CaseName: '',
110
+        CaseId: '',
111
+        ShowSelect: true,
112
       },
112
       },
113
       caseInfo: {
113
       caseInfo: {
114
         value: '',
114
         value: '',
115
         id: ''
115
         id: ''
116
       },
116
       },
117
       showSelect: false,
117
       showSelect: false,
118
-      caseList: [{
119
-        value: '案场一',
120
-        id: ''
121
-      }, {
122
-        value: '案场二',
123
-        id: ''
124
-      }, {
125
-        value: '案场三',
126
-        id: ''
127
-      }, {
128
-        value: '案场四',
129
-        id: ''
130
-      }],
131
       list: [{
118
       list: [{
132
         name: '案场名称1',
119
         name: '案场名称1',
133
         list: [{}, {}, {}, {}, {}],
120
         list: [{}, {}, {}, {}, {}],
156
     }),
143
     }),
157
     ...mapCaseState({
144
     ...mapCaseState({
158
       caseTotal: x => x.caseTotal,
145
       caseTotal: x => x.caseTotal,
159
-    })
146
+    }),
160
   },
147
   },
161
   components: {
148
   components: {
162
     topCaseInfo,
149
     topCaseInfo,
186
     ...mapCaseActions([
173
     ...mapCaseActions([
187
       'getCaseTotal',
174
       'getCaseTotal',
188
     ]),
175
     ]),
176
+    getUrl (val) {
177
+      var url = window.location.pathname
178
+      return url.replace('user.html', 'sales.html') + '' + val
179
+    },
180
+    showVanPicker () {
181
+      this.showSelect = true
182
+    },
189
     selectCase (val) { // 选择案场
183
     selectCase (val) { // 选择案场
190
       this.topCaseInfoData.CaseName = val.CaseName
184
       this.topCaseInfoData.CaseName = val.CaseName
191
       this.topCaseInfoData.CaseId = val.CaseId
185
       this.topCaseInfoData.CaseId = val.CaseId
192
       this.getCaseTableList({
186
       this.getCaseTableList({
193
         caseid: this.topCaseInfoData.CaseId
187
         caseid: this.topCaseInfoData.CaseId
194
       })
188
       })
195
-      this.ShowSelect = false
189
+      this.showSelect = false
196
     },
190
     },
197
     cutNav (index) { // 切换nav
191
     cutNav (index) { // 切换nav
198
       this.navActive = index
192
       this.navActive = index
206
 
200
 
207
 <!-- Add "scoped" attribute to limit CSS to this component only -->
201
 <!-- Add "scoped" attribute to limit CSS to this component only -->
208
 <style lang="scss" scoped>
202
 <style lang="scss" scoped>
209
-@import "page.scss";
203
+@import 'page.scss';
210
 </style>
204
 </style>