Przeglądaj źródła

Merge branch 'feature/Feature-basic_data' of https://gogs.zfire.top/zfire-front/supply-front into feature/Feature-basic_data

chen 3 lat temu
rodzic
commit
17d40a9917

+ 54 - 0
src/api/supply/engin.js

@@ -135,6 +135,24 @@ export function overOrder(params) {
   })
 }
 
+// 工程订单 - 直调发货
+export function deliverOrder(params) {
+  return request({
+    url: '/engin-order/direct-transfer',
+    method: 'post',
+    data: params
+  })
+}
+
+// 工程订单 - 提前开票
+export function directOrder(params) {
+  return request({
+    url: '/requisition/add',
+    method: 'post',
+    data: params
+  })
+}
+
 
 
 
@@ -221,6 +239,24 @@ export function closeHome(params) {
   })
 }
 
+// 家用工程订单 - 审批
+export function examineHome(params) {
+  return request({
+    url: '/engin-order/home-examine',
+    method: 'post',
+    data: params
+  })
+}
+
+// 家用工程订单 - 退订
+export function returnHome(params) {
+  return request({
+    url: '/engin-order/home-refund',
+    method: 'post',
+    data: params
+  })
+}
+
 
 
 
@@ -306,6 +342,24 @@ export function closeCom(params) {
   })
 }
 
+// 商用工程订单 - 审批
+export function examineCom(params) {
+  return request({
+    url: '/engin-order/trade-examine',
+    method: 'post',
+    data: params
+  })
+}
+
+// 商用工程订单 - 退订
+export function returnCom(params) {
+  return request({
+    url: '/engin-order/trade-refund',
+    method: 'post',
+    data: params
+  })
+}
+
 
 
 

+ 188 - 77
src/views/supply/engin/commerce_list.vue

@@ -1,19 +1,15 @@
 <template>
   <div class="app-container">
-    <div v-show="!isShowDetail && !isShowForm">
+    <div v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn">
       <!-- 筛选条件 -->
       <div class="screen-container">
         <el-form ref="screenForm" :model="screenForm" label-width="100px" size="small" label-position="left">
           <el-row :gutter="20">
             <el-col :xs="24" :sm="24" :lg="24">
-              <el-form-item prop="orderNum" label-width="0">
-                <el-radio-group v-model="screenForm.status" size="medium">
-                  <el-radio-button label="1">全部</el-radio-button>
-                  <el-radio-button label="2">已保存</el-radio-button>
-                  <el-radio-button label="3">待审核</el-radio-button>
-                  <el-radio-button label="3">审核通过</el-radio-button>
-                  <el-radio-button label="3">审核驳回</el-radio-button>
-                  <el-radio-button label="3">已退单</el-radio-button>
+              <el-form-item prop="status" label-width="0">
+                <el-radio-group v-model="screenForm.status" size="medium" @change="getList()">
+                  <el-radio-button label="">全部</el-radio-button>
+                  <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
                 </el-radio-group>
               </el-form-item>
             </el-col>
@@ -23,18 +19,18 @@
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="工程编码" prop="orderNum">
-                <el-input v-model="screenForm.orderNum" placeholder="请输入工程编码"></el-input>
+              <el-form-item label="工程编码" prop="enginNum">
+                <el-input v-model="screenForm.enginNum" placeholder="请输入工程编码"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="工程登录单号" prop="jxsName">
-                <el-input v-model="screenForm.jxsName" placeholder="请输入工程登录单号"></el-input>
+              <el-form-item label="工程登录单号" prop="loginNum">
+                <el-input v-model="screenForm.loginNum" placeholder="请输入工程登录单号"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="工程名称" prop="jxsNum">
-                <el-input v-model="screenForm.jxsNum" placeholder="请输入工程名称"></el-input>
+              <el-form-item label="工程名称" prop="enginName">
+                <el-input v-model="screenForm.enginName" placeholder="请输入工程名称"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -51,27 +47,22 @@
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="销售类型" prop="chName">
-                <el-input v-model="screenForm.chName" placeholder="请输入销售类型"></el-input>
+              <el-form-item label="销售类型" prop="saleType">
+                <el-input v-model="screenForm.saleType" placeholder="请输入销售类型"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="使用单位" prop="model">
-                <el-input v-model="screenForm.model" placeholder="请输入使用单位"></el-input>
+              <el-form-item label="制表人" prop="createMan">
+                <el-input v-model="screenForm.createMan" placeholder="请输入制表人"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="制表人" prop="model">
-                <el-input v-model="screenForm.model" placeholder="请输入制表人"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="审核人" prop="model">
-                <el-input v-model="screenForm.model" placeholder="请输入审核人"></el-input>
+              <el-form-item label="审核人" prop="examineMan">
+                <el-input v-model="screenForm.examineMan" placeholder="请输入审核人"></el-input>
               </el-form-item>
             </el-col>
             
-            <el-col :xs="24" :sm="12" :lg="18" class="tr">
+            <el-col :xs="24" :sm="24" :lg="24" class="tr">
               <el-form-item label="">
                 <el-button size="small" @click="resetScreenForm">清空</el-button>
                 <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
@@ -85,40 +76,63 @@
         <div class="btn-group clearfix">
           <div class="fl">
             <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()">新增</el-button>
+            <el-button size="small" type="danger" icon="el-icon-minus" :disabled="multipleSelection.length < 1" @click="batchDelete()">批量删除</el-button>
           </div>
           <div class="fr">
             <ExportButton :exUrl="'admin/user/mch/export'" :exParams="exParams" />
           </div>
         </div>
         <div class="table">
-          <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
-            <el-table-column align="center" label="工程订单号" prop="shipOrderNo" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="单据日期" prop="shipTime" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="工程编码" prop="stockName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="工程登录单号" prop="projectNumber" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="工程名称" prop="projectName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="使用单位" prop="unit" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="销售类型" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="货品名称" prop="unit" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="规格型号" prop="number" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="单位" prop="number" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="总数量" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="是否直调" prop="customerNumber" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="直调数量" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="单价" prop="productName" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="金额" prop="createBy" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="返利使用比例" prop="createTime" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="返利" prop="createBy" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="制表人" prop="createTime" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="制表日期" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="审核人" prop="aaa" min-width="200" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="审核日期" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="审核状态" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="操作" width="160" fixed="right">
+          <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="handleSelectionChange">
+            <el-table-column align="center" type="selection" width="55"></el-table-column>
+            <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{scope.row.examineStatus | statusFilter}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="工程订单号" prop="enginOrderNo" min-width="200" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="订单日期" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="工程登录单号" prop="refEnginRecordNo" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="订单类型" prop="enginOrderType" min-width="160" show-overflow-tooltip>
               <template slot-scope="scope">
-                <el-button type="text" @click="toForm(scope.row)">编辑</el-button>
+                {{scope.row.enginOrderType | typeFilter}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="工程名称" prop="refProjectName" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="销售类型" prop="saleTypeId" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="货品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{scope.row.isDirectTransfer ? '是':'否'}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="出库数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="单价" prop="enginPrice" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="金额" prop="enginTotality" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="返利钱包" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="业务员" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="制表人" prop="createName" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="审核人" prop="confirmName" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="操作" width="220" fixed="right">
+              <template slot-scope="scope">
+                <el-popconfirm style="margin-right: 10px;" title="确定申请吗?" @onConfirm="handleSubmit(scope.row.parentId)" v-if="scope.row.examineStatus === 'SAVE'" >
+                  <el-button slot="reference" type="text">申请</el-button>
+                </el-popconfirm>
+                <el-popconfirm style="margin-right: 10px;" title="确定撤回吗?" @onConfirm="handleWithdraw(scope.row.parentId)" v-if="scope.row.examineStatus === 'WAIT'" >
+                  <el-button slot="reference" type="text">撤回</el-button>
+                </el-popconfirm>
+                <el-button type="text" @click="toForm(scope.row)" v-if="scope.row.examineStatus === 'SAVE'">编辑</el-button>
+                <el-button type="text" @click="toExamine(scope.row)" v-if="scope.row.examineStatus === 'WAIT'">审批</el-button>
+                <el-button type="text" @click="toReturn(scope.row)">退订</el-button>
                 <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
-                <el-popconfirm v-if="scope.row.status" style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.id)" >
+                <el-popconfirm style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.parentId)" >
                   <el-button slot="reference" type="text">删除</el-button>
                 </el-popconfirm>
               </template>
@@ -143,19 +157,39 @@
     
     <CommerceDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
     <CommerceForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
+    <CommerceExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
+    <CommerceReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
 
   </div>
 </template>
 
 <script>
-import { getList } from "@/api/supply/engin";
+import { getOrderList, applyCom, withdrawCom, deleteCom } from "@/api/supply/engin";
 import CommerceDetail from "@/views/supply/engin/components/commerce_detail";
 import CommerceForm from "@/views/supply/engin/components/commerce_form";
+import CommerceExamine from "@/views/supply/engin/components/commerce_examine";
+import CommerceReturn from "@/views/supply/engin/components/commerce_return";
 
