微信

index.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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="info">
  7. <span><em>姓名:</em>{{user.name}}</span>
  8. <span><em>手机号:</em>{{user.phone}}</span>
  9. </div>
  10. <div class="flex-item flex-v">
  11. <ul class="flex-h">
  12. <li class="flex-item" :class="{'active': activeIndex === 0}" @click="cutNav(0)">卡记录</li>
  13. <li class="flex-item" :class="{'active': activeIndex === 1}" @click="cutNav(1)">券记录</li>
  14. </ul>
  15. <div class="flex-item flex-v">
  16. <div class="list-title">
  17. <span>名称</span>
  18. <span>领取时间</span>
  19. <span>记录</span>
  20. </div>
  21. <div class="flex-item">
  22. <div class="scollBody">
  23. <div v-if="activeIndex === 0">
  24. <div class="list-detail" v-for="(item,index) in cardList" :key="index">
  25. <span>{{item.CustomerCardName}}</span>
  26. <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
  27. <span>已使用</span>
  28. </div>
  29. <span class="noData" v-if="cardAjaxOff && !cardList.length">暂无数据</span>
  30. </div>
  31. <div v-if="activeIndex === 1">
  32. <div class="list-detail" v-for="(item,index) in couponList" :key="index">
  33. <span>{{item.CustomerCouponName}}</span>
  34. <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
  35. <span>已使用</span>
  36. </div>
  37. <span class="noData" v-if="couponAjaxOff && !couponList.length">暂无数据</span>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import topCaseInfo from '../../../components/topCaseInfo/index'
  47. import { mapState, createNamespacedHelpers } from 'vuex'
  48. const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
  49. const { mapActions: actions } = createNamespacedHelpers('app')
  50. export default {
  51. name: '',
  52. data () {
  53. return {
  54. activeIndex: 0,
  55. user: {
  56. name: this.$route.query.name,
  57. phone: this.$route.query.phone,
  58. id: this.$route.query.id
  59. },
  60. cardAjaxOff: false,
  61. couponAjaxOff: false,
  62. cardList: [],
  63. couponList: [],
  64. topCaseInfoData: {
  65. CaseName: '',
  66. CaseId: '',
  67. showSelect: false,
  68. userName: ''
  69. },
  70. }
  71. },
  72. computed: {
  73. ...mapState({
  74. userInfo: x => x.userCenter.userInfo,
  75. CaseList: x => x.app.CaseList,
  76. }),
  77. },
  78. components: {
  79. topCaseInfo,
  80. },
  81. created () {
  82. this.getCaseList().then((res) => {
  83. this.topCaseInfoData.CaseName = res.cases[0].CaseName
  84. this.topCaseInfoData.CaseId = res.cases[0].CaseId
  85. })
  86. this.getCustomerCardList({
  87. id: this.user.id,
  88. payload: {
  89. page: 1,
  90. pagesize: 10000,
  91. }
  92. }).then((res) => {
  93. console.log(JSON.stringify(res))
  94. res.list = res.list || []
  95. for (var n = 0; n < res.list.length; n++) {
  96. this.cardList.push(res.list[n])
  97. }
  98. this.cardAjaxOff = true
  99. })
  100. this.getCustomerCouponList({
  101. id: this.user.id,
  102. payload: {
  103. page: 1,
  104. pagesize: 10000,
  105. }
  106. }).then((res) => {
  107. console.log(JSON.stringify(res))
  108. res.list = res.list || []
  109. for (var n = 0; n < res.list.length; n++) {
  110. this.couponList.push(res.list[n])
  111. }
  112. this.couponAjaxOff = true
  113. })
  114. },
  115. methods: {
  116. ...actions([
  117. 'getCaseList',
  118. ]),
  119. ...mapUserCenterActions([
  120. 'getCustomerCardList',
  121. 'getCustomerCouponList',
  122. ]),
  123. cutNav (index) {
  124. this.activeIndex = index
  125. },
  126. }
  127. }
  128. </script>
  129. <!-- Add "scoped" attribute to limit CSS to this component only -->
  130. <style lang="scss" scoped>
  131. @import 'page.scss';
  132. </style>