| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div class="app-list-content">
- <cl-crud class="liu-crud-wrap" @load="onLoad">
- <template #slot-tabs="{ scope }">
- <el-tabs
- class="liu-tabs"
- type="border-card"
- v-model="tabIndex"
- @tab-click="handleClick"
- >
- <el-tab-pane
- v-for="(item, index) in tabsData"
- :key="index"
- :label="`${item.text}(${item.val})`"
- :name="item.key"
- ></el-tab-pane>
- </el-tabs>
- </template>
- <template #table-column-addTime="{scope}">
- <span>{{ scope.row.addTime | formatTime }}</span>
- </template>
- <template #table-column-deadline="{scope}">
- <span>{{ scope.row.deadline | formatTime }}</span>
- </template>
- <template #table-column-status="{scope}">
- <span v-if="scope.row.status == 1">
- <i class="iconfont icondagou"></i>
- </span>
- <span v-else>{{ scope.row.status | constantfilter('COUPON_STATUS') }}</span>
- </template>
- </cl-crud>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- // cl-crud
- app: null,
- tabIndex: '-1',
- tabsData: [
- {
- text: '全部',
- key: '-1',
- val: 0
- },
- {
- text: '待使用',
- key: '0',
- val: 0
- },
- {
- text: '已使用',
- key: '1',
- val: 0
- },
- {
- text: '已失效',
- key: '2',
- val: 0
- }
- ]
- };
- },
- mounted() {},
- methods: {
- handleClick() {
- this.app.refresh({ status: this.tabIndex });
- },
- // crud
- onLoad({ ctx, app }) {
- this.app = app;
- ctx.service(this.$service.coupon)
- .set('table', {
- columns: [
- {
- prop: 'userId',
- label: 'ID',
- align: 'center'
- },
- {
- prop: 'userName',
- label: '持有人',
- align: 'center'
- },
- {
- prop: 'mobile',
- label: '手机号',
- align: 'center'
- },
- {
- prop: 'amount',
- label: '金额',
- align: 'center'
- },
- {
- prop: 'miniCost',
- label: '最低消费',
- align: 'center',
- emptyText: '无'
- },
- {
- prop: 'addTime',
- label: '领取时间',
- align: 'center',
- width: 150
- },
- {
- prop: 'deadline',
- label: '到期时间',
- align: 'center',
- width: 150
- },
- {
- prop: 'source',
- label: '来源',
- align: 'center'
- },
- {
- prop: 'status',
- label: '状态',
- align: 'center'
- }
- ],
- // 操作列
- op: {
- visible: false, // 是否显示
- // 同 element-ui Table-column Attributes
- props: {
- width: 150,
- align: 'center',
- fixed: 'right',
- label: '操作'
- },
- // 布局,请移步 `layout`
- layout: ['slot-recharge', 'slot-upgrade', 'slot-ship']
- }
- })
- .set('layout', [
- ['slot-tabs'],
- ['flex1', 'refresh-btn'],
- ['data-table'],
- ['flex1', 'pagination']
- ])
- .on('refresh', async (params, { next }) => {
- // 继续执行刷新
- let { asset } = await next(params);
- this.tabsData[0].val = asset.totalNum;
- this.tabsData[1].val = asset.unUseNum;
- this.tabsData[2].val = asset.useNum;
- this.tabsData[3].val = asset.invalidNum;
- })
- .done();
- app.refresh({ status: this.tabIndex });
- }
- }
- };
- </script>
|