<!-- 收银台订单-->
<template>
  <div>
    <el-card class="box-card">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
        <el-form-item label="交易员工" prop="staffId">
          <el-select
            v-model="queryParams.staffId"
            clearable
            placeholder="全部"
          >
            <el-option v-for="item in staffList" :key="item.id" :label="item.realName" :value="item.id">
              <span style="float: left">{{ item.realName }}</span>
              <span style="float: right; color: #8492a6; font-size: 13px">{{ item.mobile }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="订单号">
          <el-input v-model="queryParams.orderNo" clearable placeholder="订单号检索"></el-input>
        </el-form-item>
        <el-form-item label="交易时间">
          <el-date-picker
            v-model="dateRange"
            style="width: 400px"
            size="medium"
            value-format="yyyy-MM-dd"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
<!--          <el-date-picker-->
<!--            v-model="beginTime"-->
<!--            type="datetime"-->
<!--            placeholder="开始日期">-->
<!--          </el-date-picker>-->
<!--            至-->
<!--          <el-date-picker-->
<!--            v-model="endTime"-->
<!--            type="datetime"-->
<!--            placeholder="结束日期">-->
<!--          </el-date-picker>-->
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>收银台订单统计</span>
      </div>
      <div class="box-gang">
        <div class="box">
          <div class="size-hui">笔数</div>
          <div class="size-bole">{{ orderStatistics.numberOfStrokes?orderStatistics.numberOfStrokes:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">订单总金额</div>
          <div class="size-bole">{{ orderStatistics.theTotalAmountOfTheOrder?orderStatistics.theTotalAmountOfTheOrder:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">实付总金额</div>
          <div class="size-bole">{{ orderStatistics.theTotalAmountPaid?orderStatistics.theTotalAmountPaid:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">油品优惠</div>
          <div class="size-bole">{{ orderStatistics.oilDiscounts?orderStatistics.oilDiscounts:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">油品总金额</div>
          <div class="size-bole">{{ orderStatistics.theTotalAmountOfOil?orderStatistics.theTotalAmountOfOil:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">商品总金额</div>
          <div class="size-bole">{{ orderStatistics.theTotalAmountOfTheItem?orderStatistics.theTotalAmountOfTheItem:0 }}</div>
        </div>
        <div class="box">
          <div class="size-hui">找零总金额</div>
          <div class="size-bole">{{ seekZeroAmount }}</div>
        </div>

      </div>
    </el-card>
    <el-card class="box-card">
      <div class="wgang">
        <div>收银台订单列表</div>
        <div style="display: flex ">
          <el-button type="primary" size="mini" icon="el-icon-plus" @click = "exportExcelCashier()">导出订单</el-button>
        </div>
      </div>
      <div class="table-box">
        <el-table
          :data="orderList"
          style="width: 100%">
<!--          <el-table-column type="expand">-->
<!--            <template slot-scope="props">-->
<!--              <el-form label-position="left" class="demo-table-expand" style="margin-left: 20px">-->
<!--                <el-form-item label="收银员">-->
<!--                  <span>{{ getRealName(staffList,props.row.staffId) }}</span>-->
<!--                </el-form-item>-->
<!--                <el-form-item label="收银员手机号">-->
<!--                  <span>{{ getMobile(staffList,props.row.staffId) }}</span>-->
<!--                </el-form-item>-->
<!--              </el-form>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column type="index" width="80" align="center" label="序号"/>
          <el-table-column prop="orderNo" align="center" label="订单号" width="220"> </el-table-column>
          <el-table-column prop="amount" align="center" label="订单金额"> </el-table-column>
          <el-table-column prop="payAmount" align="center" label="实付金额"> </el-table-column>
          <el-table-column prop="seekZero" align="center" label="找零金额"> </el-table-column>
          <el-table-column align="center" label="订单金额组成">
            <el-table-column prop="oilOrderAmount" align="center" label="油品金额">
              <template slot-scope="scope">
                <span>{{scope.row.oilOrderAmount ? scope.row.oilOrderAmount : '0'}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="goodsOrderAmount" align="center" label="商品金额">
              <template slot-scope="scope">
                <span>{{scope.row.goodsOrderAmount ? scope.row.goodsOrderAmount : '0'}}</span>
              </template>
            </el-table-column>
          </el-table-column>
          <el-table-column align="center" label="实付订单金额组成">
            <el-table-column prop="oilOrderAmount" align="center" label="油品实付金额" width="100">
              <template slot-scope="scope">
                <span>{{scope.row.oilPayAmount ? scope.row.oilPayAmount : '0'}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="goodsOrderAmount" align="center" label="商品实付金额" width="110">
              <template slot-scope="scope">
                <span>{{scope.row.goodsPayAmount ? scope.row.goodsPayAmount : '0'}}</span>
              </template>
            </el-table-column>
          </el-table-column>

          <el-table-column prop="payUser" align="center" label="付款用户" width="110"> </el-table-column>
          <el-table-column prop="status" align="center" label="状态">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.status === 'unpaid'">未支付</el-tag>
              <el-tag type="success" v-else-if="scope.row.status === 'paid'">已支付</el-tag>
              <el-tag type="danger" v-else-if="scope.row.status === 'refund'">已退款</el-tag>
              <el-tag type="danger" v-else>支付失败</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="交易时间" align="center" width="160" prop="payTime">
            <template slot-scope="scope">
              <span>{{ scope.row.payTime ? parseTime(scope.row.payTime):"--" }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作人" align="center" prop="staffId">
            <template slot-scope="scope">
              <span>{{ getRealName(staffList,scope.row.staffId) }}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="240" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button style="width: 60px" size="mini"
                         @click="getOrdersInfo(scope.row.id)"
                         type="success" plain round>详情</el-button>
              <el-button style="width: 60px" size="mini"
                         @click="patchwork(scope.row)"
                         type="primary" plain round>补打</el-button>
              <el-button style="width: 60px" size="mini"
                         v-if = "scope.row.status === 'paid'"
                         @click="handleRefund(scope.row.id)"
                         type="danger" plain round>退款</el-button>
            </template>
          </el-table-column>

        </el-table>
      </div>
      <div class="pagination-box">
        <el-pagination
          background
          v-show="total>0"
          layout="prev, pager, next"
          :total="total"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.pageSize"
          @current-change="getList">
        </el-pagination>
      </div>

    </el-card>

<!--    订单详情-->
    <el-dialog
      title="订单详情"
      :visible.sync="dialogVisible">
      <div>
        <el-descriptions>
          <el-descriptions-item label="收银员姓名">{{ cashierOrder.realName }}</el-descriptions-item>
          <el-descriptions-item label="收银员账号">{{ cashierOrder.mobile }}</el-descriptions-item>
          <el-descriptions-item label="订单编号">{{ cashierOrder.orderNo }}</el-descriptions-item>
          <el-descriptions-item label="订单金额">{{ cashierOrder.amount }}</el-descriptions-item>
          <el-descriptions-item label="油品金额">{{ cashierOrder.oilOrderAmount }}</el-descriptions-item>
          <el-descriptions-item label="商品金额">{{ cashierOrder.goodsOrderAmount }}</el-descriptions-item>
          <el-descriptions-item label="油品优惠总额">{{ cashierOrder.oilDiscountAmount }}</el-descriptions-item>
          <el-descriptions-item label="商品优惠总额">{{ cashierOrder.goodsDiscountAmount }}</el-descriptions-item>
          <el-descriptions-item label="实付金额">{{ cashierOrder.payAmount }}</el-descriptions-item>
          <el-descriptions-item label="储值卡或囤油卡消费金额">
            <span v-if="cashierOrder.oilOrderAmount - cashierOrder.oilDiscountAmount -
              (cashierOrder.payAmount+cashierOrder.goodsOrderAmount-cashierOrder.goodsDiscountAmount)>0 &&
              cashierOrder.status=='paid' && cashierOrder.payUser!='散客'">
              {{ (cashierOrder.oilOrderAmount - cashierOrder.oilDiscountAmount - (cashierOrder.payAmount-cashierOrder.goodsOrderAmount-cashierOrder.seekZero)).toFixed(2) || 0 }}
            </span>
            <span v-else>0</span>
          </el-descriptions-item>
          <el-descriptions-item label="找零金额">{{ cashierOrder.seekZero }}</el-descriptions-item>
          <el-descriptions-item label="付款方式">
            <span v-if="cashierOrder.payType == 'CASH'">现金</span>
            <span v-else-if="cashierOrder.payType == 'WECHAT'">微信</span>
            <span v-else-if="cashierOrder.payType == 'ALIPAY'">支付宝</span>
            <span v-else-if="cashierOrder.payType == 'UNIONPAY'">银联二维码</span>
            <span v-else-if="cashierOrder.payType == 'oilCard'">囤油卡</span>
            <span v-else-if="cashierOrder.payType == 'balance'">储值卡</span>
            <span v-else>小程序码</span>
          </el-descriptions-item>
          <el-descriptions-item label="付款状态">
            <el-tag v-if="cashierOrder.status == 'unpaid'">未支付</el-tag>
            <el-tag type="success" v-else-if="cashierOrder.status == 'paid'">已支付</el-tag>
            <el-tag type="warning" v-else-if="cashierOrder.status == 'payFail'">支付失败</el-tag>
            <el-tag type="danger" v-else-if="cashierOrder.status == 'refund'">已退款</el-tag>
            <el-tag type="info" v-else>退款中</el-tag>
          </el-descriptions-item>
          <el-descriptions-item label="交易时间">
            {{ cashierOrder.payTime ? parseTime(cashierOrder.payTime):"--" }}
          </el-descriptions-item>
        </el-descriptions>
      </div>
      <div style="margin-top: 30px">
        <el-descriptions :column="1" direction="vertical">
          <el-descriptions-item label="油品详情">
            <el-table
              v-loading="loading"

              :data="oilInfo"
              style="width: 100%">
              <el-table-column label="油品金额" prop="orderAmount">
                <template slot-scope="scope">
                  <span>￥{{ scope.row.orderAmount }}</span>
                </template>
              </el-table-column>
              <el-table-column label="油号油枪" align="center" prop="terminal">
                <template slot-scope="scope">
                  <span>{{ getName(oilNameList,scope.row.oils) }}/{{ getName1(oilGunList,scope.row.oilGunNum) }}</span>
                </template>
              </el-table-column>
              <el-table-column label="加油升数" align="center" prop="oilNum" >
                <template slot-scope="scope">
                  <span>{{ scope.row.oilNum }}L</span>
                </template>
              </el-table-column>
              <el-table-column label="油品单价" align="center" prop="amount">
                <template slot-scope="scope">
                  <span>{{ scope.row.oilPrice }}/L</span>
                </template>
              </el-table-column>
            </el-table>
          </el-descriptions-item>
          <el-descriptions-item label="商品详情">
            <el-table
              :data="goodsInfo"
              style="width: 100%">
              <el-table-column label="商品名称" prop="name"/>
              <el-table-column label="单价" align="center" prop="retailPrice">
                <template slot-scope="scope">
                  <span v-if="cashierOrder.payUser == '散客'">{{ scope.row.retailPrice }}</span>
                  <span v-else>{{ scope.row.memberPrice }}</span>
                </template>
              </el-table-column>
              <el-table-column label="数量" align="center" prop="num"/>
              <el-table-column label="合计" align="center" prop="num">
                <template slot-scope="scope">
                  <span v-if="cashierOrder.payUser == '散客'">{{ scope.row.retailPrice * scope.row.num }}</span>
                  <span v-else>{{ scope.row.memberPrice * scope.row.num }}</span>
                </template>
              </el-table-column>
            </el-table>
          </el-descriptions-item>
        </el-descriptions>
      </div>
    </el-dialog>
<!--    订单退款-->
    <el-dialog
      :close-on-click-modal="false"
      title="订单退款"
      width="25%"
      :visible.sync="dialogRefund">
      <div style="text-align: center;font-weight: bold">
        ￥<span style="font-size: 35px">{{ cashierOrder.payAmount }}</span>
      </div>
      <div class="tk">退款金额</div>
      <div class="tk">退款单号：{{ cashierOrder.orderNo }}</div>

      <span>退款内容：</span>
      <br>
      <span>商品：</span>
      <el-checkbox v-model="isGoods">￥{{cashierOrder.goodsPayAmount}}</el-checkbox>
      <br>



      <span>油品：</span>
      <el-checkbox v-model="isOil">￥{{cashierOrder.oilPayAmount}}</el-checkbox>
      <el-checkbox v-model="isOilVouchers">优惠卷</el-checkbox>

      <div style="margin: 10px 0">
        退款原因<br/>
        <el-radio-group v-model="radio1" style="margin: 10px 0">
          <el-radio-button label="油号选错"></el-radio-button>
          <el-radio-button label="金额错误"></el-radio-button>
          <el-radio-button label="其他原因"></el-radio-button>
        </el-radio-group>
      </div>
      <div>
        <el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
        <br/>
        <span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogRefund = false">取 消</el-button>
        <el-button type="primary" @click="refundConfirmed()">确 定</el-button>
      </span>
    </el-dialog>

    <!--    支付成功后小票打印内容-->
    <div id="reportSuccess" ref="report" class="box-center" v-show="false">
      <div class="box-title">订单统计</div>
      <div class="box-ge">
        <div v-for="item in oilInfo" :key="item.id">
          <div class="input-box">
            <div>{{ getName(oilNameList,item.oils) }}/{{ getName1(oilGunList,item.oilGunNum) }}</div>
            <div>￥{{ item.orderAmount }}</div>
          </div>
          <div class="input-box">
            <div>加油升数</div>
            <div>{{ item.oilNum }}L</div>
          </div>
        </div>
        <div v-for="item in goodsInfo" :key="item.id">
          <div class="input-box">
            <div>商品名称</div>
            <div>{{ item.name }}</div>
          </div>
          <div class="input-box">
            <div>商品数量</div>
            <div>{{ item.num }}{{ item.unit }}</div>
          </div>
          <div class="input-box" v-if="!cashierOrder.userId">
            <div>商品单价</div>
            <div>￥{{ item.retailPrice }}</div>
          </div>
          <div class="input-box" v-else>
            <div>商品单价</div>
            <div>￥{{ item.memberPrice }}</div>
          </div>
        </div>
        <div class="input-box">
          <div>支付方式</div>
          <div v-if="cashierOrder.payType == 'CASH'">现金</div>
          <div v-else-if="cashierOrder.payType == 'WECHAT'">微信</div>
          <div v-else-if="cashierOrder.payType == 'ALIPAY'">支付宝</div>
          <div v-else-if="cashierOrder.payType == 'UNIONPAY'">银联二维码</div>
          <div v-else>小程序码</div>
        </div>
        <div class="input-box">
          <div>合计</div>
          <div>￥{{ cashierOrder.amount }}</div>
        </div>
        <div class="input-box">
          <div>实付款</div>
          <div>￥{{ cashierOrder.payAmount }}</div>
        </div>
        <div class="input-box" v-if="cashierOrder.seekZero>0">
          <div>找零金额</div>
          <div>￥{{ cashierOrder.seekZero }}</div>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
import {
  cashierOrder,
  cashierOrderSeekZeroAmount,
  listCashierOrder,
  orderStatisticsApi
} from "@/api/cashier/cashierorder";
import {queryStaffs} from "@/api/cashier/staff";
import {oilOrderList, oilOrders} from "@/api/cashier/oilorder";
import {getOilNameList} from "@/api/cashier/oilnumgun";
import {getOrderGoods} from "@/api/cashier/goodsorder";
import {exportExcelCashierApi} from "@/api/order/exportExcel";
import {refundApi} from "@/api/cashier/refund";
import {getLodop} from "@/api/LodopFuncs";
import {getOilNumberGun} from "@/api/cashier/oilGuns";
import {formatDate} from "@/utils";

  export default {
    name: "order_Cashier",
    data(){
      return{
        // 退款备注
        refundRemark:"",
        radio1:"油号选错",
        // 油号列表
        oilNameList:[],
        // 油品订单详情列表
        oilInfo:[],
        // 商品订单详情列表
        goodsInfo:[],
        oilGunList:[],
        // 收银员订单详情
        cashierOrder:{},
        loading:false,
        dialogVisible:false,
        dialogRefund:false,
        // 员工列表
        staffList:[],
        // 日期范围
        dateRange: [],
        beginTime:"",
        endTime:"",
        isOilVouchers:false,
        isGoods: false,
        isOil: false,
        // 收银台订单列表
        orderList:[],
        // 查询参数
        queryParams: {
          page: 1,
          pageSize: 10,
          beginTime:"",
          endTime:"",
        },
        orderStatistics:{
          numberOfStrokes:'0',
          theTotalAmountOfTheOrder:'0',
          theTotalAmountPaid:'0',
          oilDiscounts:'0',
          theTotalAmountOfOil:'0',
          theTotalAmountOfTheItem:'0',
        },
        total:0,
        seekZeroAmount:0,
      }
    },
    created() {
      this.getList();
      this.getOrderStatistics();
      this.getStaffList();
      this.getOilGunList();
    },
    methods:{

      exportExcelCashier() {
        // this.dateRange.push(this.beginTime)
        // this.dateRange.push(this.endTime)
        exportExcelCashierApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
          const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
          this.$download.saveAs(blob,'收银台订单统计.xLsx')
        })
      },
      // 获取订单统计信息

      getOrderStatistics() {
        // this.dateRange.push(this.beginTime)
        // this.dateRange.push(this.endTime)
        orderStatisticsApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
          this.orderStatistics = res.data
        })
      },
      // 获取员工姓名
      getRealName(list,val){
        let name = "";
        list.forEach(item => {
          if (item.id == val){
            name = item.realName
          }
        })
        return name;
      },
      // 获取员工手机号
      getMobile(list,val){
        let name = "";
        list.forEach(item => {
          if (item.id == val){
            name = item.mobile
          }
        })
        return name;
      },

      async printLocally() {
        //初始化打印函数
        let LODOP = getLodop(); // 初始化打印
        LODOP.PRINT_INIT();
        var bodyStyle = `<style>
            .input-box{
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 14px;
                margin: 5px 0px;
              }
             .box-ge{
                border-bottom: 1px solid #000000 ;
                box-sizing: border-box;
                padding: 10px;
              }
              .box-title{
                font-size: 18px;
                text-align: center;
                align-items: center;
                margin-top: 15px;
              }
              .input-hui{
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 14px;
                margin: 15px 0px;
                background: #b2b2b2;
                box-sizing: border-box;
                padding: 5px 0px;
              }
              .input-hui-frou{
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 14px;
                margin: 15px 0px;
                background: #b2b2b2;
                box-sizing: border-box;
                padding: 5px 0px;
                div{
                  width: 25%;
                  text-align: left;
                }
              }
              .input-box-frou{
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 14px;
                margin: 5px 0px;
                div{
                  width: 25%;
                  text-align: left;
                }
              }
              .box-center{
                height: 500px;
              }
            </style>
            `
        var fromHtml = bodyStyle+this.$refs.report.innerHTML


        LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);

        LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);

        // LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
        // let preview = LODOP.PREVIEW();
        // console.log("preview",preview);
        LODOP.PRINT();

      },
      // 补打
      patchwork(data){
        const orderNo = data.orderNo
        this.$modal.confirm('确定您要补打当前订单吗？当前订单号[' + orderNo + '],请确保云打印机正在运行中').then(function() {
          // return delUser(row.id);
        }).then(async () => {
          await cashierOrder(data.id).then( response => {
            this.cashierOrder = response.data
            this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果");
          })
          await this.getOilList(this.cashierOrder.orderNo)
          await this.getGoodsLists(this.cashierOrder.goodsOrderId)
          this.printLocally()
        }).catch(() => {});
      },
      // 退款
      handleRefund(id){
        this.dialogRefund = true;
        //退款确定
        // this.$confirm('是否将该收银台下的订单全部退款, 是否继续?', '提示', {
        //   confirmButtonText: '确定',
        //   cancelButtonText: '取消',
        //   type: 'warning'
        // }).then(() => {
        //   this.dialogRefund = true;
        //   cashierOrder(id).then( response => {
        //     this.cashierOrder = response.data
        //     if (response.data.status === "refund") {
        //       this.$message({
        //         type: 'info',
        //         message: '该订单已经退款'
        //       });
        //       this.dialogRefund = false;
        //     }
        //   })
        // }).catch(() => {
        //   this.$message({
        //     type: 'info',
        //     message: '已取消删除'
        //   });
        // });
      },

      async refundConfirmed() {
        this.dialogRefund = false;
        this.loading = true;
        console.log("cashierOrder",this.cashierOrder)
        let map={
          orderNo: this.cashierOrder.orderNo,
          storeId: this.cashierOrder.storeId,
          refundRemark:this.radio1 +"-"+ this.refundRemark,
          type: "canRefund",
          isOilVouchers:this.isOilVouchers,
          isGoods: this.isGoods,
          isOil: this.isOil,
        }
        await refundApi(map).then(res=>{
          this.$message({
            type: 'info',
            message: '退款成功'
          });
        })

        this.loading = false;

        this.getList();
        this.getOrderStatistics();
        this.getStaffList();

      },
      // 获取油枪信息
      getOilGunList(){
        getOilNumberGun().then(res => {
          res.data.forEach(item => {
            if (item.oilGunList.length>0){
              item.oilGunList.forEach(i => {
                i.oilName = item.oilName
                this.oilGunList.push(i)
              })
            }
          })
        })
      },
      // 获取油枪名称
      getName1(oilNameList,id){
        let name = ""
        let _this = this;
        if(oilNameList!=null && oilNameList!=""){
          oilNameList.forEach(item => {
            if (item.id == id){
              name = item.gunName;
            }
          })
        }
        return name;
      },
      // 获取油号名称
      getName(oilNameList,id){
        let name = ""
        let _this = this;
        if(oilNameList!=null && oilNameList!=""){
          oilNameList.forEach(item => {
            if (item.id == id){
              name = item.oilName;
              _this.oilType = item.oilType;
            }
          })
        }
        return name;
      },
      // 获取订单详情
      getOrdersInfo(id){
        this.dialogVisible = true;
        cashierOrder(id).then( response => {
          this.cashierOrder = response.data
          this.getOilList(this.cashierOrder.orderNo)
          this.getGoodsLists(this.cashierOrder.goodsOrderId)
        })
      },
      async getOilList(orderNo){
        await oilOrderList({orderNo:orderNo}).then( response => {
          this.oilInfo = response.data
        })
      },
      async getGoodsLists(id){
        await getOrderGoods({orderId:id}).then( response => {
          this.goodsInfo = response.data;
        })
      },
      parseTime1(dateTime) {
        let date = new Date(dateTime);
        let y = date.getFullYear() + "-";
        let mon = ((date.getMonth() + 1 < 10) ? ('0' + date.getMonth()) : date.getMonth()) + "-";
        let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + " ";
        let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":";
        let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":";
        let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds());
        return new Date(y , mon , d , h , m , s);
      },
      // 获取列表信息
      getList(val){
        if (val!=undefined){
          this.queryParams.page = val
        }

        let time1 = ""
        let time2 = ""
        if (this.beginTime && this.endTime){
          // let beginTime = this.beginTime.getTime()
          // let endTime = this.endTime.getTime()
          time1 = this.parseTime1(this.beginTime)
          time2 = this.parseTime1(this.endTime)
        }
        let dateRange = []
        // this.$modal.msgError()
        // dateRange.push(time1.toString())
        // dateRange.push(time2.toString())
        // this.$modal.msgError(this.dateRange.toString())
        // this.dateRange = dateRange.toString()
        listCashierOrder(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
          this.orderList = response.data.records;
          this.total = response.data.total;
        })
        this.getSeekZero(val)
      },
      getSeekZero(val){
        if (val!=undefined){
          this.queryParams.page = val
        }
        // this.dateRange.push(this.beginTime)
        // this.dateRange.push(this.endTime)
        cashierOrderSeekZeroAmount(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
          if (response.data) {
            this.seekZeroAmount = response.data
          }
        })
      },
      // 获取员工列表信息
      getStaffList(){
        queryStaffs().then( response => {
          this.staffList = response.data;
        })
        getOilNameList().then( response => {
          this.oilNameList = response.data;
        })
      },
      // 搜索按钮操作
      handleQuery() {
        this.queryParams.page = 1;
        this.getList();
      },
      // 重置按钮操作
      resetQuery() {
        this.dateRange = [];
        this.queryParams = {
          page: 1,
          pageSize: 10,
        }
        this.beginTime = ""
        this.endTime = ""
        // this.resetForm("queryForm");
        this.handleQuery();
      },
    }
  }
</script>

<style scoped>
  .app-top{
    width: 100%;

    height: 60px;
    box-sizing: border-box;
    padding: 10px;
  }
  .clearfix{
    width: 100%;

  }
  .box-card{
    width: 100%;
    margin-bottom: 15px;
  }
  .box-gang{
    width: 100%;
    display: flex;
    align-items: center;
  }
  .box{
    width: 200px;
    box-sizing: border-box;
    padding: 10px;
    background: #f9f9f9;
    height: 86px;
    margin-right: 10px;
  }
  .size-hui{
    font-size: 14px;
    margin-bottom: 10px;
    margin-top: 10px;
  }
  .size-bole{
    font-weight: bold;
  }
  .wgang{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;

  }
  .table-box{
    width: 100%;
  }
  .pagination-box{
    width: 100%;
    margin: 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .top-app-sou{
    width: 20%;
  }
  .tk{
    text-align: center;
    color: grey;
    margin: 10px 0;
  }

</style>
