From bc1aa23f176547840a8835ea88c503c950d11584 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Tue, 27 Aug 2024 12:29:58 +0800
Subject: [PATCH] 1
---
src/api/store_branch_product_attr_value.ts | 48 +++++++
src/api/store_product_attr_value.ts | 26 ++++
src/api/system_store.ts | 7 +-
.../store/store_branch_product/details.vue | 125 +++++++++++++-----
.../store/store_branch_product/index.vue | 16 +++
src/views/store/store_product/details.vue | 30 -----
src/views/store/store_product/details11.vue | 6 +-
src/views/store/store_product/edit11.vue | 58 ++------
8 files changed, 197 insertions(+), 119 deletions(-)
create mode 100644 src/api/store_branch_product_attr_value.ts
create mode 100644 src/api/store_product_attr_value.ts
diff --git a/src/api/store_branch_product_attr_value.ts b/src/api/store_branch_product_attr_value.ts
new file mode 100644
index 00000000..8a820a58
--- /dev/null
+++ b/src/api/store_branch_product_attr_value.ts
@@ -0,0 +1,48 @@
+import request from '@/utils/request'
+
+// 门店商品属性值辅助表列表
+export function apiStoreBranchProductAttrValueLists(params: any) {
+ return request.get({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/lists',
+ params
+ })
+}
+
+// 添加门店商品属性值辅助表
+export function apiStoreBranchProductAttrValueAdd(params: any) {
+ return request.post({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/add',
+ params
+ })
+}
+
+// 编辑门店商品属性值辅助表
+export function apiStoreBranchProductAttrValueEdit(params: any) {
+ return request.post({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/edit',
+ params
+ })
+}
+//更新状态
+export function apiStoreBranchProductAttrValueStatus(params: any) {
+ return request.post({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/status',
+ params
+ })
+}
+
+// 删除门店商品属性值辅助表
+export function apiStoreBranchProductAttrValueDelete(params: any) {
+ return request.post({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/delete',
+ params
+ })
+}
+
+// 门店商品属性值辅助表详情
+export function apiStoreBranchProductAttrValueDetail(params: any) {
+ return request.get({
+ url: '/store_branch_product_attr_value/storebranchproductattrvalue/detail',
+ params
+ })
+}
diff --git a/src/api/store_product_attr_value.ts b/src/api/store_product_attr_value.ts
new file mode 100644
index 00000000..25cfb5e0
--- /dev/null
+++ b/src/api/store_product_attr_value.ts
@@ -0,0 +1,26 @@
+import request from '@/utils/request'
+
+// 商品属性值表列表
+export function apiStoreProductAttrValueLists(params: any) {
+ return request.get({ url: '/store_product_attr_value/storeproductattrvalue/lists', params })
+}
+
+// 添加商品属性值表
+export function apiStoreProductAttrValueAdd(params: any) {
+ return request.post({ url: '/store_product_attr_value/storeproductattrvalue/add', params })
+}
+
+// 编辑商品属性值表
+export function apiStoreProductAttrValueEdit(params: any) {
+ return request.post({ url: '/store_product_attr_value/storeproductattrvalue/edit', params })
+}
+
+// 删除商品属性值表
+export function apiStoreProductAttrValueDelete(params: any) {
+ return request.post({ url: '/store_product_attr_value/storeproductattrvalue/delete', params })
+}
+
+// 商品属性值表详情
+export function apiStoreProductAttrValueDetail(params: any) {
+ return request.get({ url: '/store_product_attr_value/storeproductattrvalue/detail', params })
+}
diff --git a/src/api/system_store.ts b/src/api/system_store.ts
index c77571c4..0db3cb93 100644
--- a/src/api/system_store.ts
+++ b/src/api/system_store.ts
@@ -30,11 +30,6 @@ export function apiSourceProductStoreLists(params: any) {
return request.get({ url: '/system_store/systemstore/source_product_store_lists', params })
}
-// 根据商品来源更新门店
-export function apiSourceProductUpdateStore(params: any) {
- return request.post({ url: '/system_store/systemstore/source_product_update_store', params })
-}
-
// 根据商品编辑门店库存
export function apiStoreBranchProductEdit(params: any) {
return request.post({ url: '/store_branch_product/StoreBranchProduct/edit', params })
@@ -68,4 +63,4 @@ export function apiSystemStoreStatisticsStore(params: any) {
// 门店交易统计
export function apiWorkbenchStoreIndex(params: any) {
return request.get({ url: '/workbench/store_index', params })
-}
\ No newline at end of file
+}
diff --git a/src/views/store/store_branch_product/details.vue b/src/views/store/store_branch_product/details.vue
index 90c43f54..fe7390c4 100644
--- a/src/views/store/store_branch_product/details.vue
+++ b/src/views/store/store_branch_product/details.vue
@@ -1,26 +1,65 @@
-
diff --git a/src/views/store/store_branch_product/index.vue b/src/views/store/store_branch_product/index.vue
index a6ca5ee6..b72cb506 100644
--- a/src/views/store/store_branch_product/index.vue
+++ b/src/views/store/store_branch_product/index.vue
@@ -197,6 +197,14 @@
show-overflow-tooltip
>
+
+
@@ -239,10 +248,12 @@ import { apiSystemStoreLists } from '@/api/system_store'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
import { ElMessage } from 'element-plus'
+import Details from './details.vue'
const editRef = shallowRef>()
// 是否显示编辑框
const showEdit = ref(false)
+const detailsRef = ref(null)
// 查询条件
const queryParams = reactive({
@@ -279,6 +290,11 @@ const handleAdd = async () => {
editRef.value?.open('add')
}
+// 详情
+const handleDetail = async (data: any) => {
+ detailsRef.value?.open()
+ detailsRef.value?.setFormData(data)
+}
// 编辑
const handleEdit = async (data: any) => {
showEdit.value = true
diff --git a/src/views/store/store_product/details.vue b/src/views/store/store_product/details.vue
index a6d4be91..fc916d45 100644
--- a/src/views/store/store_product/details.vue
+++ b/src/views/store/store_product/details.vue
@@ -164,7 +164,6 @@ import { apiStoreProductAdd, apiStoreProductEdit, apiStoreProductDetail } from '
import { timeFormat } from '@/utils/util'
import {
apiSourceProductStoreLists,
- apiSourceProductUpdateStore,
apiStoreBranchProductEdit,
apiStoreBranchProductEditPrice
} from '@/api/system_store'
@@ -292,35 +291,6 @@ const handleDelete = (store_id: number) => {
addList.set(store_id, (addList.get(store_id) || 0) - 1)
removeList.set(store_id, (removeList.get(store_id) || 0) + 1)
}
-
-// 修改适用门店
-const submitStore = () => {
- feedback
- .confirm('确定修改适用门店吗?')
- .then(async () => {
- const add = Array.from(addList.entries())
- .filter(([k, v]) => v == 1)
- .map(([key]) => key)
- const remove = Array.from(removeList.entries())
- .filter(([k, v]) => v == 1)
- .map(([key]) => key)
- console.log(add, remove)
- if (add.length == 0 && remove.length == 0) return ElMessage.warning('没有更改门店')
- apiSourceProductUpdateStore({
- addList: add,
- removeList: remove,
- product_id: queryParams.product_id
- }).then((res) => {
- isEidt.value = false
- addList.clear()
- removeList.clear()
- })
- })
- .catch(() => {
- // on cancel
- })
-}
-
// 库存相关
const isEidtStock = ref(false)
const stockList = ref(new Map())
diff --git a/src/views/store/store_product/details11.vue b/src/views/store/store_product/details11.vue
index 8bc184f8..8d74c2e9 100644
--- a/src/views/store/store_product/details11.vue
+++ b/src/views/store/store_product/details11.vue
@@ -25,6 +25,7 @@
+
@@ -93,7 +94,7 @@
import { usePaging } from '@/hooks/usePaging'
import { ElMessage, type FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
-import { apiStoreProductAdd, apiStoreProductEdit, apiStoreProductDetail } from '@/api/store_product'
+import { apiStoreProductAttrValueLists } from '@/api/store_product_attr_value'
import { timeFormat } from '@/utils/util'
import { apiSourceProductStoreLists } from '@/api/system_store'
import { apiWarehouseProductStoregeLists } from '@/api/warehouse_product_storege'
@@ -144,6 +145,9 @@ const setFormData = async (data: Record) => {
formData[key] = data[key]
}
}
+ apiStoreProductAttrValueLists({ product_id: data.id }).then((res) => {
+ sku_lists.value = res.lists
+ })
}
//打开弹窗
diff --git a/src/views/store/store_product/edit11.vue b/src/views/store/store_product/edit11.vue
index 34a72c61..e63fc1ac 100644
--- a/src/views/store/store_product/edit11.vue
+++ b/src/views/store/store_product/edit11.vue
@@ -19,16 +19,6 @@
:readonly="false"
/>
-
-
-
{
- tableData.value.push({ sku_name: '', purchase: 0, cost: 0, price: 0, editable: true })
+ tableData.value.push({
+ sku_name: '',
+ purchase: 0,
+ cost: 0,
+ price: 0,
+ bar_code: '',
+ editable: true
+ })
}
const deleteRow = (index) => {
@@ -347,18 +345,11 @@ const formData = reactive({
id: '',
image: '',
store_name: '',
- bar_code: '',
store_info: '',
product_type: 0,
cate_arr: [],
cate_id: '',
- price: '',
- vip_price: '',
- unit: '',
- stock: '',
swap: '',
- cost: '',
- purchase: '',
batch: 1,
store_batch: 1,
manufacturer_information: '',
@@ -368,18 +359,6 @@ const formData = reactive({
spec_type: 0
})
-// 定义验证输入的函数
-const validateInput = () => {
- // 获取输入框的当前值
- const inputValue = formData.bar_code
-
- // 使用正则表达式仅保留英文和数字
- const filteredValue = inputValue.replace(/[^a-zA-Z0-9]/g, '')
-
- // 更新输入框的值
- formData.bar_code = filteredValue
-}
-
const showStore = ref(false) // 选择门店列表是否显示
// 门店列表
const storeList = ref([])
@@ -471,13 +450,6 @@ const formRules = reactive({
trigger: ['blur']
}
],
- bar_code: [
- {
- required: true,
- message: '请输入商品条码',
- trigger: ['blur']
- }
- ],
store_info: [
{
required: true,
@@ -499,13 +471,6 @@ const formRules = reactive({
trigger: ['blur', 'change']
}
],
- swap: [
- {
- required: true,
- message: '请输入兑换库存',
- trigger: ['blur']
- }
- ],
image: [
{
required: true,
@@ -558,7 +523,8 @@ const handleSubmit = async () => {
unit: item.unit,
purchase: item.purchase,
cost: item.cost,
- price: item.price
+ price: item.price,
+ bar_code: item.bar_code
}
})
}