<template>
  <div class="app-container">
    <div class="container">
      <div class="row">
        <div class="col-sm col-md-3">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px"></div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">油品：</span>
            </div>
            <select
              class="custom-select"
              id="inputGroupSelect01"
              style="width: 80px"
            >
              <option selected>Choose...</option>
              <option value="1">One</option>
              <option value="2">Two</option>
              <option value="3">Three</option>
            </select>
          </div>
        </div>
        <div class="col-sm col-md-8">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px"></div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >日期：</span
              >
              <el-date-picker
                v-model="dateRangeCreatedDate"
                type="datetimerange"
                value-format="yyyy-MM-dd HH:mm:ss"
                size="mini"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="margin-top: 2px; max-width: 350px"
              >
              </el-date-picker>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px"></div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油频率：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">次</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                > &lt; 加油次数 &lt; </span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">次</span>
            </div>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px">
              <select
                class="custom-select custom-select-sm"
                id="inputGroupSelect01"
              >
                <option value="1">或者</option>
                <option value="2">并且</option>
              </select>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油金额：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">
                &lt; 加油金额 &lt;
              </span>
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px">
              <select
                class="custom-select custom-select-sm"
                id="inputGroupSelect01"
              >
                <option value="1">或者</option>
                <option value="2">并且</option>
              </select>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油升数：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">升</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                > &lt; 加油升数 &lt; </span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">升</span>
            </div>
          </div>
        </div>
      </div>
    </div>
   <hr/>
    <div class="container">
      <div class="row">
        <div class="col-sm col-md-8">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px"></div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >时间：</span
              >
              <el-date-picker
                v-model="dateRangeCreatedDate"
                type="datetimerange"
                value-format="yyyy-MM-dd HH:mm:ss"
                size="mini"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="margin-top: 2px; max-width: 350px"
              >
              </el-date-picker>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px"></div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油频率：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">次</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >&lt; 加油次数 &lt;</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">次</span>
            </div>
          </div>
        </div>
      </div>

      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px">
              <select
                class="custom-select custom-select-sm"
                id="inputGroupSelect01"
              >
                <option value="1">或者</option>
                <option value="2">并且</option>
              </select>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油金额：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">
                &lt; 加油金额 &lt;
              </span>
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm col-md-9">
          <div class="input-group input-group-sm flex-nowrap">
            <div class="input-group-prepend" style="width: 80px">
              <select
                class="custom-select custom-select-sm"
                id="inputGroupSelect01"
              >
                <option value="1">或者</option>
                <option value="2">并且</option>
              </select>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >加油升数：</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping"
                >&lt; 加油升数 &lt;</span
              >
            </div>
            <input
              type="text"
              class="form-control"
              aria-label="Username"
              aria-describedby="addon-wrapping"
            />
            <div class="input-group-prepend">
              <span class="input-group-text" id="addon-wrapping">元</span>
            </div>
          </div>
        </div>
      </div>
    </div>
 
    <hr />
    <el-table :data="labelList">
      <af-table-column align="center" prop="id" type="selection" />
      <af-table-column label="姓名" align="center" prop="id" />
      <af-table-column label="当前归属的标签" align="center" prop="id" />
      <af-table-column label="手机号" align="center" prop="stationName" />
      <af-table-column
        label="最后一笔消费时间"
        align="center"
        prop="stationName"
      />
      <af-table-column
        label="近期详细消费"
        align="center"
        prop="stationName"
        width="160px"
      >
        <template slot-scope="scope">
          <el-button
            type="text"
            icon="el-icon-search"
            class="underline btn24"
            size="mini"
            @click="orderOpenMethod(scope.row)"
            >查询</el-button
          >
        </template>
      </af-table-column>
      <af-table-column label="操作" align="center" width="160px">
        <template slot-scope="scope">
          <el-button
            type="text"
            icon="el-icon-circle-plus-outline"
            class="underline btn24"
            size="mini"
            @click="handleMoveLabel('right', 1, scope.row)"
            >打标签</el-button
          >
          <el-button
            type="text"
            icon="el-icon-circle-plus-outline"
            class="underline btn24"
            size="mini"
            @click="handleMoveLabel('right', 1, scope.row)"
            >删除当前标签</el-button
          >
        </template>
      </af-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog
      title="1235555"
      :visible.sync="orderOpen"
      width="750px"
      append-to-body
    >
      <div class="app-container">
        <el-table :data="orderList">
          <af-table-column label="油站" align="center" prop="stationName" />
          <af-table-column label="订单号" align="center" prop="orderNo" />
          <af-table-column label="油品名称" align="center" prop="oilName" />
          <af-table-column label="油品价格" align="center" prop="oilPirce" />
          <af-table-column label="加油升数" align="center" prop="orderLiters" />
          <af-table-column label="实付金额" align="center" prop="amt" />
          <af-table-column
            label="消费者昵称"
            width="120"
            align="center"
            prop="consumer"
          />
          <af-table-column
            label="加油员"
            width="120"
            align="center"
            prop="oilPersonnel"
          />
          <af-table-column label="加油枪号" align="center" prop="oilGun" />
          <!--
          <af-table-column
            label="支付类型"
            align="center"
            prop="payType"
            :formatter="payTypeFotmat"
          />
          -->
          <af-table-column
            label="油站名称"
            width="120"
            align="center"
            prop="stationName"
            v-if="false"
          />
          <af-table-column
            label="用户id(消费者)"
            align="center"
            prop="consumerId"
            v-if="false"
          />
          <af-table-column
            label="油站id"
            align="center"
            prop="stationId"
            v-if="false"
          />
          <af-table-column
            label="支付完成时间"
            align="center"
            prop="payDate"
            width="160px"
          >
            <template slot-scope="scope">
              <span>{{
                parseTime(scope.row.payDate, "{y}-{m}-{d} {h}:{i}:{s}")
              }}</span>
            </template>
          </af-table-column>
          <af-table-column
            label="订单创建时间"
            align="center"
            prop="createdDate"
            width="160px"
          >
            <template slot-scope="scope">
              <span>{{
                parseTime(scope.row.createdDate, "{y}-{m}-{d} {h}:{i}:{s}")
              }}</span>
            </template>
          </af-table-column>
        </el-table>
        <pagination
          v-show="totalInfo > 0"
          :total="totalInfo"
          :page.sync="query.pageNum"
          :limit.sync="query.pageSize"
          @pagination="getList"
        />
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listRecord } from "@/api/customer/record";

