import ColResult from '@/components/col-result' import { useList } from '@/helpers/hooks' import request from '@/helpers/request' import { state } from '@/state' import { List } from 'vant' import { defineComponent, PropType } from 'vue' import styles from './index.module.less' import Item from './item' // 使用状态: EXPIRED(已失效) USABLE(可使用) USED(已使用) export default defineComponent({ name: 'coupon-list', props: { useState: { type: String as PropType<'USABLE' | 'USED' | 'EXPIRED'>, default: 'USABLE' } }, data() { return { list: [] as any, listState: { dataShow: true, // 判断是否有数据 loading: false, finished: false }, params: { useState: this.useState, page: 1, rows: 20 } } }, mounted() { this.getList() }, methods: { async getList() { try { const result = await useList(`${state.platformApi}/couponInfo/page`, { params: this.params, list: this.list, ...this.listState }) const { params, list, ...res } = result this.params = params this.list = list this.listState = res } catch { // } } }, render() { return ( <> {this.listState.dataShow ? ( 0 && styles.list]} onLoad={this.getList} immediateCheck={false} > {this.list.map((item: any) => ( ))} ) : ( )} ) } })