Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
sso-equity
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 13d05848
authored
Mar 27, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
恢复回显功能
1 parent
301f8c2a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
40 deletions
src/views/templateConfig/components/selectCouponDialog.vue
src/views/templateConfig/index.vue
src/views/templateConfig/components/selectCouponDialog.vue
View file @
13d0584
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<div
class=
"table_body"
>
<div
class=
"table_body"
>
<GLCombiForm
:rowNumber=
"1"
class=
"dialog_search"
ref=
"searchRef"
:formObj=
"dialogSearchForm"
:formData=
"dialogFormData"
@
handleOk=
"handleOk"
@
handleRest=
"handleRest"
></GLCombiForm>
<GLCombiForm
:rowNumber=
"1"
class=
"dialog_search"
ref=
"searchRef"
:formObj=
"dialogSearchForm"
:formData=
"dialogFormData"
@
handleOk=
"handleOk"
@
handleRest=
"handleRest"
></GLCombiForm>
<div
class=
"dialog_table"
>
<div
class=
"dialog_table"
>
<GLTable
:pageSizes=
"pageSizes"
ref=
"tableRef"
:pageConf=
"pageConf"
@
setTableFinishFun=
"setTableFinishFun"
:searchForm=
"dialogSearchForm"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
@
selectionTable=
"selectionTable()
"
>
<GLTable
v-loading=
"loading"
:tableTotal=
"tableTotal"
:pageSizes=
"pageSizes"
ref=
"tableRef"
:pageConf=
"pageConf"
:searchForm=
"dialogSearchForm"
:tableParams=
"tableParams"
:tableData=
"tableData"
@
refreshTable=
"getCouponList"
@
selectionTable=
"selectionTable
"
>
<div
class=
"good_name"
slot=
"goodName"
slot-scope=
"scope"
>
<div
class=
"good_name"
slot=
"goodName"
slot-scope=
"scope"
>
<img
v-if=
"scope.scope.appearance == 1"
src=
"@/assets/coupon.png"
alt=
""
/>
<img
v-if=
"scope.scope.appearance == 1"
src=
"@/assets/coupon.png"
alt=
""
/>
<img
v-else
src=
"@/assets/directCharge.png"
alt=
""
/>
<img
v-else
src=
"@/assets/directCharge.png"
alt=
""
/>
...
@@ -39,7 +39,6 @@
...
@@ -39,7 +39,6 @@
</div>
</div>
</div>
</div>
</div>
</div>
</GLDialog>
</GLDialog>
</
template
>
</
template
>
...
@@ -47,12 +46,13 @@
...
@@ -47,12 +46,13 @@
import
{
utils
}
from
'glsx-common'
import
{
utils
}
from
'glsx-common'
export
default
{
export
default
{
name
:
'index'
,
name
:
'index'
,
props
:
[
'isVisible'
,
'selectedGoodsList'
],
props
:
[
'isVisible'
,
'selectedGoodsList'
,
'templateId'
],
data
()
{
data
()
{
return
{
return
{
copyList
:
[],
copyList
:
[],
firstOpen
:
true
,
firstOpen
:
true
,
resetTable
:
false
,
resetTable
:
false
,
loading
:
false
,
signList
:
{
signList
:
{
couponList
:
[],
couponList
:
[],
directChargeList
:
[]
directChargeList
:
[]
...
@@ -81,6 +81,8 @@ export default {
...
@@ -81,6 +81,8 @@ export default {
}
}
],
],
getListApi
:
this
.
$apis
.
goodsCouponApi
.
getCouponsList
,
getListApi
:
this
.
$apis
.
goodsCouponApi
.
getCouponsList
,
tableData
:
[],
tableTotal
:
0
,
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
pageConf
:
{
pageSize
:
'pageSize'
,
pageNum
:
'pageNum'
,
totalCount
:
'total'
},
tableParams
:
{
tableParams
:
{
listName
:
'list'
,
listName
:
'list'
,
...
@@ -122,8 +124,45 @@ export default {
...
@@ -122,8 +124,45 @@ export default {
this
.
getAllBrandList
()
this
.
getAllBrandList
()
},
},
mounted
(){
mounted
(){
this
.
getListByTemplateId
()
},
},
methods
:
{
methods
:
{
getListByTemplateId
(){
const
params
=
{
pageNum
:
1
,
pageSize
:
9999
,
templateId
:
this
.
templateId
}
console
.
log
(
params
)
this
.
$apis
.
goodsCouponApi
.
getCouponById
(
params
).
then
(
res
=>
{
if
(
res
){
res
?.
list
?.
map
(
item
=>
item
.
id
=
item
.
couponId
)
this
.
filterCoupon
(
res
.
list
)
this
.
getCouponList
(
false
)
}
})
},
getCouponList
(
type
){
if
(
this
?.
$refs
?.
tableRef
?.
page
&&
type
==
'reset'
)
{
this
.
$refs
.
tableRef
.
page
.
pageNum
=
1
this
.
$refs
.
tableRef
.
page
.
pageSize
=
10
}
let
{
pageSize
=
10
,
pageNum
=
1
}
=
this
?.
$refs
?.
tableRef
?.
page
||
{}
let
params
=
{
...
this
.
dialogSearchForm
,
pageSize
,
pageNum
}
this
.
loading
=
true
this
.
$apis
.
goodsCouponApi
.
getCouponsList
(
params
).
then
(
res
=>
{
this
.
loading
=
false
if
(
res
){
this
.
tableData
=
res
?.
list
||
[]
this
.
tableTotal
=
res
?.
total
||
0
this
.
setTableFinishFun
()
}
})
},
getAllBrandList
()
{
getAllBrandList
()
{
this
.
$apis
.
orderApi
.
getAllBrandList
().
then
(
res
=>
{
this
.
$apis
.
orderApi
.
getAllBrandList
().
then
(
res
=>
{
const
item
=
this
.
dialogFormData
.
find
(
item
=>
item
.
name
===
'brandName'
)
const
item
=
this
.
dialogFormData
.
find
(
item
=>
item
.
name
===
'brandName'
)
...
@@ -132,7 +171,7 @@ export default {
...
@@ -132,7 +171,7 @@ export default {
},
},
handleOk
()
{
handleOk
()
{
this
.
resetTable
=
true
this
.
resetTable
=
true
this
.
$refs
.
tableRef
.
refreshTable
(
)
this
.
getCouponList
(
'reset'
)
},
},
handleRest
()
{
handleRest
()
{
this
.
dialogSearchForm
=
{
this
.
dialogSearchForm
=
{
...
@@ -142,15 +181,6 @@ export default {
...
@@ -142,15 +181,6 @@ export default {
this
.
handleOk
()
this
.
handleOk
()
},
},
onOk
()
{
onOk
()
{
// let list = this.$refs.tableRef.mutiSelectArr[this.tableParams.mutiSelectName] || []
// list = [...this.couponList, ...list]
// for (let i = 0; i < this.selectedGoodsList.length; i++) {
// let idx = list.findIndex(item => item.id == this.selectedGoodsList[i].id)
// if (idx > -1) {
// list.splice(idx, 1)
// }
// }
// list.map(item => this.$set(item, 'newCost', Number((item.lineationPrice - item.costPrice).toFixed(1))))
this
.
$emit
(
'confirmDialog'
,
[...
this
.
signList
.
directChargeList
,
...
this
.
signList
.
couponList
])
this
.
$emit
(
'confirmDialog'
,
[...
this
.
signList
.
directChargeList
,
...
this
.
signList
.
couponList
])
this
.
handleClose
()
this
.
handleClose
()
},
},
...
@@ -162,40 +192,39 @@ export default {
...
@@ -162,40 +192,39 @@ export default {
},
},
// 点击选中卡券
// 点击选中卡券
selectionTable
(
e
){
selectionTable
(
e
){
if
(
this
.
resetTable
){
if
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
]?.
data
?.
length
){
return
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
]?.
data
?.
forEach
(
item
=>
{
const
selectTarget
=
e
?.
find
(
row
=>
item
.
id
==
row
.
id
)
const
idx
=
this
.
signList
[
item
.
appearance
==
2
?
'directChargeList'
:
'couponList'
]?.
findIndex
(
row
=>
item
.
id
==
row
.
id
)
if
(
selectTarget
&&
idx
==-
1
){
let
obj
=
utils
.
deepClone
(
item
)
this
.
$set
(
obj
,
'couponAmount'
,
1
)
this
.
signList
[
item
.
appearance
==
2
?
'directChargeList'
:
'couponList'
].
push
(
obj
)
}
if
(
!
selectTarget
&&
idx
>-
1
){
this
.
signList
[
item
.
appearance
==
2
?
'directChargeList'
:
'couponList'
].
splice
(
idx
,
1
)
}
})
}
}
let
list
=
this
.
$refs
.
tableRef
?.
mutiSelectArr
?.[
this
.
tableParams
?.
mutiSelectName
]
||
[]
e
?.
forEach
(
item
=>
{
list
.
map
(
item
=>
this
.
$set
(
item
,
'couponAmount'
,
1
))
const
target
=
this
.
signList
[
item
.
appearance
==
2
?
'directChargeList'
:
'couponList'
]?.
find
(
row
=>
item
.
id
==
row
.
id
)
this
.
filterCoupon
(
list
)
if
(
!
target
){
this
.
signList
[
item
.
appearance
==
2
?
'directChargeList'
:
'couponList'
].
push
(
item
)
}
})
},
},
// 选中的优惠券分成卡券和直充
// 选中的优惠券分成卡券和直充
filterCoupon
(
list
){
filterCoupon
(
list
){
this
.
signList
.
directChargeList
=
list
.
map
(
item
=>
{
this
.
signList
.
directChargeList
=
list
.
filter
(
item
=>
item
.
appearance
==
2
)
const
target
=
this
.
signList
.
directChargeList
.
find
(
row
=>
row
.
id
==
item
.
id
)
this
.
signList
.
couponList
=
list
.
filter
(
item
=>
item
.
appearance
==
1
)
if
(
target
)
{
item
.
couponAmount
=
target
.
couponAmount
}
return
item
}).
filter
(
item
=>
item
.
appearance
==
2
)
this
.
signList
.
couponList
=
list
.
map
(
item
=>
{
const
target
=
this
.
signList
.
directChargeList
.
find
(
row
=>
row
.
id
==
item
.
id
)
if
(
target
)
{
item
.
couponAmount
=
target
.
couponAmount
}
return
item
}).
filter
(
item
=>
item
.
appearance
==
1
)
},
},
//删除选中行
//删除选中行
delSelectedRow
(
row
){
delSelectedRow
(
row
){
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
console
.
log
(
222
)
let
idx
=
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
.
findIndex
(
item
=>
item
.
id
==
row
.
id
)
let
idx
=
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
.
findIndex
(
item
=>
item
.
id
==
row
.
id
)
if
(
idx
>
-
1
)
{
if
(
idx
>
-
1
)
{
try
{
try
{
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
idx
],
false
)
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
idx
],
false
)
// let id = this.copyList.findIndex(item => item.id == row.id)
// if (id > -1) this.copyList.splice(id, 1)
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
}
}
...
@@ -207,7 +236,7 @@ export default {
...
@@ -207,7 +236,7 @@ export default {
this
.
signList
[
key
].
splice
(
idx
,
1
)
this
.
signList
[
key
].
splice
(
idx
,
1
)
this
.
delSelectedRow
(
item
)
this
.
delSelectedRow
(
item
)
},
},
//
更新表格设置选中的行
//
根据右边已选框设置选中
setTableFinishFun
()
{
setTableFinishFun
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
let
list
=
[...
this
.
signList
.
directChargeList
,
...
this
.
signList
.
couponList
]
let
list
=
[...
this
.
signList
.
directChargeList
,
...
this
.
signList
.
couponList
]
...
@@ -215,8 +244,6 @@ export default {
...
@@ -215,8 +244,6 @@ export default {
let
idx
=
list
.
findIndex
(
item
=>
item
.
id
==
row
.
id
)
let
idx
=
list
.
findIndex
(
item
=>
item
.
id
==
row
.
id
)
try
{
try
{
if
(
idx
>-
1
){
if
(
idx
>-
1
){
// let id = this.copyList.findIndex(item => item.id == row.id)
// if (id > -1 && this.copyList?.length) this.copyList.splice(id, 1)
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
rowIdx
],
true
)
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
rowIdx
],
true
)
}
else
{
}
else
{
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
rowIdx
],
false
)
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
toggleRowSelection
(
this
.
$refs
.
tableRef
.
$refs
[
this
.
tableParams
.
mutiSelectName
+
'MutiTable'
].
data
[
rowIdx
],
false
)
...
@@ -225,7 +252,6 @@ export default {
...
@@ -225,7 +252,6 @@ export default {
console
.
log
(
err
)
console
.
log
(
err
)
}
}
})
})
this
.
resetTable
=
false
})
})
}
}
}
}
...
...
src/views/templateConfig/index.vue
View file @
13d0584
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</div>
</div>
</GLTable>
</GLTable>
</div>
</div>
<select-coupon-dialog
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:selectedGoodsList=
"couponFormObj.selectedGoodsList"
v-if=
"isVisible"
:isVisible=
"isVisible"
></select-coupon-dialog>
<select-coupon-dialog
:templateId=
"curConfigId"
@
confirmDialog=
"confirmDialog"
@
closeDialog=
"closeDialog"
:selectedGoodsList=
"couponFormObj.selectedGoodsList"
v-if=
"isVisible"
:isVisible=
"isVisible"
></select-coupon-dialog>
</div>
</div>
</template>
</template>
...
...
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