lilei пре 2 година
родитељ
комит
b7fc6bdc9c

+ 1 - 1
public/version.json

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

+ 45 - 0
src/api/purchaseCart.js

@@ -0,0 +1,45 @@
+import { axios } from '@/utils/request'
+
+// 购物车列表
+export const purchaseCartList = (params) => {
+  const url = `/purchaseCart/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 添加到购物车
+export const purchaseCartSave = params => {
+  return axios({
+    url: '/purchaseCart/save',
+    data: params,
+    method: 'post'
+  })
+}
+// 购物车已存在的产品
+export const purchaseCartExistProduct = params => {
+  return axios({
+    url: '/purchaseCart/existProduct',
+    data: params,
+    method: 'post'
+  })
+}
+// 批量删除购物车产品
+export const purchaseDeleteBatch = params => {
+  return axios({
+    url: '/purchaseCart/deleteBatch',
+    data: params,
+    method: 'post'
+  })
+}
+// 修改购物车数量
+export const purchaseUpdateQty = params => {
+  return axios({
+    url: '/purchaseCart/updateQty',
+    data: params,
+    method: 'post'
+  })
+}

+ 19 - 4
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -156,7 +156,7 @@
             class="button-primary"
             @click="goWarehouseDetail(record)"
             id="inventoryQueryList-warehouseDetail-btn">出入库明细</a-button>
-          <a-button type="link" @click="addShopCar">加入购物车</a-button>
+          <a-button type="link" @click="addShopCar(record)">加入购物车</a-button>
           <span v-if="!$hasPermissions('B_inventoryInventoryQueryDetail') && !$hasPermissions('B_inventoryInventoryQueryStock')">--</span>
         </template>
       </s-table>
@@ -164,13 +164,14 @@
     <!-- 库存详情 -->
     <inventory-query-detail-modal v-drag :openModal="openModal" :nowData="nowData" @close="closeModal" />
     <!-- 设置采购数量 -->
-    <set-purchase-qty :openModal="openPurchaseModal" @close="openPurchaseModal=false" v-drag></set-purchase-qty>
+    <set-purchase-qty ref="setPurchaseQty" :openModal="openPurchaseModal" @close="openPurchaseModal=false" v-drag></set-purchase-qty>
   </a-card>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { stockList, stockCount, stockExport } from '@/api/stock'
+import { purchaseCartExistProduct } from '@/api/purchaseCart'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import Warehouse from '@/views/common/warehouse.js'
@@ -297,8 +298,22 @@ export default {
     }
   },
   methods: {
-    addShopCar () {
-      this.openPurchaseModal = true
+    // 加入购物车
+    addShopCar (row) {
+      this.spinning = true
+      purchaseCartExistProduct({
+        productSn: row.productSn
+      }).then(res => {
+        if(res.status == 200){
+          if(res.data){
+            this.$message.info("此产品已添加到购物车!")
+          }else{
+            this.$refs.setPurchaseQty.setData(row)
+            this.openPurchaseModal = true
+          }
+        }
+        this.spinning = false
+      })
     },
     // 校验滞销天数数值范围
     checkValueRange () {

+ 35 - 65
src/views/inventoryManagement/inventoryQuery/setPurchaseQty.vue

@@ -17,16 +17,17 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol"
       >
-        <a-form-model-item label="产品名称:" prop="checkType">
-          BBB滤清器
+        <a-form-model-item label="产品名称:">
+          {{dateilData&&dateilData.productName}}
         </a-form-model-item>
-        <a-form-model-item label="产品编码" prop="warehouseFlag">
-          XX-108
+        <a-form-model-item label="产品编码">
+          {{dateilData&&dateilData.productCode}}
         </a-form-model-item>
-        <a-form-model-item label="采购数量" prop="warehouseSnList">
+        <a-form-model-item label="采购数量" prop="qty">
           <a-input-number
             id="shelfMonitoringList-maxUnsalableDays"
-            v-model="formItemLayout.warehouseSnList"
+            style="width:60%"
+            v-model="form.qty"
             :precision="0"
             :min="0"
             :max="999999"
@@ -43,11 +44,9 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { VSelect } from '@/components'
-import { checkWarehouseSave, checkWarehouseWarehouse } from '@/api/checkWarehouse'
+import { purchaseCartSave } from '@/api/purchaseCart'
 export default {
   name: 'ChainTransferOutBasicInfoModal',
-  components: { VSelect },
   mixins: [commonMixin],
   props: {
     openModal: {
@@ -65,78 +64,49 @@ export default {
         wrapperCol: { span: 20 }
       },
       form: {
-        checkType: 'ALL',
-        warehouseFlag: '0',
-        warehouseSnList: undefined
+        qty: 1,
+        productSn:'',
+        productCode: '',
+        sysFlag: ''
       },
       rules: {
-        checkType: [{ required: true, message: '请选择盘点类型', trigger: 'change' }],
-        warehouseFlag: [{ required: true, message: '请选择是否区分仓库', trigger: 'change' }],
-        warehouseSnList: [{ required: true, message: '请选择盘点仓库', trigger: 'change' }]
+        qty: [{ required: true, message: '请输入采购数量', trigger: 'change' }],
       },
-      checkTypeList: [
-        { dispName: '全盘', code: 'ALL' },
-        { dispName: '自选盘点', code: 'SELECT' }
-      ],
-      warehouseFlagList: [
-        { dispName: '不区分仓库', code: '0' },
-        { dispName: '区分仓库', code: '1' }
-      ],
-      warehouseList: []
+      dateilData: null
     }
   },
   methods: {
+    setData(row){
+      this.dateilData = row
+      this.form.productSn = row.productSn
+      this.form.productCode = row.productCode
+      this.form.sysFlag = row.dealerProduct.sysFlag
+      this.form.qty = 1
+    },
     //  保存
     handleSave () {
       const _this = this
-      _this.$emit('close')
-      _this.$router.push({ name: 'shoppingCarList', params: { type: 'pageBtn' } })
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
-
-          // const form = JSON.parse(JSON.stringify(_this.form))
-          // if (form.checkType == 'ALL') {
-          //   delete form.warehouseFlag
-          // }
-          // if (form.warehouseSnList) {
-          //   form.warehouseSnList = form.warehouseSnList.join(',')
-          // }
-          // _this.spinning = true
-          // checkWarehouseSave(form).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     setTimeout(() => {
-          //       _this.isShow = false
-          //       _this.$emit('ok', res.data)
-          //       _this.spinning = false
-          //     }, 1000)
-          //   } else {
-          //     _this.spinning = false
-          //   }
-          // })
+          const form = JSON.parse(JSON.stringify(_this.form))
+          _this.spinning = true
+          purchaseCartSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              setTimeout(() => {
+                _this.isShow = false
+                _this.$emit('ok', res.data)
+                _this.spinning = false
+              }, 1000)
+            } else {
+              _this.spinning = false
+            }
+          })
         } else {
-          console.log('error submit!!')
           return false
         }
       })
     },
-    checkTypeChange (e) {
-      this.form.warehouseFlag = '0'
-      this.form.warehouseSnList = undefined
-    },
-    warehouseFlagChange (e) {
-      this.form.warehouseSnList = undefined
-    },
-    // 获取仓库列表
-    getWarehouseList () {
-      checkWarehouseWarehouse({}).then(res => {
-        if (res.status == 200) {
-          this.warehouseList = res.data || []
-        } else {
-          this.warehouseList = []
-        }
-      })
-    }
   },
   watch: {
     //  父页面传过来的弹框状态

+ 24 - 2
src/views/inventoryManagement/inventoryWarning/list.vue

@@ -166,7 +166,7 @@
             class="button-primary"
             @click="handleSave(record)"
             id="inventoryWarningList-add-btn">保存</a-button>
-          <a-button type="link">加入购物车</a-button>
+          <a-button type="link" @click="addShopCar(record)">加入购物车</a-button>
           <span v-if="!$hasPermissions('B_inventoryWarningSave')">--</span>
         </template>
       </s-table>
@@ -174,6 +174,8 @@
 
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" @close="openGuideModal=false" @ok="resetSearchForm" />
+    <!-- 设置采购数量 -->
+    <set-purchase-qty ref="setPurchaseQty" :openModal="openPurchaseModal" @close="openPurchaseModal=false" v-drag></set-purchase-qty>
   </a-card>
 </template>
 
@@ -181,18 +183,21 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { stockWarnList, stockWarnSaveBatch, stockWarnExport } from '@/api/stockWarn'
+import { purchaseCartExistProduct } from '@/api/purchaseCart'
 import { downloadExcel } from '@/libs/JGPrint.js'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import importGuideModal from './importGuideModal.vue'
+import setPurchaseQty from '@/views/inventoryManagement/inventoryQuery/setPurchaseQty.vue'
 export default {
   name: 'InventoryWarningList',
-  components: { STable, VSelect, ProductType, ProductBrand, importGuideModal },
+  components: { STable, VSelect, ProductType, ProductBrand, importGuideModal, setPurchaseQty },
   mixins: [commonMixin],
   data () {
     return {
       spinning: false,
       openGuideModal: false,
+      openPurchaseModal: false,
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
@@ -256,6 +261,23 @@ export default {
     }
   },
   methods: {
+    // 加入购物车
+    addShopCar (row) {
+      this.spinning = true
+      purchaseCartExistProduct({
+        productSn: row.productSn
+      }).then(res => {
+        if(res.status == 200){
+          if(res.data){
+            this.$message.info("此产品已添加到购物车!")
+          }else{
+            this.$refs.setPurchaseQty.setData(row)
+            this.openPurchaseModal = true
+          }
+        }
+        this.spinning = false
+      })
+    },
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null

+ 65 - 24
src/views/shoppingCarManagement/shoppingCar/list.vue

@@ -25,7 +25,18 @@
               </a-select>
             </a-form-item>
           </a-col>
-          <a-col flex="auto">
+          <a-col flex="250px" v-if="modes=='pages'">
+            <a-form-item label="产品状态">
+              <v-select
+                code="ONLINE_FLAG2"
+                id="productPricingList-onlineFalg"
+                v-model="queryParam.onlineFalg"
+                allowClear
+                placeholder="请选择产品状态"
+              ></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col flex="auto" style="margin-bottom:10px;">
             <a-button type="primary" @click="searchForm" :disabled="disabled" id="shoppingCar-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shoppingCar-reset">重置</a-button>
           </a-col>
@@ -35,10 +46,10 @@
       <div class="table-operator">
         <a-row :gutter="16">
           <a-col class="gutter-row" :span="24">
-            <a-button type="primary" ghost v-if="modes=='pages'" @click="deleteMore">
+            <a-button type="primary" :loading="loading" ghost v-if="modes=='pages'" @click="deleteMore">
               批量删除
             </a-button>
-            <a-button type="primary" ghost v-if="modes=='modals'" @click="addMore">
+            <a-button type="primary" :loading="loading" ghost v-if="modes=='modals'" @click="addMore">
               批量添加
             </a-button>
             <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys">已选 {{ rowSelectionInfo.selectedRowKeys.length }} 项</span>
@@ -52,7 +63,7 @@
       ref="table"
       :style="{ height: tableHeight+84.5+'px' }"
       size="small"
-      :row-selection="{ columnWidth: 40 }"
+      :row-selection="modes=='pages'?{ columnWidth: 40 }:{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: !record.productEntity.purchasePrice } }) }"
       @rowSelection="rowSelectionFun"
       rowKeyName="productSn"
       :rowKey="(record) => record.productSn"
@@ -63,7 +74,21 @@
       bordered>
       <!-- 采购数量 -->
       <template slot="purchaseQty" slot-scope="text, record">
-        <a-input placeholder="请输入采购数量" v-model="record.qty"/>
+        <a-input placeholder="请输入采购数量" v-model="record.qty" @change="updateQty(record)"/>
+      </template>
+      <!-- 包装数 -->
+      <template slot="baozh" slot-scope="text, record">
+        {{ record.productEntity.packQty||'--' }}/{{ record.productEntity.packQtyUnit||'--' }}
+      </template>
+      <!-- 产品编码 -->
+      <template slot="productCode" slot-scope="text, record">
+        <div v-if="modes=='pages'">
+          <span style="padding-right: 15px;">{{ text }}</span> 
+          <a-tag v-if="record.onlineFalg == 0">下架</a-tag>
+        </div>
+        <div v-else>
+          
+        </div>
       </template>
     </s-table>
   </a-card>
@@ -71,13 +96,13 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { productList, getCurrentDealer, productUpdate } from '@/api/product'
+import { purchaseCartList, purchaseDeleteBatch, purchaseUpdateQty } from '@/api/purchaseCart'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
-import { STable } from '@/components'
+import { STable, VSelect } from '@/components'
 export default {
   name: 'ShoppingCarList',
-  components: { STable, ProductType, ProductBrand },
+  components: { STable, VSelect, ProductType, ProductBrand },
   mixins: [commonMixin],
   props:{
     modes:{
@@ -87,6 +112,7 @@ export default {
   },
   data () {
     return {
+      loading: false,
       tableHeight: 0,
       productType: [],
       queryParam: { //  查询条件
@@ -95,26 +121,24 @@ export default {
         productBrandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品一级分类
         productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
+        productTypeSn3: '' ,//  产品三级分类
+        onlineFalg: undefined
       },
       openEditPriceModal: false, // 自定义报价弹窗
-      iconShowFlag: false, // 列表配置图标显示
       disabled: false, //  查询、重置按钮是否可操作
-      exportLoading: false, // 导出loading
-      dateFormat: 'YYYY-MM-DD',
       columns: [],
-      chooseShowList: ['A', 'B', 'C', 'D', 'E'],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return productList(Object.assign(parameter, this.queryParam)).then(res => {
+        return purchaseCartList(Object.assign(parameter, {productEntity:this.queryParam})).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              data.list[i].qtyBack = data.list[i].qty
             }
             this.disabled = false
           }
@@ -122,9 +146,6 @@ export default {
           return data
         })
       },
-      openModal: false, //  查看客户详情  弹框
-      itemId: '', //  当前产品id
-      productTypeList: [], //  分类下拉数据
       rowSelectionInfo: null,
     }
   },
@@ -151,12 +172,12 @@ export default {
     getColumns () {
       const _this = this
       this.columns = [
-        { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '可用库存数量', dataIndex: 'carOwnersPrice', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '成本价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '单位', dataIndex: 'origCode', width: '8%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
-        { title: '包装数', dataIndex: 'terminalPrice', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品编码', dataIndex: 'productEntity.code',scopedSlots: { customRender: 'productCode' }, width: '15%', align: 'center' },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '可用库存数量', dataIndex: 'currentStockQty', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本价', dataIndex: 'productEntity.purchasePrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '单位', dataIndex: 'productEntity.unit', width: '8%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
+        { title: '包装数',scopedSlots: { customRender: 'baozh' }, dataIndex: 'productEntity.packQty', width: '8%', align: 'center' },
         { title: '采购数量', scopedSlots: { customRender: 'purchaseQty' }, width: '15%', align: 'center' }
       ]
     },
@@ -170,6 +191,17 @@ export default {
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
     },
+    // 修改数量
+    updateQty(row){
+      purchaseUpdateQty({qty: row.qty, purchaseCartSn: row.purchaseCartSn}).then(res => {
+        if(res.status == 200){
+          this.$message.info(res.message)
+          row.qtyBack = row.qty
+        }else{
+          row.qty = row.qtyBack
+        }
+      })
+    },
     // 批量删除
     deleteMore () {
       const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
@@ -182,7 +214,16 @@ export default {
         content: '您已经选择'+rows.length+'个产品,确认要将已选产品从购物车中移除吗?',
         centered: true,
         onOk: () => {
-          console.log('确定删除')
+          this.loading = true
+          purchaseDeleteBatch({
+            productSnList: rows
+          }).then(res => {
+            if(res.status == 200){
+              this.$message.info(res.message)
+              this.searchForm()
+            }
+            this.loading = false
+          })
         }
       })
     },

+ 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.183:8503/qpls-md',
-        target: 'http://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.0.216:8503/qpls-md',
+        // target: 'http://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,