Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
mallapp
Commits
c32f9ecf
Commit
c32f9ecf
authored
May 27, 2020
by
zhangjianguo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车的修改
parent
e4f98ee1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
93 deletions
+81
-93
cart.vue
pages/cart/cart.vue
+80
-92
user-center.vue
pages/user-center/user-center.vue
+1
-1
No files found.
pages/cart/cart.vue
View file @
c32f9ecf
...
...
@@ -70,23 +70,27 @@
:key=
"index"
:name=
"item.name"
>
<u-checkbox-group
v-if=
"item.new_status == 0 || editType == true"
@
change=
"
clickcheckbox(item.checked, item.attrs.price, index, i)
"
>
<u-checkbox
v-model=
"item.checked"
shape=
"circle"
:active-color=
"mc"
></u-checkbox>
</u-checkbox-group>
<Text
v-if=
"item.new_status != 0 && editType == false"
style=
"color: #a0a09d; width: 22px;"
>
失效
</Text
>
<view
style=
"width: 40px;text-align: center;"
v-if=
"item.new_status == 0 || editType == true"
>
<u-checkbox-group
@
change=
"
clickcheckbox(item.checked, item.attrs.price, index, i)
"
>
<u-checkbox
v-model=
"item.checked"
shape=
"circle"
:active-color=
"mc"
></u-checkbox>
</u-checkbox-group>
</view>
<view
class=
"invalid"
:style=
"
{ background: mc }" v-if="item.new_status != 0
&&
editType == false">
<Text
style=
"color: #fff; width: 22px;font-size: 20rpx;"
>
失效
</Text
>
</view>
<image
:src=
"
item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic
...
...
@@ -98,13 +102,14 @@
margin-left: 30rpx;
border-radius: 5px;
"
@
click=
"clickHandler(item.goods_id)"
/>
<view
style=
"
display: flex;
flex-direction: column;
justify-content: space-between;
width: 4
6
0rpx;
width: 4
4
0rpx;
height: 150rpx;
margin-left: 20rpx;
"
...
...
@@ -112,7 +117,7 @@
<Text
style=
"
font-size: 28rpx;
width: 4
6
0rpx;
width: 4
4
0rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
...
...
@@ -121,7 +126,7 @@
>
<view
style=
"
width: 4
6
0rpx;
width: 4
4
0rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
...
...
@@ -149,35 +154,15 @@
<Text
style=
"font-size: 30rpx;"
:style=
"
{ color: mc }"
>¥
<Text
style=
"40rpx"
>
{{
item
.
attrs
.
price
}}
</Text></Text
>
<!--
<u-number-box
:value=
"item.num"
:min=
"1"
:max=
'100'
:input-width=
"100"
@
change=
"valChange(i,index, item.num,item.attrs.price,$event)"
></u-number-box>
-->
<view
class=
"item_input"
>
<view
class=
"item_input_l"
:style=
"
{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i, index, item.attrs.price)"
>-
</view
>
<input
type=
"number"
class=
"item_input_c"
:value=
"item.num"
@
blur=
"
inputblur(i, index, item.num, item.attrs.price, $event)
"
@
input=
"
onKeyInput(i, index, item.num, item.attrs.price, $event)
"
/>
<view
class=
"item_input_r"
style=
"color: #9b9b9b;"
@
click=
"plus(i, index, item.attrs.price)"
>
+
</view
>
</view>
<u-number-box
v-model=
"item.num"
:min=
"1"
:max=
"item.goods.goods_stock"
@
change=
"valChange(i,index, item.num,item.attrs.price,$event)"
></u-number-box>
</view>
<Text
v-if=
"item.new_status != 0 && editType == false"
style=
'font-size: 20rpx;color:#a0a09d ;'
>
失效原因:商品下架或者库存不足
</Text>
</view>
</view>
</view>
...
...
@@ -334,7 +319,7 @@ export default {
clickcheckbox
(
checked
,
price
,
index
,
i
)
{
if
(
checked
==
true
)
{
this
.
checkCount
+=
1
;
this
.
TotalPrice
+=
price
*
this
.
list
[
i
].
goods_list
[
index
].
num
;
this
.
TotalPrice
+=
parseFloat
((
price
*
this
.
list
[
i
].
goods_list
[
index
].
num
).
toFixed
(
2
))
;
let
goods_list_all
=
true
;
//判断该商场是否全选
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
this
.
editType
==
false
)
{
...
...
@@ -368,7 +353,7 @@ export default {
this
.
cart_id_list
.
push
(
obj
);
}
}
else
{
this
.
TotalPrice
-=
price
*
this
.
list
[
i
].
goods_list
[
index
].
num
;
this
.
TotalPrice
-=
parseFloat
((
price
*
this
.
list
[
i
].
goods_list
[
index
].
num
).
toFixed
(
2
))
;
this
.
checkCount
-=
1
;
this
.
allchecked
=
false
;
let
goods_list_all
=
true
;
//判断该商场是否全选
...
...
@@ -388,6 +373,7 @@ export default {
});
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
mch_SelectAll
(
checked
,
i
)
{
if
(
checked
==
true
)
{
...
...
@@ -395,9 +381,12 @@ export default {
let
new_statusnum
=
0
;
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
x
.
new_status
==
0
)
{
this
.
TotalPrice
+=
x
.
attrs
.
price
*
x
.
num
;
x
.
checked
=
true
;
new_statusnum
++
;
if
(
x
.
checked
==
false
){
this
.
TotalPrice
+=
parseFloat
((
x
.
attrs
.
price
*
x
.
num
).
toFixed
(
2
));
x
.
checked
=
true
;
new_statusnum
++
;
}
}
//编辑时候的商城全选
...
...
@@ -437,7 +426,7 @@ export default {
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
x
.
new_status
==
0
)
{
x
.
checked
=
false
;
this
.
TotalPrice
-=
x
.
attrs
.
price
*
x
.
num
;
this
.
TotalPrice
-=
parseFloat
((
x
.
attrs
.
price
*
x
.
num
).
toFixed
(
2
))
;
new_statusnum
++
;
}
...
...
@@ -451,6 +440,7 @@ export default {
this
.
allchecked
=
false
;
this
.
checkCount
-=
new_statusnum
;
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
SelectAll
()
{
let
list
=
this
.
list
;
...
...
@@ -464,7 +454,7 @@ export default {
if
(
j
.
new_status
==
0
)
{
j
.
checked
=
true
;
this
.
checkCount
++
;
this
.
TotalPrice
+=
j
.
attrs
.
price
*
j
.
num
;
this
.
TotalPrice
+=
parseFloat
((
j
.
attrs
.
price
*
j
.
num
).
toFixed
(
2
))
;
}
//编辑的时候
...
...
@@ -487,43 +477,28 @@ export default {
});
});
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
inputblur
(
i
,
index
,
num
,
price
,
e
)
{
let
value
=
Number
(
e
.
target
.
value
);
if
(
value
==
0
)
{
this
.
list
[
i
].
goods_list
[
index
].
num
=
1
;
this
.
TotalPrice
+=
price
*
1
;
}
},
onKeyInput
(
i
,
index
,
num
,
price
,
e
)
{
//输入的数量
let
value
=
Number
(
e
.
target
.
value
);
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
)
{
if
(
value
>
num
)
{
this
.
TotalPrice
+=
price
*
(
value
-
num
);
}
else
if
(
value
<
num
)
{
this
.
TotalPrice
-=
price
*
(
num
-
value
);
}
}
},
reduce
(
i
,
index
,
price
)
{
//减
if
(
this
.
list
[
i
].
goods_list
[
index
].
num
>
1
)
{
this
.
list
[
i
].
goods_list
[
index
].
num
-=
1
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
)
{
this
.
TotalPrice
-=
price
*
1
;
}
}
},
plus
(
i
,
index
,
price
)
{
//加
this
.
list
[
i
].
goods_list
[
index
].
num
+=
1
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
)
{
this
.
TotalPrice
+=
price
*
1
;
}
},
valChange
(
i
,
index
,
num
,
p
,
e
){
let
value
=
parseFloat
(
e
.
value
);
let
price
=
parseFloat
(
p
);
// console.log(i, index, num, price, value)
if
(
num
>
value
){
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
){
this
.
TotalPrice
-=
parseFloat
((
price
*
(
num
-
value
)).
toFixed
(
2
))
;
}
}
else
if
(
value
>
num
){
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
){
this
.
TotalPrice
+=
parseFloat
((
price
*
(
value
-
num
)).
toFixed
(
2
))
;
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
edit
()
{
this
.
editType
=
!
this
.
editType
;
this
.
allchecked
=
false
;
...
...
@@ -623,6 +598,11 @@ export default {
});
}
},
clickHandler
(
id
)
{
uni
.
navigateTo
({
url
:
'/pages/goods/goods?id='
+
id
,
});
},
},
};
</
script
>
...
...
@@ -659,7 +639,7 @@ export default {
.cartStyle
.cartList
.cartList_item
{
width
:
100%
;
padding
:
40
rpx
3
0
rpx
;
padding
:
30
rpx
30
rpx
30
rpx
1
0
rpx
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
...
...
@@ -719,4 +699,12 @@ export default {
.cartStyle
.Deletestyle
{
margin-right
:
40
rpx
;
}
.cartStyle
.invalid
{
text-align
:
center
;
width
:
40px
;
height
:
20px
;
line-height
:
20px
;
border-radius
:
10px
;
}
</
style
>
pages/user-center/user-center.vue
View file @
c32f9ecf
...
...
@@ -33,7 +33,7 @@
</view>
</view>
<view
class=
"account_bar"
v-if=
"meueData.user_center.
is_account_
status==1"
>
<view
class=
"account_bar"
v-if=
"meueData.user_center.
account_bar.
status==1"
>
<view
class=
"account_bar_item"
v-if=
"meueData.user_center.account_bar.integral.status==1"
>
<Text
:style=
"
{'color':secondary}">
{{
user_info
.
integral
}}
</Text>
<view
class=
"footprint_item_bottom"
>
...
...
Write
Preview
Markdown
is supported
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