Newer
Older
smartKitchenFront / src / views / sales / orderList.vue
<!--订单列表-->
<template>
  <div class="product_container">
    <div class="productFun">
      <div class="productInput">
        订单号
        <div class="inputBox" style="width: 150px">
          <el-input
            v-model="selectInfo.orderId"
            placeholder="请输入订单号"
            clearable
            class="product-input"
          />
        </div>
        下单人
        <div class="inputBox" style="width: 144px">
          <el-input
            v-model="selectInfo.userName"
            placeholder="请输入下单人"
            clearable
            class="product-input"
          />
        </div>
      </div>
      <div class="productBtn">
        <el-button
          type="primary"
          icon="el-icon-search"
          class="btnItem"
          @click="selectData"
        >
          查询
        </el-button>
        <el-button
          type="primary"
          icon="el-icon-refresh-right"
          class="btnItem"
          @click="reset"
        >
          重置
        </el-button>
      </div>
    </div>
    <el-table
      ref="multipleTable"
      :data="tableData.rows"
      :row-class-name="tableRowClassName"
      :header-cell-style="{
        'text-align': 'center',
        background: '  #2483b3',
        color: 'white',
      }"
      :row-style="{ 'text-align': 'center' }"
      style="width: 100%"
      v-loading="loading"
    >
      <el-table-column type="selection" width="55" />
      <el-table-column prop="index" label="序号" />
      <el-table-column prop="orderId" label="订单号" />
      <el-table-column prop="userName" label="下单人" />
      <el-table-column prop="userRoleName" label="下单人角色" />
      <el-table-column prop="userPhone" label="联系方式" />
      <el-table-column prop="orderSourceName" label="订单来源" />
      <el-table-column prop="signDate" label="签订日期" />
      <el-table-column prop="deliveryDate" label="交付日期" />
      <el-table-column prop="deliveryAddress" label="交付地址" />
      <el-table-column prop="receiver" label="收货人" />
      <el-table-column prop="receiverPhone" label="收货人联系方式" />
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            type="text"
            size="small"
            @click="showInfo(scope.row)"
          >
            详情
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <group-page v-model="isFristPage" :limit="limit" :total="total" :offset="offset" :count="tableData.total" @setOffset="setOffset" @setLimit="setLimit" />
    <!-- 新增弹框 -->
    <order-info-dialog :is-show-info="isShowInfo" :data-info="rowInfo" @close="closeInfo" />
  </div>
</template>

<script>
// 组件
import GroupPage from '../../components/mycomponent/groupPage.vue'
import OrderInfoDialog from '../../components/mycomponent/dialog/salesDialog/orderInfoDialog.vue'
// 逻辑
import { tableRowClassName } from '../../utils/myUtils/changeTableTr'
import { listMixin, elDataDialog } from '../../utils/myUtils/mixins/listPage'
import { listPage } from '../../api/sales/orderList'
export default { // 加入分页逻辑
  components: {
    OrderInfoDialog,
    GroupPage
  },
  mixins: [listMixin, elDataDialog],
  data() {
    return {
      isShowInfo: false, // 显示新增功能
      selectInfo: {
        orderId: '',
        userName: ''
      },
      loading:false

    }
  },
  methods: {
    tableRowClassName: tableRowClassName,

    getListPage(limit, offset) {
      this.loading = true
      listPage(`limit=${limit}&offset=${offset}`, this.queryInfo).then(res => {
      // 得到相关数据
        res.rows.forEach((item, index) => {
          item.index = (index + 1) + ((offset - 1) * 10)
        })
        this.tableData = res
        this.loading = false
      }).catch(err => {
        this.loading = false
      })
    },
    reset() {
      this.selectInfo = {
        orderId: '',
        userName: ''
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.product_container {
 position: relative;
  width: 100%;
  min-height: 700px;
  height: 800px;
  overflow: auto;
  .productData {
    width: 100%;
    display: flex;
    justify-content: center;
    .middle {
      margin: 0 30px;
    }
  }
  .productFun {
    margin: 0px 0px 30px;
    display: flex;
    justify-content: space-between;
    .productInput {
      display: flex;
      align-items: center;
      .inputBox {
        margin: 0 50px 0 10px;
      }
    }
    .productBtn {
      .btnItem {
        margin-right: 10px;
        border-radius: 5px;
        // height: 32px;
        // width: 84px;
        font-size: 16px;
      }

    }
  }
  .footer {
    display: flex;
    justify-content: space-between;
    color: #6666;
    margin: 30px 10px;
  }
}
</style>