@@ -12,7 +13,7 @@
v-for="(value, valueIndex) in item.values"
:key="value.id"
class="mx-1"
- closable
+ :closable="!isDetail"
@close="handleCloseValue(index, valueIndex)"
>
{{ value.name }}
@@ -43,6 +44,9 @@
diff --git a/src/views/mall/product/spu/form/index.vue b/src/views/mall/product/spu/form/index.vue
index 9d69923a..de874524 100644
--- a/src/views/mall/product/spu/form/index.vue
+++ b/src/views/mall/product/spu/form/index.vue
@@ -1,9 +1,25 @@
-
-
+
+
+
+
+
+
+
-
-
+ ({
name: '', // 商品名称
categoryId: undefined, // 商品分类
keyword: '', // 关键字
- unit: undefined, // 单位
picUrl: '', // 商品封面图
sliderPicUrls: [], // 商品轮播图
introduction: '', // 商品简介
+ deliveryTypes: [], // 配送方式数组
deliveryTemplateId: undefined, // 运费模版
brandId: undefined, // 商品品牌
specType: false, // 商品规格
@@ -89,13 +109,7 @@ const formData = ref({
description: '', // 商品详情
sort: 0, // 商品排序
giveIntegral: 0, // 赠送积分
- virtualSalesCount: 0, // 虚拟销量
- recommendHot: false, // 是否热卖
- recommendBenefit: false, // 是否优惠
- recommendBest: false, // 是否精品
- recommendNew: false, // 是否新品
- recommendGood: false, // 是否优品
- activityOrders: [] // 活动排序
+ virtualSalesCount: 0 // 虚拟销量
})
/** 获得详情 */
@@ -135,13 +149,14 @@ const getDetail = async () => {
const submitForm = async () => {
// 提交请求
formLoading.value = true
- // 三个表单逐一校验,如果有一个表单校验不通过则切换到对应表单,如果有两个及以上的情况则切换到最前面的一个并弹出提示消息
- // 校验各表单
try {
- await unref(basicInfoRef)?.validate()
+ // 校验各表单
+ await unref(infoRef)?.validate()
+ await unref(skuRef)?.validate()
+ await unref(deliveryRef)?.validate()
await unref(descriptionRef)?.validate()
- await unref(otherSettingsRef)?.validate()
- // 深拷贝一份, 这样最终 server 端不满足,不需要恢复,
+ await unref(otherRef)?.validate()
+ // 深拷贝一份, 这样最终 server 端不满足,不需要影响原始数据
const deepCopyFormData = cloneDeep(unref(formData.value)) as ProductSpuApi.Spu
deepCopyFormData.skus!.forEach((item) => {
// 给sku name赋值
@@ -181,6 +196,7 @@ const close = () => {
delView(unref(currentRoute))
push({ name: 'ProductSpu' })
}
+
/** 初始化 */
onMounted(async () => {
await getDetail()
diff --git a/src/views/mall/product/spu/form/spu.data.ts b/src/views/mall/product/spu/form/spu.data.ts
deleted file mode 100644
index 9d88f433..00000000
--- a/src/views/mall/product/spu/form/spu.data.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-import { CrudSchema } from '@/hooks/web/useCrudSchemas'
-
-export const basicInfoSchema = reactive([
- {
- label: '商品名称',
- field: 'name'
- },
- {
- label: '关键字',
- field: 'keyword'
- },
- {
- label: '商品简介',
- field: 'introduction'
- },
- {
- label: '商品分类',
- field: 'categoryId'
- },
- {
- label: '商品品牌',
- field: 'brandId'
- },
- {
- label: '商品封面图',
- field: 'picUrl'
- },
- {
- label: '商品轮播图',
- field: 'sliderPicUrls'
- },
- {
- label: '商品视频',
- field: 'videoUrl'
- },
- {
- label: '单位',
- field: 'unit',
- dictType: DICT_TYPE.PRODUCT_UNIT
- },
- {
- label: '规格类型',
- field: 'specType'
- },
- {
- label: '分销类型',
- field: 'subCommissionType'
- },
- {
- label: '物流模版',
- field: 'deliveryTemplateId'
- },
- {
- label: '商品属性列表',
- field: 'skus'
- }
-])
-export const descriptionSchema = reactive([
- {
- label: '商品详情',
- field: 'description'
- }
-])
-export const otherSettingsSchema = reactive([
- {
- label: '商品排序',
- field: 'sort'
- },
- {
- label: '赠送积分',
- field: 'giveIntegral'
- },
- {
- label: '虚拟销量',
- field: 'virtualSalesCount'
- },
- {
- label: '是否热卖推荐',
- field: 'recommendHot'
- },
- {
- label: '是否优惠推荐',
- field: 'recommendBenefit'
- },
- {
- label: '是否精品推荐',
- field: 'recommendBest'
- },
- {
- label: '是否新品推荐',
- field: 'recommendNew'
- },
- {
- label: '是否优品推荐',
- field: 'recommendGood'
- },
- {
- label: '活动显示排序',
- field: 'activityOrders'
- }
-])
diff --git a/src/views/mall/product/spu/index.vue b/src/views/mall/product/spu/index.vue
index 27a4bd2d..6817323b 100644
--- a/src/views/mall/product/spu/index.vue
+++ b/src/views/mall/product/spu/index.vue
@@ -1,3 +1,4 @@
+
@@ -125,27 +126,33 @@
-
-
+
+
-
+
+
+
+
+
+ {{ row.name }}
+
+
+
+
-
-
- {{ fenToYuan(row.price) }}元
+
+ ¥ {{ fenToYuan(row.price) }}
-
-
+
+
-
- 详情
-
+ 详情
- 恢复到仓库
+ 恢复
- 加入回收站
+ 回收
@@ -236,48 +243,41 @@ defineOptions({ name: 'ProductSpu' })
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
-const { currentRoute, push } = useRouter() // 路由跳转
+const { push } = useRouter() // 路由跳转
const loading = ref(false) // 列表的加载中
const exportLoading = ref(false) // 导出的加载中
const total = ref(0) // 列表的总页数
-const list = ref
([]) // 列表的数据
+const list = ref([]) // 列表的数据
// tabs 数据
const tabsData = ref([
{
- count: 0,
- name: '出售中商品',
- type: 0
+ name: '出售中',
+ type: 0,
+ count: 0
},
{
- count: 0,
- name: '仓库中商品',
- type: 1
+ name: '仓库中',
+ type: 1,
+ count: 0
},
{
- count: 0,
- name: '已售罄商品',
- type: 2
+ name: '已售罄',
+ type: 2,
+ count: 0
},
{
- count: 0,
name: '警戒库存',
- type: 3
+ type: 3,
+ count: 0
},
{
- count: 0,
- name: '商品回收站',
- type: 4
+ name: '回收站',
+ type: 4,
+ count: 0
}
])
-/** 获得每个 Tab 的数量 */
-const getTabsCount = async () => {
- const res = await ProductSpuApi.getTabsCount()
- for (let objName in res) {
- tabsData.value[Number(objName)].count = res[objName]
- }
-}
const queryParams = ref({
pageNo: 1,
pageSize: 10,
@@ -288,11 +288,6 @@ const queryParams = ref({
}) // 查询参数
const queryFormRef = ref() // 搜索的表单Ref
-const handleTabClick = (tab: TabsPaneContext) => {
- queryParams.value.tabType = tab.paneName as number
- getList()
-}
-
/** 查询列表 */
const getList = async () => {
loading.value = true
@@ -305,8 +300,22 @@ const getList = async () => {
}
}
+/** 切换 Tab */
+const handleTabClick = (tab: TabsPaneContext) => {
+ queryParams.value.tabType = tab.paneName as number
+ getList()
+}
+
+/** 获得每个 Tab 的数量 */
+const getTabsCount = async () => {
+ const res = await ProductSpuApi.getTabsCount()
+ for (let objName in res) {
+ tabsData.value[Number(objName)].count = res[objName]
+ }
+}
+
/** 添加到仓库 / 回收站的状态 */
-const handleStatus02Change = async (row, newStatus: number) => {
+const handleStatus02Change = async (row: any, newStatus: number) => {
try {
// 二次确认
const text = newStatus === ProductSpuStatusEnum.RECYCLE.status ? '加入到回收站' : '恢复到仓库'
@@ -322,7 +331,7 @@ const handleStatus02Change = async (row, newStatus: number) => {
}
/** 更新上架/下架状态 */
-const handleStatusChange = async (row) => {
+const handleStatusChange = async (row: any) => {
try {
// 二次确认
const text = row.status ? '上架' : '下架'
@@ -407,19 +416,16 @@ const handleExport = async () => {
}
}
-const categoryList = ref() // 分类树
/** 获取分类的节点的完整结构 */
-const formatCategoryName = (categoryId) => {
+const categoryList = ref() // 分类树
+const formatCategoryName = (categoryId: number) => {
return treeToString(categoryList.value, categoryId)
}
-// 监听路由变化更新列表,解决商品保存后,列表不刷新的问题。
-watch(
- () => currentRoute.value,
- () => {
- getList()
- }
-)
+/** 激活时 */
+onActivated(() => {
+ getList()
+})
/** 初始化 **/
onMounted(async () => {
diff --git a/src/views/mall/promotion/diy/page/DiyPageForm.vue b/src/views/mall/promotion/diy/page/DiyPageForm.vue
index e0cb18b6..4e3c84fc 100644
--- a/src/views/mall/promotion/diy/page/DiyPageForm.vue
+++ b/src/views/mall/promotion/diy/page/DiyPageForm.vue
@@ -13,8 +13,8 @@
-
-
+
+
@@ -40,7 +40,7 @@ const formData = ref({
id: undefined,
name: undefined,
remark: undefined,
- previewImageUrls: []
+ previewPicUrls: []
})
const formRules = reactive({
name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }]
@@ -58,8 +58,8 @@ const open = async (type: string, id?: number) => {
formLoading.value = true
try {
const diyPage = await DiyPageApi.getDiyPage(id) // 处理预览图
- if (diyPage?.previewImageUrls?.length > 0) {
- diyPage.previewImageUrls = diyPage.previewImageUrls.map((url: string) => {
+ if (diyPage?.previewPicUrls?.length > 0) {
+ diyPage.previewPicUrls = diyPage.previewPicUrls.map((url: string) => {
return { url }
})
}
@@ -82,10 +82,10 @@ const submitForm = async () => {
formLoading.value = true
try {
// 处理预览图
- const previewImageUrls = formData.value.previewImageUrls.map((item) => {
+ const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : item
})
- const data = { ...formData.value, previewImageUrls } as unknown as DiyPageApi.DiyPageVO
+ const data = { ...formData.value, previewPicUrls } as unknown as DiyPageApi.DiyPageVO
if (formType.value === 'create') {
await DiyPageApi.createDiyPage(data)
message.success(t('common.createSuccess'))
@@ -107,7 +107,7 @@ const resetForm = () => {
id: undefined,
name: undefined,
remark: undefined,
- previewImageUrls: []
+ previewPicUrls: []
}
formRef.value?.resetFields()
}
diff --git a/src/views/mall/promotion/diy/page/decorate.vue b/src/views/mall/promotion/diy/page/decorate.vue
index c77ccfbf..fa20c3eb 100644
--- a/src/views/mall/promotion/diy/page/decorate.vue
+++ b/src/views/mall/promotion/diy/page/decorate.vue
@@ -52,7 +52,7 @@ const resetForm = () => {
templateId: undefined,
name: '',
remark: '',
- previewImageUrls: [],
+ previewPicUrls: [],
property: ''
} as DiyPageApi.DiyPageVO
formRef.value?.resetFields()
diff --git a/src/views/mall/promotion/diy/page/index.vue b/src/views/mall/promotion/diy/page/index.vue
index 6436c2f7..89ae0003 100644
--- a/src/views/mall/promotion/diy/page/index.vue
+++ b/src/views/mall/promotion/diy/page/index.vue
@@ -47,14 +47,14 @@
-
+
diff --git a/src/views/mall/promotion/diy/template/DiyTemplateForm.vue b/src/views/mall/promotion/diy/template/DiyTemplateForm.vue
index e4289f65..16e1fc06 100644
--- a/src/views/mall/promotion/diy/template/DiyTemplateForm.vue
+++ b/src/views/mall/promotion/diy/template/DiyTemplateForm.vue
@@ -13,8 +13,8 @@
-
-
+
+
@@ -40,7 +40,7 @@ const formData = ref({
id: undefined,
name: undefined,
remark: undefined,
- previewImageUrls: []
+ previewPicUrls: []
})
const formRules = reactive({
name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }]
@@ -59,8 +59,8 @@ const open = async (type: string, id?: number) => {
try {
const diyTemplate = await DiyTemplateApi.getDiyTemplate(id)
// 处理预览图
- if (diyTemplate?.previewImageUrls?.length > 0) {
- diyTemplate.previewImageUrls = diyTemplate.previewImageUrls.map((url: string) => {
+ if (diyTemplate?.previewPicUrls?.length > 0) {
+ diyTemplate.previewPicUrls = diyTemplate.previewPicUrls.map((url: string) => {
return { url }
})
}
@@ -83,10 +83,10 @@ const submitForm = async () => {
formLoading.value = true
try {
// 处理预览图
- const previewImageUrls = formData.value.previewImageUrls.map((item) => {
+ const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : item
})
- const data = { ...formData.value, previewImageUrls } as unknown as DiyTemplateApi.DiyTemplateVO
+ const data = { ...formData.value, previewPicUrls } as unknown as DiyTemplateApi.DiyTemplateVO
if (formType.value === 'create') {
await DiyTemplateApi.createDiyTemplate(data)
message.success(t('common.createSuccess'))
@@ -108,7 +108,7 @@ const resetForm = () => {
id: undefined,
name: undefined,
remark: undefined,
- previewImageUrls: []
+ previewPicUrls: []
}
formRef.value?.resetFields()
}
diff --git a/src/views/mall/promotion/diy/template/decorate.vue b/src/views/mall/promotion/diy/template/decorate.vue
index 6f4899a2..e7838f29 100644
--- a/src/views/mall/promotion/diy/template/decorate.vue
+++ b/src/views/mall/promotion/diy/template/decorate.vue
@@ -118,7 +118,7 @@ const resetForm = () => {
used: false,
usedTime: undefined,
remark: '',
- previewImageUrls: [],
+ previewPicUrls: [],
property: '',
pages: []
} as DiyTemplateApi.DiyTemplatePropertyVO
diff --git a/src/views/mall/promotion/diy/template/index.vue b/src/views/mall/promotion/diy/template/index.vue
index 97f8bdef..6f703573 100644
--- a/src/views/mall/promotion/diy/template/index.vue
+++ b/src/views/mall/promotion/diy/template/index.vue
@@ -47,14 +47,14 @@
-
+
diff --git a/src/views/mall/promotion/rewardActivity/RewardForm.vue b/src/views/mall/promotion/rewardActivity/RewardForm.vue
index 716f4e26..9fb69a56 100644
--- a/src/views/mall/promotion/rewardActivity/RewardForm.vue
+++ b/src/views/mall/promotion/rewardActivity/RewardForm.vue
@@ -24,51 +24,96 @@
{{ dict.label }}
+ {{ dict.label }}
+
-
-
- 活动层级{{ index+1 }}删除
-
- 满 元
-
-
-
-
-
-
- 减元
-
-
-
-
-
-
- 送积分
-
-
-
-
-
+
+
+
+ 活动层级{{ index + 1 }}
+
+ 删除
+
+
+
+
+ 满
+
+ 元
+
+
+
+
+
+
+ 减
+
+ 元
+
+
+
+
+
+
+
+
+ 送
+
+ 积分
+
+
+
+
+
+
+
-
-
- 添加活动层级
+
+
+
+ 添加活动层级
{{ dict.label }}
+ {{ dict.label }}
+
@@ -87,9 +132,9 @@
>
{{ item.name }}
- ¥{{ (item.price / 100.0).toFixed(2) }}
+
+ ¥{{ (item.price / 100.0).toFixed(2) }}
+
@@ -106,15 +151,8 @@
diff --git a/src/views/mall/promotion/rewardActivity/index.vue b/src/views/mall/promotion/rewardActivity/index.vue
index 86f91fea..c1d352be 100644
--- a/src/views/mall/promotion/rewardActivity/index.vue
+++ b/src/views/mall/promotion/rewardActivity/index.vue
@@ -122,8 +122,7 @@