+let that
 export default {
   components: {
     CommerceDetail,
     CommerceForm,
+    CommerceExamine,
+    CommerceReturn,
+  },
+  filters: {
+    statusFilter(val) {
+      let obj = that.statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    },
+    typeFilter(val) {
+      const MAP = {
+        TRADE: '商用',
+        HOME: '家用',
+      }
+      return MAP[val];
+    }
   },
   data() {
     return {
@@ -166,35 +200,53 @@ export default {
       listLoading: false, // 列表加载loading
       screenForm: { // 筛选表单数据
         orderNum: '',
-        jxsName: '',
-        chName: '',
-        model: '',
+        enginNum: '',
+        loginNum: '',
+        enginName: '',
         date: '',
-        jxsNum: '',
-        status: '',
+        saleType: '',
+        createMan: '',
+        examineMan: '',
       },
+      statusList: [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ],
+
+      multipleSelection: [],
 
       queryItem: {},
       isShowDetail: false,
       isShowForm: false,
+      isShowExamine: false,
+      isShowReturn: false,
     }
   },
 
   computed: {
     exParams() {
       return {
-        retreatOrderNo: this.screenForm.orderNum,
-        customerNumber: this.screenForm.jxsNum,
-        customerName: this.screenForm.jxsName,
-        productName: this.screenForm.chName,
-        specification: this.screenForm.model,
-        startTime: this.screenForm.date ? this.screenForm.date[0] : '',
-        endTime: this.screenForm.date ? this.screenForm.date[1] : '',
-        status: 2, // 1:发货单,2:工程发货单
+        enginOrderNo: this.screenForm.orderNum,
+        refProjectNo: this.screenForm.enginNum,
+        refEnginRecordNo: this.screenForm.loginNum,
+        refProjectName: this.screenForm.enginName,
+        startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
+        endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
+        saleTypeId: this.screenForm.saleType,
+        createName: this.screenForm.createMan,
+        confirmName: this.screenForm.examineMan,
+        enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
       }
     },
   },
 
+  beforeCreate() {
+    that = this;
+  },
+
   created() {
     this.getList();
   },
@@ -216,16 +268,18 @@ export default {
       let params = {
         pageNum: this.currentPage,
         pageSize: this.pageSize,
-        retreatOrderNo: this.screenForm.orderNum,
-        customerNumber: this.screenForm.jxsNum,
-        customerName: this.screenForm.jxsName,
-        productName: this.screenForm.chName,
-        specification: this.screenForm.model,
-        startTime: this.screenForm.date ? this.screenForm.date[0] : '',
-        endTime: this.screenForm.date ? this.screenForm.date[1] : '',
-        status: 2, // 1:发货单,2:工程发货单
+        enginOrderNo: this.screenForm.orderNum,
+        refProjectNo: this.screenForm.enginNum,
+        refEnginRecordNo: this.screenForm.loginNum,
+        refProjectName: this.screenForm.enginName,
+        startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
+        endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
+        saleTypeId: this.screenForm.saleType,
+        createName: this.screenForm.createMan,
+        confirmName: this.screenForm.examineMan,
+        enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
       };
-      getList(params).then((res) => {
+      getOrderList(params).then((res) => {
         this.dataList = res.data.records;
         this.listTotal = res.data.total;
         this.listLoading = false;
@@ -264,21 +318,78 @@ export default {
       this.isShowForm = true;
     },
 
+    // 进入审批
+    toExamine(item) {
+      this.queryItem = item;
+      this.isShowExamine = true;
+    },
+
     // 进入详情
     toDetail(item) {
       this.queryItem = item;
       this.isShowDetail = true;
     },
 
+    // 进入退订
+    toReturn(item) {
+      this.queryItem = item;
+      this.isShowReturn = true;
+    },
+
     backList() {
       this.queryItem = {};
       this.isShowDetail = false;
       this.isShowForm = false;
+      this.isShowExamine = false;
+      this.isShowReturn = false;
+    },
+
+    // 申请
+    handleSubmit(id) {
+      applyCom({id}).then(res => {
+        this.$successMsg();
+        this.getList();
+      })
+    },
+
+    // 撤回
+    handleWithdraw(id) {
+      withdrawCom({id}).then(res => {
+        this.$successMsg();
+        this.getList();
+      })
     },
 
+    // 删除
     handleDelete(id) {
+      deleteCom({ids: id}).then(res => {
+        this.$successMsg();
+        this.getList();
+      })
+    },
+
+    // 批量删除
+    batchDelete() {
+      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let ids = this.multipleSelection.map(item => {
+          return item.parentId;
+        });
+        deleteCom({ids: ids.join(',')}).then(res => {
+          this.$successMsg();
+          this.getList();
+        })
+      }).catch(() => {});
+    },
+
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+
 
-    }
   }
 }
 </script>

+ 430 - 101
src/views/supply/engin/components/commerce_detail.vue

@@ -10,56 +10,120 @@
       <div class="diy-table-1">
         <el-row>
           <el-col :span="8" class="item">
-            <div class="label">发货申请单号</div>
-            <div class="value">{{detailData.billNo}}</div>
+            <div class="label">工程订单号</div>
+            <div class="value">{{detailData.enginOrderId}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">申请日期</div>
-            <div class="value">{{detailData.fdate}}</div>
+            <div class="label">订单日期</div>
+            <div class="value">{{detailData.orderDate}}</div>
           </el-col>
           <el-col :span="8" class="item">
             <div class="label">单据状态</div>
-            <div class="value">{{detailData.srcStockId}}</div>
+            <div class="value">{{detailData.examineStatus | statusFilter}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">经销商编</div>
-            <div class="value">{{detailData.destStockId}}</div>
+            <div class="label">经销商编</div>
+            <div class="value">{{detailData.customerId}}</div>
           </el-col>
-          <el-col :span="8" class="item">
+          <el-col :span="16" class="item">
             <div class="label">经销商名称</div>
-            <div class="value">{{detailData.approveDate}}</div>
+            <div class="value">{{detailData.customerName}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">仓库</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="label">工程信息编号</div>
+            <div class="value">{{detailData.refEnginRecordNo}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">工程登录编码</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="label">工程项目名称</div>
+            <div class="value">{{detailData.refProjectName}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">制单人</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="label">工程登录类型</div>
+            <div class="value">{{detailData.refPromiseStatus}}</div>
           </el-col>
           <el-col :span="8" class="item">
-            <div class="label">制单日期</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="label">厂工程编码</div>
+            <div class="value">{{detailData.refFactoryNo}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">使用单位</div>
+            <div class="value">{{detailData.refUseUnit}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">销售类型</div>
+            <div class="value">{{detailData.saleTypeName}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">联系人</div>
+            <div class="value">{{detailData.aaa}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">固定电话</div>
+            <div class="value">{{detailData.aaa}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">移动电话</div>
+            <div class="value">{{detailData.aaa}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">不扣押金</div>
+            <div class="value">{{detailData.takeDeposit ? '是':'否'}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">文件编码</div>
+            <div class="value">{{detailData.fileNo}}</div>
+          </el-col>
+          <el-col :span="8" class="item">
+            <div class="label">业务员</div>
+            <div class="value">{{detailData.serviceName}}</div>
+          </el-col>
+          <el-col :span="24" class="item">
+            <div class="label">格力回复</div>
+            <div class="value">{{detailData.note1}}</div>
+          </el-col>
+          <el-col :span="24" class="item">
+            <div class="label">格力内部备注</div>
+            <div class="value">{{detailData.note2}}</div>
           </el-col>
           <el-col :span="24" class="item">
             <div class="label">备注</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="value">{{detailData.remark}}</div>
+          </el-col>
+          <el-col :span="6" class="item">
+            <div class="label">制单人</div>
+            <div class="value">{{detailData.createName}}</div>
+          </el-col>
+          <el-col :span="6" class="item">
+            <div class="label">制单日期</div>
+            <div class="value">{{detailData.createTime}}</div>
           </el-col>
-          <el-col :span="12" class="item">
+          <el-col :span="6" class="item">
             <div class="label">审核人</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="value">{{detailData.confirmName}}</div>
           </el-col>
-          <el-col :span="12" class="item">
+          <el-col :span="6" class="item">
             <div class="label">审核日期</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="value">{{detailData.confirmTime}}</div>
           </el-col>
-          <el-col :span="24" class="item">
+          <el-col :span="6" class="item">
+            <div class="label">最后更新人</div>
+            <div class="value">{{detailData.updateName}}</div>
+          </el-col>
+          <el-col :span="6" class="item">
+            <div class="label">最后更新日期</div>
+            <div class="value">{{detailData.updateTime}}</div>
+          </el-col>
+          <el-col :span="6" class="item">
+            <div class="label">关闭人</div>
+            <div class="value">{{detailData.closeName}}</div>
+          </el-col>
+          <el-col :span="6" class="item">
+            <div class="label">关闭日期</div>
+            <div class="value">{{detailData.closeTime}}</div>
+          </el-col>
+          <el-col :span="24" class="item" v-if="isExamine">
             <div class="label">审批说明</div>
-            <div class="value">{{detailData.approverId}}</div>
+            <div class="value">{{detailData.examineNote}}</div>
           </el-col>
         </el-row>
       </div>
@@ -69,62 +133,51 @@
       </div>
 
       <div class="table" style="margin-top: 20px">
-        <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+        <el-table :data="detailData.items" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
           <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-          <el-table-column align="center" label="引用单号" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="单号类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="销售类型" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="货品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="计量单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
           <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="返利类型" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              {{ scope.row.isDirectTransfer ? '是' : '否' }}
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
         </el-table>
       </div>
-
-      <div class="main-title">
-        <div class="title">审批记录</div>
-      </div>
-      <div class="diy-table-1">
-        <el-row :gutter="0">
-          <el-col :span="12" class="item">
-            <div class="label">审批人</div>
-            <div class="value">2022123233435342</div>
-          </el-col>
-          <el-col :span="12" class="item">
-            <div class="label">审批结果</div>
-            <div class="value">2022123233435342</div>
-          </el-col>
-          <el-col :span="24" class="item">
-            <div class="label">审批说明</div>
-            <div class="value">2022123233435342</div>
-          </el-col>
-        </el-row>
-      </div>
       
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button  type="primary" @click="openDeliverDialog">直调发货</el-button>
-        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
-          <el-button slot="reference">关 闭</el-button>
-        </el-popconfirm>
+        <el-button type="danger" @click="closeData">关闭订单</el-button>
+        <el-button type="primary" @click="openDirectDialog">提前开票</el-button>
+        <el-button type="primary" @click="overData">直调完结</el-button>
+        <el-button type="primary" @click="openDeliverDialog">直调发货</el-button>
+        <el-button @click="goBack">返回</el-button>
       </div>
     </div>
 
-    <el-dialog
-      title="直调发货"
-      :visible.sync="isShowDeliverDialog"
-      width="80%">
-      <el-form ref="deliverForm" :model="deliverForm" label-width="70px" size="small" label-position="left">
+    <el-dialog title="直调发货" :visible.sync="isShowDeliverDialog" width="80%">
+      <el-form ref="deliverForm" :model="deliverForm" :rules="deliverFormRules" label-width="80px" size="small" label-position="left">
         <el-row :gutter="20">
-          <el-col :xs="24" :sm="8" :lg="8">
-            <el-form-item label="工程订单" prop="orderNum">
-              <el-input v-model="deliverForm.orderNum" placeholder="请输入工程订单"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :sm="8" :lg="8" style="height: 51px;">
+          <el-col :xs="8" :sm="8" :lg="8" style="height: 51px;">
             <el-form-item label="发货日期" prop="date">
               <el-date-picker
                 v-model="deliverForm.date"
@@ -135,15 +188,17 @@
               </el-date-picker>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :sm="8" :lg="8">
+          <el-col :xs="8" :sm="8" :lg="8">
             <el-form-item label="发货仓库" prop="warehouse">
-              <el-select v-model="deliverForm.warehouse" placeholder="请选择发货仓库">
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
+              <el-select v-model="deliverForm.warehouse" placeholder="请选择发货仓库" style="width: 100%" filterable @change="changeWarehouse">
+                <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="8" :sm="8" :lg="8">
+            <el-form-item label="选择仓位" prop="position">
+              <el-select v-model="deliverForm.position" placeholder="请选择仓位" style="width: 100%" filterable>
+                <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -151,24 +206,24 @@
       </el-form>
 
       <div class="table" style="margin-top: 20px">
-        <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+        <el-table :data="deliverGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
           <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-          <el-table-column align="center" label="引用记录" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="销售类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品编码" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="是否使用返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="返利使用比例" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="是否直调" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="直调数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="已发货数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.directTransferQty" size="small" type="number"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利" prop="rebateAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
         </el-table>
       </div>
       <span slot="footer" class="dialog-footer">
@@ -177,33 +232,146 @@
       </span>
     </el-dialog>
 
+
+    <el-dialog title="直接调拨单(提前开票)" :visible.sync="isShowDirectDialog" width="80%">
+      <el-form ref="directForm" :model="directForm" :rules="directFormRules" label-width="80px" size="small" label-position="left">
+        <el-row :gutter="20">
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调出仓库" prop="warehouse1">
+              <el-select v-model="directForm.warehouse1" placeholder="请选择调出仓库" style="width: 100%" filterable @change="changeWarehouse1">
+                <el-option v-for="item in warehouseList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调出仓位" prop="position1">
+              <el-select v-model="directForm.position1" placeholder="请调出仓位" style="width: 100%" filterable @change="changePosition1">
+                <el-option v-for="item in positionList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调入仓库" prop="warehouse2">
+              <el-select v-model="directForm.warehouse2" placeholder="请选择调入仓库" style="width: 100%" filterable @change="changeWarehouse2">
+                <el-option v-for="item in warehouseList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调入仓位" prop="position2">
+              <el-select v-model="directForm.position2" placeholder="请调入仓位" style="width: 100%" filterable @change="changePosition2">
+                <el-option v-for="item in positionList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div class="table" style="margin-top: 20px">
+        <el-table :data="directGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+          <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
+          <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出仓库" prop="warehouse1" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出仓位" prop="position1" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入仓库" prop="warehouse2" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入仓位" prop="position2" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出库存状态" prop="status1" min-width="110" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入库存状态" prop="status2" min-width="110" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出货主" min-width="100" show-overflow-tooltip>
+            <template slot-scope="">弘格</template>
+          </el-table-column>
+          <el-table-column align="center" label="调入货主" min-width="100" show-overflow-tooltip>
+            <template slot-="scope">弘格</template>
+          </el-table-column>
+          <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        </el-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeDirectDialog">取 消</el-button>
+        <el-button type="primary" @click="submitDirectForm">确 定</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import print from 'vue-print-nb'
-import { getDetail } from "@/api/supply/reserve";
+import { getOrderDetail, closeCom, overOrder, getWarehouseList, deliverOrder, directOrder } from "@/api/supply/engin";
 
 export default {
   name: 'CommerceDetail',
   componentName: 'CommerceDetail',
   props: ['listItem'],
-  directives: {
-    print
+  filters: {
+    statusFilter(val) {
+      const statusList = [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ];
+      let obj = statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    }
   },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
       detailData: {},
 
       isShowDeliverDialog: false,
       deliverForm: {
-        orderNum: '',
         date: '',
+        warehouse: '',
+        position: '',
+      },
+      deliverFormRules: {
+        date: [
+          { required: true, message: '请选择发货日期', trigger: 'change' }
+        ],
+        warehouse: [
+          { required: true, message: '请选择发货仓库', trigger: 'change' }
+        ],
+        position: [
+          { required: true, message: '请选择仓位', trigger: 'change' }
+        ],
       },
       warehouseList: [],
+      positionList: [],
+      deliverGoodsList: [],
+
+      isShowDirectDialog: false,
+      directForm: {
+        warehouse1: '',
+        position1: '',
+        warehouse2: '',
+        position2: '',
+      },
+      directFormRules: {
+        warehouse1: [
+          { required: true, message: '请选择调出仓库', trigger: 'change' }
+        ],
+        position1: [
+          { required: true, message: '请选择调出仓位', trigger: 'change' }
+        ],
+        warehouse2: [
+          { required: true, message: '请选择调入仓库', trigger: 'change' }
+        ],
+        position2: [
+          { required: true, message: '请选择调入仓位', trigger: 'change' }
+        ],
+      },
+      warehouseList1: [],
+      warehouseList2: [],
+      positionList1: [],
+      positionList2: [],
+      directGoodsList: [],
     }
   },
 
@@ -217,6 +385,9 @@ export default {
         openSidebar: this.sidebar.opened
       }
     },
+    isExamine() {
+      return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === 'FAIL'
+    },
   },
 
   created() {
@@ -229,16 +400,73 @@ export default {
       this.$emit('backListFormDetail');
     },
 
+    // 获取仓库列表
+    getWarehouseList() {
+      getWarehouseList({
+        pageNum: 1,
+        pageSize: -1,
+      }).then(res => {
+        this.warehouseList = res.data.records;
+        this.warehouseList1 = res.data.records;
+        this.warehouseList2 = res.data.records;
+      })
+    },
+
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
+      getOrderDetail({id: this.listItem.parentId}).then(res => {
         this.detailData = res.data;
       })
     },
 
+    // 关闭订单
+    closeData() {
+      this.$confirm('此操作将关闭订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        closeCom({id: this.listItem.parentId}).then(res => {
+          this.$successMsg();
+          this.getDetail();
+        })
+      }).catch(() => {});
+    },
+
+    // 直调完结
+    overData() {
+      this.$confirm('此操作将直调完结订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        overOrder({id: this.listItem.parentId}).then(res => {
+          this.$successMsg();
+          this.getDetail();
+        })
+      }).catch(() => {});
+    },
+
+    // 更改仓库
+    changeWarehouse() {
+      this.deliverForm.position = '';
+      let obj = this.warehouseList.find(o => o.id == this.deliverForm.warehouse);
+      this.positionList = obj.kingDeeStocks;
+    },
+
     // 打开 直调发货
     openDeliverDialog() {
       this.isShowDeliverDialog = true;
+      this.deliverGoodsList = this.detailData.items;
+      this.deliverGoodsList.forEach(item => {
+        item.warehouse1 = '';
+        item.warehouse2 = '';
+        item.position1 = '';
+        item.position2 = '';
+        item.status1 = '';
+        item.status2 = '';
+      })
+      this.getWarehouseList();
     },
 
     // 关闭 直调发货
@@ -248,7 +476,108 @@ export default {
 
     // 提交 直调发货
     submitDeliverForm() {
+      this.$refs.deliverForm.validate((valid) => {
+        if (valid) {
+          for(let i=0; i<this.deliverGoodsList.length; i++) {
+            if(!this.deliverGoodsList[i].directTransferQty) {
+              this.$errorMsg('请输入直调数量');
+              return;
+            }
+          }
+          let params = {
+            enginOrderId: this.detailData.enginOrderId,
+            enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
+            deliverDate: this.deliverForm.date + ' 00:00:00',
+            correspondId: this.deliverForm.warehouse,
+            stockId: this.deliverForm.position,
+            items: this.deliverGoodsList
+          }
+          deliverOrder(params).then(res => {
+            this.$successMsg();
+            this.isShowDeliverDialog = false;
+            this.getDetail();
+          })
+        }
+      })
+    },
 
+    // 更改调出仓库
+    changeWarehouse1() {
+      this.directForm.position1 = '';
+      let obj = this.warehouseList1.find(o => o.id == this.directForm.warehouse1);
+      this.positionList1 = obj.kingDeeStocks;
+      this.directGoodsList.forEach(item => {
+        item.warehouse1 = obj.name;
+      });
+    },
+
+    // 更改调入仓库
+    changeWarehouse2() {
+      this.directForm.position2 = '';
+      let obj = this.warehouseList2.find(o => o.id == this.directForm.warehouse2);
+      this.positionList2 = obj.kingDeeStocks;
+      this.directGoodsList.forEach(item => {
+        item.warehouse2 = obj.name;
+      });
+    },
+
+    // 更改调出仓位
+    changePosition1() {
+      let obj = this.positionList1.find(o => o.id == this.directForm.position1);
+      this.directGoodsList.forEach(item => {
+        item.position1 = obj.name;
+        item.status1 = obj.defStockStatusName;
+      });
+    },
+
+    // 更改调入仓位
+    changePosition2() {
+      let obj = this.positionList2.find(o => o.id == this.directForm.position2);
+      this.directGoodsList.forEach(item => {
+        item.position2 = obj.name;
+        item.status2 = obj.defStockStatusName;
+      });
+    },
+
+    // 打开 提前开票
+    openDirectDialog() {
+      this.isShowDirectDialog = true;
+      this.directGoodsList = this.detailData.items;
+      this.getWarehouseList();
+    },
+
+    // 关闭 提前开票
+    closeDirectDialog() {
+      this.isShowDirectDialog = false;
+    },
+
+    // 提交 提前开票
+    submitDirectForm() {
+      this.$refs.directForm.validate((valid) => {
+        if (valid) {
+          let warehouseItem1 = this.warehouseList1.find(o => o.id == this.directForm.warehouse1);
+          let positionItem1 = this.positionList1.find(o => o.id == this.directForm.position1);
+          let warehouseItem2 = this.warehouseList2.find(o => o.id == this.directForm.warehouse2);
+          let positionItem2 = this.positionList2.find(o => o.id == this.directForm.position2);
+          let params = {
+            orderNo: this.detailData.enginOrderId,
+            orderType: 'TRADE', // TRADE=商用 HOME=家用 RETAIL=零售单 RETAIL_POLICY 销售政策单
+            correspondId: this.directForm.warehouse1,
+            correspondName: warehouseItem1.name,
+            stockId: this.directForm.position1,
+            stockName: positionItem1.name,
+            inCorrespondId: this.directForm.warehouse2,
+            inCorrespondName: warehouseItem2.name,
+            inStockId: this.directForm.position2,
+            inStockName: positionItem2.name,
+          }
+          directOrder(params).then(res => {
+            this.$successMsg();
+            this.isShowDirectDialog = false;
+            this.getDetail();
+          })
+        }
+      })
     },
 
   }

+ 157 - 58
src/views/supply/engin/components/commerce_examine.vue

@@ -9,56 +9,106 @@
     <div class="diy-table-1">
       <el-row>
         <el-col :span="8" class="item">
-          <div class="label">发货申请单号</div>
-          <div class="value">{{detailData.billNo}}</div>
+          <div class="label">工程订单号</div>
+          <div class="value">{{detailData.enginOrderId}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">申请日期</div>
-          <div class="value">{{detailData.fdate}}</div>
+          <div class="label">订单日期</div>
+          <div class="value">{{detailData.orderDate}}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">单据状态</div>
-          <div class="value">{{detailData.srcStockId}}</div>
+          <div class="value">{{detailData.examineStatus | statusFilter}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">经销商编</div>
-          <div class="value">{{detailData.destStockId}}</div>
+          <div class="label">经销商编</div>
+          <div class="value">{{detailData.customerId}}</div>
         </el-col>
-        <el-col :span="8" class="item">
+        <el-col :span="16" class="item">
           <div class="label">经销商名称</div>
-          <div class="value">{{detailData.approveDate}}</div>
+          <div class="value">{{detailData.customerName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">仓库</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程信息编号</div>
+          <div class="value">{{detailData.refEnginRecordNo}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">工程登录编码</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程项目名称</div>
+          <div class="value">{{detailData.refProjectName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单人</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程登录类型</div>
+          <div class="value">{{detailData.refPromiseStatus}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">厂工程编码</div>
+          <div class="value">{{detailData.refFactoryNo}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">使用单位</div>
+          <div class="value">{{detailData.refUseUnit}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">销售类型</div>
+          <div class="value">{{detailData.saleTypeName}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">联系人</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">固定电话</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">移动电话</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">不扣押金</div>
+          <div class="value">
+            <el-checkbox v-model="detailData.takeDeposit">{{detailData.takeDeposit ? '是':'否'}}</el-checkbox>
+          </div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">文件编码</div>
+          <div class="value">{{detailData.fileNo}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">业务员</div>
+          <div class="value">{{detailData.serviceName}}</div>
+        </el-col>
+        <el-col :span="24" class="item">
+          <div class="label">格力回复</div>
+          <div class="value">
+            <el-input v-model="detailData.note1" placeholder="请输入格力回复"></el-input>
+          </div>
+        </el-col>
+        <el-col :span="24" class="item">
+          <div class="label">格力内部备注</div>
+          <div class="value">
+            <el-input v-model="detailData.note2" placeholder="请输入格力内部备注"></el-input>
+          </div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">备注</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.remark}}</div>
         </el-col>
-        <el-col :span="12" class="item">
-          <div class="label">审核人</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">制单人</div>
+          <div class="value">{{detailData.createName}}</div>
         </el-col>
-        <el-col :span="12" class="item">
-          <div class="label">审核日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">制单日期</div>
+          <div class="value">{{detailData.createTime}}</div>
         </el-col>
-        <el-col :span="24" class="item">
-          <div class="label">审批说明</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">关闭人</div>
+          <div class="value">{{detailData.closeName}}</div>
+        </el-col>
+        <el-col :span="6" class="item">
+          <div class="label">关闭日期</div>
+          <div class="value">{{detailData.closeTime}}</div>
         </el-col>
       </el-row>
     </div>
@@ -68,16 +118,33 @@
     </div>
 
     <div class="table" style="margin-top: 20px">
-      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+      <el-table :data="detailData.items" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="引用单号" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单号类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="货品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="计量单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利类型" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.isDirectTransfer ? '是' : '否' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
       </el-table>
     </div>
 
@@ -88,32 +155,24 @@
       <el-row :gutter="0">
         <el-col :span="12" class="item">
           <div class="label">审批人</div>
-          <div class="value">2022123233435342</div>
+          <div class="value">{{userName}}</div>
         </el-col>
         <el-col :span="12" class="item">
-          <div class="label">审批结果</div>
-          <div class="value">
-            <el-radio-group v-model="examineForm.status">
-              <el-radio :label="true">通过</el-radio>
-              <el-radio :label="false">驳回</el-radio>
-            </el-radio-group>
-          </div>
+          <div class="label">审批日期</div>
+          <div class="value">{{getDate()}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">审批说明</div>
-          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
+          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入审批说明"></el-input></div>
         </el-col>
       </el-row>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
-        <el-popconfirm
-          title="确定关闭吗?"
-          @onConfirm="goBack"
-          style="margin-left: 10px;"
-        >
+        <el-button type="primary" @click="clickSubmitForm(1)">审批通过</el-button>
+        <el-button type="warning" @click="clickSubmitForm(0)">审批驳回</el-button>
+        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
           <el-button slot="reference">关 闭</el-button>
         </el-popconfirm>
       </div>
@@ -123,22 +182,32 @@
 </template>
 
 <script>
-import { getDetail } from "@/api/supply/reserve";
+import { getOrderDetail, examineCom } from "@/api/supply/engin";
 
 export default {
   name: 'CommerceExamine',
   componentName: 'CommerceExamine',
   props: ['listItem'],
+  filters: {
+    statusFilter(val) {
+      const statusList = [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ];
+      let obj = statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    }
+  },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
+      userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
       detailData: {},
 
       formLoading: false,
       examineForm: {
-        status: true,
         remark: '',
       }
     }
@@ -161,6 +230,22 @@ export default {
   },
 
   methods: {
+    getDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+          month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+          strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
+
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -168,13 +253,27 @@ export default {
 
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
+      getOrderDetail({id: this.listItem.parentId}).then(res => {
         this.detailData = res.data;
       })
     },
 
-    clickSubmitForm() {
-
+    // 审批
+    clickSubmitForm(val) {
+      this.$confirm('此操作将审批订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let params = this.detailData;
+        params.examineNote = this.examineForm.remark;
+        params.examineResult = val;
+        examineCom(params).then(res => {
+          this.$successMsg();
+          this.goBack();
+          this.$parent.getList();
+        })
+      }).catch(() => {});
     },
 
   }

+ 596 - 32
src/views/supply/engin/components/commerce_form.vue

@@ -6,17 +6,17 @@
       <div class="title">工程订单</div>
     </div>
 
-    <el-form ref="mainForm" :model="mainForm" label-width="100px" size="small" label-position="left">
+    <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="110px" size="small" label-position="right">
       <el-row :gutter="20">
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="订单号" prop="warehouse">
-            <el-input v-model="mainForm.remark" placeholder="请输入订单号"></el-input>
+          <el-form-item label="工程订单" prop="orderNum">
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
-          <el-form-item label="单据日期" prop="date">
+          <el-form-item label="单据日期" prop="orderDate">
             <el-date-picker
-              v-model="mainForm.date"
+              v-model="mainForm.orderDate"
               type="date"
               value-format="yyyy-MM-dd"
               style="width: 100%;"
@@ -25,78 +25,375 @@
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="制单人" prop="warehouse">
-            <el-input v-model="mainForm.remark" placeholder="请输入制单人"></el-input>
+          <el-form-item label="产品大类" prop="type">
+            <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" clearable>
+              <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
+            </el-select>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="工程登录单号" prop="warehouse">
-            <el-input v-model="mainForm.remark" placeholder="请输入工程登录单号"></el-input>
+          <el-form-item label="经销商编码" prop="jxsNum">
+            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" readonly></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="16">
+          <el-form-item label="经销商名称" prop="jxsName">
+            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" readonly></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="工程登录编号" prop="loginNum">
+            <div style="display: flex;">
+              <el-input v-model="mainForm.loginNum" placeholder="请选择工程登录" readonly></el-input>
+              <el-button style="margin-left: 10px;" @click="openShareDetail" :disabled="mainForm.loginNum !== ''">选择</el-button>
+            </div>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="工程项目名称" prop="enginName">
+            <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称"></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="经销商编码" prop="warehouse">
-            <el-input v-model="mainForm.remark" placeholder="请输入经销商编码"></el-input>
+          <el-form-item label="工程登录类型" prop="loginType">
+            <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型"></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="12" :lg="8">
-          <el-form-item label="经销商名称" prop="warehouse">
-            <el-input v-model="mainForm.remark" placeholder="请输入经销商名称"></el-input>
+          <el-form-item label="厂工程编码" prop="factoryNum">
+            <el-input v-model="mainForm.factoryNum" placeholder="请输入厂工程编码"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="使用单位" prop="company">
+            <el-input v-model="mainForm.company" placeholder="请输入使用单位"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="销售类型" prop="saleType">
+            <el-select v-model="mainForm.saleType" placeholder="选择销售类型" style="width: 100%" clearable @change="changeSaleType">
+              <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="联系人" prop="contactMan">
+            <el-input v-model="mainForm.contactMan" placeholder="请输入联系人"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="固定电话" prop="tel">
+            <el-input v-model="mainForm.tel" placeholder="请输入固定电话"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="移动电话" prop="phone">
+            <el-input v-model="mainForm.phone" placeholder="请输入移动电话"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="24" :lg="24">
+          <el-form-item label="安装地址" prop="address">
+            <el-input v-model="mainForm.address" placeholder="请输入安装地址"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="24" :lg="24">
+          <el-form-item label="格力内部备注" prop="greeRemark">
+            <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注"></el-input>
           </el-form-item>
         </el-col>
         <el-col :xs="24" :sm="24" :lg="24">
-          <el-form-item label="备注" prop="warehouse">
+          <el-form-item label="格力回复" prop="greeReply">
+            <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="24" :lg="24">
+          <el-form-item label="备注" prop="remark">
             <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
           </el-form-item>
         </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="制单人" prop="createMan">
+            <el-input v-model="mainForm.createMan" placeholder="请输入制单人" readonly></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
+          <el-form-item label="制单日期" prop="createDate">
+            <el-date-picker
+              v-model="mainForm.createDate"
+              readonly
+              type="date"
+              value-format="yyyy-MM-dd"
+              style="width: 100%;"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="文件编号" prop="fileNum">
+            <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
+          </el-form-item>
+        </el-col>
       </el-row>
     </el-form>
 
     <div class="main-title">
       <div class="title">货品信息</div>
-      <el-button type="primary" size="small" icon="el-icon-plus">添加货品</el-button>
+      <div>
+        <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
+          <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
+        </el-select>
+        <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
+      </div>
     </div>
 
     <div class="table" style="margin-top: 20px">
-      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+      <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="引用单号" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单号类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="货品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="计量单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.qty" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{scope.row.price * scope.row.qty}}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="返利钱包" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利钱包" size="small" clearable @change="changeFlWallet(scope.$index)">
+              <el-option
+                v-for="item in flWalletList"
+                :key="item.customerWalletId"
+                :label="item.name"
+                :value="item.customerWalletId">
+              </el-option>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{scope.row.qty * scope.row.discAmount}}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-select v-model="scope.row.customerWalletId" placeholder="选择现金钱包" size="small" clearable @change="changeXjWallet(scope.$index)">
+              <el-option
+                v-for="item in xjWalletList"
+                :key="item.customerWalletId"
+                :label="item.name"
+                :value="item.customerWalletId">
+              </el-option>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100}}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
+          <template slot-scope="scope">
+            <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100">
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.directTransferQty" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div>{{ scope.row.status1 | status1Filter }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <div>{{ status2Filter(scope.row) }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="操作" width="100" fixed="right">
+          <template slot-scope="scope">
+            <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
+          </template>
+        </el-table-column>
       </el-table>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
-        <el-button type="primary" @click="clickSubmitForm">提交审核</el-button>
+        <el-button type="primary" @click="clickSubmitForm(1)">保 存</el-button>
+        <el-button type="primary" @click="clickSubmitForm(2)">提交审核</el-button>
         <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
           <el-button slot="reference">关 闭</el-button>
         </el-popconfirm>
       </div>
     </div>
 
+    <!-- 工程登录列表 -->
+    <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
+      <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
+        <el-row :gutter="20">
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item prop="loginNum">
+              <el-input v-model="screenForm.loginNum" placeholder="工程登录编号"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item prop="enginName">
+              <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item prop="company">
+              <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
+            </el-form-item>
+          </el-col>
+          
+          <el-col :xs="24" :sm="12" :lg="6" class="tr">
+            <el-form-item label="">
+              <el-button size="small" @click="resetScreenForm">清空</el-button>
+              <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div class="table" style="margin: 10px 0 20px;">
+        <el-table 
+          v-loading="dialogTable_listLoading" 
+          :data="dialogTable_dataList" 
+          element-loading-text="Loading" 
+          tooltip-effect="dark" 
+          style="width: 100%" 
+          max-height="270">
+          <el-table-column align="center" label="" width="100">
+            <template slot-scope="scope">
+              <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo)">选择</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
+        </el-table>
+      </div>
+      <div class="pagination clearfix">
+        <div class="fr">
+          <el-pagination
+            @current-change="dialogTableCurrentChange"
+            :current-page="dialogTable_currentPage"
+            :page-size="dialogTable_pageSize"
+            background
+            layout="prev, pager, next"
+            :total="dialogTable_listTotal">
+          </el-pagination>
+        </div>
+      </div>
+      
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="isShowDialog = false">关 闭</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { getDetail } from "@/api/supply/reserve";
+import { getOrderDetail, getComLoginList, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
+import { getDictList, getTypeList } from '@/api/common'
 
 export default {
   name: 'CommerceForm',
   componentName: 'CommerceForm',
   props: ['listItem'],
+  filters: {
+    status1Filter(val) {
+      if (val === '' || val === null || val === undefined) return '未检查';
+      else if (val === 0) return '无货';
+      else if (val > 0 && val <= 30) return val;
+      else if (val > 30 && val <= 1000) return '有货';
+      else if (val > 1000) return '充足';
+    },
+  },
   data() {
     return {
-      detailData: {},
+      editId: '',
       mainForm: {
+        orderNum: '',
+        orderDate: '',
+        type: '',
+        jxsNum: '',
+        jxsName: '',
+        loginNum: '',
+        enginName: '',
+        loginType: '',
+        factoryNum: '',
+        company: '',
+        saleType: '',
+        contactMan: '',
+        tel: '',
+        phone: '',
+        address: '',
+        greeRemark: '',
+        greeReply: '',
+        remark: '',
+        createMan: '',
+        createDate: '',
+        fileNum: '',
+      },
+      mainFormRules: {
+        orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
+        jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
+        jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
+        loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
+        enginName: [{ required: true, message: '请输入工程项目名称', trigger: 'blur' }],
+        loginType: [{ required: true, message: '请输入工程登录类型', trigger: 'blur' }],
+        company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
+        saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
+        // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
+        // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
+        // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
+        address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
+      },
+      salesTypeList: [],
+      typeList: [],
+      goodsList: [],
 
+      isShowDialog: false, // 工程登录列表 - 弹窗
+      screenForm: {
+        loginNum: '',
+        enginName: '',
+        company: '',
       },
+      dialogTable_dataList: null, // 工程登录列表 - 列表数据
+      dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
+      dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
+      dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
+      dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
+
+      warehouseList: [],
+      warehouseValue: '',
+
+      xjWalletList: [],
+      flWalletList: [],
     }
   },
 
@@ -113,7 +410,20 @@ export default {
   },
 
   created() {
-    this.getDetail();
+    this.getDictList();
+    this.getWalletList();
+    this.getSalesTypeList();
+    this.getWarehouseList();
+
+    if(this.listItem) {
+      this.editId = this.listItem.parentId;
+      this.getDetail();
+    }else {
+      this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
+      this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
+      this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
+      this.mainForm.createDate = this.getDate();
+    }
   },
 
   methods: {
@@ -122,15 +432,261 @@ export default {
       this.$emit('backListFormDetail');
     },
 
+    getDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+          month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+          strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
+
+    // 获取钱包列表
+    getWalletList() {
+      getWalletList({
+        customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
+        type: 'COMMONLY'
+      }).then(res => {
+        this.xjWalletList = res.data;
+      })
+      getWalletList({
+        customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
+        type: 'REBATE'
+      }).then(res => {
+        this.flWalletList = res.data;
+      })
+    },
+
+    // 获取产品大类列表
+    getDictList() {
+      getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
+        this.typeList = res.data;
+      })
+    },
+
+    // 获取销售类型列表
+    getSalesTypeList() {
+      getTypeList({
+        pageNum: 1,
+        pageSize: -1
+      }).then((res) => {
+        this.salesTypeList = res.data.records;
+      })
+    },
+
+    // 获取仓库列表
+    getWarehouseList() {
+      getWarehouseList({
+        pageNum: 1,
+        pageSize: -1
+      }).then((res) => {
+        this.warehouseList = res.data.records;
+      })
+    },
+
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
-        this.detailData = res.data;
+      getOrderDetail({id: this.editId}).then(res => {
+        let data = res.data;
+        this.mainForm.orderNum = data.enginOrderId;
+        this.mainForm.orderDate = data.orderDate;
+        this.mainForm.type = data.refProductCategory;
+        this.mainForm.jxsNum = data.customerId;
+        this.mainForm.jxsName = data.customerName;
+        this.mainForm.loginNum = data.refEnginRecordNo;
+        this.mainForm.enginName = data.refProjectName;
+        this.mainForm.loginType = data.refPromiseStatus;
+        this.mainForm.factoryNum = data.refFactoryNo;
+        this.mainForm.company = data.refUseUnit;
+        this.mainForm.saleType = data.saleTypeId;
+        this.mainForm.contactMan = data.aaa;
+        this.mainForm.tel = data.aaa;
+        this.mainForm.phone = data.aaa;
+        this.mainForm.address = data.refInstallAddress;
+        this.mainForm.greeRemark = data.note2;
+        this.mainForm.greeReply = data.note1;
+        this.mainForm.remark = data.remark;
+        this.mainForm.createMan = data.createName;
+        this.mainForm.createDate = data.createTime;
+        this.mainForm.fileNum = data.fileNo;
+
+        data.items.forEach(item => {
+          item.status1 = '';
+          item.status2 = '';
+        })
+        this.goodsList = data.items;
+      })
+    },
+
+    // 工程登录列表 - 获取列表
+    getComLoginList() {
+      getComLoginList({
+        pageNum: this.dialogTable_currentPage,
+        pageSize: this.dialogTable_pageSize,
+        recordNo: this.screenForm.loginNum,
+        projectName: this.screenForm.enginName,
+        useUnit: this.screenForm.company,
+      }).then(res => {
+        this.dialogTable_dataList = res.data.records;
+        this.dialogTable_listTotal = res.data.total;
+        this.dialogTable_listLoading = false;
       })
     },
 
-    clickSubmitForm() {
+    // 工程登录列表 - 打开弹窗
+    openShareDetail() {
+      this.isShowDialog = true;
+      this.dialogTable_currentPage = 1;
+      this.getComLoginList();
+    },
+
+    // 工程登录列表 - 更改列表当前页
+    dialogTableCurrentChange(val) {
+      this.dialogTable_currentPage = val;
+      this.getComLoginList();
+    },
+
+    // 提交筛选表单
+    submitScreenForm() {
+      this.dialogTable_currentPage = 1;
+      this.getComLoginList();
+    },
 
+    // 重置筛选表单
+    resetScreenForm() {
+      this.$refs.screenForm.resetFields();
+      this.dialogTable_currentPage = 1;
+      this.getComLoginList();
+    },
+
+    // 选择工程登录
+    chooseItem(id) {
+      addCom({refEnginRecordNo: id}).then(res => {
+        this.isShowDialog = false;
+        this.editId = res.data;
+        this.getDetail();
+      })
+    },
+
+    // 选择销售类型
+    changeSaleType() {
+      let obj = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
+      this.goodsList.forEach(item => {
+        item.saleTypeId = obj.id;
+        item.saleTypeCode= obj.saleCode;
+        item.saleTypeName = obj.saleName;
+      })
+    },
+
+    // 删除产品
+    deleteItem(index) {
+      this.goodsList.splice(index, 1);
+    },
+
+    // 修改返利钱包
+    changeFlWallet(index) {
+      if(this.goodsList[index].customerWalletId2) {
+        let obj = this.flWalletList.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
+        this.goodsList[index].rebateRate = obj.rebateRate;
+        this.goodsList[index].customerWalletName2 = obj.name;
+      }else {
+        this.goodsList[index].rebateRate = '';
+        this.goodsList[index].customerWalletName2 = '';
+      }
+    },
+
+    // 修改现金钱包
+    changeXjWallet(index) {
+      if(this.goodsList[index].customerWalletId) {
+        let obj = this.xjWalletList.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
+        this.goodsList[index].customerWalletName = obj.name;
+      }else {
+        this.goodsList[index].customerWalletName = '';
+      }
+    },
+
+    // 检查库存
+    checkStock() {
+      if(!this.warehouseValue) {
+        return this.$errorMsg('请选择仓库');
+      }
+      if(!this.goodsList) {
+        return this.$errorMsg('请添加货品');
+      }
+      let ids = [];
+      this.goodsList.forEach(item => {
+        ids.push(item.materialId);
+      })
+      checkStock({
+        correspondId: this.warehouseValue,
+        materialId: ids.join(',')
+      }).then(res => {
+        if(res.data) {
+          this.goodsList.forEach((item, index) => {
+            item.status1 = res.data[index].allStockNum;
+            item.status2 = res.data[index].stockNum;
+          })
+        }
+      })
+    },
+
+    status2Filter(item) {
+      if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
+      else if (item.status2 >= item.qty) return '可用';
+      else return '短缺';
+    },
+
+    // 保存 / 提交审核
+    clickSubmitForm(type) {
+      this.$refs.mainForm.validate((valid) => {
+        if (valid) {
+          let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
+          let params = {
+            enginOrderId: this.mainForm.orderNum,
+            orderDate: this.mainForm.orderDate,
+            refProductCategory: this.mainForm.type || '',
+            // customerId: this.mainForm.jxsNum,
+            // customerName: this.mainForm.jxsName,
+            refEnginRecordNo: this.mainForm.loginNum || '',
+            refProjectName: this.mainForm.enginName || '',
+            refPromiseStatus: this.mainForm.loginType || '',
+            refFactoryNo: this.mainForm.factoryNum || '',
+            refUseUnit: this.mainForm.company || '',
+            saleTypeId: this.mainForm.saleType,
+            saleTypeCode: saleTypeItem.saleCode,
+            saleTypeName: saleTypeItem.saleName,
+            // aaa: this.mainForm.contactMan,
+            // aaa: this.mainForm.tel,
+            // aaa: this.mainForm.phone,
+            refInstallAddress: this.mainForm.address || '',
+            note2: this.mainForm.greeRemark || '',
+            note1: this.mainForm.greeReply || '',
+            remark: this.mainForm.remark || '',
+            fileNo: this.mainForm.fileNum || '',
+            items: this.goodsList,
+          }
+          if(type === 1) {
+            editCom(params).then(res => {
+              this.$successMsg('编辑成功');
+              this.goBack();
+              this.$parent.getList();
+            })
+          }else if(type === 2) {
+            submitCom(params).then(res => {
+              this.$successMsg('提交审核成功');
+              this.goBack();
+              this.$parent.getList();
+            })
+          }
+        }
+      })
     },
   }
 }
@@ -155,4 +711,12 @@ export default {
       padding-left: 10px;
     }
   }
+
+  ::v-deep input::-webkit-outer-spin-button,
+  ::v-deep input::-webkit-inner-spin-button {
+    -webkit-appearance: none;
+  }
+  ::v-deep input[type='number'] {
+    -moz-appearance: textfield;
+  }
 </style>

+ 159 - 55
src/views/supply/engin/components/commerce_return.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="detail-container">
-    <el-page-header @back="goBack" content="审批"></el-page-header>
+    <el-page-header @back="goBack" content="退订"></el-page-header>
 
     <div class="main-title">
       <div class="title">工程订单</div>
@@ -9,56 +9,100 @@
     <div class="diy-table-1">
       <el-row>
         <el-col :span="8" class="item">
-          <div class="label">发货申请单号</div>
-          <div class="value">{{detailData.billNo}}</div>
+          <div class="label">工程订单号</div>
+          <div class="value">{{detailData.enginOrderId}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">申请日期</div>
-          <div class="value">{{detailData.fdate}}</div>
+          <div class="label">订单日期</div>
+          <div class="value">{{detailData.orderDate}}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">单据状态</div>
-          <div class="value">{{detailData.srcStockId}}</div>
+          <div class="value">{{detailData.examineStatus | statusFilter}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">经销商编</div>
-          <div class="value">{{detailData.destStockId}}</div>
+          <div class="label">经销商编</div>
+          <div class="value">{{detailData.customerId}}</div>
         </el-col>
-        <el-col :span="8" class="item">
+        <el-col :span="16" class="item">
           <div class="label">经销商名称</div>
-          <div class="value">{{detailData.approveDate}}</div>
+          <div class="value">{{detailData.customerName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">仓库</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程信息编号</div>
+          <div class="value">{{detailData.refEnginRecordNo}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">工程登录编码</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程项目名称</div>
+          <div class="value">{{detailData.refProjectName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单人</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程登录类型</div>
+          <div class="value">{{detailData.refPromiseStatus}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">厂工程编码</div>
+          <div class="value">{{detailData.refFactoryNo}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">使用单位</div>
+          <div class="value">{{detailData.refUseUnit}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">销售类型</div>
+          <div class="value">{{detailData.saleTypeName}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">联系人</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">固定电话</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">移动电话</div>
+          <div class="value">{{detailData.aaa}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">不扣押金</div>
+          <div class="value">{{detailData.takeDeposit ? '是':'否'}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">文件编码</div>
+          <div class="value">{{detailData.fileNo}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">业务员</div>
+          <div class="value">{{detailData.serviceName}}</div>
+        </el-col>
+        <el-col :span="24" class="item">
+          <div class="label">格力回复</div>
+          <div class="value">{{detailData.note1}}</div>
+        </el-col>
+        <el-col :span="24" class="item">
+          <div class="label">格力内部备注</div>
+          <div class="value">{{detailData.note2}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">备注</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.remark}}</div>
         </el-col>
-        <el-col :span="12" class="item">
-          <div class="label">审核人</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">制单人</div>
+          <div class="value">{{detailData.createName}}</div>
         </el-col>
-        <el-col :span="12" class="item">
-          <div class="label">审核日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">制单日期</div>
+          <div class="value">{{detailData.createTime}}</div>
         </el-col>
-        <el-col :span="24" class="item">
-          <div class="label">审批说明</div>
-          <div class="value">{{detailData.approverId}}</div>
+        <el-col :span="6" class="item">
+          <div class="label">关闭人</div>
+          <div class="value">{{detailData.closeName}}</div>
+        </el-col>
+        <el-col :span="6" class="item">
+          <div class="label">关闭日期</div>
+          <div class="value">{{detailData.closeTime}}</div>
         </el-col>
       </el-row>
     </div>
@@ -68,16 +112,38 @@
     </div>
 
     <div class="table" style="margin-top: 20px">
-      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+      <el-table :data="detailData.items" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="引用单号" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单号类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="货品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="计量单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利类型" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.isDirectTransfer ? '是' : '否' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="可退数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="退订数量" prop="tdQty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.tdQty" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
       </el-table>
     </div>
 
@@ -87,28 +153,24 @@
     <div class="diy-table-1">
       <el-row :gutter="0">
         <el-col :span="12" class="item">
-          <div class="label">操作人</div>
-          <div class="value">2022123233435342</div>
+          <div class="label">退订人</div>
+          <div class="value">{{userName}}</div>
         </el-col>
         <el-col :span="12" class="item">
           <div class="label">退订日期</div>
-          <div class="value">123</div>
+          <div class="value">{{getDate()}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">退订说明</div>
-          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
+          <div class="value"><el-input v-model="returnForm.remark" placeholder="请输入退订说明"></el-input></div>
         </el-col>
       </el-row>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
-        <el-popconfirm
-          title="确定关闭吗?"
-          @onConfirm="goBack"
-          style="margin-left: 10px;"
-        >
+        <el-button type="primary" @click="clickSubmitForm()">确定退订</el-button>
+        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
           <el-button slot="reference">关 闭</el-button>
         </el-popconfirm>
       </div>
@@ -118,22 +180,32 @@
 </template>
 
 <script>
-import { getDetail } from "@/api/supply/reserve";
+import { getOrderDetail, returnCom } from "@/api/supply/engin";
 
 export default {
   name: 'CommerceReturn',
   componentName: 'CommerceReturn',
   props: ['listItem'],
+  filters: {
+    statusFilter(val) {
+      const statusList = [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ];
+      let obj = statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    }
+  },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
+      userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
       detailData: {},
 
       formLoading: false,
-      examineForm: {
-        status: true,
+      returnForm: {
         remark: '',
       }
     }
@@ -156,6 +228,22 @@ export default {
   },
 
   methods: {
+    getDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+          month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+          strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
+
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -163,13 +251,29 @@ export default {
 
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
+      getOrderDetail({id: this.listItem.parentId}).then(res => {
         this.detailData = res.data;
       })
     },
 
-    clickSubmitForm() {
-
+    // 退订
+    clickSubmitForm(val) {
+      this.$confirm('此操作将退订订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let params = {
+          enginOrderId: this.detailData.enginOrderId,
+          items: this.detailData.items,
+          refundNote: this.returnForm.remark
+        };
+        returnCom(params).then(res => {
+          this.$successMsg();
+          this.goBack();
+          this.$parent.getList();
+        })
+      }).catch(() => {});
     },
 
   }

+ 270 - 46
src/views/supply/engin/components/home_detail.vue

@@ -167,25 +167,17 @@
     <div class="page-footer">
       <div class="footer" :class="classObj">
         <el-button type="danger" @click="closeData">关闭订单</el-button>
-        <el-button type="primary" @click="openDeliverDialog">提前开票</el-button>
+        <el-button type="primary" @click="openDirectDialog">提前开票</el-button>
         <el-button type="primary" @click="overData">直调完结</el-button>
         <el-button type="primary" @click="openDeliverDialog">直调发货</el-button>
         <el-button @click="goBack">返回</el-button>
       </div>
     </div>
 
-    <el-dialog
-      title="直调发货"
-      :visible.sync="isShowDeliverDialog"
-      width="80%">
-      <el-form ref="deliverForm" :model="deliverForm" label-width="70px" size="small" label-position="left">
+    <el-dialog title="直调发货" :visible.sync="isShowDeliverDialog" width="80%">
+      <el-form ref="deliverForm" :model="deliverForm" :rules="deliverFormRules" label-width="80px" size="small" label-position="left">
         <el-row :gutter="20">
-          <el-col :xs="24" :sm="8" :lg="8">
-            <el-form-item label="工程订单" prop="orderNum">
-              <el-input v-model="deliverForm.orderNum" placeholder="请输入工程订单"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :xs="24" :sm="8" :lg="8" style="height: 51px;">
+          <el-col :xs="8" :sm="8" :lg="8" style="height: 51px;">
             <el-form-item label="发货日期" prop="date">
               <el-date-picker
                 v-model="deliverForm.date"
@@ -196,15 +188,17 @@
               </el-date-picker>
             </el-form-item>
           </el-col>
-          <el-col :xs="24" :sm="8" :lg="8">
+          <el-col :xs="8" :sm="8" :lg="8">
             <el-form-item label="发货仓库" prop="warehouse">
-              <el-select v-model="deliverForm.warehouse" placeholder="请选择发货仓库">
-                <el-option
-                  v-for="item in warehouseList"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
+              <el-select v-model="deliverForm.warehouse" placeholder="请选择发货仓库" style="width: 100%" filterable @change="changeWarehouse">
+                <el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="8" :sm="8" :lg="8">
+            <el-form-item label="选择仓位" prop="position">
+              <el-select v-model="deliverForm.position" placeholder="请选择仓位" style="width: 100%" filterable>
+                <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -212,24 +206,24 @@
       </el-form>
 
       <div class="table" style="margin-top: 20px">
-        <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+        <el-table :data="deliverGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
           <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-          <el-table-column align="center" label="引用记录" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="销售类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品编码" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="产品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="是否使用返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="返利使用比例" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="是否直调" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="直调数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="已发货数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-          <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.directTransferQty" size="small" type="number"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利" prop="rebateAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
         </el-table>
       </div>
       <span slot="footer" class="dialog-footer">
@@ -238,20 +232,82 @@
       </span>
     </el-dialog>
 
+
+    <el-dialog title="直接调拨单(提前开票)" :visible.sync="isShowDirectDialog" width="80%">
+      <el-form ref="directForm" :model="directForm" :rules="directFormRules" label-width="80px" size="small" label-position="left">
+        <el-row :gutter="20">
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调出仓库" prop="warehouse1">
+              <el-select v-model="directForm.warehouse1" placeholder="请选择调出仓库" style="width: 100%" filterable @change="changeWarehouse1">
+                <el-option v-for="item in warehouseList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调出仓位" prop="position1">
+              <el-select v-model="directForm.position1" placeholder="请调出仓位" style="width: 100%" filterable @change="changePosition1">
+                <el-option v-for="item in positionList1" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调入仓库" prop="warehouse2">
+              <el-select v-model="directForm.warehouse2" placeholder="请选择调入仓库" style="width: 100%" filterable @change="changeWarehouse2">
+                <el-option v-for="item in warehouseList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="12" :sm="6" :lg="6">
+            <el-form-item label="调入仓位" prop="position2">
+              <el-select v-model="directForm.position2" placeholder="请调入仓位" style="width: 100%" filterable @change="changePosition2">
+                <el-option v-for="item in positionList2" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+
+      <div class="table" style="margin-top: 20px">
+        <el-table :data="directGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+          <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
+          <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品编码" prop="materialCode" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出仓库" prop="warehouse1" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出仓位" prop="position1" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入仓库" prop="warehouse2" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入仓位" prop="position2" min-width="100" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出库存状态" prop="status1" min-width="110" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调入库存状态" prop="status2" min-width="110" show-overflow-tooltip></el-table-column>
+          <el-table-column align="center" label="调出货主" min-width="100" show-overflow-tooltip>
+            <template slot-scope="">弘格</template>
+          </el-table-column>
+          <el-table-column align="center" label="调入货主" min-width="100" show-overflow-tooltip>
+            <template slot-="scope">弘格</template>
+          </el-table-column>
+          <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        </el-table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="closeDirectDialog">取 消</el-button>
+        <el-button type="primary" @click="submitDirectForm">确 定</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import print from 'vue-print-nb'
-import { getOrderDetail, closeHome, overOrder } from "@/api/supply/engin";
+import { getOrderDetail, closeHome, overOrder, getWarehouseList, deliverOrder, directOrder } from "@/api/supply/engin";
 
 export default {
   name: 'HomeDetail',
   componentName: 'HomeDetail',
   props: ['listItem'],
-  directives: {
-    print
-  },
   filters: {
     statusFilter(val) {
       const statusList = [
@@ -267,17 +323,55 @@ export default {
   },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
       detailData: {},
 
       isShowDeliverDialog: false,
       deliverForm: {
-        orderNum: '',
         date: '',
+        warehouse: '',
+        position: '',
+      },
+      deliverFormRules: {
+        date: [
+          { required: true, message: '请选择发货日期', trigger: 'change' }
+        ],
+        warehouse: [
+          { required: true, message: '请选择发货仓库', trigger: 'change' }
+        ],
+        position: [
+          { required: true, message: '请选择仓位', trigger: 'change' }
+        ],
       },
       warehouseList: [],
+      positionList: [],
+      deliverGoodsList: [],
+
+      isShowDirectDialog: false,
+      directForm: {
+        warehouse1: '',
+        position1: '',
+        warehouse2: '',
+        position2: '',
+      },
+      directFormRules: {
+        warehouse1: [
+          { required: true, message: '请选择调出仓库', trigger: 'change' }
+        ],
+        position1: [
+          { required: true, message: '请选择调出仓位', trigger: 'change' }
+        ],
+        warehouse2: [
+          { required: true, message: '请选择调入仓库', trigger: 'change' }
+        ],
+        position2: [
+          { required: true, message: '请选择调入仓位', trigger: 'change' }
+        ],
+      },
+      warehouseList1: [],
+      warehouseList2: [],
+      positionList1: [],
+      positionList2: [],
+      directGoodsList: [],
     }
   },
 
@@ -306,6 +400,18 @@ export default {
       this.$emit('backListFormDetail');
     },
 
+    // 获取仓库列表
+    getWarehouseList() {
+      getWarehouseList({
+        pageNum: 1,
+        pageSize: -1,
+      }).then(res => {
+        this.warehouseList = res.data.records;
+        this.warehouseList1 = res.data.records;
+        this.warehouseList2 = res.data.records;
+      })
+    },
+
     // 获取详情
     getDetail() {
       getOrderDetail({id: this.listItem.parentId}).then(res => {
@@ -341,9 +447,26 @@ export default {
       }).catch(() => {});
     },
 
+    // 更改仓库
+    changeWarehouse() {
+      this.deliverForm.position = '';
+      let obj = this.warehouseList.find(o => o.id == this.deliverForm.warehouse);
+      this.positionList = obj.kingDeeStocks;
+    },
+
     // 打开 直调发货
     openDeliverDialog() {
       this.isShowDeliverDialog = true;
+      this.deliverGoodsList = this.detailData.items;
+      this.deliverGoodsList.forEach(item => {
+        item.warehouse1 = '';
+        item.warehouse2 = '';
+        item.position1 = '';
+        item.position2 = '';
+        item.status1 = '';
+        item.status2 = '';
+      })
+      this.getWarehouseList();
     },
 
     // 关闭 直调发货
@@ -353,7 +476,108 @@ export default {
 
     // 提交 直调发货
     submitDeliverForm() {
+      this.$refs.deliverForm.validate((valid) => {
+        if (valid) {
+          for(let i=0; i<this.deliverGoodsList.length; i++) {
+            if(!this.deliverGoodsList[i].directTransferQty) {
+              this.$errorMsg('请输入直调数量');
+              return;
+            }
+          }
+          let params = {
+            enginOrderId: this.detailData.enginOrderId,
+            enginOrderType: 'HOME', // TRADE=商用 HOME=家用
+            deliverDate: this.deliverForm.date + ' 00:00:00',
+            correspondId: this.deliverForm.warehouse,
+            stockId: this.deliverForm.position,
+            items: this.deliverGoodsList
+          }
+          deliverOrder(params).then(res => {
+            this.$successMsg();
+            this.isShowDeliverDialog = false;
+            this.getDetail();
+          })
+        }
+      })
+    },
+
+    // 更改调出仓库
+    changeWarehouse1() {
+      this.directForm.position1 = '';
+      let obj = this.warehouseList1.find(o => o.id == this.directForm.warehouse1);
+      this.positionList1 = obj.kingDeeStocks;
+      this.directGoodsList.forEach(item => {
+        item.warehouse1 = obj.name;
+      });
+    },
+
+    // 更改调入仓库
+    changeWarehouse2() {
+      this.directForm.position2 = '';
+      let obj = this.warehouseList2.find(o => o.id == this.directForm.warehouse2);
+      this.positionList2 = obj.kingDeeStocks;
+      this.directGoodsList.forEach(item => {
+        item.warehouse2 = obj.name;
+      });
+    },
+
+    // 更改调出仓位
+    changePosition1() {
+      let obj = this.positionList1.find(o => o.id == this.directForm.position1);
+      this.directGoodsList.forEach(item => {
+        item.position1 = obj.name;
+        item.status1 = obj.defStockStatusName;
+      });
+    },
+
+    // 更改调入仓位
+    changePosition2() {
+      let obj = this.positionList2.find(o => o.id == this.directForm.position2);
+      this.directGoodsList.forEach(item => {
+        item.position2 = obj.name;
+        item.status2 = obj.defStockStatusName;
+      });
+    },
+
+    // 打开 提前开票
+    openDirectDialog() {
+      this.isShowDirectDialog = true;
+      this.directGoodsList = this.detailData.items;
+      this.getWarehouseList();
+    },
+
+    // 关闭 提前开票
+    closeDirectDialog() {
+      this.isShowDirectDialog = false;
+    },
 
+    // 提交 提前开票
+    submitDirectForm() {
+      this.$refs.directForm.validate((valid) => {
+        if (valid) {
+          let warehouseItem1 = this.warehouseList1.find(o => o.id == this.directForm.warehouse1);
+          let positionItem1 = this.positionList1.find(o => o.id == this.directForm.position1);
+          let warehouseItem2 = this.warehouseList2.find(o => o.id == this.directForm.warehouse2);
+          let positionItem2 = this.positionList2.find(o => o.id == this.directForm.position2);
+          let params = {
+            orderNo: this.detailData.enginOrderId,
+            orderType: 'HOME', // TRADE=商用 HOME=家用 RETAIL=零售单 RETAIL_POLICY 销售政策单
+            correspondId: this.directForm.warehouse1,
+            correspondName: warehouseItem1.name,
+            stockId: this.directForm.position1,
+            stockName: positionItem1.name,
+            inCorrespondId: this.directForm.warehouse2,
+            inCorrespondName: warehouseItem2.name,
+            inStockId: this.directForm.position2,
+            inStockName: positionItem2.name,
+          }
+          directOrder(params).then(res => {
+            this.$successMsg();
+            this.isShowDirectDialog = false;
+            this.getDetail();
+          })
+        }
+      })
     },
 
   }

+ 88 - 61
src/views/supply/engin/components/home_examine.vue

@@ -66,7 +66,9 @@
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">不扣押金</div>
-          <div class="value">{{detailData.takeDeposit ? '是':'否'}}</div>
+          <div class="value">
+            <el-checkbox v-model="detailData.takeDeposit">{{detailData.takeDeposit ? '是':'否'}}</el-checkbox>
+          </div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">文件编码</div>
@@ -78,11 +80,15 @@
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">格力回复</div>
-          <div class="value">{{detailData.note1}}</div>
+          <div class="value">
+            <el-input v-model="detailData.note1" placeholder="请输入格力回复"></el-input>
+          </div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">格力内部备注</div>
-          <div class="value">{{detailData.note2}}</div>
+          <div class="value">
+            <el-input v-model="detailData.note2" placeholder="请输入格力内部备注"></el-input>
+          </div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">备注</div>
@@ -97,22 +103,6 @@
           <div class="value">{{detailData.createTime}}</div>
         </el-col>
         <el-col :span="6" class="item">
-          <div class="label">审核人</div>
-          <div class="value">{{detailData.confirmName}}</div>
-        </el-col>
-        <el-col :span="6" class="item">
-          <div class="label">审核日期</div>
-          <div class="value">{{detailData.confirmTime}}</div>
-        </el-col>
-        <el-col :span="6" class="item">
-          <div class="label">最后更新人</div>
-          <div class="value">{{detailData.updateName}}</div>
-        </el-col>
-        <el-col :span="6" class="item">
-          <div class="label">最后更新日期</div>
-          <div class="value">{{detailData.updateTime}}</div>
-        </el-col>
-        <el-col :span="6" class="item">
           <div class="label">关闭人</div>
           <div class="value">{{detailData.closeName}}</div>
         </el-col>
@@ -120,10 +110,6 @@
           <div class="label">关闭日期</div>
           <div class="value">{{detailData.closeTime}}</div>
         </el-col>
-        <el-col :span="24" class="item" v-if="isExamine">
-          <div class="label">审批说明</div>
-          <div class="value">{{detailData.examineNote}}</div>
-        </el-col>
       </el-row>
     </div>
 
@@ -134,22 +120,31 @@
     <div class="table" style="margin-top: 20px">
       <el-table :data="detailData.items" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="引用记录" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品编码" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="是否使用返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="返利使用比例" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="是否直调" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="直调数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="已发货数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利类型" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.isDirectTransfer ? '是' : '否' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
       </el-table>
     </div>
 
@@ -160,32 +155,24 @@
       <el-row :gutter="0">
         <el-col :span="12" class="item">
           <div class="label">审批人</div>
-          <div class="value">2022123233435342</div>
+          <div class="value">{{userName}}</div>
         </el-col>
         <el-col :span="12" class="item">
-          <div class="label">审批结果</div>
-          <div class="value">
-            <el-radio-group v-model="examineForm.status">
-              <el-radio :label="true">通过</el-radio>
-              <el-radio :label="false">驳回</el-radio>
-            </el-radio-group>
-          </div>
+          <div class="label">审批日期</div>
+          <div class="value">{{getDate()}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">审批说明</div>
-          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
+          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入审批说明"></el-input></div>
         </el-col>
       </el-row>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
-        <el-popconfirm
-          title="确定关闭吗?"
-          @onConfirm="goBack"
-          style="margin-left: 10px;"
-        >
+        <el-button type="primary" @click="clickSubmitForm(1)">审批通过</el-button>
+        <el-button type="warning" @click="clickSubmitForm(0)">审批驳回</el-button>
+        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
           <el-button slot="reference">关 闭</el-button>
         </el-popconfirm>
       </div>
@@ -195,22 +182,32 @@
 </template>
 
 <script>
-import { getOrderDetail } from "@/api/supply/engin";
+import { getOrderDetail, examineHome } from "@/api/supply/engin";
 
 export default {
   name: 'HomeExamine',
   componentName: 'HomeExamine',
   props: ['listItem'],
+  filters: {
+    statusFilter(val) {
+      const statusList = [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ];
+      let obj = statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    }
+  },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
+      userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
       detailData: {},
 
       formLoading: false,
       examineForm: {
-        status: true,
         remark: '',
       }
     }
@@ -233,6 +230,22 @@ export default {
   },
 
   methods: {
+    getDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+          month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+          strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
+
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -245,8 +258,22 @@ export default {
       })
     },
 
-    clickSubmitForm() {
-
+    // 审批
+    clickSubmitForm(val) {
+      this.$confirm('此操作将审批订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let params = this.detailData;
+        params.examineNote = this.examineForm.remark;
+        params.examineResult = val;
+        examineHome(params).then(res => {
+          this.$successMsg();
+          this.goBack();
+          this.$parent.getList();
+        })
+      }).catch(() => {});
     },
 
   }

+ 136 - 76
src/views/supply/engin/components/home_return.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="detail-container">
-    <el-page-header @back="goBack" content="审批"></el-page-header>
+    <el-page-header @back="goBack" content="退订"></el-page-header>
 
     <div class="main-title">
       <div class="title">工程订单</div>
@@ -9,92 +9,100 @@
     <div class="diy-table-1">
       <el-row>
         <el-col :span="8" class="item">
-          <div class="label">订单号</div>
-          <div class="value">{{detailData.billNo}}</div>
+          <div class="label">工程订单号</div>
+          <div class="value">{{detailData.enginOrderId}}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">订单日期</div>
-          <div class="value">{{detailData.fdate}}</div>
+          <div class="value">{{detailData.orderDate}}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">单据状态</div>
-          <div class="value">{{detailData.srcStockId}}</div>
+          <div class="value">{{detailData.examineStatus | statusFilter}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">工程登录单号</div>
-          <div class="value">{{detailData.destStockId}}</div>
+          <div class="label">经销商编码</div>
+          <div class="value">{{detailData.customerId}}</div>
+        </el-col>
+        <el-col :span="16" class="item">
+          <div class="label">经销商名称</div>
+          <div class="value">{{detailData.customerName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">项目名称</div>
-          <div class="value">{{detailData.approveDate}}</div>
+          <div class="label">工程信息编号</div>
+          <div class="value">{{detailData.refEnginRecordNo}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">单据类型</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程项目名称</div>
+          <div class="value">{{detailData.refProjectName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">经销商编码</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">工程登录类型</div>
+          <div class="value">{{detailData.refPromiseStatus}}</div>
+        </el-col>
+        <el-col :span="8" class="item">
+          <div class="label">厂工程编码</div>
+          <div class="value">{{detailData.refFactoryNo}}</div>
         </el-col>
         <el-col :span="8" class="item">
           <div class="label">使用单位</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.refUseUnit}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">安装地址</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">销售类型</div>
+          <div class="value">{{detailData.saleTypeName}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">工程编号</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">联系人</div>
+          <div class="value">{{detailData.aaa}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">厂工厂编码</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">固定电话</div>
+          <div class="value">{{detailData.aaa}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">工程登录类型</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">移动电话</div>
+          <div class="value">{{detailData.aaa}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">文件编号</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">不扣押金</div>
+          <div class="value">{{detailData.takeDeposit ? '是':'否'}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单人</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">文件编码</div>
+          <div class="value">{{detailData.fileNo}}</div>
         </el-col>
         <el-col :span="8" class="item">
-          <div class="label">制单日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">业务员</div>
+          <div class="value">{{detailData.serviceName}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">格力回复</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.note1}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">格力内部备注</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.note2}}</div>
+        </el-col>
+        <el-col :span="24" class="item">
+          <div class="label">备注</div>
+          <div class="value">{{detailData.remark}}</div>
         </el-col>
         <el-col :span="6" class="item">
-          <div class="label">审核人</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">制单人</div>
+          <div class="value">{{detailData.createName}}</div>
         </el-col>
         <el-col :span="6" class="item">
-          <div class="label">审核日期</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="label">制单日期</div>
+          <div class="value">{{detailData.createTime}}</div>
         </el-col>
         <el-col :span="6" class="item">
           <div class="label">关闭人</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.closeName}}</div>
         </el-col>
         <el-col :span="6" class="item">
           <div class="label">关闭日期</div>
-          <div class="value">{{detailData.approverId}}</div>
-        </el-col>
-        <el-col :span="24" class="item">
-          <div class="label">备注</div>
-          <div class="value">{{detailData.approverId}}</div>
+          <div class="value">{{detailData.closeTime}}</div>
         </el-col>
       </el-row>
     </div>
@@ -104,24 +112,38 @@
     </div>
 
     <div class="table" style="margin-top: 20px">
-      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+      <el-table :data="detailData.items" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
-        <el-table-column align="center" label="引用记录" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="销售类型" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品编码" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="产品名称" prop="baseUnitId" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="是否使用返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="返利使用比例" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="是否直调" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="直调数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="已发货数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="返利" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单位" prop="baseUnitId" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="返利类型" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.isDirectTransfer ? '是' : '否' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="可退数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="退订数量" prop="tdQty" min-width="100" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-input v-model="scope.row.tdQty" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
       </el-table>
     </div>
 
@@ -131,28 +153,24 @@
     <div class="diy-table-1">
       <el-row :gutter="0">
         <el-col :span="12" class="item">
-          <div class="label">操作人</div>
-          <div class="value">2022123233435342</div>
+          <div class="label">退订人</div>
+          <div class="value">{{userName}}</div>
         </el-col>
         <el-col :span="12" class="item">
           <div class="label">退订日期</div>
-          <div class="value">123</div>
+          <div class="value">{{getDate()}}</div>
         </el-col>
         <el-col :span="24" class="item">
           <div class="label">退订说明</div>
-          <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
+          <div class="value"><el-input v-model="returnForm.remark" placeholder="请输入退订说明"></el-input></div>
         </el-col>
       </el-row>
     </div>
     
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
-        <el-popconfirm
-          title="确定关闭吗?"
-          @onConfirm="goBack"
-          style="margin-left: 10px;"
-        >
+        <el-button type="primary" @click="clickSubmitForm()">确定退订</el-button>
+        <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
           <el-button slot="reference">关 闭</el-button>
         </el-popconfirm>
       </div>
@@ -162,22 +180,32 @@
 </template>
 
 <script>
-import { getDetail } from "@/api/supply/engin";
+import { getOrderDetail, returnHome } from "@/api/supply/engin";
 
 export default {
   name: 'HomeReturn',
   componentName: 'HomeReturn',
   props: ['listItem'],
+  filters: {
+    statusFilter(val) {
+      const statusList = [
+        { label: '已保存', value: 'SAVE' },
+        { label: '待审核', value: 'WAIT' },
+        { label: '审核通过', value: 'OK' },
+        { label: '审核驳回', value: 'FAIL' },
+        { label: '已关闭', value: 'CLOSE' },
+      ];
+      let obj = statusList.find(o => o.value == val);
+      return obj ? obj.label : ''
+    }
+  },
   data() {
     return {
-      printObj: {
-        id: 'printData'
-      },
+      userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
       detailData: {},
 
       formLoading: false,
-      examineForm: {
-        status: true,
+      returnForm: {
         remark: '',
       }
     }
@@ -200,6 +228,22 @@ export default {
   },
 
   methods: {
+    getDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+          month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+          strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
+
     // 返回列表
     goBack() {
       this.$emit('backListFormDetail');
@@ -207,13 +251,29 @@ export default {
 
     // 获取详情
     getDetail() {
-      getDetail({id: this.listItem.id}).then(res => {
+      getOrderDetail({id: this.listItem.parentId}).then(res => {
         this.detailData = res.data;
       })
     },
 
-    clickSubmitForm() {
-
+    // 退订
+    clickSubmitForm(val) {
+      this.$confirm('此操作将退订订单, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let params = {
+          enginOrderId: this.detailData.enginOrderId,
+          items: this.detailData.items,
+          refundNote: this.returnForm.remark
+        };
+        returnHome(params).then(res => {
+          this.$successMsg();
+          this.goBack();
+          this.$parent.getList();
+        })
+      }).catch(() => {});
     },
 
   }

+ 26 - 4
src/views/supply/engin/home_list.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <div v-show="!isShowDetail && !isShowForm">
+    <div v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn">
       <!-- 筛选条件 -->
       <div class="screen-container">
         <el-form ref="screenForm" :model="screenForm" label-width="100px" size="small" label-position="left">
@@ -128,9 +128,9 @@
                 <el-popconfirm style="margin-right: 10px;" title="确定撤回吗?" @onConfirm="handleWithdraw(scope.row.parentId)" v-if="scope.row.examineStatus === 'WAIT'" >
                   <el-button slot="reference" type="text">撤回</el-button>
                 </el-popconfirm>
-                <el-button type="text" @click="toForm(scope.row)">编辑</el-button>
-                <!-- <el-button type="text" @click="toExamine(scope.row)" v-if="scope.row.examineStatus === 'WAIT'">审批</el-button> -->
-                <el-button type="text" @click="toExamine(scope.row)">审批</el-button>
+                <el-button type="text" @click="toForm(scope.row)" v-if="scope.row.examineStatus === 'SAVE'">编辑</el-button>
+                <el-button type="text" @click="toExamine(scope.row)" v-if="scope.row.examineStatus === 'WAIT'">审批</el-button>
+                <el-button type="text" @click="toReturn(scope.row)">退订</el-button>
                 <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
                 <el-popconfirm style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.parentId)" >
                   <el-button slot="reference" type="text">删除</el-button>
@@ -157,6 +157,8 @@
     
     <HomeDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
     <HomeForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
+    <HomeExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
+    <HomeReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
 
   </div>
 </template>
@@ -165,12 +167,16 @@
 import { getOrderList, applyHome, withdrawHome, deleteHome } from "@/api/supply/engin";
 import HomeDetail from "@/views/supply/engin/components/home_detail";
 import HomeForm from "@/views/supply/engin/components/home_form";
+import HomeExamine from "@/views/supply/engin/components/home_examine";
+import HomeReturn from "@/views/supply/engin/components/home_return";
 
 let that
 export default {
   components: {
     HomeDetail,
     HomeForm,
+    HomeExamine,
+    HomeReturn,
   },
   filters: {
     statusFilter(val) {
@@ -215,6 +221,8 @@ export default {
       queryItem: {},
       isShowDetail: false,
       isShowForm: false,
+      isShowExamine: false,
+      isShowReturn: false,
     }
   },
 
@@ -310,16 +318,30 @@ export default {
       this.isShowForm = true;
     },
 
+    // 进入审批
+    toExamine(item) {
+      this.queryItem = item;
+      this.isShowExamine = true;
+    },
+
     // 进入详情
     toDetail(item) {
       this.queryItem = item;
       this.isShowDetail = true;
     },
 
+    // 进入退订
+    toReturn(item) {
+      this.queryItem = item;
+      this.isShowReturn = true;
+    },
+
     backList() {
       this.queryItem = {};
       this.isShowDetail = false;
       this.isShowForm = false;
+      this.isShowExamine = false;
+      this.isShowReturn = false;
     },
 
     // 申请

+ 2 - 2
src/views/supply/retail/components/retail_detail.vue

@@ -79,7 +79,7 @@
         <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利钱包" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利金额" prop="rebateAmount" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="格力折扣" prop="deductAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
@@ -247,7 +247,7 @@ export default {
     },
     progress() {
       if(this.detailData.totalQty == 0) return 0;
-      return (this.detailData.takeQty * 100) / (this.detailData.totalQty * 100);
+      return (this.detailData.hasSendQty * 100) / (this.detailData.totalQty * 100);
     }
   },
 

+ 1 - 1
src/views/supply/retail/components/retail_examine.vue

@@ -60,7 +60,7 @@
         <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利类型" prop="walletRebateName" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利金额" prop="rebateAmount" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="格力折扣" prop="deductAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="现金钱包" prop="walletRebateName2" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>

+ 29 - 16
src/views/supply/retail/components/retail_form.vue

@@ -6,13 +6,13 @@
       <div class="title">订单信息</div>
     </div>
 
-    <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="80px" size="small" label-position="right">
+    <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="100px" size="small" label-position="right">
       <el-row :gutter="20">
-        <!-- <el-col :xs="24" :sm="12" :lg="8" v-if="listItem">
-          <el-form-item label="订单号" prop="id">
-            <el-input v-model="listItem.id" readonly></el-input>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="订单号" prop="orderNum">
+            <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" readonly></el-input>
           </el-form-item>
-        </el-col> -->
+        </el-col>
         <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
           <el-form-item label="单据日期" prop="date">
             <el-date-picker
@@ -31,16 +31,19 @@
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row :gutter="20">
-        <el-col :xs="24" :sm="12" :lg="8" v-if="listItem">
-          <el-form-item label="业务员" prop="serviceName">
-            <el-input v-model="listItem.serviceName" readonly></el-input>
+        <el-col :xs="24" :sm="12" :lg="8">
+          <el-form-item label="经销商编码" prop="jxsNum">
+            <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" readonly></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :xs="24" :sm="12" :lg="16">
+          <el-form-item label="经销商名称" prop="jxsName">
+            <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" readonly></el-input>
           </el-form-item>
         </el-col>
-        <el-col :xs="24" :sm="16" :lg="16">
-          <el-form-item label="备注" prop="remark">
-            <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
+        <el-col :xs="24" :sm="24" :lg="24">
+          <el-form-item label="表头备注" prop="remark">
+            <el-input v-model="mainForm.remark" placeholder="请输入表头备注"></el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -77,9 +80,9 @@
             {{scope.row.price * scope.row.qty}}
           </template>
         </el-table-column>
-        <el-table-column align="center" label="返利钱包" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
+        <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
           <template slot-scope="scope">
-            <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利钱包" size="small" clearable @change="changeWallet(scope.$index)">
+            <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利类型" size="small" clearable @change="changeWallet(scope.$index)">
               <el-option
                 v-for="item in flWalletList"
                 :key="item.customerWalletId"
@@ -89,7 +92,7 @@
             </el-select>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
+        <el-table-column align="center" label="使用返利金额" min-width="120" show-overflow-tooltip>
           <template slot-scope="scope">
             {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
           </template>
@@ -277,8 +280,12 @@ export default {
   data() {
     return {
       mainForm: {
+        orderNum: '',
         date: '',
         type: '',
+        jxsNum: '',
+        jxsName: '',
+        serviceName: '',
         remark: '',
       },
       mainFormRules: {
@@ -337,6 +344,9 @@ export default {
     this.getWarehouseList();
     if(this.listItem) {
       this.getDetail();
+    }else {
+      this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
+      this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
     }
   },
 
@@ -350,8 +360,11 @@ export default {
     getDetail() {
       getDetail({id: this.listItem.id}).then(res => {
         let data = res.data;
+        this.mainForm.orderNum = data.id;
         this.mainForm.date = data.theTime;
         this.mainForm.type = data.mainId;
+        this.mainForm.jxsNum = data.customerId;
+        this.mainForm.jxsName = data.customerName;
         this.mainForm.remark = data.remark;
         data.retailOrderItemList.forEach(item => {
           item.status1 = '';

+ 1 - 1
src/views/supply/retail/components/retail_return.vue

@@ -60,7 +60,7 @@
         <el-table-column align="center" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利钱包" prop="customerWalletName2" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="返利金额" prop="rebateAmount" min-width="100" show-overflow-tooltip></el-table-column>
-        <el-table-column align="center" label="格力折扣" prop="deductAmount" min-width="100" show-overflow-tooltip></el-table-column>
+        <el-table-column align="center" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="现金钱包" prop="customerWalletName" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>

+ 28 - 18
src/views/supply/retail/retail_list.vue

@@ -3,7 +3,7 @@
     <div v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn">
       <!-- 筛选条件 -->
       <div class="screen-container">
-        <el-form ref="screenForm" :model="screenForm" label-width="100px" size="small" label-position="left">
+        <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
           <el-row :gutter="20">
             <el-col :xs="24" :sm="24" :lg="24">
               <el-form-item prop="status" label-width="0">
@@ -19,13 +19,13 @@
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="销售政策编号" prop="policyCode">
-                <el-input v-model="screenForm.policyCode" placeholder="请输入销售政策编号"></el-input>
+              <el-form-item label="货品名称" prop="goodsName">
+                <el-input v-model="screenForm.goodsName" placeholder="请输入货品名称"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
-              <el-form-item label="销售政策说明" prop="policyRemark">
-                <el-input v-model="screenForm.policyRemark" placeholder="请输入销售政策说明"></el-input>
+              <el-form-item label="规格型号" prop="model">
+                <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :sm="12" :lg="6">
@@ -78,6 +78,21 @@
         </div>
         <div class="table">
           <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
+            <el-table-column align="center" label="提货进度" min-width="120" show-overflow-tooltip>
+              <template slot-scope="scope">
+                <el-progress :text-inside="true" :stroke-width="26" :percentage="((scope.row.hasSendQty * 100) / (scope.row.totalQty * 100)) || 0"></el-progress>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{scope.row.examineStatus | statusFilter}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="开票状态" prop="isInvoicing" min-width="100" show-overflow-tooltip>
+              <template slot-scope="scope">
+                {{scope.row.isInvoicing ? '已开票':'未开票'}}
+              </template>
+            </el-table-column>
             <el-table-column align="center" label="订单号" prop="id" min-width="180" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="订单日期" prop="theTime" min-width="100" show-overflow-tooltip>
               <template slot-scope="scope">
@@ -97,7 +112,7 @@
             <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="出库数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="金额" prop="totalAmount" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="返利使用比例" prop="rebateRate" min-width="110" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="返利金额" prop="rebateAmount" min-width="100" show-overflow-tooltip>
               <template slot-scope="scope">
@@ -105,16 +120,11 @@
                 <div>(实际:{{scope.row.payRebateAmount}})</div>
               </template>
             </el-table-column>
-            <el-table-column align="center" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip></el-table-column>
+            <el-table-column align="center" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="制表人" prop="createName" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="审核人" prop="examineName" min-width="100" show-overflow-tooltip></el-table-column>
             <el-table-column align="center" label="审核日期" prop="examineTime" min-width="160" show-overflow-tooltip></el-table-column>
-            <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
-              <template slot-scope="scope">
-                {{scope.row.examineStatus | statusFilter}}
-              </template>
-            </el-table-column>
             <el-table-column align="center" label="操作" width="220" fixed="right">
               <template slot-scope="scope">
                 <el-button type="text" @click="toForm(scope.row)" v-if="scope.row.examineStatus === 'SAVE'">编辑</el-button>
@@ -185,8 +195,8 @@ export default {
       listLoading: false, // 列表加载loading
       screenForm: { // 筛选表单数据
         orderNum: '',
-        policyCode: '',
-        policyRemark: '',
+        goodsName: '',
+        model: '',
         jxsName: '',
         date: '',
         zbMan: '',
@@ -213,8 +223,8 @@ export default {
       return {
         examineStatus: this.screenForm.status,
         id: this.screenForm.orderNum,
-        policyCode: this.screenForm.policyCode,
-        policyRemark: this.screenForm.policyRemark,
+        materialName: this.screenForm.goodsName,
+        specification: this.screenForm.model,
         customer: this.screenForm.jxsName,
         startTime: this.screenForm.date ? this.screenForm.date[0] : '',
         endTime: this.screenForm.date ? this.screenForm.date[1] : '',
@@ -252,8 +262,8 @@ export default {
         pageSize: this.pageSize,
         examineStatus: this.screenForm.status,
         id: this.screenForm.orderNum,
-        policyCode: this.screenForm.policyCode,
-        policyRemark: this.screenForm.policyRemark,
+        materialName: this.screenForm.goodsName,
+        specification: this.screenForm.model,
         customer: this.screenForm.jxsName,
         startTime: this.screenForm.date ? this.screenForm.date[0] : '',
         endTime: this.screenForm.date ? this.screenForm.date[1] : '',