Parcourir la source

5.9修改出库及创建订单

sakura il y a 1 an
Parent
commit
342b09a3be

+ 23 - 2
manager-admin/src/api/goodsExchange.js

@@ -206,8 +206,8 @@ export function getGoodsExport(params) {
 
 export function getWarehouseOut(params) {
   return request({
-    url: '/admin/erp/warehouseOutItem/query',
-    method: 'post',
+    url: '/admin/erp/warehouseOut',
+    method: 'get',
     loaidng: false,
     params
   })
@@ -243,3 +243,24 @@ export function getStockByWarehouseGood(params) {
     data: params
   })
 }
+//查询库存商品 /admin/erp/productStock
+export function getProductStock(params) {
+  return request({
+    url: '/admin/erp/productStock',
+    method: 'get',
+    loaidng: false,
+    params
+  })
+}
+
+//编辑出库 /admin/erp/warehouseOut
+
+export function editWarehouseOut(id, parmas) {
+  return request({
+    url: `/admin/erp/warehouseOut/${id}`,
+    method: 'put',
+    headers: { 'Content-Type': 'application/json' },
+    data: parmas
+  })
+}
+

+ 1 - 1
manager-admin/src/router/index.js

@@ -187,7 +187,7 @@ const asyncRouters = [
 
     ]
   },
-  // 财务管理
+  // 客户管理
   {
     path: '/finance',
     component: Layout,

+ 1 - 1
manager-admin/src/views/finance/financeIncomeList/index.vue

@@ -170,7 +170,7 @@ export default {
         ],
         gender:[{required: true, message: '请选择性别', trigger: 'change' }],
         type:[{ required: true, message: '请选择客户类别', trigger: 'change' }],
-      contact:[{ required: true, message: '请输入客户联系人', trigger: 'blur' }],
+        contact:[{ required: true, message: '请输入客户联系人', trigger: 'blur' }],
       },
       // 供应商表单 dialog
       dialogVisible: false,

+ 6 - 6
manager-admin/src/views/stock/goodsExchange/addInventory.vue

@@ -8,9 +8,9 @@
       inline
       class="change-form"
     >
-      <el-form-item label="订单" prop="sn" class="change-form-item">
+      <el-form-item label="订单" prop="order_id" class="change-form-item">
         <el-input
-          v-model="goodsExchangeAddForm.sn"
+          v-model="goodsExchangeAddForm.order_id"
           :disabled="type === 'detail' || type === 'audit'"
           ref="order"
           @blur="blurUsername()"
