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
58b89060
Commit
58b89060
authored
Jun 30, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature:拒绝审核完成
parent
0027faa5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
553 additions
and
170 deletions
+553
-170
goods.js
server/controllers/goods.js
+32
-0
router.js
server/router.js
+4
-0
index.css
src/pages/Goods/Detail/index.css
+17
-18
index.less
src/pages/Goods/Detail/index.less
+20
-18
index.vue
src/pages/Goods/Detail/index.vue
+454
-132
goods.js
src/service/Goods/goods.js
+26
-2
No files found.
server/controllers/goods.js
View file @
58b89060
...
...
@@ -66,3 +66,35 @@ exports.getGoodsInfo = async ctx => {
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
// 商品审核通过
exports
.
postSuccess
=
async
ctx
=>
{
const
url
=
`
${
GOODS_URI
}
/goods/background/audit_pass`
;
const
opts
=
{
url
,
method
:
"POST"
,
json
:
true
,
body
:
ctx
.
request
.
body
};
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
exports
.
checkGoodsName
=
async
ctx
=>
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/check_goods_name`
,
method
:
"POST"
,
json
:
true
,
body
:
ctx
.
request
.
body
};
ctx
.
body
=
req
(
ctx
,
opts
);
};
exports
.
auditReject
=
async
ctx
=>
{
const
opts
=
{
url
:
`
${
GOODS_URI
}
/goods/background/audit_reject`
,
method
:
"POST"
,
json
:
true
,
body
:
ctx
.
request
.
body
};
console
.
log
(
"审核驳回操作"
,
ctx
.
request
.
body
);
ctx
.
body
=
await
req
(
ctx
,
opts
);
};
server/router.js
View file @
58b89060
...
...
@@ -43,6 +43,10 @@ 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/offline`
,
goods
.
putOffline
);
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/check_goods_name`
,
goods
.
checkGoodsName
);
router
.
post
(
`
${
API_VERSION
}
/goods/background/audit_reject`
,
goods
.
auditReject
)
//生活号
router
.
post
(
`
${
API_VERSION
}
/merchant/lifeinner/life_info`
,
life
.
get_life_info
)
...
...
src/pages/Goods/Detail/index.css
View file @
58b89060
...
...
@@ -16,24 +16,6 @@
display
:
flex
;
justify-content
:
flex-start
;
}
.detail
.message
.message_form
{
width
:
50%
;
}
.detail
.message
.message_form
.el-input__inner
{
width
:
80%
;
}
.detail
.message
.message_form
.el-textarea
{
width
:
80%
;
}
.detail
.message
.message_form
.options
{
width
:
80%
;
}
.detail
.message
.message_form
.options
.el-input__inner
{
width
:
100%
;
}
.detail
.message
.message_image
{
width
:
50%
;
}
.message_border
{
margin
:
10px
0
;
}
...
...
@@ -44,3 +26,20 @@
.el-textarea
.el-textarea__inner
{
resize
:
none
;
}
.operationButton
{
margin-top
:
30px
;
display
:
flex
;
justify-content
:
center
;
}
.deep_place
.el-form-item__content
{
display
:
flex
;
align-items
:
center
;
}
.deep_place
a
{
margin-left
:
10px
;
text-align
:
center
;
width
:
200px
;
border-radius
:
20px
;
color
:
#fff
;
background-color
:
#199ffb
;
}
src/pages/Goods/Detail/index.less
View file @
58b89060
...
...
@@ -14,24 +14,6 @@
.message {
display: flex;
justify-content: flex-start;
.message_form {
width: 50%;
.el-input__inner {
width: 80%;
}
.el-textarea {
width: 80%;
}
.options {
width: 80%;
.el-input__inner {
width: 100%;
}
}
}
.message_image {
width: 50%;
}
}
}
...
...
@@ -46,3 +28,23 @@
.el-textarea .el-textarea__inner {
resize: none;
}
.operationButton {
margin-top: 30px;
display: flex;
justify-content: center;
}
.deep_place {
.el-form-item__content {
display: flex;
align-items: center;
}
a {
margin-left: 10px;
text-align: center;
width: 200px;
border-radius: 20px;
color: #fff;
background-color: #199ffb;
}
}
src/pages/Goods/Detail/index.vue
View file @
58b89060
...
...
@@ -14,30 +14,62 @@
<el-card
class=
"message_border"
>
<section
class=
"message"
>
<!-- 商品列表修改区 -->
<section
class=
"width50p"
>
<el-form
class=
"message_form width50p"
label-position=
"left"
label-width=
"10
0px"
label-width=
"14
0px"
>
<h3>
基本信息
</h3>
<el-form-item
label=
"生活号名称:"
>
<el-input
<!--
<el-input
v-if=
"$route.params.operation === 'EDIT'"
disabled
:readonly=
"true"
v-model=
"goodsObj.life_account_name"
></el-input>
></el-input>
-->
<span>
{{
goodsObj
.
life_account_name
}}
</span>
</el-form-item>
<el-form-item
label=
"生活号认证:"
>
<el-input></el-input>
<el-form-item
label=
"生活号类型:"
>
<!--
<el-select
aria-readonly=
"true"
disabled
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.life_account_type"
>
<el-option
v-for=
"item in lifeList"
:key=
"item.value"
:label=
"item.options"
:value=
"item.value"
></el-option>
</el-select>
-->
<span
v-if=
"goodsObj.life_account_type === 1"
>
个人生活号
</span>
<span
v-if=
"goodsObj.life_account_type === 2"
>
企业生活号
</span>
</el-form-item>
<el-form-item
label=
"生活号认证状态:"
>
<span
v-if=
"goodsObj.life_account_auth_status === 1"
>
未认证
</span>
<span
v-if=
"goodsObj.life_account_auth_status === 2"
>
已认证
</span>
</el-form-item>
<el-form-item
label=
"商品id:"
>
<el-input
v-model=
"goodsObj.goods_spu_id"
></el-input>
<!--
<el-input
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.goods_spu_id"
></el-input>
-->
<span>
{{
goodsObj
.
goods_spu_id
}}
</span>
</el-form-item>
<el-form-item
label=
"商品名称:"
>
<el-input
v-model=
"goodsObj.goods_name"
></el-input>
<el-input
maxlength=
"50"
show-word-limit
v-if=
"$route.params.operation === 'EDIT'"
v-model=
"goodsObj.goods_name"
@
blur=
"checkSameName"
></el-input>
<span
v-else
>
{{
goodsObj
.
goods_name
}}
</span>
</el-form-item>
<el-form-item
label=
"分类:"
>
<el-cascader
:disabled=
"$route.params.operation !== 'EDIT'"
v-model=
"optionsValue"
class=
"options"
:options=
"optionList"
...
...
@@ -48,36 +80,45 @@
</el-form-item>
<el-form-item
label=
"描述:"
>
<el-input
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
maxlength=
"50"
show-word-limit
:autosize=
"
{ minRows: 4 }"
v-model="goodsObj.desc"
>
</el-input>
<span
v-else
>
{{
goodsObj
.
desc
}}
</span>
</el-form-item>
</el-form>
</section>
<!-- 商品详情图 -->
<
article
class=
"message_image
width50p"
>
<
section
class=
"
width50p"
>
<h4
style=
"margin-bottom:20px"
>
商品详情图
</h4>
<el-upload
:disabled=
"$route.params.operation !== 'EDIT'"
ref=
"detailUpload"
action=
"#"
:on-preview=
"previewImage"
:auto-upload=
"false"
:limit=
"9"
list-type=
"picture-card"
multiple
:on-remove=
"handleRemove"
@
change=
"handleUploadChange"
:on-change=
"handleDetailChange"
:on-remove=
"removeDetailFiles"
:file-list=
"descPicUrlList"
>
<template
#
default
>
<i
class=
"el-icon-plus"
></i>
</
template
>
</el-upload>
</
article
>
</
section
>
</section>
</el-card>
<!-- 商品详情 -->
<el-card
class=
"message_border"
>
<h3>
商品详情
</h3>
<section
class=
"message"
>
<section
class=
"width50p"
>
<
!-- <
section class="width50p">
<h4>套餐商品</h4>
<el-table>
<el-table-column
...
...
@@ -97,26 +138,34 @@
label="单价"
></el-table-column>
</el-table>
</section>
</section>
-->
<section
class=
"width50p"
>
<h4
style=
"margin-bottom:20px"
>
商品介绍图
</h4>
<el-upload
:disabled=
"$route.params.operation !== 'EDIT'"
action=
"#"
:auto-upload=
"false"
:limit=
"9"
:on-preview=
"previewImage"
list-type=
"picture-card"
multiple
:on-remove=
"handleRemove"
@
change=
"handleUploadChange"
ref=
"intrUpload"
:on-change=
"intrChange"
:on-remove=
"intrRemove"
:file-list=
"introducePicUrlList"
>
<
template
#
default
>
<i
class=
"el-icon-plus"
></i>
</
template
>
</el-upload>
<h4
style=
"margin-top:20px"
>
商品介绍
</h4>
<h4
style=
"margin-top:20px"
>
商品介绍
:
</h4>
<el-input
v-if=
"$route.params.operation === 'EDIT'"
type=
"textarea"
:readonly=
"true"
v-model=
"goodsObj.introduce"
></el-input>
<span
v-else
>
{{ goodsObj.introduce }}
</span>
</section>
</section>
</el-card>
...
...
@@ -125,67 +174,122 @@
<section
class=
"message"
>
<section
class=
"width50p"
>
<h3>
可用门店
</h3>
<el-table>
<el-table
:data=
"goodsObj.sub_shop"
>
<el-table-column
label=
"门店名称"
align=
"center"
prop=
"shop_name"
></el-table-column>
<el-table-column
label=
"联系电话"
align=
"center"
prop=
"phone"
></el-table-column>
<el-table-column
label=
"地址"
align=
"center"
prop=
"address"
></el-table-column>
<el-table-column
label=
"地理定位"
align=
"center"
></el-table-column>
>
<
template
#
default=
"scope"
>
<span>
经度:
{{
scope
.
row
.
longitude
}}
</span>
<span>
纬度:
{{
scope
.
row
.
latitude
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
>
<template>
<el-button
type=
"text"
>
删除
</el-button>
<
template
#
default=
"scope"
>
<el-button
type=
"text"
@
click=
"deleteShops(scope.row.shop_id)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<el-popover
placement=
"bottom"
:width=
"600"
trigger=
"click"
v-model:visible=
"addShopDialog"
>
<
template
#
reference
>
<el-button
type=
"primary"
style=
"border-radius:20px;margin:20px 0 0 50%;transform: translate(-50%,0);"
>
添加门店
</el-button>
</secti
on>
<section
class=
"width50p"
>
<h4
style=
"margin-bottom:20px"
>
价格信息
</h4
>
>
添加门店
</el-butt
on>
</
template
>
<!-- 添加门店弹窗 --
>
<el-form
inline
label-position=
"right"
label-width=
"100px"
:model=
"shopForm"
>
<el-form-item
label=
"秒杀价"
>
<el-form-item
label=
"门店名称:"
>
<el-input
v-model=
"shopForm.shop_name"
></el-input>
</el-form-item>
<el-form-item
label=
"联系电话:"
>
<el-input
v-model=
"shopForm.connect_phone"
></el-input>
</el-form-item>
<el-form-item
label=
"地址:"
>
<el-input
v-model=
"shopForm.address"
></el-input>
</el-form-item>
<el-form-item
label=
"地理定位:"
class=
"deep_place"
>
<el-input
v-model=
"shopForm.deep_place"
></el-input>
<a
style=
""
target=
"_blank"
href=
"https://lbs.amap.com/tools/picker"
>
高德获取定位
</a>
</el-form-item>
</el-form>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
type=
"primary"
>
保存
</el-button>
<el-button
@
click=
"addShopDialog = false"
>
取消
</el-button>
</section>
</el-popover>
</section>
<section
class=
"width50p"
>
<h4
style=
"margin-bottom:20px"
>
价格信息
</h4>
<el-form
label-width=
"100px"
>
<!-- <el-form-item label="秒杀价">
<el-input
:readonly="true"
disabled
></el-input>
</el-form-item>
</el-form-item> -->
<el-form-item
label=
"售价"
>
<el-input></el-input>
<el-input
v-model=
"goodsObj.price"
></el-input>
</el-form-item>
<el-form-item
label=
"原价"
>
<el-input></el-input>
<el-input
v-model=
"goodsObj.original_price"
></el-input>
</el-form-item>
<h4
style=
"margin:20px 0"
>
库存信息
</h4>
<el-form-item
label=
"剩余库存量:"
>
<el-input-number
v-model=
"
inventoryNumber
"
v-model=
"
goodsObj.inventory_rest
"
:min=
"0"
></el-input-number>
</el-form-item>
<el-form-item
label=
"已购买量:"
>
<span>
{{ 12 }}
</span>
<el-form-item
label=
"已下单量:"
>
<span>
{{ goodsObj.total_amount_sold }}
</span>
</el-form-item>
<el-form-item
label=
"已卖出总数:"
>
<span>
{{ goodsObj.total_amount_sold }}
</span>
</el-form-item>
<el-form-item
label=
"总库存量:"
>
<span>
{{
13
}}
</span>
<span>
{{
goodsObj.inventory_total
}}
</span>
</el-form-item>
</el-form>
</section>
...
...
@@ -193,7 +297,7 @@
</el-card>
<!-- 使用规则 -->
<el-card
class=
"message_border"
>
<h3>
使用规则
</h3>
<h3
style=
"margin-bottom:30px;"
>
使用规则
</h3>
<el-form
style=
"width:480px"
:model=
"rulesForm"
...
...
@@ -201,11 +305,14 @@
label-width=
"120px"
>
<el-form-item
label=
"单人可买上限:"
>
<el-input
v-model=
"rulesForm.upperLimit"
></el-input>
<el-input-number
:min=
"0"
v-model=
"goodsObj.rule_limit"
></el-input-number>
</el-form-item>
<el-form-item
label=
"退款规则:"
>
<el-select
v-model=
"
rulesForm.rulesValue
"
v-model=
"
goodsObj.rule_refund
"
placeholder=
"请选择"
>
<el-option
...
...
@@ -218,14 +325,14 @@
</el-select>
</el-form-item>
<el-form-item
label=
"使用日期:"
>
<el-radio-group
v-model=
"
rulesForm.useDat
e"
>
<el-radio-group
v-model=
"
goodsObj.rule_date_typ
e"
>
<el-radio
label=
"周末、节假日通用"
:value=
"1"
></el-radio>
<el-radio
label=
"
线下场地免费
"
value=
"2"
label=
"
仅工作日可用
"
:
value=
"2"
></el-radio>
</el-radio-group>
</el-form-item>
...
...
@@ -233,10 +340,11 @@
<el-time-picker
is-range
v-model=
"rulesForm.useTime"
range-separator=
"
至
"
range-separator=
"
-
"
start-placeholder=
"开始时间"
end-placeholder=
"结束时间"
placeholder=
"选择时间范围"
@
change=
"pickerTime"
>
</el-time-picker>
</el-form-item>
...
...
@@ -245,61 +353,143 @@
type=
"textarea"
maxlength=
"100"
show-word-limit
v-model=
"
rulesForm.
desc"
v-model=
"
goodsObj.rule_
desc"
></el-input>
</el-form-item>
</el-form>
</el-card>
<!-- 操作记录 -->
<el-card
class=
"message_border"
>
<h3>
操作记录
</h3>
<h3
style=
"margin-bottom:30px;"
>
操作记录
</h3>
<el-table
border
stripe
:data=
"recordLits"
>
</el-table>
<el-table-column
label=
"状态"
prop=
"state"
></el-table-column>
align=
"center"
>
<
template
#
default=
"scope"
>
<span
v-if=
"scope.row.status === 0"
>
待审核
</span>
<span
v-else-if=
"scope.row.status === 1"
>
审核通过
</span>
<span
v-else
>
审核失败
</span>
<span
v-if=
"scope.row.online_status === 0"
>
未上架
</span>
<span
v-else-if=
"scope.row.online_status === 1"
>
已上架
</span>
<span
v-else
>
已下架
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"操作者"
prop=
"author"
prop=
"operator_name"
align=
"center"
></el-table-column>
<el-table-column
label=
"审核时间"
prop=
"time"
prop=
"create_time"
align=
"center"
></el-table-column>
<el-table-column
label=
"审核描述"
prop=
"desc"
prop=
"note"
align=
"center"
></el-table-column>
</el-table>
</el-card>
<!-- 审核保存返回 -->
<section
class=
"operationButton"
>
<el-button
type=
"primary"
v-if=
"$route.params.operation === 'AUDIT'"
@
click=
"onSuccess"
>
通过
</el-button>
<el-popover
v-if=
"$route.params.operation === 'AUDIT'"
placement=
"top"
:width=
"600"
trigger=
"click"
v-model:visible=
"rejectVisible"
>
<
template
#
reference
>
<el-button
type=
"danger"
>
驳回
</el-button>
</
template
>
<el-form
:model=
"rejectReason"
>
<el-form-item
label=
"驳回原因:"
>
<el-input
type=
"textarea"
style=
"width:100%"
v-model=
"rejectReason.reason"
></el-input>
</el-form-item>
</el-form>
<section
style=
"display:flex;justify-content:center;"
>
<el-button
type=
"danger"
@
click=
"onDefault"
>
驳回
</el-button>
<el-button
type=
"primary"
@
click=
"rejectVisible = false"
>
取消
</el-button>
</section>
</el-popover>
<el-button
v-if=
"$route.params.operation === 'EDIT'"
type=
"primary"
>
保存
</el-button>
<el-button
type=
"primary"
@
click=
"backToDetail"
>
返回
</el-button>
</section>
</el-card>
<!-- 展示缩略图 -->
<el-dialog
width=
"40%"
v-model=
"isShowPopver"
>
<el-image
:src=
"popoverImage"
fit=
"fill"
style=
"width:100%"
></el-image>
</el-dialog>
</template>
<
style
lang=
"less"
src=
"./index.less"
scope
></
style
>
<
script
>
import
{
getGoodsInfo
,
getGoodsList
}
from
"@/service/Goods/goods"
;
import
{
getGoodsInfo
,
getGoodsList
,
postSuccess
,
auditReject
,
checkGoodsName
}
from
"@/service/Goods/goods"
;
export
default
{
name
:
"GoodsDetail"
,
// beforeRouteEnter (to, from, next) {
// if (!to.params.operation
) {
// next({ name: "GoodsList" });
// }
//
else if (!to.params.spuId) {
//
next({ name: "GoodsList" });
// }
// else {
// next();
// };
// },
beforeRouteEnter
(
to
,
from
,
next
)
{
if
(
!
to
.
params
.
operation
)
{
next
({
name
:
"GoodsList"
});
}
else
if
(
!
to
.
params
.
spuId
)
{
next
({
name
:
"GoodsList"
});
}
else
{
next
();
}
},
created
()
{
this
.
getOptions
();
this
.
getGoodsDetailList
(
{
goods_spu_id
:
"2106231609050140001"
}
);
this
.
getGoodsDetailList
(
this
.
$route
.
params
.
spuId
);
},
computed
:
{
...
...
@@ -313,6 +503,7 @@ export default {
return
"审核驳回"
;
}
},
// 上下架状态
onlineStatus
()
{
if
(
this
.
goodsObj
.
online_status
===
0
)
{
...
...
@@ -328,6 +519,8 @@ export default {
watch
:
{
goodsObj
(
val
)
{
this
.
optionsValue
=
[
val
.
category_1_id
,
val
.
category_2_id
];
this
.
useTime
=
this
.
formatDate
(
val
.
rule_start_time
,
val
.
rule_end_time
);
console
.
log
(
"初始化时间"
,
this
.
useTime
);
}
},
...
...
@@ -339,18 +532,25 @@ export default {
label
:
"name"
,
children
:
"sub_list"
},
lifeList
:
[
{
value
:
1
,
options
:
"个人生活号"
},
{
value
:
2
,
options
:
"企业生活号"
}
],
optionList
:
[],
// 商品分类选项
optionsValue
:
[],
// 商品分类的值
spuId
:
""
,
// 商品id
goodsObj
:
{},
// 商品回显信息
// 商品回显信息
goodsObj
:
{},
descPicUrlList
:
[],
// 商品详情图列表
introducePicUrlList
:
[],
// 商品介绍图列表
recordList
:
[],
// 提交记录
optionList
:
[],
// 商品分类选项
uploadFileList
:
[],
// 上传图片列表
inventoryNumber
:
0
,
// 库存数量
// 使用规则表单
rulesForm
:
{
upperL
imit
:
""
,
// 单人可买上限
rule_l
imit
:
""
,
// 单人可买上限
rulesValue
:
""
,
// 退款规则
// 退款选项
rulesOptions
:
[
...
...
@@ -359,18 +559,30 @@ export default {
{
value
:
3
,
label
:
"到期后不退款"
}
],
useDate
:
""
,
// 使用日期
useTime
:
""
,
// 使用时间
desc
:
""
,
// 使用描述
useTime
:
[],
// 使用时间
rule_desc
:
""
// 使用描述
},
recordLits
:
[
{
state
:
"审核通过"
,
author
:
"我自己"
,
time
:
"2021-06-25"
,
desc
:
"那就通过了呗,还咋?"
}
],
// 操作记录
// 操作记录列表
recordLits
:
[],
// 驳回原因表单
rejectReason
:
{
reason
:
""
},
// 门店表单
shopForm
:
{
shop_name
:
""
,
connect_phone
:
""
,
address
:
""
,
deep_place
:
""
},
addShopDialog
:
false
,
// 添加门店弹框
rejectVisible
:
false
,
// 驳回原因弹框展示状态
popoverImage
:
""
,
// 放大显示图
isShowPopver
:
false
// 是否展示图片框
};
},
...
...
@@ -386,30 +598,140 @@ export default {
console
.
error
(
error
);
}
},
// 获取详情列表
async
getGoodsDetailList
(
params
)
{
try
{
const
res
=
await
getGoodsInfo
(
params
);
const
res
=
await
getGoodsInfo
(
{
goods_spu_id
:
params
}
);
console
.
log
(
"商品详情列表"
,
res
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
const
{
goods_info
,
record_list
}
=
res
.
result
;
this
.
goodsObj
=
goods_info
;
this
.
recordList
=
record_list
;
this
.
recordLits
=
record_list
;
// 格式化商品详情照片
goods_info
.
desc_pic_url_list
.
forEach
(
item
=>
{
const
obj
=
new
Object
();
obj
.
url
=
item
;
this
.
descPicUrlList
.
push
(
obj
);
});
// 格式化商品介绍照片
goods_info
.
introduce_pic_url_list
.
forEach
(
item
=>
{
const
obj
=
new
Object
();
obj
.
url
=
item
;
this
.
introducePicUrlList
.
push
(
obj
);
});
// 格式化初始日期
}
catch
(
error
)
{
console
.
error
(
error
);
}
},
// 格式化日期
formatDate
(
startTime
,
endTime
)
{
const
nowTime
=
new
Date
();
const
nowYear
=
nowTime
.
getFullYear
();
const
nowMonth
=
nowTime
.
getMonth
()
+
1
;
const
nowDate
=
nowTime
.
getDate
();
const
startTimeArray
=
startTime
.
split
(
":"
);
const
endTimeArray
=
endTime
.
split
(
":"
);
const
startHour
=
parseInt
(
startTimeArray
[
0
]);
const
startMinute
=
parseInt
(
startTimeArray
[
1
]);
const
endHour
=
parseInt
(
endTimeArray
[
0
]);
const
endMinute
=
parseInt
(
endTimeArray
[
1
]);
return
[
new
Date
(
nowYear
,
nowMonth
,
nowDate
,
startHour
,
startMinute
),
new
Date
(
nowYear
,
nowMonth
,
nowDate
,
endHour
,
endMinute
)
];
},
// 商品分类列表变化
optionsChange
(
value
)
{
console
.
log
(
value
);
},
// 删除照片
handleRemove
(
file
,
fileList
)
{
// 检查商品名称是否重复
async
checkSameName
()
{
const
res
=
await
checkGoodsName
({
life_account_id
:
this
.
goodsObj
.
life_account_id
,
name
:
this
.
goodsObj
.
goods_name
,
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
});
console
.
log
(
res
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"商品名称未被占用"
);
},
// 商品详情图更改
handleDetailChange
(
file
,
fileList
)
{
console
.
log
(
fileList
);
},
// 上传图片更改
handleUploadChange
(
file
,
fileList
)
{
// 商品详情图删除完成后的钩子
removeDetailFiles
(
file
,
fileList
)
{
console
.
log
(
fileList
);
},
// 商品介绍图更改钩子
intrChange
(
file
,
fileList
)
{
console
.
log
(
fileList
);
},
// 商品介绍图删除后的钩子
intrRemove
(
file
,
fileList
)
{
console
.
log
(
fileList
);
},
// 展示商品大图
previewImage
(
file
)
{
this
.
popoverImage
=
file
.
url
;
this
.
isShowPopver
=
true
;
},
// 删除已选择门店
deleteShops
(
shopId
)
{
console
.
log
(
shopId
);
},
// 更改已选门店
handleSelectionChange
(
value
)
{
console
.
log
(
value
);
},
// 选择时间
pickerTime
(
time
)
{
this
.
goodsObj
.
rule_start_time
;
const
dateTime1
=
time
[
0
].
getHours
();
const
dateTime2
=
time
[
1
].
getHours
();
console
.
log
(
"时间节点"
,
dateTime1
,
dateTime2
);
},
// 审核通过
async
onSuccess
()
{
const
res
=
await
postSuccess
(
this
.
$route
.
params
.
spuId
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
success
(
"审核通过"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 审核拒绝
async
onDefault
()
{
if
(
!
this
.
rejectReason
.
reason
)
return
this
.
$message
.
error
(
"审核驳回时,驳回原因不能为空"
);
const
query
=
{
goods_spu_id
:
this
.
goodsObj
.
goods_spu_id
,
refuse_reason
:
this
.
rejectReason
.
reason
};
const
res
=
await
auditReject
(
query
);
if
(
res
.
code
!==
0
)
return
this
.
$message
.
error
(
res
.
reason
);
this
.
$message
.
danger
(
"审核驳回成功!"
);
this
.
$router
.
replace
({
name
:
"GoodsList"
});
},
// 返回主页面
backToDetail
()
{
this
.
$router
.
replace
({
name
:
"GoodsList"
});
}
}
};
...
...
src/service/Goods/goods.js
View file @
58b89060
...
...
@@ -7,7 +7,9 @@ export async function getGoodsList () {
}
// 获取商品列表
export
async
function
getList
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_list"
,
{
params
});
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_list"
,
{
params
});
return
res
;
}
// 商品上架
...
...
@@ -26,6 +28,28 @@ export async function putOffline (query) {
}
// 获取商品详情列表
export
async
function
getGoodsInfo
(
params
)
{
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_info"
,
{
params
});
const
res
=
await
axios
.
get
(
"/api/v1/goods/background/get_goods_info"
,
{
params
});
return
res
;
}
// 商品详情-审核通过
export
async
function
postSuccess
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_pass"
,
{
goods_spu_id
:
query
});
return
res
;
}
// 审核拒绝
export
async
function
auditReject
(
query
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/audit_reject"
,
query
);
return
res
;
}
// 商品详情-检查商品名称是否重复
export
async
function
checkGoodsName
(
params
)
{
const
res
=
await
axios
.
post
(
"/api/v1/goods/background/check_goods_name"
,
params
);
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