123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <template>
- <div class="mainPage flex-v">
- <div class="top">
- <topCaseInfo :data="topCaseInfoData" :userName="userInfo.customer.RealName ? userInfo.customer.RealName : userInfo.customer.CustomerName" @selectCase="showSelect = true"></topCaseInfo>
- </div>
- <div class="info">
- <span><em>姓名:</em>{{user.name}}</span>
- <span><em>手机号:</em>{{user.phone}}</span>
- </div>
- <div class="flex-item flex-v">
- <ul class="flex-h">
- <li class="flex-item" :class="{'active': activeIndex === 0}" @click="cutNav(0)">卡记录</li>
- <li class="flex-item" :class="{'active': activeIndex === 1}" @click="cutNav(1)">券记录</li>
- </ul>
- <div class="flex-item flex-v">
- <div class="list-title">
- <span>名称</span>
- <span>领取时间</span>
- <span>记录</span>
- </div>
- <div class="flex-item">
- <div class="scollBody">
- <div v-if="activeIndex === 0">
- <div class="list-detail" v-for="(item,index) in cardList" :key="index">
- <span>{{item.CustomerCardName}}</span>
- <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
- <span>已使用</span>
- </div>
- <span class="noData" v-if="cardAjaxOff && !cardList.length">暂无数据</span>
- </div>
- <div v-if="activeIndex === 1">
- <div class="list-detail" v-for="(item,index) in couponList" :key="index">
- <span>{{item.CustomerCouponName}}</span>
- <span>{{toolClass.dateFormat(item.ReceiveDate)}}</span>
- <span>{{item.Status === 2?"已使用":"未使用"}}</span>
- </div>
- <span class="noData" v-if="couponAjaxOff && !couponList.length">暂无数据</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import topCaseInfo from '../../../components/topCaseInfo/index'
- import { mapState, createNamespacedHelpers } from 'vuex'
- const { mapActions: mapUserCenterActions } = createNamespacedHelpers('userCenter')
- const { mapActions: actions } = createNamespacedHelpers('app')
-
- export default {
- name: '',
- data () {
- return {
- activeIndex: 0,
- user: {
- name: this.$route.query.name,
- phone: this.$route.query.phone,
- id: this.$route.query.id
- },
- cardAjaxOff: false,
- couponAjaxOff: false,
- cardList: [],
- couponList: [],
- topCaseInfoData: {
- caseName: '',
- caseId: '',
- showSelect: false
- },
- }
- },
- computed: {
- ...mapState({
- userInfo: x => x.userCenter.userInfo,
- CaseList: x => x.app.CaseList,
- }),
- },
- components: {
- topCaseInfo,
- },
- created () {
- this.getCaseList().then((res) => {
- this.topCaseInfoData.caseId = this.userInfo.customer.BelongCaseId
- for (let i = 0; i < this.CaseList.length; i++) {
- if (this.CaseList[i].CaseId === this.topCaseInfoData.caseId) {
- this.topCaseInfoData.caseName = this.CaseList[i].CaseName
- }
- }
- })
- this.getCustomerCardList({
- id: this.user.id,
- payload: {
- page: 1,
- pagesize: 10000,
- }
- }).then((res) => {
- console.log(JSON.stringify(res))
- res.list = res.list || []
- for (var n = 0; n < res.list.length; n++) {
- this.cardList.push(res.list[n])
- }
- this.cardAjaxOff = true
- })
- this.getCustomerCouponList({
- id: this.user.id,
- payload: {
- page: 1,
- pagesize: 10000,
- }
- }).then((res) => {
- console.log(JSON.stringify(res))
- res.list = res.list || []
- for (var n = 0; n < res.list.length; n++) {
- this.couponList.push(res.list[n])
- }
- this.couponAjaxOff = true
- })
- },
- methods: {
- ...actions([
- 'getCaseList',
- ]),
- ...mapUserCenterActions([
- 'getCustomerCardList',
- 'getCustomerCouponList',
- ]),
- cutNav (index) {
- this.activeIndex = index
- },
- showVanPicker () {
- this.showSelect = true
- },
- selectCase (val) { // 选择案场
- this.topCaseInfoData.caseName = val.CaseName
- this.topCaseInfoData.caseId = val.CaseId
- this.getCaseTableList({
- caseid: this.topCaseInfoData.caseId
- })
- this.showSelect = false
- }
- }
- }
- </script>
-
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style lang="scss" scoped>
- @import 'page.scss';
- </style>
|