<template>
	<div class="app-list-content">
		<x-crud class="liu-crud-wrap" @load="onLoad">
			<template #table-column-addTime="{scope}">
				<span>{{ scope.row.addTime | formatTime('MM-DD HH:mm') }}</span>
			</template>
			<template #table-column-amount="{scope}">
				<span v-if="scope.row.io == 1">+</span>
				<span v-else>-</span>
					{{ scope.row.amount}}
			</template>

			<template #table-column-payWay="{scope}">
				<span v-if="scope.row.payWay == 0">微信支付</span>
				<span v-else-if="scope.row.payWay == 1">支付宝</span>
				<span v-else-if="scope.row.payWay == 2">余额</span>
				<span v-else>-</span>
			</template>

			<template #table-column-fromType="{scope}">
				<span v-if="scope.row.fromType == 0">门店</span>
				<span v-else-if="scope.row.fromType == 1">商城</span>
				<span v-else-if="scope.row.fromType == 2">朋友圈</span>
				<span v-else>-</span>
			</template>

		</x-crud>
	</div>
</template>

<script>
import merchantCapital from '@/service/merchant-capital/index';
export default {
	name: 'assets-list',
	methods: {
		// x-crud 组件ad
		onLoad({ ctx, app }) {
			this.app = app;
			ctx.service(merchantCapital)
				.set('table', {
					columns: [
						{
							prop: 'userName',
							label: '姓名',
							align: 'center'
						},
						{
							prop: 'amount',
							label: '收入',
							align: 'center'
						},
						{
							prop: 'addTime',
							label: '时间',
							align: 'center'
						},
						{
							prop: 'payWay',
							label: '支付方式',
							align: 'center'
						},
						{
							prop: 'fromType',
							label: '来源',
							align: 'center'
						},
						{
							prop: 'totalIncome',
							label: '累计收入',
							align: 'center'
						},
						{
							prop: 'id',
							label: '编号',
							align: 'center',
							'min-width': 100
						}
					],
					// 操作列
					op: {
						visible: false, // 是否显示
						// 同 element-ui Table-column Attributes
						props: {
							width: 100,
							align: 'center',
							fixed: 'right',
							label: '操作'
						},
						// 布局，请移步 `layout`
						layout: []
					}
				})
				.set('layout', [
					['slot-tabs'],
					['flex1', 'slot-add-ad-btn', 'refresh-btn'],
					['data-table'],
					['flex1', 'pagination']
				])
				.done();
			app.refresh({ io: '1' });
		}
	}
};
</script>

<style lang="stylus" scoped></style>
