Merge remote-tracking branch 'yudao/dev' into dev-crm

# Conflicts:
#	src/router/modules/remaining.ts
This commit is contained in:
puhui999 2024-01-14 21:53:31 +08:00
commit 2a55d88a44
58 changed files with 1157 additions and 1269 deletions

View File

@ -4,8 +4,8 @@ NODE_ENV=development
VITE_DEV=true VITE_DEV=true
# 请求路径 # 请求路径
# VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn' VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
VITE_BASE_URL='http://dofast.demo.huizhizao.vip:20001' # VITE_BASE_URL='http://dofast.demo.huizhizao.vip:20001'
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload' VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
@ -35,4 +35,4 @@ VITE_OUT_DIR=dist
VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn' VITE_MALL_H5_DOMAIN='http://mall.yudao.iocoder.cn'
# 验证码的开关 # 验证码的开关
VITE_APP_CAPTCHA_ENABLE=true VITE_APP_CAPTCHA_ENABLE=false

View File

@ -57,7 +57,6 @@
"pinia": "^2.1.7", "pinia": "^2.1.7",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"qs": "^6.11.2", "qs": "^6.11.2",
"sortablejs": "^1.15.0",
"steady-xml": "^0.1.0", "steady-xml": "^0.1.0",
"url": "^0.11.3", "url": "^0.11.3",
"video.js": "^7.21.5", "video.js": "^7.21.5",
@ -81,7 +80,6 @@
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"@types/qs": "^6.9.10", "@types/qs": "^6.9.10",
"@types/sortablejs": "^1.15.5",
"@typescript-eslint/eslint-plugin": "^6.11.0", "@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0", "@typescript-eslint/parser": "^6.11.0",
"@unocss/transformer-variant-group": "^0.57.4", "@unocss/transformer-variant-group": "^0.57.4",

View File

