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
3808ff71
Commit
3808ff71
authored
Mar 03, 2022
by
verestrasz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f0901f14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
370 additions
and
357 deletions
+370
-357
index.vue
src/view/good-mgr/add-good/index.vue
+361
-352
sale-info.vue
src/view/good-mgr/add-good/sale-info.vue
+9
-5
No files found.
src/view/good-mgr/add-good/index.vue
View file @
3808ff71
...
...
@@ -25,6 +25,7 @@
:isEdit=
"isEdit"
:isAgain=
"isAgain"
:isSelf=
"isSelf"
:isDraft=
"isDraft"
:status=
"status"
/>
<info-con
...
...
@@ -369,362 +370,362 @@
</
template
>
<
script
>
import
BaseInfo
from
'./base-info'
import
SaleInfo
from
'./sale-info'
import
DeciptInfo
from
'./decpit-info'
import
{
getPosterFromVideoUrl
}
from
'@/libs/tools'
import
{
mapMutations
}
from
'vuex'
import
InfoCon
from
'./info-con'
import
{
formatTime
}
from
'../../../libs/ali-oss'
import
BaseInfo
from
"./base-info"
;
import
SaleInfo
from
"./sale-info"
;
import
DeciptInfo
from
"./decpit-info"
;
import
{
getPosterFromVideoUrl
}
from
"@/libs/tools"
;
import
{
mapMutations
}
from
"vuex"
;
import
InfoCon
from
"./info-con"
;
import
{
formatTime
}
from
"../../../libs/ali-oss"
;
export
default
{
name
:
'add_good'
,
name
:
"add_good"
,
components
:
{
BaseInfo
,
SaleInfo
,
DeciptInfo
,
InfoCon
InfoCon
,
},
computed
:
{
title
()
{
if
(
this
.
routeName
===
'update_good'
)
{
return
'编辑商品 - 填写商品信息'
}
else
if
(
this
.
routeName
==
'good_detail'
)
{
return
'商品详情'
title
()
{
if
(
this
.
routeName
===
"update_good"
)
{
return
"编辑商品 - 填写商品信息"
;
}
else
if
(
this
.
routeName
==
"good_detail"
)
{
return
"商品详情"
;
// this.isSelf // : `商品详情( 品牌商:${this.form.brandName} )`
}
else
if
(
this
.
routeName
===
'again_good'
)
{
return
'重新发布商品 - 填写商品信息'
}
else
if
(
this
.
routeName
===
"again_good"
)
{
return
"重新发布商品 - 填写商品信息"
;
}
else
{
return
'发布商品 - 填写商品信息'
return
"发布商品 - 填写商品信息"
;
}
},
isDetail
()
{
return
this
.
routeName
===
'good_detail'
isDetail
()
{
return
this
.
routeName
===
"good_detail"
;
},
isAdd
()
{
return
this
.
routeName
===
'add_good'
isAdd
()
{
return
this
.
routeName
===
"add_good"
;
},
isEdit
()
{
return
this
.
routeName
===
'update_good'
isEdit
()
{
return
this
.
routeName
===
"update_good"
;
},
isAgain
()
{
return
this
.
routeName
===
'again_good'
isAgain
()
{
return
this
.
routeName
===
"again_good"
;
},
isDraft
()
{
return
this
.
routeName
===
'draft_good'
isDraft
()
{
return
this
.
routeName
===
"draft_good"
;
},
isSelf
()
{
return
this
.
form
.
brandId
===
this
.
$store
.
state
.
admin
.
brandId
isSelf
()
{
return
this
.
form
.
brandId
===
this
.
$store
.
state
.
admin
.
brandId
;
},
status
()
{
return
this
.
form
.
baseInfo
.
type
;
},
status
()
{
return
this
.
form
.
baseInfo
.
type
}
},
data
()
{
data
()
{
return
{
routeName
:
''
,
routeName
:
""
,
delayDeliveryDisabled
:
false
,
form
:
{
brandId
:
''
,
brandName
:
''
,
goodsId
:
''
,
brandId
:
""
,
brandName
:
""
,
goodsId
:
""
,
// templateId: '',
baseInfo
:
{
name
:
''
,
// 商品名称
description
:
''
,
// 商品描述
prop
:
[{
name
:
''
,
val
:
''
}],
// 商品属性
name
:
""
,
// 商品名称
description
:
""
,
// 商品描述
prop
:
[{
name
:
""
,
val
:
""
}],
// 商品属性
categoryId
:
[],
// 类目选择
type
:
'6'
// 商品类型
type
:
"6"
,
// 商品类型
},
saleInfo
:
{
sku
:
[],
imgObj
:
{},
commodityPass
:
1
,
number
:
''
,
// 发行数量:只有商户选择“可拷贝”时,才会出现
price
:
''
,
// 商品价格
type
:
''
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
''
,
// 1.内部发行 2.外部绑定
tokenId
:
''
,
// 绑定的外部通证id
number
:
""
,
// 发行数量:只有商户选择“可拷贝”时,才会出现
price
:
""
,
// 商品价格
type
:
""
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
""
,
// 1.内部发行 2.外部绑定
tokenId
:
""
,
// 绑定的外部通证id
salesType
:
4
,
// 销售模式
difficulty
:
3
,
isHide
:
false
,
stock
:
0
,
blindBoxRule
:
''
//
stock: 0,
blindBoxRule
:
""
,
// statu:this.status
},
deciptInfo
:
{
video
:
''
,
video
:
""
,
videoList
:
[],
nftFile
:
''
,
nftFile
:
""
,
nftEnclosureList
:
[],
videoThumb
:
''
,
thumb
:
''
,
videoThumb
:
""
,
thumb
:
""
,
thumbList
:
[],
detailPictures
:
[],
detailDescribe
:
''
,
detailDescribe
:
""
,
defaultDetailPicture
:
[],
defaultVideoList
:
[],
defaultThumbList
:
[],
defaultNftEnclosureList
:
[]
defaultNftEnclosureList
:
[]
,
// statu:this.status
},
returnType
:
'0'
,
// 退货类型
returnReason
:
''
,
// 退货理由
note
:
''
,
// 商品备注
buyerDeposit
:
''
,
// 买家保证金
priceIncrease
:
''
,
// 出价最小增幅
endTime
:
''
,
// 结束时间
deposit
:
''
,
// 首付比例
depositType
:
''
,
// 首付比例类型
drawStartTime
:
''
,
// 预计提货开始时间
drawEndTime
:
''
,
// 预计提货结束时间
saleStartTime
:
''
,
// 预售开始时间
saleEndTime
:
''
,
// 预售结束时间
stock
:
''
,
// 积分库存
pnum
:
''
,
// 积分数量
traceabilityNumber
:
''
,
// 溯源编号
returnType
:
"0"
,
// 退货类型
returnReason
:
""
,
// 退货理由
note
:
""
,
// 商品备注
buyerDeposit
:
""
,
// 买家保证金
priceIncrease
:
""
,
// 出价最小增幅
endTime
:
""
,
// 结束时间
deposit
:
""
,
// 首付比例
depositType
:
""
,
// 首付比例类型
drawStartTime
:
""
,
// 预计提货开始时间
drawEndTime
:
""
,
// 预计提货结束时间
saleStartTime
:
""
,
// 预售开始时间
saleEndTime
:
""
,
// 预售结束时间
stock
:
""
,
// 积分库存
pnum
:
""
,
// 积分数量
traceabilityNumber
:
""
,
// 溯源编号
delayDelivery
:
false
,
// 延迟提货
packageDTO
:
{
resource
:
[
{
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
goodsId
:
""
,
skuId
:
""
,
number
:
""
,
specificationsList
:
[],
actualNumber
:
''
}
actualNumber
:
""
,
}
,
],
// 打包资源
price
:
''
,
// 打包价格
stock
:
''
// 库存
price
:
""
,
// 打包价格
stock
:
""
,
// 库存
},
nftdto
:
{
number
:
''
,
// 发行数量:只有商户选择“可拷贝”时,才会出现
price
:
''
,
// 商品价格
type
:
''
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
''
,
// 1.内部发行 2.外部绑定
tokenId
:
''
// 绑定的外部通证id
}
number
:
""
,
// 发行数量:只有商户选择“可拷贝”时,才会出现
price
:
""
,
// 商品价格
type
:
""
,
// NFT类型(1.单个,不可考贝 2.可拷贝)
tzType
:
""
,
// 1.内部发行 2.外部绑定
tokenId
:
""
,
// 绑定的外部通证id
}
,
},
skuNumber
:
''
,
skuNumber
:
""
,
loading
:
true
,
expressList
:
[],
profitList
:
[],
integralMerchantNameList
:
[],
specificationsList
:
[],
idx
:
''
,
fixedProportion
:
''
,
fixedAmount
:
''
,
idx
:
""
,
fixedProportion
:
""
,
fixedAmount
:
""
,
nftList
:
[],
submitLoading
:
false
,
startOption
:
{
// 指定开始限制时间
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
;
}
,
},
endOption
:
{
// 指定终止日期
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
;
}
,
},
drawStartOption
:
{
// 指定开始限制时间
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
;
}
,
},
drawEndOption
:
{
// 指定终止日期
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
;
}
,
},
buyEndOption
:
{
// 指定终止日期
disabledDate
:
(
date
)
=>
{
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
}
return
date
&&
date
.
valueOf
()
<
Date
.
now
()
-
86400000
;
}
,
},
draftLoading
:
false
}
draftLoading
:
false
,
}
;
},
methods
:
{
...
mapMutations
([
'closeTag'
]),
addAge
()
{
...
mapMutations
([
"closeTag"
]),
addAge
()
{
this
.
form
.
packageDTO
.
resource
.
push
({
integralMerchantNameList
:
[],
goodsId
:
''
,
skuId
:
''
,
number
:
''
,
goodsId
:
""
,
skuId
:
""
,
number
:
""
,
specificationsList
:
[],
actualNumber
:
''
})
actualNumber
:
""
,
})
;
},
changeTzType
()
{
this
.
form
.
nftdto
.
type
=
''
this
.
form
.
nftdto
.
number
=
''
this
.
form
.
nftdto
.
tokenId
=
''
changeTzType
()
{
this
.
form
.
nftdto
.
type
=
""
;
this
.
form
.
nftdto
.
number
=
""
;
this
.
form
.
nftdto
.
tokenId
=
""
;
},
changeType
()
{
this
.
form
.
nftdto
.
number
=
''
changeType
()
{
this
.
form
.
nftdto
.
number
=
""
;
},
delAge
(
index
)
{
this
.
form
.
packageDTO
.
resource
.
splice
(
index
,
1
)
delAge
(
index
)
{
this
.
form
.
packageDTO
.
resource
.
splice
(
index
,
1
)
;
},
handleNFT
(
val
)
{
console
.
log
(
val
)
this
.
form
.
nftdto
.
number
=
val
.
availableNumber
handleNFT
(
val
)
{
console
.
log
(
val
)
;
this
.
form
.
nftdto
.
number
=
val
.
availableNumber
;
},
handleSearch
(
goodsInfo
,
index
)
{
handleSearch
(
goodsInfo
,
index
)
{
if
(
!
goodsInfo
)
{
return
this
.
$Message
.
warning
(
'请先输入资源编号以便查询!'
)
return
this
.
$Message
.
warning
(
"请先输入资源编号以便查询!"
);
}
this
.
api
({
apiName
:
'spugetbyvague'
,
apiName
:
"spugetbyvague"
,
postdata
:
goodsInfo
,
success
:
(
res
)
=>
{
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
=
res
.
data
res
.
data
;
if
(
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
.
length
===
1
)
{
let
goodsId
=
this
.
form
.
packageDTO
.
resource
[
index
].
integralMerchantNameList
[
0
]
.
goodsId
.
goodsId
;
this
.
api
({
apiName
:
'skugetbygoodsId'
,
apiName
:
"skugetbygoodsId"
,
postdata
:
goodsId
,
success
:
(
res
)
=>
{
let
arr
=
[]
let
arr
=
[]
;
let
list
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
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
return
x
.
skuId
===
item
.
skuId
;
})
)
{
item
.
stock
=
list
.
find
((
x
)
=>
{
return
x
.
skuId
===
item
.
skuId
}).
stock
return
x
.
skuId
===
item
.
skuId
;
}).
stock
;
}
arr
.
push
(
item
)
arr
.
push
(
item
)
;
}
}
else
{
arr
=
res
.
data
arr
=
res
.
data
;
}
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
=
arr
}
})
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
=
arr
;
}
,
})
;
}
}
})
}
,
})
;
},
handleSpecifications
(
idx
,
index
)
{
this
.
idx
=
idx
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
handleSpecifications
(
idx
,
index
)
{
this
.
idx
=
idx
;
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
)
{
let
title
=
'规格信息不能重复!'
this
.
form
.
packageDTO
.
resource
[
index
].
skuId
=
''
return
this
.
$Notice
.
error
({
title
})
let
title
=
"规格信息不能重复!"
;
this
.
form
.
packageDTO
.
resource
[
index
].
skuId
=
""
;
return
this
.
$Notice
.
error
({
title
})
;
}
}
}
},
onBlur
(
index
,
val
)
{
onBlur
(
index
,
val
)
{
for
(
let
i
=
0
,
len
=
val
.
specificationsList
.
length
;
i
<
len
;
i
++
)
{
if
(
val
.
specificationsList
[
i
].
skuId
===
val
.
skuId
)
{
this
.
idx
=
i
break
this
.
idx
=
i
;
break
;
}
}
let
idx
=
this
.
idx
let
idx
=
this
.
idx
;
this
.
form
.
packageDTO
.
resource
[
index
].
actualNumber
=
this
.
form
.
packageDTO
.
resource
[
index
].
specificationsList
[
idx
].
stock
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
)
;
let
stockNumber
=
JSON
.
parse
(
val
.
number
)
*
this
.
form
.
packageDTO
.
stock
;
if
(
stockNumber
>
this
.
form
.
packageDTO
.
resource
[
index
].
actualNumber
)
{
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
""
;
return
this
.
$Notice
.
warning
({
title
:
`库存*填写的资源量不能超过总资源数量`
})
title
:
`库存*填写的资源量不能超过总资源数量`
,
})
;
}
},
stockBlur
(
val
)
{
let
skuNumber
=
this
.
form
.
packageDTO
.
resource
stockBlur
(
val
)
{
let
skuNumber
=
this
.
form
.
packageDTO
.
resource
;
skuNumber
.
forEach
((
item
,
index
)
=>
{
let
number
=
item
.
number
*
val
let
n
=
NaN
let
number
=
item
.
number
*
val
;
let
n
=
NaN
;
for
(
let
i
=
0
,
len
=
item
.
specificationsList
.
length
;
i
<
len
;
i
++
)
{
if
(
item
.
specificationsList
[
i
].
skuId
===
item
.
skuId
)
{
n
=
i
break
n
=
i
;
break
;
}
}
if
(
number
>
item
.
specificationsList
[
n
].
stock
)
{
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
''
this
.
form
.
packageDTO
.
resource
[
index
].
number
=
""
;
return
this
.
$Notice
.
warning
({
title
:
`库存 * 填写的资源量不能超过总资源数量`
})
title
:
`库存 * 填写的资源量不能超过总资源数量`
,
})
;
}
})
})
;
},
requestOptionData
()
{
requestOptionData
()
{
// 获取快递模板
this
.
api
({
apiName
:
'templateList'
,
apiName
:
"templateList"
,
success
:
(
res
)
=>
{
this
.
expressList
=
res
.
data
}
})
this
.
expressList
=
res
.
data
;
}
,
})
;
},
getNftList
()
{
getNftList
()
{
// 获取外部NFT
this
.
api
({
apiName
:
'externnftlist'
,
apiName
:
"externnftlist"
,
success
:
(
res
)
=>
{
// console.log('333', this.nftList)
this
.
nftList
=
res
.
data
}
})
this
.
nftList
=
res
.
data
;
}
,
})
;
},
getDelayDelivery
()
{
getDelayDelivery
()
{
if
(
!
this
.
isDetail
)
{
this
.
api
({
apiName
:
'merchantDelayDelivery'
,
apiName
:
"merchantDelayDelivery"
,
success
:
(
res
)
=>
{
if
(
res
.
data
==
0
)
{
this
.
delayDeliveryDisabled
=
true
this
.
delayDeliveryDisabled
=
true
;
}
}
})
}
,
})
;
}
},
getTemplateorshopquery
()
{
getTemplateorshopquery
()
{
if
(
this
.
isAdd
)
{
this
.
api
({
apiName
:
'templateorshopquery'
,
success
:
(
res
)
=>
{}
})
apiName
:
"templateorshopquery"
,
success
:
(
res
)
=>
{}
,
})
;
}
},
requestGoodDetail
(
goodsId
)
{
this
.
loading
=
true
requestGoodDetail
(
goodsId
)
{
this
.
loading
=
true
;
this
.
api
({
apiName
:
'getGoodDetail'
,
apiName
:
"getGoodDetail"
,
postdata
:
{
goodsId
},
success
:
(
res
)
=>
{
let
{
...
...
@@ -751,8 +752,8 @@ export default {
blindBoxPrice
,
difficulty
,
goodsNftVO
,
blindBoxRule
}
=
res
.
data
blindBoxRule
,
}
=
res
.
data
;
let
form
=
{
goodsId
:
goodsId
,
blindBoxPrice
,
...
...
@@ -765,39 +766,39 @@ export default {
this
.
isDraft
||
this
.
isEdit
?
JSON
.
parse
(
categoryIds
)
:
categoryName
,
// 类目选择
type
:
type
// 商品类型
type
:
type
,
// 商品类型
},
deciptInfo
:
{
nftFile
:
nftFile
||
''
,
nftFile
:
nftFile
||
""
,
nftEnclosureList
:
nftFile
?
[
nftFile
]
:
[],
video
:
video
||
''
,
video
:
video
||
""
,
videoList
:
video
?
[
video
]
:
[],
thumb
,
thumbList
:
thumb
?
[
thumb
]
:
''
,
thumbList
:
thumb
?
[
thumb
]
:
""
,
detailPictures
:
imgList
?
JSON
.
parse
(
imgList
)
:
[],
detailDescribe
:
detail
,
defaultDetailPicture
:
imgList
?
JSON
.
parse
(
imgList
)
:
[],
defaultVideoList
:
video
?
[
video
]
:
[],
defaultThumbList
:
[
thumb
],
defaultNftEnclosureList
:
nftFile
?
[
nftFile
]
:
[]
defaultNftEnclosureList
:
nftFile
?
[
nftFile
]
:
[]
,
},
returnType
:
returnType
+
''
,
// 退货类型
returnType
:
returnType
+
""
,
// 退货类型
returnReason
:
returnReason
,
// 退货理由
note
:
note
,
// 商品备注
delayDelivery
:
!!
delayDelivery
,
traceabilityNumber
:
traceabilityNumber
}
traceabilityNumber
:
traceabilityNumber
,
}
;
let
saleInfo
=
{
...
goodsNftVO
,
salesType
,
sku
:
[],
blindBoxRule
}
blindBoxRule
,
}
;
if
(
salesType
===
4
)
{
saleInfo
.
commodityPass
=
commodityPass
||
1
saleInfo
.
price
=
blindBoxPrice
||
0
saleInfo
.
difficulty
=
difficulty
||
1
saleInfo
.
commodityPass
=
commodityPass
||
1
;
saleInfo
.
price
=
blindBoxPrice
||
0
;
saleInfo
.
difficulty
=
difficulty
||
1
;
for
(
let
item
of
skus
)
{
let
obj
=
{
...
item
,
...
...
@@ -805,41 +806,41 @@ export default {
name
:
item
.
propertyList
[
0
].
propVal
,
upload
:
{
imageList
:
[
item
.
image
],
defaultImgList
:
[
item
.
image
]
}
}
saleInfo
.
sku
.
push
(
obj
)
defaultImgList
:
[
item
.
image
]
,
}
,
}
;
saleInfo
.
sku
.
push
(
obj
)
;
}
}
if
(
salesType
===
1
)
{
saleInfo
.
stock
=
0
//
if (salesType === 1) {
//
saleInfo.stock = 0
if
(
skus
&&
skus
.
length
>
0
)
{
saleInfo
.
stock
=
skus
[
0
].
stock
}
}
form
.
saleInfo
=
saleInfo
this
.
form
=
form
//
if (skus && skus.length>0) {
//
saleInfo.stock = skus[0].stock
//
}
//
}
form
.
saleInfo
=
saleInfo
;
this
.
form
=
form
;
},
complete
:
()
=>
{
this
.
loading
=
false
}
})
this
.
loading
=
false
;
}
,
})
;
},
initData
()
{
let
routeName
=
this
.
$route
.
name
let
{
goodsId
}
=
this
.
$route
.
query
this
.
form
.
goodsId
=
goodsId
this
.
routeName
=
routeName
initData
()
{
let
routeName
=
this
.
$route
.
name
;
let
{
goodsId
}
=
this
.
$route
.
query
;
this
.
form
.
goodsId
=
goodsId
;
this
.
routeName
=
routeName
;
if
(
routeName
==
'update_good'
||
routeName
==
'good_detail'
||
routeName
==
'again_good'
||
routeName
==
'draft_good'
routeName
==
"update_good"
||
routeName
==
"good_detail"
||
routeName
==
"again_good"
||
routeName
==
"draft_good"
)
{
this
.
requestGoodDetail
(
goodsId
)
this
.
requestGoodDetail
(
goodsId
)
;
}
else
{
this
.
loading
=
false
this
.
loading
=
false
;
}
},
// checkForm() {
...
...
@@ -1188,13 +1189,13 @@ export default {
// form.delayDelivery = delayDelivery == true ? "1" : "0";
// return { errMsg, form };
// },
checkForm
()
{
checkForm
()
{
let
form
=
{
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
,
...
...
@@ -1203,17 +1204,17 @@ export default {
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
,
...
...
@@ -1221,254 +1222,262 @@ export default {
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
(
this
.
form
.
goodsId
)
{
form
.
goodsId
=
this
.
form
.
goodsId
form
.
goodsId
=
this
.
form
.
goodsId
;
}
if
(
this
.
form
.
saleInfo
.
salesType
===
1
)
{
form
.
commodityPass
=
this
.
form
.
saleInfo
.
tzType
form
.
skuList
=
[
{
stock
:
this
.
form
.
saleInfo
.
stock
,
propertyList
:
[
{
propKey
:
'规格名称'
,
propVal
:
' '
}
]
}
]
form
.
nftdto
=
{
number
:
1
,
number
:
this
.
form
.
saleInfo
.
number
,
price
:
this
.
form
.
saleInfo
.
price
,
tokenId
:
this
.
form
.
saleInfo
.
tokenId
,
type
:
this
.
form
.
saleInfo
.
type
,
tzType
:
this
.
form
.
saleInfo
.
tzType
tzType
:
this
.
form
.
saleInfo
.
tzType
,
};
if
(
form
.
type
==
6
)
{
if
(
this
.
form
.
saleInfo
.
tzType
==
1
&&
this
.
form
.
saleInfo
.
type
==
1
)
{
this
.
form
.
saleInfo
.
number
=
1
;
}
}
form
.
commodityPass
=
this
.
form
.
saleInfo
.
tzType
;
form
.
skuList
=
[
{
stock
:
this
.
form
.
saleInfo
.
number
,
propertyList
:
[
{
propKey
:
"规格名称"
,
propVal
:
" "
,
},
],
},
];
}
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
=
[]
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
||
''
}
]
}
propKey
:
"规格名称"
,
propVal
:
item
.
name
||
""
,
}
,
]
,
}
;
if
(
item
.
upload
&&
item
.
upload
.
imageList
&&
item
.
upload
.
imageList
.
length
!==
0
)
{
obj
.
image
=
item
.
upload
.
imageList
[
0
]
obj
.
image
=
item
.
upload
.
imageList
[
0
]
;
}
skuList
.
push
(
obj
)
skuList
.
push
(
obj
)
;
}
form
.
skuList
=
skuList
form
.
skuList
=
skuList
;
}
return
form
return
form
;
},
validateForm
()
{
let
errMsg
=
''
validateForm
()
{
let
errMsg
=
""
;
if
(
!
this
.
form
.
baseInfo
)
{
errMsg
=
'请完善基本信息!'
errMsg
=
"请完善基本信息!"
;
}
if
(
!
this
.
form
.
baseInfo
.
name
)
{
errMsg
=
'请填写 基本信息 - 商品名称!'
errMsg
=
"请填写 基本信息 - 商品名称!"
;
}
if
(
!
this
.
form
.
baseInfo
.
type
)
{
errMsg
=
'请填写 基本信息 - 商品类型!'
errMsg
=
"请填写 基本信息 - 商品类型!"
;
}
if
(
!
this
.
form
.
baseInfo
.
description
)
{
errMsg
=
'请填写 基本信息 - 商品描述!'
errMsg
=
"请填写 基本信息 - 商品描述!"
;
}
if
(
!
this
.
form
.
baseInfo
.
categoryId
||
this
.
form
.
baseInfo
.
categoryId
.
length
===
0
)
{
errMsg
=
'请填写 基本信息 - 类目选择!'
errMsg
=
"请填写 基本信息 - 类目选择!"
;
}
if
(
!
this
.
form
.
deciptInfo
)
{
errMsg
=
'请完善图文描述!'
errMsg
=
"请完善图文描述!"
;
}
if
(
!
this
.
form
.
deciptInfo
.
detailPictures
||
this
.
form
.
deciptInfo
.
detailPictures
.
length
===
0
)
{
errMsg
=
'请上传 图文描述 - 商品图片!'
errMsg
=
"请上传 图文描述 - 商品图片!"
;
}
if
(
!
this
.
form
.
deciptInfo
.
thumbList
||
this
.
form
.
deciptInfo
.
thumbList
.
length
===
0
)
{
errMsg
=
'请上传 图文描述 - 缩略图!'
errMsg
=
"请上传 图文描述 - 缩略图!"
;
}
if
(
this
.
form
.
deciptInfo
.
detailDescribe
.
length
>
18000
)
{
errMsg
=
'图文描述 - 详情描述 内容长度过长!'
errMsg
=
"图文描述 - 详情描述 内容长度过长!"
;
}
if
(
this
.
form
.
deciptInfo
.
detailDescribe
.
length
==
0
)
{
errMsg
=
'图文描述 - 请输入详情描述!'
errMsg
=
"图文描述 - 请输入详情描述!"
;
}
if
(
!
this
.
form
.
saleInfo
)
{
errMsg
=
'请完善规格信息!'
errMsg
=
"请完善规格信息!"
;
}
else
{
if
(
!
this
.
form
.
saleInfo
.
price
)
{
errMsg
=
'请填写商品价格!'
errMsg
=
"请填写商品价格!"
;
}
if
(
!
this
.
form
.
saleInfo
.
salesType
)
{
errMsg
=
'请选择销售模式!'
errMsg
=
"请选择销售模式!"
;
}
else
{
if
(
this
.
form
.
saleInfo
.
salesType
===
4
)
{
if
(
!
this
.
form
.
saleInfo
.
blindBoxRule
)
{
errMsg
=
'请完善规格信息 - 盲盒规则!'
errMsg
=
"请完善规格信息 - 盲盒规则!"
;
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
==
0
)
{
errMsg
=
'请完善规格信息 - 盲盒规则!'
errMsg
=
"请完善规格信息 - 盲盒规则!"
;
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
>
18000
)
{
errMsg
=
'规格信息 - 盲盒规则 内容长度过长!'
errMsg
=
"规格信息 - 盲盒规则 内容长度过长!"
;
}
if
(
this
.
form
.
saleInfo
.
blindBoxRule
.
length
>
18000
)
{
errMsg
=
'规格信息 - 盲盒规则 内容长度过长!'
errMsg
=
"规格信息 - 盲盒规则 内容长度过长!"
;
}
if
(
!
this
.
form
.
saleInfo
.
sku
||
this
.
form
.
saleInfo
.
sku
.
length
===
0
)
{
errMsg
=
'请完善规格信息!'
errMsg
=
"请完善规格信息!"
;
}
for
(
let
item
of
this
.
form
.
saleInfo
.
sku
)
{
if
(
!
item
.
name
)
{
errMsg
=
'请填写 规格信息 - 规格名称!'
break
errMsg
=
"请填写 规格信息 - 规格名称!"
;
break
;
}
if
(
!
item
.
weight
)
{
errMsg
=
'请填写 规格信息 - 重量!'
break
if
(
!
typeof
item
.
weight
===
"number"
)
{
errMsg
=
"请填写 规格信息 - 重量!"
;
break
;
}
if
(
item
.
weight
==
0
||
(
item
.
weight
&&
item
.
weight
<
0
)
||
item
.
weight
>
9999
)
{
errMsg
=
'规格信息 - 重量 格式不正确!'
break
if
(
item
.
weight
<
0
||
item
.
weight
>
9999
)
{
errMsg
=
"规格信息 - 重量 格式不正确!"
;
break
;
}
if
(
!
item
.
stock
)
{
errMsg
=
'请填写 规格信息 - 库存!'
break
errMsg
=
"请填写 规格信息 - 库存!"
;
break
;
}
if
(
item
.
stock
<
0
||
!
/^
\d
+$/
.
test
(
item
.
stock
)
||
item
.
stock
>
99999999
)
{
errMsg
=
'规格信息 - 库存 格式不正确!'
break
errMsg
=
"规格信息 - 库存 格式不正确!"
;
break
;
}
}
}
else
{
if
(
!
this
.
form
.
saleInfo
.
stock
)
{
errMsg
=
'请输入库存!'
}
else
{
if
(
!
this
.
form
.
saleInfo
.
tzType
){
errMsg
=
"请填写 规格信息 - 商品通证!"
;
}
if
(
!
this
.
form
.
saleInfo
.
type
){
errMsg
=
"请填写 规格信息 - NFT类型!"
;
}
if
(
this
.
form
.
saleInfo
.
type
===
2
&&!
this
.
form
.
saleInfo
.
number
){
errMsg
=
"请填写 规格信息 - 发行数量!"
;
}
}
}
}
return
errMsg
return
errMsg
;
},
handleSubmit
()
{
let
form
=
this
.
checkForm
()
let
errMsg
=
this
.
validateForm
()
console
.
log
(
'form'
,
form
)
handleSubmit
()
{
let
form
=
this
.
checkForm
();
let
errMsg
=
this
.
validateForm
();
if
(
errMsg
)
{
return
this
.
$Notice
.
warning
({
title
:
errMsg
})
}
if
(
!
errMsg
)
{
if
(
form
.
type
==
6
&&
form
.
nftdto
)
{
if
(
form
.
nftdto
.
tzType
==
1
&&
form
.
nftdto
.
type
==
1
)
{
form
.
nftdto
.
number
=
1
}
}
return
this
.
$Notice
.
warning
({
title
:
errMsg
});
}
var
regex1
=
new
RegExp
(
"(i?)(<p)(?!(.*?style=['
\"
](.*)['
\"
])[^>]+>)"
,
'gmi'
)
form
.
detail
=
form
.
detail
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
)
form
.
blindBoxRule
=
form
.
blindBoxRule
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
)
"gmi"
);
form
.
detail
=
form
.
detail
.
replace
(
regex1
,
'$2 style="padding:0 10px"$3'
);
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
"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
,
postdata
:
form
,
success
:
(
res
)
=>
{
// 关闭当前标签页
let
route
=
this
.
$route
let
toRouteName
=
'product_list'
this
.
closeTag
({
route
,
toRouteName
})
this
.
$Notice
.
success
({
title
})
let
route
=
this
.
$route
;
let
toRouteName
=
"product_list"
;
this
.
closeTag
({
route
,
toRouteName
})
;
this
.
$Notice
.
success
({
title
})
;
},
complete
:
()
=>
{
this
.
submitLoading
=
false
}
})
this
.
submitLoading
=
false
;
}
,
})
;
},
handleDraft
()
{
let
form
=
this
.
checkForm
()
this
.
draftLoading
=
true
handleDraft
()
{
let
form
=
this
.
checkForm
()
;
this
.
draftLoading
=
true
;
this
.
api
({
apiName
:
'draftGood'
,
apiName
:
"draftGood"
,
postdata
:
form
,
success
:
(
res
)
=>
{
// 关闭当前标签页
let
route
=
this
.
$route
let
toRouteName
=
'product_list'
this
.
closeTag
({
route
,
toRouteName
})
this
.
$Notice
.
success
({
title
:
'保存成功!'
})
let
route
=
this
.
$route
;
let
toRouteName
=
"product_list"
;
this
.
closeTag
({
route
,
toRouteName
})
;
this
.
$Notice
.
success
({
title
:
"保存成功!"
});
},
complete
:
()
=>
{
this
.
draftLoading
=
false
}
})
}
this
.
draftLoading
=
false
;
}
,
})
;
}
,
},
mounted
()
{
mounted
()
{
// this.getNftList()
this
.
requestOptionData
()
this
.
initData
()
this
.
getDelayDelivery
()
this
.
getTemplateorshopquery
()
this
.
requestOptionData
()
;
this
.
initData
()
;
this
.
getDelayDelivery
()
;
this
.
getTemplateorshopquery
()
;
// console.log('base', this.form.baseInfo)
}
}
}
,
}
;
</
script
>
<
style
lang=
"less"
scoped
>
...
...
src/view/good-mgr/add-good/sale-info.vue
View file @
3808ff71
...
...
@@ -164,7 +164,7 @@
>
</Select>
</div>
<div
class=
"item"
>
<
!--
<
div
class=
"item"
>
<label
class=
"label"
>
库存:
</label>
<Input
v-model=
"data.stock"
...
...
@@ -174,7 +174,7 @@
:maxlength=
"9"
@
on-change=
"inputChangeStock($event)"
/>
</div>
</div>
-->
</
template
>
<
template
v-if=
"data.salesType === 4"
>
<div
class=
"item"
style=
"text-align: center"
>
...
...
@@ -391,6 +391,10 @@ export default {
isAgain
:
{
type
:
Boolean
,
default
:
false
},
isDraft
:{
type
:
Boolean
,
default
:
false
}
},
components
:
{
...
...
@@ -466,9 +470,9 @@ export default {
setTimeout
(()
=>
{})
},
methods
:
{
inputChangeStock
(
e
)
{
this
.
data
.
stock
=
e
.
target
.
value
},
//
inputChangeStock (e) {
//
this.data.stock = e.target.value
//
},
changeTzType
()
{
this
.
data
.
type
=
''
this
.
data
.
number
=
''
...
...
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