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
286c0ae7
Commit
286c0ae7
authored
Nov 16, 2018
by
Junling Bu
Browse files
chore[renard-wx]: 基于微信开发者工具的格式化代码
parent
20b97ec8
Changes
94
Hide whitespace changes
Inline
Side-by-side
renard-wx/pages/groupon/myGroupon/myGroupon.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"我的团购"
,
"usingComponents"
:
{
"zan-capsule"
:
"/components/capsule/index"
}
"navigationBarTitleText"
:
"我的团购"
,
"usingComponents"
:
{
"zan-capsule"
:
"/components/capsule/index"
}
}
\ No newline at end of file
renard-wx/pages/groupon/myGroupon/myGroupon.wxml
View file @
286c0ae7
<view class="container">
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
</view>
<view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view>
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view>
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text>
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view>
<view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view>
</navigator>
</view>
</view>
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view>
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view>
</view>
</navigator>
</view>
</view>
\ No newline at end of file
renard-wx/pages/groupon/myGroupon/myGroupon.wxss
View file @
286c0ae7
page {
height: 100%;
width: 100%;
background: #f4f4f4;
height: 100%;
width: 100%;
background: #f4f4f4;
}
.capsule-tag {
float: right;
/* padding-right: 10rpx; */
float: right;
/* padding-right: 10rpx; */
}
.zan-capsule + .zan-capsule {
margin-left: 5px;
margin-left: 5px;
}
.orders-switch {
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid #a78845;
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid #a78845;
}
.orders-switch .item {
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
}
.orders-switch .item .txt {
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 100%;
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 100%;
}
.orders-switch .item.active .txt {
color: #a78845;
border-bottom: 4rpx solid #a78845;
color: #a78845;
border-bottom: 4rpx solid #a78845;
}
.no-order {
width: 100%;
height: auto;
margin: 0 auto;
width: 100%;
height: auto;
margin: 0 auto;
}
.no-order .c {
width: 100%;
height: auto;
margin-top: 200rpx;
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-order .c image {
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-order .c text {
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.orders {
height: auto;
width: 100%;
overflow: hidden;
height: auto;
width: 100%;
overflow: hidden;
}
.order {
margin-top: 20rpx;
background: #fff;
margin-top: 20rpx;
background: #fff;
}
.order .h {
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .h .l {
float: left;
color: #a78845;
font-size: 26rpx;
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .h .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .i {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .i .l {
float: left;
color: #a78845;
font-size: 26rpx;
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .i .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .j {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
}
.order .j .l {
float: left;
font-size: 26rpx;
color: #a78845;
float: left;
font-size: 26rpx;
color: #a78845;
}
.order .j .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .goods {
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
}
.order .goods .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.order .goods .img image {
height: 145.83rpx;
width: 145.83rpx;
height: 145.83rpx;
width: 145.83rpx;
}
.order .goods .info {
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
}
.order .goods .name {
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
}
.order .goods .number {
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
}
.order .goods .status {
width: 105rpx;
color: #a78845;
font-size: 25rpx;
width: 105rpx;
color: #a78845;
font-size: 25rpx;
}
.order .b {
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
}
.order .b .l {
float: left;
float: left;
}
.order .b .r {
float: right;
float: right;
}
.order .b .btn {
margin-top: 19rpx;
height: 64.5rpx;
line-height: 64.5rpx;
text-align: center;
padding: 0 20rpx;
border-radius: 5rpx;
font-size: 28rpx;
color: #fff;
background: #a78845;
margin-top: 19rpx;
height: 64.5rpx;
line-height: 64.5rpx;
text-align: center;
padding: 0 20rpx;
border-radius: 5rpx;
font-size: 28rpx;
color: #fff;
background: #a78845;
}
renard-wx/pages/hotGoods/hotGoods.js
View file @
286c0ae7
...
...
@@ -3,129 +3,129 @@ var api = require('../../config/api.js');
var
app
=
getApp
();
Page
({
data
:
{
bannerInfo
:
{
'
imgUrl
'
:
''
,
'
name
'
:
''
data
:
{
bannerInfo
:
{
'
imgUrl
'
:
''
,
'
name
'
:
''
},
categoryFilter
:
false
,
filterCategory
:
[],
goodsList
:
[],
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
size
:
100
},
categoryFilter
:
false
,
filterCategory
:
[],
goodsList
:
[],
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
size
:
100
},
getBanner
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsHot
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
bannerInfo
:
res
.
data
.
bannerInfo
,
getBanner
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsHot
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
bannerInfo
:
res
.
data
.
bannerInfo
,
});
}
});
}
});
},
getCategoryList
:
function
()
{
var
that
=
this
;
},
getCategoryList
:
function
()
{
var
that
=
this
;
util
.
request
(
api
.
GoodsFilter
,
{
isHot
:
1
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
filterCategory
:
res
.
data
.
filterCategoryList
,
});
}
});
},
getGoodsList
:
function
()
{
var
that
=
this
;
util
.
request
(
api
.
GoodsFilter
,
{
isHot
:
1
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
filterCategory
:
res
.
data
.
filterCategoryList
,
});
}
});
},
getGoodsList
:
function
()
{
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
isHot
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
});
}
});
util
.
request
(
api
.
GoodsList
,
{
isHot
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
});
}
});
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
getBanner
();
this
.
getGoodsList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
getBanner
();
this
.
getGoodsList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
onUnload
:
function
()
{
// 页面关闭
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
});
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
});
this
.
getGoodsList
();
break
;
default
:
//综合排序
this
.
getGoodsList
();
break
;
default
:
//综合排序
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
,
});
this
.
getGoodsList
();
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
,
'
categoryFilter
'
:
false
,
'
categoryId
'
:
this
.
data
.
filterCategory
[
currentIndex
].
id
});
this
.
getGoodsList
();
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
this
.
setData
({
'
categoryFilter
'
:
false
,
'
categoryId
'
:
this
.
data
.
filterCategory
[
currentIndex
].
id
});
this
.
getGoodsList
();
}
})
\ No newline at end of file
renard-wx/pages/hotGoods/hotGoods.wxml
View file @
286c0ae7
...
...
@@ -12,7 +12,7 @@
</view>
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}"
bindtap="openSortFilter" id="defaultSort">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
...
...
renard-wx/pages/hotGoods/hotGoods.wxss
View file @
286c0ae7
page{
background: #f4f4f4;
page
{
background: #f4f4f4;
}
.brand-info .name{
width: 100%;
height: 278rpx;
position: relative;
.brand-info .name
{
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
.brand-info .img
{
position: absolute;
top:
0;
left:
0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.brand-info .info-box
{
position: absolute;
top:
0;
left:
0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.brand-info .info{
display: block;
.brand-info .info
{
display: block;
}
.brand-info .txt{
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
.brand-info .txt
{
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line{
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
.brand-info .line
{
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
}
.sort{
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
.sort
{
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box{
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
.sort-box
{
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item{
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:1;
color: #333;
font-size: 30rpx;
.sort-box .item
{
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:
1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt{
display: block;
width: 100%;
height: 100%;
color: #333;
.sort-box .item .txt
{
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt{
color: #b4282d;
.sort-box .item.active .txt
{
color: #b4282d;
}
.sort-box .item.by-price{
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price
{
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.asc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.asc
{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.desc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.desc
{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box-category{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
.sort-box-category
{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
.sort-box-category .item
{
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
}
.sort-box-category .item.active{
color: #b4282d;
border: 1px solid #b4282d;
.sort-box-category .item.active
{
color: #b4282d;
border: 1px solid #b4282d;
}
.cate-item .b{
.cate-item .b
{
width: 750rpx;
height: auto;
overflow: hidden;
...
...
@@ -134,7 +134,7 @@ page{
margin-top: 20rpx;
}
.cate-item .b .item{
.cate-item .b .item
{
float: left;
background: #fff;
width: 375rpx;
...
...
@@ -145,17 +145,17 @@ page{
text-align: center;
}
.cate-item .b .item-b{
border-right: 1rpx solid #f4f4f4;
.cate-item .b .item-b
{
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img{
margin-top: 10rpx;
.cate-item .item .img
{
margin-top: 10rpx;
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name{
.cate-item .item .name
{
display: block;
width: 365.625rpx;
height: 35rpx;
...
...
@@ -167,11 +167,11 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price
{
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
font-size: 30rpx;
color: #b4282d;
}
\ No newline at end of file
}
renard-wx/pages/index/index.js
View file @
286c0ae7
...
...
@@ -6,134 +6,134 @@ const user = require('../../utils/user.js');
const
app
=
getApp
();
Page
({
data
:
{
newGoods
:
[],
hotGoods
:
[],
topics
:
[],
brands
:
[],
groupons
:
[],
floorGoods
:
[],
// banner: [],
channel
:
[]
},
onShareAppMessage
:
function
()
{
return
{
title
:
'
Renard
'
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index
'
}
},
data
:
{
newGoods
:
[],
hotGoods
:
[],
topics
:
[],
brands
:
[],
groupons
:
[],
floorGoods
:
[],
// banner: [],
channel
:
[]
},
onShareAppMessage
:
function
()
{
return
{
title
:
'
Renard
'
,
desc
:
'
唯爱与美食不可辜负
'
,
path
:
'
/pages/index/index
'
}
},
saveFormId
:
function
(
v
)
{
if
(
v
.
detail
.
formId
!=
'
the formId is a mock one
'
)
{
util
.
request
(
api
.
UserFormIdCreate
,
{
formId
:
v
.
detail
.
formId
});
}
},
saveFormId
:
function
(
v
)
{
if
(
v
.
detail
.
formId
!=
'
the formId is a mock one
'
)
{
util
.
request
(
api
.
UserFormIdCreate
,
{
formId
:
v
.
detail
.
formId
});
}
},
onPullDownRefresh
()
{
this
.
getIndexData
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
onPullDownRefresh
()
{
this
.
getIndexData
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getIndexData
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
getIndexData
:
function
()
{
wx
.
showLoading
({
title
:
'
加载中
'
,
});
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
setTimeout
(
function
()
{
wx
.
hideLoading
()
},
2000
);
let
that
=
this
;
util
.
request
(
api
.
IndexUrl
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
newGoods
:
res
.
data
.
newGoodsList
,
hotGoods
:
res
.
data
.
hotGoodsList
,
topics
:
res
.
data
.
topicList
,
brands
:
res
.
data
.
brandList
,
floorGoods
:
res
.
data
.
floorGoodsList
,
// banner: res.data.banner,
groupons
:
res
.
data
.
grouponList
,
channel
:
res
.
data
.
channel
let
that
=
this
;
util
.
request
(
api
.
IndexUrl
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
newGoods
:
res
.
data
.
newGoodsList
,
hotGoods
:
res
.
data
.
hotGoodsList
,
topics
:
res
.
data
.
topicList
,
brands
:
res
.
data
.
brandList
,
floorGoods
:
res
.
data
.
floorGoodsList
,
// banner: res.data.banner,
groupons
:
res
.
data
.
grouponList
,
channel
:
res
.
data
.
channel
});
wx
.
hideLoading
();
}
});
wx
.
hideLoading
();
}
});
},
onLoad
:
function
(
options
)
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
windowWidth
:
res
.
windowWidth
,
windowHeight
:
res
.
windowHeight
},
onLoad
:
function
(
options
)
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
windowWidth
:
res
.
windowWidth
,
windowHeight
:
res
.
windowHeight
});
}
});
}
});
if
(
options
.
scene
)
{
var
scene
=
decodeURIComponent
(
options
.
scene
);
console
.
log
(
"
scene:
"
+
scene
);
if
(
options
.
scene
)
{
var
scene
=
decodeURIComponent
(
options
.
scene
);
console
.
log
(
"
scene:
"
+
scene
);
let
info_arr
=
[];
info_arr
=
scene
.
split
(
'
,
'
);
let
_type
=
info_arr
[
0
];
let
id
=
info_arr
[
1
];
let
info_arr
=
[];
info_arr
=
scene
.
split
(
'
,
'
);
let
_type
=
info_arr
[
0
];
let
id
=
info_arr
[
1
];
if
(
_type
==
'
goods
'
)
{
wx
.
navigateTo
({
url
:
'
../goods/goods?id=
'
+
id
});
}
else
if
(
_type
==
'
groupon
'
)
{
wx
.
navigateTo
({
url
:
'
../goods/goods?grouponId=
'
+
id
});
}
else
{
wx
.
navigateTo
({
url
:
'
../index/index
'
});
}
}
if
(
_type
==
'
goods
'
)
{
wx
.
navigateTo
({
url
:
'
../goods/goods?id=
'
+
id
});
}
else
if
(
_type
==
'
groupon
'
)
{
wx
.
navigateTo
({
url
:
'
../goods/goods?grouponId=
'
+
id
});
}
else
{
wx
.
navigateTo
({
url
:
'
../index/index
'
});
}
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
grouponId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../goods/goods?grouponId=
'
+
options
.
grouponId
});
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
grouponId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../goods/goods?grouponId=
'
+
options
.
grouponId
});
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
goodId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../goods/goods?id=
'
+
options
.
goodId
});
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
goodId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../goods/goods?id=
'
+
options
.
goodId
});
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
orderId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../ucenter/orderDetail/orderDetail?id=
'
+
options
.
orderId
});
}
// 页面初始化 options为页面跳转所带来的参数
if
(
options
.
orderId
)
{
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx
.
navigateTo
({
url
:
'
../ucenter/orderDetail/orderDetail?id=
'
+
options
.
orderId
});
}
this
.
getIndexData
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
this
.
getIndexData
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
});
\ No newline at end of file
renard-wx/pages/index/index.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"首页"
,
"usingComponents"
:
{
"zan-capsule"
:
"/components/capsule/index"
,
"goodList"
:
"/components/goodList/goodList"
,
"van-notice-bar"
:
"/components/notice-bar/index"
}
"navigationBarTitleText"
:
"首页"
,
"usingComponents"
:
{
"zan-capsule"
:
"/components/capsule/index"
,
"goodList"
:
"/components/goodList/goodList"
,
"van-notice-bar"
:
"/components/notice-bar/index"
}
}
\ No newline at end of file
renard-wx/pages/index/index.wxml
View file @
286c0ae7
<view class="container">
<!-- 首页顶部通知消息 -->
<van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" />
<!-- 首页顶部通知消息 -->
<van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" />
<view class="HotName">今日推荐
<text></text>
</view>
<view class="HotMark">唯爱与美食不可辜负</view>
<view class="HotName">今日推荐
<text></text>
</view>
<view class="HotMark">唯爱与美食不可辜负</view>
<view class="HotSwiper" style="margin-top:{{windowHeight/45}}px">
<swiper circular="true" autoplay="true" interval="6000" duration="500" previous-margin="{{windowWidth/3.8}}rpx" next-margin="{{windowWidth/3.8}}rpx">
<block wx:for-items="{{hotGoods}}" wx:key="{{id}}">
<navigator url="/pages/goods/goods?id={{item.id}}">
<swiper-item>
<view class="swiper-box">
<form bindsubmit="saveFormId" report-submit='true' class='form_class'>
<button formType="submit" class='form_button'>
<image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" />
</button>
</form>
<view class="swiper-box-info">
<view class="name">{{item.name}}</view>
<view class="price">
<view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view>
<view class="retailPrice">现价:¥{{item.retailPrice}}</view>
</view>
<view class="capsule-tag" wx:if="{{item.isNew == true}}">
<zan-capsule color="#a78845" leftText="N" rightText="新 品" />
</view>
<view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}">
<zan-capsule color="#b4282d" leftText="H" rightText="折 扣" />
<view class="HotSwiper" style="margin-top:{{windowHeight/45}}px">
<swiper circular="true" autoplay="true" interval="6000" duration="500" previous-margin="{{windowWidth/3.8}}rpx" next-margin="{{windowWidth/3.8}}rpx">
<block wx:for-items="{{hotGoods}}" wx:key="{{id}}">
<navigator url="/pages/goods/goods?id={{item.id}}">
<swiper-item>
<view class="swiper-box">
<form bindsubmit="saveFormId" report-submit='true' class='form_class'>
<button formType="submit" class='form_button'>
<image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" />
</button>
</form>
<view class="swiper-box-info">
<view class="name">{{item.name}}</view>
<view class="price">
<view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view>
<view class="retailPrice">现价:¥{{item.retailPrice}}</view>
</view>
<view class="capsule-tag" wx:if="{{item.isNew == true}}">
<zan-capsule color="#a78845" leftText="N" rightText="新 品" />
</view>
<view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}">
<zan-capsule color="#b4282d" leftText="H" rightText="折 扣" />
</view>
</view>
</view>
</swiper-item>
</navigator>
</block>
</swiper>
</view>
<view class="a-section a-groupon" wx:if="{{groupons.length > 0}}">
<view class="h">
<view class="title">
<view>
<navigator url="/pages/groupon/grouponList/grouponList">
<text class="txt">优惠专区</text>
</navigator>
</view>
</view>
</view>
</swiper-item>
</navigator>
</block>
</swiper>
</view>
<view class="a-section a-groupon" wx:if="{{groupons.length > 0}}">
<view class="h">
<view class="title">
<view>
<navigator url="/pages/groupon/grouponList/grouponList">
<text class="txt">优惠专区</text>
</navigator>
</view>
</view>
</view>
<view class="b">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.goods.id}}">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<view class="header">
<text class="name">{{item.goods.name}}</text>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
</view>
</view>
<text class="desc">{{item.goods.brief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view>
<view class="retailPrice">团购价:¥{{item.groupon_price}}</view>
</view>
<view class="b">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.goods.id}}">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<view class="header">
<text class="name">{{item.goods.name}}</text>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
</view>
</view>
<text class="desc">{{item.goods.brief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view>
<view class="retailPrice">团购价:¥{{item.groupon_price}}</view>
</view>
</view>
</view>
</navigator>
</view>
</view>
</navigator>
</view>
</view>
</view>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h">
<view class="title">
<navigator url="../newGoods/newGoods">
<text class="txt">新品首发</text>
</navigator>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h">
<view class="title">
<navigator url="../newGoods/newGoods">
<text class="txt">新品首发</text>
</navigator>
</view>
</view>
<goodList goods="{{newGoods}}"></goodList>
</view>
<goodList goods="{{newGoods}}"></goodList>
</view>
<view class="a-section a-brand">
<view class="h">
<view class="title">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</view>
</view>
<view class="b">
<view class="item item-1" wx:for="{{brands}}" wx:key="id">
<navigator url="/pages/brandDetail/brandDetail?id={{item.id}}">
<view class="wrap">
<image class="img" src="{{item.picUrl}}" mode="aspectFill"></image>
<view class="mt">
<text class="brand">{{item.name}}</text>
<view class="a-section a-brand">
<view class="h">
<view class="title">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</view>
</view>
</navigator>
</view>
</view>
<view class="b">
<view class="item item-1" wx:for="{{brands}}" wx:key="id">
<navigator url="/pages/brandDetail/brandDetail?id={{item.id}}">
<view class="wrap">
<image class="img" src="{{item.picUrl}}" mode="aspectFill"></image>
<view class="mt">
<text class="brand">{{item.name}}</text>
</view>
</view>
</navigator>
</view>
</view>
</view>
</view>
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<navigator url="/pages/category/category?id={{item.id}}" class="more-a">
<view class="h" wx:if="{{item.goodsList.length > 0}}">
<text>{{item.name}}</text>
</view>
</navigator>
<goodList goods="{{item.goodsList}}"></goodList>
</view>
<view class="
a-section a-topic" wx:if="topics.length > 0
">
<
view
class="
h
">
<view class="
title
">
<
navigator url="/pages/topic/topic"
>
<text class="txt">专题精选</text
>
<view class="
good-grid" wx:for="{{floorGoods}}" wx:key="id
">
<
navigator url="/pages/category/category?id={{item.id}}"
class="
more-a
">
<view class="
h" wx:if="{{item.goodsList.length > 0}}
">
<
text>{{item.name}}</text
>
</view
>
</navigator>
</view
>
<goodList goods="{{item.goodsList}}"></goodList
>
</view>
<view class="b">
<scroll-view scroll-x class="list
">
<view class="
item" wx:for="{{topics}}" wx:for-index="index" wx:for-item="item" wx:key="id
">
<navigator url="../topicDetail/topicDetail?id={{item.id}}
">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image
>
<view class="np"
>
<text class="name">{{item.title}}</text
>
<view class="a-section a-topic" wx:if="topics.length > 0
">
<view class="
h
">
<view class="title
">
<navigator url="/pages/topic/topic"
>
<text class="txt">专题精选</text
>
</navigator
>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
<view class="b">
<scroll-view scroll-x class="list">
<view class="item" wx:for="{{topics}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="np">
<text class="name">{{item.title}}</text>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
\ No newline at end of file
renard-wx/pages/index/index.wxss
View file @
286c0ae7
.HotName {
font-size: 50rpx;
margin-left: 40rpx;
margin-top: 30rpx;
color: #293539;
font-weight: 300;
position: relative;
font-size: 50rpx;
margin-left: 40rpx;
margin-top: 30rpx;
color: #293539;
font-weight: 300;
position: relative;
}
.HotName text {
width: 14rpx;
height: 14rpx;
position: absolute;
border: 4rpx solid #a78845;
border-radius: 50%;
width: 14rpx;
height: 14rpx;
position: absolute;
border: 4rpx solid #a78845;
border-radius: 50%;
}
.HotMark {
margin-left: 50rpx;
color: #293539;
font-size: 36rpx;
margin-top: 10rpx;
text-align: center;
width: 350rpx;
border-bottom: 1rpx solid #a78845;
margin-left: 50rpx;
color: #293539;
font-size: 36rpx;
margin-top: 10rpx;
text-align: center;
width: 350rpx;
border-bottom: 1rpx solid #a78845;
}
.HotSwiper swiper {
width: 100%;
height: 800rpx;
width: 100%;
height: 800rpx;
}
.swiper-box {
width: 520rpx;
margin: 0 auto;
position: relative;
height: 700rpx;
box-shadow: 0px 10rpx 30rpx 0px #cfc9ca;
margin-top: 40rpx;
border-radius: 20rpx;
width: 520rpx;
margin: 0 auto;
position: relative;
height: 700rpx;
box-shadow: 0px 10rpx 30rpx 0px #cfc9ca;
margin-top: 40rpx;
border-radius: 20rpx;
}
.swiper-box image {
width: 100%;
height: 520rpx;
background-color: #f5f5f5;
border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx;
width: 100%;
height: 520rpx;
background-color: #f5f5f5;
border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx;
}
.swiper-box-info {
position: absolute;
width: 100%;
height: 100rpx;
top: 520rpx;
background-color: #fff;
border-bottom-right-radius: 10rpx;
border-bottom-left-radius: 10rpx;
position: absolute;
width: 100%;
height: 100rpx;
top: 520rpx;
background-color: #fff;
border-bottom-right-radius: 10rpx;
border-bottom-left-radius: 10rpx;
}
.swiper-box-info .name {
width: 90%;
margin: 0 auto;
margin-top: 20rpx;
font-size: 32rpx;
margin-left: 35rpx;
color: #293539;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 90%;
margin: 0 auto;
margin-top: 20rpx;
font-size: 32rpx;
margin-left: 35rpx;
color: #293539;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.swiper-box-info .price {
float: left;
width: 60%;
margin-top: 10rpx;
margin-left: 30rpx;
float: left;
width: 60%;
margin-top: 10rpx;
margin-left: 30rpx;
}
.swiper-box-info .counterPrice {
text-decoration: line-through;
font-size: 30rpx;
color: #999;
text-decoration: line-through;
font-size: 30rpx;
color: #999;
}
.swiper-box-info .retailPrice {
font-size: 30rpx;
color: #a78845;
font-size: 30rpx;
color: #a78845;
}
.capsule-tag {
float: right;
padding-right: 20rpx;
padding-top: 8rpx;
float: right;
padding-right: 20rpx;
padding-top: 8rpx;
}
.zan-capsule + .zan-capsule {
margin-left: 10px;
margin-left: 10px;
}
.a-section .h {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
height: 130rpx;
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
height: 130rpx;
}
.a-section .h .title {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
background-color: #a78845;
height: 75rpx;
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
background-color: #a78845;
height: 75rpx;
}
.a-section .h .txt {
padding-left: 50rpx;
padding-right: 50rpx;
height: 75rpx;
color: #fff;
font-size: 33rpx;
padding-left: 50rpx;
padding-right: 50rpx;
height: 75rpx;
color: #fff;
font-size: 33rpx;
}
.a-brand .b {
width: 750rpx;
height: auto;
overflow: hidden;
position: relative;
width: 750rpx;
height: auto;
overflow: hidden;
position: relative;
}
.a-brand .wrap {
position: relative;
position: relative;
}
.a-brand .img {
position: absolute;
left: 0;
top: 0;
position: absolute;
left: 0;
top: 0;
}
.a-brand .mt {
position: absolute;
z-index: 2;
padding: 4rpx 12rpx;
background-color: #a78845;
right: 0;
top: 0;
position: absolute;
z-index: 2;
padding: 4rpx 12rpx;
background-color: #a78845;
right: 0;
top: 0;
}
.a-brand .mt .brand {
display: block;
font-size: 24rpx;
height: 33rpx;
color: #fff;
display: block;
font-size: 24rpx;
height: 33rpx;
color: #fff;
}
.a-brand .mt .price, .a-brand .mt .unit {
font-size: 25rpx;
color: #fff;
font-size: 25rpx;
color: #fff;
}
.a-brand .item-1 {
float: left;
width: 375rpx;
height: 252rpx;
overflow: hidden;
border-top: 1rpx solid #fff;
margin-left: 1rpx;
float: left;
width: 375rpx;
height: 252rpx;
overflow: hidden;
border-top: 1rpx solid #fff;
margin-left: 1rpx;
}
.a-brand .item-1:nth-child(2n+1) {
margin-left: 0;
width: 374rpx;
margin-left: 0;
width: 374rpx;
}
.a-brand .item-1 .img {
width: 375rpx;
height: 253rpx;
width: 375rpx;
height: 253rpx;
}
.a-topic .b {
height: 533rpx;
width: 750rpx;
padding: 0 0 48rpx 0;
height: 533rpx;
width: 750rpx;
padding: 0 0 48rpx 0;
}
.a-topic .b .list {
height: 533rpx;
width: 750rpx;
white-space: nowrap;
height: 533rpx;
width: 750rpx;
white-space: nowrap;
}
.a-topic .b .item {
display: inline-block;
height: 533rpx;
width: 680.5rpx;
margin-left: 30rpx;
overflow: hidden;
display: inline-block;
height: 533rpx;
width: 680.5rpx;
margin-left: 30rpx;
overflow: hidden;
}
.a-topic .b .item:last-child {
margin-right: 30rpx;
margin-right: 30rpx;
}
.a-topic .b .img {
height: 387.5rpx;
width: 680.5rpx;
margin-bottom: 30rpx;
height: 387.5rpx;
width: 680.5rpx;
margin-bottom: 30rpx;
}
.a-topic .b .np {
height: 35rpx;
margin-bottom: 13.5rpx;
color: #333;
font-size: 30rpx;
height: 35rpx;
margin-bottom: 13.5rpx;
color: #333;
font-size: 30rpx;
}
.a-topic .b .np .price {
margin-left: 20.8rpx;
color: #a78845;
margin-left: 20.8rpx;
color: #a78845;
}
.a-topic .b .desc {
display: block;
height: 30rpx;
color: #999;
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
height: 30rpx;
color: #999;
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.a-groupon {
width: 750rpx;
height: auto;
overflow: hidden;
width: 750rpx;
height: auto;
overflow: hidden;
}
.a-groupon .b .item {
border-top: 1px solid #d9d9d9;
margin: 0 20rpx;
height: 244rpx;
width: 710rpx;
border-top: 1px solid #d9d9d9;
margin: 0 20rpx;
height: 244rpx;
width: 710rpx;
}
.a-groupon .b .img {
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
}
.a-groupon .b .right {
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
}
.a-groupon .b .text {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
}
.a-groupon .b .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
}
.a-groupon .capsule-tag {
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
}
.a-groupon .zan-capsule + .zan-capsule {
margin-left: 10px;
margin-left: 10px;
}
.a-groupon .b .desc {
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
}
.a-groupon .b .price {
width: 476rpx;
display: flex;
color: #b4282d;
line-height: 50rpx;
font-size: 33rpx;
width: 476rpx;
display: flex;
color: #b4282d;
line-height: 50rpx;
font-size: 33rpx;
}
.a-groupon .b .counterPrice {
text-decoration: line-through;
font-size: 28rpx;
color: #999;
text-decoration: line-through;
font-size: 28rpx;
color: #999;
}
.a-groupon .b .retailPrice {
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
}
.good-grid {
width: 750rpx;
height: auto;
overflow: hidden;
width: 750rpx;
height: auto;
overflow: hidden;
}
.good-grid .h {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
height: 130rpx;
font-size: 33rpx;
color: #333;
border: #a78845 1rpx;
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: center;
height: 130rpx;
font-size: 33rpx;
color: #333;
border: #a78845 1rpx;
}
renard-wx/pages/newGoods/newGoods.js
View file @
286c0ae7
...
...
@@ -3,121 +3,121 @@ var api = require('../../config/api.js');
var
app
=
getApp
();
Page
({
data
:
{
bannerInfo
:
{
'
imgUrl
'
:
''
,
'
name
'
:
''
data
:
{
bannerInfo
:
{
'
imgUrl
'
:
''
,
'
name
'
:
''
},
categoryFilter
:
false
,
filterCategory
:
[],
goodsList
:
[],
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
size
:
100
},
categoryFilter
:
false
,
filterCategory
:
[],
goodsList
:
[],
categoryId
:
0
,
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
page
:
1
,
size
:
100
},
onPullDownRefresh
()
{
this
.
getBanner
();
this
.
getGoodsList
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
onPullDownRefresh
()
{
this
.
getBanner
();
this
.
getGoodsList
();
wx
.
stopPullDownRefresh
()
//停止下拉刷新
},
getBanner
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsNew
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
bannerInfo
:
res
.
data
.
bannerInfo
,
getBanner
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsNew
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
bannerInfo
:
res
.
data
.
bannerInfo
,
});
}
});
}
});
},
getGoodsList
:
function
()
{
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
isNew
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
});
}
});
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
getBanner
();
this
.
getGoodsList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
getGoodsList
:
function
()
{
var
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
isNew
:
true
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
order
:
that
.
data
.
currentSortOrder
,
sort
:
that
.
data
.
currentSort
,
categoryId
:
that
.
data
.
categoryId
})
.
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
});
}
});
},
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
getBanner
();
this
.
getGoodsList
();
},
onReady
:
function
()
{
// 页面渲染完成
},
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
// 页面隐藏
},
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
// 页面关闭
},
onUnload
:
function
()
{
// 页面关闭
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
});
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
});
this
.
getGoodsList
();
break
;
default
:
//综合排序
this
.
getGoodsList
();
break
;
default
:
//综合排序
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
});
this
.
getGoodsList
();
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
'
categoryFilter
'
:
false
,
'
categoryId
'
:
this
.
data
.
filterCategory
[
currentIndex
].
id
});
this
.
getGoodsList
();
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
this
.
setData
({
'
categoryFilter
'
:
false
,
'
categoryId
'
:
this
.
data
.
filterCategory
[
currentIndex
].
id
});
this
.
getGoodsList
();
}
}
})
\ No newline at end of file
renard-wx/pages/newGoods/newGoods.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"新品首发"
,
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
"navigationBarTitleText"
:
"新品首发"
,
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
}
\ No newline at end of file
renard-wx/pages/newGoods/newGoods.wxml
View file @
286c0ae7
<view class="container">
<view class="brand-info">
<view class="name">
<image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image>
<view class="info-box">
<view class="info">
<text class="txt">{{bannerInfo.name}}</text>
<text class="line"></text>
<view class="brand-info">
<view class="name">
<image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image>
<view class="info-box">
<view class="info">
<text class="txt">{{bannerInfo.name}}</text>
<text class="line"></text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text>
</view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
<text class="txt">分类</text>
</view>
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text>
</view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
<text class="txt">分类</text>
</view>
</view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view>
<view class="
sort-box-category" wx-if="
{{categoryFilter}}
"
>
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view
>
<view class="
cate-item" hidden='
{{categoryFilter}}
'
>
<goodList calss="goodList" goods="{{goodsList}}"></goodList
>
</view>
</view>
<view class="cate-item" hidden='{{categoryFilter}}'>
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view>
</view>
\ No newline at end of file
renard-wx/pages/newGoods/newGoods.wxss
View file @
286c0ae7
page {
background: #f4f4f4;
background: #f4f4f4;
}
.brand-info .name {
width: 100%;
height: 278rpx;
position: relative;
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.brand-info .info {
display: block;
display: block;
}
.brand-info .txt {
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line {
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
}
.sort {
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item {
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex: 1;
color: #333;
font-size: 30rpx;
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex: 1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt {
display: block;
width: 100%;
height: 100%;
color: #333;
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt {
color: #a78845;
color: #a78845;
}
.sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.cate-item {
z-index: -1;
z-index: -1;
}
.goodList {
z-index: -1;
z-index: -1;
}
.sort-box-category {
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
z-index: 5000;
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
z-index: 5000;
}
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
z-index: 5000;
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
z-index: 5000;
}
.sort-box-category .item.active {
color: #a78845;
border: 1px solid #a78845;
z-index: 5000;
color: #a78845;
border: 1px solid #a78845;
z-index: 5000;
}
renard-wx/pages/payResult/payResult.js
View file @
286c0ae7
...
...
@@ -7,25 +7,25 @@ Page({
status
:
false
,
orderId
:
0
},
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
// 页面初始化 options为页面跳转所带来的参数
this
.
setData
({
orderId
:
options
.
orderId
,
status
:
options
.
status
===
'
1
'
?
true
:
false
})
},
onReady
:
function
()
{
onReady
:
function
()
{
},
onShow
:
function
()
{
onShow
:
function
()
{
// 页面显示
},
onHide
:
function
()
{
onHide
:
function
()
{
// 页面隐藏
},
onUnload
:
function
()
{
onUnload
:
function
()
{
// 页面关闭
},
...
...
@@ -33,7 +33,7 @@ Page({
let
that
=
this
;
util
.
request
(
api
.
OrderPrepay
,
{
orderId
:
that
.
data
.
orderId
},
'
POST
'
).
then
(
function
(
res
)
{
},
'
POST
'
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
const
payParam
=
res
.
data
;
console
.
log
(
"
支付过程开始
"
)
...
...
@@ -43,17 +43,17 @@ Page({
'
package
'
:
payParam
.
packageValue
,
'
signType
'
:
payParam
.
signType
,
'
paySign
'
:
payParam
.
paySign
,
'
success
'
:
function
(
res
)
{
'
success
'
:
function
(
res
)
{
console
.
log
(
"
支付过程成功
"
)
that
.
setData
({
status
:
true
});
},
'
fail
'
:
function
(
res
)
{
'
fail
'
:
function
(
res
)
{
console
.
log
(
"
支付过程失败
"
)
util
.
showErrorToast
(
'
支付失败
'
);
},
'
complete
'
:
function
(
res
)
{
'
complete
'
:
function
(
res
)
{
console
.
log
(
"
支付过程结束
"
)
}
});
...
...
renard-wx/pages/payResult/payResult.wxml
View file @
286c0ae7
...
...
@@ -10,7 +10,8 @@
<view class="error" wx:if="{{!status}}">
<view class="msg">付款失败</view>
<view class="tips">
<view class="p">请在 <text class="time">半小时</text> 内完成付款</view>
<view class="p">请在
<text class="time">半小时</text> 内完成付款</view>
<view class="p">否则订单将会被系统取消</view>
</view>
<view class="btns">
...
...
renard-wx/pages/payResult/payResult.wxss
View file @
286c0ae7
...
...
@@ -33,7 +33,7 @@ page {
width: 200rpx;
line-height: 78rpx;
border: 1px solid #868686;
color: #000
000
;
color: #000;
border-radius: 5rpx;
}
...
...
@@ -56,4 +56,4 @@ page {
.pay-result .error .tips .p {
line-height: 42rpx;
text-align: center;
}
\ No newline at end of file
}
renard-wx/pages/search/search.js
View file @
286c0ae7
...
...
@@ -3,197 +3,197 @@ var api = require('../../config/api.js');
var
app
=
getApp
();
Page
({
data
:
{
keywrod
:
''
,
searchStatus
:
false
,
goodsList
:
[],
helpKeyword
:
[],
historyKeyword
:
[],
categoryFilter
:
false
,
currentSort
:
'
name
'
,
currentSortType
:
'
default
'
,
currentSortOrder
:
'
desc
'
,
filterCategory
:
[],
defaultKeyword
:
{},
hotKeyword
:
[],
page
:
1
,
size
:
20
,
categoryId
:
0
},
//事件处理函数
closeSearch
:
function
()
{
wx
.
navigateBack
()
},
clearKeyword
:
function
()
{
this
.
setData
({
keyword
:
''
,
searchStatus
:
false
});
},
onLoad
:
function
()
{
this
.
getSearchKeyword
();
},
getSearchKeyword
()
{
let
that
=
this
;
util
.
request
(
api
.
SearchIndex
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
historyKeyword
:
res
.
data
.
historyKeywordList
,
defaultKeyword
:
res
.
data
.
defaultKeyword
,
hotKeyword
:
res
.
data
.
hotKeywordList
data
:
{
keywrod
:
''
,
searchStatus
:
false
,
goodsList
:
[],
helpKeyword
:
[],
historyKeyword
:
[],
categoryFilter
:
false
,
currentSort
:
'
name
'
,
currentSortType
:
'
default
'
,
currentSortOrder
:
'
desc
'
,
filterCategory
:
[],
defaultKeyword
:
{},
hotKeyword
:
[],
page
:
1
,
size
:
20
,
categoryId
:
0
},
//事件处理函数
closeSearch
:
function
()
{
wx
.
navigateBack
()
},
clearKeyword
:
function
()
{
this
.
setData
({
keyword
:
''
,
searchStatus
:
false
});
}
});
},
inputChange
:
function
(
e
)
{
},
onLoad
:
function
()
{
this
.
getSearchKeyword
();
},
getSearchKeyword
()
{
let
that
=
this
;
util
.
request
(
api
.
SearchIndex
).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
historyKeyword
:
res
.
data
.
historyKeywordList
,
defaultKeyword
:
res
.
data
.
defaultKeyword
,
hotKeyword
:
res
.
data
.
hotKeywordList
});
}
});
},
this
.
setData
({
keyword
:
e
.
detail
.
value
,
searchStatus
:
false
});
inputChange
:
function
(
e
)
{
if
(
e
.
detail
.
value
)
{
this
.
getHelpKeyword
();
}
},
getHelpKeyword
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
SearchHelper
,
{
keyword
:
that
.
data
.
keyword
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
helpKeyword
:
res
.
data
this
.
setData
({
keyword
:
e
.
detail
.
value
,
searchStatus
:
false
});
}
});
},
inputFocus
:
function
()
{
this
.
setData
({
searchStatus
:
false
,
goodsList
:
[]
});
if
(
this
.
data
.
keyword
)
{
this
.
getHelpKeyword
();
}
},
clearHistory
:
function
()
{
this
.
setData
({
historyKeyword
:
[]
});
util
.
request
(
api
.
SearchClearHistory
,
{},
'
POST
'
)
.
then
(
function
(
res
)
{
console
.
log
(
'
清除成功
'
);
});
},
getGoodsList
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
keyword
:
that
.
data
.
keyword
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
sort
:
that
.
data
.
currentSort
,
order
:
that
.
data
.
currentSortOrder
,
categoryId
:
that
.
data
.
categoryId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
searchStatus
:
true
,
categoryFilter
:
false
,
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
if
(
e
.
detail
.
value
)
{
this
.
getHelpKeyword
();
}
},
getHelpKeyword
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
SearchHelper
,
{
keyword
:
that
.
data
.
keyword
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
helpKeyword
:
res
.
data
});
}
});
}
}
,
//重新获取关键词
th
at
.
getSearchKeyword
();
});
},
onKeywordTap
:
function
(
event
)
{
inputFocus
:
function
()
{
th
is
.
setData
({
searchStatus
:
false
,
goodsList
:
[]
});
this
.
getSearchResult
(
event
.
target
.
dataset
.
keyword
);
if
(
this
.
data
.
keyword
)
{
this
.
getHelpKeyword
();
}
},
},
getSearchResult
(
keyword
)
{
if
(
keyword
===
''
)
{
keyword
=
this
.
data
.
defaultKeyword
.
keyword
;
}
this
.
setData
({
keyword
:
keyword
,
page
:
1
,
categoryId
:
0
,
goodsList
:
[]
});
this
.
getGoodsList
();
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
clearHistory
:
function
()
{
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
historyKeyword
:
[]
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
util
.
request
(
api
.
SearchClearHistory
,
{},
'
POST
'
)
.
then
(
function
(
res
)
{
console
.
log
(
'
清除成功
'
);
});
},
getGoodsList
:
function
()
{
let
that
=
this
;
util
.
request
(
api
.
GoodsList
,
{
keyword
:
that
.
data
.
keyword
,
page
:
that
.
data
.
page
,
size
:
that
.
data
.
size
,
sort
:
that
.
data
.
currentSort
,
order
:
that
.
data
.
currentSortOrder
,
categoryId
:
that
.
data
.
categoryId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
that
.
setData
({
searchStatus
:
true
,
categoryFilter
:
false
,
goodsList
:
res
.
data
.
goodsList
,
filterCategory
:
res
.
data
.
filterCategoryList
});
}
//重新获取关键词
that
.
getSearchKeyword
();
});
},
onKeywordTap
:
function
(
event
)
{
this
.
getSearchResult
(
event
.
target
.
dataset
.
keyword
);
},
getSearchResult
(
keyword
)
{
if
(
keyword
===
''
)
{
keyword
=
this
.
data
.
defaultKeyword
.
keyword
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
keyword
:
keyword
,
page
:
1
,
categoryId
:
0
,
goodsList
:
[]
});
this
.
getGoodsList
();
break
;
default
:
//综合排序
},
openSortFilter
:
function
(
event
)
{
let
currentId
=
event
.
currentTarget
.
id
;
switch
(
currentId
)
{
case
'
categoryFilter
'
:
this
.
setData
({
categoryFilter
:
!
this
.
data
.
categoryFilter
,
currentSortType
:
'
category
'
,
currentSort
:
'
add_time
'
,
currentSortOrder
:
'
desc
'
});
break
;
case
'
priceSort
'
:
let
tmpSortOrder
=
'
asc
'
;
if
(
this
.
data
.
currentSortOrder
==
'
asc
'
)
{
tmpSortOrder
=
'
desc
'
;
}
this
.
setData
({
currentSortType
:
'
price
'
,
currentSort
:
'
retail_price
'
,
currentSortOrder
:
tmpSortOrder
,
categoryFilter
:
false
});
this
.
getGoodsList
();
break
;
default
:
//综合排序
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
name
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
,
});
this
.
getGoodsList
();
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
let
filterCategory
=
this
.
data
.
filterCategory
;
let
currentCategory
=
null
;
for
(
let
key
in
filterCategory
)
{
if
(
key
==
currentIndex
)
{
filterCategory
[
key
].
selected
=
true
;
currentCategory
=
filterCategory
[
key
];
}
else
{
filterCategory
[
key
].
selected
=
false
;
}
}
this
.
setData
({
currentSortType
:
'
default
'
,
currentSort
:
'
name
'
,
currentSortOrder
:
'
desc
'
,
categoryFilter
:
false
,
categoryId
:
0
,
filterCategory
:
filterCategory
,
categoryFilter
:
false
,
categoryId
:
currentCategory
.
id
,
page
:
1
,
goodsList
:
[]
});
this
.
getGoodsList
();
},
onKeywordConfirm
(
event
)
{
this
.
getSearchResult
(
event
.
detail
.
value
);
}
},
selectCategory
:
function
(
event
)
{
let
currentIndex
=
event
.
target
.
dataset
.
categoryIndex
;
let
filterCategory
=
this
.
data
.
filterCategory
;
let
currentCategory
=
null
;
for
(
let
key
in
filterCategory
)
{
if
(
key
==
currentIndex
)
{
filterCategory
[
key
].
selected
=
true
;
currentCategory
=
filterCategory
[
key
];
}
else
{
filterCategory
[
key
].
selected
=
false
;
}
}
this
.
setData
({
filterCategory
:
filterCategory
,
categoryFilter
:
false
,
categoryId
:
currentCategory
.
id
,
page
:
1
,
goodsList
:
[]
});
this
.
getGoodsList
();
},
onKeywordConfirm
(
event
)
{
this
.
getSearchResult
(
event
.
detail
.
value
);
}
});
\ No newline at end of file
renard-wx/pages/search/search.json
View file @
286c0ae7
{
"navigationBarTitleText"
:
"搜索"
,
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
"navigationBarTitleText"
:
"搜索"
,
"usingComponents"
:
{
"goodList"
:
"/components/goodList/goodList"
}
}
\ No newline at end of file
renard-wx/pages/search/search.wxml
View file @
286c0ae7
<scroll-view class="container" style="height: 100%;">
<view class="search-header">
<view class="input-box">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png"></image>
<input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" placeholder="{{defaultKeyword.keyword}}" />
<image class="del" wx:if="{{keyword}}" bindtap="clearKeyword" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/clearIpt-f71b83e3c2.png"></image>
</view>
<view class="right" bindtap="closeSearch">取消</view>
</view>
<view class="no-search" wx:if="{{ !searchStatus}}">
<view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}">
<view class="h">
<text class="title">历史记录</text>
<image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image>
</view>
<view class="b">
<view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view>
</view>
</view>
<view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<view class="h">
<text class="title">热门搜索</text>
</view>
<view class="b">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
</view>
</view>
<view class="shelper-list" wx:if="{{keyword}}">
<view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
<view class="search-header">
<view class="input-box">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png"></image>
<input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" placeholder="{{defaultKeyword.keyword}}" />
<image class="del" wx:if="{{keyword}}" bindtap="clearKeyword" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/clearIpt-f71b83e3c2.png"></image>
</view>
<view class="right" bindtap="closeSearch">取消</view>
</view>
</view>
<view class="search-result" wx:if="{{ searchStatus && goodsList.length}}">
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
<view class="no-search" wx:if="{{ !searchStatus}}">
<view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}">
<view class="h">
<text class="title">历史记录</text>
<image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image>
</view>
<view class="b">
<view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view>
</view>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text>
<view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<view class="h">
<text class="title">热门搜索</text>
</view>
<view class="b">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
</view>
</view>
<view class="
item {{currentSortType == 'category' ? 'active' : ''}}" id="categoryFilter
">
<text class="txt">分类</text
>
<view class="
shelper-list" wx:if="{{keyword}}
">
<view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view
>
</view>
</view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view>
<view class="cate-item">
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
<view class="search-result" wx:if="{{ searchStatus && goodsList.length}}">
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text>
</view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" id="categoryFilter">
<text class="txt">分类</text>
</view>
</view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view>
<view class="cate-item">
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view>
</view>
</view>
<view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image>
<text class="text">您寻找的商品还未上架</text>
</view>
<view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image>
<text class="text">您寻找的商品还未上架</text>
</view>
</scroll-view>
\ No newline at end of file
Prev
1
2
3
4
5
Next
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