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

This commit is contained in:
Junling Bu
2018-11-16 20:19:16 +08:00
parent 20b97ec89a
commit 286c0ae73f
94 changed files with 7096 additions and 7081 deletions

View File

@@ -3,29 +3,29 @@ var api = require('./config/api.js');
var user = require('./utils/user.js'); var user = require('./utils/user.js');
App({ App({
onLaunch: function() { onLaunch: function() {
const updateManager = wx.getUpdateManager(); const updateManager = wx.getUpdateManager();
wx.getUpdateManager().onUpdateReady(function() { wx.getUpdateManager().onUpdateReady(function() {
wx.showModal({ wx.showModal({
title: '更新提示', title: '更新提示',
content: '新版本已经准备好,是否重启应用?', content: '新版本已经准备好,是否重启应用?',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate() updateManager.applyUpdate()
} }
} }
}) })
}) })
}, },
onShow: function(options) { onShow: function(options) {
user.checkLogin().then(res => { user.checkLogin().then(res => {
this.globalData.hasLogin = true; this.globalData.hasLogin = true;
}).catch(() => { }).catch(() => {
this.globalData.hasLogin = false; this.globalData.hasLogin = false;
}); });
}, },
globalData: { globalData: {
hasLogin: false hasLogin: false
} }
}) })

View File

@@ -1,74 +1,74 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/catalog/catalog", "pages/catalog/catalog",
"pages/newGoods/newGoods", "pages/newGoods/newGoods",
"pages/hotGoods/hotGoods", "pages/hotGoods/hotGoods",
"pages/ucenter/index/index", "pages/ucenter/index/index",
"pages/ucenter/address/address", "pages/ucenter/address/address",
"pages/ucenter/addressAdd/addressAdd", "pages/ucenter/addressAdd/addressAdd",
"pages/ucenter/order/order", "pages/ucenter/order/order",
"pages/ucenter/orderDetail/orderDetail", "pages/ucenter/orderDetail/orderDetail",
"pages/ucenter/coupon/coupon", "pages/ucenter/coupon/coupon",
"pages/ucenter/collect/collect", "pages/ucenter/collect/collect",
"pages/auth/login/login", "pages/auth/login/login",
"pages/payResult/payResult", "pages/payResult/payResult",
"pages/comment/comment", "pages/comment/comment",
"pages/commentPost/commentPost", "pages/commentPost/commentPost",
"pages/topic/topic", "pages/topic/topic",
"pages/topicDetail/topicDetail", "pages/topicDetail/topicDetail",
"pages/brand/brand", "pages/brand/brand",
"pages/brandDetail/brandDetail", "pages/brandDetail/brandDetail",
"pages/search/search", "pages/search/search",
"pages/category/category", "pages/category/category",
"pages/cart/cart", "pages/cart/cart",
"pages/shopping/checkout/checkout", "pages/shopping/checkout/checkout",
"pages/goods/goods", "pages/goods/goods",
"pages/groupon/myGroupon/myGroupon", "pages/groupon/myGroupon/myGroupon",
"pages/groupon/grouponDetail/grouponDetail", "pages/groupon/grouponDetail/grouponDetail",
"pages/groupon/grouponList/grouponList" "pages/groupon/grouponList/grouponList"
], ],
"window": { "window": {
"navigationBarTitleText": "Renard", "navigationBarTitleText": "Renard",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"tabBar": { "tabBar": {
"color": "#6e6d6b", "color": "#6e6d6b",
"selectedColor": "#e64340", "selectedColor": "#e64340",
"borderStyle": "white", "borderStyle": "white",
"backgroundColor": "#fff", "backgroundColor": "#fff",
"box-shadow": "0 0 6px 0", "box-shadow": "0 0 6px 0",
"list": [ "list": [
{ {
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "images/tabbar/like-f.png", "iconPath": "images/tabbar/like-f.png",
"selectedIconPath": "images/tabbar/like-o.png" "selectedIconPath": "images/tabbar/like-o.png"
}, },
{ {
"pagePath": "pages/catalog/catalog", "pagePath": "pages/catalog/catalog",
"iconPath": "images/tabbar/menu-f.png", "iconPath": "images/tabbar/menu-f.png",
"selectedIconPath": "images/tabbar/menu-o.png" "selectedIconPath": "images/tabbar/menu-o.png"
}, },
{ {
"pagePath": "pages/cart/cart", "pagePath": "pages/cart/cart",
"iconPath": "images/tabbar/cart-f.png", "iconPath": "images/tabbar/cart-f.png",
"selectedIconPath": "images/tabbar/cart-o.png" "selectedIconPath": "images/tabbar/cart-o.png"
}, },
{ {
"pagePath": "pages/ucenter/index/index", "pagePath": "pages/ucenter/index/index",
"iconPath": "images/tabbar/user-f.png", "iconPath": "images/tabbar/user-f.png",
"selectedIconPath": "images/tabbar/user-o.png" "selectedIconPath": "images/tabbar/user-o.png"
} }
] ]
}, },
"networkTimeout": { "networkTimeout": {
"request": 10000, "request": 10000,
"connectSocket": 10000, "connectSocket": 10000,
"uploadFile": 10000, "uploadFile": 10000,
"downloadFile": 10000 "downloadFile": 10000
}, },
"debug": true "debug": true
} }

View File

@@ -1,24 +1,24 @@
/**app.wxss**/ /**app.wxss**/
.container { .container {
box-sizing: border-box; box-sizing: border-box;
font-family: PingFangSC-Light,helvetica,'Heiti SC'; font-family: PingFangSC-Light, helvetica, 'Heiti SC';
width: 100%; width: 100%;
height: 100%; height: 100%;
}
view,image,text,navigator{
box-sizing: border-box;
padding:0;
margin:0;
} }
view,text{ view, image, text, navigator {
font-family: PingFangSC-Light,helvetica,'Heiti SC'; box-sizing: border-box;
padding: 0;
margin: 0;
}
view, text {
font-family: PingFangSC-Light, helvetica, 'Heiti SC';
font-size: 29rpx; font-size: 29rpx;
color: #a78845; color: #a78845;
} }
.wxParse-img { .wxParse-img {
display: block !important; display: block !important;
} }

View File

@@ -1,6 +1,6 @@
// 以下是业务服务器API地址 // 以下是业务服务器API地址
// 本机开发时使用 // 本机开发时使用
var WxApiRoot = 'http://localhost:8080/wx/'; var WxApiRoot = 'http://localhost:8080/wx/';
// 局域网测试使用 // 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8080/wx/'; // var WxApiRoot = 'http://192.168.0.101:8080/wx/';
// 云平台上线时使用 // 云平台上线时使用
@@ -8,82 +8,82 @@
// var WxApiRoot = 'https://www.menethil.com.cn/wx/'; // var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = { module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口 IndexUrl: WxApiRoot + 'home/index', //首页数据接口
CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口 CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口
CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口 CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口
CatalogAll: WxApiRoot + 'catalog/all', //分类目录当前分类数据接口 CatalogAll: WxApiRoot + 'catalog/all', //分类目录当前分类数据接口
AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录 AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录
AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录 AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录
AuthRegister: WxApiRoot + 'auth/register', //账号注册 AuthRegister: WxApiRoot + 'auth/register', //账号注册
AuthReset: WxApiRoot + 'auth/reset', //账号密码重置 AuthReset: WxApiRoot + 'auth/reset', //账号密码重置
AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码 AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码
GoodsCount: WxApiRoot + 'goods/count', //统计商品总数 GoodsCount: WxApiRoot + 'goods/count', //统计商品总数
GoodsList: WxApiRoot + 'goods/list', //获得商品列表 GoodsList: WxApiRoot + 'goods/list', //获得商品列表
GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据 GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据
GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情 GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情
GoodsNew: WxApiRoot + 'goods/new', //新品 GoodsNew: WxApiRoot + 'goods/new', //新品
GoodsHot: WxApiRoot + 'goods/hot', //热门 GoodsHot: WxApiRoot + 'goods/hot', //热门
GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看) GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看)
BrandList: WxApiRoot + 'brand/list', //品牌列表 BrandList: WxApiRoot + 'brand/list', //品牌列表
BrandDetail: WxApiRoot + 'brand/detail', //品牌详情 BrandDetail: WxApiRoot + 'brand/detail', //品牌详情
CartList: WxApiRoot + 'cart/index', //获取购物车的数据 CartList: WxApiRoot + 'cart/index', //获取购物车的数据
CartAdd: WxApiRoot + 'cart/add', // 添加商品到购物车 CartAdd: WxApiRoot + 'cart/add', // 添加商品到购物车
CartFastAdd: WxApiRoot + 'cart/fastadd', // 立即购买商品 CartFastAdd: WxApiRoot + 'cart/fastadd', // 立即购买商品
CartUpdate: WxApiRoot + 'cart/update', // 更新购物车的商品 CartUpdate: WxApiRoot + 'cart/update', // 更新购物车的商品
CartDelete: WxApiRoot + 'cart/delete', // 删除购物车的商品 CartDelete: WxApiRoot + 'cart/delete', // 删除购物车的商品
CartChecked: WxApiRoot + 'cart/checked', // 选择或取消选择商品 CartChecked: WxApiRoot + 'cart/checked', // 选择或取消选择商品
CartGoodsCount: WxApiRoot + 'cart/goodscount', // 获取购物车商品件数 CartGoodsCount: WxApiRoot + 'cart/goodscount', // 获取购物车商品件数
CartCheckout: WxApiRoot + 'cart/checkout', // 下单前信息确认 CartCheckout: WxApiRoot + 'cart/checkout', // 下单前信息确认
CollectList: WxApiRoot + 'collect/list', //收藏列表 CollectList: WxApiRoot + 'collect/list', //收藏列表
CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏 CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏
CommentList: WxApiRoot + 'comment/list', //评论列表 CommentList: WxApiRoot + 'comment/list', //评论列表
CommentCount: WxApiRoot + 'comment/count', //评论总数 CommentCount: WxApiRoot + 'comment/count', //评论总数
CommentPost: WxApiRoot + 'comment/post', //发表评论 CommentPost: WxApiRoot + 'comment/post', //发表评论
TopicList: WxApiRoot + 'topic/list', //专题列表 TopicList: WxApiRoot + 'topic/list', //专题列表
TopicDetail: WxApiRoot + 'topic/detail', //专题详情 TopicDetail: WxApiRoot + 'topic/detail', //专题详情
TopicRelated: WxApiRoot + 'topic/related', //相关专题 TopicRelated: WxApiRoot + 'topic/related', //相关专题
SearchIndex: WxApiRoot + 'search/index', //搜索关键字 SearchIndex: WxApiRoot + 'search/index', //搜索关键字
SearchResult: WxApiRoot + 'search/result', //搜索结果 SearchResult: WxApiRoot + 'search/result', //搜索结果
SearchHelper: WxApiRoot + 'search/helper', //搜索帮助 SearchHelper: WxApiRoot + 'search/helper', //搜索帮助
SearchClearHistory: WxApiRoot + 'search/clearhistory', //搜索历史清楚 SearchClearHistory: WxApiRoot + 'search/clearhistory', //搜索历史清楚
AddressList: WxApiRoot + 'address/list', //收货地址列表 AddressList: WxApiRoot + 'address/list', //收货地址列表
AddressDetail: WxApiRoot + 'address/detail', //收货地址详情 AddressDetail: WxApiRoot + 'address/detail', //收货地址详情
AddressSave: WxApiRoot + 'address/save', //保存收货地址 AddressSave: WxApiRoot + 'address/save', //保存收货地址
AddressDelete: WxApiRoot + 'address/delete', //保存收货地址 AddressDelete: WxApiRoot + 'address/delete', //保存收货地址
RegionList: WxApiRoot + 'region/list', //获取区域列表 RegionList: WxApiRoot + 'region/list', //获取区域列表
OrderSubmit: WxApiRoot + 'order/submit', // 提交订单 OrderSubmit: WxApiRoot + 'order/submit', // 提交订单
OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话 OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话
OrderList: WxApiRoot + 'order/list', //订单列表 OrderList: WxApiRoot + 'order/list', //订单列表
OrderDetail: WxApiRoot + 'order/detail', //订单详情 OrderDetail: WxApiRoot + 'order/detail', //订单详情
OrderCancel: WxApiRoot + 'order/cancel', //取消订单 OrderCancel: WxApiRoot + 'order/cancel', //取消订单
OrderRefund: WxApiRoot + 'order/refund', //退款取消订单 OrderRefund: WxApiRoot + 'order/refund', //退款取消订单
OrderDelete: WxApiRoot + 'order/delete', //删除订单 OrderDelete: WxApiRoot + 'order/delete', //删除订单
OrderConfirm: WxApiRoot + 'order/confirm', //确认收货 OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息 OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息
OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息 OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息
FootprintList: WxApiRoot + 'footprint/list', //足迹列表 FootprintList: WxApiRoot + 'footprint/list', //足迹列表
FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹 FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId用于发送模版消息 UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId用于发送模版消息
GroupOnList: WxApiRoot + 'groupon/list', //团购列表 GroupOnList: WxApiRoot + 'groupon/list', //团购列表
GroupOn: WxApiRoot + 'groupon/query', //团购API-查询 GroupOn: WxApiRoot + 'groupon/query', //团购API-查询
GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购 GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购
GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情 GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情
GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情 GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情
StorageUpload: WxApiRoot + 'storage/upload' //图片上传 StorageUpload: WxApiRoot + 'storage/upload' //图片上传
}; };

View File

@@ -4,29 +4,28 @@ var user = require('../../../utils/user.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {},
}, onLoad: function(options) {
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成 // 页面渲染完成
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
wxLogin: function (e) { wxLogin: function(e) {
if (e.detail.userInfo == undefined){ if (e.detail.userInfo == undefined) {
app.globalData.hasLogin = false; app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败'); util.showErrorToast('微信登录失败');
return; return;

View File

@@ -1,7 +1,7 @@
<view class="container"> <view class="container">
<view class="form-box"> <view class="form-box">
<button type="primary" open-type="getUserInfo" class="login-btn" bindgetuserinfo="wxLogin">微信直接登录</button> <button type="primary" open-type="getUserInfo" class="login-btn" bindgetuserinfo="wxLogin">微信直接登录</button>
</view> </view>
</view> </view>

View File

@@ -1,90 +1,90 @@
.form-box{ .form-box {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 0 40rpx; padding: 0 40rpx;
margin-top: 96rpx; margin-top: 96rpx;
background: #fff; background: #fff;
} }
.form-item{ .form-item {
position: relative; position: relative;
background: #fff; background: #fff;
height: 96rpx; height: 96rpx;
border-bottom: 1px solid #a78845; border-bottom: 1px solid #a78845;
} }
.form-item .username, .form-item .password, .form-item .code{ .form-item .username, .form-item .password, .form-item .code {
position: absolute; position: absolute;
top: 26rpx; top: 26rpx;
left: 0; left: 0;
display: block; display: block;
width: 100%; width: 100%;
height: 44rpx; height: 44rpx;
background: #fff; background: #fff;
color: #a78845; color: #a78845;
font-size: 30rpx; font-size: 30rpx;
} }
.form-item-code{ .form-item-code {
margin-top:32rpx; margin-top: 32rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
} }
.form-item-code .form-item{ .form-item-code .form-item {
float: left; float: left;
width: 350rpx; width: 350rpx;
} }
.form-item-code .code-img{ .form-item-code .code-img {
float: right; float: right;
margin-top: 4rpx; margin-top: 4rpx;
height: 88rpx; height: 88rpx;
width: 236rpx; width: 236rpx;
} }
.form-item .clear{ .form-item .clear {
position: absolute; position: absolute;
top: 26rpx; top: 26rpx;
right: 18rpx; right: 18rpx;
z-index: 2; z-index: 2;
display: block; display: block;
background: #fff; background: #fff;
height: 44rpx; height: 44rpx;
width: 44rpx; width: 44rpx;
} }
.login-btn{ .login-btn {
margin: 60rpx 0 40rpx 0; margin: 60rpx 0 40rpx 0;
height: 96rpx; height: 96rpx;
line-height: 96rpx; line-height: 96rpx;
color: #a78845; color: #a78845;
font-size: 30rpx; font-size: 30rpx;
width: 100%; width: 100%;
background: #b4282d; background: #b4282d;
border-radius: 6rpx; border-radius: 6rpx;
} }
.form-item-text{ .form-item-text {
height: 35rpx; height: 35rpx;
width: 100%; width: 100%;
color: #a78845; color: #a78845;
} }
.form-item-text .register{ .form-item-text .register {
display: block; display: block;
height: 34rpx; height: 34rpx;
float: left; float: left;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }
.form-item-text .reset{ .form-item-text .reset {
display: block; display: block;
height: 34rpx; height: 34rpx;
float: right; float: right;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }

View File

@@ -2,58 +2,58 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
brandList: [], brandList: [],
page: 1, page: 1,
size: 10, size: 10,
totalPages: 1 totalPages: 1
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.getBrandList(); this.getBrandList();
}, },
getBrandList: function() { getBrandList: function() {
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
});
let that = this;
util.request(api.BrandList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({
brandList: that.data.brandList.concat(res.data.brandList),
totalPages: res.data.totalPages
}); });
} let that = this;
wx.hideLoading(); util.request(api.BrandList, {
}); page: that.data.page,
}, size: that.data.size
onReachBottom() { }).then(function(res) {
if (this.data.totalPages > this.data.page) { if (res.errno === 0) {
this.setData({ that.setData({
page: this.data.page + 1 brandList: that.data.brandList.concat(res.data.brandList),
}); totalPages: res.data.totalPages
} else { });
return false; }
wx.hideLoading();
});
},
onReachBottom() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
} else {
return false;
}
this.getBrandList();
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
} }
this.getBrandList();
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}) })

View File

@@ -1,14 +1,14 @@
<view class="container"> <view class="container">
<view class="brand-list"> <view class="brand-list">
<navigator url="../brandDetail/brandDetail?id={{item.id}}" class="item" wx:for="{{brandList}}" wx:key="id"> <navigator url="../brandDetail/brandDetail?id={{item.id}}" class="item" wx:for="{{brandList}}" wx:key="id">
<view class="img-bg"> <view class="img-bg">
<image src="{{item.picUrl}}" background-size="cover"></image> <image src="{{item.picUrl}}" background-size="cover"></image>
</view> </view>
<view class="txt-box"> <view class="txt-box">
<view class="line"> <view class="line">
<text class="name">{{item.name}}</text> <text class="name">{{item.name}}</text>
</view> </view>
</view> </view>
</navigator> </navigator>
</view> </view>
</view> </view>

View File

@@ -1,52 +1,52 @@
.brand-list .item{ .brand-list .item {
display: block; display: block;
width: 750rpx; width: 750rpx;
height: 416rpx; height: 416rpx;
position: relative; position: relative;
margin-bottom: 4rpx; margin-bottom: 4rpx;
} }
.brand-list .item .img-bg{ .brand-list .item .img-bg {
position: absolute; position: absolute;
left:0; left: 0;
top:0; top: 0;
z-index: 0; z-index: 0;
width: 750rpx; width: 750rpx;
height: 417rpx; height: 417rpx;
overflow: hidden; overflow: hidden;
} }
.brand-list .item .img-bg image{ .brand-list .item .img-bg image {
width: 750rpx; width: 750rpx;
height: 416rpx; height: 416rpx;
} }
.brand-list .item .txt-box{ .brand-list .item .txt-box {
position: absolute; position: absolute;
left:0; left: 0;
top:0; top: 0;
display: table; display: table;
z-index: 0; z-index: 0;
width: 750rpx; width: 750rpx;
height: 417rpx; height: 417rpx;
} }
.brand-list .item .line{ .brand-list .item .line {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
height: 63rpx; height: 63rpx;
line-height: 63rpx; line-height: 63rpx;
} }
.brand-list .item .line text{ .brand-list .item .line text {
font-size: 35rpx; font-size: 35rpx;
font-weight: 700; font-weight: 700;
text-shadow: 1rpx 1rpx rgba(0,0,0,.32); text-shadow: 1rpx 1rpx rgba(0, 0, 0, 0.32);
color: #fff; color: #fff;
} }
.brand-list .item .line .s{ .brand-list .item .line .s {
padding: 0 10rpx; padding: 0 10rpx;
font-size: 40rpx; font-size: 40rpx;
} }

View File

@@ -1,69 +1,68 @@
var util = require('../../utils/util.js'); var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
id: 0, id: 0,
brand: {}, brand: {},
goodsList: [], goodsList: [],
page: 1, page: 1,
size: 100 size: 100
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
var that = this; var that = this;
that.setData({
id: parseInt(options.id)
});
this.getBrand();
},
getBrand: function() {
let that = this;
util.request(api.BrandDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({ that.setData({
brand: res.data.brand id: parseInt(options.id)
}); });
this.getBrand();
},
getBrand: function() {
let that = this;
util.request(api.BrandDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
brand: res.data.brand
});
that.getGoodsList(); that.getGoodsList();
} }
}); });
}, },
getGoodsList() { getGoodsList() {
var that = this; var that = this;
util.request(api.GoodsList, { util.request(api.GoodsList, {
brandId: that.data.id, brandId: that.data.id,
page: that.data.page, page: that.data.page,
size: that.data.size size: that.data.size
}) })
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList goodsList: res.data.goodsList
}); });
} }
}); });
}, },
onReady: function() { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function() { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function() { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function() { onUnload: function() {
// 页面关闭 // 页面关闭
} }
}) })

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "品牌商详情", "navigationBarTitleText": "品牌商详情",
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }

View File

@@ -1,20 +1,20 @@
<view class="container"> <view class="container">
<view class="brand-info"> <view class="brand-info">
<view class="name"> <view class="name">
<image class="img" src="{{brand.picUrl}}" background-size="cover"></image> <image class="img" src="{{brand.picUrl}}" background-size="cover"></image>
<view class="info-box"> <view class="info-box">
<view class="info"> <view class="info">
<text class="txt">{{brand.name}}</text> <text class="txt">{{brand.name}}</text>
<text class="line"></text> <text class="line"></text>
</view>
</view>
</view>
<view class="desc">
{{brand.desc}}
</view> </view>
</view>
</view> </view>
<view class="desc">
{{brand.desc}}
</view>
</view>
<view class="cate-item"> <view class="cate-item">
<goodList calss="goodList" goods="{{goodsList}}"></goodList> <goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view> </view>
</view> </view>

View File

@@ -1,61 +1,61 @@
page { page {
background: #f4f4f4; background: #f4f4f4;
} }
.brand-info .name { .brand-info .name {
width: 100%; width: 100%;
height: 290rpx; height: 290rpx;
position: relative; position: relative;
} }
.brand-info .img { .brand-info .img {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 290rpx; height: 290rpx;
} }
.brand-info .info-box { .brand-info .info-box {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 290rpx; height: 290rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.brand-info .info { .brand-info .info {
display: block; display: block;
} }
.brand-info .txt { .brand-info .txt {
display: block; display: block;
height: 37.5rpx; height: 37.5rpx;
font-size: 37.5rpx; font-size: 37.5rpx;
color: #fff; color: #fff;
} }
.brand-info .line { .brand-info .line {
margin: 0 auto; margin: 0 auto;
margin-top: 16rpx; margin-top: 16rpx;
display: block; display: block;
height: 2rpx; height: 2rpx;
width: 145rpx; width: 145rpx;
background: #fff; background: #fff;
} }
.brand-info .desc { .brand-info .desc {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 41.5rpx 31.25rpx; padding: 41.5rpx 31.25rpx;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
line-height: 41.5rpx; line-height: 41.5rpx;
text-align: center; text-align: center;
} }

View File

@@ -5,301 +5,301 @@ var user = require('../../utils/user.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
cartGoods: [], cartGoods: [],
cartTotal: { cartTotal: {
"goodsCount": 0, "goodsCount": 0,
"goodsAmount": 0.00, "goodsAmount": 0.00,
"checkedGoodsCount": 0, "checkedGoodsCount": 0,
"checkedGoodsAmount": 0.00 "checkedGoodsAmount": 0.00
},
isEditCart: false,
checkedAllStatus: true,
editCartList: [],
hasLogin: false
}, },
isEditCart: false, onLoad: function(options) {
checkedAllStatus: true, // 页面初始化 options为页面跳转所带来的参数
editCartList: [], },
hasLogin: false onReady: function() {
}, // 页面渲染完成
onLoad: function(options) { },
// 页面初始化 options为页面跳转所带来的参数 onShow: function() {
}, // 页面显示
onReady: function() { if (app.globalData.hasLogin) {
// 页面渲染完成 this.getCartList();
},
onShow: function() {
// 页面显示
if (app.globalData.hasLogin) {
this.getCartList();
}
this.setData({
hasLogin: app.globalData.hasLogin
});
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
goLogin() {
wx.navigateTo({
url: "/pages/auth/login/login"
});
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCartList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getCartList: function() {
let that = this;
util.request(api.CartList).then(function(res) {
if (res.errno === 0) {
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
that.setData({
checkedAllStatus: that.isCheckedAll()
});
}
});
},
isCheckedAll: function() {
//判断购物车商品已全选
return this.data.cartGoods.every(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
},
doCheckedAll: function() {
let checkedAll = this.isCheckedAll()
this.setData({
checkedAllStatus: this.isCheckedAll()
});
},
checkedItem: function(event) {
let itemIndex = event.target.dataset.itemIndex;
let that = this;
let productIds = [];
productIds.push(that.data.cartGoods[itemIndex].productId);
if (!this.data.isEditCart) {
util.request(api.CartChecked, {
productIds: productIds,
isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
} }
that.setData({ this.setData({
checkedAllStatus: that.isCheckedAll() hasLogin: app.globalData.hasLogin
}); });
});
} else { },
//编辑状态 onHide: function() {
let tmpCartData = this.data.cartGoods.map(function(element, index, array) { // 页面隐藏
if (index == itemIndex) { },
element.checked = !element.checked; onUnload: function() {
// 页面关闭
},
goLogin() {
wx.navigateTo({
url: "/pages/auth/login/login"
});
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCartList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getCartList: function() {
let that = this;
util.request(api.CartList).then(function(res) {
if (res.errno === 0) {
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
that.setData({
checkedAllStatus: that.isCheckedAll()
});
}
});
},
isCheckedAll: function() {
//判断购物车商品已全选
return this.data.cartGoods.every(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
},
doCheckedAll: function() {
let checkedAll = this.isCheckedAll()
this.setData({
checkedAllStatus: this.isCheckedAll()
});
},
checkedItem: function(event) {
let itemIndex = event.target.dataset.itemIndex;
let that = this;
let productIds = [];
productIds.push(that.data.cartGoods[itemIndex].productId);
if (!this.data.isEditCart) {
util.request(api.CartChecked, {
productIds: productIds,
isChecked: that.data.cartGoods[itemIndex].checked ? 0 : 1
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
} else {
//编辑状态
let tmpCartData = this.data.cartGoods.map(function(element, index, array) {
if (index == itemIndex) {
element.checked = !element.checked;
}
return element;
});
that.setData({
cartGoods: tmpCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
}
},
getCheckedGoodsCount: function() {
let checkedGoodsCount = 0;
this.data.cartGoods.forEach(function(v) {
if (v.checked === true) {
checkedGoodsCount += v.number;
}
});
console.log(checkedGoodsCount);
return checkedGoodsCount;
},
checkedAll: function() {
let that = this;
if (!this.data.isEditCart) {
var productIds = this.data.cartGoods.map(function(v) {
return v.productId;
});
util.request(api.CartChecked, {
productIds: productIds,
isChecked: that.isCheckedAll() ? 0 : 1
}, 'POST').then(function(res) {
if (res.errno === 0) {
console.log(res.data);
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
} else {
//编辑状态
let checkedAllStatus = that.isCheckedAll();
let tmpCartData = this.data.cartGoods.map(function(v) {
v.checked = !checkedAllStatus;
return v;
});
that.setData({
cartGoods: tmpCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
} }
return element; },
}); editCart: function() {
var that = this;
that.setData({ if (this.data.isEditCart) {
cartGoods: tmpCartData, this.getCartList();
checkedAllStatus: that.isCheckedAll(), this.setData({
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount() isEditCart: !this.data.isEditCart
}); });
} } else {
}, //编辑状态
getCheckedGoodsCount: function() { let tmpCartList = this.data.cartGoods.map(function(v) {
let checkedGoodsCount = 0; v.checked = false;
this.data.cartGoods.forEach(function(v) { return v;
if (v.checked === true) { });
checkedGoodsCount += v.number; this.setData({
} editCartList: this.data.cartGoods,
}); cartGoods: tmpCartList,
console.log(checkedGoodsCount); isEditCart: !this.data.isEditCart,
return checkedGoodsCount; checkedAllStatus: that.isCheckedAll(),
}, 'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
checkedAll: function() { });
let that = this;
if (!this.data.isEditCart) {
var productIds = this.data.cartGoods.map(function(v) {
return v.productId;
});
util.request(api.CartChecked, {
productIds: productIds,
isChecked: that.isCheckedAll() ? 0 : 1
}, 'POST').then(function(res) {
if (res.errno === 0) {
console.log(res.data);
that.setData({
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
} }
that.setData({ },
checkedAllStatus: that.isCheckedAll() updateCart: function(productId, goodsId, number, id) {
}); let that = this;
});
} else {
//编辑状态
let checkedAllStatus = that.isCheckedAll();
let tmpCartData = this.data.cartGoods.map(function(v) {
v.checked = !checkedAllStatus;
return v;
});
that.setData({ util.request(api.CartUpdate, {
cartGoods: tmpCartData, productId: productId,
checkedAllStatus: that.isCheckedAll(), goodsId: goodsId,
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount() number: number,
}); id: id
} }, 'POST').then(function(res) {
that.setData({
}, checkedAllStatus: that.isCheckedAll()
editCart: function() { });
var that = this;
if (this.data.isEditCart) {
this.getCartList();
this.setData({
isEditCart: !this.data.isEditCart
});
} else {
//编辑状态
let tmpCartList = this.data.cartGoods.map(function(v) {
v.checked = false;
return v;
});
this.setData({
editCartList: this.data.cartGoods,
cartGoods: tmpCartList,
isEditCart: !this.data.isEditCart,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
}
},
updateCart: function(productId, goodsId, number, id) {
let that = this;
util.request(api.CartUpdate, {
productId: productId,
goodsId: goodsId,
number: number,
id: id
}, 'POST').then(function(res) {
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
},
cutNumber: function(event) {
let itemIndex = event.target.dataset.itemIndex;
let cartItem = this.data.cartGoods[itemIndex];
let number = (cartItem.number - 1 > 1) ? cartItem.number - 1 : 1;
cartItem.number = number;
this.setData({
cartGoods: this.data.cartGoods
});
this.updateCart(cartItem.productId, cartItem.goodsId, number, cartItem.id);
},
addNumber: function(event) {
let itemIndex = event.target.dataset.itemIndex;
let cartItem = this.data.cartGoods[itemIndex];
let number = cartItem.number + 1;
cartItem.number = number;
this.setData({
cartGoods: this.data.cartGoods
});
this.updateCart(cartItem.productId, cartItem.goodsId, number, cartItem.id);
},
checkoutOrder: function() {
//获取已选择的商品
let that = this;
var checkedGoods = this.data.cartGoods.filter(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
if (checkedGoods.length <= 0) {
return false;
}
// storage中设置了cartId则是购物车购买
try {
wx.setStorageSync('cartId', 0);
wx.navigateTo({
url: '../shopping/checkout/checkout'
})
} catch (e) {}
},
deleteCart: function() {
//获取已选择的商品
let that = this;
let productIds = this.data.cartGoods.filter(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
if (productIds.length <= 0) {
return false;
}
productIds = productIds.map(function(element, index, array) {
if (element.checked == true) {
return element.productId;
}
});
util.request(api.CartDelete, {
productIds: productIds
}, 'POST').then(function(res) {
if (res.errno === 0) {
console.log(res.data);
let cartList = res.data.cartList.map(v => {
v.checked = false;
return v;
}); });
that.setData({ },
cartGoods: cartList, cutNumber: function(event) {
cartTotal: res.data.cartTotal
});
}
that.setData({ let itemIndex = event.target.dataset.itemIndex;
checkedAllStatus: that.isCheckedAll() let cartItem = this.data.cartGoods[itemIndex];
}); let number = (cartItem.number - 1 > 1) ? cartItem.number - 1 : 1;
}); cartItem.number = number;
} this.setData({
cartGoods: this.data.cartGoods
});
this.updateCart(cartItem.productId, cartItem.goodsId, number, cartItem.id);
},
addNumber: function(event) {
let itemIndex = event.target.dataset.itemIndex;
let cartItem = this.data.cartGoods[itemIndex];
let number = cartItem.number + 1;
cartItem.number = number;
this.setData({
cartGoods: this.data.cartGoods
});
this.updateCart(cartItem.productId, cartItem.goodsId, number, cartItem.id);
},
checkoutOrder: function() {
//获取已选择的商品
let that = this;
var checkedGoods = this.data.cartGoods.filter(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
if (checkedGoods.length <= 0) {
return false;
}
// storage中设置了cartId则是购物车购买
try {
wx.setStorageSync('cartId', 0);
wx.navigateTo({
url: '../shopping/checkout/checkout'
})
} catch (e) {}
},
deleteCart: function() {
//获取已选择的商品
let that = this;
let productIds = this.data.cartGoods.filter(function(element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
if (productIds.length <= 0) {
return false;
}
productIds = productIds.map(function(element, index, array) {
if (element.checked == true) {
return element.productId;
}
});
util.request(api.CartDelete, {
productIds: productIds
}, 'POST').then(function(res) {
if (res.errno === 0) {
console.log(res.data);
let cartList = res.data.cartList.map(v => {
v.checked = false;
return v;
});
that.setData({
cartGoods: cartList,
cartTotal: res.data.cartTotal
});
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
}
}) })

View File

@@ -1,4 +1,4 @@
{ {
"backgroundColor": "#f4f4f4", "backgroundColor": "#f4f4f4",
"navigationBarTitleText": "购物车" "navigationBarTitleText": "购物车"
} }

View File

@@ -1,59 +1,59 @@
<view class="container"> <view class="container">
<view class="no-login" wx:if="{{!hasLogin}}"> <view class="no-login" wx:if="{{!hasLogin}}">
<view class="c"> <view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" /> <image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>还没有登录</text> <text>还没有登录</text>
<button plain="true" bindtap="goLogin">去登录</button> <button plain="true" bindtap="goLogin">去登录</button>
</view> </view>
</view> </view>
<view class='login' wx:else> <view class='login' wx:else>
<view class="service-policy"> <view class="service-policy">
<view class="item">30天无忧退货</view> <view class="item">30天无忧退货</view>
<view class="item">48小时快速退款</view> <view class="item">48小时快速退款</view>
<view class="item">满88元免邮费</view> <view class="item">满88元免邮费</view>
</view> </view>
<view class="no-cart" wx:if="{{cartGoods.length <= 0}}"> <view class="no-cart" wx:if="{{cartGoods.length <= 0}}">
<view class="c"> <view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" /> <image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>去添加点什么吧</text> <text>去添加点什么吧</text>
</view> </view>
</view> </view>
<view class="cart-view" wx:else> <view class="cart-view" wx:else>
<view class="list"> <view class="list">
<view class="group-item"> <view class="group-item">
<view class="goods"> <view class="goods">
<view class="item {{isEditCart ? 'edit' : ''}}" wx:for="{{cartGoods}}" wx:key="id"> <view class="item {{isEditCart ? 'edit' : ''}}" wx:for="{{cartGoods}}" wx:key="id">
<view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view> <view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-item-index="{{index}}"></view>
<view class="cart-goods"> <view class="cart-goods">
<image class="img" src="{{item.picUrl}}"></image> <image class="img" src="{{item.picUrl}}"></image>
<view class="info"> <view class="info">
<view class="t"> <view class="t">
<text class="name">{{item.goodsName}}</text> <text class="name">{{item.goodsName}}</text>
<text class="num">x{{item.number}}</text> <text class="num">x{{item.number}}</text>
</view> </view>
<view class="attr">{{ isEditCart ? '已选择:' : ''}}{{item.goodsSpecificationValues||''}}</view> <view class="attr">{{ isEditCart ? '已选择:' : ''}}{{item.goodsSpecificationValues||''}}</view>
<view class="b"> <view class="b">
<text class="price">¥{{item.price}}</text> <text class="price">¥{{item.price}}</text>
<view class="selnum"> <view class="selnum">
<view class="cut" bindtap="cutNumber" data-item-index="{{index}}">-</view> <view class="cut" bindtap="cutNumber" data-item-index="{{index}}">-</view>
<input value="{{item.number}}" class="number" disabled="true" type="number" /> <input value="{{item.number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber" data-item-index="{{index}}">+</view> <view class="add" bindtap="addNumber" data-item-index="{{index}}">+</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view>
</view>
<view class="cart-bottom">
<view class="checkbox {{checkedAllStatus ? 'checked' : ''}}" bindtap="checkedAll">全选({{cartTotal.checkedGoodsCount}})</view>
<view class="total">{{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}}</view>
<view class="delete" bindtap="editCart">{{!isEditCart ? '编辑' : '完成'}}</view>
<view class="checkout" bindtap="deleteCart" wx:if="{{isEditCart}}">删除所选</view>
<view class="checkout" bindtap="checkoutOrder" wx:if="{{!isEditCart}}">下单</view>
</view>
</view> </view>
</view>
<view class="cart-bottom">
<view class="checkbox {{checkedAllStatus ? 'checked' : ''}}" bindtap="checkedAll">全选({{cartTotal.checkedGoodsCount}})</view>
<view class="total">{{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}}</view>
<view class="delete" bindtap="editCart">{{!isEditCart ? '编辑' : '完成'}}</view>
<view class="checkout" bindtap="deleteCart" wx:if="{{isEditCart}}">删除所选</view>
<view class="checkout" bindtap="checkoutOrder" wx:if="{{!isEditCart}}">下单</view>
</view>
</view> </view>
</view>
</view> </view>

View File

@@ -1,394 +1,394 @@
page { page {
height: 100%; height: 100%;
min-height: 100%; min-height: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.container { .container {
background: #f4f4f4; background: #f4f4f4;
width: 100%; width: 100%;
height: auto; height: auto;
min-height: 100%; min-height: 100%;
overflow: hidden; overflow: hidden;
} }
.service-policy { .service-policy {
width: 750rpx; width: 750rpx;
height: 73rpx; height: 73rpx;
background: #f4f4f4; background: #f4f4f4;
padding: 0 31.25rpx; padding: 0 31.25rpx;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.service-policy .item { .service-policy .item {
/* background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/servicePolicyRed-518d32d74b.png) 0 center no-repeat; */ /* background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/servicePolicyRed-518d32d74b.png) 0 center no-repeat; */
background-size: 10rpx; background-size: 10rpx;
padding-left: 15rpx; padding-left: 15rpx;
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 25rpx; font-size: 25rpx;
color: #a78845; color: #a78845;
} }
.no-login { .no-login {
width: 100%; width: 100%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
color: #a78845; color: #a78845;
} }
.no-login .c { .no-login .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
color: #a78845; color: #a78845;
} }
.no-login .c image { .no-login .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
color: #a78845; color: #a78845;
} }
.no-login .c text { .no-login .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 59rpx; height: 59rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 40rpx; font-size: 40rpx;
color: #a78845; color: #a78845;
} }
.no-login button { .no-login button {
width: 60%; width: 60%;
margin: 0 auto; margin: 0 auto;
color: #a78845; color: #a78845;
/* background-color: #FFF; */ /* background-color: #FFF; */
border-color: #a78845; border-color: #a78845;
} }
.no-cart { .no-cart {
width: 100%; width: 100%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
color: #a78845; color: #a78845;
} }
.no-cart .c { .no-cart .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
} }
.no-cart .c image { .no-cart .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
} }
.no-cart .c text { .no-cart .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #999; color: #999;
} }
.cart-view { .cart-view {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.cart-view .list { .cart-view .list {
height: auto; height: auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
margin-bottom: 120rpx; margin-bottom: 120rpx;
} }
.cart-view .group-item { .cart-view .group-item {
height: auto; height: auto;
width: 100%; width: 100%;
background: #fff; background: #fff;
margin-bottom: 18rpx; margin-bottom: 18rpx;
} }
.cart-view .item { .cart-view .item {
height: 164rpx; height: 164rpx;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.cart-view .item .checkbox { .cart-view .item .checkbox {
float: left; float: left;
height: 34rpx; height: 34rpx;
width: 34rpx; width: 34rpx;
margin: 65rpx 18rpx 65rpx 26rpx; margin: 65rpx 18rpx 65rpx 26rpx;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-0e09baa37e.png) no-repeat; background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-0e09baa37e.png) no-repeat;
background-size: 34rpx; background-size: 34rpx;
} }
.cart-view .item .checkbox.checked { .cart-view .item .checkbox.checked {
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-checked-822e54472a.png) no-repeat; background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-checked-822e54472a.png) no-repeat;
background-size: 34rpx; background-size: 34rpx;
} }
.cart-view .item .cart-goods { .cart-view .item .cart-goods {
float: left; float: left;
height: 164rpx; height: 164rpx;
width: 672rpx; width: 672rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.cart-view .item .img { .cart-view .item .img {
float: left; float: left;
height: 125rpx; height: 125rpx;
width: 125rpx; width: 125rpx;
background: #f4f4f4; background: #f4f4f4;
margin: 19.5rpx 18rpx 19.5rpx 0; margin: 19.5rpx 18rpx 19.5rpx 0;
} }
.cart-view .item .info { .cart-view .item .info {
float: left; float: left;
height: 125rpx; height: 125rpx;
width: 503rpx; width: 503rpx;
margin: 19.5rpx 26rpx 19.5rpx 0; margin: 19.5rpx 26rpx 19.5rpx 0;
} }
.cart-view .item .t { .cart-view .item .t {
margin: 8rpx 0; margin: 8rpx 0;
height: 28rpx; height: 28rpx;
font-size: 25rpx; font-size: 25rpx;
color: #333; color: #333;
overflow: hidden; overflow: hidden;
} }
.cart-view .item .name { .cart-view .item .name {
height: 28rpx; height: 28rpx;
max-width: 310rpx; max-width: 310rpx;
line-height: 28rpx; line-height: 28rpx;
font-size: 25rpx; font-size: 25rpx;
color: #333; color: #333;
overflow: hidden; overflow: hidden;
} }
.cart-view .item .num { .cart-view .item .num {
height: 28rpx; height: 28rpx;
line-height: 28rpx; line-height: 28rpx;
float: right; float: right;
} }
.cart-view .item .attr { .cart-view .item .attr {
margin-bottom: 17rpx; margin-bottom: 17rpx;
height: 24rpx; height: 24rpx;
line-height: 24rpx; line-height: 24rpx;
font-size: 22rpx; font-size: 22rpx;
color: #666; color: #666;
overflow: hidden; overflow: hidden;
} }
.cart-view .item .b { .cart-view .item .b {
height: 28rpx; height: 28rpx;
line-height: 28rpx; line-height: 28rpx;
font-size: 25rpx; font-size: 25rpx;
color: #333; color: #333;
overflow: hidden; overflow: hidden;
} }
.cart-view .item .price { .cart-view .item .price {
float: left; float: left;
color: #a78845; color: #a78845;
} }
.cart-view .item .open { .cart-view .item .open {
height: 28rpx; height: 28rpx;
width: 150rpx; width: 150rpx;
display: block; display: block;
float: right; float: right;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/arrowDown-d48093db25.png) right center no-repeat; background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/arrowDown-d48093db25.png) right center no-repeat;
background-size: 25rpx; background-size: 25rpx;
font-size: 25rpx; font-size: 25rpx;
color: #333; color: #333;
} }
.cart-view .item.edit .t { .cart-view .item.edit .t {
display: none; display: none;
} }
.cart-view .item.edit .attr { .cart-view .item.edit .attr {
text-align: right; text-align: right;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/arrow-right1-e9828c5b35.png) right center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/arrow-right1-e9828c5b35.png) right center no-repeat;
padding-right: 25rpx; padding-right: 25rpx;
background-size: 12rpx 20rpx; background-size: 12rpx 20rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
height: 39rpx; height: 39rpx;
line-height: 39rpx; line-height: 39rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
overflow: hidden; overflow: hidden;
} }
.cart-view .item.edit .b { .cart-view .item.edit .b {
display: flex; display: flex;
height: 52rpx; height: 52rpx;
overflow: hidden; overflow: hidden;
} }
.cart-view .item.edit .price { .cart-view .item.edit .price {
line-height: 52rpx; line-height: 52rpx;
height: 52rpx; height: 52rpx;
flex: 1; flex: 1;
} }
.cart-view .item .selnum { .cart-view .item .selnum {
display: none; display: none;
} }
.cart-view .item.edit .selnum { .cart-view .item.edit .selnum {
width: 235rpx; width: 235rpx;
height: 52rpx; height: 52rpx;
border: 1rpx solid #ccc; border: 1rpx solid #ccc;
display: flex; display: flex;
} }
.selnum .cut { .selnum .cut {
width: 70rpx; width: 70rpx;
height: 100%; height: 100%;
text-align: center; text-align: center;
line-height: 50rpx; line-height: 50rpx;
} }
.selnum .number { .selnum .number {
flex: 1; flex: 1;
height: 100%; height: 100%;
text-align: center; text-align: center;
line-height: 68.75rpx; line-height: 68.75rpx;
border-left: 1px solid #ccc; border-left: 1px solid #ccc;
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
float: left; float: left;
} }
.selnum .add { .selnum .add {
width: 80rpx; width: 80rpx;
height: 100%; height: 100%;
text-align: center; text-align: center;
line-height: 50rpx; line-height: 50rpx;
} }
.cart-view .group-item .header { .cart-view .group-item .header {
width: 100%; width: 100%;
height: 94rpx; height: 94rpx;
line-height: 94rpx; line-height: 94rpx;
padding: 0 26rpx; padding: 0 26rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.cart-view .promotion .icon { .cart-view .promotion .icon {
display: inline-block; display: inline-block;
height: 24rpx; height: 24rpx;
width: 15rpx; width: 15rpx;
} }
.cart-view .promotion { .cart-view .promotion {
margin-top: 25.5rpx; margin-top: 25.5rpx;
float: left; float: left;
height: 43rpx; height: 43rpx;
width: 480rpx; width: 480rpx;
/*margin-right: 84rpx;*/ /*margin-right: 84rpx;*/
line-height: 43rpx; line-height: 43rpx;
font-size: 0; font-size: 0;
} }
.cart-view .promotion .tag { .cart-view .promotion .tag {
border: 1px solid #f48f18; border: 1px solid #f48f18;
height: 37rpx; height: 37rpx;
line-height: 31rpx; line-height: 31rpx;
padding: 0 9rpx; padding: 0 9rpx;
margin-right: 10rpx; margin-right: 10rpx;
color: #f48f18; color: #f48f18;
font-size: 24.5rpx; font-size: 24.5rpx;
} }
.cart-view .promotion .txt { .cart-view .promotion .txt {
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
padding-right: 10rpx; padding-right: 10rpx;
color: #333; color: #333;
font-size: 29rpx; font-size: 29rpx;
overflow: hidden; overflow: hidden;
} }
.cart-view .get { .cart-view .get {
margin-top: 18rpx; margin-top: 18rpx;
float: right; float: right;
height: 58rpx; height: 58rpx;
padding-left: 14rpx; padding-left: 14rpx;
border-left: 1px solid #d9d9d9; border-left: 1px solid #d9d9d9;
line-height: 58rpx; line-height: 58rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.cart-bottom { .cart-bottom {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
height: 100rpx; height: 100rpx;
width: 100%; width: 100%;
background: #fff; background: #fff;
display: flex; display: flex;
} }
.cart-bottom .checkbox { .cart-bottom .checkbox {
height: 34rpx; height: 34rpx;
padding-left: 60rpx; padding-left: 60rpx;
line-height: 34rpx; line-height: 34rpx;
margin: 33rpx 18rpx 33rpx 26rpx; margin: 33rpx 18rpx 33rpx 26rpx;
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-0e09baa37e.png) no-repeat; background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-0e09baa37e.png) no-repeat;
background-size: 34rpx; background-size: 34rpx;
font-size: 29rpx; font-size: 29rpx;
} }
.cart-bottom .checkbox.checked { .cart-bottom .checkbox.checked {
background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-checked-822e54472a.png) no-repeat; background: url(http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/checkbox-checked-822e54472a.png) no-repeat;
background-size: 34rpx; background-size: 34rpx;
} }
.cart-bottom .total { .cart-bottom .total {
height: 34rpx; height: 34rpx;
flex: 1; flex: 1;
margin: 33rpx 10rpx; margin: 33rpx 10rpx;
font-size: 29rpx; font-size: 29rpx;
color: #a78845; color: #a78845;
} }
.cart-bottom .delete { .cart-bottom .delete {
height: 34rpx; height: 34rpx;
width: auto; width: auto;
margin: 33rpx 18rpx; margin: 33rpx 18rpx;
font-size: 29rpx; font-size: 29rpx;
} }
.cart-bottom .checkout { .cart-bottom .checkout {
height: 100rpx; height: 100rpx;
width: 210rpx; width: 210rpx;
text-align: center; text-align: center;
line-height: 100rpx; line-height: 100rpx;
font-size: 29rpx; font-size: 29rpx;
background: #a78845; background: #a78845;
color: #fff; color: #fff;
} }

View File

@@ -2,81 +2,81 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
Page({ Page({
data: { data: {
categoryList: [], categoryList: [],
currentCategory: {}, currentCategory: {},
currentSubCategoryList: {}, currentSubCategoryList: {},
allList: {}, allList: {},
scrollLeft: 0, scrollLeft: 0,
scrollTop: 0, scrollTop: 0,
goodsCount: 0, goodsCount: 0,
scrollHeight: 0 scrollHeight: 0
}, },
onLoad: function(options) { onLoad: function(options) {
this.getCatalog(); this.getCatalog();
}, },
onPullDownRefresh() { onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCatalog(); this.getCatalog();
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getCatalog: function() { getCatalog: function() {
//CatalogList //CatalogList
let that = this; let that = this;
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
});
util.request(api.CatalogAll).then(function(res) {
that.setData({
allList: res.data.allList,
categoryList: res.data.categoryList,
currentCategory: res.data.currentCategory,
currentSubCategoryList: res.data.currentSubCategory
});
});
wx.hideLoading();
},
getCurrentCategory: function(item) {
let that = this;
for (var key in that.data.allList) {
if (key == item.id) {
that.setData({
currentCategory: item,
currentSubCategoryList: that.data.allList[key]
}); });
} util.request(api.CatalogAll).then(function(res) {
} that.setData({
}, allList: res.data.allList,
onReady: function() { categoryList: res.data.categoryList,
// 页面渲染完成 currentCategory: res.data.currentCategory,
}, currentSubCategoryList: res.data.currentSubCategory
onShow: function() { });
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchCate: function(event) { });
if (this.data.currentCategory.id == event.currentTarget.dataset.id) {
return false;
}
this.getCurrentCategory(event.currentTarget.dataset.id); wx.hideLoading();
}, },
levelClick: function(e) { getCurrentCategory: function(item) {
console.log(e.currentTarget.dataset.id) let that = this;
wx.navigateTo({
url: "/pages/category/category?id=" + e.currentTarget.dataset.id for (var key in that.data.allList) {
}) if (key == item.id) {
} that.setData({
currentCategory: item,
currentSubCategoryList: that.data.allList[key]
});
}
}
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchCate: function(event) {
if (this.data.currentCategory.id == event.currentTarget.dataset.id) {
return false;
}
this.getCurrentCategory(event.currentTarget.dataset.id);
},
levelClick: function(e) {
console.log(e.currentTarget.dataset.id)
wx.navigateTo({
url: "/pages/category/category?id=" + e.currentTarget.dataset.id
})
}
}) })

View File

@@ -1,59 +1,67 @@
.HotName{ .HotName {
font-size:80rpx; font-size: 80rpx;
margin-left:40rpx; margin-left: 40rpx;
color:#293539; color: #293539;
font-weight:300; font-weight: 300;
position: relative; position: relative;
} }
.HotName text{
width:14rpx; .HotName text {
height:14rpx; width: 14rpx;
position:absolute; height: 14rpx;
border:2px solid #a78845; position: absolute;
border-radius:50%; border: 2px solid #a78845;
border-radius: 50%;
} }
.menu-box{
width:80%; .menu-box {
margin:0 auto; width: 80%;
margin-top:40rpx; margin: 0 auto;
margin-top: 40rpx;
} }
.menu-box-list{
text-align:center; .menu-box-list {
margin-bottom:30rpx; text-align: center;
margin-bottom: 30rpx;
} }
.menu-box-list .menu-list-title{
color:#6a7275; .menu-box-list .menu-list-title {
font-size:40rpx; color: #6a7275;
font-weight:300; font-size: 40rpx;
letter-spacing:20rpx; font-weight: 300;
letter-spacing: 20rpx;
position: relative; position: relative;
} }
.menu-box-list .hover{
color:#a78845; .menu-box-list .hover {
color: #a78845;
} }
.menu-box-list .hover .l{
width:10rpx; .menu-box-list .hover .l {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:2rpx solid #a78845; position: absolute;
border-radius:50%; border: 2rpx solid #a78845;
margin-left:-38rpx; border-radius: 50%;
margin-top:30rpx; margin-left: -38rpx;
margin-top: 30rpx;
} }
.menu-box-list .hover .r{
width:10rpx; .menu-box-list .hover .r {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:2rpx solid #a78845; position: absolute;
border-radius:50%; border: 2rpx solid #a78845;
margin-left:6rpx; border-radius: 50%;
margin-top:30rpx; margin-left: 6rpx;
margin-top: 30rpx;
} }
.menu-list-pro{
.menu-list-pro {
overflow-x: scroll; overflow-x: scroll;
margin-top: 40rpx; margin-top: 40rpx;
white-space:nowrap; white-space: nowrap;
text-overflow:ellipsis; text-overflow: ellipsis;
height: auto; height: auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
@@ -70,8 +78,8 @@
.menu-list-pro .icon { .menu-list-pro .icon {
height: 100rpx; height: 100rpx;
width: 100rpx; width: 100rpx;
border-radius:12rpx; border-radius: 12rpx;
box-shadow:0px 4rpx 4rpx 0px #cfc9ca; box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
} }
.menu-list-pro .txt { .menu-list-pro .txt {
@@ -115,7 +123,7 @@
font-size: 30rpx; font-size: 30rpx;
} }
/* .menu-list-pro image{ /* .menu-list-pro image{
height: 80px; height: 80px;
width: 80px; width: 80px;
margin-right: 34rpx; margin-right: 34rpx;
@@ -132,4 +140,4 @@
color: #333; color: #333;
height: 42rpx; height: 42rpx;
width: 80px; width: 80px;
} */ } */

View File

@@ -2,139 +2,139 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
Page({ Page({
data: { data: {
navList: [], navList: [],
goodsList: [], goodsList: [],
id: 0, id: 0,
currentCategory: {}, currentCategory: {},
scrollLeft: 0, scrollLeft: 0,
scrollTop: 0, scrollTop: 0,
scrollHeight: 0, scrollHeight: 0,
page: 1, page: 1,
size: 100 size: 100
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
var that = this; var that = this;
if (options.id) { if (options.id) {
that.setData({
id: parseInt(options.id)
});
}
wx.getSystemInfo({
success: function(res) {
that.setData({
scrollHeight: res.windowHeight
});
}
});
this.getCategoryInfo();
},
onPullDownRefresh() {
// wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCategoryInfo();
// wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getCategoryInfo: function() {
let that = this;
util.request(api.GoodsCategory, {
id: this.data.id
})
.then(function(res) {
if (res.errno == 0) {
that.setData({
navList: res.data.brotherCategory,
currentCategory: res.data.currentCategory
});
wx.setNavigationBarTitle({
title: res.data.parentCategory.name
})
//nav位置
let currentIndex = 0;
let navListCount = that.data.navList.length;
for (let i = 0; i < navListCount; i++) {
currentIndex += 1;
if (that.data.navList[i].id == that.data.id) {
break;
}
}
if (currentIndex > navListCount / 2 && navListCount > 5) {
that.setData({ that.setData({
scrollLeft: currentIndex * 60 id: parseInt(options.id)
}); });
}
that.getGoodsList();
} else {
//显示错误信息
} }
}); wx.getSystemInfo({
}, success: function(res) {
onReady: function() { that.setData({
// 页面渲染完成 scrollHeight: res.windowHeight
}, });
onShow: function() { }
// 页面显示
console.log(1);
},
onHide: function() {
// 页面隐藏
},
getGoodsList: function() {
wx.showLoading({
title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
var that = this;
util.request(api.GoodsList, {
categoryId: that.data.currentCategory.id,
page: that.data.page,
size: that.data.size
})
.then(function(res) {
that.setData({
goodsList: res.data.goodsList,
}); });
wx.hideLoading();
});
},
onUnload: function() {
// 页面关闭
},
switchCate: function(event) {
if (this.data.id == event.currentTarget.dataset.id) {
return false;
}
var that = this;
var clientX = event.detail.x;
var currentTarget = event.currentTarget;
if (clientX < 60) {
that.setData({
scrollLeft: currentTarget.offsetLeft - 60
});
} else if (clientX > 330) {
that.setData({
scrollLeft: currentTarget.offsetLeft
});
}
this.setData({
id: event.currentTarget.dataset.id
});
this.getCategoryInfo(); this.getCategoryInfo();
} },
onPullDownRefresh() {
// wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCategoryInfo();
// wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getCategoryInfo: function() {
let that = this;
util.request(api.GoodsCategory, {
id: this.data.id
})
.then(function(res) {
if (res.errno == 0) {
that.setData({
navList: res.data.brotherCategory,
currentCategory: res.data.currentCategory
});
wx.setNavigationBarTitle({
title: res.data.parentCategory.name
})
//nav位置
let currentIndex = 0;
let navListCount = that.data.navList.length;
for (let i = 0; i < navListCount; i++) {
currentIndex += 1;
if (that.data.navList[i].id == that.data.id) {
break;
}
}
if (currentIndex > navListCount / 2 && navListCount > 5) {
that.setData({
scrollLeft: currentIndex * 60
});
}
that.getGoodsList();
} else {
//显示错误信息
}
});
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
console.log(1);
},
onHide: function() {
// 页面隐藏
},
getGoodsList: function() {
wx.showLoading({
title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
var that = this;
util.request(api.GoodsList, {
categoryId: that.data.currentCategory.id,
page: that.data.page,
size: that.data.size
})
.then(function(res) {
that.setData({
goodsList: res.data.goodsList,
});
wx.hideLoading();
});
},
onUnload: function() {
// 页面关闭
},
switchCate: function(event) {
if (this.data.id == event.currentTarget.dataset.id) {
return false;
}
var that = this;
var clientX = event.detail.x;
var currentTarget = event.currentTarget;
if (clientX < 60) {
that.setData({
scrollLeft: currentTarget.offsetLeft - 60
});
} else if (clientX > 330) {
that.setData({
scrollLeft: currentTarget.offsetLeft
});
}
this.setData({
id: event.currentTarget.dataset.id
});
this.getCategoryInfo();
}
}) })

View File

@@ -1,5 +1,5 @@
{ {
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }

View File

@@ -1,19 +1,19 @@
<view class="container"> <view class="container">
<view class="cate-nav"> <view class="cate-nav">
<scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}"> <scroll-view scroll-x="true" class="cate-nav-body" style="width: 750rpx;" scroll-left="{{scrollLeft}}">
<view wx:for="{{navList}}" class="item {{ id == item.id ? 'active' : ''}}" wx:key="id" data-id="{{item.id}}" data-index="{{index}}" bindtap="switchCate"> <view wx:for="{{navList}}" class="item {{ id == item.id ? 'active' : ''}}" wx:key="id" data-id="{{item.id}}" data-index="{{index}}" bindtap="switchCate">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
</view> </view>
</scroll-view> </scroll-view>
</view>
<scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}};">
<view class="cate-item">
<view class="h">
<text class="name">{{currentCategory.name}}</text>
<text class="desc">{{currentCategory.frontName}}</text>
</view>
<goodList goods="{{goodsList}}"></goodList>
</view> </view>
</scroll-view> <scroll-view scroll-y="true" scroll-top="{{scrollTop}}" style="height:{{scrollHeight}};">
<view class="cate-item">
<view class="h">
<text class="name">{{currentCategory.name}}</text>
<text class="desc">{{currentCategory.frontName}}</text>
</view>
<goodList goods="{{goodsList}}"></goodList>
</view>
</scroll-view>
</view> </view>

View File

@@ -1,69 +1,70 @@
.container{ .container {
background: #fff; background: #fff;
}
.cate-nav{
position: fixed;
left:0;
top:0;
z-index: 1000;
} }
.cate-nav-body{ .cate-nav {
height: 84rpx; position: fixed;
white-space: nowrap; left: 0;
background: #fff; top: 0;
border-top: 1px solid rgba(0,0,0,.15); z-index: 1000;
overflow: hidden;
} }
.cate-nav .item{ .cate-nav-body {
display: inline-block; height: 84rpx;
height: 84rpx; white-space: nowrap;
min-width: 130rpx; background: #fff;
padding: 0 15rpx; border-top: 1px solid rgba(0, 0, 0, 0.15);
overflow: hidden;
} }
.cate-nav .item .name{ .cate-nav .item {
display: block; display: inline-block;
height: 84rpx; height: 84rpx;
padding: 0 20rpx; min-width: 130rpx;
line-height: 84rpx; padding: 0 15rpx;
color: #333;
font-size: 30rpx;
width: auto;
} }
.cate-nav .item.active .name{ .cate-nav .item .name {
color: #a78845; display: block;
border-bottom: 2px solid #a78845; height: 84rpx;
padding: 0 20rpx;
line-height: 84rpx;
color: #333;
font-size: 30rpx;
width: auto;
} }
.cate-item{ .cate-nav .item.active .name {
margin-top: 94rpx; color: #a78845;
height: auto; border-bottom: 2px solid #a78845;
overflow: hidden;
} }
.cate-item .h{ .cate-item {
height: 145rpx; margin-top: 94rpx;
width: 750rpx; height: auto;
display: flex; overflow: hidden;
flex-direction: column;
align-items: center;
justify-content: center;
} }
.cate-item .h .name{ .cate-item .h {
display: block; height: 145rpx;
height: 35rpx; width: 750rpx;
margin-bottom: 18rpx; display: flex;
font-size: 30rpx; flex-direction: column;
color: #333; align-items: center;
justify-content: center;
} }
.cate-item .h .desc{ .cate-item .h .name {
display: block; display: block;
height: 24rpx; height: 35rpx;
font-size: 24rpx; margin-bottom: 18rpx;
color: #999; font-size: 30rpx;
} color: #333;
}
.cate-item .h .desc {
display: block;
height: 24rpx;
font-size: 24rpx;
color: #999;
}

View File

@@ -16,9 +16,12 @@ Page({
picPage: 1, picPage: 1,
size: 20 size: 20
}, },
getCommentCount: function () { getCommentCount: function() {
let that = this; 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) { if (res.errno === 0) {
that.setData({ that.setData({
allCount: res.data.allCount, allCount: res.data.allCount,
@@ -27,15 +30,15 @@ Page({
} }
}); });
}, },
getCommentList: function(){ getCommentList: function() {
let that = this; let that = this;
util.request(api.CommentList, { util.request(api.CommentList, {
valueId: that.data.valueId, valueId: that.data.valueId,
type: that.data.type, type: that.data.type,
size: that.data.size, size: that.data.size,
page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage), page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage),
showType: that.data.showType showType: that.data.showType
}).then(function (res) { }).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
if (that.data.showType == 0) { if (that.data.showType == 0) {
@@ -54,7 +57,7 @@ Page({
} }
}); });
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
type: options.type, type: options.type,
@@ -63,23 +66,23 @@ Page({
this.getCommentCount(); this.getCommentCount();
this.getCommentList(); this.getCommentList();
}, },
onReady: function () { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
switchTab: function () { switchTab: function() {
let that = this; let that = this;
if (that.data.showType == 0) { if (that.data.showType == 0) {
that.setData({ that.setData({
@@ -98,16 +101,16 @@ Page({
} }
this.getCommentList(); this.getCommentList();
}, },
onReachBottom: function(){ onReachBottom: function() {
console.log('onPullDownRefresh'); console.log('onPullDownRefresh');
if ( this.data.showType == 0) { if (this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) { if (this.data.allCount / this.data.size < this.data.allPage) {
return false; return false;
} }
this.setData({ this.setData({
'allPage' : this.data.allPage + 1 'allPage': this.data.allPage + 1
}); });
} else { } else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) { if (this.data.hasPicCount / this.data.size < this.data.picPage) {

View File

@@ -1,12 +1,12 @@
<view class="comments"> <view class="comments">
<view class="h"> <view class="h">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab"> <view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab">
<view class="txt">全部({{allCount}})</view> <view class="txt">全部({{allCount}})</view>
</view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
</view> </view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
</view>
<view class="b"> <view class="b">
<view class="item" wx:for="{{comments}}" wx:key="id"> <view class="item" wx:for="{{comments}}" wx:key="id">
<view class="info"> <view class="info">

View File

@@ -1,156 +1,155 @@
.comments{ .comments {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left:30rpx; padding-left: 30rpx;
background: #fff; background: #fff;
margin: 20rpx 0; margin: 20rpx 0;
} }
.comments .h{ .comments .h {
position: fixed; position: fixed;
left:0; left: 0;
top:0; top: 0;
z-index: 1000; z-index: 1000;
width: 100%; width: 100%;
display: flex; display: flex;
background: #fff; background: #fff;
height: 84rpx; height: 84rpx;
border-bottom: 1px solid rgba(0,0,0,.15); border-bottom: 1px solid rgba(0, 0, 0, 0.15);
} }
.comments .h .item{ .comments .h .item {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
width: 50%; width: 50%;
padding: 0 15rpx; padding: 0 15rpx;
text-align: center; text-align: center;
} }
.comments .h .item .txt{ .comments .h .item .txt {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
padding: 0 20rpx; padding: 0 20rpx;
line-height: 82rpx; line-height: 82rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
width: 170rpx; width: 170rpx;
} }
.comments .h .item.active .txt{ .comments .h .item.active .txt {
color: #ab2b2b; color: #ab2b2b;
border-bottom: 4rpx solid #ab2b2b; border-bottom: 4rpx solid #ab2b2b;
} }
.comments .b{ .comments .b {
margin-top: 85rpx; margin-top: 85rpx;
height: auto; height: auto;
width: 720rpx; width: 720rpx;
} }
.comments .b.no-h{ .comments .b.no-h {
margin-top: 0; margin-top: 0;
} }
.comments .item{ .comments .item {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
padding-bottom: 25rpx; padding-bottom: 25rpx;
} }
.comments .info{ .comments .info {
height: 127rpx; height: 127rpx;
width: 100%; width: 100%;
padding: 33rpx 0 27rpx 0; padding: 33rpx 0 27rpx 0;
} }
.comments .user{ .comments .user {
float: left; float: left;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
font-size: 0; font-size: 0;
} }
.comments .user image{ .comments .user image {
float: left; float: left;
width: 67rpx; width: 67rpx;
height: 67rpx; height: 67rpx;
margin-right: 17rpx; margin-right: 17rpx;
border-radius: 50%; border-radius: 50%;
} }
.comments .user text{ .comments .user text {
display: inline-block; display: inline-block;
width: auto; width: auto;
height: 66rpx; height: 66rpx;
overflow: hidden; overflow: hidden;
font-size: 29rpx; font-size: 29rpx;
line-height: 66rpx; line-height: 66rpx;
} }
.comments .time{ .comments .time {
display: block; display: block;
float: right; float: right;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
color: #7f7f7f; color: #7f7f7f;
font-size: 25rpx; font-size: 25rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.comments .comment{ .comments .comment {
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
line-height: 45.8rpx; line-height: 45.8rpx;
font-size: 29rpx; font-size: 29rpx;
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }
.comments .imgs{ .comments .imgs {
width: 720rpx; width: 720rpx;
height: 150rpx; height: 150rpx;
margin-bottom: 25rpx; margin-bottom: 25rpx;
} }
.comments .imgs .img{ .comments .imgs .img {
height: 150rpx; height: 150rpx;
width: 150rpx; width: 150rpx;
margin-right: 28rpx; margin-right: 28rpx;
} }
.comments .spec{ .comments .spec {
width: 720rpx; width: 720rpx;
height: 25rpx; height: 25rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.comments .spec .item{ .comments .spec .item {
color: #7f7f7f; color: #7f7f7f;
font-size: 25rpx; font-size: 25rpx;
} }
.comments .customer-service{ .comments .customer-service {
width: 690rpx; width: 690rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-top: 23rpx; margin-top: 23rpx;
background: rgba(0,0,0,.03); background: rgba(0, 0, 0, 0.03);
padding: 21rpx; padding: 21rpx;
} }
.comments .customer-service .u {
.comments .customer-service .u{ font-size: 24rpx;
font-size: 24rpx; color: #333;
color: #333; line-height: 37.5rpx;
line-height: 37.5rpx;
} }
.comments .customer-service .c{ .comments .customer-service .c {
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
line-height: 37.5rpx; line-height: 37.5rpx;
} }

View File

@@ -16,7 +16,7 @@ Page({
picUrls: [], picUrls: [],
files: [] files: []
}, },
chooseImage: function (e) { chooseImage: function(e) {
if (this.data.files.length >= 5) { if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片') util.showErrorToast('只能上传五张图片')
return false; return false;
@@ -27,7 +27,7 @@ Page({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: function (res) { success: function(res) {
that.setData({ that.setData({
files: that.data.files.concat(res.tempFilePaths) files: that.data.files.concat(res.tempFilePaths)
}); });
@@ -35,13 +35,13 @@ Page({
} }
}) })
}, },
upload: function (res) { upload: function(res) {
var that = this; var that = this;
const uploadTask = wx.uploadFile({ const uploadTask = wx.uploadFile({
url: api.StorageUpload, url: api.StorageUpload,
filePath: res.tempFilePaths[0], filePath: res.tempFilePaths[0],
name: 'file', name: 'file',
success: function (res) { success: function(res) {
var _res = JSON.parse(res.data); var _res = JSON.parse(res.data);
if (_res.errno === 0) { if (_res.errno === 0) {
var url = _res.data.url var url = _res.data.url
@@ -52,7 +52,7 @@ Page({
}) })
} }
}, },
fail: function (e) { fail: function(e) {
wx.showModal({ wx.showModal({
title: '错误', title: '错误',
content: '上传失败', content: '上传失败',
@@ -68,28 +68,24 @@ Page({
}) })
}, },
previewImage: function (e) { previewImage: function(e) {
wx.previewImage({ wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接 current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表 urls: this.data.files // 需要预览的图片http链接列表
}) })
}, },
selectRater: function (e) { selectRater: function(e) {
var star = e.currentTarget.dataset.star + 1; var star = e.currentTarget.dataset.star + 1;
var starText; var starText;
if (star == 1) { if (star == 1) {
starText = '很差'; starText = '很差';
} } else if (star == 2) {
else if (star == 2) {
starText = '不太满意'; starText = '不太满意';
} } else if (star == 3) {
else if (star == 3) {
starText = '满意'; starText = '满意';
} } else if (star == 4) {
else if (star == 4) {
starText = '比较满意'; starText = '比较满意';
} } else {
else {
starText = '十分满意' starText = '十分满意'
} }
this.setData({ this.setData({
@@ -98,7 +94,7 @@ Page({
}) })
}, },
onLoad: function (options) { onLoad: function(options) {
var that = this; var that = this;
that.setData({ that.setData({
orderId: options.orderId, orderId: options.orderId,
@@ -107,11 +103,12 @@ Page({
}); });
this.getOrderGoods(); this.getOrderGoods();
}, },
getOrderGoods: function () { getOrderGoods: function() {
let that = this; let that = this;
util.request(api.OrderGoods, { util.request(api.OrderGoods, {
orderId: that.data.orderId, goodsId: that.data.valueId orderId: that.data.orderId,
}).then(function (res) { goodsId: that.data.valueId
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
orderGoods: res.data, orderGoods: res.data,
@@ -119,10 +116,10 @@ Page({
} }
}); });
}, },
onClose: function () { onClose: function() {
wx.navigateBack(); wx.navigateBack();
}, },
onPost: function () { onPost: function() {
let that = this; let that = this;
if (!this.data.content) { if (!this.data.content) {
@@ -137,11 +134,11 @@ Page({
star: that.data.star, star: that.data.star,
hasPicture: that.data.hasPicture, hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls picUrls: that.data.picUrls
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
wx.showToast({ wx.showToast({
title: '评论成功', title: '评论成功',
complete: function () { complete: function() {
wx.navigateBack(); wx.navigateBack();
} }
}) })
@@ -161,18 +158,18 @@ Page({
content: event.detail.value, content: event.detail.value,
}) })
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
{ {
"navigationBarTitleText": "商品详情", "navigationBarTitleText": "商品详情",
"usingComponents": { "usingComponents": {
"sharePop": "/components/sharePop/sharePop", "sharePop": "/components/sharePop/sharePop",
"goodList": "/components/goodList/goodList", "goodList": "/components/goodList/goodList",
"van-notify": "../../components/notify/index" "van-notify": "/components/notify/index"
} }
} }

View File

@@ -1,129 +1,129 @@
<view class="container"> <view class="container">
<swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000"> <swiper class="goodsimgs" indicator-dots="true" autoplay="true" interval="3000" duration="1000">
<swiper-item wx:for="{{goods.gallery}}" wx:key="*this"> <swiper-item wx:for="{{goods.gallery}}" wx:key="*this">
<image src="{{item}}" background-size="cover"></image> <image src="{{item}}" background-size="cover"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 商品信息 --> <!-- 商品信息 -->
<view class="goods-info"> <view class="goods-info">
<view class="c"> <view class="c">
<text class="name">{{goods.name}}</text> <text class="name">{{goods.name}}</text>
<text class="desc">{{goods.brief}}</text> <text class="desc">{{goods.brief}}</text>
<view class="price"> <view class="price">
<view class="counterPrice">原价:¥{{goods.counterPrice}}</view> <view class="counterPrice">原价:¥{{goods.counterPrice}}</view>
<view class="retailPrice">现价:¥{{checkedSpecPrice}}</view> <view class="retailPrice">现价:¥{{checkedSpecPrice}}</view>
</view> </view>
<view class="brand" wx:if="{{brand.name}}"> <view class="brand" wx:if="{{brand.name}}">
<navigator url="../brandDetail/brandDetail?id={{brand.id}}"> <navigator url="../brandDetail/brandDetail?id={{brand.id}}">
<text>{{brand.name}}</text> <text>{{brand.name}}</text>
</navigator> </navigator>
</view> </view>
</view>
</view>
<!-- 规格框体 -->
<view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="t">{{checkedSpecText}}</view>
<image class="i" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
</view>
</view>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="common-problem">
<view class="h">
<view class="line"></view>
<text class="title">常见问题</text>
</view>
<view class="b">
<view class="item" wx:for="{{issueList}}" wx:key="id">
<view class="question-box">
<text class="spot"></text>
<text class="question">{{item.question}}</text>
</view> </view>
<view class="answer">
{{item.answer}}
</view>
</view>
</view> </view>
</view>
<!-- 大家都在看 --> <!-- 规格框体 -->
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}"> <view class="section-nav section-attr" bindtap="switchAttrPop">
<view class="h"> <view class="t">{{checkedSpecText}}</view>
<view class="line"></view> <image class="i" src="/static/images/address_right.png" background-size="cover"></image>
<text class="title">大家都在看</text> </view>
<view class="goods-attr">
<view class="t">商品参数</view>
<view class="l">
<view class="item" wx:for="{{attribute}}" wx:key="name">
<text class="left">{{item.attribute}}</text>
<text class="right">{{item.value}}</text>
</view>
</view>
</view>
<view class="detail">
<import src="/lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:goodsDetail.nodes}}" />
</view>
<view class="common-problem">
<view class="h">
<view class="line"></view>
<text class="title">常见问题</text>
</view>
<view class="b">
<view class="item" wx:for="{{issueList}}" wx:key="id">
<view class="question-box">
<text class="spot"></text>
<text class="question">{{item.question}}</text>
</view>
<view class="answer">
{{item.answer}}
</view>
</view>
</view>
</view>
<!-- 大家都在看 -->
<view class="related-goods" wx:if="{{relatedGoods.length > 0}}">
<view class="h">
<view class="line"></view>
<text class="title">大家都在看</text>
</view>
<goodList goods="{{relatedGoods}}"></goodList>
</view> </view>
<goodList goods="{{relatedGoods}}"></goodList>
</view>
</view> </view>
<!-- 规格选择界面 --> <!-- 规格选择界面 -->
<view class="attr-pop-box" hidden="{{!openAttr}}"> <view class="attr-pop-box" hidden="{{!openAttr}}">
<view class="attr-pop"> <view class="attr-pop">
<view class="close" bindtap="closeAttr"> <view class="close" bindtap="closeAttr">
<image class="icon" src="/static/images/icon_close.png"></image> <image class="icon" src="/static/images/icon_close.png"></image>
</view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
</view>
</view>
</view>
<!-- 规格列表 -->
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
</view>
<view class="spec-con" wx:if="{{groupon.length > 0}}">
<view class="spec-item">
<view class="name">团购立减</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickGroupon" wx:for="{{groupon}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">¥-{{vitem.discount}} ({{vitem.discountMember}}人)</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
</view>
</view>
</view>
</view> </view>
<view class="img-info">
<image class="img" src="{{goods.picUrl}}"></image>
<view class="info">
<view class="c">
<view class="p">价格:¥{{checkedSpecPrice}}</view>
<view class="a">{{tmpSpecText}}</view>
</view>
</view>
</view>
<!-- 规格列表 -->
<view class="spec-con">
<view class="spec-item" wx:for="{{specificationList}}" wx:key="name">
<view class="name">{{item.name}}</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickSkuValue" wx:for="{{item.valueList}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">{{vitem.value}}</view>
</view>
</view>
<view class="spec-con" wx:if="{{groupon.length > 0}}">
<view class="spec-item">
<view class="name">团购立减</view>
<view class="values">
<view class="value {{vitem.checked ? 'selected' : ''}}" bindtap="clickGroupon" wx:for="{{groupon}}" wx:for-item="vitem" wx:key="{{vitem.id}}" data-value-id="{{vitem.id}}" data-name="{{vitem.specification}}">¥-{{vitem.discount}} ({{vitem.discountMember}}人)</view>
</view>
</view>
</view>
<!-- 数量 -->
<view class="number-item">
<view class="name">数量</view>
<view class="selnum">
<view class="cut" bindtap="cutNumber">-</view>
<input value="{{number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber">+</view>
</view>
</view>
</view>
</view>
</view> </view>
<!-- 联系客服 --> <!-- 联系客服 -->
<view class="contact"> <view class="contact">
<contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27"> <contact-button style="opacity:0;position:absolute;" type="default-dark" session-from="weapp" size="27">
</contact-button> </contact-button>
</view> </view>
<!-- 顶部提示 --> <!-- 顶部提示 -->
@@ -134,16 +134,16 @@
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="bottom-btn"> <view class="bottom-btn">
<view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon}}"> <view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon}}">
<image class="icon" src="../../images/goods-share.png"/> <image class="icon" src="../../images/goods-share.png" />
</view>
<view class="l l-cart" wx:if="{{!isGroupon}}">
<view class="box">
<text class="cart-count">{{cartGoodsCount}}</text>
<image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view> </view>
</view> <view class="l l-cart" wx:if="{{!isGroupon}}">
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}" wx:if="{{!isGroupon}}">加入购物车</view> <view class="box">
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">{{isGroupon?'参加团购':'立即购买'}}</view> <text class="cart-count">{{cartGoodsCount}}</text>
<view class="n" wx:if="{{soldout}}">商品已售空</view> <image bindtap="openCartPage" class="icon" src="/static/images/ic_menu_shoping_nor.png"></image>
</view>
</view>
<view class="r" bindtap="addToCart" wx:if="{{!soldout}}" wx:if="{{!isGroupon}}">加入购物车</view>
<view class="c" bindtap="addFast" wx:if="{{!soldout}}">{{isGroupon?'参加团购':'立即购买'}}</view>
<view class="n" wx:if="{{soldout}}">商品已售空</view>
</view> </view>

File diff suppressed because it is too large Load Diff

View File

@@ -2,93 +2,93 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
Page({ Page({
data: { data: {
id: 0, id: 0,
orderId: 0, orderId: 0,
groupon: {}, groupon: {},
linkGrouponId: 0, linkGrouponId: 0,
joiners: [], joiners: [],
orderInfo: {}, orderInfo: {},
orderGoods: [], orderGoods: [],
expressInfo: {}, expressInfo: {},
flag: false, flag: false,
handleOption: {} handleOption: {}
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
id: options.id id: options.id
}); });
this.getOrderDetail(); this.getOrderDetail();
}, },
// 页面分享 // 页面分享
onShareAppMessage: function() { onShareAppMessage: function() {
let that = this; let that = this;
return { return {
title: '邀请团购', title: '邀请团购',
desc: '唯爱与美食不可辜负', desc: '唯爱与美食不可辜负',
path: '/pages/index/index?grouponId=' + this.data.linkGrouponId path: '/pages/index/index?grouponId=' + this.data.linkGrouponId
} }
}, },
showShare: function() { showShare: function() {
this.sharePop.togglePopup(); this.sharePop.togglePopup();
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getOrderDetail(); this.getOrderDetail();
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
expandDetail: function() { expandDetail: function() {
let that = this; let that = this;
this.setData({ this.setData({
flag: !that.data.flag flag: !that.data.flag
}) })
}, },
getOrderDetail: function() { getOrderDetail: function() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
let that = this;
util.request(api.GroupOnDetail, {
grouponId: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
joiners: res.data.joiners,
groupon: res.data.groupon,
linkGrouponId: res.data.linkGrouponId,
orderId: res.data.orderInfo.id,
orderInfo: res.data.orderInfo,
orderGoods: res.data.orderGoods,
handleOption: res.data.orderInfo.handleOption,
expressInfo: res.data.expressInfo
}); });
wx.hideLoading(); setTimeout(function() {
} wx.hideLoading()
}); }, 2000);
},
let that = this;
onReady: function() { util.request(api.GroupOnDetail, {
// 页面渲染完成 grouponId: that.data.id
this.sharePop = this.selectComponent("#sharePop"); }).then(function(res) {
}, if (res.errno === 0) {
onShow: function() { that.setData({
// 页面显示 joiners: res.data.joiners,
}, groupon: res.data.groupon,
onHide: function() { linkGrouponId: res.data.linkGrouponId,
// 页面隐藏 orderId: res.data.orderInfo.id,
}, orderInfo: res.data.orderInfo,
onUnload: function() { orderGoods: res.data.orderGoods,
// 页面关闭 handleOption: res.data.orderInfo.handleOption,
} expressInfo: res.data.expressInfo
});
wx.hideLoading();
}
});
},
onReady: function() {
// 页面渲染完成
this.sharePop = this.selectComponent("#sharePop");
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}); });

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "团购详情", "navigationBarTitleText": "团购详情",
"usingComponents": { "usingComponents": {
"sharePop": "/components/sharePop/sharePop" "sharePop": "/components/sharePop/sharePop"
} }
} }

View File

@@ -1,93 +1,93 @@
<view class="container"> <view class="container">
<view class="order-info"> <view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view> <view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view> <view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c"> <view class="item-c">
<view class="l">实付: <view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text> <text class="cost">¥{{orderInfo.actualPrice}}</text>
</view> </view>
<view class="r"> <view class="r">
<view class="btn active" bindtap="showShare">邀请参团</view> <view class="btn active" bindtap="showShare">邀请参团</view>
</view> </view>
</view>
</view>
<sharePop id="sharePop" url="{{groupon.shareUrl}}"></sharePop>
<view class="menu-list-pro">
<view class="h">
<view class="label">参与团购 ( {{joiners.length}}人)</view>
<!-- <view class="status">查看全部</view> -->
</view>
<view class="menu-list-item" wx:for-items="{{joiners}}" wx:key="id" data-id="{{item.id}}">
<image class="icon" src="{{item.avatar}}"></image>
<text class="txt">{{item.nickname}}</text>
</view>
</view>
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view> </view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.goodsSpecificationValues}}</view>
<view class="price">¥{{item.retailPrice}}</view>
</view>
</view>
</view> </view>
<view class="order-bottom"> <sharePop id="sharePop" url="{{groupon.shareUrl}}"></sharePop>
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<!-- 物流信息,仅收货状态下可见 --> <view class="menu-list-pro">
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}"> <view class="h">
<view class="expand"> <view class="label">参与团购 ( {{joiners.length}}人)</view>
<view class="title"> <!-- <view class="status">查看全部</view> -->
<view class="t">快递公司:{{expressInfo.shipperName}}</view> </view>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view> <view class="menu-list-item" wx:for-items="{{joiners}}" wx:key="id" data-id="{{item.id}}">
</view> <image class="icon" src="{{item.avatar}}"></image>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image> <text class="txt">{{item.nickname}}</text>
</view>
</view> </view>
<!-- <view class="order-express" > --> <view class="order-goods">
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}"> <view class="h">
<view class="trace"> <view class="label">商品信息</view>
<view class="acceptStation">{{iitem.AcceptStation}}</view> <view class="status">{{orderInfo.orderStatusText}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view> </view>
</view> <view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.goodsSpecificationValues}}</view>
<view class="price">¥{{item.retailPrice}}</view>
</view>
</view>
</view>
<view class="order-bottom">
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view> </view>
</view>
<!-- </view> --> <!-- 物流信息,仅收货状态下可见 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="expand">
<view class="title">
<view class="t">快递公司:{{expressInfo.shipperName}}</view>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<!-- <view class="order-express" > -->
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
</view>
</view>
<!-- </view> -->
</view> </view>

View File

@@ -1,395 +1,395 @@
page { page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.order-info { .order-info {
padding-top: 25rpx; padding-top: 25rpx;
background: #fff; background: #fff;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.item-a { .item-a {
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: 42.5rpx; height: 42.5rpx;
padding-bottom: 12.5rpx; padding-bottom: 12.5rpx;
line-height: 30rpx; line-height: 30rpx;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.item-b { .item-b {
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
margin-top: 12.5rpx; margin-top: 12.5rpx;
margin-bottom: 41.5rpx; margin-bottom: 41.5rpx;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.item-c { .item-c {
margin-left: 31.25rpx; margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
height: 103rpx; height: 103rpx;
line-height: 103rpx; line-height: 103rpx;
} }
.item-c .l { .item-c .l {
float: left; float: left;
} }
.item-c .r { .item-c .r {
height: 103rpx; height: 103rpx;
float: right; float: right;
display: flex; display: flex;
align-items: center; align-items: center;
padding-right: 16rpx; padding-right: 16rpx;
} }
.item-c .r .btn { .item-c .r .btn {
float: right; float: right;
} }
.item-c .cost { .item-c .cost {
color: #b4282d; color: #b4282d;
} }
.item-c .btn { .item-c .btn {
line-height: 66rpx; line-height: 66rpx;
border-radius: 5rpx; border-radius: 5rpx;
text-align: center; text-align: center;
margin: 0 15rpx; margin: 0 15rpx;
padding: 0 20rpx; padding: 0 20rpx;
height: 66rpx; height: 66rpx;
} }
.item-c .btn.active { .item-c .btn.active {
background: #a78845; background: #a78845;
color: #fff; color: #fff;
} }
.order-goods { .order-goods {
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
} }
.order-goods .h { .order-goods .h {
height: 93.75rpx; height: 93.75rpx;
line-height: 93.75rpx; line-height: 93.75rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx; padding-right: 31.25rpx;
} }
.order-goods .h .label { .order-goods .h .label {
float: left; float: left;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order-goods .h .status { .order-goods .h .status {
float: right; float: right;
font-size: 30rpx; font-size: 30rpx;
color: #b4282d; color: #b4282d;
} }
.order-goods .item { .order-goods .item {
display: flex; display: flex;
align-items: center; align-items: center;
height: 192rpx; height: 192rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-goods .item:last-child { .order-goods .item:last-child {
border-bottom: none; border-bottom: none;
} }
.order-goods .item .img { .order-goods .item .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.order-goods .item .img image { .order-goods .item .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.order-goods .item .info { .order-goods .item .info {
flex: 1; flex: 1;
height: 145.83rpx; height: 145.83rpx;
margin-left: 20rpx; margin-left: 20rpx;
} }
.order-goods .item .t { .order-goods .item .t {
margin-top: 8rpx; margin-top: 8rpx;
height: 33rpx; height: 33rpx;
line-height: 33rpx; line-height: 33rpx;
margin-bottom: 10.5rpx; margin-bottom: 10.5rpx;
} }
.order-goods .item .t .name { .order-goods .item .t .name {
display: block; display: block;
float: left; float: left;
height: 33rpx; height: 33rpx;
line-height: 33rpx; line-height: 33rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .t .number { .order-goods .item .t .number {
display: block; display: block;
float: right; float: right;
height: 33rpx; height: 33rpx;
text-align: right; text-align: right;
line-height: 33rpx; line-height: 33rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .attr { .order-goods .item .attr {
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
color: #666; color: #666;
margin-bottom: 25rpx; margin-bottom: 25rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.order-goods .item .price { .order-goods .item .price {
display: block; display: block;
float: left; float: left;
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .btn { .order-goods .item .btn {
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
border-radius: 5rpx; border-radius: 5rpx;
text-align: center; text-align: center;
display: block; display: block;
float: right; float: right;
margin: 0 15rpx; margin: 0 15rpx;
padding: 0 20rpx; padding: 0 20rpx;
} }
.order-goods .item .btn.active { .order-goods .item .btn.active {
background: #b4282d; background: #b4282d;
color: #fff; color: #fff;
} }
.order-bottom { .order-bottom {
margin-top: 20rpx; margin-top: 20rpx;
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
} }
.order-bottom .address { .order-bottom .address {
height: 128rpx; height: 128rpx;
padding-top: 25rpx; padding-top: 25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-bottom .address .t { .order-bottom .address .t {
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
margin-bottom: 7.5rpx; margin-bottom: 7.5rpx;
} }
.order-bottom .address .name { .order-bottom .address .name {
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
width: 140rpx; width: 140rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .address .mobile { .order-bottom .address .mobile {
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .address .b { .order-bottom .address .b {
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .total { .order-bottom .total {
height: 106rpx; height: 106rpx;
padding-top: 20rpx; padding-top: 20rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-bottom .total .t { .order-bottom .total .t {
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
margin-bottom: 7.5rpx; margin-bottom: 7.5rpx;
display: flex; display: flex;
} }
.order-bottom .total .label { .order-bottom .total .label {
width: 150rpx; width: 150rpx;
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .total .txt { .order-bottom .total .txt {
flex: 1; flex: 1;
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .pay-fee { .order-bottom .pay-fee {
height: 81rpx; height: 81rpx;
line-height: 81rpx; line-height: 81rpx;
} }
.order-bottom .pay-fee .label { .order-bottom .pay-fee .label {
display: inline-block; display: inline-block;
width: 140rpx; width: 140rpx;
color: #b4282d; color: #b4282d;
} }
.order-bottom .pay-fee .txt { .order-bottom .pay-fee .txt {
display: inline-block; display: inline-block;
width: 140rpx; width: 140rpx;
color: #b4282d; color: #b4282d;
} }
.order-express { .order-express {
margin-top: 20rpx; margin-top: 20rpx;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
background: #fff; background: #fff;
} }
.order-express .expand { .order-express .expand {
/* margin-top: 20rpx; */ /* margin-top: 20rpx; */
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
background: #fff; background: #fff;
/* border: 10rpx #a78845; */ /* border: 10rpx #a78845; */
} }
.order-express .title { .order-express .title {
float: left; float: left;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 10rpx; padding: 10rpx;
} }
.order-express .ti { .order-express .ti {
float: right; float: right;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
margin-right: 16rpx; margin-right: 16rpx;
margin-top: 28rpx; margin-top: 28rpx;
} }
.order-express .t { .order-express .t {
font-size: 29rpx; font-size: 29rpx;
margin-left: 10.25rpx; margin-left: 10.25rpx;
color: #a78845; color: #a78845;
} }
.order-express .b { .order-express .b {
font-size: 29rpx; font-size: 29rpx;
margin-left: 10.25rpx; margin-left: 10.25rpx;
color: #a78845; color: #a78845;
} }
.order-express .traces { .order-express .traces {
padding: 17.5rpx; padding: 17.5rpx;
background: #fff; background: #fff;
border-bottom: 1rpx solid #f1e6cdcc; border-bottom: 1rpx solid #f1e6cdcc;
} }
.order-express .trace { .order-express .trace {
padding-bottom: 17.5rpx; padding-bottom: 17.5rpx;
padding-top: 17.5rpx; padding-top: 17.5rpx;
background: #fff; background: #fff;
} }
.order-express .acceptTime { .order-express .acceptTime {
margin-top: 20rpx; margin-top: 20rpx;
margin-right: 40rpx; margin-right: 40rpx;
text-align: right; text-align: right;
font-size: 26rpx; font-size: 26rpx;
} }
.order-express .acceptStation { .order-express .acceptStation {
font-size: 26rpx; font-size: 26rpx;
} }
.menu-list-pro { .menu-list-pro {
margin-top: 20rpx; margin-top: 20rpx;
overflow-x: scroll; overflow-x: scroll;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
height: 260rpx; height: 260rpx;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
border-bottom: 1rpx #cfc9ca; border-bottom: 1rpx #cfc9ca;
background-color: #fff; background-color: #fff;
} }
.menu-list-pro .h { .menu-list-pro .h {
height: 93.75rpx; height: 93.75rpx;
line-height: 93.75rpx; line-height: 93.75rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx; padding-right: 31.25rpx;
} }
.menu-list-pro .h .label { .menu-list-pro .h .label {
float: left; float: left;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.menu-list-pro .h .status { .menu-list-pro .h .status {
float: right; float: right;
font-size: 30rpx; font-size: 30rpx;
color: #a78845; color: #a78845;
} }
.menu-list-pro .menu-list-item { .menu-list-pro .menu-list-item {
display: block; display: block;
float: left; float: left;
height: 110rpx; height: 110rpx;
width: 80rpx; width: 80rpx;
margin-top: 30rpx; margin-top: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
margin-left: 40rpx; margin-left: 40rpx;
} }
.menu-list-pro .icon { .menu-list-pro .icon {
height: 80rpx; height: 80rpx;
width: 80rpx; width: 80rpx;
border-radius: 12rpx; border-radius: 12rpx;
box-shadow: 0px 4rpx 4rpx 0px #cfc9ca; box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
} }
.menu-list-pro .txt { .menu-list-pro .txt {
display: block; display: block;
float: left; float: left;
width: 80rpx; width: 80rpx;
margin-top: 5rpx; margin-top: 5rpx;
font-size: 22rpx; font-size: 22rpx;
color: #a78845; color: #a78845;
} }

View File

@@ -20,59 +20,59 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
this.getGrouponList(); this.getGrouponList();
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () { onReady: function() {
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function() {
}, },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload: function () { onUnload: function() {
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function() {
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
getGrouponList: function () { getGrouponList: function() {
let that = this; let that = this;
that.setData({ that.setData({
@@ -87,7 +87,10 @@ Page({
duration: 2000 duration: 2000
}); });
util.request(api.GroupOnList, { page: that.data.page, size: that.data.size }).then(function (res) { util.request(api.GroupOnList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
@@ -101,7 +104,7 @@ Page({
}); });
}, },
nextPage: function (event) { nextPage: function(event) {
var that = this; var that = this;
if (this.data.page > that.data.count / that.data.size) { if (this.data.page > that.data.count / that.data.size) {
return true; return true;
@@ -115,7 +118,7 @@ Page({
this.getTopic(); this.getTopic();
}, },
prevPage: function (event) { prevPage: function(event) {
if (this.data.page <= 1) { if (this.data.page <= 1) {
return false; return false;
} }

View File

@@ -2,5 +2,5 @@
"navigationBarTitleText": "团购专区", "navigationBarTitleText": "团购专区",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index" "zan-capsule": "/components/capsule/index"
} }
} }

View File

@@ -1,117 +1,118 @@
page ,.container{ page, .container {
width: 750rpx; width: 750rpx;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
background: #f4f4f4; background: #f4f4f4;
} }
.groupon-list{
width: 750rpx; .groupon-list {
height: 100%; width: 750rpx;
overflow: hidden; height: 100%;
background: #f4f4f4; overflow: hidden;
background: #f4f4f4;
} }
.groupon-list .item { .groupon-list .item {
height: 244rpx; height: 244rpx;
width: 100%; width: 100%;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.groupon-list .img { .groupon-list .img {
margin-top: 12rpx; margin-top: 12rpx;
margin-right: 12rpx; margin-right: 12rpx;
float: left; float: left;
width: 220rpx; width: 220rpx;
height: 220rpx; height: 220rpx;
} }
.groupon-list .right { .groupon-list .right {
float: left; float: left;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.groupon-list .text { .groupon-list .text {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
} }
.groupon-list .name { .groupon-list .name {
float: left; float: left;
width: 330rpx; width: 330rpx;
display: block; display: block;
color: #333; color: #333;
line-height: 50rpx; line-height: 50rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.groupon-list .capsule-tag { .groupon-list .capsule-tag {
float: right; float: right;
padding-right: 0rpx; padding-right: 0rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.groupon-list .zan-capsule + .zan-capsule { .groupon-list .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.groupon-list .desc { .groupon-list .desc {
width: 476rpx; width: 476rpx;
display: block; display: block;
color: #999; color: #999;
line-height: 50rpx; line-height: 50rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.groupon-list .price { .groupon-list .price {
width: 476rpx; width: 476rpx;
display: flex; display: flex;
color: #AB956D; color: #ab956d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
.groupon-list .counterPrice { .groupon-list .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
} }
.groupon-list .retailPrice { .groupon-list .retailPrice {
margin-left: 30rpx; margin-left: 30rpx;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }
.page{ .page {
width: 750rpx; width: 750rpx;
height: 108rpx; height: 108rpx;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.page view{ .page view {
height: 108rpx; height: 108rpx;
width: 50%; width: 50%;
float: left; float: left;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
text-align: center; text-align: center;
line-height: 108rpx; line-height: 108rpx;
} }
.page .prev{ .page .prev {
border-right: 1px solid #D9D9D9; border-right: 1px solid #d9d9d9;
} }
.page .disabled{ .page .disabled {
color: #ccc; color: #ccc;
} }

View File

@@ -2,60 +2,60 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
Page({ Page({
data: { data: {
orderList: [], orderList: [],
showType: 0 showType: 0
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
onPullDownRefresh() { onPullDownRefresh() {
// wx.showNavigationBarLoading() //在标题栏中显示加载 // wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList(); this.getOrderList();
// wx.hideNavigationBarLoading() //完成停止加载 // wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getOrderList() { getOrderList() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
let that = this;
util.request(api.GroupOnMy, {
showType: that.data.showType
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderList: res.data.data
}); });
wx.hideLoading();
} setTimeout(function() {
}); wx.hideLoading()
}, }, 2000);
switchTab: function(event) {
let showType = event.currentTarget.dataset.index; let that = this;
this.setData({ util.request(api.GroupOnMy, {
showType: showType showType: that.data.showType
}); }).then(function(res) {
this.getOrderList(); if (res.errno === 0) {
}, that.setData({
onReady: function() { orderList: res.data.data
// 页面渲染完成 });
}, wx.hideLoading();
onShow: function() { }
// 页面显示 });
this.getOrderList(); },
}, switchTab: function(event) {
onHide: function() { let showType = event.currentTarget.dataset.index;
// 页面隐藏 this.setData({
}, showType: showType
onUnload: function() { });
// 页面关闭 this.getOrderList();
} },
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}) })

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "我的团购", "navigationBarTitleText": "我的团购",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index" "zan-capsule": "/components/capsule/index"
} }
} }

View File

@@ -1,52 +1,52 @@
<view class="container"> <view class="container">
<view class="orders-switch"> <view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'> <view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">发起的团购</view> <view class="txt">发起的团购</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">参加的团购</view>
</view>
</view> </view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'> <view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="txt">参加的团购</view> <view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>尚未参加任何团购</text>
</view>
</view> </view>
</view>
<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"> <view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id"> <navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h"> <view class="h">
<view class="l">订单编号:{{item.orderSn}}</view> <view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view> <view class="r">{{item.orderStatusText}}</view>
</view> </view>
<view class="j"> <view class="j">
<view class="l">团购立减:¥{{item.rules.discount}}</view> <view class="l">团购立减:¥{{item.rules.discount}}</view>
<view class="r">参与时间:{{item.groupon.addTime}}</view> <view class="r">参与时间:{{item.groupon.addTime}}</view>
</view> </view>
<view class="i"> <view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view> <view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参与:{{item.joinerCount}}</view> <view class="r">当前参与:{{item.joinerCount}}</view>
</view> </view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem"> <view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img"> <view class="img">
<image src="{{gitem.picUrl}}"></image> <image src="{{gitem.picUrl}}"></image>
</view> </view>
<view class="info"> <view class="info">
<text class="name">{{gitem.goodsName}}</text> <text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text> <text class="number">共{{gitem.number}}件商品</text>
</view> </view>
<view class="status"></view> <view class="status"></view>
</view> </view>
<view class="b"> <view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view> <view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag"> <view class="capsule-tag">
<zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" /> <zan-capsule color="#a78845" leftText="状态" rightText="{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}" />
</view> </view>
<view class="capsule-tag"> <view class="capsule-tag">
<zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" /> <zan-capsule color="#a78845" leftText="发起" rightText="{{item.creator}}" wx:if="{{!item.isCreator}}" />
</view> </view>
</view> </view>
</navigator> </navigator>
</view> </view>
</view> </view>

View File

@@ -1,222 +1,222 @@
page { page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.capsule-tag { .capsule-tag {
float: right; float: right;
/* padding-right: 10rpx; */ /* padding-right: 10rpx; */
} }
.zan-capsule + .zan-capsule { .zan-capsule + .zan-capsule {
margin-left: 5px; margin-left: 5px;
} }
.orders-switch { .orders-switch {
width: 100%; width: 100%;
background: #fff; background: #fff;
height: 84rpx; height: 84rpx;
border-bottom: 1px solid #a78845; border-bottom: 1px solid #a78845;
} }
.orders-switch .item { .orders-switch .item {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
width: 50%; width: 50%;
padding: 0 15rpx; padding: 0 15rpx;
text-align: center; text-align: center;
} }
.orders-switch .item .txt { .orders-switch .item .txt {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
padding: 0 20rpx; padding: 0 20rpx;
line-height: 82rpx; line-height: 82rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
width: 100%; width: 100%;
} }
.orders-switch .item.active .txt { .orders-switch .item.active .txt {
color: #a78845; color: #a78845;
border-bottom: 4rpx solid #a78845; border-bottom: 4rpx solid #a78845;
} }
.no-order { .no-order {
width: 100%; width: 100%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
} }
.no-order .c { .no-order .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
} }
.no-order .c image { .no-order .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
} }
.no-order .c text { .no-order .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #999; color: #999;
} }
.orders { .orders {
height: auto; height: auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.order { .order {
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
} }
.order .h { .order .h {
height: 83.3rpx; height: 83.3rpx;
line-height: 83.3rpx; line-height: 83.3rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order .h .l { .order .h .l {
float: left; float: left;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .h .r { .order .h .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .i { .order .i {
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order .i .l { .order .i .l {
float: left; float: left;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .i .r { .order .i .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .j { .order .j {
height: 56rpx; height: 56rpx;
line-height: 56rpx; line-height: 56rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
} }
.order .j .l { .order .j .l {
float: left; float: left;
font-size: 26rpx; font-size: 26rpx;
color: #a78845; color: #a78845;
} }
.order .j .r { .order .j .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 26rpx; font-size: 26rpx;
} }
.order .goods { .order .goods {
display: flex; display: flex;
align-items: center; align-items: center;
height: 199rpx; height: 199rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
} }
.order .goods .img { .order .goods .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.order .goods .img image { .order .goods .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.order .goods .info { .order .goods .info {
height: 145.83rpx; height: 145.83rpx;
flex: 1; flex: 1;
padding-left: 20rpx; padding-left: 20rpx;
} }
.order .goods .name { .order .goods .name {
margin-top: 30rpx; margin-top: 30rpx;
display: block; display: block;
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order .goods .number { .order .goods .number {
display: block; display: block;
height: 37rpx; height: 37rpx;
line-height: 37rpx; line-height: 37rpx;
color: #666; color: #666;
font-size: 25rpx; font-size: 25rpx;
} }
.order .goods .status { .order .goods .status {
width: 105rpx; width: 105rpx;
color: #a78845; color: #a78845;
font-size: 25rpx; font-size: 25rpx;
} }
.order .b { .order .b {
height: 103rpx; height: 103rpx;
line-height: 103rpx; line-height: 103rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order .b .l { .order .b .l {
float: left; float: left;
} }
.order .b .r { .order .b .r {
float: right; float: right;
} }
.order .b .btn { .order .b .btn {
margin-top: 19rpx; margin-top: 19rpx;
height: 64.5rpx; height: 64.5rpx;
line-height: 64.5rpx; line-height: 64.5rpx;
text-align: center; text-align: center;
padding: 0 20rpx; padding: 0 20rpx;
border-radius: 5rpx; border-radius: 5rpx;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
background: #a78845; background: #a78845;
} }

View File

@@ -3,129 +3,129 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
bannerInfo: { bannerInfo: {
'imgUrl': '', 'imgUrl': '',
'name': '' 'name': ''
},
categoryFilter: false,
filterCategory: [],
goodsList: [],
categoryId: 0,
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
page: 1,
size: 100
}, },
categoryFilter: false, getBanner: function() {
filterCategory: [], let that = this;
goodsList: [], util.request(api.GoodsHot).then(function(res) {
categoryId: 0, if (res.errno === 0) {
currentSortType: 'default', that.setData({
currentSort: 'add_time', bannerInfo: res.data.bannerInfo,
currentSortOrder: 'desc', });
page: 1, }
size: 100
},
getBanner: function() {
let that = this;
util.request(api.GoodsHot).then(function(res) {
if (res.errno === 0) {
that.setData({
bannerInfo: res.data.bannerInfo,
}); });
} },
}); getCategoryList: function() {
}, var that = this;
getCategoryList: function() {
var that = this;
util.request(api.GoodsFilter, { util.request(api.GoodsFilter, {
isHot: 1 isHot: 1
}) })
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
filterCategory: res.data.filterCategoryList, filterCategory: res.data.filterCategoryList,
}); });
} }
}); });
}, },
getGoodsList: function() { getGoodsList: function() {
var that = this; var that = this;
util.request(api.GoodsList, { util.request(api.GoodsList, {
isHot: true, isHot: true,
page: that.data.page, page: that.data.page,
size: that.data.size, size: that.data.size,
order: that.data.currentSortOrder, order: that.data.currentSortOrder,
sort: that.data.currentSort, sort: that.data.currentSort,
categoryId: that.data.categoryId categoryId: that.data.categoryId
}) })
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: res.data.goodsList, goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList filterCategory: res.data.filterCategoryList
}); });
} }
}); });
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getBanner();
this.getGoodsList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
openSortFilter: function(event) {
let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({
categoryFilter: !this.data.categoryFilter,
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
});
break;
case 'priceSort':
let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc';
}
this.setData({
currentSortType: 'price',
currentSort: 'retail_price',
currentSortOrder: tmpSortOrder,
categoryFilter: false
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getBanner();
this.getGoodsList(); this.getGoodsList();
break; },
default: onReady: function() {
//综合排序 // 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
openSortFilter: function(event) {
let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({
categoryFilter: !this.data.categoryFilter,
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
});
break;
case 'priceSort':
let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc';
}
this.setData({
currentSortType: 'price',
currentSort: 'retail_price',
currentSortOrder: tmpSortOrder,
categoryFilter: false
});
this.getGoodsList();
break;
default:
//综合排序
this.setData({
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0,
});
this.getGoodsList();
}
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({ this.setData({
currentSortType: 'default', 'categoryFilter': false,
currentSort: 'add_time', 'categoryId': this.data.filterCategory[currentIndex].id
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0,
}); });
this.getGoodsList(); this.getGoodsList();
} }
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({
'categoryFilter': false,
'categoryId': this.data.filterCategory[currentIndex].id
});
this.getGoodsList();
}
}) })

View File

@@ -12,7 +12,7 @@
</view> </view>
<view class="sort"> <view class="sort">
<view class="sort-box"> <view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort"> <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text> <text class="txt">综合</text>
</view> </view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">

View File

@@ -1,132 +1,132 @@
page{ page {
background: #f4f4f4; background: #f4f4f4;
} }
.brand-info .name{ .brand-info .name {
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
position: relative; position: relative;
} }
.brand-info .img{ .brand-info .img {
position: absolute; position: absolute;
top:0; top: 0;
left:0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
} }
.brand-info .info-box{ .brand-info .info-box {
position: absolute; position: absolute;
top:0; top: 0;
left:0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.brand-info .info{ .brand-info .info {
display: block; display: block;
} }
.brand-info .txt{ .brand-info .txt {
display: block; display: block;
height: 40rpx; height: 40rpx;
font-size: 37.5rpx; font-size: 37.5rpx;
color: #fff; color: #fff;
} }
.brand-info .line{ .brand-info .line {
margin: 0 auto; margin: 0 auto;
margin-top: 16rpx; margin-top: 16rpx;
display: block; display: block;
height: 2rpx; height: 2rpx;
width: 145rpx; width: 145rpx;
background: #fff; background: #fff;
} }
.sort{ .sort {
position: relative; position: relative;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box{ .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item{ .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex:1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt{ .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt{ .sort-box .item.active .txt {
color: #b4282d; color: #b4282d;
} }
.sort-box .item.by-price{ .sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat; background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc{ .sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc{ .sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box-category{ .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box-category .item{ .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
} }
.sort-box-category .item.active{ .sort-box-category .item.active {
color: #b4282d; color: #b4282d;
border: 1px solid #b4282d; border: 1px solid #b4282d;
} }
.cate-item .b{ .cate-item .b {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
@@ -134,7 +134,7 @@ page{
margin-top: 20rpx; margin-top: 20rpx;
} }
.cate-item .b .item{ .cate-item .b .item {
float: left; float: left;
background: #fff; background: #fff;
width: 375rpx; width: 375rpx;
@@ -145,17 +145,17 @@ page{
text-align: center; text-align: center;
} }
.cate-item .b .item-b{ .cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4; border-right: 1rpx solid #f4f4f4;
} }
.cate-item .item .img{ .cate-item .item .img {
margin-top: 10rpx; margin-top: 10rpx;
width: 302rpx; width: 302rpx;
height: 302rpx; height: 302rpx;
} }
.cate-item .item .name{ .cate-item .item .name {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 35rpx; height: 35rpx;
@@ -167,11 +167,11 @@ page{
color: #333; color: #333;
} }
.cate-item .item .price{ .cate-item .item .price {
display: block; display: block;
width: 365.625rpx; width: 365.625rpx;
height: 30rpx; height: 30rpx;
text-align: center; text-align: center;
font-size: 30rpx; font-size: 30rpx;
color: #b4282d; color: #b4282d;
} }

View File

@@ -6,134 +6,134 @@ const user = require('../../utils/user.js');
const app = getApp(); const app = getApp();
Page({ Page({
data: { data: {
newGoods: [], newGoods: [],
hotGoods: [], hotGoods: [],
topics: [], topics: [],
brands: [], brands: [],
groupons: [], groupons: [],
floorGoods: [], floorGoods: [],
// banner: [], // banner: [],
channel: [] channel: []
}, },
onShareAppMessage: function() { onShareAppMessage: function() {
return { return {
title: 'Renard', title: 'Renard',
desc: '唯爱与美食不可辜负', desc: '唯爱与美食不可辜负',
path: '/pages/index/index' path: '/pages/index/index'
} }
}, },
saveFormId: function(v) { saveFormId: function(v) {
if (v.detail.formId != 'the formId is a mock one') { if (v.detail.formId != 'the formId is a mock one') {
util.request(api.UserFormIdCreate, { util.request(api.UserFormIdCreate, {
formId: v.detail.formId formId: v.detail.formId
}); });
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getIndexData(); this.getIndexData();
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getIndexData: function() { getIndexData: function() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
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
}); });
wx.hideLoading();
} setTimeout(function() {
}); wx.hideLoading()
}, }, 2000);
onLoad: function(options) {
var that = this; let that = this;
wx.getSystemInfo({ util.request(api.IndexUrl).then(function(res) {
success: function(res) { if (res.errno === 0) {
that.setData({ that.setData({
windowWidth: res.windowWidth, newGoods: res.data.newGoodsList,
windowHeight: res.windowHeight 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
});
wx.hideLoading();
}
}); });
} },
}); onLoad: function(options) {
var that = this;
if (options.scene) { wx.getSystemInfo({
var scene = decodeURIComponent(options.scene); success: function(res) {
console.log("scene:" + scene); that.setData({
windowWidth: res.windowWidth,
let info_arr = []; windowHeight: res.windowHeight
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'
});
}
}
// 页面初始化 options为页面跳转所带来的参数 if (options.scene) {
if (options.grouponId) { var scene = decodeURIComponent(options.scene);
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 console.log("scene:" + scene);
wx.navigateTo({
url: '../goods/goods?grouponId=' + options.grouponId
});
}
// 页面初始化 options为页面跳转所带来的参数 let info_arr = [];
if (options.goodId) { info_arr = scene.split(',');
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 let _type = info_arr[0];
wx.navigateTo({ let id = info_arr[1];
url: '../goods/goods?id=' + options.goodId
});
}
// 页面初始化 options为页面跳转所带来的参数 if (_type == 'goods') {
if (options.orderId) { wx.navigateTo({
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页 url: '../goods/goods?id=' + id
wx.navigateTo({ });
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId } else if (_type == 'groupon') {
}); wx.navigateTo({
} url: '../goods/goods?grouponId=' + id
});
} else {
wx.navigateTo({
url: '../index/index'
});
}
}
this.getIndexData(); // 页面初始化 options为页面跳转所带来的参数
}, if (options.grouponId) {
onReady: function() { //这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
// 页面渲染完成 wx.navigateTo({
}, url: '../goods/goods?grouponId=' + options.grouponId
onShow: function() { });
// 页面显示 }
},
onHide: function() { // 页面初始化 options为页面跳转所带来的参数
// 页面隐藏 if (options.goodId) {
}, //这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
onUnload: function() { wx.navigateTo({
// 页面关闭 url: '../goods/goods?id=' + options.goodId
}, });
}
// 页面初始化 options为页面跳转所带来的参数
if (options.orderId) {
//这个pageId的值存在则证明首页的开启来源于用户点击来首页,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId
});
}
this.getIndexData();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
}); });

View File

@@ -1,8 +1,8 @@
{ {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index", "zan-capsule": "/components/capsule/index",
"goodList": "/components/goodList/goodList", "goodList": "/components/goodList/goodList",
"van-notice-bar": "/components/notice-bar/index" "van-notice-bar": "/components/notice-bar/index"
} }
} }

View File

@@ -1,140 +1,140 @@
<view class="container"> <view class="container">
<!-- 首页顶部通知消息 --> <!-- 首页顶部通知消息 -->
<van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" /> <van-notice-bar scrollable="true" text="目前上架的商品均可直接下单购买,欢迎大家购买支持我的工作!" />
<view class="HotName">今日推荐 <view class="HotName">今日推荐
<text></text> <text></text>
</view> </view>
<view class="HotMark">唯爱与美食不可辜负</view> <view class="HotMark">唯爱与美食不可辜负</view>
<view class="HotSwiper" style="margin-top:{{windowHeight/45}}px"> <view class="HotSwiper" style="margin-top:{{windowHeight/45}}px">
<swiper circular="true" autoplay="true" interval="6000" duration="500" previous-margin="{{windowWidth/3.8}}rpx" next-margin="{{windowWidth/3.8}}rpx"> <swiper circular="true" autoplay="true" interval="6000" duration="500" previous-margin="{{windowWidth/3.8}}rpx" next-margin="{{windowWidth/3.8}}rpx">
<block wx:for-items="{{hotGoods}}" wx:key="{{id}}"> <block wx:for-items="{{hotGoods}}" wx:key="{{id}}">
<navigator url="/pages/goods/goods?id={{item.id}}"> <navigator url="/pages/goods/goods?id={{item.id}}">
<swiper-item> <swiper-item>
<view class="swiper-box"> <view class="swiper-box">
<form bindsubmit="saveFormId" report-submit='true' class='form_class'> <form bindsubmit="saveFormId" report-submit='true' class='form_class'>
<button formType="submit" class='form_button'> <button formType="submit" class='form_button'>
<image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" /> <image src="{{item.picUrl}}" mode="aspectFill" data-id="{{item.id}}" />
</button> </button>
</form> </form>
<view class="swiper-box-info"> <view class="swiper-box-info">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
<view class="price"> <view class="price">
<view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view> <view class="counterPrice" wx:if="{{item.counterPrice > item.retailPrice}}">原价:¥{{item.counterPrice}}</view>
<view class="retailPrice">现价:¥{{item.retailPrice}}</view> <view class="retailPrice">现价:¥{{item.retailPrice}}</view>
</view>
<view class="capsule-tag" wx:if="{{item.isNew == true}}">
<zan-capsule color="#a78845" leftText="N" rightText="新 品" />
</view>
<view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}">
<zan-capsule color="#b4282d" leftText="H" rightText="折 扣" />
</view>
</view>
</view>
</swiper-item>
</navigator>
</block>
</swiper>
</view>
<view class="a-section a-groupon" wx:if="{{groupons.length > 0}}">
<view class="h">
<view class="title">
<view>
<navigator url="/pages/groupon/grouponList/grouponList">
<text class="txt">优惠专区</text>
</navigator>
</view> </view>
<view class="capsule-tag" wx:if="{{item.isNew == true}}">
<zan-capsule color="#a78845" leftText="N" rightText="新 品" />
</view>
<view class="capsule-tag" wx:if="{{item.counterPrice > item.retailPrice}}">
<zan-capsule color="#b4282d" leftText="H" rightText="折 扣" />
</view>
</view>
</view> </view>
</swiper-item>
</navigator>
</block>
</swiper>
</view>
<view class="a-section a-groupon" wx:if="{{groupons.length > 0}}">
<view class="h">
<view class="title">
<view>
<navigator url="/pages/groupon/grouponList/grouponList">
<text class="txt">优惠专区</text>
</navigator>
</view> </view>
</view> <view class="b">
</view> <view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id">
<view class="b"> <navigator url="/pages/goods/goods?id={{item.goods.id}}">
<view class="item" wx:for="{{groupons}}" wx:for-index="index" wx:for-item="item" wx:key="id"> <image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image>
<navigator url="/pages/goods/goods?id={{item.goods.id}}"> <view class="right">
<image class="img" src="{{item.goods.picUrl}}" background-size="cover"></image> <view class="text">
<view class="right"> <view class="header">
<view class="text"> <text class="name">{{item.goods.name}}</text>
<view class="header"> <view class="capsule-tag">
<text class="name">{{item.goods.name}}</text> <zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" />
<view class="capsule-tag"> </view>
<zan-capsule color="#a78845" leftText="团购" rightText="{{item.groupon_member}}" /> </view>
</view> <text class="desc">{{item.goods.brief}}</text>
</view> <view class="price">
<text class="desc">{{item.goods.brief}}</text> <view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view>
<view class="price"> <view class="retailPrice">团购价:¥{{item.groupon_price}}</view>
<view class="counterPrice">原价:¥{{item.goods.counterPrice}}</view> </view>
<view class="retailPrice">团购价:¥{{item.groupon_price}}</view> </view>
</view> </view>
</navigator>
</view> </view>
</view>
</navigator>
</view>
</view>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h">
<view class="title">
<navigator url="../newGoods/newGoods">
<text class="txt">新品首发</text>
</navigator>
</view>
</view>
<goodList goods="{{newGoods}}"></goodList>
</view>
<view class="a-section a-brand">
<view class="h">
<view class="title">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</view>
</view>
<view class="b">
<view class="item item-1" wx:for="{{brands}}" wx:key="id">
<navigator url="/pages/brandDetail/brandDetail?id={{item.id}}">
<view class="wrap">
<image class="img" src="{{item.picUrl}}" mode="aspectFill"></image>
<view class="mt">
<text class="brand">{{item.name}}</text>
</view>
</view>
</navigator>
</view>
</view>
</view>
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<navigator url="/pages/category/category?id={{item.id}}" class="more-a">
<view class="h" wx:if="{{item.goodsList.length > 0}}">
<text>{{item.name}}</text>
</view>
</navigator>
<goodList goods="{{item.goodsList}}"></goodList>
</view>
<view class="a-section a-topic" wx:if="topics.length > 0">
<view class="h">
<view class="title">
<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>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view> </view>
</scroll-view>
</view> </view>
</view>
<view class="a-section a-new" wx:if="{{newGoods.length > 0}}">
<view class="h">
<view class="title">
<navigator url="../newGoods/newGoods">
<text class="txt">新品首发</text>
</navigator>
</view>
</view>
<goodList goods="{{newGoods}}"></goodList>
</view>
<view class="a-section a-brand">
<view class="h">
<view class="title">
<navigator url="../brand/brand">
<text class="txt">品牌制造商直供</text>
</navigator>
</view>
</view>
<view class="b">
<view class="item item-1" wx:for="{{brands}}" wx:key="id">
<navigator url="/pages/brandDetail/brandDetail?id={{item.id}}">
<view class="wrap">
<image class="img" src="{{item.picUrl}}" mode="aspectFill"></image>
<view class="mt">
<text class="brand">{{item.name}}</text>
</view>
</view>
</navigator>
</view>
</view>
</view>
<view class="good-grid" wx:for="{{floorGoods}}" wx:key="id">
<navigator url="/pages/category/category?id={{item.id}}" class="more-a">
<view class="h" wx:if="{{item.goodsList.length > 0}}">
<text>{{item.name}}</text>
</view>
</navigator>
<goodList goods="{{item.goodsList}}"></goodList>
</view>
<view class="a-section a-topic" wx:if="topics.length > 0">
<view class="h">
<view class="title">
<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>
</view>
<text class="desc">{{item.subtitle}}</text>
</navigator>
</view>
</scroll-view>
</view>
</view>
</view> </view>

View File

@@ -1,336 +1,336 @@
.HotName { .HotName {
font-size: 50rpx; font-size: 50rpx;
margin-left: 40rpx; margin-left: 40rpx;
margin-top: 30rpx; margin-top: 30rpx;
color: #293539; color: #293539;
font-weight: 300; font-weight: 300;
position: relative; position: relative;
} }
.HotName text { .HotName text {
width: 14rpx; width: 14rpx;
height: 14rpx; height: 14rpx;
position: absolute; position: absolute;
border: 4rpx solid #a78845; border: 4rpx solid #a78845;
border-radius: 50%; border-radius: 50%;
} }
.HotMark { .HotMark {
margin-left: 50rpx; margin-left: 50rpx;
color: #293539; color: #293539;
font-size: 36rpx; font-size: 36rpx;
margin-top: 10rpx; margin-top: 10rpx;
text-align: center; text-align: center;
width: 350rpx; width: 350rpx;
border-bottom: 1rpx solid #a78845; border-bottom: 1rpx solid #a78845;
} }
.HotSwiper swiper { .HotSwiper swiper {
width: 100%; width: 100%;
height: 800rpx; height: 800rpx;
} }
.swiper-box { .swiper-box {
width: 520rpx; width: 520rpx;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
height: 700rpx; height: 700rpx;
box-shadow: 0px 10rpx 30rpx 0px #cfc9ca; box-shadow: 0px 10rpx 30rpx 0px #cfc9ca;
margin-top: 40rpx; margin-top: 40rpx;
border-radius: 20rpx; border-radius: 20rpx;
} }
.swiper-box image { .swiper-box image {
width: 100%; width: 100%;
height: 520rpx; height: 520rpx;
background-color: #f5f5f5; background-color: #f5f5f5;
border-top-left-radius: 10rpx; border-top-left-radius: 10rpx;
border-top-right-radius: 10rpx; border-top-right-radius: 10rpx;
} }
.swiper-box-info { .swiper-box-info {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
top: 520rpx; top: 520rpx;
background-color: #fff; background-color: #fff;
border-bottom-right-radius: 10rpx; border-bottom-right-radius: 10rpx;
border-bottom-left-radius: 10rpx; border-bottom-left-radius: 10rpx;
} }
.swiper-box-info .name { .swiper-box-info .name {
width: 90%; width: 90%;
margin: 0 auto; margin: 0 auto;
margin-top: 20rpx; margin-top: 20rpx;
font-size: 32rpx; font-size: 32rpx;
margin-left: 35rpx; margin-left: 35rpx;
color: #293539; color: #293539;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.swiper-box-info .price { .swiper-box-info .price {
float: left; float: left;
width: 60%; width: 60%;
margin-top: 10rpx; margin-top: 10rpx;
margin-left: 30rpx; margin-left: 30rpx;
} }
.swiper-box-info .counterPrice { .swiper-box-info .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
} }
.swiper-box-info .retailPrice { .swiper-box-info .retailPrice {
font-size: 30rpx; font-size: 30rpx;
color: #a78845; color: #a78845;
} }
.capsule-tag { .capsule-tag {
float: right; float: right;
padding-right: 20rpx; padding-right: 20rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.zan-capsule + .zan-capsule { .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.a-section .h { .a-section .h {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 130rpx; height: 130rpx;
} }
.a-section .h .title { .a-section .h .title {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #a78845; background-color: #a78845;
height: 75rpx; height: 75rpx;
} }
.a-section .h .txt { .a-section .h .txt {
padding-left: 50rpx; padding-left: 50rpx;
padding-right: 50rpx; padding-right: 50rpx;
height: 75rpx; height: 75rpx;
color: #fff; color: #fff;
font-size: 33rpx; font-size: 33rpx;
} }
.a-brand .b { .a-brand .b {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.a-brand .wrap { .a-brand .wrap {
position: relative; position: relative;
} }
.a-brand .img { .a-brand .img {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
} }
.a-brand .mt { .a-brand .mt {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
padding: 4rpx 12rpx; padding: 4rpx 12rpx;
background-color: #a78845; background-color: #a78845;
right: 0; right: 0;
top: 0; top: 0;
} }
.a-brand .mt .brand { .a-brand .mt .brand {
display: block; display: block;
font-size: 24rpx; font-size: 24rpx;
height: 33rpx; height: 33rpx;
color: #fff; color: #fff;
} }
.a-brand .mt .price, .a-brand .mt .unit { .a-brand .mt .price, .a-brand .mt .unit {
font-size: 25rpx; font-size: 25rpx;
color: #fff; color: #fff;
} }
.a-brand .item-1 { .a-brand .item-1 {
float: left; float: left;
width: 375rpx; width: 375rpx;
height: 252rpx; height: 252rpx;
overflow: hidden; overflow: hidden;
border-top: 1rpx solid #fff; border-top: 1rpx solid #fff;
margin-left: 1rpx; margin-left: 1rpx;
} }
.a-brand .item-1:nth-child(2n+1) { .a-brand .item-1:nth-child(2n+1) {
margin-left: 0; margin-left: 0;
width: 374rpx; width: 374rpx;
} }
.a-brand .item-1 .img { .a-brand .item-1 .img {
width: 375rpx; width: 375rpx;
height: 253rpx; height: 253rpx;
} }
.a-topic .b { .a-topic .b {
height: 533rpx; height: 533rpx;
width: 750rpx; width: 750rpx;
padding: 0 0 48rpx 0; padding: 0 0 48rpx 0;
} }
.a-topic .b .list { .a-topic .b .list {
height: 533rpx; height: 533rpx;
width: 750rpx; width: 750rpx;
white-space: nowrap; white-space: nowrap;
} }
.a-topic .b .item { .a-topic .b .item {
display: inline-block; display: inline-block;
height: 533rpx; height: 533rpx;
width: 680.5rpx; width: 680.5rpx;
margin-left: 30rpx; margin-left: 30rpx;
overflow: hidden; overflow: hidden;
} }
.a-topic .b .item:last-child { .a-topic .b .item:last-child {
margin-right: 30rpx; margin-right: 30rpx;
} }
.a-topic .b .img { .a-topic .b .img {
height: 387.5rpx; height: 387.5rpx;
width: 680.5rpx; width: 680.5rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.a-topic .b .np { .a-topic .b .np {
height: 35rpx; height: 35rpx;
margin-bottom: 13.5rpx; margin-bottom: 13.5rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.a-topic .b .np .price { .a-topic .b .np .price {
margin-left: 20.8rpx; margin-left: 20.8rpx;
color: #a78845; color: #a78845;
} }
.a-topic .b .desc { .a-topic .b .desc {
display: block; display: block;
height: 30rpx; height: 30rpx;
color: #999; color: #999;
font-size: 24rpx; font-size: 24rpx;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.a-groupon { .a-groupon {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.a-groupon .b .item { .a-groupon .b .item {
border-top: 1px solid #d9d9d9; border-top: 1px solid #d9d9d9;
margin: 0 20rpx; margin: 0 20rpx;
height: 244rpx; height: 244rpx;
width: 710rpx; width: 710rpx;
} }
.a-groupon .b .img { .a-groupon .b .img {
margin-top: 12rpx; margin-top: 12rpx;
margin-right: 12rpx; margin-right: 12rpx;
float: left; float: left;
width: 220rpx; width: 220rpx;
height: 220rpx; height: 220rpx;
} }
.a-groupon .b .right { .a-groupon .b .right {
float: left; float: left;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
} }
.a-groupon .b .text { .a-groupon .b .text {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
height: 244rpx; height: 244rpx;
width: 476rpx; width: 476rpx;
} }
.a-groupon .b .name { .a-groupon .b .name {
float: left; float: left;
width: 330rpx; width: 330rpx;
display: block; display: block;
color: #333; color: #333;
line-height: 50rpx; line-height: 50rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.a-groupon .capsule-tag { .a-groupon .capsule-tag {
float: right; float: right;
padding-right: 0rpx; padding-right: 0rpx;
padding-top: 8rpx; padding-top: 8rpx;
} }
.a-groupon .zan-capsule + .zan-capsule { .a-groupon .zan-capsule + .zan-capsule {
margin-left: 10px; margin-left: 10px;
} }
.a-groupon .b .desc { .a-groupon .b .desc {
width: 476rpx; width: 476rpx;
display: block; display: block;
color: #999; color: #999;
line-height: 50rpx; line-height: 50rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.a-groupon .b .price { .a-groupon .b .price {
width: 476rpx; width: 476rpx;
display: flex; display: flex;
color: #b4282d; color: #b4282d;
line-height: 50rpx; line-height: 50rpx;
font-size: 33rpx; font-size: 33rpx;
} }
.a-groupon .b .counterPrice { .a-groupon .b .counterPrice {
text-decoration: line-through; text-decoration: line-through;
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
} }
.a-groupon .b .retailPrice { .a-groupon .b .retailPrice {
margin-left: 30rpx; margin-left: 30rpx;
font-size: 28rpx; font-size: 28rpx;
color: #a78845; color: #a78845;
} }
.good-grid { .good-grid {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.good-grid .h { .good-grid .h {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 130rpx; height: 130rpx;
font-size: 33rpx; font-size: 33rpx;
color: #333; color: #333;
border: #a78845 1rpx; border: #a78845 1rpx;
} }

View File

@@ -3,121 +3,121 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
bannerInfo: { bannerInfo: {
'imgUrl': '', 'imgUrl': '',
'name': '' 'name': ''
},
categoryFilter: false,
filterCategory: [],
goodsList: [],
categoryId: 0,
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
page: 1,
size: 100
}, },
categoryFilter: false,
filterCategory: [],
goodsList: [],
categoryId: 0,
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
page: 1,
size: 100
},
onPullDownRefresh() {
this.getBanner();
this.getGoodsList();
wx.stopPullDownRefresh() //停止下拉刷新
},
getBanner: function() {
let that = this;
util.request(api.GoodsNew).then(function(res) {
if (res.errno === 0) {
that.setData({
bannerInfo: res.data.bannerInfo,
});
}
});
},
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) {
if (res.errno === 0) {
that.setData({
goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList
});
}
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getBanner();
this.getGoodsList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
openSortFilter: function(event) {
let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({
categoryFilter: !this.data.categoryFilter,
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
});
break;
case 'priceSort':
let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc';
}
this.setData({
currentSortType: 'price',
currentSort: 'retail_price',
currentSortOrder: tmpSortOrder,
categoryFilter: false
});
onPullDownRefresh() {
this.getBanner();
this.getGoodsList(); this.getGoodsList();
break; wx.stopPullDownRefresh() //停止下拉刷新
default: },
//综合排序
getBanner: function() {
let that = this;
util.request(api.GoodsNew).then(function(res) {
if (res.errno === 0) {
that.setData({
bannerInfo: res.data.bannerInfo,
});
}
});
},
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) {
if (res.errno === 0) {
that.setData({
goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList
});
}
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.getBanner();
this.getGoodsList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
openSortFilter: function(event) {
let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({
categoryFilter: !this.data.categoryFilter,
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
});
break;
case 'priceSort':
let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc';
}
this.setData({
currentSortType: 'price',
currentSort: 'retail_price',
currentSortOrder: tmpSortOrder,
categoryFilter: false
});
this.getGoodsList();
break;
default:
//综合排序
this.setData({
currentSortType: 'default',
currentSort: 'add_time',
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0
});
this.getGoodsList();
}
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({ this.setData({
currentSortType: 'default', 'categoryFilter': false,
currentSort: 'add_time', 'categoryId': this.data.filterCategory[currentIndex].id
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0
}); });
this.getGoodsList(); this.getGoodsList();
} }
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
this.setData({
'categoryFilter': false,
'categoryId': this.data.filterCategory[currentIndex].id
});
this.getGoodsList();
}
}) })

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "新品首发", "navigationBarTitleText": "新品首发",
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }

View File

@@ -1,32 +1,32 @@
<view class="container"> <view class="container">
<view class="brand-info"> <view class="brand-info">
<view class="name"> <view class="name">
<image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image> <image class="img" src="{{bannerInfo.imgUrl}}" background-size="cover"></image>
<view class="info-box"> <view class="info-box">
<view class="info"> <view class="info">
<text class="txt">{{bannerInfo.name}}</text> <text class="txt">{{bannerInfo.name}}</text>
<text class="line"></text> <text class="line"></text>
</view>
</view>
</view> </view>
</view>
</view> </view>
</view> <view class="sort">
<view class="sort"> <view class="sort-box">
<view class="sort-box"> <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort"> <text class="txt">综合</text>
<text class="txt">综合</text> </view>
</view> <view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <text class="txt">价格</text>
<text class="txt">价格</text> </view>
</view> <view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter"> <text class="txt">分类</text>
<text class="txt">分类</text> </view>
</view> </view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view> </view>
<view class="sort-box-category" wx-if="{{categoryFilter}}"> <view class="cate-item" hidden='{{categoryFilter}}'>
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view> <goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view> </view>
</view>
<view class="cate-item" hidden='{{categoryFilter}}'>
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view>
</view> </view>

View File

@@ -1,138 +1,138 @@
page { page {
background: #f4f4f4; background: #f4f4f4;
} }
.brand-info .name { .brand-info .name {
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
position: relative; position: relative;
} }
.brand-info .img { .brand-info .img {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
} }
.brand-info .info-box { .brand-info .info-box {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 278rpx; height: 278rpx;
text-align: center; text-align: center;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.brand-info .info { .brand-info .info {
display: block; display: block;
} }
.brand-info .txt { .brand-info .txt {
display: block; display: block;
height: 40rpx; height: 40rpx;
font-size: 37.5rpx; font-size: 37.5rpx;
color: #fff; color: #fff;
} }
.brand-info .line { .brand-info .line {
margin: 0 auto; margin: 0 auto;
margin-top: 16rpx; margin-top: 16rpx;
display: block; display: block;
height: 2rpx; height: 2rpx;
width: 145rpx; width: 145rpx;
background: #fff; background: #fff;
} }
.sort { .sort {
position: relative; position: relative;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box { .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item { .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex: 1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt { .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt { .sort-box .item.active .txt {
color: #a78845; color: #a78845;
} }
.sort-box .item.by-price { .sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat; background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc { .sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc { .sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.cate-item { .cate-item {
z-index: -1; z-index: -1;
} }
.goodList { .goodList {
z-index: -1; z-index: -1;
} }
.sort-box-category { .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
z-index: 5000; z-index: 5000;
} }
.sort-box-category .item { .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
z-index: 5000; z-index: 5000;
} }
.sort-box-category .item.active { .sort-box-category .item.active {
color: #a78845; color: #a78845;
border: 1px solid #a78845; border: 1px solid #a78845;
z-index: 5000; z-index: 5000;
} }

View File

@@ -7,25 +7,25 @@ Page({
status: false, status: false,
orderId: 0 orderId: 0
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
orderId: options.orderId, orderId: options.orderId,
status: options.status === '1' ? true : false status: options.status === '1' ? true : false
}) })
}, },
onReady: function () { onReady: function() {
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
}, },
@@ -33,7 +33,7 @@ Page({
let that = this; let that = this;
util.request(api.OrderPrepay, { util.request(api.OrderPrepay, {
orderId: that.data.orderId orderId: that.data.orderId
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
const payParam = res.data; const payParam = res.data;
console.log("支付过程开始") console.log("支付过程开始")
@@ -43,17 +43,17 @@ Page({
'package': payParam.packageValue, 'package': payParam.packageValue,
'signType': payParam.signType, 'signType': payParam.signType,
'paySign': payParam.paySign, 'paySign': payParam.paySign,
'success': function (res) { 'success': function(res) {
console.log("支付过程成功") console.log("支付过程成功")
that.setData({ that.setData({
status: true status: true
}); });
}, },
'fail': function (res) { 'fail': function(res) {
console.log("支付过程失败") console.log("支付过程失败")
util.showErrorToast('支付失败'); util.showErrorToast('支付失败');
}, },
'complete': function (res) { 'complete': function(res) {
console.log("支付过程结束") console.log("支付过程结束")
} }
}); });

View File

@@ -10,7 +10,8 @@
<view class="error" wx:if="{{!status}}"> <view class="error" wx:if="{{!status}}">
<view class="msg">付款失败</view> <view class="msg">付款失败</view>
<view class="tips"> <view class="tips">
<view class="p">请在 <text class="time">半小时</text> 内完成付款</view> <view class="p">请在
<text class="time">半小时</text> 内完成付款</view>
<view class="p">否则订单将会被系统取消</view> <view class="p">否则订单将会被系统取消</view>
</view> </view>
<view class="btns"> <view class="btns">

View File

@@ -33,7 +33,7 @@ page {
width: 200rpx; width: 200rpx;
line-height: 78rpx; line-height: 78rpx;
border: 1px solid #868686; border: 1px solid #868686;
color: #000000; color: #000;
border-radius: 5rpx; border-radius: 5rpx;
} }
@@ -56,4 +56,4 @@ page {
.pay-result .error .tips .p { .pay-result .error .tips .p {
line-height: 42rpx; line-height: 42rpx;
text-align: center; text-align: center;
} }

View File

@@ -3,197 +3,197 @@ var api = require('../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
keywrod: '', keywrod: '',
searchStatus: false, searchStatus: false,
goodsList: [], goodsList: [],
helpKeyword: [], helpKeyword: [],
historyKeyword: [], historyKeyword: [],
categoryFilter: false, categoryFilter: false,
currentSort: 'name', currentSort: 'name',
currentSortType: 'default', currentSortType: 'default',
currentSortOrder: 'desc', currentSortOrder: 'desc',
filterCategory: [], filterCategory: [],
defaultKeyword: {}, defaultKeyword: {},
hotKeyword: [], hotKeyword: [],
page: 1, page: 1,
size: 20, size: 20,
categoryId: 0 categoryId: 0
}, },
//事件处理函数 //事件处理函数
closeSearch: function() { closeSearch: function() {
wx.navigateBack() wx.navigateBack()
}, },
clearKeyword: function() { clearKeyword: function() {
this.setData({
keyword: '',
searchStatus: false
});
},
onLoad: function() {
this.getSearchKeyword();
},
getSearchKeyword() {
let that = this;
util.request(api.SearchIndex).then(function(res) {
if (res.errno === 0) {
that.setData({
historyKeyword: res.data.historyKeywordList,
defaultKeyword: res.data.defaultKeyword,
hotKeyword: res.data.hotKeywordList
});
}
});
},
inputChange: function(e) {
this.setData({
keyword: e.detail.value,
searchStatus: false
});
if (e.detail.value) {
this.getHelpKeyword();
}
},
getHelpKeyword: function() {
let that = this;
util.request(api.SearchHelper, {
keyword: that.data.keyword
}).then(function(res) {
if (res.errno === 0) {
that.setData({
helpKeyword: res.data
});
}
});
},
inputFocus: function() {
this.setData({
searchStatus: false,
goodsList: []
});
if (this.data.keyword) {
this.getHelpKeyword();
}
},
clearHistory: function() {
this.setData({
historyKeyword: []
});
util.request(api.SearchClearHistory, {}, 'POST')
.then(function(res) {
console.log('清除成功');
});
},
getGoodsList: function() {
let that = this;
util.request(api.GoodsList, {
keyword: that.data.keyword,
page: that.data.page,
size: that.data.size,
sort: that.data.currentSort,
order: that.data.currentSortOrder,
categoryId: that.data.categoryId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
searchStatus: true,
categoryFilter: false,
goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList
});
}
//重新获取关键词
that.getSearchKeyword();
});
},
onKeywordTap: function(event) {
this.getSearchResult(event.target.dataset.keyword);
},
getSearchResult(keyword) {
if (keyword === '') {
keyword = this.data.defaultKeyword.keyword;
}
this.setData({
keyword: keyword,
page: 1,
categoryId: 0,
goodsList: []
});
this.getGoodsList();
},
openSortFilter: function(event) {
let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({ this.setData({
categoryFilter: !this.data.categoryFilter, keyword: '',
currentSortType: 'category', searchStatus: false
currentSort: 'add_time',
currentSortOrder: 'desc'
}); });
break; },
case 'priceSort': onLoad: function() {
let tmpSortOrder = 'asc'; this.getSearchKeyword();
if (this.data.currentSortOrder == 'asc') { },
tmpSortOrder = 'desc';
getSearchKeyword() {
let that = this;
util.request(api.SearchIndex).then(function(res) {
if (res.errno === 0) {
that.setData({
historyKeyword: res.data.historyKeywordList,
defaultKeyword: res.data.defaultKeyword,
hotKeyword: res.data.hotKeywordList
});
}
});
},
inputChange: function(e) {
this.setData({
keyword: e.detail.value,
searchStatus: false
});
if (e.detail.value) {
this.getHelpKeyword();
}
},
getHelpKeyword: function() {
let that = this;
util.request(api.SearchHelper, {
keyword: that.data.keyword
}).then(function(res) {
if (res.errno === 0) {
that.setData({
helpKeyword: res.data
});
}
});
},
inputFocus: function() {
this.setData({
searchStatus: false,
goodsList: []
});
if (this.data.keyword) {
this.getHelpKeyword();
}
},
clearHistory: function() {
this.setData({
historyKeyword: []
});
util.request(api.SearchClearHistory, {}, 'POST')
.then(function(res) {
console.log('清除成功');
});
},
getGoodsList: function() {
let that = this;
util.request(api.GoodsList, {
keyword: that.data.keyword,
page: that.data.page,
size: that.data.size,
sort: that.data.currentSort,
order: that.data.currentSortOrder,
categoryId: that.data.categoryId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
searchStatus: true,
categoryFilter: false,
goodsList: res.data.goodsList,
filterCategory: res.data.filterCategoryList
});
}
//重新获取关键词
that.getSearchKeyword();
});
},
onKeywordTap: function(event) {
this.getSearchResult(event.target.dataset.keyword);
},
getSearchResult(keyword) {
if (keyword === '') {
keyword = this.data.defaultKeyword.keyword;
} }
this.setData({ this.setData({
currentSortType: 'price', keyword: keyword,
currentSort: 'retail_price', page: 1,
currentSortOrder: tmpSortOrder, categoryId: 0,
categoryFilter: false goodsList: []
}); });
this.getGoodsList(); this.getGoodsList();
break; },
default: openSortFilter: function(event) {
//综合排序 let currentId = event.currentTarget.id;
switch (currentId) {
case 'categoryFilter':
this.setData({
categoryFilter: !this.data.categoryFilter,
currentSortType: 'category',
currentSort: 'add_time',
currentSortOrder: 'desc'
});
break;
case 'priceSort':
let tmpSortOrder = 'asc';
if (this.data.currentSortOrder == 'asc') {
tmpSortOrder = 'desc';
}
this.setData({
currentSortType: 'price',
currentSort: 'retail_price',
currentSortOrder: tmpSortOrder,
categoryFilter: false
});
this.getGoodsList();
break;
default:
//综合排序
this.setData({
currentSortType: 'default',
currentSort: 'name',
currentSortOrder: 'desc',
categoryFilter: false,
categoryId: 0,
});
this.getGoodsList();
}
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
let filterCategory = this.data.filterCategory;
let currentCategory = null;
for (let key in filterCategory) {
if (key == currentIndex) {
filterCategory[key].selected = true;
currentCategory = filterCategory[key];
} else {
filterCategory[key].selected = false;
}
}
this.setData({ this.setData({
currentSortType: 'default', filterCategory: filterCategory,
currentSort: 'name', categoryFilter: false,
currentSortOrder: 'desc', categoryId: currentCategory.id,
categoryFilter: false, page: 1,
categoryId: 0, goodsList: []
}); });
this.getGoodsList(); this.getGoodsList();
},
onKeywordConfirm(event) {
this.getSearchResult(event.detail.value);
} }
},
selectCategory: function(event) {
let currentIndex = event.target.dataset.categoryIndex;
let filterCategory = this.data.filterCategory;
let currentCategory = null;
for (let key in filterCategory) {
if (key == currentIndex) {
filterCategory[key].selected = true;
currentCategory = filterCategory[key];
} else {
filterCategory[key].selected = false;
}
}
this.setData({
filterCategory: filterCategory,
categoryFilter: false,
categoryId: currentCategory.id,
page: 1,
goodsList: []
});
this.getGoodsList();
},
onKeywordConfirm(event) {
this.getSearchResult(event.detail.value);
}
}); });

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "搜索", "navigationBarTitleText": "搜索",
"usingComponents": { "usingComponents": {
"goodList": "/components/goodList/goodList" "goodList": "/components/goodList/goodList"
} }
} }

View File

@@ -1,59 +1,59 @@
<scroll-view class="container" style="height: 100%;"> <scroll-view class="container" style="height: 100%;">
<view class="search-header"> <view class="search-header">
<view class="input-box"> <view class="input-box">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png"></image> <image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/search2-2fb94833aa.png"></image>
<input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" placeholder="{{defaultKeyword.keyword}}" /> <input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" placeholder="{{defaultKeyword.keyword}}" />
<image class="del" wx:if="{{keyword}}" bindtap="clearKeyword" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/clearIpt-f71b83e3c2.png"></image> <image class="del" wx:if="{{keyword}}" bindtap="clearKeyword" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/clearIpt-f71b83e3c2.png"></image>
</view>
<view class="right" bindtap="closeSearch">取消</view>
</view> </view>
<view class="right" bindtap="closeSearch">取消</view> <view class="no-search" wx:if="{{ !searchStatus}}">
</view> <view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}">
<view class="no-search" wx:if="{{ !searchStatus}}"> <view class="h">
<view class="search-keywords search-history" wx:if="{{!keyword && historyKeyword.length}}"> <text class="title">历史记录</text>
<view class="h"> <image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image>
<text class="title">历史记录</text> </view>
<image class="icon" bindtap="clearHistory" src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/del1-93f0a4add4.png"></image> <view class="b">
</view> <view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view>
<view class="b"> </view>
<view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view> </view>
</view> <view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<view class="h">
<text class="title">热门搜索</text>
</view>
<view class="b">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
</view>
</view>
<view class="shelper-list" wx:if="{{keyword}}">
<view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
</view>
</view> </view>
<view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
<view class="h">
<text class="title">热门搜索</text>
</view>
<view class="b">
<view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
</view>
</view>
<view class="shelper-list" wx:if="{{keyword}}">
<view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
</view>
</view>
<view class="search-result" wx:if="{{ searchStatus && goodsList.length}}"> <view class="search-result" wx:if="{{ searchStatus && goodsList.length}}">
<view class="sort"> <view class="sort">
<view class="sort-box"> <view class="sort-box">
<view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort"> <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
<text class="txt">综合</text> <text class="txt">综合</text>
</view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort">
<text class="txt">价格</text>
</view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" id="categoryFilter">
<text class="txt">分类</text>
</view>
</view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view> </view>
<view class="item by-price {{currentSortType == 'price' ? 'active' : ''}} {{currentSortOrder == 'asc' ? 'asc' : 'desc'}}" bindtap="openSortFilter" id="priceSort"> <view class="cate-item">
<text class="txt">价格</text> <goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view> </view>
<view class="item {{currentSortType == 'category' ? 'active' : ''}}" id="categoryFilter">
<text class="txt">分类</text>
</view>
</view>
<view class="sort-box-category" wx-if="{{categoryFilter}}">
<view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
</view>
</view> </view>
<view class="cate-item">
<goodList calss="goodList" goods="{{goodsList}}"></goodList>
</view>
</view>
<view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}"> <view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image> <image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noSearchResult-7572a94f32.png"></image>
<text class="text">您寻找的商品还未上架</text> <text class="text">您寻找的商品还未上架</text>
</view> </view>
</scroll-view> </scroll-view>

View File

@@ -1,280 +1,280 @@
page { page {
min-height: 100%; min-height: 100%;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.container { .container {
min-height: 100%; min-height: 100%;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
.search-header { .search-header {
position: fixed; position: fixed;
top: 0; top: 0;
width: 750rpx; width: 750rpx;
height: 91rpx; height: 91rpx;
display: flex; display: flex;
background: #fff; background: #fff;
border-bottom: 1px solid rgba(0, 0, 0, 0.15); border-bottom: 1px solid rgba(0, 0, 0, 0.15);
padding: 0 31.25rpx; padding: 0 31.25rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.search-header .input-box { .search-header .input-box {
position: relative; position: relative;
margin-top: 16rpx; margin-top: 16rpx;
float: left; float: left;
width: 0; width: 0;
flex: 1; flex: 1;
height: 59rpx; height: 59rpx;
line-height: 59rpx; line-height: 59rpx;
padding: 0 20rpx; padding: 0 20rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.search-header .icon { .search-header .icon {
position: absolute; position: absolute;
top: 14rpx; top: 14rpx;
left: 20rpx; left: 20rpx;
width: 31rpx; width: 31rpx;
height: 31rpx; height: 31rpx;
} }
.search-header .del { .search-header .del {
position: absolute; position: absolute;
top: 3rpx; top: 3rpx;
right: 10rpx; right: 10rpx;
width: 53rpx; width: 53rpx;
height: 53rpx; height: 53rpx;
z-index: 10; z-index: 10;
} }
.search-header .keywrod { .search-header .keywrod {
position: absolute; position: absolute;
top: 0; top: 0;
left: 40rpx; left: 40rpx;
width: 506rpx; width: 506rpx;
height: 59rpx; height: 59rpx;
padding-left: 30rpx; padding-left: 30rpx;
} }
.search-header .right { .search-header .right {
margin-top: 24rpx; margin-top: 24rpx;
margin-left: 31rpx; margin-left: 31rpx;
margin-right: 6rpx; margin-right: 6rpx;
width: 58rpx; width: 58rpx;
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
float: right; float: right;
} }
.no-search { .no-search {
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-top: 91rpx; margin-top: 91rpx;
} }
.search-keywords { .search-keywords {
background: #fff; background: #fff;
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.search-keywords .h { .search-keywords .h {
padding: 0 31.25rpx; padding: 0 31.25rpx;
height: 93rpx; height: 93rpx;
line-height: 93rpx; line-height: 93rpx;
width: 100%; width: 100%;
color: #999; color: #999;
font-size: 29rpx; font-size: 29rpx;
} }
.search-keywords .title { .search-keywords .title {
display: block; display: block;
width: 120rpx; width: 120rpx;
float: left; float: left;
} }
.search-keywords .icon { .search-keywords .icon {
margin-top: 19rpx; margin-top: 19rpx;
float: right; float: right;
display: block; display: block;
margin-left: 511rpx; margin-left: 511rpx;
height: 55rpx; height: 55rpx;
width: 55rpx; width: 55rpx;
} }
.search-keywords .b { .search-keywords .b {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding-left: 31.25rpx; padding-left: 31.25rpx;
} }
.search-keywords .item { .search-keywords .item {
display: inline-block; display: inline-block;
width: auto; width: auto;
height: 48rpx; height: 48rpx;
line-height: 48rpx; line-height: 48rpx;
padding: 0 15rpx; padding: 0 15rpx;
border: 1px solid #999; border: 1px solid #999;
margin: 0 31.25rpx 31.25rpx 0; margin: 0 31.25rpx 31.25rpx 0;
font-size: 24rpx; font-size: 24rpx;
color: #333; color: #333;
} }
.search-keywords .item.active { .search-keywords .item.active {
color: #a78845; color: #a78845;
border: 1px solid #a78845; border: 1px solid #a78845;
} }
.shelper-list { .shelper-list {
width: 750rpx; width: 750rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
padding: 0 31.25rpx; padding: 0 31.25rpx;
} }
.shelper-list .item { .shelper-list .item {
height: 93rpx; height: 93rpx;
width: 687.5rpx; width: 687.5rpx;
line-height: 93rpx; line-height: 93rpx;
font-size: 24rpx; font-size: 24rpx;
color: #333; color: #333;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.sort { .sort {
position: fixed; position: fixed;
top: 91rpx; top: 91rpx;
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
} }
.sort-box { .sort-box {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: 78rpx; height: 78rpx;
overflow: hidden; overflow: hidden;
padding: 0 30rpx; padding: 0 30rpx;
display: flex; display: flex;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box .item { .sort-box .item {
height: 78rpx; height: 78rpx;
line-height: 78rpx; line-height: 78rpx;
text-align: center; text-align: center;
flex: 1; flex: 1;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.sort-box .item .txt { .sort-box .item .txt {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #333; color: #333;
} }
.sort-box .item.active .txt { .sort-box .item.active .txt {
color: #a78845; color: #a78845;
} }
.sort-box .item.by-price { .sort-box .item.by-price {
background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat; background: url(//yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/no-3127092a69.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.asc { .sort-box .item.by-price.active.asc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/up-636b92c0a5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box .item.by-price.active.desc { .sort-box .item.by-price.active.desc {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/down-95e035f3e5.png) 155rpx center no-repeat;
background-size: 15rpx 21rpx; background-size: 15rpx 21rpx;
} }
.sort-box-category { .sort-box-category {
background: #fff; background: #fff;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
padding: 40rpx 40rpx 0 0; padding: 40rpx 40rpx 0 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.sort-box-category .item { .sort-box-category .item {
height: 54rpx; height: 54rpx;
line-height: 54rpx; line-height: 54rpx;
text-align: center; text-align: center;
float: left; float: left;
padding: 0 16rpx; padding: 0 16rpx;
margin: 0 0 40rpx 40rpx; margin: 0 0 40rpx 40rpx;
border: 1px solid #666; border: 1px solid #666;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
} }
.sort-box-category .item.active { .sort-box-category .item.active {
color: #a78845; color: #a78845;
border: 1px solid #a78845; border: 1px solid #a78845;
} }
.cate-item { .cate-item {
margin-top: 175rpx; margin-top: 175rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.cate-item .h { .cate-item .h {
height: 145rpx; height: 145rpx;
width: 750rpx; width: 750rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.cate-item .h .name { .cate-item .h .name {
display: block; display: block;
height: 35rpx; height: 35rpx;
margin-bottom: 18rpx; margin-bottom: 18rpx;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.cate-item .h .desc { .cate-item .h .desc {
display: block; display: block;
height: 24rpx; height: 24rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
} }
.search-result-empty { .search-result-empty {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding-top: 300rpx; padding-top: 300rpx;
} }
.search-result-empty .icon { .search-result-empty .icon {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 240rpx; width: 240rpx;
height: 240rpx; height: 240rpx;
} }
.search-result-empty .text { .search-result-empty .text {
display: block; display: block;
width: 100%; width: 100%;
height: 40rpx; height: 40rpx;
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
color: #999; color: #999;
} }

View File

@@ -4,170 +4,170 @@ var api = require('../../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
checkedGoodsList: [], checkedGoodsList: [],
checkedAddress: {}, checkedAddress: {},
checkedCoupon: [], checkedCoupon: [],
goodsTotalPrice: 0.00, //商品总价 goodsTotalPrice: 0.00, //商品总价
freightPrice: 0.00, //快递费 freightPrice: 0.00, //快递费
couponPrice: 0.00, //优惠券的价格 couponPrice: 0.00, //优惠券的价格
grouponPrice: 0.00, //团购优惠价格 grouponPrice: 0.00, //团购优惠价格
orderTotalPrice: 0.00, //订单总价 orderTotalPrice: 0.00, //订单总价
actualPrice: 0.00, //实际需要支付的总价 actualPrice: 0.00, //实际需要支付的总价
cartId: 0, cartId: 0,
addressId: 0, addressId: 0,
couponId: 0, couponId: 0,
grouponLinkId: 0, //参与的团购如果是发起则为0 grouponLinkId: 0, //参与的团购如果是发起则为0
grouponRulesId: 0 //团购规则ID grouponRulesId: 0 //团购规则ID
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
//获取checkou信息 //获取checkou信息
getCheckoutInfo: function() { getCheckoutInfo: function() {
let that = this; let that = this;
util.request(api.CartCheckout, { util.request(api.CartCheckout, {
cartId: that.data.cartId, cartId: that.data.cartId,
addressId: that.data.addressId, addressId: that.data.addressId,
couponId: that.data.couponId, couponId: that.data.couponId,
grouponRulesId: that.data.grouponRulesId grouponRulesId: that.data.grouponRulesId
}).then(function(res) { }).then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
checkedGoodsList: res.data.checkedGoodsList, checkedGoodsList: res.data.checkedGoodsList,
checkedAddress: res.data.checkedAddress, checkedAddress: res.data.checkedAddress,
actualPrice: res.data.actualPrice, actualPrice: res.data.actualPrice,
checkedCoupon: res.data.checkedCoupon, checkedCoupon: res.data.checkedCoupon,
couponPrice: res.data.couponPrice, couponPrice: res.data.couponPrice,
grouponPrice: res.data.grouponPrice, grouponPrice: res.data.grouponPrice,
freightPrice: res.data.freightPrice, freightPrice: res.data.freightPrice,
goodsTotalPrice: res.data.goodsTotalPrice, goodsTotalPrice: res.data.goodsTotalPrice,
orderTotalPrice: res.data.orderTotalPrice, orderTotalPrice: res.data.orderTotalPrice,
addressId: res.data.addressId, addressId: res.data.addressId,
couponId: res.data.couponId, couponId: res.data.couponId,
grouponRulesId: res.data.grouponRulesId, grouponRulesId: res.data.grouponRulesId,
});
}
wx.hideLoading();
});
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
wx.showLoading({
title: '加载中...',
});
try {
var cartId = wx.getStorageSync('cartId');
if (cartId) {
this.setData({
'cartId': cartId
});
}
var addressId = wx.getStorageSync('addressId');
if (addressId) {
this.setData({
'addressId': addressId
});
}
var couponId = wx.getStorageSync('couponId');
if (couponId) {
this.setData({
'couponId': couponId
});
}
var grouponRulesId = wx.getStorageSync('grouponRulesId');
if (grouponRulesId) {
this.setData({
'grouponRulesId': grouponRulesId
});
}
var grouponLinkId = wx.getStorageSync('grouponLinkId');
if (grouponLinkId) {
this.setData({
'grouponLinkId': grouponLinkId
});
}
} catch (e) {
// Do something when catch error
console.log(e);
}
this.getCheckoutInfo();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
submitOrder: function() {
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
return false;
}
util.request(api.OrderSubmit, {
cartId: this.data.cartId,
addressId: this.data.addressId,
couponId: this.data.couponId,
grouponRulesId: this.data.grouponRulesId,
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
if (res.errno === 0) {
const orderId = res.data.orderId;
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
}); });
}, }
'fail': function(res) { wx.hideLoading();
console.log("支付过程失败");
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
},
'complete': function(res) {
console.log("支付过程结束")
}
});
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
}); });
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
onReady: function() {
// 页面渲染完成
} else { },
util.showErrorToast(res.errmsg); onShow: function() {
} // 页面显示
}); wx.showLoading({
} title: '加载中...',
});
try {
var cartId = wx.getStorageSync('cartId');
if (cartId) {
this.setData({
'cartId': cartId
});
}
var addressId = wx.getStorageSync('addressId');
if (addressId) {
this.setData({
'addressId': addressId
});
}
var couponId = wx.getStorageSync('couponId');
if (couponId) {
this.setData({
'couponId': couponId
});
}
var grouponRulesId = wx.getStorageSync('grouponRulesId');
if (grouponRulesId) {
this.setData({
'grouponRulesId': grouponRulesId
});
}
var grouponLinkId = wx.getStorageSync('grouponLinkId');
if (grouponLinkId) {
this.setData({
'grouponLinkId': grouponLinkId
});
}
} catch (e) {
// Do something when catch error
console.log(e);
}
this.getCheckoutInfo();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
submitOrder: function() {
if (this.data.addressId <= 0) {
util.showErrorToast('请选择收货地址');
return false;
}
util.request(api.OrderSubmit, {
cartId: this.data.cartId,
addressId: this.data.addressId,
couponId: this.data.couponId,
grouponRulesId: this.data.grouponRulesId,
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
if (res.errno === 0) {
const orderId = res.data.orderId;
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
},
'fail': function(res) {
console.log("支付过程失败");
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
},
'complete': function(res) {
console.log("支付过程结束")
}
});
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
} else {
util.showErrorToast(res.errmsg);
}
});
}
}); });

View File

@@ -1,65 +1,65 @@
<view class="container"> <view class="container">
<view class="address-box"> <view class="address-box">
<view class="address-item" bindtap="selectAddress" wx:if="{{checkedAddress.id > 0}}"> <view class="address-item" bindtap="selectAddress" wx:if="{{checkedAddress.id > 0}}">
<view class="l"> <view class="l">
<text class="name">{{checkedAddress.name}}</text> <text class="name">{{checkedAddress.name}}</text>
<text class="default" wx:if="{{checkedAddress.isDefault}}">默认</text> <text class="default" wx:if="{{checkedAddress.isDefault}}">默认</text>
</view> </view>
<view class="m"> <view class="m">
<text class="mobile">{{checkedAddress.mobile}}</text> <text class="mobile">{{checkedAddress.mobile}}</text>
<text class="address">{{checkedAddress.address}}</text> <text class="address">{{checkedAddress.address}}</text>
</view> </view>
<view class="r"> <view class="r">
<image src="/static/images/address_right.png"></image> <image src="/static/images/address_right.png"></image>
</view> </view>
</view> </view>
<view class="address-item address-empty" bindtap="selectAddress" wx:else> <view class="address-item address-empty" bindtap="selectAddress" wx:else>
<view class="m"> <view class="m">
还没有收货地址,去添加 还没有收货地址,去添加
</view> </view>
<view class="r"> <view class="r">
<image src="/static/images/address_right.png"></image> <image src="/static/images/address_right.png"></image>
</view> </view>
</view>
</view>
<view class="order-box">
<view class="order-item">
<view class="l">
<text class="name">商品合计</text>
</view>
<view class="r">
<text class="txt">¥ {{goodsTotalPrice}}元</text>
</view>
</view>
<view class="order-item">
<view class="l">
<text class="name">运费</text>
</view>
<view class="r">
<text class="txt">¥ {{freightPrice}}元</text>
</view>
</view>
</view>
<view class="goods-items">
<view class="item" wx:for="{{checkedGoodsList}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view> </view>
<view class="m">{{item.specifications}}</view>
<view class="b">¥{{item.price}}</view>
</view>
</view> </view>
</view>
<view class="order-total"> <view class="order-box">
<view class="l">实付:¥{{actualPrice}}</view> <view class="order-item">
<view class="r" bindtap="submitOrder">去付款</view> <view class="l">
</view> <text class="name">商品合计</text>
</view>
<view class="r">
<text class="txt">¥ {{goodsTotalPrice}}元</text>
</view>
</view>
<view class="order-item">
<view class="l">
<text class="name">运费</text>
</view>
<view class="r">
<text class="txt">¥ {{freightPrice}}元</text>
</view>
</view>
</view>
<view class="goods-items">
<view class="item" wx:for="{{checkedGoodsList}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="m">{{item.specifications}}</view>
<view class="b">¥{{item.price}}</view>
</view>
</view>
</view>
<view class="order-total">
<view class="l">实付:¥{{actualPrice}}</view>
<view class="r" bindtap="submitOrder">去付款</view>
</view>
</view> </view>

View File

@@ -1,295 +1,293 @@
page{ page {
height: 100%; height: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.address-box{ .address-box {
width: 100%; width: 100%;
height: 166.55rpx; height: 166.55rpx;
background: url('http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png') 0 0 repeat-x; background: 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: 62.5rpx 10.5rpx; background-size: 62.5rpx 10.5rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding-top: 10.5rpx; padding-top: 10.5rpx;
} }
.address-item{ .address-item {
display: flex; display: flex;
height: 155.55rpx; height: 155.55rpx;
background: #fff; background: #fff;
padding: 41.6rpx 0 41.6rpx 31.25rpx; padding: 41.6rpx 0 41.6rpx 31.25rpx;
} }
.address-item.address-empty{ .address-item.address-empty {
line-height: 75rpx; line-height: 75rpx;
text-align: center; text-align: center;
} }
.address-box .l{ .address-box .l {
width: 125rpx; width: 125rpx;
height: 100%; height: 100%;
} }
.address-box .l .name{ .address-box .l .name {
margin-left: 6.25rpx; margin-left: 6.25rpx;
margin-top: -7.25rpx; margin-top: -7.25rpx;
display: block; display: block;
width: 125rpx; width: 125rpx;
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
margin-bottom: 5rpx; margin-bottom: 5rpx;
} }
.address-box .l .default{ .address-box .l .default {
margin-left: 6.25rpx; margin-left: 6.25rpx;
display: block; display: block;
width: 62rpx; width: 62rpx;
height: 33rpx; height: 33rpx;
border-radius: 5rpx; border-radius: 5rpx;
border: 1px solid #b4282d; border: 1px solid #b4282d;
font-size: 20.5rpx; font-size: 20.5rpx;
text-align: center; text-align: center;
line-height: 29rpx; line-height: 29rpx;
color: #b4282d; color: #b4282d;
} }
.address-box .m{ .address-box .m {
flex: 1; flex: 1;
height: 72.25rpx; height: 72.25rpx;
color: #999; color: #999;
} }
.address-box .mobile{ .address-box .mobile {
display: block; display: block;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
margin-bottom: 6.25rpx; margin-bottom: 6.25rpx;
font-size: 30rpx; font-size: 30rpx;
color:#333; color: #333;
} }
.address-box .address{ .address-box .address {
display: block; display: block;
height: 37.5rpx; height: 37.5rpx;
line-height: 37.5rpx; line-height: 37.5rpx;
font-size: 25rpx; font-size: 25rpx;
color:#666; color: #666;
} }
.address-box .r{ .address-box .r {
width: 77rpx; width: 77rpx;
height: 77rpx; height: 77rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.address-box .r image{ .address-box .r image {
width: 52.078rpx; width: 52.078rpx;
height: 52.078rpx; height: 52.078rpx;
} }
.coupon-box{ .coupon-box {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
} }
.coupon-box .coupon-item{ .coupon-box .coupon-item {
width: 100%; width: 100%;
height: 108.3rpx; height: 108.3rpx;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
display: flex; display: flex;
padding-left: 31.25rpx; padding-left: 31.25rpx;
} }
.coupon-box .l{ .coupon-box .l {
flex: 1; flex: 1;
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
padding-top: 35rpx; padding-top: 35rpx;
} }
.coupon-box .l .name{ .coupon-box .l .name {
float: left; float: left;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.coupon-box .l .txt{ .coupon-box .l .txt {
float: right; float: right;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.coupon-box .r{ .coupon-box .r {
margin-top: 15.5rpx; margin-top: 15.5rpx;
width: 77rpx; width: 77rpx;
height: 77rpx; height: 77rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.coupon-box .r image{ .coupon-box .r image {
width: 52.078rpx; width: 52.078rpx;
height: 52.078rpx; height: 52.078rpx;
} }
.order-box{ .order-box {
margin-top: 20rpx; margin-top: 20rpx;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
} }
.order-box .order-item{ .order-box .order-item {
height: 104.3rpx; height: 104.3rpx;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
display: flex; display: flex;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
padding-top: 26rpx; padding-top: 26rpx;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.order-box .order-item .l{ .order-box .order-item .l {
float: left; float: left;
height: 52rpx; height: 52rpx;
width: 50%; width: 50%;
line-height: 52rpx; line-height: 52rpx;
overflow: hidden; overflow: hidden;
} }
.order-box .order-item .r{ .order-box .order-item .r {
float: right; float: right;
text-align: right; text-align: right;
width: 50%; width: 50%;
height: 52rpx; height: 52rpx;
line-height: 52rpx; line-height: 52rpx;
overflow: hidden; overflow: hidden;
} }
.order-box .order-item.no-border{ .order-box .order-item.no-border {
border-bottom: none; border-bottom: none;
} }
.goods-items{ .goods-items {
margin-top: 20rpx; margin-top: 20rpx;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
padding-left: 31.25rpx; padding-left: 31.25rpx;
margin-bottom: 120rpx; margin-bottom: 120rpx;
} }
.goods-items .item{ .goods-items .item {
height: 192rpx; height: 192rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 1px solid rgba(0,0,0,0.15); border-bottom: 1px solid rgba(0, 0, 0, 0.15);
} }
.goods-items .item.no-border{ .goods-items .item.no-border {
border-bottom: none; border-bottom: none;
} }
.goods-items .item:last-child {
.goods-items .item:last-child{ border-bottom: none;
border-bottom: none;
} }
.goods-items .img{ .goods-items .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background-color: #f4f4f4; background-color: #f4f4f4;
margin-right: 20rpx; margin-right: 20rpx;
} }
.goods-items .img image{ .goods-items .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.goods-items .info{ .goods-items .info {
flex: 1; flex: 1;
height: 145.83rpx; height: 145.83rpx;
padding-top: 5rpx; padding-top: 5rpx;
} }
.goods-items .t{ .goods-items .t {
height: 33rpx; height: 33rpx;
line-height: 33rpx; line-height: 33rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
overflow: hidden; overflow: hidden;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.goods-items .t .name{ .goods-items .t .name {
display: block; display: block;
float: left; float: left;
} }
.goods-items .t .number{ .goods-items .t .number {
display: block; display: block;
float: right; float: right;
text-align: right; text-align: right;
} }
.goods-items .m { .goods-items .m {
height: 29rpx; height: 29rpx;
overflow: hidden; overflow: hidden;
line-height: 29rpx; line-height: 29rpx;
margin-bottom: 25rpx; margin-bottom: 25rpx;
font-size: 25rpx; font-size: 25rpx;
color: #666; color: #666;
} }
.goods-items .b { .goods-items .b {
height: 41rpx; height: 41rpx;
overflow: hidden; overflow: hidden;
line-height: 41rpx; line-height: 41rpx;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order-total{ .order-total {
position: fixed; position: fixed;
left:0; left: 0;
bottom: 0; bottom: 0;
height: 100rpx; height: 100rpx;
width: 100%; width: 100%;
display: flex; display: flex;
} }
.order-total .l{ .order-total .l {
flex: 1; flex: 1;
height: 100rpx; height: 100rpx;
line-height: 100rpx; line-height: 100rpx;
color: #a78845; color: #a78845;
background: #fff; background: #fff;
font-size: 33rpx; font-size: 33rpx;
padding-left: 31.25rpx; padding-left: 31.25rpx;
border-top: 1rpx solid rgba(0,0,0,0.2); border-top: 1rpx solid rgba(0, 0, 0, 0.2);
border-bottom: 1rpx solid rgba(0,0,0,0.2); border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
} }
.order-total .r{ .order-total .r {
width: 233rpx; width: 233rpx;
height: 100rpx; height: 100rpx;
background: #a78845; background: #a78845;
border: 1px solid #a78845; border: 1px solid #a78845;
line-height: 100rpx; line-height: 100rpx;
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 30rpx; font-size: 30rpx;
} }

View File

@@ -2,93 +2,93 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js'); var api = require('../../config/api.js');
var app = getApp() var app = getApp()
Page({ Page({
data: { data: {
topicList: [], topicList: [],
page: 1, page: 1,
size: 10, size: 10,
count: 0, count: 0,
scrollTop: 0, scrollTop: 0,
showPage: false showPage: false
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.getTopic(); 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; var that = this;
if (this.data.page > that.data.count / that.data.size) { if (this.data.page > that.data.count / that.data.size) {
return true; return true;
} }
that.setData({
page: that.data.page + 1
});
this.getTopic();
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getTopic();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getTopic: function() {
let that = this;
that.setData({
scrollTop: 0,
showPage: false,
topicList: []
});
// 页面渲染完成
wx.showToast({
title: '加载中...',
icon: 'loading',
duration: 2000
});
util.request(api.TopicList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({ that.setData({
scrollTop: 0, page: that.data.page + 1
topicList: res.data.data,
showPage: true,
count: res.data.count
}); });
}
wx.hideToast();
});
}, this.getTopic();
prevPage: function(event) {
if (this.data.page <= 1) { },
return false;
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getTopic();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getTopic: function() {
let that = this;
that.setData({
scrollTop: 0,
showPage: false,
topicList: []
});
// 页面渲染完成
wx.showToast({
title: '加载中...',
icon: 'loading',
duration: 2000
});
util.request(api.TopicList, {
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
that.setData({
scrollTop: 0,
topicList: res.data.data,
showPage: true,
count: res.data.count
});
}
wx.hideToast();
});
},
prevPage: function(event) {
if (this.data.page <= 1) {
return false;
}
var that = this;
that.setData({
page: that.data.page - 1
});
this.getTopic();
} }
var that = this;
that.setData({
page: that.data.page - 1
});
this.getTopic();
}
}) })

View File

@@ -1,16 +1,16 @@
<view class="container"> <view class="container">
<scroll-view class="topic-list" scroll-y="true" scroll-top="{{scrollTop}}"> <scroll-view class="topic-list" scroll-y="true" scroll-top="{{scrollTop}}">
<navigator class="item" wx:for="{{topicList}}" wx:key="id" url="../topicDetail/topicDetail?id={{item.id}}"> <navigator class="item" wx:for="{{topicList}}" wx:key="id" url="../topicDetail/topicDetail?id={{item.id}}">
<image class="img" src="{{item.picUrl}}"></image> <image class="img" src="{{item.picUrl}}"></image>
<view class="info"> <view class="info">
<text class="title">{{item.title}}</text> <text class="title">{{item.title}}</text>
<text class="desc">{{item.subtitle}}</text> <text class="desc">{{item.subtitle}}</text>
<!-- <text class="price">{{item.price}}元起</text> --> <!-- <text class="price">{{item.price}}元起</text> -->
</view> </view>
</navigator> </navigator>
<view class="page" wx:if="{{showPage}}"> <view class="page" wx:if="{{showPage}}">
<view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view> <view class="prev {{ page <= 1 ? 'disabled' : ''}}" bindtap="prevPage">上一页</view>
<view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view> <view class="next {{ (count / size) < page ? 'disabled' : ''}}" bindtap="nextPage">下一页</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>

View File

@@ -1,94 +1,94 @@
page ,.container{ page, .container {
width: 750rpx; width: 750rpx;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
background: #f4f4f4; background: #f4f4f4;
}
.topic-list{
width: 750rpx;
height: 100%;
overflow: hidden;
background: #f4f4f4;
} }
.topic-list .item{ .topic-list {
width: 100%; width: 750rpx;
height: 625rpx; height: 100%;
overflow: hidden; overflow: hidden;
background: #fff; background: #f4f4f4;
margin-bottom: 20rpx;
} }
.topic-list .img{ .topic-list .item {
width: 100%; width: 100%;
height: 415rpx; height: 625rpx;
overflow: hidden;
background: #fff;
margin-bottom: 20rpx;
} }
.topic-list .info{ .topic-list .img {
width: 100%; width: 100%;
height: 210rpx; height: 415rpx;
overflow: hidden;
} }
.topic-list .title{ .topic-list .info {
display: block; width: 100%;
text-align: center; height: 210rpx;
width: 100%; overflow: hidden;
height: 33rpx;
line-height: 35rpx;
color: #a78845;
overflow: hidden;
font-size: 35rpx;
margin-top: 30rpx;
} }
.topic-list .desc{ .topic-list .title {
display: block; display: block;
text-align: center; text-align: center;
position: relative; width: 100%;
width: auto; height: 33rpx;
height: 24rpx; line-height: 35rpx;
line-height: 24rpx; color: #a78845;
overflow: hidden; overflow: hidden;
color: #999; font-size: 35rpx;
font-size: 24rpx; margin-top: 30rpx;
margin-top: 16rpx;
margin-bottom: 30rpx;
} }
.topic-list .price{ .topic-list .desc {
display: block; display: block;
text-align: center; text-align: center;
width: 100%; position: relative;
height: 27rpx; width: auto;
line-height: 27rpx; height: 24rpx;
overflow: hidden; line-height: 24rpx;
color: #b4282d; overflow: hidden;
font-size: 27rpx; color: #999;
font-size: 24rpx;
margin-top: 16rpx;
margin-bottom: 30rpx;
} }
.topic-list .price {
.page{ display: block;
width: 750rpx; text-align: center;
height: 108rpx; width: 100%;
background: #fff; height: 27rpx;
margin-bottom: 20rpx; line-height: 27rpx;
overflow: hidden;
color: #b4282d;
font-size: 27rpx;
} }
.page view{ .page {
height: 108rpx; width: 750rpx;
width: 50%; height: 108rpx;
float: left; background: #fff;
font-size: 29rpx; margin-bottom: 20rpx;
color: #333;
text-align: center;
line-height: 108rpx;
} }
.page .prev{ .page view {
border-right: 1px solid #D9D9D9; height: 108rpx;
width: 50%;
float: left;
font-size: 29rpx;
color: #333;
text-align: center;
line-height: 108rpx;
} }
.page .disabled{ .page .prev {
color: #ccc; border-right: 1px solid #d9d9d9;
} }
.page .disabled {
color: #ccc;
}

View File

@@ -1,7 +1,7 @@
<scroll-view class="container"> <scroll-view class="container">
<scroll-view class="content"> <scroll-view class="content">
<import src="../../lib/wxParse/wxParse.wxml"/> <import src="../../lib/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:topicDetail.nodes}}"/> <template is="wxParse" data="{{wxParseData:topicDetail.nodes}}" />
</scroll-view> </scroll-view>
<view class="topic-goods"> <view class="topic-goods">
</view> </view>

View File

@@ -1,190 +1,186 @@
.content {
width: 100%;
height: auto;
.content{ font-size: 0;
width: 100%;
height: auto;
font-size: 0;
} }
.content image{ .content image {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
} }
.comments{ .comments {
width: 100%; width: 100%;
height: auto; height: auto;
padding-left:30rpx; padding-left: 30rpx;
background: #fff; background: #fff;
margin-top: 20rpx; margin-top: 20rpx;
} }
.comments .h{ .comments .h {
height: 93rpx; height: 93rpx;
line-height: 93rpx; line-height: 93rpx;
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.comments .h .t{ .comments .h .t {
display: block; display: block;
float: left; float: left;
width: 50%; width: 50%;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.comments .h .i{ .comments .h .i {
display: block; display: block;
float: right; float: right;
margin-top: 30rpx; margin-top: 30rpx;
width: 33rpx; width: 33rpx;
height: 33rpx; height: 33rpx;
} }
.comments .b{ .comments .b {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
} }
.comments .item{ .comments .item {
height: auto; height: auto;
width: 720rpx; width: 720rpx;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.comments .info{ .comments .info {
height: 127rpx; height: 127rpx;
width: 100%; width: 100%;
padding: 33rpx 0 27rpx 0; padding: 33rpx 0 27rpx 0;
} }
.comments .user{ .comments .user {
float: left; float: left;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
font-size: 0; font-size: 0;
} }
.comments .user .avatar{ .comments .user .avatar {
display: block; display: block;
float: left; float: left;
width: 67rpx; width: 67rpx;
height: 67rpx; height: 67rpx;
margin-right: 17rpx; margin-right: 17rpx;
border-radius: 50%; border-radius: 50%;
} }
.comments .user .nickname{ .comments .user .nickname {
display: block; display: block;
width: auto; width: auto;
float: left; float: left;
height: 66rpx; height: 66rpx;
overflow: hidden; overflow: hidden;
font-size: 29rpx; font-size: 29rpx;
line-height: 66rpx; line-height: 66rpx;
} }
.comments .time{ .comments .time {
display: block; display: block;
float: right; float: right;
width: auto; width: auto;
height: 67rpx; height: 67rpx;
line-height: 67rpx; line-height: 67rpx;
color: #7f7f7f; color: #7f7f7f;
font-size: 25rpx; font-size: 25rpx;
margin-right: 30rpx; margin-right: 30rpx;
} }
.comments .comment{ .comments .comment {
width: 720rpx; width: 720rpx;
padding-right: 30rpx; padding-right: 30rpx;
line-height: 45.8rpx; line-height: 45.8rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
font-size: 29rpx; font-size: 29rpx;
color: #333; color: #333;
} }
.comments .load{ .comments .load {
width: 720rpx; width: 720rpx;
height: 108rpx; height: 108rpx;
line-height: 108rpx; line-height: 108rpx;
text-align: center; text-align: center;
font-size: 38.5rpx; font-size: 38.5rpx;
} }
.no-comments{ .no-comments {
height: 297rpx; height: 297rpx;
} }
.no-comments .txt{ .no-comments .txt {
height: 43rpx; height: 43rpx;
line-height: 43rpx; line-height: 43rpx;
display: block; display: block;
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #7f7f7f; color: #7f7f7f;
} }
.no-comments .icon{ .no-comments .icon {
margin: 48rpx auto 18rpx auto; margin: 48rpx auto 18rpx auto;
height: 130rpx; height: 130rpx;
display: block; display: block;
width: 115rpx; width: 115rpx;
} }
.rec-box {
.rec-box{ width: 690rpx;
width: 690rpx; height: auto;
height: auto; margin: 0 30rpx;
margin: 0 30rpx;
} }
.rec-box .h{ .rec-box .h {
position: relative; position: relative;
width: 690rpx; width: 690rpx;
height: 110rpx; height: 110rpx;
/*border-bottom: 1px solid #d0d0d0;*/ /*border-bottom: 1px solid #d0d0d0;*/
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.rec-box .h .txt{ .rec-box .h .txt {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
background: #f4f4f4; background: #f4f4f4;
top: 59rpx; top: 59rpx;
left: 200rpx; left: 200rpx;
width: 290rpx; width: 290rpx;
height: 45rpx; height: 45rpx;
line-height: 45rpx; line-height: 45rpx;
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
text-align: center; text-align: center;
} }
.rec-box .b .item{ .rec-box .b .item {
width: 690rpx; width: 690rpx;
height: auto; height: auto;
padding: 24rpx 24rpx 30rpx 24rpx; padding: 24rpx 24rpx 30rpx 24rpx;
background: #fff; background: #fff;
margin-bottom: 30rpx; margin-bottom: 30rpx;
} }
.rec-box .b .item .img{ .rec-box .b .item .img {
height: 355rpx; height: 355rpx;
width: 642rpx; width: 642rpx;
} }
.rec-box .b .item .title{ .rec-box .b .item .title {
display: block; display: block;
margin-top: 30rpx; margin-top: 30rpx;
height: 30rpx; height: 30rpx;
width: 642rpx; width: 642rpx;
font-size: 28rpx; font-size: 28rpx;
} }
@import "../../lib/wxParse/wxParse.wxss"; @import "../../lib/wxParse/wxParse.wxss";

View File

@@ -3,95 +3,95 @@ var api = require('../../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
addressList: [], addressList: [],
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
onReady: function() { onReady: function() {
// 页面渲染完成 // 页面渲染完成
}, },
onShow: function() { onShow: function() {
// 页面显示 // 页面显示
this.getAddressList(); this.getAddressList();
}, },
onPullDownRefresh() { onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载 wx.showNavigationBarLoading() //在标题栏中显示加载
this.getAddressList(); this.getAddressList();
wx.hideNavigationBarLoading() //完成停止加载 wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getAddressList() { getAddressList() {
let that = this; 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
});
}
});
},
addressAddOrUpdate(event) {
//返回之前先取出上一页对象并设置addressId
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2];
if (prevPage.route == "pages/shopping/checkout/checkout") {
try {
wx.setStorageSync('addressId', event.currentTarget.dataset.addressId);
} catch (e) {
}
let addressId = event.currentTarget.dataset.addressId;
if (addressId && addressId != 0) {
wx.navigateBack();
} else {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd?id=' + addressId
})
}
} else {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd?id=' + event.currentTarget.dataset.addressId
})
}
},
deleteAddress(event) {
console.log(event.target);
let that = this;
wx.showModal({
title: '',
content: '确定要删除地址?',
success: function(res) {
if (res.confirm) {
let addressId = event.target.dataset.addressId;
util.request(api.AddressDelete, {
id: addressId
}, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.getAddressList(); that.setData({
wx.removeStorage({ addressList: res.data
key: 'addressId', });
success: function(res) {},
})
} }
}); });
console.log('用户点击确定') },
}
}
});
return false;
}, addressAddOrUpdate(event) {
onHide: function() { //返回之前先取出上一页对象并设置addressId
// 页面隐藏 var pages = getCurrentPages();
}, var prevPage = pages[pages.length - 2];
onUnload: function() {
// 页面关闭 if (prevPage.route == "pages/shopping/checkout/checkout") {
} try {
wx.setStorageSync('addressId', event.currentTarget.dataset.addressId);
} catch (e) {
}
let addressId = event.currentTarget.dataset.addressId;
if (addressId && addressId != 0) {
wx.navigateBack();
} else {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd?id=' + addressId
})
}
} else {
wx.navigateTo({
url: '/pages/ucenter/addressAdd/addressAdd?id=' + event.currentTarget.dataset.addressId
})
}
},
deleteAddress(event) {
console.log(event.target);
let that = this;
wx.showModal({
title: '',
content: '确定要删除地址?',
success: function(res) {
if (res.confirm) {
let addressId = event.target.dataset.addressId;
util.request(api.AddressDelete, {
id: addressId
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.getAddressList();
wx.removeStorage({
key: 'addressId',
success: function(res) {},
})
}
});
console.log('用户点击确定')
}
}
});
return false;
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}); });

View File

@@ -1,22 +1,22 @@
<view class="container"> <view class="container">
<view class="address-list" wx:if="{{ addressList.length > 0 }}"> <view class="address-list" wx:if="{{ addressList.length > 0 }}">
<view class="item" wx:for="{{addressList}}" wx:key="id" bindtap="addressAddOrUpdate" data-address-id="{{item.id}}"> <view class="item" wx:for="{{addressList}}" wx:key="id" bindtap="addressAddOrUpdate" data-address-id="{{item.id}}">
<view class="l"> <view class="l">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
<view class="default" wx:if="{{item.isDefault}}">默认</view> <view class="default" wx:if="{{item.isDefault}}">默认</view>
</view> </view>
<view class="c"> <view class="c">
<view class="mobile">{{item.mobile}}</view> <view class="mobile">{{item.mobile}}</view>
<view class="address">{{item.detailedAddress}}</view> <view class="address">{{item.detailedAddress}}</view>
</view> </view>
<view class="r"> <view class="r">
<image catchtap="deleteAddress" data-address-id="{{item.id}}" class="del" src="/static/images/del-address.png"></image> <image catchtap="deleteAddress" data-address-id="{{item.id}}" class="del" src="/static/images/del-address.png"></image>
</view> </view>
</view>
</view> </view>
<view class="empty-view" wx:if="{{ addressList.length <= 0 }}"> </view>
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image> <view class="empty-view" wx:if="{{ addressList.length <= 0 }}">
<text class="text">收货地址在哪里</text> <image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image>
</view> <text class="text">收货地址在哪里</text>
<view class="add-address" bindtap="addressAddOrUpdate" data-address-id="0">新建</view> </view>
</view> <view class="add-address" bindtap="addressAddOrUpdate" data-address-id="0">新建</view>
</view>

View File

@@ -1,109 +1,105 @@
page{ page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.container{ .container {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.address-list{ .address-list {
padding-left: 31.25rpx; 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: #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; background-size: auto 10.5rpx;
margin-bottom: 90rpx; margin-bottom: 90rpx;
} }
.address-list .item{ .address-list .item {
height: 156.55rpx; height: 156.55rpx;
align-items: center; align-items: center;
display: flex; display: flex;
border-bottom: 1rpx solid #DCD9D9; border-bottom: 1rpx solid #dcd9d9;
} }
.address-list .l{ .address-list .l {
width: 125rpx; width: 125rpx;
height: 80rpx; height: 80rpx;
overflow: hidden; overflow: hidden;
} }
.address-list .name{ .address-list .name {
width: 125rpx; width: 125rpx;
height: 43rpx; height: 43rpx;
font-size: 29rpx; font-size: 29rpx;
margin-bottom: 5.2rpx; margin-bottom: 5.2rpx;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
} }
.address-list .default{ .address-list .default {
width: 62.5rpx; width: 62.5rpx;
height: 33rpx; height: 33rpx;
line-height: 28rpx; line-height: 28rpx;
text-align: center; text-align: center;
font-size: 20rpx; font-size: 20rpx;
color: #a78845; color: #a78845;
border: 1rpx solid #a78845; border: 1rpx solid #a78845;
visibility: visible; visibility: visible;
} }
.address-list .c {
.address-list .c{ flex: 1;
flex: 1; height: auto;
height: auto; overflow: hidden;
overflow: hidden;
} }
.address-list .mobile{ .address-list .mobile {
height: 29rpx;
height: 29rpx; font-size: 29rpx;
font-size: 29rpx; line-height: 29rpx;
line-height: 29rpx; overflow: hidden;
overflow: hidden; margin-bottom: 6.25rpx;
margin-bottom: 6.25rpx;
} }
.address-list .address{ .address-list .address {
height: 37rpx; height: 37rpx;
font-size: 25rpx; font-size: 25rpx;
line-height: 37rpx; line-height: 37rpx;
overflow: hidden; overflow: hidden;
} }
.address-list .r{ .address-list .r {
width: 52rpx; width: 52rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
margin-right: 16.5rpx; margin-right: 16.5rpx;
} }
.address-list .del{ .address-list .del {
display: block; display: block;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
} }
.add-address{ .add-address {
background: #a78845; background: #a78845;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 99rpx; height: 99rpx;
line-height: 99rpx; line-height: 99rpx;
position: fixed; position: fixed;
border-radius: 0; border-radius: 0;
border: none; border: none;
color: #fff; color: #fff;
font-size: 29rpx; font-size: 29rpx;
bottom: 0; bottom: 0;
left:0; left: 0;
} }
.empty-view{ .empty-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
@@ -112,15 +108,15 @@ page{
justify-content: center; justify-content: center;
} }
.empty-view .icon{ .empty-view .icon {
height: 248rpx; height: 248rpx;
width: 258rpx; width: 258rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.empty-view .text{ .empty-view .text {
width: auto; width: auto;
font-size: 28rpx; font-size: 28rpx;
line-height: 35rpx; line-height: 35rpx;
color: #999; color: #999;
} }

View File

@@ -20,10 +20,24 @@ Page({
}, },
addressId: 0, addressId: 0,
openSelectRegion: false, openSelectRegion: false,
selectRegionList: [ selectRegionList: [{
{ id: 0, name: '省份', pid: 1, type: 1 }, id: 0,
{ id: 0, name: '城市', pid: 1, type: 2 }, name: '省份',
{ id: 0, name: '区县', pid: 1, type: 3 } pid: 1,
type: 1
},
{
id: 0,
name: '城市',
pid: 1,
type: 2
},
{
id: 0,
name: '区县',
pid: 1,
type: 3
}
], ],
regionType: 1, regionType: 1,
regionList: [], regionList: [],
@@ -59,7 +73,9 @@ Page({
}, },
getAddressDetail() { getAddressDetail() {
let that = this; 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.errno === 0) {
if (res.data) { if (res.data) {
that.setData({ that.setData({
@@ -110,10 +126,24 @@ Page({
this.getRegionList(address.cityId); this.getRegionList(address.cityId);
} else { } else {
this.setData({ this.setData({
selectRegionList: [ selectRegionList: [{
{ id: 0, name: '省份', pid: 0, type: 1 }, id: 0,
{ id: 0, name: '城市', pid: 0, type: 2 }, name: '省份',
{ id: 0, name: '区县', pid: 0, type: 3 } pid: 0,
type: 1
},
{
id: 0,
name: '城市',
pid: 0,
type: 2
},
{
id: 0,
name: '区县',
pid: 0,
type: 3
}
], ],
regionType: 1 regionType: 1
}) })
@@ -123,7 +153,7 @@ Page({
this.setRegionDoneStatus(); this.setRegionDoneStatus();
}, },
onLoad: function (options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
console.log(options) console.log(options)
if (options.id && options.id != 0) { if (options.id && options.id != 0) {
@@ -133,7 +163,7 @@ Page({
this.getAddressDetail(); this.getAddressDetail();
} }
}, },
onReady: function () { onReady: function() {
}, },
selectRegionType(event) { selectRegionType(event) {
@@ -240,7 +270,9 @@ Page({
getRegionList(regionId) { getRegionList(regionId) {
let that = this; let that = this;
let regionType = that.data.regionType; 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) { if (res.errno === 0) {
that.setData({ that.setData({
regionList: res.data.map(item => { regionList: res.data.map(item => {
@@ -302,7 +334,7 @@ Page({
areaId: address.areaId, areaId: address.areaId,
address: address.address, address: address.address,
isDefault: address.isDefault isDefault: address.isDefault
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
//返回之前先取出上一页对象并设置addressId //返回之前先取出上一页对象并设置addressId
var pages = getCurrentPages(); var pages = getCurrentPages();
@@ -325,15 +357,15 @@ Page({
}); });
}, },
onShow: function () { onShow: function() {
// 页面显示 // 页面显示
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }

View File

@@ -1,39 +1,39 @@
<view class="add-address"> <view class="add-address">
<view class="add-form"> <view class="add-form">
<view class="form-item"> <view class="form-item">
<input class="input" bindinput="bindinputName" placeholder="姓名" value="{{address.name}}" auto-focus/> <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="手机号码"/>
</view>
<view class="form-item">
<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="详细地址, 如街道、楼盘号等"/>
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
</view>
</view> </view>
<view class="form-item">
<view class="btns"> <input class="input" bindinput="bindinputMobile" value="{{address.mobile}}" placeholder="手机号码" />
<button class="cannel" bindtap="cancelAddress">取消</button>
<button class="save" bindtap="saveAddress">保存</button>
</view> </view>
<view class="form-item">
<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="详细地址, 如街道、楼盘号等" />
</view>
<view class="form-default">
<text bindtap="bindIsDefault" class="default-input {{address.isDefault == 1 ? 'selected' : ''}}">设为默认地址</text>
</view>
</view>
<view class="region-select" wx:if="{{openSelectRegion}}"> <view class="btns">
<view class="hd"> <button class="cannel" bindtap="cancelAddress">取消</button>
<view class="region-selected"> <button class="save" bindtap="saveAddress">保存</button>
<view class="item {{item.id == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}" bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="id">{{item.name}}</view> </view>
</view>
<view class="done {{selectRegionDone ? '' : 'disabled'}}" bindtap="doneSelectRegion">确定</view> <view class="region-select" wx:if="{{openSelectRegion}}">
<view class="hd">
<view class="region-selected">
<view class="item {{item.id == 0 ? 'disabled' : ''}} {{(regionType -1) === index ? 'selected' : ''}}" bindtap="selectRegionType" data-region-type-index="{{index}}" wx:for="{{selectRegionList}}" wx:key="id">{{item.name}}</view>
</view> </view>
<view class="bd"> <view class="done {{selectRegionDone ? '' : 'disabled'}}" bindtap="doneSelectRegion">确定</view>
</view>
<view class="bd">
<scroll-view scroll-y class="region-list"> <scroll-view scroll-y class="region-list">
<view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}" wx:for="{{regionList}}" wx:key="id">{{item.name}}</view> <view class="item {{item.selected ? 'selected' : ''}}" bindtap="selectRegion" data-region-index="{{index}}" wx:for="{{regionList}}" wx:key="id">{{item.name}}</view>
</scroll-view> </scroll-view>
</view>
</view> </view>
</view>
</view> </view>
<view class="bg-mask" bindtap="cancelSelectRegion" wx:if="{{openSelectRegion}}"></view> <view class="bg-mask" bindtap="cancelSelectRegion" wx:if="{{openSelectRegion}}"></view>

View File

@@ -1,109 +1,109 @@
page{ page {
height: 100%; height: 100%;
background: #f4f4f4; background: #f4f4f4;
}
.add-address .add-form{
background: #fff;
width: 100%;
height: auto;
overflow: hidden;
} }
.add-address .form-item{ .add-address .add-form {
height: 116rpx; background: #fff;
padding-left: 31.25rpx; width: 100%;
border-bottom: 1px solid #d9d9d9; height: auto;
display: flex; overflow: hidden;
align-items: center;
padding-right: 31.25rpx;
} }
.add-address .input{ .add-address .form-item {
flex: 1; height: 116rpx;
height: 44rpx; padding-left: 31.25rpx;
line-height: 44rpx; border-bottom: 1px solid #d9d9d9;
overflow: hidden; display: flex;
align-items: center;
padding-right: 31.25rpx;
} }
.add-address .form-default{ .add-address .input {
border-bottom: 1px solid #d9d9d9; flex: 1;
height: 96rpx; height: 44rpx;
background: #fafafa; line-height: 44rpx;
padding-top: 28rpx; overflow: hidden;
font-size: 28rpx;
} }
.default-input{ .add-address .form-default {
margin: 0 auto; border-bottom: 1px solid #d9d9d9;
display: block; height: 96rpx;
width: 240rpx; background: #fafafa;
height: 40rpx; padding-top: 28rpx;
padding-left: 50rpx; font-size: 28rpx;
line-height: 40rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
background-size: 38rpx 486rpx;
font-size: 28rpx;
} }
.default-input.selected{ .default-input {
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat; margin: 0 auto;
background-size: 38rpx 486rpx; display: block;
width: 240rpx;
height: 40rpx;
padding-left: 50rpx;
line-height: 40rpx;
background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 1rpx -448rpx no-repeat;
background-size: 38rpx 486rpx;
font-size: 28rpx;
} }
.add-address .btns{ .default-input.selected {
position: fixed; background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/sprites/checkbox-sed825af9d3-a6b8540d42.png) 0 -192rpx no-repeat;
bottom: 0; background-size: 38rpx 486rpx;
left: 0;
overflow: hidden;
display: flex;
height: 100rpx;
width: 100%;
} }
.add-address .cannel,.add-address .save{ .add-address .btns {
flex: 1; position: fixed;
height: 100rpx; bottom: 0;
text-align: center; left: 0;
line-height: 100rpx; overflow: hidden;
font-size: 28rpx; display: flex;
color: #fff; height: 100rpx;
border:none; width: 100%;
border-radius: 0;
} }
.add-address .cannel{ .add-address .cannel, .add-address .save {
background: #3F3F3F; flex: 1;
height: 100rpx;
text-align: center;
line-height: 100rpx;
font-size: 28rpx;
color: #fff;
border: none;
border-radius: 0;
} }
.add-address .save{ .add-address .cannel {
background: #a78845; background: #3f3f3f;
} }
.add-address .save {
background: #a78845;
}
.region-select{ .region-select {
width: 100%; width: 100%;
height: 600rpx; height: 600rpx;
background: #fff; background: #fff;
position: fixed; position: fixed;
z-index: 10; z-index: 10;
left:0; left: 0;
bottom: 0; bottom: 0;
} }
.region-select .hd{ .region-select .hd {
height: 108rpx; height: 108rpx;
width: 100%; width: 100%;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding: 46rpx 30rpx 0 30rpx; padding: 46rpx 30rpx 0 30rpx;
} }
.region-select .region-selected{ .region-select .region-selected {
float: left; float: left;
height: 60rpx; height: 60rpx;
display: flex; display: flex;
} }
.region-select .region-selected .item{ .region-select .region-selected .item {
max-width: 140rpx; max-width: 140rpx;
margin-right: 30rpx; margin-right: 30rpx;
text-align: left; text-align: left;
@@ -112,19 +112,19 @@ page{
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.region-select .region-selected .item.disabled{ .region-select .region-selected .item.disabled {
color: #999; color: #999;
} }
.region-select .region-selected .item.selected{ .region-select .region-selected .item.selected {
color: #a78845; color: #a78845;
} }
.region-select .done{ .region-select .done {
float: right; float: right;
height: 60rpx; height: 60rpx;
width: 60rpx; width: 60rpx;
@@ -136,21 +136,21 @@ page{
font-size: 28rpx; font-size: 28rpx;
} }
.region-select .done.disabled{ .region-select .done.disabled {
color: #999; color: #999;
} }
.region-select .bd{ .region-select .bd {
height: 492rpx; height: 492rpx;
width: 100%; width: 100%;
padding: 0 30rpx; padding: 0 30rpx;
} }
.region-select .region-list{ .region-select .region-list {
height: 492rpx; height: 492rpx;
} }
.region-select .region-list .item{ .region-select .region-list .item {
width: 100%; width: 100%;
height: 104rpx; height: 104rpx;
line-height: 104rpx; line-height: 104rpx;
@@ -159,17 +159,16 @@ page{
font-size: 28rpx; font-size: 28rpx;
} }
.region-select .region-list .item.selected{ .region-select .region-list .item.selected {
color: #b4282d; color: #b4282d;
} }
.bg-mask {
.bg-mask{
height: 100%; height: 100%;
width: 100%; width: 100%;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.4);
position: fixed; position: fixed;
top:0; top: 0;
left:0; left: 0;
z-index: 8; z-index: 8;
} }

View File

@@ -6,7 +6,7 @@
</view> </view>
</view> </view>
<view class="collect-list" wx:else> <view class="collect-list" wx:else>
<view class="item" bindtap="openGoods" bindtouchstart="touchStart" bindtouchend="touchEnd" wx:for="{{collectList}}" wx:key="id" data-index="{{index}}"> <view class="item" bindtap="openGoods" bindtouchstart="touchStart" bindtouchend="touchEnd" wx:for="{{collectList}}" wx:key="id" data-index="{{index}}">
<image class="img" src="{{item.picUrl}}"></image> <image class="img" src="{{item.picUrl}}"></image>
<view class="info"> <view class="info">
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
@@ -16,4 +16,4 @@
</view> </view>
</view> </view>
</view> </view>

View File

@@ -1,49 +1,48 @@
page{ page {
background: #f4f4f4; background: #f4f4f4;
min-height: 100%; min-height: 100%;
} }
.container{ .container {
background: #f4f4f4; background: #f4f4f4;
min-height: 100%; min-height: 100%;
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.no-collect {
.no-collect{ width: 100%;
width: 100%; height: auto;
height: auto; margin: 0 auto;
margin: 0 auto;
} }
.no-collect .c{ .no-collect .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
} }
.no-collect .c image{ .no-collect .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
} }
.no-collect .c text{ .no-collect .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #999; color: #999;
} }
.collect-list{ .collect-list {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
@@ -52,7 +51,7 @@ page{
border-top: 1px solid #e1e1e1; border-top: 1px solid #e1e1e1;
} }
.item{ .item {
height: 212rpx; height: 212rpx;
width: 720rpx; width: 720rpx;
background: #fff; background: #fff;
@@ -60,17 +59,17 @@ page{
border-bottom: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1;
} }
.item:last-child{ .item:last-child {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
} }
.item .img{ .item .img {
float: left; float: left;
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;
} }
.item .info{ .item .info {
float: right; float: right;
width: 540rpx; width: 540rpx;
height: 150rpx; height: 150rpx;
@@ -80,21 +79,20 @@ page{
padding-left: 20rpx; padding-left: 20rpx;
} }
.item .info .name{ .item .info .name {
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;
line-height: 40rpx; line-height: 40rpx;
} }
.item .info .subtitle {
.item .info .subtitle{
margin-top: 8rpx; margin-top: 8rpx;
font-size: 24rpx; font-size: 24rpx;
color: #888; color: #888;
line-height: 40rpx; line-height: 40rpx;
} }
.item .info .price{ .item .info .price {
margin-top: 8rpx; margin-top: 8rpx;
font-size: 28rpx; font-size: 28rpx;
color: #333; color: #333;

View File

@@ -1,27 +1,24 @@
var util = require('../../../utils/util.js'); var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
}, },
onLoad: function (options) { onLoad: function(options) {},
}, onReady: function() {
onReady: function () {
}, },
onShow: function () { onShow: function() {
}, },
onHide: function () { onHide: function() {
// 页面隐藏 // 页面隐藏
}, },
onUnload: function () { onUnload: function() {
// 页面关闭 // 页面关闭
} }
}) })

View File

@@ -25,7 +25,7 @@
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="tag">新人专享</view> <view class="tag">新人专享</view>
<view class="content"> <view class="content">
<view class="left"> <view class="left">

View File

@@ -1,15 +1,15 @@
page{ page {
background: #f4f4f4; background: #f4f4f4;
min-height: 100%; min-height: 100%;
} }
.container{ .container {
background: #f4f4f4; background: #f4f4f4;
min-height: 100%; min-height: 100%;
padding-top: 30rpx; padding-top: 30rpx;
} }
.coupon-form{ .coupon-form {
height: 110rpx; height: 110rpx;
width: 100%; width: 100%;
background: #fff; background: #fff;
@@ -19,7 +19,7 @@ page{
display: flex; display: flex;
} }
.input-box{ .input-box {
flex: 1; flex: 1;
height: 70rpx; height: 70rpx;
color: #333; color: #333;
@@ -31,7 +31,7 @@ page{
margin-right: 30rpx; margin-right: 30rpx;
} }
.input-box .coupon-sn{ .input-box .coupon-sn {
position: absolute; position: absolute;
top: 10rpx; top: 10rpx;
left: 30rpx; left: 30rpx;
@@ -42,7 +42,7 @@ page{
font-size: 24rpx; font-size: 24rpx;
} }
.clear-icon{ .clear-icon {
position: absolute; position: absolute;
top: 21rpx; top: 21rpx;
right: 30rpx; right: 30rpx;
@@ -50,9 +50,9 @@ page{
height: 28rpx; height: 28rpx;
} }
.add-btn{ .add-btn {
height: 70rpx; height: 70rpx;
border:none; border: none;
width: 168rpx; width: 168rpx;
background: #b4282d; background: #b4282d;
border-radius: 0; border-radius: 0;
@@ -61,11 +61,11 @@ page{
font-size: 28rpx; font-size: 28rpx;
} }
.add-btn.disabled{ .add-btn.disabled {
background: #ccc; background: #ccc;
} }
.help{ .help {
height: 72rpx; height: 72rpx;
line-height: 72rpx; line-height: 72rpx;
text-align: right; text-align: right;
@@ -76,7 +76,7 @@ page{
font-size: 24rpx; font-size: 24rpx;
} }
.coupon-list{ .coupon-list {
width: 100%; width: 100%;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
@@ -84,18 +84,18 @@ page{
padding-right: 30rpx; padding-right: 30rpx;
} }
.item{ .item {
position: relative; position: relative;
height: 290rpx; height: 290rpx;
width: 100%; width: 100%;
background: linear-gradient(to right,#cfa568,#e3bf79); background: linear-gradient(to right, #cfa568, #e3bf79);
margin-bottom: 30rpx; margin-bottom: 30rpx;
padding-top: 52rpx; padding-top: 52rpx;
} }
.tag{ .tag {
height: 32rpx; height: 32rpx;
background: #A48143; background: #a48143;
padding-left: 16rpx; padding-left: 16rpx;
padding-right: 16rpx; padding-right: 16rpx;
position: absolute; position: absolute;
@@ -107,8 +107,7 @@ page{
line-height: 32rpx; line-height: 32rpx;
} }
.content {
.content{
margin-top: 24rpx; margin-top: 24rpx;
margin-left: 40rpx; margin-left: 40rpx;
display: flex; display: flex;
@@ -117,50 +116,50 @@ page{
align-items: center; align-items: center;
} }
.content .left{ .content .left {
flex: 1; flex: 1;
} }
.name{ .name {
font-size: 44rpx; font-size: 44rpx;
color: #fff; color: #fff;
margin-bottom: 14rpx; margin-bottom: 14rpx;
} }
.time{ .time {
font-size: 24rpx; font-size: 24rpx;
color: rgba(255,255,255, 0.8); color: rgba(255, 255, 255, 0.8);
line-height: 30rpx; line-height: 30rpx;
} }
.content .right{ .content .right {
width: 162rpx; width: 162rpx;
} }
.go{ .go {
height: 48rpx; height: 48rpx;
border:none; border: none;
width: 162rpx; width: 162rpx;
background: rgba(255,255,255, 0.8); background: rgba(255, 255, 255, 0.8);
border-radius: 4rpx; border-radius: 4rpx;
line-height: 48rpx; line-height: 48rpx;
color: #b69150; color: #b69150;
font-size: 24rpx; font-size: 24rpx;
} }
.condition{ .condition {
position: absolute; position: absolute;
width: 100%; width: 100%;
bottom: 0; bottom: 0;
left:0; left: 0;
height: 78rpx; height: 78rpx;
background: rgba(0,0,0,.08); background: rgba(0, 0, 0, 0.08);
padding: 24rpx 40rpx; padding: 24rpx 40rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.condition .txt{ .condition .txt {
display: block; display: block;
height: 30rpx; height: 30rpx;
flex: 1; flex: 1;
@@ -170,9 +169,8 @@ page{
color: #fff; color: #fff;
} }
.condition .icon {
.condition .icon{
margin-left: 30rpx; margin-left: 30rpx;
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
} }

View File

@@ -4,127 +4,127 @@ var user = require('../../../utils/user.js');
var app = getApp(); var app = getApp();
Page({ Page({
data: { data: {
aboutShow: true,
userInfo: {
nickName: '点击登录',
avatarUrl: 'http://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png'
}
},
onLoad: function(options) {
},
onReady: function() {
},
onShow: function() {
//获取用户的登录信息
if (app.globalData.hasLogin) {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
aboutShow: true, aboutShow: true,
userInfo: userInfo, userInfo: {
}); nickName: '点击登录',
} avatarUrl: 'http://yanxuan.nosdn.127.net/8945ae63d940cc42406c3f67019c5cb6.png'
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
goLogin() {
if (!app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
goOrder() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/order/order"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
goCoupon() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/coupon/coupon"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goGroupon() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/groupon/myGroupon/myGroupon"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goCollect() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/collect/collect"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goFootprint() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/footprint/footprint"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goAddress() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/address/address"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
exitLogin: function() {
wx.showModal({
title: '',
confirmColor: '#b4282d',
content: '退出登录?',
success: function(res) {
if (res.confirm) {
wx.removeStorageSync('token');
wx.removeStorageSync('userInfo');
wx.switchTab({
url: '/pages/index/index'
});
} }
} },
}) onLoad: function(options) {
} },
onReady: function() {
},
onShow: function() {
//获取用户的登录信息
if (app.globalData.hasLogin) {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
aboutShow: true,
userInfo: userInfo,
});
}
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
goLogin() {
if (!app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
goOrder() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/order/order"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
goCoupon() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/coupon/coupon"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goGroupon() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/groupon/myGroupon/myGroupon"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goCollect() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/collect/collect"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goFootprint() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/footprint/footprint"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
goAddress() {
if (app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/ucenter/address/address"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
};
},
exitLogin: function() {
wx.showModal({
title: '',
confirmColor: '#b4282d',
content: '退出登录?',
success: function(res) {
if (res.confirm) {
wx.removeStorageSync('token');
wx.removeStorageSync('userInfo');
wx.switchTab({
url: '/pages/index/index'
});
}
}
})
}
}) })

View File

@@ -1,42 +1,42 @@
<view class="container"> <view class="container">
<view class="my-info"> <view class="my-info">
<view class="profile-info" bindtap="goLogin"> <view class="profile-info" bindtap="goLogin">
<image class="avatar" src="{{userInfo.avatarUrl}}" /> <image class="avatar" src="{{userInfo.avatarUrl}}" />
<view class="my-info-name">{{userInfo.nickName}} <view class="my-info-name">{{userInfo.nickName}}
<text></text> <text></text>
</view> </view>
</view>
<view class="my-info-order">
<view class="list-icon" bindtap="goOrder" data-index="0">
<view class="{{tabClass[0]}}"></view>
<image src="../../../images/my-icon-1.png" />
<text>我的订单</text>
</view>
<view class="list-icon" bindtap="goGroupon" data-index="1">
<view class="{{tabClass[1]}}"></view>
<image src="../../../images/my-icon-2.png" />
<text>我的团购</text>
</view>
<view class="list-icon" bindtap="goCollect" data-index="2">
<view class="{{tabClass[2]}}"></view>
<image src="../../../images/my-icon-3.png" />
<text>我的收藏</text>
</view>
<view class="list-icon" bindtap="goAddress" data-index="3">
<view class="{{tabClass[3]}}"></view>
<image src="../../../images/my-icon-4.png" />
<text>收货地址</text>
</view>
</view>
</view> </view>
<view class="my-info-order"> <view class="my-item-list">
<view class="list-icon" bindtap="goOrder" data-index="0"> <view class="my-item">
<view class="{{tabClass[0]}}"></view> <navigator url="/pages/select-address/index" hover-class="none">快递费说明</navigator>
<image src="../../../images/my-icon-1.png" /> <image src="../../../images/right-icon.png" />
<text>我的订单</text> </view>
</view> <view class="my-item">
<view class="list-icon" bindtap="goGroupon" data-index="1"> <navigator url="/pages/select-address/index" hover-class="none">团购说明</navigator>
<view class="{{tabClass[1]}}"></view> <image src="../../../images/right-icon.png" />
<image src="../../../images/my-icon-2.png" /> </view>
<text>我的团购</text>
</view>
<view class="list-icon" bindtap="goCollect" data-index="2">
<view class="{{tabClass[2]}}"></view>
<image src="../../../images/my-icon-3.png" />
<text>我的收藏</text>
</view>
<view class="list-icon" bindtap="goAddress" data-index="3">
<view class="{{tabClass[3]}}"></view>
<image src="../../../images/my-icon-4.png" />
<text>收货地址</text>
</view>
</view> </view>
</view>
<view class="my-item-list">
<view class="my-item">
<navigator url="/pages/select-address/index" hover-class="none">快递费说明</navigator>
<image src="../../../images/right-icon.png" />
</view>
<view class="my-item">
<navigator url="/pages/select-address/index" hover-class="none">团购说明</navigator>
<image src="../../../images/right-icon.png" />
</view>
</view>
</view> </view>

View File

@@ -1,151 +1,171 @@
.my-info{ .my-info {
width:100%; width: 100%;
text-align:center; text-align: center;
border-bottom:20rpx solid #f5f5f5; border-bottom: 20rpx solid #f5f5f5;
padding-bottom:30rpx; padding-bottom: 30rpx;
} }
.my-info .avatar{
width:176rpx; .my-info .avatar {
height:176rpx; width: 176rpx;
border-radius:50%; height: 176rpx;
border-radius: 50%;
} }
.my-info .my-info-name{
color:#293539; .my-info .my-info-name {
font-size:76rrpx; color: #293539;
margin-top:10rpx; font-size: 76rrpx;
margin-top: 10rpx;
position: relative; position: relative;
} }
.my-info .my-info-name text{
width:10rpx; .my-info .my-info-name text {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:4rpx solid #a78845; position: absolute;
border-radius:50%; border: 4rpx solid #a78845;
margin-left:10rpx; border-radius: 50%;
margin-left: 10rpx;
} }
.my-info-order{
width:95%; .my-info-order {
text-align:center; width: 95%;
margin:0 auto; text-align: center;
margin-top:60rpx; margin: 0 auto;
margin-top: 60rpx;
} }
.my-info-order .list-icon{
.my-info-order .list-icon {
display: inline-block; display: inline-block;
width: 25%; width: 25%;
position: relative; position: relative;
} }
.my-info-order .list-icon .red-dot{
width:18rpx; .my-info-order .list-icon .red-dot {
height:18rpx; width: 18rpx;
border-radius:50%; height: 18rpx;
position:absolute; border-radius: 50%;
right:30rpx; position: absolute;
right: 30rpx;
background-color: #ff3f3e; background-color: #ff3f3e;
} }
.my-info-order .list-icon text{
display:block; .my-info-order .list-icon text {
font-size:22rpx; display: block;
color:#293539; font-size: 22rpx;
color: #293539;
} }
.my-info-order .list-icon image{
width:56rpx; .my-info-order .list-icon image {
height:56rpx; width: 56rpx;
height: 56rpx;
} }
.my-item-list .my-item{
width:100%; .my-item-list .my-item {
height:120rpx; width: 100%;
border-bottom:2rpx dashed #f5f5f5; height: 120rpx;
line-height:120rpx; border-bottom: 2rpx dashed #f5f5f5;
font-size:32rpx; line-height: 120rpx;
color:#293539; font-size: 32rpx;
position:relative; color: #293539;
font-weight:300; position: relative;
font-weight: 300;
} }
.my-item-list .my-item text{
width:10rpx; .my-item-list .my-item text {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:2rpx solid #a78845; position: absolute;
border-radius:50%; border: 2rpx solid #a78845;
left:30rpx; border-radius: 50%;
bottom:50rpx; left: 30rpx;
bottom: 50rpx;
} }
.my-item-list .my-item navigator{
display:inline-block; .my-item-list .my-item navigator {
margin-left:70rpx; display: inline-block;
width:90%; margin-left: 70rpx;
width: 90%;
} }
.my-item-list .my-item .about{
display:inline-block; .my-item-list .my-item .about {
margin-left:70rpx; display: inline-block;
width:90%; margin-left: 70rpx;
width: 90%;
} }
.my-item-list .my-item image{
width:40rpx; .my-item-list .my-item image {
height:40rpx; width: 40rpx;
float:right; height: 40rpx;
margin-top:40rpx; float: right;
margin-right:30rpx; margin-top: 40rpx;
position:absolute; margin-right: 30rpx;
right:0; position: absolute;
right: 0;
} }
.show-pop{
.show-pop {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
background-color: rgba(255,255,255,.8); background-color: rgba(255, 255, 255, 0.8);
} }
.show-pop .show-pop-box{
width:55%; .show-pop .show-pop-box {
margin:0 auto; width: 55%;
margin-top:30%; margin: 0 auto;
background-color:#fff; margin-top: 30%;
border-radius:10rpx; background-color: #fff;
text-align:center; border-radius: 10rpx;
position:relative; text-align: center;
padding-bottom:40rpx; position: relative;
padding-top:60rpx; padding-bottom: 40rpx;
padding-left:30rpx; padding-top: 60rpx;
padding-right:30rpx; padding-left: 30rpx;
padding-right: 30rpx;
box-shadow: 0rpx 4rpx 30rpx #eee; box-shadow: 0rpx 4rpx 30rpx #eee;
} }
.show-pop-box .close{
width:70rpx; .show-pop-box .close {
height:70rpx; width: 70rpx;
height: 70rpx;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
} }
.show-pop .show-pop-box .show-pop-title{
color:#a78845; .show-pop .show-pop-box .show-pop-title {
font-size:36rpx; color: #a78845;
font-weight:300; font-size: 36rpx;
font-weight: 300;
position: relative; position: relative;
} }
.show-pop .show-pop-box .show-pop-title .r{
width:10rpx; .show-pop .show-pop-box .show-pop-title .r {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:1px solid #a78845; position: absolute;
border-radius:50%; border: 1px solid #a78845;
margin-left:20rpx; border-radius: 50%;
margin-top:20rpx; margin-left: 20rpx;
margin-top: 20rpx;
} }
.show-pop .show-pop-box .show-pop-title .l{
width:10rpx; .show-pop .show-pop-box .show-pop-title .l {
height:10rpx; width: 10rpx;
position:absolute; height: 10rpx;
border:2rpx solid #a78845; position: absolute;
border-radius:50%; border: 2rpx solid #a78845;
margin-left:-30rpx; border-radius: 50%;
margin-top:20rpx; margin-left: -30rpx;
margin-top: 20rpx;
}
.show-pop .show-pop-box .show-pop-text {
margin-top: 20rpx;
color: #293539;
font-size: 30rpx;
line-height: 56rpx;
font-weight: 300;
} }
.show-pop .show-pop-box .show-pop-text{
margin-top:20rpx;
color:#293539;
font-size:30rpx;
line-height:56rpx;
font-weight:300;
}

View File

@@ -2,60 +2,60 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
Page({ Page({
data: { data: {
orderList: [], orderList: [],
showType: 0 showType: 0
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
}, },
onPullDownRefresh() { onPullDownRefresh() {
// wx.showNavigationBarLoading() //在标题栏中显示加载 // wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderList(); this.getOrderList();
// wx.hideNavigationBarLoading() //完成停止加载 // wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
getOrderList() { getOrderList() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
let that = this;
util.request(api.OrderList, {
showType: that.data.showType
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderList: res.data.data
}); });
wx.hideLoading();
} setTimeout(function() {
}); wx.hideLoading()
}, }, 2000);
switchTab: function(event) {
let showType = event.currentTarget.dataset.index; let that = this;
this.setData({ util.request(api.OrderList, {
showType: showType showType: that.data.showType
}); }).then(function(res) {
this.getOrderList(); if (res.errno === 0) {
}, that.setData({
onReady: function() { orderList: res.data.data
// 页面渲染完成 });
}, wx.hideLoading();
onShow: function() { }
// 页面显示 });
this.getOrderList(); },
}, switchTab: function(event) {
onHide: function() { let showType = event.currentTarget.dataset.index;
// 页面隐藏 this.setData({
}, showType: showType
onUnload: function() { });
// 页面关闭 this.getOrderList();
} },
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}) })

View File

@@ -1,6 +1,6 @@
{ {
"navigationBarTitleText": "我的订单", "navigationBarTitleText": "我的订单",
"usingComponents": { "usingComponents": {
"zan-capsule": "/components/capsule/index" "zan-capsule": "/components/capsule/index"
} }
} }

View File

@@ -1,50 +1,50 @@
<view class="container"> <view class="container">
<view class="orders-switch"> <view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'> <view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">全部</view> <view class="txt">全部</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">待付款</view>
</view>
<view class="item {{ showType == 2 ? 'active' : ''}}" bindtap="switchTab" data-index='2'>
<view class="txt">待发货</view>
</view>
<view class="item {{ showType == 3 ? 'active' : ''}}" bindtap="switchTab" data-index='3'>
<view class="txt">待收货</view>
</view>
<view class="item {{ showType == 4 ? 'active' : ''}}" bindtap="switchTab" data-index='4'>
<view class="txt">待评价</view>
</view>
</view> </view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'> <view class="no-order" wx:if="{{orderList.length <= 0}}">
<view class="txt">待付款</view> <view class="c">
<image src="http://nos.netease.com/mailpub/hxm/yanxuan-wap/p/20150730/style/img/icon-normal/noCart-a8fe3f12e5.png" />
<text>还没有任何订单呢</text>
</view>
</view> </view>
<view class="item {{ showType == 2 ? 'active' : ''}}" bindtap="switchTab" data-index='2'>
<view class="txt">待发货</view>
</view>
<view class="item {{ showType == 3 ? 'active' : ''}}" bindtap="switchTab" data-index='3'>
<view class="txt">待收货</view>
</view>
<view class="item {{ showType == 4 ? 'active' : ''}}" bindtap="switchTab" data-index='4'>
<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"> <view class="orders">
<navigator url="../orderDetail/orderDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id"> <navigator url="../orderDetail/orderDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h"> <view class="h">
<view class="l">订单编号:{{item.orderSn}}</view> <view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view> <view class="r">{{item.orderStatusText}}</view>
</view> </view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem"> <view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img"> <view class="img">
<image src="{{gitem.picUrl}}"></image> <image src="{{gitem.picUrl}}"></image>
</view> </view>
<view class="info"> <view class="info">
<text class="name">{{gitem.goodsName}}</text> <text class="name">{{gitem.goodsName}}</text>
<text class="number">共{{gitem.number}}件商品</text> <text class="number">共{{gitem.number}}件商品</text>
</view> </view>
<view class="status"></view> <view class="status"></view>
</view> </view>
<view class="b"> <view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view> <view class="l">实付:¥{{item.actualPrice}}</view>
<view class="capsule-tag"> <view class="capsule-tag">
<zan-capsule color="#a78845" leftText="" rightText="团购" wx:if="{{item.isGroupin}}" /> <zan-capsule color="#a78845" leftText="" rightText="团购" wx:if="{{item.isGroupin}}" />
</view> </view>
</view> </view>
</navigator> </navigator>
</view> </view>
</view> </view>

View File

@@ -1,183 +1,183 @@
page { page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.capsule-tag { .capsule-tag {
float: right; float: right;
/* padding-right: 10rpx; */ /* padding-right: 10rpx; */
} }
.zan-capsule + .zan-capsule { .zan-capsule + .zan-capsule {
margin-left: 5px; margin-left: 5px;
} }
.orders-switch { .orders-switch {
width: 100%; width: 100%;
background: #fff; background: #fff;
height: 84rpx; height: 84rpx;
border-bottom: 1px solid #a78845; border-bottom: 1px solid #a78845;
} }
.orders-switch .item { .orders-switch .item {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
width: 18%; width: 18%;
padding: 0 15rpx; padding: 0 15rpx;
text-align: center; text-align: center;
} }
.orders-switch .item .txt { .orders-switch .item .txt {
display: inline-block; display: inline-block;
height: 82rpx; height: 82rpx;
padding: 0 20rpx; padding: 0 20rpx;
line-height: 82rpx; line-height: 82rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
width: 170rpx; width: 170rpx;
} }
.orders-switch .item.active .txt { .orders-switch .item.active .txt {
color: #a78845; color: #a78845;
border-bottom: 4rpx solid #a78845; border-bottom: 4rpx solid #a78845;
} }
.no-order { .no-order {
width: 100%; width: 100%;
height: auto; height: auto;
margin: 0 auto; margin: 0 auto;
} }
.no-order .c { .no-order .c {
width: 100%; width: 100%;
height: auto; height: auto;
margin-top: 200rpx; margin-top: 200rpx;
} }
.no-order .c image { .no-order .c image {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
text-align: center; text-align: center;
width: 258rpx; width: 258rpx;
height: 258rpx; height: 258rpx;
} }
.no-order .c text { .no-order .c text {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
width: 258rpx; width: 258rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
text-align: center; text-align: center;
font-size: 29rpx; font-size: 29rpx;
color: #999; color: #999;
} }
.orders { .orders {
height: auto; height: auto;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.order { .order {
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
} }
.order .h { .order .h {
height: 83.3rpx; height: 83.3rpx;
line-height: 83.3rpx; line-height: 83.3rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order .h .l { .order .h .l {
float: left; float: left;
} }
.order .h .r { .order .h .r {
float: right; float: right;
color: #a78845; color: #a78845;
font-size: 24rpx; font-size: 24rpx;
} }
.order .goods { .order .goods {
display: flex; display: flex;
align-items: center; align-items: center;
height: 199rpx; height: 199rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
} }
.order .goods .img { .order .goods .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.order .goods .img image { .order .goods .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.order .goods .info { .order .goods .info {
height: 145.83rpx; height: 145.83rpx;
flex: 1; flex: 1;
padding-left: 20rpx; padding-left: 20rpx;
} }
.order .goods .name { .order .goods .name {
margin-top: 30rpx; margin-top: 30rpx;
display: block; display: block;
height: 44rpx; height: 44rpx;
line-height: 44rpx; line-height: 44rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order .goods .number { .order .goods .number {
display: block; display: block;
height: 37rpx; height: 37rpx;
line-height: 37rpx; line-height: 37rpx;
color: #666; color: #666;
font-size: 25rpx; font-size: 25rpx;
} }
.order .goods .status { .order .goods .status {
width: 105rpx; width: 105rpx;
color: #a78845; color: #a78845;
font-size: 25rpx; font-size: 25rpx;
} }
.order .b { .order .b {
height: 103rpx; height: 103rpx;
line-height: 103rpx; line-height: 103rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order .b .l { .order .b .l {
float: left; float: left;
} }
.order .b .r { .order .b .r {
float: right; float: right;
} }
.order .b .btn { .order .b .btn {
margin-top: 19rpx; margin-top: 19rpx;
height: 64.5rpx; height: 64.5rpx;
line-height: 64.5rpx; line-height: 64.5rpx;
text-align: center; text-align: center;
padding: 0 20rpx; padding: 0 20rpx;
border-radius: 5rpx; border-radius: 5rpx;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
background: #a78845; background: #a78845;
} }

View File

@@ -2,207 +2,207 @@ var util = require('../../../utils/util.js');
var api = require('../../../config/api.js'); var api = require('../../../config/api.js');
Page({ Page({
data: { data: {
orderId: 0, orderId: 0,
orderInfo: {}, orderInfo: {},
orderGoods: [], orderGoods: [],
expressInfo: {}, expressInfo: {},
flag: false, flag: false,
handleOption: {} handleOption: {}
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.setData({ this.setData({
orderId: options.id orderId: options.id
}); });
this.getOrderDetail(); this.getOrderDetail();
}, },
onPullDownRefresh() { onPullDownRefresh() {
// wx.showNavigationBarLoading() //在标题栏中显示加载 // wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderDetail(); this.getOrderDetail();
// wx.hideNavigationBarLoading() //完成停止加载 // wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
expandDetail: function() { expandDetail: function() {
let that = this; let that = this;
this.setData({ this.setData({
flag: !that.data.flag flag: !that.data.flag
}) })
}, },
getOrderDetail: function() { getOrderDetail: function() {
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
});
setTimeout(function() {
wx.hideLoading()
}, 2000);
let that = this;
util.request(api.OrderDetail, {
orderId: that.data.orderId
}).then(function(res) {
if (res.errno === 0) {
console.log(res.data);
that.setData({
orderInfo: res.data.orderInfo,
orderGoods: res.data.orderGoods,
handleOption: res.data.orderInfo.handleOption,
expressInfo: res.data.expressInfo
}); });
wx.hideLoading(); setTimeout(function() {
} wx.hideLoading()
}); }, 2000);
},
// “去付款”按钮点击效果 let that = this;
payOrder: function() { util.request(api.OrderDetail, {
let that = this; orderId: that.data.orderId
util.request(api.OrderPrepay, { }).then(function(res) {
orderId: that.data.orderId if (res.errno === 0) {
}, 'POST').then(function(res) { console.log(res.data);
if (res.errno === 0) { that.setData({
const payParam = res.data; orderInfo: res.data.orderInfo,
console.log("支付过程开始"); orderGoods: res.data.orderGoods,
wx.requestPayment({ handleOption: res.data.orderInfo.handleOption,
'timeStamp': payParam.timeStamp, expressInfo: res.data.expressInfo
'nonceStr': payParam.nonceStr, });
'package': payParam.packageValue,
'signType': payParam.signType, wx.hideLoading();
'paySign': payParam.paySign, }
'success': function(res) {
console.log("支付过程成功");
util.redirect('/pages/ucenter/order/order');
},
'fail': function(res) {
console.log("支付过程失败");
util.showErrorToast('支付失败');
},
'complete': function(res) {
console.log("支付过程结束")
}
}); });
} },
}); // “去付款”按钮点击效果
payOrder: function() {
}, let that = this;
// “取消订单”点击效果 util.request(api.OrderPrepay, {
cancelOrder: function() { orderId: that.data.orderId
let that = this; }, 'POST').then(function(res) {
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要取消此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderCancel, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
wx.showToast({ const payParam = res.data;
title: '取消订单成功' console.log("支付过程开始");
}); wx.requestPayment({
util.redirect('/pages/ucenter/order/order'); 'timeStamp': payParam.timeStamp,
} else { 'nonceStr': payParam.nonceStr,
util.showErrorToast(res.errmsg); 'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
util.redirect('/pages/ucenter/order/order');
},
'fail': function(res) {
console.log("支付过程失败");
util.showErrorToast('支付失败');
},
'complete': function(res) {
console.log("支付过程结束")
}
});
} }
}); });
}
}
});
},
// “取消订单并退款”点击效果
refundOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({ },
title: '', // “取消订单”点击效果
content: '确定要取消此订单?', cancelOrder: function() {
success: function(res) { let that = this;
if (res.confirm) { let orderInfo = that.data.orderInfo;
util.request(api.OrderRefund, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “删除”点击效果
deleteOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({ wx.showModal({
title: '', title: '',
content: '确定要删除此订单?', content: '确定要取消此订单?',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
util.request(api.OrderDelete, { util.request(api.OrderCancel, {
orderId: orderInfo.id orderId: orderInfo.id
}, 'POST').then(function(res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
wx.showToast({ wx.showToast({
title: '删除订单成功' title: '取消订单成功'
}); });
util.redirect('/pages/ucenter/order/order'); util.redirect('/pages/ucenter/order/order');
} else { } else {
util.showErrorToast(res.errmsg); util.showErrorToast(res.errmsg);
}
});
}
} }
}); });
} },
} // “取消订单并退款”点击效果
}); refundOrder: function() {
}, let that = this;
// “确认收货”点击效果 let orderInfo = that.data.orderInfo;
confirmOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({ wx.showModal({
title: '', title: '',
content: '确认收货', content: '确定要取消此订单',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
util.request(api.OrderConfirm, { util.request(api.OrderRefund, {
orderId: orderInfo.id orderId: orderInfo.id
}, 'POST').then(function(res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
wx.showToast({ wx.showToast({
title: '确认收货成功' title: '取消订单成功'
}); });
util.redirect('/pages/ucenter/order/order'); util.redirect('/pages/ucenter/order/order');
} else { } else {
util.showErrorToast(res.errmsg); util.showErrorToast(res.errmsg);
}
});
}
} }
}); });
} },
} // “删除”点击效果
}); deleteOrder: function() {
}, let that = this;
onReady: function() { let orderInfo = that.data.orderInfo;
// 页面渲染完成
}, wx.showModal({
onShow: function() { title: '',
// 页面显示 content: '确定要删除此订单?',
}, success: function(res) {
onHide: function() { if (res.confirm) {
// 页面隐藏 util.request(api.OrderDelete, {
}, orderId: orderInfo.id
onUnload: function() { }, 'POST').then(function(res) {
// 页面关闭 if (res.errno === 0) {
} wx.showToast({
title: '删除订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “确认收货”点击效果
confirmOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确认收货?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderConfirm, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '确认收货成功!'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
}); });

View File

@@ -1,87 +1,87 @@
<view class="container"> <view class="container">
<view class="order-info"> <view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view> <view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view> <view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c"> <view class="item-c">
<view class="l">实付: <view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text> <text class="cost">¥{{orderInfo.actualPrice}}</text>
</view> </view>
<view class="r"> <view class="r">
<view class="btn active" bindtap="cancelOrder" wx:if="{{handleOption.cancel}}">取消订单</view> <view class="btn active" bindtap="cancelOrder" wx:if="{{handleOption.cancel}}">取消订单</view>
<view class="btn active" bindtap="payOrder" wx:if="{{handleOption.pay}}">去付款</view> <view class="btn active" bindtap="payOrder" wx:if="{{handleOption.pay}}">去付款</view>
<view class="btn active" bindtap="confirmOrder" wx:if="{{handleOption.confirm}}">确认收货</view> <view class="btn active" bindtap="confirmOrder" wx:if="{{handleOption.confirm}}">确认收货</view>
<view class="btn active" bindtap="deleteOrder" wx:if="{{handleOption.delete}}">删除订单</view> <view class="btn active" bindtap="deleteOrder" wx:if="{{handleOption.delete}}">删除订单</view>
<view class="btn active" bindtap="refundOrder" wx:if="{{handleOption.refund}}">申请退款</view> <view class="btn active" bindtap="refundOrder" wx:if="{{handleOption.refund}}">申请退款</view>
</view> </view>
</view>
</view>
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view> </view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.specifications}}</view>
<view class="price">¥{{item.price}}</view>
<view class="btn active" wx:if="{{handleOption.comment && (item.comment == 0)}}">
<navigator url="../../commentPost/commentPost?orderId={{item.orderId}}&&valueId={{item.goodsId}}&type=0">去评价</navigator>
</view>
<view class="btn active" wx:if="{{handleOption.rebuy}}">
<navigator url="../../goods/goods?id={{item.goodsId}}">再次购买</navigator>
</view>
</view>
</view>
</view> </view>
<view class="order-bottom"> <view class="order-goods">
<view class="address"> <view class="h">
<view class="t"> <view class="label">商品信息</view>
<text class="name">{{orderInfo.consignee}}</text> <view class="status">{{orderInfo.orderStatusText}}</view>
<text class="mobile">{{orderInfo.mobile}}</text>
</view> </view>
<view class="b">{{orderInfo.address}}</view> <view class="goods">
</view> <view class="item" wx:for="{{orderGoods}}" wx:key="id">
<view class="total"> <view class="img">
<view class="t"> <image src="{{item.picUrl}}"></image>
<text class="label">商品合计:</text> </view>
<text class="txt">¥{{orderInfo.goodsPrice}}</text> <view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="number">x{{item.number}}</text>
</view>
<view class="attr">{{item.specifications}}</view>
<view class="price">¥{{item.price}}</view>
<view class="btn active" wx:if="{{handleOption.comment && (item.comment == 0)}}">
<navigator url="../../commentPost/commentPost?orderId={{item.orderId}}&&valueId={{item.goodsId}}&type=0">去评价</navigator>
</view>
<view class="btn active" wx:if="{{handleOption.rebuy}}">
<navigator url="../../goods/goods?id={{item.goodsId}}">再次购买</navigator>
</view>
</view>
</view>
</view> </view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<!-- 物流信息,仅收货状态下可见 --> <view class="order-bottom">
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}"> <view class="address">
<view class="expand"> <view class="t">
<view class="title"> <text class="name">{{orderInfo.consignee}}</text>
<view class="t">快递公司:{{expressInfo.shipperName}}</view> <text class="mobile">{{orderInfo.mobile}}</text>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view> </view>
</view> <view class="b">{{orderInfo.address}}</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image> </view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view> </view>
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace"> <!-- 物流信息,仅收货状态下可见 -->
<view class="acceptStation">{{iitem.AcceptStation}}</view> <view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="acceptTime">{{iitem.AcceptTime}}</view> <view class="expand">
</view> <view class="title">
<view class="t">快递公司:{{expressInfo.shipperName}}</view>
<view class="b">物流单号:{{expressInfo.shipperCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
</view>
</view> </view>
</view>
</view> </view>

View File

@@ -1,337 +1,337 @@
page { page {
height: 100%; height: 100%;
width: 100%; width: 100%;
background: #f4f4f4; background: #f4f4f4;
} }
.order-info { .order-info {
padding-top: 25rpx; padding-top: 25rpx;
background: #fff; background: #fff;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
} }
.item-a { .item-a {
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: 42.5rpx; height: 42.5rpx;
padding-bottom: 12.5rpx; padding-bottom: 12.5rpx;
line-height: 30rpx; line-height: 30rpx;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.item-b { .item-b {
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
margin-top: 12.5rpx; margin-top: 12.5rpx;
margin-bottom: 41.5rpx; margin-bottom: 41.5rpx;
font-size: 30rpx; font-size: 30rpx;
color: #666; color: #666;
} }
.item-c { .item-c {
margin-left: 31.25rpx; margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4; border-top: 1px solid #f4f4f4;
height: 103rpx; height: 103rpx;
line-height: 103rpx; line-height: 103rpx;
} }
.item-c .l { .item-c .l {
float: left; float: left;
} }
.item-c .r { .item-c .r {
height: 103rpx; height: 103rpx;
float: right; float: right;
display: flex; display: flex;
align-items: center; align-items: center;
padding-right: 16rpx; padding-right: 16rpx;
} }
.item-c .r .btn { .item-c .r .btn {
float: right; float: right;
} }
.item-c .cost { .item-c .cost {
color: #b4282d; color: #b4282d;
} }
.item-c .btn { .item-c .btn {
line-height: 66rpx; line-height: 66rpx;
border-radius: 5rpx; border-radius: 5rpx;
text-align: center; text-align: center;
margin: 0 15rpx; margin: 0 15rpx;
padding: 0 20rpx; padding: 0 20rpx;
height: 66rpx; height: 66rpx;
} }
.item-c .btn.active { .item-c .btn.active {
background: #a78845; background: #a78845;
color: #fff; color: #fff;
} }
.order-goods { .order-goods {
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
} }
.order-goods .h { .order-goods .h {
height: 93.75rpx; height: 93.75rpx;
line-height: 93.75rpx; line-height: 93.75rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
padding-right: 31.25rpx; padding-right: 31.25rpx;
} }
.order-goods .h .label { .order-goods .h .label {
float: left; float: left;
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
} }
.order-goods .h .status { .order-goods .h .status {
float: right; float: right;
font-size: 30rpx; font-size: 30rpx;
color: #b4282d; color: #b4282d;
} }
.order-goods .item { .order-goods .item {
display: flex; display: flex;
align-items: center; align-items: center;
height: 192rpx; height: 192rpx;
margin-left: 31.25rpx; margin-left: 31.25rpx;
padding-right: 31.25rpx; padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-goods .item:last-child { .order-goods .item:last-child {
border-bottom: none; border-bottom: none;
} }
.order-goods .item .img { .order-goods .item .img {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
background: #f4f4f4; background: #f4f4f4;
} }
.order-goods .item .img image { .order-goods .item .img image {
height: 145.83rpx; height: 145.83rpx;
width: 145.83rpx; width: 145.83rpx;
} }
.order-goods .item .info { .order-goods .item .info {
flex: 1; flex: 1;
height: 145.83rpx; height: 145.83rpx;
margin-left: 20rpx; margin-left: 20rpx;
} }
.order-goods .item .t { .order-goods .item .t {
margin-top: 8rpx; margin-top: 8rpx;
height: 33rpx; height: 33rpx;
line-height: 33rpx; line-height: 33rpx;
margin-bottom: 10.5rpx; margin-bottom: 10.5rpx;
} }
.order-goods .item .t .name { .order-goods .item .t .name {
display: block; display: block;
float: left; float: left;
height: 33rpx; height: 33rpx;
line-height: 33rpx; line-height: 33rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .t .number { .order-goods .item .t .number {
display: block; display: block;
float: right; float: right;
height: 33rpx; height: 33rpx;
text-align: right; text-align: right;
line-height: 33rpx; line-height: 33rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .attr { .order-goods .item .attr {
height: 29rpx; height: 29rpx;
line-height: 29rpx; line-height: 29rpx;
color: #666; color: #666;
margin-bottom: 25rpx; margin-bottom: 25rpx;
font-size: 25rpx; font-size: 25rpx;
} }
.order-goods .item .price { .order-goods .item .price {
display: block; display: block;
float: left; float: left;
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
color: #333; color: #333;
font-size: 30rpx; font-size: 30rpx;
} }
.order-goods .item .btn { .order-goods .item .btn {
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
border-radius: 5rpx; border-radius: 5rpx;
text-align: center; text-align: center;
display: block; display: block;
float: right; float: right;
margin: 0 15rpx; margin: 0 15rpx;
padding: 0 20rpx; padding: 0 20rpx;
} }
.order-goods .item .btn.active { .order-goods .item .btn.active {
background: #b4282d; background: #b4282d;
color: #fff; color: #fff;
} }
.order-bottom { .order-bottom {
margin-top: 20rpx; margin-top: 20rpx;
padding-left: 31.25rpx; padding-left: 31.25rpx;
height: auto; height: auto;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
} }
.order-bottom .address { .order-bottom .address {
height: 128rpx; height: 128rpx;
padding-top: 25rpx; padding-top: 25rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-bottom .address .t { .order-bottom .address .t {
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
margin-bottom: 7.5rpx; margin-bottom: 7.5rpx;
} }
.order-bottom .address .name { .order-bottom .address .name {
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
width: 140rpx; width: 140rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .address .mobile { .order-bottom .address .mobile {
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .address .b { .order-bottom .address .b {
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .total { .order-bottom .total {
height: 106rpx; height: 106rpx;
padding-top: 20rpx; padding-top: 20rpx;
border-bottom: 1px solid #f4f4f4; border-bottom: 1px solid #f4f4f4;
} }
.order-bottom .total .t { .order-bottom .total .t {
height: 30rpx; height: 30rpx;
line-height: 30rpx; line-height: 30rpx;
margin-bottom: 7.5rpx; margin-bottom: 7.5rpx;
display: flex; display: flex;
} }
.order-bottom .total .label { .order-bottom .total .label {
width: 150rpx; width: 150rpx;
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .total .txt { .order-bottom .total .txt {
flex: 1; flex: 1;
display: inline-block; display: inline-block;
height: 35rpx; height: 35rpx;
line-height: 35rpx; line-height: 35rpx;
font-size: 30rpx; font-size: 30rpx;
} }
.order-bottom .pay-fee { .order-bottom .pay-fee {
height: 81rpx; height: 81rpx;
line-height: 81rpx; line-height: 81rpx;
} }
.order-bottom .pay-fee .label { .order-bottom .pay-fee .label {
display: inline-block; display: inline-block;
width: 140rpx; width: 140rpx;
color: #b4282d; color: #b4282d;
} }
.order-bottom .pay-fee .txt { .order-bottom .pay-fee .txt {
display: inline-block; display: inline-block;
width: 140rpx; width: 140rpx;
color: #b4282d; color: #b4282d;
} }
.order-express { .order-express {
margin-top: 20rpx; margin-top: 20rpx;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
background: #fff; background: #fff;
} }
.order-express .expand { .order-express .expand {
/* margin-top: 20rpx; */ /* margin-top: 20rpx; */
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
background: #fff; background: #fff;
/* border: 10rpx #a78845; */ /* border: 10rpx #a78845; */
} }
.order-express .title { .order-express .title {
float: left; float: left;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 10rpx; padding: 10rpx;
} }
.order-express .ti { .order-express .ti {
float: right; float: right;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
margin-right: 16rpx; margin-right: 16rpx;
margin-top: 28rpx; margin-top: 28rpx;
} }
.order-express .t { .order-express .t {
font-size: 29rpx; font-size: 29rpx;
margin-left: 10.25rpx; margin-left: 10.25rpx;
color: #a78845; color: #a78845;
} }
.order-express .b { .order-express .b {
font-size: 29rpx; font-size: 29rpx;
margin-left: 10.25rpx; margin-left: 10.25rpx;
color: #a78845; color: #a78845;
} }
.order-express .traces { .order-express .traces {
padding: 17.5rpx; padding: 17.5rpx;
background: #fff; background: #fff;
border-bottom: 1rpx solid #f1e6cdcc; border-bottom: 1rpx solid #f1e6cdcc;
} }
.order-express .trace { .order-express .trace {
padding-bottom: 17.5rpx; padding-bottom: 17.5rpx;
padding-top: 17.5rpx; padding-top: 17.5rpx;
background: #fff; background: #fff;
} }
.order-express .acceptTime { .order-express .acceptTime {
margin-top: 20rpx; margin-top: 20rpx;
margin-right: 40rpx; margin-right: 40rpx;
text-align: right; text-align: right;
font-size: 26rpx; font-size: 26rpx;
} }
.order-express .acceptStation { .order-express .acceptStation {
font-size: 26rpx; font-size: 26rpx;
} }

View File

@@ -1,216 +1,186 @@
{ {
"description": "项目配置文件。", "description": "项目配置文件。",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"minified": true, "minified": true,
"newFeature": true "newFeature": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.2.0", "libVersion": "2.2.0",
"appid": "wxa5b486c6b918ecfb", "appid": "wxa5b486c6b918ecfb",
"projectname": "Renard", "projectname": "Renard",
"condition": { "condition": {
"search": { "search": {
"current": -1, "current": -1,
"list": [] "list": []
}, },
"conversation": { "conversation": {
"current": -1, "current": -1,
"list": [] "list": []
}, },
"plugin": { "plugin": {
"current": -1, "current": -1,
"list": [] "list": []
}, },
"game": { "game": {
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 34, "current": 34,
"list": [ "list": [
{ {
"id": -1, "id": -1,
"name": "首页", "name": "首页",
"pathName": "pages/index/index", "pathName": "pages/index/index",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "专题", "name": "专题",
"pathName": "pages/topic/topic", "pathName": "pages/topic/topic",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "专题详情", "name": "专题详情",
"pathName": "pages/topicDetail/topicDetail", "pathName": "pages/topicDetail/topicDetail",
"query": "id=314" "query": "id=314"
}, },
{ {
"id": -1, "id": -1,
"name": "专题评论列表", "name": "品牌",
"pathName": "pages/topicComment/topicComment", "pathName": "pages/brand/brand",
"query": "valueId=314&type=1" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "专题评论添加", "name": "品牌详情",
"pathName": "pages/topicCommentPost/topicCommentPost", "pathName": "pages/brandDetail/brandDetail",
"query": "valueId=314&type=1" "query": "id=1001000"
}, },
{ {
"id": -1, "id": -1,
"name": "品牌", "name": "人气推荐",
"pathName": "pages/brand/brand", "pathName": "pages/hotGoods/hotGoods",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "品牌详情", "name": "新品首发",
"pathName": "pages/brandDetail/brandDetail", "pathName": "pages/newGoods/newGoods",
"query": "id=1001000" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "人气推荐", "name": "分类",
"pathName": "pages/hotGoods/hotGoods", "pathName": "pages/catalog/catalog",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "新品首发", "name": "分类详情",
"pathName": "pages/newGoods/newGoods", "pathName": "pages/category/category",
"query": "" "query": "id=1008002"
}, },
{ {
"id": -1, "id": -1,
"name": "分类", "name": "查找",
"pathName": "pages/catalog/catalog", "pathName": "pages/search/search",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "分类详情", "name": "商品",
"pathName": "pages/category/category", "pathName": "pages/goods/goods",
"query": "id=1008002" "query": "id=1181000"
}, },
{ {
"id": -1, "id": -1,
"name": "查找", "name": "商品评论列表",
"pathName": "pages/search/search", "pathName": "pages/comment/comment",
"query": "" "query": "valueId=1181000&type=0"
}, },
{ {
"id": -1, "id": -1,
"name": "商品", "name": "购物车",
"pathName": "pages/goods/goods", "pathName": "pages/cart/cart",
"query": "id=1181000" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "商品评论列表", "name": "下单",
"pathName": "pages/comment/comment", "pathName": "pages/shopping/checkout/checkout",
"query": "valueId=1181000&type=0" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "购物车", "name": "支付结果",
"pathName": "pages/cart/cart", "pathName": "pages/payResult/payResult",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "下单", "name": "我的",
"pathName": "pages/shopping/checkout/checkout", "pathName": "pages/ucenter/index/index",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "支付结果", "name": "我的订单列表",
"pathName": "pages/payResult/payResult", "pathName": "pages/ucenter/order/order",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "我的", "name": "我的订单详情",
"pathName": "pages/ucenter/index/index", "pathName": "pages/ucenter/orderDetail/orderDetail",
"query": "" "query": "id=1"
}, },
{ {
"id": -1, "id": 22,
"name": "的订单列表", "name": "待评价的订单详情",
"pathName": "pages/ucenter/order/order", "pathName": "pages/ucenter/orderDetail/orderDetail",
"query": "" "query": "id=1"
}, },
{ {
"id": -1, "id": -1,
"name": "我的订单详情", "name": "购买商品评价",
"pathName": "pages/ucenter/orderDetail/orderDetail", "pathName": "pages/commentPost/commentPost",
"query": "id=1" "query": "orderId=2&type=0&valueId=1116011"
}, },
{ {
"id": 22, "id": -1,
"name": "待评价的订单详情", "name": "我的优惠券",
"pathName": "pages/ucenter/orderDetail/orderDetail", "pathName": "pages/ucenter/coupon/coupon",
"query": "id=1" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "购买商品评价", "name": "我的收藏",
"pathName": "pages/commentPost/commentPost", "pathName": "pages/ucenter/collect/collect",
"query": "orderId=2&type=0&valueId=1116011" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "我的优惠券", "name": "我的地址",
"pathName": "pages/ucenter/coupon/coupon", "pathName": "pages/ucenter/address/address",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "我的收藏", "name": "我的地址添加",
"pathName": "pages/ucenter/collect/collect", "pathName": "pages/ucenter/addressAdd/addressAdd",
"query": "" "query": ""
}, },
{ {
"id": -1, "id": -1,
"name": "我的足迹", "name": "登录",
"pathName": "pages/ucenter/footprint/footprint", "pathName": "pages/auth/login/login",
"query": "" "query": ""
}, }
{ ]
"id": -1, }
"name": "我的地址", }
"pathName": "pages/ucenter/address/address",
"query": ""
},
{
"id": -1,
"name": "我的地址添加",
"pathName": "pages/ucenter/addressAdd/addressAdd",
"query": ""
},
{
"id": -1,
"name": "登录",
"pathName": "pages/auth/login/login",
"query": ""
},
{
"id": -1,
"name": "注册",
"pathName": "pages/auth/register/register",
"query": ""
},
{
"id": -1,
"name": "找回密码",
"pathName": "pages/auth/reset/reset",
"query": ""
}
]
}
}
} }

View File

@@ -5,7 +5,7 @@ function isValidPhone(str) {
} else { } else {
return true; return true;
} }
} }
module.exports = { module.exports = {
isValidPhone isValidPhone

View File

@@ -9,12 +9,12 @@ const api = require('../config/api.js');
* Promise封装wx.checkSession * Promise封装wx.checkSession
*/ */
function checkSession() { function checkSession() {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
wx.checkSession({ wx.checkSession({
success: function () { success: function() {
resolve(true); resolve(true);
}, },
fail: function () { fail: function() {
reject(false); reject(false);
} }
}) })
@@ -25,16 +25,16 @@ function checkSession() {
* Promise封装wx.login * Promise封装wx.login
*/ */
function login() { function login() {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
wx.login({ wx.login({
success: function (res) { success: function(res) {
if (res.code) { if (res.code) {
resolve(res); resolve(res);
} else { } else {
reject(res); reject(res);
} }
}, },
fail: function (err) { fail: function(err) {
reject(err); reject(err);
} }
}); });
@@ -46,10 +46,13 @@ function login() {
*/ */
function loginByWeixin(userInfo) { function loginByWeixin(userInfo) {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
return login().then((res) => { return login().then((res) => {
//登录远程服务器 //登录远程服务器
util.request(api.AuthLoginByWeixin, { code: res.code, userInfo: userInfo }, 'POST').then(res => { util.request(api.AuthLoginByWeixin, {
code: res.code,
userInfo: userInfo
}, 'POST').then(res => {
if (res.errno === 0) { if (res.errno === 0) {
//存储用户信息 //存储用户信息
wx.setStorageSync('userInfo', res.data.userInfo); wx.setStorageSync('userInfo', res.data.userInfo);
@@ -72,7 +75,7 @@ function loginByWeixin(userInfo) {
* 判断用户是否登录 * 判断用户是否登录
*/ */
function checkLogin() { function checkLogin() {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) { if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {
checkSession().then(() => { checkSession().then(() => {
resolve(true); resolve(true);

View File

@@ -23,7 +23,7 @@ function formatNumber(n) {
* 封装微信的的request * 封装微信的的request
*/ */
function request(url, data = {}, method = "GET") { function request(url, data = {}, method = "GET") {
return new Promise(function (resolve, reject) { return new Promise(function(resolve, reject) {
wx.request({ wx.request({
url: url, url: url,
data: data, data: data,
@@ -32,7 +32,7 @@ function request(url, data = {}, method = "GET") {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-Litemall-Token': wx.getStorageSync('token') 'X-Litemall-Token': wx.getStorageSync('token')
}, },
success: function (res) { success: function(res) {
if (res.statusCode == 200) { if (res.statusCode == 200) {
@@ -56,7 +56,7 @@ function request(url, data = {}, method = "GET") {
} }
}, },
fail: function (err) { fail: function(err) {
reject(err) reject(err)
} }
}) })
@@ -90,6 +90,4 @@ module.exports = {
request, request,
redirect, redirect,
showErrorToast showErrorToast
}; };