<template>
  <div v-loading="loading">
    <el-table
        :data="list"
        border
        style="width: 100%">
        <el-table-column
        prop="create_time"
        label="购买时间"
        width="180">
        </el-table-column>
        <el-table-column
        prop="username"
        label="会员"
        width="180">
        </el-table-column>
        <el-table-column
        prop="product_name"
        label="产品名"
        width="180">
        </el-table-column>
        <el-table-column
        prop="real_price"
        label="实付价格">
        </el-table-column>
        <el-table-column
        prop="order_no"
        label="订单号">
        </el-table-column>
        <el-table-column
        prop="ali_wx_no"
        label="wx/zfb订单号">
        </el-table-column>
        <el-table-column
        prop="user"
        label="收货人">
        </el-table-column>
        <el-table-column
        prop="phone"
        label="收货人电话">
        </el-table-column>
        <el-table-column
        prop="address"
        label="地址">
        </el-table-column>
        <el-table-column
        prop="is_send"
        label="是否发货">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.is_send"
            v-if="scope.row.is_send == 1"
            disabled
            active-value='1'
            inactive-value='0'
            active-color="#13ce66"
            inactive-color="#dcdfe6"
            @change="changeLineStatus(scope.row)"
          ></el-switch>
          
          <el-switch
            v-model="scope.row.is_send"
            v-if="scope.row.is_send == 0"
            active-value='1'
            inactive-value='0'
            active-color="#13ce66"
            inactive-color="#dcdfe6"
            @change="changeLineStatus(scope.row)"
          ></el-switch>
        </template>
        </el-table-column>
    </el-table>

    <div class="block">
        <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="page"
        :page-size="50"
        layout="total, prev, pager, next"
        :total="1000">
        </el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  name: 'treeTable',
  components: {
  },
  data () {
    return {
      loading: false,
      list:[],
      page:1
    }
  },
  created () {
    this.$store.commit('setCurrentNav', '订单管理>>软路由订单明细')
    this.get()
  },
  methods: {
    search () {
      
    },
    get () {
      this.$api.get(this.$api.phpURL + 'ros/order/getAllList?page='+this.page).then(res => {
        this.list = res.Data
      })
    },
    handleCurrentChange() {
        this.get();
    },
    changeLineStatus(r) {
      this.$api.post(this.$api.phpURL + 'ros/order/setIsend', {r}).then(res => {})
    }
  }
}
</script>
<style scoped>
</style>
