Commit 20b97ec8 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-wx]: 使用微信开发者工具的格式化代码

parent 822d5075
...@@ -20,59 +20,59 @@ Page({ ...@@ -20,59 +20,59 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
this.getGrouponList(); this.getGrouponList();
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
getGrouponList: function () { getGrouponList: function() {
let that = this; let that = this;
that.setData({ that.setData({
...@@ -87,7 +87,10 @@ Page({ ...@@ -87,7 +87,10 @@ Page({
duration: 2000 duration: 2000
}); });
util.request(api.GroupOnList, { page: that.data.page, size: that.data.size }).then(function (res) { util.request(api.GroupOnList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
...@@ -101,7 +104,7 @@ Page({ ...@@ -101,7 +104,7 @@ Page({
}); });
}, },
nextPage: function (event) { nextPage: function(event) {
var that = this; var that = this;
if (this.data.page > that.data.count / that.data.size) { if (this.data.page > that.data.count / that.data.size) {
return true; return true;
...@@ -115,7 +118,7 @@ Page({ ...@@ -115,7 +118,7 @@ Page({
this.getTopic(); this.getTopic();
}, },
prevPage: function (event) { prevPage: function(event) {
if (this.data.page <= 1) { if (this.data.page <= 1) {
return false; return false;
} }
......
page ,.container{ page, .container {
width: 750rpx; width: 750rpx;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
background: #f4f4f4; background: #f4f4f4;
} }
.groupon-list{
width: 750rpx; .groupon-list {
height: 100%; width: 750rpx;
overflow: hidden; height: 100%;
background: #f4f4f4; overflow: hidden;
background: #f4f4f4;
} }
.groupon-list .item { .groupon-list .item {
height: 244rpx; height: 244rpx;
width: 100%; width: 100%;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.groupon-list .img { .groupon-list .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;
} }
.groupon-list .right { .groupon-list .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;
} }
.groupon-list .text { .groupon-list .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;
} }
.groupon-list .name { .groupon-list .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;
} }
.groupon-list .capsule-tag { .groupon-list .capsule-tag {
float: right; float: right;
padding-right: 0rpx; padding-right: 0rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.groupon-list .zan-capsule + .zan-capsule { .groupon-list .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.groupon-list .desc { .groupon-list .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;
} }
.groupon-list .price { .groupon-list .price {
width: 476rpx; width: 476rpx;
display: flex; display: flex;
color: #AB956D; color: #ab956d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
.groupon-list .counterPrice { .groupon-list .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
} }
.groupon-list .retailPrice { .groupon-list .retailPrice {
margin-left: 30rpx; margin-left: 30rpx;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }
.page{ .page {
width: 750rpx; width: 750rpx;
height: 108rpx; height: 108rpx;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.page view{ .page view {
height: 108rpx; height: 108rpx;
width: 50%; width: 50%;
float: left; float: left;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
text-align: center; text-align: center;
line-height: 108rpx; line-height: 108rpx;
} }
.page .prev{ .page .prev {
border-right: 1px solid #D9D9D9; border-right: 1px solid #d9d9d9;
} }
.page .disabled{ .page .disabled {
color: #ccc; color: #ccc;
} }
\ No newline at end of file
...@@ -2,51 +2,51 @@ var util = require('../../../utils/util.js'); ...@@ -2,51 +2,51 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
Page({ Page({
data: { data: {
orderList: [], orderList: [],
showType: 0 showType: 0
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
onPullDownRefresh() { onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList(); this.getOrderList();
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getOrderList() { getOrderList() {
let that = this; let that = this;
util.request(api.GroupOnMy, { util.request(api.GroupOnMy, {
showType: that.data.showType showType: that.data.showType
}).then(function(res) { }).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
orderList: res.data.data orderList: res.data.data
});
}
}); });
} },
}); switchTab: function(event) {
}, let showType = event.currentTarget.dataset.index;
switchTab: function(event) { this.setData({
let showType = event.currentTarget.dataset.index; showType: showType
this.setData({ });
showType: showType this.getOrderList();
}); },
this.getOrderList(); onReady: function() {
}, // 页面渲染完成
onReady: function() { },
// 页面渲染完成 onShow: function() {
}, // 页面显示
onShow: function() { this.getOrderList();
// 页面显示 },
this.getOrderList(); onHide: function() {
}, // 页面隐藏
onHide: function() { },
// 页面隐藏 onUnload: function() {
}, // 页面关闭
onUnload: function() { }
// 页面关闭
}
}) })
\ No newline at end of file
{ {
"navigationBarTitleText": "我的团购", "navigationBarTitleText": "我的团购",
"usingComponents": { "usingComponents": {
"zan-capsule": "../../../lib/zanui-weapp/capsule/index" "zan-capsule": "../../../lib/zanui-weapp/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;
} }
...@@ -18,9 +18,9 @@ Page({ ...@@ -18,9 +18,9 @@ Page({
page: 1, page: 1,
size: 100 size: 100
}, },
getBanner: function () { getBanner: function() {
let that = this; let that = this;
util.request(api.GoodsHot).then(function (res) { util.request(api.GoodsHot).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
bannerInfo: res.data.bannerInfo, bannerInfo: res.data.bannerInfo,
...@@ -28,23 +28,32 @@ Page({ ...@@ -28,23 +28,32 @@ Page({
} }
}); });
}, },
getCategoryList: function(){ getCategoryList: function() {
var that = this; var that = this;
util.request(api.GoodsFilter, { isHot: 1 }) util.request(api.GoodsFilter, {
.then(function (res) { isHot: 1
})
.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, { isHot: true, page: that.data.page, size: that.data.size, order: that.data.currentSortOrder, sort: that.data.currentSort, categoryId: that.data.categoryId}) util.request(api.GoodsList, {
.then(function (res) { 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) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
...@@ -52,29 +61,29 @@ Page({ ...@@ -52,29 +61,29 @@ Page({
}); });
} }
}); });
}, },
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':
...@@ -111,7 +120,7 @@ Page({ ...@@ -111,7 +120,7 @@ Page({
this.getGoodsList(); this.getGoodsList();
} }
}, },
selectCategory: function(event){ selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex; let currentIndex = event.target.dataset.categoryIndex;
this.setData({ this.setData({
'categoryFilter': false, 'categoryFilter': false,
......
...@@ -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,113 +6,113 @@ const user = require('../../utils/user.js'); ...@@ -6,113 +6,113 @@ 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: 'litemall小程序商场', title: 'litemall小程序商场',
desc: '开源微信小程序商城', desc: '开源微信小程序商城',
path: '/pages/index/index' path: '/pages/index/index'
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
this.getIndexData(); this.getIndexData();
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getIndexData: function() { getIndexData: function() {
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
});
}
}); });
} },
}); onLoad: function(options) {
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
if (options.scene) { if (options.scene) {
//这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页 //这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页
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) {
//这个goodId的值存在则证明首页的开启来源于分享,同时可以通过获取到的goodId的值跳转导航到对应的详情页 //这个goodId的值存在则证明首页的开启来源于分享,同时可以通过获取到的goodId的值跳转导航到对应的详情页
wx.navigateTo({ wx.navigateTo({
url: '../goods/goods?id=' + options.goodId url: '../goods/goods?id=' + options.goodId
}); });
} }
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
if (options.orderId) { if (options.orderId) {
//这个orderId的值存在则证明首页的开启来源于订单模版通知,同时可以通过获取到的pageId的值跳转导航到对应的详情页 //这个orderId的值存在则证明首页的开启来源于订单模版通知,同时可以通过获取到的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": "../../lib/zanui-weapp/capsule/index" "zan-capsule": "../../lib/zanui-weapp/capsule/index"
} }
} }
\ No newline at end of file
<!--index.wxml--> <!--index.wxml-->
<view class="container"> <view class="container">
<swiper class="banner" indicator-dots="true" autoplay="true" interval="3000" duration="1000"> <swiper class="banner" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{banner}}" wx:key="id"> <swiper-item wx:for="{{banner}}" wx:key="id">
<!-- <navigator url="{{item.link}}"> --> <!-- <navigator url="{{item.link}}"> -->
<image src="{{item.url}}" background-size="cover"></image> <image src="{{item.url}}" background-size="cover"></image>
<!-- </navigator> --> <!-- </navigator> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="m-menu"> <view class="m-menu">
<navigator class="item" url="/pages/category/category?id={{item.id}}" wx:for="{{channel}}" wx:key="id"> <navigator class="item" url="/pages/category/category?id={{item.id}}" wx:for="{{channel}}" wx:key="id">
<image src="{{item.iconUrl}}" background-size="cover"></image> <image src="{{item.iconUrl}}" background-size="cover"></image>
<text>{{item.name}}</text> <text>{{item.name}}</text>
</navigator> </navigator>
</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 class="b">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <view class="a-section a-groupon" wx:if="{{groupons.length > 0}}">
<navigator url="/pages/goods/goods?id={{item.goods.id}}"> <view class="h">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image> <view class="title">
<view class="right"> <view>
<view class="text"> <navigator url="/pages/groupon/grouponList/grouponList">
<view class="header"> <text class="txt">团购专区</text>
<text class="name">{{item.goods.name}}</text> </navigator>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
</view> </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>
</view> </view>
</navigator> <view class="b">
</view> <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>
</view> </view>
</view>
<view class="a-section a-brand"> <view class="a-section a-brand">
<view class="h"> <view class="h">
<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="b">
<view class="item item-1" wx:for="{{brands}}" wx:key="id"> <view class="item item-1" wx:for="{{brands}}" wx:key="id">
<navigator url="/pages/brandDetail/brandDetail?id={{item.id}}"> <navigator url="/pages/brandDetail/brandDetail?id={{item.id}}">
<view class="wrap"> <view class="wrap">
<image class="img" src="{{item.picUrl}}" mode="aspectFill"></image> <image class="img" src="{{item.picUrl}}" mode="aspectFill"></image>
<view class="mt"> <view class="mt">
<text class="brand">{{item.name}}</text> <text class="brand">{{item.name}}</text>
<text class="price">{{item.floorPrice}}</text> <text class="price">{{item.floorPrice}}</text>
<text class="unit">元起</text> <text class="unit">元起</text>
</view>
</view>
</navigator>
</view> </view>
</view> </view>
</navigator>
</view>
</view>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h">
<view>
<navigator url="../newGoods/newGoods">
<text class="txt">周一周四 · 新品首发</text>
</navigator>
</view>
</view> </view>
<view class="b"> <view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="item" wx:for="{{newGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <view class="h">
<navigator url="../goods/goods?id={{item.id}}"> <view>
<image class="img" src="{{item.picUrl}}" background-size="cover"></image> <navigator url="../newGoods/newGoods">
<text class="name">{{item.name}}</text> <text class="txt">周一周四 · 新品首发</text>
<text class="price">¥{{item.retailPrice}}</text> </navigator>
</navigator> </view>
</view> </view>
<view class="b">
<view class="item" wx:for="{{newGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="../goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<text class="name">{{item.name}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</navigator>
</view>
</view>
</view> </view>
</view>
<view class="a-section a-popular" wx:if="{{hotGoods.length > 0}}"> <view class="a-section a-popular" wx:if="{{hotGoods.length > 0}}">
<view class="h"> <view class="h">
<view> <view>
<navigator url="../hotGoods/hotGoods"> <navigator url="../hotGoods/hotGoods">
<text class="txt">人气推荐</text> <text class="txt">人气推荐</text>
</navigator> </navigator>
</view>
</view>
<view class="b">
<view class="item" wx:for="{{hotGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<text class="name">{{item.name}}</text>
<text class="desc">{{item.brief}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</view> </view>
</view> </view>
</navigator> <view class="b">
</view> <view class="item" wx:for="{{hotGoods}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<text class="name">{{item.name}}</text>
<text class="desc">{{item.brief}}</text>
<text class="price">¥{{item.retailPrice}}</text>
</view>
</view>
</navigator>
</view>
</view>
</view> </view>
</view>
<view class="a-section a-topic" wx:if="topics.length > 0"> <view class="a-section a-topic" wx:if="topics.length > 0">
<view class="h"> <view class="h">
<view> <view>
<navigator url="/pages/topic/topic"> <navigator url="/pages/topic/topic">
<text class="txt">专题精选</text> <text class="txt">专题精选</text>
</navigator> </navigator>
</view>
</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>
<text class="price">¥{{item.price}}元起</text>
</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>
<text class="price">¥{{item.price}}元起</text>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
</view>
</view> </view>
</view> <view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id"> <view class="h">
<view class="h">
<text>{{item.name}}</text> <text>{{item.name}}</text>
</view>
<view class="b">
<block wx:for="{{item.goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="id">
<view class="item {{iindex % 2 == 0 ? '' : 'item-b'}}">
<navigator url="../goods/goods?id={{iitem.id}}" class="a">
<image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
<text class="name">{{iitem.name}}</text>
<text class="price">¥{{iitem.retailPrice}}</text>
</navigator>
</view> </view>
</block> <view class="b">
<block wx:for="{{item.goodsList}}" wx:for-index="iindex" wx:for-item="iitem" wx:key="id">
<view class="item {{iindex % 2 == 0 ? '' : 'item-b'}}">
<navigator url="../goods/goods?id={{iitem.id}}" class="a">
<image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
<text class="name">{{iitem.name}}</text>
<text class="price">¥{{iitem.retailPrice}}</text>
</navigator>
</view>
</block>
</view>
<navigator url="/pages/category/category?id={{item.id}}" class="t">
<view class="txt">{{'更多'+item.name+'好物 >'}}</view>
</navigator>
</view> </view>
<navigator url="/pages/category/category?id={{item.id}}" class="t">
<view class="txt">{{'更多'+item.name+'好物 >'}}</view>
</navigator>
</view>
</view> </view>
\ No newline at end of file
...@@ -9,20 +9,15 @@ ...@@ -9,20 +9,15 @@
} }
.m-menu { .m-menu {
/* border: 1px solid black; */
/* height: 280rpx; */
background: #fff; background: #fff;
/* padding: 0 25rpx; */
display: flex; display: flex;
/* justify-content: center; */
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: 0rpx; padding-bottom: 0rpx;
padding-top: 25rpx padding-top: 25rpx;
} }
.m-menu .item { .m-menu .item {
/* border: 1px solid black; */
width: 150rpx; width: 150rpx;
height: 126rpx; height: 126rpx;
} }
...@@ -116,7 +111,7 @@ ...@@ -116,7 +111,7 @@
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;
} }
...@@ -127,89 +122,89 @@ ...@@ -127,89 +122,89 @@
} }
.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: #AB956D; color: #ab956d;
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;
} }
.a-new .b { .a-new .b {
...@@ -252,7 +247,7 @@ ...@@ -252,7 +247,7 @@
text-align: center; text-align: center;
line-height: 30rpx; line-height: 30rpx;
font-size: 30rpx; font-size: 30rpx;
color: #AB956D; color: #ab956d;
} }
.a-popular { .a-popular {
...@@ -313,7 +308,7 @@ ...@@ -313,7 +308,7 @@
.a-popular .b .price { .a-popular .b .price {
width: 456rpx; width: 456rpx;
display: block; display: block;
color: #AB956D; color: #ab956d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
...@@ -357,7 +352,7 @@ ...@@ -357,7 +352,7 @@
.a-topic .b .np .price { .a-topic .b .np .price {
margin-left: 20.8rpx; margin-left: 20.8rpx;
color: #AB956D; color: #ab956d;
} }
.a-topic .b .desc { .a-topic .b .desc {
...@@ -367,7 +362,7 @@ ...@@ -367,7 +362,7 @@
font-size: 24rpx; font-size: 24rpx;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
.good-grid { .good-grid {
...@@ -403,7 +398,7 @@ ...@@ -403,7 +398,7 @@
text-align: center; text-align: center;
} }
.good-grid .b .item .a{ .good-grid .b .item .a {
height: 452rpx; height: 452rpx;
width: 100%; width: 100%;
} }
...@@ -436,7 +431,7 @@ ...@@ -436,7 +431,7 @@
height: 30rpx; height: 30rpx;
text-align: center; text-align: center;
font-size: 30rpx; font-size: 30rpx;
color: #AB956D; color: #ab956d;
} }
.good-grid .t { .good-grid .t {
......
...@@ -18,9 +18,9 @@ Page({ ...@@ -18,9 +18,9 @@ Page({
page: 1, page: 1,
size: 100 size: 100
}, },
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,
...@@ -31,8 +31,15 @@ Page({ ...@@ -31,8 +31,15 @@ Page({
getGoodsList: function() { getGoodsList: function() {
var that = this; 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 }) util.request(api.GoodsList, {
.then(function (res) { 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) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
...@@ -41,27 +48,27 @@ Page({ ...@@ -41,27 +48,27 @@ Page({
} }
}); });
}, },
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':
...@@ -98,7 +105,7 @@ Page({ ...@@ -98,7 +105,7 @@ Page({
this.getGoodsList(); this.getGoodsList();
} }
}, },
selectCategory: function (event) { selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex; let currentIndex = event.target.dataset.categoryIndex;
this.setData({ this.setData({
'categoryFilter': false, 'categoryFilter': false,
......
...@@ -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
...@@ -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() {
// 页面关闭 // 页面关闭
}, },
...@@ -57,7 +57,7 @@ Page({ ...@@ -57,7 +57,7 @@ Page({
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("支付过程开始")
...@@ -67,17 +67,17 @@ Page({ ...@@ -67,17 +67,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
...@@ -21,23 +21,23 @@ Page({ ...@@ -21,23 +21,23 @@ Page({
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 () { onLoad: function() {
this.getSearchKeyword(); this.getSearchKeyword();
}, },
getSearchKeyword() { getSearchKeyword() {
let that = this; let that = this;
util.request(api.SearchIndex).then(function (res) { util.request(api.SearchIndex).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
historyKeyword: res.data.historyKeywordList, historyKeyword: res.data.historyKeywordList,
...@@ -48,7 +48,7 @@ Page({ ...@@ -48,7 +48,7 @@ Page({
}); });
}, },
inputChange: function (e) { inputChange: function(e) {
this.setData({ this.setData({
keyword: e.detail.value, keyword: e.detail.value,
searchStatus: false searchStatus: false
...@@ -58,7 +58,7 @@ Page({ ...@@ -58,7 +58,7 @@ Page({
this.getHelpKeyword(); this.getHelpKeyword();
} }
}, },
getHelpKeyword: function () { getHelpKeyword: function() {
let that = this; let that = this;
util.request(api.SearchHelper, { util.request(api.SearchHelper, {
keyword: that.data.keyword keyword: that.data.keyword
...@@ -70,7 +70,7 @@ Page({ ...@@ -70,7 +70,7 @@ Page({
} }
}); });
}, },
inputFocus: function () { inputFocus: function() {
this.setData({ this.setData({
searchStatus: false, searchStatus: false,
goodsList: [] goodsList: []
...@@ -80,17 +80,17 @@ Page({ ...@@ -80,17 +80,17 @@ Page({
this.getHelpKeyword(); this.getHelpKeyword();
} }
}, },
clearHistory: function () { clearHistory: function() {
this.setData({ this.setData({
historyKeyword: [] historyKeyword: []
}) })
util.request(api.SearchClearHistory, {}, 'POST') util.request(api.SearchClearHistory, {}, 'POST')
.then(function (res) { .then(function(res) {
console.log('清除成功'); console.log('清除成功');
}); });
}, },
getGoodsList: function () { getGoodsList: function() {
let that = this; let that = this;
util.request(api.GoodsList, { util.request(api.GoodsList, {
keyword: that.data.keyword, keyword: that.data.keyword,
...@@ -113,7 +113,7 @@ Page({ ...@@ -113,7 +113,7 @@ Page({
that.getSearchKeyword(); that.getSearchKeyword();
}); });
}, },
onKeywordTap: function (event) { onKeywordTap: function(event) {
this.getSearchResult(event.target.dataset.keyword); this.getSearchResult(event.target.dataset.keyword);
......
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