Переглянути джерело

政策订单添加非经销商判断

howie 3 роки тому
батько
коміт
92649aa2a2
1 змінених файлів з 186 додано та 11 видалено
  1. 186 11
      src/views/supply/policy/components/retail_detail.vue

+ 186 - 11
src/views/supply/policy/components/retail_detail.vue

@@ -10,7 +10,7 @@
           :text-inside="true"
           :stroke-width="26"
           :percentage="
-          detailData.thjd ? ((detailData.thjd * 1000) / 10).toFixed(2) : 0
+            detailData.thjd ? +((detailData.thjd * 1000) / 10).toFixed(2) : 0
         "
         />
       </div>
@@ -291,10 +291,13 @@
 
     <div class="page-footer">
       <div class="footer" :class="classObj">
-        <el-button type="success" @click="toCheckOrder">联查单据</el-button>
+        <el-button type="success" @click="toCheckOrder" >联查单据</el-button>
+        <el-button type="primary" @click="openDirectDialog" v-if="isCustomer" :disabled="detailData.examineStatus !== 'OK'">提前开票</el-button>
+
         <el-button
           :type="status ? 'info' : 'primary'"
-          :disabled="detailData.examineStatus !== 'OK' || status"
+          v-if="isCustomer"
+          :disabled="detailData.examineStatus !== 'OK' || status "
           @click="openDeliverDialog"
         >直调发货</el-button>
         <el-button
@@ -306,6 +309,70 @@
         <!-- <el-button @click="goBack">关 闭</el-button> -->
       </div>
     </div>
+    <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="refundableQty" 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>
     <el-dialog title="直调发货" :visible.sync="isShowDeliverDialog" width="80%">
       <el-form
         ref="deliverForm"
@@ -502,7 +569,7 @@
 
 <script>
 import { getDetail } from '@/api/supply/policy'
-import { adjustDeliver, finishData, getPositionList, getWarehouseList } from '@/api/supply/retail'
+import { adjustDeliver, directOrder, finishData, getPositionList, getWarehouseList } from '@/api/supply/retail'
 import { mapState } from 'vuex'
 import CheckOrder from '@/components/Common/check-order'
 
@@ -528,12 +595,10 @@ export default {
   data() {
     return {
       detailData: {},
-
       isShowDeliverDialog: false,
       deliverForm: {
         date: '',
-        warehouse: '',
-        position: ''
+        position: '',
       },
       deliverFormRules: {
         date: [
@@ -543,11 +608,35 @@ export default {
           { required: true, message: '请选择虚拟仓位', trigger: 'change' }
         ],
       },
-      warehouseList: [],
       positionList: [],
-
       goodsList: [],
-      status: false,
+      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: [],
+      status:false,
       checkOrderId: {},
       isShowCheckOrder: false,
     }
@@ -686,7 +775,85 @@ export default {
       this.checkOrderId = this.detailData.id;
       this.isShowCheckOrder = true;
     },
+    // 关闭 提前开票
+    closeDirectDialog() {
+      this.isShowDirectDialog = false;
+    },
+    // 更改调出仓库
+    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;
+      });
+    },
+    // 获取仓库列表
+    getWarehouseList() {
+      getWarehouseList({
+        pageNum: 1,
+        pageSize: -1,
+      }).then(res => {
+        this.warehouseList1 = res.data.records;
+        this.warehouseList2 = res.data.records;
+      })
+    },
+
+    // 更改调出仓位
+    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;
+      });
+    },
+    // 提交 提前开票
+    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.id,
+            orderType: 'RETAIL', // 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();
+          })
+        }
+      })
+    },
     backDetail() {
       this.isShowCheckOrder = false;
     },
@@ -724,7 +891,15 @@ export default {
           })
         }
       })
-    }
+    },
+    // 打开 提前开票
+    openDirectDialog() {
+      this.isShowDirectDialog = true;
+      this.directGoodsList = this.detailData.retailOrderItemList;
+      this.getWarehouseList();
+    },
+
+
   }
 }
 </script>