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

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

parent 822d5075
......@@ -20,59 +20,59 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
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;
that.setData({
......@@ -87,7 +87,10 @@ Page({
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) {
that.setData({
......@@ -101,7 +104,7 @@ Page({
});
},
nextPage: function (event) {
nextPage: function(event) {
var that = this;
if (this.data.page > that.data.count / that.data.size) {
return true;
......@@ -115,7 +118,7 @@ Page({
this.getTopic();
},
prevPage: function (event) {
prevPage: function(event) {
if (this.data.page <= 1) {
return false;
}
......
page ,.container{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
page, .container {
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.groupon-list{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
.groupon-list {
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.groupon-list .item {
height: 244rpx;
width: 100%;
background: #fff;
margin-bottom: 20rpx;
height: 244rpx;
width: 100%;
background: #fff;
margin-bottom: 20rpx;
}
.groupon-list .img {
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
}
.groupon-list .right {
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
}
.groupon-list .text {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
}
.groupon-list .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
}
.groupon-list .capsule-tag {
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
}
.groupon-list .zan-capsule + .zan-capsule {
margin-left: 10px;
margin-left: 10px;
}
.groupon-list .desc {
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
}
.groupon-list .price {
width: 476rpx;
display: flex;
color: #AB956D;
line-height: 50rpx;
font-size: 33rpx;
width: 476rpx;
display: flex;
color: #ab956d;
line-height: 50rpx;
font-size: 33rpx;
}
.groupon-list .counterPrice {
text-decoration: line-through;
font-size: 28rpx;
color: #999;
text-decoration: line-through;
font-size: 28rpx;
color: #999;
}
.groupon-list .retailPrice {
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
}
.page{
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
.page {
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
}
.page view{
height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
.page view {
height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
}
.page .prev{
border-right: 1px solid #D9D9D9;
.page .prev {
border-right: 1px solid #d9d9d9;
}
.page .disabled{
color: #ccc;
}
\ No newline at end of file
.page .disabled {
color: #ccc;
}
......@@ -2,51 +2,51 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
Page({
data: {
orderList: [],
showType: 0
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
data: {
orderList: [],
showType: 0
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getOrderList() {
let that = this;
util.request(api.GroupOnMy, {
showType: that.data.showType
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderList: res.data.data
getOrderList() {
let that = this;
util.request(api.GroupOnMy, {
showType: that.data.showType
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderList: res.data.data
});
}
});
}
});
},
switchTab: function(event) {
let showType = event.currentTarget.dataset.index;
this.setData({
showType: showType
});
this.getOrderList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
},
switchTab: function(event) {
let showType = event.currentTarget.dataset.index;
this.setData({
showType: showType
});
this.getOrderList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})
\ No newline at end of file
{
"navigationBarTitleText": "我的团购",
"usingComponents": {
"zan-capsule": "../../../lib/zanui-weapp/capsule/index"
}
"navigationBarTitleText": "我的团购",
"usingComponents": {
"zan-capsule": "../../../lib/zanui-weapp/capsule/index"
}
}
\ No newline at end of file
<view class="container">
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
</view>
<view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view>
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view>
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text>
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view>
<view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view>
</navigator>
</view>
</view>
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view>
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
</view>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view>
</view>
</navigator>
</view>
</view>
\ No newline at end of file
page {
height: 100%;
width: 100%;
background: #f4f4f4;
height: 100%;
width: 100%;
background: #f4f4f4;
}
.capsule-tag {
float: right;
/* padding-right: 10rpx; */
float: right;
/* padding-right: 10rpx; */
}
.zan-capsule + .zan-capsule {
margin-left: 5px;
margin-left: 5px;
}
.orders-switch {
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid #a78845;
width: 100%;
background: #fff;
height: 84rpx;
border-bottom: 1px solid #a78845;
}
.orders-switch .item {
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
}
.orders-switch .item .txt {
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 100%;
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 100%;
}
.orders-switch .item.active .txt {
color: #a78845;
border-bottom: 4rpx solid #a78845;
color: #a78845;
border-bottom: 4rpx solid #a78845;
}
.no-order {
width: 100%;
height: auto;
margin: 0 auto;
width: 100%;
height: auto;
margin: 0 auto;
}
.no-order .c {
width: 100%;
height: auto;
margin-top: 200rpx;
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-order .c image {
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
margin: 0 auto;
display: block;
text-align: center;
width: 258rpx;
height: 258rpx;
}
.no-order .c text {
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
margin: 0 auto;
display: block;
width: 258rpx;
height: 29rpx;
line-height: 29rpx;
text-align: center;
font-size: 29rpx;
color: #999;
}
.orders {
height: auto;
width: 100%;
overflow: hidden;
height: auto;
width: 100%;
overflow: hidden;
}
.order {
margin-top: 20rpx;
background: #fff;
margin-top: 20rpx;
background: #fff;
}
.order .h {
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .h .l {
float: left;
color: #a78845;
font-size: 26rpx;
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .h .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .i {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
}
.order .i .l {
float: left;
color: #a78845;
font-size: 26rpx;
float: left;
color: #a78845;
font-size: 26rpx;
}
.order .i .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .j {
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
height: 56rpx;
line-height: 56rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
}
.order .j .l {
float: left;
font-size: 26rpx;
color: #a78845;
float: left;
font-size: 26rpx;
color: #a78845;
}
.order .j .r {
float: right;
color: #a78845;
font-size: 26rpx;
float: right;
color: #a78845;
font-size: 26rpx;
}
.order .goods {
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
}
.order .goods .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.order .goods .img image {
height: 145.83rpx;
width: 145.83rpx;
height: 145.83rpx;
width: 145.83rpx;
}
.order .goods .info {
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
}
.order .goods .name {
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
}
.order .goods .number {
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
}
.order .goods .status {
width: 105rpx;
color: #a78845;
font-size: 25rpx;
width: 105rpx;
color: #a78845;
font-size: 25rpx;
}
.order .b {
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
height: 103rpx;
line-height: 103rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
}
.order .b .l {
float: left;
float: left;
}
.order .b .r {
float: right;
float: right;
}
.order .b .btn {
margin-top: 19rpx;
height: 64.5rpx;
line-height: 64.5rpx;
text-align: center;
padding: 0 20rpx;
border-radius: 5rpx;
font-size: 28rpx;
color: #fff;
background: #a78845;
margin-top: 19rpx;
height: 64.5rpx;
line-height: 64.5rpx;
text-align: center;
padding: 0 20rpx;
border-radius: 5rpx;
font-size: 28rpx;
color: #fff;
background: #a78845;
}
......@@ -18,9 +18,9 @@ Page({
page: 1,
size: 100
},
getBanner: function () {
getBanner: function() {
let that = this;
util.request(api.GoodsHot).then(function (res) {
util.request(api.GoodsHot).then(function(res) {
if (res.errno === 0) {
that.setData({
bannerInfo: res.data.bannerInfo,
......@@ -28,23 +28,32 @@ Page({
}
});
},
getCategoryList: function(){
getCategoryList: function() {
var that = this;
util.request(api.GoodsFilter, { isHot: 1 })
.then(function (res) {
util.request(api.GoodsFilter, {
isHot: 1
})
.then(function(res) {
if (res.errno === 0) {
that.setData({
filterCategory: res.data.filterCategoryList,
});
}
});
});
},
getGoodsList: function (){
getGoodsList: function() {
var that = this;
util.request(api.GoodsList, { isHot: true, page: that.data.page, size: that.data.size, order: that.data.currentSortOrder, sort: that.data.currentSort, categoryId: that.data.categoryId})
.then(function (res) {
util.request(api.GoodsList, {
isHot: true,
page: that.data.page,
size: that.data.size,
order: that.data.currentSortOrder,
sort: that.data.currentSort,
categoryId: that.data.categoryId
})
.then(function(res) {
if (res.errno === 0) {
that.setData({
goodsList: res.data.goodsList,
......@@ -52,29 +61,29 @@ Page({
});
}
});
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
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;
switch (currentId) {
case 'categoryFilter':
......@@ -111,7 +120,7 @@ Page({
this.getGoodsList();
}
},
selectCategory: function(event){
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({
'categoryFilter': false,
......
......@@ -12,7 +12,7 @@
</view>
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
......
page{
background: #f4f4f4;
page {
background: #f4f4f4;
}
.brand-info .name{
width: 100%;
height: 278rpx;
position: relative;
.brand-info .name {
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
.brand-info .img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.brand-info .info-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.brand-info .info{
display: block;
.brand-info .info {
display: block;
}
.brand-info .txt{
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
.brand-info .txt {
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line{
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
.brand-info .line {
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
}
.sort{
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
.sort {
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box{
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item{
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:1;
color: #333;
font-size: 30rpx;
.sort-box .item {
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex: 1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt{
display: block;
width: 100%;
height: 100%;
color: #333;
.sort-box .item .txt {
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt{
color: #b4282d;
.sort-box .item.active .txt {
color: #b4282d;
}
.sort-box .item.by-price{
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.asc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.desc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box-category{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
.sort-box-category {
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
}
.sort-box-category .item.active{
color: #b4282d;
border: 1px solid #b4282d;
.sort-box-category .item.active {
color: #b4282d;
border: 1px solid #b4282d;
}
.cate-item .b{
.cate-item .b {
width: 750rpx;
height: auto;
overflow: hidden;
......@@ -134,7 +134,7 @@ page{
margin-top: 20rpx;
}
.cate-item .b .item{
.cate-item .b .item {
float: left;
background: #fff;
width: 375rpx;
......@@ -145,17 +145,17 @@ page{
text-align: center;
}
.cate-item .b .item-b{
border-right: 1rpx solid #f4f4f4;
.cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img{
margin-top: 10rpx;
.cate-item .item .img {
margin-top: 10rpx;
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name{
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 35rpx;
......@@ -167,11 +167,11 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
font-size: 30rpx;
color: #b4282d;
}
\ No newline at end of file
}
......@@ -6,113 +6,113 @@ const user = require('../../utils/user.js');
const app = getApp();
Page({
data: {
newGoods: [],
hotGoods: [],
topics: [],
brands: [],
groupons: [],
floorGoods: [],
banner: [],
channel: []
},
data: {
newGoods: [],
hotGoods: [],
topics: [],
brands: [],
groupons: [],
floorGoods: [],
banner: [],
channel: []
},
onShareAppMessage: function() {
return {
title: 'litemall小程序商场',
desc: '开源微信小程序商城',
path: '/pages/index/index'
}
},
onShareAppMessage: function() {
return {
title: 'litemall小程序商场',
desc: '开源微信小程序商城',
path: '/pages/index/index'
}
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getIndexData();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getIndexData();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getIndexData: function() {
let that = this;
util.request(api.IndexUrl).then(function(res) {
if (res.errno === 0) {
that.setData({
newGoods: res.data.newGoodsList,
hotGoods: res.data.hotGoodsList,
topics: res.data.topicList,
brands: res.data.brandList,
floorGoods: res.data.floorGoodsList,
banner: res.data.banner,
groupons: res.data.grouponList,
channel: res.data.channel
getIndexData: function() {
let that = this;
util.request(api.IndexUrl).then(function(res) {
if (res.errno === 0) {
that.setData({
newGoods: res.data.newGoodsList,
hotGoods: res.data.hotGoodsList,
topics: res.data.topicList,
brands: res.data.brandList,
floorGoods: res.data.floorGoodsList,
banner: res.data.banner,
groupons: res.data.grouponList,
channel: res.data.channel
});
}
});
}
});
},
onLoad: function(options) {
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
if (options.scene) {
//这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页
var scene = decodeURIComponent(options.scene);
console.log("scene:" + scene);
// 页面初始化 options为页面跳转所带来的参数
if (options.scene) {
//这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页
var scene = decodeURIComponent(options.scene);
console.log("scene:" + scene);
let info_arr = [];
info_arr = scene.split(',');
let _type = info_arr[0];
let id = info_arr[1];
let info_arr = [];
info_arr = scene.split(',');
let _type = info_arr[0];
let id = info_arr[1];
if (_type == 'goods') {
wx.navigateTo({
url: '../goods/goods?id=' + id
});
} else if (_type == 'groupon') {
wx.navigateTo({
url: '../goods/goods?grouponId=' + id
});
} else {
wx.navigateTo({
url: '../index/index'
});
}
}
if (_type == 'goods') {
wx.navigateTo({
url: '../goods/goods?id=' + id
});
} else if (_type == 'groupon') {
wx.navigateTo({
url: '../goods/goods?grouponId=' + id
});
} else {
wx.navigateTo({
url: '../index/index'
});
}
}
// 页面初始化 options为页面跳转所带来的参数
if (options.grouponId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?grouponId=' + options.grouponId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.grouponId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?grouponId=' + options.grouponId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.goodId) {
//这个goodId的值存在则证明首页的开启来源于分享,同时可以通过获取到的goodId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?id=' + options.goodId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.goodId) {
//这个goodId的值存在则证明首页的开启来源于分享,同时可以通过获取到的goodId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?id=' + options.goodId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.orderId) {
//这个orderId的值存在则证明首页的开启来源于订单模版通知,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.orderId) {
//这个orderId的值存在则证明首页的开启来源于订单模版通知,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId
});
}
this.getIndexData();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
this.getIndexData();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
})
\ No newline at end of file
{
"navigationBarTitleText": "首页",
"usingComponents": {
"zan-capsule": "../../lib/zanui-weapp/capsule/index"
}
"navigationBarTitleText": "首页",
"usingComponents": {
"zan-capsule": "../../lib/zanui-weapp/capsule/index"
}
}
\ No newline at end of file
<!--index.wxml-->
<view class="container">
<swiper class="banner" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{banner}}" wx:key="id">
<!-- <navigator url="{{item.link}}"> -->
<image src="{{item.url}}" background-size="cover"></image>
<!-- </navigator> -->
</swiper-item>
</swiper>
<view class="m-menu">
<navigator class="item" url="/pages/category/category?id={{item.id}}" wx:for="{{channel}}" wx:key="id">
<image src="{{item.iconUrl}}" background-size="cover"></image>
<text>{{item.name}}</text>
</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>
<swiper class="banner" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{banner}}" wx:key="id">
<!-- <navigator url="{{item.link}}"> -->
<image src="{{item.url}}" background-size="cover"></image>
<!-- </navigator> -->
</swiper-item>
</swiper>
<view class="m-menu">
<navigator class="item" url="/pages/category/category?id={{item.id}}" wx:for="{{channel}}" wx:key="id">
<image src="{{item.iconUrl}}" background-size="cover"></image>
<text>{{item.name}}</text>
</navigator>
</view>
<view class="b">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.goods.id}}">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<view class="header">
<text class="name">{{item.goods.name}}</text>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
<view 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>
<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 class="b">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="/pages/goods/goods?id={{item.goods.id}}">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<view class="right">
<view class="text">
<view class="header">
<text class="name">{{item.goods.name}}</text>
<view class="capsule-tag">
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
</view>
</view>
<text class="desc">{{item.goods.brief}}</text>
<view class="price">
<view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view>
<view class="retailPrice">现价:¥{{item.groupon_price}}</view>
</view>
</view>
</view>
</navigator>
</view>
</view>
</view>
</view>
<view class="a-section a-brand">
<view class="h">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</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>
<text class="price">{{item.floorPrice}}</text>
<text class="unit">元起</text>
<view class="a-section a-brand">
<view class="h">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</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>
<text class="price">{{item.floorPrice}}</text>
<text class="unit">元起</text>
</view>
</view>
</navigator>
</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="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 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 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 class="a-section a-popular" wx:if="{{hotGoods.length > 0}}">
<view class="h">
<view>
<navigator url="../hotGoods/hotGoods">
<text class="txt">人气推荐</text>
</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 class="a-section a-popular" wx:if="{{hotGoods.length > 0}}">
<view class="h">
<view>
<navigator url="../hotGoods/hotGoods">
<text class="txt">人气推荐</text>
</navigator>
</view>
</view>
</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>
</navigator>
</view>
</view>
</view>
</view>
<view class="a-section a-topic" wx:if="topics.length > 0">
<view class="h">
<view>
<navigator url="/pages/topic/topic">
<text class="txt">专题精选</text>
</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 class="a-section a-topic" wx:if="topics.length > 0">
<view class="h">
<view>
<navigator url="/pages/topic/topic">
<text class="txt">专题精选</text>
</navigator>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
<view class="b">
<scroll-view scroll-x class="list">
<view class="item" wx:for="{{topics}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<navigator url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}" background-size="cover"></image>
<view class="np">
<text class="name">{{item.title}}</text>
<text class="price">¥{{item.price}}元起</text>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
</view>
</view>
</view>
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<view class="h">
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<view class="h">
<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>
</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>
<navigator url="/pages/category/category?id={{item.id}}" class="t">
<view class="txt">{{'更多'+item.name+'好物 >'}}</view>
</navigator>
</view>
</view>
\ No newline at end of file
......@@ -9,20 +9,15 @@
}
.m-menu {
/* border: 1px solid black; */
/* height: 280rpx; */
background: #fff;
/* padding: 0 25rpx; */
display: flex;
/* justify-content: center; */
align-items: center;
flex-wrap: wrap;
padding-bottom: 0rpx;
padding-top: 25rpx
padding-top: 25rpx;
}
.m-menu .item {
/* border: 1px solid black; */
width: 150rpx;
height: 126rpx;
}
......@@ -116,7 +111,7 @@
margin-left: 1rpx;
}
.a-brand .item-1:nth-child(2n+1){
.a-brand .item-1:nth-child(2n+1) {
margin-left: 0;
width: 374rpx;
}
......@@ -127,89 +122,89 @@
}
.a-groupon {
width: 750rpx;
height: auto;
overflow: hidden;
width: 750rpx;
height: auto;
overflow: hidden;
}
.a-groupon .b .item {
border-top: 1px solid #d9d9d9;
margin: 0 20rpx;
height: 244rpx;
width: 710rpx;
border-top: 1px solid #d9d9d9;
margin: 0 20rpx;
height: 244rpx;
width: 710rpx;
}
.a-groupon .b .img {
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
margin-top: 12rpx;
margin-right: 12rpx;
float: left;
width: 220rpx;
height: 220rpx;
}
.a-groupon .b .right {
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
float: left;
height: 244rpx;
width: 476rpx;
display: flex;
flex-flow: row nowrap;
}
.a-groupon .b .text {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
display: flex;
flex-wrap: nowrap;
flex-direction: column;
justify-content: center;
overflow: hidden;
height: 244rpx;
width: 476rpx;
}
.a-groupon .b .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;
font-size: 30rpx;
}
.a-groupon .capsule-tag {
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
float: right;
padding-right: 0rpx;
padding-top: 8rpx;
}
.a-groupon .zan-capsule + .zan-capsule {
margin-left: 10px;
margin-left: 10px;
}
.a-groupon .b .desc {
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
width: 476rpx;
display: block;
color: #999;
line-height: 50rpx;
font-size: 25rpx;
}
.a-groupon .b .price {
width: 476rpx;
display: flex;
color: #AB956D;
line-height: 50rpx;
font-size: 33rpx;
width: 476rpx;
display: flex;
color: #ab956d;
line-height: 50rpx;
font-size: 33rpx;
}
.a-groupon .b .counterPrice {
text-decoration: line-through;
font-size: 28rpx;
color: #999;
text-decoration: line-through;
font-size: 28rpx;
color: #999;
}
.a-groupon .b .retailPrice {
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
margin-left: 30rpx;
font-size: 28rpx;
color: #a78845;
}
.a-new .b {
......@@ -252,7 +247,7 @@
text-align: center;
line-height: 30rpx;
font-size: 30rpx;
color: #AB956D;
color: #ab956d;
}
.a-popular {
......@@ -313,7 +308,7 @@
.a-popular .b .price {
width: 456rpx;
display: block;
color: #AB956D;
color: #ab956d;
line-height: 50rpx;
font-size: 33rpx;
}
......@@ -357,7 +352,7 @@
.a-topic .b .np .price {
margin-left: 20.8rpx;
color: #AB956D;
color: #ab956d;
}
.a-topic .b .desc {
......@@ -367,7 +362,7 @@
font-size: 24rpx;
white-space: nowrap;
overflow: hidden;
text-overflow:ellipsis;
text-overflow: ellipsis;
}
.good-grid {
......@@ -403,7 +398,7 @@
text-align: center;
}
.good-grid .b .item .a{
.good-grid .b .item .a {
height: 452rpx;
width: 100%;
}
......@@ -436,7 +431,7 @@
height: 30rpx;
text-align: center;
font-size: 30rpx;
color: #AB956D;
color: #ab956d;
}
.good-grid .t {
......
......@@ -18,9 +18,9 @@ Page({
page: 1,
size: 100
},
getBanner: function () {
getBanner: function() {
let that = this;
util.request(api.GoodsNew).then(function (res) {
util.request(api.GoodsNew).then(function(res) {
if (res.errno === 0) {
that.setData({
bannerInfo: res.data.bannerInfo,
......@@ -31,8 +31,15 @@ Page({
getGoodsList: function() {
var that = this;
util.request(api.GoodsList, { isNew: true, page: that.data.page, size: that.data.size, order: that.data.currentSortOrder, sort: that.data.currentSort, categoryId: that.data.categoryId })
.then(function (res) {
util.request(api.GoodsList, {
isNew: true,
page: that.data.page,
size: that.data.size,
order: that.data.currentSortOrder,
sort: that.data.currentSort,
categoryId: that.data.categoryId
})
.then(function(res) {
if (res.errno === 0) {
that.setData({
goodsList: res.data.goodsList,
......@@ -41,27 +48,27 @@ Page({
}
});
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
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;
switch (currentId) {
case 'categoryFilter':
......@@ -98,7 +105,7 @@ Page({
this.getGoodsList();
}
},
selectCategory: function (event) {
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({
'categoryFilter': false,
......
......@@ -12,7 +12,7 @@
</view>
<view class="sort">
<view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
......
page{
background: #f4f4f4;
page {
background: #f4f4f4;
}
.brand-info .name{
width: 100%;
height: 278rpx;
position: relative;
.brand-info .name {
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
.brand-info .img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box{
position: absolute;
top:0;
left:0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.brand-info .info-box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.brand-info .info{
display: block;
.brand-info .info {
display: block;
}
.brand-info .txt{
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
.brand-info .txt {
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line{
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
.brand-info .line {
margin: 0 auto;
margin-top: 16rpx;
display: block;
height: 2rpx;
width: 145rpx;
background: #fff;
}
.sort{
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
.sort {
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box{
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
overflow: hidden;
padding: 0 30rpx;
display: flex;
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item{
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:1;
color: #333;
font-size: 30rpx;
.sort-box .item {
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex: 1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt{
display: block;
width: 100%;
height: 100%;
color: #333;
.sort-box .item .txt {
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt{
color: #b4282d;
.sort-box .item.active .txt {
color: #b4282d;
}
.sort-box .item.by-price{
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.asc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box .item.by-price.active.desc{
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
.sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx;
}
.sort-box-category{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
.sort-box-category {
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
float: left;
padding: 0 16rpx;
margin: 0 0 40rpx 40rpx;
border: 1px solid #666;
color: #333;
font-size: 24rpx;
}
.sort-box-category .item.active{
color: #b4282d;
border: 1px solid #b4282d;
.sort-box-category .item.active {
color: #b4282d;
border: 1px solid #b4282d;
}
.cate-item .b{
.cate-item .b {
width: 750rpx;
height: auto;
overflow: hidden;
......@@ -134,7 +134,7 @@ page{
margin-top: 20rpx;
}
.cate-item .b .item{
.cate-item .b .item {
float: left;
background: #fff;
width: 375rpx;
......@@ -145,17 +145,17 @@ page{
text-align: center;
}
.cate-item .b .item-b{
border-right: 1rpx solid #f4f4f4;
.cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img{
margin-top: 10rpx;
.cate-item .item .img {
margin-top: 10rpx;
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name{
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 35rpx;
......@@ -167,11 +167,11 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
font-size: 30rpx;
color: #b4282d;
}
\ No newline at end of file
}
......@@ -7,25 +7,25 @@ Page({
status: false,
orderId: 0
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
orderId: options.orderId,
status: options.status === '1' ? true : false
})
},
onReady: function () {
onReady: function() {
},
onShow: function () {
onShow: function() {
// 页面显示
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
},
......@@ -57,7 +57,7 @@ Page({
util.request(api.OrderPrepay, {
orderId: that.data.orderId
}, 'POST').then(function (res) {
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始")
......@@ -67,17 +67,17 @@ Page({
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function (res) {
'success': function(res) {
console.log("支付过程成功")
that.setData({
status: true
});
},
'fail': function (res) {
'fail': function(res) {
console.log("支付过程失败")
util.showErrorToast('支付失败');
},
'complete': function (res) {
'complete': function(res) {
console.log("支付过程结束")
}
});
......
......@@ -10,7 +10,8 @@
<view class="error" wx:if="{{!status}}">
<view class="msg">付款失败</view>
<view class="tips">
<view class="p">请在 <text class="time">半小时</text> 内完成付款</view>
<view class="p">请在
<text class="time">半小时</text> 内完成付款</view>
<view class="p">否则订单将会被系统取消</view>
</view>
<view class="btns">
......
......@@ -33,7 +33,7 @@ page {
width: 200rpx;
line-height: 78rpx;
border: 1px solid #868686;
color: #000000;
color: #000;
border-radius: 5rpx;
}
......@@ -56,4 +56,4 @@ page {
.pay-result .error .tips .p {
line-height: 42rpx;
text-align: center;
}
\ No newline at end of file
}
......@@ -21,23 +21,23 @@ Page({
categoryId: 0
},
//事件处理函数
closeSearch: function () {
closeSearch: function() {
wx.navigateBack()
},
clearKeyword: function () {
clearKeyword: function() {
this.setData({
keyword: '',
searchStatus: false
});
},
onLoad: function () {
onLoad: function() {
this.getSearchKeyword();
},
getSearchKeyword() {
let that = this;
util.request(api.SearchIndex).then(function (res) {
util.request(api.SearchIndex).then(function(res) {
if (res.errno === 0) {
that.setData({
historyKeyword: res.data.historyKeywordList,
......@@ -48,7 +48,7 @@ Page({
});
},
inputChange: function (e) {
inputChange: function(e) {
this.setData({
keyword: e.detail.value,
searchStatus: false
......@@ -58,7 +58,7 @@ Page({
this.getHelpKeyword();
}
},
getHelpKeyword: function () {
getHelpKeyword: function() {
let that = this;
util.request(api.SearchHelper, {
keyword: that.data.keyword
......@@ -70,7 +70,7 @@ Page({
}
});
},
inputFocus: function () {
inputFocus: function() {
this.setData({
searchStatus: false,
goodsList: []
......@@ -80,17 +80,17 @@ Page({
this.getHelpKeyword();
}
},
clearHistory: function () {
clearHistory: function() {
this.setData({
historyKeyword: []
})
util.request(api.SearchClearHistory, {}, 'POST')
.then(function (res) {
.then(function(res) {
console.log('清除成功');
});
},
getGoodsList: function () {
getGoodsList: function() {
let that = this;
util.request(api.GoodsList, {
keyword: that.data.keyword,
......@@ -113,7 +113,7 @@ Page({
that.getSearchKeyword();
});
},
onKeywordTap: function (event) {
onKeywordTap: function(event) {
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