export default {
  name: "Dzk_Bill",
  data() {
    return {
      // 总条数
      total: 0,
      // 客户电子会员卡充值消费记录表格数据
      labelList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderNo: null,
        customerNo: null,
        customerName: null,
        usageType: null,
        payType: null,
        cardOilsType: null,
      },
      orderList: [{}],
      orderOpen: false,
      totalInfo: 0,
      query: {
        pageNum: 1,
        pageSize: 10,
        unionId: null,
        customerName: null,
        recordType: null,
        integral: null,
        stationId: null,
        stationName: null,
        levelId: this.levelId,
      },
      dateRangeCreatedDate: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    usageTypeFotmat(row, column) {
      if (row.usageType === "+") {
        return "充值";
      } else if (row.usageType === "-") {
        return "消费";
      }
    },
    cardOilsTypeFotmat(row, column) {
      if (row.cardOilsType === "1") {
        return "汽油";
      } else if (row.cardOilsType === "2") {
        return "柴油";
      } else if (row.cardOilsType === "3") {
        return "非油品";
      } else if (row.cardOilsType === "4") {
        return "LNG";
      } else if (row.cardOilsType === "5") {
        return "CNG";
      }
    },
    /** 查询客户电子会员卡充值消费记录列表 */
    getList() {
      listRecord(this.queryParams).then((response) => {
        this.labelList = response.rows;
        this.total = response.total;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    orderOpenMethod() {
      this.orderOpen = true;
    },
  },
};
</script>
<style scoped lang="scss">
.app-container {
  .container {
    .row {
      margin-bottom: 10px;
    }
  }
}
</style>