续默认包装单位
This commit is contained in:
1 parent
93f6871f46
commit
484df1c0e2
5 files changed
+67
-38
No files matched your search
+3
-3
@@ -8,9 +8,9 @@ VITE_OPEN = true
|
||||
ENV = 'development'
|
||||
|
||||
# ADMIN 服务地址
|
||||
#VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
|
||||
VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/ # 线上
|
||||
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
|
||||
VITE_ADMIN_PROXY_PATH = http://localhost:9999/
|
||||
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
|
||||
# VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999/ # 邓-本地
|
||||
# VITE_ADMIN_PROXY_PATH = http://192.168.101.37:9999/ # 邓-本地
|
||||
# VITE_ADMIN_PROXY_PATH = http://59.202.170.152:81/api # 正式环境
|
||||
@@ -18,7 +18,7 @@ VITE_ADMIN_PROXY_PATH = http://localhost:9999/
|
||||
# 图片访问基础地址
|
||||
VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api # 线上
|
||||
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
|
||||
VITE_IMAGE_BASE_PATH = http://localhost:9999
|
||||
# VITE_IMAGE_BASE_PATH = http://localhost:9999
|
||||
# VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
|
||||
# VITE_IMAGE_BASE_PATH = http://192.168.101.37:9999 # 邓-本地
|
||||
# VITE_IMAGE_BASE_PATH = http://59.202.170.152:81/api/ # 正式环境
|
||||
|
||||
+31
-19
@@ -46,11 +46,15 @@
|
||||
</div>
|
||||
</el-row>
|
||||
<el-form-item label="" prop="supermarketAuxiliaryCodeEntityList">
|
||||
<el-table :data="supermarketAuxiliaryCodeEntityList" border :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle">
|
||||
<el-table
|
||||
:data="supermarketAuxiliaryCodeEntityList"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="40" align="center" fixed /> -->
|
||||
<el-table-column type="index" label="#" width="50" />
|
||||
<el-table-column prop="barCode" label="条码" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="spuId" label="spuID" show-overflow-tooltip /> -->
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -62,7 +66,13 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_supermarketAuxiliaryCode_del'" @click="handleDelete(scope.row)">
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_supermarketAuxiliaryCode_del'"
|
||||
@click="handleDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -78,12 +88,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
// import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
|
||||
const supermarketAuxiliaryCodeEntityList = defineModel<any>('supermarketAuxiliaryCodeEntityList', { default: [] });
|
||||
const supermarketAuxiliaryCodeEntityList = defineModel<any>("supermarketAuxiliaryCodeEntityList", { default: [] })
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
// const queryRef = ref();
|
||||
// const showSearch = ref(true);
|
||||
@@ -100,25 +110,25 @@ const formDialogRef = ref();
|
||||
// const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
|
||||
const tableStyle = {
|
||||
cellStyle: { textAlign: 'center' },
|
||||
cellStyle: { textAlign: "center" },
|
||||
headerCellStyle: {
|
||||
textAlign: 'center',
|
||||
background: 'var(--el-table-row-hover-bg-color)',
|
||||
color: 'var(--el-text-color-primary)',
|
||||
textAlign: "center",
|
||||
background: "var(--el-table-row-hover-bg-color)",
|
||||
color: "var(--el-text-color-primary)",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const getDataList = (formData: any) => {
|
||||
console.log(formData);
|
||||
const index = supermarketAuxiliaryCodeEntityList.value?.findIndex((item: any) => item.id === formData.id);
|
||||
console.log(formData)
|
||||
const index = supermarketAuxiliaryCodeEntityList.value?.findIndex((item: any) => item.id === formData.id)
|
||||
if (supermarketAuxiliaryCodeEntityList.value == null || index == undefined) {
|
||||
supermarketAuxiliaryCodeEntityList.value = [{ ...formData, isNew: true }];
|
||||
supermarketAuxiliaryCodeEntityList.value = [{ ...formData, isNew: true }]
|
||||
} else if (index === -1) {
|
||||
supermarketAuxiliaryCodeEntityList.value.push({ ...formData, isNew: true });
|
||||
supermarketAuxiliaryCodeEntityList.value.push({ ...formData, isNew: true })
|
||||
} else {
|
||||
supermarketAuxiliaryCodeEntityList.value[index] = formData;
|
||||
supermarketAuxiliaryCodeEntityList.value[index] = formData
|
||||
}
|
||||
};
|
||||
}
|
||||
// 清空搜索条件
|
||||
// const resetQuery = () => {
|
||||
// // 清空搜索条件
|
||||
@@ -147,7 +157,9 @@ const getDataList = (formData: any) => {
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (rowData: any) => {
|
||||
supermarketAuxiliaryCodeEntityList.value = supermarketAuxiliaryCodeEntityList.value.filter((item: any) => item.id !== rowData.id);
|
||||
supermarketAuxiliaryCodeEntityList.value = supermarketAuxiliaryCodeEntityList.value.filter(
|
||||
(item: any) => item.id !== rowData.id,
|
||||
)
|
||||
// try {
|
||||
// await useMessageBox().confirm('此操作将永久删除');
|
||||
// } catch {
|
||||
@@ -160,5 +172,5 @@ const handleDelete = async (rowData: any) => {
|
||||
// } catch (err: any) {
|
||||
// useMessage().error(err.msg);
|
||||
// }
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -104,9 +104,10 @@ const dataRules = ref({
|
||||
unit: [{ required: true, message: "单位不能为空", trigger: "blur" }],
|
||||
status: [{ required: true, message: "状态不能为空", trigger: "blur" }],
|
||||
packageNum: [{ required: true, message: "内装数不能为空", trigger: "blur" }],
|
||||
// purchasePrice: [{ required: true, message: '进价不能为空', trigger: 'blur' }],
|
||||
retailPrice: [{ required: true, message: "零售价不能为空", trigger: "blur" }],
|
||||
// promotionPrice: [{ required: true, message: '促销价不能为空', trigger: 'blur' }],
|
||||
purchasePrice: [{ required: true, message: "进价不能为空", trigger: "blur" }],
|
||||
promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
<el-table-column prop="packageNum" label="内装数" show-overflow-tooltip />
|
||||
<el-table-column prop="purchasePrice" label="进价(元)" show-overflow-tooltip />
|
||||
<el-table-column prop="retailPrice" label="零售价(元)" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="spuId" label="spuId" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="promotionPrice" label="促销价(元)" show-overflow-tooltip />
|
||||
<el-table-column prop="costPrice" label="成本价(元)" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
@@ -102,8 +101,9 @@
|
||||
type="primary"
|
||||
v-auth="'supermarket_supermarketUnit_del'"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -149,18 +149,31 @@ const tableStyle = {
|
||||
},
|
||||
}
|
||||
|
||||
// 根据基础信息的部分填写项自动生成一条默认包装单位
|
||||
watch(
|
||||
() => props.defaultSpuUnit,
|
||||
(newValue, oldValue) => {
|
||||
console.log(newValue, oldValue)
|
||||
|
||||
const defaultSpuUnitIndex = supermarketUnitEntityList.value.findIndex((item: any) => {
|
||||
return (item.flag = "default")
|
||||
return (
|
||||
item.barCode == oldValue.barCode &&
|
||||
item.unit == oldValue.unit &&
|
||||
item.packageNum == oldValue.packageNum &&
|
||||
item.retailPrice == oldValue.retailPrice &&
|
||||
item.purchasePrice == oldValue.purchasePrice &&
|
||||
item.promotionPrice == oldValue.promotionPrice &&
|
||||
item.costPrice == oldValue.costPrice
|
||||
)
|
||||
})
|
||||
console.log(defaultSpuUnitIndex)
|
||||
|
||||
if (defaultSpuUnitIndex !== -1) {
|
||||
console.log(supermarketUnitEntityList.value[defaultSpuUnitIndex])
|
||||
supermarketUnitEntityList.value[defaultSpuUnitIndex] = newValue
|
||||
} else {
|
||||
supermarketUnitEntityList.value.push(newValue)
|
||||
}
|
||||
console.log(supermarketUnitEntityList.value)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="自编码/条码" prop="barCode">
|
||||
<el-input v-model.trim="form.barCode" placeholder="请输入自编码/条码" />
|
||||
<el-form-item label="自编码/条码" prop="barcode">
|
||||
<el-input v-model.trim="form.barcode" placeholder="请输入自编码/条码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@@ -126,7 +126,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input placeholder="请输入规格" v-model.trim="form.specification" />
|
||||
<el-input placeholder="请输入规格" v-model.trim="form.spec" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
@@ -211,7 +211,7 @@ const form = reactive({
|
||||
id: "",
|
||||
merchantId: "",
|
||||
productCode: "",
|
||||
barCode: "",
|
||||
barcode: "",
|
||||
productName: "",
|
||||
unit: "",
|
||||
categoryId: "",
|
||||
@@ -223,7 +223,7 @@ const form = reactive({
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
giveIntegral: 0,
|
||||
specification: "",
|
||||
spec: "",
|
||||
origin: "",
|
||||
packageNum: 0,
|
||||
retailPrice: 0,
|
||||
@@ -250,7 +250,7 @@ const dataRules = {
|
||||
productNature: [{ required: true, message: "请选择商品性质", trigger: "blur" }],
|
||||
merchantId: [{ required: true, message: "商户不能为空", trigger: "blur" }],
|
||||
productCode: [{ required: true, message: "货号不能为空", trigger: "blur" }],
|
||||
barCode: [{ required: true, message: "自编码/条码不能为空", trigger: "blur" }],
|
||||
barcode: [{ required: true, message: "自编码/条码不能为空", trigger: "blur" }],
|
||||
productName: [{ required: true, message: "商品名称不能为空", trigger: "blur" }],
|
||||
unit: [{ required: true, message: "单位不能为空", trigger: "blur" }],
|
||||
stock: [{ required: true, message: "总库存不能为空", trigger: "blur" }],
|
||||
@@ -261,8 +261,10 @@ const dataRules = {
|
||||
supplierId: [{ required: true, message: "请选择货商", trigger: "blur" }],
|
||||
smErpUnitEntityList: [{ required: true, message: "请添加包装单位", trigger: "change" }],
|
||||
smErpAuxiliaryCodeEntityList: [{ required: true, message: "请添加辅助条码", trigger: "change" }],
|
||||
// costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
retailPrice: [{ required: true, message: "零售价不能为空", trigger: "blur" }],
|
||||
purchasePrice: [{ required: true, message: "进价不能为空", trigger: "blur" }],
|
||||
promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
packageNum: [{ required: true, message: "内装数不能为空", trigger: "blur" }],
|
||||
}
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
@@ -272,12 +274,14 @@ const supplierOptions = ref<any>([]) // 货商的下拉选项
|
||||
// 默认包装单位
|
||||
const defaultSpuUnit = computed(() => ({
|
||||
flag: "default",
|
||||
barCode: form.barCode,
|
||||
barCode: form.barcode,
|
||||
unit: form.unit,
|
||||
packageNum: form.packageNum,
|
||||
retailPrice: form.retailPrice,
|
||||
purchasePrice: form.purchasePrice,
|
||||
promotionPrice: form.promotionPrice,
|
||||
costPrice: form.costPrice,
|
||||
spec: form.spec,
|
||||
status: "0",
|
||||
}))
|
||||
|
||||
@@ -305,8 +309,6 @@ const openDialog = async (id: string) => {
|
||||
getSupplierTypeOptions(),
|
||||
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||
|
||||
console.log(categoryDict, brandDict, supplierDict)
|
||||
|
||||
categoryOptions && categoryDict.code === 0 && (categoryOptions.value = categoryDict.data)
|
||||
brandOptions && brandDict.code === 0 && (brandOptions.value = brandDict.data)
|
||||
supplierOptions && supplierDict.code === 0 && (supplierOptions.value = supplierDict.data)
|
||||
@@ -325,6 +327,7 @@ const getsupermarketSpuData = async (id: string) => {
|
||||
item.purchasePrice = displayPrice(item.purchasePrice, "")
|
||||
item.costPrice = displayPrice(item.costPrice, "")
|
||||
})
|
||||
|
||||
Object.assign(form, res.data)
|
||||
console.log(res.data)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user