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 @@
...
@@ -70,23 +70,27 @@
:key=
"index"
:key=
"index"
:name=
"item.name"
:name=
"item.name"
>
>
<u-checkbox-group
<view
style=
"width: 40px;text-align: center;"
v-if=
"item.new_status == 0 || editType == true"
>
v-if=
"item.new_status == 0 || editType == true"
<u-checkbox-group
@
change=
"
@
change=
"
clickcheckbox(item.checked, item.attrs.price, index, i)
clickcheckbox(item.checked, item.attrs.price, index, i)
"
"
>
>
<u-checkbox
<u-checkbox
v-model=
"item.checked"
v-model=
"item.checked"
shape=
"circle"
shape=
"circle"
:active-color=
"mc"
:active-color=
"mc"
></u-checkbox>
></u-checkbox>
</u-checkbox-group>
</u-checkbox-group>
<Text
</view>
v-if=
"item.new_status != 0 && editType == false"
style=
"color: #a0a09d; width: 22px;"
<view
class=
"invalid"
:style=
"
{ background: mc }" v-if="item.new_status != 0
&&
editType == false">
>
失效
</Text
<Text
>
style=
"color: #fff; width: 22px;font-size: 20rpx;"
>
失效
</Text
>
</view>
<image
<image
:src=
"
:src=
"
item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic
item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic
...
@@ -98,13 +102,14 @@
...
@@ -98,13 +102,14 @@
margin-left: 30rpx;
margin-left: 30rpx;
border-radius: 5px;
border-radius: 5px;
"
"
@
click=
"clickHandler(item.goods_id)"
/>
/>
<view
<view
style=
"
style=
"
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: space-between;
justify-content: space-between;
width: 4
6
0rpx;
width: 4
4
0rpx;
height: 150rpx;
height: 150rpx;
margin-left: 20rpx;
margin-left: 20rpx;
"
"
...
@@ -112,7 +117,7 @@
...
@@ -112,7 +117,7 @@
<Text
<Text
style=
"
style=
"
font-size: 28rpx;
font-size: 28rpx;
width: 4
6
0rpx;
width: 4
4
0rpx;
overflow: hidden;
overflow: hidden;
white-space: nowrap;
white-space: nowrap;
text-overflow: ellipsis;
text-overflow: ellipsis;
...
@@ -121,7 +126,7 @@
...
@@ -121,7 +126,7 @@
>
>
<view
<view
style=
"
style=
"
width: 4
6
0rpx;
width: 4
4
0rpx;
overflow: hidden;
overflow: hidden;
white-space: nowrap;
white-space: nowrap;
text-overflow: ellipsis;
text-overflow: ellipsis;
...
@@ -149,35 +154,15 @@
...
@@ -149,35 +154,15 @@
<Text
style=
"font-size: 30rpx;"
:style=
"
{ color: mc }"
<Text
style=
"font-size: 30rpx;"
:style=
"
{ color: mc }"
>¥
<Text
style=
"40rpx"
>
{{
item
.
attrs
.
price
}}
</Text></Text
>¥
<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>
-->
<u-number-box
<view
class=
"item_input"
>
v-model=
"item.num"
<view
:min=
"1"
class=
"item_input_l"
:max=
"item.goods.goods_stock"
:style=
"
{
@
change=
"valChange(i,index, item.num,item.attrs.price,$event)"
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
></u-number-box>
}"
@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>
</view>
</view>
<Text
v-if=
"item.new_status != 0 && editType == false"
style=
'font-size: 20rpx;color:#a0a09d ;'
>
失效原因:商品下架或者库存不足
</Text>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -334,7 +319,7 @@ export default {
...
@@ -334,7 +319,7 @@ export default {
clickcheckbox
(
checked
,
price
,
index
,
i
)
{
clickcheckbox
(
checked
,
price
,
index
,
i
)
{
if
(
checked
==
true
)
{
if
(
checked
==
true
)
{
this
.
checkCount
+=
1
;
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
;
//判断该商场是否全选
let
goods_list_all
=
true
;
//判断该商场是否全选
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
this
.
editType
==
false
)
{
if
(
this
.
editType
==
false
)
{
...
@@ -368,7 +353,7 @@ export default {
...
@@ -368,7 +353,7 @@ export default {
this
.
cart_id_list
.
push
(
obj
);
this
.
cart_id_list
.
push
(
obj
);
}
}
}
else
{
}
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
.
checkCount
-=
1
;
this
.
allchecked
=
false
;
this
.
allchecked
=
false
;
let
goods_list_all
=
true
;
//判断该商场是否全选
let
goods_list_all
=
true
;
//判断该商场是否全选
...
@@ -388,6 +373,7 @@ export default {
...
@@ -388,6 +373,7 @@ export default {
});
});
}
}
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
},
mch_SelectAll
(
checked
,
i
)
{
mch_SelectAll
(
checked
,
i
)
{
if
(
checked
==
true
)
{
if
(
checked
==
true
)
{
...
@@ -395,9 +381,12 @@ export default {
...
@@ -395,9 +381,12 @@ export default {
let
new_statusnum
=
0
;
let
new_statusnum
=
0
;
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
x
.
new_status
==
0
)
{
if
(
x
.
new_status
==
0
)
{
this
.
TotalPrice
+=
x
.
attrs
.
price
*
x
.
num
;
if
(
x
.
checked
==
false
){
x
.
checked
=
true
;
this
.
TotalPrice
+=
parseFloat
((
x
.
attrs
.
price
*
x
.
num
).
toFixed
(
2
));
new_statusnum
++
;
x
.
checked
=
true
;
new_statusnum
++
;
}
}
}
//编辑时候的商城全选
//编辑时候的商城全选
...
@@ -437,7 +426,7 @@ export default {
...
@@ -437,7 +426,7 @@ export default {
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
this
.
list
[
i
].
goods_list
.
forEach
((
x
)
=>
{
if
(
x
.
new_status
==
0
)
{
if
(
x
.
new_status
==
0
)
{
x
.
checked
=
false
;
x
.
checked
=
false
;
this
.
TotalPrice
-=
x
.
attrs
.
price
*
x
.
num
;
this
.
TotalPrice
-=
parseFloat
((
x
.
attrs
.
price
*
x
.
num
).
toFixed
(
2
))
;
new_statusnum
++
;
new_statusnum
++
;
}
}
...
@@ -451,6 +440,7 @@ export default {
...
@@ -451,6 +440,7 @@ export default {
this
.
allchecked
=
false
;
this
.
allchecked
=
false
;
this
.
checkCount
-=
new_statusnum
;
this
.
checkCount
-=
new_statusnum
;
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
},
SelectAll
()
{
SelectAll
()
{
let
list
=
this
.
list
;
let
list
=
this
.
list
;
...
@@ -464,7 +454,7 @@ export default {
...
@@ -464,7 +454,7 @@ export default {
if
(
j
.
new_status
==
0
)
{
if
(
j
.
new_status
==
0
)
{
j
.
checked
=
true
;
j
.
checked
=
true
;
this
.
checkCount
++
;
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 {
...
@@ -487,43 +477,28 @@ export default {
});
});
});
});
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
},
},
inputblur
(
i
,
index
,
num
,
price
,
e
)
{
valChange
(
i
,
index
,
num
,
p
,
e
){
let
value
=
Number
(
e
.
target
.
value
);
if
(
value
==
0
)
{
let
value
=
parseFloat
(
e
.
value
);
this
.
list
[
i
].
goods_list
[
index
].
num
=
1
;
let
price
=
parseFloat
(
p
);
this
.
TotalPrice
+=
price
*
1
;
// console.log(i, index, num, price, value)
}
if
(
num
>
value
){
},
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
onKeyInput
(
i
,
index
,
num
,
price
,
e
)
{
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
){
//输入的数量
this
.
TotalPrice
-=
parseFloat
((
price
*
(
num
-
value
)).
toFixed
(
2
))
;
let
value
=
Number
(
e
.
target
.
value
);
}
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
}
else
if
(
value
>
num
){
this
.
list
[
i
].
goods_list
[
index
].
num
=
value
;
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
)
{
if
(
this
.
list
[
i
].
goods_list
[
index
].
checked
==
true
){
if
(
value
>
num
)
{
this
.
TotalPrice
+=
parseFloat
((
price
*
(
value
-
num
)).
toFixed
(
2
))
;
this
.
TotalPrice
+=
price
*
(
value
-
num
);
}
else
if
(
value
<
num
)
{
}
this
.
TotalPrice
-=
price
*
(
num
-
value
);
}
}
this
.
TotalPrice
=
parseFloat
((
this
.
TotalPrice
).
toFixed
(
2
)
)
}
},
},
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
;
}
},
edit
()
{
edit
()
{
this
.
editType
=
!
this
.
editType
;
this
.
editType
=
!
this
.
editType
;
this
.
allchecked
=
false
;
this
.
allchecked
=
false
;
...
@@ -623,6 +598,11 @@ export default {
...
@@ -623,6 +598,11 @@ export default {
});
});
}
}
},
},
clickHandler
(
id
)
{
uni
.
navigateTo
({
url
:
'/pages/goods/goods?id='
+
id
,
});
},
},
},
};
};
</
script
>
</
script
>
...
@@ -659,7 +639,7 @@ export default {
...
@@ -659,7 +639,7 @@ export default {
.cartStyle
.cartList
.cartList_item
{
.cartStyle
.cartList
.cartList_item
{
width
:
100%
;
width
:
100%
;
padding
:
40
rpx
3
0
rpx
;
padding
:
30
rpx
30
rpx
30
rpx
1
0
rpx
;
display
:
flex
;
display
:
flex
;
flex-direction
:
row
;
flex-direction
:
row
;
align-items
:
center
;
align-items
:
center
;
...
@@ -719,4 +699,12 @@ export default {
...
@@ -719,4 +699,12 @@ export default {
.cartStyle
.Deletestyle
{
.cartStyle
.Deletestyle
{
margin-right
:
40
rpx
;
margin-right
:
40
rpx
;
}
}
.cartStyle
.invalid
{
text-align
:
center
;
width
:
40px
;
height
:
20px
;
line-height
:
20px
;
border-radius
:
10px
;
}
</
style
>
</
style
>
pages/user-center/user-center.vue
View file @
c32f9ecf
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
</view>
</view>
</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"
>
<view
class=
"account_bar_item"
v-if=
"meueData.user_center.account_bar.integral.status==1"
>
<Text
:style=
"
{'color':secondary}">
{{
user_info
.
integral
}}
</Text>
<Text
:style=
"
{'color':secondary}">
{{
user_info
.
integral
}}
</Text>
<view
class=
"footprint_item_bottom"
>
<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