Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-miniapp-eshop
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
李奇
2018-06-22 18:16:05 +0800
Commit
3d9b09a06ec71c6b56fa9bc98164bcfdfc82b517
1 parent
32eccdac
购物车引入
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
3 deletions
app/models/cart/cart.js
app/pages/cart/cart.js
app/pages/cart/cart.wxml
app/pages/cart/cart.wxss
app/static/images/empty_cart.png
app/models/cart/cart.js
0 → 100644
View file @
3d9b09a
import
api
from
'../../common/api'
;
export
default
{
/**
* 购物车数据
* @param params
* @returns {*}
*/
getCartData
(
params
)
{
return
api
.
get
({
url
:
''
,
data
:
Object
.
assign
({
method
:
'app.Shopping.queryCart'
},
params
)
});
}
};
...
...
app/pages/cart/cart.js
View file @
3d9b09a
import
cartModel
from
'../../models/cart/cart'
;
const
app
=
getApp
();
const
router
=
global
.
router
;
Page
({
data
:
{
},
onLoad
()
{
},
onShow
()
{
this
.
getCartData
();
},
goShopping
()
{
router
.
go
(
'home'
);
},
getCartData
()
{
cartModel
.
getCartData
({
uid
:
app
.
getUid
()})
.
then
(
res
=>
{
if
(
res
.
code
===
200
&&
res
.
data
)
{
this
.
_resolveCartData
(
res
.
data
);
}
else
{
return
Promise
.
reject
();
}
})
.
catch
(()
=>
{});
},
_resolveCartData
()
{
}
});
...
...
app/pages/cart/cart.wxml
View file @
3d9b09a
<view class="container">
<view>hello from the shopping cart!</view>
</view>
<block wx:if="{{curShoppingCartData.has_product_in_shop_cart}}">
我是购物车内容
</block>
<block wx:else>
<view class='empty-cart'>
<image src='../../static/images/empty_cart.png' class='empty-img'></image>
<text class='empty-desc'>购物车空空如也\n去挑选中意的商品</text>
<view class='shopping-btn' bindtap='goShopping'>去逛逛</view>
</view>
</block>
\ No newline at end of file
...
...
app/pages/cart/cart.wxss
View file @
3d9b09a
.empty-cart .empty-img {
display: block;
width: 204rpx;
height: 200rpx;
margin: 300rpx auto 0 auto;
}
.empty-cart .empty-desc {
display: block;
width: 400rpx;
margin: 60rpx auto 0 auto;
color: #444;
font-size: 26rpx;
line-height: 1.4;
text-align: center;
}
.empty-cart .shopping-btn {
width: 360rpx;
padding: 30rpx;
margin: 60rpx auto 0 auto;
color: #fff;
font-size: 28rpx;
text-align: center;
border-radius: 4rpx;
background-color: #444;
}
...
...
app/static/images/empty_cart.png
0 → 100755
View file @
3d9b09a
2.71 KB
Please
register
or
login
to post a comment