Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-discover
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7e826a4e
authored
Aug 24, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新月底版本代码
1 parent
00736a2f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2533 additions
and
1365 deletions
src/api/modules/case.js
src/api/modules/goods.js
src/common/constant.js
src/views/case/index.vue
src/views/goods/add.vue
src/views/goods/addPrefer.vue
src/views/goods/browseList.vue
src/views/goods/index.vue
src/views/goods/preferList.vue
src/api/modules/case.js
View file @
7e826a4
...
@@ -63,11 +63,22 @@ const getCaseDetailApi = params => {
...
@@ -63,11 +63,22 @@ const getCaseDetailApi = params => {
})
})
}
}
const
topCaseApi
=
params
=>
{
params
.
method
=
'scrm.api.shopmall.discover.case.updateToTop'
return
http
({
url
,
method
:
'post'
,
data
:
params
,
sign
:
true
})
}
export
default
{
export
default
{
getCaseListApi
,
getCaseListApi
,
getVideoListApi
,
getVideoListApi
,
delCaseApi
,
delCaseApi
,
addCaseApi
,
addCaseApi
,
getCarSeriesApi
,
getCarSeriesApi
,
getCaseDetailApi
getCaseDetailApi
,
topCaseApi
}
}
\ No newline at end of file
\ No newline at end of file
src/api/modules/goods.js
View file @
7e826a4
...
@@ -75,6 +75,62 @@ const getMerchantListApi = params => {
...
@@ -75,6 +75,62 @@ const getMerchantListApi = params => {
})
})
}
}
const
getBrowseListApi
=
params
=>
{
params
.
method
=
'scrm.api.shopmall.discover.goods.browse.records'
return
http
({
url
,
method
:
'post'
,
data
:
params
,
sign
:
true
})
}
const
getVisitorListApi
=
params
=>
{
params
.
method
=
'scrm.api.shopmall.discover.goods.visitor.records'
return
http
({
url
,
method
:
'post'
,
data
:
params
,
sign
:
true
})
}
const
getSharedListApi
=
params
=>
{
params
.
method
=
'scrm.api.shopmall.discover.goods.shared.records'
return
http
({
url
,
method
:
'post'
,
data
:
params
,
sign
:
true
})
}
const
exportBrowseApi
=
(
params
,
TYPE
=
1
)
=>
{
//TYPE 1 浏览 2 访客 3 分享
params
.
method
=
{
1
:
'scrm.api.shopmall.discover.goods.browse.records.export'
,
2
:
'scrm.api.shopmall.discover.goods.visitor.records.export'
,
3
:
'scrm.api.shopmall.discover.goods.shared.records.export'
}[
TYPE
]
return
http
({
url
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
const
exportGoodsApi
=
params
=>
{
params
.
method
=
'scrm.api.shopmall.goods.configuration.export'
return
http
({
url
,
method
:
'post'
,
data
:
params
,
sign
:
true
})
}
export
default
{
export
default
{
getGoodsListApi
,
getGoodsListApi
,
updateGoodsStatusApi
,
updateGoodsStatusApi
,
...
@@ -82,5 +138,10 @@ export default {
...
@@ -82,5 +138,10 @@ export default {
getCarlifeGoodsApi
,
getCarlifeGoodsApi
,
addGoodsApi
,
addGoodsApi
,
getGoodsDetail
,
getGoodsDetail
,
getMerchantListApi
getMerchantListApi
,
getBrowseListApi
,
getVisitorListApi
,
getSharedListApi
,
exportBrowseApi
,
exportGoodsApi
}
}
\ No newline at end of file
\ No newline at end of file
src/common/constant.js
View file @
7e826a4
...
@@ -29,8 +29,47 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
...
@@ -29,8 +29,47 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
}
else
{
}
else
{
return
newValue
?
oldValue
:
''
return
newValue
?
oldValue
:
''
}
}
};
function
getExplorer
()
{
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
()
var
browserType
=
null
if
(
ua
.
match
(
/msie/
)
!=
null
||
ua
.
match
(
/trident/
)
!=
null
)
{
browserType
=
'IE'
}
else
if
(
ua
.
match
(
/firefox/
)
!=
null
)
{
browserType
=
'火狐'
}
else
if
(
ua
.
match
(
/ubrowser/
)
!=
null
)
{
browserType
=
'UC'
}
else
if
(
ua
.
match
(
/opera/
)
!=
null
)
{
browserType
=
'欧朋'
}
else
if
(
ua
.
match
(
/bidubrowser/
)
!=
null
)
{
browserType
=
'百度'
}
else
if
(
ua
.
match
(
/metasr/
)
!=
null
)
{
browserType
=
'搜狗'
}
else
if
(
ua
.
match
(
/tencenttraveler/
)
!=
null
||
ua
.
match
(
/qqbrowse/
)
!=
null
)
{
browserType
=
'QQ'
}
else
if
(
ua
.
match
(
/maxthon/
)
!=
null
)
{
browserType
=
'遨游'
}
else
{
browserType
=
'谷歌'
}
return
browserType
}
function
exportFn
(
url
)
{
let
browserType
=
getExplorer
()
if
(
browserType
==
'QQ'
)
{
window
.
open
(
url
)
return
}
let
iframe
=
document
.
createElement
(
'iframe'
)
iframe
.
style
.
display
=
'none'
iframe
.
src
=
url
document
.
body
.
appendChild
(
iframe
)
}
}
const
orderManageStatusList
=
[
const
orderManageStatusList
=
[
{
confId
:
'1'
,
confName
:
'未支付'
},
{
confId
:
'1'
,
confName
:
'未支付'
},
{
confId
:
'2'
,
confName
:
'已支付'
},
{
confId
:
'2'
,
confName
:
'已支付'
},
...
@@ -149,6 +188,8 @@ const stateList = [{
...
@@ -149,6 +188,8 @@ const stateList = [{
},
},
]
]
export
{
export
{
limitPrice
,
limitPrice
,
orderManageStatusList
,
orderManageStatusList
,
...
@@ -159,5 +200,7 @@ export {
...
@@ -159,5 +200,7 @@ export {
memberTypeList
,
memberTypeList
,
stateList
,
stateList
,
orderTypesList
,
orderTypesList
,
orderStatusList
orderStatusList
,
getExplorer
,
exportFn
}
}
\ No newline at end of file
\ No newline at end of file
src/views/case/index.vue
View file @
7e826a4
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
</el-dialog>
</el-dialog>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
bigView
from
'@/components/big-view'
import
bigView
from
'@/components/big-view'
...
@@ -60,6 +60,17 @@
...
@@ -60,6 +60,17 @@
buttonList
:
[
buttonList
:
[
{
{
type
:
'el-button'
,
type
:
'el-button'
,
name
:
'置顶'
,
attrs
:
{
type
:
'text'
,
fn
:
'置顶'
},
listeners
:
{
click
:
row
=>
this
.
topFn
(
row
.
scope
)
}
},
{
type
:
'el-button'
,
name
:
'预览'
,
name
:
'预览'
,
attrs
:
{
attrs
:
{
type
:
'text'
,
type
:
'text'
,
...
@@ -159,12 +170,30 @@
...
@@ -159,12 +170,30 @@
created
()
{},
created
()
{},
mounted
()
{},
mounted
()
{},
methods
:
{
methods
:
{
topFn
({
id
,
caseName
}){
const
h
=
this
.
$createElement
this
.
$confirm
(
h
(
'div'
,
[
h
(
'div'
,{
style
:
'font-size: 18px;color:#333,margin-bottom:4px;margin-top:8px'
},
'是否确定将此案例置顶?'
),
h
(
'p'
,
{
style
:
'color:#666;margin-top:4px'
},
'置顶后的案例会在小程序端优先置顶展示'
)]),
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
this
.
$apis
.
case
.
topCaseApi
({
id
}).
then
(
res
=>
{
if
(
res
){
this
.
$message
.
success
(
'置顶成功'
)
this
.
handleSearch
()
}
})
}
}
})
},
filterBrand
({
brandList
}){
filterBrand
({
brandList
}){
return
brandList
?.
map
(
item
=>
item
.
brandName
)
||
[]
return
brandList
?.
map
(
item
=>
item
.
brandName
)
||
[]
},
},
previewFn
(
row
){
previewFn
(
row
){
console
.
log
(
this
.
previewVideoUrl
)
this
.
previewVideoUrl
=
row
?.
mediaInfo
?.
mediaUrl
this
.
previewVideoUrl
=
row
?.
mediaInfo
?.
mediaUrl
this
.
previewVideoVisible
=
true
this
.
previewVideoVisible
=
true
},
},
getParams
()
{
getParams
()
{
...
@@ -223,7 +252,7 @@
...
@@ -223,7 +252,7 @@
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.case-ctnr
{
.case-ctnr
{
background-color
:
#fff
;
background-color
:
#fff
;
...
@@ -236,4 +265,3 @@
...
@@ -236,4 +265,3 @@
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/goods/add.vue
View file @
7e826a4
<
template
>
<
template
>
<div
class=
"goods-ctnr"
>
<div
class=
"goods-ctnr"
>
<div
class=
"global-title"
>
{{
!
routeInfo
.
id
?
'新增'
:
disabled
?
'查看'
:
'编辑'
}}
商品
</div>
<div
class=
"global-title"
>
{{
!
routeInfo
.
id
?
'新增'
:
disabled
?
'查看'
:
'编辑'
}}
商品
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<glsx-combi-form
:isInline=
"false"
class=
"glsx-combi-form"
ref=
"baseInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"formData"
:formRules=
"myRule"
>
<glsx-combi-form
:isInline=
"false"
class=
"glsx-combi-form"
ref=
"baseInfoRef"
labelWidth=
"154px"
<div
slot=
"selectGoodsSlot"
>
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"formData"
:formRules=
"myRule"
>
<el-button
:class=
"['el-icon-plus',
{'disabled-class':disabled}]" size="small" @click="openGoodsDialog">
{{
formObj
.
smartcarlifeInfoId
?
'重新选择'
:
'选择商品'
}}
</el-button>
<div
slot=
"selectGoodsSlot"
>
</div>
<el-button
:class=
"['el-icon-plus',
{'disabled-class':disabled}]" size="small" @click="openGoodsDialog">
<div
slot=
"goodsInfoSlot"
class=
"goods-wrap"
>
{{
formObj
.
smartcarlifeInfoId
?
'重新选择'
:
'选择商品'
}}
<glsx-combi-form
:isInline=
"false"
ref=
"goodsInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"goodsFormData"
:formRules=
"goodsRule"
>
</el-button>
<div
slot=
"uploadSlot"
class=
"upload-calss"
>
</div>
<glsx-preview
:picOptions=
"posterOptions"
:imageUrlArr=
"formObj.coverList"
@
change=
"changeChannelImg"
></glsx-preview>
<div
slot=
"goodsInfoSlot"
class=
"goods-wrap"
>
<span
class=
"tip"
>
建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内
</span>
<glsx-combi-form
:isInline=
"false"
ref=
"goodsInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
</div>
:formObj
.
sync=
"formObj"
:formData=
"goodsFormData"
:formRules=
"goodsRule"
>
</glsx-combi-form>
<div
slot=
"uploadSlot"
class=
"upload-calss"
>
</div>
<glsx-preview
:picOptions=
"posterOptions"
:imageUrlArr=
"formObj.coverList"
<div
slot=
"paymentSlot"
>
@
change=
"changeChannelImg"
></glsx-preview>
<el-radio-group
:disabled=
"disabled"
v-model=
"formObj.paymentType"
>
<span
class=
"tip"
>
建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内
</span>
<el-radio
:label=
"1"
>
全款
</el-radio>
</div>
<el-radio
:label=
"2"
>
定金+尾款
</el-radio>
</glsx-combi-form>
</el-radio-group>
</div>
<div
class=
"money-wrap"
v-if=
"formObj.paymentType == 2"
>
<div
slot=
"paymentSlot"
>
<label
class=
"label"
for=
""
>
定金金额/元:
</label>
<el-radio-group
:disabled=
"disabled"
v-model=
"formObj.paymentType"
>
<format-input
:disabled=
"disabled"
:intDigit=
"4"
:precise=
"2"
v-model=
"formObj.depositPrice"
></format-input>
<el-radio
:label=
"1"
>
全款
</el-radio>
</div>
<el-radio
:label=
"2"
>
定金+尾款
</el-radio>
</div>
</el-radio-group>
<div
slot=
"saleStoreSlot"
>
<div
class=
"money-wrap"
v-if=
"formObj.paymentType == 2"
>
<el-button
v-if=
"!disabled"
class=
"el-icon-plus"
size=
"small"
@
click=
"closeDialog"
>
选择门店
</el-button>
<label
class=
"label"
for=
""
>
定金金额/元:
</label>
<template
v-if=
"saleMerchantList && saleMerchantList.length"
>
<format-input
:disabled=
"disabled"
:intDigit=
"4"
:precise=
"2"
v-model=
"formObj.depositPrice"
></format-input>
<GLTable
class=
"selected-table"
:hasPage=
"false"
ref=
"selectedRef"
:tableParams=
"selectedtableParams"
:tableData=
"saleMerchantList"
>
</div>
<div
slot=
"activityPriceSlot"
slot-scope=
"scope"
>
</div>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
v-model=
"scope.scope.activityPrice"
></format-input>
<div
slot=
"saleStoreSlot"
>
</div>
<el-button
v-if=
"!disabled"
class=
"el-icon-plus"
size=
"small"
@
click=
"closeDialog"
>
选择门店
</el-button>
<div
slot=
"originalPriceSlot"
slot-scope=
"scope"
>
<template
v-if=
"saleMerchantList && saleMerchantList.length"
>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
v-model=
"scope.scope.originalPrice"
></format-input>
<GLTable
class=
"selected-table"
:hasPage=
"false"
ref=
"selectedRef"
:tableParams=
"selectedtableParams"
</div>
:tableData=
"saleMerchantList"
>
<div
slot=
"retainagePriceSlot"
slot-scope=
"scope"
>
<div
slot=
"activityPriceSlot"
slot-scope=
"scope"
>
{{
retainagePriceFn
(
scope
.
scope
.
activityPrice
)
}}
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
</div>
v-model=
"scope.scope.activityPrice"
></format-input>
<div
slot=
"auth-button"
slot-scope=
"scope"
>
</div>
<el-button
v-if=
"!disabled"
type=
"text"
@
click=
"handleDel(scope.scope)"
>
删除
</el-button>
<div
slot=
"originalPriceSlot"
slot-scope=
"scope"
>
</div>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
</GLTable>
v-model=
"scope.scope.originalPrice"
></format-input>
</
template
>
</div>
</div>
<div
slot=
"retainagePriceSlot"
slot-scope=
"scope"
>
<div
slot=
"carSeriesSlot"
>
{{
retainagePriceFn
(
scope
.
scope
.
activityPrice
)
}}
videoUrl
<el-radio-group
:disabled=
"disabled"
v-model=
"formObj.vehicleSeriesType"
>
</div>
<el-radio
:label=
"1"
>
全部
</el-radio>
<div
slot=
"auth-button"
slot-scope=
"scope"
>
<el-radio
:label=
"2"
>
部分
</el-radio>
<el-button
v-if=
"!disabled"
type=
"text"
@
click=
"handleDel(scope.scope)"
>
删除
</el-button>
</el-radio-group>
</div>
<div
v-if=
"formObj.vehicleSeriesType == 2"
>
</GLTable>
<el-button
type=
"default"
v-if=
"!disabled"
class=
"el-icon-plus"
@
click=
"handleCarSeriesClose"
>
选择车系
</el-button>
</
template
>
<div
class=
"car-series-wrap"
v-if=
"vehicleSeriesRequestList && vehicleSeriesRequestList.length"
>
</div>
<div
class=
"car-series-item"
v-for=
"item in vehicleSeriesRequestList"
:key=
"item.vehicleSeriesId"
>
{{ item.vehicleSeriesName }}
</div>
</div>
<div
slot=
"productVideoSlot"
>
</div>
<el-form-item
label=
""
>
</div>
<
template
v-if=
"!formObj.goodsVideo"
>
<div
slot=
"categorySlot"
>
<div
class=
"upload-img"
>
<brandCascader
:curInfo=
"curCategoryInfo"
:disabled=
"disabled"
@
clickItem=
"selectCategory"
class=
"category-class"
></brandCascader>
<i
class=
"el-icon-plus avatar-uploader-desc-icon"
></i>
<div
class=
"avatar-uploader-desc-word"
>
上传视频
</div>
<input
type=
"file"
class=
"upload-video"
style=
"opacity: 0"
accept=
".mp4"
@
change=
"e => handleVideoChange(e)"
/>
</div>
</
template
>
<
template
v-else
>
<div
class=
"video-box"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"formObj.goodsVideo"
type=
"video/mp4"
/>
</video>
<div
class=
"mask"
>
<div
class=
"video-pane-close"
@
click=
"handleEnlarge(formObj.goodsVideo, 'video')"
>
<img
src=
"../../assets/channel/view.png"
alt=
""
/>
</div>
<div
class=
"video-pane-close"
@
click=
"close('radio')"
>
<img
src=
"../../assets/channel/dele.png"
alt=
""
/>
</div>
</div>
</div>
</glsx-combi-form>
</div>
</
template
>
<div
class=
"text-tip2"
>
作为商品详情页顶部展示和详情展示,格式建议mp4,大小不超过20M
</div>
</el-form-item>
</div>
<div
slot=
"carSeriesSlot"
>
<el-radio-group
:disabled=
"disabled"
v-model=
"formObj.vehicleSeriesType"
>
<el-radio
:label=
"1"
>
全部
</el-radio>
<el-radio
:label=
"2"
>
部分
</el-radio>
</el-radio-group>
<div
v-if=
"formObj.vehicleSeriesType == 2"
>
<el-button
type=
"default"
v-if=
"!disabled"
class=
"el-icon-plus"
@
click=
"handleCarSeriesClose"
>
选择车系
</el-button>
<div
class=
"car-series-wrap"
v-if=
"vehicleSeriesRequestList && vehicleSeriesRequestList.length"
>
<div
class=
"car-series-item"
v-for=
"item in vehicleSeriesRequestList"
:key=
"item.vehicleSeriesId"
>
{{ item.vehicleSeriesName }}
</div>
</div>
</div>
</div>
<div
slot=
"categorySlot"
>
<brandCascader
:curInfo=
"curCategoryInfo"
:disabled=
"disabled"
@
clickItem=
"selectCategory"
class=
"category-class"
></brandCascader>
</div>
</div>
<GLFooter
style=
"margin-top: 16px;"
>
</glsx-combi-form>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
v-if=
"!disabled"
type=
"primary"
@
click=
"handleSave"
>
确定
</el-button>
</GLFooter>
<selectCarDialog
v-if=
"carDialogVisible"
:echoData=
"vehicleSeriesRequestList"
@
handleClose=
"handleCarSeriesClose"
@
handleConfirm=
"handleConfirm"
:dialogVisible=
"carDialogVisible"
></selectCarDialog>
<selectGoods
v-if=
"goodsVisible"
:routeInfo=
"routeInfo"
:dialogVisible=
"goodsVisible"
@
handleGoodsConfirm=
"handleGoodsConfirm"
@
handleGoodsClose=
"handleGoodsClose"
></selectGoods>
<selectMerchantDialog
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:goodsId=
"formObj.smartcarlifeInfoId"
:selectedList=
"saleMerchantList"
v-if=
"merchantDialogVisible"
:isVisible=
"merchantDialogVisible"
></selectMerchantDialog>
</div>
</div>
<GLFooter
style=
"margin-top: 16px;"
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
v-if=
"!disabled"
type=
"primary"
@
click=
"handleSave"
>
确定
</el-button>
</GLFooter>
<selectCarDialog
v-if=
"carDialogVisible"
:echoData=
"vehicleSeriesRequestList"
@
handleClose=
"handleCarSeriesClose"
@
handleConfirm=
"handleConfirm"
:dialogVisible=
"carDialogVisible"
></selectCarDialog>
<selectGoods
v-if=
"goodsVisible"
:routeInfo=
"routeInfo"
:dialogVisible=
"goodsVisible"
@
handleGoodsConfirm=
"handleGoodsConfirm"
@
handleGoodsClose=
"handleGoodsClose"
></selectGoods>
<selectMerchantDialog
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:goodsId=
"formObj.smartcarlifeInfoId"
:selectedList=
"saleMerchantList"
v-if=
"merchantDialogVisible"
:isVisible=
"merchantDialogVisible"
></selectMerchantDialog>
<el-dialog
class=
"image-dialog"
:visible
.
sync=
"dialogVisibleImg"
width=
"50%"
>
<img
:src=
"dialogSrc"
width=
"100%"
v-if=
"dialogType == 'img'"
/>
<video
width=
"100%"
autoplay
controls
:src=
"dialogSrc"
v-else
></video>
</el-dialog>
</div>
</template>
</template>
<
script
>
<
script
>
const
MerchantColumns
=
[
const
MerchantColumns
=
[
{
{
label
:
'门店名称'
,
label
:
'门店名称'
,
prop
:
'merchantName'
,
prop
:
'merchantName'
,
},
},
{
{
label
:
'门店原价(元)'
,
label
:
'门店原价(元)'
,
width
:
220
,
width
:
220
,
addHtml
:
'originalPriceSlot'
addHtml
:
'originalPriceSlot'
},
},
{
{
label
:
'门店活动价(元)'
,
label
:
'门店活动价(元)'
,
width
:
220
,
width
:
220
,
addHtml
:
'activityPriceSlot'
addHtml
:
'activityPriceSlot'
},
},
{
{
label
:
'尾款金额(元)'
,
label
:
'尾款金额(元)'
,
width
:
150
,
width
:
150
,
addHtml
:
'retainagePriceSlot'
addHtml
:
'retainagePriceSlot'
}
}
]
]
const
notPriceColumns
=
[
const
notPriceColumns
=
[
{
{
label
:
'门店名称'
,
label
:
'门店名称'
,
prop
:
'merchantName'
,
prop
:
'merchantName'
,
},
},
{
{
label
:
'门店原价(元)'
,
label
:
'门店原价(元)'
,
addHtml
:
'originalPriceSlot'
addHtml
:
'originalPriceSlot'
},
},
{
{
label
:
'门店活动价(元)'
,
label
:
'门店活动价(元)'
,
addHtml
:
'activityPriceSlot'
addHtml
:
'activityPriceSlot'
}
}
]
]
import
glsxCombiForm
from
'@/components/glsx-combi-form'
import
glsxCombiForm
from
'@/components/glsx-combi-form'
import
brandCascader
from
'./components/brandCascader'
import
brandCascader
from
'./components/brandCascader'
import
selectGoods
from
'./components/selectGoods'
import
selectGoods
from
'./components/selectGoods'
import
selectCarDialog
from
'@/views/store/components/selectCarDialog'
import
selectCarDialog
from
'@/views/store/components/selectCarDialog'
import
selectMerchantDialog
from
'./components/selectMerchantDialog'
import
selectMerchantDialog
from
'./components/selectMerchantDialog'
export
default
{
export
default
{
name
:
'add'
,
name
:
'add'
,
components
:
{
components
:
{
glsxCombiForm
,
glsxCombiForm
,
brandCascader
,
brandCascader
,
selectGoods
,
selectGoods
,
selectCarDialog
,
selectCarDialog
,
selectMerchantDialog
selectMerchantDialog
},
},
watch
:{
watch
:
{
'formObj.paymentType'
:{
'formObj.paymentType'
:
{
handler
(
nVal
,
oVal
){
handler
(
nVal
,
oVal
)
{
if
(
nVal
==
1
)
{
if
(
nVal
==
1
)
{
this
.
selectedtableParams
.
tableColumns
=
notPriceColumns
this
.
selectedtableParams
.
tableColumns
=
notPriceColumns
}
else
{
}
else
{
this
.
selectedtableParams
.
tableColumns
=
MerchantColumns
this
.
selectedtableParams
.
tableColumns
=
MerchantColumns
}
},
deep
:
true
}
},
data
()
{
return
{
goodsVisible
:
false
,
carDialogVisible
:
false
,
merchantDialogVisible
:
false
,
disabled
:
false
,
goodsInfo
:
{},
routeInfo
:
{},
defaultProps
:{
children
:
'categoryName'
,
label
:
'childs'
},
curCategoryInfo
:{},
posterOptions
:
{
width
:
'104px'
,
height
:
'104px'
,
key
:
'posterImg'
,
isClose
:
true
},
goodsFormData
:[
{
label
:
'商品图'
,
addHtml
:
'uploadSlot'
,
isDisabled
:
false
},
{
label
:
'商品名称'
,
name
:
'goodsName'
,
maxlength
:
20
,
showLimit
:
true
,
type
:
'input'
,
isDisabled
:
false
},
{
label
:
'售价(元)'
,
name
:
'retailPrice'
,
type
:
'showTxt'
},
{
label
:
'最低售价(元)'
,
name
:
'minSellPrice'
,
type
:
'showTxt'
},
],
formObj
:{
smartcarlifeInfoId
:
''
,
goodsName
:
''
,
goodsType
:
'1'
,
goodsImage
:
''
,
minSellPrice
:
''
,
retailPrice
:
''
,
coverList
:
[],
paymentType
:
1
,
depositPrice
:
''
,
vehicleSeriesType
:
1
,
associationClassifyFirstId
:
''
,
associationClassifySecondId
:
''
},
saleMerchantList
:[],
vehicleSeriesRequestList
:
[],
myRule
:
{
selectGoodsName
:
[
{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
smartcarlifeInfoId
){
callback
(
new
Error
(
'请选择商品'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}
],
goodsInfoName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
coverList
&&
!
this
.
formObj
.
coverList
[
0
]){
callback
(
new
Error
(
'请上传商品图'
))
}
else
if
(
!
this
.
formObj
.
goodsName
){
callback
(
new
Error
(
'请输入商品名称'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
paymentType
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
this
.
formObj
.
paymentType
==
2
&&
!
this
.
formObj
.
depositPrice
){
callback
(
new
Error
(
'请输入定金金额'
))
}
else
{
callback
()
}
this
.
validateField
(
'saleStore'
)
},
trigger
:
'change'
}],
saleStore
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
const
target
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
activityPrice
||
!
item
.
originalPrice
)
const
hasNegTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
let
activityPrice
=
item
.
activityPrice
||
0
let
depositPrice
=
this
.
formObj
.
depositPrice
||
0
return
+
activityPrice
<
+
depositPrice
})
const
hasTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
let
originalPrice
=
item
.
originalPrice
||
0
let
activityPrice
=
item
.
activityPrice
||
0
let
minSellPrice
=
this
.
formObj
.
minSellPrice
||
0
return
(
+
activityPrice
>
+
originalPrice
||
+
originalPrice
<
minSellPrice
)
})
if
(
!
this
.
saleMerchantList
.
length
){
callback
(
new
Error
(
'请选择门店'
))
}
else
if
(
target
){
callback
(
new
Error
(
'门店活动价和原价不能为空'
))
}
else
if
(
this
.
formObj
.
paymentType
==
2
&&
hasNegTarget
){
callback
(
new
Error
(
'活动价不能小于定金'
))
}
else
if
(
hasTarget
){
callback
(
new
Error
(
'原价不能小于最低售价和活动价'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
carSeriesName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
this
.
formObj
.
vehicleSeriesType
==
2
&&
!
this
.
vehicleSeriesRequestList
.
length
){
callback
(
new
Error
(
'请选择适用车系'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
categoryName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
associationClassifyFirstId
||
!
this
.
formObj
.
associationClassifySecondId
){
callback
(
new
Error
(
'请选择关联商品分类'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
},
formData
:[
{
label
:
'选择商品'
,
name
:
'selectGoodsName'
,
addHtml
:
'selectGoodsSlot'
,
type
:
'input'
,
isDisabled
:
false
},
{
label
:
'商品信息'
,
name
:
'goodsInfoName'
,
addHtml
:
'goodsInfoSlot'
,
type
:
'input'
,
isDisabled
:
false
},
{
label
:
'收款方式'
,
name
:
'paymentType'
,
addHtml
:
'paymentSlot'
},
{
label
:
'销售门店'
,
name
:
'saleStore'
,
addHtml
:
'saleStoreSlot'
},
{
label
:
'适用车系'
,
name
:
'carSeriesName'
,
addHtml
:
'carSeriesSlot'
,
},
{
label
:
'关联商品分类'
,
name
:
'categoryName'
,
addHtml
:
'categorySlot'
}
],
selectedtableParams
:
{
listName
:
'list'
,
tableOption
:
{
width
:
100
},
tableColumns
:
notPriceColumns
}
}
}
},
},
created
(){
deep
:
true
// this.getCategory()
}
const
urlParam
=
this
.
$route
.
params
},
this
.
routeInfo
=
JSON
.
parse
(
decodeURIComponent
(
urlParam
.
id
))
data
()
{
const
{
id
,
type
}
=
this
.
routeInfo
return
{
if
(
type
==
1
)
{
dialogVisibleImg
:
false
,
this
.
disabled
=
true
goodsVisible
:
false
,
this
.
posterOptions
.
isClose
=
false
carDialogVisible
:
false
,
const
_target
=
this
.
goodsFormData
.
find
(
item
=>
item
.
name
==
'goodsName'
)
merchantDialogVisible
:
false
,
_target
.
isDisabled
=
true
disabled
:
false
,
this
.
selectedtableParams
.
tableOption
=
null
dialogSrc
:
''
,
}
goodsInfo
:
{},
if
(
id
){
routeInfo
:
{},
this
.
getDetail
()
defaultProps
:
{
}
children
:
'categoryName'
,
},
label
:
'childs'
methods
:{
},
validateField
(
field
){
curCategoryInfo
:
{},
if
(
Array
.
isArray
(
field
)){
posterOptions
:
{
field
.
forEach
(
item
=>
{
width
:
'104px'
,
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
item
)
height
:
'104px'
,
})
key
:
'posterImg'
,
}
else
{
isClose
:
true
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
field
)
},
}
goodsFormData
:
[
},
{
retainagePriceFn
(
price
){
label
:
'商品图'
,
let
depositPrice
=
this
.
formObj
.
paymentType
==
1
?
0
:
this
.
formObj
.
depositPrice
addHtml
:
'uploadSlot'
,
if
(
this
.
formObj
.
paymentType
==
1
)
return
'--'
isDisabled
:
false
if
(
!
price
){
return
'待计算'
}
else
{
return
Number
((
price
-
depositPrice
).
toFixed
(
2
))
}
},
openGoodsDialog
(){
if
(
this
.
disabled
)
return
this
.
goodsVisible
=
true
},
},
handleGoodsClose
(){
{
this
.
goodsVisible
=
false
label
:
'商品名称'
,
name
:
'goodsName'
,
maxlength
:
20
,
showLimit
:
true
,
type
:
'input'
,
isDisabled
:
false
},
},
handleGoodsConfirm
(
e
){
{
if
(
this
.
formObj
.
smartcarlifeInfoId
!=
e
?.
id
)
this
.
saleMerchantList
=
[]
label
:
'售价(元)'
,
let
{
id
:
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
minSellPrice
,
retailPrice
}
=
e
||
{}
name
:
'retailPrice'
,
minSellPrice
=
minSellPrice
?
Number
(
Number
(
minSellPrice
/
100
).
toFixed
(
2
))
:
0
type
:
'showTxt'
retailPrice
=
retailPrice
?
Number
(
Number
(
retailPrice
/
100
).
toFixed
(
2
))
:
0
this
.
formObj
=
{...
this
.
formObj
,
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
coverList
:
[
goodsImage
],
minSellPrice
,
retailPrice
}
this
.
handleGoodsClose
()
this
.
validateField
([
'selectGoodsName'
,
'goodsInfoName'
])
},
},
handleCarSeriesClose
(){
{
this
.
carDialogVisible
=
!
this
.
carDialogVisible
label
:
'最低售价(元)'
,
name
:
'minSellPrice'
,
type
:
'showTxt'
},
},
handleConfirm
(
e
=
{}){
],
let
carList
=
[]
formObj
:
{
for
(
const
key
in
e
){
smartcarlifeInfoId
:
''
,
for
(
const
sonKey
in
e
[
key
]){
goodsName
:
''
,
carList
=
[...
carList
,
...
e
[
key
][
sonKey
]]
goodsType
:
'1'
,
}
goodsImage
:
''
,
minSellPrice
:
''
,
retailPrice
:
''
,
coverList
:
[],
paymentType
:
1
,
depositPrice
:
''
,
vehicleSeriesType
:
1
,
goodsVideo
:
''
,
associationClassifyFirstId
:
''
,
associationClassifySecondId
:
''
},
saleMerchantList
:
[],
vehicleSeriesRequestList
:
[],
myRule
:
{
selectGoodsName
:
[
{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
smartcarlifeInfoId
)
{
callback
(
new
Error
(
'请选择商品'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}
],
goodsInfoName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
coverList
&&
!
this
.
formObj
.
coverList
[
0
])
{
callback
(
new
Error
(
'请上传商品图'
))
}
else
if
(
!
this
.
formObj
.
goodsName
)
{
callback
(
new
Error
(
'请输入商品名称'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
paymentType
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
this
.
formObj
.
paymentType
==
2
&&
!
this
.
formObj
.
depositPrice
)
{
callback
(
new
Error
(
'请输入定金金额'
))
}
else
{
callback
()
}
}
this
.
vehicleSeriesRequestList
=
carList
.
map
(
item
=>
{
const
{
id
,
name
,
parentId
,
parentName
,
rootId
,
rootName
}
=
item
return
{
brandId
:
rootId
,
brandName
:
rootName
,
childBrandId
:
parentId
,
childBrandName
:
parentName
,
vehicleSeriesId
:
id
,
vehicleSeriesName
:
name
}
})
this
.
handleCarSeriesClose
()
this
.
validateField
(
'carSeriesName'
)
},
confirmDialog
(
e
){
this
.
saleMerchantList
=
e
||
[]
this
.
closeDialog
()
this
.
validateField
(
'saleStore'
)
this
.
validateField
(
'saleStore'
)
},
},
closeDialog
(){
trigger
:
'change'
if
(
!
this
.
merchantDialogVisible
&&
!
this
.
formObj
.
smartcarlifeInfoId
){
}],
return
this
.
$message
.
error
(
'请先选择商品'
)
saleStore
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
const
target
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
activityPrice
||
!
item
.
originalPrice
)
const
hasNegTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
let
activityPrice
=
item
.
activityPrice
||
0
let
depositPrice
=
this
.
formObj
.
depositPrice
||
0
return
+
activityPrice
<
+
depositPrice
})
const
hasTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
let
originalPrice
=
item
.
originalPrice
||
0
let
activityPrice
=
item
.
activityPrice
||
0
let
minSellPrice
=
this
.
formObj
.
minSellPrice
||
0
return
(
+
activityPrice
>
+
originalPrice
||
+
originalPrice
<
minSellPrice
)
})
if
(
!
this
.
saleMerchantList
.
length
)
{
callback
(
new
Error
(
'请选择门店'
))
}
else
if
(
target
)
{
callback
(
new
Error
(
'门店活动价和原价不能为空'
))
}
else
if
(
this
.
formObj
.
paymentType
==
2
&&
hasNegTarget
)
{
callback
(
new
Error
(
'活动价不能小于定金'
))
}
else
if
(
hasTarget
)
{
callback
(
new
Error
(
'原价不能小于最低售价和活动价'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
carSeriesName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
this
.
formObj
.
vehicleSeriesType
==
2
&&
!
this
.
vehicleSeriesRequestList
.
length
)
{
callback
(
new
Error
(
'请选择适用车系'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
categoryName
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
associationClassifyFirstId
||
!
this
.
formObj
.
associationClassifySecondId
)
{
callback
(
new
Error
(
'请选择关联商品分类'
))
}
else
{
callback
()
}
}
this
.
merchantDialogVisible
=
!
this
.
merchantDialogVisible
},
trigger
:
'change'
}],
},
formData
:
[
{
label
:
'选择商品'
,
name
:
'selectGoodsName'
,
addHtml
:
'selectGoodsSlot'
,
type
:
'input'
,
isDisabled
:
false
},
},
handleDel
(
row
)
{
{
const
idx
=
this
.
saleMerchantList
.
findIndex
(
item
=>
item
.
merchantId
==
row
.
merchantId
)
label
:
'商品信息'
,
if
(
idx
>-
1
)
this
.
saleMerchantList
.
splice
(
idx
,
1
)
name
:
'goodsInfoName'
,
addHtml
:
'goodsInfoSlot'
,
type
:
'input'
,
isDisabled
:
false
},
},
selectCategory
(
e
)
{
{
this
.
formObj
.
associationClassifyFirstId
=
e
?.
parent
?.
id
label
:
'收款方式'
,
this
.
formObj
.
associationClassifySecondId
=
e
?.
data
?.
id
name
:
'paymentType'
,
this
.
validateField
(
'categoryName'
)
addHtml
:
'paymentSlot'
},
},
getParams
(){
{
let
obj
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
formObj
))
label
:
'销售门店'
,
obj
.
goodsImage
=
obj
.
coverList
[
0
]
name
:
'saleStore'
,
obj
.
depositPrice
=
obj
.
depositPrice
?
Number
(
Number
(
obj
.
depositPrice
*
10
*
10
).
toFixed
(
0
))
:
0
addHtml
:
'saleStoreSlot'
if
(
obj
.
paymentType
==
1
)
delete
obj
.
depositPrice
delete
obj
.
minSellPrice
delete
obj
.
retailPrice
delete
obj
.
coverList
let
saleMerchantList
=
this
.
saleMerchantList
.
map
(
item
=>
{
let
{
merchantId
,
merchantName
,
activityPrice
,
originalPrice
}
=
item
let
price
=
this
.
formObj
.
paymentType
==
1
?
0
:
this
.
formObj
.
depositPrice
let
retainagePrice
=
activityPrice
-
price
activityPrice
=
activityPrice
?
Number
(
Number
(
activityPrice
*
10
*
10
).
toFixed
(
0
))
:
0
retainagePrice
=
retainagePrice
?
Number
(
Number
(
retainagePrice
*
10
*
10
).
toFixed
(
0
))
:
0
originalPrice
=
originalPrice
?
Number
(
Number
(
originalPrice
*
10
*
10
).
toFixed
(
0
))
:
0
if
(
obj
.
paymentType
==
1
)
{
return
{
merchantId
,
merchantName
,
activityPrice
,
originalPrice
}
}
else
{
return
{
merchantId
,
merchantName
,
activityPrice
,
retainagePrice
,
originalPrice
}
}
})
const
params
=
{
saleMerchantList
:
saleMerchantList
,
vehicleSeriesRequestList
:
this
.
vehicleSeriesRequestList
,
...
obj
}
if
(
this
.
routeInfo
.
id
)
params
.
id
=
this
.
routeInfo
.
id
return
params
},
},
handleSave
(){
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validate
(
valid
=>
{
label
:
'产品视频'
,
if
(
valid
){
name
:
'productVideo'
,
const
params
=
this
.
getParams
()
addHtml
:
'productVideoSlot'
this
.
$apis
.
goods
.
addGoodsApi
(
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
.
success
(
'操作成功'
)
this
.
handleCancel
()
}
})
}
})
},
},
handleCancel
(){
// {
this
.
$router
.
back
()
// label: '产品视频',
// name: 'activityVideoList',
// type: 'upload',
// uploadType: 'video',
// suffixSlot: 'activityVideos',
// // tips: '大图下可以展示视频,不上传则不显示',
// limitSize: 20,
// maxPhotoNum: 1,
// handleDelete: idx => {
// this.formObj.activityVideoList = ''
// },
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// const fileSuffix = file.name.split('.')[file.name.split('.').length - 1]
// if (fileSuffix.toLowerCase() != 'mp4') {
// this.$message.error('上传视频不是MP4的格式!')
// return true
// }
// this.loading = true
// this.$apis.common
// .uploadVideoApi({ file: base64 })
// .then(res => {
// this.formObj.activityVideoList = res
// })
// .finally(() => {
// this.loading = false
// })
// }
// },
{
label
:
'适用车系'
,
name
:
'carSeriesName'
,
addHtml
:
'carSeriesSlot'
,
},
},
getDetail
(){
{
const
params
=
{
label
:
'关联商品分类'
,
id
:
this
.
routeInfo
.
id
name
:
'categoryName'
,
}
addHtml
:
'categorySlot'
if
(
this
.
routeInfo
.
merchantId
)
params
.
merchantId
=
this
.
routeInfo
.
merchantId
}
this
.
$apis
.
goods
.
getGoodsDetail
(
params
).
then
(
res
=>
{
],
if
(
res
)
{
selectedtableParams
:
{
for
(
const
key
in
this
.
formObj
){
listName
:
'list'
,
const
formatAttr
=
[
'depositPrice'
,
'minSellPrice'
,
'retailPrice'
]
tableOption
:
{
if
(
formatAttr
.
includes
(
key
)){
width
:
100
this
.
formObj
[
key
]
=
res
[
key
]
?
Number
(
Number
(
res
[
key
]
/
100
).
toFixed
(
2
))
:
0
},
}
else
{
tableColumns
:
notPriceColumns
this
.
formObj
[
key
]
=
res
[
key
]
}
}
}
}
},
this
.
curCategoryInfo
=
{
created
()
{
categoryName
:
res
.
associationClassifySecondName
,
// this.getCategory()
id
:
res
.
associationClassifySecondId
const
urlParam
=
this
.
$route
.
params
}
this
.
routeInfo
=
JSON
.
parse
(
decodeURIComponent
(
urlParam
.
id
))
this
.
formObj
.
goodsType
=
'1'
const
{
id
,
type
}
=
this
.
routeInfo
this
.
formObj
.
coverList
=
[
res
.
goodsImage
]
if
(
type
==
1
)
{
this
.
saleMerchantList
=
res
.
saleMerchantList
?.
map
(
item
=>
{
this
.
disabled
=
true
let
activityPrice
=
item
.
activityPrice
?
Number
(
Number
(
item
.
activityPrice
/
100
).
toFixed
(
2
))
:
0
this
.
posterOptions
.
isClose
=
false
let
originalPrice
=
item
.
originalPrice
?
Number
(
Number
(
item
.
originalPrice
/
100
).
toFixed
(
2
))
:
0
const
_target
=
this
.
goodsFormData
.
find
(
item
=>
item
.
name
==
'goodsName'
)
return
{...
item
,
activityPrice
,
originalPrice
}
_target
.
isDisabled
=
true
})
||
[]
this
.
selectedtableParams
.
tableOption
=
null
this
.
vehicleSeriesRequestList
=
res
?.
vehicleSeriesList
?.
map
(
item
=>
{
}
const
{
brandId
,
brandName
,
childBrandId
,
childBrandName
,
vehicleSeriesId
,
vehicleSeriesName
}
=
item
if
(
id
)
{
return
{
brandId
,
brandName
,
childBrandId
,
childBrandName
,
vehicleSeriesId
,
vehicleSeriesName
}
this
.
getDetail
()
})
||
[]
}
}
},
methods
:
{
// 上传视频
handleVideoChange
(
e
)
{
let
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
// 默认30MB
const
limitSize
=
20
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
if
(
!
isLt
)
{
this
.
$message
.
error
(
'上传视频大小不能超过'
+
limitSize
+
'MB!'
)
this
.
loading
=
false
return
}
this
.
$notify
({
title
:
'提示'
,
message
:
'视频上传中,请稍后'
})
document
.
querySelector
(
'.upload-video'
).
value
=
''
reader
.
readAsDataURL
(
file
)
reader
.
onload
=
e
=>
{
const
videoFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
+
'@'
+
videoFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
uploadVideoApi
({
file
:
base64
}).
then
(
res
=>
{
if
(
res
)
{
this
.
$notify
({
title
:
'提示'
,
message
:
'视频上传成功'
,
type
:
'success'
})
})
this
.
loading
=
false
this
.
formObj
.
goodsVideo
=
res
}
else
{
this
.
loading
=
false
}
})
}
},
// 预览图文
handleEnlarge
(
src
,
type
)
{
this
.
dialogVisibleImg
=
true
this
.
dialogSrc
=
src
this
.
dialogType
=
type
?
type
:
'img'
},
// 删除图片/视频
close
(
type
,
index
)
{
switch
(
type
)
{
case
'radio'
:
this
.
formObj
.
goodsVideo
=
''
break
default
:
this
.
formObj
.
goodsVideo
=
''
}
},
validateField
(
field
)
{
if
(
Array
.
isArray
(
field
))
{
field
.
forEach
(
item
=>
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
item
)
})
}
else
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
field
)
}
}
,
retainagePriceFn
(
price
)
{
let
depositPrice
=
this
.
formObj
.
paymentType
==
1
?
0
:
this
.
formObj
.
depositPrice
if
(
this
.
formObj
.
paymentType
==
1
)
return
'--'
if
(
!
price
)
{
return
'待计算'
}
else
{
return
Number
((
price
-
depositPrice
).
toFixed
(
2
))
}
}
,
openGoodsDialog
()
{
if
(
this
.
disabled
)
return
this
.
goodsVisible
=
true
}
,
handleGoodsClose
()
{
this
.
goodsVisible
=
false
}
,
handleGoodsConfirm
(
e
)
{
if
(
this
.
formObj
.
smartcarlifeInfoId
!=
e
?.
id
)
this
.
saleMerchantList
=
[]
let
{
id
:
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
minSellPrice
,
retailPrice
,
goodsVideo
}
=
e
||
{}
minSellPrice
=
minSellPrice
?
Number
(
Number
(
minSellPrice
/
100
).
toFixed
(
2
))
:
0
retailPrice
=
retailPrice
?
Number
(
Number
(
retailPrice
/
100
).
toFixed
(
2
))
:
0
// 若选择的商品素材包含了视频,则带入对应的视频文件
if
(
goodsVideo
)
this
.
formObj
.
goodsVideo
=
goodsVideo
this
.
formObj
=
{
...
this
.
formObj
,
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
coverList
:
[
goodsImage
],
minSellPrice
,
retailPrice
}
this
.
handleGoodsClose
()
this
.
validateField
([
'selectGoodsName'
,
'goodsInfoName'
])
}
,
handleCarSeriesClose
()
{
this
.
carDialogVisible
=
!
this
.
carDialogVisible
}
,
handleConfirm
(
e
=
{})
{
let
carList
=
[]
for
(
const
key
in
e
)
{
for
(
const
sonKey
in
e
[
key
])
{
carList
=
[...
carList
,
...
e
[
key
][
sonKey
]]
}
}
this
.
vehicleSeriesRequestList
=
carList
.
map
(
item
=>
{
const
{
id
,
name
,
parentId
,
parentName
,
rootId
,
rootName
}
=
item
return
{
brandId
:
rootId
,
brandName
:
rootName
,
childBrandId
:
parentId
,
childBrandName
:
parentName
,
vehicleSeriesId
:
id
,
vehicleSeriesName
:
name
}
}
})
this
.
handleCarSeriesClose
()
this
.
validateField
(
'carSeriesName'
)
}
}
}
,
</
script
>
confirmDialog
(
e
)
{
<
style
scoped
lang=
"scss"
>
this
.
saleMerchantList
=
e
||
[]
.container
{
this
.
closeDialog
()
.glsx-combi-form{
this
.
validateField
(
'saleStore'
)
/deep/
.el-radio-group{
}
.el-radio__label{
,
padding-left
:
8px
;
closeDialog
()
{
if
(
!
this
.
merchantDialogVisible
&&
!
this
.
formObj
.
smartcarlifeInfoId
)
{
return
this
.
$message
.
error
(
'请先选择商品'
)
}
this
.
merchantDialogVisible
=
!
this
.
merchantDialogVisible
}
,
handleDel
(
row
)
{
const
idx
=
this
.
saleMerchantList
.
findIndex
(
item
=>
item
.
merchantId
==
row
.
merchantId
)
if
(
idx
>
-
1
)
this
.
saleMerchantList
.
splice
(
idx
,
1
)
}
,
selectCategory
(
e
)
{
this
.
formObj
.
associationClassifyFirstId
=
e
?.
parent
?.
id
this
.
formObj
.
associationClassifySecondId
=
e
?.
data
?.
id
this
.
validateField
(
'categoryName'
)
}
,
getParams
()
{
let
obj
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
formObj
))
obj
.
goodsImage
=
obj
.
coverList
[
0
]
obj
.
depositPrice
=
obj
.
depositPrice
?
Number
(
Number
(
obj
.
depositPrice
*
10
*
10
).
toFixed
(
0
))
:
0
if
(
obj
.
paymentType
==
1
)
delete
obj
.
depositPrice
delete
obj
.
minSellPrice
delete
obj
.
retailPrice
delete
obj
.
coverList
let
saleMerchantList
=
this
.
saleMerchantList
.
map
(
item
=>
{
let
{
merchantId
,
merchantName
,
activityPrice
,
originalPrice
}
=
item
let
price
=
this
.
formObj
.
paymentType
==
1
?
0
:
this
.
formObj
.
depositPrice
let
retainagePrice
=
activityPrice
-
price
activityPrice
=
activityPrice
?
Number
(
Number
(
activityPrice
*
10
*
10
).
toFixed
(
0
))
:
0
retainagePrice
=
retainagePrice
?
Number
(
Number
(
retainagePrice
*
10
*
10
).
toFixed
(
0
))
:
0
originalPrice
=
originalPrice
?
Number
(
Number
(
originalPrice
*
10
*
10
).
toFixed
(
0
))
:
0
if
(
obj
.
paymentType
==
1
)
{
return
{
merchantId
,
merchantName
,
activityPrice
,
originalPrice
}
}
else
{
return
{
merchantId
,
merchantName
,
activityPrice
,
retainagePrice
,
originalPrice
}
}
})
const
params
=
{
saleMerchantList
:
saleMerchantList
,
vehicleSeriesRequestList
:
this
.
vehicleSeriesRequestList
,
...
obj
}
if
(
this
.
routeInfo
.
id
)
params
.
id
=
this
.
routeInfo
.
id
return
params
}
,
handleSave
()
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validate
(
valid
=>
{
if
(
valid
)
{
const
params
=
this
.
getParams
()
this
.
$apis
.
goods
.
addGoodsApi
(
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
.
success
(
'操作成功'
)
this
.
handleCancel
()
}
}
})
}
}
})
}
}
background-color
:
#fff
;
,
.disabled-class
{
handleCancel
()
{
cursor
:
not-allowed
;
this
.
$router
.
back
()
color
:
#666666
;
}
}
.goods-wrap
{
,
padding
:
20px
20px
1px
;
getDetail
()
{
width
:
1000px
;
const
params
=
{
background
:
#F9F9F9
;
id
:
this
.
routeInfo
.
id
border-radius
:
4px
;
}
.upload-calss{
if
(
this
.
routeInfo
.
merchantId
)
params
.
merchantId
=
this
.
routeInfo
.
merchantId
display
:
flex
;
this
.
$apis
.
goods
.
getGoodsDetail
(
params
).
then
(
res
=>
{
.tip{
if
(
res
)
{
height
:
20px
;
for
(
const
key
in
this
.
formObj
)
{
line-height
:
20px
;
const
formatAttr
=
[
'depositPrice'
,
'minSellPrice'
,
'retailPrice'
]
align-self
:
flex-end
;
if
(
formatAttr
.
includes
(
key
))
{
font-weight
:
400
;
this
.
formObj
[
key
]
=
res
[
key
]
?
Number
(
Number
(
res
[
key
]
/
100
).
toFixed
(
2
))
:
0
font-size
:
14px
;
}
else
{
color
:
#999999
;
this
.
formObj
[
key
]
=
res
[
key
]
margin-left
:
10px
;
}
}
}
this
.
curCategoryInfo
=
{
categoryName
:
res
.
associationClassifySecondName
,
id
:
res
.
associationClassifySecondId
}
this
.
formObj
.
goodsType
=
'1'
this
.
formObj
.
coverList
=
[
res
.
goodsImage
]
this
.
saleMerchantList
=
res
.
saleMerchantList
?.
map
(
item
=>
{
let
activityPrice
=
item
.
activityPrice
?
Number
(
Number
(
item
.
activityPrice
/
100
).
toFixed
(
2
))
:
0
let
originalPrice
=
item
.
originalPrice
?
Number
(
Number
(
item
.
originalPrice
/
100
).
toFixed
(
2
))
:
0
return
{...
item
,
activityPrice
,
originalPrice
}
})
||
[]
this
.
vehicleSeriesRequestList
=
res
?.
vehicleSeriesList
?.
map
(
item
=>
{
const
{
brandId
,
brandName
,
childBrandId
,
childBrandName
,
vehicleSeriesId
,
vehicleSeriesName
}
=
item
return
{
brandId
,
brandName
,
childBrandId
,
childBrandName
,
vehicleSeriesId
,
vehicleSeriesName
}
})
||
[]
}
}
})
}
}
.category-class
{
}
width
:
432px
;
}
</
script
>
<
style
scoped
lang=
"scss"
>
.container
{
.glsx-combi-form
{
/deep/
.el-radio-group
{
.el-radio__label
{
padding-left
:
8px
;
}
}
}
.money-wrap
{
}
.label{
width
:
92px
;
background-color
:
#fff
;
height
:
20px
;
line-height
:
20px
;
.disabled-class
{
font-weight
:
400
;
cursor
:
not-allowed
;
font-size
:
14px
;
color
:
#666666
;
color
:
#333333
;
}
text-align
:
right
;
}
.goods-wrap
{
.el-input
{
padding
:
20px
20px
1px
;
width
:
432px
;
width
:
1000px
;
}
background
:
#F9F9F9
;
border-radius
:
4px
;
.upload-calss
{
display
:
flex
;
.tip
{
height
:
20px
;
line-height
:
20px
;
align-self
:
flex-end
;
font-weight
:
400
;
font-size
:
14px
;
color
:
#999999
;
margin-left
:
10px
;
}
}
}
.selected-table
{
}
margin-top
:
10px
;
width
:
100%
;
.category-class
{
max-width
:
1000px
;
width
:
432px
;
.el-button--text{
}
padding
:
0
;
}
.money-wrap
{
.label
{
width
:
92px
;
height
:
20px
;
line-height
:
20px
;
font-weight
:
400
;
font-size
:
14px
;
color
:
#333333
;
text-align
:
right
;
}
}
.car-series-wrap
{
margin-top
:
8px
;
.el-input
{
width
:
580px
;
width
:
432px
;
height
:
80px
;
}
background
:
#FFFFFF
;
}
border
:
1px
solid
#E8E8EA
;
border-radius
:
4px
;
.selected-table
{
padding
:
6px
8px
;
margin-top
:
10px
;
overflow-y
:
auto
;
width
:
100%
;
.car-series-item{
max-width
:
1000px
;
display
:
inline-block
;
padding
:
0
8px
;
.el-button--text
{
height
:
24px
;
padding
:
0
;
color
:
#666666
;
}
line-height
:
24px
;
}
background
:
#FAFBFE
;
border
:
1px
solid
#E5E5E5
;
.car-series-wrap
{
border-radius
:
4px
;
margin-top
:
8px
;
margin-right
:
4px
;
width
:
580px
;
}
height
:
80px
;
background
:
#FFFFFF
;
border
:
1px
solid
#E8E8EA
;
border-radius
:
4px
;
padding
:
6px
8px
;
overflow-y
:
auto
;
.car-series-item
{
display
:
inline-block
;
padding
:
0
8px
;
height
:
24px
;
color
:
#666666
;
line-height
:
24px
;
background
:
#FAFBFE
;
border
:
1px
solid
#E5E5E5
;
border-radius
:
4px
;
margin-right
:
4px
;
}
}
}
.upload-img
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
width
:
104px
;
height
:
104px
;
background
:
rgba
(
0
,
0
,
0
,
0.04
);
border
:
1px
dashed
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
4px
;
input
{
position
:
absolute
;
//
top
:
0
;
//
left
:
0
;
width
:
104px
;
height
:
104px
;
}
}
.avatar-uploader-desc-word
{
font-weight
:
400
;
font-size
:
28
rpx
;
color
:
#666666
;
}
.video-box
{
position
:
relative
;
width
:
104px
;
height
:
104px
;
border-radius
:
4px
;
margin-right
:
8px
;
&:hover
.mask
{
opacity
:
1
;
}
.video
{
position
:
absolute
;
object-fit
:
fill
;
}
.photo-activity
{
position
:
absolute
;
width
:
104px
;
height
:
104px
;
}
.mask
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
absolute
;
background
:
rgba
(
0
,
0
,
0
,
0.5
);
color
:
#ffffff
;
opacity
:
0
;
top
:
0
;
right
:
0
;
width
:
104px
;
height
:
104px
;
z-index
:
999
;
.video-pane-close
{
width
:
14px
;
height
:
14px
;
cursor
:
pointer
;
margin-right
:
8px
;
}
}
}
}
.activity-img-box
{
display
:
flex
;
}
.text-tip2
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
14
rpx
;
color
:
#999999
;
margin-bottom
:
-35px
;
}
}
</
style
>
\ No newline at end of file
\ No newline at end of file
</
style
>
src/views/goods/addPrefer.vue
View file @
7e826a4
<
template
>
<
template
>
<div
class=
"goods-ctnr"
>
<div
class=
"goods-ctnr"
>
<div
class=
"global-title"
>
{{
!
routeInfo
.
id
?
'新增'
:
disabled
?
'查看'
:
'编辑'
}}
商品
</div>
<div
class=
"global-title"
>
{{
!
routeInfo
.
id
?
'新增'
:
disabled
?
'查看'
:
'编辑'
}}
商品
</div>
<div
class=
"container"
>
<div
class=
"container"
>
<glsx-combi-form
:isInline=
"false"
class=
"glsx-combi-form"
ref=
"baseInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"formData"
:formRules=
"myRule"
>
<glsx-combi-form
:isInline=
"false"
class=
"glsx-combi-form"
ref=
"baseInfoRef"
labelWidth=
"154px"
<div
slot=
"selectBtnSlot"
>
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"formData"
:formRules=
"myRule"
>
<el-button
:class=
"['el-icon-plus',
{'disabled-class':disabled}]" size="small" @click="openGoodsDialog">选择商品
</el-button>
<div
slot=
"selectBtnSlot"
>
</div>
<el-button
:class=
"['el-icon-plus',
{'disabled-class':disabled}]" size="small" @click="openGoodsDialog">
<div
slot=
"goodsInfoSlot"
class=
"goods-wrap"
>
选择商品
<glsx-combi-form
:isInline=
"false"
ref=
"goodsInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
:formObj
.
sync=
"formObj"
:formData=
"goodsFormData"
:formRules=
"goodsRule"
>
</el-button>
<div
slot=
"uploadSlot"
class=
"upload-calss"
>
</div>
<glsx-preview
:picOptions=
"posterOptions"
:imageUrlArr=
"formObj.coverList"
@
change=
"changeChannelImg"
></glsx-preview>
<div
slot=
"goodsInfoSlot"
class=
"goods-wrap"
>
<span
class=
"tip"
>
建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内
</span>
<glsx-combi-form
:isInline=
"false"
ref=
"goodsInfoRef"
labelWidth=
"154px"
defaultWidth=
"432px"
</div>
:formObj
.
sync=
"formObj"
:formData=
"goodsFormData"
:formRules=
"goodsRule"
>
</glsx-combi-form>
<div
slot=
"uploadSlot"
class=
"upload-calss"
>
</div>
<glsx-preview
:picOptions=
"posterOptions"
:imageUrlArr=
"formObj.coverList"
<div
slot=
"saleStoreSlot"
>
@
change=
"changeChannelImg"
></glsx-preview>
<el-button
v-if=
"!disabled"
class=
"el-icon-plus"
size=
"small"
@
click=
"closeDialog"
>
选择门店
</el-button>
<span
class=
"tip"
>
建议尺寸750*750,图片格式为jpg,jpeg,png,大小2M以内
</span>
<template
v-if=
"saleMerchantList && saleMerchantList.length"
>
</div>
<GLTable
class=
"selected-table"
:hasPage=
"false"
ref=
"selectedRef"
:tableParams=
"selectedtableParams"
:tableData=
"saleMerchantList"
>
</glsx-combi-form>
<div
slot=
"activityPriceSlot"
slot-scope=
"scope"
>
</div>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
v-model=
"scope.scope.activityPrice"
></format-input>
<div
slot=
"saleStoreSlot"
>
</div>
<el-button
v-if=
"!disabled"
class=
"el-icon-plus"
size=
"small"
@
click=
"closeDialog"
>
选择门店
</el-button>
<div
slot=
"originalPriceSlot"
slot-scope=
"scope"
>
<template
v-if=
"saleMerchantList && saleMerchantList.length"
>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
v-model=
"scope.scope.originalPrice"
></format-input>
<GLTable
class=
"selected-table"
:hasPage=
"false"
ref=
"selectedRef"
:tableParams=
"selectedtableParams"
</div>
:tableData=
"saleMerchantList"
>
<div
slot=
"giveIntegralSlot"
slot-scope=
"scope"
>
<div
slot=
"activityPriceSlot"
slot-scope=
"scope"
>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
v-model=
"scope.scope.giveIntegral"
></format-input>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
</div>
v-model=
"scope.scope.activityPrice"
></format-input>
<div
slot=
"auth-button"
slot-scope=
"scope"
>
</div>
<el-button
v-if=
"!disabled"
type=
"text"
@
click=
"handleDel(scope.scope)"
>
删除
</el-button>
<div
slot=
"originalPriceSlot"
slot-scope=
"scope"
>
</div>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
</GLTable>
v-model=
"scope.scope.originalPrice"
></format-input>
</
template
>
</div>
</div>
<div
slot=
"giveIntegralSlot"
slot-scope=
"scope"
>
<div
slot=
"expressFeeSlot"
>
<format-input
:disabled=
"disabled"
:intDigit=
"6"
:precise=
"2"
placeholder=
"请输入"
<format-input
class=
"expressFee-class"
:disabled=
"disabled"
:intDigit=
"4"
:precise=
"2"
v-model=
"formObj.expressFee"
></format-input>
v-model=
"scope.scope.giveIntegral"
></format-input>
</div>
<div
slot=
"auth-button"
slot-scope=
"scope"
>
<el-button
v-if=
"!disabled"
type=
"text"
@
click=
"handleDel(scope.scope)"
>
删除
</el-button>
</div>
</GLTable>
</
template
>
</div>
<div
slot=
"productVideoSlot"
>
<el-form-item
label=
""
>
<
template
v-if=
"!formObj.goodsVideo"
>
<div
class=
"upload-img"
>
<i
class=
"el-icon-plus avatar-uploader-desc-icon"
></i>
<div
class=
"avatar-uploader-desc-word"
>
上传视频
</div>
<input
type=
"file"
class=
"upload-video"
style=
"opacity: 0"
accept=
".mp4"
@
change=
"e => handleVideoChange(e)"
/>
</div>
</
template
>
<
template
v-else
>
<div
class=
"video-box"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"formObj.goodsVideo"
type=
"video/mp4"
/>
</video>
<div
class=
"mask"
>
<div
class=
"video-pane-close"
@
click=
"handleEnlarge(formObj.goodsVideo, 'video')"
>
<img
src=
"../../assets/channel/view.png"
alt=
""
/>
</div>
<div
class=
"video-pane-close"
@
click=
"close('radio')"
>
<img
src=
"../../assets/channel/dele.png"
alt=
""
/>
</div>
</div>
</div>
</glsx-combi-form>
</div>
</
template
>
<div
class=
"text-tip2"
>
作为商品详情页顶部展示和详情展示,格式建议mp4,大小不超过20M
</div>
</el-form-item>
</div>
<div
slot=
"expressFeeSlot"
>
<format-input
class=
"expressFee-class"
:disabled=
"disabled"
:intDigit=
"4"
:precise=
"2"
v-model=
"formObj.expressFee"
></format-input>
</div>
</div>
<GLFooter
style=
"margin-top: 16px;"
>
</glsx-combi-form>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
v-if=
"!disabled"
type=
"primary"
@
click=
"handleSave"
>
确定
</el-button>
</GLFooter>
<selectGoods
v-if=
"goodsVisible"
:routeInfo=
"routeInfo"
:dialogVisible=
"goodsVisible"
:goodsInfo=
"formObj"
@
handleGoodsConfirm=
"handleGoodsConfirm"
@
handleGoodsClose=
"handleGoodsClose"
></selectGoods>
<selectMerchantDialog
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:goodsId=
"formObj.smartcarlifeInfoId"
:selectedList=
"saleMerchantList"
v-if=
"merchantDialogVisible"
:isVisible=
"merchantDialogVisible"
></selectMerchantDialog>
</div>
</div>
<GLFooter
style=
"margin-top: 16px;"
>
<el-button
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
v-if=
"!disabled"
type=
"primary"
@
click=
"handleSave"
>
确定
</el-button>
</GLFooter>
<selectGoods
v-if=
"goodsVisible"
:routeInfo=
"routeInfo"
:dialogVisible=
"goodsVisible"
:goodsInfo=
"formObj"
@
handleGoodsConfirm=
"handleGoodsConfirm"
@
handleGoodsClose=
"handleGoodsClose"
></selectGoods>
<selectMerchantDialog
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:goodsId=
"formObj.smartcarlifeInfoId"
:selectedList=
"saleMerchantList"
v-if=
"merchantDialogVisible"
:isVisible=
"merchantDialogVisible"
></selectMerchantDialog>
<el-dialog
class=
"image-dialog"
:visible
.
sync=
"dialogVisibleImg"
width=
"50%"
>
<img
:src=
"dialogSrc"
width=
"100%"
v-if=
"dialogType == 'img'"
/>
<video
width=
"100%"
autoplay
controls
:src=
"dialogSrc"
v-else
></video>
</el-dialog>
</div>
</template>
</template>
<
script
>
<
script
>
const
MerchantColumns
=
[
const
MerchantColumns
=
[
{
label
:
'门店名称'
,
prop
:
'merchantName'
},
{
label
:
'门店原价(元)'
,
addHtml
:
'originalPriceSlot'
},
{
label
:
'门店价格(元)'
,
width
:
220
,
addHtml
:
'activityPriceSlot'
},
{
label
:
'赠送积分'
,
width
:
220
,
addHtml
:
'giveIntegralSlot'
}
]
import
glsxCombiForm
from
'@/components/glsx-combi-form'
import
selectGoods
from
'./components/selectGoods'
import
selectMerchantDialog
from
'./components/selectMerchantDialog'
export
default
{
name
:
'add'
,
components
:
{
glsxCombiForm
,
selectGoods
,
selectMerchantDialog
},
data
()
{
return
{
dialogVisibleImg
:
false
,
goodsVisible
:
false
,
merchantDialogVisible
:
false
,
disabled
:
false
,
dialogSrc
:
''
,
goodsInfo
:
{},
routeInfo
:
{},
posterOptions
:
{
width
:
'104px'
,
height
:
'104px'
,
key
:
'posterImg'
,
isClose
:
true
},
goodsFormData
:
[
{
{
label
:
'门店名称'
,
label
:
'商品图'
,
prop
:
'merchantName'
addHtml
:
'uploadSlot'
,
isDisabled
:
false
},
},
{
{
label
:
'门店原价(元)'
,
label
:
'商品名称'
,
addHtml
:
'originalPriceSlot'
name
:
'goodsName'
,
maxlength
:
20
,
showLimit
:
true
,
type
:
'input'
,
isDisabled
:
false
},
},
{
{
label
:
'门店价格
(元)'
,
label
:
'售价
(元)'
,
width
:
220
,
name
:
'retailPrice'
,
addHtml
:
'activityPriceSlo
t'
type
:
'showTx
t'
},
},
{
{
label
:
'赠送积分'
,
label
:
'最低售价(元)'
,
width
:
220
,
name
:
'minSellPrice'
,
addHtml
:
'giveIntegralSlot'
type
:
'showTxt'
}
},
]
],
import
glsxCombiForm
from
'@/components/glsx-combi-form'
formObj
:
{
import
selectGoods
from
'./components/selectGoods'
source
:
'2'
,
import
selectMerchantDialog
from
'./components/selectMerchantDialog'
method
:
'2'
,
export
default
{
goodsType
:
'2'
,
name
:
'add'
,
expressFee
:
''
,
components
:
{
smartcarlifeInfoId
:
''
,
glsxCombiForm
,
goodsName
:
''
,
selectGoods
,
goodsImage
:
''
,
selectMerchantDialog
minSellPrice
:
''
,
},
retailPrice
:
''
,
data
()
{
goodsVideo
:
''
,
return
{
coverList
:
[],
goodsVisible
:
false
,
associationClassifyFirstId
:
''
,
merchantDialogVisible
:
false
,
introduction
:
''
disabled
:
false
,
},
goodsInfo
:
{},
saleMerchantList
:
[],
routeInfo
:
{},
goodsList
:
[],
posterOptions
:
{
myRule
:
{
width
:
'104px'
,
selectBtnSlot
:
[
height
:
'104px'
,
{
key
:
'posterImg'
,
required
:
true
,
isClose
:
true
validator
:
(
rule
,
value
,
callback
)
=>
{
},
if
(
!
this
.
formObj
.
smartcarlifeInfoId
)
{
goodsFormData
:[
callback
(
new
Error
(
'请选择商品'
))
{
}
else
{
label
:
'商品图'
,
callback
()
addHtml
:
'uploadSlot'
,
}
isDisabled
:
false
},
{
label
:
'商品名称'
,
name
:
'goodsName'
,
maxlength
:
20
,
showLimit
:
true
,
type
:
'input'
,
isDisabled
:
false
},
{
label
:
'售价(元)'
,
name
:
'retailPrice'
,
type
:
'showTxt'
},
{
label
:
'最低售价(元)'
,
name
:
'minSellPrice'
,
type
:
'showTxt'
},
],
formObj
:{
source
:
'2'
,
method
:
'2'
,
goodsType
:
'2'
,
expressFee
:
''
,
smartcarlifeInfoId
:
''
,
goodsName
:
''
,
goodsImage
:
''
,
minSellPrice
:
''
,
retailPrice
:
''
,
coverList
:
[],
associationClassifyFirstId
:
''
,
introduction
:
''
},
saleMerchantList
:[],
goodsList
:
[],
myRule
:
{
selectBtnSlot
:
[
{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
smartcarlifeInfoId
){
callback
(
new
Error
(
'请选择商品'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}
],
goodsInfoSlot
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
if
(
!
this
.
formObj
.
coverList
&&
!
this
.
formObj
.
coverList
[
0
]){
callback
(
new
Error
(
'请上传商品图'
))
}
else
if
(
!
this
.
formObj
.
goodsName
){
callback
(
new
Error
(
'请输入商品名称'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
saleStoreSlot
:
[{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
{
const
_target
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
activityPrice
||
!
item
.
originalPrice
)
const
_integralTarget
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
giveIntegral
)
const
hasTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
let
originalPrice
=
item
.
originalPrice
||
0
let
activityPrice
=
item
.
activityPrice
||
0
let
minSellPrice
=
this
.
formObj
.
minSellPrice
||
0
return
(
+
activityPrice
>
+
originalPrice
||
+
originalPrice
<
minSellPrice
)
})
if
(
!
this
.
saleMerchantList
.
length
){
callback
(
new
Error
(
'请选择门店'
))
}
else
if
(
_target
){
callback
(
new
Error
(
'门店活动价和原价不能为空'
))
}
else
if
(
hasTarget
){
callback
(
new
Error
(
'原价不能小于最低售价和活动价'
))
}
else
if
(
_integralTarget
){
callback
(
new
Error
(
'请输入赠送积分'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}],
associationClassifyFirstId
:
[{
required
:
true
,
message
:
'请选择关联商品分类'
,
trigger
:
'change'
}],
source
:
[{
required
:
true
,
message
:
'请选择来源'
,
trigger
:
'change'
}],
method
:
[{
required
:
true
,
message
:
'请选择配送方式'
,
trigger
:
'change'
}],
expressFee
:
[{
required
:
true
,
message
:
'请输入运费'
,
trigger
:
'change'
}],
},
},
formData
:[
trigger
:
'change'
{
}
label
:
'关联商品分类'
,
],
name
:
'associationClassifyFirstId'
,
goodsInfoSlot
:
[{
type
:
'select'
,
required
:
true
,
optionList
:
[],
validator
:
(
rule
,
value
,
callback
)
=>
{
optionId
:
'id'
,
if
(
!
this
.
formObj
.
coverList
&&
!
this
.
formObj
.
coverList
[
0
])
{
optionLabel
:
'categoryName'
,
callback
(
new
Error
(
'请上传商品图'
))
isDisabled
:
false
}
else
if
(
!
this
.
formObj
.
goodsName
)
{
},
callback
(
new
Error
(
'请输入商品名称'
))
{
}
else
{
label
:
'来源'
,
callback
()
name
:
'source'
,
type
:
'radio'
,
optionList
:
[{
confId
:
'2'
,
confName
:
'嘀加智享平台'
}],
optionId
:
'confId'
,
optionLabel
:
'confName'
,
isDisabled
:
false
},
{
label
:
'选择商品'
,
name
:
'selectBtnSlot'
,
addHtml
:
'selectBtnSlot'
,
isDisabled
:
false
},
{
label
:
'商品信息'
,
name
:
'goodsInfoSlot'
,
addHtml
:
'goodsInfoSlot'
,
isDisabled
:
false
},
{
label
:
'销售门店'
,
name
:
'saleStoreSlot'
,
addHtml
:
'saleStoreSlot'
,
isDisabled
:
false
},
{
label
:
'配送方式'
,
name
:
'method'
,
type
:
'radio'
,
optionList
:
[{
confId
:
'2'
,
confName
:
'快递发货'
}],
optionId
:
'confId'
,
optionLabel
:
'confName'
,
isDisabled
:
false
},
{
label
:
'运费/元'
,
name
:
'expressFee'
,
addHtml
:
'expressFeeSlot'
,
isDisabled
:
false
},
{
label
:
'服务说明'
,
name
:
'introduction'
,
type
:
'input'
,
inputType
:
'textarea'
,
isDisabled
:
false
,
maxlength
:
200
},
],
selectedtableParams
:
{
listName
:
'list'
,
tableOption
:
{
width
:
100
},
tableColumns
:
MerchantColumns
}
}
}
},
},
trigger
:
'change'
created
(){
}],
this
.
getCategory
()
saleStoreSlot
:
[{
const
urlParam
=
this
.
$route
.
params
required
:
true
,
this
.
routeInfo
=
JSON
.
parse
(
decodeURIComponent
(
urlParam
.
id
))
validator
:
(
rule
,
value
,
callback
)
=>
{
const
{
id
,
type
}
=
this
.
routeInfo
const
_target
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
activityPrice
||
!
item
.
originalPrice
)
if
(
type
==
1
)
{
const
_integralTarget
=
this
.
saleMerchantList
.
find
(
item
=>
!
item
.
giveIntegral
)
this
.
disabled
=
true
const
hasTarget
=
this
.
saleMerchantList
.
find
(
item
=>
{
this
.
posterOptions
.
isClose
=
false
let
originalPrice
=
item
.
originalPrice
||
0
const
_target
=
this
.
goodsFormData
.
find
(
item
=>
item
.
name
==
'goodsName'
)
let
activityPrice
=
item
.
activityPrice
||
0
_target
.
isDisabled
=
true
let
minSellPrice
=
this
.
formObj
.
minSellPrice
||
0
const
disabledList
=
[
'associationClassifyFirstId'
,
'source'
,
'method'
,
'introduction'
]
return
(
+
activityPrice
>
+
originalPrice
||
+
originalPrice
<
minSellPrice
)
disabledList
.
forEach
(
ele
=>
{
const
_disabledTarget
=
this
.
formData
.
find
(
item
=>
item
.
name
==
ele
)
_disabledTarget
.
isDisabled
=
true
})
})
this
.
selectedtableParams
.
tableOption
=
null
if
(
!
this
.
saleMerchantList
.
length
)
{
}
callback
(
new
Error
(
'请选择门店'
))
if
(
id
){
}
else
if
(
_target
)
{
this
.
getDetail
()
callback
(
new
Error
(
'门店活动价和原价不能为空'
))
}
}
else
if
(
hasTarget
)
{
},
callback
(
new
Error
(
'原价不能小于最低售价和活动价'
))
methods
:{
}
else
if
(
_integralTarget
)
{
getCategory
(){
callback
(
new
Error
(
'请输入赠送积分'
))
const
params
=
{
}
else
{
pageSize
:
10000
,
callback
()
pageNum
:
1
,
categoryType
:
2
}
this
.
$apis
.
category
.
getCategoryListApi
(
params
).
then
(
res
=>
{
if
(
res
?.
list
?.
length
){
const
_target
=
this
.
formData
.
find
(
item
=>
item
.
name
==
'associationClassifyFirstId'
)
_target
.
optionList
=
res
.
list
}
})
},
validateField
(
field
){
if
(
Array
.
isArray
(
field
)){
field
.
forEach
(
item
=>
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
item
)
})
}
else
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
field
)
}
}
},
trigger
:
'change'
}],
associationClassifyFirstId
:
[{
required
:
true
,
message
:
'请选择关联商品分类'
,
trigger
:
'change'
}],
source
:
[{
required
:
true
,
message
:
'请选择来源'
,
trigger
:
'change'
}],
method
:
[{
required
:
true
,
message
:
'请选择配送方式'
,
trigger
:
'change'
}],
expressFee
:
[{
required
:
true
,
message
:
'请输入运费'
,
trigger
:
'change'
}],
},
formData
:
[
{
label
:
'关联商品分类'
,
name
:
'associationClassifyFirstId'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'categoryName'
,
isDisabled
:
false
},
},
openGoodsDialog
(){
{
if
(
this
.
disabled
)
return
label
:
'来源'
,
this
.
goodsVisible
=
true
name
:
'source'
,
type
:
'radio'
,
optionList
:
[{
confId
:
'2'
,
confName
:
'嘀加智享平台'
}],
optionId
:
'confId'
,
optionLabel
:
'confName'
,
isDisabled
:
false
},
},
handleGoodsClose
(){
{
this
.
goodsVisible
=
false
label
:
'选择商品'
,
name
:
'selectBtnSlot'
,
addHtml
:
'selectBtnSlot'
,
isDisabled
:
false
},
},
handleGoodsConfirm
(
e
){
{
if
(
this
.
formObj
.
smartcarlifeInfoId
!=
e
?.
id
)
this
.
saleMerchantList
=
[]
label
:
'商品信息'
,
let
{
id
:
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
minSellPrice
,
retailPrice
}
=
e
||
{}
name
:
'goodsInfoSlot'
,
minSellPrice
=
minSellPrice
?
Number
(
Number
(
minSellPrice
/
100
).
toFixed
(
2
))
:
0
addHtml
:
'goodsInfoSlot'
,
retailPrice
=
retailPrice
?
Number
(
Number
(
retailPrice
/
100
).
toFixed
(
2
))
:
0
isDisabled
:
false
this
.
formObj
=
{...
this
.
formObj
,
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
coverList
:
[
goodsImage
],
minSellPrice
,
retailPrice
}
this
.
handleGoodsClose
()
this
.
validateField
([
'selectBtnSlot'
,
'goodsInfoSlot'
])
},
},
confirmDialog
(
e
)
{
{
this
.
saleMerchantList
=
e
||
[]
label
:
'销售门店'
,
this
.
saleMerchantList
.
map
(
item
=>
this
.
$set
(
item
,
'giveIntegral'
,
''
))
name
:
'saleStoreSlot'
,
this
.
validateField
(
'saleStoreSlot'
)
addHtml
:
'saleStoreSlot'
,
this
.
closeDialog
()
isDisabled
:
false
},
},
closeDialog
(){
{
if
(
!
this
.
merchantDialogVisible
&&
!
this
.
formObj
.
smartcarlifeInfoId
){
label
:
'产品视频'
,
return
this
.
$message
.
error
(
'请先选择商品'
)
name
:
'productVideo'
,
}
addHtml
:
'productVideoSlot'
this
.
merchantDialogVisible
=
!
this
.
merchantDialogVisible
},
},
handleDel
(
row
)
{
{
const
idx
=
this
.
saleMerchantList
.
findIndex
(
item
=>
item
.
merchantId
==
row
.
merchantId
)
label
:
'配送方式'
,
if
(
idx
>-
1
)
this
.
saleMerchantList
.
splice
(
idx
,
1
)
name
:
'method'
,
type
:
'radio'
,
optionList
:
[{
confId
:
'2'
,
confName
:
'快递发货'
}],
optionId
:
'confId'
,
optionLabel
:
'confName'
,
isDisabled
:
false
},
},
getParams
(){
{
let
obj
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
formObj
))
label
:
'运费/元'
,
obj
.
goodsImage
=
obj
.
coverList
[
0
]
name
:
'expressFee'
,
obj
.
expressFee
=
obj
.
expressFee
?
Number
(
Number
(
obj
.
expressFee
*
10
*
10
).
toFixed
(
0
))
:
0
addHtml
:
'expressFeeSlot'
,
delete
obj
.
minSellPrice
isDisabled
:
false
delete
obj
.
retailPrice
delete
obj
.
coverList
delete
obj
.
source
delete
obj
.
method
let
saleMerchantList
=
this
.
saleMerchantList
.
map
(
item
=>
{
let
{
merchantId
,
merchantName
,
activityPrice
,
giveIntegral
,
originalPrice
}
=
item
activityPrice
=
activityPrice
?
Number
(
Number
(
activityPrice
*
10
*
10
).
toFixed
(
0
))
:
0
originalPrice
=
originalPrice
?
Number
(
Number
(
originalPrice
*
10
*
10
).
toFixed
(
0
))
:
0
return
{
merchantId
,
merchantName
,
activityPrice
,
giveIntegral
,
originalPrice
}
})
const
params
=
{
saleMerchantList
:
saleMerchantList
,
...
obj
}
if
(
this
.
routeInfo
.
id
)
params
.
id
=
this
.
routeInfo
.
id
return
params
},
},
handleSave
(){
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validate
(
valid
=>
{
label
:
'服务说明'
,
if
(
valid
){
name
:
'introduction'
,
const
params
=
this
.
getParams
()
type
:
'input'
,
this
.
$apis
.
goods
.
addGoodsApi
(
params
).
then
(
res
=>
{
inputType
:
'textarea'
,
if
(
res
)
{
isDisabled
:
false
,
this
.
$message
.
success
(
'操作成功'
)
maxlength
:
200
this
.
handleCancel
()
}
})
}
})
},
},
handleCancel
(){
],
this
.
$router
.
back
()
selectedtableParams
:
{
listName
:
'list'
,
tableOption
:
{
width
:
100
},
},
getDetail
(){
tableColumns
:
MerchantColumns
const
params
=
{
}
id
:
this
.
routeInfo
.
id
}
}
},
if
(
this
.
routeInfo
.
merchantId
)
params
.
merchantId
=
this
.
routeInfo
.
merchantId
created
()
{
this
.
$apis
.
goods
.
getGoodsDetail
(
params
).
then
(
res
=>
{
this
.
getCategory
()
if
(
res
)
{
const
urlParam
=
this
.
$route
.
params
for
(
const
key
in
this
.
formObj
){
this
.
routeInfo
=
JSON
.
parse
(
decodeURIComponent
(
urlParam
.
id
))
const
formatAttr
=
[
'depositPrice'
,
'minSellPrice'
,
'retailPrice'
,
'expressFee'
]
const
{
id
,
type
}
=
this
.
routeInfo
if
(
formatAttr
.
includes
(
key
)){
if
(
type
==
1
)
{
this
.
formObj
[
key
]
=
res
[
key
]
?
Number
(
Number
(
res
[
key
]
/
100
).
toFixed
(
2
))
:
0
this
.
disabled
=
true
}
else
{
this
.
posterOptions
.
isClose
=
false
this
.
formObj
[
key
]
=
res
[
key
]
const
_target
=
this
.
goodsFormData
.
find
(
item
=>
item
.
name
==
'goodsName'
)
}
_target
.
isDisabled
=
true
}
const
disabledList
=
[
'associationClassifyFirstId'
,
'source'
,
'method'
,
'introduction'
]
this
.
curCategoryInfo
=
{
disabledList
.
forEach
(
ele
=>
{
categoryName
:
res
.
associationClassifySecondName
,
const
_disabledTarget
=
this
.
formData
.
find
(
item
=>
item
.
name
==
ele
)
id
:
res
.
associationClassifySecondId
_disabledTarget
.
isDisabled
=
true
}
})
this
.
formObj
.
goodsType
=
'2'
this
.
selectedtableParams
.
tableOption
=
null
this
.
formObj
.
source
=
'2'
,
}
this
.
formObj
.
method
=
'2'
,
if
(
id
)
{
this
.
formObj
.
coverList
=
[
res
.
goodsImage
]
this
.
getDetail
()
this
.
saleMerchantList
=
res
.
saleMerchantList
?.
map
(
item
=>
{
}
let
activityPrice
=
item
.
activityPrice
?
Number
(
Number
(
item
.
activityPrice
/
100
).
toFixed
(
2
))
:
0
},
let
originalPrice
=
item
.
originalPrice
?
Number
(
Number
(
item
.
originalPrice
/
100
).
toFixed
(
2
))
:
0
methods
:
{
return
{...
item
,
activityPrice
,
originalPrice
}
// 上传视频
})
||
[]
handleVideoChange
(
e
)
{
}
let
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
// 默认30MB
const
limitSize
=
20
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
if
(
!
isLt
)
{
this
.
$message
.
error
(
'上传视频大小不能超过'
+
limitSize
+
'MB!'
)
this
.
loading
=
false
return
}
this
.
$notify
({
title
:
'提示'
,
message
:
'视频上传中,请稍后'
})
document
.
querySelector
(
'.upload-video'
).
value
=
''
reader
.
readAsDataURL
(
file
)
reader
.
onload
=
e
=>
{
const
videoFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
+
'@'
+
videoFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
uploadVideoApi
({
file
:
base64
}).
then
(
res
=>
{
if
(
res
)
{
this
.
$notify
({
title
:
'提示'
,
message
:
'视频上传成功'
,
type
:
'success'
})
})
this
.
loading
=
false
this
.
formObj
.
goodsVideo
=
res
}
else
{
this
.
loading
=
false
}
})
}
},
// 预览图文
handleEnlarge
(
src
,
type
)
{
this
.
dialogVisibleImg
=
true
this
.
dialogSrc
=
src
this
.
dialogType
=
type
?
type
:
'img'
},
// 删除图片/视频
close
(
type
,
index
)
{
switch
(
type
)
{
case
'radio'
:
this
.
formObj
.
goodsVideo
=
''
break
default
:
this
.
formObj
.
goodsVideo
=
''
}
},
getCategory
()
{
const
params
=
{
pageSize
:
10000
,
pageNum
:
1
,
categoryType
:
2
}
this
.
$apis
.
category
.
getCategoryListApi
(
params
).
then
(
res
=>
{
if
(
res
?.
list
?.
length
)
{
const
_target
=
this
.
formData
.
find
(
item
=>
item
.
name
==
'associationClassifyFirstId'
)
_target
.
optionList
=
res
.
list
}
}
})
},
validateField
(
field
)
{
if
(
Array
.
isArray
(
field
))
{
field
.
forEach
(
item
=>
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
item
)
})
}
else
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validateField
(
field
)
}
},
openGoodsDialog
()
{
if
(
this
.
disabled
)
return
this
.
goodsVisible
=
true
},
handleGoodsClose
()
{
this
.
goodsVisible
=
false
},
handleGoodsConfirm
(
e
)
{
if
(
this
.
formObj
.
smartcarlifeInfoId
!=
e
?.
id
)
this
.
saleMerchantList
=
[]
let
{
id
:
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
minSellPrice
,
retailPrice
,
goodsVideo
}
=
e
||
{}
minSellPrice
=
minSellPrice
?
Number
(
Number
(
minSellPrice
/
100
).
toFixed
(
2
))
:
0
retailPrice
=
retailPrice
?
Number
(
Number
(
retailPrice
/
100
).
toFixed
(
2
))
:
0
// 若选择的商品素材包含了视频,则带入对应的视频文件
if
(
goodsVideo
)
this
.
formObj
.
goodsVideo
=
goodsVideo
this
.
formObj
=
{
...
this
.
formObj
,
smartcarlifeInfoId
,
goodsName
,
goodsImage
,
coverList
:
[
goodsImage
],
minSellPrice
,
retailPrice
}
this
.
handleGoodsClose
()
this
.
validateField
([
'selectBtnSlot'
,
'goodsInfoSlot'
])
},
confirmDialog
(
e
)
{
this
.
saleMerchantList
=
e
||
[]
this
.
saleMerchantList
.
map
(
item
=>
this
.
$set
(
item
,
'giveIntegral'
,
''
))
this
.
validateField
(
'saleStoreSlot'
)
this
.
closeDialog
()
},
closeDialog
()
{
if
(
!
this
.
merchantDialogVisible
&&
!
this
.
formObj
.
smartcarlifeInfoId
)
{
return
this
.
$message
.
error
(
'请先选择商品'
)
}
this
.
merchantDialogVisible
=
!
this
.
merchantDialogVisible
},
handleDel
(
row
)
{
const
idx
=
this
.
saleMerchantList
.
findIndex
(
item
=>
item
.
merchantId
==
row
.
merchantId
)
if
(
idx
>
-
1
)
this
.
saleMerchantList
.
splice
(
idx
,
1
)
},
getParams
()
{
let
obj
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
formObj
))
obj
.
goodsImage
=
obj
.
coverList
[
0
]
obj
.
expressFee
=
obj
.
expressFee
?
Number
(
Number
(
obj
.
expressFee
*
10
*
10
).
toFixed
(
0
))
:
0
delete
obj
.
minSellPrice
delete
obj
.
retailPrice
delete
obj
.
coverList
delete
obj
.
source
delete
obj
.
method
let
saleMerchantList
=
this
.
saleMerchantList
.
map
(
item
=>
{
let
{
merchantId
,
merchantName
,
activityPrice
,
giveIntegral
,
originalPrice
}
=
item
activityPrice
=
activityPrice
?
Number
(
Number
(
activityPrice
*
10
*
10
).
toFixed
(
0
))
:
0
originalPrice
=
originalPrice
?
Number
(
Number
(
originalPrice
*
10
*
10
).
toFixed
(
0
))
:
0
return
{
merchantId
,
merchantName
,
activityPrice
,
giveIntegral
,
originalPrice
}
})
const
params
=
{
saleMerchantList
:
saleMerchantList
,
...
obj
}
if
(
this
.
routeInfo
.
id
)
params
.
id
=
this
.
routeInfo
.
id
return
params
},
handleSave
()
{
this
.
$refs
.
baseInfoRef
.
$refs
.
formRef
.
validate
(
valid
=>
{
if
(
valid
)
{
const
params
=
this
.
getParams
()
this
.
$apis
.
goods
.
addGoodsApi
(
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
.
success
(
'操作成功'
)
this
.
handleCancel
()
}
})
}
})
},
handleCancel
()
{
this
.
$router
.
back
()
},
getDetail
()
{
const
params
=
{
id
:
this
.
routeInfo
.
id
}
if
(
this
.
routeInfo
.
merchantId
)
params
.
merchantId
=
this
.
routeInfo
.
merchantId
this
.
$apis
.
goods
.
getGoodsDetail
(
params
).
then
(
res
=>
{
if
(
res
)
{
for
(
const
key
in
this
.
formObj
)
{
const
formatAttr
=
[
'depositPrice'
,
'minSellPrice'
,
'retailPrice'
,
'expressFee'
]
if
(
formatAttr
.
includes
(
key
))
{
this
.
formObj
[
key
]
=
res
[
key
]
?
Number
(
Number
(
res
[
key
]
/
100
).
toFixed
(
2
))
:
0
}
else
{
this
.
formObj
[
key
]
=
res
[
key
]
}
}
this
.
curCategoryInfo
=
{
categoryName
:
res
.
associationClassifySecondName
,
id
:
res
.
associationClassifySecondId
}
this
.
formObj
.
goodsType
=
'2'
this
.
formObj
.
source
=
'2'
,
this
.
formObj
.
method
=
'2'
,
this
.
formObj
.
coverList
=
[
res
.
goodsImage
]
this
.
saleMerchantList
=
res
.
saleMerchantList
?.
map
(
item
=>
{
let
activityPrice
=
item
.
activityPrice
?
Number
(
Number
(
item
.
activityPrice
/
100
).
toFixed
(
2
))
:
0
let
originalPrice
=
item
.
originalPrice
?
Number
(
Number
(
item
.
originalPrice
/
100
).
toFixed
(
2
))
:
0
return
{...
item
,
activityPrice
,
originalPrice
}
})
||
[]
}
})
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.container
{
.container
{
background-color
:
#fff
;
background-color
:
#fff
;
.glsx-combi-form{
/deep/
.el-radio-group{
.glsx-combi-form
{
.el-radio__label{
/deep/
.el-radio-group
{
padding-left
:
2px
;
.el-radio__label
{
}
padding-left
:
2px
;
}
}
}
.disabled-class
{
cursor
:
not-allowed
;
color
:
#666666
;
}
}
.goods-wrap
{
}
padding
:
20px
20px
1px
;
width
:
970px
;
.disabled-class
{
background
:
#F9F9F9
;
cursor
:
not-allowed
;
border-radius
:
4px
;
color
:
#666666
;
.upload-calss{
}
display
:
flex
;
.tip{
.goods-wrap
{
height
:
20px
;
padding
:
20px
20px
1px
;
line-height
:
20px
;
width
:
970px
;
align-self
:
flex-end
;
background
:
#F9F9F9
;
font-weight
:
400
;
border-radius
:
4px
;
font-size
:
14px
;
color
:
#999999
;
.upload-calss
{
margin-left
:
10px
;
display
:
flex
;
}
}
.tip
{
height
:
20px
;
line-height
:
20px
;
align-self
:
flex-end
;
font-weight
:
400
;
font-size
:
14px
;
color
:
#999999
;
margin-left
:
10px
;
}
}
}
.selected-table
{
}
margin-top
:
10px
;
width
:
970px
;
.selected-table
{
.el-button--text{
margin-top
:
10px
;
padding
:
0
;
width
:
970px
;
}
.el-button--text
{
padding
:
0
;
}
}
.expressFee-class
{
}
width
:
432px
;
.expressFee-class
{
width
:
432px
;
}
/
deep
/
#introduction
{
.el-textarea__inner
{
width
:
580px
;
height
:
80px
;
}
}
/
deep
/
#introduction
{
}
.el-textarea__inner{
}
width
:
580px
;
height
:
80px
;
.upload-img
{
}
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
width
:
104px
;
height
:
104px
;
background
:
rgba
(
0
,
0
,
0
,
0.04
);
border
:
1px
dashed
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
4px
;
input
{
position
:
absolute
;
//
top
:
0
;
//
left
:
0
;
width
:
104px
;
height
:
104px
;
}
}
.avatar-uploader-desc-word
{
font-weight
:
400
;
font-size
:
28
rpx
;
color
:
#666666
;
}
.video-box
{
position
:
relative
;
width
:
104px
;
height
:
104px
;
border-radius
:
4px
;
margin-right
:
8px
;
&:hover
.mask
{
opacity
:
1
;
}
.video
{
position
:
absolute
;
object-fit
:
fill
;
}
.photo-activity
{
position
:
absolute
;
width
:
104px
;
height
:
104px
;
}
.mask
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
absolute
;
background
:
rgba
(
0
,
0
,
0
,
0.5
);
color
:
#ffffff
;
opacity
:
0
;
top
:
0
;
right
:
0
;
width
:
104px
;
height
:
104px
;
z-index
:
999
;
.video-pane-close
{
width
:
14px
;
height
:
14px
;
cursor
:
pointer
;
margin-right
:
8px
;
}
}
}
}
.activity-img-box
{
display
:
flex
;
}
.text-tip2
{
font-family
:
PingFangSC-Regular
;
font-weight
:
400
;
font-size
:
14
rpx
;
color
:
#999999
;
margin-bottom
:
-35px
;
}
}
</
style
>
\ No newline at end of file
\ No newline at end of file
</
style
>
src/views/goods/browseList.vue
0 → 100644
View file @
7e826a4
<!-- 明细 -->
<
template
>
<div
class=
"edit-share marketing edit-box"
>
<div
class=
" container1 edit-container"
>
<p
class=
"edit-title"
>
{{
routeInfo
.
activityName
}}
</p>
<div
class=
"p-20"
>
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<div
class=
"flex m-b-10 w-100-percent"
>
<div
class=
"table-title"
>
已累计
<template
v-if=
"routeInfo.type != 2"
>
{{
decodeURI
(
routeInfo
.
name
)
}}
</
template
>
<span>
{{total || routeInfo.count }}
</span>
{{ routeInfo.type == 2 ? '位访客' : '次' }}
</div>
<el-button
:size=
"size"
class=
"default-blue-btn"
type=
"default"
@
click=
"handleExport"
>
导出
</el-button>
</div>
<!-- 表格区域 开始 -->
<GLTable
ref=
"browserRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
>
<div
slot=
"customerName"
class=
"flex-align"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.customerAvatar"
>
<el-popover
placement=
"top"
width=
"160"
trigger=
"hover"
popper-class=
"table-popover-block"
>
<img
class=
"table-popover-img"
:src=
"scope.scope.customerAvatar"
/>
<img
class=
"img-36 pointer"
slot=
"reference"
:src=
"scope.scope.customerAvatar"
/>
</el-popover>
</
template
>
<span
class=
"m-l-10"
>
{{ scope.scope.customerName }}
</span>
</div>
<div
slot=
"shareName"
class=
"flex-align"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.shareAvatar"
>
<el-popover
placement=
"top"
width=
"160"
trigger=
"hover"
popper-class=
"table-popover-block"
>
<img
class=
"table-popover-img"
:src=
"scope.scope.shareAvatar"
/>
<img
class=
"img-36 pointer"
slot=
"reference"
:src=
"scope.scope.shareAvatar"
/>
</el-popover>
</
template
>
<span
class=
"m-l-10"
>
{{ scope.scope.shareName }}
</span>
<span
class=
"m-l-10"
>
{{ scope.scope.sharePhone }}
</span>
</div>
<div
slot=
"isBuy"
slot-scope=
"scope"
>
<span
:class=
"['table-circle', 'm-r-8', scope.scope.isBuy == 'Y' ? 'back-green' : 'back-grey']"
></span>
<span>
{{
{
Y: '已付款',
N: '未付款'
}[scope.scope.isBuy] || '--'
}}
</span>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
<div
class=
"footer"
:style=
"{ left: footerLeft + 'px', width: footerWidth + 'px' }"
>
<el-button
type=
"default"
@
click=
"handleJump"
>
返回
</el-button>
</div>
</div>
</template>
<
script
>
import
*
as
dayjs
from
'dayjs'
import
url
from
'@/assets/empty.png'
import
{
exportFn
}
from
'@/common/constant'
export
default
{
name
:
'browseList'
,
data
()
{
return
{
size
:
'small'
,
url
:
url
,
footerLeft
:
'0'
,
footerWidth
:
'0'
,
routeInfo
:
{
id
:
''
,
activityName
:
''
},
searchForm
:
{
customerName
:
''
,
mobile
:
''
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
// 搜索
searchFormData
:
[
{
label
:
'微信昵称'
,
name
:
'customerName'
,
type
:
'input'
,
maxlength
:
50
},
{
label
:
'手机号'
,
name
:
'mobile'
,
type
:
'input'
,
maxlength
:
11
},
{
label
:
'分享人'
,
name
:
'shareName'
,
type
:
'input'
,
maxlength
:
50
}
],
// 表格
getListApi
:
null
,
tableParams
:
{
listName
:
'list'
,
tableColumns
:
[
{
label
:
'微信昵称'
,
prop
:
'customerName'
,
addHtml
:
'customerName'
},
{
label
:
'手机号'
,
prop
:
'mobile'
},
{
label
:
'分享人'
,
prop
:
'shareName'
,
addHtml
:
'shareName'
,
width
:
230
}
]
},
total
:
0
}
},
created
()
{
console
.
log
(
this
.
$route
.
query
)
const
lastTableColumns
=
[
{
label
:
'浏览时长'
,
prop
:
'browserTime'
},
{
label
:
'进入页面时间'
,
prop
:
'operationDate'
,
width
:
'180'
},
{
label
:
'离开页面时间'
,
prop
:
'leaveDate'
,
width
:
'180'
},
{
label
:
'订单状态'
,
prop
:
'isBuy'
,
addHtml
:
'isBuy'
}
],
{
query
}
=
this
.
$route
,
name
=
{
1
:
'浏览'
,
2
:
'访客'
,
3
:
'分享'
}[
query
.
type
],
[
url
]
=
window
.
location
.
href
.
split
(
'%24title'
),
apiName
=
this
.
$apis
.
goods
[
{
1
:
'getBrowseListApi'
,
2
:
'getVisitorListApi'
,
3
:
'getSharedListApi'
}[
query
.
type
]]
query
.
name
=
name
this
.
routeInfo
=
query
this
.
getListApi
=
apiName
if
(
query
.
type
==
1
)
this
.
getTotal
(
apiName
,
query
.
id
)
history
.
replaceState
(
null
,
null
,
`
${
url
}
&$title=
${
name
}
明细`
)
// listName:
//1 浏览 2 访客 3 分享
if
(
query
.
type
!=
2
)
{
this
.
searchFormData
.
push
({
label
:
'订单状态'
,
name
:
'isBuy'
,
type
:
'select'
,
width
:
'215px'
,
optionList
:
[
{
confId
:
''
,
confName
:
'全部'
},
{
confId
:
'Y'
,
confName
:
'已付款'
},
{
confId
:
'N'
,
confName
:
'未付款'
}
],
optionId
:
'confId'
,
optionLabel
:
'confName'
})
if
(
query
.
type
==
3
)
this
.
tableParams
.
tableColumns
.
push
({
label
:
'分享时间'
,
prop
:
'sharedTime'
})
this
.
tableParams
.
tableColumns
=
[...
this
.
tableParams
.
tableColumns
,
...
lastTableColumns
]
}
else
this
.
tableParams
.
tableColumns
=
[
...
this
.
tableParams
.
tableColumns
,
{
label
:
'浏览次数'
,
prop
:
'browseCount'
},
{
label
:
'最后浏览时间'
,
prop
:
'lastBrowseDate'
}
]
},
mounted
()
{
this
.
footerLeft
=
document
.
querySelector
(
'.base-container-right'
).
offsetLeft
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
},
methods
:
{
beforeSearchFn
()
{
return
new
Promise
(
resolve
=>
{
this
.
searchForm
.
id
=
this
.
routeInfo
.
id
resolve
()
})
},
handleExport
()
{
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
searchForm
)
let
{
type
}
=
this
.
routeInfo
params
.
pageNum
=
1
params
.
pageSize
=
999999
this
.
$apis
.
goods
.
exportBrowseApi
(
params
,
type
).
then
(
res
=>
{
exportFn
(
res
)
})
},
handleJump
(
path
,
row
=
{})
{
// this.$router.push({
// path: '/gooods/crowdFundList'
// })
// this.$route.query.activeName= this.routeInfo.activeName;
this
.
$router
.
back
()
},
setTableFinishFun
()
{
//接收到的数据为空
this
.
$refs
.
browserRef
.
data
.
length
?
(
this
.
$refs
.
browserRef
.
tableHeightValues
=
''
)
:
this
.
$refs
.
browserRef
.
setTableHeightFun
()
},
handleSearch
()
{
const
{
query
}
=
this
.
$route
this
.
$refs
.
browserRef
.
refreshTable
()
if
(
query
.
type
==
1
)
this
.
getTotal
(
this
.
$apis
.
goods
.
getBrowseListApi
,
query
.
id
)
},
handleReset
()
{
this
.
searchForm
=
{
id
:
this
.
routeInfo
.
id
,
customerName
:
''
,
mobile
:
''
}
this
.
handleSearch
()
},
async
getTotal
(
apiName
,
id
)
{
const
{
customerName
,
mobile
}
=
this
.
searchForm
,
{
total
}
=
await
apiName
({
pageSize
:
10
,
pageNum
:
1
,
id
,
customerName
,
mobile
})
this
.
total
=
total
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.edit-container
{
.table-title
{
font-weight
:
400
;
font-size
:
14px
;
color
:
#333333
;
line-height
:
20px
;
display
:
flex
;
align-items
:
center
;
span
{
color
:
#5850ff
;
}
}
}
.m-b-10
{
margin-bottom
:
10px
;
}
.m-l-10
{
margin-left
:
10px
;
}
.flex
{
display
:
flex
;
justify-content
:
space-between
;
}
.flex-align
{
display
:
flex
;
align-items
:
center
}
.footer
{
position
:
fixed
;
bottom
:
0
;
width
:
100%
;
height
:
64px
;
text-align
:
center
;
line-height
:
64px
;
background
:
#fff
;
z-index
:
999
;
}
.marketing
.edit-title
{
font-size
:
16px
;
font-weight
:
600
;
height
:
58px
;
line-height
:
58px
;
border-bottom
:
1px
solid
#e7eaec
;
margin
:
0
0
;
padding
:
0
0
0
20px
;
}
.marketing
.edit-container
{
margin-bottom
:
30px
;
}
.p-20
{
padding
:
20px
;
}
.marketing
.container1
{
background
:
#fff
;
}
</
style
>
src/views/goods/index.vue
View file @
7e826a4
...
@@ -10,7 +10,11 @@
...
@@ -10,7 +10,11 @@
</GLCombiForm>
</GLCombiForm>
<div
class=
"operate-wrap"
>
<div
class=
"operate-wrap"
>
<span
class=
"table-title"
>
发现商品列表
</span>
<span
class=
"table-title"
>
发现商品列表
</span>
<div>
<el-button
class=
"operate-btn"
type=
"primary"
size=
"small"
@
click=
"handleAdd"
>
新增商品
</el-button>
<el-button
class=
"operate-btn"
type=
"primary"
size=
"small"
@
click=
"handleAdd"
>
新增商品
</el-button>
<el-button
size=
"small"
@
click=
"handleExport"
>
导出
</el-button>
</div>
</div>
</div>
<GLTable
ref=
"channelRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
@
setTableFinishFun=
"setTableFinishFun"
>
<GLTable
ref=
"channelRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
@
setTableFinishFun=
"setTableFinishFun"
>
<div
slot=
"imageSlot"
class=
"table-image"
slot-scope=
"scope"
>
<div
slot=
"imageSlot"
class=
"table-image"
slot-scope=
"scope"
>
...
@@ -41,6 +45,20 @@
...
@@ -41,6 +45,20 @@
<span
v-else
>
{{
filterData
(
scope
.
scope
).
join
(
'、'
)
}}
</span>
<span
v-else
>
{{
filterData
(
scope
.
scope
).
join
(
'、'
)
}}
</span>
</
template
>
</
template
>
</div>
</div>
<div
slot=
"linkText"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.incrementFlag == 'Y' || hideStatus"
>
{{
scope
.
scope
[
scope
.
prop
]
||
0
}}
</
template
>
<
template
v-else
>
<p
class=
"cursor-pointer"
@
click=
"handleDetail(scope)"
>
{{
scope
.
scope
[
scope
.
prop
]
||
0
}}
</p>
</
template
>
</div>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"buttonList"
:buttonItem=
"scope"
:buttonNum=
"4"
></GLTableButton>
<GLTableButton
:buttonList=
"buttonList"
:buttonItem=
"scope"
:buttonNum=
"4"
></GLTableButton>
</div>
</div>
...
@@ -48,11 +66,12 @@
...
@@ -48,11 +66,12 @@
</div>
</div>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
brandCascader
from
'./components/brandCascader'
import
brandCascader
from
'./components/brandCascader'
import
preferList
from
'./preferList'
import
preferList
from
'./preferList'
import
{
exportFn
}
from
'@/common/constant'
export
default
{
export
default
{
name
:
'App'
,
name
:
'App'
,
components
:
{
components
:
{
...
@@ -60,8 +79,9 @@
...
@@ -60,8 +79,9 @@
preferList
preferList
},
},
beforeRouteEnter
(
to
,
from
,
next
)
{
beforeRouteEnter
(
to
,
from
,
next
)
{
console
.
log
(
from
)
next
(
vm
=>
{
next
(
vm
=>
{
if
(
from
.
path
.
indexOf
(
'/goods/addPrefer'
)
==
0
)
{
vm
.
activeName
=
'2'
}
if
(
from
.
path
.
indexOf
(
'/goods/addPrefer'
)
==
0
||
(
from
.
path
.
indexOf
(
'/goods/browseList'
)
==
0
&&
from
.
query
.
activeName
==
2
)
)
{
vm
.
activeName
=
'2'
}
})
})
},
},
data
()
{
data
()
{
...
@@ -211,6 +231,26 @@
...
@@ -211,6 +231,26 @@
addHtml
:
'merchantPriceSlot'
addHtml
:
'merchantPriceSlot'
},
},
{
{
label
:
'浏览量(次)'
,
prop
:
'viewAmount'
,
addHtml
:
'linkText'
,
width
:
140
},
{
label
:
'访客'
,
prop
:
'fansAmount'
,
addHtml
:
'linkText'
},
{
label
:
'分享'
,
prop
:
'shareAmount'
,
addHtml
:
'linkText'
},
{
label
:
'销量'
,
prop
:
'saleAmount'
},
{
label
:
'分类'
,
label
:
'分类'
,
width
:
150
,
width
:
150
,
formatter
:
cellValue
=>
{
formatter
:
cellValue
=>
{
...
@@ -244,6 +284,42 @@
...
@@ -244,6 +284,42 @@
created
()
{},
created
()
{},
mounted
()
{},
mounted
()
{},
methods
:
{
methods
:
{
// 明细
handleDetail
({
prop
,
scope
})
{
let
data
=
{
viewAmount
:
{
type
:
1
,
count
:
scope
.
viewAmount
},
fansAmount
:
{
type
:
2
,
count
:
scope
.
fansAmount
},
shareAmount
:
{
type
:
3
,
count
:
scope
.
shareAmount
}
}[
prop
]
this
.
$router
.
push
({
path
:
'/goods/browseList'
,
query
:
{
id
:
scope
.
id
,
activityName
:
scope
.
goodsName
,
type
:
data
.
type
,
count
:
data
.
count
,
activeName
:
this
.
activeName
}
})
},
handleExport
()
{
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
searchForm
)
params
.
goodsType
=
1
this
.
$apis
.
goods
.
exportGoodsApi
(
params
).
then
(
res
=>
{
exportFn
(
res
)
})
},
selectCategory
(
e
){
selectCategory
(
e
){
this
.
tableSearchForm
.
associationClassifyFirstId
=
e
?.
parent
?.
id
this
.
tableSearchForm
.
associationClassifyFirstId
=
e
?.
parent
?.
id
this
.
tableSearchForm
.
associationClassifySecondId
=
e
?.
data
?.
id
this
.
tableSearchForm
.
associationClassifySecondId
=
e
?.
data
?.
id
...
@@ -339,14 +415,14 @@
...
@@ -339,14 +415,14 @@
params
.
type
=
type
params
.
type
=
type
title
=
type
==
1
?
'查看商品'
:
'编辑商品'
title
=
type
==
1
?
'查看商品'
:
'编辑商品'
}
}
const
queryStr
=
encodeURIComponent
(
JSON
.
stringify
(
params
))
const
queryStr
=
encodeURIComponent
(
JSON
.
stringify
(
params
))
this
.
$router
.
push
({
path
:
`/goods/add/`
+
queryStr
,
query
:
{
$title
:
title
}})
this
.
$router
.
push
({
path
:
`/goods/add/`
+
queryStr
,
query
:
{
$title
:
title
}})
}
}
}
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.goods-list-cntr
{
.goods-list-cntr
{
.search-wrap{
.search-wrap{
...
@@ -382,5 +458,8 @@
...
@@ -382,5 +458,8 @@
}
}
}
}
}
}
.cursor-pointer
{
cursor
:
pointer
;
color
:
#5850FF
;
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
src/views/goods/preferList.vue
View file @
7e826a4
<
template
>
<
template
>
<div
class=
"prefer-list-cntr"
>
<div
class=
"prefer-list-cntr"
>
<div
class=
"table-wrap"
>
<div
class=
"table-wrap"
>
<GLCombiForm
ref=
"showSearch"
class=
"search-wrap"
:rowNumber=
"1"
:formObj=
"tableSearchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
>
<GLCombiForm
ref=
"showSearch"
class=
"search-wrap"
:rowNumber=
"1"
:formObj=
"tableSearchForm"
</GLCombiForm>
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
>
<div
class=
"operate-wrap"
>
</GLCombiForm>
<span
class=
"table-title"
>
车主优选商品列表
</span>
<div
class=
"operate-wrap"
>
<el-button
class=
"operate-btn"
type=
"primary"
size=
"small"
@
click=
"handleAdd"
>
新增商品
</el-button>
<span
class=
"table-title"
>
车主优选商品列表
</span>
</div>
<div>
<GLTable
ref=
"channelRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
@
setTableFinishFun=
"setTableFinishFun"
>
<el-button
class=
"operate-btn"
type=
"primary"
size=
"small"
@
click=
"handleAdd"
>
新增商品
</el-button>
<div
slot=
"imageSlot"
class=
"table-image"
slot-scope=
"scope"
>
<el-button
size=
"small"
@
click=
"handleExport"
>
导出
</el-button>
<el-popover
placement=
"top"
width=
"160"
trigger=
"hover"
popper-class=
"table-popover-block"
>
<img
class=
"table-popover-img"
:src=
"scope.scope.goodsImage"
/>
<img
class=
"img-36 pointer"
slot=
"reference"
:src=
"scope.scope.goodsImage"
/>
</el-popover>
</div>
<div
slot=
"statusSlot"
slot-scope=
"scope"
>
<span
:class=
"['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"
></span>
<span>
{{
scope
.
scope
.
goodsStatus
==
1
?
'上架'
:
'下架'
}}
</span>
</div>
<div
slot=
"merchantPriceSlot"
slot-scope=
"scope"
>
<template
v-if=
"scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"
>
<span>
{{
filterData
(
scope
.
scope
).
slice
(
0
,
1
).
join
(
'、'
)
}}
</span>
<el-popover
placement=
"top"
width=
"fit-content"
trigger=
"hover"
>
<div
v-for=
"(item,index) in filterData(scope.scope)"
:key=
"index"
>
{{
item
}}
</div>
<span
class=
"more-info"
slot=
"reference"
>
...[
{{
scope
.
scope
.
saleMerchantList
.
length
}}
]
</span>
</el-popover>
</
template
>
<
template
v-else
>
<span
v-if=
"!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length"
>
--
</span>
<span
v-else
>
{{
filterData
(
scope
.
scope
).
join
(
'、'
)
}}
</span>
</
template
>
</div>
<div
slot=
"giveIntegralSlot"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"
>
<span>
{{
filterData
(
scope
.
scope
,
1
).
slice
(
0
,
1
).
join
(
'、'
)
}}
</span>
<el-popover
placement=
"top"
width=
"400"
trigger=
"hover"
>
<div
v-for=
"(item,index) in filterData(scope.scope,1)"
:key=
"index"
>
{{
item
}}
</div>
<span
class=
"more-info"
slot=
"reference"
>
...(
{{
scope
.
scope
.
saleMerchantList
.
length
}}
)
</span>
</el-popover>
</
template
>
<
template
v-else
>
<span
v-if=
"!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length"
>
--
</span>
<span
v-else
>
{{
filterData
(
scope
.
scope
,
1
).
join
(
'、'
)
}}
</span>
</
template
>
</div>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"buttonList"
:buttonItem=
"scope"
:buttonNum=
"4"
></GLTableButton>
</div>
</GLTable>
</div>
</div>
</div>
<GLTable
ref=
"channelRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"searchForm"
:beforeSearchFn=
"beforeSearchFn"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
@
setTableFinishFun=
"setTableFinishFun"
>
<div
slot=
"imageSlot"
class=
"table-image"
slot-scope=
"scope"
>
<el-popover
placement=
"top"
width=
"160"
trigger=
"hover"
popper-class=
"table-popover-block"
>
<img
class=
"table-popover-img"
:src=
"scope.scope.goodsImage"
/>
<img
class=
"img-36 pointer"
slot=
"reference"
:src=
"scope.scope.goodsImage"
/>
</el-popover>
</div>
<div
slot=
"statusSlot"
slot-scope=
"scope"
>
<span
:class=
"['status', scope.scope.goodsStatus==1 ? 'success-status': 'error-status']"
></span>
<span>
{{
scope
.
scope
.
goodsStatus
==
1
?
'上架'
:
'下架'
}}
</span>
</div>
<div
slot=
"merchantPriceSlot"
slot-scope=
"scope"
>
<template
v-if=
"scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"
>
<span>
{{
filterData
(
scope
.
scope
).
slice
(
0
,
1
).
join
(
'、'
)
}}
</span>
<el-popover
placement=
"top"
width=
"fit-content"
trigger=
"hover"
>
<div
v-for=
"(item,index) in filterData(scope.scope)"
:key=
"index"
>
{{
item
}}
</div>
<span
class=
"more-info"
slot=
"reference"
>
...[
{{
scope
.
scope
.
saleMerchantList
.
length
}}
]
</span>
</el-popover>
</
template
>
<
template
v-else
>
<span
v-if=
"!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length"
>
--
</span>
<span
v-else
>
{{
filterData
(
scope
.
scope
).
join
(
'、'
)
}}
</span>
</
template
>
</div>
<div
slot=
"linkText"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.incrementFlag == 'Y' || hideStatus"
>
{{
scope
.
scope
[
scope
.
prop
]
||
0
}}
</
template
>
<
template
v-else
>
<p
class=
"cursor-pointer"
@
click=
"handleDetail(scope)"
>
{{
scope
.
scope
[
scope
.
prop
]
||
0
}}
</p>
</
template
>
</div>
<div
slot=
"giveIntegralSlot"
slot-scope=
"scope"
>
<
template
v-if=
"scope.scope.saleMerchantList && scope.scope.saleMerchantList.length > 1"
>
<span>
{{
filterData
(
scope
.
scope
,
1
).
slice
(
0
,
1
).
join
(
'、'
)
}}
</span>
<el-popover
placement=
"top"
width=
"400"
trigger=
"hover"
>
<div
v-for=
"(item,index) in filterData(scope.scope,1)"
:key=
"index"
>
{{
item
}}
</div>
<span
class=
"more-info"
slot=
"reference"
>
...(
{{
scope
.
scope
.
saleMerchantList
.
length
}}
)
</span>
</el-popover>
</
template
>
<
template
v-else
>
<span
v-if=
"!scope.scope.saleMerchantList || !scope.scope.saleMerchantList.length"
>
--
</span>
<span
v-else
>
{{
filterData
(
scope
.
scope
,
1
).
join
(
'、'
)
}}
</span>
</
template
>
</div>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"buttonList"
:buttonItem=
"scope"
:buttonNum=
"4"
></GLTableButton>
</div>
</GLTable>
</div>
</div>
</template>
</div>
</template>
<
script
>
import
url
from
'@/assets/empty.png'
<
script
>
export
default
{
import
url
from
'@/assets/empty.png'
name
:
'App'
,
import
{
exportFn
}
from
'@/common/constant'
data
()
{
export
default
{
return
{
name
:
'App'
,
tableSearchForm
:
{
data
()
{
channelName
:
''
,
return
{
createDate
:
[],
tableSearchForm
:
{
associationClassifyFirstId
:
''
,
channelName
:
''
,
associationClassifySecondId
:
''
,
createDate
:
[],
merchantName
:
''
,
associationClassifyFirstId
:
''
,
goodsType
:
'2'
,
associationClassifySecondId
:
''
,
merchantName
:
''
,
goodsType
:
'2'
,
},
tabPaneList
:
[{
name
:
'sa'
,
label
:
'配置升级'
},
{
name
:
'sa'
,
label
:
'车主优选'
}],
buttonList
:
[
{
type
:
'el-button'
,
name
:
'查看'
,
attrs
:
{
type
:
'text'
,
fn
:
'查看'
},
listeners
:
{
click
:
row
=>
this
.
handleAdd
(
row
.
scope
,
1
)
}
},
},
tabPaneList
:
[{
name
:
'sa'
,
label
:
'配置升级'
},
{
name
:
'sa'
,
label
:
'车主优选'
}],
{
buttonList
:
[
type
:
'el-button'
,
{
name
:
'编辑'
,
type
:
'el-button'
,
attrs
:
{
name
:
'查看'
,
type
:
'text'
,
attrs
:
{
fn
:
'编辑'
type
:
'text'
,
},
fn
:
'查看'
listeners
:
{
click
:
row
=>
this
.
handleAdd
(
row
.
scope
,
2
)
}
},
{
type
:
'el-button'
,
name
:
'上架'
,
attrs
:
{
type
:
'text'
,
fn
:
'上架'
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
!=
1
},
listeners
:
{
click
:
row
=>
this
.
shelfGoodsFn
(
row
.
scope
,
1
)
}
},
{
type
:
'el-button'
,
name
:
'下架'
,
attrs
:
{
type
:
'text'
,
fn
:
'下架'
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
==
1
},
listeners
:
{
click
:
row
=>
this
.
shelfGoodsFn
(
row
.
scope
,
0
)
}
},
{
type
:
'el-button'
,
name
:
'删除'
,
attrs
:
{
type
:
'text'
,
fn
:
'删除'
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
!=
1
},
listeners
:
{
click
:
row
=>
this
.
delGoodsFn
(
row
.
scope
)
}
}
],
searchForm
:
{},
url
:
url
,
searchFormData
:
[
{
label
:
'商品名称'
,
name
:
'goodsName'
,
type
:
'input'
},
{
label
:
'创建日期'
,
name
:
'createDate'
,
type
:
'datePicker'
,
isClear
:
true
,
customPickerOptions
:
{
disabledDate
(
date
)
{
const
yesterday
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()))
if
(
date
>
yesterday
)
{
return
true
}
return
false
}
}
},
{
label
:
'分类名称'
,
name
:
'associationClassifyFirstId'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'categoryName'
,
},
{
label
:
'来源'
,
name
:
'source'
,
type
:
'select'
,
optionList
:
[
{
id
:
''
,
name
:
'全部'
},
},
listeners
:
{
// {
click
:
row
=>
this
.
handleAdd
(
row
.
scope
,
1
)
// id: '1',
// name: '云中鹤'
// },
{
id
:
'2'
,
name
:
'嘀加智享'
},
],
optionId
:
'id'
,
optionLabel
:
'name'
},
],
getListApi
:
this
.
$apis
.
goods
.
getGoodsListApi
,
tableParams
:
{
listName
:
'list'
,
tableOption
:
{
width
:
200
},
tableColumns
:
[
{
label
:
'来源'
,
prop
:
'sourse'
,
width
:
150
,
formatter
:
cellValue
=>
{
return
'嘀加智享平台'
}
}
},
},
{
{
type
:
'el-button'
,
label
:
'商品名称'
,
name
:
'编辑'
,
width
:
150
,
attrs
:
{
prop
:
'goodsName'
type
:
'text'
,
fn
:
'编辑'
},
listeners
:
{
click
:
row
=>
this
.
handleAdd
(
row
.
scope
,
2
)
}
},
},
{
{
type
:
'el-button'
,
label
:
'缩略图'
,
name
:
'上架'
,
addHtml
:
'imageSlot'
attrs
:
{
type
:
'text'
,
fn
:
'上架'
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
!=
1
},
listeners
:
{
click
:
row
=>
this
.
shelfGoodsFn
(
row
.
scope
,
1
)
}
},
},
// {
// label: '供货价格(元)',
// formatter: cellValue => {
// return cellValue.paymentType==1 ? '全款' : '定金+尾款'
// }
// },
// {
// label: '市场价格(元)',
// formatter: cellValue => {
// return cellValue.depositPrice ? Number((Number(cellValue.depositPrice)/100).toFixed(2)) : '--'
// }
// },
{
{
type
:
'el-button'
,
label
:
'销售价格(元)'
,
name
:
'下架'
,
width
:
200
,
attrs
:
{
addHtml
:
'merchantPriceSlot'
type
:
'text'
,
fn
:
'下架'
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
==
1
},
listeners
:
{
click
:
row
=>
this
.
shelfGoodsFn
(
row
.
scope
,
0
)
}
},
},
{
{
type
:
'el-button'
,
label
:
'浏览量(次)'
,
name
:
'删除'
,
prop
:
'viewAmount'
,
attrs
:
{
addHtml
:
'linkText'
,
type
:
'text'
,
width
:
140
fn
:
'删除'
},
},
condition
:
row
=>
{
return
row
.
scope
.
goodsStatus
!=
1
},
listeners
:
{
click
:
row
=>
this
.
delGoodsFn
(
row
.
scope
)
}
}
],
searchForm
:
{},
url
:
url
,
searchFormData
:
[
{
{
label
:
'
商品名称
'
,
label
:
'
访客
'
,
name
:
'goodsName
'
,
prop
:
'fansAmount
'
,
type
:
'inpu
t'
addHtml
:
'linkTex
t'
},
},
{
{
label
:
'创建日期'
,
label
:
'分享'
,
name
:
'createDate'
,
prop
:
'shareAmount'
,
type
:
'datePicker'
,
addHtml
:
'linkText'
isClear
:
true
,
customPickerOptions
:
{
disabledDate
(
date
)
{
const
yesterday
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()))
if
(
date
>
yesterday
)
{
return
true
}
return
false
}
}
},
},
{
{
label
:
'分类名称'
,
label
:
'销量'
,
name
:
'associationClassifyFirstId'
,
prop
:
'saleAmount'
type
:
'select'
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'categoryName'
,
},
},
{
{
label
:
'来源'
,
label
:
'赠送积分'
,
name
:
'source'
,
width
:
200
,
type
:
'select'
,
addHtml
:
'giveIntegralSlot'
optionList
:
[
{
id
:
''
,
name
:
'全部'
},
// {
// id: '1',
// name: '云中鹤'
// },
{
id
:
'2'
,
name
:
'嘀加智享'
},
],
optionId
:
'id'
,
optionLabel
:
'name'
},
},
],
{
getListApi
:
this
.
$apis
.
goods
.
getGoodsListApi
,
label
:
'商品分类'
,
tableParams
:
{
width
:
180
,
listName
:
'list'
,
prop
:
'associationClassifyFirstName'
tableOption
:
{
width
:
200
},
},
tableColumns
:
[
{
{
label
:
'状态'
,
label
:
'来源'
,
addHtml
:
'statusSlot'
prop
:
'sourse'
,
},
width
:
150
,
{
formatter
:
cellValue
=>
{
label
:
'创建日期'
,
return
'嘀加智享平台'
prop
:
'createdDate'
,
}
width
:
220
},
},
{
{
label
:
'商品名称'
,
label
:
'更新时间'
,
width
:
150
,
prop
:
'updatedDate'
,
prop
:
'goodsName'
width
:
220
},
},
{
{
label
:
'缩略图'
,
label
:
'操作人'
,
addHtml
:
'imageSlot'
prop
:
'updatedBy'
,
},
},
// {
]
// label: '供货价格(元)',
},
// formatter: cellValue => {
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
}
// return cellValue.paymentType==1 ? '全款' : '定金+尾款'
}
// }
},
// },
created
()
{
// {
this
.
getCategory
()
// label: '市场价格(元)',
},
// formatter: cellValue => {
mounted
()
{
// return cellValue.depositPrice ? Number((Number(cellValue.depositPrice)/100).toFixed(2)) : '--'
},
// }
methods
:
{
// },
// 明细
{
handleDetail
({
prop
,
scope
})
{
label
:
'销售价格(元)'
,
let
data
=
{
width
:
200
,
viewAmount
:
{
addHtml
:
'merchantPriceSlot'
type
:
1
,
},
count
:
scope
.
viewAmount
{
label
:
'赠送积分'
,
width
:
200
,
addHtml
:
'giveIntegralSlot'
},
{
label
:
'商品分类'
,
width
:
180
,
prop
:
'associationClassifyFirstName'
},
{
label
:
'状态'
,
addHtml
:
'statusSlot'
},
{
label
:
'创建日期'
,
prop
:
'createdDate'
,
width
:
220
},
{
label
:
'更新时间'
,
prop
:
'updatedDate'
,
width
:
220
},
{
label
:
'操作人'
,
prop
:
'updatedBy'
,
},
]
},
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
}
fansAmount
:
{
}
type
:
2
,
},
count
:
scope
.
fansAmount
created
()
{
},
this
.
getCategory
()
shareAmount
:
{
},
type
:
3
,
mounted
()
{},
count
:
scope
.
shareAmount
methods
:
{
getCategory
(){
const
params
=
{
pageSize
:
10000
,
pageNum
:
1
,
categoryType
:
2
}
}
this
.
$apis
.
category
.
getCategoryListApi
(
params
).
then
(
res
=>
{
}[
prop
]
if
(
res
?.
list
?.
length
){
this
.
$router
.
push
({
const
_target
=
this
.
searchFormData
.
find
(
item
=>
item
.
name
==
'associationClassifyFirstId'
)
path
:
'/goods/browseList'
,
_target
&&
(
_target
.
optionList
=
res
.
list
)
query
:
{
console
.
log
(
this
.
searchFormData
)
id
:
scope
.
id
,
}
activityName
:
scope
.
goodsName
,
type
:
data
.
type
,
count
:
data
.
count
,
activeName
:
'2'
}
})
},
handleExport
()
{
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
searchForm
)
params
.
goodsType
=
2
this
.
$apis
.
goods
.
exportGoodsApi
(
params
).
then
(
res
=>
{
exportFn
(
res
)
})
})
},
},
selectCategory
(
e
){
this
.
tableSearchForm
.
associationClassifyFirstId
=
e
?.
parent
?.
id
getCategory
()
{
this
.
tableSearchForm
.
associationClassifySecondId
=
e
?.
data
?.
id
const
params
=
{
},
pageSize
:
10000
,
shelfGoodsFn
(
item
,
type
){
pageNum
:
1
,
if
(
type
==
1
){
categoryType
:
2
this
.
updateStatus
(
item
.
id
,
type
)
}
}
else
{
this
.
$apis
.
category
.
getCategoryListApi
(
params
).
then
(
res
=>
{
this
.
$confirm
(
`确定下架该商品吗`
,
'提示'
,
{
if
(
res
?.
list
?.
length
)
{
confirmButtonText
:
'确定'
,
const
_target
=
this
.
searchFormData
.
find
(
item
=>
item
.
name
==
'associationClassifyFirstId'
)
cancelButtonText
:
'取消'
,
_target
&&
(
_target
.
optionList
=
res
.
list
)
type
:
'warning'
,
console
.
log
(
this
.
searchFormData
)
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
this
.
updateStatus
(
item
.
id
,
type
)
}
}
})
}
}
},
})
delGoodsFn
(
item
){
},
this
.
$confirm
(
`确定删除该商品吗`
,
'提示'
,
{
selectCategory
(
e
)
{
this
.
tableSearchForm
.
associationClassifyFirstId
=
e
?.
parent
?.
id
this
.
tableSearchForm
.
associationClassifySecondId
=
e
?.
data
?.
id
},
shelfGoodsFn
(
item
,
type
)
{
if
(
type
==
1
)
{
this
.
updateStatus
(
item
.
id
,
type
)
}
else
{
this
.
$confirm
(
`确定下架该商品吗`
,
'提示'
,
{
confirmButtonText
:
'确定'
,
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
type
:
'warning'
,
callback
:
action
=>
{
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
if
(
action
==
'confirm'
)
{
this
.
$apis
.
goods
.
delGoodsApi
({
id
:
item
.
id
}).
then
(
res
=>
{
this
.
updateStatus
(
item
.
id
,
type
)
if
(
res
){
this
.
$message
.
success
(
'删除成功'
)
this
.
handleSearch
()
}
})
}
}
}
}
})
})
},
}
updateStatus
(
id
,
goodsStatus
){
},
this
.
$apis
.
goods
.
updateGoodsStatusApi
({
id
,
goodsStatus
}).
then
(
res
=>
{
delGoodsFn
(
item
)
{
if
(
res
){
this
.
$confirm
(
`确定删除该商品吗`
,
'提示'
,
{
this
.
$message
.
success
(
'操作成功'
)
confirmButtonText
:
'确定'
,
this
.
handleSearch
()
cancelButtonText
:
'取消'
,
type
:
'warning'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
this
.
$apis
.
goods
.
delGoodsApi
({
id
:
item
.
id
}).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
.
success
(
'删除成功'
)
this
.
handleSearch
()
}
})
}
}
})
},
filterData
({
saleMerchantList
:
list
},
notFormat
){
if
(
notFormat
){
return
list
?.
map
(
item
=>
{
return
`
${
item
.
merchantName
||
'--'
}
:
${
item
.
giveIntegral
||
'0'
}
`
})
||
[]
}
else
{
return
list
?.
map
(
item
=>
{
let
activityPrice
=
item
.
activityPrice
?
Number
((
Number
(
item
.
activityPrice
)
/
100
).
toFixed
(
2
))
:
0
return
`
${
item
.
merchantName
||
'--'
}
:
${
activityPrice
||
'0'
}
`
})
||
[]
}
}
},
})
getParams
()
{
},
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableSearchForm
))
updateStatus
(
id
,
goodsStatus
)
{
if
(
this
.
tableSearchForm
.
createDate
.
length
)
{
this
.
$apis
.
goods
.
updateGoodsStatusApi
({
id
,
goodsStatus
}).
then
(
res
=>
{
params
.
startCreatedDate
=
new
Date
(
this
.
tableSearchForm
.
createDate
[
0
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 00:00:00'
if
(
res
)
{
params
.
endCreatedDate
=
new
Date
(
this
.
tableSearchForm
.
createDate
[
1
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 23:59:59'
this
.
$message
.
success
(
'操作成功'
)
this
.
handleSearch
()
}
}
return
params
})
},
},
beforeSearchFn
()
{
filterData
({
saleMerchantList
:
list
},
notFormat
)
{
return
new
Promise
(
resolve
=>
{
if
(
notFormat
)
{
this
.
searchForm
=
this
.
getParams
()
return
list
?.
map
(
item
=>
{
delete
this
.
searchForm
.
createDate
return
`
${
item
.
merchantName
||
'--'
}
:
${
item
.
giveIntegral
||
'0'
}
`
resolve
()
})
||
[]
})
}
else
{
},
return
list
?.
map
(
item
=>
{
handleSearch
()
{
let
activityPrice
=
item
.
activityPrice
?
Number
((
Number
(
item
.
activityPrice
)
/
100
).
toFixed
(
2
))
:
0
this
.
$refs
.
channelRef
.
refreshTable
()
return
`
${
item
.
merchantName
||
'--'
}
:
${
activityPrice
||
'0'
}
`
},
})
||
[]
handleReset
()
{
}
this
.
tableSearchForm
=
{
},
goodsType
:
'2'
,
getParams
()
{
createDate
:
[],
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableSearchForm
))
associationClassifyFirstId
:
''
,
if
(
this
.
tableSearchForm
.
createDate
.
length
)
{
associationClassifySecondId
:
''
,
params
.
startCreatedDate
=
new
Date
(
this
.
tableSearchForm
.
createDate
[
0
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 00:00:00'
merchantName
:
''
params
.
endCreatedDate
=
new
Date
(
this
.
tableSearchForm
.
createDate
[
1
]).
toLocaleDateString
().
replace
(
/
\/
/g
,
'-'
)
+
' 23:59:59'
},
}
this
.
$refs
?.
cascaderRef
?.
curBrand
&&
(
this
.
$refs
.
cascaderRef
.
curBrand
=
{})
return
params
this
.
searchForm
=
{}
},
this
.
handleSearch
()
beforeSearchFn
()
{
},
return
new
Promise
(
resolve
=>
{
setTableFinishFun
()
{
this
.
searchForm
=
this
.
getParams
()
//接收到的数据为空
delete
this
.
searchForm
.
createDate
this
.
$refs
.
channelRef
.
data
.
length
?
(
this
.
$refs
.
channelRef
.
tableHeightValues
=
''
)
:
this
.
$refs
.
channelRef
.
setTableHeightFun
()
resolve
()
})
},
handleSearch
()
{
this
.
$refs
.
channelRef
.
refreshTable
()
},
handleReset
()
{
this
.
tableSearchForm
=
{
goodsType
:
'2'
,
createDate
:
[],
associationClassifyFirstId
:
''
,
associationClassifySecondId
:
''
,
merchantName
:
''
},
},
handleAdd
(
row
=
{},
type
){
this
.
$refs
?.
cascaderRef
?.
curBrand
&&
(
this
.
$refs
.
cascaderRef
.
curBrand
=
{})
const
params
=
{
this
.
searchForm
=
{}
goodsType
:
'2'
this
.
handleSearch
()
}
},
let
title
=
'新增商品'
setTableFinishFun
()
{
if
(
type
){
//接收到的数据为空
params
.
id
=
row
.
id
this
.
$refs
.
channelRef
.
data
.
length
?
(
this
.
$refs
.
channelRef
.
tableHeightValues
=
''
)
:
this
.
$refs
.
channelRef
.
setTableHeightFun
()
params
.
type
=
type
},
title
=
type
==
1
?
'查看商品'
:
'编辑商品'
handleAdd
(
row
=
{},
type
)
{
}
const
params
=
{
goodsType
:
'2'
const
queryStr
=
encodeURIComponent
(
JSON
.
stringify
(
params
))
this
.
$router
.
push
({
path
:
`/goods/addPrefer/`
+
queryStr
,
query
:
{
$title
:
title
}})
}
}
let
title
=
'新增商品'
if
(
type
)
{
params
.
id
=
row
.
id
params
.
type
=
type
title
=
type
==
1
?
'查看商品'
:
'编辑商品'
}
const
queryStr
=
encodeURIComponent
(
JSON
.
stringify
(
params
))
this
.
$router
.
push
({
path
:
`/goods/addPrefer/`
+
queryStr
,
query
:
{
$title
:
title
}})
}
}
}
}
</
script
>
}
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.prefer-list-cntr
{
.prefer-list-cntr
{
.table-wrap{
.table-wrap
{
margin-top
:
16px
;
margin-top
:
16px
;
padding
:
20px
;
padding
:
20px
;
background-color
:
#fff
;
background-color
:
#fff
;
.status{
width
:
6px
;
.status
{
height
:
6px
;
width
:
6px
;
border-radius
:
50%
;
height
:
6px
;
display
:
inline-block
;
border-radius
:
50%
;
vertical-align
:
middle
;
display
:
inline-block
;
margin-right
:
8px
;
vertical-align
:
middle
;
}
margin-right
:
8px
;
.success-status
{
}
background-color
:
#37C67F
;
}
.success-status
{
.error-status
{
background-color
:
#37C67F
;
background-color
:
#999999
;
}
.more-info
{
white-space
:
nowrap
;
color
:
#5850FF
;
cursor
:
pointer
;
}
}
}
.error-status
{
background-color
:
#999999
;
}
.more-info
{
white-space
:
nowrap
;
color
:
#5850FF
;
cursor
:
pointer
;
}
}
}
.cursor-pointer
{
cursor
:
pointer
;
color
:
#5850FF
;
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment