Commit 097c5a07 by 孙美琪

资源管理修改

parent f5c54151
......@@ -3,7 +3,7 @@ import request from '@/config/axios'
export interface Favorite {
id?: number
userId?: string // 用户编号
spuId?: number | null // 商品 SPU 编号
spuId?: number | null // 资源 SPU 编号
}
// 获得 ProductFavorite 列表
......
......@@ -8,8 +8,8 @@ export interface Property {
}
export interface Sku {
id?: number // 商品 SKU 编号
name?: string // 商品 SKU 名称
id?: number // 资源 SKU 编号
name?: string // 资源 SKU 名称
spuId?: number // SPU 编号
properties?: Property[] // 属性数组
price?: number | string // 商品价格
......
......@@ -27,8 +27,8 @@ export interface PointActivityVO {
export interface PointProductVO {
id?: number // 积分商城商品编号
activityId?: number // 积分商城活动 id
spuId?: number // 商品 SPU 编号
skuId: number // 商品 SKU 编号
spuId?: number // 资源 SPU 编号
skuId: number // 资源 SKU 编号
count: number // 可兑换数量
point: number // 兑换积分
price: number // 兑换金额,单位:分
......
......@@ -13,9 +13,9 @@ export interface TradeAfterSaleVO {
orderId?: number | null // 交易订单编号
orderNo?: string // 订单流水号
orderItemId?: number | null // 交易订单项编号
spuId?: number | null // 商品 SPU 编号
spuName?: string // 商品 SPU 名称
skuId?: number | null // 商品 SKU 编号
spuId?: number | null // 资源 SPU 编号
spuName?: string // 资源 SPU 名称
skuId?: number | null // 资源 SKU 编号
properties?: ProductPropertiesVO[] // 属性数组
picUrl?: string // 商品图片
count?: number | null // 退货商品数量
......
......@@ -82,9 +82,9 @@ export interface OrderItemRespVO {
userId?: number | null // 用户编号
orderId?: number | null // 订单编号
// ========== 商品基本信息 ==========
spuId?: number | null // 商品 SPU 编号
spuName?: string //商品 SPU 名称
skuId?: number | null // 商品 SKU 编号
spuId?: number | null // 资源 SPU 编号
spuName?: string //资源 SPU 名称
skuId?: number | null // 资源 SKU 编号
picUrl?: string //商品图片
count?: number | null //购买数量
// ========== 价格 + 支付基本信息 ==========
......
......@@ -88,7 +88,7 @@ export const APP_LINK_GROUP_LIST = [
]
},
{
name: '商品',
name: '资源',
links: [
{
name: '商品列表',
......
......@@ -9,7 +9,7 @@
width: scrollbarWidth
}"
>
<!-- 商品 -->
<!-- 资源 -->
<div
class="relative box-content flex flex-row flex-wrap overflow-hidden bg-white"
:style="{
......
......@@ -250,6 +250,7 @@ export const fileSizeFormatter = (row, column, cellValue) => {
* @param source 源对象
*/
export const copyValueToTarget = (target: any, source: any) => {
console.log(target, 'target')
const newObj = Object.assign({}, target, source)
// 删除多余属性
Object.keys(newObj).forEach((key) => {
......
<template>
<doc-alert title="【商品】商品分类" url="https://doc.iocoder.cn/mall/product-category/" />
<doc-alert title="【资源】商品分类" url="https://doc.iocoder.cn/mall/product-category/" />
<!-- 搜索工作栏 -->
<ContentWrap>
......
......@@ -7,7 +7,7 @@
:rules="formRules"
label-width="100px"
>
<el-form-item label="商品" prop="spuId">
<el-form-item label="资源" prop="spuId">
<SpuShowcase v-model="formData.spuId" :limit="1" />
</el-form-item>
<el-form-item v-if="formData.spuId" label="商品规格" prop="skuId">
......
<template>
<doc-alert title="【商品】商品评价" url="https://doc.iocoder.cn/mall/product-comment/" />
<doc-alert title="【资源】商品评价" url="https://doc.iocoder.cn/mall/product-comment/" />
<ContentWrap>
<!-- 搜索工作栏 -->
......
<template>
<doc-alert title="【商品】商品属性" url="https://doc.iocoder.cn/mall/product-property/" />
<doc-alert title="【资源】商品属性" url="https://doc.iocoder.cn/mall/product-property/" />
<!-- 搜索工作栏 -->
<ContentWrap>
......
......@@ -28,12 +28,10 @@
</span>
</template>
</el-table-column>
<el-table-column label="鉴权信息" prop="auth" align="center" />
<el-table-column label="有效期(单位:天)" prop="expTime" align="center" min-width="100" />
<el-table-column label="费用描述" prop="feeInfo" align="center" />
</template>
<!-- <el-table-column align="center" label="商品条码" min-width="168">-->
<!-- <template #default="{ row }">-->
<!-- <el-input v-model="row.barCode" class="w-100%" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="销售价" min-width="168">
<template #default="{ row }">
<el-input-number
......@@ -75,30 +73,6 @@
<el-input-number v-model="row.stock" :min="0" class="w-100%" controls-position="right" />
</template>
</el-table-column>
<!-- <el-table-column align="center" label="重量(kg)" min-width="168">-->
<!-- <template #default="{ row }">-->
<!-- <el-input-number-->
<!-- v-model="row.weight"-->
<!-- :min="0"-->
<!-- :precision="2"-->
<!-- :step="0.1"-->
<!-- class="w-100%"-->
<!-- controls-position="right"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" label="体积(m^3)" min-width="168">-->
<!-- <template #default="{ row }">-->
<!-- <el-input-number-->
<!-- v-model="row.volume"-->
<!-- :min="0"-->
<!-- :precision="2"-->
<!-- :step="0.1"-->
<!-- class="w-100%"-->
<!-- controls-position="right"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<template v-if="formData!.subCommissionType">
<el-table-column align="center" label="一级返佣(元)" min-width="168">
<template #default="{ row }">
......@@ -173,11 +147,6 @@
</template>
</el-table-column>
</template>
<!-- <el-table-column align="center" label="商品条码" min-width="100">-->
<!-- <template #default="{ row }">-->
<!-- {{ row.barCode }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="销售价(元)" min-width="80">
<template #default="{ row }">
{{ row.price }}
......@@ -198,16 +167,6 @@
{{ row.stock }}
</template>
</el-table-column>
<!-- <el-table-column align="center" label="重量(kg)" min-width="80">-->
<!-- <template #default="{ row }">-->
<!-- {{ row.weight }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" label="体积(m^3)" min-width="80">-->
<!-- <template #default="{ row }">-->
<!-- {{ row.volume }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<template v-if="formData!.subCommissionType">
<el-table-column align="center" label="一级返佣(元)" min-width="80">
<template #default="{ row }">
......@@ -253,11 +212,6 @@
</template>
</el-table-column>
</template>
<el-table-column align="center" label="商品条码" min-width="100">
<template #default="{ row }">
{{ row.barCode }}
</template>
</el-table-column>
<el-table-column align="center" label="销售价(元)" min-width="80">
<template #default="{ row }">
{{ formatToFraction(row.price) }}
......@@ -321,13 +275,12 @@ const skuList = ref<Sku[]>([
price: 0, // 商品价格
marketPrice: 0, // 市场价
costPrice: 0, // 成本价
barCode: '', // 商品条码
picUrl: '', // 图片地址
stock: 0, // 库存
weight: 0, // 商品重量
volume: 0, // 商品体积
firstBrokeragePrice: 0, // 一级分销的佣金
secondBrokeragePrice: 0 // 二级分销的佣金
volume: 0 // 商品体积
// firstBrokeragePrice: 0, // 一级分销的佣金
// secondBrokeragePrice: 0 // 二级分销的佣金
}
]) // 批量添加时的临时数据
......@@ -453,13 +406,12 @@ const generateTableData = (propertyList: any[]) => {
price: 0,
marketPrice: 0,
costPrice: 0,
barCode: '',
picUrl: '',
stock: 0,
weight: 0,
volume: 0,
firstBrokeragePrice: 0,
secondBrokeragePrice: 0
// firstBrokeragePrice: 0,
// secondBrokeragePrice: 0
}
// 如果存在属性相同的 sku 则不做处理
const index = formData.value!.skus!.findIndex(
......@@ -528,13 +480,12 @@ watch(
price: 0,
marketPrice: 0,
costPrice: 0,
barCode: '',
picUrl: '',
stock: 0,
weight: 0,
volume: 0,
firstBrokeragePrice: 0,
secondBrokeragePrice: 0
volume: 0
// firstBrokeragePrice: 0,
// secondBrokeragePrice: 0
}
]
}
......
......@@ -257,7 +257,7 @@ const handleCheckAll = (checked: boolean) => {
/**
* 选中一行
* @param checked 是否选中
* @param spu 商品
* @param spu 资源
* @param isCalcCheckAll 是否计算全选
*/
const handleCheckOne = (checked: boolean, spu: Spu, isCalcCheckAll: boolean) => {
......
<!-- 商品发布 - 基础设置 -->
<template>
<el-form ref="formRef" :disabled="isDetail" :model="formData" :rules="rules" label-width="120px">
<el-form-item label="商品名称" prop="name">
<el-form-item label="资源名称" prop="name">
<el-input
v-model="formData.name"
:autosize="{ minRows: 2, maxRows: 2 }"
......@@ -9,11 +9,11 @@
:show-word-limit="true"
class="w-80!"
maxlength="64"
placeholder="请输入商品名称"
placeholder="请输入资源名称"
type="textarea"
/>
</el-form-item>
<el-form-item label="商品分类" prop="categoryId">
<el-form-item label="资源分类" prop="categoryId">
<el-cascader
v-model="formData.categoryId"
:options="categoryList"
......@@ -21,11 +21,16 @@
class="w-80"
clearable
filterable
placeholder="请选择商品分类"
placeholder="请选择资源分类"
/>
</el-form-item>
<el-form-item label="商品品牌" prop="brandId">
<el-select v-model="formData.brandId" class="w-80" placeholder="请选择商品品牌">
<el-form-item label="资源品牌" prop="brandId">
<el-select
v-model="formData.brandId"
class="w-80"
placeholder="请选择资源品牌"
style="width: 320px"
>
<el-option
v-for="item in brandList"
:key="item.id"
......@@ -34,27 +39,6 @@
/>
</el-select>
</el-form-item>
<el-form-item label="商品关键字" prop="keyword">
<el-input v-model="formData.keyword" class="w-80!" placeholder="请输入商品关键字" />
</el-form-item>
<el-form-item label="商品简介" prop="introduction">
<el-input
v-model="formData.introduction"
:autosize="{ minRows: 2, maxRows: 2 }"
:clearable="true"
:show-word-limit="true"
class="w-80!"
maxlength="128"
placeholder="请输入商品简介"
type="textarea"
/>
</el-form-item>
<el-form-item label="商品封面图" prop="picUrl">
<UploadImg v-model="formData.picUrl" :disabled="isDetail" height="80px" />
</el-form-item>
<el-form-item label="商品轮播图" prop="sliderPicUrls">
<UploadImgs v-model="formData.sliderPicUrls" :disabled="isDetail" />
</el-form-item>
</el-form>
</template>
<script lang="ts" setup>
......@@ -83,20 +67,16 @@ 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],
brandId: [required],
picUrl: [required],
sliderPicUrls: [required],
brandId: [required]
sliderPicUrls: [required]
})
/** 将传进来的值赋值给 formData */
......
......@@ -8,17 +8,7 @@
:rules="rules"
label-width="120px"
>
<el-form-item label="分销类型" prop="subCommissionType">
<el-radio-group
v-model="formData.subCommissionType"
class="w-80"
@change="changeSubCommissionType"
>
<el-radio :value="false">默认设置</el-radio>
<el-radio :value="true" class="radio">单独设置</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="商品规格" prop="specType">
<el-form-item label="资源规格" prop="specType">
<el-radio-group v-model="formData.specType" class="w-80" @change="onChangeSpec">
<el-radio :value="false" class="radio">单规格</el-radio>
<el-radio :value="true">多规格</el-radio>
......@@ -33,7 +23,7 @@
:rule-config="ruleConfig"
/>
</el-form-item>
<el-form-item v-if="formData.specType" label="商品属性">
<el-form-item v-if="formData.specType" label="资源属性">
<el-button class="mb-10px mr-15px" @click="attributesAddFormRef.open">添加属性</el-button>
<ProductAttributes
:is-detail="isDetail"
......@@ -73,6 +63,7 @@ import {
import ProductAttributes from './ProductAttributes.vue'
import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
import type { Spu } from '@/api/mall/product/spu'
import { defaultProps } from '@/utils/tree'
defineOptions({ name: 'ProductSpuSkuForm' })
......@@ -120,7 +111,10 @@ const formData = reactive<Spu>({
})
const rules = reactive({
specType: [required],
subCommissionType: [required]
subCommissionType: [required],
name: [required],
categoryId: [required],
brandId: [required]
})
/** 将传进来的值赋值给 formData */
......@@ -130,6 +124,7 @@ watch(
if (!data) {
return
}
console.log(props.propFormData, 'props.propFormData')
copyValueToTarget(formData, data)
// 将 SKU 的属性,整理成 PropertyAndValues 数组
propertyList.value = getPropertyList(data)
......@@ -158,13 +153,13 @@ const validate = async () => {
defineExpose({ validate })
/** 分销类型 */
const changeSubCommissionType = () => {
// 默认为零,类型切换后也要重置为零
for (const item of formData.skus!) {
item.firstBrokeragePrice = 0
item.secondBrokeragePrice = 0
}
}
// const changeSubCommissionType = () => {
// // 默认为零,类型切换后也要重置为零
// for (const item of formData.skus!) {
// item.firstBrokeragePrice = 0
// item.secondBrokeragePrice = 0
// }
// }
/** 选择规格 */
const onChangeSpec = () => {
......@@ -191,4 +186,15 @@ const onChangeSpec = () => {
const generateSkus = (propertyList: any[]) => {
skuListRef.value.generateTableData(propertyList)
}
/** 初始化 */
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>
<template>
<ContentWrap v-loading="formLoading">
<el-tabs v-model="activeName">
<el-tab-pane label="基础设置" name="info">
<InfoForm
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-tabs>
<el-form>
<el-form-item style="float: right">
<el-button v-if="!isDetail" :loading="formLoading" type="primary" @click="submitForm">
保存
</el-button>
<el-button @click="close">返回</el-button>
</el-form-item>
</el-form>
<InfoForm
ref="infoRef"
v-model:activeName="activeName"
:is-detail="isDetail"
:propFormData="formData"
/>
<SkuForm
ref="skuRef"
v-model:activeName="activeName"
:is-detail="isDetail"
:propFormData="formData"
/>
<el-form>
<el-form-item style="float: right">
<el-button v-if="!isDetail" :loading="formLoading" type="primary" @click="submitForm">
保存
</el-button>
<el-button @click="close">返回</el-button>
</el-form-item>
</el-form>
</ContentWrap>
</template>
<script lang="ts" setup>
import { cloneDeep } from 'lodash-es'
import { useTagsViewStore } from '@/store/modules/tagsView'
import {cloneDeep} from 'lodash-es'
import {useTagsViewStore} from '@/store/modules/tagsView'
import * as ProductSpuApi from '@/api/mall/product/spu'
import InfoForm from './InfoForm.vue'
import DescriptionForm from './DescriptionForm.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: 'ProductSpuAdd' })
defineOptions({name: 'ProductSpuAdd'})
const { t } = useI18n() // 国际化
const {t} = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const { push, currentRoute } = useRouter() // 路由
const { params, name } = useRoute() // 查询参数
const { delView } = useTagsViewStore() // 视图操作
const {push, currentRoute} = useRouter() // 路由
const {params, name} = useRoute() // 查询参数
const {delView} = useTagsViewStore() // 视图操作
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const activeName = ref('info') // Tag 激活的窗口
......@@ -170,7 +164,7 @@ const submitForm = async () => {
/** 关闭按钮 */
const close = () => {
delView(unref(currentRoute))
push({ name: 'ProductSpu' })
push({name: 'ProductSpu'})
}
/** 初始化 */
......
<!-- 商品中心 - 商品列表 -->
<template>
<doc-alert title="【商品】商品 SPU 与 SKU" url="https://doc.iocoder.cn/mall/product-spu-sku/" />
<doc-alert title="【资源】资源 SPU 与 SKU" url="https://doc.iocoder.cn/mall/product-spu-sku/" />
<!-- 搜索工作栏 -->
<ContentWrap>
......@@ -11,16 +11,16 @@
class="-mb-15px"
label-width="68px"
>
<el-form-item label="商品名称" prop="name">
<el-form-item label="资源名称" prop="name">
<el-input
v-model="queryParams.name"
class="!w-240px"
clearable
placeholder="请输入商品名称"
placeholder="请输入资源名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="商品分类" prop="categoryId">
<el-form-item label="资源分类" prop="categoryId">
<el-cascader
v-model="queryParams.categoryId"
:options="categoryList"
......@@ -28,7 +28,7 @@
class="w-1/1"
clearable
filterable
placeholder="请选择商品分类"
placeholder="请选择资源分类"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
......@@ -130,8 +130,8 @@
</el-form>
</template>
</el-table-column>
<el-table-column label="商品编号" min-width="140" prop="id" />
<el-table-column label="商品信息" min-width="300">
<el-table-column label="资源编号" min-width="140" prop="id" />
<el-table-column label="资源信息" min-width="300">
<template #default="{ row }">
<div class="flex">
<el-image
......
......@@ -35,7 +35,7 @@
</el-form-item>
<el-form-item
v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope"
label="商品"
label="资源"
prop="productSpuIds"
>
<SpuShowcase v-model="formData.productSpuIds" />
......
<template>
<doc-alert title="【统计】会员、商品、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<doc-alert title="【统计】会员、资源、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<div class="flex flex-col">
<el-row :gutter="16" class="summary">
......
......@@ -10,7 +10,7 @@
</template>
<!-- 排行列表 -->
<el-table v-loading="loading" :data="list" @sort-change="handleSortChange">
<el-table-column label="商品 ID" prop="spuId" min-width="70" />
<el-table-column label="资源 ID" prop="spuId" min-width="70" />
<el-table-column label="商品图片" align="center" prop="picUrl" width="80">
<template #default="{ row }">
<el-image
......
<template>
<doc-alert title="【统计】会员、商品、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<doc-alert title="【统计】会员、资源、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<!-- 商品概览 -->
<ProductSummary />
......
<template>
<doc-alert title="【统计】会员、商品、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<doc-alert title="【统计】会员、资源、交易统计" url="https://doc.iocoder.cn/mall/statistics/" />
<div class="flex flex-col">
<el-row :gutter="16" class="summary">
......
......@@ -91,7 +91,7 @@
<el-row :gutter="20">
<el-col :span="15">
<el-table v-if="formData.orderItem" :data="[formData.orderItem]" border>
<el-table-column label="商品" prop="spuName" width="auto">
<el-table-column label="资源" prop="spuName" width="auto">
<template #default="{ row }">
{{ row.spuName }}
<el-tag
......
......@@ -76,7 +76,7 @@
<el-row :gutter="20">
<el-col :span="15">
<el-table :data="formData.items" border>
<el-table-column label="商品" prop="spuName" width="auto">
<el-table-column label="资源" prop="spuName" width="auto">
<template #default="{ row }">
{{ row.spuName }}
<el-tag v-for="property in row.properties" :key="property.propertyId">
......
......@@ -87,7 +87,7 @@
:rules="formRules"
label-width="80px"
>
<el-form-item label="商品" prop="spuId">
<el-form-item label="资源" prop="spuId">
<el-select
v-model="formData.spuId"
placeholder="请输入下单商品"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment