From b66ab07d3a9b2859e34ebb0ef2f86906f898e0e2 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 14:10:29 +0800 Subject: [PATCH 1/5] Add batch set price modal --- .../info/components/BatchSetPriceModal.vue | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/views/product/info/components/BatchSetPriceModal.vue diff --git a/src/views/product/info/components/BatchSetPriceModal.vue b/src/views/product/info/components/BatchSetPriceModal.vue new file mode 100644 index 0000000..1ee0fdc --- /dev/null +++ b/src/views/product/info/components/BatchSetPriceModal.vue @@ -0,0 +1,122 @@ + + + + + \ No newline at end of file From 2b5ac7160f278d6d017604990ab2c4cb5100f1be Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 14:10:52 +0800 Subject: [PATCH 2/5] Integrated bulk pricing module --- .../info/components/ProductInfoModal.vue | 60 +++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/views/product/info/components/ProductInfoModal.vue b/src/views/product/info/components/ProductInfoModal.vue index 8f4b0f1..572bc46 100644 --- a/src/views/product/info/components/ProductInfoModal.vue +++ b/src/views/product/info/components/ProductInfoModal.vue @@ -204,10 +204,10 @@ + 插入一行 删除选中行 - 采购价-批量 - 零售价-批量 - 销售价-批量 - 最低售价-批量 + 采购价-批量 + 零售价-批量 + 销售价-批量 + 最低售价-批量 @@ -273,6 +273,7 @@ 最低安全库存-批量 最高安全库存-批量 + @@ -338,6 +339,8 @@ import {DefaultOptionType} from "ant-design-vue/es/vc-tree-select/TreeSelect"; import {ProductAttributeListReq} from "@/api/product/model/productAttributeModel" import {getBarCode} from "@/api/product/product" import {getAttributeList, getAttributeById} from "@/api/product/productAttribute" +import {useMessage} from "@/hooks/web/useMessage"; +import BatchSetPriceModal from "@/views/product/info/components/BatchSetPriceModal.vue"; export default { name: 'ProductInfoModal', @@ -345,7 +348,7 @@ export default { components: { 'a-modal': Modal, 'a-upload': Upload, - 'a-a-button': Button, + 'a-button': Button, 'a-spin': Spin, 'a-row': Row, 'a-col': Col, @@ -361,8 +364,10 @@ export default { 'a-tabs': Tabs, 'a-tab-pane': TabPane, 'a-table': Table, + BatchSetPriceModal, }, setup(_, context) { + const { createMessage } = useMessage(); const productStandard = ref(''); const productName = ref(''); const confirmLoading = ref(false); @@ -387,6 +392,8 @@ export default { const skuTwo = reactive([]); const skuThree = reactive([]); + const priceModalForm = ref(null); + onMounted(() => { // 在组件初始化加载时调用请求接口的方法 // loadUnitListData(); @@ -715,7 +722,6 @@ export default { meTable.dataSource.forEach(row => { edit(row.key); }); - console.info(meTable.dataSource); } } }) @@ -733,8 +739,6 @@ export default { productAttributeList.value[i].disabled = true } } - - }); async function onManySkuChange(value) { @@ -777,11 +781,45 @@ export default { } } + function batchSetPrice(type) { + if(manySkuSelected.value > 0) { + priceModalForm.value.add(type); + priceModalForm.value.openPriceModal = true; + } else { + createMessage.warn('抱歉,您还没有选择多属性,开启多属性后才能批量设置金额'); + } + } function batchSetStock(type) { - } + function batchSetPriceModalFormOk(price, batchType) { + if(meTable.dataSource.length === 0) { + createMessage.warn('请先录入条码、单位等信息!'); + return; + } + if (batchType === 'purchase') { + for (let i = 0; i < meTable.dataSource.length; i++) { + meTable.dataSource[i].purchasePrice = price + } + } else if (batchType === 'retail') { + for (let i = 0; i < meTable.dataSource.length; i++) { + meTable.dataSource[i].retailPrice = price + } + } else if (batchType === 'sale') { + for (let i = 0; i < meTable.dataSource.length; i++) { + meTable.dataSource[i].salesPrice = price + } + } else if (batchType === 'low') { + for (let i = 0; i < meTable.dataSource.length; i++) { + meTable.dataSource[i].lowSalesPrice = price + } + } + meTable.dataSource.forEach(row => { + edit(row.key); + }); + + } const editableData = reactive({}); @@ -806,7 +844,6 @@ export default { const edit = (key) => { const rowData = meTable.dataSource.find(item => item.key === key); if (rowData) { - console.info("能不能修改key: " + key) editableData[key] = cloneDeep(rowData); } }; @@ -898,6 +935,9 @@ export default { productStandard, productName, unit, + batchSetPrice, + priceModalForm, + batchSetPriceModalFormOk }; }, } From b80f7ed409d429aabc05c7c74a67c0129992e0d5 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 17:35:57 +0800 Subject: [PATCH 3/5] Add batch set stock modal --- .../info/components/BatchSetStockModal.vue | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/views/product/info/components/BatchSetStockModal.vue diff --git a/src/views/product/info/components/BatchSetStockModal.vue b/src/views/product/info/components/BatchSetStockModal.vue new file mode 100644 index 0000000..d21b083 --- /dev/null +++ b/src/views/product/info/components/BatchSetStockModal.vue @@ -0,0 +1,107 @@ + + + + + \ No newline at end of file From 96d460876a2e4951178279fafd59ecb85a6d8cd4 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 17:36:07 +0800 Subject: [PATCH 4/5] Add product stock api --- src/api/product/model/productModel.ts | 8 ++++++++ src/api/product/product.ts | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/api/product/model/productModel.ts diff --git a/src/api/product/model/productModel.ts b/src/api/product/model/productModel.ts new file mode 100644 index 0000000..c1ac52d --- /dev/null +++ b/src/api/product/model/productModel.ts @@ -0,0 +1,8 @@ +export interface ProductStockResp { + id: number | string; + warehouseId: number | string; + warehouseName: string; + initStockQuantity: number; + lowStockQuantity: number; + highStockQuantity: number; +} \ No newline at end of file diff --git a/src/api/product/product.ts b/src/api/product/product.ts index 8d6736a..6cfe136 100644 --- a/src/api/product/product.ts +++ b/src/api/product/product.ts @@ -1,9 +1,10 @@ import {defHttp} from '/@/utils/http/axios'; -import { ErrorMessageMode } from '/#/axios'; import {BaseDataResp} from "@/api/model/baseModel"; +import {ProductStockResp} from "@/api/product/model/productModel"; enum Api { getBarCode = '/product/getBarCode', + getStock = '/product/getStock', } export function getBarCode() { @@ -12,4 +13,12 @@ export function getBarCode() { url: Api.getBarCode, } ); +} + +export function getStock() { + return defHttp.get>( + { + url: Api.getStock, + } + ); } \ No newline at end of file From 2472ffd33c72441669d81da7c857a98ebebf1614 Mon Sep 17 00:00:00 2001 From: jameszow Date: Fri, 20 Oct 2023 17:36:26 +0800 Subject: [PATCH 5/5] Add stock reactive data and views --- .../info/components/ProductInfoModal.vue | 130 ++++++++++++++++-- 1 file changed, 120 insertions(+), 10 deletions(-) diff --git a/src/views/product/info/components/ProductInfoModal.vue b/src/views/product/info/components/ProductInfoModal.vue index 572bc46..c808bea 100644 --- a/src/views/product/info/components/ProductInfoModal.vue +++ b/src/views/product/info/components/ProductInfoModal.vue @@ -212,8 +212,7 @@
-
+ @@ -268,12 +268,30 @@
- - + + + + + + + @@ -313,7 +331,7 @@