Blame view

src/components/owner/ownerDetailCoupon.vue 3.24 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
c85e0853   wuxw   业主详情开发完成
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    <div class="margin-top">
      <el-table :data="ownerDetailCouponInfo.coupons" style="width: 100%">
        <el-table-column prop="couponId" :label="$t('ownerDetailCoupon.id')" align="center"></el-table-column>
        <el-table-column prop="couponName" :label="$t('ownerDetailCoupon.couponName')" align="center"></el-table-column>
        <el-table-column prop="value" :label="$t('ownerDetailCoupon.value')" align="center"></el-table-column>
        <el-table-column prop="validityDay" :label="$t('ownerDetailCoupon.validity')" align="center"></el-table-column>
        <el-table-column prop="userName" :label="$t('ownerDetailCoupon.userName')" align="center"></el-table-column>
        <el-table-column prop="tel" :label="$t('ownerDetailCoupon.phone')" align="center"></el-table-column>
        <el-table-column prop="toTypeName" :label="$t('ownerDetailCoupon.purpose')" align="center"></el-table-column>
        <el-table-column prop="stock" :label="$t('ownerDetailCoupon.quantity')" align="center">
          <template slot-scope="scope">{{scope.row.stock}}张</template>
        </el-table-column>
        <el-table-column prop="state" :label="$t('ownerDetailCoupon.status')" align="center">
          <template slot-scope="scope">{{scope.row.state == '1001'?$t('ownerDetailCoupon.unused'):$t('ownerDetailCoupon.used')}}</template>
        </el-table-column>
        <el-table-column prop="startTime" :label="$t('ownerDetailCoupon.effectiveTime')" align="center"></el-table-column>
      </el-table>
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page="pagination.currentPage"
        :page-size="pagination.pageSize"
        :total="pagination.total"
        layout="total, prev, pager, next, jumper">
      </el-pagination>
    </div>
  </template>
  
  <script>
  import { listCouponPropertyUser } from '@/api/owner/ownerDetailCouponApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'OwnerDetailCoupon',
    data() {
      return {
        ownerDetailCouponInfo: {
          coupons: [],
          ownerId: '',
          link: '',
        },
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        }
      }
    },
    methods: {
      open(ownerId, ownerName, link) {
        this.ownerDetailCouponInfo.ownerId = ownerId
        this.ownerDetailCouponInfo.ownerName = ownerName
        this.ownerDetailCouponInfo.link = link
        this._loadOwnerDetailCouponData(1, this.pagination.pageSize)
      },
      _loadOwnerDetailCouponData(page, row) {
        const params = {
          page: page,
          row: row,
          communityId: getCommunityId(),
          tel: this.ownerDetailCouponInfo.link
        }
  
        listCouponPropertyUser(params).then(response => {
          this.ownerDetailCouponInfo.coupons = response.data
f9f29297   wuxw   v1.9 分页 record 传给...
66
          this.pagination.total = response.total
c85e0853   wuxw   业主详情开发完成
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
        }).catch(error => {
          console.error('请求失败处理', error)
        })
      },
      handleCurrentChange(val) {
        this._loadOwnerDetailCouponData(val, this.pagination.pageSize)
      }
    },
    created() {
      this.$on('switch', (data) => {
        this.ownerDetailCouponInfo.ownerId = data.ownerId
        this.ownerDetailCouponInfo.link = data.link
        this._loadOwnerDetailCouponData(1, this.pagination.pageSize)
      })
    }
  }
  </script>
  
  <style scoped>
  /* 样式同上一个组件 */
  </style>