Explorar o código

购物车加入采购单

lilei %!s(int64=2) %!d(string=hai) anos
pai
achega
bb5542ae92

+ 1 - 1
public/version.json

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

+ 2 - 2
src/api/purchaseDetail.js

@@ -63,7 +63,7 @@ export const purchaseDetailCancelList = (params) => {
     method: 'post'
   })
 }
-//  采购 详情 上次缺货 列表 分页
+//  采购 详情 上次缺货 购物车 保存
 export const purchaseDetailCancelSave = (params) => {
   return axios({
     url: '/purchaseDetail/saveCancelProduct',
@@ -79,4 +79,4 @@ export const purchaseDetailDownloadFail = params => {
     data: params,
     responseType: 'blob'
   })
-}
+}

+ 3 - 4
src/views/common/shopingCatModal.vue

@@ -12,7 +12,7 @@
        <strong>{{title}}</strong>
        <span style="color:red;margin-left:10px;">注意:仅可添加本供应商有经销权且总部已上线的产品</span>
      </div>
-     <shopingCat ref="shopingCat" modes="modals" @add="handleAdd"></shopingCat>
+     <shopingCat ref="shopingCat" modes="modals" @ok="handleok"></shopingCat>
   </a-drawer>
 </template>
 
@@ -62,9 +62,8 @@ export default {
     onClose () {
       this.$emit('close')
     },
-    handleAdd (record) {
-      this.spinning = true
-      this.$emit('add', record, 0)
+    handleok () {
+      this.$emit('ok')
     },
   }
 }

+ 3 - 2
src/views/purchasingManagement/purchaseOrderNew/edit.vue

@@ -53,7 +53,7 @@
       <!-- 上次缺货 -->
       <outStockModal :openModal="openOutStockModal" :paramsData="paramsData" @close="openOutStockModal=false" @ok="hanldeOkOutStock" />
       <!-- 购物车 -->
-      <shopingCatModal :showModal="openShopCatModal" :paramsData="paramsData" @close="openShopCatModal=false"></shopingCatModal>
+      <shopingCatModal :showModal="openShopCatModal" :paramsData="paramsData" @close="openShopCatModal=false" @ok="resetPurchaseForm"></shopingCatModal>
       <!-- 已选产品 -->
       <div>
         <div class="chooseBox-title">
@@ -388,7 +388,8 @@ export default {
     // 打开购物车
     hanldCart(){
       this.paramsData = {
-        purchaseBillSn: this.$route.params.sn
+        purchaseBillSn: this.$route.params.sn,
+        purchaseBillNo: this.detail && this.detail.purchaseBillNo ? this.detail.purchaseBillNo : undefined
       }
       this.openShopCatModal=true
     },

+ 16 - 10
src/views/purchasingManagement/purchaseOrderNew/outStockModal.vue

@@ -180,18 +180,29 @@ export default {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
+      const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+      const list = []
+      rows.map(item => {
+        list.push({
+          cancelQty: item.cancelQty,
+          qty: item.qty,
+          productSn: item.productSn,
+          price: item.price
+        })
+      })
+      
       const params = {
         confirm: false,
         purchaseBillSn: this.paramsData.purchaseBillSn,
         purchaseBillNo: this.paramsData.purchaseBillNo,
-        purchaseBillDetailEntityList: this.rowSelectionInfo && this.rowSelectionInfo.selectedRows
+        purchaseBillDetailEntityList: list
       }
       purchaseDetailCancelSave(params).then(res => {
         if (res.status == 200 && res.data) {
           let content = ''
           if ((res.data.productSizeRepeat != res.data.productSize) && (res.data.productSizeRepeat != 0)) {
             content = `您已经选择 ${res.data.productSize} 个产品,其中 ${res.data.productSizeRepeat} 个产品已经存在于采购单中。本次只会加入不重复的产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content)
+            this.confirmFun(content,params)
           } else if (res.data.productSizeRepeat == res.data.productSize) {
             content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
             this.$info({
@@ -206,12 +217,12 @@ export default {
             })
           } else {
             content = `您已经选择 ${res.data.productSize} 个产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content)
+            this.confirmFun(content,params)
           }
         }
       })
     },
