Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
62f400a1
Commit
62f400a1
authored
Aug 12, 2019
by
Junling Bu
Browse files
fix[litemall-vue]: #245
parent
5e0be573
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-vue/src/views/order/tabbar-cart.vue
View file @
62f400a1
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
label=
"总计"
label=
"总计"
@
submit=
"cartSubmit"
@
submit=
"cartSubmit"
>
>
<van-checkbox
v-model=
"
allC
hecked
Status"
@
change
=
"setCheckAll"
style=
"padding: 0 10px;"
>
全选
</van-checkbox>
<van-checkbox
v-model=
"
c
hecked
All"
@
click
=
"setCheckAll"
style=
"padding: 0 10px;"
>
全选
</van-checkbox>
</van-submit-bar>
</van-submit-bar>
</div>
</div>
</
template
>
</
template
>
...
@@ -57,25 +57,16 @@ export default {
...
@@ -57,25 +57,16 @@ export default {
checkedAll
:
false
,
checkedAll
:
false
,
isSubmit
:
false
,
isSubmit
:
false
,
checkedGoods
:
[],
checkedGoods
:
[],
AllGoods
:
[],
allGoods
:
[],
allCheckedStatus
:
false
,
goods
:
[]
goods
:
[],
count
:
0
};
};
},
},
activated
()
{
this
.
checkedAll
=
false
;
this
.
isEditor
=
false
;
this
.
isSubmit
=
false
;
},
created
()
{
created
()
{
this
.
init
();
this
.
init
();
},
},
computed
:
{
computed
:
{
submitBarText
()
{
submitBarText
()
{
const
count
=
this
.
count
;
return
this
.
isEditor
?
'
删除
'
:
'
结算
'
;
return
this
.
isEditor
?
'
删除
'
:
`结算
${
count
?
`(
${
count
}
)`
:
''
}
`
;
},
},
totalPrice
()
{
totalPrice
()
{
return
this
.
goods
.
reduce
(
return
this
.
goods
.
reduce
(
...
@@ -102,9 +93,8 @@ export default {
...
@@ -102,9 +93,8 @@ export default {
init
()
{
init
()
{
cartList
().
then
(
res
=>
{
cartList
().
then
(
res
=>
{
this
.
goods
=
res
.
data
.
data
.
cartList
;
this
.
goods
=
res
.
data
.
data
.
cartList
;
this
.
A
llGoods
=
this
.
getAllList
();
this
.
a
llGoods
=
this
.
getAllList
();
this
.
checkedGoods
=
this
.
getCheckedList
(
this
.
goods
);
this
.
checkedGoods
=
this
.
getCheckedList
(
this
.
goods
);
this
.
count
=
this
.
checkedGoods
.
length
;
});
});
},
},
getAllList
()
{
getAllList
()
{
...
@@ -149,10 +139,10 @@ export default {
...
@@ -149,10 +139,10 @@ export default {
}
}
},
},
setCheckAll
(
val
)
{
setCheckAll
(
val
)
{
if
(
this
.
checkedGoods
.
length
===
this
.
A
llGoods
.
length
)
{
if
(
this
.
checkedGoods
.
length
===
this
.
a
llGoods
.
length
)
{
this
.
checkedGoods
=
[];
this
.
checkedGoods
=
[];
}
else
{
}
else
{
this
.
checkedGoods
=
this
.
A
llGoods
;
this
.
checkedGoods
=
this
.
a
llGoods
;
}
}
},
},
deleteCart
(
o
)
{
deleteCart
(
o
)
{
...
@@ -175,19 +165,25 @@ export default {
...
@@ -175,19 +165,25 @@ export default {
});
});
let
delProductIds
=
[];
let
delProductIds
=
[];
_
.
each
(
_
.
difference
(
this
.
A
llGoods
,
index
),
v
=>
{
_
.
each
(
_
.
difference
(
this
.
a
llGoods
,
index
),
v
=>
{
let
productId
=
_
.
find
(
this
.
goods
,
result
=>
{
let
productId
=
_
.
find
(
this
.
goods
,
result
=>
{
return
result
.
id
===
v
;
return
result
.
id
===
v
;
}).
productId
;
}).
productId
;
delProductIds
.
push
(
productId
);
delProductIds
.
push
(
productId
);
});
});
//没选中的不掉接口
if
(
delProductIds
.
length
>
0
)
{
if
(
delProductIds
.
length
>
0
)
{
cartChecked
({
productIds
:
delProductIds
,
isChecked
:
0
});
cartChecked
({
productIds
:
delProductIds
,
isChecked
:
0
});
}
}
if
(
addProductIds
.
length
>
0
)
{
if
(
addProductIds
.
length
>
0
)
{
cartChecked
({
productIds
:
addProductIds
,
isChecked
:
1
});
cartChecked
({
productIds
:
addProductIds
,
isChecked
:
1
});
}
}
if
(
index
.
length
===
this
.
allGoods
.
length
){
this
.
checkedAll
=
true
}
else
{
this
.
checkedAll
=
false
}
},
},
deleteNext
(
o
)
{
deleteNext
(
o
)
{
let
productIds
=
[];
let
productIds
=
[];
...
@@ -199,9 +195,8 @@ export default {
...
@@ -199,9 +195,8 @@ export default {
cartDelete
({
productIds
:
productIds
}).
then
(
res
=>
{
cartDelete
({
productIds
:
productIds
}).
then
(
res
=>
{
this
.
goods
=
res
.
data
.
data
.
cartList
;
this
.
goods
=
res
.
data
.
data
.
cartList
;
this
.
A
llGoods
=
this
.
getAllList
();
this
.
a
llGoods
=
this
.
getAllList
();
this
.
checkedGoods
=
this
.
getCheckedList
(
this
.
goods
);
this
.
checkedGoods
=
this
.
getCheckedList
(
this
.
goods
);
this
.
count
=
this
.
checkedGoods
.
length
;
});
});
}
}
},
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment