Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
op-web-service
Commits
dfc262f4
Commit
dfc262f4
authored
Sep 01, 2021
by
liwenhong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lwh/goods-add-time'
# Conflicts: # src/pages/Activity/releaseProduc/index.vue
parents
c4870fa3
a310011d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
555 additions
and
541 deletions
+555
-541
goods.js
server/controllers/goods.js
+147
-136
router.js
server/router.js
+1
-0
index.less
src/pages/Goods/List/index.less
+3
-0
index.vue
src/pages/Goods/List/index.vue
+341
-344
goods.js
src/service/Goods/goods.js
+63
-61
No files found.
server/controllers/goods.js
View file @
dfc262f4
...
@@ -16,169 +16,180 @@ const req = require("../utils/request").httpReq;
...
@@ -16,169 +16,180 @@ const req = require("../utils/request").httpReq;
* };
* };
*/
*/
// 获取分类
// 获取分类
exports
.
getCategoryList
=
async
ctx
=>
{
exports
.
getCategoryList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_category_list`
;
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_category_list`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"GET"
method
:
"GET"
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 获取商品列表
// 获取商品列表
exports
.
getList
=
async
ctx
=>
{
exports
.
getList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_list`
;
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_list`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"GET"
,
method
:
"GET"
,
qs
:
ctx
.
request
.
query
qs
:
ctx
.
request
.
query
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 商品上架
// 商品上架
exports
.
putOnline
=
async
ctx
=>
{
exports
.
putOnline
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/online`
;
const
url
=
`
${
GOODS_URI
}
/goods/background/online`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 商品下架
// 商品下架
exports
.
putOffline
=
async
ctx
=>
{
exports
.
putOffline
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/offline`
;
const
url
=
`
${
GOODS_URI
}
/goods/background/offline`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
// 设置商品上架
exports
.
putOnlineSite
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/online_site`
;
const
opts
=
{
url
,
method
:
"POST"
,
json
:
true
,
body
:
ctx
.
request
.
body
,
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 获取商品详情列表
// 获取商品详情列表
exports
.
getGoodsInfo
=
async
ctx
=>
{
exports
.
getGoodsInfo
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_info`
;
const
url
=
`
${
GOODS_URI
}
/goods/background/get_goods_info`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"GET"
,
method
:
"GET"
,
qs
:
ctx
.
request
.
query
qs
:
ctx
.
request
.
query
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 商品审核通过
// 商品审核通过
exports
.
postSuccess
=
async
ctx
=>
{
exports
.
postSuccess
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/audit_pass`
,
url
:
`
${
GOODS_URI
}
/goods/background/audit_pass`
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 营销活动列表
// 营销活动列表
exports
.
getMarketingList
=
async
ctx
=>
{
exports
.
getMarketingList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/marketing/background/marketing_list`
;
const
url
=
`
${
GOODS_URI
}
/marketing/background/marketing_list`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 检查商品名称是否被占用
// 检查商品名称是否被占用
exports
.
checkGoodsName
=
async
ctx
=>
{
exports
.
checkGoodsName
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/check_goods_name`
,
url
:
`
${
GOODS_URI
}
/goods/background/check_goods_name`
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 获取查询活动列表
// 获取查询活动列表
exports
.
getFindGoodsList
=
async
ctx
=>
{
exports
.
getFindGoodsList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/marketing/background/goods_list`
;
const
url
=
`
${
GOODS_URI
}
/marketing/background/goods_list`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 审核拒绝
// 审核拒绝
exports
.
auditReject
=
async
ctx
=>
{
exports
.
auditReject
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/audit_reject`
,
url
:
`
${
GOODS_URI
}
/goods/background/audit_reject`
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
}
}
;
// 添加活动列表
// 添加活动列表
exports
.
getAddMarketingList
=
async
ctx
=>
{
exports
.
getAddMarketingList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/marketing/background/add_marketing`
;
const
url
=
`
${
GOODS_URI
}
/marketing/background/add_marketing`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 获取门店列表
// 获取门店列表
exports
.
getShopsList
=
async
ctx
=>
{
exports
.
getShopsList
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/shop/background/shop_list`
,
url
:
`
${
GOODS_URI
}
/shop/background/shop_list`
,
method
:
"GET"
,
method
:
"GET"
,
qs
:
ctx
.
request
.
query
qs
:
ctx
.
request
.
query
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 添加门店
// 添加门店
exports
.
addShop
=
async
ctx
=>
{
exports
.
addShop
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/shop/background/add_shop`
,
url
:
`
${
GOODS_URI
}
/shop/background/add_shop`
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
}
}
;
// 查看列表详情
// 查看列表详情
exports
.
getMarketingInfo
=
async
ctx
=>
{
exports
.
getMarketingInfo
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/marketing/background/marketing_info`
;
const
url
=
`
${
GOODS_URI
}
/marketing/background/marketing_info`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 修改商品
// 修改商品
exports
.
editGoods
=
async
ctx
=>
{
exports
.
editGoods
=
async
(
ctx
)
=>
{
const
opts
=
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/edit_goods`
,
url
:
`
${
GOODS_URI
}
/goods/background/edit_goods`
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
}
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
};
// 开启关闭状态
// 开启关闭状态
exports
.
updateMarketingList
=
async
ctx
=>
{
exports
.
updateMarketingList
=
async
(
ctx
)
=>
{
const
url
=
`
${
GOODS_URI
}
/marketing/background/update_marketing`
;
const
url
=
`
${
GOODS_URI
}
/marketing/background/update_marketing`
;
const
opts
=
{
const
opts
=
{
url
,
url
,
method
:
"POST"
,
method
:
"POST"
,
json
:
true
,
json
:
true
,
body
:
ctx
.
request
.
body
body
:
ctx
.
request
.
body
,
};
};
const
res
=
await
req
(
ctx
,
opts
);
const
res
=
await
req
(
ctx
,
opts
);
ctx
.
body
=
res
;
ctx
.
body
=
res
;
};
};
server/router.js
View file @
dfc262f4
...
@@ -49,6 +49,7 @@ router.get(`${API_VERSION}/get_goods_category_list`, goods.getCategoryList);
...
@@ -49,6 +49,7 @@ router.get(`${API_VERSION}/get_goods_category_list`, goods.getCategoryList);
router
.
get
(
`
${
API_VERSION
}
/goods/background/get_goods_list`
,
goods
.
getList
);
router
.
get
(
`
${
API_VERSION
}
/goods/background/get_goods_list`
,
goods
.
getList
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/online`
,
goods
.
putOnline
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/online`
,
goods
.
putOnline
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/offline`
,
goods
.
putOffline
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/offline`
,
goods
.
putOffline
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/putOnlineSite`
,
goods
.
putOnlineSite
);
router
.
get
(
`
${
API_VERSION
}
/goods/background/get_goods_info`
,
goods
.
getGoodsInfo
);
router
.
get
(
`
${
API_VERSION
}
/goods/background/get_goods_info`
,
goods
.
getGoodsInfo
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/audit_pass`
,
goods
.
postSuccess
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/audit_pass`
,
goods
.
postSuccess
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/check_goods_name`
,
goods
.
checkGoodsName
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/check_goods_name`
,
goods
.
checkGoodsName
);
...
...
src/pages/Goods/List/index.less
View file @
dfc262f4
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
}
}
}
}
}
}
.pick-time {
margin-left: 10px;
}
.commodity_list {
.commodity_list {
margin-top: 30px;
margin-top: 30px;
}
}
...
...
src/pages/Goods/List/index.vue
View file @
dfc262f4
<
template
>
<
template
>
<layout>
<layout>
<el-card
class=
"goods"
>
<el-card
class=
"goods"
>
<!-- 筛选区 -->
<!-- 筛选区 -->
<el-form
inline
class=
"search_condition"
>
<el-form
inline
class=
"search_condition"
>
<!-- 商品id -->
<!-- 商品id -->
<el-form-item
label=
"商品id"
>
<el-form-item
label=
"商品id"
>
<el-input
v-model=
"searchProps.goods_spu_id"
></el-input>
<el-input
v-model=
"searchProps.goods_spu_id"
></el-input>
</el-form-item>
</el-form-item>
<!-- 商品名称 -->
<!-- 商品名称 -->
<el-form-item
label=
"商品名称"
>
<el-form-item
label=
"商品名称"
>
<el-input
v-model=
"searchProps.goods_name"
></el-input>
<el-input
v-model=
"searchProps.goods_name"
></el-input>
</el-form-item>
</el-form-item>
<!-- 所属分类 -->
<!-- 所属分类 -->
<el-form-item
label=
"所属分类"
>
<el-form-item
label=
"所属分类"
>
<el-cascader
<el-cascader
v-model=
"searchProps.classValue"
v-model=
"searchProps.classValue"
@
change=
"handleTypeChange"
@
change=
"handleTypeChange"
:options=
"labelOptions"
:options=
"labelOptions"
:props=
"cascaderProps"
:props=
"cascaderProps"
collapse-tags
collapse-tags
clearable
clearable
></el-cascader>
></el-cascader>
</el-form-item>
</el-form-item>
<!-- 生活号ID -->
<!-- 生活号ID -->
<el-form-item
label=
"生活号id"
>
<el-form-item
label=
"生活号id"
>
<el-input
v-model=
"searchProps.life_account_id"
></el-input>
<el-input
v-model=
"searchProps.life_account_id"
></el-input>
</el-form-item>
</el-form-item>
<!-- 生活号名称 -->
<!-- 生活号名称 -->
<el-form-item
label=
"生活号名称"
>
<el-form-item
label=
"生活号名称"
>
<el-input
v-model=
"searchProps.life_account_name"
></el-input>
<el-input
v-model=
"searchProps.life_account_name"
></el-input>
</el-form-item>
</el-form-item>
<!-- 审核状态 -->
<!-- 审核状态 -->
<el-form-item
label=
"审核状态"
>
<el-form-item
label=
"审核状态"
>
<el-select
<el-select
v-model=
"audit_status"
multiple
collapse-tags
@
change=
"handleStatusChange"
>
v-model=
"audit_status"
<el-option
v-for=
"item in stateOption"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
multiple
</el-select>
collapse-tags
</el-form-item>
@
change=
"handleStatusChange"
<el-form-item
label=
"上架状态"
>
>
<el-select
v-model=
"onlineStatus"
multiple
collapse-tags
@
change=
"handleOnlineStatusChange"
>
<el-option
<el-option
v-for=
"item in onlineStateOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
v-for=
"item in stateOption"
</el-select>
:key=
"item.value"
</el-form-item>
:label=
"item.label"
<!-- 按钮操作 -->
:value=
"item.value"
<el-form-item
style=
"justify-self: flex-end"
>
></el-option>
<el-button
@
click=
"searchList"
type=
"primary"
>
搜索
</el-button>
</el-select>
<el-button
@
click=
"resetList"
>
重置
</el-button>
</el-form-item>
</el-form-item>
<el-form-item
label=
"上架状态"
>
</el-form>
<el-select
v-model=
"onlineStatus"
multiple
collapse-tags
@
change=
"handleOnlineStatusChange"
>
<el-option
v-for=
"item in onlineStateOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
</el-form-item>
<!-- 按钮操作 -->
<el-form-item
style=
"justify-self: flex-end;"
>
<el-button
@
click=
"searchList"
type=
"primary"
>
搜索
</el-button>
<el-button
@
click=
"resetList"
>
重置
</el-button>
</el-form-item>
</el-form>
<!-- 列表区 -->
<!-- 列表区 -->
<el-table
class=
"goods_list"
:data=
"goodsList"
border
stripe
>
<el-table
class=
"goods_list"
:data=
"goodsList"
border
stripe
>
<el-table-column
<el-table-column
label=
"商品id"
prop=
"goods_spu_id"
align=
"center"
></el-table-column>
label=
"商品id"
<el-table-column
label=
"商品名称"
prop=
"goods_name"
align=
"center"
></el-table-column>
prop=
"goods_spu_id"
<el-table-column
label=
"一级分类"
prop=
"category_1_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"二级分类"
prop=
"category_2_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"生活号id"
prop=
"life_account_id"
align=
"center"
></el-table-column>
<el-table-column
label=
"生活号名称"
prop=
"life_account_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"发布者"
prop=
"publish_user_id"
align=
"center"
></el-table-column>
<el-table-column
label=
"状态"
align=
"center"
>
<template
#
default=
"scope"
>
<span
v-if=
"scope.row.audit_status == 0"
style=
"color: #ff982c"
>
待审核
</span>
<span
v-if=
"scope.row.audit_status == 1"
style=
"color: #5cc247"
>
审核通过
</span>
<span
v-if=
"scope.row.audit_status == 2"
style=
"color: #fd6b6f"
>
审核驳回
</span>
<span
v-if=
"scope.row.online_status == 0 && scope.row.audit_status != 2"
style=
"color: #ff982c"
>
未上架
</span>
<span
v-if=
"scope.row.online_status == 1 && scope.row.audit_status != 2"
style=
"color: #5cc247"
>
已上架
</span>
<span
v-if=
"scope.row.online_status == 2 && scope.row.audit_status != 2"
style=
"color: #fd6b6f"
>
已下架
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"状态更新时间"
prop=
"update_time"
align=
"center"
></el-table-column>
<el-table-column
label=
"商品创建时间"
prop=
"create_time"
align=
"center"
></el-table-column>
<el-table-column
label=
"上架类型"
prop=
"online_type"
align=
"center"
>
<
template
#
default=
"scope"
>
{{
[
""
,
"立即上架"
,
"定点上架"
,
"暂不上架"
][
scope
.
row
.
online_type
]
}}
</
template
>
</el-table-column>
<!-- <el-table-column
label="上架时间"
prop="online_start_time"
align="center"
align="center"
></el-table-column>
>
<el-table-column
label=
"商品名称"
prop=
"goods_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"一级分类"
prop=
"category_1_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"二级分类"
prop=
"category_2_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"生活号id"
prop=
"life_account_id"
align=
"center"
></el-table-column>
<el-table-column
label=
"生活号名称"
prop=
"life_account_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"发布者"
prop=
"publish_user_id"
align=
"center"
></el-table-column>
<el-table-column
label=
"状态"
align=
"center"
>
<template #default="scope">
<template #default="scope">
<span
v-if=
"scope.row.audit_status == 0"
style=
"color:#FF982C;"
{{scope.row.online_start_time}} - {{scope.row.online_end_time}}
>
待审核
</span
>
<span
v-if=
"scope.row.audit_status == 1"
style=
"color:#5CC247;"
>
审核通过
</span
>
<span
v-if=
"scope.row.audit_status == 2"
style=
"color:#FD6B6F;"
>
审核驳回
</span
>
<span
v-if=
"scope.row.online_status == 0 && scope.row.audit_status != 2"
style=
"color:#FF982C;"
>
未上架
</span
>
<span
v-if=
"scope.row.online_status == 1 && scope.row.audit_status != 2"
style=
"color:#5CC247;"
>
已上架
</span
>
<span
v-if=
"scope.row.online_status == 2 && scope.row.audit_status != 2"
style=
"color:#FD6B6F;"
>
已下架
</span
>
</template>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
<!-- 操作快捷键 -->
label=
"状态更新时间"
<el-table-column
label=
"操作"
align=
"center"
fixed=
"right"
width=
"200"
>
prop=
"update_time"
<
template
#
default=
"scope"
>
align=
"center"
<el-button
type=
"text"
@
click=
"goDetail(`EDIT`, scope.row.goods_spu_id)"
>
编辑
</el-button>
></el-table-column>
<el-table-column
label=
"商品创建时间"
prop=
"create_time"
align=
"center"
></el-table-column>
<!-- 操作快捷键 -->
<el-table-column
label=
"操作"
align=
"center"
fixed=
"right"
width=
"200"
>
<
template
#
default=
"scope"
>
<el-button
type=
"text"
@
click=
"goDetail(`EDIT`, scope.row.goods_spu_id)"
>
编辑
</el-button
>
<el-button
<el-button
v-if=
"scope.row.audit_status == 0"
type=
"text"
@
click=
"goDetail(`AUDIT`, scope.row.goods_spu_id)"
>
审核
</el-button>
v-if=
"scope.row.audit_status == 0"
type=
"text"
@
click=
"goDetail(`AUDIT`, scope.row.goods_spu_id)"
>
审核
</el-button
>
<el-popconfirm
<!--
<el-popconfirm
v-if=
"scope.row.online_status == 2"
v-if=
"scope.row.online_status == 2"
title=
"您确定要上架该商品吗?"
title=
"您确定要上架该商品吗?"
cancelButtonType=
"default"
cancelButtonType=
"default"
...
@@ -169,9 +100,9 @@
...
@@ -169,9 +100,9 @@
<template
#
reference
>
<template
#
reference
>
<el-button
type=
"text"
>
上架
</el-button>
<el-button
type=
"text"
>
上架
</el-button>
</
template
>
</
template
>
</el-popconfirm>
</el-popconfirm>
-->
<el-popconfirm
<!--
<el-popconfirm
v-if="
v-if="
scope.row.online_status != 2 &&
scope.row.online_status != 2 &&
(scope.row.audit_status == 1 || scope.row.online_status == 1)
(scope.row.audit_status == 1 || scope.row.online_status == 1)
...
@@ -185,208 +116,274 @@
...
@@ -185,208 +116,274 @@
<template #reference>
<template #reference>
<el-button type="text">下架</el-button>
<el-button type="text">下架</el-button>
</template>
</template>
</el-popconfirm>
</el-popconfirm>
-->
<el-button
<el-button
@
click=
"goDetail(`DETAIL`, scope.row.goods_spu_id)"
type=
"text"
>
详情
</el-button>
@
click=
"goDetail(`DETAIL`, scope.row.goods_spu_id)"
<el-button
type=
"text"
@
click=
"handleGoodOnline(scope.row)"
>
上架配置
</el-button>
type=
"text"
</template>
>
详情
</el-button
</el-table-column>
>
</el-table>
</template>
<el-dialog
title=
"上架时间配置"
width=
"50%"
top=
"10%"
center
v-model=
"showGoodsAddTime"
>
</el-table-column>
<el-form-item>
</el-table>
上架时间:
<el-radio-group
v-model=
"checkedAddTime.online_type"
>
<!-- 页码区 -->
<el-radio
:label=
"1"
>
立即上架
</el-radio>
<el-pagination
<el-radio
:label=
"2"
>
class=
"pagination"
定点上架
@
current-change=
"handleCurrentChange"
<span
class=
"pick-time"
>
v-model:currentPage=
"searchProps.page"
<el-date-picker
:page-size=
"searchProps.page_size"
v-model=
"addTimeRange"
layout=
"total,prev, pager, next, jumper"
type=
"datetimerange"
:total=
"totalCount"
start-placeholder=
"开始日期"
>
end-placeholder=
"结束日期"
</el-pagination>
format=
"YYYY-MM-DD HH:mm:ss"
</el-card>
value-format=
"YYYY-MM-DD HH:mm:ss"
</layout>
:disabled=
"checkedAddTime.online_type != 2"
@
change=
"pickAddTime"
></el-date-picker>
</span>
</el-radio>
<el-radio
:label=
"3"
>
暂不上架
</el-radio>
</el-radio-group>
</el-form-item>
<
template
#
footer
>
<span>
<el-button
type=
"primary"
@
click=
"handleConfirmRefund"
>
确认
</el-button>
<el-button
@
click=
"showGoodsAddTime = false"
>
返回
</el-button>
</span>
</
template
>
</el-dialog>
<!-- 页码区 -->
<el-pagination
class=
"pagination"
@
current-change=
"handleCurrentChange"
v-model:currentPage=
"searchProps.page"
:page-size=
"searchProps.page_size"
layout=
"total,prev, pager, next, jumper"
:total=
"totalCount"
></el-pagination>
</el-card>
</layout>
</template>
</template>
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
<
script
>
<
script
>
import
{
import
{
getGoodsList
,
getList
,
putOnline
,
putOffline
,
putOnlineSite
}
from
"@/service/Goods/goods"
;
getGoodsList
,
import
Layout
from
"../layout/index.vue"
;
getList
,
export
default
{
putOnline
,
name
:
"GoodsList"
,
putOffline
}
from
"@/service/Goods/goods"
;
import
Layout
from
"../layout/index.vue"
;
export
default
{
name
:
"GoodsList"
,
components
:
{
components
:
{
Layout
Layout
,
},
},
created
()
{
created
()
{
// 获取级联选择
// 获取级联选择
this
.
getOptionList
();
this
.
getOptionList
();
// 获取商品列表
// 获取商品列表
this
.
getCommodityList
();
this
.
getCommodityList
();
},
},
data
()
{
data
()
{
return
{
return
{
// 级联选择器参数
// 级联选择器参数
cascaderProps
:
{
cascaderProps
:
{
multiple
:
true
,
// 是否支持多选
multiple
:
true
,
// 是否支持多选
value
:
"category_id"
,
// 每一项选择的值
value
:
"category_id"
,
// 每一项选择的值
label
:
"name"
,
// 每一项的名称
label
:
"name"
,
// 每一项的名称
children
:
"sub_list"
// 每一项子集的对应节点
children
:
"sub_list"
,
// 每一项子集的对应节点
},
},
// 查询参数
// 查询参数
searchProps
:
{
searchProps
:
{
page
:
1
,
// 页码
page
:
1
,
// 页码
page_size
:
20
,
// 页数大小
page_size
:
20
,
// 页数大小
goods_spu_id
:
""
,
// 后台商品id
goods_spu_id
:
""
,
// 后台商品id
goods_name
:
""
,
// 商品名称
goods_name
:
""
,
// 商品名称
category_1_id
:
""
,
// 一级分类id
category_1_id
:
""
,
// 一级分类id
category_2_id
:
""
,
// 二级分类id
category_2_id
:
""
,
// 二级分类id
life_account_id
:
""
,
life_account_id
:
""
,
life_account_name
:
""
,
life_account_name
:
""
,
audit_status
:
""
,
// 审核状态
audit_status
:
""
,
// 审核状态
online_status
:
""
,
// 上架状态
online_status
:
""
,
// 上架状态
classValue
:
""
classValue
:
""
,
},
},
// 级联选择器
// 级联选择器
labelOptions
:
[],
labelOptions
:
[],
// 审核状态
// 审核状态
stateOption
:
[
stateOption
:
[
{
value
:
0
,
label
:
"待审核"
},
{
value
:
0
,
label
:
"待审核"
},
{
value
:
1
,
label
:
"审核通过"
},
{
value
:
1
,
label
:
"审核通过"
},
{
value
:
2
,
label
:
"审核驳回"
}
{
value
:
2
,
label
:
"审核驳回"
},
],
],
// 上下架状态
// 上下架状态
onlineStateOptions
:
[
onlineStateOptions
:
[
{
value
:
0
,
label
:
"未上架"
},
{
value
:
0
,
label
:
"未上架"
},
{
value
:
1
,
label
:
"已上架"
},
{
value
:
1
,
label
:
"已上架"
},
{
value
:
2
,
label
:
"已下架"
}
{
value
:
2
,
label
:
"已下架"
},
],
],
audit_status
:
[],
// 审核状态
audit_status
:
[],
// 审核状态
onlineStatus
:
[],
// 上/下架状态
onlineStatus
:
[],
// 上/下架状态
// 商品列表
// 商品列表
goodsList
:
[],
goodsList
:
[],
totalCount
:
0
// 总条数
totalCount
:
0
,
// 总条数
};
showGoodsAddTime
:
false
,
//商品添加弹窗
},
addTimeRange
:
[],
checkedAddTime
:
{
online_start_time
:
""
,
online_end_time
:
""
,
online_type
:
3
,
goods_spu_id
:
""
,
},
};
},
methods
:
{
methods
:
{
// 获取级联选择
// 获取级联选择
async
getOptionList
()
{
async
getOptionList
()
{
try
{
try
{
const
res
=
await
getGoodsList
();
const
res
=
await
getGoodsList
();
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
labelOptions
=
res
.
result
;
this
.
labelOptions
=
res
.
result
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
},
},
// 获取数组返回值并转换为字符串
// 获取数组返回值并转换为字符串
getVal
(
value
,
index
=
0
)
{
getVal
(
value
,
index
=
0
)
{
const
valueArray
=
value
.
map
(
item
=>
{
const
valueArray
=
value
.
map
((
item
)
=>
{
return
item
[
index
];
return
item
[
index
];
});
});
return
valueArray
.
join
();
return
valueArray
.
join
();
},
},
getValue
(
value
)
{
getValue
(
value
)
{
const
values
=
value
.
map
(
item
=>
{
const
values
=
value
.
map
((
item
)
=>
{
return
item
;
return
item
;
});
});
return
values
.
join
();
return
values
.
join
();
},
},
// 获取列表
// 获取列表
async
getCommodityList
()
{
async
getCommodityList
()
{
try
{
try
{
const
res
=
await
getList
(
this
.
searchProps
);
const
res
=
await
getList
(
this
.
searchProps
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
console
.
log
(
"商品列表"
,
res
);
console
.
log
(
"商品列表"
,
res
);
this
.
goodsList
=
res
.
result
.
list
;
this
.
goodsList
=
res
.
result
.
list
;
this
.
totalCount
=
res
.
result
.
count
;
this
.
totalCount
=
res
.
result
.
count
;
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
},
},
// 所属分类赋值
// 所属分类赋值
handleTypeChange
(
val
)
{
handleTypeChange
(
val
)
{
this
.
searchProps
.
category_1_id
=
this
.
getVal
(
val
,
0
);
this
.
searchProps
.
category_1_id
=
this
.
getVal
(
val
,
0
);
this
.
searchProps
.
category_2_id
=
this
.
getVal
(
val
,
1
);
this
.
searchProps
.
category_2_id
=
this
.
getVal
(
val
,
1
);
},
},
// 审核状态赋值
// 审核状态赋值
handleStatusChange
(
val
)
{
handleStatusChange
(
val
)
{
this
.
searchProps
.
audit_status
=
this
.
getValue
(
val
);
this
.
searchProps
.
audit_status
=
this
.
getValue
(
val
);
},
},
// 上架状态赋值
// 上架状态赋值
handleOnlineStatusChange
(
val
)
{
handleOnlineStatusChange
(
val
)
{
this
.
searchProps
.
online_status
=
this
.
getValue
(
val
);
this
.
searchProps
.
online_status
=
this
.
getValue
(
val
);
},
},
// 按条件搜索
// 按条件搜索
searchList
()
{
searchList
()
{
console
.
log
(
this
.
searchProps
);
console
.
log
(
this
.
searchProps
);
this
.
getCommodityList
();
this
.
getCommodityList
();
},
},
// 重置表单
pickAddTime
(
val
)
{
resetList
()
{
if
(
val
[
1
]
<
new
Date
())
{
this
.
searchProps
=
{
this
.
addTimeRange
[
1
]
=
new
Date
();
page
:
1
,
// 页码
this
.
$message
.
warning
(
"结束时间不能小于当前时间"
);
page_size
:
20
,
// 页数大小
}
goods_spu_id
:
""
,
// 后台商品id
},
goods_name
:
""
,
// 商品名称
// 重置表单
category_1_id
:
""
,
// 一级分类id
resetList
()
{
category_2_id
:
""
,
// 二级分类id
this
.
searchProps
=
{
life_account_id
:
""
,
page
:
1
,
// 页码
life_account_name
:
""
,
page_size
:
20
,
// 页数大小
audit_status
:
""
,
// 审核状态
goods_spu_id
:
""
,
// 后台商品id
online_status
:
""
,
// 上架状态
goods_name
:
""
,
// 商品名称
classValue
:
""
category_1_id
:
""
,
// 一级分类id
};
category_2_id
:
""
,
// 二级分类id
this
.
audit_status
=
[];
life_account_id
:
""
,
this
.
onlineStatus
=
[];
life_account_name
:
""
,
this
.
getCommodityList
();
audit_status
:
""
,
// 审核状态
},
online_status
:
""
,
// 上架状态
// 上架/下架操作
classValue
:
""
,
async
changeGoodsState
(
state
,
spuId
)
{
};
// 上架操作
this
.
audit_status
=
[];
if
(
state
===
"GROUNDING"
)
{
this
.
onlineStatus
=
[];
const
res
=
await
putOnline
(
spuId
);
this
.
getCommodityList
();
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
},
this
.
$message
.
success
(
"商品上架成功"
);
// 上架/下架操作
}
async
changeGoodsState
(
state
,
spuId
)
{
// 下架操作
// 上架操作
else
if
(
state
===
"UNDERCARRIAGE"
)
{
if
(
state
===
"GROUNDING"
)
{
const
res
=
await
putOffline
(
spuId
);
const
res
=
await
putOnline
(
spuId
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"商品下架成功"
);
this
.
$message
.
success
(
"商品上架成功"
);
}
}
this
.
getCommodityList
();
// 下架操作
},
else
if
(
state
===
"UNDERCARRIAGE"
)
{
const
res
=
await
putOffline
(
spuId
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"商品下架成功"
);
}
this
.
getCommodityList
();
},
// 页码变化
// 页码变化
handleCurrentChange
(
e
)
{
handleCurrentChange
(
e
)
{
this
.
searchProps
.
page
=
e
;
this
.
searchProps
.
page
=
e
;
// 获取信息
// 获取信息
this
.
getCommodityList
();
this
.
getCommodityList
();
},
},
// 去往详情页
// 去往详情页
goDetail
(
operation
,
spuId
)
{
goDetail
(
operation
,
spuId
)
{
console
.
log
(
spuId
);
console
.
log
(
spuId
);
this
.
$router
.
push
({
name
:
"GoodsDetail"
,
params
:
{
operation
,
spuId
}
});
this
.
$router
.
push
({
name
:
"GoodsDetail"
,
params
:
{
operation
,
spuId
}
});
}
},
}
handleGoodOnline
(
item
)
{
};
item
.
online_start_time
&&
item
.
online_end_time
&&
(
this
.
addTimeRange
=
[
item
.
online_start_time
,
item
.
online_end_time
]);
this
.
showGoodsAddTime
=
true
;
this
.
checkedAddTime
.
online_type
=
item
.
online_type
||
3
;
this
.
checkedAddTime
.
goods_spu_id
=
item
.
goods_spu_id
;
},
changeDate
(
dateA
)
{
let
time
=
new
Date
(
dateA
).
toJSON
();
let
date
=
new
Date
(
+
new
Date
(
time
)
+
8
*
3600
*
1000
)
.
toISOString
()
.
replace
(
/T/g
,
" "
)
.
replace
(
/
\.[\d]{3}
Z/
,
""
);
return
date
;
},
async
handleConfirmRefund
()
{
if
(
this
.
checkedAddTime
.
online_type
==
2
)
{
this
.
checkedAddTime
.
online_start_time
=
this
.
changeDate
(
this
.
addTimeRange
[
0
]);
this
.
checkedAddTime
.
online_end_time
=
this
.
changeDate
(
this
.
addTimeRange
[
1
]);
}
let
res
=
await
putOnlineSite
(
this
.
checkedAddTime
);
await
this
.
getCommodityList
();
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
showGoodsAddTime
=
false
;
this
.
addTimeRange
=
[];
this
.
checkedAddTime
=
{
online_start_time
:
""
,
online_end_time
:
""
,
online_type
:
1
,
goods_spu_id
:
""
,
};
return
this
.
$message
.
success
(
"操作成功"
);
},
},
};
</
script
>
</
script
>
src/service/Goods/goods.js
View file @
dfc262f4
import
axios
from
"@/utils/request"
;
import
axios
from
"@/utils/request"
;
// 获取商品分类项
// 获取商品分类项
export
async
function
getGoodsList
()
{
export
async
function
getGoodsList
()
{
const
res
=
await
axios
.
get
(
"/api/v1/get_goods_category_list"
);
const
res
=
await
axios
.
get
(
"/api/v1/get_goods_category_list"
);
return
res
;
return
res
;
}
}
// 获取商品列表
// 获取商品列表
export
async
function
getList
(
params
)
{
export
async
function
getList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_list"
,
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_list"
,
{
params
params
,
});
});
return
res
;
return
res
;
}
}
// 商品上架
// 商品上架
export
async
function
putOnline
(
query
)
{
export
async
function
putOnline
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/online"
,
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/online"
,
{
goods_spu_id
:
query
goods_spu_id
:
query
,
});
});
return
res
;
return
res
;
}
}
// 商品下架
// 商品下架
export
async
function
putOffline
(
query
)
{
export
async
function
putOffline
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/offline"
,
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/offline"
,
{
goods_spu_id
:
query
goods_spu_id
:
query
,
});
});
return
res
;
return
res
;
}
// 设置商品上架
export
async
function
putOnlineSite
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/putOnlineSite"
,
params
);
return
res
;
}
}
// 获取商品详情列表
// 获取商品详情列表
export
async
function
getGoodsInfo
(
params
)
{
export
async
function
getGoodsInfo
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_info"
,
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_info"
,
{
params
params
,
});
});
return
res
;
return
res
;
}
}
// 商品详情-审核通过
// 商品详情-审核通过
export
async
function
postSuccess
(
query
)
{
export
async
function
postSuccess
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_pass"
,
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_pass"
,
{
goods_spu_id
:
query
goods_spu_id
:
query
,
});
});
return
res
;
return
res
;
}
}
// 审核拒绝
// 审核拒绝
export
async
function
auditReject
(
query
)
{
export
async
function
auditReject
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_reject"
,
query
);
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_reject"
,
query
);
return
res
;
return
res
;
}
}
// 商品详情-检查商品名称是否重复
// 商品详情-检查商品名称是否重复
export
async
function
checkGoodsName
(
params
)
{
export
async
function
checkGoodsName
(
params
)
{
const
res
=
await
axios
.
post
(
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/check_goods_name"
,
params
);
"/api/v1/goods/background/check_goods_name"
,
return
res
;
params
);
return
res
;
}
}
// 获取门店表单
// 获取门店表单
export
async
function
getShopsList
(
params
)
{
export
async
function
getShopsList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/shop/background/shop_list"
,
{
params
});
const
res
=
await
axios
.
get
(
"/api/v1/shop/background/shop_list"
,
{
params
});
return
res
;
return
res
;
}
}
// 添加门店信息
// 添加门店信息
export
async
function
postAddShop
(
query
)
{
export
async
function
postAddShop
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/shop/background/add_shop"
,
query
);
const
res
=
await
axios
.
post
(
"/api/v1/shop/background/add_shop"
,
query
);
return
res
;
return
res
;
}
}
export
async
function
editGoods
(
query
)
{
export
async
function
editGoods
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/edit_goods"
,
query
);
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/edit_goods"
,
query
);
return
res
;
return
res
;
}
}
// 获取营销活动列表
// 获取营销活动列表
export
async
function
getMarketingList
(
params
)
{
export
async
function
getMarketingList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/get_marketing_list"
,
params
);
const
res
=
await
axios
.
post
(
"/api/v1/get_marketing_list"
,
params
);
return
res
;
return
res
;
}
}
// 获取查询商品列表
// 获取查询商品列表
export
async
function
getFindGoodsList
(
params
)
{
export
async
function
getFindGoodsList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/get_find_goods_list"
,
params
);
const
res
=
await
axios
.
post
(
"/api/v1/get_find_goods_list"
,
params
);
return
res
;
return
res
;
}
}
// 获取添加活动列表
// 获取添加活动列表
export
async
function
getAddMarketingList
(
params
)
{
export
async
function
getAddMarketingList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/get_addmarketing_list"
,
params
);
const
res
=
await
axios
.
post
(
"/api/v1/get_addmarketing_list"
,
params
);
return
res
;
return
res
;
}
}
// 获取查看列表
// 获取查看列表
export
async
function
getMarketingInfo
(
marketing_id
)
{
export
async
function
getMarketingInfo
(
marketing_id
)
{
const
res
=
await
axios
.
post
(
"/api/v1/get_marketing_info"
,
marketing_id
);
const
res
=
await
axios
.
post
(
"/api/v1/get_marketing_info"
,
marketing_id
);
return
res
;
return
res
;
}
}
// 获取开启关闭
// 获取开启关闭
export
async
function
updateMarketingList
(
params
)
{
export
async
function
updateMarketingList
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/update_marketing_list"
,
params
);
const
res
=
await
axios
.
post
(
"/api/v1/update_marketing_list"
,
params
);
return
res
;
return
res
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment