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

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

parent 822d5075
page{
page {
min-height: 100%;
background-color: #f4f4f4;
}
.container{
.container {
min-height: 100%;
background-color: #f4f4f4;
}
.search-header{
.search-header {
position: fixed;
top: 0;
width: 750rpx;
height: 91rpx;
display: flex;
background: #fff;
border-bottom: 1px solid rgba(0,0,0,.15);
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
padding: 0 31.25rpx;
font-size: 29rpx;
color: #333;
}
.search-header .input-box{
.search-header .input-box {
position: relative;
margin-top: 16rpx;
float: left;
......@@ -33,7 +33,7 @@ page{
background: #f4f4f4;
}
.search-header .icon{
.search-header .icon {
position: absolute;
top: 14rpx;
left: 20rpx;
......@@ -41,7 +41,7 @@ page{
height: 31rpx;
}
.search-header .del{
.search-header .del {
position: absolute;
top: 3rpx;
right: 10rpx;
......@@ -50,7 +50,7 @@ page{
z-index: 10;
}
.search-header .keywrod{
.search-header .keywrod {
position: absolute;
top: 0;
left: 40rpx;
......@@ -59,7 +59,7 @@ page{
padding-left: 30rpx;
}
.search-header .right{
.search-header .right {
margin-top: 24rpx;
margin-left: 31rpx;
margin-right: 6rpx;
......@@ -69,13 +69,13 @@ page{
float: right;
}
.no-search{
.no-search {
height: auto;
overflow: hidden;
margin-top: 91rpx;
}
.search-keywords{
.search-keywords {
background: #fff;
width: 750rpx;
height: auto;
......@@ -83,7 +83,7 @@ page{
margin-bottom: 20rpx;
}
.search-keywords .h{
.search-keywords .h {
padding: 0 31.25rpx;
height: 93rpx;
line-height: 93rpx;
......@@ -92,13 +92,13 @@ page{
font-size: 29rpx;
}
.search-keywords .title{
.search-keywords .title {
display: block;
width: 120rpx;
float: left;
}
.search-keywords .icon{
.search-keywords .icon {
margin-top: 19rpx;
float: right;
display: block;
......@@ -107,31 +107,31 @@ page{
width: 55rpx;
}
.search-keywords .b{
.search-keywords .b {
width: 750rpx;
height: auto;
overflow: hidden;
padding-left: 31.25rpx;
}
.search-keywords .item{
.search-keywords .item {
display: inline-block;
width: auto;
height: 48rpx;
line-height: 48rpx;
padding:0 15rpx;
padding: 0 15rpx;
border: 1px solid #999;
margin: 0 31.25rpx 31.25rpx 0;
font-size: 24rpx;
color: #333;
}
.search-keywords .item.active{
.search-keywords .item.active {
color: #b4282d;
border: 1px solid #b4282d;
}
.shelper-list{
.shelper-list {
width: 750rpx;
height: auto;
overflow: hidden;
......@@ -139,7 +139,7 @@ page{
padding: 0 31.25rpx;
}
.shelper-list .item{
.shelper-list .item {
height: 93rpx;
width: 687.5rpx;
line-height: 93rpx;
......@@ -148,8 +148,7 @@ page{
border-bottom: 1px solid #f4f4f4;
}
.sort{
.sort {
position: fixed;
top: 91rpx;
background: #fff;
......@@ -157,7 +156,7 @@ page{
height: 78rpx;
}
.sort-box{
.sort-box {
background: #fff;
width: 100%;
height: 78rpx;
......@@ -167,42 +166,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;
......@@ -211,7 +210,7 @@ page{
border-bottom: 1px solid #d9d9d9;
}
.sort-box-category .item{
.sort-box-category .item {
height: 54rpx;
line-height: 54rpx;
text-align: center;
......@@ -223,18 +222,18 @@ page{
font-size: 24rpx;
}
.sort-box-category .item.active{
.sort-box-category .item.active {
color: #b4282d;
border: 1px solid #b4282d;
}
.cate-item{
.cate-item {
margin-top: 175rpx;
height: auto;
overflow: hidden;
}
.cate-item .h{
.cate-item .h {
height: 145rpx;
width: 750rpx;
display: flex;
......@@ -243,7 +242,7 @@ page{
justify-content: center;
}
.cate-item .h .name{
.cate-item .h .name {
display: block;
height: 35rpx;
margin-bottom: 18rpx;
......@@ -251,28 +250,28 @@ page{
color: #333;
}
.cate-item .h .desc{
.cate-item .h .desc {
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}
.cate-item .b{
.cate-item .b {
width: 750rpx;
padding: 0 6.25rpx;
height: auto;
overflow: hidden;
}
.cate-item .list-filter{
.cate-item .list-filter {
height: 80rpx;
width: 100%;
background: #fff;
margin-bottom: 6.25rpx;
}
.cate-item .b .item{
.cate-item .b .item {
float: left;
background: #fff;
width: 365rpx;
......@@ -283,16 +282,16 @@ page{
text-align: center;
}
.cate-item .b .item-b{
.cate-item .b .item-b {
margin-left: 6.25rpx;
}
.cate-item .item .img{
.cate-item .item .img {
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name{
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 35rpx;
......@@ -304,7 +303,7 @@ page{
color: #333;
}
.cate-item .item .price{
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
......@@ -313,20 +312,20 @@ page{
color: #b4282d;
}
.search-result-empty{
.search-result-empty {
width: 100%;
height: 100%;
padding-top: 300rpx;
}
.search-result-empty .icon{
.search-result-empty .icon {
margin: 0 auto;
display: block;
width: 240rpx;
height: 240rpx;
}
.search-result-empty .text{
.search-result-empty .text {
display: block;
width: 100%;
height: 40rpx;
......
......@@ -10,23 +10,23 @@ Page({
scrollTop: 0,
showPage: false
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getTopic();
},
onReady: function () {
onReady: function() {
// 页面渲染完成
},
onShow: function () {
onShow: function() {
// 页面显示
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
},
nextPage: function (event) {
nextPage: function(event) {
var that = this;
if (this.data.page > that.data.count / that.data.size) {
return true;
......@@ -40,7 +40,7 @@ Page({
this.getTopic();
},
getTopic: function(){
getTopic: function() {
let that = this;
that.setData({
......@@ -55,7 +55,10 @@ Page({
duration: 2000
});
util.request(api.TopicList, { page: that.data.page, size: that.data.size }).then(function (res) {
util.request(api.TopicList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({
......@@ -69,7 +72,7 @@ Page({
});
},
prevPage: function (event) {
prevPage: function(event) {
if (this.data.page <= 1) {
return false;
}
......
......@@ -17,9 +17,12 @@ Page({
picPage: 1,
size: 20
},
getCommentCount: function () {
getCommentCount: function() {
let that = this;
util.request(api.CommentCount, { valueId: that.data.valueId, type: that.data.type}).then(function (res) {
util.request(api.CommentCount, {
valueId: that.data.valueId,
type: that.data.type
}).then(function(res) {
if (res.errno === 0) {
that.setData({
......@@ -29,7 +32,7 @@ Page({
}
});
},
getCommentList: function(){
getCommentList: function() {
let that = this;
util.request(api.CommentList, {
valueId: that.data.valueId,
......@@ -37,7 +40,7 @@ Page({
size: that.data.size,
page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage),
showType: that.data.showType
}).then(function (res) {
}).then(function(res) {
if (res.errno === 0) {
if (that.data.showType == 0) {
......@@ -56,7 +59,7 @@ Page({
}
});
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
type: options.type,
......@@ -65,39 +68,39 @@ Page({
this.getCommentCount();
this.getCommentList();
},
onReady: function () {
onReady: function() {
// 页面渲染完成
},
onShow: function () {
onShow: function() {
// 页面显示
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
},
switchTab: function () {
switchTab: function() {
this.setData({
showType: this.data.showType == 1 ? 0 :1
showType: this.data.showType == 1 ? 0 : 1
});
this.getCommentList();
},
onReachBottom: function(){
onReachBottom: function() {
console.log('onPullDownRefresh');
if ( this.data.showType == 0) {
if (this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) {
return false;
}
this.setData({
'allPage' : this.data.allPage + 1
'allPage': this.data.allPage + 1
});
} else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) {
......
......@@ -12,10 +12,6 @@
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="id" wx:for-item="pitem" src="{{pitem.picUrl}}"></image>
</view>
<!--<view class="customer-service" wx:if="{{item.commentReplyVO}}">
<text class="u">小选回复:</text>
<text class="c">{{item.commentReplyVO.replyContent}}</text>
</view>-->
</view>
</view>
......
.comments{
.comments {
width: 100%;
height: auto;
padding-left:30rpx;
padding-left: 30rpx;
background: #fff;
margin: 20rpx 0;
}
.comments .b{
.comments .b {
height: auto;
width: 720rpx;
}
.comments .b.no-h{
.comments .b.no-h {
margin-top: 0;
}
.comments .item{
.comments .item {
height: auto;
width: 720rpx;
overflow: hidden;
......@@ -23,13 +23,13 @@
padding-bottom: 25rpx;
}
.comments .info{
.comments .info {
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user{
.comments .user {
float: left;
width: auto;
height: 67rpx;
......@@ -37,7 +37,7 @@
font-size: 0;
}
.comments .user image{
.comments .user image {
float: left;
width: 67rpx;
height: 67rpx;
......@@ -45,7 +45,7 @@
border-radius: 50%;
}
.comments .user text{
.comments .user text {
display: inline-block;
width: auto;
height: 66rpx;
......@@ -54,7 +54,7 @@
line-height: 66rpx;
}
.comments .time{
.comments .time {
display: block;
float: right;
width: auto;
......@@ -65,7 +65,7 @@
margin-right: 30rpx;
}
.comments .comment{
.comments .comment {
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
......@@ -73,35 +73,34 @@
margin-bottom: 16rpx;
}
.comments .imgs{
.comments .imgs {
width: 720rpx;
height: 150rpx;
margin-bottom: 25rpx;
}
.comments .imgs .img{
.comments .imgs .img {
height: 150rpx;
width: 150rpx;
margin-right: 28rpx;
}
.comments .customer-service{
.comments .customer-service {
width: 690rpx;
height: auto;
overflow: hidden;
margin-top: 23rpx;
background: rgba(0,0,0,.03);
background: rgba(0, 0, 0, 0.03);
padding: 21rpx;
}
.comments .customer-service .u{
.comments .customer-service .u {
font-size: 24rpx;
color: #333;
line-height: 37.5rpx;
}
.comments .customer-service .c{
.comments .customer-service .c {
font-size: 24rpx;
color: #999;
line-height: 37.5rpx;
......
......@@ -14,7 +14,7 @@ Page({
picUrls: [],
files: []
},
chooseImage: function (e) {
chooseImage: function(e) {
if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片')
return false;
......@@ -25,7 +25,7 @@ Page({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
success: function(res) {
that.setData({
files: that.data.files.concat(res.tempFilePaths)
});
......@@ -33,13 +33,13 @@ Page({
}
})
},
upload: function (res) {
upload: function(res) {
var that = this;
const uploadTask = wx.uploadFile({
url: api.StorageUpload,
filePath: res.tempFilePaths[0],
name: 'file',
success: function (res) {
success: function(res) {
var _res = JSON.parse(res.data);
if (_res.errno === 0) {
var url = _res.data.url
......@@ -50,7 +50,7 @@ Page({
})
}
},
fail: function (e) {
fail: function(e) {
wx.showModal({
title: '错误',
content: '上传失败',
......@@ -66,28 +66,24 @@ Page({
})
},
previewImage: function (e) {
previewImage: function(e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表
})
},
selectRater: function (e) {
selectRater: function(e) {
var star = e.currentTarget.dataset.star + 1;
var starText;
if (star == 1) {
starText = '很差';
}
else if (star == 2) {
} else if (star == 2) {
starText = '不太满意';
}
else if (star == 3) {
} else if (star == 3) {
starText = '满意';
}
else if (star == 4) {
} else if (star == 4) {
starText = '比较满意';
}
else {
} else {
starText = '十分满意'
}
this.setData({
......@@ -96,8 +92,8 @@ Page({
})
},
onLoad: function (options) {
if (parseInt(options.type) !== 1){
onLoad: function(options) {
if (parseInt(options.type) !== 1) {
return;
}
......@@ -107,9 +103,11 @@ Page({
});
this.getTopic();
},
getTopic: function () {
getTopic: function() {
let that = this;
util.request(api.TopicDetail, { id: that.data.valueId }).then(function (res) {
util.request(api.TopicDetail, {
id: that.data.valueId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
......@@ -119,10 +117,10 @@ Page({
}
});
},
onClose: function () {
onClose: function() {
wx.navigateBack();
},
onPost: function () {
onPost: function() {
let that = this;
if (!this.data.content) {
......@@ -137,11 +135,11 @@ Page({
star: that.data.star,
hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls
}, 'POST').then(function (res) {
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '评论成功',
complete: function () {
complete: function() {
wx.navigateBack();
}
})
......@@ -161,18 +159,18 @@ Page({
content: event.detail.value,
})
},
onReady: function () {
onReady: function() {
},
onShow: function () {
onShow: function() {
// 页面显示
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
}
......
......@@ -35,10 +35,6 @@
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
<!-- <view class="weui-uploader__file weui-uploader__file_status" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
<view class="weui-uploader__file-content">50%</view>
</view> -->
</block>
<view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="chooseImage"></view>
......
......@@ -12,14 +12,16 @@ Page({
commentList: [],
topicGoods: []
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
var that = this;
that.setData({
id: options.id
});
util.request(api.TopicDetail, { id: that.data.id }).then(function (res) {
util.request(api.TopicDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
topic: res.data.topic,
......@@ -30,7 +32,9 @@ Page({
}
});
util.request(api.TopicRelated, { id: that.data.id }).then(function (res) {
util.request(api.TopicRelated, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
topicList: res.data
......@@ -40,7 +44,13 @@ Page({
},
getCommentList() {
let that = this;
util.request(api.CommentList, { valueId: that.data.id, type: 1, showType: 0, page: 1, size: 5 }).then(function (res) {
util.request(api.CommentList, {
valueId: that.data.id,
type: 1,
showType: 0,
page: 1,
size: 5
}).then(function(res) {
if (res.errno === 0) {
that.setData({
commentList: res.data.data,
......@@ -51,26 +61,27 @@ Page({
},
postComment() {
if (!app.globalData.hasLogin) {
wx.navigateTo({ url: "/pages/auth/login/login" });
}
else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
} else {
wx.navigateTo({
url: '/pages/topicCommentPost/topicCommentPost?valueId=' + this.data.id + '&type=1',
})
}
},
onReady: function () {
onReady: function() {
},
onShow: function () {
onShow: function() {
// 页面显示
this.getCommentList();
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
}
......
<scroll-view class="container">
<scroll-view class="content">
<import src="../../lib/wxParse/wxParse.wxml"/>
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/>
<import src="../../lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}" />
</scroll-view>
<scroll-view class="sv-goods" wx:if="{{topicGoods.length > 0 }}">
<view class="topic-goods">
......
.content{
.content {
width: 100%;
height: auto;
font-size: 0;
}
.content image{
.content image {
display: inline-block;
width: 100%;
}
.comments{
.comments {
width: 100%;
height: auto;
padding-left:30rpx;
padding-left: 30rpx;
background: #fff;
margin-top: 20rpx;
}
.comments .h{
.comments .h {
height: 93rpx;
line-height: 93rpx;
width: 720rpx;
......@@ -25,7 +25,7 @@
border-bottom: 1px solid #d9d9d9;
}
.comments .h .t{
.comments .h .t {
display: block;
float: left;
width: 50%;
......@@ -33,7 +33,7 @@
color: #333;
}
.comments .h .i{
.comments .h .i {
display: block;
float: right;
margin-top: 30rpx;
......@@ -41,25 +41,25 @@
height: 33rpx;
}
.comments .b{
.comments .b {
height: auto;
width: 720rpx;
}
.comments .item{
.comments .item {
height: auto;
width: 720rpx;
overflow: hidden;
border-bottom: 1px solid #d9d9d9;
}
.comments .info{
.comments .info {
height: 127rpx;
width: 100%;
padding: 33rpx 0 27rpx 0;
}
.comments .user{
.comments .user {
float: left;
width: auto;
height: 67rpx;
......@@ -67,7 +67,7 @@
font-size: 0;
}
.comments .user .avatar{
.comments .user .avatar {
display: block;
float: left;
width: 67rpx;
......@@ -76,7 +76,7 @@
border-radius: 50%;
}
.comments .user .nickname{
.comments .user .nickname {
display: block;
width: auto;
float: left;
......@@ -86,7 +86,7 @@
line-height: 66rpx;
}
.comments .time{
.comments .time {
display: block;
float: right;
width: auto;
......@@ -97,7 +97,7 @@
margin-right: 30rpx;
}
.comments .comment{
.comments .comment {
width: 720rpx;
padding-right: 30rpx;
line-height: 45.8rpx;
......@@ -106,7 +106,7 @@
color: #333;
}
.comments .load{
.comments .load {
width: 720rpx;
height: 108rpx;
line-height: 108rpx;
......@@ -114,11 +114,11 @@
font-size: 38.5rpx;
}
.no-comments{
.no-comments {
height: 297rpx;
}
.no-comments .txt{
.no-comments .txt {
height: 43rpx;
line-height: 43rpx;
display: block;
......@@ -128,17 +128,17 @@
color: #7f7f7f;
}
.no-comments .icon{
.no-comments .icon {
margin: 48rpx auto 18rpx auto;
height: 130rpx;
display: block;
width: 115rpx;
}
.sv-goods{
.sv-goods {
width: 100%;
height: auto;
padding-left:30rpx;
padding-left: 30rpx;
background: #fff;
margin-top: 20rpx;
}
......@@ -149,6 +149,7 @@
height: 244rpx;
width: 710rpx;
}
.topic-goods .b .img {
margin-top: 12rpx;
margin-right: 12rpx;
......@@ -156,6 +157,7 @@
width: 220rpx;
height: 220rpx;
}
.topic-goods .b .right {
float: left;
height: 244rpx;
......@@ -163,6 +165,7 @@
display: flex;
flex-flow: row nowrap;
}
.topic-goods .b .text {
display: flex;
flex-wrap: nowrap;
......@@ -172,6 +175,7 @@
height: 244rpx;
width: 476rpx;
}
.topic-goods .b .name {
float: left;
width: 330rpx;
......@@ -180,6 +184,7 @@
line-height: 50rpx;
font-size: 30rpx;
}
.topic-goods .b .desc {
width: 476rpx;
display: block;
......@@ -187,6 +192,7 @@
line-height: 50rpx;
font-size: 25rpx;
}
.topic-goods .b .price {
width: 476rpx;
display: flex;
......@@ -195,13 +201,13 @@
font-size: 33rpx;
}
.rec-box{
.rec-box {
width: 690rpx;
height: auto;
margin: 0 30rpx;
}
.rec-box .h{
.rec-box .h {
position: relative;
width: 690rpx;
height: 96rpx;
......@@ -209,7 +215,7 @@
margin-bottom: 32rpx;
}
.rec-box .h .txt{
.rec-box .h .txt {
display: inline-block;
position: absolute;
background: #f4f4f4;
......@@ -223,7 +229,7 @@
text-align: center;
}
.rec-box .b .item{
.rec-box .b .item {
width: 690rpx;
height: 397rpx;
padding: 24rpx 24rpx 30rpx 24rpx;
......@@ -231,12 +237,12 @@
margin-bottom: 30rpx;
}
.rec-box .b .item .img{
.rec-box .b .item .img {
height: 278rpx;
width: 642rpx;
}
.rec-box .b .item .title{
.rec-box .b .item .title {
display: block;
margin-top: 30rpx;
height: 30rpx;
......
......@@ -6,19 +6,19 @@ Page({
data: {
addressList: [],
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
onReady: function () {
onReady: function() {
// 页面渲染完成
},
onShow: function () {
onShow: function() {
// 页面显示
this.getAddressList();
},
getAddressList (){
getAddressList() {
let that = this;
util.request(api.AddressList).then(function (res) {
util.request(api.AddressList).then(function(res) {
if (res.errno === 0) {
that.setData({
addressList: res.data
......@@ -26,7 +26,7 @@ Page({
}
});
},
addressAddOrUpdate (event) {
addressAddOrUpdate(event) {
console.log(event)
//返回之前,先取出上一页对象,并设置addressId
......@@ -55,13 +55,13 @@ Page({
})
}
},
deleteAddress(event){
deleteAddress(event) {
console.log(event.target)
let that = this;
wx.showModal({
title: '',
content: '确定要删除地址?',
success: function (res) {
success: function(res) {
if (res.confirm) {
let addressId = event.target.dataset.addressId;
util.request(api.AddressDelete, {
......@@ -82,10 +82,10 @@ Page({
return false;
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
}
})
\ No newline at end of file
page{
page {
height: 100%;
width: 100%;
background: #f4f4f4;
}
.container{
.container {
height: 100%;
width: 100%;
}
.address-list{
.address-list {
padding-left: 31.25rpx;
background: #fff url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png) 0 0 repeat-x;
background-size: auto 10.5rpx;
margin-bottom: 90rpx;
}
.address-list .item{
.address-list .item {
height: 156.55rpx;
align-items: center;
display: flex;
border-bottom: 1rpx solid #DCD9D9;
border-bottom: 1rpx solid #dcd9d9;
}
.address-list .l{
.address-list .l {
width: 125rpx;
height: 80rpx;
overflow: hidden;
}
.address-list .name{
.address-list .name {
width: 125rpx;
height: 43rpx;
font-size: 29rpx;
......@@ -40,7 +40,7 @@ page{
overflow: hidden;
}
.address-list .default{
.address-list .default {
width: 62.5rpx;
height: 33rpx;
line-height: 28rpx;
......@@ -51,15 +51,13 @@ page{
visibility: visible;
}
.address-list .c{
.address-list .c {
flex: 1;
height: auto;
overflow: hidden;
}
.address-list .mobile{
.address-list .mobile {
height: 29rpx;
font-size: 29rpx;
line-height: 29rpx;
......@@ -68,7 +66,7 @@ page{
margin-bottom: 6.25rpx;
}
.address-list .address{
.address-list .address {
height: 37rpx;
font-size: 25rpx;
line-height: 37rpx;
......@@ -76,20 +74,20 @@ page{
color: #666;
}
.address-list .r{
.address-list .r {
width: 52rpx;
height: auto;
overflow: hidden;
margin-right: 16.5rpx;
}
.address-list .del{
.address-list .del {
display: block;
width: 52rpx;
height: 52rpx;
}
.add-address{
.add-address {
border: none;
right: 0;
display: flex;
......@@ -117,7 +115,7 @@ page{
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}
.empty-view{
.empty-view {
height: 100%;
width: 100%;
display: flex;
......@@ -126,13 +124,13 @@ page{
justify-content: center;
}
.empty-view .icon{
.empty-view .icon {
height: 248rpx;
width: 258rpx;
margin-bottom: 10rpx;
}
.empty-view .text{
.empty-view .text {
width: auto;
font-size: 28rpx;
line-height: 35rpx;
......
......@@ -6,7 +6,7 @@ var app = getApp();
Page({
data: {
address: {
id:0,
id: 0,
provinceId: 0,
cityId: 0,
areaId: 0,
......@@ -20,10 +20,24 @@ Page({
},
addressId: 0,
openSelectRegion: false,
selectRegionList: [
{ id: 0, name: '省份', pid: 1, type: 1 },
{ id: 0, name: '城市', pid: 1, type: 2 },
{ id: 0, name: '区县', pid: 1, type: 3 }
selectRegionList: [{
id: 0,
name: '省份',
pid: 1,
type: 1
},
{
id: 0,
name: '城市',
pid: 1,
type: 2
},
{
id: 0,
name: '区县',
pid: 1,
type: 3
}
],
regionType: 1,
regionList: [],
......@@ -43,14 +57,14 @@ Page({
address: address
});
},
bindinputAddress (event){
bindinputAddress(event) {
let address = this.data.address;
address.address = event.detail.value;
this.setData({
address: address
});
},
bindIsDefault(){
bindIsDefault() {
let address = this.data.address;
address.isDefault = !address.isDefault;
this.setData({
......@@ -59,9 +73,11 @@ Page({
},
getAddressDetail() {
let that = this;
util.request(api.AddressDetail, { id: that.data.addressId }).then(function (res) {
util.request(api.AddressDetail, {
id: that.data.addressId
}).then(function(res) {
if (res.errno === 0) {
if(res.data){
if (res.data) {
that.setData({
address: res.data
});
......@@ -110,10 +126,24 @@ Page({
this.getRegionList(address.cityId);
} else {
this.setData({
selectRegionList: [
{ id: 0, name: '省份', pid: 0, type: 1 },
{ id: 0, name: '城市', pid: 0, type: 2 },
{ id: 0, name: '区县', pid: 0, type: 3 }
selectRegionList: [{
id: 0,
name: '省份',
pid: 0,
type: 1
},
{
id: 0,
name: '城市',
pid: 0,
type: 2
},
{
id: 0,
name: '区县',
pid: 0,
type: 3
}
],
regionType: 1
})
......@@ -123,7 +153,7 @@ Page({
this.setRegionDoneStatus();
},
onLoad: function (options) {
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
console.log(options)
if (options.id && options.id != 0) {
......@@ -133,7 +163,7 @@ Page({
this.getAddressDetail();
}
},
onReady: function () {
onReady: function() {
},
selectRegionType(event) {
......@@ -142,7 +172,7 @@ Page({
let selectRegionList = that.data.selectRegionList;
//判断是否可点击
if (regionTypeIndex + 1 == this.data.regionType || (regionTypeIndex - 1 >= 0 && selectRegionList[regionTypeIndex-1].id <= 0)) {
if (regionTypeIndex + 1 == this.data.regionType || (regionTypeIndex - 1 >= 0 && selectRegionList[regionTypeIndex - 1].id <= 0)) {
return false;
}
......@@ -240,7 +270,9 @@ Page({
getRegionList(regionId) {
let that = this;
let regionType = that.data.regionType;
util.request(api.RegionList, { pid: regionId }).then(function (res) {
util.request(api.RegionList, {
pid: regionId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
regionList: res.data.map(item => {
......@@ -258,10 +290,10 @@ Page({
}
});
},
cancelAddress(){
cancelAddress() {
wx.navigateBack();
},
saveAddress(){
saveAddress() {
console.log(this.data.address)
let address = this.data.address;
......@@ -302,7 +334,7 @@ Page({
areaId: address.areaId,
address: address.address,
isDefault: address.isDefault
}, 'POST').then(function (res) {
}, 'POST').then(function(res) {
if (res.errno === 0) {
//返回之前,先取出上一页对象,并设置addressId
var pages = getCurrentPages();
......@@ -325,15 +357,15 @@ Page({
});
},
onShow: function () {
onShow: function() {
// 页面显示
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
}
......
......@@ -4,13 +4,13 @@
<input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus/>
</view>
<view class="form-item">
<input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码"/>
<input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码" />
</view>
<view class="form-item">
<input class="input" value="{{address.provinceName + address.cityName + address.areaName}}" disabled="true" bindtap="chooseRegion" placeholder="省份、城市、区县"/>
<input class="input" value="{{address.provinceName + address.cityName + address.areaName}}" disabled="true" bindtap="chooseRegion" placeholder="省份、城市、区县" />
</view>
<view class="form-item">
<input class="input" bindinput="bindinputAddress" value="{{address.address}}" placeholder="详细地址, 如街道、楼盘号等"/>
<input class="input" bindinput="bindinputAddress" value="{{address.address}}" placeholder="详细地址, 如街道、楼盘号等" />
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
......
page{
page {
height: 100%;
background: #f4f4f4;
}
.add-address .add-form{
.add-address .add-form {
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
}
.add-address .form-item{
.add-address .form-item {
height: 116rpx;
padding-left: 31.25rpx;
border-bottom: 1px solid #d9d9d9;
......@@ -18,14 +19,14 @@ page{
padding-right: 31.25rpx;
}
.add-address .input{
.add-address .input {
flex: 1;
height: 44rpx;
line-height: 44rpx;
overflow: hidden;
}
.add-address .form-default{
.add-address .form-default {
border-bottom: 1px solid #d9d9d9;
height: 96rpx;
background: #fafafa;
......@@ -33,7 +34,7 @@ page{
font-size: 28rpx;
}
.default-input{
.default-input {
margin: 0 auto;
display: block;
width: 240rpx;
......@@ -45,12 +46,12 @@ page{
font-size: 28rpx;
}
.default-input.selected{
.default-input.selected {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
background-size: 38rpx 486rpx;
}
.add-address .btns{
.add-address .btns {
position: fixed;
bottom: 0;
left: 0;
......@@ -60,50 +61,49 @@ page{
width: 100%;
}
.add-address .cannel,.add-address .save{
.add-address .cannel, .add-address .save {
flex: 1;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 28rpx;
color: #fff;
border:none;
border: none;
border-radius: 0;
}
.add-address .cannel{
.add-address .cannel {
background: #333;
}
.add-address .save{
.add-address .save {
background: #b4282d;
}
.region-select{
.region-select {
width: 100%;
height: 600rpx;
background: #fff;
position: fixed;
z-index: 10;
left:0;
left: 0;
bottom: 0;
}
.region-select .hd{
.region-select .hd {
height: 108rpx;
width: 100%;
border-bottom: 1px solid #f4f4f4;
padding: 46rpx 30rpx 0 30rpx;
}
.region-select .region-selected{
.region-select .region-selected {
float: left;
height: 60rpx;
display: flex;
}
.region-select .region-selected .item{
.region-select .region-selected .item {
max-width: 140rpx;
margin-right: 30rpx;
text-align: left;
......@@ -116,15 +116,15 @@ page{
white-space: nowrap;
}
.region-select .region-selected .item.disabled{
.region-select .region-selected .item.disabled {
color: #999;
}
.region-select .region-selected .item.selected{
.region-select .region-selected .item.selected {
color: #b4282d;
}
.region-select .done{
.region-select .done {
float: right;
height: 60rpx;
width: 60rpx;
......@@ -136,21 +136,21 @@ page{
font-size: 28rpx;
}
.region-select .done.disabled{
.region-select .done.disabled {
color: #999;
}
.region-select .bd{
.region-select .bd {
height: 492rpx;
width: 100%;
padding: 0 30rpx;
}
.region-select .region-list{
.region-select .region-list {
height: 492rpx;
}
.region-select .region-list .item{
.region-select .region-list .item {
width: 100%;
height: 104rpx;
line-height: 104rpx;
......@@ -159,17 +159,16 @@ page{
font-size: 28rpx;
}
.region-select .region-list .item.selected{
.region-select .region-list .item.selected {
color: #b4282d;
}
.bg-mask{
.bg-mask {
height: 100%;
width: 100%;
background: rgba(0, 0, 0, 0.4);
position: fixed;
top:0;
left:0;
top: 0;
left: 0;
z-index: 8;
}
......@@ -16,7 +16,11 @@ Page({
title: '加载中...',
});
let that = this;
util.request(api.CollectList, { type: that.data.type, page: that.data.page, size: that.data.size }).then(function (res) {
util.request(api.CollectList, {
type: that.data.type,
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({
collectList: that.data.collectList.concat(res.data.collectList),
......@@ -26,7 +30,7 @@ Page({
wx.hideLoading();
});
},
onLoad: function (options) {
onLoad: function(options) {
this.getCollectList();
},
onReachBottom() {
......@@ -44,17 +48,17 @@ Page({
return false;
}
},
onReady: function () {
onReady: function() {
},
onShow: function () {
onShow: function() {
},
onHide: function () {
onHide: function() {
// 页面隐藏
},
onUnload: function () {
onUnload: function() {
// 页面关闭
},
openGoods(event) {
......@@ -71,10 +75,13 @@ Page({
wx.showModal({
title: '',
content: '确定删除吗?',
success: function (res) {
success: function(res) {
if (res.confirm) {
util.request(api.CollectAddOrDelete, { type: that.data.type, valueId: goodsId}, 'POST').then(function (res) {
util.request(api.CollectAddOrDelete, {
type: that.data.type,
valueId: goodsId
}, 'POST').then(function(res) {
if (res.errno === 0) {
console.log(res.data);
wx.showToast({
......@@ -99,14 +106,14 @@ Page({
}
},
//按下事件开始
touchStart: function (e) {
touchStart: function(e) {
let that = this;
that.setData({
touchStart: e.timeStamp
})
},
//按下事件结束
touchEnd: function (e) {
touchEnd: function(e) {
let that = this;
that.setData({
touchEnd: e.timeStamp
......
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