-    confirmFun (content) {
+    confirmFun (content,params) {
       const _this = this
       this.$confirm({
         title: '提示',
@@ -223,12 +234,7 @@ export default {
         zIndex: 1100,
         onOk () {
           _this.spinning = true
-          const params = {
-            confirm: true,
-            purchaseBillSn: _this.paramsData.purchaseBillSn,
-            purchaseBillNo: _this.paramsData.purchaseBillNo,
-            purchaseBillDetailEntityList: _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows
-          }
+          params.confirm = true
           purchaseDetailCancelSave(params).then(res => {
             if (res.status == 200) {
               _this.$emit('ok')

+ 66 - 4
src/views/shoppingCarManagement/shoppingCar/list.vue

@@ -100,6 +100,7 @@
 import { commonMixin } from '@/utils/mixin'
 import { mapActions } from 'vuex'
 import { purchaseCartList, purchaseDeleteBatch, purchaseUpdateQty } from '@/api/purchaseCart'
+import { purchaseDetailCancelSave } from '@/api/purchaseDetail'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import { STable, VSelect } from '@/components'
@@ -234,23 +235,84 @@ export default {
         }
       })
     },
-    // 批量添加
+    // 保存
     addMore () {
+      const _this = this
       const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
       if (!this.rowSelectionInfo || (rows.length <= 0)) {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
+      const rowsList = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
+      const list = []
+      rowsList.map(item => {
+        list.push({
+          cancelQty: item.qty,
+          qty: item.qty,
+          productSn: item.productSn,
+          price: item.purchasePrice
+        })
+      })
+      const params = {
+        confirm: false,
+        purchaseBillSn: this.paramsData.purchaseBillSn,
+        purchaseBillNo: this.paramsData.purchaseBillNo,
+        purchaseBillDetailEntityList: list,
+        purchaseCartFlag: true
+      }
+      purchaseDetailCancelSave(params).then(res => {
+        if (res.status == 200 && res.data) {
+          let content = ''
+          if ((res.data.productSizeRepeat != res.data.productSize) && (res.data.productSizeRepeat != 0)) {
+            content = `您已经选择 ${res.data.productSize} 个产品,其中 ${res.data.productSizeRepeat} 个产品已经存在于采购单中。本次只会加入不重复的产品,上次采购数量将作为本次采购数量。确认加入本次采购吗?`
+            this.confirmFun(content,params)
+          } else if (res.data.productSizeRepeat == res.data.productSize) {
+            content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
+            this.$info({
+              title: '提示',
+              content: content,
+              okText: '好的',
+              centered: true,
+              zIndex: 1100,
+              onOk () {
+                _this.$refs.table.clearSelected() // 清空表格选中项
+              }
+            })
+          } else {
+            content = `您已经选择 ${res.data.productSize} 个产品,上次采购数量将作为本次采购数量。确认加入本次采购吗?`
+            this.confirmFun(content,params)
+          }
+        }
+      })
+    },
+    confirmFun (content,params) {
+      const _this = this
       this.$confirm({
         title: '提示',
-        content: '确定批量添加吗?',
+        content: content,
+        okText: '确认加入',
+        cancelText: '重新选择',
         centered: true,
-        onOk: () => {
+        closable: true,
+        zIndex: 1100,
+        onOk () {
+          _this.loading = true
+          params.confirm = true
+          purchaseDetailCancelSave(params).then(res => {
+            if (res.status == 200) {
+              _this.$emit('ok')
+              _this.loading = false
+            } else {
+              _this.loading = false
+            }
+          })
+        },
+        onCancel () {
+          _this.$refs.table.clearSelected() // 清空表格选中项
         }
       })
     },
     pageInit (paramsData) {
-      const _this = this
       this.paramsData = paramsData || {}
       this.setTableH()
       this.getColumns()

+ 2 - 2
vue.config.js

@@ -211,8 +211,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.0.216:8503/qpls-md',
-        target: 'http://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.0.183:8503/qpls-md',
+        // target: 'http://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,