<template>
    <div v-loading="loading">
        <div class="white-box">
            <el-table class="withdraw-table" :data="tableData" stripe style="width: 100%;">
                <el-table-column label="创建时间">
                    <template slot-scope="scope">
                        {{tool.formatDate(scope.row.CREATED_AT)}}
                    </template>
                </el-table-column>
                <el-table-column label="订单编号" prop="SN">
                </el-table-column>
              <!--  <el-table-column label="会员ID" prop="USER_ID">

                </el-table-column>-->
                <el-table-column label="会员编号" prop="USER_NAME">

                </el-table-column>

                <el-table-column label="订单金额" prop="ORDER_AMOUNT">
                </el-table-column>
                <el-table-column label="订单PV" prop="PV">
                </el-table-column>
                <el-table-column label="收货人" prop="CONSIGNEE">
                </el-table-column>
                <el-table-column label="收货电话" prop="MOBILE">
                </el-table-column>
                <el-table-column label="支付时间" prop="PAY_AT">
                </el-table-column>
            </el-table>
            <div class="white-box-footer">
                <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
            </div>
        </div>
    </div>
</template>

<script>
    import network from '@/utils/network'
    import tool from '@/utils/tool'
    import Pagination from '@/components/Pagination'
    export default {
        name: "order-list",
        components: {Pagination},
        mounted() {
            this.getData()
        },
        data() {
            return {
                loading: false,
                form:{

                },
                tableData:null,
                list: null,
                currentPage: 1,
                totalPages: 1,
                totalCount: 1,
                pageSize: 20,
                tool: tool,
            }
        },
        methods: {
            handleCurrentChange (page) {
                this.getData(page, this.pageSize)
            },
            handleSizeChange (pageSize) {
                this.getData(this.currentPage, pageSize)
            },
            getData(page, pageSize) {
                network.getPageData(this, 'shop/order-list', page, pageSize, {type: this.type}, function (response) {
                    console.log(response)
                    this.loading = false;
                    this.list = response.list;
                    let settingObj=this.list;
                    let settingArr = Object.keys(settingObj).map(key => {
                        //console.log(key); //为每个键名
                        return settingObj[key];  //把每个对象返回出去生成一个新的数组中相当于0:{id:1}
                    } );
                    this.tableData=settingArr;
                    console.log(this.tableData)


                });
            },
        }
    }
</script>
<style scoped>

</style>