@@ -473,7 +473,7 @@ export default {
     // 查询订单编号
     blurUsername(){
       if(this.goodsExchangeAddForm.sn!==undefined){
-        API_order.getOrderList({sn:this.goodsExchangeAddForm.sn}).then(res=>{
+        API_order.getOrderList({sn:this.goodsExchangeAddForm.order_id}).then(res=>{
           console.log(res.data);
           this.goodsExchangeAddForm.order_id= Number(res.data[0].id)
           this.goodsExchangeAddForm.contract_product_list=res.data
@@ -661,7 +661,7 @@ export default {
             return;
           }
           if (this.$route.name === "editInventory") {
-            API_GoodsExchange.editWarehouseEntry(params).then((response) => {
+            API_GoodsExchange.editWarehouseEntry(id,params).then((response) => {
               this.$message.success("修改成功!");
               const { callback } = this.$route.params;
               if (typeof callback === "function") callback();
@@ -716,14 +716,14 @@ export default {
             return;
           }
          /* */ if (this.$route.name === "editInventory") {
-          params.contract_product_list.map(el=>{
+          /* params.contract_product_list.map(el=>{
             el.product_id=el.id
             el.goods_id=el.id
           })
           params.product_list.map(el=>{
             el.product_id=el.id
             el.goods_id=el.id
-          })
+          }) */
             API_GoodsExchange.editWarehouseEntry(id,params).then((response) => {
               this.$message.success("修改成功!");
               const { callback } = this.$route.params;

+ 2 - 145
manager-admin/src/views/stock/goodsExchange/goodsExchange.vue

@@ -7,7 +7,6 @@
       </el-tabs>
     </div>
     <div class="btn">
-      <!-- <el-button type="primary" @click="getExport()">导 出</el-button> -->
     </div>
     <div class="search">
       <el-form ref="advancedForm" :model="advancedForm" label-width="160px">
@@ -123,24 +122,8 @@
           </template>
         </el-table-column>
         <el-table-column prop="warehouse_name" label="仓库名称" />
-
         <el-table-column prop="order_id" label="订单编号" />
-        <!--  <el-table-column v-if="activeName=='first'" prop="warehouse_name" label="出库">
-           <template slot-scope="scope">{{
-            scope.row.change_time | unixToDate
-          }}</template>
-        </el-table-column>
-        <el-table-column v-else prop="warehouse_name" label="入库">
-        </el-table-column>-->
-       <!-- <el-table-column prop="goods_name" label="商品名称" />
-         <el-table-column prop="goods_sn" label="商品编号" />
-         <el-table-column prop="goods_category" label="商品类别" />
-        <el-table-column prop="goods_sn" label="规格型号" />
-        <el-table-column prop="qty" label="库存数量" /> -->
         <el-table-column prop="memo" label="备注" />
-        <!-- <el-table-column prop="status" label="状态">
-          <template slot-scope="scope">{{ statusFilter(scope.row.status) }}</template>
-        </el-table-column> -->
         <el-table-column label="操作" width="450">
           <template slot-scope="scope">
             <el-button
@@ -151,16 +134,10 @@
             >
             <el-button
               size="mini"
+              v-if="scope.row.has_submit=='N'"
               @click="handleEditGoodsExchange(scope.row)"
               >编辑</el-button
             >
-            <!-- <el-button v-if="scope.row.allowable.allow_submit && checkPermission(['goodsExchange:submit'])" type="success"
-              size="mini" @click="handleSubmitGoodsExchange(scope.row)">提交</el-button>
-            <el-button v-if="scope.row.allowable.allow_cancel && checkPermission(['goodsExchange:withdraw'])" type="danger"
-              size="mini" @click="handleCancelGoodsExchange(scope.row)">撤回</el-button>
-
-            <el-button v-if="checkPermission(['goodsExchange:print'])" type="primary" size="mini"
-              @click="handlePrintGoodsExchangeDialog(scope.row)">打印</el-button> -->
           </template>
         </el-table-column>
       </template>
@@ -178,122 +155,6 @@
       >
       </el-pagination>
     </en-table-layout>
-
-    <el-dialog
-      title="换货单表"
-      :visible.sync="dialogVisible"
-      width="940px"
-      center
-    >
-      <el-button
-        size="mini"
-        type="primary"
-        @click="handlePrintGoodsExchange"
-        class="print"
-        >打印</el-button
-      >
-      <div id="deliverySheet" style="width: 811px">
-        <div class="tips-t">
-          <div>换货单号:{{ goodsExchangeForm.sn }}</div>
-          <div>
-            换货时间:{{ goodsExchangeForm.change_time | unixToDateStr }}
-          </div>
-          <div>仓库:{{ goodsExchangeForm.warehouse_name }}</div>
-        </div>
-        <div class="tips-t">
-          <div>所属部门:{{ goodsExchangeForm.dept_name }}</div>
-          <div>登记人:{{ goodsExchangeForm.handled_by }}</div>
-          <div>审核人:{{ goodsExchangeForm.change_person }}</div>
-        </div>
-        <div class="tips-t">
-          <div>换货说明:{{ goodsExchangeForm.change_desc }}</div>
-          <div></div>
-          <div></div>
-        </div>
-        <div class="mx">
-          <h3>换货商品明细</h3>
-        </div>
-        <el-table
-          :data="goodsExchangeForm.change_list"
-          border
-          :cell-style="{ textAlign: 'center' }"
-          :header-cell-style="{ textAlign: 'center' }"
-          style="width: 100%; margin-top: 20px"
-        >
-          <el-table-column label="批次编号" width="150">
-            <template slot-scope="scope">
-              {{ scope.row.stock_sn }}
-            </template>
-          </el-table-column>
-          <el-table-column label="商品编号" width="150">
-            <template slot-scope="scope">
-              {{ scope.row.product_sn }}
-            </template>
-          </el-table-column>
-          <el-table-column label="商品名称" width="160">
-            <template slot-scope="scope">
-              {{ scope.row.product_name }}
-            </template>
-          </el-table-column>
-          <el-table-column label="规格型号" width="170">
-            <template slot-scope="scope">
-              {{ scope.row.specification }}
-            </template>
-          </el-table-column>
-          <el-table-column label="换货数量" width="90">
-            <template slot-scope="scope">
-              {{ scope.row.num }}
-            </template>
-          </el-table-column>
-          <el-table-column label="换货金额" width="90">
-            <template slot-scope="scope">
-              {{ scope.row.amount }}
-            </template>
-          </el-table-column>
-        </el-table>
-        <div class="mx">
-          <h3>退货商品明细</h3>
-        </div>
-        <el-table
-          :data="goodsExchangeForm.return_list"
-          border
-          :cell-style="{ textAlign: 'center' }"
-          :header-cell-style="{ textAlign: 'center' }"
-          style="width: 100%; margin-top: 20px"
-        >
-          <el-table-column label="批次编号" width="150">
-            <template slot-scope="scope">
-              {{ scope.row.stock_sn }}
-            </template>
-          </el-table-column>
-          <el-table-column label="商品编号" width="150">
-            <template slot-scope="scope">
-              {{ scope.row.product_sn }}
-            </template>
-          </el-table-column>
-          <el-table-column label="商品名称" width="160">
-            <template slot-scope="scope">
-              {{ scope.row.product_name }}
-            </template>
-          </el-table-column>
-          <el-table-column label="规格型号" width="170">
-            <template slot-scope="scope">
-              {{ scope.row.specification }}
-            </template>
-          </el-table-column>
-          <el-table-column label="换货数量" width="90">
-            <template slot-scope="scope">
-              {{ scope.row.num }}
-            </template>
-          </el-table-column>
-          <el-table-column label="换货金额" width="90">
-            <template slot-scope="scope">
-              {{ scope.row.amount }}
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
@@ -307,6 +168,7 @@ export default {
   name: "goodsExchange",
   data() {
     return {
+      //仓库列表
       warehouseList: [],
       deptList: [],
       // 列表loading状态
@@ -355,11 +217,6 @@ export default {
         this.GET_WarehouseEntry();
       }
     },
-    getExport() {
-      // API_GoodsExchange.getGoodsExport().then(res=>{
-      //   console.log(res);
-      // })
-    },
     /** 状态 */
     statusFilter(val) {
       switch (val) {

+ 130 - 103
manager-admin/src/views/stock/goodsExchange/goodsExchangeAdd.vue

@@ -43,23 +43,23 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="订单" prop="order_sn" class="change-form-item">
+      <!-- <el-form-item label="订单" prop="order_sn" class="change-form-item">
         <el-input
           v-model="goodsExchangeAddForm.order_list[0].order_sn"
           :disabled="type === 'detail' || type === 'audit'"
           ref="order"
         >
         </el-input>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item
         label="备注"
-        prop="change_desc"
+        prop="notes"
         class="change-form-item"
         style="width: 61%"
       >
         <el-input
           style="flex: 1"
-          v-model="goodsExchangeAddForm.change_desc"
+          v-model="goodsExchangeAddForm.notes"
           type="textarea"
           :disabled="type === 'detail' || type === 'audit'"
           maxlength="250"
@@ -146,7 +146,7 @@
       <div style="width: 100%; display: block">
         <el-form-item style="width: 100%">
           <el-table
-            :data="product_list"
+            :data="goodsExchangeAddForm.product_list"
             border
             :cell-style="{ textAlign: 'center' }"
             :header-cell-style="{ textAlign: 'center' }"
@@ -164,7 +164,7 @@
             </el-table-column>
             <el-table-column label="条码">
               <template slot-scope="scope">
-                {{ scope.row.product_barcode }}
+                {{ scope.row.bar_code }}
               </template>
             </el-table-column>
             <el-table-column label="序列号">
@@ -174,19 +174,18 @@
             </el-table-column>
             <el-table-column label="规格型号">
               <template slot-scope="scope">
-                {{ scope.row.specification }}
+                {{ scope.row.goods_style }}
               </template>
             </el-table-column>
             <el-table-column label="单位">
               <template slot-scope="scope">
-                {{ scope.row.unit }}
+                {{ scope.row.goods_unit }}
               </template>
             </el-table-column>
-            <el-table-column label="订单数量"> </el-table-column>
             <el-table-column label="出库数量">
               <template slot-scope="scope">
                 <el-input
-                  v-model="scope.row.num"
+                  v-model="scope.row.out_num"
                   type="number"
                   :min="0"
                   :maxlength="20"
@@ -196,13 +195,13 @@
             </el-table-column>
             <el-table-column label="库存数量">
               <template slot-scope="scope">
-                {{ scope.row.already_num }}
+                {{ scope.row.usable_stock }}
               </template>
             </el-table-column>
             <el-table-column label="差异">
               <template slot-scope="scope">
                 <!-- 入库减去库存  -->
-                {{ scope.row.num - scope.row.already_num || 0 }}
+                {{ scope.row.usable_stock - scope.row.out_num   || 0 }}
               </template>
             </el-table-column>
             <el-table-column
@@ -213,7 +212,7 @@
                 <el-button
                   size="mini"
                   type="danger"
-                  @click="product_list.splice(scope.$index, 1)"
+                  @click="goodsExchangeAddForm.product_list.splice(scope.$index, 1)"
                   >删除</el-button
                 >
               </template>
@@ -230,9 +229,15 @@
       <el-button
         v-if="type !== 'audit' && type !== 'detail'"
         type="primary"
-        @click="submitgoodsExchangeAddForm"
+        @click="saveGoodsExchangeAddForm"
         >保存
       </el-button>
+      <el-button
+        v-if="type !== 'audit' && type !== 'detail'"
+        type="primary"
+        @click="submitGoodsExchangeAddForm"
+        >出库
+      </el-button>
       <el-button @click="printIng" v-if="type == 'audit'">打印</el-button>
       <el-button @click="$router.back()">返回</el-button>
     </div>
@@ -290,7 +295,7 @@
         <el-button type="primary" @click="handleRejectGoodsExchange()">确 定</el-button> -->
       </span>
     </el-dialog>
-    <el-dialog
+    <!-- <el-dialog
       title="出库商品"
       :visible.sync="goodsVisible"
       width="1000px"
@@ -316,7 +321,7 @@
         <el-button @click="closeGoosData">取 消</el-button>
         <el-button type="primary" @click="submitGoosData()">确 定</el-button>
       </span>
-    </el-dialog>
+    </el-dialog> -->
   </div>
 </template>
 
@@ -397,7 +402,7 @@ export default {
             order_sn: "",
           },
         ],
-        /* product_list: [], */
+         product_list: [],
         type: "",
       },
       /** 校验规则 */
@@ -476,7 +481,8 @@ export default {
     ...mapGetters(["user"]),
   },
   methods: {
-    handleSelectionChange(val) {
+     /*//商品对应字段
+     handleSelectionChange(val) {
       this.goodsList = val.map((el) => {
         el.product_id = el.id;
         el.goods_id = el.id;
@@ -490,19 +496,19 @@ export default {
     },
     // 保存已选商品
     submitGoosData() {
-      if (this.goodsList.length >= 1) {
-        this.goodsExchangeAddForm.order_list[0].order_item_list =
-          this.goodsList;
-        this.product_list = this.goodsList;
+        if (this.goodsList.length >= 1) {
+          this.goodsExchangeAddForm.order_list[0].order_item_list =
+            this.goodsList;
+          this.product_list = this.goodsList;
+          this.goodsVisible = false;
+        } else {
+          this.$message.error("请选择商品信息");
+        }
+      },
+      // 关闭商品明细
+      closeGoosData() {
         this.goodsVisible = false;
-      } else {
-        this.$message.error("请选择商品信息");
-      }
-    },
-    // 关闭商品明细
-    closeGoosData() {
-      this.goodsVisible = false;
-    },
+      },*/
     // 打印功能
     printIng() {},
     toSearch() {
@@ -529,7 +535,7 @@ export default {
         this.adminList = response.data;
       });
     },
-    /** 清除已选商品明细 */
+    /** 清除已选商品明细
     cleanGoodsList() {
       // 切换部门或仓库需要清除已选对应仓库下的商品数据 change_list
       this.goodsExchangeAddForm.order_list[0].order_item_list = [];
@@ -540,7 +546,7 @@ export default {
       this.GET_WarehouseList({ dept_id: e });
       this.cleanGoodsList();
     },
-    /** 审核-通过 */
+    //审核-通过
     handlePassGoodsExchange() {
       if (this.goodsExchangeAddForm.check_amount_same === false) {
         this.$confirm(this.goodsExchangeAddForm.diff_amount_message, "提示", {
@@ -584,7 +590,7 @@ export default {
           .catch(() => {});
       }
     },
-    /** 审核-拒绝 */
+    // 审核-拒绝
     handleRejectGoodsExchange() {
       this.$confirm("确定拒绝吗?", "提示", { type: "warning" })
         .then(() => {
@@ -604,23 +610,23 @@ export default {
           });
         })
         .catch(() => {});
-    },
+    },*/
     /** 获取仓库 */
     GET_WarehouseList(e) {
       API_BasicSetting.getWarehouseListAll().then((response) => {
         this.warehouseList = response;
       });
     },
-    // 保存
-    submitgoodsExchangeAddForm() {
+    //保存
+    saveGoodsExchangeAddForm(){
       this.$refs["goodsExchangeAddForm"].validate((valid) => {
         if (valid) {
           const { id } = this.goodsExchangeAddForm;
           const params = this.MixinClone(this.goodsExchangeAddForm);
+          //保存类型
+          params.save_or_submit="save"
           params.warehouse_consignee_id = this.deptListAll.id;
           params.out_time = Date.parse(new Date());
-          params.order_list[0].order_item_list[0].batch_list[0].out_num =
-            this.product_list[0].num;
           params.staff_name = this.goodsExchangeAddForm.distribution_name;
           if (params.warehouse_id) {
             params.warehouse_name = this.warehouseList.find(
@@ -633,12 +639,13 @@ export default {
             ).real_name;
           }
           params.change_time = Math.floor(params.change_time / 1000);
-          if (!params.order_list[0].order_item_list.length) {
+
+          if (!this.goodsExchangeAddForm.product_list.length) {
             this.$message.error("请选择商品!");
             return;
           }
           if (this.$route.name === "goodsExchangeEdit") {
-            API_GoodsExchange.warehouseOut(params).then((response) => {
+            API_GoodsExchange.editWarehouseOut(id,params).then((response) => {
               this.$message.success("修改成功!");
               const { callback } = this.$route.params;
               if (typeof callback === "function") callback();
@@ -649,7 +656,6 @@ export default {
               this.$router.push({ name: "goodsExchange" });
             });
           } else if (this.$route.name === "goodsExchangeAdd") {
-            console.log(params);
             // 新增入库
             API_GoodsExchange.warehouseOut(params).then(() => {
               this.$message.success("添加成功!");
@@ -665,67 +671,87 @@ export default {
         }
       });
     },
-    returngoodsExchangeAddForm() {
-      const { id } = this.goodsExchangeAddForm;
-      const params = this.MixinClone(this.goodsExchangeAddForm);
-      param; /* s.dept_name = this.deptListAll.find(
-        (dept) => dept.id === params.dept_id
-      ).name; */
-      params.staff_name = this.goodsExchangeAddForm.distribution_name;
-      params.warehouse_name = this.warehouseList.find(
-        (ware) => ware.id === params.warehouse_id
-      ).name;
-      params.change_time = Math.floor(params.change_time / 1000);
-      params.product_list = params.product_list.map((item) => {
-        //change_list
-        item.product_sn = item.product_sn;
-        item.product_name = item.product_name;
-        item.specification = item.product_specification;
-        item.product_id = item.product_id;
-        item.unit = item.unit;
-        item.stock_sn = item.sn;
-        item.stock_num = item.remain_num;
-        item.cost_price = item.product_cost_price;
-        return item;
-      });
-      API_GoodsExchange.returnGoodsExchange(id, params).then(() => {
-        this.$message.success("换货成功!");
-        const { callback } = this.$route.params;
-        if (typeof callback === "function") callback();
-        this.$store.dispatch("delCurrentViews", {
-          view: this.$route,
-          $router: this.$router,
-        });
-        this.$router.push({ name: "goodsExchange" });
+    //出库
+    submitGoodsExchangeAddForm() {
+      this.$refs["goodsExchangeAddForm"].validate((valid) => {
+        if (valid) {
+          const { id } = this.goodsExchangeAddForm;
+          const params = this.MixinClone(this.goodsExchangeAddForm);
+          //保存类型
+          params.save_or_submit="submit"
+          params.warehouse_consignee_id = this.deptListAll.id;
+          params.out_time = Date.parse(new Date());
+          params.staff_name = this.goodsExchangeAddForm.distribution_name;
+          if (params.warehouse_id) {
+            params.warehouse_name = this.warehouseList.find(
+              (ware) => ware.id === params.warehouse_id
+            ).name;
+          }
+          if (params.handled_by_id) {
+            params.handled_by = this.adminList.find(
+              (admin) => admin.id === params.handled_by_id
+            ).real_name;
+          }
+          params.change_time = Math.floor(params.change_time / 1000);
+          if (!this.goodsExchangeAddForm.product_list.length) {
+            this.$message.error("请选择商品!");
+            return;
+          }
+          if (this.$route.name === "goodsExchangeEdit") {
+            API_GoodsExchange.editWarehouseOut(id,params).then((response) => {
+              this.$message.success("修改成功!");
+              const { callback } = this.$route.params;
+              if (typeof callback === "function") callback();
+              this.$store.dispatch("delCurrentViews", {
+                view: this.$route,
+                $router: this.$router,
+              });
+              this.$router.push({ name: "goodsExchange" });
+            });
+          } else if (this.$route.name === "goodsExchangeAdd") {
+            console.log(params);
+            // 新增入库
+            API_GoodsExchange.warehouseOut(params).then(() => {
+              this.$message.success("添加成功!");
+              const { callback } = this.$route.params;
+              if (typeof callback === "function") callback();
+              this.$store.dispatch("delCurrentViews", {
+                view: this.$route,
+                $router: this.$router,
+              });
+              this.$router.push({ name: "goodsExchange" });
+            });
+          }
+        }
       });
     },
     // 选择出库单
     async handleSelectWarehouseEntryBatch() {
-      API_GoodsExchange.getGoodsInfo().then((res) => {
+    /*   API_GoodsExchange.getProductStock().then((res) => {
         this.goodsData = res.data;
         this.goodsVisible = true;
-      });
-      /*// if (!this.goodsExchangeAddForm.warehouse_id) {
-      //   this.$message.error('请先选择仓库!')
-      //   return
-      // }
+      });*/
+     if (!this.goodsExchangeAddForm.warehouse_id) {
+        this.$message.error('请先选择仓库!')
+        return
+      }
        const goodsData = await this.$EnwarehouseEntryBatch({
-        goodsApi: "/admin/erp/goods",
+        goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.goodsExchangeAddForm.warehouse_id}`,
         warehouseList: this.warehouseList,
         //change_list
         selectedIds: this.id
           ? this.goodsExchangeAddForm.product_list &&
             this.goodsExchangeAddForm.product_list.map((item) => item.id)
           : this.goodsExchangeAddForm.product_list.map((item) => item.id),
-        purchasePlanApiParams: {
+         purchasePlanApiParams: {
           warehouse_id: this.goodsExchangeAddForm.warehouse_id,
-        },
+          },
       });
       this.goodsExchangeAddForm.warehouse_id = goodsData.warehouse_id;
       this.goodsExchangeAddForm.product_list = goodsData.purchasePlans.map(
         (item) => {
           //
-          item.amount = item.entry_price;
+          /* item.amount = item.entry_price;
           item.product_sn = item.product_sn;
           item.product_name = item.product_name;
           item.specification = item.product_specification;
@@ -735,7 +761,8 @@ export default {
           item.stock_id = item.warehouse_entry_id;
           item.stock_batch_sn = item.sn;
           item.stock_batch_id = item.id;
-          item.cost_price = item.product_cost_price;
+          item.cost_price = item.product_cost_price; */
+          item.goods_id=item.id
           return item;
         }
       );
@@ -743,7 +770,8 @@ export default {
         this.goodsExchangeAddForm.product_list.reduce(
           (sum, obj) => sum + obj.entry_price,
           0
-        ); */
+        );
+        console.log(this.goodsExchangeAddForm);
     },
     /** 选择订单编号 */
     async handleSelectOrderSn() {
@@ -773,18 +801,14 @@ export default {
         item.specification = item.product_specification;
         item.product_id = item.product_id;
         item.unit = item.product_unit;
-        item.num = item.return_num;
+        item.out_num = item.return_num;
         item.stock_sn = item.warehouse_entry_sn;
         item.cost_price = item.product_cost_price;
         return item;
       });
     },
-    /** 获取部门 */
+    /** 获取仓库 */
     GET_DeptList() {
-      /* API_Setting.getDeptList().then((response) => {
-        this.deptList = Foundation.buildTree(response, "0");
-        this.deptListAll = response;
-      }); */
       API_GoodsExchange.getInfo().then((response) => {
         this.deptListAll = response;
         this.deptListAll.password = "";
@@ -797,31 +821,36 @@ export default {
     /** 获取详情页面数据 */
     GET_goodsExchangeAddDetail() {
       this.$nextTick(() => {
-        API_GoodsExchange.getGoodsExchangeInfo(this.id).then((response) => {
+        API_GoodsExchange.getGoodsWarehouseOut(this.id).then((response) => {
           this.goodsExchangeAddForm = response;
-          this.GET_WarehouseList({ dept_id: response.dept_id });
+          this.GET_WarehouseList({ dept_id: response.warehouse_id });
           this.goodsExchangeAddForm.change_time = Math.floor(
             this.goodsExchangeAddForm.change_time * 1000
           );
           this.goodsExchangeAddForm.distribution_name = response.staff_name;
-          this.product_list = response.product_list.map((item) => {
+          this.goodsExchangeAddForm.product_list = response.product_list.map((item) => {
             //change_list
-            item.entry_price = item.amount;
-            item.product_specification = item.specification;
-            item.product_unit = item.unit;
-            item.warehouse_entry_sn = item.stock_sn;
+              item.name=item.goods_vo.name
+              item.sn=item.goods_vo.sn
+              item.sn_code=item.goods_vo.sn_code
+              item.bar_code=item.goods_vo.bar_code
+              item.entry_price = item.amount;
+              item.product_specification = item.specification;
+              item.product_unit = item.unit;
+              item.warehouse_entry_sn = item.stock_sn;
+              item.usable_stock=item.goods_vo.usable_stock
             return item;
           });
-          this.goodsExchangeAddForm.return_list = response.return_list.map(
+          /* this.goodsExchangeAddForm.return_list = response.return_list.map(
             (item) => {
               item.product_price = item.amount;
               item.product_specification = item.specification;
               item.product_unit = item.unit;
-              item.return_num = item.num;
+              item.return_num = item.out_num;
               item.warehouse_entry_sn = item.stock_sn;
               return item;
             }
-          );
+          ); */
           // this.GET_WarehouseOutProduct()
         });
       });
@@ -831,8 +860,6 @@ export default {
 </script>
 
 <style type="text/scss" lang="scss" scoped>
-/deep/ {
-}
 /** 底部步骤 */
 .footer {
   width: 100%;

+ 42 - 10
manager-admin/src/views/stock/order.vue

@@ -123,7 +123,7 @@
                     <el-option label="已支付" value="PAY" />
                   </el-select>
                 </el-form-item>
-              </el-form>
+              </el-form>:selectable="canWarehouseOut"
             </template>
           </en-table-search>
         </div> -->
@@ -132,7 +132,7 @@
         <el-table-column
           type="selection"
           width="55"
-          :selectable="canWarehouseOut"
+
         />
         <el-table-column prop="sn" label="订单编号">
           <template slot-scope="scope">
@@ -147,8 +147,10 @@
             scope.row.order_time | unixToDate
           }}</template>
         </el-table-column>
-        <el-table-column prop="member_name" label="仓库名称">
-          <template slot-scope="scope">{{ scope.row.member_name }}</template>
+        <el-table-column prop="warehouse_id" label="仓库名称">
+          <template slot-scope="scope">
+            {{warehouseName(scope.row.warehouse_id) }}
+          </template>
         </el-table-column>
         <el-table-column prop="delivery_type" label="配送方式">
           <template slot-scope="scope">{{ scope.row.delivery_type }}</template>
@@ -162,18 +164,22 @@
           }}</template>
         </el-table-column>
         <el-table-column prop="status" label="订单状态">
-          <template slot-scope="scope">{{ scope.row.status_text }}</template>
+          <template slot-scope="scope">
+            {{typeName(scope.row.status)  }}
+          </template>
         </el-table-column>
         <!-- <el-table-column prop="status" label="订单状态">
           <template slot-scope="scope">{{ scope.row.payment_status_text }}</template>
         </el-table-column> -->
         <el-table-column label="操作" width="250">
           <template slot-scope="scope">
-            <!-- <el-button size="mini" type="success" v-if="scope.row.allowable.submit && checkPermission(['order:submit'])"
-                       @click="handleSubmit(scope.row.id)">提交</el-button>
-            <el-button size="mini" type="danger" v-if="scope.row.allowable.withdraw && checkPermission(['order:withdraw'])"
+             <el-button size="mini" type="success"
+             v-if="scope.row.status==='TO_BE_COMMIT'"
+                       @click="handleSubmit(scope.row.id)">确认</el-button>
+           <!-- <el-button size="mini" type="danger" v-if="scope.row.allowable.withdraw && checkPermission(['order:withdraw'])"
                        @click="handleWithdraw(scope.row.id)">撤回</el-button> -->
             <el-button size="mini" @click="handleEdit(scope.row)"
+            v-if="scope.row.status==='TO_BE_COMMIT'"
               >编辑</el-button
             >
             <!-- <el-button size="mini" type="success" v-if="scope.row.allowable.audit && checkPermission(['order:audit'])"
@@ -203,6 +209,7 @@
 import * as API_order from "@/api/order";
 import Storage from "@/utils/storage";
 import * as API_BasicSetting from '@/api/basicSetting'
+import * as API_Setting from '@/api/setting'
 export default {
   name: "orderList",
   data() {
@@ -233,6 +240,7 @@ export default {
 
       accessToken: Storage.getItem("seller_access_token"),
       multipleSelection: [],
+      orderType:[]
     };
   },
   mounted() {
@@ -258,6 +266,26 @@ export default {
     next();
   },
   methods: {
+    typeName(val){
+      console.log(val);
+      let name=''
+      this.orderType.map(el=>{
+       if(el.value==val) {
+        return name=el.label
+       }
+      })
+      console.log(name);
+      return name
+    },
+    warehouseName(val){
+      let name=''
+      this.warehouseList.map(el=>{
+       if(el.id==val) {
+        return name=el.name
+       }
+      })
+      return name
+    },
     batchOutbound() {
       if (this.multipleSelection.length === 0) {
         this.$message.error("请选择订单!");
@@ -275,6 +303,10 @@ export default {
       API_BasicSetting.getWarehouseListAll().then(response => {
         this.warehouseList = response
       })
+      API_Setting.getPage({dictType:"order_status"}).then(res=>{
+        this.orderType=res.data
+        console.log(this.orderType);
+      })
     },
     /** 计算高度 */
     countTableHeight() {
@@ -292,9 +324,9 @@ export default {
       });
     },
     /** 是否可以出库 */
-    canWarehouseOut(row) {
+   /*  canWarehouseOut(row) {
       return row.allowable.warehouse_out;
-    },
+    }, */
 
     /** 分页大小发生改变 */
     handlePageSizeChange(size) {

+ 346 - 123
manager-admin/src/views/stock/orderAdd.vue

@@ -16,7 +16,7 @@
         <el-col :span="10">
           <el-form-item label="订单类型" prop="type" :rules="rules.type">
             <!-- @change="cleanGoodsList" -->
-            <el-select v-model="OrderForm.type" clearable>
+            <el-select v-model="OrderForm.type"  clearable>
               <el-option
                 v-for="(item, index) in orderTypeList"
                 :key="index"
@@ -26,6 +26,43 @@
             </el-select>
           </el-form-item>
         </el-col>
+        <el-col :span="10">
+          <el-form-item
+            label="租赁时间"
+            prop="time"
+            v-if="OrderForm.type=='TO_C'"
+            :rules="rules.time"
+          >
+          <el-date-picker
+                v-model="time"
+                type="daterange"
+                align="center"
+                :editable="false"
+                unlink-panels
+                :clearable="false"
+                :default-time="['00:00:00', '23:59:59']"
+                range-separator="-"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd hh:mm:ss"
+                :picker-options="{
+                  disabledDate(time) {
+                    return (
+                      time.getTime()<=
+                      new Date(
+                        new Date().getFullYear(),
+                        new Date().getMonth(),
+                        new Date().getDate()
+                      ).getTime() -
+                        86400000
+                    );
+                  },
+                  shortcuts: MixinPickerShortcuts,
+                }"
+              >
+              </el-date-picker>
+          </el-form-item>
+        </el-col>
         <el-col :span="10">
           <el-form-item
             label="下单客户"
@@ -40,6 +77,7 @@
                 :value="item.id"
               />
             </el-select>
+            <el-button type="primary" @click="addCust">新增客户</el-button>
           </el-form-item>
         </el-col>
         <el-col :span="10">
@@ -125,7 +163,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="10">
-          <el-form-item label="配送地址" prop="addres">
+          <el-form-item label="配送地址" prop="province_city_area_address">
             <!--  <el-select v-model="OrderForm.addres">
               <el-option
                 v-for="item in marketingList"
@@ -143,7 +181,7 @@
             >
             </el-cascader>
             <el-input
-              v-model="OrderForm.addres"
+              v-model="OrderForm.address"
               placeholder="请输入"
             ></el-input>
           </el-form-item>
@@ -160,27 +198,6 @@
           </div>
         </el-col>
       </el-row>
-
-      <!-- <el-form-item label="" prop="" :rules="rules.addres">
-      </el-form-item>
-       <el-form-item label="支付时间" prop="payment_time" :rules="rules.payment_time" v-if="OrderForm.payment_status === 'PAY'">
-        <el-date-picker v-model="OrderForm.payment_time" value-format="timestamp" type="datetime" :editable="false" :clearable="false" style="width: 100%"/>
-      </el-form-item> -->
-      <!-- <el-form-item label="自提门店" v-if="OrderForm.delivery_type === 'self_pick'">
-        <el-select v-model="OrderForm.store_id">
-          <el-option v-for="item in storeList" :key="item.id" :label="item.store_name" :value="item.id"/>
-        </el-select>
-      </el-form-item> -->
-
-      <!-- <el-form-item label="附件" prop="attachment" style="width: 500px">
-        <el-upload multiple :action="MixinUploadApi" :file-list="fileList" v-if="!isDetail"
-                   :on-success="(res) => { OrderForm.attachment = res.url }" :limit="1">
-          <el-button size="mini" type="primary">上传</el-button>
-        </el-upload>
-        <a v-if="OrderForm.attachment" :href="OrderForm.attachment" target="_blank"
-           style="color:#409EFF;font-size:12px">下载附件</a>
-      </el-form-item> -->
-
       <div style="margin-bottom: 10px">
         <h3>商品明细</h3>
         <div v-if="!isDetail">
@@ -191,47 +208,11 @@
             @click="handleSelectGoods"
             >手动选择</el-button
           >
-          <!-- <el-button class="button" size="mini" @click="handleShowUpdateNum" v-if="!showUpdateNum">
-          设置数量
-        </el-button>
-        <span v-else>
-          <el-input style="width: 70px;" @keydown.enter.native="handleConfirmUpdateNum"
-                    ref="batchSetNumRef" v-model="batchUpdateNum"></el-input>
-          <el-button class="button" size="mini" @click="handleCancelUpdateNum">取消</el-button>
-          <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateNum">确认</el-button>
-        </span>
-
-        <el-button class="button" size="mini" @click="handleShowUpdateTaxRate" v-if="!showTaxRate">
-          设置税率
-        </el-button>
-        <span v-else>
-          <el-input style="width: 70px;" @keydown.enter.native="handleConfirmUpdateTaxRate" ref="batchSetTaxRateRef"
-                    v-model="batchTaxRate"></el-input>
-          <el-button class="button" size="mini" @click="handleCancelUpdateTaxRate">取消</el-button>
-          <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateTaxRate">确认</el-button>
-        </span>
-
-        <el-button class="button" size="mini" @click="handleShowUpdateDiscountPrice"
-                   v-if="!showDiscountPrice">设置优惠金额
-        </el-button>
-        <span v-else>
-          <el-input style="width: 170px;" @keydown.enter.native="handleConfirmUpdateDiscountPrice"
-                    ref="batchSetDiscountRef" v-model="batchDiscountPrice">
-            <template #prepend>
-              <el-select v-model="batchDiscountType" style="width: 100px;">
-                <el-option :value="0" label="按百分比"></el-option>
-                <el-option :value="1" label="按金额"></el-option>
-              </el-select>
-            </template>
-          </el-input>
-          <el-button class="button" size="mini" @click="handleCancelUpdateDiscountPrice">取消</el-button>
-          <el-button class="button" size="mini" type="primary" @click="handleConfirmUpdateDiscountPrice">确认</el-button>
-        </span> -->
         </div>
       </div>
       <div style="display: block">
         <el-table
-          :data="OrderForm.item_list"
+          :data="OrderForm.product_list"
           border
           :cell-style="{ textAlign: 'center' }"
           @selection-change="handleSelectionChange"
@@ -271,27 +252,27 @@
           </el-table-column>
           <el-table-column label="订单数量">
             <template slot-scope="scope">
-              {{ scope.row.order }}
-            </template>
-          </el-table-column>
-          <el-table-column label="入库数量">
-            <template slot-scope="scope">
-              {{ scope.row.inventory_num }}
+              <el-input
+                  v-model="scope.row.num"
+                  type="number"
+                  :min="0"
+                  :maxlength="20"
+                ></el-input>
             </template>
           </el-table-column>
           <el-table-column label="库存数量">
             <template slot-scope="scope">
-              {{ scope.row.stock_num }}
+              {{ scope.row.usable_stock }}
             </template>
           </el-table-column>
           <el-table-column label="差异">
             <template slot-scope="scope">
-              {{ scope.row.inventory_num - scope.row.stock_num || 0 }}
+              {{scope.row.usable_stock - scope.row.num  || 0 }}
             </template>
           </el-table-column>
           <!-- <el-table-column label="数量">
           <template slot-scope="scope">
-            <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.num'" :rules="rules.item_list.num" class="tableFormItem">
+            <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.num'" :rules="rules.product_list.num" class="tableFormItem">
               <el-input v-model="scope.row.num" :maxlength="20" :minlength="1"></el-input>
             </el-form-item>
             <span v-else>{{ scope.row.num }}</span>
@@ -299,7 +280,7 @@
         </el-table-column>
         <el-table-column label="单价">
           <template slot-scope="scope">
-            <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.price'" :rules="rules.item_list.price" class="tableFormItem">
+            <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.price'" :rules="rules.product_list.price" class="tableFormItem">
               <el-input v-model="scope.row.price" :maxlength="20" :minlength="1"></el-input>
             </el-form-item>
             <span v-else>{{ scope.row.price }}</span>
@@ -312,7 +293,7 @@
         </el-table-column>
         <el-table-column label="税率">
           <template slot-scope="scope">
-            <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.tax_rate'" :rules="rules.item_list.tax_rate" class="tableFormItem">
+            <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.tax_rate'" :rules="rules.product_list.tax_rate" class="tableFormItem">
               <el-input v-model="scope.row.tax_rate" :maxlength="20"></el-input>
             </el-form-item>
             <span v-else>{{ scope.row.tax_rate }}</span>
@@ -325,7 +306,7 @@
         </el-table-column>
         <el-table-column label="优惠金额">
           <template slot-scope="scope">
-            <el-form-item v-if="!isDetail" :prop="'item_list.'+scope.$index+'.discount_price'" :rules="rules.item_list.discount_price" class="tableFormItem">
+            <el-form-item v-if="!isDetail" :prop="'product_list.'+scope.$index+'.discount_price'" :rules="rules.product_list.discount_price" class="tableFormItem">
               <el-input v-model="scope.row.discount_price"></el-input>
             </el-form-item>
             <span v-else>{{ scope.row.discount_price }}</span>
@@ -347,17 +328,11 @@
               <el-button
                 size="mini"
                 type="danger"
-                @click="OrderForm.item_list.splice(scope.$index, 1)"
+                @click="OrderForm.product_list.splice(scope.$index, 1)"
                 >删除
               </el-button>
             </template>
           </el-table-column>
-          <!-- <div slot="append" style="text-align: right;line-height: 50px;margin-right: 20px;font-size: small">
-          商品金额:{{ OrderForm.total_price.toFixed(2) }} &nbsp;&nbsp;&nbsp;&nbsp;
-          税额:{{ OrderForm.tax_price.toFixed(2) }} &nbsp;&nbsp;&nbsp;&nbsp;
-          优惠金额:{{ OrderForm.discount_price.toFixed(2) }} &nbsp;&nbsp;&nbsp;&nbsp;
-          实付金额:{{ OrderForm.pay_price.toFixed(2) }}
-        </div> -->
         </el-table>
       </div>
       <!-- <div class="mx">
@@ -412,11 +387,61 @@
           :loading="formLoading"
           >保存</el-button
         >
+        <el-button
+          type="primary"
+          @click="saveSubmitOrderForm"
+          v-if="!isDetail"
+          :loading="formLoading"
+          >确认并保存</el-button
+        >
         <!-- <el-button type="primary" :disabled="false" @click="handleAudit(true)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核通过</el-button>
       <el-button type="danger" :disabled="false" @click="handleAudit(false)" v-if="isDetail && checkPermission(['order:audit']) && OrderForm.allowable.audit">审核驳回</el-button> -->
         <el-button @click="roBack()" :disabled="false">返回</el-button>
       </div>
     </el-form>
+    <el-dialog title="添加客户信息" :visible.sync="customer.dialogVisible" width="1100px"
+      @open="handleDialogOpen" :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false">
+      <el-form :model="customer.supplierForm" :rules="customer.supplierRules" ref="supplierForm" label-width="120px" inline>
+         <el-form-item label="联系人姓名" prop="name">
+          <el-input v-model="customer.supplierForm.name" :minlength="2" :maxlength="20" clearable
+            placeholder="请输入联系人"></el-input>
+        </el-form-item>
+        <el-form-item label="性别" prop="gender">
+            <el-radio v-model="customer.supplierForm.gender" label="男">男</el-radio>
+            <el-radio v-model="customer.supplierForm.gender" label="女">女</el-radio>
+        </el-form-item>
+        <el-form-item label="手机号码" prop="mobile">
+                <el-input v-model="customer.supplierForm.mobile" :minlength="2" :maxlength="20" clearable
+                  placeholder="请输入手机号码"></el-input>
+          </el-form-item>
+        <el-form-item label="邮件" prop="email">
+          <el-input v-model="customer.supplierForm.email" :minlength="2" :maxlength="20" clearable
+            placeholder="请输入电子邮件"></el-input>
+        </el-form-item>
+        <el-form-item label="客户类别" prop="type">
+            <el-select v-model="customer.supplierForm.type" placeholder="请选择客户类别">
+              <el-option
+                v-for="item in customer.options"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-input v-model="customer.supplierForm.status" :minlength="2" :maxlength="20" clearable
+            placeholder="请输入客户状态"></el-input>
+        </el-form-item>
+        <el-form-item label="客户联系人" prop="contact ">
+          <el-input v-model="customer.supplierForm.contact " :minlength="2" :maxlength="20" clearable
+            placeholder="请输入客户联系人"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="customer.dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitSupplierForm">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -425,21 +450,20 @@ import { mapGetters } from "vuex";
 import * as API_Order from "@/api/order";
 import * as API_BasicSetting from "@/api/basicSetting";
 import * as API_Member from "@/api/member";
+import * as API_Setting from '@/api/setting'
 import * as API_CollectingAccount from "@/api/collectingAccount";
 import { RegExp } from "~/ui-utils";
-// import { regionData } from 'element-china-area-data'
 import {
   provinceAndCityData,
+  pcTextArr,
   regionData,
-  provinceAndCityDataPlus,
-  regionDataPlus,
-  CodeToText,
-  TextToCode,
+  pcaTextArr,
+  codeToText,
 } from "element-china-area-data";
 import html2canvas from "html2canvas";
 
 const initOrderForm = {
-  item_list: [],
+  product_list: [],
   payment_list: [],
   tax_price: 0,
   total_price: 0,
@@ -456,7 +480,7 @@ export default {
     return {
       brcode: false,
       options: regionData,
-      selectedOptions: [],
+      selectedOptions: [''],
       warehouseList: [], // 仓库列表
       memberList: [], // 会员列表
       marketingList: [], // 销售经理列表
@@ -475,7 +499,13 @@ export default {
       ],
       id: "",
       /** 订单表单*/
-      OrderForm: {},
+      OrderForm: {
+       //省市区地址
+       province_city_area:"",
+        //详细信息
+        address:"",
+        province_city_area_address:"",
+      },
       formLoading: false,
       isDetail: undefined,
       multipleSelection: [], // 勾选的商品
@@ -498,7 +528,7 @@ export default {
         payment_status: [this.MixinRequired("支付状态不能为空", "change")],
         payment_time: [this.MixinRequired("支付时间不能为空", "change")],
         delivery_type: [this.MixinRequired("请选择配送方式", "change")],
-        item_list: {
+        product_list: {
           num: [
             this.MixinRequired("数量不能为空", "change"),
             {
@@ -584,18 +614,73 @@ export default {
       // 客户列表
       customerList: [],
       //
-      orderTypeList: [
-        {
-          label: "商品租赁",
-          value: "商品租赁",
-        },
-        {
-          label: "商品售卖",
-          value: "商品售卖",
-        },
-      ],
+      orderTypeList: [],
       // 条形码
       barcodeValue: "",
+      time:[],
+      //新增客户
+      customer:{
+        dialogVisible:false,
+        supplierRules: {
+        custom_sn: [
+          this.MixinRequired('请输入客户编号!'),
+          { min: 2, max: 20, message: '长度在 2 到 20 个字符' },
+          {
+            validator: (rule, value, callback) => {
+              if (value && !RegExp.userName.test(value)) {
+                callback(new Error('只支持汉字、字母、数字、“-”、“_”的组合!'))
+              } else {
+                callback()
+              }
+            }
+          }
+        ],
+        postal_address: [this.MixinRequired('请输入通讯地址!')],
+        telephone: [
+          this.MixinRequired('请输入联系电话!'),
+          {
+            validator: (rule, value, callback) => {
+              if (!RegExp.mobile.test(value)) {
+                callback(new Error('联系电话格式有误!'))
+              } else {
+                callback()
+              }
+            },
+            trigger: ['change', 'blur']
+          }
+        ],
+        name: [this.MixinRequired('请输入联系人!')],
+        mobile: [
+          this.MixinRequired('请输入手机号码!'),
+          {
+            validator: (rule, value, callback) => {
+              if (!RegExp.mobile.test(value)) {
+                callback(new Error('手机号码格式有误!'))
+              } else {
+                callback()
+              }
+            },
+            trigger: ['change', 'blur']
+          }
+        ],
+        gender:[{required: true, message: '请选择性别', trigger: 'change' }],
+        type:[{ required: true, message: '请选择客户类别', trigger: 'change' }],
+        contact:[{ required: true, message: '请输入客户联系人', trigger: 'blur' }],
+        },
+        supplierForm:{},
+        options:[
+          {
+              value: '全部',
+              label: '全部'
+            },{
+              value: '销售客户',
+              label: '销售客户'
+            }, {
+              value: '租赁客户',
+              label: '租赁客户'
+            },
+          ]
+      }
     };
   },
   computed: {
@@ -611,12 +696,37 @@ export default {
     this.GET_CustomerList();
   },
   methods: {
+    /** dialog打开后重置form表单校验结果 */
+    handleDialogOpen() {
+      setTimeout(() => { this.$refs['supplierForm'].clearValidate() })
+      this.customer.supplierForm={}
+    },
+    submitSupplierForm() {
+      this.$refs['supplierForm'].validate((valid) => {
+        if (valid) {
+          const { id } = this.customer.supplierForm
+          const params = this.MixinClone(this.customer.supplierForm)
+            API_BasicSetting.addCustomer(params).then(() => {
+              this.customer.dialogVisible = false
+              this.$message.success('添加成功!')
+              this.GET_CustomerList()
+            })
+        } else {
+          this.$message.error('表单填写有误,请核对!')
+          return false
+        }
+      })
+    },
+    // 添加客户
+    addCust(){
+      this.customer.dialogVisible=true
+    },
     handleChange(value) {
-      /* var loc = "";
-        for (let i = 0; i < this.selectedOptions.length; i++) {
-            loc += CodeToText[this.selectedOptions[i]];
-        } */
-      console.log(value); //打印区域码所对应的属性值即中文地址
+      this.OrderForm.province_city_area=value.join(",")
+      console.log(this.OrderForm.province_city_area);
+      /**/
+
+       //打印区域码所对应的属性值即中文地址
     },
     /** 初始化 */
     init() {
@@ -637,7 +747,7 @@ export default {
     /** 清除已选商品明细 */
     cleanGoodsList() {
       // 切换仓库需要清除已选对应仓库下的商品数据
-      this.$set(this.OrderForm, "item_list", []);
+      this.$set(this.OrderForm, "product_list", []);
     },
     //获取客户列表
     GET_CustomerList() {
@@ -647,6 +757,9 @@ export default {
           console.log(this.customerList);
         })
         .catch(() => {});
+        API_Setting.getPage({dictType:"order_type"}).then(res=>{
+          this.orderTypeList=res.data
+        })
     },
     /** 获取会员列表 */
     GET_MemberList() {
@@ -704,26 +817,25 @@ export default {
       }
 
       const goodsData = await this.$EnPickerGoods({
-        goodsApi: "/admin/erp/product",
-        selectedIds: this.OrderForm.item_list.map((item) => item.product_id),
+        goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${this.OrderForm.warehouse_id}`,
+        selectedIds: this.OrderForm.product_list.map((item) => item.product_id),
         goodsApiParams: { warehouse_id: this.OrderForm.warehouse_id },
       });
 
-      this.OrderForm.item_list = goodsData.map((item) => {
+      this.OrderForm.product_list = goodsData.map((item) => {
         // 初始化字段,和订单的item字段名保持一致
         item.product_id = item.id;
         item.product_name = item.name;
         item.product_sn = item.sn;
         item.product_specification = item.specification;
         item.product_unit = item.unit;
-        item.num = 1;
+        item.num = 0;
         item.discount_price = 0;
         // 原价(总)
         item.total_price = 0;
         // 税额(总)
         item.tax_price = 0;
         // 合计
-        item.pay_price = 0;
 
         return item;
       });
@@ -822,6 +934,7 @@ export default {
         }
       }
     },
+    //保存订单
     async submitOrderForm() {
       // 校验商品明细数据
       const valid = await this.$refs.orderFormRef
@@ -832,7 +945,25 @@ export default {
         return;
       }
       const { id } = this.OrderForm;
+      //设置时间
+      delete this.OrderForm.start_time;
+      delete this.OrderForm.end_time;
+      if (this.time) {
+        this.OrderForm.start_time = this.time[0]
+        this.OrderForm.end_time = this.time[1]
+      }
+      delete this.time;
+      var loc = "";
+        for (let i = 0; i < this.selectedOptions.length; i++) {
+            loc += codeToText[this.selectedOptions[i]]+',';
+        }
+      this.OrderForm.province_city_area_address=loc+this.OrderForm.address
       const params = this.MixinClone(this.OrderForm);
+      console.log(params);
+      params.item_list=params.product_list
+      /**/ params.product_list.map(el=>{
+        el.goods_id=el.id
+      })
       params.order_time = Math.floor(params.order_time / 1000);
       params.payment_time = Math.floor(params.payment_time / 1000);
       this.formLoading = true;
@@ -856,6 +987,65 @@ export default {
           });
       }
     },
+    //确认并保存订单
+   async saveSubmitOrderForm(){
+       // 校验商品明细数据
+       const valid = await this.$refs.orderFormRef
+        .validate()
+        .catch((err) => err);
+      if (valid !== true) {
+        this.$message.error("表单数据输入有误,请检查!");
+        return;
+      }
+      const { id } = this.OrderForm;
+      //设置时间
+      delete this.OrderForm.start_time;
+      delete this.OrderForm.end_time;
+      if (this.time) {
+        this.OrderForm.start_time = this.time[0]
+        this.OrderForm.end_time = this.time[1]
+      }
+      delete this.time;
+      var loc = "";
+        for (let i = 0; i < this.selectedOptions.length; i++) {
+            loc += codeToText[this.selectedOptions[i]]+',';
+        }
+      this.OrderForm.province_city_area_address=loc+this.OrderForm.address
+      const params = this.MixinClone(this.OrderForm);
+      console.log(params);
+      params.item_list=params.product_list
+      /**/ params.product_list.map(el=>{
+        el.goods_id=el.id
+      })
+      params.order_time = Math.floor(params.order_time / 1000);
+      params.payment_time = Math.floor(params.payment_time / 1000);
+      this.formLoading = true;
+      if (id) {
+        API_Order.editOrder(id, params)
+          .then((response) => {
+            this.$message.success("修改成功!");
+            API_Order.submit(id).then(res=>{
+              this.$message.success("订单已确认")
+              this.backOrderList();
+            })
+          })
+          .finally(() => {
+            this.formLoading = false;
+          });
+      } else {
+        API_Order.addOrder(params)
+          .then(() => {
+            this.$message.success("添加成功!");
+            /* API_Order.submit(id).then(res=>{
+              this.$message.success("订单已确认") }) */
+              this.backOrderList();
+
+          })
+          .finally(() => {
+            this.formLoading = false;
+          });
+      }
+    },
     /** 获取仓库 */
     GET_WarehouseList() {
       API_BasicSetting.getWarehouseListAll({}).then((response) => {
@@ -888,10 +1078,50 @@ export default {
     /** 获取订单详情 */
     GET_OrderDetail() {
       API_Order.getOrderDetail(this.id).then((response) => {
+        response.product_list=response.item_list.map(el=>{
+          el.allow_sn=el.goods_vo.allow_sn
+          el.bar_code=el.goods_vo.bar_code
+          el.brand_id=el.goods_vo.brand_id
+          el.brand_name=el.goods_vo.brand_name
+          el.category_id=el.goods_vo.category_id
+          el.category_ids=el.goods_vo.category_ids
+          el.category_name=el.goods_vo.category_name
+          el.cost_price=el.goods_vo.cost_price
+          el.create_time=el.goods_vo.create_time
+          el.creator=el.goods_vo.creator
+          el.description=el.goods_vo.description
+          el.en_name=el.goods_vo.en_name
+          el.freight_template_id=el.goods_vo.freight_template_id
+          el.goods_style=el.goods_vo.goods_style
+          el.goods_unit=el.goods_vo.goods_unit
+          el.goods_unit=el.goods_vo.goods_unit
+          el.have_spec=el.goods_vo.have_spec
+          el.hire_or_sail=el.goods_vo.hire_or_sail
+          el.id=el.goods_vo.id
+          el.image=el.goods_vo.image
+          el.image_list=el.goods_vo.image_list
+          el.label_names=el.goods_vo.label_names
+          el.market_enable=el.goods_vo.market_enable
+          el.mkt_price=el.goods_vo.mkt_price
+          el.name=el.goods_vo.name
+          el.params_list=el.goods_vo.params_list
+          el.price=el.goods_vo.price
+          el.sn=el.goods_vo.sn
+          el.sn_code=el.goods_vo.sn_code
+          el.sort=el.goods_vo.sort
+          el.update_time=el.goods_vo.update_time
+          el.updater=el.goods_vo.updater
+          el.usable_stock=el.goods_vo.usable_stock
+          el.video=el.goods_vo.video
+          return el
+        })
+
+        this.selectedOptions=response.province_city_area.split(",")
         this.OrderForm = response;
-        this.fileList = response.attachment
+           console.log( this.OrderForm);
+       /*  this.fileList = response.attachment
           ? [{ name: "附件", url: response.attachment }]
-          : [];
+          : []; */
         this.OrderForm.order_time = Math.floor(
           this.OrderForm.order_time * 1000
         );
@@ -904,17 +1134,13 @@ export default {
     },
   },
   watch: {
-    "OrderForm.item_list": {
+    "OrderForm.product_list": {
       deep: true,
       handler(newVal) {
         newVal.forEach((item) => {
-          // 原价(总)
-          item.total_price = item.price * item.num;
           // 税额(总)
           item.tax_price = item.total_price * item.tax_rate * 0.01;
           // 合计
-          item.pay_price =
-            item.total_price + item.tax_price - item.discount_price;
         });
         this.OrderForm.total_price = newVal.reduce(
           (sum, item) => sum + item.total_price,
@@ -924,10 +1150,6 @@ export default {
           (sum, item) => sum + item.discount_price * 1,
           0
         );
-        this.OrderForm.pay_price = newVal.reduce(
-          (sum, item) => sum + item.pay_price,
-          0
-        );
         this.OrderForm.tax_price = newVal.reduce(
           (sum, item) => sum + item.tax_price,
           0
@@ -1031,14 +1253,15 @@ export default {
   }
 }
 .redClass /deep/ .el-form-item__label {
-  color: red !important;
+  //color: red !important;
   font-weight: 700;
+  width: 500px;
 }
 /deep/ .el-form-item {
   width: 100%;
   height: auto;
   .el-input {
-    width: 200px !important;
+    width: 200px;
   }
 }
 </style>

+ 1 - 1
ui-components/PickerGoods/src/defaultOptions.js

@@ -52,6 +52,6 @@ export const data = {
 export const generalColumns = [
   { label: '商品编号', prop: 'sn' },
   { label: '商品名称', prop: 'name' },
-  { label: '规格型号', prop: 'specification' },
+  { label: '规格型号', prop: 'goods_style' },
   { label: '商品类别', prop: 'category_name' }
 ]

+ 7 - 1
ui-components/PickerGoods/src/main.vue

@@ -157,7 +157,13 @@ export default {
         }
       }).then(response => {
         this.loading = false
-        this.purchasePlanData = response
+        if(response.records==undefined){
+          this.purchasePlanData = response
+        }else{
+          response.data=response.records
+          response.data_total=response.total
+          this.purchasePlanData = response
+        } 
       })
     }
   }

+ 10 - 2
ui-components/PickerWarehouseEntryBatch/src/main.vue

@@ -6,7 +6,7 @@
       <div class="purchasePlan-picker__filter">
 				<div class="filter-item" v-if="showWarehouseSearch">
 					仓库:
-					<el-select @change="changeWarehouse" v-model="purchasePlanApiParams.warehouse_id">
+					<el-select disabled  @change="changeWarehouse"  v-model="purchasePlanApiParams.warehouse_id">
 						<el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
 					</el-select>
 				</div>
@@ -71,6 +71,7 @@ export default {
 				warehouse_id: ''
       },
       purchasePlanData: {
+        
         data: [],
         data_total: 0
       },
@@ -182,7 +183,14 @@ export default {
         }
       }).then(response => {
         this.loading = false
-        this.purchasePlanData = response
+        if(response.records==undefined){
+          this.purchasePlanData = response
+        }else{
+          response.data=response.records
+          response.data_total=response.total
+          this.purchasePlanData = response
+          console.log(this.purchasePlanData);
+        } 
       })
     }
   }