微信

index.vue 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="mainPage flex-v">
  3. <div class="top">
  4. <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer.RealName ? userInfo.customer.RealName : 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>{{item.Status === 2?"已使用":"未使用"}}</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. },
  69. }
  70. },
  71. computed: {
  72. ...mapState({
  73. userInfo: x => x.userCenter.userInfo,
  74. CaseList: x => x.app.CaseList,
  75. }),
  76. },
  77. components: {
  78. topCaseInfo,
  79. },
  80. created () {
  81. this.getCaseList().then((res) => {
  82. this.topCaseInfoData.caseId = this.userInfo.customer.BelongCaseId
  83. for (let i = 0; i < this.CaseList.length; i++) {
  84. if (this.CaseList[i].CaseId === this.topCaseInfoData.caseId) {
  85. this.topCaseInfoData.caseName = this.CaseList[i].CaseName
  86. }
  87. }
  88. })
  89. this.getCustomerCardList({
  90. id: this.user.id,
  91. payload: {
  92. page: 1,
  93. pagesize: 10000,
  94. }
  95. }).then((res) => {
  96. console.log(JSON.stringify(res))
  97. res.list = res.list || []
  98. for (var n = 0; n < res.list.length; n++) {
  99. this.cardList.push(res.list[n])
  100. }
  101. this.cardAjaxOff = true
  102. })
  103. this.getCustomerCouponList({
  104. id: this.user.id,
  105. payload: {
  106. page: 1,
  107. pagesize: 10000,
  108. }
  109. }).then((res) => {
  110. console.log(JSON.stringify(res))
  111. res.list = res.list || []
  112. for (var n = 0; n < res.list.length; n++) {
  113. this.couponList.push(res.list[n])
  114. }
  115. this.couponAjaxOff = true
  116. })
  117. },
  118. methods: {
  119. ...actions([
  120. 'getCaseList',
  121. ]),
  122. ...mapUserCenterActions([
  123. 'getCustomerCardList',
  124. 'getCustomerCouponList',
  125. ]),
  126. cutNav (index) {
  127. this.activeIndex = index
  128. },
  129. showVanPicker () {
  130. this.showSelect = true
  131. },
  132. selectCase (val) { // 选择案场
  133. this.topCaseInfoData.caseName = val.CaseName
  134. this.topCaseInfoData.caseId = val.CaseId
  135. this.getCaseTableList({
  136. caseid: this.topCaseInfoData.caseId
  137. })
  138. this.showSelect = false
  139. }
  140. }
  141. }
  142. </script>
  143. <!-- Add "scoped" attribute to limit CSS to this component only -->
  144. <style lang="scss" scoped>
  145. @import 'page.scss';
  146. </style>