Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-commodity
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 b39c47b4
authored
Apr 25, 2023
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
商品管理。详情
1 parent
a85b6041
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
496 additions
and
223 deletions
src/api/modules/commodity.js
src/common/constant.js
src/components/relate-store-dialog/index.vue
src/main.js
src/utils/index.js
src/views/commodity/commodityDetail.vue
src/views/commodity/constant/baseList.js
src/views/commodity/constant/data.js
src/views/commodity/editCommodity.vue
src/views/commodity/index.vue
src/api/modules/commodity.js
View file @
b39c47b
import
{
http
}
from
'@/main'
import
{
http
}
from
'@/main'
const
path
=
'dj.api.'
const
path2
=
'dj.smartcarlife.api.'
const
getListApi
=
params
=>
{
const
getListApi
=
params
=>
{
params
.
method
=
`scrm.api.shopmall.goods.page.curMerchant`
params
.
method
=
'scrm.api.partner.goods.page'
return
http
({
return
http
({
url
:
'rop-scrm-
shopmall
/router'
,
url
:
'rop-scrm-
partner
/router'
,
method
:
'GET'
,
method
:
'GET'
,
data
:
params
,
data
:
params
,
sign
:
true
sign
:
true
...
@@ -13,13 +10,67 @@ const getListApi = params => {
...
@@ -13,13 +10,67 @@ const getListApi = params => {
}
}
const
getSimpleMerchantList
=
params
=>
{
const
getSimpleMerchantList
=
params
=>
{
params
.
method
=
'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
// params.method = 'scrm.api.carlife.merchant.listWithPageSimpleByCurMerchant'
params
.
method
=
'scrm.api.partner.goods.merchant.page'
return
http
({
return
http
({
url
:
'rop-scrm-
carlife
/router'
,
url
:
'rop-scrm-
partner
/router'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
params
,
data
:
params
,
sign
:
true
sign
:
true
})
})
}
}
export
default
{
getListApi
,
getSimpleMerchantList
}
const
getGoodsSeries
=
params
=>
{
params
.
method
=
'scrm.api.partner.goods.info.list'
return
http
({
url
:
'rop-scrm-partner/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
const
updateGoods
=
params
=>
{
params
.
method
=
'scrm.api.partner.goods.insertOrUpdate'
return
http
({
url
:
'rop-scrm-partner/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
const
getGoodsDetail
=
params
=>
{
params
.
method
=
'scrm.api.partner.goods.getDetailById'
return
http
({
url
:
'rop-scrm-partner/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
const
deleteGoods
=
params
=>
{
params
.
method
=
'scrm.api.partner.goods.deleteById'
return
http
({
url
:
'rop-scrm-partner/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
const
exportGoods
=
params
=>
{
params
.
method
=
'scrm.api.partner.goods.export'
return
http
({
url
:
'rop-scrm-partner/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
,
returnAll
:
true
})
}
export
default
{
getListApi
,
getSimpleMerchantList
,
getGoodsSeries
,
updateGoods
,
getGoodsDetail
,
deleteGoods
,
exportGoods
}
src/common/constant.js
View file @
b39c47b
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
function
limitPrice
(
newValue
,
oldValue
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
function
limitPrice
(
newValue
,
oldValue
,
intergerDigit
,
pointDigit
,
minValue
,
maxValue
,
regRule
)
{
/* eslint-disable */
/* eslint-disable */
var
reg
=
{
var
reg
=
{
priceReg
:
/^
\d[\d\.]
*$/
,
priceReg
:
/^
\d[\d\.]
*$/
,
numReg
:
/^
[
1-9
]\d
*$/
,
numReg
:
/^
[
1-9
]\d
*$/
,
zNumReg
:
/^
\d
*$/
zNumReg
:
/^
\d
*$/
}
}
/* eslint-enable */
/* eslint-enable */
regRule
=
regRule
||
'priceReg'
regRule
=
regRule
||
'priceReg'
if
(
newValue
&&
((
minValue
&&
newValue
<
minValue
)
||
(
maxValue
&&
newValue
>
maxValue
)))
{
if
(
newValue
&&
((
minValue
&&
newValue
<
minValue
)
||
(
maxValue
&&
newValue
>
maxValue
)))
{
return
oldValue
||
''
return
oldValue
||
''
...
@@ -62,21 +62,22 @@ const deliveryTypeList = [
...
@@ -62,21 +62,22 @@ const deliveryTypeList = [
//会员中心得状态list
//会员中心得状态list
const
statusList
=
[
const
statusList
=
[
// {
// {
// confId: '',
// confId: '',
// confName: '全部'
// confName: '全部'
// },
// },
{
{
confId
:
1
,
confId
:
1
,
confName
:
'生效中'
confName
:
'生效中'
},
},
{
{
confId
:
2
,
confId
:
2
,
confName
:
'已失效'
confName
:
'已失效'
}
}
]
]
//会员订单类型字典
//会员订单类型字典
const
orderTypesList
=
[{
const
orderTypesList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'套餐'
confName
:
'套餐'
},
},
...
@@ -110,9 +111,10 @@ const orderStatusList = [
...
@@ -110,9 +111,10 @@ const orderStatusList = [
{
{
confId
:
6
,
confId
:
6
,
confName
:
'已退款'
confName
:
'已退款'
}
,
}
]
]
const
serviceStatusList
=
[{
const
serviceStatusList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'未生效'
confName
:
'未生效'
},
},
...
@@ -126,7 +128,8 @@ const serviceStatusList = [{
...
@@ -126,7 +128,8 @@ const serviceStatusList = [{
}
}
]
]
const
memberTypeList
=
[{
const
memberTypeList
=
[
{
confId
:
1
,
confId
:
1
,
confName
:
'正式会员'
confName
:
'正式会员'
},
},
...
@@ -135,7 +138,8 @@ const memberTypeList = [{
...
@@ -135,7 +138,8 @@ const memberTypeList = [{
confName
:
'试用会员'
confName
:
'试用会员'
}
}
]
]
const
stateList
=
[{
const
stateList
=
[
{
confId
:
0
,
confId
:
0
,
confName
:
'待上架'
confName
:
'待上架'
},
},
...
@@ -146,18 +150,13 @@ const stateList = [{
...
@@ -146,18 +150,13 @@ const stateList = [{
{
{
confId
:
2
,
confId
:
2
,
confName
:
'已下架'
confName
:
'已下架'
}
,
}
]
]
export
{
limitPrice
,
orderManageStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
}
\ No newline at end of file
\ No newline at end of file
function
setMinHeight
(
calssName
=
'.edit-container'
)
{
let
height
=
document
.
querySelector
(
'.header-wrap'
).
clientHeight
+
110
+
'px'
let
minHeight
=
'calc(100vh - '
+
height
+
')'
document
.
querySelector
(
calssName
).
style
.
minHeight
=
minHeight
}
export
{
limitPrice
,
orderManageStatusList
,
orderSourceList
,
deliveryTypeList
,
statusList
,
serviceStatusList
,
memberTypeList
,
stateList
,
orderTypesList
,
orderStatusList
,
setMinHeight
}
src/components/relate-store-dialog/index.vue
View file @
b39c47b
...
@@ -84,7 +84,7 @@ export default {
...
@@ -84,7 +84,7 @@ export default {
mounted
()
{
mounted
()
{
this
.
selectedData
=
this
.
storeSelected
this
.
selectedData
=
this
.
storeSelected
this
.
selectedData
.
forEach
(
item
=>
{
this
.
selectedData
.
forEach
(
item
=>
{
item
.
merchant
No
=
item
.
merchantId
?
item
.
merchantId
+
''
:
item
.
merchantNo
item
.
merchant
Id
=
item
.
merchantId
?
item
.
merchantId
+
''
:
item
.
merchantId
})
})
this
.
getSelectingList
()
this
.
getSelectingList
()
},
},
...
@@ -95,9 +95,9 @@ export default {
...
@@ -95,9 +95,9 @@ export default {
return
isSelect
return
isSelect
},
},
recoverySelection
()
{
recoverySelection
()
{
var
exitIds
=
this
.
selectedData
.
map
(
item
=>
item
.
merchant
No
+
''
)
var
exitIds
=
this
.
selectedData
.
map
(
item
=>
item
.
merchant
Id
+
''
)
this
.
selectingData
.
forEach
(
item
=>
{
this
.
selectingData
.
forEach
(
item
=>
{
if
(
exitIds
.
includes
(
item
.
merchant
No
+
''
))
{
if
(
exitIds
.
includes
(
item
.
merchant
Id
+
''
))
{
this
.
$refs
.
seletingTable
.
toggleRowSelection
(
item
,
true
)
this
.
$refs
.
seletingTable
.
toggleRowSelection
(
item
,
true
)
}
else
{
}
else
{
this
.
$refs
.
seletingTable
.
toggleRowSelection
(
item
,
false
)
this
.
$refs
.
seletingTable
.
toggleRowSelection
(
item
,
false
)
...
@@ -119,12 +119,12 @@ export default {
...
@@ -119,12 +119,12 @@ export default {
})
})
},
},
handleChange
(
selection
,
row
)
{
handleChange
(
selection
,
row
)
{
var
addOrDelete
=
!!
selection
.
find
(
item
=>
+
item
.
merchant
No
===
+
row
.
merchantNo
)
var
addOrDelete
=
!!
selection
.
find
(
item
=>
+
item
.
merchant
Id
===
+
row
.
merchantId
)
addOrDelete
?
this
.
selectedData
.
push
(
row
)
:
(
this
.
selectedData
=
this
.
selectedData
.
filter
(
item
=>
item
.
merchant
No
!==
row
.
merchantNo
))
addOrDelete
?
this
.
selectedData
.
push
(
row
)
:
(
this
.
selectedData
=
this
.
selectedData
.
filter
(
item
=>
item
.
merchant
Id
!==
row
.
merchantId
))
},
},
handleAll
(
selection
)
{
handleAll
(
selection
)
{
this
.
selectingData
.
forEach
(
item
=>
{
this
.
selectingData
.
forEach
(
item
=>
{
let
isExit
=
this
.
selectedData
.
findIndex
(
subItem
=>
+
subItem
.
merchant
No
===
+
item
.
merchantNo
)
let
isExit
=
this
.
selectedData
.
findIndex
(
subItem
=>
+
subItem
.
merchant
Id
===
+
item
.
merchantId
)
var
isServed
=
item
.
hasOwnProperty
(
'beServed'
)
?
item
.
beServed
:
false
var
isServed
=
item
.
hasOwnProperty
(
'beServed'
)
?
item
.
beServed
:
false
if
(
selection
.
length
&&
isExit
===
-
1
&&
!
isServed
)
{
if
(
selection
.
length
&&
isExit
===
-
1
&&
!
isServed
)
{
this
.
selectedData
.
push
(
item
)
this
.
selectedData
.
push
(
item
)
...
@@ -134,7 +134,7 @@ export default {
...
@@ -134,7 +134,7 @@ export default {
})
})
},
},
handleDelete
(
row
)
{
handleDelete
(
row
)
{
this
.
selectedData
=
this
.
selectedData
.
filter
(
item
=>
+
item
.
merchant
No
!==
+
row
.
merchantNo
)
this
.
selectedData
=
this
.
selectedData
.
filter
(
item
=>
+
item
.
merchant
Id
!==
+
row
.
merchantId
)
this
.
recoverySelection
()
this
.
recoverySelection
()
},
},
handleCurrentChange
(
val
)
{
handleCurrentChange
(
val
)
{
...
...
src/main.js
View file @
b39c47b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
import
Vue
from
'vue'
import
Vue
from
'vue'
import
apis
from
'./api'
import
apis
from
'./api'
import
{
optionalChaining
}
from
'./utils/chaining'
import
{
optionalChaining
}
from
'./utils/chaining'
import
{
setMinHeight
}
from
'@/common/constant'
import
utils
from
'./utils/index'
import
utils
from
'./utils/index'
import
'./public-path'
import
'./public-path'
import
'@/assets/css/public.scss'
import
'@/assets/css/public.scss'
...
@@ -23,6 +24,7 @@ Vue.prototype.$$ = optionalChaining
...
@@ -23,6 +24,7 @@ Vue.prototype.$$ = optionalChaining
Vue
.
prototype
.
$utils
=
utils
Vue
.
prototype
.
$utils
=
utils
Vue
.
prototype
.
size
=
'small'
Vue
.
prototype
.
size
=
'small'
Vue
.
prototype
.
$EventBus
=
new
Vue
()
Vue
.
prototype
.
$EventBus
=
new
Vue
()
Vue
.
prototype
.
setMinHeight
=
setMinHeight
start
()
start
()
export
{
bootstrap
,
mount
,
unmount
}
from
'@/setup'
export
{
bootstrap
,
mount
,
unmount
}
from
'@/setup'
export
const
http
=
params
=>
Vue
.
prototype
.
$http
(
params
)
export
const
http
=
params
=>
Vue
.
prototype
.
$http
(
params
)
...
...
src/utils/index.js
View file @
b39c47b
...
@@ -71,25 +71,35 @@ function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = '
...
@@ -71,25 +71,35 @@ function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = '
type
,
type
,
callback
:
action
=>
{
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
if
(
action
==
'confirm'
)
{
//
that.$apis[apiModule][apiName](apiParams).then(res => {
that
.
$apis
[
apiModule
][
apiName
](
apiParams
).
then
(
res
=>
{
//
that.$message({
that
.
$message
({
//
message: res.code == '0' ? '操作成功' : res.message,
message
:
res
.
code
==
'0'
?
'操作成功'
:
res
.
message
,
//
type: res.code == '0' ? 'success' : 'error'
type
:
res
.
code
==
'0'
?
'success'
:
'error'
//
})
})
//
if (res.code == '0') {
if
(
res
.
code
==
'0'
)
{
//
fn && fn()
fn
&&
fn
()
//
that.handleSearch()
that
.
handleSearch
()
//
}
}
//
})
})
}
}
}
}
})
})
}
}
function
aToExport
(
url
)
{
var
a
=
document
.
createElement
(
'a'
)
a
.
setAttribute
(
'id'
,
'exportToExport'
)
a
.
setAttribute
(
'href'
,
url
)
a
.
setAttribute
(
'target'
,
'_blank'
)
document
.
body
.
appendChild
(
a
)
a
.
click
()
}
export
default
{
export
default
{
debounce
,
debounce
,
dateFormat
,
dateFormat
,
checkPhone
,
checkPhone
,
getOptionsList
,
getOptionsList
,
secondConfirm
secondConfirm
,
aToExport
}
}
src/views/commodity/commodityDetail.vue
0 → 100644
View file @
b39c47b
<!-- 订单详情 -->
<
template
>
<div
class=
"order-detail marketing"
>
<div
class=
"edit-box"
>
<div
class=
"container m-b-20"
>
<p
class=
"edit-title"
>
基础信息
</p>
<el-form
label-width=
"100px"
:inline=
"true"
>
<el-row
v-for=
"(item, index) in detailFormDataRow"
:key=
"index"
>
<el-form-item
v-for=
"(subItem, subIndex) in item.rowList"
:key=
"subIndex"
:label=
"subItem.label"
class=
"row-item"
>
<span
class=
"detail-txt ellipsis-1"
:title=
"detailForm[subItem.name]"
>
{{
detailForm
[
subItem
.
name
]
?
detailForm
[
subItem
.
name
]
+
(
subItem
.
suffix
||
''
)
:
'-'
}}
</span>
</el-form-item>
</el-row>
</el-form>
</div>
<div
class=
"container edit-container"
>
<p
class=
"edit-title"
>
使用门店
</p>
<GLTable
ref=
"warehousListRef"
:hasPage=
"false"
:tableParams=
"tableParams"
:tableData=
"detailForm.merchantList"
></GLTable>
</div>
</div>
<GLFooter>
<el-button
@
click=
"handleCancel"
size=
"medium"
>
取消
</el-button>
</GLFooter>
</div>
</
template
>
<
script
>
export
default
{
name
:
'commodityDetail'
,
data
()
{
return
{
size
:
'small'
,
title
:
'查看商品'
,
editChildRef
:
'editChildRef'
,
routeInfo
:
{
orderCode
:
''
},
detailForm
:
{},
orderRefund
:
null
,
orderGoods
:
[],
// 订单信息
detailFormDataRow
:
[],
detailFormData
:
[
{
label
:
'商品名称'
,
name
:
'goodsName'
},
{
label
:
'商品编码'
,
name
:
'type'
},
{
label
:
'所属系列'
,
name
:
'goodsCode'
},
{
label
:
'产品类型'
,
name
:
'typeTxt'
},
{
label
:
'所属系列'
,
name
:
'goodsCode'
},
{
label
:
'售价/元'
,
name
:
'sellPrice'
},
{
label
:
'最低售价/元'
,
name
:
'minSellPrice'
},
{
label
:
'赠送成本/元'
,
name
:
'giftCost'
},
{
label
:
'产品成本/元'
,
name
:
'productCost'
},
{
label
:
'库存预警'
,
name
:
'warningValue'
},
{
label
:
'质保年限'
,
name
:
'warrantyPeriod'
,
suffix
:
'年'
}
],
// 门店表格
tableParams
:
{
tableColumns
:
[
{
label
:
'门店名称'
,
prop
:
'merchantName'
},
{
label
:
'商户号'
,
prop
:
'merchantId'
}
]
},
}
},
created
()
{
this
.
formToRow
(
'detailFormData'
)
},
mounted
()
{
this
.
setMinHeight
(
'.edit-box'
)
this
.
routeInfo
=
this
.
$route
.
query
this
.
getInfo
()
},
methods
:
{
formToRow
(
formName
,
numOfRow
=
3
)
{
var
rowNum
=
Math
.
ceil
(
this
[
formName
].
length
/
numOfRow
)
for
(
var
i
=
0
;
i
<
rowNum
;
i
++
)
{
for
(
var
j
=
0
;
j
<
numOfRow
;
j
++
)
{
if
(
j
==
0
)
{
this
[
formName
+
'Row'
][
i
]
=
{
rowList
:
[]
}
}
if
(
i
*
numOfRow
+
j
<
this
[
formName
].
length
)
{
this
[
formName
+
'Row'
][
i
].
rowList
.
push
(
this
[
formName
][
i
*
numOfRow
+
j
])
}
}
}
console
.
log
(
this
.
detailFormDataRow
,
'detailFormDataRow---'
)
},
getInfo
()
{
this
.
$apis
.
commodity
.
getGoodsDetail
({
upgradeGoodsId
:
this
.
routeInfo
.
info
.
upgradeGoodsId
}).
then
(
res
=>
{
this
.
detailForm
=
res
let
list
=
[]
this
.
detailForm
.
baseProductFlag
==
'Y'
?
list
.
push
(
'基础产品'
)
:
''
this
.
detailForm
.
upgradeProductFlag
==
'Y'
?
list
.
push
(
'升级产品'
)
:
''
this
.
detailForm
.
typeTxt
=
list
.
join
(
','
)
})
},
handleCancel
()
{
this
.
$router
.
push
({
path
:
'/commodity/index'
})
}
}
}
</
script
>
<
style
>
.marketing.order-detail
.el-form--inline
.el-form-item
{
margin
:
0
;
}
.marketing.order-detail
.el-form--inline
.el-form-item__content
{
height
:
30px
;
}
.marketing.order-detail
.form-img
.el-form--inline
.el-form-item__content
{
height
:
auto
!important
;
}
.marketing.order-detail
.flex
{
justify-content
:
flex-start
;
}
.marketing.order-detail
.row-item
{
width
:
33%
;
}
.detail-txt
{
display
:
inline-block
;
width
:
220px
;
}
.marketing.order-detail
.show-table
>
tbody
>
tr
>
td
{
text-align
:
center
;
vertical-align
:
middle
;
}
.marketing.order-detail
.show-table
td
{
padding-right
:
20px
;
}
.order-detail
.comment-img
{
margin-top
:
10px
;
margin-right
:
20px
;
}
</
style
>
src/views/commodity/constant/baseList.js
View file @
b39c47b
const
statusList
=
[
const
typeList
=
[
{
confId
:
0
,
confValue
:
'待上架'
},
{
{
confId
:
1
,
confId
:
1
,
confValue
:
'
在售
'
confValue
:
'
基础产品
'
},
},
{
{
confId
:
2
,
confId
:
2
,
confValue
:
'部分在售'
confValue
:
'升级产品'
},
{
confId
:
3
,
confValue
:
'草稿'
}
}
]
]
export
default
{
export
default
{
status
List
type
List
}
}
src/views/commodity/constant/data.js
View file @
b39c47b
...
@@ -9,7 +9,7 @@ const commodityObj = {
...
@@ -9,7 +9,7 @@ const commodityObj = {
},
},
{
{
label
:
'商品编码'
,
label
:
'商品编码'
,
name
:
'
goodsT
ype'
,
name
:
'
t
ype'
,
type
:
'input'
,
type
:
'input'
,
isClear
:
true
,
isClear
:
true
,
maxlength
:
50
maxlength
:
50
...
@@ -19,102 +19,41 @@ const commodityObj = {
...
@@ -19,102 +19,41 @@ const commodityObj = {
name
:
'merchantIdList'
,
name
:
'merchantIdList'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'
categoryType
'
,
optionId
:
'
merchantId
'
,
optionLabel
:
'
category
Name'
,
optionLabel
:
'
merchant
Name'
,
optionsName
:
'
productType
List'
optionsName
:
'
merchant
List'
},
},
{
{
label
:
'所属系列'
,
label
:
'所属系列'
,
name
:
'goods
Series
'
,
name
:
'goods
Code
'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'
categoryTyp
e'
,
optionId
:
'
goodsCod
e'
,
optionLabel
:
'
category
Name'
,
optionLabel
:
'
goods
Name'
,
optionsName
:
'goodsSeriesList'
optionsName
:
'goodsSeriesList'
},
},
{
{
label
:
'产品类型'
,
label
:
'产品类型'
,
name
:
'
status
'
,
name
:
'
goodsType
'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'confId'
,
optionId
:
'confId'
,
optionLabel
:
'confValue'
,
optionLabel
:
'confValue'
,
optionsName
:
'
status
List'
optionsName
:
'
type
List'
}
}
],
]
tableParams
:
{
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableOption
:
{
width
:
'170'
},
tableColumns
:
[
{
label
:
'商品名称'
,
prop
:
'goodsName'
,
width
:
'200'
},
{
label
:
'商品编码'
,
prop
:
'goodsType'
,
width
:
'110'
},
{
label
:
'所属系列'
,
prop
:
'goodsSeries'
,
width
:
'100'
},
{
label
:
'产品类型'
,
prop
:
''
},
{
label
:
'售价/元'
,
prop
:
'sellPrice'
},
{
label
:
'最低售价/元'
,
prop
:
'minSellPrice'
},
{
label
:
'赠送成本'
,
prop
:
'giftCost'
},
{
label
:
'产品成本'
,
prop
:
'productCost'
},
{
label
:
'使用门店'
,
prop
:
''
},
{
label
:
'创建日期'
,
prop
:
'createDateStr'
,
width
:
'155px'
}
// {
// label: '更新日期',
// prop: 'updatedDate',
// width: '155px'
// // formatter: cellValue => {
// // return cellValue.updatedDate ? Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
// // }
// }
]
}
}
}
const
editCommodityObj
=
{
const
editCommodityObj
=
{
editRule
:
{
editRule
:
{
goodsName
:
[{
required
:
true
,
message
:
'请输入商品名称'
,
trigger
:
'change'
}],
goodsName
:
[{
required
:
true
,
message
:
'请输入商品名称'
,
trigger
:
'change'
}],
goods
Series
:
[{
required
:
true
,
message
:
'请选择所属系列'
,
trigger
:
'change'
}],
goods
Code
:
[{
required
:
true
,
message
:
'请选择所属系列'
,
trigger
:
'change'
}],
sellPrice
:
[{
required
:
true
,
message
:
'请输入售价'
,
trigger
:
'change'
}],
sellPrice
:
[{
required
:
true
,
message
:
'请输入售价'
,
trigger
:
'change'
}],
minSellPrice
:
[{
required
:
true
,
message
:
'请输入最低售价'
,
trigger
:
'change'
}],
minSellPrice
:
[{
required
:
true
,
message
:
'请输入最低售价'
,
trigger
:
'change'
}],
giftCost
:
[{
required
:
true
,
message
:
'请输入赠送成本'
,
trigger
:
'change'
}],
giftCost
:
[{
required
:
true
,
message
:
'请输入赠送成本'
,
trigger
:
'change'
}],
productCost
:
[{
required
:
true
,
message
:
'请输入产品成本'
,
trigger
:
'change'
}],
productCost
:
[{
required
:
true
,
message
:
'请输入产品成本'
,
trigger
:
'change'
}],
warningValue
:
[{
required
:
true
,
message
:
'请输入库存预警'
,
trigger
:
'change'
}],
warningValue
:
[{
required
:
true
,
message
:
'请输入库存预警'
,
trigger
:
'change'
}],
merchantList
:
[{
required
:
true
,
message
:
'请选择门店'
,
trigger
:
'change'
}]
merchantList
:
[{
required
:
true
,
message
:
'请选择门店'
,
trigger
:
'change'
}],
warrantyPeriod
:
[{
required
:
true
,
message
:
'请输入质保年限'
,
trigger
:
'change'
}]
},
},
editFormData
:
[
editFormData
:
[
{
{
...
@@ -125,21 +64,22 @@ const editCommodityObj = {
...
@@ -125,21 +64,22 @@ const editCommodityObj = {
},
},
{
{
label
:
'商品编码'
,
label
:
'商品编码'
,
name
:
'
goodsT
ype'
,
name
:
'
t
ype'
,
type
:
'input'
,
type
:
'input'
,
maxlength
:
50
maxlength
:
50
},
},
{
{
label
:
'所属系列'
,
label
:
'所属系列'
,
name
:
'goods
Series
'
,
name
:
'goods
Code
'
,
type
:
'select'
,
type
:
'select'
,
optionList
:
[],
optionList
:
[],
optionId
:
'
confId
'
,
optionId
:
'
goodsCode
'
,
optionLabel
:
'
conf
Name'
,
optionLabel
:
'
goods
Name'
,
optionsName
:
'goodsSeriesList'
,
optionsName
:
'goodsSeriesList'
,
changeAttr
:
function
(
val
,
targetItem
,
that
)
{
changeAttr
:
function
(
val
,
targetItem
,
that
)
{
let
labeList
=
[
'产品类型'
]
let
labeList
=
[
'产品类型'
]
that
.
changeFormAttr
(
'editFormData'
,
'isHide'
,
labeList
,
val
!=
'1'
)
let
txt
=
targetItem
.
optionList
.
find
(
k
=>
k
.
goodsCode
==
val
)?.
goodsName
||
''
that
.
changeFormAttr
(
'editFormData'
,
'isHide'
,
labeList
,
txt
!=
'太阳膜'
)
if
(
val
!=
'1'
)
{
if
(
val
!=
'1'
)
{
that
.
editForm
.
baseProductFlag
=
'N'
that
.
editForm
.
baseProductFlag
=
'N'
that
.
editForm
.
upgradeProductFlag
=
'Y'
that
.
editForm
.
upgradeProductFlag
=
'Y'
...
@@ -183,6 +123,11 @@ const editCommodityObj = {
...
@@ -183,6 +123,11 @@ const editCommodityObj = {
label
:
'库存预警'
,
label
:
'库存预警'
,
name
:
'warningValue'
,
name
:
'warningValue'
,
type
:
'input'
type
:
'input'
},
{
label
:
'质保年限'
,
name
:
'warrantyPeriod'
,
type
:
'input'
}
}
],
],
...
...
src/views/commodity/editCommodity.vue
View file @
b39c47b
...
@@ -95,20 +95,7 @@ export default {
...
@@ -95,20 +95,7 @@ export default {
]
]
},
},
baseData
:
{
baseData
:
{
goodsSeriesList
:
[
goodsSeriesList
:
[]
{
confId
:
'1'
,
confName
:
'太阳膜'
},
{
confId
:
'2'
,
confName
:
'车衣'
},
{
confId
:
'3'
,
confName
:
'改色膜'
}
]
}
}
}
}
},
},
...
@@ -139,28 +126,40 @@ export default {
...
@@ -139,28 +126,40 @@ export default {
// 库存预警
// 库存预警
'editForm.warningValue'
(
newValue
,
oldValue
)
{
'editForm.warningValue'
(
newValue
,
oldValue
)
{
this
.
editForm
.
warningValue
=
limitPrice
(
newValue
,
oldValue
,
6
,
2
)
this
.
editForm
.
warningValue
=
limitPrice
(
newValue
,
oldValue
,
6
,
2
)
}
,
}
},
},
mounted
()
{
mounted
()
{
this
.
routeInfo
=
this
.
$route
.
query
this
.
routeInfo
=
this
.
$route
.
query
this
.
routeInfo
.
editType
!=
'add'
?
this
.
getInfo
()
:
''
this
.
routeInfo
.
editType
!=
'add'
?
this
.
getInfo
()
:
''
this
.
$utils
.
getOptionsList
(
this
,
'editFormData'
,
false
)
this
.
$utils
.
getOptionsList
(
this
,
'editFormData'
,
false
)
this
.
getGoodsSeries
()
// this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
// this.changeFormAttr('editFormData', 'isHide', ['规格明细'], false)
},
},
methods
:
{
methods
:
{
getInfo
()
{
getInfo
()
{
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
let
params
=
{
// this.$nextTick(() => {
upgradeGoodsId
:
this
.
routeInfo
.
info
.
upgradeGoodsId
// this.editStatus = false
}
// })
console
.
log
(
params
)
// })
this
.
$apis
.
commodity
.
getGoodsDetail
(
params
).
then
(
res
=>
{
this
.
editForm
=
res
this
.
$nextTick
(()
=>
{
this
.
editStatus
=
false
})
})
},
},
// 所属系列改变,清空值
// 所属系列改变,清空值
// seriesClear() {
// seriesClear() {
// this.editForm
// this.editForm
// },
// },
getGoodsSeries
()
{
this
.
$apis
.
commodity
.
getGoodsSeries
({}).
then
(
res
=>
{
this
.
baseData
.
goodsSeriesList
=
res
this
.
$utils
.
getOptionsList
(
this
,
'editFormData'
,
false
,
'goodsCode'
)
})
},
// 产品类型改变
// 产品类型改变
handleCheckChange
(
val
,
attr
)
{
handleCheckChange
(
val
,
attr
)
{
let
baseAttrList
=
[
'赠送成本/元'
]
let
baseAttrList
=
[
'赠送成本/元'
]
...
@@ -211,30 +210,21 @@ export default {
...
@@ -211,30 +210,21 @@ export default {
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
this
.
$refs
.
editFormRef
.
$refs
[
this
.
editChildRef
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
var
params
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
)
console
.
log
(
params
,
'params----'
)
params
.
merchantIdList
=
[]
// if (this.routeInfo.editType == 'edit') {
params
.
merchantIdList
=
params
.
merchantList
.
map
(
item
=>
item
.
merchantId
)
// params.id = this.routeInfo.id
delete
params
.
merchantList
// }
if
(
this
.
routeInfo
.
editType
==
'edit'
)
{
// params.merchantList = []
params
.
upgradeGoodsId
=
this
.
routeInfo
.
info
.
upgradeGoodsId
// // 专区类型(1发现频道,2商城专区)
}
// params.zoneType = '2'
this
.
$apis
.
commodity
.
updateGoods
(
params
).
then
(
res
=>
{
// this.editForm.merchantList.forEach(item => {
this
.
$message
({
// params.merchantList.push({
message
:
res
.
code
==
'0'
?
'操作成功'
:
'操作失败'
,
// merchantId: item.merchantNo,
type
:
res
.
code
==
'0'
?
'success'
:
'error'
// merchantName: item.merchantName,
})
// merchantAccountLevel: item.merchantAccountLevel
if
(
res
.
code
==
'0'
)
{
// })
this
.
cancelJump
()
// })
}
// // console.log(params)
})
// this.$apis.zoneList.insertZoneApi(params).then(res => {
// this.$message({
// message: res.code == '0' ? '操作成功' : '操作失败',
// type: res.code == '0' ? 'success' : 'error'
// })
// if (res.code == '0') {
// this.cancelJump()
// }
// })
}
}
})
})
},
},
...
...
src/views/commodity/index.vue
View file @
b39c47b
...
@@ -3,11 +3,12 @@
...
@@ -3,11 +3,12 @@
<div
class=
"container"
>
<div
class=
"container"
>
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"1"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<div
class=
"table-header"
>
<div
class=
"table-header"
>
<GLButton
type=
"primary"
size=
"small"
@
click=
"handleAdd"
fn=
"新建"
>
新增商品
</GLButton>
<GLButton
type=
"primary"
size=
"small"
@
click=
"handleEdit('add')"
fn=
"新增"
>
新增商品
</GLButton>
<el-button
type=
"primary"
size=
"small"
@
click=
"handleExport"
>
导出
</el-button>
</div>
</div>
<!-- 表格区域 开始 -->
<!-- 表格区域 开始 -->
<GLTable
ref=
"commofityRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"
s
earchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
>
<GLTable
ref=
"commofityRef"
:getListApi=
"getListApi"
:noDataImg=
"url"
:searchForm=
"
tableS
earchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<div
class=
"table-btns"
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
</div>
</div>
...
@@ -21,6 +22,7 @@
...
@@ -21,6 +22,7 @@
import
url
from
'@/assets/empty.png'
import
url
from
'@/assets/empty.png'
import
constData
from
'./constant/data'
import
constData
from
'./constant/data'
import
baseList
from
'./constant/baseList'
import
baseList
from
'./constant/baseList'
import
*
as
dayjs
from
'dayjs'
export
default
{
export
default
{
name
:
'commodity'
,
name
:
'commodity'
,
data
()
{
data
()
{
...
@@ -31,15 +33,79 @@ export default {
...
@@ -31,15 +33,79 @@ export default {
goodsName
:
''
,
goodsName
:
''
,
goodsCode
:
''
,
goodsCode
:
''
,
merchantIdList
:
[],
merchantIdList
:
[],
goodsType
:
''
,
type
:
''
,
baseProductFlag
:
'N'
,
goodsType
:
''
upgradeProductFlag
:
'N'
},
},
tableSearchForm
:
{},
searchFormData
:
constData
.
commodityObj
.
searchFormData
,
searchFormData
:
constData
.
commodityObj
.
searchFormData
,
// 表格
// 表格
getListApi
:
this
.
$apis
.
commodity
.
getListApi
,
getListApi
:
this
.
$apis
.
commodity
.
getListApi
,
tableParams
:
constData
.
commodityObj
.
tableParams
,
tableParams
:
{
// pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
listName
:
'list'
,
tableOption
:
{
width
:
'170'
},
tableColumns
:
[
{
label
:
'商品名称'
,
prop
:
'goodsName'
,
width
:
'200'
},
{
label
:
'商品编码'
,
prop
:
'type'
,
width
:
'110'
},
{
label
:
'所属系列'
,
prop
:
'goodsCode'
,
width
:
'100'
},
{
label
:
'产品类型'
,
prop
:
'baseProductFlag'
,
formatter
:
cellValue
=>
{
let
list
=
[]
cellValue
.
baseProductFlag
==
'Y'
?
list
.
push
(
'基础产品'
)
:
''
cellValue
.
upgradeProductFlag
==
'Y'
?
list
.
push
(
'升级产品'
)
:
''
return
list
.
join
(
','
)
}
},
{
label
:
'售价/元'
,
prop
:
'sellPrice'
},
{
label
:
'最低售价/元'
,
prop
:
'minSellPrice'
},
{
label
:
'赠送成本'
,
prop
:
'giftCost'
},
{
label
:
'产品成本'
,
prop
:
'productCost'
},
{
label
:
'使用门店'
,
prop
:
''
,
formatter
:
cellValue
=>
{
return
cellValue
.
merchantList
?.
map
(
item
=>
item
.
merchantName
).
join
(
','
)
}
},
{
label
:
'创建日期'
,
prop
:
'createDate'
,
width
:
'155px'
,
formatter
:
cellValue
=>
{
return
cellValue
.
createdDate
?
dayjs
(
cellValue
.
createdDate
).
format
(
'YYYY-MM-DD'
)
:
''
}
}
]
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
// 表格按钮
// 表格按钮
tableButtonList
:
[
tableButtonList
:
[
{
{
...
@@ -49,9 +115,6 @@ export default {
...
@@ -49,9 +115,6 @@ export default {
type
:
'text'
,
type
:
'text'
,
fn
:
'查看'
fn
:
'查看'
},
},
// condition: row => {
// return row.goodsStatus
// },
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
handleEdit
(
'detail'
,
row
)
click
:
row
=>
this
.
handleEdit
(
'detail'
,
row
)
}
}
...
@@ -63,9 +126,6 @@ export default {
...
@@ -63,9 +126,6 @@ export default {
type
:
'text'
,
type
:
'text'
,
fn
:
'编辑'
fn
:
'编辑'
},
},
// condition: row => {
// return !row.goodsStatus
// },
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
handleEdit
(
'edit'
,
row
)
click
:
row
=>
this
.
handleEdit
(
'edit'
,
row
)
}
}
...
@@ -77,9 +137,6 @@ export default {
...
@@ -77,9 +137,6 @@ export default {
type
:
'text'
,
type
:
'text'
,
fn
:
'删除'
fn
:
'删除'
},
},
// condition: row => {
// return !row.goodsStatus
// },
listeners
:
{
listeners
:
{
click
:
row
=>
this
.
handleDelete
(
row
)
click
:
row
=>
this
.
handleDelete
(
row
)
}
}
...
@@ -87,9 +144,10 @@ export default {
...
@@ -87,9 +144,10 @@ export default {
],
],
// 基本数据
// 基本数据
baseData
:
{
baseData
:
{
productType
List
:
[],
merchant
List
:
[],
brandList
:
[],
brandList
:
[],
statusList
:
baseList
.
statusList
typeList
:
baseList
.
typeList
,
goodsSeriesList
:
[]
},
},
imgVisible
:
false
,
imgVisible
:
false
,
previewImgUrl
:
''
previewImgUrl
:
''
...
@@ -97,9 +155,29 @@ export default {
...
@@ -97,9 +155,29 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
getGoodsSeries
()
this
.
getMerchantList
()
this
.
$utils
.
getOptionsList
(
this
,
'searchFormData'
)
this
.
$utils
.
getOptionsList
(
this
,
'searchFormData'
)
},
},
methods
:
{
methods
:
{
getParams
()
{
var
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
searchForm
))
switch
(
params
.
goodsType
)
{
case
1
:
params
.
baseProductFlag
=
'Y'
break
case
2
:
params
.
upgradeProductFlag
=
'Y'
break
}
return
params
},
beforeSearchFn
()
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
this
.
tableSearchForm
=
this
.
getParams
()
resolve
()
})
},
/**
/**
* @param {Sting} editType add/edit/detail
* @param {Sting} editType add/edit/detail
* @param {Object} info
* @param {Object} info
...
@@ -116,15 +194,40 @@ export default {
...
@@ -116,15 +194,40 @@ export default {
$title
:
encodeURI
(
titleObj
[
editType
])
$title
:
encodeURI
(
titleObj
[
editType
])
}
}
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/commodity/editCommodity'
,
path
:
editType
==
'detail'
?
'/commodity/commodityDetail'
:
'/commodity/editCommodity'
,
query
:
params
query
:
params
})
})
},
},
getGoodsSeries
()
{
this
.
$apis
.
commodity
.
getGoodsSeries
({}).
then
(
res
=>
{
this
.
baseData
.
goodsSeriesList
=
res
this
.
$utils
.
getOptionsList
(
this
,
'searchFormData'
,
true
,
'goodsCode'
)
})
},
getMerchantList
()
{
let
params
=
{
currentPage
:
1
,
pageSize
:
99999
}
this
.
$apis
.
commodity
.
getSimpleMerchantList
(
params
).
then
(
res
=>
{
this
.
baseData
.
merchantList
=
res
.
list
this
.
$utils
.
getOptionsList
(
this
,
'searchFormData'
,
true
,
'merchantIdList'
)
})
},
// 删除
// 删除
handleDelete
(
info
)
{
handleDelete
(
info
)
{
this
.
$utils
.
secondConfirm
(
this
,
'删除提示'
,
'删除后不可恢复,是否确定删除?'
)
this
.
$utils
.
secondConfirm
(
this
,
'删除提示'
,
'删除后不可恢复,是否确定删除?'
,
'commodity'
,
'deleteGoods'
,
{
upgradeGoodsId
:
info
.
upgradeGoodsId
})
console
.
log
(
info
)
},
// 导出
handleExport
()
{
let
params
=
this
.
getParams
()
this
.
$apis
.
commodity
.
exportGoods
(
params
).
then
(
res
=>
{
this
.
$utils
.
aToExport
(
res
.
data
)
})
},
},
handleSearch
()
{
handleSearch
()
{
...
@@ -133,10 +236,11 @@ export default {
...
@@ -133,10 +236,11 @@ export default {
handleReset
()
{
handleReset
()
{
this
.
searchForm
=
{
this
.
searchForm
=
{
commodityCode
:
''
,
goodsName
:
''
,
baseGoodsName
:
''
,
goodsCode
:
''
,
goodsType
:
''
,
merchantIdList
:
[],
status
:
''
type
:
''
,
goodsType
:
''
}
}
this
.
handleSearch
()
this
.
handleSearch
()
},
},
...
...
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