"...main/resources/git@ustchcs.com:gujinli1118/JSH_ERP.git" did not exist on "e7d7666b3d6f731d001cb7a792348af34df17c45"
Commit 286c0ae7 authored by Junling Bu's avatar Junling Bu
Browse files

chore[renard-wx]: 基于微信开发者工具的格式化代码

parent 20b97ec8
{ {
"navigationBarTitleText": "我的团购", "navigationBarTitleText": "我的团购",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index" "zan-capsule": "/components/capsule/index"
} }
} }
\ No newline at end of file
<view class="container"> <view class="container">
<view class="orders-switch"> <view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'> <view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view> <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> </view>
<view class="status"></view> <view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
</view> <view class="txt">参加的团购</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>
<view class="capsule-tag"> </view>
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" /> <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> </view>
</navigator>
</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> </view>
\ No newline at end of file
page { page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.capsule-tag { .capsule-tag {
float: right; float: right;
/* padding-right: 10rpx; */ /* padding-right: 10rpx; */
} }
.zan-capsule + .zan-capsule { .zan-capsule + .zan-capsule {
margin-left: 5px; margin-left: 5px;
} }
.orders-switch { .orders-switch {
width: 100%; width: 100%;
background: #fff; background: #fff;
height: 84rpx; height: 84rpx;
border-bottom: 1px solid #a78845; border-bottom: 1px solid #a78845;
} }
.orders-switch .item { .orders-switch .item {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
width: 50%; width: 50%;
padding: 0 15rpx; padding: 0 15rpx;
text-align: center; text-align: center;
} }
.orders-switch .item .txt { .orders-switch .item .txt {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
padding: 0 20rpx; padding: 0 20rpx;
line-height: 82rpx; line-height: 82rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
width: 100%; width: 100%;
} }
.orders-switch .item.active .txt { .orders-switch .item.active .txt {
color: #a78845; color: #a78845;
border-bottom: 4rpx solid #a78845; border-bottom: 4rpx solid #a78845;
} }
.no-order { .no-order {
width: 100%; width: 100%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
} }
.no-order .c { .no-order .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
} }
.no-order .c image { .no-order .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
} }
.no-order .c text { .no-order .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #999; color: #999;
} }
.orders { .orders {
height: auto; height: auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.order { .order {
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
} }
.order .h { .order .h {
height: 83.3rpx; height: 83.3rpx;
line-height: 83.3rpx; line-height: 83.3rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order .h .l { .order .h .l {
float: left; float: left;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .h .r { .order .h .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .i { .order .i {
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order .i .l { .order .i .l {
float: left; float: left;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .i .r { .order .i .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .j { .order .j {
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
} }
.order .j .l { .order .j .l {
float: left; float: left;
font-size: 26rpx; font-size: 26rpx;
color: #a78845; color: #a78845;
} }
.order .j .r { .order .j .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .goods { .order .goods {
display: flex; display: flex;
align-items: center; align-items: center;
height: 199rpx; height: 199rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
} }
.order .goods .img { .order .goods .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.order .goods .img image { .order .goods .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.order .goods .info { .order .goods .info {
height: 145.83rpx; height: 145.83rpx;
flex: 1; flex: 1;
padding-left: 20rpx; padding-left: 20rpx;
} }
.order .goods .name { .order .goods .name {
margin-top: 30rpx; margin-top: 30rpx;
display: block; display: block;
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order .goods .number { .order .goods .number {
display: block; display: block;
height: 37rpx; height: 37rpx;
line-height: 37rpx; line-height: 37rpx;
color: #666; color: #666;
font-size: 25rpx; font-size: 25rpx;
} }
.order .goods .status { .order .goods .status {
width: 105rpx; width: 105rpx;
color: #a78845; color: #a78845;
font-size: 25rpx; font-size: 25rpx;
} }
.order .b { .order .b {
height: 103rpx; height: 103rpx;
line-height: 103rpx; line-height: 103rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order .b .l { .order .b .l {
float: left; float: left;
} }
.order .b .r { .order .b .r {
float: right; float: right;
} }
.order .b .btn { .order .b .btn {
margin-top: 19rpx; margin-top: 19rpx;
height: 64.5rpx; height: 64.5rpx;
line-height: 64.5rpx; line-height: 64.5rpx;
text-align: center; text-align: center;
padding: 0 20rpx; padding: 0 20rpx;
border-radius: 5rpx; border-radius: 5rpx;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
background: #a78845; background: #a78845;
} }
...@@ -3,129 +3,129 @@ var api = require('../../config/api.js'); ...@@ -3,129 +3,129 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
bannerInfo: { bannerInfo: {
'imgUrl': '', 'imgUrl': '',
'name': '' 'name': ''
},
categoryFilter: false,
filterCategory: [],
goodsList: [],
categoryId: 0,
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
page: 1,
size: 100
}, },
categoryFilter: false, getBanner: function() {
filterCategory: [], let that = this;
goodsList: [], util.request(api.GoodsHot).then(function(res) {
categoryId: 0, if (res.errno === 0) {
currentSortType: 'default', that.setData({
currentSort: 'add_time', bannerInfo: res.data.bannerInfo,
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,
}); });
} },
}); getCategoryList: function() {
}, var that = this;
getCategoryList: function() {
var that = this;
util.request(api.GoodsFilter, { util.request(api.GoodsFilter, {
isHot: 1 isHot: 1
}) })
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
filterCategory: res.data.filterCategoryList, filterCategory: res.data.filterCategoryList,
}); });
} }
}); });
}, },
getGoodsList: function() { getGoodsList: function() {
var that = this; var that = this;
util.request(api.GoodsList, { util.request(api.GoodsList, {
isHot: true, isHot: true,
page: that.data.page, page: that.data.page,
size: that.data.size, size: that.data.size,
order: that.data.currentSortOrder, order: that.data.currentSortOrder,
sort: that.data.currentSort, sort: that.data.currentSort,
categoryId: that.data.categoryId categoryId: that.data.categoryId
}) })
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList filterCategory: res.data.filterCategoryList
}); });
} }
}); });
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.getBanner(); this.getBanner();
this.getGoodsList(); this.getGoodsList();
}, },
onReady: function() { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function() { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function() { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function() { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
openSortFilter: function(event) { openSortFilter: function(event) {
let currentId = event.currentTarget.id; let currentId = event.currentTarget.id;
switch (currentId) { switch (currentId) {
case 'categoryFilter': case 'categoryFilter':
this.setData({ this.setData({
categoryFilter: !this.data.categoryFilter, categoryFilter: !this.data.categoryFilter,
currentSortType: 'category', currentSortType: 'category',
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc' currentSortOrder: 'desc'
}); });
break; break;
case 'priceSort': case 'priceSort':
let tmpSortOrder = 'asc'; let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') { if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc'; tmpSortOrder = 'desc';
} }
this.setData({ this.setData({
currentSortType: 'price', currentSortType: 'price',
currentSort: 'retail_price', currentSort: 'retail_price',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false
}); });
this.getGoodsList(); this.getGoodsList();
break; break;
default: 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({ this.setData({
currentSortType: 'default', 'categoryFilter': false,
currentSort: 'add_time', 'categoryId': this.data.filterCategory[currentIndex].id
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0,
}); });
this.getGoodsList(); 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
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</view> </view>
<view class="sort"> <view class="sort">
<view class="sort-box"> <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> <text class="txt">综合</text>
</view> </view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
......
page{ page {
background: #f4f4f4; background: #f4f4f4;
} }
.brand-info .name{ .brand-info .name {
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
position: relative; position: relative;
} }
.brand-info .img{ .brand-info .img {
position: absolute; position: absolute;
top:0; top: 0;
left:0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
} }
.brand-info .info-box{ .brand-info .info-box {
position: absolute; position: absolute;
top:0; top: 0;
left:0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.brand-info .info{ .brand-info .info {
display: block; display: block;
} }
.brand-info .txt{ .brand-info .txt {
display: block; display: block;
height: 40rpx; height: 40rpx;
font-size: 37.5rpx; font-size: 37.5rpx;
color: #fff; color: #fff;
} }
.brand-info .line{ .brand-info .line {
margin: 0 auto; margin: 0 auto;
margin-top: 16rpx; margin-top: 16rpx;
display: block; display: block;
height: 2rpx; height: 2rpx;
width: 145rpx; width: 145rpx;
background: #fff; background: #fff;
} }
.sort{ .sort {
position: relative; position: relative;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box{ .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item{ .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex:1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt{ .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt{ .sort-box .item.active .txt {
color: #b4282d; color: #b4282d;
} }
.sort-box .item.by-price{ .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: 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-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc{ .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: 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-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc{ .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: 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-size: 15rpx 21rpx;
} }
.sort-box-category{ .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box-category .item{ .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
} }
.sort-box-category .item.active{ .sort-box-category .item.active {
color: #b4282d; color: #b4282d;
border: 1px solid #b4282d; border: 1px solid #b4282d;
} }
.cate-item .b{ .cate-item .b {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
...@@ -134,7 +134,7 @@ page{ ...@@ -134,7 +134,7 @@ page{
margin-top: 20rpx; margin-top: 20rpx;
} }
.cate-item .b .item{ .cate-item .b .item {
float: left; float: left;
background: #fff; background: #fff;
width: 375rpx; width: 375rpx;
...@@ -145,17 +145,17 @@ page{ ...@@ -145,17 +145,17 @@ page{
text-align: center; text-align: center;
} }
.cate-item .b .item-b{ .cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4; border-right: 1rpx solid #f4f4f4;
} }
.cate-item .item .img{ .cate-item .item .img {
margin-top: 10rpx; margin-top: 10rpx;
width: 302rpx; width: 302rpx;
height: 302rpx; height: 302rpx;
} }
.cate-item .item .name{ .cate-item .item .name {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 35rpx; height: 35rpx;
...@@ -167,11 +167,11 @@ page{ ...@@ -167,11 +167,11 @@ page{
color: #333; color: #333;
} }
.cate-item .item .price{ .cate-item .item .price {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 30rpx; height: 30rpx;
text-align: center; text-align: center;
font-size: 30rpx; font-size: 30rpx;
color: #b4282d; color: #b4282d;
} }
\ No newline at end of file
...@@ -6,134 +6,134 @@ const user = require('../../utils/user.js'); ...@@ -6,134 +6,134 @@ const user = require('../../utils/user.js');
const app = getApp(); const app = getApp();
Page({ Page({
data: { data: {
newGoods: [], newGoods: [],
hotGoods: [], hotGoods: [],
topics: [], topics: [],
brands: [], brands: [],
groupons: [], groupons: [],
floorGoods: [], floorGoods: [],
// banner: [], // banner: [],
channel: [] channel: []
}, },
onShareAppMessage: function() { onShareAppMessage: function() {
return { return {
title: 'Renard', title: 'Renard',
desc: '唯爱与美食不可辜负', desc: '唯爱与美食不可辜负',
path: '/pages/index/index' path: '/pages/index/index'
} }
}, },
saveFormId: function(v) { saveFormId: function(v) {
if (v.detail.formId != 'the formId is a mock one') { if (v.detail.formId != 'the formId is a mock one') {
util.request(api.UserFormIdCreate, { util.request(api.UserFormIdCreate, {
formId: v.detail.formId formId: v.detail.formId
}); });
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getIndexData(); this.getIndexData();
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getIndexData: function() { getIndexData: function() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
}); });
setTimeout(function() { setTimeout(function() {
wx.hideLoading() wx.hideLoading()
}, 2000); }, 2000);
let that = this; let that = this;
util.request(api.IndexUrl).then(function(res) { util.request(api.IndexUrl).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
newGoods: res.data.newGoodsList, newGoods: res.data.newGoodsList,
hotGoods: res.data.hotGoodsList, hotGoods: res.data.hotGoodsList,
topics: res.data.topicList, topics: res.data.topicList,
brands: res.data.brandList, brands: res.data.brandList,
floorGoods: res.data.floorGoodsList, floorGoods: res.data.floorGoodsList,
// banner: res.data.banner, // banner: res.data.banner,
groupons: res.data.grouponList, groupons: res.data.grouponList,
channel: res.data.channel channel: res.data.channel
});
wx.hideLoading();
}
}); });
wx.hideLoading(); },
} onLoad: function(options) {
}); var that = this;
}, wx.getSystemInfo({
onLoad: function(options) { success: function(res) {
var that = this; that.setData({
wx.getSystemInfo({ windowWidth: res.windowWidth,
success: function(res) { windowHeight: res.windowHeight
that.setData({ });
windowWidth: res.windowWidth, }
windowHeight: res.windowHeight
}); });
}
});
if (options.scene) { if (options.scene) {
var scene = decodeURIComponent(options.scene); var scene = decodeURIComponent(options.scene);
console.log("scene:" + scene); console.log("scene:" + scene);
let info_arr = []; let info_arr = [];
info_arr = scene.split(','); info_arr = scene.split(',');
let _type = info_arr[0]; let _type = info_arr[0];
let id = info_arr[1]; let id = info_arr[1];
if (_type == 'goods') { if (_type == 'goods') {
wx.navigateTo({ wx.navigateTo({
url: '../goods/goods?id=' + id url: '../goods/goods?id=' + id
}); });
} else if (_type == 'groupon') { } else if (_type == 'groupon') {
wx.navigateTo({ wx.navigateTo({
url: '../goods/goods?grouponId=' + id url: '../goods/goods?grouponId=' + id
}); });
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '../index/index' url: '../index/index'
}); });
} }
} }
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
if (options.grouponId) { if (options.grouponId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 //这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({ wx.navigateTo({
url: '../goods/goods?grouponId=' + options.grouponId url: '../goods/goods?grouponId=' + options.grouponId
}); });
} }
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
if (options.goodId) { if (options.goodId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 //这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({ wx.navigateTo({
url: '../goods/goods?id=' + options.goodId url: '../goods/goods?id=' + options.goodId
}); });
} }
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
if (options.orderId) { if (options.orderId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 //这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({ wx.navigateTo({
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId
}); });
} }
this.getIndexData(); this.getIndexData();
}, },
onReady: function() { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function() { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function() { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function() { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
}); });
\ No newline at end of file
{ {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index", "zan-capsule": "/components/capsule/index",
"goodList": "/components/goodList/goodList", "goodList": "/components/goodList/goodList",
"van-notice-bar": "/components/notice-bar/index" "van-notice-bar": "/components/notice-bar/index"
} }
} }
\ No newline at end of file
<view class="container"> <view class="container">
<!-- 首页顶部通知消息 --> <!-- 首页顶部通知消息 -->
<van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" /> <van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" />
<view class="HotName">今日推荐 <view class="HotName">今日推荐
<text></text> <text></text>
</view> </view>
<view class="HotMark">唯爱与美食不可辜负</view> <view class="HotMark">唯爱与美食不可辜负</view>
<view class="HotSwiper" style="margin-top:{{windowHeight/45}}px"> <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"> <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}}"> <block wx:for-items="{{hotGoods}}" wx:key="{{id}}">
<navigator url="/pages/goods/goods?id={{item.id}}"> <navigator url="/pages/goods/goods?id={{item.id}}">
<swiper-item> <swiper-item>
<view class="swiper-box"> <view class="swiper-box">
<form bindsubmit="saveFormId" report-submit='true' class='form_class'> <form bindsubmit="saveFormId" report-submit='true' class='form_class'>
<button formType="submit" class='form_button'> <button formType="submit" class='form_button'>
<image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" /> <image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" />
</button> </button>
</form> </form>
<view class="swiper-box-info"> <view class="swiper-box-info">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
<view class="price"> <view class="price">
<view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view> <view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view>
<view class="retailPrice">现价:¥{{item.retailPrice}}</view> <view class="retailPrice">现价:¥{{item.retailPrice}}</view>
</view> </view>
<view class="capsule-tag" wx:if="{{item.isNew == true}}"> <view class="capsule-tag" wx:if="{{item.isNew == true}}">
<zan-capsule color="#a78845" leftText="N" rightText="新 品" /> <zan-capsule color="#a78845" leftText="N" rightText="新 品" />
</view> </view>
<view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}"> <view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}">
<zan-capsule color="#b4282d" leftText="H" rightText="折 扣" /> <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>
</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> <view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<view class="b"> <navigator url="/pages/goods/goods?id={{item.goods.id}}">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<navigator url="/pages/goods/goods?id={{item.goods.id}}"> <view class="right">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image> <view class="text">
<view class="right"> <view class="header">
<view class="text"> <text class="name">{{item.goods.name}}</text>
<view class="header"> <view class="capsule-tag">
<text class="name">{{item.goods.name}}</text> <zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
<view class="capsule-tag"> </view>
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" /> </view>
</view> <text class="desc">{{item.goods.brief}}</text>
</view> <view class="price">
<text class="desc">{{item.goods.brief}}</text> <view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view>
<view class="price"> <view class="retailPrice">团购价:¥{{item.groupon_price}}</view>
<view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view> </view>
<view class="retailPrice">团购价:¥{{item.groupon_price}}</view> </view>
</view> </view>
</navigator>
</view> </view>
</view> </view>
</navigator>
</view>
</view> </view>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}"> <view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h"> <view class="h">
<view class="title"> <view class="title">
<navigator url="../newGoods/newGoods"> <navigator url="../newGoods/newGoods">
<text class="txt">新品首发</text> <text class="txt">新品首发</text>
</navigator> </navigator>
</view> </view>
</view>
<goodList goods="{{newGoods}}"></goodList>
</view> </view>
<goodList goods="{{newGoods}}"></goodList>
</view>
<view class="a-section a-brand"> <view class="a-section a-brand">
<view class="h"> <view class="h">
<view class="title"> <view class="title">
<navigator url="../brand/brand"> <navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text> <text class="txt">品牌制造商直供</text>
</navigator> </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>
</view> </view>
</navigator> <view class="b">
</view> <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>
<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="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<view class="h"> <navigator url="/pages/category/category?id={{item.id}}" class="more-a">
<view class="title"> <view class="h" wx:if="{{item.goodsList.length > 0}}">
<navigator url="/pages/topic/topic"> <text>{{item.name}}</text>
<text class="txt">专题精选</text> </view>
</navigator> </navigator>
</view> <goodList goods="{{item.goodsList}}"></goodList>
</view> </view>
<view class="b">
<scroll-view scroll-x class="list"> <view class="a-section a-topic" wx:if="topics.length > 0">
<view class="item" wx:for="{{topics}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <view class="h">
<navigator url="../topicDetail/topicDetail?id={{item.id}}"> <view class="title">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image> <navigator url="/pages/topic/topic">
<view class="np"> <text class="txt">专题精选</text>
<text class="name">{{item.title}}</text> </navigator>
</view> </view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view> </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>
</view> </view>
\ No newline at end of file
.HotName { .HotName {
font-size: 50rpx; font-size: 50rpx;
margin-left: 40rpx; margin-left: 40rpx;
margin-top: 30rpx; margin-top: 30rpx;
color: #293539; color: #293539;
font-weight: 300; font-weight: 300;
position: relative; position: relative;
} }
.HotName text { .HotName text {
width: 14rpx; width: 14rpx;
height: 14rpx; height: 14rpx;
position: absolute; position: absolute;
border: 4rpx solid #a78845; border: 4rpx solid #a78845;
border-radius: 50%; border-radius: 50%;
} }
.HotMark { .HotMark {
margin-left: 50rpx; margin-left: 50rpx;
color: #293539; color: #293539;
font-size: 36rpx; font-size: 36rpx;
margin-top: 10rpx; margin-top: 10rpx;
text-align: center; text-align: center;
width: 350rpx; width: 350rpx;
border-bottom: 1rpx solid #a78845; border-bottom: 1rpx solid #a78845;
} }
.HotSwiper swiper { .HotSwiper swiper {
width: 100%; width: 100%;
height: 800rpx; height: 800rpx;
} }
.swiper-box { .swiper-box {
width: 520rpx; width: 520rpx;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
height: 700rpx; height: 700rpx;
box-shadow: 0px 10rpx 30rpx 0px #cfc9ca; box-shadow: 0px 10rpx 30rpx 0px #cfc9ca;
margin-top: 40rpx; margin-top: 40rpx;
border-radius: 20rpx; border-radius: 20rpx;
} }
.swiper-box image { .swiper-box image {
width: 100%; width: 100%;
height: 520rpx; height: 520rpx;
background-color: #f5f5f5; background-color: #f5f5f5;
border-top-left-radius: 10rpx; border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx; border-top-right-radius: 10rpx;
} }
.swiper-box-info { .swiper-box-info {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
top: 520rpx; top: 520rpx;
background-color: #fff; background-color: #fff;
border-bottom-right-radius: 10rpx; border-bottom-right-radius: 10rpx;
border-bottom-left-radius: 10rpx; border-bottom-left-radius: 10rpx;
} }
.swiper-box-info .name { .swiper-box-info .name {
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
margin-top: 20rpx; margin-top: 20rpx;
font-size: 32rpx; font-size: 32rpx;
margin-left: 35rpx; margin-left: 35rpx;
color: #293539; color: #293539;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.swiper-box-info .price { .swiper-box-info .price {
float: left; float: left;
width: 60%; width: 60%;
margin-top: 10rpx; margin-top: 10rpx;
margin-left: 30rpx; margin-left: 30rpx;
} }
.swiper-box-info .counterPrice { .swiper-box-info .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
} }
.swiper-box-info .retailPrice { .swiper-box-info .retailPrice {
font-size: 30rpx; font-size: 30rpx;
color: #a78845; color: #a78845;
} }
.capsule-tag { .capsule-tag {
float: right; float: right;
padding-right: 20rpx; padding-right: 20rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.zan-capsule + .zan-capsule { .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.a-section .h { .a-section .h {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 130rpx; height: 130rpx;
} }
.a-section .h .title { .a-section .h .title {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #a78845; background-color: #a78845;
height: 75rpx; height: 75rpx;
} }
.a-section .h .txt { .a-section .h .txt {
padding-left: 50rpx; padding-left: 50rpx;
padding-right: 50rpx; padding-right: 50rpx;
height: 75rpx; height: 75rpx;
color: #fff; color: #fff;
font-size: 33rpx; font-size: 33rpx;
} }
.a-brand .b { .a-brand .b {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.a-brand .wrap { .a-brand .wrap {
position: relative; position: relative;
} }
.a-brand .img { .a-brand .img {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
} }
.a-brand .mt { .a-brand .mt {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
padding: 4rpx 12rpx; padding: 4rpx 12rpx;
background-color: #a78845; background-color: #a78845;
right: 0; right: 0;
top: 0; top: 0;
} }
.a-brand .mt .brand { .a-brand .mt .brand {
display: block; display: block;
font-size: 24rpx; font-size: 24rpx;
height: 33rpx; height: 33rpx;
color: #fff; color: #fff;
} }
.a-brand .mt .price, .a-brand .mt .unit { .a-brand .mt .price, .a-brand .mt .unit {
font-size: 25rpx; font-size: 25rpx;
color: #fff; color: #fff;
} }
.a-brand .item-1 { .a-brand .item-1 {
float: left; float: left;
width: 375rpx; width: 375rpx;
height: 252rpx; height: 252rpx;
overflow: hidden; overflow: hidden;
border-top: 1rpx solid #fff; border-top: 1rpx solid #fff;
margin-left: 1rpx; margin-left: 1rpx;
} }
.a-brand .item-1:nth-child(2n+1) { .a-brand .item-1:nth-child(2n+1) {
margin-left: 0; margin-left: 0;
width: 374rpx; width: 374rpx;
} }
.a-brand .item-1 .img { .a-brand .item-1 .img {
width: 375rpx; width: 375rpx;
height: 253rpx; height: 253rpx;
} }
.a-topic .b { .a-topic .b {
height: 533rpx; height: 533rpx;
width: 750rpx; width: 750rpx;
padding: 0 0 48rpx 0; padding: 0 0 48rpx 0;
} }
.a-topic .b .list { .a-topic .b .list {
height: 533rpx; height: 533rpx;
width: 750rpx; width: 750rpx;
white-space: nowrap; white-space: nowrap;
} }
.a-topic .b .item { .a-topic .b .item {
display: inline-block; display: inline-block;
height: 533rpx; height: 533rpx;
width: 680.5rpx; width: 680.5rpx;
margin-left: 30rpx; margin-left: 30rpx;
overflow: hidden; overflow: hidden;
} }
.a-topic .b .item:last-child { .a-topic .b .item:last-child {
margin-right: 30rpx; margin-right: 30rpx;
} }
.a-topic .b .img { .a-topic .b .img {
height: 387.5rpx; height: 387.5rpx;
width: 680.5rpx; width: 680.5rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.a-topic .b .np { .a-topic .b .np {
height: 35rpx; height: 35rpx;
margin-bottom: 13.5rpx; margin-bottom: 13.5rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.a-topic .b .np .price { .a-topic .b .np .price {
margin-left: 20.8rpx; margin-left: 20.8rpx;
color: #a78845; color: #a78845;
} }
.a-topic .b .desc { .a-topic .b .desc {
display: block; display: block;
height: 30rpx; height: 30rpx;
color: #999; color: #999;
font-size: 24rpx; font-size: 24rpx;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.a-groupon { .a-groupon {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.a-groupon .b .item { .a-groupon .b .item {
border-top: 1px solid #d9d9d9; border-top: 1px solid #d9d9d9;
margin: 0 20rpx; margin: 0 20rpx;
height: 244rpx; height: 244rpx;
width: 710rpx; width: 710rpx;
} }
.a-groupon .b .img { .a-groupon .b .img {
margin-top: 12rpx; margin-top: 12rpx;
margin-right: 12rpx; margin-right: 12rpx;
float: left; float: left;
width: 220rpx; width: 220rpx;
height: 220rpx; height: 220rpx;
} }
.a-groupon .b .right { .a-groupon .b .right {
float: left; float: left;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.a-groupon .b .text { .a-groupon .b .text {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
} }
.a-groupon .b .name { .a-groupon .b .name {
float: left; float: left;
width: 330rpx; width: 330rpx;
display: block; display: block;
color: #333; color: #333;
line-height: 50rpx; line-height: 50rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.a-groupon .capsule-tag { .a-groupon .capsule-tag {
float: right; float: right;
padding-right: 0rpx; padding-right: 0rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.a-groupon .zan-capsule + .zan-capsule { .a-groupon .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.a-groupon .b .desc { .a-groupon .b .desc {
width: 476rpx; width: 476rpx;
display: block; display: block;
color: #999; color: #999;
line-height: 50rpx; line-height: 50rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.a-groupon .b .price { .a-groupon .b .price {
width: 476rpx; width: 476rpx;
display: flex; display: flex;
color: #b4282d; color: #b4282d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
.a-groupon .b .counterPrice { .a-groupon .b .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
} }
.a-groupon .b .retailPrice { .a-groupon .b .retailPrice {
margin-left: 30rpx; margin-left: 30rpx;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }
.good-grid { .good-grid {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.good-grid .h { .good-grid .h {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 130rpx; height: 130rpx;
font-size: 33rpx; font-size: 33rpx;
color: #333; color: #333;
border: #a78845 1rpx; border: #a78845 1rpx;
} }
...@@ -3,121 +3,121 @@ var api = require('../../config/api.js'); ...@@ -3,121 +3,121 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
bannerInfo: { bannerInfo: {
'imgUrl': '', 'imgUrl': '',
'name': '' '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() { onPullDownRefresh() {
this.getBanner(); this.getBanner();
this.getGoodsList(); this.getGoodsList();
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getBanner: function() { getBanner: function() {
let that = this; let that = this;
util.request(api.GoodsNew).then(function(res) { util.request(api.GoodsNew).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
bannerInfo: res.data.bannerInfo, bannerInfo: res.data.bannerInfo,
});
}
}); });
} },
}); getGoodsList: function() {
}, var that = this;
getGoodsList: function() { util.request(api.GoodsList, {
var that = this; isNew: true,
util.request(api.GoodsList, { page: that.data.page,
isNew: true, size: that.data.size,
page: that.data.page, order: that.data.currentSortOrder,
size: that.data.size, sort: that.data.currentSort,
order: that.data.currentSortOrder, categoryId: that.data.categoryId
sort: that.data.currentSort, })
categoryId: that.data.categoryId .then(function(res) {
}) if (res.errno === 0) {
.then(function(res) { that.setData({
if (res.errno === 0) { goodsList: res.data.goodsList,
that.setData({ filterCategory: res.data.filterCategoryList
goodsList: res.data.goodsList, });
filterCategory: res.data.filterCategoryList }
}); });
} },
}); onLoad: function(options) {
}, // 页面初始化 options为页面跳转所带来的参数
onLoad: function(options) { this.getBanner();
// 页面初始化 options为页面跳转所带来的参数 this.getGoodsList();
this.getBanner(); },
this.getGoodsList(); onReady: function() {
}, // 页面渲染完成
onReady: function() { },
// 页面渲染完成 onShow: function() {
}, // 页面显示
onShow: function() {
// 页面显示
}, },
onHide: function() { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function() { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
openSortFilter: function(event) { openSortFilter: function(event) {
let currentId = event.currentTarget.id; let currentId = event.currentTarget.id;
switch (currentId) { switch (currentId) {
case 'categoryFilter': case 'categoryFilter':
this.setData({ this.setData({
categoryFilter: !this.data.categoryFilter, categoryFilter: !this.data.categoryFilter,
currentSortType: 'category', currentSortType: 'category',
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc' currentSortOrder: 'desc'
}); });
break; break;
case 'priceSort': case 'priceSort':
let tmpSortOrder = 'asc'; let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') { if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc'; tmpSortOrder = 'desc';
} }
this.setData({ this.setData({
currentSortType: 'price', currentSortType: 'price',
currentSort: 'retail_price', currentSort: 'retail_price',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false
}); });
this.getGoodsList(); this.getGoodsList();
break; break;
default: 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({ this.setData({
currentSortType: 'default', 'categoryFilter': false,
currentSort: 'add_time', 'categoryId': this.data.filterCategory[currentIndex].id
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0
}); });
this.getGoodsList(); 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
{ {
"navigationBarTitleText": "新品首发", "navigationBarTitleText": "新品首发",
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }
\ No newline at end of file
<view class="container"> <view class="container">
<view class="brand-info"> <view class="brand-info">
<view class="name"> <view class="name">
<image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image> <image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image>
<view class="info-box"> <view class="info-box">
<view class="info"> <view class="info">
<text class="txt">{{bannerInfo.name}}</text> <text class="txt">{{bannerInfo.name}}</text>
<text class="line"></text> <text class="line"></text>
</view>
</view>
</view> </view>
</view>
</view> </view>
</view> <view class="sort">
<view class="sort"> <view class="sort-box">
<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>
<text class="txt">综合</text> </view>
</view> <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <text class="txt">价格</text>
<text class="txt">价格</text> </view>
</view> <view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter"> <text class="txt">分类</text>
<text class="txt">分类</text> </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>
<view class="sort-box-category" wx-if="{{categoryFilter}}"> <view class="cate-item" hidden='{{categoryFilter}}'>
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view> <goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view> </view>
</view>
<view class="cate-item" hidden='{{categoryFilter}}'>
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view>
</view> </view>
\ No newline at end of file
page { page {
background: #f4f4f4; background: #f4f4f4;
} }
.brand-info .name { .brand-info .name {
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
position: relative; position: relative;
} }
.brand-info .img { .brand-info .img {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
} }
.brand-info .info-box { .brand-info .info-box {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.brand-info .info { .brand-info .info {
display: block; display: block;
} }
.brand-info .txt { .brand-info .txt {
display: block; display: block;
height: 40rpx; height: 40rpx;
font-size: 37.5rpx; font-size: 37.5rpx;
color: #fff; color: #fff;
} }
.brand-info .line { .brand-info .line {
margin: 0 auto; margin: 0 auto;
margin-top: 16rpx; margin-top: 16rpx;
display: block; display: block;
height: 2rpx; height: 2rpx;
width: 145rpx; width: 145rpx;
background: #fff; background: #fff;
} }
.sort { .sort {
position: relative; position: relative;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box { .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item { .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex: 1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt { .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt { .sort-box .item.active .txt {
color: #a78845; color: #a78845;
} }
.sort-box .item.by-price { .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: 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-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc { .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: 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-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc { .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: 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-size: 15rpx 21rpx;
} }
.cate-item { .cate-item {
z-index: -1; z-index: -1;
} }
.goodList { .goodList {
z-index: -1; z-index: -1;
} }
.sort-box-category { .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
z-index: 5000; z-index: 5000;
} }
.sort-box-category .item { .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
z-index: 5000; z-index: 5000;
} }
.sort-box-category .item.active { .sort-box-category .item.active {
color: #a78845; color: #a78845;
border: 1px solid #a78845; border: 1px solid #a78845;
z-index: 5000; z-index: 5000;
} }
...@@ -7,25 +7,25 @@ Page({ ...@@ -7,25 +7,25 @@ Page({
status: false, status: false,
orderId: 0 orderId: 0
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
orderId: options.orderId, orderId: options.orderId,
status: options.status === '1' ? true : false 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({ ...@@ -33,7 +33,7 @@ Page({
let that = this; let that = this;
util.request(api.OrderPrepay, { util.request(api.OrderPrepay, {
orderId: that.data.orderId orderId: that.data.orderId
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
const payParam = res.data; const payParam = res.data;
console.log("支付过程开始") console.log("支付过程开始")
...@@ -43,17 +43,17 @@ Page({ ...@@ -43,17 +43,17 @@ Page({
'package': payParam.packageValue, 'package': payParam.packageValue,
'signType': payParam.signType, 'signType': payParam.signType,
'paySign': payParam.paySign, 'paySign': payParam.paySign,
'success': function (res) { 'success': function(res) {
console.log("支付过程成功") console.log("支付过程成功")
that.setData({ that.setData({
status: true status: true
}); });
}, },
'fail': function (res) { 'fail': function(res) {
console.log("支付过程失败") console.log("支付过程失败")
util.showErrorToast('支付失败'); util.showErrorToast('支付失败');
}, },
'complete': function (res) { 'complete': function(res) {
console.log("支付过程结束") console.log("支付过程结束")
} }
}); });
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
<view class="error" wx:if="{{!status}}"> <view class="error" wx:if="{{!status}}">
<view class="msg">付款失败</view> <view class="msg">付款失败</view>
<view class="tips"> <view class="tips">
<view class="p">请在 <text class="time">半小时</text> 内完成付款</view> <view class="p">请在
<text class="time">半小时</text> 内完成付款</view>
<view class="p">否则订单将会被系统取消</view> <view class="p">否则订单将会被系统取消</view>
</view> </view>
<view class="btns"> <view class="btns">
......
...@@ -33,7 +33,7 @@ page { ...@@ -33,7 +33,7 @@ page {
width: 200rpx; width: 200rpx;
line-height: 78rpx; line-height: 78rpx;
border: 1px solid #868686; border: 1px solid #868686;
color: #000000; color: #000;
border-radius: 5rpx; border-radius: 5rpx;
} }
...@@ -56,4 +56,4 @@ page { ...@@ -56,4 +56,4 @@ page {
.pay-result .error .tips .p { .pay-result .error .tips .p {
line-height: 42rpx; line-height: 42rpx;
text-align: center; text-align: center;
} }
\ No newline at end of file
...@@ -3,197 +3,197 @@ var api = require('../../config/api.js'); ...@@ -3,197 +3,197 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
keywrod: '', keywrod: '',
searchStatus: false, searchStatus: false,
goodsList: [], goodsList: [],
helpKeyword: [], helpKeyword: [],
historyKeyword: [], historyKeyword: [],
categoryFilter: false, categoryFilter: false,
currentSort: 'name', currentSort: 'name',
currentSortType: 'default', currentSortType: 'default',
currentSortOrder: 'desc', currentSortOrder: 'desc',
filterCategory: [], filterCategory: [],
defaultKeyword: {}, defaultKeyword: {},
hotKeyword: [], hotKeyword: [],
page: 1, page: 1,
size: 20, size: 20,
categoryId: 0 categoryId: 0
}, },
//事件处理函数 //事件处理函数
closeSearch: function() { closeSearch: function() {
wx.navigateBack() wx.navigateBack()
}, },
clearKeyword: function() { clearKeyword: function() {
this.setData({ this.setData({
keyword: '', keyword: '',
searchStatus: false 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
}); });
} },
}); onLoad: function() {
}, this.getSearchKeyword();
},
inputChange: function(e) {
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({ inputChange: function(e) {
keyword: e.detail.value,
searchStatus: false
});
if (e.detail.value) { this.setData({
this.getHelpKeyword(); keyword: e.detail.value,
} searchStatus: false
},
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
}); });
}
}); if (e.detail.value) {
}, this.getHelpKeyword();
}
inputFocus: function() { },
this.setData({
searchStatus: false, getHelpKeyword: function() {
goodsList: [] let that = this;
}); util.request(api.SearchHelper, {
keyword: that.data.keyword
if (this.data.keyword) { }).then(function(res) {
this.getHelpKeyword(); if (res.errno === 0) {
} that.setData({
}, helpKeyword: res.data
});
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
}); });
} },
//重新获取关键词 inputFocus: function() {
that.getSearchKeyword(); this.setData({
}); searchStatus: false,
}, goodsList: []
onKeywordTap: function(event) { });
this.getSearchResult(event.target.dataset.keyword); if (this.data.keyword) {
this.getHelpKeyword();
}
},
}, clearHistory: function() {
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':
this.setData({ this.setData({
categoryFilter: !this.data.categoryFilter, historyKeyword: []
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
}); });
break;
case 'priceSort': util.request(api.SearchClearHistory, {}, 'POST')
let tmpSortOrder = 'asc'; .then(function(res) {
if (this.data.currentSortOrder == 'asc') { console.log('清除成功');
tmpSortOrder = 'desc'; });
},
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({ this.setData({
currentSortType: 'price', keyword: keyword,
currentSort: 'retail_price', page: 1,
currentSortOrder: tmpSortOrder, categoryId: 0,
categoryFilter: false goodsList: []
}); });
this.getGoodsList(); 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({ this.setData({
currentSortType: 'default', filterCategory: filterCategory,
currentSort: 'name', categoryFilter: false,
currentSortOrder: 'desc', categoryId: currentCategory.id,
categoryFilter: false, page: 1,
categoryId: 0, goodsList: []
}); });
this.getGoodsList(); 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
{ {
"navigationBarTitleText": "搜索", "navigationBarTitleText": "搜索",
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }
\ No newline at end of file
<scroll-view class="container" style="height: 100%;"> <scroll-view class="container" style="height: 100%;">
<view class="search-header"> <view class="search-header">
<view class="input-box"> <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> <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}}" /> <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> <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>
<view class="right" bindtap="closeSearch">取消</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> </view>
</view> <view class="no-search" wx:if="{{ !searchStatus}}">
<view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}">
<view class="search-result" wx:if="{{ searchStatus && goodsList.length}}"> <view class="h">
<view class="sort"> <text class="title">历史记录</text>
<view class="sort-box"> <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 class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort"> </view>
<text class="txt">综合</text> <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>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<text class="txt">价格</text> <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>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" id="categoryFilter"> <view class="shelper-list" wx:if="{{keyword}}">
<text class="txt">分类</text> <view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
</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>
<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>
<view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}"> <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> <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> <text class="text">您寻找的商品还未上架</text>
</view> </view>
</scroll-view> </scroll-view>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment