微信

index.vue 3.4KB

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