Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
h5-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
yimu
h5-admin
Commits
3fe1f073
Commit
3fe1f073
authored
Mar 01, 2022
by
verestrasz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3d5918c8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1533 additions
and
828 deletions
+1533
-828
good.js
src/api/apiConfig/good.js
+8
-0
index.vue
src/components/file-upload/index.vue
+8
-1
Goods.js
src/enums/Goods.js
+6
-1
routers.js
src/router/routers.js
+12
-0
base-info.vue
src/view/good-mgr/add-good/base-info.vue
+2
-2
index.vue
src/view/good-mgr/add-good/index.vue
+1001
-632
sale-info.vue
src/view/good-mgr/add-good/sale-info.vue
+465
-189
product-list.vue
src/view/good-mgr/product-list.vue
+31
-3
No files found.
src/api/apiConfig/good.js
View file @
3fe1f073
...
...
@@ -57,6 +57,14 @@ export const addGood = {
return
form
}
}
// 存为草稿
export
const
draftGood
=
{
url
:
'/goods/releaseGoods/draft'
,
method
:
'POST'
,
dealReqData
:
(
form
)
=>
{
return
form
}
}
// 获取商品列表
export
const
getGoodList
=
{
url
:
'/goodsList/page'
,
...
...
src/components/file-upload/index.vue
View file @
3fe1f073
...
...
@@ -7,7 +7,9 @@
:style=
"uploadStyle"
>
<template
v-if=
"item.status === 'finished'"
>
<img
:src=
"getImgUrl(item)"
/>
{{
item
.
url
}}
<video
:src=
"item.url"
v-if=
"type==='video'"
></video>
<img
:src=
"getImgUrl(item)"
v-else
/>
{{
item
.
url
}}
<div
class=
"demo-upload-list-cover"
v-show=
"!readonly || showWatch"
>
<Icon
v-if=
"showWatch && type != 'apk'"
...
...
@@ -310,6 +312,11 @@ export default {
height: 100%;
object-fit: cover;
}
.demo-upload-list video {
width: 100%;
height: 100%;
object-fit: cover;
}
.demo-upload-list-cover {
display: none;
position: absolute;
...
...
src/enums/Goods.js
View file @
3fe1f073
...
...
@@ -7,7 +7,8 @@ export const OffShelfType = {
AUDIT
:
5
,
CHECK_FAIL
:
6
,
OFFERING
:
7
,
CANCELED
:
8
CANCELED
:
8
,
DRAFT
:
9
}
export
const
OffShelfTypeObj
=
{
...
...
@@ -46,6 +47,10 @@ export const OffShelfTypeObj = {
[
OffShelfType
.
CANCELED
]:
{
label
:
'已取消'
,
color
:
'default'
},
[
OffShelfType
.
DRAFT
]:
{
label
:
'草稿'
,
color
:
'default'
}
}
export
const
IsAppendType
=
{
...
...
src/router/routers.js
View file @
3fe1f073
...
...
@@ -208,6 +208,18 @@ export default [{
import
(
'@/view/good-mgr/add-good'
)
},
{
path
:
'draft_good'
,
name
:
'draft_good'
,
meta
:
{
icon
:
'ios-appstore-outline'
,
title
:
'编辑商品'
,
hideInMenu
:
true
,
notCache
:
true
},
component
:
()
=>
import
(
'@/view/good-mgr/add-good'
)
},
{
path
:
'commodity_add_good'
,
name
:
'commodity_add_good'
,
meta
:
{
...
...
src/view/good-mgr/add-good/base-info.vue
View file @
3fe1f073
...
...
@@ -78,9 +78,9 @@
<div
class=
"item"
>
<label
class=
"label"
>
所属类目:
</label>
<Input
v-if=
"is
Edit || is
Detail"
v-if=
"isDetail"
v-model=
"data.categoryId"
:readonly=
"isDetail
|| isEdit
"
:readonly=
"isDetail"
/>
<Cascader
v-else
:data=
"categoryList"
v-model=
"data.categoryId"
@
on-change=
"handleChange"
></Cascader>
</div>
...
...
src/view/good-mgr/add-good/index.vue
View file @
3fe1f073
...
...
@@ -8,8 +8,17 @@
<Icon
type=
"md-bookmark"
color=
"#2d8cf0"
:size=
"28"
/>
<label>
{{
title
}}
</label>
</div>
<base-info
:data=
"form.baseInfo"
:isDetail=
"isDetail"
:isEdit=
"isEdit"
:isAgain=
"isAgain"
/>
<decipt-info
:data=
"form.deciptInfo"
:isDetail=
"isDetail"
:status=
"status"
/>
<base-info
:data=
"form.baseInfo"
:isDetail=
"isDetail"
:isEdit=
"isEdit"
:isAgain=
"isAgain"
/>
<decipt-info
:data=
"form.deciptInfo"
:isDetail=
"isDetail"
:status=
"status"
/>
<sale-info
:data=
"form.saleInfo"
:isDetail=
"isDetail"
...
...
@@ -18,76 +27,94 @@
:isSelf=
"isSelf"
:status=
"status"
/>
<info-con
title=
"资源信息"
class=
"base-info-con"
v-if=
"form.baseInfo.type==5"
>
<info-con
title=
"资源信息"
class=
"base-info-con"
v-if=
"form.baseInfo.type == 5"
>
<div
class=
"series-info"
>
<label
class=
"label"
>
打包价格:
</label>
<Input
v-model=
"form.packageDTO.price"
:disabled=
'isDetail'
placeholder=
"请输入打包价格"
style=
"width: 400px"
/>
<Input
v-model=
"form.packageDTO.price"
:disabled=
"isDetail"
placeholder=
"请输入打包价格"
style=
"width: 400px"
/>
</div>
<div
class=
"package-resources"
>
<label
class=
"label"
>
打包资源:
</label>
<div
class=
"property-con"
>
<div
class=
"property-item"
v-for=
"(item, index) of form.packageDTO.resource"
:key=
"'prop-item-' + index"
>
<AutoComplete
v-model=
"item.name"
@
on-search=
"handleSearch($event,index)"
placeholder=
"请输入资源编号或名称"
:disabled=
'isDetail'
style=
"width:215px;"
>
<Option
v-for=
"(item,index) in item.integralMerchantNameList"
:value=
"item.name"
:key=
"'state-option-' + index"
>
{{
item
.
name
}}
</Option>
</AutoComplete>
<Select
placeholder=
"请选择资源规格"
class=
"search-input"
v-model=
"item.skuId"
:disabled=
'isDetail'
style=
"width: 215px;margin:0 20px;"
>
<Option
v-for=
"(itemb,idx) of item.specificationsList"
:value=
"itemb.skuId"
:key=
"itemb.skuId"
@
click
.
native=
"handleSpecifications(idx,index)"
>
{{
itemb
.
name
}}
</Option
>
</Select>
<Input
class=
"prop-val"
placeholder=
"请设置资源数量"
v-model=
"item.number"
:disabled=
'isDetail'
@
on-blur=
"onBlur(index,item)"
:maxlength=
"30"
style=
"width:215px"
/>
<span
v-if=
"item.actualNumber&&item.actualNumber!=0"
>
资源总数:
{{
item
.
actualNumber
}}
</span>
<Icon
class=
"del-con"
type=
"md-close-circle"
color=
"#ed4014"
v-if=
"!isDetail"
:size=
"20"
@
click=
"delAge(index)"
/>
</div>
<div
class=
"add-btn"
>
<Button
type=
"info"
@
click=
"addAge"
v-if=
"!isDetail"
>
+ 添加
</Button
<div
class=
"property-item"
v-for=
"(item, index) of form.packageDTO.resource"
:key=
"'prop-item-' + index"
>
<AutoComplete
v-model=
"item.name"
@
on-search=
"handleSearch($event, index)"
placeholder=
"请输入资源编号或名称"
:disabled=
"isDetail"
style=
"width: 215px"
>
<Option
v-for=
"(item, index) in item.integralMerchantNameList"
:value=
"item.name"
:key=
"'state-option-' + index"
>
{{
item
.
name
}}
</Option
>
</AutoComplete>
<Select
placeholder=
"请选择资源规格"
class=
"search-input"
v-model=
"item.skuId"
:disabled=
"isDetail"
style=
"width: 215px; margin: 0 20px"
>
<Option
v-for=
"(itemb, idx) of item.specificationsList"
:value=
"itemb.skuId"
:key=
"itemb.skuId"
@
click
.
native=
"handleSpecifications(idx, index)"
>
{{
itemb
.
name
}}
</Option
>
</Select>
<Input
class=
"prop-val"
placeholder=
"请设置资源数量"
v-model=
"item.number"
:disabled=
"isDetail"
@
on-blur=
"onBlur(index, item)"
:maxlength=
"30"
style=
"width: 215px"
/>
<span
v-if=
"item.actualNumber && item.actualNumber != 0"
>
资源总数:
{{
item
.
actualNumber
}}
</span
>
<Icon
class=
"del-con"
type=
"md-close-circle"
color=
"#ed4014"
v-if=
"!isDetail"
:size=
"20"
@
click=
"delAge(index)"
/>
</div>
<div
class=
"add-btn"
>
<Button
type=
"info"
@
click=
"addAge"
v-if=
"!isDetail"
>
+ 添加
</Button
>
</div>
</div>
</div>
</div>
<div
class=
"series-info"
>
<label
class=
"label"
>
库存:
</label>
<Input
v-model=
"form.packageDTO.stock"
:disabled=
'isDetail'
placeholder=
"请输入库存"
style=
"width: 400px"
@
on-blur=
"stockBlur(form.packageDTO.stock)"
/>
<label
class=
"label"
>
库存:
</label>
<Input
v-model=
"form.packageDTO.stock"
:disabled=
"isDetail"
placeholder=
"请输入库存"
style=
"width: 400px"
@
on-blur=
"stockBlur(form.packageDTO.stock)"
/>
</div>
</info-con>
<!--
<info-con
title=
"规格信息"
class=
"base-info-con"
v-if=
"form.baseInfo.type==6"
>
...
...
@@ -134,105 +161,208 @@
</div>
</info-con>
-->
<info-con
title=
"销售信息:"
class=
"base-info-con"
>
<div
class=
"series-info"
v-if=
"(form.baseInfo.type==1||form.baseInfo.type==3)&&form.saleInfo.commodityPass!=0"
>
<label
class=
"label"
>
是否允许延后提货:
</label>
<i-switch
v-model=
"form.delayDelivery"
:disabled=
"delayDeliveryDisabled || isDetail"
/>
</div>
<div
class=
"series-info"
>
<label
class=
"label"
>
退换货类型:
</label>
<RadioGroup
v-model=
"form.returnType"
>
<Radio
label=
"0"
:disabled=
"isDetail"
class=
"ivu-radio"
>
不支持
</Radio>
<Radio
label=
"1"
:disabled=
"isDetail"
class=
"ivu-radio"
>
七天无理由退货
</Radio>
<Radio
label=
"2"
:disabled=
"isDetail"
class=
"ivu-radio"
>
自定义
<Input
v-model=
"form.returnReason"
:disabled=
"isDetail"
type=
"textarea"
placeholder=
"请输入退货缘由"
style=
"width: 200px"
/>
</Radio>
</RadioGroup>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 2"
>
<label
class=
"label"
>
预售时间:
</label>
<div
class=
"series-info"
v-if=
"
(form.baseInfo.type == 1 || form.baseInfo.type == 3) &&
form.saleInfo.commodityPass != 0
"
>
<label
class=
"label"
>
是否允许延后提货:
</label>
<i-switch
v-model=
"form.delayDelivery"
:disabled=
"delayDeliveryDisabled || isDetail"
/>
</div>
<div
class=
"series-info"
>
<label
class=
"label"
>
退换货类型:
</label>
<RadioGroup
v-model=
"form.returnType"
>
<Radio
label=
"0"
:disabled=
"isDetail"
class=
"ivu-radio"
>
不支持
</Radio
>
<Radio
label=
"1"
:disabled=
"isDetail"
class=
"ivu-radio"
>
七天无理由退货
</Radio
>
<Radio
label=
"2"
:disabled=
"isDetail"
class=
"ivu-radio"
>
自定义
<Input
v-model=
"form.returnReason"
:disabled=
"isDetail"
type=
"textarea"
placeholder=
"请输入退货缘由"
style=
"width: 200px"
/>
</Radio>
</RadioGroup>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 2"
>
<label
class=
"label"
>
预售时间:
</label>
<Row
class=
"time"
>
<Col>
<DatePicker
type=
"date"
:options=
"startOption"
:readonly=
"isDetail"
v-model=
"form.saleStartTime"
placeholder=
"请选择开始时间"
style=
"width: 200px"
></DatePicker>
<DatePicker
type=
"date"
:options=
"startOption"
:readonly=
"isDetail"
v-model=
"form.saleStartTime"
placeholder=
"请选择开始时间"
style=
"width: 200px"
></DatePicker>
</Col>
<span>
至
</span>
<Col>
<DatePicker
type=
"date"
:options=
"endOption"
:readonly=
"isDetail"
v-model=
"form.saleEndTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
<DatePicker
type=
"date"
:options=
"endOption"
:readonly=
"isDetail"
v-model=
"form.saleEndTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type==
2"
>
<label
class=
"label"
>
预计提货时间:
</label>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type ==
2"
>
<label
class=
"label"
>
预计提货时间:
</label>
<Row
class=
"time"
>
<Col>
<DatePicker
type=
"date"
:options=
"drawStartOption"
:readonly=
"isDetail"
v-model=
"form.drawStartTime"
placeholder=
"请选择开始时间"
style=
"width: 200px"
></DatePicker>
<DatePicker
type=
"date"
:options=
"drawStartOption"
:readonly=
"isDetail"
v-model=
"form.drawStartTime"
placeholder=
"请选择开始时间"
style=
"width: 200px"
></DatePicker>
</Col>
<span>
至
</span>
<Col>
<DatePicker
type=
"date"
:options=
"drawEndOption"
:readonly=
"isDetail"
v-model=
"form.drawEndTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
<DatePicker
type=
"date"
:options=
"drawEndOption"
:readonly=
"isDetail"
v-model=
"form.drawEndTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type==2"
>
<label
class=
"label"
>
首付比例:
</label>
<RadioGroup
v-model=
"form.depositType"
>
<Radio
label=
"1"
:disabled=
"isDetail"
class=
"ivu-radio"
style=
"width: 260px;"
>
<span>
固定比例
</span>
<Input
v-model=
"fixedProportion"
:disabled=
"isDetail"
style=
"width: 100px"
/>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 2"
>
<label
class=
"label"
>
首付比例:
</label>
<RadioGroup
v-model=
"form.depositType"
>
<Radio
label=
"1"
:disabled=
"isDetail"
class=
"ivu-radio"
style=
"width: 260px"
>
<span>
固定比例
</span>
<Input
v-model=
"fixedProportion"
:disabled=
"isDetail"
style=
"width: 100px"
/>
<span>
%
</span>
<!--
</Input>
-->
</Radio>
<Radio
label=
"2"
:disabled=
"isDetail"
class=
"ivu-radio"
style=
"width: 260px"
>
<span>
固定金额
</span>
<Input
v-model=
"fixedAmount"
:disabled=
"isDetail"
style=
"width: 100px"
/>
<!--
</Input>
-->
</Radio>
<Radio
label=
"2"
:disabled=
"isDetail"
class=
"ivu-radio"
style=
"width: 260px"
>
<span>
固定金额
</span>
<Input
v-model=
"fixedAmount"
:disabled=
"isDetail"
style=
"width: 100px"
/>
<span>
元
</span>
<!--
</Input>
-->
</Radio>
</RadioGroup>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type==3"
>
<label
class=
"label"
>
拍卖保证金:
</label>
<Input
v-model=
"form.buyerDeposit"
:readonly=
'isDetail'
type=
"number"
style=
"width: 100px;"
>
</Input>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type==3"
>
<label
class=
"label"
>
出价最小增幅:
</label>
<Input
v-model=
"form.priceIncrease"
:readonly=
'isDetail'
type=
"number"
style=
"width: 100px;"
>
</Input>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type==3"
>
<label
class=
"label"
>
结束时间:
</label>
<DatePicker
type=
"date"
:options=
"buyEndOption"
:readonly=
"isDetail"
v-model=
"form.endTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
</div>
<div
class=
"series-info"
>
<label
class=
"label"
>
商品备注:
</label>
<Input
v-model=
"form.note"
:readonly=
"isDetail"
type=
"textarea"
placeholder=
"商品备注(非必填)"
style=
"width: 200px"
/>
</div>
<!--
<div
class=
"series-info"
v-if=
"form.baseInfo.type==4"
>
-->
<!--
<label
class=
"label"
>
库存:
</label>
-->
<!--
<Input
v-model=
"form.stock"
type=
"number"
placeholder=
"商品库存"
style=
"width: 200px"
/>
-->
<!--
</div>
-->
<!--
<div
class=
"series-info"
v-if=
"form.baseInfo.type==4"
>
-->
<!--
<label
class=
"label"
>
所需积分:
</label>
-->
<!--
<Input
v-model=
"form.pnum"
type=
"number"
placeholder=
"所需积分"
style=
"width: 200px"
/>
-->
<!--
</div>
-->
<!--
</Input>
-->
</Radio>
</RadioGroup>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 3"
>
<label
class=
"label"
>
拍卖保证金:
</label>
<Input
v-model=
"form.buyerDeposit"
:readonly=
"isDetail"
type=
"number"
style=
"width: 100px"
>
</Input>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 3"
>
<label
class=
"label"
>
出价最小增幅:
</label>
<Input
v-model=
"form.priceIncrease"
:readonly=
"isDetail"
type=
"number"
style=
"width: 100px"
>
</Input>
</div>
<div
class=
"series-time"
v-if=
"form.baseInfo.type == 3"
>
<label
class=
"label"
>
结束时间:
</label>
<DatePicker
type=
"date"
:options=
"buyEndOption"
:readonly=
"isDetail"
v-model=
"form.endTime"
placeholder=
"请选择结束时间"
style=
"width: 200px"
></DatePicker>
</div>
<div
class=
"series-info"
>
<label
class=
"label"
>
商品备注:
</label>
<Input
v-model=
"form.note"
:readonly=
"isDetail"
type=
"textarea"
placeholder=
"商品备注(非必填)"
style=
"width: 200px"
/>
</div>
<!--
<div
class=
"series-info"
v-if=
"form.baseInfo.type==4"
>
-->
<!--
<label
class=
"label"
>
库存:
</label>
-->
<!--
<Input
v-model=
"form.stock"
type=
"number"
placeholder=
"商品库存"
style=
"width: 200px"
/>
-->
<!--
</div>
-->
<!--
<div
class=
"series-info"
v-if=
"form.baseInfo.type==4"
>
-->
<!--
<label
class=
"label"
>
所需积分:
</label>
-->
<!--
<Input
v-model=
"form.pnum"
type=
"number"
placeholder=
"所需积分"
style=
"width: 200px"
/>
-->
<!--
</div>
-->
</info-con>
<info-con
title=
"溯源信息"
class=
"base-info-con"
>
<div
class=
"series-info"
>
<label
class=
"label"
>
溯源编号:
</label>
<Input
v-model=
"form.traceabilityNumber"
:readonly=
"isDetail"
placeholder=
"请输入溯源系统的商品溯源编号(非必填)"
style=
"width: 400px"
/>
</div>
<label
class=
"label"
>
溯源编号:
</label>
<Input
v-model=
"form.traceabilityNumber"
:readonly=
"isDetail"
placeholder=
"请输入溯源系统的商品溯源编号(非必填)"
style=
"width: 400px"
/>
</div>
</info-con>
<div
class=
"submit-con"
>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-if=
"!isDetail"
:loading=
"submitLoading"
>
提交商品信息
</Button
>
<div
class=
"submit-bottom"
>
<div
class=
"submit-con"
>
<Button
type=
"primary"
@
click=
"handleDraft"
v-if=
"!isDetail"
:disabled=
"isEdit"
:loading=
"draftLoading"
>
存为草稿
</Button
>
</div>
<div
class=
"submit-con"
>
<Button
type=
"primary"
@
click=
"handleSubmit"
v-if=
"!isDetail"
:loading=
"submitLoading"
>
提交商品信息
</Button
>
</div>
</div>
</Card>
</div>
...
...
@@ -279,6 +409,9 @@ export default {
isAgain
()
{
return
this
.
routeName
===
'again_good'
},
isDraft
()
{
return
this
.
routeName
===
'draft_good'
},
isSelf
()
{
return
this
.
form
.
brandId
===
this
.
$store
.
state
.
admin
.
brandId
},
...
...
@@ -294,15 +427,13 @@ export default {
brandId
:
''
,
brandName
:
''
,
goodsId
:
''
,
// templateId: '',
baseInfo
:
{
name
:
''
,
// 商品名称
description
:
''
,
// 商品描述
prop
:
[{
name
:
''
,
val
:
''
}],
// 商品属性
categoryId
:
[],
// 类目选择
type
:
'6'
// 商品类型
type
:
'6'
// 商品类型
},
saleInfo
:
{
sku
:
[],
...
...
@@ -313,7 +444,11 @@ export default {
type
:
''
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
''
,
// 1.内部发行 2.外部绑定
tokenId
:
''
,
// 绑定的外部通证id
salesType
:
''
// 销售模式
salesType
:
4
,
// 销售模式
difficulty
:
3
,
isHide
:
false
,
stock
:
0
,
blindBoxRule
:
''
// statu:this.status
},
deciptInfo
:
{
...
...
@@ -349,9 +484,18 @@ export default {
traceabilityNumber
:
''
,
// 溯源编号
delayDelivery
:
false
,
// 延迟提货
packageDTO
:
{
resource
:
[{
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
specificationsList
:
[],
actualNumber
:
''
}],
// 打包资源
resource
:
[
{
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
specificationsList
:
[],
actualNumber
:
''
}
],
// 打包资源
price
:
''
,
// 打包价格
stock
:
''
// 库存
stock
:
''
// 库存
},
nftdto
:
{
number
:
''
,
// 发行数量:只有商户选择“可拷贝”时,才会出现
...
...
@@ -401,13 +545,21 @@ export default {
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
}
},
draftLoading
:
false
}
},
methods
:
{
...
mapMutations
([
'closeTag'
]),
addAge
()
{
this
.
form
.
packageDTO
.
resource
.
push
({
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
specificationsList
:
[],
actualNumber
:
''
})
this
.
form
.
packageDTO
.
resource
.
push
({
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
specificationsList
:
[],
actualNumber
:
''
})
},
changeTzType
()
{
this
.
form
.
nftdto
.
type
=
''
...
...
@@ -432,19 +584,32 @@ export default {
apiName
:
'spugetbyvague'
,
postdata
:
goodsInfo
,
success
:
(
res
)
=>
{
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
=
res
.
data
if
(
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
.
length
===
1
)
{
let
goodsId
=
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
[
0
].
goodsId
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
=
res
.
data
if
(
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
.
length
===
1
)
{
let
goodsId
=
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
[
0
]
.
goodsId
this
.
api
({
apiName
:
'skugetbygoodsId'
,
postdata
:
goodsId
,
success
:
(
res
)
=>
{
let
arr
=
[]
let
list
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
let
list
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
if
(
list
&&
list
.
length
>
0
)
{
for
(
let
item
of
res
.
data
)
{
if
(
list
.
find
(
x
=>
{
return
x
.
skuId
===
item
.
skuId
}))
{
item
.
stock
=
list
.
find
(
x
=>
{
return
x
.
skuId
===
item
.
skuId
}).
stock
if
(
list
.
find
((
x
)
=>
{
return
x
.
skuId
===
item
.
skuId
})
)
{
item
.
stock
=
list
.
find
((
x
)
=>
{
return
x
.
skuId
===
item
.
skuId
}).
stock
}
arr
.
push
(
item
)
}
...
...
@@ -463,7 +628,10 @@ export default {
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
for
(
var
i
=
0
;
i
<
this
.
form
.
packageDTO
.
resource
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
this
.
form
.
packageDTO
.
resource
.
length
;
j
++
)
{
if
(
this
.
form
.
packageDTO
.
resource
[
i
].
skuId
===
this
.
form
.
packageDTO
.
resource
[
j
].
skuId
)
{
if
(
this
.
form
.
packageDTO
.
resource
[
i
].
skuId
===
this
.
form
.
packageDTO
.
resource
[
j
].
skuId
)
{
let
title
=
'规格信息不能重复!'
this
.
form
.
packageDTO
.
resource
[
index
].
skuId
=
''
return
this
.
$Notice
.
error
({
title
})
...
...
@@ -480,12 +648,19 @@ export default {
}
let
idx
=
this
.
idx
this
.
form
.
packageDTO
.
resource
[
index
].
actualNumber
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
[
idx
].
stock
this
.
$set
(
this
.
form
.
packageDTO
.
resource
,
index
,
this
.
form
.
packageDTO
.
resource
[
index
])
this
.
form
.
packageDTO
.
resource
[
index
].
actualNumber
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
[
idx
].
stock
this
.
$set
(
this
.
form
.
packageDTO
.
resource
,
index
,
this
.
form
.
packageDTO
.
resource
[
index
]
)
let
stockNumber
=
JSON
.
parse
(
val
.
number
)
*
this
.
form
.
packageDTO
.
stock
if
(
stockNumber
>
this
.
form
.
packageDTO
.
resource
[
index
].
actualNumber
)
{
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
return
this
.
$Notice
.
warning
({
title
:
`库存*填写的资源量不能超过总资源数量`
})
return
this
.
$Notice
.
warning
({
title
:
`库存*填写的资源量不能超过总资源数量`
})
}
},
stockBlur
(
val
)
{
...
...
@@ -501,7 +676,9 @@ export default {
}
if
(
number
>
item
.
specificationsList
[
n
].
stock
)
{
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
return
this
.
$Notice
.
warning
({
title
:
`库存 * 填写的资源量不能超过总资源数量`
})
return
this
.
$Notice
.
warning
({
title
:
`库存 * 填写的资源量不能超过总资源数量`
})
}
})
},
...
...
@@ -540,8 +717,7 @@ export default {
if
(
this
.
isAdd
)
{
this
.
api
({
apiName
:
'templateorshopquery'
,
success
:
(
res
)
=>
{
}
success
:
(
res
)
=>
{}
})
}
},
...
...
@@ -552,132 +728,98 @@ export default {
postdata
:
{
goodsId
},
success
:
(
res
)
=>
{
let
{
brandId
,
brandName
,
// templateId,
name
,
description
,
prop
,
skus
,
imgList
,
video
,
videoThumb
,
thumb
,
detail
,
categoryIds
,
categoryName
,
goodsId
,
type
,
note
,
prop
,
returnReason
,
returnType
,
traceabilityNumber
,
note
,
salesType
,
delayDelivery
,
returnReason
,
categoryName
,
categoryIds
,
preSaleVO
,
auctionVO
,
imgList
,
nftFile
,
skus
,
commodityPass
,
goodsPackageVO
,
thumb
,
traceabilityNumber
,
video
,
blindBoxPrice
,
difficulty
,
goodsNftVO
,
nftFi
le
blindBoxRu
le
}
=
res
.
data
this
.
form
.
brandId
=
brandId
this
.
form
.
brandName
=
brandName
// this.form.templateId = templateId
this
.
form
.
note
=
note
this
.
form
.
returnType
=
returnType
.
toString
()
this
.
form
.
returnReason
=
returnReason
this
.
form
.
traceabilityNumber
=
traceabilityNumber
if
(
delayDelivery
==
0
)
{
this
.
form
.
delayDelivery
=
false
}
else
{
this
.
form
.
delayDelivery
=
true
let
form
=
{
goodsId
:
goodsId
,
blindBoxPrice
,
difficulty
,
baseInfo
:
{
name
:
name
,
// 商品名称
description
:
description
,
// 商品描述
prop
:
JSON
.
parse
(
prop
),
// 商品属性
categoryId
:
this
.
isDraft
||
this
.
isEdit
?
JSON
.
parse
(
categoryIds
)
:
categoryName
,
// 类目选择
type
:
type
// 商品类型
},
deciptInfo
:
{
nftFile
:
nftFile
||
''
,
nftEnclosureList
:
nftFile
?
[
nftFile
]
:
[],
video
:
video
||
''
,
videoList
:
video
?
[
video
]
:
[],
thumb
,
thumbList
:
thumb
?
[
thumb
]
:
''
,
detailPictures
:
imgList
?
JSON
.
parse
(
imgList
)
:
[],
detailDescribe
:
detail
,
defaultDetailPicture
:
imgList
?
JSON
.
parse
(
imgList
)
:
[],
defaultVideoList
:
video
?
[
video
]
:
[],
defaultThumbList
:
[
thumb
],
defaultNftEnclosureList
:
nftFile
?
[
nftFile
]
:
[]
},
returnType
:
returnType
+
''
,
// 退货类型
returnReason
:
returnReason
,
// 退货理由
note
:
note
,
// 商品备注
delayDelivery
:
!!
delayDelivery
,
traceabilityNumber
:
traceabilityNumber
}
if
(
auctionVO
)
{
this
.
form
.
buyerDeposit
=
auctionVO
.
buyerDeposit
this
.
form
.
priceIncrease
=
auctionVO
.
priceIncrease
this
.
form
.
endTime
=
formatTime
(
auctionVO
.
endTime
)
let
saleInfo
=
{
...
goodsNftVO
,
salesType
,
sku
:
[],
blindBoxRule
}
this
.
form
.
baseInfo
=
{
name
,
description
,
prop
:
JSON
.
parse
(
prop
),
type
:
type
.
toString
(),
categoryId
:
this
.
isAgain
?
JSON
.
parse
(
categoryIds
)
:
categoryName
}
let
newSku
=
[]
skus
.
forEach
((
item
)
=>
{
let
{
image
,
propertyList
}
=
item
let
upload
=
{
imageList
:
[
image
],
defaultImgList
:
[
image
]
}
let
prop
=
{}
propertyList
.
forEach
((
pItem
)
=>
{
prop
[
pItem
.
propKey
]
=
pItem
.
propVal
})
newSku
.
push
({
...
item
,
...
prop
,
upload
})
})
this
.
form
.
saleInfo
.
sku
=
newSku
this
.
form
.
saleInfo
.
commodityPass
=
commodityPass
this
.
form
.
deciptInfo
=
{
nftFile
,
nftEnclosureList
:
[
nftFile
],
video
,
videoList
:
[
video
],
videoThumb
,
thumb
,
thumbList
:
[
thumb
],
detailPictures
:
JSON
.
parse
(
imgList
),
detailDescribe
:
detail
,
defaultDetailPicture
:
JSON
.
parse
(
imgList
),
defaultVideoList
:
[
video
],
defaultThumbList
:
[
thumb
],
defaultNftEnclosureList
:
[
nftFile
]
}
if
(
!
video
)
{
this
.
form
.
deciptInfo
.
video
=
''
this
.
form
.
deciptInfo
.
defaultVideoList
=
[]
}
if
(
!
nftFile
)
{
this
.
form
.
deciptInfo
.
nftFile
=
''
this
.
form
.
deciptInfo
.
defaultNftEnclosureList
=
[]
}
if
(
type
==
2
)
{
this
.
form
.
depositType
=
preSaleVO
.
depositType
.
toString
()
if
(
this
.
form
.
depositType
==
1
)
{
this
.
fixedProportion
=
preSaleVO
.
deposit
}
else
{
this
.
fixedAmount
=
preSaleVO
.
deposit
if
(
salesType
===
4
)
{
saleInfo
.
commodityPass
=
commodityPass
saleInfo
.
price
=
blindBoxPrice
saleInfo
.
difficulty
=
difficulty
for
(
let
item
of
skus
)
{
let
obj
=
{
...
item
,
isHide
:
!!
item
.
isHide
,
name
:
item
.
propertyList
[
0
].
propVal
,
upload
:
{
imageList
:
[
item
.
image
],
defaultImgList
:
[
item
.
image
]
}
}
saleInfo
.
sku
.
push
(
obj
)
}
// this.form.deposit = preSaleVO.deposit
this
.
form
.
drawEndTime
=
formatTime
(
preSaleVO
.
drawEndTime
)
this
.
form
.
drawStartTime
=
formatTime
(
preSaleVO
.
drawStartTime
)
this
.
form
.
saleEndTime
=
formatTime
(
preSaleVO
.
saleEndTime
)
this
.
form
.
saleStartTime
=
formatTime
(
preSaleVO
.
saleStartTime
)
}
if
(
goodsPackageVO
)
{
goodsPackageVO
.
resource
.
forEach
((
item
,
index
)
=>
{
item
.
name
=
item
.
goodsName
let
stock
=
item
.
sku
.
number
+
(
item
.
number
*
goodsPackageVO
.
stock
)
// console.log('stock', stock)
item
.
specificationsList
=
[
{
name
:
item
.
sku
.
name
,
skuId
:
item
.
sku
.
skuId
,
stock
:
stock
}
]
item
.
skuId
=
item
.
sku
.
skuId
})
this
.
form
.
packageDTO
=
goodsPackageVO
}
if
(
goodsNftVO
)
{
goodsNftVO
.
type
=
goodsNftVO
.
type
.
toString
()
goodsNftVO
.
tzType
=
goodsNftVO
.
tzType
.
toString
()
// goodsNftVO.tokenId = goodsNftVO.tokenId
if
(
salesType
===
1
)
{
saleInfo
.
stock
=
0
this
.
form
.
nftdto
=
goodsNftVO
// console.log('22222222', this.form.nftdto)
if
(
skus
&&
skus
.
length
>
0
)
{
saleInfo
.
stock
=
skus
[
0
].
stock
}
}
// this.form.nftdto = nftdto
form
.
saleInfo
=
saleInfo
this
.
form
=
form
},
complete
:
()
=>
{
this
.
loading
=
false
...
...
@@ -689,398 +831,600 @@ export default {
let
{
goodsId
}
=
this
.
$route
.
query
this
.
form
.
goodsId
=
goodsId
this
.
routeName
=
routeName
if
(
routeName
==
'update_good'
||
routeName
==
'good_detail'
||
routeName
==
'again_good'
)
{
if
(
routeName
==
'update_good'
||
routeName
==
'good_detail'
||
routeName
==
'again_good'
||
routeName
==
'draft_good'
)
{
this
.
requestGoodDetail
(
goodsId
)
}
else
{
this
.
loading
=
false
}
},
// checkForm() {
// let errMsg = "";
// let form = {
// auctionDTO: {},
// pointsExchangeDTO: {},
// preSaleDTO: {},
// skuList: [
// {
// coinName: "",
// originalPrice: "",
// nftSalesType: "",
// propertyList: [
// {
// propKey: "",
// propVal: "",
// },
// ],
// republish: "",
// skuId: "",
// stock: "",
// },
// ],
// packageDTO: {},
// nftdto: {},
// };
// let {
// goodsId,
// // templateId,
// baseInfo,
// saleInfo,
// deciptInfo,
// returnType,
// returnReason,
// note,
// deposit,
// depositType,
// buyerDeposit,
// priceIncrease,
// drawStartTime,
// drawEndTime,
// saleStartTime,
// saleEndTime,
// endTime,
// stock,
// pnum,
// traceabilityNumber,
// delayDelivery,
// nftdto,
// // packagePrice
// packageDTO,
// } = this.form;
// form.goodsId = goodsId;
// if (!baseInfo) {
// return { errMsg: "请完善基本信息!" };
// }
// if (!baseInfo.name) {
// return { errMsg: "请填写 基本信息 - 商品名称!" };
// }
// if (!baseInfo.type) {
// return { errMsg: "请填写 基本信息 - 商品类型!" };
// }
// if (!baseInfo.description) {
// return { errMsg: "请填写 基本信息 - 商品描述!" };
// }
// // if (
// // (!baseInfo.prop ||
// // baseInfo.prop.length === 0 ||
// // !baseInfo.prop[0].name ||
// // !baseInfo.prop[0].val)
// // ) {
// // return { errMsg: '请填写 基本信息 - 商品属性!' }
// // }
// if (!baseInfo.categoryId || baseInfo.categoryId.length === 0) {
// return { errMsg: "请填写 基本信息 - 类目选择!" };
// }
// form = { ...form, ...baseInfo };
// // 销售信息
// if (baseInfo.type != 6 && baseInfo.type != 5) {
// if (!saleInfo.sku || saleInfo.sku.length === 0) {
// return { errMsg: "请完善规格信息!" };
// }
// let skuIndex = 0;
// saleInfo.sku.forEach((item) => {
// // console.log('item', item)
// if (!item.originalPrice && item.originalPrice != 0) {
// errMsg = "请填写 规格信息 - 价格!";
// }
// if (!item.stock) {
// errMsg = "请填写 规格信息 - 库存!";
// }
// if (this.isAdd && saleInfo.commodityPass == 1 && !item.coinName) {
// errMsg = "请填写 规格信息 - Token名称!";
// }
// if (!item.weight) {
// errMsg = "请填写 规格信息 - 重量!";
// }
// if (
// item.weight == 0 ||
// (item.weight && item.weight
<
0
)
||
// item.weight > 9999
// ) {
// errMsg = "规格信息 - 重量 格式不正确!";
// }
// item.weight = parseFloat(item.weight);
// if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.weight)) {
// errMsg = "规格信息 - 重量 最多至小数点后两位!";
// }
// // console.log('coinName', item.coinName)
// if (
// this.isAdd &&
// saleInfo.commodityPass == 1 &&
// !/^[A-Z0-9]{2,10}$/.test(item.coinName)
// ) {
// errMsg = "规格信息 - Token名称 格式不正确!";
// }
// if (item.originalPrice
<=
0
||
item
.
originalPrice
>
999999
)
{
// errMsg = "规格信息 - 价格 格式不正确!";
// }
// item.originalPrice = parseFloat(item.originalPrice);
// if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.originalPrice)) {
// errMsg = "规格信息 - 价格 最多至小数点后两位!";
// }
// if (
// item.stock
<
0
||
// !/^\d+$/.test(item.stock) ||
// item.stock > 99999999
// ) {
// errMsg = "规格信息 - 库存 格式不正确!";
// }
// if (
// item.upload &&
// item.upload.imageList &&
// item.upload.imageList.length !== 0
// ) {
// saleInfo.sku[skuIndex].image = item.upload.imageList[0];
// }
// skuIndex++;
// });
// if (errMsg) {
// return { errMsg };
// }
// form.skuList = saleInfo.sku;
// form.commodityPass = saleInfo.commodityPass;
// if (form.commodityPass == 1) {
// form.skuList = form.skuList.map((item) => {
// let { coinName, coinNamePrefix, ...other } = item;
// return { coinName: coinNamePrefix + coinName, ...other };
// });
// }
// if (form.commodityPass == 2 && !this.isEdit) {
// form.skuList.forEach((item) => {
// let name = JSON.parse(item.name);
// item.commodityPassId = name.commodityPassId;
// item.coinName = `${item.coinNamePrefix}${name.labelName}`;
// });
// }
// }
// if (baseInfo.type == 6 && saleInfo.sku.length != 0) {
// // console.log(11111, saleInfo.sku)
// form.skuList = saleInfo.sku;
// }
// // form.skuList = skuList
// // console.log('form.skuList', form.skuList)
// // 图文信息
// if (!deciptInfo) {
// return { errMsg: "请完善图文描述!" };
// }
// if (
// !deciptInfo.detailPictures ||
// deciptInfo.detailPictures.length === 0
// ) {
// return { errMsg: "请上传 图文描述 - 商品图片!" };
// }
// // if (!deciptInfo.videoList || deciptInfo.videoList.length === 0) {
// // return { errMsg: '请上传 图文描述 - 商品视频!' }
// // }
// if (!deciptInfo.thumbList || deciptInfo.thumbList.length === 0) {
// return { errMsg: "请上传 图文描述 - 缩略图!" };
// }
// if (deciptInfo.detailDescribe.length > 18000) {
// return { errMsg: "图文描述 - 详情描述 内容长度过长!" };
// }
// if (deciptInfo.detailDescribe.length == 0) {
// return { errMsg: "图文描述 - 请输入详情描述!" };
// }
// // form = { ...form, ...deciptInfo }
// form.thumb = deciptInfo.thumbList[0];
// form.imgList = JSON.stringify(deciptInfo.detailPictures);
// form.detail = deciptInfo.detailDescribe;
// if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
// form.video = deciptInfo.videoList[0];
// form.videoPoster = getPosterFromVideoUrl(form.video);
// } else {
// form.video = "";
// form.videoPoster = "";
// }
// if (
// deciptInfo.nftEnclosureList &&
// deciptInfo.nftEnclosureList.length !== 0
// ) {
// form.nftFile = deciptInfo.nftEnclosureList[0];
// // form.videoPoster = getPosterFromVideoUrl(form.video)
// } else {
// form.nftFile = "";
// }
// // console.log('form',form)
// // 快递模板
// // if (!templateId) {
// // return { errMsg: '请选择快递模板!' }
// // }
// // form.templateId = templateId
// // 打包价格
// if (!packageDTO.price && baseInfo.type == 5) {
// return { errMsg: "请填写打包价格" };
// }
// form.packageDTO.price = packageDTO.price;
// // 打包资源
// packageDTO.resource.forEach((item) => {
// if (!item.skuId && baseInfo.type == 5) {
// errMsg = "请选择规格!";
// }
// if (!item.number && item.number != 0 && baseInfo.type == 5) {
// errMsg = "请填写数量!";
// }
// });
// form.packageDTO.resource = packageDTO.resource;
// form.packageDTO.resource = form.packageDTO.resource.map((item) => {
// let { skuId, number } = item;
// return { skuId: skuId, number: number };
// });
// form.packageDTO.resource = JSON.stringify(form.packageDTO.resource);
// if (!packageDTO.stock && baseInfo.type == 5) {
// return { errMsg: "请填写打包库存" };
// }
// form.packageDTO.stock = packageDTO.stock;
// // NFT商品价格
// // console.log('nftdto', nftdto)
// if (!nftdto.price && baseInfo.type == 6) {
// return { errMsg: "请填写商品价格" };
// }
// // NFT类型
// if (!nftdto.type && baseInfo.type == 6 && nftdto.tzType == 1) {
// return { errMsg: "请选择NFT类型" };
// }
// // NFT类型
// if (!nftdto.number && baseInfo.type == 6 && nftdto.type == 2) {
// return { errMsg: "请填写发行数量" };
// }
// form.nftdto = nftdto;
// // 退货类型
// if (!returnType && returnType != 0) {
// return { errMsg: "请选择退货类型" };
// }
// form.returnType = returnType;
// // 自定义退货(退货理由)
// if (returnReason == "" && returnType == 2) {
// return { errMsg: "请描述退货理由" };
// }
// form.returnReason = returnReason;
// // 商品备注
// // if (!note) {
// // return { errMsg: '请填写商品备注' }
// // }
// form.note = note;
// if (!depositType && baseInfo.type == 2) {
// return { errMsg: "请选择预售定金类型" };
// }
// form.preSaleDTO.depositType = depositType;
// // 首付比例
// if (baseInfo.type == 2) {
// if (depositType == 1) {
// deposit = this.fixedProportion;
// } else {
// deposit = this.fixedAmount;
// }
// }
// if (!deposit && baseInfo.type == 2) {
// return { errMsg: "请填写首付比例" };
// }
// form.preSaleDTO.deposit = deposit;
// // 预计提货开始时间
// if (!drawStartTime && baseInfo.type == 2) {
// return { errMsg: "请填写预计提货开始时间" };
// }
// form.preSaleDTO.drawStartTime = drawStartTime;
// // 预计提货结束时间
// if (!drawEndTime && baseInfo.type == 2) {
// return { errMsg: "请填写预计提货结束时间" };
// }
// form.preSaleDTO.drawEndTime = drawEndTime;
// // 预售开始时间
// if (!saleStartTime && baseInfo.type == 2) {
// return { errMsg: "请填写预售开始时间" };
// }
// form.preSaleDTO.saleStartTime = saleStartTime;
// // 预售结束时间
// if (!saleEndTime && baseInfo.type == 2) {
// return { errMsg: "请填写预售结束时间" };
// }
// form.preSaleDTO.saleEndTime = saleEndTime;
// // 买家保证金
// if (!buyerDeposit && baseInfo.type == 3) {
// return { errMsg: "请填写拍卖保证金" };
// }
// if (
// (buyerDeposit
<
0
||
!
/^
\d
+$/
.
test
(
buyerDeposit
))
&&
// baseInfo.type == 3
// ) {
// return { errMsg: "拍卖保证金格式输入有误!" };
// }
// form.auctionDTO.buyerDeposit = buyerDeposit;
// // 出价最小增幅
// if (!priceIncrease && baseInfo.type == 3) {
// return { errMsg: "请填写出价最小增幅" };
// }
// if (
// (priceIncrease
<
0
||
!
/^
\d
+$/
.
test
(
priceIncrease
))
&&
// baseInfo.type == 3
// ) {
// return { errMsg: "出价最小增幅格式输入有误!" };
// }
// form.auctionDTO.priceIncrease = priceIncrease;
// if (!endTime && baseInfo.type == 3) {
// return { errMsg: "请填写拍卖结束时间" };
// }
// form.auctionDTO.endTime = endTime;
// // 积分库存
// // if (!stock && baseInfo.type == 4) {
// // return { errMsg: '请填写库存' }
// // }
// // form.pointsExchangeDTO.stock = stock
// // // 积分数量
// // if (!pnum && baseInfo.type == 4) {
// // return { errMsg: '请填写积分数量' }
// // }
// form.pointsExchangeDTO.pnum = pnum;
// // if (!traceabilityNumber) {
// // return { errMsg: '请输入溯源系统的商品溯源编号' }
// // }
// form.traceabilityNumber = traceabilityNumber;
// form.delayDelivery = delayDelivery == true ? "1" : "0";
// return { errMsg, form };
// },
checkForm
()
{
let
errMsg
=
''
let
form
=
{
auctionDTO
:
{},
pointsExchangeDTO
:
{},
preSaleDTO
:
{},
skuList
:
[{
coinName
:
''
,
originalPrice
:
''
,
nftSalesType
:
''
,
propertyList
:
[{
propKey
:
''
,
propVal
:
''
}],
republish
:
''
,
skuId
:
''
,
stock
:
''
}],
packageDTO
:
{},
nftdto
:
{}
}
let
{
goodsId
,
// templateId,
baseInfo
,
saleInfo
,
deciptInfo
,
returnType
,
returnReason
,
note
,
deposit
,
depositType
,
buyerDeposit
,
priceIncrease
,
drawStartTime
,
drawEndTime
,
saleStartTime
,
saleEndTime
,
endTime
,
stock
,
pnum
,
traceabilityNumber
,
delayDelivery
,
nftdto
,
// packagePrice
packageDTO
}
=
this
.
form
form
.
goodsId
=
goodsId
if
(
!
baseInfo
)
{
return
{
errMsg
:
'请完善基本信息!'
}
}
if
(
!
baseInfo
.
name
)
{
return
{
errMsg
:
'请填写 基本信息 - 商品名称!'
}
}
if
(
!
baseInfo
.
type
)
{
return
{
errMsg
:
'请填写 基本信息 - 商品类型!'
}
}
if
(
!
baseInfo
.
description
)
{
return
{
errMsg
:
'请填写 基本信息 - 商品描述!'
}
blindBoxPrice
:
0
,
categoryId
:
this
.
form
.
baseInfo
.
categoryId
.
length
>
0
?
JSON
.
stringify
(
this
.
form
.
baseInfo
.
categoryId
)
:
''
,
commodityPass
:
0
,
delayDelivery
:
this
.
form
.
delayDelivery
?
1
:
0
,
description
:
this
.
form
.
baseInfo
.
description
,
detail
:
this
.
form
.
deciptInfo
.
detailDescribe
,
difficulty
:
this
.
form
.
saleInfo
.
difficulty
,
imgList
:
this
.
form
.
deciptInfo
.
detailPictures
.
length
>
0
?
JSON
.
stringify
(
this
.
form
.
deciptInfo
.
detailPictures
)
:
''
,
name
:
this
.
form
.
baseInfo
.
name
,
nftFile
:
this
.
form
.
deciptInfo
.
nftEnclosureList
.
length
>
0
?
this
.
form
.
deciptInfo
.
nftEnclosureList
[
0
]
:
''
,
nftdto
:
this
.
form
.
nftdto
,
note
:
this
.
form
.
note
,
prop
:
this
.
form
.
baseInfo
.
prop
?
JSON
.
stringify
(
this
.
form
.
baseInfo
.
prop
)
:
''
,
returnReason
:
this
.
form
.
returnReason
,
returnType
:
this
.
form
.
returnType
,
salesType
:
this
.
form
.
saleInfo
.
salesType
,
skuList
:
[],
thumb
:
this
.
form
.
deciptInfo
.
thumbList
.
length
>
0
?
this
.
form
.
deciptInfo
.
thumbList
[
0
]
:
''
,
traceabilityNumber
:
this
.
form
.
traceabilityNumber
,
type
:
this
.
form
.
baseInfo
.
type
,
video
:
this
.
form
.
deciptInfo
.
videoList
.
length
>
0
?
this
.
form
.
deciptInfo
.
videoList
[
0
]
:
''
,
videoPoster
:
this
.
form
.
deciptInfo
.
videoList
.
length
>
0
?
getPosterFromVideoUrl
(
this
.
form
.
deciptInfo
.
videoList
[
0
])
:
''
}
// if (
// (!baseInfo.prop ||
// baseInfo.prop.length === 0 ||
// !baseInfo.prop[0].name ||
// !baseInfo.prop[0].val)
// ) {
// return { errMsg: '请填写 基本信息 - 商品属性!' }
// }
if
(
(
!
baseInfo
.
categoryId
||
baseInfo
.
categoryId
.
length
===
0
)
)
{
return
{
errMsg
:
'请填写 基本信息 - 类目选择!'
}
if
(
this
.
form
.
goodsId
)
{
form
.
goodsId
=
this
.
form
.
goodsId
}
form
=
{
...
form
,
...
baseInfo
}
// 销售信息
if
(
baseInfo
.
type
!=
6
&&
baseInfo
.
type
!=
5
)
{
if
(
(
!
saleInfo
.
sku
||
saleInfo
.
sku
.
length
===
0
)
)
{
return
{
errMsg
:
'请完善规格信息!'
}
}
let
skuIndex
=
0
saleInfo
.
sku
.
forEach
((
item
)
=>
{
// console.log('item', item)
if
(
!
item
.
originalPrice
&&
item
.
originalPrice
!=
0
)
{
errMsg
=
'请填写 规格信息 - 价格!'
}
if
(
!
item
.
stock
)
{
errMsg
=
'请填写 规格信息 - 库存!'
}
if
(
this
.
isAdd
&&
saleInfo
.
commodityPass
==
1
&&
!
item
.
coinName
)
{
errMsg
=
'请填写 规格信息 - Token名称!'
}
if
(
!
item
.
weight
)
{
errMsg
=
'请填写 规格信息 - 重量!'
}
if
((
item
.
weight
==
0
||
(
item
.
weight
&&
item
.
weight
<
0
)
||
item
.
weight
>
9999
))
{
errMsg
=
'规格信息 - 重量 格式不正确!'
}
item
.
weight
=
parseFloat
(
item
.
weight
)
if
(
!
/^
[
0-9
]
+
(
.
[
0-9
]{1,2})?
$/
.
test
(
item
.
weight
))
{
errMsg
=
'规格信息 - 重量 最多至小数点后两位!'
}
// console.log('coinName', item.coinName)
if
(
this
.
isAdd
&&
saleInfo
.
commodityPass
==
1
&&
!
/^
[
A-Z0-9
]{2,10}
$/
.
test
(
item
.
coinName
))
{
errMsg
=
'规格信息 - Token名称 格式不正确!'
}
if
((
item
.
originalPrice
<=
0
||
item
.
originalPrice
>
999999
))
{
errMsg
=
'规格信息 - 价格 格式不正确!'
}
item
.
originalPrice
=
parseFloat
(
item
.
originalPrice
)
if
(
!
/^
[
0-9
]
+
(
.
[
0-9
]{1,2})?
$/
.
test
(
item
.
originalPrice
))
{
errMsg
=
'规格信息 - 价格 最多至小数点后两位!'
if
(
this
.
form
.
saleInfo
.
salesType
===
1
)
{
form
.
commodityPass
=
this
.
form
.
saleInfo
.
tzType
form
.
skuList
=
[
{
stock
:
this
.
form
.
saleInfo
.
stock
,
propertyList
:
[
{
propKey
:
'规格名称'
,
propVal
:
' '
}
]
}
if
((
item
.
stock
<
0
||
!
/^
\d
+$/
.
test
(
item
.
stock
)
||
item
.
stock
>
99999999
))
{
errMsg
=
'规格信息 - 库存 格式不正确!'
]
form
.
nftdto
=
{
number
:
1
,
price
:
this
.
form
.
saleInfo
.
price
,
tokenId
:
this
.
form
.
saleInfo
.
tokenId
,
type
:
this
.
form
.
saleInfo
.
type
,
tzType
:
this
.
form
.
saleInfo
.
tzType
}
}
else
if
(
this
.
form
.
saleInfo
.
salesType
===
4
)
{
form
.
commodityPass
=
this
.
form
.
saleInfo
.
commodityPass
form
.
blindBoxPrice
=
this
.
form
.
saleInfo
.
price
form
.
blindBoxRule
=
this
.
form
.
saleInfo
.
blindBoxRule
let
skuList
=
[]
for
(
let
item
of
this
.
form
.
saleInfo
.
sku
)
{
let
obj
=
{
...
item
,
isHide
:
item
.
isHide
?
1
:
0
,
propertyList
:
[
{
propKey
:
'规格名称'
,
propVal
:
item
.
name
||
''
}
]
}
if
(
item
.
upload
&&
item
.
upload
.
imageList
&&
item
.
upload
.
imageList
.
length
!==
0
item
.
upload
.
imageList
&&
item
.
upload
.
imageList
.
length
!==
0
)
{
saleInfo
.
sku
[
skuIndex
]
.
image
=
item
.
upload
.
imageList
[
0
]
obj
.
image
=
item
.
upload
.
imageList
[
0
]
}
skuIndex
++
})
if
(
errMsg
)
{
return
{
errMsg
}
skuList
.
push
(
obj
)
}
form
.
skuList
=
saleInfo
.
sku
form
.
commodityPass
=
saleInfo
.
commodityPass
if
(
form
.
commodityPass
==
1
)
{
form
.
skuList
=
form
.
skuList
.
map
(
item
=>
{
let
{
coinName
,
coinNamePrefix
,
...
other
}
=
item
return
{
coinName
:
coinNamePrefix
+
coinName
,
...
other
}
})
}
if
(
form
.
commodityPass
==
2
&&
!
this
.
isEdit
)
{
form
.
skuList
.
forEach
(
item
=>
{
let
name
=
JSON
.
parse
(
item
.
name
)
item
.
commodityPassId
=
name
.
commodityPassId
item
.
coinName
=
`
${
item
.
coinNamePrefix
}${
name
.
labelName
}
`
})
}
}
if
(
baseInfo
.
type
==
6
&&
saleInfo
.
sku
.
length
!=
0
)
{
// console.log(11111, saleInfo.sku)
form
.
skuList
=
saleInfo
.
sku
form
.
skuList
=
skuList
}
// form.skuList = skuList
// console.log('form.skuList', form.skuList)
// 图文信息
if
(
!
deciptInfo
)
{
return
{
errMsg
:
'请完善图文描述!'
}
}
if
(
!
deciptInfo
.
detailPictures
||
deciptInfo
.
detailPictures
.
length
===
0
)
{
return
{
errMsg
:
'请上传 图文描述 - 商品图片!'
}
}
// if (!deciptInfo.videoList || deciptInfo.videoList.length === 0) {
// return { errMsg: '请上传 图文描述 - 商品视频!' }
// }
if
(
!
deciptInfo
.
thumbList
||
deciptInfo
.
thumbList
.
length
===
0
)
{
return
{
errMsg
:
'请上传 图文描述 - 缩略图!'
}
}
if
(
deciptInfo
.
detailDescribe
.
length
>
18000
)
{
return
{
errMsg
:
'图文描述 - 详情描述 内容长度过长!'
}
}
if
(
deciptInfo
.
detailDescribe
.
length
==
0
)
{
return
{
errMsg
:
'图文描述 - 请输入详情描述!'
}
}
// form = { ...form, ...deciptInfo }
form
.
thumb
=
deciptInfo
.
thumbList
[
0
]
form
.
imgList
=
JSON
.
stringify
(
deciptInfo
.
detailPictures
)
form
.
detail
=
deciptInfo
.
detailDescribe
if
(
deciptInfo
.
videoList
&&
deciptInfo
.
videoList
.
length
!==
0
)
{
form
.
video
=
deciptInfo
.
videoList
[
0
]
form
.
videoPoster
=
getPosterFromVideoUrl
(
form
.
video
)
}
else
{
form
.
video
=
''
form
.
videoPoster
=
''
return
form
},
validateForm
()
{
let
errMsg
=
''
if
(
!
this
.
form
.
baseInfo
)
{
errMsg
=
'请完善基本信息!'
}
if
(
deciptInfo
.
nftEnclosureList
&&
deciptInfo
.
nftEnclosureList
.
length
!==
0
)
{
form
.
nftFile
=
deciptInfo
.
nftEnclosureList
[
0
]
// form.videoPoster = getPosterFromVideoUrl(form.video)
}
else
{
form
.
nftFile
=
''
if
(
!
this
.
form
.
baseInfo
.
name
)
{
errMsg
=
'请填写 基本信息 - 商品名称!'
}
// console.log('form',form)
// 快递模板
// if (!templateId) {
// return { errMsg: '请选择快递模板!' }
// }
// form.templateId = templateId
// 打包价格
if
(
!
packageDTO
.
price
&&
baseInfo
.
type
==
5
)
{
return
{
errMsg
:
'请填写打包价格'
}
if
(
!
this
.
form
.
baseInfo
.
type
)
{
errMsg
=
'请填写 基本信息 - 商品类型!'
}
form
.
packageDTO
.
price
=
packageDTO
.
price
// 打包资源
packageDTO
.
resource
.
forEach
(
item
=>
{
if
(
!
item
.
skuId
&&
baseInfo
.
type
==
5
)
{
errMsg
=
'请选择规格!'
}
if
(
!
item
.
number
&&
item
.
number
!=
0
&&
baseInfo
.
type
==
5
)
{
errMsg
=
'请填写数量!'
}
})
form
.
packageDTO
.
resource
=
packageDTO
.
resource
form
.
packageDTO
.
resource
=
form
.
packageDTO
.
resource
.
map
(
item
=>
{
let
{
skuId
,
number
}
=
item
return
{
skuId
:
skuId
,
number
:
number
}
})
form
.
packageDTO
.
resource
=
JSON
.
stringify
(
form
.
packageDTO
.
resource
)
if
(
!
packageDTO
.
stock
&&
baseInfo
.
type
==
5
)
{
return
{
errMsg
:
'请填写打包库存'
}
if
(
!
this
.
form
.
baseInfo
.
description
)
{
errMsg
=
'请填写 基本信息 - 商品描述!'
}
form
.
packageDTO
.
stock
=
packageDTO
.
stock
// NFT商品价格
// console.log('nftdto', nftdto)
if
(
!
nftdto
.
price
&&
baseInfo
.
type
==
6
)
{
return
{
errMsg
:
'请填写商品价格'
}
if
(
!
this
.
form
.
baseInfo
.
categoryId
||
this
.
form
.
baseInfo
.
categoryId
.
length
===
0
)
{
errMsg
=
'请填写 基本信息 - 类目选择!'
}
// NFT类型
if
(
!
nftdto
.
type
&&
baseInfo
.
type
==
6
&&
nftdto
.
tzType
==
1
)
{
return
{
errMsg
:
'请选择NFT类型'
}
if
(
!
this
.
form
.
deciptInfo
)
{
errMsg
=
'请完善图文描述!'
}
// NFT类型
if
(
!
nftdto
.
number
&&
baseInfo
.
type
==
6
&&
nftdto
.
type
==
2
)
{
return
{
errMsg
:
'请填写发行数量'
}
if
(
!
this
.
form
.
deciptInfo
.
detailPictures
||
this
.
form
.
deciptInfo
.
detailPictures
.
length
===
0
)
{
errMsg
=
'请上传 图文描述 - 商品图片!'
}
form
.
nftdto
=
nftdto
// 退货类型
if
(
!
returnType
&&
returnType
!=
0
)
{
return
{
errMsg
:
'请选择退货类型'
}
if
(
!
this
.
form
.
deciptInfo
.
thumbList
||
this
.
form
.
deciptInfo
.
thumbList
.
length
===
0
)
{
errMsg
=
'请上传 图文描述 - 缩略图!'
}
form
.
returnType
=
returnType
// 自定义退货(退货理由)
if
(
returnReason
==
''
&&
returnType
==
2
)
{
return
{
errMsg
:
'请描述退货理由'
}
if
(
this
.
form
.
deciptInfo
.
detailDescribe
.
length
>
18000
)
{
errMsg
=
'图文描述 - 详情描述 内容长度过长!'
}
form
.
returnReason
=
returnReason
// 商品备注
// if (!note) {
// return { errMsg: '请填写商品备注' }
// }
form
.
note
=
note
if
(
!
depositType
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请选择预售定金类型'
}
if
(
this
.
form
.
deciptInfo
.
detailDescribe
.
length
==
0
)
{
errMsg
=
'图文描述 - 请输入详情描述!'
}
form
.
preSaleDTO
.
depositType
=
depositType
// 首付比例
if
(
baseInfo
.
type
==
2
)
{
if
(
depositType
==
1
)
{
deposit
=
this
.
fixedProportion
if
(
!
this
.
form
.
saleInfo
)
{
errMsg
=
'请完善规格信息!'
}
else
{
if
(
!
this
.
form
.
saleInfo
.
price
)
{
errMsg
=
'请填写商品价格!'
}
if
(
!
this
.
form
.
saleInfo
.
salesType
)
{
errMsg
=
'请选择销售模式!'
}
else
{
deposit
=
this
.
fixedAmount
if
(
this
.
form
.
saleInfo
.
salesType
===
4
)
{
if
(
!
this
.
form
.
saleInfo
.
blindBoxRule
)
{
errMsg
=
'请完善规格信息 - 盲盒规则!'
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
==
0
)
{
errMsg
=
'请完善规格信息 - 盲盒规则!'
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
>
18000
)
{
errMsg
=
'规格信息 - 盲盒规则 内容长度过长!'
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
>
18000
)
{
errMsg
=
'规格信息 - 盲盒规则 内容长度过长!'
}
if
(
!
this
.
form
.
saleInfo
.
sku
||
this
.
form
.
saleInfo
.
sku
.
length
===
0
)
{
errMsg
=
'请完善规格信息!'
}
for
(
let
item
of
this
.
form
.
saleInfo
.
sku
)
{
if
(
!
item
.
name
)
{
errMsg
=
'请填写 规格信息 - 规格名称!'
break
}
if
(
!
item
.
weight
)
{
errMsg
=
'请填写 规格信息 - 重量!'
break
}
if
(
item
.
weight
==
0
||
(
item
.
weight
&&
item
.
weight
<
0
)
||
item
.
weight
>
9999
)
{
errMsg
=
'规格信息 - 重量 格式不正确!'
break
}
if
(
!
item
.
stock
)
{
errMsg
=
'请填写 规格信息 - 库存!'
break
}
if
(
item
.
stock
<
0
||
!
/^
\d
+$/
.
test
(
item
.
stock
)
||
item
.
stock
>
99999999
)
{
errMsg
=
'规格信息 - 库存 格式不正确!'
break
}
}
}
else
{
if
(
!
this
.
form
.
saleInfo
.
stock
)
{
errMsg
=
'请输入库存!'
}
}
}
}
if
(
!
deposit
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请填写首付比例'
}
}
form
.
preSaleDTO
.
deposit
=
deposit
// 预计提货开始时间
if
(
!
drawStartTime
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请填写预计提货开始时间'
}
}
form
.
preSaleDTO
.
drawStartTime
=
drawStartTime
// 预计提货结束时间
if
(
!
drawEndTime
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请填写预计提货结束时间'
}
}
form
.
preSaleDTO
.
drawEndTime
=
drawEndTime
// 预售开始时间
if
(
!
saleStartTime
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请填写预售开始时间'
}
}
form
.
preSaleDTO
.
saleStartTime
=
saleStartTime
// 预售结束时间
if
(
!
saleEndTime
&&
baseInfo
.
type
==
2
)
{
return
{
errMsg
:
'请填写预售结束时间'
}
}
form
.
preSaleDTO
.
saleEndTime
=
saleEndTime
// 买家保证金
if
(
!
buyerDeposit
&&
baseInfo
.
type
==
3
)
{
return
{
errMsg
:
'请填写拍卖保证金'
}
}
if
((
buyerDeposit
<
0
||
!
/^
\d
+$/
.
test
(
buyerDeposit
))
&&
baseInfo
.
type
==
3
)
{
return
{
errMsg
:
'拍卖保证金格式输入有误!'
}
}
form
.
auctionDTO
.
buyerDeposit
=
buyerDeposit
// 出价最小增幅
if
(
!
priceIncrease
&&
baseInfo
.
type
==
3
)
{
return
{
errMsg
:
'请填写出价最小增幅'
}
}
if
((
priceIncrease
<
0
||
!
/^
\d
+$/
.
test
(
priceIncrease
))
&&
baseInfo
.
type
==
3
)
{
return
{
errMsg
:
'出价最小增幅格式输入有误!'
}
}
form
.
auctionDTO
.
priceIncrease
=
priceIncrease
if
(
!
endTime
&&
baseInfo
.
type
==
3
)
{
return
{
errMsg
:
'请填写拍卖结束时间'
}
}
form
.
auctionDTO
.
endTime
=
endTime
// 积分库存
// if (!stock && baseInfo.type == 4) {
// return { errMsg: '请填写库存' }
// }
// form.pointsExchangeDTO.stock = stock
// // 积分数量
// if (!pnum && baseInfo.type == 4) {
// return { errMsg: '请填写积分数量' }
// }
form
.
pointsExchangeDTO
.
pnum
=
pnum
// if (!traceabilityNumber) {
// return { errMsg: '请输入溯源系统的商品溯源编号' }
// }
form
.
traceabilityNumber
=
traceabilityNumber
form
.
delayDelivery
=
delayDelivery
==
true
?
'1'
:
'0'
return
{
errMsg
,
form
}
return
errMsg
},
handleSubmit
()
{
let
{
errMsg
,
form
}
=
this
.
checkForm
()
// console.log('form', form)
let
form
=
this
.
checkForm
()
let
errMsg
=
this
.
validateForm
()
console
.
log
(
'form'
,
form
)
if
(
errMsg
)
{
return
this
.
$Notice
.
warning
({
title
:
errMsg
})
}
if
(
form
.
preSaleDTO
.
drawStartTime
>
form
.
preSaleDTO
.
drawEndTime
)
{
return
this
.
$Notice
.
warning
(
'提货开始时间不能大于结束时间'
)
}
if
(
form
.
preSaleDTO
.
saleStartTime
>
form
.
preSaleDTO
.
saleEndTime
)
{
return
this
.
$Notice
.
warning
(
'预售开始时间不能大于结束时间'
)
}
if
(
!
errMsg
)
{
form
.
categoryId
=
JSON
.
stringify
(
form
.
categoryId
)
form
.
prop
=
JSON
.
stringify
(
form
.
prop
)
form
.
type
=
JSON
.
parse
(
form
.
type
)
}
if
(
!
errMsg
)
{
form
.
returnType
=
JSON
.
parse
(
form
.
returnType
)
form
.
preSaleDTO
.
drawStartTime
=
new
Date
(
form
.
preSaleDTO
.
drawStartTime
).
getTime
()
form
.
preSaleDTO
.
drawEndTime
=
new
Date
(
form
.
preSaleDTO
.
drawEndTime
).
getTime
()
+
86399000
form
.
preSaleDTO
.
saleStartTime
=
new
Date
(
form
.
preSaleDTO
.
saleStartTime
).
getTime
()
form
.
preSaleDTO
.
saleEndTime
=
new
Date
(
form
.
preSaleDTO
.
saleEndTime
).
getTime
()
+
86399000
form
.
auctionDTO
.
endTime
=
new
Date
(
form
.
auctionDTO
.
endTime
).
getTime
()
+
86399000
}
if
(
!
errMsg
)
{
if
(
form
.
type
==
6
)
{
if
(
form
.
type
==
6
&&
form
.
nftdto
)
{
if
(
form
.
nftdto
.
tzType
==
1
&&
form
.
nftdto
.
type
==
1
)
{
form
.
nftdto
.
number
=
1
}
if
(
form
.
nftdto
.
tzType
==
1
)
{
form
.
commodityPass
=
1
}
else
if
(
form
.
nftdto
.
tzType
==
2
)
{
form
.
commodityPass
=
2
}
// form.commodityPass = 0
form
.
skuList
.
forEach
(
item
=>
{
item
.
originalPrice
=
form
.
nftdto
.
price
item
.
coinName
=
form
.
nftdto
.
tokenId
item
.
republish
=
false
item
.
propertyList
=
[{
propKey
:
'规格'
,
propVal
:
form
.
name
}]
item
.
stock
=
form
.
nftdto
.
number
item
.
image
=
form
.
thumb
item
.
nftSalesType
=
0
})
}
}
// form.detail
var
regex1
=
new
RegExp
(
"(i?)(
\
<p)(?!(.*?style=['
\"
](.*)['
\"
])[^
\
>]+
\
>)"
,
'gmi'
)
var
regex1
=
new
RegExp
(
"(i?)(<p)(?!(.*?style=['
\"
](.*)['
\"
])[^>]+>)"
,
'gmi'
)
form
.
detail
=
form
.
detail
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
)
// console.log('form', form)
let
apiName
=
this
.
isAdd
?
'addGood'
:
this
.
isAgain
?
'republishGood'
:
'updateGood'
let
title
=
this
.
isAdd
?
'添加成功!'
:
this
.
isAgain
?
'重新发布成功!'
:
'编辑成功!'
form
.
blindBoxRule
=
form
.
blindBoxRule
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
)
var
regex1
=
new
RegExp
(
"(i?)(<p)(?!(.*?style=['
\"
](.*)['
\"
])[^>]+>)"
,
'gmi'
)
form
.
detail
=
form
.
detail
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
)
let
apiName
=
(
this
.
isAdd
||
this
.
isDraft
)
?
'addGood'
:
this
.
isAgain
?
'republishGood'
:
'updateGood'
let
title
=
(
this
.
isAdd
||
this
.
isDraft
)
?
'添加成功!'
:
this
.
isAgain
?
'重新发布成功!'
:
'编辑成功!'
this
.
submitLoading
=
true
this
.
api
({
apiName
,
...
...
@@ -1096,8 +1440,25 @@ export default {
this
.
submitLoading
=
false
}
})
},
handleDraft
()
{
let
form
=
this
.
checkForm
()
this
.
draftLoading
=
true
this
.
api
({
apiName
:
'draftGood'
,
postdata
:
form
,
success
:
(
res
)
=>
{
// 关闭当前标签页
let
route
=
this
.
$route
let
toRouteName
=
'product_list'
this
.
closeTag
({
route
,
toRouteName
})
this
.
$Notice
.
success
({
title
:
'保存成功!'
})
},
complete
:
()
=>
{
this
.
draftLoading
=
false
}
})
}
},
mounted
()
{
// this.getNftList()
...
...
@@ -1137,14 +1498,14 @@ export default {
font-size: 12px;
// font-weight: bold;
}
.ivu-radio{
.ivu-radio
{
width: 200px;
}
.ivu-select {
width: 200px;
}
}
.series-time{
.series-time
{
padding: 5px 36px;
margin-bottom: 10px;
display: flex;
...
...
@@ -1153,15 +1514,24 @@ export default {
padding: 5px;
font-size: 12px;
}
.time{
.time
{
display: flex;
justify-content: space-around;
}
}
.submit-con {
text-align: center;
// .submit-con {
// text-align: center;
// }
.submit-bottom {
margin: 0 auto;
width: 50%;
display: flex;
justify-content: space-around;
.submit-con {
// text-align: center;
}
}
.package-resources{
.package-resources
{
padding: 5px 36px;
margin-bottom: 10px;
align-items: center;
...
...
@@ -1172,13 +1542,12 @@ export default {
font-size: 12px;
// font-weight: bold;
}
.property-con{
.property-con
{
border: 1px solid #dcdee2;
border-radius: 5px;
padding: 20px;
align-items: center;
.property-item{
.property-item {
// display: flex;
// justify-content: space-between;
align-items: center;
...
...
src/view/good-mgr/add-good/sale-info.vue
View file @
3fe1f073
...
...
@@ -67,173 +67,304 @@
</div>
-->
<div
class=
"item"
>
<label
class=
"label"
>
销售模式:
</label>
<RadioGroup
v-model=
"data.salesType"
>
<Radio
:label=
"1"
style=
"width:200px"
:disabled=
"isDetail || isEdit"
>
普通
</Radio>
<Radio
:label=
"2"
style=
"width:200px"
:disabled=
"isDetail || isEdit"
>
盲盒
</Radio>
<RadioGroup
v-model=
"data.salesType"
@
on-change=
"changeSalesType"
>
<Radio
:label=
"1"
style=
"width: 200px"
:disabled=
"isDetail || isEdit"
>
普通
</Radio
>
<Radio
:label=
"4"
style=
"width: 200px"
:disabled=
"isDetail || isEdit"
>
盲盒
</Radio
>
</RadioGroup>
</div>
<div
class=
"item"
>
<label
class=
"label"
>
商品价格:
</label>
<Input
v-model=
"data.price"
:readonly=
"isDetail"
placeholder=
"请输入商品价格"
style=
"width: 400px"
/>
<Input
v-model=
"data.price"
:readonly=
"isDetail"
placeholder=
"请输入商品价格"
style=
"width: 400px"
/>
</div>
<div
class=
"item"
>
<div
class=
"item"
v-if=
"data.salesType === 1"
>
<label
class=
"label"
>
商品通证:
</label>
<RadioGroup
v-model=
"data.tzType"
@
on-change=
"changeTzType"
>
<Radio
label=
"1"
:disabled=
"isDetail||isEdit||isAgain"
style=
"width:200px;"
>
内部发行
</Radio>
<Radio
label=
"2"
:disabled=
"isDetail||isEdit||isAgain"
style=
"width:200px;"
>
外部绑定
</Radio>
<Radio
:label=
"1"
:disabled=
"isDetail || isEdit || isAgain"
style=
"width: 200px"
>
内部发行
</Radio
>
<Radio
:label=
"2"
:disabled=
"isDetail || isEdit || isAgain"
style=
"width: 200px"
>
外部绑定
</Radio
>
</RadioGroup>
</div>
<div
class=
"item"
v-if=
"data.tzType==1"
>
<label
class=
"label"
>
NFT类型:
</label>
<RadioGroup
v-model=
"data.type"
@
on-change=
"changeType"
>
<Radio
label=
"1"
:disabled=
"isDetail||isEdit||isAgain"
style=
"width:200px;"
>
单个,不可拷贝
</Radio>
<Radio
label=
"2"
:disabled=
"isDetail||isEdit||isAgain"
style=
"width:200px;"
>
可拷贝
</Radio>
<div
class=
"item"
v-if=
"data.salesType === 4"
>
<label
class=
"label"
>
商品通证:
</label>
<RadioGroup
v-model=
"data.commodityPass"
>
<Radio
:label=
"1"
style=
"width: 200px"
:disabled=
"isDetail || isEdit"
>
是,自动生成Token
</Radio
>
<Radio
:label=
"2"
style=
"width: 200px"
:disabled=
"isDetail || isEdit"
>
是,使用外部既有Token
</Radio
>
</RadioGroup>
</div>
<div
class=
"item"
v-if=
"data.type==2"
>
<label
class=
"label"
>
发行数量:
</label>
<Input
v-model=
"data.number"
:readonly=
"isDetail||isEdit||isAgain"
placeholder=
"请输入发行数量,正整数"
style=
"width: 400px"
/>
</div>
<div
class=
"item"
v-if=
"data.tzType==2"
>
<label
class=
"label"
>
绑定NFT:
</label>
<Input
v-model=
"data.tokenId"
v-if=
"isDetail||isEdit||isAgain"
:readonly=
"isDetail||isEdit||isAgain"
style=
"width: 400px"
/>
<Select
v-else
placeholder=
"请选择NFT TOKENID"
transfer
v-model=
"data.tokenId"
<template
v-if=
"data.salesType == 1"
>
<div
class=
"item"
v-if=
"data.tzType == 1"
>
<label
class=
"label"
>
NFT类型:
</label>
<RadioGroup
v-model=
"data.type"
@
on-change=
"changeType"
>
<Radio
:label=
"1"
:disabled=
"isDetail || isEdit || isAgain"
style=
"width: 200px"
>
单个,不可拷贝
</Radio
>
<Option
:value=
"item.labelName"
v-for=
"(item, index) of nftList"
:key=
"`rate-option-$
{index}`"
@click.native="handleNFT(item)"
>
{{
item
.
labelName
}}
</Option
>
</Select>
</div>
<!--
<div
class=
"item"
>
<label
class=
"label"
>
商品通证:
</label>
<RadioGroup
v-model=
"data.commodityPass"
>
<Radio
:label=
"0"
style=
"width:200px"
:disabled=
"isDetail || isEdit"
>
否
</Radio>
<Radio
:label=
"1"
style=
"width:200px"
:disabled=
"isDetail || isEdit"
>
是,自动生成Token
</Radio>
<Radio
:label=
"2"
style=
"width:200px"
:disabled=
"isDetail || isEdit"
>
是,使用外部既有Token
</Radio>
</RadioGroup>
</div>
-->
<div
class=
"item"
style=
"text-align:center"
>
<Button
type=
"primary"
style=
"margin:auto"
@
click=
"genSkuTable"
>
生成价目表
</Button>
</div>
<!--
<div
class=
"tip"
v-if=
"!isDetail && !isEdit"
>
提示:如修改上述基本属性后,需重新生成价目表!缩略图建议尺寸100 *
100,大小不得超过6MB
</div>
-->
<Table
v-if=
"showTable"
border
:columns=
"columns"
:data=
"data.sku"
>
<template
slot-scope=
"
{ row, index }" slot="originalPrice">
<span
v-if=
"isDetail"
>
{{
row
.
originalPrice
}}
</span>
<Radio
:label=
"2"
:disabled=
"isDetail || isEdit || isAgain"
style=
"width: 200px"
>
可拷贝
</Radio
>
</RadioGroup>
</div>
<div
class=
"item"
v-if=
"data.type == 2"
>
<label
class=
"label"
>
发行数量:
</label>
<Input
v-else
placeholder=
"单位(RMB)"
:value=
"row.originalPrice"
@
on-change=
"handleInputChange(index, 'originalPrice')"
type=
"number"
:readonly=
"isDetail"
v-model=
"data.number"
:readonly=
"isDetail || isEdit || isAgain"
placeholder=
"请输入发行数量,正整数"
style=
"width: 400px"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"stock
"
>
<
span
v-if=
"isDetail"
>
{{
row
.
stock
}}
</span
>
</
div
>
<
div
class=
"item"
v-if=
"data.tzType == 2
"
>
<
label
class=
"label"
>
绑定NFT:
</label
>
<Input
v-else
placeholder=
"整数值"
:value=
"row.stock"
@
on-change=
"handleInputChange(index, 'stock')"
@
on-blur=
"onBlur(index,row)"
type=
"number"
:readonly=
"isDetail"
:maxlength=
"9"
v-model=
"data.tokenId"
v-if=
"isDetail || isEdit || isAgain"
:readonly=
"isDetail || isEdit || isAgain"
style=
"width: 400px"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"coinName"
>
<template
v-if=
"isDetail || isEdit||data.sku[index].status==1"
>
<label
class=
"coinName-label"
>
{{
(
row
.
coinNamePrefix
+
row
.
coinName
)
||
'--'
}}
</label>
</
template
>
<
template
v-else
>
<div
v-if=
"data.commodityPass == 0"
>
<label>
--
</label>
</div>
<div
v-if=
"data.commodityPass == 1"
>
<label
class=
"coinName-label"
>
{{
coinNamePrefix
}}
</label>
<!--
<label
class=
"coinName-label"
style=
"color: #ed4014"
>
+
</label
>
-->
<Input
placeholder=
"2-10位大写字母或数字"
:value=
"row.coinName"
@
on-change=
"handleInputChange(index, 'coinName')"
@
on-blur=
"handleInputBlur(index, 'coinName')"
style=
"width: 140px"
:disabled=
"isDetail||data.sku[index].status==1"
:maxlength=
"10"
/>
</div>
<div
v-if=
"data.commodityPass ==2"
>
<label
class=
"coinName-label"
>
{{
coinNamePrefix
}}
</label>
<Select
:transfer=
true
v-model=
"data.sku[index].name"
@
on-change=
"getMoreParams(data.sku[index].name,index)"
style=
"width: 140px;"
>
<Select
v-else
placeholder=
"请选择NFT TOKENID"
transfer
v-model=
"data.tokenId"
style=
"width: 200px"
>
<Option
v-for=
"(item, index) of seriesList"
:value=
"JSON.stringify(item)"
:key=
"'series-option-' + index"
:value=
"item.labelName"
v-for=
"(item, index) of nftList"
:key=
"`rate-option-$
{index}`"
@click.native="handleNFT(item)"
>
{{
item
.
labelName
}}
</Option
>
</Select>
</div>
</
template
>
</template>
<
template
slot-scope=
"{ row, index }"
slot=
"weight"
>
<span
v-if=
"isDetail"
>
{{
row
.
weight
}}
</span>
<div
class=
"item"
>
<label
class=
"label"
>
库存:
</label>
<Input
v-else
placeholder=
"单位(KG)"
:value=
"row.weight"
@
on-change=
"handleInputChange(index, 'weight')"
type=
"number"
v-model=
"data.stock"
:readonly=
"isDetail"
placeholder=
"请输入库存,正整数"
type=
"number"
:maxlength=
"9"
@
on-change=
"inputChangeStock($event)"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"image"
>
<file-upload
:ref=
"'fileUpload' + index"
:width=
"46"
style=
"margin-top: 5px"
v-model=
"data.sku[index].upload.imageList"
@
input=
"handleUploadInput($event, index)"
:maxNum=
"1"
:defaultList=
"data.sku[index].upload.defaultImgList"
:readonly=
"isDetail"
showWatch
:iconSize=
"16"
/>
</
template
>
</div>
</
template
>
<
template
v-if=
"data.salesType === 4"
>
<div
class=
"item"
style=
"text-align: center"
>
<label
class=
"label"
>
规格列表:
</label>
<Table
border
:columns=
"columns"
:data=
"data.sku"
>
<template
slot-scope=
"
{ row, index }" slot="name">
<span
v-if=
"isDetail"
>
{{
row
.
name
}}
</span>
<Input
v-else
placeholder=
"规格名称"
:value=
"row.name"
@
on-change=
"handleInputChange(index, 'name')"
:readonly=
"isDetail"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"image"
>
<file-upload
:ref=
"'fileUpload' + index"
:width=
"46"
style=
"margin-top: 5px"
v-model=
"data.sku[index].upload.imageList"
@
input=
"handleUploadInput($event, index)"
:maxNum=
"1"
:defaultList=
"data.sku[index].upload.defaultImgList"
:readonly=
"isDetail"
showWatch
:iconSize=
"16"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"weight"
>
<span
v-if=
"isDetail"
>
{{
row
.
weight
}}
</span>
<Input
v-else
placeholder=
"单位(KG)"
:value=
"row.weight"
@
on-change=
"handleInputChange(index, 'weight')"
type=
"number"
:readonly=
"isDetail"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"stock"
>
<span
v-if=
"isDetail"
>
{{
row
.
stock
}}
</span>
<Input
v-else
placeholder=
"整数值"
:value=
"row.stock"
@
on-change=
"handleInputChange(index, 'stock')"
@
on-blur=
"onBlur(index, row)"
type=
"number"
:readonly=
"isDetail"
:maxlength=
"9"
/>
</
template
>
<
template
slot-scope=
"{ row, index }"
slot=
"coinName"
>
<template
v-if=
"isDetail || isEdit || data.sku[index].status == 1"
>
<label
class=
"coinName-label"
>
{{
row
.
coinNamePrefix
+
row
.
coinName
||
"--"
}}
</label>
</
template
>
<
template
v-else
>
<div
v-if=
"data.commodityPass == 1"
>
<label>
内部生成
</label>
</div>
<div
v-if=
"data.commodityPass == 0"
>
<label
class=
"coinName-label"
>
{{
coinNamePrefix
}}
</label>
<!--
<label
class=
"coinName-label"
style=
"color: #ed4014"
>
+
</label
>
-->
<Input
placeholder=
"2-10位大写字母或数字"
:value=
"row.coinName"
@
on-change=
"handleInputChange(index, 'coinName')"
@
on-blur=
"handleInputBlur(index, 'coinName')"
style=
"width: 140px"
:disabled=
"isDetail || data.sku[index].status == 1"
:maxlength=
"10"
/>
</div>
<div
v-if=
"data.commodityPass == 2"
>
<label
class=
"coinName-label"
>
{{
coinNamePrefix
}}
</label>
<Select
:transfer=
"true"
v-model=
"data.sku[index].name"
@
on-change=
"getMoreParams(data.sku[index].name, index)"
style=
"width: 140px"
>
<Option
v-for=
"(item, index) of seriesList"
:value=
"JSON.stringify(item)"
:key=
"'series-option-' + index"
>
{{
item
.
labelName
}}
</Option
>
</Select>
</div>
</
template
>
</template>
<
template
slot-scope=
"{ row, index }"
slot=
"isHide"
>
<span
v-if=
"isDetail"
>
{{
row
.
isHide
?
"是"
:
"否"
}}
</span>
<Checkbox
v-model=
"row.isHide"
@
on-change=
"changIsHidden($event, index)"
></Checkbox>
</
template
>
<
template
slot-scope=
"{ index }"
slot=
"opt"
>
<Button
type=
"error"
size=
"small"
@
click=
"delSku(index)"
>
删除
</Button>
</
template
>
</Table>
<div
class=
"item"
style=
"margin-top:40px;"
>
<label
class=
"label"
>
难度系数:
</label>
<Slider
v-model=
"value"
:tip-format=
"format"
style=
"width:500px;"
></Slider>
</div>
<
template
slot-scope=
"{ index }"
slot=
"opt"
>
<Button
type=
"error"
size=
"small"
@
click=
"delSku(index)"
>
删除
</Button
>
</
template
>
</Table>
</div>
<div
class=
"item"
style=
"justify-content: flex-end"
>
<Button
type=
"primary"
style=
"margin: auto"
@
click=
"genSkuTable"
>
添加商品
</Button
>
</div>
<div
class=
"item"
style=
"margin-top: 40px"
>
<label
class=
"label"
>
难度系数:
</label>
<Slider
v-model=
"data.difficulty"
:tip-format=
"format"
:min=
"1"
:max=
"10"
style=
"width: 500px"
></Slider>
</div>
<div
class=
"item"
>
<label
class=
"label"
>
盲盒规则:
</label>
<div
class=
"editor-con"
>
<Spin
fix
v-if=
"editorLoading"
>
<Icon
type=
"ios-loading"
size=
"30"
color=
"#2d8cf0"
class=
"spin-icon-load"
></Icon>
<div>
上传中( {{ editorUploadPercent }}% )...
</div>
</Spin>
<quill-editor
v-model=
"data.blindBoxRule"
ref=
"myQuillEditor"
:options=
"editorOption"
class=
"detail-editor"
v-show=
"!isDetail"
></quill-editor>
<div
v-show=
"isDetail"
v-html=
"data.blindBoxRule"
class=
"describt-detail"
></div>
</div>
</div>
<Upload
:action=
"uploadImgUrl"
ref=
"uploadImg"
v-show=
"false"
:headers=
"{
token: $store.state.admin.token,
adminId: $store.state.admin.uid,
}"
:before-upload=
"imgBoforeUpload"
:on-progress=
"uploadOnProgress"
:on-success=
"imgUploadSuccess"
:on-error=
"imgUploadErr"
accept=
".jpg, .jpeg, .png, .gif"
/>
<Upload
:action=
"uploadVideoUrl"
ref=
"uploadVideo"
v-show=
"false"
:headers=
"{
token: $store.state.admin.token,
adminId: $store.state.admin.uid,
}"
:before-upload=
"videoBoforeUpload"
:on-progress=
"uploadOnProgress"
:on-success=
"videoUploadSuccess"
:on-error=
"videoUploadErr"
accept=
".mp4, .mkv"
/>
</template>
</info-con>
</template>
<
script
>
import
InfoCon
from
'./info-con'
import
FileUpload
from
'_c/file-upload'
import
{
uploadImgUrl
,
uploadVideoUrl
}
from
'@/api/apiConfig'
import
{
apiVerify
}
from
'@/api/apiVerify'
import
{
getPosterFromVideoUrl
}
from
'@/libs/tools'
export
default
{
props
:
{
data
:
{
...
...
@@ -245,7 +376,8 @@ export default {
type
:
''
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
''
,
// 1.内部发行 2.外部绑定
tokenId
:
''
,
// 绑定的外部通证id
salesType
:
''
// 销售模式
salesType
:
2
,
// 销售模式
difficulty
:
1
},
isDetail
:
{
type
:
Boolean
,
...
...
@@ -258,9 +390,7 @@ export default {
isAgain
:
{
type
:
Boolean
,
default
:
false
},
status
:
''
}
},
components
:
{
InfoCon
,
...
...
@@ -269,26 +399,51 @@ export default {
data
()
{
return
{
propList
:
[{
name
:
''
,
valList
:
[{
val
:
''
}]
}],
showTable
:
false
,
columns
:
[],
coinNamePrefix
:
''
,
seriesList
:
[{
}],
seriesList
:
[{}],
name
:
''
,
tokenNumber
:
''
,
numberStock
:
''
,
// rateList: [3, 4, 5, 6, 9, 10, 11, 13],
value
:
3
,
nftList
:
[]
difficulty
:
1
,
nftList
:
[],
uploadImgUrl
,
uploadVideoUrl
,
editorOption
:
{
placeholder
:
'请输入内容...'
,
modules
:
{
toolbar
:
[
[
'bold'
,
'italic'
,
{
header
:
2
},
'blockquote'
,
{
list
:
'ordered'
},
{
list
:
'bullet'
},
{
align
:
[]
}
],
[
'image'
,
'video'
]
]
}
},
editorLoading
:
false
,
editorUploadPercent
:
0
}
},
computed
:
{
platform
()
{
return
this
.
$store
.
state
.
admin
.
type
==
1
||
this
.
$store
.
state
.
admin
.
type
==
4
return
(
this
.
$store
.
state
.
admin
.
type
==
1
||
this
.
$store
.
state
.
admin
.
type
==
4
)
},
editor
()
{
return
this
.
$refs
.
myQuillEditor
.
quill
}
},
mounted
()
{
this
.
editor
.
getModule
(
'toolbar'
).
addHandler
(
'image'
,
this
.
imgHandler
)
this
.
editor
.
getModule
(
'toolbar'
).
addHandler
(
'video'
,
this
.
videoHandler
)
this
.
genPropList
(
this
.
data
.
sku
)
this
.
genColumn
()
this
.
getNftList
()
...
...
@@ -298,7 +453,7 @@ export default {
if
(
!
this
.
platform
)
{
this
.
getunbindToken
()
}
this
.
data
.
sku
.
forEach
(
item
=>
{
this
.
data
.
sku
.
forEach
(
(
item
)
=>
{
this
.
numberStock
=
item
.
stock
if
(
this
.
isAgain
)
{
item
.
republish
=
false
...
...
@@ -307,17 +462,26 @@ export default {
item
.
coinName
=
item
.
coinName
.
substring
(
4
)
// console.log('coinName', item.coinName)
})
this
.
showTable
=
true
setTimeout
(()
=>
{
})
setTimeout
(()
=>
{})
},
methods
:
{
inputChangeStock
(
e
)
{
this
.
data
.
stock
=
e
.
target
.
value
},
changeTzType
()
{
this
.
data
.
type
=
''
this
.
data
.
number
=
''
this
.
data
.
tokenId
=
''
},
changeSalesType
(
val
)
{
if
(
val
===
4
)
{
if
(
this
.
data
.
sku
.
length
==
0
||
!
this
.
data
.
sku
)
{
this
.
genSkuTable
()
}
}
else
{
this
.
data
.
salesType
=
val
}
},
changeType
()
{
this
.
data
.
number
=
''
},
...
...
@@ -332,25 +496,40 @@ export default {
})
},
format
(
val
)
{
return
'难度系数: '
+
val
+
'
%
'
return
'难度系数: '
+
val
+
''
},
getMoreParams
(
val
,
index
)
{
val
=
JSON
.
parse
(
val
)
this
.
tokenNumber
=
val
.
availableNumber
this
.
data
.
sku
[
index
].
stock
=
''
},
changIsHidden
(
val
,
index
)
{
this
.
data
.
sku
[
index
].
isHide
=
val
},
onBlur
(
index
,
val
)
{
// console.log('4444', this.data.commodityPass)
if
(
!
this
.
isEdit
&&
JSON
.
parse
(
val
.
stock
)
>
this
.
tokenNumber
&&
this
.
data
.
commodityPass
==
2
)
{
if
(
!
this
.
isEdit
&&
JSON
.
parse
(
val
.
stock
)
>
this
.
tokenNumber
&&
this
.
data
.
commodityPass
==
2
)
{
this
.
data
.
sku
[
index
].
stock
=
parseInt
(
this
.
tokenNumber
)
return
this
.
$Notice
.
warning
({
title
:
`填写库存过多 (实际数量:
${
parseInt
(
this
.
tokenNumber
)}
)`
})
return
this
.
$Notice
.
warning
({
title
:
`填写库存过多 (实际数量:
${
parseInt
(
this
.
tokenNumber
)}
)`
})
}
if
(
this
.
isEdit
&&
this
.
data
.
commodityPass
==
2
)
{
let
number
=
JSON
.
parse
(
val
.
stock
)
-
this
.
numberStock
// + this.data.sku[index].balanceNum
if
(
number
>
this
.
data
.
sku
[
index
].
balanceNum
)
{
this
.
data
.
sku
[
index
].
stock
=
parseInt
(
this
.
numberStock
+
this
.
data
.
sku
[
index
].
balanceNum
)
return
this
.
$Notice
.
warning
({
title
:
`填写库存过多 (实际数量:
${
parseInt
(
this
.
numberStock
+
this
.
data
.
sku
[
index
].
balanceNum
)}
)`
})
this
.
data
.
sku
[
index
].
stock
=
parseInt
(
this
.
numberStock
+
this
.
data
.
sku
[
index
].
balanceNum
)
return
this
.
$Notice
.
warning
({
title
:
`填写库存过多 (实际数量:
${
parseInt
(
this
.
numberStock
+
this
.
data
.
sku
[
index
].
balanceNum
)}
)`
})
}
}
},
...
...
@@ -508,9 +687,10 @@ export default {
// if (typeof this.data.commodityPass !== 'number') {
// return this.$Notice.warning({ title: '请先选择商品通证' })
// }
this
.
genColumn
()
if
(
!
this
.
columns
||
!
this
.
columns
.
length
===
0
)
{
this
.
genColumn
()
}
this
.
genSku
()
this
.
showTable
=
true
// }
},
genColumn
()
{
...
...
@@ -529,9 +709,16 @@ export default {
width
:
240
,
align
:
'center'
})
columns
.
push
({
title
:
'重量(KG)'
,
slot
:
'weight'
,
width
:
130
,
align
:
'center'
})
columns
.
push
({
title
:
'
价格(¥)
'
,
slot
:
'
originalPrice
'
,
title
:
'
库存
'
,
slot
:
'
stock
'
,
width
:
160
,
align
:
'center'
})
...
...
@@ -542,24 +729,12 @@ export default {
align
:
'center'
})
columns
.
push
({
title
:
'重量(KG)'
,
slot
:
'weight'
,
width
:
130
,
align
:
'center'
})
columns
.
push
({
title
:
'库存'
,
slot
:
'stock'
,
width
:
160
,
title
:
'是否是隐藏款'
,
slot
:
'isHide'
,
width
:
110
,
align
:
'center'
})
// columns.push({
// title: '税率',
// slot: 'rate',
// width: 110,
// align: 'center'
// })
// columns.push({
// title: '类型编码',
// slot: 'typeCode',
// width: 200,
...
...
@@ -581,14 +756,6 @@ export default {
align
:
'center'
})
}
// if (this.isDetail && this.isSelf) {
// columns.push({
// title: '操作',
// slot: 'opt2',
// width: 100,
// align: 'center'
// })
// }
this
.
columns
=
columns
},
genSku
()
{
...
...
@@ -596,8 +763,11 @@ export default {
this
.
propList
.
forEach
((
item
)
=>
{
resArr
=
this
.
genSkuData
(
item
,
resArr
)
})
this
.
data
.
sku
=
resArr
if
(
this
.
data
.
sku
.
length
===
0
)
{
this
.
data
.
sku
=
resArr
}
else
{
this
.
data
.
sku
=
[...
this
.
data
.
sku
,
...
resArr
]
}
},
genSkuData
(
prop
,
resArr
)
{
let
newArr
=
[]
...
...
@@ -616,13 +786,12 @@ export default {
// availableNumber: '',
image
:
''
,
propertyList
,
// rate: 0,
// typeCode: '',
weight
:
''
,
upload
:
{
imageList
:
[],
defaultImgList
:
[]
}
},
isHide
:
false
})
})
// console.log('newArr1', newArr)
...
...
@@ -630,7 +799,9 @@ export default {
resArr
.
forEach
((
rItem
)
=>
{
valList
.
forEach
((
vItem
)
=>
{
let
newItem
=
{
...
rItem
,
[
name
]:
vItem
.
val
}
newItem
.
propertyList
=
JSON
.
parse
(
JSON
.
stringify
(
newItem
.
propertyList
))
newItem
.
propertyList
=
JSON
.
parse
(
JSON
.
stringify
(
newItem
.
propertyList
)
)
newItem
.
propertyList
.
push
({
propKey
:
name
,
propVal
:
vItem
.
val
...
...
@@ -646,6 +817,79 @@ export default {
}
// console.log('newArr', newArr)
return
newArr
},
imgHandler
(
image
)
{
if
(
image
)
{
this
.
$refs
.
uploadImg
.
$el
.
querySelector
(
'[type=file]'
).
click
()
}
},
videoHandler
(
video
)
{
if
(
video
)
{
this
.
$refs
.
uploadVideo
.
$el
.
querySelector
(
'[type=file]'
).
click
()
}
},
uploadOnProgress
(
event
,
file
,
fileList
)
{
this
.
editorUploadPercent
=
parseFloat
(
event
.
percent
).
toFixed
(
1
)
},
imgBoforeUpload
(
file
)
{
if
(
file
.
size
>=
5
*
1024
*
1024
)
{
this
.
$Notice
.
warning
({
title
:
'上传图片不得超过5MB!'
})
return
false
}
this
.
editorUploadPercent
=
0
this
.
editorLoading
=
true
},
imgUploadSuccess
(
res
,
file
,
fileList
)
{
this
.
editorLoading
=
false
apiVerify
({
res
:
{
data
:
res
},
success
:
()
=>
{
let
url
=
res
.
data
let
addImageRange
=
this
.
editor
.
getSelection
()
let
newRange
=
0
+
(
addImageRange
!==
null
?
addImageRange
.
index
:
0
)
this
.
editor
.
insertEmbed
(
newRange
,
'simpleImg'
,
{
url
,
width
:
'100%'
})
this
.
editor
.
setSelection
(
1
+
newRange
)
}
})
},
imgUploadErr
()
{
this
.
editorLoading
=
false
this
.
$Notice
.
error
({
title
:
'上传失败,请稍后再试!'
})
},
videoBoforeUpload
(
file
)
{
if
(
file
.
size
>=
50
*
1024
*
1024
)
{
this
.
$Notice
.
warning
({
title
:
'上传视频不得超过50MB!'
})
return
false
}
this
.
editorUploadPercent
=
0
this
.
editorLoading
=
true
},
videoUploadSuccess
(
res
,
file
,
fileList
)
{
this
.
editorLoading
=
false
apiVerify
({
res
:
{
data
:
res
},
success
:
()
=>
{
let
url
=
res
.
data
let
addVideoRange
=
this
.
editor
.
getSelection
()
let
newRange
=
0
+
(
addVideoRange
!==
null
?
addVideoRange
.
index
:
0
)
this
.
editor
.
insertEmbed
(
newRange
,
'simpleVideo'
,
{
url
,
controls
:
'controls'
,
width
:
'100%'
,
poster
:
getPosterFromVideoUrl
(
url
)
})
this
.
editor
.
setSelection
(
1
+
newRange
)
}
})
},
videoUploadErr
()
{
this
.
editorLoading
=
false
this
.
$Notice
.
error
({
title
:
'上传失败,请稍后再试!'
})
}
}
}
...
...
@@ -660,8 +904,10 @@ export default {
}
.item .label {
width: 140px;
// min-width: 140px;
margin-right: 10px;
text-align: right;
flex-shrink: 0;
}
.item .property-con {
flex: 1;
...
...
@@ -705,5 +951,35 @@ export default {
.token-label {
font-size: 14px;
}
.item .editor-con {
position: relative;
width: 600px;
.spin-icon-load {
animation: ani-demo-spin 1s linear infinite;
}
.ivu-spin {
border: 1px solid #dcdee2;
border-radius: 5px;
}
.describt-detail {
width: 100%;
height: 800px;
overflow-y: auto;
padding: 10px;
border: 1px solid #dcdee2;
border-radius: 5px;
}
}
.detail-editor {
> .ql-toolbar {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
> .ql-container {
height: 800px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
}
}
</
style
>
src/view/good-mgr/product-list.vue
View file @
3fe1f073
...
...
@@ -164,6 +164,10 @@ export default {
{
series_id
:
8
,
series_name
:
'已取消'
},
{
series_id
:
9
,
series_name
:
'草稿'
}
],
...
...
@@ -335,12 +339,29 @@ export default {
style
:
{
margin
:
'5px'
,
// display: this.isBrand ? 'inline-block' : 'none'
display
:
status
==
OffShelfType
.
OFFERING
?
'inline-block'
:
'none'
display
:
status
==
OffShelfType
.
SHELVES
?
'inline-block'
:
'none'
}
},
'编 辑'
)
let
draftBtn
=
h
(
'Button'
,
{
props
:
{
type
:
'primary'
,
size
:
'small'
},
on
:
{
click
:
this
.
handleDraft
(
params
.
row
)
},
style
:
{
margin
:
'5px'
,
// display: this.isBrand ? 'inline-block' : 'none'
display
:
(
status
==
OffShelfType
.
DRAFT
||
status
==
OffShelfType
.
OFFERING
||
status
==
OffShelfType
.
CHECK_FAIL
||
status
==
OffShelfType
.
FAIL
)
?
'inline-block'
:
'none'
}
},
'编 辑'
)
let
offShelfBtn
=
h
(
'Button'
,
{
...
...
@@ -409,7 +430,7 @@ export default {
},
'重新发布'
)
return
h
(
'div'
,
[
detailBtn
,
!
this
.
platform
&&
editBtn
,
offShelfBtn
,
!
this
.
platform
&&
cancelBtn
,
!
this
.
platform
&&
againBtn
,
!
this
.
platform
&&
delBtn
])
return
h
(
'div'
,
[
detailBtn
,
!
this
.
platform
&&
editBtn
,
offShelfBtn
,
!
this
.
platform
&&
cancelBtn
,
!
this
.
platform
&&
againBtn
,
!
this
.
platform
&&
d
raftBtn
,
!
this
.
platform
&&
d
elBtn
])
}
}
],
...
...
@@ -532,6 +553,13 @@ export default {
this
.
$router
.
push
({
name
:
row
.
commodityPass
==
3
?
'commodity_again_good'
:
'again_good'
,
query
})
}
},
handleDraft
(
row
)
{
return
()
=>
{
console
.
log
(
row
)
let
query
=
{
goodsId
:
row
.
goodsId
}
this
.
$router
.
push
({
name
:
row
.
commodityPass
==
3
?
'commodity_draft_good'
:
'draft_good'
,
query
})
}
},
handleDetail
(
row
)
{
return
()
=>
{
let
query
=
{
goodsId
:
row
.
goodsId
}
...
...
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