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
14c25d3b
Commit
14c25d3b
authored
May 19, 2020
by
罗超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/viitto/mallapp
parents
f2954b96
2190ac56
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
572 additions
and
26 deletions
+572
-26
pages.json
pages.json
+17
-7
cart.vue
pages/cart/cart.vue
+404
-0
index.vue
pages/cart/index.vue
+0
-9
index.vue
pages/ucenter/index.vue
+0
-9
user-center.vue
pages/user-center/user-center.vue
+150
-0
api.js
plugin/api.js
+1
-1
Shopping.png
static/images/icon/Shopping.png
+0
-0
No files found.
pages.json
View file @
14c25d3b
...
...
@@ -2,15 +2,25 @@
"easycom"
:
{
"^u-(.*)"
:
"uview-ui/components/u-$1/u-$1.vue"
},
"pages"
:
[{
"pages"
:
[
{
"path"
:
"pages/index/index"
},
{
"path"
:
"pages/user-center/user-center"
},
{
"path"
:
"pages/cart/cart"
},
{
"path"
:
"pages/cats/cats"
},
{
"path"
:
"pages/goods/goods"
},
{
"path"
:
"pages/cats/cats"
},
{
"path"
:
"pages/index/index"
},
{
"path"
:
"pages/webbox/webbox"
},
...
...
pages/cart/cart.vue
0 → 100644
View file @
14c25d3b
<
template
>
<div
class=
'cartStyle'
v-if=
"!isloading"
>
<view
style=
"display: flex;flex-direction: row;align-items: center;justify-content: space-between;padding: 0 15rpx;"
>
<Text
class=
'grid-text'
>
商品库存有限,请尽快下单
</Text>
<Text
@
click=
'edit'
v-if=
'editType==false'
class=
'grid-text_r'
>
编辑
</Text>
<Text
@
click=
'edit'
v-if=
'editType==true'
class=
'grid-text_r'
>
完成
</Text>
</view>
<view
style=
"width: 100%;height: 30rpx;background: #F7F7F7;margin: 20rpx 0;"
></view>
<view
v-if=
"list.length==0"
style=
"width: 100%;height: 400rpx;display: flex;flex-direction: column;justify-content: center;align-items: center;"
>
<view
style=
"width: 180rpx;height: 180rpx;border-radius: 50%;background: #DFDFE9;display: flex;align-items: center;justify-content: center;"
>
<image
src=
'../../static/images/icon/Shopping.png'
style=
'width:60rpx ;height: 60rpx;'
></image>
</view>
<Text
style=
'margin-top: 20rpx;color: #939393;'
>
购物车还是空的哦
</Text>
</view>
<view
style=
"padding: 25rpx;border-bottom: 1rpx solid #E4E4E4;"
v-if=
"list.length>0"
>
<u-checkbox-group
@
change=
'SelectAll'
>
<u-checkbox
v-model=
"allchecked"
shape=
"circle"
active-color=
"red"
>
赞羊严选
</u-checkbox>
</u-checkbox-group>
</view>
<view
class=
"cartList"
:style=
"
{'margin-bottom':listbottom}"
v-if="list.length>0"
>
<view
class=
"cartList_item"
v-for=
"(item, index) in list"
:key=
"index"
:name=
"item.name"
>
<u-checkbox-group
@
change=
'clickcheckbox(item.checked,item.goods.price,index)'
>
<u-checkbox
v-model=
"item.checked"
shape=
"circle"
active-color=
"red"
></u-checkbox>
</u-checkbox-group>
<image
:src=
"item.attrs.pic_url ? item.attrs.pic_url:item.goods.cover_pic"
mode=
"aspectFit"
style=
"width: 150rpx; height: 150rpx;margin-left: 30rpx;"
/>
<view
style=
"display: flex;flex-direction: column;justify-content: space-between;width: 460rpx;height: 150rpx;margin-left: 20rpx;"
>
<Text
style=
'font-size: 28rpx;width: 460rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;'
>
{{
item
.
goods
.
name
}}
</Text>
<view
style=
'width: 460rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;'
>
<view
v-for=
"(attr, inde2x) in item.attrs.attr"
:key=
"index2"
>
<Text
style=
'color: #A0A09D;font-size: 24rpx;margin-right: 5rpx;'
>
{{
attr
.
attr_group_name
}}
:
{{
attr
.
attr_name
}}
</Text>
</view>
</view>
<view
style=
"display: flex;flex-direction: row;align-items: center;justify-content: space-between;"
>
<Text
style=
'color: #E35943;font-size:30rpx ;'
>
¥
<Text
style=
'40rpx'
>
{{
item
.
goods
.
price
}}
</Text></Text>
<view
class=
"item_input"
>
<view
class=
"item_input_l"
:style=
"
{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(index,item.goods.price)">-
</view>
<input
type=
"number"
class=
"item_input_c"
:value=
"item.num"
>
<view
class=
"item_input_r"
style=
"color: #9B9B9B;"
@
click=
"plus(index,item.goods.price)"
>
+
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"box_bottom"
:style=
"
{'margin-bottom':bottommargin}"
>
<div
style=
'margin-left: 30rpx;'
>
<u-checkbox-group
@
change=
'SelectAll'
>
<u-checkbox
v-model=
"allchecked"
shape=
"circle"
active-color=
"red"
>
全选
</u-checkbox>
</u-checkbox-group>
<Text
style=
'color: #ff4544;font-size:30rpx ;'
v-if=
'editType==false'
>
¥
{{
TotalPrice
}}
</Text>
</div>
<div
class=
'bottom_btn'
:style=
"
{'background':TotalPrice>0 ? '#ff4544':'#989898'}"
v-if='editType==false'
@click='settlement'
>
<Text
style=
'font-size: 28rpx;color: white;'
>
去结算
</Text>
</div>
<u-button
v-if=
'editType==true&& cart_id_list.length ==0'
shape=
"circle"
size=
"medium"
class=
'Deletestyle'
>
删除
</u-button>
<u-button
v-if=
'editType==true&& cart_id_list.length >0'
shape=
"circle"
size=
"medium"
class=
'Deletestyle'
@
click=
'Delete'
type=
"error"
>
删除
</u-button>
</view>
<tabbars></tabbars>
</div>
</
template
>
<
script
>
import
tabbars
from
"@/components/tabbar/index"
;
export
default
{
data
(){
return
{
isloading
:
true
,
pageTitle
:
"购物车"
,
navHeight
:
0
,
contentHeight
:
0
,
cstyle
:{},
allchecked
:
false
,
TotalPrice
:
0
,
//总价格
bottommargin
:
0
,
listbottom
:
0
,
editType
:
false
,
list
:[],
cart_id_list
:[],
}
},
created
(){
},
components
:{
tabbars
,
},
onLoad
()
{
this
.
navHeight
=
this
.
$navHeight
-
2
;
this
.
cstyle
=
uni
.
getStorageSync
(
"basedata"
)
?
uni
.
getStorageSync
(
"basedata"
).
cat_style
:
[];
if
(
this
.
cstyle
.
cat_style
==
"4"
)
{
// this.searchStyle.p = {
// position: "fixed",
// top: this.navHeight,
// width: "100%",
// left: "0",
// };
}
},
mounted
()
{
let
currentPages
=
getCurrentPages
();
let
c
=
this
.
$uiConfig
.
is_bang
?
80
:
52
;
this
.
bottommargin
=
(
c
-
2
)
+
'px'
;
this
.
listbottom
=
(
c
-
2
+
50
)
+
'px'
;
this
.
contentHeight
=
this
.
$utils
.
calcContentHeight
(
c
);
let
u
=
"/"
+
currentPages
[
currentPages
.
length
-
1
].
route
;
let
pages
=
wx
.
getStorageSync
(
"basedata"
)
?
wx
.
getStorageSync
(
"basedata"
).
bar_title
:
[];
pages
.
forEach
((
x
)
=>
{
if
(
x
.
value
==
u
)
{
this
.
pageTitle
=
x
.
new_name
?
x
.
new_name
:
x
.
name
;
}
});
this
.
init
();
},
methods
:{
goHome
()
{
uni
.
redirectTo
({
url
:
"/pages/index/main"
});
},
init
()
{
uni
.
showNavigationBarLoading
();
this
.
request
(
{
url
:
""
,
header
:{
'X-Access-Token'
:
'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
JSON
.
stringify
([]),
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
21269
},
data
:
{
r
:
"api/cart/list"
,
},
},
(
res
)
=>
{
uni
.
hideNavigationBarLoading
()
this
.
isloading
=
false
;
if
(
res
.
data
.
list
.
length
>
0
){
let
goods_list
=
res
.
data
.
list
[
0
].
goods_list
;
goods_list
.
forEach
((
x
)
=>
{
x
.
checked
=
false
});
this
.
list
=
goods_list
;
console
.
log
(
this
.
list
)
}
else
{
this
.
list
=
[]
}
}
);
},
clickcheckbox
(
checked
,
price
,
index
){
if
(
checked
==
true
){
this
.
TotalPrice
+=
price
*
this
.
list
[
index
].
num
;
let
all
=
true
;
this
.
list
.
forEach
((
x
)
=>
{
if
(
x
.
checked
==
false
){
all
=
false
}
})
if
(
all
==
true
){
this
.
allchecked
=
true
}
if
(
this
.
editType
==
true
){
let
obj
=
{
'mch_id'
:
0
,
'id'
:
this
.
list
[
index
].
id
}
this
.
cart_id_list
.
push
(
obj
)
}
}
else
{
this
.
TotalPrice
-=
price
*
this
.
list
[
index
].
num
this
.
allchecked
=
false
;
if
(
this
.
editType
==
true
){
this
.
cart_id_list
.
forEach
((
x
)
=>
{
if
(
x
.
id
==
this
.
list
[
index
].
id
){
this
.
cart_id_list
.
splice
(
x
,
1
)
}
})
}
}
},
SelectAll
(){
if
(
this
.
allchecked
==
true
){
this
.
TotalPrice
=
0
;
this
.
cart_id_list
=
[];
this
.
list
.
forEach
((
x
)
=>
{
x
.
checked
=
true
;
this
.
TotalPrice
+=
x
.
goods
.
price
*
x
.
num
;
if
(
this
.
editType
==
true
){
this
.
cart_id_list
.
push
({
'mch_id'
:
0
,
'id'
:
x
.
id
})
}
})
}
else
{
this
.
list
.
forEach
((
x
)
=>
{
x
.
checked
=
false
;
this
.
TotalPrice
=
0
;
if
(
this
.
editType
==
true
){
this
.
cart_id_list
=
[]
}
})
}
},
reduce
(
index
,
price
){
//减
if
(
this
.
list
[
index
].
num
>
1
){
this
.
list
[
index
].
num
=
this
.
list
[
index
].
num
-
1
;
if
(
this
.
list
[
index
].
checked
==
true
){
this
.
TotalPrice
-=
price
*
1
}
}
},
plus
(
index
,
price
){
//加
this
.
list
[
index
].
num
=
this
.
list
[
index
].
num
+
1
;
if
(
this
.
list
[
index
].
checked
==
true
){
this
.
TotalPrice
+=
price
*
1
}
},
edit
(){
this
.
editType
=!
this
.
editType
;
this
.
allchecked
=
false
;
this
.
TotalPrice
=
0
this
.
list
.
forEach
((
x
)
=>
{
x
.
checked
=
false
})
},
Delete
(){
uni
.
showNavigationBarLoading
();
this
.
request
(
{
url
:
""
,
method
:
"POST"
,
header
:{
'content-type'
:
'application/x-www-form-urlencoded'
,
'X-Access-Token'
:
'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
JSON
.
stringify
([{
"value"
:
"873015dc76a242cc8c7ae1c25cdbdf4c"
,
"type"
:
0
,
"remains"
:
1
,
"expires_at"
:
"2020-05-25 19:03:25"
}]),
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
21269
,
},
data
:
{
r
:
"api/cart/delete"
,
cart_id_list
:
JSON
.
stringify
(
this
.
cart_id_list
)
,
},
},
(
res
)
=>
{
this
.
init
()
this
.
TotalPrice
=
0
this
.
editType
=
false
;
this
.
allchecked
=
false
;
uni
.
hideNavigationBarLoading
()
}
);
},
settlement
(){
}
}
}
</
script
>
<
style
>
.cartStyle
{
height
:
100%
;
position
:
relative
;
}
.cartStyle
.grid-text
{
font-size
:
24
rpx
;
margin-top
:
4
rpx
;
color
:
#939393
;
}
.cartStyle
.grid-text_r
{
margin-top
:
4
rpx
;
margin-right
:
10
rpx
;
}
.cartStyle
.cartList
{
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
overflow-y
:
hidden
;
}
.cartStyle
.cartList
.cartList_item
{
width
:
100%
;
padding
:
40
rpx
30
rpx
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
border-bottom
:
1
rpx
solid
#E4E4E4
;
}
.cartList
.cartList_item
.item_input
{
width
:
200
rpx
;
height
:
60
rpx
;
background
:
#F7F7F7
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
}
.cartList
.item_input
.item_input_l
,
.item_input_r
{
width
:
50
rpx
;
height
:
60
rpx
;
font-size
:
28
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.cartStyle
.item_input
.item_input_c
{
text-align
:
center
;
width
:
50
rpx
;
height
:
60
rpx
;
}
.cartStyle
.box_bottom
{
width
:
100%
;
height
:
50px
;
position
:
fixed
;
background
:
#FFF
;
left
:
0
;
bottom
:
0
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
space-between
;
border-top
:
1
rpx
solid
#E4E4E4
;
z-index
:
999
;
}
.cartStyle
.bottom_btn
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
width
:
250
rpx
;
height
:
50px
;
}
.cartStyle
.Deletestyle
{
margin-right
:
40
rpx
;
}
</
style
>
pages/cart/index.vue
deleted
100644 → 0
View file @
f2954b96
<
template
>
<view>
购物车
</view>
</
template
>
<
script
>
</
script
>
<
style
>
</
style
>
pages/ucenter/index.vue
deleted
100644 → 0
View file @
f2954b96
<
template
>
<view>
个人中心
</view>
</
template
>
<
script
>
</
script
>
<
style
>
</
style
>
pages/user-center/user-center.vue
0 → 100644
View file @
14c25d3b
<
template
>
<view
class=
"userStyle"
v-if=
"!isloading"
>
<view
class=
"userBox"
></view>
<image
:src=
'meueData.user_center.style_bg_pic_url'
class=
"imgbg"
>
<!--
<image
:src=
'user_info.avatar'
class=
"headimg"
></image>
-->
<!--
<view
style=
"width: 140rpx;height: 140rpx;background: #007AFF;"
></view>
-->
</image>
<tabbars></tabbars>
</view>
</
template
>
<
script
>
import
tabbars
from
"@/components/tabbar/index"
;
export
default
{
data
(){
return
{
isloading
:
true
,
pageTitle
:
"用户中心"
,
navHeight
:
0
,
contentHeight
:
0
,
cstyle
:{},
meueData
:{},
//菜单
user_info
:{},
//个人信息
bottommargin
:
0
,
listbottom
:
0
,
}
},
components
:{
tabbars
},
onLoad
()
{
this
.
navHeight
=
this
.
$navHeight
-
2
;
this
.
cstyle
=
uni
.
getStorageSync
(
"basedata"
)
?
uni
.
getStorageSync
(
"basedata"
).
cat_style
:
[];
if
(
this
.
cstyle
.
cat_style
==
"4"
)
{
}
},
mounted
(){
let
currentPages
=
getCurrentPages
();
let
c
=
this
.
$uiConfig
.
is_bang
?
80
:
52
;
this
.
bottommargin
=
(
c
-
2
)
+
'px'
;
this
.
listbottom
=
(
c
-
2
+
50
)
+
'px'
;
this
.
contentHeight
=
this
.
$utils
.
calcContentHeight
(
c
);
let
u
=
"/"
+
currentPages
[
currentPages
.
length
-
1
].
route
;
let
pages
=
wx
.
getStorageSync
(
"basedata"
)
?
wx
.
getStorageSync
(
"basedata"
).
bar_title
:
[];
console
.
log
(
wx
.
getStorageSync
(
"basedata"
))
console
.
log
(
u
)
pages
.
forEach
((
x
)
=>
{
if
(
x
.
value
==
u
)
{
this
.
pageTitle
=
x
.
new_name
?
x
.
new_name
:
x
.
name
;
}
});
this
.
userinfo
()
this
.
getmeue
()
},
methods
:{
goHome
()
{
uni
.
redirectTo
({
url
:
"/pages/index/main"
});
},
userinfo
()
{
uni
.
showNavigationBarLoading
();
this
.
request
(
{
url
:
""
,
header
:{
'X-Access-Token'
:
'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
JSON
.
stringify
([]),
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
21269
},
data
:
{
r
:
"api/user/user-info"
,
},
},
(
res
)
=>
{
uni
.
hideNavigationBarLoading
()
this
.
isloading
=
false
;
console
.
log
(
res
)
}
);
},
getmeue
(){
uni
.
showNavigationBarLoading
();
this
.
request
(
{
url
:
""
,
header
:{
'X-Access-Token'
:
'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ'
,
'X-App-Platform'
:
'wxapp'
,
'X-App-Version'
:
'4.2.47'
,
'X-Form-Id-List'
:
JSON
.
stringify
([]),
'X-Requested-With'
:
'XMLHttpRequest'
,
'X-User-Id'
:
21269
},
data
:
{
r
:
"api/user/config"
,
},
},
(
res
)
=>
{
uni
.
hideNavigationBarLoading
()
this
.
isloading
=
false
;
console
.
log
(
res
.
data
)
this
.
meueData
=
res
.
data
.
config
;
this
.
user_info
=
res
.
data
.
user_info
;
}
);
}
}
}
</
script
>
<
style
>
.userStyle
.userBox
{
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.userStyle
.imgbg
{
width
:
100%
;
height
:
330
rpx
;
position
:
relative
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
}
.userStyle
.headimg
{
width
:
140
rpx
;
height
:
140
rpx
;
border-radius
:
50%
;
margin-left
:
60
rpx
;
}
</
style
>
plugin/api.js
View file @
14c25d3b
...
...
@@ -5,7 +5,7 @@ export default {
Vue
.
prototype
.
request
=
function
(
param
,
success
,
failed
)
{
//网络请求
uni
.
request
({
url
:
this
.
host
+
param
.
url
,
url
:
this
.
host
+
"&r="
+
param
.
data
.
r
,
method
:
param
.
method
||
"GET"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
...
...
static/images/icon/Shopping.png
0 → 100644
View file @
14c25d3b
1.94 KB
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