<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="订单号" prop="orderNo">
        <el-input
          v-model="queryParams.orderNo"
          placeholder="请输入订单号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="业务员" prop="salesmanId">
        <el-select v-model="queryParams.salesmanId" placeholder="请选择">
          <el-option
            v-for="(item,index) in salesmanList"
            :key="index"
            :label="item.companyUserName"
            :value="item.sysUserId">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="订单状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择订单状态" clearable size="small">
          <el-option
            v-for="dict in statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="是否支付" prop="isPay">-->
<!--        <el-input-->
<!--          v-model="queryParams.isPay"-->
<!--          placeholder="请输入是否支付"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="收件人姓名" prop="receiverName">
        <el-input
          v-model="queryParams.receiverName"
          placeholder="请输入收件人姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="收件人电话" prop="receiverPhone">
        <el-input
          v-model="queryParams.receiverPhone"
          placeholder="请输入收件人电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="收件人省份" prop="receiverProvince">-->
<!--        <el-input-->
<!--          v-model="queryParams.receiverProvince"-->
<!--          placeholder="请输入收件人省份"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="收件人城市" prop="receiverCity">-->
<!--        <el-input-->
<!--          v-model="queryParams.receiverCity"-->
<!--          placeholder="请输入收件人城市"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="收件人区县" prop="receiverArea">-->
<!--        <el-input-->
<!--          v-model="queryParams.receiverArea"-->
<!--          placeholder="请输入收件人区县"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="收件人地址" prop="receiverAddress">
        <el-input
          v-model="queryParams.receiverAddress"
          placeholder="请输入收件人地址"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="下单时间" prop="createAt">
        <el-date-picker
          v-model="createAtRange"
          size="small"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="备注" prop="remarks">
        <el-input
          v-model="queryParams.remarks"
          placeholder="请输入备注"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['mall:mallAppOrderOrder:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          :disabled="single"-->
<!--          @click="handleUpdate"-->
<!--          v-hasPermi="['mall:mallAppOrderOrder:edit']"-->
<!--        >修改</el-button>-->
<!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['mall:mallAppOrderOrder:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['mall:mallAppOrderOrder:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="mallAppOrderOrderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
<!--      <el-table-column label="线下订单主键ID" align="center" prop="id" />-->
      <el-table-column label="订单号" align="center" prop="orderNo" width="110px" />
      <el-table-column label="业务员名称" align="center" prop="salesmanName"width="120" />
<!--      <el-table-column label="会员ID" align="center" prop="userId" />-->
<!--      <el-table-column label="订单类型：3-线下订单" align="center" prop="orderType" />-->
<!--      <el-table-column label="邮费" align="center" prop="postFee" />-->
      <el-table-column label="订单原价" align="center" prop="orderPrice" width="80" />
<!--      <el-table-column label="实付金额" align="center" prop="payment" />-->
<!--      <el-table-column label="优惠金额" align="center" prop="discountPrice" />-->
<!--      <el-table-column label="提成金额" align="center" prop="commissionPrice" />-->
      <el-table-column label="商品总数" align="center" prop="goodsNum" width="80" />
<!--      <el-table-column label="商品总重量" align="center" prop="goodsWeight" />-->
<!--      <el-table-column label="商品总体积" align="center" prop="goodsVolume" />-->
<!--      <el-table-column label="配送方式：0-快递，1-自提" align="center" prop="deliveryType" />-->
      <el-table-column label="订单状态" align="center" prop="status" width="80">
        <template slot-scope="scope">
          <dict-tag :options="statusOptions" :value="scope.row.status"/>
        </template>
      </el-table-column>
<!--      <el-table-column label="是否支付" align="center" prop="isPay" />-->
<!--      <el-table-column label="支付类型：0-未支付，1-微信，2-支付宝，3-银行转账，4-线下支付，5-其他" align="center" prop="payType" />-->
<!--      <el-table-column label="是否上传凭证：0-未上传，1-已上传" align="center" prop="isProof" />-->
<!--      <el-table-column label="支付凭证" align="center" prop="payProof" />-->
<!--      <el-table-column label="是否装车：0-未装车，1-已装车" align="center" prop="isCar" />-->
<!--      <el-table-column label="装车视频" align="center" prop="carVideo" />-->
      <el-table-column label="下单时间" align="center" prop="createAt" width="150" />
<!--      <el-table-column label="支付时间" align="center" prop="payAt" />-->
<!--      <el-table-column label="审核时间" align="center" prop="examineAt" />-->
<!--      <el-table-column label="财务审核时间" align="center" prop="financeExamineAt" />-->
<!--      <el-table-column label="接单时间" align="center" prop="receiveAt" />-->
<!--      <el-table-column label="装车时间" align="center" prop="carAt" />-->
<!--      <el-table-column label="确认收货时间" align="center" prop="enterAt" />-->
<!--      <el-table-column label="退货时间" align="center" prop="returnAt" />-->
<!--      <el-table-column label="完成时间" align="center" prop="completeAt" />-->
<!--      <el-table-column label="快递公司代号" align="center" prop="shippingMark" />-->
<!--      <el-table-column label="物流名称" align="center" prop="shippingName" />-->
<!--      <el-table-column label="物流单号" align="center" prop="shippingCode" />-->
<!--      <el-table-column label="是否申请退款：0-否，1-是" align="center" prop="isRefund" />-->
<!--      <el-table-column label="寄件人姓名" align="center" prop="senderName" />-->
<!--      <el-table-column label="寄件人电话" align="center" prop="senderPhone" />-->
<!--      <el-table-column label="寄件人省份" align="center" prop="senderProvince" />-->
<!--      <el-table-column label="寄件人城市" align="center" prop="senderCity" />-->
<!--      <el-table-column label="寄件人区县" align="center" prop="senderArea" />-->
<!--      <el-table-column label="寄件人地址" align="center" prop="senderAddress" />-->
      <el-table-column label="收件人姓名" align="center" prop="receiverName" width="100" />
      <el-table-column label="收件人电话" align="center" prop="receiverPhone" width="120" />
<!--      <el-table-column label="收件人省份" align="center" prop="receiverProvince" />-->
<!--      <el-table-column label="收件人城市" align="center" prop="receiverCity" />-->
<!--      <el-table-column label="收件人区县" align="center" prop="receiverArea" />-->
<!--      <el-table-column label="收件人地址" align="center" prop="receiverAddress" />-->
      <el-table-column label="收件人地址" align="center" prop="receiverAddress" width="200">
        <template slot-scope="scope">
            <span
            >{{ scope.row.receiverProvince }}{{ scope.row.receiverCity
              }}{{ scope.row.receiverArea }}{{ scope.row.receiverAddress }}</span
            >
        </template>
      </el-table-column>
<!--      <el-table-column label="是否修改过收货地址：0-否，1-是" align="center" prop="isChangeAddress" />-->
<!--      <el-table-column label="年" align="center" prop="year" />-->
<!--      <el-table-column label="月" align="center" prop="month" />-->
<!--      <el-table-column label="日" align="center" prop="day" />-->
<!--      <el-table-column label="相关人员ID" align="center" prop="resId" />-->
<!--      <el-table-column label="相关人员名" align="center" prop="resName" />-->
<!--      <el-table-column label="业务员ID" align="center" prop="salesmanId" />-->
<!--      <el-table-column label="分公司管理员ID" align="center" prop="companyManageId" />-->
<!--      <el-table-column label="仓库管理员ID" align="center" prop="warehouseManageId" />-->
<!--      <el-table-column label="财务ID" align="center" prop="financeId" />-->
<!--      <el-table-column label="买家留言" align="center" prop="buyerMsg" />-->
      <el-table-column label="备注" align="center" prop="remarks" />
<!--      <el-table-column label="内容" align="center" prop="content" />-->
<!--      <el-table-column label="删除标记：0-正常，1-删除" align="center" prop="delFlag" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
        <template slot-scope="scope">
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['mall:mallAppOrderOrder:edit']"-->
<!--          >修改</el-button>-->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-monitor"
            @click="printDialogOpen(scope.row)"
          >打印</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleCheckDetail(scope.row)"
            v-hasPermi="['mall:mallAppOrderOrder:query']"
          >查看详情</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['mall:mallAppOrderOrder:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改app-线下订单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="订单号" prop="orderNo">
          <el-input v-model="form.orderNo" placeholder="请输入订单号" />
        </el-form-item>
        <el-form-item label="会员ID" prop="userId">
          <el-input v-model="form.userId" placeholder="请输入会员ID" />
        </el-form-item>
        <el-form-item label="订单类型：3-线下订单" prop="orderType">
          <el-select v-model="form.orderType" placeholder="请选择订单类型：3-线下订单">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="邮费" prop="postFee">
          <el-input v-model="form.postFee" placeholder="请输入邮费" />
        </el-form-item>
        <el-form-item label="订单原价" prop="orderPrice">
          <el-input v-model="form.orderPrice" placeholder="请输入订单原价" />
        </el-form-item>
        <el-form-item label="实付金额" prop="payment">
          <el-input v-model="form.payment" placeholder="请输入实付金额" />
        </el-form-item>
        <el-form-item label="优惠金额" prop="discountPrice">
          <el-input v-model="form.discountPrice" placeholder="请输入优惠金额" />
        </el-form-item>
        <el-form-item label="提成金额" prop="commissionPrice">
          <el-input v-model="form.commissionPrice" placeholder="请输入提成金额" />
        </el-form-item>
        <el-form-item label="商品总数" prop="goodsNum">
          <el-input v-model="form.goodsNum" placeholder="请输入商品总数" />
        </el-form-item>
        <el-form-item label="商品总重量" prop="goodsWeight">
          <el-input v-model="form.goodsWeight" placeholder="请输入商品总重量" />
        </el-form-item>
        <el-form-item label="商品总体积" prop="goodsVolume">
          <el-input v-model="form.goodsVolume" placeholder="请输入商品总体积" />
        </el-form-item>
        <el-form-item label="配送方式：0-快递，1-自提" prop="deliveryType">
          <el-select v-model="form.deliveryType" placeholder="请选择配送方式：0-快递，1-自提">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="订单状态：0-未付款，1-已付款，2-待接单，3-待发货，4-已装车，5-已完成，,8-已取消">
          <el-radio-group v-model="form.status">
            <el-radio
              v-for="dict in statusOptions"
              :key="dict.dictValue"
              :label="dict.dictValue"
            >{{dict.dictLabel}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="是否支付：0-未支付，1-已支付" prop="isPay">
          <el-input v-model="form.isPay" placeholder="请输入是否支付：0-未支付，1-已支付" />
        </el-form-item>
        <el-form-item label="支付类型：0-未支付，1-微信，2-支付宝，3-银行转账，4-线下支付，5-其他" prop="payType">
          <el-select v-model="form.payType" placeholder="请选择支付类型：0-未支付，1-微信，2-支付宝，3-银行转账，4-线下支付，5-其他">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="是否上传凭证：0-未上传，1-已上传" prop="isProof">
          <el-input v-model="form.isProof" placeholder="请输入是否上传凭证：0-未上传，1-已上传" />
        </el-form-item>
        <el-form-item label="支付凭证" prop="payProof">
          <el-input v-model="form.payProof" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="是否装车：0-未装车，1-已装车" prop="isCar">
          <el-input v-model="form.isCar" placeholder="请输入是否装车：0-未装车，1-已装车" />
        </el-form-item>
        <el-form-item label="装车视频" prop="carVideo">
          <el-input v-model="form.carVideo" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="下单时间" prop="createAt">
          <el-input v-model="form.createAt" placeholder="请输入下单时间" />
        </el-form-item>
        <el-form-item label="支付时间" prop="payAt">
          <el-input v-model="form.payAt" placeholder="请输入支付时间" />
        </el-form-item>
        <el-form-item label="审核时间" prop="examineAt">
          <el-input v-model="form.examineAt" placeholder="请输入审核时间" />
        </el-form-item>
        <el-form-item label="财务审核时间" prop="financeExamineAt">
          <el-input v-model="form.financeExamineAt" placeholder="请输入财务审核时间" />
        </el-form-item>
        <el-form-item label="接单时间" prop="receiveAt">
          <el-input v-model="form.receiveAt" placeholder="请输入接单时间" />
        </el-form-item>
        <el-form-item label="装车时间" prop="carAt">
          <el-input v-model="form.carAt" placeholder="请输入装车时间" />
        </el-form-item>
        <el-form-item label="确认收货时间" prop="enterAt">
          <el-input v-model="form.enterAt" placeholder="请输入确认收货时间" />
        </el-form-item>
        <el-form-item label="退货时间" prop="returnAt">
          <el-input v-model="form.returnAt" placeholder="请输入退货时间" />
        </el-form-item>
        <el-form-item label="完成时间" prop="completeAt">
          <el-input v-model="form.completeAt" placeholder="请输入完成时间" />
        </el-form-item>
        <el-form-item label="快递公司代号" prop="shippingMark">
          <el-input v-model="form.shippingMark" placeholder="请输入快递公司代号" />
        </el-form-item>
        <el-form-item label="物流名称" prop="shippingName">
          <el-input v-model="form.shippingName" placeholder="请输入物流名称" />
        </el-form-item>
        <el-form-item label="物流单号" prop="shippingCode">
          <el-input v-model="form.shippingCode" placeholder="请输入物流单号" />
        </el-form-item>
        <el-form-item label="是否申请退款：0-否，1-是" prop="isRefund">
          <el-input v-model="form.isRefund" placeholder="请输入是否申请退款：0-否，1-是" />
        </el-form-item>
        <el-form-item label="寄件人姓名" prop="senderName">
          <el-input v-model="form.senderName" placeholder="请输入寄件人姓名" />
        </el-form-item>
        <el-form-item label="寄件人电话" prop="senderPhone">
          <el-input v-model="form.senderPhone" placeholder="请输入寄件人电话" />
        </el-form-item>
        <el-form-item label="寄件人省份" prop="senderProvince">
          <el-input v-model="form.senderProvince" placeholder="请输入寄件人省份" />
        </el-form-item>
        <el-form-item label="寄件人城市" prop="senderCity">
          <el-input v-model="form.senderCity" placeholder="请输入寄件人城市" />
        </el-form-item>
        <el-form-item label="寄件人区县" prop="senderArea">
          <el-input v-model="form.senderArea" placeholder="请输入寄件人区县" />
        </el-form-item>
        <el-form-item label="寄件人地址" prop="senderAddress">
          <el-input v-model="form.senderAddress" placeholder="请输入寄件人地址" />
        </el-form-item>
        <el-form-item label="收件人姓名" prop="receiverName">
          <el-input v-model="form.receiverName" placeholder="请输入收件人姓名" />
        </el-form-item>
        <el-form-item label="收件人电话" prop="receiverPhone">
          <el-input v-model="form.receiverPhone" placeholder="请输入收件人电话" />
        </el-form-item>
        <el-form-item label="收件人省份" prop="receiverProvince">
          <el-input v-model="form.receiverProvince" placeholder="请输入收件人省份" />
        </el-form-item>
        <el-form-item label="收件人城市" prop="receiverCity">
          <el-input v-model="form.receiverCity" placeholder="请输入收件人城市" />
        </el-form-item>
        <el-form-item label="收件人区县" prop="receiverArea">
          <el-input v-model="form.receiverArea" placeholder="请输入收件人区县" />
        </el-form-item>
        <el-form-item label="收件人地址" prop="receiverAddress">
          <el-input v-model="form.receiverAddress" placeholder="请输入收件人地址" />
        </el-form-item>
        <el-form-item label="是否修改过收货地址：0-否，1-是" prop="isChangeAddress">
          <el-input v-model="form.isChangeAddress" placeholder="请输入是否修改过收货地址：0-否，1-是" />
        </el-form-item>
        <el-form-item label="年" prop="year">
          <el-input v-model="form.year" placeholder="请输入年" />
        </el-form-item>
        <el-form-item label="月" prop="month">
          <el-input v-model="form.month" placeholder="请输入月" />
        </el-form-item>
        <el-form-item label="日" prop="day">
          <el-input v-model="form.day" placeholder="请输入日" />
        </el-form-item>
        <el-form-item label="相关人员ID" prop="resId">
          <el-input v-model="form.resId" placeholder="请输入相关人员ID" />
        </el-form-item>
        <el-form-item label="相关人员名" prop="resName">
          <el-input v-model="form.resName" placeholder="请输入相关人员名" />
        </el-form-item>
        <el-form-item label="业务员ID" prop="salesmanId">
          <el-input v-model="form.salesmanId" placeholder="请输入业务员ID" />
        </el-form-item>
        <el-form-item label="分公司管理员ID" prop="companyManageId">
          <el-input v-model="form.companyManageId" placeholder="请输入分公司管理员ID" />
        </el-form-item>
        <el-form-item label="仓库管理员ID" prop="warehouseManageId">
          <el-input v-model="form.warehouseManageId" placeholder="请输入仓库管理员ID" />
        </el-form-item>
        <el-form-item label="财务ID" prop="financeId">
          <el-input v-model="form.financeId" placeholder="请输入财务ID" />
        </el-form-item>
        <el-form-item label="买家留言" prop="buyerMsg">
          <el-input v-model="form.buyerMsg" placeholder="请输入买家留言" />
        </el-form-item>
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="内容">
          <editor v-model="form.content" :min-height="192"/>
        </el-form-item>
        <el-form-item label="删除标记：0-正常，1-删除" prop="delFlag">
          <el-input v-model="form.delFlag" placeholder="请输入删除标记：0-正常，1-删除" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!--    订单详情-->
    <el-dialog  :visible.sync="menuRoleVisible" append-to-body>
      <el-form label-width="90px">
        <el-row>
          <el-col :span="parseInt(12)">
            <el-form-item label="收件人" prop="receiverName" >
              <el-input v-model="form.receiverName" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(12)">
            <el-form-item label="手机号" prop="receiverPhone" >
              <el-input v-model="form.receiverPhone" placeholder="" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="parseInt(8)">
            <el-form-item label="省份" prop="receiverProvince">
              <el-input v-model="form.receiverProvince" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="城市" prop="receiverCity">
              <el-input v-model="form.receiverCity" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="区县" prop="receiverArea">
              <el-input v-model="form.receiverArea" placeholder="" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="地址" prop="receiverAddress">
            <el-input v-model="form.receiverAddress" placeholder="" disabled />
          </el-form-item>
        </el-row>
        <el-row>
          <el-col :span="parseInt(8)">
            <el-form-item label="总价" prop="orderPrice">
              <el-input v-model="form.orderPrice" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="提成" prop="commissionPrice"  v-hasPermi="['mall:mallAppOrderGoods:commission']">
              <el-input v-model="form.commissionPrice" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="总数量" prop="goodsNum">
              <el-input v-model="form.goodsNum" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="是否接单" prop="status">
              <el-input v-model="form.status === '3'? '已接单':'未接单'" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="接单姓名" prop="warehouseManageName">
              <el-input v-model="form.warehouseManageName" placeholder="" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(8)">
            <el-form-item label="财务审核" prop="isFinance">
              <el-input v-model="form.isFinance === '0'? '未审核':'已审核'" placeholder="" disabled />
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="" disabled />
        </el-form-item>

        <el-row>
          <el-col :span="parseInt(12)" v-if="form.isProof === '1'">
            <el-form-item label="支付凭证" prop="payProof">
<!--              <el-image style="width: 200px; height: 200px" :src="form.payProof" disabled :preview-src-list="[form.payProof]" />-->
              <el-image
                v-for="(imageUrl, index) in imageUrls"
                :key="index"
                :src="imageUrl"
                style="width: 200px; height: 200px"
                disabled :preview-src-list="[imageUrl]"
              ></el-image>
            </el-form-item>
          </el-col>
          <el-col :span="parseInt(12)" v-if="form.isCar === '1'">
            <el-form-item label="装车视频" prop="carVideo">
              <video style="width: 200px; height: 200px" :src="form.carVideo" disabled controls />
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <mall-app-order-goods v-if="menuRoleVisible" :page-type="1" :order-id="this.orderGoodsOrderId"  ref="OrderGoods"></mall-app-order-goods>
    </el-dialog>

    <!--    打印订单-->
    <el-dialog  :visible.sync="printOpen" title="打印订单" append-to-body width="500px">
      <el-row style="margin-bottom: 10px">
        <el-col :span="parseInt('3')">
          <el-button type="primary" v-print="'#printMe'">打印</el-button>
        </el-col>
      </el-row>
      <el-row style="margin-bottom: 10px">
      </el-row>
      <div id="printMe" >
        <el-form v-if="!isPrintBatch">
          <el-form-item>
            <el-row class="printElRow">
              <div style="text-align: center;font-size: 17px;">郑州千冻实业发展有限公司出库单</div>
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">日期:</span>
              <el-input style="width: 60%" v-text="parseTime(printData.orderObj.createAt,'{y}年{m}月{d}日')" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">编号:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.orderNo" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">业务员:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.salesmanName" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">收件人:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.receiverName" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">手机号:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.receiverPhone" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">地区:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.receiverProvince + printData.orderObj.receiverCity + printData.orderObj.receiverArea" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">地址:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.receiverAddress" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">备注:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.remarks" :disabled="true" />
            </el-row>
            <el-row class="printElRow"  v-if="checkPermi(['mall:mallAppOrderGoods:commission'])" >
              <span style="margin-left: 10px;margin-right: 10px" class="ph">提成:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.commissionPrice" :disabled="true" />
            </el-row>
            <el-row class="printElRow">
              <span style="margin-left: 10px;margin-right: 10px" class="ph">合计:</span>
              <el-input style="width: 60%" v-text="printData.orderObj.orderPrice" :disabled="true" />
            </el-row>
          </el-form-item>
          <table border="1" style="width: 380px">
            <!--    第四行-->
            <tr>
              <td align="center">序号</td>
              <td align="center">名称</td>
              <td align="center">规格</td>
              <td align="center">单位</td>
              <td align="center">单价</td>
              <td align="center">数量</td>
              <td align="center"  v-if="checkPermi(['mall:mallAppOrderGoods:commission'])" >提成</td>
              <td align="center">小计</td>
            </tr>
            <!--    遍历表格数据-->
            <tr v-for="(item,index) in printData.orderGoodsList">
              <td align="center">{{ index+1 }}</td>
              <td align="center">{{ item.goodsName }}</td>
              <td align="center">{{ item.goodsProduct }}</td>
              <td align="center">{{ item.goodsUnit }}</td>
              <td align="center">{{ item.goodsPrice }}</td>
              <td align="center">{{ item.goodsTotal }}</td>
              <td align="center" v-if="checkPermi(['mall:mallAppOrderGoods:commission'])" >{{ item.commissionPrice }}</td>
              <td align="center">{{ item.totalPrice }}</td>
            </tr>
          </table>
        </el-form>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {
  listMallAppOrderOrder,
  getMallAppOrderOrder,
  delMallAppOrderOrder,
  addMallAppOrderOrder,
  updateMallAppOrderOrder,
  exportMallAppOrderOrder,
  exportOrder
} from "@/api/mall/mallAppOrderOrder";
import {selectAppSalesmanList} from "@/api/mall/mallAppCompanyUser";
import {getMallOrderOrder} from "@/api/mall/mallOrderOrder";
import MallAppOrderGoods from "@/views/mall/mallAppOrderGoods";
import {listMallOrderGoods} from "@/api/mall/mallOrderGoods";
import {getMallAppOrderGoods, getMallAppOrderGoodsList, listMallAppOrderGoods} from "@/api/mall/mallAppOrderGoods";
import {getPrintSetting} from "@/api/mall/printSetting";
import { checkPermi } from '@/utils/permission'

export default {
  name: "MallAppOrderOrder",
  components: {MallAppOrderGoods},
  data() {
    return {
      imageUrls: [],
      printObj:{},
      printData:{
        orderObj:{},
        orderGoodsList:[]
      },
      printDataList:[],
      /** 是否批量打印 */
      isPrintBatch: false,
      /** 配置表单 */
      printForm:{},
      printRules: {
      },
      /** 打印配置 */
      printSettingOpen: false,
      // 打印遮罩层
      printOpen: false,
      menuRoleVisible : false,
      salesmanList:[],
      createAtRange:[],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // app-线下订单表格数据
      mallAppOrderOrderList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 订单状态：0-未付款，1-已付款，2-待接单，3-待发货，4-已装车，5-已完成，,8-已取消字典
      statusOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderNo: null,
        userId: null,
        orderType: null,
        postFee: null,
        orderPrice: null,
        payment: null,
        discountPrice: null,
        commissionPrice: null,
        goodsNum: null,
        goodsWeight: null,
        goodsVolume: null,
        deliveryType: null,
        status: null,
        isPay: null,
        payType: null,
        isProof: null,
        payProof: null,
        isCar: null,
        carVideo: null,
        createAt: null,
        payAt: null,
        examineAt: null,
        financeExamineAt: null,
        receiveAt: null,
        carAt: null,
        enterAt: null,
        returnAt: null,
        completeAt: null,
        shippingMark: null,
        shippingName: null,
        shippingCode: null,
        isRefund: null,
        senderName: null,
        senderPhone: null,
        senderProvince: null,
        senderCity: null,
        senderArea: null,
        senderAddress: null,
        receiverName: null,
        receiverPhone: null,
        receiverProvince: null,
        receiverCity: null,
        receiverArea: null,
        receiverAddress: null,
        isChangeAddress: null,
        year: null,
        month: null,
        day: null,
        resId: null,
        resName: null,
        salesmanId: null,
        companyManageId: null,
        warehouseManageId: null,
        financeId: null,
        buyerMsg: null,
        remarks: null,
        content: null,
        delFlag: null,
        params:{
          beginCreateAt:'',
          endCreateAt:''
        }
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("app_order_status").then(response => {
      this.statusOptions = response.data;
    });

    selectAppSalesmanList().then(res =>{
      this.salesmanList = res.data
    })
  },
  methods: {
    checkPermi,
    /** 打印配置信息 */
    getPrintSetting() {
      getPrintSetting('1').then(response => {
        this.printForm = response.data;
        this.printObj.preparer = this.printForm.preparer
        this.printObj.checker = this.printForm.checker
        this.printObj.printed = this.printForm.printed
        this.printObj.phone = this.printForm.phone
        this.printObj.remark = this.printForm.remark
        this.printSettingOpen = false
      });
    },
    /** 打印弹窗 */
    printDialogOpen(row){
      this.isPrintBatch = false
      this.printData =  {
        orderObj:{},
        orderGoodsList:[]
      }
      this.printObj =  {}
      this.printOpen = true
      var orderId = row.id
      var _this = this
      this.getPrintSetting();
      getMallAppOrderOrder(orderId).then(res =>{
        if (res.code === 200){
          _this.printData.orderObj = res.data;
          console.log("订单信息")
          console.log(_this.printData.orderObj)
        }else {
          _this.msgError('订单信息获取失败');
        }
      });
      getMallAppOrderGoodsList({
        orderId: orderId
      }).then(res =>{
        if (res.code == 200){
          _this.printData.orderGoodsList = res.data;
        }else {
          _this.msgError('订单信息获取失败');
        }
      });
    },
    /** 订单详情 */
    handleCheckDetail(row){
      let orderId = row.id;
      this.form = {}
      this.form.carVideo = [];
      getMallAppOrderOrder(orderId).then(response => {
        this.form = response.data;
        this.imageUrls = response.data.payProof.split(',');
      });
      this.menuRoleVisible = true;
      this.orderGoodsOrderId = orderId
    },

    /** 查询app-线下订单列表 */
    getList() {
      this.loading = true;
      if (null != this.createAtRange && '' != this.createAtRange) {
        this.queryParams.params["beginCreateAt"] = this.createAtRange[0];
        this.queryParams.params["endCreateAt"] = this.createAtRange[1];
      }
      listMallAppOrderOrder(this.queryParams).then(response => {
        this.mallAppOrderOrderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        orderNo: null,
        userId: null,
        orderType: null,
        postFee: null,
        orderPrice: null,
        payment: null,
        discountPrice: null,
        commissionPrice: null,
        goodsNum: null,
        goodsWeight: null,
        goodsVolume: null,
        deliveryType: null,
        status: "0",
        isPay: null,
        payType: null,
        isProof: null,
        payProof: null,
        isCar: null,
        carVideo: null,
        createAt: null,
        payAt: null,
        examineAt: null,
        financeExamineAt: null,
        receiveAt: null,
        carAt: null,
        enterAt: null,
        returnAt: null,
        completeAt: null,
        shippingMark: null,
        shippingName: null,
        shippingCode: null,
        isRefund: null,
        senderName: null,
        senderPhone: null,
        senderProvince: null,
        senderCity: null,
        senderArea: null,
        senderAddress: null,
        receiverName: null,
        receiverPhone: null,
        receiverProvince: null,
        receiverCity: null,
        receiverArea: null,
        receiverAddress: null,
        isChangeAddress: null,
        year: null,
        month: null,
        day: null,
        resId: null,
        resName: null,
        salesmanId: null,
        companyManageId: null,
        warehouseManageId: null,
        financeId: null,
        buyerMsg: null,
        remarks: null,
        content: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.createAtRange = []
      this.queryParams.params["beginCreateAt"] = '';
      this.queryParams.params["endCreateAt"] = '';
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加app-线下订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getMallAppOrderOrder(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改app-线下订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateMallAppOrderOrder(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addMallAppOrderOrder(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除app-线下订单编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delMallAppOrderOrder(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // const queryParams = this.queryParams;
      // this.$confirm('是否确认导出所有app-线下订单数据项?', "警告", {
      //     confirmButtonText: "确定",
      //     cancelButtonText: "取消",
      //     type: "warning"
      //   }).then(() => {
      //     this.exportLoading = true;
      //     return exportMallAppOrderOrder(queryParams);
      //   }).then(response => {
      //     this.download(response.msg);
      //     this.exportLoading = false;
      //   }).catch(() => {});

      const orderIds = this.ids;
      var that = this
      if (orderIds.length === 0){
        const queryParams = this.queryParams;
        this.$confirm('是否确认导出满足筛选条件的订单?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.exportLoading = true;
          return exportMallAppOrderOrder(queryParams);
        }).then(response => {
          this.download(response.msg);
          this.exportLoading = false;
        }).catch(() => {});
      }else {
        // const queryParams = this.queryParams;
        this.$confirm('是否确认导出勾选的订单数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          that.exportLoading = true;
          return exportOrder(orderIds);
        }).then(response => {
          that.download(response.msg);
          that.exportLoading = false;
        }).catch(() => {});
      }

    }
  }
};
</script>
