10.4 Vue电商后台管理 完善订单模块--用Tab切换对订单进行分类

1. 效果如下:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2. 实现代码

在这里插入图片描述
四个el-tab-pane中,< el-table >是一样的:

<el-tab-pane name="all" label="所有">
            <el-table :data="orderList" border stripe>
        <el-table-column type="index" label="#">
        </el-table-column>
        <el-table-column prop="order_number" label="订单编号">
        </el-table-column>
        <el-table-column prop="order_price" label="订单价格">
        </el-table-column>
         <el-table-column prop="order_pay" label="支付状态">
           <template v-slot="scope">
            <el-tag type="danger"
            v-if="scope.row.order_pay === '0'">未支付</el-tag>
            <el-tag type="success"
            v-if="scope.row.order_pay === '1'">支付宝</el-tag>
            <el-tag type="success"
            v-if="scope.row.order_pay === '2'">微信</el-tag>
            <el-tag type="success"
            v-if="scope.row.order_pay === '3'">银行卡</el-tag>
          </template>
          </el-table-column>
         <el-table-column prop="is_send" label="是否发货">
           <template v-slot="scope">
            <el-tag type="success"
            v-if="scope.row.is_send === ''"></el-tag>
            <el-tag type="danger"
            v-if="scope.row.is_send === ''"></el-tag>
          </template>
          </el-table-column>
        <el-table-column prop="create_time" label="下单时间">
          <template slot-scope="scope">
            {{scope.row.create_time | dataFormat}}
          </template>
        </el-table-column>
        <el-table-column prop="consignee_addr" label="发货地址">
        </el-table-column>
        <el-table-column label="操作">
          <template v-slot="scope">
             <el-button type="text"
              @click="sendGoods(scope.row.order_id)"
              v-if="scope.row.is_send === ''"
              disabled>
              发货</el-button>
              <el-button type="text"
              @click="sendGoods(scope.row.order_id)"
              v-if="scope.row.is_send === ''" >
              发货</el-button>
             <el-button type="text"
              @click="dialogVisible(scope.row.order_id)">修改地址</el-button>
            <el-button type="text"
            @click="goEditPage(scope.row.order_id)">订单详情</el-button>
            <el-button type="text"
            @click="showProgressBox">物流信息</el-button>
          </template>
        </el-table-column>
      </el-table>
         </el-tab-pane>

在这里插入图片描述

// 包含所有订单的列表
      orderList: [],
      // 只包含已发货的订单的列表
      sendOrderList: [],
      // 只包含待发货的订单的列表
      noSendOrderList: [],
      // 只包含 未支付的订单的列表
      noPayOrderList: [],

在这里插入图片描述

 // 获取订单列表
    async getOrderList () {
      // console.log(this.queryInfo.query)
      const { data: res } = await this.$http.get('orders', {
        params: this.queryInfo
      })
      console.log(res)
      if (res.meta.status !== 200) {
        this.$message.error('获取订单列表失败!')
      }
      this.total = res.data.total
      this.orderList = res.data.goods
      console.log(this.orderList)
      // 过滤出只包含已发货的订单的列表
      this.sendOrderList =
      this.orderList.filter(item => item.is_send === '是')
      // 过滤出 只包含 未发货的订单的列表
      this.noSendOrderList =
      this.orderList.filter(item => item.is_send === '否')
      // 过滤出 只包含 未支付的订单的列表
      this.noPayOrderList =
      this.orderList.filter(item => item.order_pay === '0')
    },
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值