@ -41,3 +41,8 @@ export const deleteProduct = async (id: number) => {
export const exportProduct = async (params) => { export const exportProduct = async (params) => {
return await request.download({ url: `/crm/product/export-excel`, params }) return await request.download({ url: `/crm/product/export-excel`, params })
} }
// 查询产品操作日志
export const getOperateLogPage = async (params: any) => {
return await request.get({ url: '/crm/product/operate-log-page', params })
}

View File

@ -20,10 +20,6 @@ export interface CategoryVO {
* *
*/ */
picUrl: string picUrl: string
/**
* PC
*/
bigPicUrl?: string
/** /**
* *
*/ */

View File

@ -65,16 +65,6 @@ export const getPropertyPage = (params: PageParam) => {
return request.get({ url: '/product/property/page', params }) return request.get({ url: '/product/property/page', params })
} }
// 获得属性项列表
export const getPropertyList = (params: any) => {
return request.get({ url: '/product/property/list', params })
}
// 获得属性项列表
export const getPropertyListAndValue = (data: any) => {
return request.post({ url: '/product/property/get-value-list', data })
}
// ------------------------ 属性值 ------------------- // ------------------------ 属性值 -------------------
// 获得属性值分页 // 获得属性值分页

View File

@ -33,14 +33,15 @@ export interface GiveCouponTemplate {
export interface Spu { export interface Spu {
id?: number id?: number
name?: string // 商品名称 name?: string // 商品名称
categoryId?: number | undefined // 商品分类 categoryId?: number // 商品分类
keyword?: string // 关键字 keyword?: string // 关键字
unit?: number | undefined // 单位 unit?: number | undefined // 单位
picUrl?: string // 商品封面图 picUrl?: string // 商品封面图
sliderPicUrls?: string[] // 商品轮播图 sliderPicUrls?: string[] // 商品轮播图
introduction?: string // 商品简介 introduction?: string // 商品简介
deliveryTypes?: number[] // 配送方式
deliveryTemplateId?: number | undefined // 运费模版 deliveryTemplateId?: number | undefined // 运费模版
brandId?: number | undefined // 商品品牌编号 brandId?: number // 商品品牌编号
specType?: boolean // 商品规格 specType?: boolean // 商品规格
subCommissionType?: boolean // 分销类型 subCommissionType?: boolean // 分销类型
skus?: Sku[] // sku数组 skus?: Sku[] // sku数组
@ -48,11 +49,6 @@ export interface Spu {
sort?: number // 商品排序 sort?: number // 商品排序
giveIntegral?: number // 赠送积分 giveIntegral?: number // 赠送积分
virtualSalesCount?: number // 虚拟销量 virtualSalesCount?: number // 虚拟销量
recommendHot?: boolean // 是否热卖
recommendBenefit?: boolean // 是否优惠
recommendBest?: boolean // 是否精品
recommendNew?: boolean // 是否新品
recommendGood?: boolean // 是否优品
price?: number // 商品价格 price?: number // 商品价格
salesCount?: number // 商品销量 salesCount?: number // 商品销量
marketPrice?: number // 市场价 marketPrice?: number // 市场价
@ -60,7 +56,6 @@ export interface Spu {
stock?: number // 商品库存 stock?: number // 商品库存
createTime?: Date // 商品创建时间 createTime?: Date // 商品创建时间
status?: number // 商品状态 status?: number // 商品状态
activityOrders: number[] // 活动排序
} }
// 获得 Spu 列表 // 获得 Spu 列表

View File

@ -5,7 +5,7 @@ export interface DiyPageVO {
templateId?: number templateId?: number
name: string name: string
remark: string remark: string
previewImageUrls: string[] previewPicUrls: string[]
property: string property: string
} }

View File

@ -7,7 +7,7 @@ export interface DiyTemplateVO {
used: boolean used: boolean
usedTime?: Date usedTime?: Date
remark: string remark: string
previewImageUrls: string[] previewPicUrls: string[]
property: string property: string
} }

View File

@ -1,17 +1,18 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface DiscountActivityVO { export interface DiscountActivityVO {
id?:number, id?: number
name?: string name?: string
startTime?:Date startTime?: Date
endTime?:Date endTime?: Date
remark?:string remark?: string
conditionType?:number conditionType?: number
productScope?:number productScope?: number
productSpuIds?:number[] productSpuIds?: number[]
rules?:DiscountProductVO[] rules?: DiscountProductVO[]
} }
//优惠规则
// 优惠规则
export interface DiscountProductVO { export interface DiscountProductVO {
limit: number limit: number
discountPrice: number discountPrice: number
@ -21,23 +22,26 @@ export interface DiscountProductVO {
couponCounts: number[] couponCounts: number[]
} }
// 新增满减送活动 // 新增满减送活动
export const createRewardActivity = async (data: DiscountActivityVO) => { export const createRewardActivity = async (data: DiscountActivityVO) => {
return await request.post({ url: '/promotion/reward-activity/create', data }) return await request.post({ url: '/promotion/reward-activity/create', data })
} }
// 更新满减送活动 // 更新满减送活动
export const updateRewardActivity = async (data: DiscountActivityVO) => { export const updateRewardActivity = async (data: DiscountActivityVO) => {
return await request.put({ url: '/promotion/reward-activity/update', data }) return await request.put({ url: '/promotion/reward-activity/update', data })
} }
// 查询满减送活动列表 // 查询满减送活动列表
export const getRewardActivityPage = async (params) => { export const getRewardActivityPage = async (params) => {
return await request.get({ url: '/promotion/reward-activity/page', params }) return await request.get({ url: '/promotion/reward-activity/page', params })
} }
// 查询满减送活动详情 // 查询满减送活动详情
export const getReward = async (id:number) => { export const getReward = async (id: number) => {
return await request.get({ url: '/promotion/reward-activity/get?id='+id, }) return await request.get({ url: '/promotion/reward-activity/get?id=' + id })
} }
// 删除限时折扣活动 // 删除限时折扣活动
export const deleteRewardActivity = async (id: number) => { export const deleteRewardActivity = async (id: number) => {
return await request.delete({ url: '/promotion/reward-activity/delete?id=' + id }) return await request.delete({ url: '/promotion/reward-activity/delete?id=' + id })

View File

@ -23,7 +23,7 @@
<template #tip>建议宽度 750px</template> <template #tip>建议宽度 750px</template>
</UploadImg> </UploadImg>
</el-form-item> </el-form-item>
<el-tree :data="treeData" :expand-on-click-node="false"> <el-tree :data="treeData" :expand-on-click-node="false" default-expand-all>
<template #default="{ node, data }"> <template #default="{ node, data }">
<el-form-item <el-form-item
:label="data.label" :label="data.label"
@ -43,7 +43,7 @@
</el-form-item> </el-form-item>
</template> </template>
</el-tree> </el-tree>
<slot name="style" :formData="formData"></slot> <slot name="style" :style="formData"></slot>
</el-form> </el-form>
</el-card> </el-card>
</el-tab-pane> </el-tab-pane>

View File

@ -2,15 +2,13 @@ import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/utils/constants' import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/utils/constants'
import { floatToFixed2 } from '@/utils' import { floatToFixed2 } from '@/utils'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { object } from 'vue-types'
// 优惠值 // 优惠值
// TODO @疯狂idea 有告警
export const CouponDiscount = defineComponent({ export const CouponDiscount = defineComponent({
name: 'CouponDiscount', name: 'CouponDiscount',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
@ -35,9 +33,7 @@ export const CouponDiscount = defineComponent({
export const CouponDiscountDesc = defineComponent({ export const CouponDiscountDesc = defineComponent({
name: 'CouponDiscountDesc', name: 'CouponDiscountDesc',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO
@ -61,9 +57,7 @@ export const CouponDiscountDesc = defineComponent({
export const CouponValidTerm = defineComponent({ export const CouponValidTerm = defineComponent({
name: 'CouponValidTerm', name: 'CouponValidTerm',
props: { props: {
coupon: { coupon: object<CouponTemplateApi.CouponTemplateVO>()
type: CouponTemplateApi.CouponTemplateVO
}
}, },
setup(props) { setup(props) {
const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO const coupon = props.coupon as CouponTemplateApi.CouponTemplateVO

View File

@ -24,7 +24,6 @@ export interface CouponCardProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'CouponCard', id: 'CouponCard',
name: '优惠券', name: '优惠券',

View File

@ -31,7 +31,6 @@ export interface MagicCubeItemProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂:有 idea 爆红告警
export const component = { export const component = {
id: 'MagicCube', id: 'MagicCube',
name: '广告魔方', name: '广告魔方',

View File

@ -59,7 +59,6 @@ export interface ProductCardFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'ProductCard', id: 'ProductCard',
name: '商品卡片', name: '商品卡片',

View File

@ -38,7 +38,6 @@ export interface ProductListFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'ProductList', id: 'ProductList',
name: '商品栏', name: '商品栏',

View File

@ -1,17 +1,16 @@
<template> <template>
<div class="min-h-30px" v-html="article.content"></div> <div class="min-h-30px" v-html="article?.content"></div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PromotionArticleProperty } from './config' import { PromotionArticleProperty } from './config'
import * as ArticleApi from '@/api/mall/promotion/article/index' import * as ArticleApi from '@/api/mall/promotion/article/index'
/** 营销文章 */ /** 营销文章 */
// TODO @idea
defineOptions({ name: 'PromotionArticle' }) defineOptions({ name: 'PromotionArticle' })
// //
const props = defineProps<{ property: PromotionArticleProperty }>() const props = defineProps<{ property: PromotionArticleProperty }>()
// //
const article = ref<ArticleApi.ArticleVO[]>({}) const article = ref<ArticleApi.ArticleVO>()
watch( watch(
() => props.property.id, () => props.property.id,
async () => { async () => {

View File

@ -39,13 +39,11 @@ export interface PromotionCombinationFieldProperty {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'PromotionCombination', id: 'PromotionCombination',
name: '拼团', name: '拼团',
icon: 'mdi:account-group', icon: 'mdi:account-group',
property: { property: {
activityId: undefined,
layoutType: 'oneCol', layoutType: 'oneCol',
fields: { fields: {
name: { show: true, color: '#000' }, name: { show: true, color: '#000' },

View File

@ -17,7 +17,6 @@ export interface SearchProperty {
export type PlaceholderPosition = 'left' | 'center' export type PlaceholderPosition = 'left' | 'center'
// 定义组件 // 定义组件
// TODO @疯狂idea 这里爆红可以卡看咋优化下哇is missing the following properties from type DiyComponent<SearchProperty>: uid, position
export const component = { export const component = {
id: 'SearchBar', id: 'SearchBar',
name: '搜索框', name: '搜索框',

View File

@ -19,7 +19,6 @@ export interface VideoPlayerStyle extends ComponentStyle {
} }
// 定义组件 // 定义组件
// TODO @疯狂idea 有告警
export const component = { export const component = {
id: 'VideoPlayer', id: 'VideoPlayer',
name: '视频播放', name: '视频播放',
@ -33,6 +32,6 @@ export const component = {
bgColor: '#fff', bgColor: '#fff',
marginBottom: 8, marginBottom: 8,
height: 300 height: 300
} as ComponentStyle } as VideoPlayerStyle
} }
} as DiyComponent<VideoPlayerProperty> } as DiyComponent<VideoPlayerProperty>

View File

@ -1,9 +1,9 @@
<template> <template>
<ComponentContainerProperty v-model="formData.style"> <ComponentContainerProperty v-model="formData.style">
<template #style="{ formData }"> <template #style>
<el-form-item label="高度" prop="height"> <el-form-item label="高度" prop="height">
<el-slider <el-slider
v-model="formData.height" v-model="formData.style.height"
:max="500" :max="500"
:min="100" :min="100"
show-input show-input

View File

@ -6,7 +6,7 @@ import { TabBarProperty } from '@/components/DiyEditor/components/mobile/TabBar/
// 页面装修组件 // 页面装修组件
export interface DiyComponent<T> { export interface DiyComponent<T> {
// 用于区分同一种组件的不同实例 // 用于区分同一种组件的不同实例
uid: number uid?: number
// 组件唯一标识 // 组件唯一标识
id: string id: string
// 组件名称 // 组件名称
@ -21,7 +21,7 @@ export interface DiyComponent<T> {
center center
fixed: 由组件自己决定位置 fixed: 由组件自己决定位置
*/ */
position: 'top' | 'bottom' | 'center' | '' | 'fixed' position?: 'top' | 'bottom' | 'center' | '' | 'fixed'
// 组件属性 // 组件属性
property: T property: T
} }
@ -103,8 +103,7 @@ export function usePropertyForm<T>(modelValue: T, emit: Function): { formData: R
} }
) )
// TODO @疯狂:这个 idea 爆红,看看怎么可以解决哈 return { formData } as { formData: Ref<T> }
return { formData }
} }
// 页面组件库 // 页面组件库

View File

@ -16,7 +16,7 @@
<template v-if="modelValue"> <template v-if="modelValue">
<img :src="modelValue" class="upload-image" /> <img :src="modelValue" class="upload-image" />
<div class="upload-handle" @click.stop> <div class="upload-handle" @click.stop>
<div class="handle-icon" @click="editImg"> <div class="handle-icon" @click="editImg" v-if="!disabled">
<Icon icon="ep:edit" /> <Icon icon="ep:edit" />
<span v-if="showBtnText">{{ t('action.edit') }}</span> <span v-if="showBtnText">{{ t('action.edit') }}</span>
</div> </div>
@ -24,7 +24,7 @@
<Icon icon="ep:zoom-in" /> <Icon icon="ep:zoom-in" />
<span v-if="showBtnText">{{ t('action.detail') }}</span> <span v-if="showBtnText">{{ t('action.detail') }}</span>
</div> </div>
<div v-if="showDelete" class="handle-icon" @click="deleteImg"> <div v-if="showDelete && !disabled" class="handle-icon" @click="deleteImg">
<Icon icon="ep:delete" /> <Icon icon="ep:delete" />
<span v-if="showBtnText">{{ t('action.del') }}</span> <span v-if="showBtnText">{{ t('action.del') }}</span>
</div> </div>

View File

@ -28,7 +28,7 @@
<Icon icon="ep:zoom-in" /> <Icon icon="ep:zoom-in" />
<span>查看</span> <span>查看</span>
</div> </div>
<div class="handle-icon" @click="handleRemove(file)"> <div class="handle-icon" @click="handleRemove(file)" v-if="!disabled">
<Icon icon="ep:delete" /> <Icon icon="ep:delete" />
<span>删除</span> <span>删除</span>
</div> </div>

View File

@ -473,8 +473,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
title: '模板装修', title: '模板装修',
noCache: true, noCache: true,
hidden: true, hidden: true,
// TODO @疯狂:建议 menu 那的 /mall/promotion/diy-template/diy-template 改成 /mall/promotion/diy/template activeMenu: '/mall/promotion/diy/template'
activeMenu: '/mall/promotion/diy-template/diy-template'
}, },
component: () => import('@/views/mall/promotion/diy/template/decorate.vue') component: () => import('@/views/mall/promotion/diy/template/decorate.vue')
}, },
@ -485,8 +484,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
title: '页面装修', title: '页面装修',
noCache: true, noCache: true,
hidden: true, hidden: true,
// TODO @疯狂:建议 menu 那的 /mall/promotion/diy-template/diy-page 改成 /mall/promotion/diy/page activeMenu: '/mall/promotion/diy/page'
activeMenu: '/mall/promotion/diy-template/diy-page'
}, },
component: () => import('@/views/mall/promotion/diy/page/decorate.vue') component: () => import('@/views/mall/promotion/diy/page/decorate.vue')
} }
@ -519,6 +517,17 @@ const remainingRouter: AppRouteRecordRaw[] = [
activeMenu: '/crm/contact' activeMenu: '/crm/contact'
}, },
component: () => import('@/views/crm/contact/detail/index.vue') component: () => import('@/views/crm/contact/detail/index.vue')
},
{
path: 'product/detail/:id',
name: 'CrmProductDetail',
meta: {
title: '产品详情',
noCache: true,
hidden: true,
activeMenu: '/crm/product'
},
component: () => import('@/views/crm/product/detail/index.vue')
} }
] ]
} }

View File

@ -103,7 +103,6 @@ export const getDictLabel = (dictType: string, value: any): string => {
export enum DICT_TYPE { export enum DICT_TYPE {
USER_TYPE = 'user_type', USER_TYPE = 'user_type',
COMMON_STATUS = 'common_status', COMMON_STATUS = 'common_status',
SYSTEM_TENANT_PACKAGE_ID = 'system_tenant_package_id',
TERMINAL = 'terminal', // 终端 TERMINAL = 'terminal', // 终端
// ========== SYSTEM 模块 ========== // ========== SYSTEM 模块 ==========

View File

@ -177,7 +177,7 @@ export const fileSizeFormatter = (row, column, cellValue) => {
* @param target * @param target
* @param source * @param source
*/ */
export const copyValueToTarget = (target, source) => { export const copyValueToTarget = (target: any, source: any) => {
const newObj = Object.assign({}, target, source) const newObj = Object.assign({}, target, source)
// 删除多余属性 // 删除多余属性
Object.keys(newObj).forEach((key) => { Object.keys(newObj).forEach((key) => {
@ -194,10 +194,10 @@ export const copyValueToTarget = (target, source) => {
* *
* @param num * @param num
*/ */
export const formatToFraction = (num: number | string | undefined): number => { export const formatToFraction = (num: number | string | undefined): string => {
if (typeof num === 'undefined') return 0 if (typeof num === 'undefined') return '0.00'
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
return parseFloat((parsedNumber / 100).toFixed(2)) return (parsedNumber / 100.0).toFixed(2)
} }
/** /**
@ -249,7 +249,7 @@ export const yuanToFen = (amount: string | number): number => {
/** /**
* *
*/ */
export const fenToYuan = (price: string | number): number => { export const fenToYuan = (price: string | number): string => {
return formatToFraction(price) return formatToFraction(price)
} }

View File

@ -1,71 +0,0 @@
<template>
<Dialog v-model="dialogVisible" :max-height="500" :scroll="true" title="产品详情">
<el-descriptions :column="1" border>
<el-descriptions-item label="产品名称">
{{ detailData.name }}
</el-descriptions-item>
<el-descriptions-item label="创建时间">
{{ formatDate(detailData.createTime) }}
</el-descriptions-item>
<el-descriptions-item label="状态">
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_STATUS" :value="detailData.status" />
</el-descriptions-item>
<el-descriptions-item label="产品分类">
{{ productCategoryList?.find((c) => c.id === detailData.categoryId)?.name }}
</el-descriptions-item>
<el-descriptions-item label="产品编码">
{{ detailData.no }}
</el-descriptions-item>
<el-descriptions-item label="产品描述">
{{ detailData.description }}
</el-descriptions-item>
<el-descriptions-item label="负责人">
{{ detailData.ownerUserId }}
</el-descriptions-item>
<el-descriptions-item label="单位">
<dict-tag :type="DICT_TYPE.PRODUCT_UNIT" :value="detailData.unit" />
</el-descriptions-item>
<el-descriptions-item label="价格">
{{ fenToYuan(detailData.price) }}
</el-descriptions-item>
</el-descriptions>
</Dialog>
</template>
<script setup lang="ts">
// TODO tab
import { DICT_TYPE } from '@/utils/dict'
import * as ProductCategoryApi from '@/api/crm/product/productCategory'
import * as ProductApi from '@/api/crm/product'
import { formatDate } from '@/utils/formatTime'
import { fenToYuan } from '@/utils'
import { getSimpleUserList, UserVO } from '@/api/system/user'
defineOptions({ name: 'CrmProductDetail' })
const { t } = useI18n() //
const dialogVisible = ref(false) //
const detailLoading = ref(false) //
const detailData = ref() //
/** 打开弹窗 */
const open = async (data: ProductApi.ProductVO) => {
dialogVisible.value = true
//
detailLoading.value = true
try {
detailData.value = data
} finally {
detailLoading.value = false
}
}
defineExpose({ open }) // open
const productCategoryList = ref([]) //
const userList = ref<UserVO[]>([]) //
onMounted(async () => {
productCategoryList.value = await ProductCategoryApi.getProductCategoryList({})
userList.value = await getSimpleUserList()
})
</script>

View File

@ -62,13 +62,13 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="价格" prop="price"> <el-form-item label="价格" prop="price">
<el-input <el-input-number
type="number"
v-model="formData.price" v-model="formData.price"
placeholder="请输入价格" placeholder="请输入价格"
:min="0" :min="0"
:precision="2" :precision="2"
:step="0.1" :step="0.1"
class="w-full!"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -149,7 +149,7 @@ const open = async (type: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await ProductApi.getProduct(id) formData.value = await ProductApi.getProduct(id)
formData.value.price = fenToYuan(formData.value.price) formData.value.price = Number(fenToYuan(formData.value.price))
} finally { } finally {
formLoading.value = false formLoading.value = false
} }

View File

@ -0,0 +1,55 @@
<template>
<div>
<div class="flex items-start justify-between">
<div>
<el-col>
<el-row>
<span class="text-xl font-bold">{{ product.name }}</span>
</el-row>
</el-col>
</div>
<div>
<!-- 右上按钮 -->
<el-button @click="openForm('update', product.id)" v-hasPermi="['crm:product:update']">
编辑
</el-button>
</div>
</div>
</div>
<ContentWrap class="mt-10px">
<el-descriptions :column="5" direction="vertical">
<el-descriptions-item label="产品类别">
{{ productCategoryList?.find((c) => c.id === product.categoryId)?.name }}
</el-descriptions-item>
<el-descriptions-item label="产品单位">
<dict-tag :type="DICT_TYPE.PRODUCT_UNIT" :value="product.unit" />
</el-descriptions-item>
<el-descriptions-item label="产品价格">{{ fenToYuan(product.price) }}</el-descriptions-item>
<el-descriptions-item label="产品编码">{{ product.no }}</el-descriptions-item>
</el-descriptions>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ProductForm ref="formRef" @success="emit('refresh')" />
</template>
<script setup lang="ts">
import ProductForm from '@/views/crm/product/ProductForm.vue'
import { DICT_TYPE } from '@/utils/dict'
import { fenToYuan } from '@/utils'
import * as ProductApi from '@/api/crm/product'
import * as ProductCategoryApi from '@/api/crm/product/productCategory'
//
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
const { product } = defineProps<{ product: ProductApi.ProductVO }>()
const emit = defineEmits(['refresh']) // success
/** 初始化 */
const productCategoryList = ref([]) //
onMounted(async () => {
productCategoryList.value = await ProductCategoryApi.getProductCategoryList({})
})
</script>

View File

@ -0,0 +1,45 @@
<template>
<ContentWrap>
<el-collapse v-model="activeNames">
<el-collapse-item name="basicInfo">
<template #title>
<span class="text-base font-bold">基本信息</span>
</template>
<el-descriptions :column="4">
<el-descriptions-item label="产品名称">{{ product.name }}</el-descriptions-item>
<el-descriptions-item label="产品编码">{{ product.no }}</el-descriptions-item>
<el-descriptions-item label="价格">{{ fenToYuan(product.price) }}</el-descriptions-item>
<el-descriptions-item label="产品描述">{{ product.description }}</el-descriptions-item>
<el-descriptions-item label="产品类型">
{{ productCategoryList?.find((c) => c.id === product.categoryId)?.name }}
</el-descriptions-item>
<el-descriptions-item label="是否上下架">
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_STATUS" :value="product.status"/>
</el-descriptions-item>
<el-descriptions-item label="单位">
<dict-tag :type="DICT_TYPE.PRODUCT_UNIT" :value="product.unit"/>
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
</el-collapse>
</ContentWrap>
</template>
<script setup lang="ts">
import {DICT_TYPE} from '@/utils/dict'
import * as ProductApi from '@/api/crm/product'
import {fenToYuan} from '@/utils'
import * as ProductCategoryApi from '@/api/crm/product/productCategory'
const {product} = defineProps<{
product: ProductApi.ProductVO
}>()
//
const activeNames = ref(['basicInfo'])
/** 初始化 */
const productCategoryList = ref([]) //
onMounted(async () => {
productCategoryList.value = await ProductCategoryApi.getProductCategoryList({})
})
</script>

View File

@ -0,0 +1,62 @@
<template>
<ProductDetailsHeader :product="product" :loading="loading" @refresh="getProductData(id)" />
<el-col>
<el-tabs>
<el-tab-pane label="详细资料">
<ProductDetailsInfo :product="product" />
</el-tab-pane>
<el-tab-pane label="操作日志">
<OperateLogV2 :log-list="logList" />
</el-tab-pane>
</el-tabs>
</el-col>
</template>
<script setup lang="ts">
import { useTagsViewStore } from '@/store/modules/tagsView'
import { OperateLogV2VO } from '@/api/system/operatelog'
import * as ProductApi from '@/api/crm/product'
import ProductDetailsHeader from '@/views/crm/product/detail/ProductDetailsHeader.vue'
import ProductDetailsInfo from '@/views/crm/product/detail/ProductDetailsInfo.vue'
defineOptions({ name: 'CrmProductDetail' })
const route = useRoute()
const id = Number(route.params.id) //
const loading = ref(true) //
const product = ref<ProductApi.ProductVO>({} as ProductApi.ProductVO) //
/** 获取详情 */
const getProductData = async (id: number) => {
loading.value = true
try {
product.value = await ProductApi.getProduct(id)
await getOperateLog(id)
} finally {
loading.value = false
}
}
/** 获取操作日志 */
const logList = ref<OperateLogV2VO[]>([]) //
const getOperateLog = async (productId: number) => {
if (!productId) {
return
}
const data = await ProductApi.getOperateLogPage({
bizId: productId
})
logList.value = data.list
}
/** 初始化 */
const { delView } = useTagsViewStore() //
const { currentRoute } = useRouter() //
onMounted(async () => {
if (!id) {
ElMessage.warning('参数错误,产品不能为空!')
delView(unref(currentRoute))
return
}
await getProductData(id)
})
</script>

View File

@ -28,8 +28,8 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> <el-button @click="handleQuery"> <Icon icon="ep:search" class="mr-5px" /> 搜索 </el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> <el-button @click="resetQuery"> <Icon icon="ep:refresh" class="mr-5px" /> 重置 </el-button>
<el-button type="primary" @click="openForm('create')" v-hasPermi="['crm:product:create']"> <el-button type="primary" @click="openForm('create')" v-hasPermi="['crm:product:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button> </el-button>
@ -40,7 +40,8 @@
:loading="exportLoading" :loading="exportLoading"
v-hasPermi="['crm:product:export']" v-hasPermi="['crm:product:export']"
> >
<Icon icon="ep:download" class="mr-5px" /> 导出 <Icon icon="ep:download" class="mr-5px" />
导出
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -49,8 +50,14 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="产品名称" align="center" prop="name" /> <el-table-column label="产品名称" align="center" prop="name" width="160">
<el-table-column label="产品类型" align="center" prop="categoryName" /> <template #default="scope">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }}
</el-link>
</template>
</el-table-column>
<el-table-column label="产品类型" align="center" prop="categoryName" width="160" />
<el-table-column label="产品单位" align="center" prop="unit"> <el-table-column label="产品单位" align="center" prop="unit">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.PRODUCT_UNIT" :value="scope.row.unit" /> <dict-tag :type="DICT_TYPE.PRODUCT_UNIT" :value="scope.row.unit" />
@ -62,14 +69,15 @@
align="center" align="center"
prop="price" prop="price"
:formatter="fenToYuanFormat" :formatter="fenToYuanFormat"
width="100"
/> />
<el-table-column label="产品描述" align="center" prop="description" /> <el-table-column label="产品描述" align="center" prop="description" width="150" />
<el-table-column label="是否架" align="center" prop="status"> <el-table-column label="上架状态" align="center" prop="status" width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.CRM_PRODUCT_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.CRM_PRODUCT_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="负责人" align="center" prop="ownerUserName" /> <el-table-column label="负责人" align="center" prop="ownerUserName" width="120" />
<el-table-column <el-table-column
label="更新时间" label="更新时间"
align="center" align="center"
@ -77,7 +85,7 @@
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column label="创建" align="center" prop="creatorName" /> <el-table-column label="创建" align="center" prop="creatorName" width="120" />
<el-table-column <el-table-column
label="创建时间" label="创建时间"
align="center" align="center"
@ -85,16 +93,8 @@
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column label="操作" align="center" width="160"> <el-table-column label="操作" align="center" fixed="right" width="160">
<template #default="scope"> <template #default="scope">
<el-button
v-hasPermi="['crm:product:query']"
link
type="primary"
@click="openDetail(scope.row)"
>
详情
</el-button>
<el-button <el-button
link link
type="primary" type="primary"
@ -125,8 +125,6 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<ProductForm ref="formRef" @success="getList" /> <ProductForm ref="formRef" @success="getList" />
<!-- 表单弹窗详情 -->
<ProductDetail ref="detailRef" @success="getList" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -135,7 +133,6 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as ProductApi from '@/api/crm/product' import * as ProductApi from '@/api/crm/product'
import ProductForm from './ProductForm.vue' import ProductForm from './ProductForm.vue'
import ProductDetail from './ProductDetail.vue'
import { fenToYuanFormat } from '@/utils/formatter' import { fenToYuanFormat } from '@/utils/formatter'
defineOptions({ name: 'CrmProduct' }) defineOptions({ name: 'CrmProduct' })
@ -184,10 +181,11 @@ const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
/** 详情操作 */
const detailRef = ref() /** 打开详情 */
const openDetail = (data: ProductApi.ProductVO) => { const { currentRoute, push } = useRouter()
detailRef.value.open(data) const openDetail = (id: number) => {
push({ name: 'CrmProductDetail', params: { id } })
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -218,8 +216,13 @@ const handleExport = async () => {
} }
} }
/** 激活时 */
onActivated(() => {
getList()
})
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(() => {
await getList() getList()
}) })
</script> </script>

View File

@ -25,10 +25,6 @@
<UploadImg v-model="formData.picUrl" :limit="1" :is-show-tip="false" /> <UploadImg v-model="formData.picUrl" :limit="1" :is-show-tip="false" />
<div style="font-size: 10px" class="pl-10px">推荐 180x180 图片分辨率</div> <div style="font-size: 10px" class="pl-10px">推荐 180x180 图片分辨率</div>
</el-form-item> </el-form-item>
<el-form-item label="PC 端分类图" prop="bigPicUrl">
<UploadImg v-model="formData.bigPicUrl" :limit="1" :is-show-tip="false" />
<div style="font-size: 10px" class="pl-10px">推荐 468x340 图片分辨率</div>
</el-form-item>
<el-form-item label="分类排序" prop="sort"> <el-form-item label="分类排序" prop="sort">
<el-input-number v-model="formData.sort" controls-position="right" :min="0" /> <el-input-number v-model="formData.sort" controls-position="right" :min="0" />
</el-form-item> </el-form-item>
@ -68,7 +64,6 @@ const formData = ref({
id: undefined, id: undefined,
name: '', name: '',
picUrl: '', picUrl: '',
bigPicUrl: '',
status: CommonStatusEnum.ENABLE status: CommonStatusEnum.ENABLE
}) })
const formRules = reactive({ const formRules = reactive({
@ -133,7 +128,6 @@ const resetForm = () => {
id: undefined, id: undefined,
name: '', name: '',
picUrl: '', picUrl: '',
bigPicUrl: '',
status: CommonStatusEnum.ENABLE status: CommonStatusEnum.ENABLE
} }
formRef.value?.resetFields() formRef.value?.resetFields()

View File

@ -38,7 +38,7 @@
<el-table-column label="名称" min-width="240" prop="name" sortable /> <el-table-column label="名称" min-width="240" prop="name" sortable />
<el-table-column label="分类图标" align="center" min-width="80" prop="picUrl"> <el-table-column label="分类图标" align="center" min-width="80" prop="picUrl">
<template #default="scope"> <template #default="scope">
<img v-if="scope.row.picUrl" :src="scope.row.picUrl" alt="移动端分类图" class="h-36px" /> <img :src="scope.row.picUrl" alt="移动端分类图" class="h-36px" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" min-width="150" prop="sort" /> <el-table-column label="排序" align="center" min-width="150" prop="sort" />

View File

@ -9,7 +9,7 @@
label-width="68px" label-width="68px"
> >
<el-form-item label="属性项" prop="propertyId"> <el-form-item label="属性项" prop="propertyId">
<el-select v-model="queryParams.propertyId" class="!w-240px"> <el-select v-model="queryParams.propertyId" class="!w-240px" disabled>
<el-option <el-option
v-for="item in propertyOptions" v-for="item in propertyOptions"
:key="item.id" :key="item.id"
@ -158,6 +158,6 @@ const handleDelete = async (id: number) => {
onMounted(async () => { onMounted(async () => {
await getList() await getList()
// //
propertyOptions.value = await PropertyApi.getPropertyList({}) propertyOptions.value.push(await PropertyApi.getProperty(queryParams.propertyId))
}) })
</script> </script>

View File

@ -8,9 +8,9 @@
max-height="500" max-height="500"
size="small" size="small"
> >
<el-table-column align="center" fixed="left" label="图片" min-width="100"> <el-table-column align="center" label="图片" min-width="65">
<template #default="{ row }"> <template #default="{ row }">
<UploadImg v-model="row.picUrl" height="80px" width="100%" /> <UploadImg v-model="row.picUrl" height="50px" width="50px" />
</template> </template>
</el-table-column> </el-table-column>
<template v-if="formData!.specType && !isBatch"> <template v-if="formData!.specType && !isBatch">
@ -34,12 +34,19 @@
<el-input v-model="row.barCode" class="w-100%" /> <el-input v-model="row.barCode" class="w-100%" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="销售价(元)" min-width="168"> <el-table-column align="center" label="销售价" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.price" :min="0" :precision="2" :step="0.1" class="w-100%" /> <el-input-number
v-model="row.price"
:min="0"
:precision="2"
:step="0.1"
class="w-100%"
controls-position="right"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="市场价(元)" min-width="168"> <el-table-column align="center" label="市场价" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input-number
v-model="row.marketPrice" v-model="row.marketPrice"
@ -47,10 +54,11 @@
:precision="2" :precision="2"
:step="0.1" :step="0.1"
class="w-100%" class="w-100%"
controls-position="right"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="成本价(元)" min-width="168"> <el-table-column align="center" label="成本价" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number <el-input-number
v-model="row.costPrice" v-model="row.costPrice"
@ -58,22 +66,37 @@
:precision="2" :precision="2"
:step="0.1" :step="0.1"
class="w-100%" class="w-100%"
controls-position="right"
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="库存" min-width="168"> <el-table-column align="center" label="库存" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.stock" :min="0" class="w-100%" /> <el-input-number v-model="row.stock" :min="0" class="w-100%" controls-position="right" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="重量(kg)" min-width="168"> <el-table-column align="center" label="重量(kg)" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.weight" :min="0" :precision="2" :step="0.1" class="w-100%" /> <el-input-number
v-model="row.weight"
:min="0"
:precision="2"
:step="0.1"
class="w-100%"
controls-position="right"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="体积(m^3)" min-width="168"> <el-table-column align="center" label="体积(m^3)" min-width="168">
<template #default="{ row }"> <template #default="{ row }">
<el-input-number v-model="row.volume" :min="0" :precision="2" :step="0.1" class="w-100%" /> <el-input-number
v-model="row.volume"
:min="0"
:precision="2"
:step="0.1"
class="w-100%"
controls-position="right"
/>
</template> </template>
</el-table-column> </el-table-column>
<template v-if="formData!.subCommissionType"> <template v-if="formData!.subCommissionType">
@ -85,6 +108,7 @@
:precision="2" :precision="2"
:step="0.1" :step="0.1"
class="w-100%" class="w-100%"
controls-position="right"
/> />
</template> </template>
</el-table-column> </el-table-column>
@ -96,6 +120,7 @@
:precision="2" :precision="2"
:step="0.1" :step="0.1"
class="w-100%" class="w-100%"
controls-position="right"
/> />
</template> </template>
</el-table-column> </el-table-column>
@ -124,7 +149,12 @@
<el-table-column v-if="isComponent" type="selection" width="45" /> <el-table-column v-if="isComponent" type="selection" width="45" />
<el-table-column align="center" label="图片" min-width="80"> <el-table-column align="center" label="图片" min-width="80">
<template #default="{ row }"> <template #default="{ row }">
<el-image :src="row.picUrl" class="h-60px w-60px" @click="imagePreview(row.picUrl)" /> <el-image
v-if="row.picUrl"
:src="row.picUrl"
class="h-50px w-50px"
@click="imagePreview(row.picUrl)"
/>
</template> </template>
</el-table-column> </el-table-column>
<template v-if="formData!.specType && !isBatch"> <template v-if="formData!.specType && !isBatch">

View File

@ -1,66 +0,0 @@
<template>
<div ref="elTagWrappingRef">
<template v-if="activityOrders && activityOrders.length > 0">
<el-tag
v-for="activityType in activityOrders"
:key="activityType"
:type="promotionTypes.find((item) => item.value === activityType)?.colorType"
class="mr-[10px]"
>
{{ promotionTypes.find((item) => item.value === activityType)?.label }}
</el-tag>
</template>
<template v-else>
<el-tag
v-for="type in promotionTypes"
:key="type.value as number"
:type="type.colorType"
class="mr-[10px]"
>
{{ type.label }}
</el-tag>
</template>
</div>
</template>
<script lang="ts" setup>
import Sortable from 'sortablejs'
import type { DictDataType } from '@/utils/dict'
defineOptions({ name: 'ActivityOrdersSort' })
const props = defineProps<{
promotionTypes: DictDataType[]
activityOrders: number[]
}>()
const emit = defineEmits<{
(e: 'update:activityOrders', v: number[])
}>()
const elTagWrappingRef = ref() // elTag Ref
const initSortable = () => {
new Sortable(elTagWrappingRef.value, {
swapThreshold: 1,
animation: 150,
onEnd: (el) => {
const innerText = el.to.innerText
//
const activityOrder = innerText.split('\n')
//
const sortedActivityOrder = activityOrder.map((activityName) => {
return props.promotionTypes.find((item) => item.label === activityName)?.value
})
emit('update:activityOrders', sortedActivityOrder as number[])
}
})
}
onMounted(async () => {
await nextTick()
//
if (props.activityOrders && props.activityOrders.length === 0) {
emit(
'update:activityOrders',
props.promotionTypes.map((item) => item.value as number)
)
}
initSortable()
})
</script>

View File

@ -1,375 +0,0 @@
<template>
<!-- 情况一添加/修改 -->
<el-form
v-if="!isDetail"
ref="productSpuBasicInfoRef"
:model="formData"
:rules="rules"
label-width="120px"
>
<el-row>
<el-col :span="12">
<el-form-item label="商品名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品分类" prop="categoryId">
<el-cascader
v-model="formData.categoryId"
:options="categoryList"
:props="defaultProps"
class="w-1/1"
clearable
placeholder="请选择商品分类"
filterable
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品关键字" prop="keyword">
<el-input v-model="formData.keyword" placeholder="请输入商品关键字" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select v-model="formData.unit" class="w-1/1" placeholder="请选择单位">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.PRODUCT_UNIT)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品简介" prop="introduction">
<el-input
v-model="formData.introduction"
:rows="3"
placeholder="请输入商品简介"
type="textarea"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品封面图" prop="picUrl">
<UploadImg v-model="formData.picUrl" height="80px" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品轮播图" prop="sliderPicUrls">
<UploadImgs v-model:modelValue="formData.sliderPicUrls" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运费模板" prop="deliveryTemplateId">
<el-select v-model="formData.deliveryTemplateId" placeholder="请选择">
<el-option
v-for="item in deliveryTemplateList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="品牌" prop="brandId">
<el-select v-model="formData.brandId" placeholder="请选择">
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品规格" props="specType">
<el-radio-group v-model="formData.specType" @change="onChangeSpec">
<el-radio :label="false" class="radio">单规格</el-radio>
<el-radio :label="true">多规格</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分销类型" props="subCommissionType">
<el-radio-group v-model="formData.subCommissionType" @change="changeSubCommissionType">
<el-radio :label="false">默认设置</el-radio>
<el-radio :label="true" class="radio">单独设置</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<!-- 多规格添加-->
<el-col :span="24">
<el-form-item v-if="!formData.specType">
<SkuList
ref="skuListRef"
:prop-form-data="formData"
:propertyList="propertyList"
:rule-config="ruleConfig"
/>
</el-form-item>
<el-form-item v-if="formData.specType" label="商品属性">
<el-button class="mb-10px mr-15px" @click="attributesAddFormRef.open">添加属性</el-button>
<ProductAttributes :propertyList="propertyList" @success="generateSkus" />
</el-form-item>
<template v-if="formData.specType && propertyList.length > 0">
<el-form-item label="批量设置">
<SkuList :is-batch="true" :prop-form-data="formData" :propertyList="propertyList" />
</el-form-item>
<el-form-item label="属性列表">
<SkuList
ref="skuListRef"
:prop-form-data="formData"
:propertyList="propertyList"
:rule-config="ruleConfig"
/>
</el-form-item>
</template>
</el-col>
</el-row>
</el-form>
<!-- 情况二详情 -->
<Descriptions v-if="isDetail" :data="formData" :schema="allSchemas.detailSchema">
<template #categoryId="{ row }"> {{ formatCategoryName(row.categoryId) }}</template>
<template #brandId="{ row }">
{{ brandList.find((item) => item.id === row.brandId)?.name }}
</template>
<template #deliveryTemplateId="{ row }">
{{ deliveryTemplateList.find((item) => item.id === row.deliveryTemplateId)?.name }}
</template>
<template #specType="{ row }">
{{ row.specType ? '多规格' : '单规格' }}
</template>
<template #subCommissionType="{ row }">
{{ row.subCommissionType ? '单独设置' : '默认设置' }}
</template>
<template #picUrl="{ row }">
<el-image :src="row.picUrl" class="h-60px w-60px" @click="imagePreview(row.picUrl)" />
</template>
<template #sliderPicUrls="{ row }">
<el-image
v-for="(item, index) in row.sliderPicUrls"
:key="index"
:src="item.url"
class="mr-10px h-60px w-60px"
@click="imagePreview(row.sliderPicUrls)"
/>
</template>
<template #skus>
<SkuList
ref="skuDetailListRef"
:is-detail="isDetail"
:prop-form-data="formData"
:propertyList="propertyList"
/>
</template>
</Descriptions>
<!-- 商品属性添加 Form 表单 -->
<ProductPropertyAddForm ref="attributesAddFormRef" :propertyList="propertyList" />
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { isArray } from '@/utils/is'
import { copyValueToTarget } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree'
import { createImageViewer } from '@/components/ImageViewer'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { getPropertyList, RuleConfig, SkuList } from '@/views/mall/product/spu/components/index.ts'
import ProductAttributes from './ProductAttributes.vue'
import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
import { basicInfoSchema } from './spu.data'
import type { Spu } from '@/api/mall/product/spu'
import * as ProductCategoryApi from '@/api/mall/product/category'
import * as ProductBrandApi from '@/api/mall/product/brand'
import * as ExpressTemplateApi from '@/api/mall/trade/delivery/expressTemplate'
defineOptions({ name: 'ProductSpuBasicInfoForm' })
// sku
const ruleConfig: RuleConfig[] = [
{
name: 'stock',
rule: (arg) => arg >= 0,
message: '商品库存必须大于等于 1 '
},
{
name: 'price',
rule: (arg) => arg >= 0.01,
message: '商品销售价格必须大于等于 0.01 元!!!'
},
{
name: 'marketPrice',
rule: (arg) => arg >= 0.01,
message: '商品市场价格必须大于等于 0.01 元!!!'
},
{
name: 'costPrice',
rule: (arg) => arg >= 0.01,
message: '商品成本价格必须大于等于 0.00 元!!!'
}
]
// ====== ======
const { allSchemas } = useCrudSchemas(basicInfoSchema)
/** 商品图预览 */
const imagePreview = (args) => {
const urlList = []
if (isArray(args)) {
args.forEach((item) => {
urlList.push(item.url)
})
} else {
urlList.push(args)
}
createImageViewer({
urlList
})
}
// ====== end ======
const message = useMessage() //
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
activeName: propTypes.string.def(''),
isDetail: propTypes.bool.def(false) //
})
const attributesAddFormRef = ref() //
const productSpuBasicInfoRef = ref() // Ref
const propertyList = ref([]) //
const skuListRef = ref() // Ref
/** 调用 SkuList generateTableData 方法*/
const generateSkus = (propertyList) => {
skuListRef.value.generateTableData(propertyList)
}
const formData = reactive<Spu>({
name: '', //
categoryId: null, //
keyword: '', //
unit: null, //
picUrl: '', //
sliderPicUrls: [], //
introduction: '', //
deliveryTemplateId: null, //
brandId: null, //
specType: false, //
subCommissionType: false, //
skus: []
})
const rules = reactive({
name: [required],
categoryId: [required],
keyword: [required],
unit: [required],
introduction: [required],
picUrl: [required],
sliderPicUrls: [required],
deliveryTemplateId: [required],
brandId: [required],
specType: [required],
subCommissionType: [required]
})
/**
* 将传进来的值赋值给 formData
*/
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData, data)
formData.sliderPicUrls = data['sliderPicUrls']?.map((item) => ({
url: item
}))
propertyList.value = getPropertyList(data)
},
{
immediate: true
}
)
/**
* 表单校验
*/
const emit = defineEmits(['update:activeName'])
const validate = async () => {
// sku
skuListRef.value.validateSku()
//
if (!productSpuBasicInfoRef) return
return await unref(productSpuBasicInfoRef).validate((valid) => {
if (!valid) {
message.warning('商品信息未完善!!')
emit('update:activeName', 'basicInfo')
//
throw new Error('商品信息未完善!!')
} else {
//
Object.assign(props.propFormData, formData)
}
})
}
defineExpose({ validate })
/** 分销类型 */
const changeSubCommissionType = () => {
//
for (const item of formData.skus) {
item.firstBrokeragePrice = 0
item.secondBrokeragePrice = 0
}
}
/** 选择规格 */
const onChangeSpec = () => {
//
propertyList.value = []
// sku
formData.skus = [
{
price: 0,
marketPrice: 0,
costPrice: 0,
barCode: '',
picUrl: '',
stock: 0,
weight: 0,
volume: 0,
firstBrokeragePrice: 0,
secondBrokeragePrice: 0
}
]
}
const categoryList = ref([]) //
/** 获取分类的节点的完整结构 */
const formatCategoryName = (categoryId) => {
return treeToString(categoryList.value, categoryId)
}
const brandList = ref([]) //
const deliveryTemplateList = ref([]) //
onMounted(async () => {
//
const data = await ProductCategoryApi.getCategoryList({})
categoryList.value = handleTree(data, 'id', 'parentId')
//
brandList.value = await ProductBrandApi.getSimpleBrandList()
//
deliveryTemplateList.value = await ExpressTemplateApi.getSimpleTemplateList()
})
</script>

View File

@ -0,0 +1,96 @@
<!-- 商品发布 - 物流设置 -->
<template>
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form-item label="配送方式" prop="deliveryTypes">
<el-checkbox-group v-model="formData.deliveryTypes" class="w-80">
<el-checkbox
v-for="dict in getIntDictOptions(DICT_TYPE.TRADE_DELIVERY_TYPE)"
:key="dict.value"
:label="dict.value"
>
{{ dict.label }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item
label="运费模板"
prop="deliveryTemplateId"
v-if="formData.deliveryTypes?.includes(DeliveryTypeEnum.EXPRESS.type)"
>
<el-select placeholder="请选择运费模板" v-model="formData.deliveryTemplateId" class="w-80">
<el-option
v-for="item in deliveryTemplateList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { copyValueToTarget } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import type { Spu } from '@/api/mall/product/spu'
import * as ExpressTemplateApi from '@/api/mall/trade/delivery/expressTemplate'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { DeliveryTypeEnum } from '@/utils/constants'
defineOptions({ name: 'ProductDeliveryForm' })
const message = useMessage() //
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
isDetail: propTypes.bool.def(false) //
})
const formRef = ref() // Ref
const formData = reactive<Spu>({
deliveryTypes: [], //
deliveryTemplateId: undefined //
})
const rules = reactive({
deliveryTypes: [required],
deliveryTemplateId: [required]
})
/** 将传进来的值赋值给 formData */
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData, data)
},
{
immediate: true
}
)
/** 表单校验 */
const emit = defineEmits(['update:activeName'])
const validate = async () => {
if (!formRef) return
try {
await unref(formRef)?.validate()
//
Object.assign(props.propFormData, formData)
} catch (e) {
message.error('【物流设置】不完善,请填写相关信息')
emit('update:activeName', 'delivery')
throw e //
}
}
defineExpose({ validate })
/** 初始化 */
const deliveryTemplateList = ref([]) //
onMounted(async () => {
deliveryTemplateList.value = await ExpressTemplateApi.getSimpleTemplateList()
})
</script>

View File

@ -1,30 +1,11 @@
<!-- 商品发布 - 商品详情 -->
<template> <template>
<!-- 情况一添加/修改 --> <el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form
v-if="!isDetail"
ref="descriptionFormRef"
:model="formData"
:rules="rules"
label-width="120px"
>
<!--富文本编辑器组件--> <!--富文本编辑器组件-->
<el-form-item label="商品详情" prop="description"> <el-form-item label="商品详情" prop="description">
<Editor v-model:modelValue="formData.description" /> <Editor v-model:modelValue="formData.description" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 情况二详情 -->
<Descriptions
v-if="isDetail"
:data="formData"
:schema="allSchemas.detailSchema"
class="descriptionFormDescriptions"
>
<!-- 展示 HTML 内容 -->
<template #description="{ row }">
<div v-dompurify-html="row.description" style="width: 600px"></div>
</template>
</Descriptions>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import type { Spu } from '@/api/mall/product/spu' import type { Spu } from '@/api/mall/product/spu'
@ -32,13 +13,11 @@ import { Editor } from '@/components/Editor'
import { PropType } from 'vue' import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes' import { propTypes } from '@/utils/propTypes'
import { copyValueToTarget } from '@/utils' import { copyValueToTarget } from '@/utils'
import { descriptionSchema } from './spu.data'
defineOptions({ name: 'DescriptionForm' }) defineOptions({ name: 'ProductDescriptionForm' })
const message = useMessage() // const message = useMessage() //
const { allSchemas } = useCrudSchemas(descriptionSchema)
const props = defineProps({ const props = defineProps({
propFormData: { propFormData: {
type: Object as PropType<Spu>, type: Object as PropType<Spu>,
@ -47,7 +26,7 @@ const props = defineProps({
activeName: propTypes.string.def(''), activeName: propTypes.string.def(''),
isDetail: propTypes.bool.def(false) // isDetail: propTypes.bool.def(false) //
}) })
const descriptionFormRef = ref() // Ref const formRef = ref() // Ref
const formData = ref<Spu>({ const formData = ref<Spu>({
description: '' // description: '' //
}) })
@ -55,9 +34,8 @@ const formData = ref<Spu>({
const rules = reactive({ const rules = reactive({
description: [required] description: [required]
}) })
/**
* 富文本编辑器如果输入过再清空会有残留需再重置一次 /** 富文本编辑器如果输入过再清空会有残留,需再重置一次 */
*/
watch( watch(
() => formData.value.description, () => formData.value.description,
(newValue) => { (newValue) => {
@ -70,9 +48,8 @@ watch(
immediate: true immediate: true
} }
) )
/**
* 将传进来的值赋值给formData /** 将传进来的值赋值给 formData */
*/
watch( watch(
() => props.propFormData, () => props.propFormData,
(data) => { (data) => {
@ -86,24 +63,19 @@ watch(
} }
) )
/** /** 表单校验 */
* 表单校验
*/
const emit = defineEmits(['update:activeName']) const emit = defineEmits(['update:activeName'])
const validate = async () => { const validate = async () => {
// if (!formRef) return
if (!descriptionFormRef) return try {
return await unref(descriptionFormRef).validate((valid) => { await unref(formRef)?.validate()
if (!valid) {
message.warning('商品详情为完善!!')
emit('update:activeName', 'description')
//
throw new Error('商品详情为完善!!')
} else {
// //
Object.assign(props.propFormData, formData.value) Object.assign(props.propFormData, formData.value)
} catch (e) {
message.error('【商品详情】不完善,请填写相关信息')
emit('update:activeName', 'description')
throw e //
} }
})
} }
defineExpose({ validate }) defineExpose({ validate })
</script> </script>

View File

@ -0,0 +1,146 @@
<!-- 商品发布 - 基础设置 -->
<template>
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form-item label="商品名称" prop="name">
<el-input
v-model="formData.name"
placeholder="请输入商品名称"
type="textarea"
:autosize="{ minRows: 2, maxRows: 2 }"
maxlength="64"
:show-word-limit="true"
:clearable="true"
class="w-80!"
/>
</el-form-item>
<el-form-item label="商品分类" prop="categoryId">
<el-cascader
v-model="formData.categoryId"
:options="categoryList"
:props="defaultProps"
class="w-80"
clearable
placeholder="请选择商品分类"
filterable
/>
</el-form-item>
<el-form-item label="商品品牌" prop="brandId">
<el-select v-model="formData.brandId" placeholder="请选择商品品牌" class="w-80">
<el-option
v-for="item in brandList"
:key="item.id"
:label="item.name"
:value="item.id as number"
/>
</el-select>
</el-form-item>
<el-form-item label="商品关键字" prop="keyword">
<el-input v-model="formData.keyword" placeholder="请输入商品关键字" class="w-80!" />
</el-form-item>
<el-form-item label="商品简介" prop="introduction">
<el-input
v-model="formData.introduction"
placeholder="请输入商品名称"
type="textarea"
:autosize="{ minRows: 2, maxRows: 2 }"
maxlength="128"
:show-word-limit="true"
:clearable="true"
class="w-80!"
/>
</el-form-item>
<el-form-item label="商品封面图" prop="picUrl">
<UploadImg v-model="formData.picUrl" height="80px" :disabled="isDetail" />
</el-form-item>
<el-form-item label="商品轮播图" prop="sliderPicUrls">
<UploadImgs v-model:modelValue="formData.sliderPicUrls" :disabled="isDetail" />
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { copyValueToTarget } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import { defaultProps, handleTree } from '@/utils/tree'
import type { Spu } from '@/api/mall/product/spu'
import * as ProductCategoryApi from '@/api/mall/product/category'
import * as ProductBrandApi from '@/api/mall/product/brand'
import { BrandVO } from '@/api/mall/product/brand'
import { CategoryVO } from '@/api/mall/product/category'
defineOptions({ name: 'ProductSpuInfoForm' })
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
isDetail: propTypes.bool.def(false) //
})
const message = useMessage() //
const formRef = ref() // Ref
const formData = reactive<Spu>({
name: '', //
categoryId: undefined, //
keyword: '', //
picUrl: '', //
sliderPicUrls: [], //
introduction: '', //
brandId: undefined //
})
const rules = reactive({
name: [required],
categoryId: [required],
keyword: [required],
introduction: [required],
picUrl: [required],
sliderPicUrls: [required],
brandId: [required]
})
/** 将传进来的值赋值给 formData */
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData, data)
// TODO @puhui999 v-model
formData.sliderPicUrls = data['sliderPicUrls']?.map((item) => ({
url: item
}))
},
{
immediate: true
}
)
/** 表单校验 */
const emit = defineEmits(['update:activeName'])
const validate = async () => {
if (!formRef) return
try {
await unref(formRef)?.validate()
//
Object.assign(props.propFormData, formData)
} catch (e) {
message.error('【基础设置】不完善,请填写相关信息')
emit('update:activeName', 'info')
throw e //
}
}
defineExpose({ validate })
/** 初始化 */
const brandList = ref<BrandVO[]>([]) //
const categoryList = ref<CategoryVO[]>([]) //
onMounted(async () => {
//
const data = await ProductCategoryApi.getCategoryList({})
categoryList.value = handleTree(data, 'id')
//
brandList.value = await ProductBrandApi.getSimpleBrandList()
})
</script>

View File

@ -0,0 +1,91 @@
<!-- 商品发布 - 其它设置 -->
<template>
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form-item label="商品排序" prop="sort">
<el-input-number
v-model="formData.sort"
:min="0"
placeholder="请输入商品排序"
class="w-80!"
/>
</el-form-item>
<el-form-item label="赠送积分" prop="giveIntegral">
<el-input-number
v-model="formData.giveIntegral"
:min="0"
placeholder="请输入赠送积分"
class="w-80!"
/>
</el-form-item>
<el-form-item label="虚拟销量" prop="virtualSalesCount">
<el-input-number
v-model="formData.virtualSalesCount"
:min="0"
placeholder="请输入虚拟销量"
class="w-80!"
/>
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
import type { Spu } from '@/api/mall/product/spu'
import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { copyValueToTarget } from '@/utils'
defineOptions({ name: 'ProductOtherForm' })
const message = useMessage() //
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
isDetail: propTypes.bool.def(false) //
})
const formRef = ref() // Ref
//
const formData = ref<Spu>({
sort: 0, //
giveIntegral: 0, //
virtualSalesCount: 0 //
})
//
const rules = reactive({
sort: [required],
giveIntegral: [required],
virtualSalesCount: [required]
})
/** 将传进来的值赋值给 formData */
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData.value, data)
},
{
immediate: true
}
)
/** 表单校验 */
const emit = defineEmits(['update:activeName'])
const validate = async () => {
if (!formRef) return
try {
await unref(formRef)?.validate()
//
Object.assign(props.propFormData, formData.value)
} catch (e) {
message.error('【其它设置】不完善,请填写相关信息')
emit('update:activeName', 'other')
throw e //
}
}
defineExpose({ validate })
</script>

View File

@ -1,209 +0,0 @@
<template>
<!-- 情况一添加/修改 -->
<el-form
v-if="!isDetail"
ref="otherSettingsFormRef"
:model="formData"
:rules="rules"
label-width="120px"
>
<el-row>
<el-col :span="24">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="商品排序" prop="sort">
<el-input-number v-model="formData.sort" :min="0" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="赠送积分" prop="giveIntegral">
<el-input-number v-model="formData.giveIntegral" :min="0" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="虚拟销量" prop="virtualSalesCount">
<el-input-number
v-model="formData.virtualSalesCount"
:min="0"
placeholder="请输入虚拟销量"
/>
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="24">
<el-form-item label="商品推荐">
<el-checkbox-group v-model="checkboxGroup" @change="onChangeGroup">
<el-checkbox v-for="(item, index) in recommendOptions" :key="index" :label="item.value">
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="活动优先级">
<ActivityOrdersSort
v-model:activity-orders="formData.activityOrders"
:promotion-types="promotionTypes"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 情况二详情 -->
<Descriptions v-if="isDetail" :data="formData" :schema="allSchemas.detailSchema">
<template #recommendHot="{ row }">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.recommendHot" />
</template>
<template #recommendBenefit="{ row }">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.recommendBenefit" />
</template>
<template #recommendBest="{ row }">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.recommendBest" />
</template>
<template #recommendNew="{ row }">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.recommendNew" />
</template>
<template #recommendGood="{ row }">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="row.recommendGood" />
</template>
<template #activityOrders="{ row }">
<el-tag
v-for="activityType in row.activityOrders"
:key="activityType"
:type="promotionTypes.find((item) => item.value === activityType)?.colorType"
class="mr-[10px]"
>
{{ promotionTypes.find((item) => item.value === activityType)?.label }}
</el-tag>
</template>
</Descriptions>
</template>
<script lang="ts" setup>
import type { Spu } from '@/api/mall/product/spu'
import { PropType } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { copyValueToTarget } from '@/utils'
import { otherSettingsSchema } from './spu.data'
import { DICT_TYPE, DictDataType } from '@/utils/dict'
import ActivityOrdersSort from './ActivityOrdersSort.vue'
defineOptions({ name: 'OtherSettingsForm' })
const message = useMessage() //
const { allSchemas } = useCrudSchemas(otherSettingsSchema)
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
activeName: propTypes.string.def(''),
isDetail: propTypes.bool.def(false) //
})
// TODO @puhui999 promotion_type_enum
//
const promotionTypes = ref<DictDataType[]>([
{
dictType: 'promotionTypes',
label: '秒杀',
value: 1,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '砍价',
value: 2,
colorType: 'warning',
cssClass: ''
},
{
dictType: 'promotionTypes',
label: '拼团',
value: 3,
colorType: 'warning',
cssClass: ''
}
])
const otherSettingsFormRef = ref() // Ref
//
const formData = ref<Spu>({
sort: 1, //
giveIntegral: 1, //
virtualSalesCount: 1, //
recommendHot: false, //
recommendBenefit: false, //
recommendBest: false, //
recommendNew: false, //
recommendGood: false, //
activityOrders: [] //
})
//
const rules = reactive({
sort: [required],
giveIntegral: [required],
virtualSalesCount: [required]
})
const recommendOptions = [
{ name: '是否热卖', value: 'recommendHot' },
{ name: '是否优惠', value: 'recommendBenefit' },
{ name: '是否精品', value: 'recommendBest' },
{ name: '是否新品', value: 'recommendNew' },
{ name: '是否优品', value: 'recommendGood' }
] //
const checkboxGroup = ref<string[]>([]) //
/** 选择商品后赋值 */
const onChangeGroup = () => {
recommendOptions.forEach(({ value }) => {
formData.value[value] = checkboxGroup.value.includes(value)
})
}
/**
* 将传进来的值赋值给formData
*/
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData.value, data)
recommendOptions.forEach(({ value }) => {
if (formData.value[value] && !checkboxGroup.value.includes(value)) {
checkboxGroup.value.push(value)
}
})
},
{
immediate: true
}
)
/**
* 表单校验
*/
const emit = defineEmits(['update:activeName'])
const validate = async () => {
//
if (!otherSettingsFormRef) return
return await unref(otherSettingsFormRef).validate((valid) => {
if (!valid) {
message.warning('商品其他设置未完善!!')
emit('update:activeName', 'otherSettings')
//
throw new Error('商品其他设置未完善!!')
} else {
//
Object.assign(props.propFormData, formData.value)
}
})
}
defineExpose({ validate })
</script>

View File

@ -1,9 +1,10 @@
<!-- 商品发布 - 库存价格 - 属性列表 -->
<template> <template>
<el-col v-for="(item, index) in attributeList" :key="index"> <el-col v-for="(item, index) in attributeList" :key="index">
<div> <div>
<el-text class="mx-1">属性名</el-text> <el-text class="mx-1">属性名</el-text>
<el-tag class="mx-1" closable type="success" @close="handleCloseProperty(index)" <el-tag class="mx-1" :closable="!isDetail" type="success" @close="handleCloseProperty(index)">
>{{ item.name }} {{ item.name }}
</el-tag> </el-tag>
</div> </div>
<div> <div>
@ -12,7 +13,7 @@
v-for="(value, valueIndex) in item.values" v-for="(value, valueIndex) in item.values"
:key="value.id" :key="value.id"
class="mx-1" class="mx-1"
closable :closable="!isDetail"
@close="handleCloseValue(index, valueIndex)" @close="handleCloseValue(index, valueIndex)"
> >
{{ value.name }} {{ value.name }}
@ -43,6 +44,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ElInput } from 'element-plus' import { ElInput } from 'element-plus'
import * as PropertyApi from '@/api/mall/product/property' import * as PropertyApi from '@/api/mall/product/property'
import { PropertyVO } from '@/api/mall/product/property'
import { PropertyAndValues } from '@/views/mall/product/spu/components'
import { propTypes } from '@/utils/propTypes'
defineOptions({ name: 'ProductAttributes' }) defineOptions({ name: 'ProductAttributes' })
@ -51,7 +55,7 @@ const message = useMessage() // 消息弹窗
const inputValue = ref('') // const inputValue = ref('') //
const attributeIndex = ref<number | null>(null) // index const attributeIndex = ref<number | null>(null) // index
// //
const inputVisible = computed(() => (index) => { const inputVisible = computed(() => (index: number) => {
if (attributeIndex.value === null) return false if (attributeIndex.value === null) return false
if (attributeIndex.value === index) return true if (attributeIndex.value === index) return true
}) })
@ -59,17 +63,18 @@ const inputRef = ref([]) //标签输入框Ref
/** 解决 ref 在 v-for 中的获取问题*/ /** 解决 ref 在 v-for 中的获取问题*/
const setInputRef = (el) => { const setInputRef = (el) => {
if (el === null || typeof el === 'undefined') return if (el === null || typeof el === 'undefined') return
// id // id
if (!inputRef.value.some((item) => item.input?.attributes.id === el.input?.attributes.id)) { if (!inputRef.value.some((item) => item.input?.attributes.id === el.input?.attributes.id)) {
inputRef.value.push(el) inputRef.value.push(el)
} }
} }
const attributeList = ref([]) // const attributeList = ref<PropertyAndValues[]>([]) //
const props = defineProps({ const props = defineProps({
propertyList: { propertyList: {
type: Array, type: Array,
default: () => {} default: () => {}
} },
isDetail: propTypes.bool.def(false) //
}) })
watch( watch(
@ -85,23 +90,24 @@ watch(
) )
/** 删除属性值*/ /** 删除属性值*/
const handleCloseValue = (index, valueIndex) => { const handleCloseValue = (index: number, valueIndex: number) => {
attributeList.value[index].values?.splice(valueIndex, 1) attributeList.value[index].values?.splice(valueIndex, 1)
} }
/** 删除属性*/ /** 删除属性*/
const handleCloseProperty = (index) => { const handleCloseProperty = (index: number) => {
attributeList.value?.splice(index, 1) attributeList.value?.splice(index, 1)
} }
/** 显示输入框并获取焦点 */ /** 显示输入框并获取焦点 */
const showInput = async (index) => { const showInput = async (index) => {
attributeIndex.value = index attributeIndex.value = index
inputRef.value[index].focus() inputRef.value[index].focus()
} }
const emit = defineEmits(['success']) // success
/** 输入框失去焦点或点击回车时触发 */ /** 输入框失去焦点或点击回车时触发 */
const handleInputConfirm = async (index, propertyId) => { const emit = defineEmits(['success']) // success
const handleInputConfirm = async (index: number, propertyId: number) => {
if (inputValue.value) { if (inputValue.value) {
// //
try { try {
@ -110,7 +116,7 @@ const handleInputConfirm = async (index, propertyId) => {
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
emit('success', attributeList.value) emit('success', attributeList.value)
} catch { } catch {
message.error('添加失败,请重试') // TODO message.error('添加失败,请重试')
} }
} }
attributeIndex.value = null attributeIndex.value = null

View File

@ -1,5 +1,6 @@
<!-- 商品发布 - 库存价格 - 添加属性 -->
<template> <template>
<Dialog v-model="dialogVisible" :title="dialogTitle"> <Dialog v-model="dialogVisible" title="添加商品属性">
<el-form <el-form
ref="formRef" ref="formRef"
v-loading="formLoading" v-loading="formLoading"
@ -26,8 +27,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // const message = useMessage() //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('添加商品属性') // const formLoading = ref(false) //
const formLoading = ref(false) // 12
const formData = ref({ const formData = ref({
name: '' name: ''
}) })
@ -44,7 +44,7 @@ const props = defineProps({
}) })
watch( watch(
() => props.propertyList, () => props.propertyList, // props
(data) => { (data) => {
if (!data) return if (!data) return
attributeList.value = data attributeList.value = data
@ -54,6 +54,7 @@ watch(
immediate: true immediate: true
} }
) )
/** 打开弹窗 */ /** 打开弹窗 */
const open = async () => { const open = async () => {
dialogVisible.value = true dialogVisible.value = true
@ -71,19 +72,13 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as PropertyApi.PropertyVO const data = formData.value as PropertyApi.PropertyVO
//
const res = await PropertyApi.getPropertyListAndValue({ name: data.name })
if (res.length === 0) {
const propertyId = await PropertyApi.createProperty(data) const propertyId = await PropertyApi.createProperty(data)
attributeList.value.push({ id: propertyId, ...formData.value, values: [] }) //
} else { attributeList.value.push({
if (res[0].values === null) { id: propertyId,
res[0].values = [] ...formData.value,
} values: []
// })
res[0].values = []
attributeList.value.push(res[0]) //
}
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
dialogVisible.value = false dialogVisible.value = false
} finally { } finally {

View File

@ -0,0 +1,187 @@
<!-- 商品发布 - 库存价格 -->
<template>
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form-item label="分销类型" props="subCommissionType">
<el-radio-group
v-model="formData.subCommissionType"
@change="changeSubCommissionType"
class="w-80"
>
<el-radio :label="false">默认设置</el-radio>
<el-radio :label="true" class="radio">单独设置</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品规格" props="specType">
<el-radio-group v-model="formData.specType" @change="onChangeSpec" class="w-80">
<el-radio :label="false" class="radio">单规格</el-radio>
<el-radio :label="true">多规格</el-radio>
</el-radio-group>
</el-form-item>
<!-- 多规格添加-->
<el-form-item v-if="!formData.specType">
<SkuList
ref="skuListRef"
:prop-form-data="formData"
:property-list="propertyList"
:rule-config="ruleConfig"
/>
</el-form-item>
<el-form-item v-if="formData.specType" label="商品属性">
<el-button class="mb-10px mr-15px" @click="attributesAddFormRef.open">添加属性</el-button>
<ProductAttributes
:property-list="propertyList"
@success="generateSkus"
:is-detail="isDetail"
/>
</el-form-item>
<template v-if="formData.specType && propertyList.length > 0">
<el-form-item label="批量设置" v-if="!isDetail">
<SkuList :is-batch="true" :prop-form-data="formData" :property-list="propertyList" />
</el-form-item>
<el-form-item label="规格列表">
<SkuList
ref="skuListRef"
:prop-form-data="formData"
:property-list="propertyList"
:rule-config="ruleConfig"
:is-detail="isDetail"
/>
</el-form-item>
</template>
</el-form>
<!-- 商品属性添加 Form 表单 -->
<ProductPropertyAddForm ref="attributesAddFormRef" :propertyList="propertyList" />
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { copyValueToTarget } from '@/utils'
import { propTypes } from '@/utils/propTypes'
import {
getPropertyList,
PropertyAndValues,
RuleConfig,
SkuList
} from '@/views/mall/product/spu/components/index'
import ProductAttributes from './ProductAttributes.vue'
import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
import type { Spu } from '@/api/mall/product/spu'
defineOptions({ name: 'ProductSpuSkuForm' })
// sku
const ruleConfig: RuleConfig[] = [
{
name: 'stock',
rule: (arg) => arg >= 0,
message: '商品库存必须大于等于 1 '
},
{
name: 'price',
rule: (arg) => arg >= 0.01,
message: '商品销售价格必须大于等于 0.01 元!!!'
},
{
name: 'marketPrice',
rule: (arg) => arg >= 0.01,
message: '商品市场价格必须大于等于 0.01 元!!!'
},
{
name: 'costPrice',
rule: (arg) => arg >= 0.01,
message: '商品成本价格必须大于等于 0.00 元!!!'
}
]
const message = useMessage() //
const props = defineProps({
propFormData: {
type: Object as PropType<Spu>,
default: () => {}
},
isDetail: propTypes.bool.def(false) //
})
const attributesAddFormRef = ref() //
const formRef = ref() // Ref
const propertyList = ref<PropertyAndValues[]>([]) //
const skuListRef = ref() // Ref
const formData = reactive<Spu>({
specType: false, //
subCommissionType: false, //
skus: []
})
const rules = reactive({
specType: [required],
subCommissionType: [required]
})
/** 将传进来的值赋值给 formData */
watch(
() => props.propFormData,
(data) => {
if (!data) {
return
}
copyValueToTarget(formData, data)
// SKU PropertyAndValues
propertyList.value = getPropertyList(data)
},
{
immediate: true
}
)
/** 表单校验 */
const emit = defineEmits(['update:activeName'])
const validate = async () => {
if (!formRef) return
try {
// sku
skuListRef.value.validateSku()
await unref(formRef).validate()
//
Object.assign(props.propFormData, formData)
} catch (e) {
message.error('【库存价格】不完善,请填写相关信息')
emit('update:activeName', 'sku')
throw e //
}
}
defineExpose({ validate })
/** 分销类型 */
const changeSubCommissionType = () => {
//
for (const item of formData.skus!) {
item.firstBrokeragePrice = 0
item.secondBrokeragePrice = 0
}
}
/** 选择规格 */
const onChangeSpec = () => {
//
propertyList.value = []
// sku
formData.skus = [
{
price: 0,
marketPrice: 0,
costPrice: 0,
barCode: '',
picUrl: '',
stock: 0,
weight: 0,
volume: 0,
firstBrokeragePrice: 0,
secondBrokeragePrice: 0
}
]
}
/** 调用 SkuList generateTableData 方法*/
const generateSkus = (propertyList) => {
skuListRef.value.generateTableData(propertyList)
}
</script>

View File

@ -1,9 +1,25 @@
<template> <template>
<ContentWrap v-loading="formLoading"> <ContentWrap v-loading="formLoading">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="商品信息" name="basicInfo"> <el-tab-pane label="基础设置" name="info">
<BasicInfoForm <InfoForm
ref="basicInfoRef" ref="infoRef"
v-model:activeName="activeName"
:is-detail="isDetail"
:propFormData="formData"
/>
</el-tab-pane>
<el-tab-pane label="价格库存" name="sku">
<SkuForm
ref="skuRef"
v-model:activeName="activeName"
:is-detail="isDetail"
:propFormData="formData"
/>
</el-tab-pane>
<el-tab-pane label="物流设置" name="delivery">
<DeliveryForm
ref="deliveryRef"
v-model:activeName="activeName" v-model:activeName="activeName"
:is-detail="isDetail" :is-detail="isDetail"
:propFormData="formData" :propFormData="formData"
@ -17,9 +33,9 @@
:propFormData="formData" :propFormData="formData"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="其他设置" name="otherSettings"> <el-tab-pane label="其它设置" name="other">
<OtherSettingsForm <OtherForm
ref="otherSettingsRef" ref="otherRef"
v-model:activeName="activeName" v-model:activeName="activeName"
:is-detail="isDetail" :is-detail="isDetail"
:propFormData="formData" :propFormData="formData"
@ -40,9 +56,11 @@
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { useTagsViewStore } from '@/store/modules/tagsView' import { useTagsViewStore } from '@/store/modules/tagsView'
import * as ProductSpuApi from '@/api/mall/product/spu' import * as ProductSpuApi from '@/api/mall/product/spu'
import BasicInfoForm from './BasicInfoForm.vue' import InfoForm from './InfoForm.vue'
import DescriptionForm from './DescriptionForm.vue' import DescriptionForm from './DescriptionForm.vue'
import OtherSettingsForm from './OtherSettingsForm.vue' import OtherForm from './OtherForm.vue'
import SkuForm from './SkuForm.vue'
import DeliveryForm from './DeliveryForm.vue'
import { convertToInteger, floatToFixed2, formatToFraction } from '@/utils' import { convertToInteger, floatToFixed2, formatToFraction } from '@/utils'
defineOptions({ name: 'ProductSpuForm' }) defineOptions({ name: 'ProductSpuForm' })
@ -54,20 +72,22 @@ const { params, name } = useRoute() // 查询参数
const { delView } = useTagsViewStore() // const { delView } = useTagsViewStore() //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const activeName = ref('basicInfo') // Tag const activeName = ref('info') // Tag
const isDetail = ref(false) // const isDetail = ref(false) //
const basicInfoRef = ref() // Ref const infoRef = ref() // Ref
const descriptionRef = ref() // Ref const skuRef = ref() // Ref
const otherSettingsRef = ref() // Ref const deliveryRef = ref() // Ref
// spu const descriptionRef = ref() // Ref
const otherRef = ref() // Ref
// SPU
const formData = ref<ProductSpuApi.Spu>({ const formData = ref<ProductSpuApi.Spu>({
name: '', // name: '', //
categoryId: undefined, // categoryId: undefined, //
keyword: '', // keyword: '', //
unit: undefined, //
picUrl: '', // picUrl: '', //
sliderPicUrls: [], // sliderPicUrls: [], //
introduction: '', // introduction: '', //
deliveryTypes: [], //
deliveryTemplateId: undefined, // deliveryTemplateId: undefined, //
brandId: undefined, // brandId: undefined, //
specType: false, // specType: false, //
@ -89,13 +109,7 @@ const formData = ref<ProductSpuApi.Spu>({
description: '', // description: '', //
sort: 0, // sort: 0, //
giveIntegral: 0, // giveIntegral: 0, //
virtualSalesCount: 0, // virtualSalesCount: 0 //
recommendHot: false, //
recommendBenefit: false, //
recommendBest: false, //
recommendNew: false, //
recommendGood: false, //
activityOrders: [] //
}) })
/** 获得详情 */ /** 获得详情 */
@ -135,13 +149,14 @@ const getDetail = async () => {
const submitForm = async () => { const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
//
//
try { try {
await unref(basicInfoRef)?.validate() //
await unref(infoRef)?.validate()
await unref(skuRef)?.validate()
await unref(deliveryRef)?.validate()
await unref(descriptionRef)?.validate() await unref(descriptionRef)?.validate()
await unref(otherSettingsRef)?.validate() await unref(otherRef)?.validate()
// , server // , server
const deepCopyFormData = cloneDeep(unref(formData.value)) as ProductSpuApi.Spu const deepCopyFormData = cloneDeep(unref(formData.value)) as ProductSpuApi.Spu
deepCopyFormData.skus!.forEach((item) => { deepCopyFormData.skus!.forEach((item) => {
// sku name // sku name
@ -181,6 +196,7 @@ const close = () => {
delView(unref(currentRoute)) delView(unref(currentRoute))
push({ name: 'ProductSpu' }) push({ name: 'ProductSpu' })
} }
/** 初始化 */ /** 初始化 */
onMounted(async () => { onMounted(async () => {
await getDetail() await getDetail()

View File

@ -1,101 +0,0 @@
import { CrudSchema } from '@/hooks/web/useCrudSchemas'
export const basicInfoSchema = reactive<CrudSchema[]>([
{
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<CrudSchema[]>([
{
label: '商品详情',
field: 'description'
}
])
export const otherSettingsSchema = reactive<CrudSchema[]>([
{
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'
}
])

View File

@ -1,3 +1,4 @@
<!-- 商品中心 - 商品列表 -->
<template> <template>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<ContentWrap> <ContentWrap>
@ -125,27 +126,33 @@
</el-form> </el-form>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="商品编号" min-width="60" prop="id" /> <el-table-column label="商品编号" min-width="140" prop="id" />
<el-table-column label="商品图" min-width="80"> <el-table-column label="商品信息" min-width="300">
<template #default="{ row }"> <template #default="{ row }">
<el-image :src="row.picUrl" class="h-30px w-30px" @click="imagePreview(row.picUrl)" /> <div class="flex">
<el-image
fit="cover"
:src="row.picUrl"
class="flex-none w-50px h-50px"
@click="imagePreview(row.picUrl)"
/>
<div class="ml-4 overflow-hidden">
<el-tooltip effect="dark" :content="row.name" placement="top">
<div>
{{ row.name }}
</div>
</el-tooltip>
</div>
</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :show-overflow-tooltip="true" label="商品名称" min-width="300" prop="name" /> <el-table-column align="center" label="价格" min-width="160" prop="price">
<el-table-column align="center" label="商品售价" min-width="90" prop="price"> <template #default="{ row }"> ¥ {{ fenToYuan(row.price) }}</template>
<template #default="{ row }"> {{ fenToYuan(row.price) }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="销量" min-width="90" prop="salesCount" /> <el-table-column align="center" label="销量" min-width="90" prop="salesCount" />
<el-table-column align="center" label="库存" min-width="90" prop="stock" /> <el-table-column align="center" label="库存" min-width="90" prop="stock" />
<el-table-column align="center" label="排序" min-width="70" prop="sort" /> <el-table-column align="center" label="排序" min-width="70" prop="sort" />
<el-table-column <el-table-column align="center" label="销售状态" min-width="80">
:formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180"
/>
<el-table-column align="center" label="状态" min-width="80">
<template #default="{ row }"> <template #default="{ row }">
<template v-if="row.status >= 0"> <template v-if="row.status >= 0">
<el-switch <el-switch
@ -163,16 +170,16 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
:formatter="dateFormatter"
align="center"
label="创建时间"
prop="createTime"
width="180"
/>
<el-table-column align="center" fixed="right" label="操作" min-width="200"> <el-table-column align="center" fixed="right" label="操作" min-width="200">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button link type="primary" @click="openDetail(row.id)"> 详情 </el-button>
v-hasPermi="['product:spu:update']"
link
type="primary"
@click="openDetail(row.id)"
>
详情
</el-button>
<el-button <el-button
v-hasPermi="['product:spu:update']" v-hasPermi="['product:spu:update']"
link link
@ -196,17 +203,17 @@
type="primary" type="primary"
@click="handleStatus02Change(row, ProductSpuStatusEnum.DISABLE.status)" @click="handleStatus02Change(row, ProductSpuStatusEnum.DISABLE.status)"
> >
恢复到仓库 恢复
</el-button> </el-button>
</template> </template>
<template v-else> <template v-else>
<el-button <el-button
v-hasPermi="['product:spu:update']" v-hasPermi="['product:spu:update']"
link link
type="primary" type="danger"
@click="handleStatus02Change(row, ProductSpuStatusEnum.RECYCLE.status)" @click="handleStatus02Change(row, ProductSpuStatusEnum.RECYCLE.status)"
> >
加入回收 回收
</el-button> </el-button>
</template> </template>
</template> </template>
@ -236,48 +243,41 @@ defineOptions({ name: 'ProductSpu' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const { currentRoute, push } = useRouter() // const { push } = useRouter() //
const loading = ref(false) // const loading = ref(false) //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const total = ref(0) // const total = ref(0) //
const list = ref<any[]>([]) // const list = ref<ProductSpuApi.Spu[]>([]) //
// tabs // tabs
const tabsData = ref([ const tabsData = ref([
{ {
count: 0, name: '出售中',
name: '出售中商品', type: 0,
type: 0 count: 0
}, },
{ {
count: 0, name: '仓库中',
name: '仓库中商品', type: 1,
type: 1 count: 0
}, },
{ {
count: 0, name: '已售罄',
name: '已售罄商品', type: 2,
type: 2 count: 0
}, },
{ {
count: 0,
name: '警戒库存', name: '警戒库存',
type: 3 type: 3,
count: 0
}, },
{ {
count: 0, name: '回收站',
name: '商品回收站', type: 4,
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({ const queryParams = ref({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
@ -288,11 +288,6 @@ const queryParams = ref({
}) // }) //
const queryFormRef = ref() // Ref const queryFormRef = ref() // Ref
const handleTabClick = (tab: TabsPaneContext) => {
queryParams.value.tabType = tab.paneName as number
getList()
}
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true 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 { try {
// //
const text = newStatus === ProductSpuStatusEnum.RECYCLE.status ? '加入到回收站' : '恢复到仓库' 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 { try {
// //
const text = row.status ? '上架' : '下架' 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) return treeToString(categoryList.value, categoryId)
} }
// /** 激活时 */
watch( onActivated(() => {
() => currentRoute.value,
() => {
getList() getList()
} })
)
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {

View File

@ -13,8 +13,8 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" /> <el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
<el-form-item label="预览图" prop="previewImageUrls"> <el-form-item label="预览图" prop="previewPicUrls">
<UploadImgs v-model="formData.previewImageUrls" /> <UploadImgs v-model="formData.previewPicUrls" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -40,7 +40,7 @@ const formData = ref({
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '页面名称不能为空', trigger: 'blur' }]
@ -58,8 +58,8 @@ const open = async (type: string, id?: number) => {
formLoading.value = true formLoading.value = true
try { try {
const diyPage = await DiyPageApi.getDiyPage(id) // const diyPage = await DiyPageApi.getDiyPage(id) //
if (diyPage?.previewImageUrls?.length > 0) { if (diyPage?.previewPicUrls?.length > 0) {
diyPage.previewImageUrls = diyPage.previewImageUrls.map((url: string) => { diyPage.previewPicUrls = diyPage.previewPicUrls.map((url: string) => {
return { url } return { url }
}) })
} }
@ -82,10 +82,10 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
// //
const previewImageUrls = formData.value.previewImageUrls.map((item) => { const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : 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') { if (formType.value === 'create') {
await DiyPageApi.createDiyPage(data) await DiyPageApi.createDiyPage(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -107,7 +107,7 @@ const resetForm = () => {
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -52,7 +52,7 @@ const resetForm = () => {
templateId: undefined, templateId: undefined,
name: '', name: '',
remark: '', remark: '',
previewImageUrls: [], previewPicUrls: [],
property: '' property: ''
} as DiyPageApi.DiyPageVO } as DiyPageApi.DiyPageVO
formRef.value?.resetFields() formRef.value?.resetFields()

View File

@ -47,14 +47,14 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<el-table-column label="预览图" align="center" prop="previewImageUrls"> <el-table-column label="预览图" align="center" prop="previewPicUrls">
<template #default="scope"> <template #default="scope">
<el-image <el-image
class="h-40px max-w-40px" class="h-40px max-w-40px"
v-for="(url, index) in scope.row.previewImageUrls" v-for="(url, index) in scope.row.previewPicUrls"
:key="index" :key="index"
:src="url" :src="url"
:preview-src-list="scope.row.previewImageUrls" :preview-src-list="scope.row.previewPicUrls"
:initial-index="index" :initial-index="index"
preview-teleported preview-teleported
/> />

View File

@ -13,8 +13,8 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" /> <el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" />
</el-form-item> </el-form-item>
<el-form-item label="预览图" prop="previewImageUrls"> <el-form-item label="预览图" prop="previewPicUrls">
<UploadImgs v-model="formData.previewImageUrls" /> <UploadImgs v-model="formData.previewPicUrls" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
@ -40,7 +40,7 @@ const formData = ref({
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '模板名称不能为空', trigger: 'blur' }]
@ -59,8 +59,8 @@ const open = async (type: string, id?: number) => {
try { try {
const diyTemplate = await DiyTemplateApi.getDiyTemplate(id) const diyTemplate = await DiyTemplateApi.getDiyTemplate(id)
// //
if (diyTemplate?.previewImageUrls?.length > 0) { if (diyTemplate?.previewPicUrls?.length > 0) {
diyTemplate.previewImageUrls = diyTemplate.previewImageUrls.map((url: string) => { diyTemplate.previewPicUrls = diyTemplate.previewPicUrls.map((url: string) => {
return { url } return { url }
}) })
} }
@ -83,10 +83,10 @@ const submitForm = async () => {
formLoading.value = true formLoading.value = true
try { try {
// //
const previewImageUrls = formData.value.previewImageUrls.map((item) => { const previewPicUrls = formData.value.previewPicUrls.map((item) => {
return item['url'] ? item['url'] : 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') { if (formType.value === 'create') {
await DiyTemplateApi.createDiyTemplate(data) await DiyTemplateApi.createDiyTemplate(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -108,7 +108,7 @@ const resetForm = () => {
id: undefined, id: undefined,
name: undefined, name: undefined,
remark: undefined, remark: undefined,
previewImageUrls: [] previewPicUrls: []
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -118,7 +118,7 @@ const resetForm = () => {
used: false, used: false,
usedTime: undefined, usedTime: undefined,
remark: '', remark: '',
previewImageUrls: [], previewPicUrls: [],
property: '', property: '',
pages: [] pages: []
} as DiyTemplateApi.DiyTemplatePropertyVO } as DiyTemplateApi.DiyTemplatePropertyVO

View File

@ -47,14 +47,14 @@
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<el-table-column label="预览图" align="center" prop="previewImageUrls"> <el-table-column label="预览图" align="center" prop="previewPicUrls">
<template #default="scope"> <template #default="scope">
<el-image <el-image
class="h-40px max-w-40px" class="h-40px max-w-40px"
v-for="(url, index) in scope.row.previewImageUrls" v-for="(url, index) in scope.row.previewPicUrls"
:key="index" :key="index"
:src="url" :src="url"
:preview-src-list="scope.row.previewImageUrls" :preview-src-list="scope.row.previewPicUrls"
:initial-index="index" :initial-index="index"
preview-teleported preview-teleported
/> />

View File

@ -24,51 +24,96 @@
<el-radio <el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_CONDITION_TYPE)" v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_CONDITION_TYPE)"
:key="dict.value" :key="dict.value"
:label="parseInt(dict.value)" :label="dict.value"
>{{ dict.label }}</el-radio
> >
{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="优惠设置"> <el-form-item label="优惠设置">
<template v-for="(item,index) in formData.rules" :key="index"> <template v-for="(item, index) in formData.rules" :key="index">
<el-row type="flex"> <el-row type="flex">
<el-col :span="24" style="font-weight: bold;display: flex;">活动层级{{ index+1 }}<el-button link type="danger" style="margin-left: auto;" v-if="index!=0" @click="deleteStratum(index)">删除</el-button></el-col> <el-col :span="24" style="font-weight: bold; display: flex">
<e-form :ref="'formRef'+index" :model="item" > 活动层级{{ index + 1 }}
<el-form-item label="优惠门槛:" prop="limit" label-width="100px" style="padding-left: 50px;"><el-input style="width: 150px;padding:0 10px;" v-model="item.limit" type='number' placeholder="" /> <el-button
link
type="danger"
style="margin-left: auto"
v-if="index != 0"
@click="deleteActivityRule(index)"
>
删除
</el-button>
</el-col>
<e-form :ref="'formRef' + index" :model="item">
<el-form-item
label="优惠门槛:"
prop="limit"
label-width="100px"
style="padding-left: 50px"
>
<el-input
style="width: 150px; padding: 0 10px"
v-model="item.limit"
type="number"
placeholder=""
/>
</el-form-item> </el-form-item>
<el-form-item label="优惠内容:" label-width="100px" style="padding-left: 50px;"> <el-form-item label="优惠内容:" label-width="100px" style="padding-left: 50px">
<el-checkbox-group v-model="rules[index]" style="width:100%"> <el-checkbox-group v-model="activityRules[index]" style="width: 100%">
<el-col :span="24"> <el-col :span="24">
<el-checkbox label="订单金额优惠" name="type" /> <el-checkbox label="订单金额优惠" name="type" />
<el-form-item v-if="rules[index].includes('订单金额优惠')"> <el-form-item v-if="activityRules[index].includes('订单金额优惠')">
<el-input style="width: 150px;padding:0 20px;" v-model="item.discountPrice" type='number' placeholder="" />
<el-input
style="width: 150px; padding: 0 20px"
v-model="item.discountPrice"
type="number"
placeholder=""
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"><el-checkbox v-model="item.freeDelivery" label="包邮" name="type" /></el-col> <el-col :span="24">
<el-checkbox v-model="item.freeDelivery" label="包邮" name="type" />
</el-col>
<el-col :span="24"> <el-col :span="24">
<el-checkbox label="送积分" name="type" /> <el-checkbox label="送积分" name="type" />
<el-form-item v-if="rules[index].includes('送积分')"> <el-form-item v-if="activityRules[index].includes('送积分')">
<el-input style="width: 150px;padding:0 20px;" v-model="item.point" type='number' placeholder="" />积分
<el-input
style="width: 150px; padding: 0 20px"
v-model="item.point"
type="number"
placeholder=""
/>
积分
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 优惠券待处理 也可以参考优惠劵的SpuShowcase--> <!-- 优惠券待处理 也可以参考优惠劵的SpuShowcase-->
<!-- TODO 待实现--> <!-- TODO 待实现-->
<el-col :span="24"><el-checkbox label="送优惠券" name="type" /></el-col> <el-col :span="24">
<el-checkbox label="送优惠券" name="type" />
</el-col>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</e-form> </e-form>
</el-row> </el-row>
</template> </template>
<el-button type="primary" @click="addStratum">添加活动层级</el-button> <!-- TODO 实现建议改成放在每一个活动层级的下面有点类似主子表 -->
<el-button type="primary" @click="addActivityStratum">添加活动层级</el-button>
</el-form-item> </el-form-item>
<el-form-item label="活动商品" prop="productScope"> <el-form-item label="活动商品" prop="productScope">
<el-radio-group v-model="formData.productScope"> <el-radio-group v-model="formData.productScope">
<el-radio <el-radio
v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_PRODUCT_SCOPE)" v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_PRODUCT_SCOPE)"
:key="dict.value" :key="dict.value"
:label="parseInt(dict.value)" :label="dict.value"
>{{ dict.label }}</el-radio
> >
{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<!-- TODO活动商品的开发可以参考优惠劵的已经搞好啦 --> <!-- TODO活动商品的开发可以参考优惠劵的已经搞好啦 -->
@ -87,9 +132,9 @@
> >
<el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id"> <el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id">
<span style="float: left">{{ item.name }}</span> <span style="float: left">{{ item.name }}</span>
<span style="float: right; font-size: 13px; color: #8492a6" <span style="float: right; font-size: 13px; color: #8492a6">
>{{ (item.price / 100.0).toFixed(2) }}</span {{ (item.price / 100.0).toFixed(2) }}
> </span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -106,15 +151,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getSpuSimpleList } from '@/api/mall/product/spu' import { getSpuSimpleList } from '@/api/mall/product/spu'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { CommonStatusEnum } from '@/utils/constants'
import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity' import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity'
import { import { PromotionConditionTypeEnum, PromotionProductScopeEnum } from '@/utils/constants'
PromotionConditionTypeEnum,
PromotionProductScopeEnum,
PromotionActivityStatusEnum
} from '@/utils/constants'
//
const productSpus = ref<any[]>([])
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
@ -127,6 +165,7 @@ defineOptions({ name: 'ProductBrandForm' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const productSpus = ref<any[]>([]) //
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
@ -141,19 +180,18 @@ const formData = ref({
remark: undefined, remark: undefined,
productScope: PromotionProductScopeEnum.ALL.scope, productScope: PromotionProductScopeEnum.ALL.scope,
productSpuIds: undefined, productSpuIds: undefined,
rules: [{ rules: [
{
limit: undefined, limit: undefined,
discountPrice: undefined, discountPrice: undefined,
freeDelivery: undefined, freeDelivery: undefined,
point: undefined, point: undefined,
couponIds: [], couponIds: [],
couponCounts: [] couponCounts: []
}], }
]
}) })
// const activityRules = reactive([]) // []
let rules=reactive([]);
//
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }],
startAndEndTime: [{ required: true, message: '活动时间不能为空', trigger: 'blur' }], startAndEndTime: [{ required: true, message: '活动时间不能为空', trigger: 'blur' }],
@ -173,23 +211,24 @@ const open = async (type: string, id?: number) => {
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
let data= await RewardActivityApi.getReward(id); let data = await RewardActivityApi.getReward(id)
data.startAndEndTime=[new Date(data.startTime), new Date(data.endTime)]; data.startAndEndTime = [new Date(data.startTime), new Date(data.endTime)]
rules.splice(0,rules.length); activityRules.splice(0, activityRules.length)
data.rules.forEach((item)=>{ data.rules.forEach((item) => {
let ars:string[]=reactive([]); // TODO reactive []
if(item.freeDelivery){ let array: string[] = reactive([])
ars.push('包邮') if (item.freeDelivery) {
array.push('包邮')
} }
if(item.point){ if (item.point) {
ars.push('送积分') array.push('送积分')
} }
if(item.discountPrice){ if (item.discountPrice) {
ars.push('订单金额优惠') array.push('订单金额优惠')
} }
rules.push(ars) activityRules.push(array)
}) })
formData.value=data formData.value = data
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -205,20 +244,15 @@ const submitForm = async () => {
const valid = await formRef.value.validate() const valid = await formRef.value.validate()
if (!valid) return if (!valid) return
// //
formData.value.startTime= +new Date(formData.value.startAndEndTime[0]) formData.value.startTime = +new Date(formData.value.startAndEndTime[0])
formData.value.endTime=+new Date(formData.value.startAndEndTime[1]) formData.value.endTime = +new Date(formData.value.startAndEndTime[1])
console.log(rules) activityRules.forEach((item, index) => {
rules.forEach((item,index)=>{ formData.value.rules[index].freeDelivery = !!item.includes('包邮')
if(item.includes('包邮')){ if (!item.includes('送积分')) {
formData.value.rules[index].freeDelivery=true; formData.value.rules[index].point = undefined
}else{
formData.value.rules[index].freeDelivery=false;
} }
if(!item.includes('送积分')){ if (!item.includes('订单金额优惠')) {
formData.value.rules[index].point=undefined; formData.value.rules[index].discountPrice = undefined
}
if(!item.includes('订单金额优惠')){
formData.value.rules[index].discountPrice=undefined;
} }
}) })
@ -241,7 +275,7 @@ const submitForm = async () => {
} }
} }
const addStratum =()=>{ const addActivityStratum = () => {
formData.value.rules.push({ formData.value.rules.push({
limit: undefined, limit: undefined,
discountPrice: undefined, discountPrice: undefined,
@ -250,13 +284,12 @@ const addStratum =()=>{
couponIds: [], couponIds: [],
couponCounts: [] couponCounts: []
}) })
rules.push([]); activityRules.push([])
console.log(rules)
} }
const deleteStratum=(index)=>{ const deleteActivityRule = (index) => {
formData.value.rules.splice(index,1) formData.value.rules.splice(index, 1)
rules.splice(index,1) activityRules.splice(index, 1)
} }
/** 重置表单 */ /** 重置表单 */
@ -271,19 +304,21 @@ const resetForm = () => {
remark: undefined, remark: undefined,
productScope: PromotionProductScopeEnum.ALL.scope, productScope: PromotionProductScopeEnum.ALL.scope,
productSpuIds: undefined, productSpuIds: undefined,
rules: [{ rules: [
{
limit: undefined, limit: undefined,
discountPrice: undefined, discountPrice: undefined,
freeDelivery: undefined, freeDelivery: undefined,
point: undefined, point: undefined,
couponIds: [], couponIds: [],
couponCounts: [] couponCounts: []
}],
} }
rules.splice(0,rules.length); ]
rules.push(reactive([])); }
activityRules.splice(0, activityRules.length)
activityRules.push(reactive([]))
// //
nextTick(()=>{ nextTick(() => {
formRef.value?.resetFields() formRef.value?.resetFields()
}) })
} }

View File

@ -122,7 +122,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as ProductBrandApi from '@/api/mall/product/brand'
import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity' import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity'
import RewardForm from './RewardForm.vue' import RewardForm from './RewardForm.vue'
@ -157,16 +156,11 @@ const getList = async () => {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
// console.log(queryParams)
// message.success('')
// return
getList() getList()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
// message.success('')
// return
queryFormRef.value.resetFields() queryFormRef.value.resetFields()
handleQuery() handleQuery()
} }
@ -182,8 +176,6 @@ const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
// message.success('')
// return
// //
await RewardActivityApi.deleteRewardActivity(id) await RewardActivityApi.deleteRewardActivity(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))

View File

@ -119,7 +119,6 @@ const resetForm = () => {
id: undefined, id: undefined,
name: '', name: '',
picUrl: '', picUrl: '',
bigPicUrl: '',
status: CommonStatusEnum.ENABLE status: CommonStatusEnum.ENABLE
} }
formRef.value?.resetFields() formRef.value?.resetFields()