Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yongxinda-admin
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
yongxinda-admin
Commits
ca537cc2
提交
ca537cc2
authored
10月 24, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
9d3f1cb6
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
433 行增加
和
524 行删除
+433
-524
edit.vue
src/views/commodityManage/edit.vue
+202
-250
list.vue
src/views/commodityManage/list.vue
+11
-4
shelves.vue
src/views/commodityManage/shelves.vue
+219
-269
vite.config.ts
vite.config.ts
+1
-1
没有找到文件。
src/views/commodityManage/edit.vue
浏览文件 @
ca537cc2
<
template
>
<div
class=
"app-container"
>
<el-card
class=
"box-card"
>
<h3>
商品介绍
</h3>
<el-form
ref=
"goodsRef"
:rules=
"rules"
:model=
"goods"
label-width=
"150px"
>
<el-form-item
label=
"商品编号"
prop=
"goodsSn"
>
<el-input
v-model=
"goods.goodsSn"
/>
</el-form-item>
<el-form-item
label=
"商品名称"
prop=
"name"
>
<el-input
v-model=
"goods.name"
/>
</el-form-item>
<el-form-item
label=
"市场售价"
prop=
"counterPrice"
>
<el-input
v-model=
"goods.counterPrice"
placeholder=
"0.00"
>
<template
slot=
"append"
>
元
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"是否新品"
>
<el-radio-group
v-model=
"goods.isNew"
>
<el-radio
:label=
"true"
>
新品
</el-radio>
<el-radio
:label=
"false"
>
非新品
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否热卖"
>
<el-radio-group
v-model=
"goods.isHot"
>
<el-radio
:label=
"false"
>
普通
</el-radio>
<el-radio
:label=
"true"
>
热卖
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否在售"
>
<el-radio-group
v-model=
"goods.isOnSale"
>
<el-radio
:label=
"true"
>
在售
</el-radio>
<el-radio
:label=
"false"
>
未售
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"商品图片"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"goods.picUrl"
:src=
"goods.picUrl"
class=
"avatar"
/>
<!-- <img v-if="goods.picUrl" :src="'http://192.168.0.23' + goods.picUrl" class="avatar" /> -->
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"宣传画廊"
>
<el-upload
:action=
"uploadPath"
:limit=
"5"
:headers=
"headers"
:on-exceed=
"uploadOverrun"
:on-success=
"handleGalleryUrl"
:on-remove=
"handleRemove"
multiple
accept=
".jpg,.jpeg,.png,.gif"
list-type=
"picture-card"
>
<el-icon
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"商品单位"
>
<el-input
v-model=
"goods.unit"
placeholder=
"件 / 个 / 盒"
/>
</el-form-item>
<el-form-item
label=
"关键字"
>
<el-tag
v-for=
"tag in keywords"
:key=
"tag"
closable
type=
"primary"
@
close=
"handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
v-if=
"newKeywordVisible"
ref=
"newKeywordInput"
v-model=
"newKeyword"
class=
"input-new-keyword"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
/>
<el-button
v-else
class=
"button-new-keyword"
type=
"primary"
@
click=
"showInput"
>
+ 增加
</el-button>
</el-form-item>
<el-form-item
label=
"商品配件"
>
<el-select
v-model=
"goods.parts"
multiple
collapse-tags
collapse-tags-tooltip
style=
"width: 240px"
>
<el-option
v-for=
"item in partsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="商品配件">
<el-tag v-for="tag in parts" :key="tag" closable type="primary" @close="handlePartsClose(tag)">
{{ tag }}
</el-tag>
<el-input v-if="newPartsVisible" ref="newKeywordInput" v-model="newPart" class="input-new-keyword"
@keyup.enter.native="handlePartsConfirm" @blur="handlePartsConfirm" />
<el-button v-else class="button-new-keyword" type="primary" @click="showPartsInput">+ 增加</el-button>
</el-form-item> -->
<el-form-item
label=
"所属分类"
>
<el-cascader
v-model=
"categoryIds"
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
</el-form-item>
<el-form-item
label=
"所属品牌商"
>
<el-select
v-model=
"goods.brandId"
clearable
>
<el-option
v-for=
"item in brandList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"商品简介"
>
<el-input
v-model=
"goods.brief"
/>
</el-form-item>
<el-form-item
label=
"商品详细介绍"
>
<!-- <editor v-model="goods.detail" :init="editorInit" /> -->
<richTextEditor
:valueHtml=
'goods.detail'
@
htmlChange=
"htmlChange"
/>
</el-form-item>
</el-form>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品规格
</h3>
<el-row
:gutter=
"20"
type=
"flex"
align=
"middle"
style=
"padding: 20px 0"
>
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"false"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
</el-col>
</el-row>
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<
template
#
default=
"scope"
>
<el-tag
type=
"primary"
>
{{
scope
.
row
.
value
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
<
template
#
default=
"scope"
>
<img
v-if=
"scope.row.picUrl"
:src=
"scope.row.picUrl"
width=
"40"
/>
</
template
>
</el-table-column>
<el-table-column
v-if=
"multipleSpec"
align=
"center"
label=
"操作"
width=
"250"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleSpecificationDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"specVisiable"
title=
"设置规格"
>
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
<el-drawer
v-model=
"editDrawer"
size=
"100%"
@
before-close=
"handleCancel"
>
<el-card
class=
"box-card"
>
<h3>
商品介绍
</h3>
<el-form
ref=
"goodsRef"
:rules=
"rules"
:model=
"goods"
label-width=
"150px"
>
<el-form-item
label=
"商品编号"
prop=
"goodsSn"
>
<el-input
v-model=
"goods.goodsSn"
/>
</el-form-item>
<el-form-item
label=
"商品名称"
prop=
"name"
>
<el-input
v-model=
"goods.name"
/>
</el-form-item>
<el-form-item
label=
"市场售价"
prop=
"counterPrice"
>
<el-input
v-model=
"goods.counterPrice"
placeholder=
"0.00"
>
<template
slot=
"append"
>
元
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"是否新品"
>
<el-radio-group
v-model=
"goods.isNew"
>
<el-radio
:label=
"true"
>
新品
</el-radio>
<el-radio
:label=
"false"
>
非新品
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"规格值"
prop=
"value"
>
<el-input
v-model=
"specForm.value"
/>
<el-form-item
label=
"是否热卖"
>
<el-radio-group
v-model=
"goods.isHot"
>
<el-radio
:label=
"false"
>
普通
</el-radio>
<el-radio
:label=
"true"
>
热卖
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-form-item
label=
"是否在售"
>
<el-radio-group
v-model=
"goods.isOnSale"
>
<el-radio
:label=
"true"
>
在售
</el-radio>
<el-radio
:label=
"false"
>
未售
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"商品图片"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"specForm.picUrl"
:src=
"specForm.picUrl"
class=
"avatar"
/>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
:on-success=
"uploadPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"goods.picUrl"
:src=
"goods.picUrl"
class=
"avatar"
/>
<!-- <img v-if="goods.picUrl" :src="'http://192.168.0.23' + goods.picUrl" class="avatar" /> -->
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"specVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSpecificationAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<!-- <el-card class="box-card">
<h3>商品库存</h3>
<el-table :data="products">
<el-table-column property="value" label="货品规格">
<template #default="scope">
<el-tag v-for="tag in scope.row.specifications" :key="tag">
{{ tag }}
</el-tag>
</template>
</el-table-column>
<el-table-column property="price" width="100" label="货品售价" />
<el-table-column property="number" width="100" label="货品数量" />
<el-table-column property="url" width="100" label="货品图片">
<template #default="scope">
<img v-if="scope.row.url" :src="scope.row.url" width="40" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100" class-name="small-padding fixed-width">
<template #default="scope">
<el-button type="primary" size="small" @click="handleProductShow(scope.row)">设置</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog v-model="productVisiable" title="添加货品">
<el-form ref="productRef" :model="productForm" status-icon label-position="left" label-width="100px"
style="width: 400px; margin-left: 50px">
<el-form-item label="货品规格列" prop="specifications">
<el-tag v-for="tag in productForm.specifications" :key="tag">
<el-form-item
label=
"宣传画廊"
>
<el-upload
:action=
"uploadPath"
:limit=
"5"
:headers=
"headers"
:on-exceed=
"uploadOverrun"
:on-success=
"handleGalleryUrl"
:on-remove=
"handleRemove"
multiple
accept=
".jpg,.jpeg,.png,.gif"
list-type=
"picture-card"
>
<el-icon
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"商品单位"
>
<el-input
v-model=
"goods.unit"
placeholder=
"件 / 个 / 盒"
/>
</el-form-item>
<el-form-item
label=
"关键字"
>
<el-tag
v-for=
"tag in keywords"
:key=
"tag"
closable
type=
"primary"
@
close=
"handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
v-if=
"newKeywordVisible"
ref=
"newKeywordInput"
v-model=
"newKeyword"
class=
"input-new-keyword"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
/>
<el-button
v-else
class=
"button-new-keyword"
type=
"primary"
@
click=
"showInput"
>
+ 增加
</el-button>
</el-form-item>
<el-form-item label="货品售价" prop="price">
<el-input v-model="productForm.price" />
<el-form-item
label=
"商品配件"
>
<el-select
v-model=
"goodsParts"
multiple
collapse-tags
collapse-tags-tooltip
style=
"width: 240px"
>
<el-option
v-for=
"item in partsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="货品数量" prop="number">
<el-input v-model="productForm.number" />
<!-- <el-form-item label="商品配件">
<el-tag v-for="tag in parts" :key="tag" closable type="primary" @close="handlePartsClose(tag)">
{{ tag }}
</el-tag>
<el-input v-if="newPartsVisible" ref="newKeywordInput" v-model="newPart" class="input-new-keyword"
@keyup.enter.native="handlePartsConfirm" @blur="handlePartsConfirm" />
<el-button v-else class="button-new-keyword" type="primary" @click="showPartsInput">+ 增加</el-button>
</el-form-item> -->
<el-form-item
label=
"所属分类"
>
<el-cascader
v-model=
"categoryIds"
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
</el-form-item>
<el-form-item label="货品图片" prop="url">
<el-upload :action="uploadPath" :show-file-list="false" :headers="headers"
:on-success="uploadProductUrl" class="avatar-uploader" accept=".jpg,.jpeg,.png,.gif"
>
<
img v-if="productForm.url" :src="productForm.url" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon
" />
</el-
upload
>
<el-form-item
label=
"所属品牌商"
>
<el-select
v-model=
"goods.brandId"
clearable
>
<
el-option
v-for=
"item in brandList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value
"
/>
</el-
select
>
</el-form-item>
</el-form>
<template #footer class="dialog-footer">
<el-button @click="productVisiable = false">取消</el-button>
<el-button type="primary" @click="handleProductEdit">确定</el-button>
</template>
</el-dialog>
</el-card> -->
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
<el-button
type=
"primary"
@
click=
"handleAttributeShow"
>
添加
</el-button>
<el-table
:data=
"attributes"
>
<el-table-column
property=
"attribute"
label=
"商品参数名称"
/>
<el-table-column
property=
"value"
label=
"商品参数值"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"100"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleAttributeDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"attributeVisiable"
title=
"添加商品参数"
>
<el-form
ref=
"attributeRef"
:model=
"attributeForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"商品参数名称"
prop=
"attribute"
>
<el-input
v-model=
"attributeForm.attribute"
/>
<el-form-item
label=
"商品简介"
>
<el-input
v-model=
"goods.brief"
/>
</el-form-item>
<el-form-item
label=
"商品参数值"
prop=
"value"
>
<el-input
v-model=
"attributeForm.value"
/>
<el-form-item
label=
"商品详细介绍"
>
<!-- <editor v-model="goods.detail" :init="editorInit" /> -->
<richTextEditor
:valueHtml=
'goods.detail'
@
htmlChange=
"htmlChange"
/>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"attributeVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleAttributeAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<div
class=
"op-container"
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleEdit"
>
更新商品
</el-button>
</div>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品规格
</h3>
<el-row
:gutter=
"20"
type=
"flex"
align=
"middle"
style=
"padding: 20px 0"
>
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"false"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
</el-col>
</el-row>
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<
template
#
default=
"scope"
>
<el-tag
type=
"primary"
>
{{
scope
.
row
.
value
}}
</el-tag>
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
<
template
#
default=
"scope"
>
<img
v-if=
"scope.row.picUrl"
:src=
"scope.row.picUrl"
width=
"40"
/>
</
template
>
</el-table-column>
<el-table-column
v-if=
"multipleSpec"
align=
"center"
label=
"操作"
width=
"250"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleSpecificationDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"specVisiable"
title=
"设置规格"
>
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
</el-form-item>
<el-form-item
label=
"规格值"
prop=
"value"
>
<el-input
v-model=
"specForm.value"
/>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"specForm.picUrl"
:src=
"specForm.picUrl"
class=
"avatar"
/>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
</el-upload>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"specVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSpecificationAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
<el-button
type=
"primary"
@
click=
"handleAttributeShow"
>
添加
</el-button>
<el-table
:data=
"attributes"
>
<el-table-column
property=
"attribute"
label=
"商品参数名称"
/>
<el-table-column
property=
"value"
label=
"商品参数值"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"100"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleAttributeDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"attributeVisiable"
title=
"添加商品参数"
>
<el-form
ref=
"attributeRef"
:model=
"attributeForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"商品参数名称"
prop=
"attribute"
>
<el-input
v-model=
"attributeForm.attribute"
/>
</el-form-item>
<el-form-item
label=
"商品参数值"
prop=
"value"
>
<el-input
v-model=
"attributeForm.value"
/>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"attributeVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleAttributeAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<
template
#
footer
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleEdit"
>
更新商品
</el-button>
</
template
>
</el-drawer>
</div>
</template>
<
script
setup
lang=
"ts"
>
import
{
ref
,
computed
,
nextTick
}
from
"vue"
;
import
{
ref
,
computed
}
from
"vue"
;
import
{
detailGoods
,
editGoods
,
listCatAndBrand
}
from
"@/services/api/commodityManage/list"
;
import
{
uploadPath
}
from
"@/services/api/storage"
;
import
{
ElMessageBox
,
ElMessage
,
ElNotification
}
from
"element-plus"
;
...
...
@@ -266,6 +218,7 @@ import router from '@/router'
import
{
listGoods
}
from
"@/services/api/commodityManage/list"
;
let
route
:
any
=
router
let
editDrawer
=
ref
(
false
)
let
newKeywordVisible
=
ref
(
false
);
let
newPartsVisible
=
ref
(
false
);
let
newKeyword
=
ref
(
""
);
...
...
@@ -290,9 +243,9 @@ let goods = ref({
brief
:
""
,
detail
:
'<p>你好啊!!</p>'
,
categoryId
:
undefined
,
keywords
:
undefined
,
parts
:
undefined
keywords
:
undefined
}
as
any
);
let
goodsParts
=
ref
()
let
specVisiable
=
ref
(
false
);
let
specForm
=
ref
({
specification
:
""
,
value
:
""
,
picUrl
:
""
}
as
any
);
let
multipleSpec
=
ref
(
false
);
...
...
@@ -305,7 +258,6 @@ let productForm = ref({
number
:
0
,
url
:
""
,
});
let
goodsId
=
ref
(
route
.
options
.
history
.
location
.
split
(
'='
)[
1
])
let
products
=
ref
([
{
id
:
0
,
specifications
:
[
"标准"
],
price
:
0.0
,
number
:
0
,
url
:
""
},
]);
...
...
@@ -335,13 +287,9 @@ let initList = () => {
})
}
initList
()
let
init
=
()
=>
{
// if (route.options.history.location.split('=').length > 1) {
// var goodsId = route.options.history.location.split('=')[1]
// }
// else return
detailGoods
(
goodsId
.
value
).
then
((
res
)
=>
{
let
init
=
(
id
:
number
)
=>
{
detailGoods
(
id
).
then
((
res
)
=>
{
goods
.
value
=
res
.
data
.
goods
;
console
.
log
(
goods
.
value
);
...
...
@@ -374,7 +322,6 @@ let init = () => {
brandList
.
value
=
res
.
data
.
brandList
;
});
}
init
()
let
htmlChange
=
(
value
:
any
)
=>
goods
.
value
.
detail
=
value
...
...
@@ -622,6 +569,11 @@ let handleAttributeDelete = (row: any) => {
const
index
=
attributes
.
value
.
indexOf
(
row
);
attributes
.
value
.
splice
(
index
,
1
);
}
defineExpose
({
editDrawer
,
init
})
</
script
>
<
style
>
...
...
src/views/commodityManage/list.vue
浏览文件 @
ca537cc2
...
...
@@ -114,6 +114,8 @@
<litemall-page
:page-data=
"listQuery"
:total=
"total"
@
size-change=
"sizeChange"
@
current-change=
"currentChange"
/>
</div>
<shelves
ref=
"shelvesRef"
@
initShelves=
"getList"
/>
<edit
ref=
"editRef"
:editId=
"editId"
@
initShelves=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
>
...
...
@@ -123,10 +125,15 @@ import { listGoods, deleteGoods } from "@/services/api/commodityManage/list";
// import { thumbnail, toPreview } from "@/utils/index";
import
router
from
'@/router'
;
import
LitemallPage
from
"@/components/pagination/litemallPage.vue"
;
import
shelves
from
'./shelves.vue'
import
edit
from
'./edit.vue'
let
list
=
ref
([]);
let
total
=
ref
(
0
);
let
listLoading
=
ref
(
true
);
let
shelvesRef
=
ref
();
let
editRef
=
ref
();
let
editId
=
ref
();
let
listQuery
=
ref
({
page
:
1
,
limit
:
10
,
...
...
@@ -170,12 +177,12 @@ let handleFilter = () => {
getList
();
};
let
handleCreate
=
()
=>
{
console
.
log
(
'跳转'
);
router
.
push
({
path
:
"/commodity/shelves"
});
shelvesRef
.
value
.
shelvesDrawer
=
true
// router.push({ path: "/commodity/shelves" });
};
let
handleUpdate
=
(
row
:
any
)
=>
{
router
.
push
({
path
:
"/commodity/edit"
,
query
:
{
id
:
row
.
id
}
});
editRef
.
value
.
init
(
row
.
id
)
editRef
.
value
.
editDrawer
=
true
};
let
showDetail
=
(
detail
:
any
)
=>
{
goodsDetail
=
detail
;
...
...
src/views/commodityManage/shelves.vue
浏览文件 @
ca537cc2
<
template
>
<div
class=
"app-container"
>
<el-card
class=
"box-card"
>
<h3>
商品介绍
</h3>
<el-form
ref=
"goodsRef"
:rules=
"rules"
:model=
"goods"
label-width=
"150px"
>
<el-form-item
label=
"商品编号"
prop=
"goodsSn"
>
<el-input
v-model=
"goods.goodsSn"
/>
</el-form-item>
<el-form-item
label=
"商品名称"
prop=
"name"
>
<el-input
v-model=
"goods.name"
/>
</el-form-item>
<el-form-item
label=
"市场售价"
prop=
"counterPrice"
>
<el-input
v-model=
"goods.counterPrice"
placeholder=
"0.00"
>
<template
slot=
"append"
>
元
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"是否新品"
>
<el-radio-group
v-model=
"goods.isNew"
>
<el-radio
:label=
"true"
>
新品
</el-radio>
<el-radio
:label=
"false"
>
非新品
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否热卖"
>
<el-radio-group
v-model=
"goods.isHot"
>
<el-radio
:label=
"false"
>
普通
</el-radio>
<el-radio
:label=
"true"
>
热卖
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否在售"
>
<el-radio-group
v-model=
"goods.isOnSale"
>
<el-radio
:label=
"true"
>
在售
</el-radio>
<el-radio
:label=
"false"
>
未售
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"商品图片"
>
<el-upload
:action=
"uploadPath"
:limit=
"1"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadPicUrl"
list-type=
"picture"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"goods.picUrl"
:src=
"'http://192.168.0.23' + goods.picUrl"
class=
"avatar"
/>
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"宣传画廊"
>
<el-upload
:action=
"uploadPath"
:limit=
"5"
:headers=
"headers"
:on-exceed=
"uploadOverrun"
:on-success=
"handleGalleryUrl"
:on-remove=
"handleRemove"
multiple
accept=
".jpg,.jpeg,.png,.gif"
list-type=
"picture-card"
>
<el-icon
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"商品单位"
>
<el-input
v-model=
"goods.unit"
placeholder=
"件 / 个 / 盒"
/>
</el-form-item>
<el-form-item
label=
"关键字"
>
<el-tag
v-for=
"tag in keywords"
:key=
"tag"
closable
type=
"primary"
@
close=
"handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
v-if=
"newKeywordVisible"
ref=
"newKeywordInput"
v-model=
"newKeyword"
class=
"input-new-keyword"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
/>
<el-button
v-else
class=
"button-new-keyword"
type=
"primary"
@
click=
"showInput"
>
+ 增加
</el-button>
</el-form-item>
<!-- <el-form-item label="商品配件">
<el-tag v-for="tag in parts" :key="tag" closable type="primary" @close="handlePartsClose(tag)">
{{ tag }}
</el-tag>
<el-input v-if="newPartsVisible" ref="newKeywordInput" v-model="newPart" class="input-new-keyword"
@keyup.enter.native="handlePartsConfirm" @blur="handlePartsConfirm" />
<el-button v-else class="button-new-keyword" type="primary" @click="showPartsInput">+ 增加</el-button>
</el-form-item> -->
<el-form-item
label=
"商品配件"
>
<el-select
v-model=
"goods.parts"
multiple
collapse-tags
collapse-tags-tooltip
style=
"width: 240px"
>
<el-option
v-for=
"item in partsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"所属分类"
>
<el-cascader
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
</el-form-item>
<el-form-item
label=
"所属品牌商"
>
<el-select
v-model=
"goods.brandId"
clearable
>
<el-option
v-for=
"item in brandList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"商品简介"
>
<el-input
v-model=
"goods.brief"
/>
</el-form-item>
<el-form-item
label=
"商品详细介绍"
>
<richTextEditor
:valueHtml=
'goods.detail'
@
htmlChange=
"htmlChange"
/>
</el-form-item>
</el-form>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品规格
</h3>
<el-row
:gutter=
"20"
type=
"flex"
align=
"middle"
style=
"padding: 20px 0"
>
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"true"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
</el-col>
</el-row>
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<
template
#
default=
"scope"
>
<!--
<el-tag
type=
"primary"
>
-->
{{
scope
.
row
.
value
}}
<!--
</el-tag>
-->
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
<
template
#
default=
"scope"
>
<img
v-if=
"scope.row.picUrl"
:src=
"scope.row.picUrl"
width=
"40"
/>
</
template
>
</el-table-column>
<el-table-column
v-if=
"multipleSpec"
align=
"center"
label=
"操作"
width=
"250"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleSpecificationDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"specVisiable"
title=
"设置规格"
>
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
<el-drawer
v-model=
"shelvesDrawer"
size=
"100%"
@
before-close=
"handleCancel"
>
<el-card
class=
"box-card"
>
<h3>
商品介绍
</h3>
<el-form
ref=
"goodsRef"
:rules=
"rules"
:model=
"goods"
label-width=
"150px"
>
<el-form-item
label=
"商品编号"
prop=
"goodsSn"
>
<el-input
v-model=
"goods.goodsSn"
/>
</el-form-item>
<el-form-item
label=
"
规格值"
prop=
"valu
e"
>
<el-input
v-model=
"
specForm.valu
e"
/>
<el-form-item
label=
"
商品名称"
prop=
"nam
e"
>
<el-input
v-model=
"
goods.nam
e"
/>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<div
v-if=
"specForm.picUrl"
>
<!-- <img v-if="specForm.picUrl.split('http').length > 1" :src="specForm.picUrl"
class="avatar" /> -->
<img
:src=
"'http://192.168.0.23' + specForm.picUrl"
class=
"avatar"
/>
</div>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
<el-form-item
label=
"市场售价"
prop=
"counterPrice"
>
<el-input
v-model=
"goods.counterPrice"
placeholder=
"0.00"
>
<template
slot=
"append"
>
元
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"是否新品"
>
<el-radio-group
v-model=
"goods.isNew"
>
<el-radio
:label=
"true"
>
新品
</el-radio>
<el-radio
:label=
"false"
>
非新品
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否热卖"
>
<el-radio-group
v-model=
"goods.isHot"
>
<el-radio
:label=
"false"
>
普通
</el-radio>
<el-radio
:label=
"true"
>
热卖
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"是否在售"
>
<el-radio-group
v-model=
"goods.isOnSale"
>
<el-radio
:label=
"true"
>
在售
</el-radio>
<el-radio
:label=
"false"
>
未售
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"商品图片"
>
<el-upload
:action=
"uploadPath"
:limit=
"1"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadPicUrl"
list-type=
"picture"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<img
v-if=
"goods.picUrl"
:src=
"'http://192.168.0.23' + goods.picUrl"
class=
"avatar"
/>
<el-icon
v-else
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"specVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSpecificationAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<!-- <el-card class="box-card">
<h3>商品配件</h3>
<el-table :data="products">
<el-table-column property="value" label="货品规格">
<template #default="scope">
<el-tag v-for="tag in scope.row.specifications" :key="tag">
{{ tag }}
</el-tag>
</template>
</el-table-column>
<el-table-column property="price" width="100" label="货品售价" />
<el-table-column property="number" width="100" label="货品数量" />
<el-table-column property="url" width="100" label="货品图片">
<template #default="scope">
<img v-if="scope.row.url" :src="scope.row.url" width="40" />
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100" class-name="small-padding fixed-width">
<template #default="scope">
<el-button type="primary" size="small" @click="handleProductShow(scope.row)">设置</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog v-model="productVisiable" title="添加货品">
<el-form ref="productRef" :model="productForm" status-icon label-position="left" label-width="100px"
style="width: 400px; margin-left: 50px">
<el-form-item label="货品规格列" prop="specifications">
<el-tag v-for="tag in productForm.specifications" :key="tag">
<el-form-item
label=
"宣传画廊"
>
<el-upload
:action=
"uploadPath"
:limit=
"5"
:headers=
"headers"
:on-exceed=
"uploadOverrun"
:on-success=
"handleGalleryUrl"
:on-remove=
"handleRemove"
multiple
accept=
".jpg,.jpeg,.png,.gif"
list-type=
"picture-card"
>
<el-icon
class=
"avatar-uploader-icon"
>
<Plus
/>
</el-icon>
</el-upload>
</el-form-item>
<el-form-item
label=
"商品单位"
>
<el-input
v-model=
"goods.unit"
placeholder=
"件 / 个 / 盒"
/>
</el-form-item>
<el-form-item
label=
"关键字"
>
<el-tag
v-for=
"tag in keywords"
:key=
"tag"
closable
type=
"primary"
@
close=
"handleClose(tag)"
>
{{ tag }}
</el-tag>
<el-input
v-if=
"newKeywordVisible"
ref=
"newKeywordInput"
v-model=
"newKeyword"
class=
"input-new-keyword"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
/>
<el-button
v-else
class=
"button-new-keyword"
type=
"primary"
@
click=
"showInput"
>
+ 增加
</el-button>
</el-form-item>
<el-form-item label="货品售价" prop="price">
<el-input v-model="productForm.price" />
<el-form-item
label=
"商品配件"
>
<el-select
v-model=
"goodsParts"
multiple
collapse-tags
collapse-tags-tooltip
style=
"width: 240px"
>
<el-option
v-for=
"item in partsList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="货品数量" prop="number">
<el-input v-model="productForm.number" />
<el-form-item
label=
"所属分类"
>
<el-cascader
:options=
"categoryList"
expand-trigger=
"hover"
clearable
@
change=
"handleCategoryChange"
/>
</el-form-item>
<el-form-item label="货品图片" prop="url">
<el-upload :action="uploadPath" :show-file-list="false" :headers="headers"
:on-success="uploadProductUrl" class="avatar-uploader" accept=".jpg,.jpeg,.png,.gif"
>
<
img v-if="productForm.url" :src="productForm.url" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon
" />
</el-
upload
>
<el-form-item
label=
"所属品牌商"
>
<el-select
v-model=
"goods.brandId"
clearable
>
<
el-option
v-for=
"item in brandList"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value
"
/>
</el-
select
>
</el-form-item>
</el-form>
<template #footer class="dialog-footer">
<el-button @click="productVisiable = false">取消</el-button>
<el-button type="primary" @click="handleProductEdit">确定</el-button>
</template>
</el-dialog>
</el-card> -->
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
<el-button
type=
"primary"
@
click=
"handleAttributeShow"
>
添加
</el-button>
<el-table
:data=
"attributes"
>
<el-table-column
property=
"attribute"
label=
"商品参数名称"
/>
<el-table-column
property=
"value"
label=
"商品参数值"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"100"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleAttributeDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"attributeVisiable"
title=
"添加商品参数"
>
<el-form
ref=
"attributeRef"
:model=
"attributeForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"商品参数名称"
prop=
"attribute"
>
<el-input
v-model=
"attributeForm.attribute"
/>
<el-form-item
label=
"商品简介"
>
<el-input
v-model=
"goods.brief"
/>
</el-form-item>
<el-form-item
label=
"商品参数值"
prop=
"value"
>
<el-input
v-model=
"attributeForm.value"
/>
<el-form-item
label=
"商品详细介绍"
>
<richTextEditor
:valueHtml=
'goods.detail'
@
htmlChange=
"htmlChange"
/>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"attributeVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleAttributeAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<div
class=
"op-container"
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handlePublish"
>
上架
</el-button>
</div>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品规格
</h3>
<el-row
:gutter=
"20"
type=
"flex"
align=
"middle"
style=
"padding: 20px 0"
>
<el-col
:span=
"10"
>
<el-radio-group
v-model=
"multipleSpec"
@
change=
"specChanged"
>
<!-- <el-radio-button :label="false">默认标准规格</el-radio-button> -->
<el-radio-button
:label=
"true"
>
多规格支持
</el-radio-button>
</el-radio-group>
</el-col>
<el-col
v-if=
"multipleSpec"
:span=
"10"
>
<el-button
:plain=
"true"
type=
"primary"
@
click=
"handleSpecificationShow"
>
添加
</el-button>
</el-col>
</el-row>
<el-table
:data=
"specifications"
>
<el-table-column
property=
"specification"
label=
"规格名"
/>
<el-table-column
property=
"value"
label=
"规格值"
>
<
template
#
default=
"scope"
>
<!--
<el-tag
type=
"primary"
>
-->
{{
scope
.
row
.
value
}}
<!--
</el-tag>
-->
</
template
>
</el-table-column>
<el-table-column
property=
"picUrl"
label=
"规格图片"
>
<
template
#
default=
"scope"
>
<img
v-if=
"scope.row.picUrl"
:src=
"scope.row.picUrl"
width=
"40"
/>
</
template
>
</el-table-column>
<el-table-column
v-if=
"multipleSpec"
align=
"center"
label=
"操作"
width=
"250"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleSpecificationDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"specVisiable"
title=
"设置规格"
>
<el-form
ref=
"specRef"
:rules=
"rules"
:model=
"specForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"规格名"
prop=
"specification"
>
<el-input
v-model=
"specForm.specification"
/>
</el-form-item>
<el-form-item
label=
"规格值"
prop=
"value"
>
<el-input
v-model=
"specForm.value"
/>
</el-form-item>
<el-form-item
label=
"规格图片"
prop=
"picUrl"
>
<el-upload
:action=
"uploadPath"
:show-file-list=
"false"
:headers=
"headers"
:on-success=
"uploadSpecPicUrl"
class=
"avatar-uploader"
accept=
".jpg,.jpeg,.png,.gif"
>
<div
v-if=
"specForm.picUrl"
>
<!-- <img v-if="specForm.picUrl.split('http').length > 1" :src="specForm.picUrl"
class="avatar" /> -->
<img
:src=
"'http://192.168.0.23' + specForm.picUrl"
class=
"avatar"
/>
</div>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
/>
</el-upload>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"specVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSpecificationAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<el-card
class=
"box-card"
>
<h3>
商品参数
</h3>
<el-button
type=
"primary"
@
click=
"handleAttributeShow"
>
添加
</el-button>
<el-table
:data=
"attributes"
>
<el-table-column
property=
"attribute"
label=
"商品参数名称"
/>
<el-table-column
property=
"value"
label=
"商品参数值"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"100"
class-name=
"small-padding fixed-width"
>
<
template
#
default=
"scope"
>
<el-button
type=
"danger"
size=
"small"
@
click=
"handleAttributeDelete(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-dialog
v-model=
"attributeVisiable"
title=
"添加商品参数"
>
<el-form
ref=
"attributeRef"
:model=
"attributeForm"
status-icon
label-position=
"left"
label-width=
"100px"
style=
"width: 400px; margin-left: 50px"
>
<el-form-item
label=
"商品参数名称"
prop=
"attribute"
>
<el-input
v-model=
"attributeForm.attribute"
/>
</el-form-item>
<el-form-item
label=
"商品参数值"
prop=
"value"
>
<el-input
v-model=
"attributeForm.value"
/>
</el-form-item>
</el-form>
<
template
#
footer
class=
"dialog-footer"
>
<el-button
@
click=
"attributeVisiable = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handleAttributeAdd"
>
确定
</el-button>
</
template
>
</el-dialog>
</el-card>
<
template
#
footer
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"handlePublish"
>
上架
</el-button>
</
template
>
</el-drawer>
</div>
</template>
...
...
@@ -265,15 +208,12 @@ import { publishGoods, listCatAndBrand } from "@/services/api/commodityManage/li
import
{
uploadPath
}
from
"@/services/api/storage"
;
import
{
ElMessageBox
,
ElMessage
,
ElNotification
}
from
"element-plus"
;
import
richTextEditor
from
'@/components/richTextEditor.vue'
import
router
from
'@/router'
import
{
listGoods
,
deleteGoods
}
from
"@/services/api/commodityManage/list"
;
import
{
listGoods
}
from
"@/services/api/commodityManage/list"
;
let
shelvesDrawer
=
ref
(
false
)
let
newKeywordVisible
=
ref
(
false
);
let
newPartsVisible
=
ref
(
false
);
let
newKeyword
=
ref
(
""
);
let
newPart
=
ref
(
""
);
let
keywords
=
ref
([]
as
any
);
let
parts
=
ref
([]
as
any
);
let
categoryList
=
ref
([]
as
any
);
let
brandList
=
ref
([]
as
any
);
let
goods
=
ref
({
...
...
@@ -291,8 +231,8 @@ let goods = ref({
detail
:
'<p></p>'
,
categoryId
:
undefined
,
keywords
:
undefined
,
parts
:
undefined
});
let
goodsParts
=
ref
()
let
specVisiable
=
ref
(
false
);
let
specForm
=
ref
({
specification
:
""
,
value
:
""
,
picUrl
:
""
});
let
multipleSpec
=
ref
(
true
);
...
...
@@ -319,6 +259,8 @@ let rules = ref({
name
:
[{
required
:
true
,
message
:
"商品名称不能为空"
,
trigger
:
"blur"
}],
});
let
emits
=
defineEmits
([
'initShelves'
])
let
init
=
()
=>
{
listCatAndBrand
().
then
((
res
:
any
)
=>
{
categoryList
.
value
=
res
.
data
.
categoryList
;
...
...
@@ -348,8 +290,27 @@ let handleCategoryChange = (value: any) => {
goods
.
value
.
categoryId
=
value
[
value
.
length
-
1
];
}
let
handleCancel
=
()
=>
{
router
.
push
({
path
:
"/commodity/list"
});
// $store.dispatch("tagsView/delView", $route);
goods
.
value
=
{
goodsSn
:
""
,
name
:
""
,
counterPrice
:
""
,
gallery
:
[]
as
any
,
isHot
:
false
,
isNew
:
true
,
isOnSale
:
true
,
picUrl
:
""
,
unit
:
""
,
brandId
:
""
,
brief
:
""
,
detail
:
'<p></p>'
,
categoryId
:
undefined
,
keywords
:
undefined
,
}
specifications
.
value
=
[]
products
.
value
=
[{
id
:
0
,
specifications
:
[
"标准"
],
price
:
0.0
,
number
:
0
,
url
:
""
},]
goodsParts
.
value
=
[]
attributes
.
value
=
[]
shelvesDrawer
.
value
=
false
}
let
handlePublish
=
()
=>
{
const
finalGoods
=
{
...
...
@@ -357,6 +318,7 @@ let handlePublish = () => {
specifications
:
specifications
.
value
,
products
:
products
.
value
,
attributes
:
attributes
.
value
,
parts
:
goodsParts
.
value
};
publishGoods
(
finalGoods
)
.
then
((
res
:
any
)
=>
{
...
...
@@ -365,8 +327,7 @@ let handlePublish = () => {
title
:
"成功"
,
message
:
"创建成功"
,
});
// $store.dispatch("tagsView/delView", $route);
router
.
push
({
path
:
"/commodity/list"
});
handleCancel
()
})
.
catch
((
res
)
=>
{
ElMessageBox
.
alert
(
"业务错误:"
+
res
.
data
.
errmsg
,
"警告"
,
{
...
...
@@ -380,16 +341,10 @@ let handleClose = (tag: any) => {
goods
.
value
.
keywords
=
keywords
.
value
.
toString
();
}
let
handlePartsClose
=
(
tag
:
any
)
=>
{
parts
.
value
.
splice
(
parts
.
value
.
indexOf
(
tag
),
1
);
goods
.
value
.
parts
=
keywords
.
value
.
toString
();
}
let
showInput
=
()
=>
{
newKeywordVisible
.
value
=
true
;
}
let
showPartsInput
=
()
=>
{
newPartsVisible
.
value
=
true
;
}
let
handleInputConfirm
=
()
=>
{
const
newKeywords
:
string
=
newKeyword
.
value
;
if
(
newKeywords
)
{
...
...
@@ -400,15 +355,6 @@ let handleInputConfirm = () => {
newKeyword
.
value
=
""
;
}
let
handlePartsConfirm
=
()
=>
{
const
newParts
:
string
=
newPart
.
value
;
if
(
newParts
)
{
parts
.
value
.
push
(
newParts
);
goods
.
value
.
parts
=
parts
.
value
.
toString
();
}
newPartsVisible
.
value
=
false
;
newPart
.
value
=
""
;
}
let
uploadPicUrl
=
(
res
:
any
)
=>
{
goods
.
value
.
picUrl
=
res
.
data
.
url
;
}
...
...
@@ -593,6 +539,10 @@ let handleAttributeDelete = (row: any) => {
const
index
=
attributes
.
value
.
indexOf
(
row
);
attributes
.
value
.
splice
(
index
,
1
);
}
defineExpose
({
shelvesDrawer
})
</
script
>
<
style
>
...
...
vite.config.ts
浏览文件 @
ca537cc2
...
...
@@ -89,7 +89,7 @@ export default ({ command, mode }) => {
// '/foo': '',
// 选项写法
"/admin"
:
{
target
:
"http://192.168.0.
23
/"
,
target
:
"http://192.168.0.
9:8089
/"
,
// rewrite: (path) => path.replace(/^\/api/, '')
},
// 正则表达式写法
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论