Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-pay
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 2d0a211e
authored
Nov 11, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
商品编辑-规格值
1 parent
4d4414f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
145 additions
and
58 deletions
src/views/productGroup/editProduct.vue
src/views/productGroup/editProduct.vue
View file @
2d0a211
...
@@ -97,14 +97,14 @@
...
@@ -97,14 +97,14 @@
</div>
</div>
</div>
</div>
<
template
slot=
"proSpecsBtn"
>
<
template
slot=
"proSpecsBtn"
>
<el-button
:disabled=
"routeInfo.addOrEdit == 3"
type=
"primary"
@
click=
"handleSpecsEdit(
scope
)"
>
添加规格
</el-button>
<el-button
:disabled=
"routeInfo.addOrEdit == 3"
type=
"primary"
@
click=
"handleSpecsEdit(
1
)"
>
添加规格
</el-button>
</
template
>
</
template
>
<div
slot=
"proSpecs"
style=
"margin-left: 110px;"
>
<div
slot=
"proSpecs"
style=
"margin-left: 110px;"
>
<div
v-for=
"(subItem, subIndex) in specificationDetailList"
:key=
"subIndex"
>
<div
v-for=
"(subItem, subIndex) in specificationDetailList"
:key=
"subIndex"
>
<div>
<div>
<span>
规格名:
</span>
<span>
规格名:
</span>
<span>
{{ subItem.specificationName }}
</span>
<span>
{{ subItem.specificationName }}
</span>
<el-button
v-show=
"!disabled"
type=
"text"
@
click=
"handleSpecsEdit(2, subItem,
i
ndex)"
>
编辑
</el-button>
<el-button
v-show=
"!disabled"
type=
"text"
@
click=
"handleSpecsEdit(2, subItem,
subI
ndex)"
>
编辑
</el-button>
<el-button
v-show=
"!disabled"
type=
"text"
@
click=
"handleSpecsDelete(subIndex)"
>
删除
</el-button>
<el-button
v-show=
"!disabled"
type=
"text"
@
click=
"handleSpecsDelete(subIndex)"
>
删除
</el-button>
</div>
</div>
<div
class=
"flex"
>
<div
class=
"flex"
>
...
@@ -176,6 +176,18 @@
...
@@ -176,6 +176,18 @@
<el-dialog
:visible
.
sync=
"isImgVisible"
>
<el-dialog
:visible
.
sync=
"isImgVisible"
>
<img
class=
"dialog-img"
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
/>
<img
class=
"dialog-img"
width=
"100%"
:src=
"dialogImageUrl"
alt=
""
/>
</el-dialog>
</el-dialog>
<glsx-dialog
title=
"规格"
:isVisible
.
sync=
"isSpescVisible"
width=
"70%"
@
confirmDialog=
"handleSpescConfirm"
@
closeDialog=
"handleSpescClose"
>
<el-form
label-width=
"120px"
:model=
"spescEditForm"
:rules=
"spescRules"
ref=
"spescRef"
>
<el-form-item
label=
"规格名:"
prop=
"specificationName"
>
<el-input
class=
"w-320"
:size=
"size"
v-model=
"spescEditForm.specificationName"
placeholder=
"请输入规格名"
></el-input>
</el-form-item>
<el-form-item
label=
"规格值:"
prop=
"specificationValueList"
>
<el-tag
style=
"margin-right: 10px;"
v-for=
"(tag, i) in spescEditForm.specificationValueList"
:key=
"i"
closable
:type=
"tag.type"
@
close=
"handleSpescDelete(tag)"
>
{{ tag.specificationValue }}
</el-tag>
<el-input
class=
"input-new-tag"
v-if=
"specsInputVisible"
v-model=
"spescInputVal"
ref=
"saveSpescInput"
:size=
"size"
@
keyup
.
enter
.
native=
"handleInputConfirm"
@
blur=
"handleInputConfirm"
></el-input>
<el-button
v-else
class=
"button-new-tag"
size=
"small"
@
click=
"showInput"
>
+ 规格值
</el-button>
</el-form-item>
</el-form>
</glsx-dialog>
<relate-store-dialog
v-if=
"relateStoreVisible"
ref=
"relateStore"
:relateStoreVisible=
"relateStoreVisible"
:storeApi=
"storeApi"
:storeSearchForm=
"storeSearchForm"
:storeSelected=
"selectedList"
@
handleRelateStoreConfirm=
"handleRelateStoreConfirm"
@
handleRelateStoreClose=
"handleRelateStoreClose"
>
<relate-store-dialog
v-if=
"relateStoreVisible"
ref=
"relateStore"
:relateStoreVisible=
"relateStoreVisible"
:storeApi=
"storeApi"
:storeSearchForm=
"storeSearchForm"
:storeSelected=
"selectedList"
@
handleRelateStoreConfirm=
"handleRelateStoreConfirm"
@
handleRelateStoreClose=
"handleRelateStoreClose"
>
<el-row
slot
>
<el-row
slot
>
<el-form
:model=
"storeSearchForm"
ref=
"relate"
:inline=
"true"
label-width=
"90px"
>
<el-form
:model=
"storeSearchForm"
ref=
"relate"
:inline=
"true"
label-width=
"90px"
>
...
@@ -238,14 +250,25 @@ export default {
...
@@ -238,14 +250,25 @@ export default {
specificationDetailList
:
[],
specificationDetailList
:
[],
nameToValSpecsList
:
[],
nameToValSpecsList
:
[],
minRetailPrice
:
''
,
minRetailPrice
:
''
,
// specsTableParams: {
// 添加规格弹窗
// tableColumns: [
isSpescVisible
:
false
,
// {
spescRules
:
{
// label: '码数',
specificationName
:
[
// prop: ''
{
required
:
true
,
message
:
'请输入规格名'
,
trigger
:
'blur'
},
// }
{
validator
:
(
rule
,
value
,
callback
)
=>
{
// ]
return
this
.
spescData
.
curSpeceNameList
.
some
(
item
=>
item
==
value
)
?
callback
(
new
Error
(
'规格名重复'
))
:
callback
()
// },
},
trigger
:
'blur'
}
],
specificationValueList
:
[{
required
:
true
,
message
:
'请输入规格值'
,
trigger
:
'change'
}]
},
spescData
:
{
status
:
''
,
curSpeceNameList
:
[]
},
spescEditForm
:
{},
specsInputVisible
:
false
,
spescInputVal
:
''
,
// 表单
// 表单
editForm
:
{
editForm
:
{
goodsName
:
''
,
goodsName
:
''
,
...
@@ -549,6 +572,19 @@ export default {
...
@@ -549,6 +572,19 @@ export default {
this
.
externalFormList
[
1
].
editFormData
[
idx
].
isHide
=
!!
this
.
editForm
.
specificationList
.
length
this
.
externalFormList
[
1
].
editFormData
[
idx
].
isHide
=
!!
this
.
editForm
.
specificationList
.
length
})
})
},
},
// 二次确认
secondSimpleConfirm
(
title
,
txt
,
fn
)
{
this
.
$confirm
(
txt
,
title
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
fn
&&
fn
()
}
}
})
},
// 选择门店
// 选择门店
handleRelateStoreClose
()
{
handleRelateStoreClose
()
{
this
.
selectedList
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
.
supplyMerchantList
)
this
.
selectedList
=
this
.
$common
.
utils
.
deepClone
(
this
.
editForm
.
supplyMerchantList
)
...
@@ -563,16 +599,9 @@ export default {
...
@@ -563,16 +599,9 @@ export default {
this
.
$refs
.
relateStore
.
handleCurrentChange
(
1
)
this
.
$refs
.
relateStore
.
handleCurrentChange
(
1
)
},
},
handleMerchantDelete
(
obj
)
{
handleMerchantDelete
(
obj
)
{
this
.
$messageBox
.
confirm
(
'是否删除该门店?'
,
'删除'
,
{
this
.
secondSimpleConfirm
(
'删除'
,
'是否删除该门店?'
,
()
=>
{
confirmButtonText
:
'确定'
,
var
idx
=
this
.
editForm
.
supplyMerchantList
.
findIndex
(
item
=>
item
.
merchantNo
==
obj
.
scope
.
merchantNo
)
cancelButtonText
:
'取消'
,
this
.
editForm
.
supplyMerchantList
.
splice
(
idx
,
1
)
type
:
'error'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
var
idx
=
this
.
editForm
.
supplyMerchantList
.
findIndex
(
item
=>
item
.
merchantNo
==
obj
.
scope
.
merchantNo
)
this
.
editForm
.
supplyMerchantList
.
splice
(
idx
,
1
)
}
}
})
})
},
},
// 找最小规格值
// 找最小规格值
...
@@ -586,6 +615,7 @@ export default {
...
@@ -586,6 +615,7 @@ export default {
},
},
// 规格值解构
// 规格值解构
changeSpecs
(
isRecovery
)
{
changeSpecs
(
isRecovery
)
{
this
.
specsWidth
=
(
100
/
(
this
.
specificationDetailList
.
length
+
2
))
+
'%'
this
.
nameToValSpecsList
=
[]
this
.
nameToValSpecsList
=
[]
var
markIdx
=
0
var
markIdx
=
0
for
(
var
i
=
0
;
i
<
this
.
specificationDetailList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
specificationDetailList
.
length
;
i
++
)
{
...
@@ -620,8 +650,8 @@ export default {
...
@@ -620,8 +650,8 @@ export default {
}
}
}
}
}
}
console
.
log
(
this
.
nameToValSpecsList
)
//
console.log(this.nameToValSpecsList)
console
.
log
(
this
.
specificationDetailList
)
//
console.log(this.specificationDetailList)
if
(
isRecovery
)
{
if
(
isRecovery
)
{
this
.
nameToValSpecsList
.
forEach
((
item
,
index
)
=>
{
this
.
nameToValSpecsList
.
forEach
((
item
,
index
)
=>
{
var
specificationObj
=
{}
var
specificationObj
=
{}
...
@@ -639,7 +669,7 @@ export default {
...
@@ -639,7 +669,7 @@ export default {
}
}
})
})
}
}
console
.
log
(
this
.
nameToValSpecsList
)
//
console.log(this.nameToValSpecsList)
},
},
setLocaleCompare
(
params
)
{
setLocaleCompare
(
params
)
{
...
@@ -655,6 +685,63 @@ export default {
...
@@ -655,6 +685,63 @@ export default {
return
obj
.
join
(
'&'
).
replace
(
/,/g
,
'-'
)
return
obj
.
join
(
'&'
).
replace
(
/,/g
,
'-'
)
},
},
// 规格弹窗
handleSpescDelete
(
tag
)
{
this
.
spescEditForm
.
specificationValueList
.
splice
(
this
.
spescEditForm
.
specificationValueList
.
indexOf
(
tag
),
1
);
},
showInput
()
{
this
.
specsInputVisible
=
true
this
.
$nextTick
(
_
=>
{
this
.
$refs
.
saveSpescInput
.
$refs
.
input
.
focus
()
});
},
handleInputConfirm
()
{
let
spescInputVal
=
this
.
spescInputVal
if
(
this
.
spescEditForm
.
specificationValueList
.
length
==
8
)
{
this
.
$message
({
message
:
'规格值最多不能超过8个'
,
type
:
'error'
,
customClass
:
'zZindex'
})
return
true
}
if
(
this
.
spescEditForm
.
specificationValueList
.
findIndex
(
i
=>
i
.
specificationValue
==
spescInputVal
)
!=
-
1
)
{
this
.
$message
({
message
:
spescInputVal
+
'规格值已经存在'
,
type
:
'error'
,
customClass
:
'zZindex'
})
return
true
}
if
(
spescInputVal
)
{
this
.
spescEditForm
.
specificationValueList
.
push
({
specificationValue
:
spescInputVal
})
}
this
.
specsInputVisible
=
false
this
.
spescInputVal
=
''
},
handleSpescConfirm
()
{
this
.
$refs
.
spescRef
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
spescData
.
status
==
1
)
{
this
.
specificationDetailList
.
push
(
this
.
spescEditForm
)
}
else
{
this
.
specificationDetailList
[
this
.
spescData
.
targetIdx
]
=
this
.
spescEditForm
}
this
.
editForm
.
retailPrice
=
''
this
.
editForm
.
goodsStock
=
''
this
.
handleSpescClose
()
this
.
changeSpecs
(
false
)
}
})
},
handleSpescClose
()
{
this
.
isSpescVisible
=
!
this
.
isSpescVisible
},
// 添加规格status(1 - 新增;2 - 编辑)
// 添加规格status(1 - 新增;2 - 编辑)
handleSpecsEdit
(
status
,
targetItem
,
targetIdx
)
{
handleSpecsEdit
(
status
,
targetItem
,
targetIdx
)
{
if
(
status
==
1
&&
this
.
specificationDetailList
.
length
>=
5
)
{
if
(
status
==
1
&&
this
.
specificationDetailList
.
length
>=
5
)
{
...
@@ -670,39 +757,27 @@ export default {
...
@@ -670,39 +757,27 @@ export default {
curSpeceNameList
.
push
(
item
.
specificationName
)
curSpeceNameList
.
push
(
item
.
specificationName
)
}
}
})
})
var
params
=
{
this
.
spescData
=
{
// 1 - 新增;2 - 编辑
// 1 - 新增;2 - 编辑
status
:
status
,
status
:
status
,
targetIdx
:
targetIdx
,
curSpeceNameList
:
curSpeceNameList
curSpeceNameList
:
curSpeceNameList
}
}
if
(
status
==
2
)
{
this
.
spescEditForm
=
status
==
2
?
this
.
$common
.
utils
.
deepClone
(
targetItem
)
:
{
specificationName
:
''
,
specificationValueList
:
[]
}
params
.
formData
=
JSON
.
parse
(
JSON
.
stringify
(
targetItem
))
console
.
log
(
this
.
spescEditForm
)
}
this
.
handleSpescClose
()
// $uibModal.open({
// templateUrl: 'biz/mallManage/view/model/editSpecsModel.html',
// controller: 'editSpecsModel',
// size: 'lg',
// resolve: {
// specsConfig: function () {
// return params
// }
// }
// }).result.then(function (specsForm) {
// //关闭弹框后执行方法
// if (status == 1) {
// $scope.specificationDetailList.push(specsForm)
// $scope.specsWidth = (100 / ($scope.specificationDetailList.length + 2)) + '%'
// } else {
// $scope.specificationDetailList[targetIdx] = specsForm
// }
// $scope.formData.retailPrice = ''
// $scope.formData.goodsStock = ''
// changeSpecs(false)
// }, function () {});
},
},
// 删除规格值
handleSpecsDelete
(
index
)
{
this
.
secondSimpleConfirm
(
'删除'
,
'是否删除该规格?'
,
()
=>
{
this
.
specificationDetailList
.
splice
(
index
,
1
)
this
.
changeSpecs
(
false
)
})
},
// 恢复规格值
// 恢复规格值
recoverySpec
()
{
recoverySpec
()
{
this
.
specsWidth
=
(
100
/
(
this
.
specificationDetailList
.
length
+
2
))
+
'%'
this
.
changeSpecs
(
true
)
this
.
changeSpecs
(
true
)
},
},
// 恢复商品描述
// 恢复商品描述
...
@@ -826,15 +901,8 @@ export default {
...
@@ -826,15 +901,8 @@ export default {
this
.
editForm
.
descImgList
.
splice
(
idx
,
1
)
this
.
editForm
.
descImgList
.
splice
(
idx
,
1
)
},
},
handleImgDelete
(
attrName
,
subIndex
)
{
handleImgDelete
(
attrName
,
subIndex
)
{
this
.
$messageBox
.
confirm
(
'是否删除该图片?'
,
'删除'
,
{
this
.
secondSimpleConfirm
(
'删除'
,
'是否删除该图片?'
,
()
=>
{
confirmButtonText
:
'确定'
,
this
.
editForm
[
attrName
].
splice
(
subIndex
,
1
)
cancelButtonText
:
'取消'
,
type
:
'error'
,
callback
:
action
=>
{
if
(
action
==
'confirm'
)
{
this
.
editForm
[
attrName
].
splice
(
subIndex
,
1
)
}
}
})
})
},
},
handleImgLook
(
src
)
{
handleImgLook
(
src
)
{
...
@@ -906,4 +974,23 @@ export default {
...
@@ -906,4 +974,23 @@ export default {
.edit-pro
.table-spesc
.el-input--small
.el-input__inner
{
.edit-pro
.table-spesc
.el-input--small
.el-input__inner
{
text-align
:
center
!important
;
text-align
:
center
!important
;
}
}
.edit-pro
.w-320
{
width
:
320px
;
}
/* .el-tag + .el-tag {
margin-left: 10px;
} */
.button-new-tag
{
height
:
32px
;
line-height
:
30px
;
padding-top
:
0
;
padding-bottom
:
0
;
}
.input-new-tag
{
width
:
90px
;
vertical-align
:
bottom
;
}
.zZindex
{
z-index
:
3000
!important
;
}
</
style
>
</
style
>
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