<template>
    <scTable ref="table" :apiObj="list.apiObj" :params="searchKey" @selectionChange="selectionChange" row-key="id">
        <el-table-column type="selection" width="50" fixed="left"></el-table-column>
        <el-table-column label="交易单号" width="220" fixed="left" prop="order_sn"></el-table-column>
        <el-table-column label="会员昵称" prop="name"></el-table-column>
        <el-table-column label="手机号码" prop="tel"></el-table-column>
        <el-table-column label="充值金额" prop="money">
            <template #default="scope">
                ￥{{ scope.row.money }}
            </template>
        </el-table-column>
        <el-table-column label="充值方式" prop="type">
            <template #default="scope">
                <div class="status-danger" v-if="scope.row.type==2"><sc-status-indicator type="danger"></sc-status-indicator> 微信支付</div>
                <div class="status-danger" v-else><sc-status-indicator type="danger"></sc-status-indicator> PC端现金支付</div>
            </template>
        </el-table-column>
        <el-table-column label="充值时间" prop="create_at" width="180"></el-table-column>
    </scTable>
</template>

<script>
export default{
    data(){
        return {
            list: {
                apiObj: this.$API.storeLog.recharge
            },
            dataSelect:[],
            dataSelectFull:[],
            searchKey:{}
        }
    },
    methods: {
        refresh(){
            this.$refs.table.refresh()
        },
        upData(data){
            this.$refs.table.upData(data)
        },
        handleSuccess(){
            this.$refs.table.refresh()
        },
        sortChange(event){
            if (event.order) {
                var data = {
                    "field":event.prop,
                    "order":event.order
                }
                this.$refs.table.upData(data)
            } else {
                this.$refs.table.reload(this.searchKey)
            }
            return ;
        },
        selectionChange(event){
            this.dataSelect = [];
            var arr = [];
            var arrCompany = [];
            event.forEach(function(val,index){
                arr[index] = val.id;
                arrCompany[index] = val;
            });
            this.dataSelectFull = arrCompany;
            this.dataSelect = arr;
            this.$emit("success",this.dataSelect);
            this.$emit("successFull",this.dataSelectFull);
        },
        table_passwd(row){
            this.$nextTick(() => {
                this.$refs.userPasswd.open("edit").setData(row)
            })
        },
    }
}
</script>