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{
page, .container {
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
}
.groupon-list{
.groupon-list {
width: 750rpx;
height: 100%;
overflow: hidden;
......@@ -74,7 +75,7 @@ page ,.container{
.groupon-list .price {
width: 476rpx;
display: flex;
color: #AB956D;
color: #ab956d;
line-height: 50rpx;
font-size: 33rpx;
}
......@@ -91,14 +92,14 @@ page ,.container{
color: #a78845;
}
.page{
.page {
width: 750rpx;
height: 108rpx;
background: #fff;
margin-bottom: 20rpx;
}
.page view{
.page view {
height: 108rpx;
width: 50%;
float: left;
......@@ -108,10 +109,10 @@ page ,.container{
line-height: 108rpx;
}
.page .prev{
border-right: 1px solid #D9D9D9;
.page .prev {
border-right: 1px solid #d9d9d9;
}
.page .disabled{
.page .disabled {
color: #ccc;
}
......@@ -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,11 +28,13 @@ 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,
......@@ -40,11 +42,18 @@ Page({
}
});
},
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,
......@@ -54,27 +63,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':
......@@ -111,7 +120,7 @@ Page({
this.getGoodsList();
}
},
selectCategory: function(event){
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({
'categoryFilter': false,
......
page{
page {
background: #f4f4f4;
}
.brand-info .name{
.brand-info .name {
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img{
.brand-info .img {
position: absolute;
top:0;
left:0;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box{
.brand-info .info-box {
position: absolute;
top:0;
left:0;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
......@@ -28,18 +28,18 @@ page{
align-items: center;
}
.brand-info .info{
.brand-info .info {
display: block;
}
.brand-info .txt{
.brand-info .txt {
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line{
.brand-info .line {
margin: 0 auto;
margin-top: 16rpx;
display: block;
......@@ -48,14 +48,14 @@ page{
background: #fff;
}
.sort{
.sort {
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box{
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
......@@ -65,42 +65,42 @@ page{
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item{
.sort-box .item {
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:1;
flex: 1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt{
.sort-box .item .txt {
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt{
.sort-box .item.active .txt {
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-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-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-size: 15rpx 21rpx;
}
.sort-box-category{
.sort-box-category {
background: #fff;
width: 100%;
height: auto;
......@@ -109,7 +109,7 @@ page{
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
......@@ -121,12 +121,12 @@ page{
font-size: 24rpx;
}
.sort-box-category .item.active{
.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{
.cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img{
.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,7 +167,7 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
......
......@@ -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;
}
......@@ -195,7 +190,7 @@
.a-groupon .b .price {
width: 476rpx;
display: flex;
color: #AB956D;
color: #ab956d;
line-height: 50rpx;
font-size: 33rpx;
}
......@@ -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,
......
page{
page {
background: #f4f4f4;
}
.brand-info .name{
.brand-info .name {
width: 100%;
height: 278rpx;
position: relative;
}
.brand-info .img{
.brand-info .img {
position: absolute;
top:0;
left:0;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
}
.brand-info .info-box{
.brand-info .info-box {
position: absolute;
top:0;
left:0;
top: 0;
left: 0;
width: 100%;
height: 278rpx;
text-align: center;
......@@ -28,18 +28,18 @@ page{
align-items: center;
}
.brand-info .info{
.brand-info .info {
display: block;
}
.brand-info .txt{
.brand-info .txt {
display: block;
height: 40rpx;
font-size: 37.5rpx;
color: #fff;
}
.brand-info .line{
.brand-info .line {
margin: 0 auto;
margin-top: 16rpx;
display: block;
......@@ -48,14 +48,14 @@ page{
background: #fff;
}
.sort{
.sort {
position: relative;
background: #fff;
width: 100%;
height: 78rpx;
}
.sort-box{
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
......@@ -65,42 +65,42 @@ page{
border-bottom: 1px solid #d9d9d9;
}
.sort-box .item{
.sort-box .item {
height: 78rpx;
line-height: 78rpx;
text-align: center;
flex:1;
flex: 1;
color: #333;
font-size: 30rpx;
}
.sort-box .item .txt{
.sort-box .item .txt {
display: block;
width: 100%;
height: 100%;
color: #333;
}
.sort-box .item.active .txt{
.sort-box .item.active .txt {
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-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-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-size: 15rpx 21rpx;
}
.sort-box-category{
.sort-box-category {
background: #fff;
width: 100%;
height: auto;
......@@ -109,7 +109,7 @@ page{
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
......@@ -121,12 +121,12 @@ page{
font-size: 24rpx;
}
.sort-box-category .item.active{
.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{
.cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img{
.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,7 +167,7 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
......
......@@ -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;
}
......
......@@ -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