Pārlūkot izejas kodu

累计产品 列表删除 批量删除

chenrui 6 mēneši atpakaļ
vecāks
revīzija
567473cb0b

+ 9 - 0
src/api/salesDetailNew.js

@@ -340,3 +340,12 @@ export const accumulatedProductsList = (params) => {
     }
   })
 }
+
+// 删除  批量删除  累计产品
+export const deleteBatchBorrow = (params) => {
+  return axios({
+    url: '/sales/detail/deleteBatchBorrow',
+    method: 'post',
+    data: params
+  })
+}

+ 32 - 3
src/views/salesManagement/salesQueryNew/comps/totalProductDetailModal.vue

@@ -45,6 +45,7 @@
           type="primary"
           id="viewTotalProduct-allbtn"
           style="margin-right:10px;"
+          @click="handleDel()"
         > 批量删除</a-button>
         <span>已选{{ selectTotalInfo.selectNum }}项,数量合计{{ selectTotalInfo.selProductNum }}个,售价合计{{ selectTotalInfo.selTotalPrice }}元</span>
       </div>
@@ -81,7 +82,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
-import { accumulatedProductsList } from '@/api/salesDetailNew'
+import { accumulatedProductsList, deleteBatchBorrow } from '@/api/salesDetailNew'
 export default {
   name: 'TotalProductDetailModal',
   mixins: [commonMixin],
@@ -139,8 +140,8 @@ export default {
       const selectNum = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
       let selProductNum = 0
       let selTotalPrice = 0
-      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys) {
-        this.rowSelectionInfo.selectedRowKeys.forEach(item => {
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
+        this.rowSelectionInfo.selectedRows.forEach(item => {
           selProductNum += item.num
           selTotalPrice += item.price
         })
@@ -170,6 +171,34 @@ export default {
       this.queryParam.targetName = undefined
       this.$refs.table.refresh(true)
       this.$refs.table.clearSelected() // 清空表格选中项
+    },
+    // 删除  批量删除
+    handleDel (row) {
+      const ajaxData = {
+        salesBillSn: this.parameter.salesBillSn,
+        salesBillDetailSnList: []
+      }
+      if (row) {
+        ajaxData.salesBillDetailSnList = [row.salesPromoSn]
+      } else {
+        if (!(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys && this.rowSelectionInfo.selectedRowKeys.length)) {
+          this.$message.warning('请在列表勾选后再进行批量操作!')
+          return
+        }
+        ajaxData.salesBillDetailSnList = this.rowSelectionInfo.selectedRowKeys
+      }
+      this.confirmDel(ajaxData)
+    },
+    // 确定删除
+    confirmDel (ajaxData) {
+      this.spinning = true
+      deleteBatchBorrow(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$message.success('删除成功')
+          this.$refs.table.refresh(true)
+        }
+        this.spinning = false
+      })
     }
   },
   watch: {