Browse Source

批量添加货架产品

lilei 2 năm trước cách đây
mục cha
commit
bd2e7af88f

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1668071823005
+  "version": 1668073820752
 }

+ 8 - 0
src/api/salesDetail.js

@@ -19,6 +19,14 @@ export const salesDetailInsert = (params) => {
     method: 'post'
   })
 }
+// 批量新增
+export const salesDetailInsertBatch = (params) => {
+  return axios({
+    url: '/salesDetail/insertBatch',
+    data: params,
+    method: 'post'
+  })
+}
 //  销售详情 修改价格
 export const salesDetailUpdatePrice = (params) => {
   return axios({

+ 22 - 8
src/views/salesManagement/salesQuery/chooseShelfProduct.vue

@@ -19,7 +19,7 @@
               layout="inline"
               :model="queryParam"
               @keyup.enter.native="$refs.table.refresh(true)" >
-              <a-row :gutter="5">
+              <a-row :gutter="15">
                 <a-col :md="4" :sm="24">
                   <a-form-model-item label="产品编码">
                     <a-input id="chooseShelf-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
@@ -30,7 +30,7 @@
                     <a-input id="chooseShelf-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品分类">
                     <ProductType id="chooseShelf-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
                   </a-form-model-item>
@@ -40,7 +40,7 @@
                     <a-checkbox-group v-model.trim="queryParam.stockStateList" :options="options" />
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="6" :sm="12" style="margin-bottom: 10px;">
+                <a-col :md="4" :sm="12" style="margin-bottom: 10px;">
                   <a-button type="primary" @click="$refs.table.refresh(true)" id="chooseShelf-refresh">查询</a-button>
                   <a-button style="margin-left: 5px" @click="resetSearchForm" id="chooseShelf-reset">重置</a-button>
                 </a-col>
@@ -50,7 +50,7 @@
           <div class="chooseShelf-modal-table">
             <div class="table-operator">
               <div>
-                <a-button type="primary">批量添加</a-button>
+                <a-button type="primary" @click="handlePlAdd">批量添加</a-button>
                 <span style="margin-left: 10px;" v-if="selectTotal">已选{{ selectTotal }}项</span>
               </div>
               <div>
@@ -129,18 +129,18 @@
               layout="inline"
               :model="queryParam1"
               @keyup.enter.native="$refs.table1.refresh(true)" >
-              <a-row :gutter="5">
-                <a-col :md="4" :sm="24">
+              <a-row :gutter="15">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品编码">
                     <a-input id="chooseShelf-code1" v-model.trim="queryParam1.productCode" allowClear placeholder="请输入产品编码"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品名称">
                     <a-input id="chooseShelf-name1" v-model.trim="queryParam1.productName" allowClear placeholder="请输入产品名称"/>
                   </a-form-model-item>
                 </a-col>
-                <a-col :md="4" :sm="24">
+                <a-col :md="6" :sm="24">
                   <a-form-model-item label="产品分类">
                     <ProductType id="chooseShelf-productType1" :isDealer="true" @change="changeProductType1" v-model="productType1"></ProductType>
                   </a-form-model-item>
@@ -334,9 +334,18 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
+    // 添加
     handleAdd (row) {
       this.$emit('add', row)
     },
+    // 批量添加
+    handlePlAdd () {
+      if (this.selectTotal) {
+        this.$emit('plAdd', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || [])
+      } else {
+        this.$message.info('请选择产品')
+      }
+    },
     resetSearchForm () {
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
@@ -346,8 +355,13 @@ export default {
       this.productType = []
       this.queryParam.stockStateList = []
       this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearSelected()
       this.$refs.table.refresh(true)
     },
+    reload () {
+      this.$refs.table.clearSelected()
+      this.$refs.table.refresh()
+    },
     // ---------- 全部产品----------
     //  产品分类  change
     changeProductType1 (val, opt) {

+ 31 - 1
src/views/salesManagement/salesQuery/edit.vue

@@ -218,6 +218,7 @@
       v-if="showShelfModal"
       ref="chooseShelfProduct"
       @add="insterProduct"
+      @plAdd="plInsterProduct"
       :baseData="shelfInfo"
       :openModal="showShelfModal"
       @close="showShelfModal=false"></chooseShelfProduct>
@@ -234,7 +235,7 @@ import settleModal from '@/views/financialManagement/settleModal/settleModal.vue
 import { stockByProductSn } from '@/api/stock'
 import { queryByCustomerSn } from '@/api/shelf'
 import { salesDetail, salesWriteSubmit, salesWriteDiscount, salesDetailPrint, salesDetailExport, salesDel } from '@/api/sales'
-import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport } from '@/api/salesDetail'
+import { salesDetailList, salesDetailInsert, salesDetailInsertBatch, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport } from '@/api/salesDetail'
 import outInDetialModal from '@/views/common/outInDetialModal.vue'
 import chooseShelfProduct from './chooseShelfProduct.vue'
 import Print from '@/views/common/print.vue'
@@ -653,11 +654,40 @@ export default {
           // this.resetSearchForm(true)  //  不刷新库存
           this.$refs.table.refresh(true)
           this.getOrderDetail(false)
+          if (this.showShelfModal) {
+            this.$refs.chooseShelfProduct.reload()
+          }
         }
         this.isInster = false
         // this.spinning = false
       })
     },
+    // 批量添加接口
+    plInsterProduct (list) {
+      const params = []
+      list.map(item => {
+        params.push({
+          buyerSn: this.detailData.buyerSn,
+          productSn: item.productSn,
+          cost: item.putCost,
+          price: item.price,
+          qty: item.salesNums,
+          salesBillSn: this.detailData.salesBillSn,
+          salesBillNo: this.detailData.salesBillNo,
+          stockSn: item.stockSn
+        })
+      })
+      this.$message.loading('正在批量添加产品...', 1)
+      salesDetailInsertBatch(params).then(res => {
+        if (res.status == 200) {
+          this.$refs.table.refresh(true)
+          this.getOrderDetail(false)
+          if (this.showShelfModal) {
+            this.$refs.chooseShelfProduct.reload()
+          }
+        }
+      })
+    },
     //  销售单详情
     getOrderDetail (flag) {
       salesDetail({ id: this.$route.params.id }).then(res => {