diff --git a/renard-wx/app.js b/renard-wx/app.js
index e5cb4a08..1fb78e95 100644
--- a/renard-wx/app.js
+++ b/renard-wx/app.js
@@ -3,29 +3,29 @@ var api = require('./config/api.js');
var user = require('./utils/user.js');
App({
- onLaunch: function() {
- const updateManager = wx.getUpdateManager();
- wx.getUpdateManager().onUpdateReady(function() {
- wx.showModal({
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success: function(res) {
- if (res.confirm) {
- // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
- updateManager.applyUpdate()
- }
- }
- })
- })
- },
- onShow: function(options) {
- user.checkLogin().then(res => {
- this.globalData.hasLogin = true;
- }).catch(() => {
- this.globalData.hasLogin = false;
- });
- },
- globalData: {
- hasLogin: false
- }
+ onLaunch: function() {
+ const updateManager = wx.getUpdateManager();
+ wx.getUpdateManager().onUpdateReady(function() {
+ wx.showModal({
+ title: '更新提示',
+ content: '新版本已经准备好,是否重启应用?',
+ success: function(res) {
+ if (res.confirm) {
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+ updateManager.applyUpdate()
+ }
+ }
+ })
+ })
+ },
+ onShow: function(options) {
+ user.checkLogin().then(res => {
+ this.globalData.hasLogin = true;
+ }).catch(() => {
+ this.globalData.hasLogin = false;
+ });
+ },
+ globalData: {
+ hasLogin: false
+ }
})
\ No newline at end of file
diff --git a/renard-wx/app.json b/renard-wx/app.json
index 106db2de..8135730e 100644
--- a/renard-wx/app.json
+++ b/renard-wx/app.json
@@ -1,74 +1,74 @@
{
- "pages": [
- "pages/index/index",
- "pages/catalog/catalog",
- "pages/newGoods/newGoods",
- "pages/hotGoods/hotGoods",
- "pages/ucenter/index/index",
- "pages/ucenter/address/address",
- "pages/ucenter/addressAdd/addressAdd",
- "pages/ucenter/order/order",
- "pages/ucenter/orderDetail/orderDetail",
- "pages/ucenter/coupon/coupon",
- "pages/ucenter/collect/collect",
- "pages/auth/login/login",
- "pages/payResult/payResult",
- "pages/comment/comment",
- "pages/commentPost/commentPost",
- "pages/topic/topic",
- "pages/topicDetail/topicDetail",
- "pages/brand/brand",
- "pages/brandDetail/brandDetail",
- "pages/search/search",
- "pages/category/category",
- "pages/cart/cart",
- "pages/shopping/checkout/checkout",
- "pages/goods/goods",
- "pages/groupon/myGroupon/myGroupon",
- "pages/groupon/grouponDetail/grouponDetail",
- "pages/groupon/grouponList/grouponList"
- ],
- "window": {
- "navigationBarTitleText": "Renard",
- "enablePullDownRefresh": true,
- "backgroundTextStyle": "light",
- "navigationBarBackgroundColor": "#fff",
- "navigationBarTextStyle": "black"
- },
- "tabBar": {
- "color": "#6e6d6b",
- "selectedColor": "#e64340",
- "borderStyle": "white",
- "backgroundColor": "#fff",
- "box-shadow": "0 0 6px 0",
- "list": [
- {
- "pagePath": "pages/index/index",
- "iconPath": "images/tabbar/like-f.png",
- "selectedIconPath": "images/tabbar/like-o.png"
- },
- {
- "pagePath": "pages/catalog/catalog",
- "iconPath": "images/tabbar/menu-f.png",
- "selectedIconPath": "images/tabbar/menu-o.png"
- },
- {
- "pagePath": "pages/cart/cart",
- "iconPath": "images/tabbar/cart-f.png",
- "selectedIconPath": "images/tabbar/cart-o.png"
- },
- {
- "pagePath": "pages/ucenter/index/index",
- "iconPath": "images/tabbar/user-f.png",
- "selectedIconPath": "images/tabbar/user-o.png"
- }
- ]
- },
- "networkTimeout": {
- "request": 10000,
- "connectSocket": 10000,
- "uploadFile": 10000,
- "downloadFile": 10000
- },
- "debug": true
+ "pages": [
+ "pages/index/index",
+ "pages/catalog/catalog",
+ "pages/newGoods/newGoods",
+ "pages/hotGoods/hotGoods",
+ "pages/ucenter/index/index",
+ "pages/ucenter/address/address",
+ "pages/ucenter/addressAdd/addressAdd",
+ "pages/ucenter/order/order",
+ "pages/ucenter/orderDetail/orderDetail",
+ "pages/ucenter/coupon/coupon",
+ "pages/ucenter/collect/collect",
+ "pages/auth/login/login",
+ "pages/payResult/payResult",
+ "pages/comment/comment",
+ "pages/commentPost/commentPost",
+ "pages/topic/topic",
+ "pages/topicDetail/topicDetail",
+ "pages/brand/brand",
+ "pages/brandDetail/brandDetail",
+ "pages/search/search",
+ "pages/category/category",
+ "pages/cart/cart",
+ "pages/shopping/checkout/checkout",
+ "pages/goods/goods",
+ "pages/groupon/myGroupon/myGroupon",
+ "pages/groupon/grouponDetail/grouponDetail",
+ "pages/groupon/grouponList/grouponList"
+ ],
+ "window": {
+ "navigationBarTitleText": "Renard",
+ "enablePullDownRefresh": true,
+ "backgroundTextStyle": "light",
+ "navigationBarBackgroundColor": "#fff",
+ "navigationBarTextStyle": "black"
+ },
+ "tabBar": {
+ "color": "#6e6d6b",
+ "selectedColor": "#e64340",
+ "borderStyle": "white",
+ "backgroundColor": "#fff",
+ "box-shadow": "0 0 6px 0",
+ "list": [
+ {
+ "pagePath": "pages/index/index",
+ "iconPath": "images/tabbar/like-f.png",
+ "selectedIconPath": "images/tabbar/like-o.png"
+ },
+ {
+ "pagePath": "pages/catalog/catalog",
+ "iconPath": "images/tabbar/menu-f.png",
+ "selectedIconPath": "images/tabbar/menu-o.png"
+ },
+ {
+ "pagePath": "pages/cart/cart",
+ "iconPath": "images/tabbar/cart-f.png",
+ "selectedIconPath": "images/tabbar/cart-o.png"
+ },
+ {
+ "pagePath": "pages/ucenter/index/index",
+ "iconPath": "images/tabbar/user-f.png",
+ "selectedIconPath": "images/tabbar/user-o.png"
+ }
+ ]
+ },
+ "networkTimeout": {
+ "request": 10000,
+ "connectSocket": 10000,
+ "uploadFile": 10000,
+ "downloadFile": 10000
+ },
+ "debug": true
}
\ No newline at end of file
diff --git a/renard-wx/app.wxss b/renard-wx/app.wxss
index fe9d0542..6dcb077d 100644
--- a/renard-wx/app.wxss
+++ b/renard-wx/app.wxss
@@ -1,24 +1,24 @@
/**app.wxss**/
+
.container {
box-sizing: border-box;
- font-family: PingFangSC-Light,helvetica,'Heiti SC';
+ font-family: PingFangSC-Light, helvetica, 'Heiti SC';
width: 100%;
height: 100%;
-}
-
-view,image,text,navigator{
- box-sizing: border-box;
- padding:0;
- margin:0;
-
}
-view,text{
- font-family: PingFangSC-Light,helvetica,'Heiti SC';
+view, image, text, navigator {
+ box-sizing: border-box;
+ padding: 0;
+ margin: 0;
+}
+
+view, text {
+ font-family: PingFangSC-Light, helvetica, 'Heiti SC';
font-size: 29rpx;
color: #a78845;
}
.wxParse-img {
display: block !important;
-}
\ No newline at end of file
+}
diff --git a/renard-wx/config/api.js b/renard-wx/config/api.js
index 85a61d03..0e96bfaf 100644
--- a/renard-wx/config/api.js
+++ b/renard-wx/config/api.js
@@ -1,6 +1,6 @@
// 以下是业务服务器API地址
// 本机开发时使用
- var WxApiRoot = 'http://localhost:8080/wx/';
+var WxApiRoot = 'http://localhost:8080/wx/';
// 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8080/wx/';
// 云平台上线时使用
@@ -8,82 +8,82 @@
// var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = {
- IndexUrl: WxApiRoot + 'home/index', //首页数据接口
- CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口
- CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口
+ IndexUrl: WxApiRoot + 'home/index', //首页数据接口
+ CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口
+ CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口
- CatalogAll: WxApiRoot + 'catalog/all', //分类目录当前分类数据接口
+ CatalogAll: WxApiRoot + 'catalog/all', //分类目录当前分类数据接口
- AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录
- AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录
- AuthRegister: WxApiRoot + 'auth/register', //账号注册
- AuthReset: WxApiRoot + 'auth/reset', //账号密码重置
- AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码
+ AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录
+ AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录
+ AuthRegister: WxApiRoot + 'auth/register', //账号注册
+ AuthReset: WxApiRoot + 'auth/reset', //账号密码重置
+ AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码
- GoodsCount: WxApiRoot + 'goods/count', //统计商品总数
- GoodsList: WxApiRoot + 'goods/list', //获得商品列表
- GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据
- GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情
- GoodsNew: WxApiRoot + 'goods/new', //新品
- GoodsHot: WxApiRoot + 'goods/hot', //热门
- GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看)
+ GoodsCount: WxApiRoot + 'goods/count', //统计商品总数
+ GoodsList: WxApiRoot + 'goods/list', //获得商品列表
+ GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据
+ GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情
+ GoodsNew: WxApiRoot + 'goods/new', //新品
+ GoodsHot: WxApiRoot + 'goods/hot', //热门
+ GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看)
- BrandList: WxApiRoot + 'brand/list', //品牌列表
- BrandDetail: WxApiRoot + 'brand/detail', //品牌详情
+ BrandList: WxApiRoot + 'brand/list', //品牌列表
+ BrandDetail: WxApiRoot + 'brand/detail', //品牌详情
- CartList: WxApiRoot + 'cart/index', //获取购物车的数据
- CartAdd: WxApiRoot + 'cart/add', // 添加商品到购物车
- CartFastAdd: WxApiRoot + 'cart/fastadd', // 立即购买商品
- CartUpdate: WxApiRoot + 'cart/update', // 更新购物车的商品
- CartDelete: WxApiRoot + 'cart/delete', // 删除购物车的商品
- CartChecked: WxApiRoot + 'cart/checked', // 选择或取消选择商品
- CartGoodsCount: WxApiRoot + 'cart/goodscount', // 获取购物车商品件数
- CartCheckout: WxApiRoot + 'cart/checkout', // 下单前信息确认
+ CartList: WxApiRoot + 'cart/index', //获取购物车的数据
+ CartAdd: WxApiRoot + 'cart/add', // 添加商品到购物车
+ CartFastAdd: WxApiRoot + 'cart/fastadd', // 立即购买商品
+ CartUpdate: WxApiRoot + 'cart/update', // 更新购物车的商品
+ CartDelete: WxApiRoot + 'cart/delete', // 删除购物车的商品
+ CartChecked: WxApiRoot + 'cart/checked', // 选择或取消选择商品
+ CartGoodsCount: WxApiRoot + 'cart/goodscount', // 获取购物车商品件数
+ CartCheckout: WxApiRoot + 'cart/checkout', // 下单前信息确认
- CollectList: WxApiRoot + 'collect/list', //收藏列表
- CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏
+ CollectList: WxApiRoot + 'collect/list', //收藏列表
+ CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏
- CommentList: WxApiRoot + 'comment/list', //评论列表
- CommentCount: WxApiRoot + 'comment/count', //评论总数
- CommentPost: WxApiRoot + 'comment/post', //发表评论
+ CommentList: WxApiRoot + 'comment/list', //评论列表
+ CommentCount: WxApiRoot + 'comment/count', //评论总数
+ CommentPost: WxApiRoot + 'comment/post', //发表评论
- TopicList: WxApiRoot + 'topic/list', //专题列表
- TopicDetail: WxApiRoot + 'topic/detail', //专题详情
- TopicRelated: WxApiRoot + 'topic/related', //相关专题
+ TopicList: WxApiRoot + 'topic/list', //专题列表
+ TopicDetail: WxApiRoot + 'topic/detail', //专题详情
+ TopicRelated: WxApiRoot + 'topic/related', //相关专题
- SearchIndex: WxApiRoot + 'search/index', //搜索关键字
- SearchResult: WxApiRoot + 'search/result', //搜索结果
- SearchHelper: WxApiRoot + 'search/helper', //搜索帮助
- SearchClearHistory: WxApiRoot + 'search/clearhistory', //搜索历史清楚
+ SearchIndex: WxApiRoot + 'search/index', //搜索关键字
+ SearchResult: WxApiRoot + 'search/result', //搜索结果
+ SearchHelper: WxApiRoot + 'search/helper', //搜索帮助
+ SearchClearHistory: WxApiRoot + 'search/clearhistory', //搜索历史清楚
- AddressList: WxApiRoot + 'address/list', //收货地址列表
- AddressDetail: WxApiRoot + 'address/detail', //收货地址详情
- AddressSave: WxApiRoot + 'address/save', //保存收货地址
- AddressDelete: WxApiRoot + 'address/delete', //保存收货地址
+ AddressList: WxApiRoot + 'address/list', //收货地址列表
+ AddressDetail: WxApiRoot + 'address/detail', //收货地址详情
+ AddressSave: WxApiRoot + 'address/save', //保存收货地址
+ AddressDelete: WxApiRoot + 'address/delete', //保存收货地址
- RegionList: WxApiRoot + 'region/list', //获取区域列表
+ RegionList: WxApiRoot + 'region/list', //获取区域列表
- OrderSubmit: WxApiRoot + 'order/submit', // 提交订单
- OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话
- OrderList: WxApiRoot + 'order/list', //订单列表
- OrderDetail: WxApiRoot + 'order/detail', //订单详情
- OrderCancel: WxApiRoot + 'order/cancel', //取消订单
- OrderRefund: WxApiRoot + 'order/refund', //退款取消订单
- OrderDelete: WxApiRoot + 'order/delete', //删除订单
- OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
- OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息
- OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息
+ OrderSubmit: WxApiRoot + 'order/submit', // 提交订单
+ OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话
+ OrderList: WxApiRoot + 'order/list', //订单列表
+ OrderDetail: WxApiRoot + 'order/detail', //订单详情
+ OrderCancel: WxApiRoot + 'order/cancel', //取消订单
+ OrderRefund: WxApiRoot + 'order/refund', //退款取消订单
+ OrderDelete: WxApiRoot + 'order/delete', //删除订单
+ OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
+ OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息
+ OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息
- FootprintList: WxApiRoot + 'footprint/list', //足迹列表
- FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
+ FootprintList: WxApiRoot + 'footprint/list', //足迹列表
+ FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
- UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
+ UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
- GroupOnList: WxApiRoot + 'groupon/list', //团购列表
- GroupOn: WxApiRoot + 'groupon/query', //团购API-查询
- GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购
- GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情
- GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情
+ GroupOnList: WxApiRoot + 'groupon/list', //团购列表
+ GroupOn: WxApiRoot + 'groupon/query', //团购API-查询
+ GroupOnMy: WxApiRoot + 'groupon/my', //团购API-我的团购
+ GroupOnDetail: WxApiRoot + 'groupon/detail', //团购API-详情
+ GroupOnJoin: WxApiRoot + 'groupon/join', //团购API-详情
- StorageUpload: WxApiRoot + 'storage/upload' //图片上传
+ StorageUpload: WxApiRoot + 'storage/upload' //图片上传
};
\ No newline at end of file
diff --git a/renard-wx/pages/auth/login/login.js b/renard-wx/pages/auth/login/login.js
index 36592482..ec9a1e66 100644
--- a/renard-wx/pages/auth/login/login.js
+++ b/renard-wx/pages/auth/login/login.js
@@ -4,29 +4,28 @@ var user = require('../../../utils/user.js');
var app = getApp();
Page({
- data: {
- },
- onLoad: function (options) {
+ data: {},
+ onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
- onReady: function () {
+ onReady: function() {
},
- onShow: function () {
+ onShow: function() {
// 页面显示
},
- onHide: function () {
+ onHide: function() {
// 页面隐藏
},
- onUnload: function () {
+ onUnload: function() {
// 页面关闭
},
- wxLogin: function (e) {
- if (e.detail.userInfo == undefined){
+ wxLogin: function(e) {
+ if (e.detail.userInfo == undefined) {
app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败');
return;
diff --git a/renard-wx/pages/auth/login/login.wxml b/renard-wx/pages/auth/login/login.wxml
index f433e106..994665f2 100644
--- a/renard-wx/pages/auth/login/login.wxml
+++ b/renard-wx/pages/auth/login/login.wxml
@@ -1,7 +1,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/renard-wx/pages/auth/login/login.wxss b/renard-wx/pages/auth/login/login.wxss
index d913bdfe..0d089286 100644
--- a/renard-wx/pages/auth/login/login.wxss
+++ b/renard-wx/pages/auth/login/login.wxss
@@ -1,90 +1,90 @@
-.form-box{
- width: 100%;
- height: auto;
- overflow: hidden;
- padding: 0 40rpx;
- margin-top: 96rpx;
- background: #fff;
+.form-box {
+ width: 100%;
+ height: auto;
+ overflow: hidden;
+ padding: 0 40rpx;
+ margin-top: 96rpx;
+ background: #fff;
}
-.form-item{
- position: relative;
- background: #fff;
- height: 96rpx;
- border-bottom: 1px solid #a78845;
+.form-item {
+ position: relative;
+ background: #fff;
+ height: 96rpx;
+ border-bottom: 1px solid #a78845;
}
-.form-item .username, .form-item .password, .form-item .code{
- position: absolute;
- top: 26rpx;
- left: 0;
- display: block;
- width: 100%;
- height: 44rpx;
- background: #fff;
- color: #a78845;
- font-size: 30rpx;
+.form-item .username, .form-item .password, .form-item .code {
+ position: absolute;
+ top: 26rpx;
+ left: 0;
+ display: block;
+ width: 100%;
+ height: 44rpx;
+ background: #fff;
+ color: #a78845;
+ font-size: 30rpx;
}
-.form-item-code{
- margin-top:32rpx;
- height: auto;
- overflow: hidden;
- width: 100%;
+.form-item-code {
+ margin-top: 32rpx;
+ height: auto;
+ overflow: hidden;
+ width: 100%;
}
-.form-item-code .form-item{
- float: left;
- width: 350rpx;
+.form-item-code .form-item {
+ float: left;
+ width: 350rpx;
}
-.form-item-code .code-img{
- float: right;
- margin-top: 4rpx;
- height: 88rpx;
- width: 236rpx;
+.form-item-code .code-img {
+ float: right;
+ margin-top: 4rpx;
+ height: 88rpx;
+ width: 236rpx;
}
-.form-item .clear{
- position: absolute;
- top: 26rpx;
- right: 18rpx;
- z-index: 2;
- display: block;
- background: #fff;
- height: 44rpx;
- width: 44rpx;
+.form-item .clear {
+ position: absolute;
+ top: 26rpx;
+ right: 18rpx;
+ z-index: 2;
+ display: block;
+ background: #fff;
+ height: 44rpx;
+ width: 44rpx;
}
-.login-btn{
- margin: 60rpx 0 40rpx 0;
- height: 96rpx;
- line-height: 96rpx;
- color: #a78845;
- font-size: 30rpx;
- width: 100%;
- background: #b4282d;
- border-radius: 6rpx;
+.login-btn {
+ margin: 60rpx 0 40rpx 0;
+ height: 96rpx;
+ line-height: 96rpx;
+ color: #a78845;
+ font-size: 30rpx;
+ width: 100%;
+ background: #b4282d;
+ border-radius: 6rpx;
}
-.form-item-text{
- height: 35rpx;
- width: 100%;
- color: #a78845;
+.form-item-text {
+ height: 35rpx;
+ width: 100%;
+ color: #a78845;
}
-.form-item-text .register{
- display: block;
- height: 34rpx;
- float: left;
- font-size: 28rpx;
- color: #a78845;
+.form-item-text .register {
+ display: block;
+ height: 34rpx;
+ float: left;
+ font-size: 28rpx;
+ color: #a78845;
}
-.form-item-text .reset{
- display: block;
- height: 34rpx;
- float: right;
- font-size: 28rpx;
- color: #a78845;
-}
\ No newline at end of file
+.form-item-text .reset {
+ display: block;
+ height: 34rpx;
+ float: right;
+ font-size: 28rpx;
+ color: #a78845;
+}
diff --git a/renard-wx/pages/brand/brand.js b/renard-wx/pages/brand/brand.js
index 07707254..7e1920bf 100644
--- a/renard-wx/pages/brand/brand.js
+++ b/renard-wx/pages/brand/brand.js
@@ -2,58 +2,58 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var app = getApp();
Page({
- data: {
- brandList: [],
- page: 1,
- size: 10,
- totalPages: 1
- },
- onLoad: function(options) {
- // 页面初始化 options为页面跳转所带来的参数
- this.getBrandList();
- },
- getBrandList: function() {
- wx.showLoading({
- 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
+ data: {
+ brandList: [],
+ page: 1,
+ size: 10,
+ totalPages: 1
+ },
+ onLoad: function(options) {
+ // 页面初始化 options为页面跳转所带来的参数
+ this.getBrandList();
+ },
+ getBrandList: function() {
+ wx.showLoading({
+ title: '加载中...',
});
- }
- wx.hideLoading();
- });
- },
- onReachBottom() {
- if (this.data.totalPages > this.data.page) {
- this.setData({
- page: this.data.page + 1
- });
- } else {
- return false;
+ 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
+ });
+ }
+ 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() {
- // 页面关闭
-
- }
})
\ No newline at end of file
diff --git a/renard-wx/pages/brand/brand.wxml b/renard-wx/pages/brand/brand.wxml
index 5d4bf682..4b46be7c 100644
--- a/renard-wx/pages/brand/brand.wxml
+++ b/renard-wx/pages/brand/brand.wxml
@@ -1,14 +1,14 @@
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
-
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
\ No newline at end of file
diff --git a/renard-wx/pages/brand/brand.wxss b/renard-wx/pages/brand/brand.wxss
index 71de4d69..4fdc8c57 100644
--- a/renard-wx/pages/brand/brand.wxss
+++ b/renard-wx/pages/brand/brand.wxss
@@ -1,52 +1,52 @@
-.brand-list .item{
- display: block;
- width: 750rpx;
- height: 416rpx;
- position: relative;
- margin-bottom: 4rpx;
+.brand-list .item {
+ display: block;
+ width: 750rpx;
+ height: 416rpx;
+ position: relative;
+ margin-bottom: 4rpx;
}
-.brand-list .item .img-bg{
- position: absolute;
- left:0;
- top:0;
- z-index: 0;
- width: 750rpx;
- height: 417rpx;
- overflow: hidden;
+.brand-list .item .img-bg {
+ position: absolute;
+ left: 0;
+ top: 0;
+ z-index: 0;
+ width: 750rpx;
+ height: 417rpx;
+ overflow: hidden;
}
-.brand-list .item .img-bg image{
- width: 750rpx;
- height: 416rpx;
+.brand-list .item .img-bg image {
+ width: 750rpx;
+ height: 416rpx;
}
-.brand-list .item .txt-box{
- position: absolute;
- left:0;
- top:0;
- display: table;
- z-index: 0;
- width: 750rpx;
- height: 417rpx;
+.brand-list .item .txt-box {
+ position: absolute;
+ left: 0;
+ top: 0;
+ display: table;
+ z-index: 0;
+ width: 750rpx;
+ height: 417rpx;
}
-.brand-list .item .line{
- display: table-cell;
- vertical-align: middle;
- text-align: center;
- height: 63rpx;
- line-height: 63rpx;
+.brand-list .item .line {
+ display: table-cell;
+ vertical-align: middle;
+ text-align: center;
+ height: 63rpx;
+ line-height: 63rpx;
}
-.brand-list .item .line text{
- font-size: 35rpx;
- font-weight: 700;
- text-shadow: 1rpx 1rpx rgba(0,0,0,.32);
- color: #fff;
+.brand-list .item .line text {
+ font-size: 35rpx;
+ font-weight: 700;
+ text-shadow: 1rpx 1rpx rgba(0, 0, 0, 0.32);
+ color: #fff;
}
-.brand-list .item .line .s{
- padding: 0 10rpx;
- font-size: 40rpx;
-}
\ No newline at end of file
+.brand-list .item .line .s {
+ padding: 0 10rpx;
+ font-size: 40rpx;
+}
diff --git a/renard-wx/pages/brandDetail/brandDetail.js b/renard-wx/pages/brandDetail/brandDetail.js
index 27a83c03..b27f9f77 100644
--- a/renard-wx/pages/brandDetail/brandDetail.js
+++ b/renard-wx/pages/brandDetail/brandDetail.js
@@ -1,69 +1,68 @@
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
-
var app = getApp();
Page({
- data: {
- id: 0,
- brand: {},
- goodsList: [],
- page: 1,
- size: 100
- },
- onLoad: function(options) {
- // 页面初始化 options为页面跳转所带来的参数
- 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) {
+ data: {
+ id: 0,
+ brand: {},
+ goodsList: [],
+ page: 1,
+ size: 100
+ },
+ onLoad: function(options) {
+ // 页面初始化 options为页面跳转所带来的参数
+ var that = this;
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();
- }
- });
- },
- getGoodsList() {
- var that = this;
+ that.getGoodsList();
+ }
+ });
+ },
+ getGoodsList() {
+ var that = this;
- util.request(api.GoodsList, {
- brandId: that.data.id,
- page: that.data.page,
- size: that.data.size
- })
- .then(function(res) {
- if (res.errno === 0) {
- that.setData({
- goodsList: res.data.goodsList
- });
- }
- });
- },
- onReady: function() {
- // 页面渲染完成
+ util.request(api.GoodsList, {
+ brandId: that.data.id,
+ page: that.data.page,
+ size: that.data.size
+ })
+ .then(function(res) {
+ if (res.errno === 0) {
+ that.setData({
+ goodsList: res.data.goodsList
+ });
+ }
+ });
+ },
+ onReady: function() {
+ // 页面渲染完成
- },
- onShow: function() {
- // 页面显示
+ },
+ onShow: function() {
+ // 页面显示
- },
- onHide: function() {
- // 页面隐藏
+ },
+ onHide: function() {
+ // 页面隐藏
- },
- onUnload: function() {
- // 页面关闭
+ },
+ onUnload: function() {
+ // 页面关闭
- }
+ }
})
\ No newline at end of file
diff --git a/renard-wx/pages/brandDetail/brandDetail.json b/renard-wx/pages/brandDetail/brandDetail.json
index b35cba00..3026b4f3 100644
--- a/renard-wx/pages/brandDetail/brandDetail.json
+++ b/renard-wx/pages/brandDetail/brandDetail.json
@@ -1,6 +1,6 @@
{
- "navigationBarTitleText": "品牌商详情",
- "usingComponents": {
- "goodList": "/components/goodList/goodList"
- }
+ "navigationBarTitleText": "品牌商详情",
+ "usingComponents": {
+ "goodList": "/components/goodList/goodList"
+ }
}
\ No newline at end of file
diff --git a/renard-wx/pages/brandDetail/brandDetail.wxml b/renard-wx/pages/brandDetail/brandDetail.wxml
index f1340269..1710e9f4 100644
--- a/renard-wx/pages/brandDetail/brandDetail.wxml
+++ b/renard-wx/pages/brandDetail/brandDetail.wxml
@@ -1,20 +1,20 @@
-
-
-
-
-
- {{brand.name}}
-
+
+
+
+
+
+ {{brand.name}}
+
+
+
+
+
+ {{brand.desc}}
-
-
- {{brand.desc}}
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/renard-wx/pages/brandDetail/brandDetail.wxss b/renard-wx/pages/brandDetail/brandDetail.wxss
index 5d88d652..0cbe30f5 100644
--- a/renard-wx/pages/brandDetail/brandDetail.wxss
+++ b/renard-wx/pages/brandDetail/brandDetail.wxss
@@ -1,61 +1,61 @@
page {
- background: #f4f4f4;
+ background: #f4f4f4;
}
.brand-info .name {
- width: 100%;
- height: 290rpx;
- position: relative;
+ width: 100%;
+ height: 290rpx;
+ position: relative;
}
.brand-info .img {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 290rpx;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 290rpx;
}
.brand-info .info-box {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 290rpx;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 290rpx;
+ text-align: center;
+ display: flex;
+ justify-content: center;
+ align-items: center;
}
.brand-info .info {
- display: block;
+ display: block;
}
.brand-info .txt {
- display: block;
- height: 37.5rpx;
- font-size: 37.5rpx;
- color: #fff;
+ display: block;
+ height: 37.5rpx;
+ font-size: 37.5rpx;
+ color: #fff;
}
.brand-info .line {
- margin: 0 auto;
- margin-top: 16rpx;
- display: block;
- height: 2rpx;
- width: 145rpx;
- background: #fff;
+ margin: 0 auto;
+ margin-top: 16rpx;
+ display: block;
+ height: 2rpx;
+ width: 145rpx;
+ background: #fff;
}
.brand-info .desc {
- background: #fff;
- width: 100%;
- height: auto;
- overflow: hidden;
- padding: 41.5rpx 31.25rpx;
- font-size: 30rpx;
- color: #666;
- line-height: 41.5rpx;
- text-align: center;
-}
\ No newline at end of file
+ background: #fff;
+ width: 100%;
+ height: auto;
+ overflow: hidden;
+ padding: 41.5rpx 31.25rpx;
+ font-size: 30rpx;
+ color: #666;
+ line-height: 41.5rpx;
+ text-align: center;
+}
diff --git a/renard-wx/pages/cart/cart.js b/renard-wx/pages/cart/cart.js
index ccd4f57c..392d1ebd 100644
--- a/renard-wx/pages/cart/cart.js
+++ b/renard-wx/pages/cart/cart.js
@@ -5,301 +5,301 @@ var user = require('../../utils/user.js');
var app = getApp();
Page({
- data: {
- cartGoods: [],
- cartTotal: {
- "goodsCount": 0,
- "goodsAmount": 0.00,
- "checkedGoodsCount": 0,
- "checkedGoodsAmount": 0.00
+ data: {
+ cartGoods: [],
+ cartTotal: {
+ "goodsCount": 0,
+ "goodsAmount": 0.00,
+ "checkedGoodsCount": 0,
+ "checkedGoodsAmount": 0.00
+ },
+ isEditCart: false,
+ checkedAllStatus: true,
+ editCartList: [],
+ hasLogin: false
},
- isEditCart: false,
- checkedAllStatus: true,
- editCartList: [],
- hasLogin: false
- },
- onLoad: function(options) {
- // 页面初始化 options为页面跳转所带来的参数
- },
- onReady: function() {
- // 页面渲染完成
- },
- 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
- });
+ onLoad: function(options) {
+ // 页面初始化 options为页面跳转所带来的参数
+ },
+ onReady: function() {
+ // 页面渲染完成
+ },
+ onShow: function() {
+ // 页面显示
+ if (app.globalData.hasLogin) {
+ this.getCartList();
}
- that.setData({
- checkedAllStatus: that.isCheckedAll()
+ this.setData({
+ hasLogin: app.globalData.hasLogin
});
- });
- } else {
- //编辑状态
- let tmpCartData = this.data.cartGoods.map(function(element, index, array) {
- if (index == itemIndex) {
- element.checked = !element.checked;
+
+ },
+ 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({
+ 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;
- });
-
- 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
- });
+ },
+ 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()
+ });
}
- that.setData({
- checkedAllStatus: that.isCheckedAll()
- });
- });
- } else {
- //编辑状态
- let checkedAllStatus = that.isCheckedAll();
- let tmpCartData = this.data.cartGoods.map(function(v) {
- v.checked = !checkedAllStatus;
- return v;
- });
+ },
+ updateCart: function(productId, goodsId, number, id) {
+ let that = this;
- that.setData({
- cartGoods: tmpCartData,
- checkedAllStatus: that.isCheckedAll(),
- 'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
- });
- }
-
- },
- 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;
+ util.request(api.CartUpdate, {
+ productId: productId,
+ goodsId: goodsId,
+ number: number,
+ id: id
+ }, 'POST').then(function(res) {
+ that.setData({
+ checkedAllStatus: that.isCheckedAll()
+ });
});
- that.setData({
- cartGoods: cartList,
- cartTotal: res.data.cartTotal
- });
- }
+ },
+ cutNumber: function(event) {
- that.setData({
- checkedAllStatus: that.isCheckedAll()
- });
- });
- }
+ 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,
+ cartTotal: res.data.cartTotal
+ });
+ }
+
+ that.setData({
+ checkedAllStatus: that.isCheckedAll()
+ });
+ });
+ }
})
\ No newline at end of file
diff --git a/renard-wx/pages/cart/cart.json b/renard-wx/pages/cart/cart.json
index d9a1dcd2..2c3ab45a 100644
--- a/renard-wx/pages/cart/cart.json
+++ b/renard-wx/pages/cart/cart.json
@@ -1,4 +1,4 @@
{
- "backgroundColor": "#f4f4f4",
- "navigationBarTitleText": "购物车"
+ "backgroundColor": "#f4f4f4",
+ "navigationBarTitleText": "购物车"
}
\ No newline at end of file
diff --git a/renard-wx/pages/cart/cart.wxml b/renard-wx/pages/cart/cart.wxml
index 2774994a..a89615b6 100644
--- a/renard-wx/pages/cart/cart.wxml
+++ b/renard-wx/pages/cart/cart.wxml
@@ -1,59 +1,59 @@
-
-
-
- 还没有登录
-
-
-
-
-
- 30天无忧退货
- 48小时快速退款
- 满88元免邮费
-
-
-
-
- 去添加点什么吧
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.goodsName}}
- x{{item.number}}
-
- {{ isEditCart ? '已选择:' : ''}}{{item.goodsSpecificationValues||''}}
-
- ¥{{item.price}}
-
- -
-
- +
-
-
-
-
-
-
+
+
+
+ 还没有登录
+
+
+
+
+
+ 30天无忧退货
+ 48小时快速退款
+ 满88元免邮费
+
+
+
+
+ 去添加点什么吧
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.goodsName}}
+ x{{item.number}}
+
+ {{ isEditCart ? '已选择:' : ''}}{{item.goodsSpecificationValues||''}}
+
+ ¥{{item.price}}
+
+ -
+
+ +
+
+
+
+
+
+
+
+
+
+
+ 全选({{cartTotal.checkedGoodsCount}})
+ {{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}}
+ {{!isEditCart ? '编辑' : '完成'}}
+ 删除所选
+ 下单
+
-
-
-
- 全选({{cartTotal.checkedGoodsCount}})
- {{!isEditCart ? '¥'+cartTotal.checkedGoodsAmount : ''}}
- {{!isEditCart ? '编辑' : '完成'}}
- 删除所选
- 下单
-
-
\ No newline at end of file
diff --git a/renard-wx/pages/cart/cart.wxss b/renard-wx/pages/cart/cart.wxss
index 18c49db2..eeabbdc8 100644
--- a/renard-wx/pages/cart/cart.wxss
+++ b/renard-wx/pages/cart/cart.wxss
@@ -1,394 +1,394 @@
page {
- height: 100%;
- min-height: 100%;
- background: #f4f4f4;
+ height: 100%;
+ min-height: 100%;
+ background: #f4f4f4;
}
.container {
- background: #f4f4f4;
- width: 100%;
- height: auto;
- min-height: 100%;
- overflow: hidden;
+ background: #f4f4f4;
+ width: 100%;
+ height: auto;
+ min-height: 100%;
+ overflow: hidden;
}
.service-policy {
- width: 750rpx;
- height: 73rpx;
- background: #f4f4f4;
- padding: 0 31.25rpx;
- display: flex;
- flex-flow: row nowrap;
- align-items: center;
- justify-content: space-between;
+ width: 750rpx;
+ height: 73rpx;
+ background: #f4f4f4;
+ padding: 0 31.25rpx;
+ display: flex;
+ flex-flow: row nowrap;
+ align-items: center;
+ justify-content: space-between;
}
.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-size: 10rpx;
- padding-left: 15rpx;
- display: flex;
- align-items: center;
- font-size: 25rpx;
- color: #a78845;
+ /* 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;
+ padding-left: 15rpx;
+ display: flex;
+ align-items: center;
+ font-size: 25rpx;
+ color: #a78845;
}
.no-login {
- width: 100%;
- height: auto;
- margin: 0 auto;
- color: #a78845;
+ width: 100%;
+ height: auto;
+ margin: 0 auto;
+ color: #a78845;
}
.no-login .c {
- width: 100%;
- height: auto;
- margin-top: 200rpx;
- color: #a78845;
+ width: 100%;
+ height: auto;
+ margin-top: 200rpx;
+ color: #a78845;
}
.no-login .c image {
- margin: 0 auto;
- display: block;
- text-align: center;
- width: 258rpx;
- height: 258rpx;
- color: #a78845;
+ margin: 0 auto;
+ display: block;
+ text-align: center;
+ width: 258rpx;
+ height: 258rpx;
+ color: #a78845;
}
.no-login .c text {
- margin: 0 auto;
- display: block;
- width: 258rpx;
- height: 59rpx;
- line-height: 29rpx;
- text-align: center;
- font-size: 40rpx;
- color: #a78845;
+ margin: 0 auto;
+ display: block;
+ width: 258rpx;
+ height: 59rpx;
+ line-height: 29rpx;
+ text-align: center;
+ font-size: 40rpx;
+ color: #a78845;
}
.no-login button {
- width: 60%;
- margin: 0 auto;
- color: #a78845;
- /* background-color: #FFF; */
- border-color: #a78845;
+ width: 60%;
+ margin: 0 auto;
+ color: #a78845;
+ /* background-color: #FFF; */
+ border-color: #a78845;
}
.no-cart {
- width: 100%;
- height: auto;
- margin: 0 auto;
- color: #a78845;
+ width: 100%;
+ height: auto;
+ margin: 0 auto;
+ color: #a78845;
}
.no-cart .c {
- width: 100%;
- height: auto;
- margin-top: 200rpx;
+ width: 100%;
+ height: auto;
+ margin-top: 200rpx;
}
.no-cart .c image {
- margin: 0 auto;
- display: block;
- text-align: center;
- width: 258rpx;
- height: 258rpx;
+ margin: 0 auto;
+ display: block;
+ text-align: center;
+ width: 258rpx;
+ height: 258rpx;
}
.no-cart .c text {
- margin: 0 auto;
- display: block;
- width: 258rpx;
- height: 29rpx;
- line-height: 29rpx;
- text-align: center;
- font-size: 29rpx;
- color: #999;
+ margin: 0 auto;
+ display: block;
+ width: 258rpx;
+ height: 29rpx;
+ line-height: 29rpx;
+ text-align: center;
+ font-size: 29rpx;
+ color: #999;
}
.cart-view {
- width: 100%;
- height: auto;
- overflow: hidden;
+ width: 100%;
+ height: auto;
+ overflow: hidden;
}
.cart-view .list {
- height: auto;
- width: 100%;
- overflow: hidden;
- margin-bottom: 120rpx;
+ height: auto;
+ width: 100%;
+ overflow: hidden;
+ margin-bottom: 120rpx;
}
.cart-view .group-item {
- height: auto;
- width: 100%;
- background: #fff;
- margin-bottom: 18rpx;
+ height: auto;
+ width: 100%;
+ background: #fff;
+ margin-bottom: 18rpx;
}
.cart-view .item {
- height: 164rpx;
- width: 100%;
- overflow: hidden;
+ height: 164rpx;
+ width: 100%;
+ overflow: hidden;
}
.cart-view .item .checkbox {
- float: left;
- height: 34rpx;
- width: 34rpx;
- 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-size: 34rpx;
+ float: left;
+ height: 34rpx;
+ width: 34rpx;
+ 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-size: 34rpx;
}
.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-size: 34rpx;
+ 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;
}
.cart-view .item .cart-goods {
- float: left;
- height: 164rpx;
- width: 672rpx;
- border-bottom: 1px solid #f4f4f4;
+ float: left;
+ height: 164rpx;
+ width: 672rpx;
+ border-bottom: 1px solid #f4f4f4;
}
.cart-view .item .img {
- float: left;
- height: 125rpx;
- width: 125rpx;
- background: #f4f4f4;
- margin: 19.5rpx 18rpx 19.5rpx 0;
+ float: left;
+ height: 125rpx;
+ width: 125rpx;
+ background: #f4f4f4;
+ margin: 19.5rpx 18rpx 19.5rpx 0;
}
.cart-view .item .info {
- float: left;
- height: 125rpx;
- width: 503rpx;
- margin: 19.5rpx 26rpx 19.5rpx 0;
+ float: left;
+ height: 125rpx;
+ width: 503rpx;
+ margin: 19.5rpx 26rpx 19.5rpx 0;
}
.cart-view .item .t {
- margin: 8rpx 0;
- height: 28rpx;
- font-size: 25rpx;
- color: #333;
- overflow: hidden;
+ margin: 8rpx 0;
+ height: 28rpx;
+ font-size: 25rpx;
+ color: #333;
+ overflow: hidden;
}
.cart-view .item .name {
- height: 28rpx;
- max-width: 310rpx;
- line-height: 28rpx;
- font-size: 25rpx;
- color: #333;
- overflow: hidden;
+ height: 28rpx;
+ max-width: 310rpx;
+ line-height: 28rpx;
+ font-size: 25rpx;
+ color: #333;
+ overflow: hidden;
}
.cart-view .item .num {
- height: 28rpx;
- line-height: 28rpx;
- float: right;
+ height: 28rpx;
+ line-height: 28rpx;
+ float: right;
}
.cart-view .item .attr {
- margin-bottom: 17rpx;
- height: 24rpx;
- line-height: 24rpx;
- font-size: 22rpx;
- color: #666;
- overflow: hidden;
+ margin-bottom: 17rpx;
+ height: 24rpx;
+ line-height: 24rpx;
+ font-size: 22rpx;
+ color: #666;
+ overflow: hidden;
}
.cart-view .item .b {
- height: 28rpx;
- line-height: 28rpx;
- font-size: 25rpx;
- color: #333;
- overflow: hidden;
+ height: 28rpx;
+ line-height: 28rpx;
+ font-size: 25rpx;
+ color: #333;
+ overflow: hidden;
}
.cart-view .item .price {
- float: left;
- color: #a78845;
+ float: left;
+ color: #a78845;
}
.cart-view .item .open {
- height: 28rpx;
- width: 150rpx;
- display: block;
- 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-size: 25rpx;
- font-size: 25rpx;
- color: #333;
+ height: 28rpx;
+ width: 150rpx;
+ display: block;
+ 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-size: 25rpx;
+ font-size: 25rpx;
+ color: #333;
}
.cart-view .item.edit .t {
- display: none;
+ display: none;
}
.cart-view .item.edit .attr {
- 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;
- padding-right: 25rpx;
- background-size: 12rpx 20rpx;
- margin-bottom: 24rpx;
- height: 39rpx;
- line-height: 39rpx;
- font-size: 24rpx;
- color: #999;
- overflow: hidden;
+ 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;
+ padding-right: 25rpx;
+ background-size: 12rpx 20rpx;
+ margin-bottom: 24rpx;
+ height: 39rpx;
+ line-height: 39rpx;
+ font-size: 24rpx;
+ color: #999;
+ overflow: hidden;
}
.cart-view .item.edit .b {
- display: flex;
- height: 52rpx;
- overflow: hidden;
+ display: flex;
+ height: 52rpx;
+ overflow: hidden;
}
.cart-view .item.edit .price {
- line-height: 52rpx;
- height: 52rpx;
- flex: 1;
+ line-height: 52rpx;
+ height: 52rpx;
+ flex: 1;
}
.cart-view .item .selnum {
- display: none;
+ display: none;
}
.cart-view .item.edit .selnum {
- width: 235rpx;
- height: 52rpx;
- border: 1rpx solid #ccc;
- display: flex;
+ width: 235rpx;
+ height: 52rpx;
+ border: 1rpx solid #ccc;
+ display: flex;
}
.selnum .cut {
- width: 70rpx;
- height: 100%;
- text-align: center;
- line-height: 50rpx;
+ width: 70rpx;
+ height: 100%;
+ text-align: center;
+ line-height: 50rpx;
}
.selnum .number {
- flex: 1;
- height: 100%;
- text-align: center;
- line-height: 68.75rpx;
- border-left: 1px solid #ccc;
- border-right: 1px solid #ccc;
- float: left;
+ flex: 1;
+ height: 100%;
+ text-align: center;
+ line-height: 68.75rpx;
+ border-left: 1px solid #ccc;
+ border-right: 1px solid #ccc;
+ float: left;
}
.selnum .add {
- width: 80rpx;
- height: 100%;
- text-align: center;
- line-height: 50rpx;
+ width: 80rpx;
+ height: 100%;
+ text-align: center;
+ line-height: 50rpx;
}
.cart-view .group-item .header {
- width: 100%;
- height: 94rpx;
- line-height: 94rpx;
- padding: 0 26rpx;
- border-bottom: 1px solid #f4f4f4;
+ width: 100%;
+ height: 94rpx;
+ line-height: 94rpx;
+ padding: 0 26rpx;
+ border-bottom: 1px solid #f4f4f4;
}
.cart-view .promotion .icon {
- display: inline-block;
- height: 24rpx;
- width: 15rpx;
+ display: inline-block;
+ height: 24rpx;
+ width: 15rpx;
}
.cart-view .promotion {
- margin-top: 25.5rpx;
- float: left;
- height: 43rpx;
- width: 480rpx;
- /*margin-right: 84rpx;*/
- line-height: 43rpx;
- font-size: 0;
+ margin-top: 25.5rpx;
+ float: left;
+ height: 43rpx;
+ width: 480rpx;
+ /*margin-right: 84rpx;*/
+ line-height: 43rpx;
+ font-size: 0;
}
.cart-view .promotion .tag {
- border: 1px solid #f48f18;
- height: 37rpx;
- line-height: 31rpx;
- padding: 0 9rpx;
- margin-right: 10rpx;
- color: #f48f18;
- font-size: 24.5rpx;
+ border: 1px solid #f48f18;
+ height: 37rpx;
+ line-height: 31rpx;
+ padding: 0 9rpx;
+ margin-right: 10rpx;
+ color: #f48f18;
+ font-size: 24.5rpx;
}
.cart-view .promotion .txt {
- height: 43rpx;
- line-height: 43rpx;
- padding-right: 10rpx;
- color: #333;
- font-size: 29rpx;
- overflow: hidden;
+ height: 43rpx;
+ line-height: 43rpx;
+ padding-right: 10rpx;
+ color: #333;
+ font-size: 29rpx;
+ overflow: hidden;
}
.cart-view .get {
- margin-top: 18rpx;
- float: right;
- height: 58rpx;
- padding-left: 14rpx;
- border-left: 1px solid #d9d9d9;
- line-height: 58rpx;
- font-size: 29rpx;
- color: #333;
+ margin-top: 18rpx;
+ float: right;
+ height: 58rpx;
+ padding-left: 14rpx;
+ border-left: 1px solid #d9d9d9;
+ line-height: 58rpx;
+ font-size: 29rpx;
+ color: #333;
}
.cart-bottom {
- position: fixed;
- bottom: 0;
- left: 0;
- height: 100rpx;
- width: 100%;
- background: #fff;
- display: flex;
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ height: 100rpx;
+ width: 100%;
+ background: #fff;
+ display: flex;
}
.cart-bottom .checkbox {
- height: 34rpx;
- padding-left: 60rpx;
- line-height: 34rpx;
- 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-size: 34rpx;
- font-size: 29rpx;
+ height: 34rpx;
+ padding-left: 60rpx;
+ line-height: 34rpx;
+ 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-size: 34rpx;
+ font-size: 29rpx;
}
.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-size: 34rpx;
+ 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;
}
.cart-bottom .total {
- height: 34rpx;
- flex: 1;
- margin: 33rpx 10rpx;
- font-size: 29rpx;
- color: #a78845;
+ height: 34rpx;
+ flex: 1;
+ margin: 33rpx 10rpx;
+ font-size: 29rpx;
+ color: #a78845;
}
.cart-bottom .delete {
- height: 34rpx;
- width: auto;
- margin: 33rpx 18rpx;
- font-size: 29rpx;
+ height: 34rpx;
+ width: auto;
+ margin: 33rpx 18rpx;
+ font-size: 29rpx;
}
.cart-bottom .checkout {
- height: 100rpx;
- width: 210rpx;
- text-align: center;
- line-height: 100rpx;
- font-size: 29rpx;
- background: #a78845;
- color: #fff;
+ height: 100rpx;
+ width: 210rpx;
+ text-align: center;
+ line-height: 100rpx;
+ font-size: 29rpx;
+ background: #a78845;
+ color: #fff;
}
diff --git a/renard-wx/pages/catalog/catalog.js b/renard-wx/pages/catalog/catalog.js
index eaa27a74..352913c1 100644
--- a/renard-wx/pages/catalog/catalog.js
+++ b/renard-wx/pages/catalog/catalog.js
@@ -2,81 +2,81 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
- data: {
- categoryList: [],
- currentCategory: {},
- currentSubCategoryList: {},
- allList: {},
- scrollLeft: 0,
- scrollTop: 0,
- goodsCount: 0,
- scrollHeight: 0
- },
- onLoad: function(options) {
- this.getCatalog();
- },
+ data: {
+ categoryList: [],
+ currentCategory: {},
+ currentSubCategoryList: {},
+ allList: {},
+ scrollLeft: 0,
+ scrollTop: 0,
+ goodsCount: 0,
+ scrollHeight: 0
+ },
+ onLoad: function(options) {
+ this.getCatalog();
+ },
- onPullDownRefresh() {
- wx.showNavigationBarLoading() //在标题栏中显示加载
- this.getCatalog();
- wx.hideNavigationBarLoading() //完成停止加载
- wx.stopPullDownRefresh() //停止下拉刷新
- },
+ onPullDownRefresh() {
+ wx.showNavigationBarLoading() //在标题栏中显示加载
+ this.getCatalog();
+ wx.hideNavigationBarLoading() //完成停止加载
+ wx.stopPullDownRefresh() //停止下拉刷新
+ },
- getCatalog: function() {
- //CatalogList
- let that = this;
- wx.showLoading({
- 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]
+ getCatalog: function() {
+ //CatalogList
+ let that = this;
+ wx.showLoading({
+ title: '加载中...',
});
- }
- }
- },
- onReady: function() {
- // 页面渲染完成
- },
- onShow: function() {
- // 页面显示
- },
- onHide: function() {
- // 页面隐藏
- },
- onUnload: function() {
- // 页面关闭
- },
+ 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
+ });
- 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
- })
- }
+ 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]
+ });
+ }
+ }
+ },
+ 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
+ })
+ }
})
\ No newline at end of file
diff --git a/renard-wx/pages/catalog/catalog.wxss b/renard-wx/pages/catalog/catalog.wxss
index 1bf96a0b..bf57abfd 100644
--- a/renard-wx/pages/catalog/catalog.wxss
+++ b/renard-wx/pages/catalog/catalog.wxss
@@ -1,59 +1,67 @@
-.HotName{
- font-size:80rpx;
- margin-left:40rpx;
- color:#293539;
- font-weight:300;
+.HotName {
+ font-size: 80rpx;
+ margin-left: 40rpx;
+ color: #293539;
+ font-weight: 300;
position: relative;
}
-.HotName text{
- width:14rpx;
- height:14rpx;
- position:absolute;
- border:2px solid #a78845;
- border-radius:50%;
+
+.HotName text {
+ width: 14rpx;
+ height: 14rpx;
+ position: absolute;
+ border: 2px solid #a78845;
+ border-radius: 50%;
}
-.menu-box{
- width:80%;
- margin:0 auto;
- margin-top:40rpx;
+
+.menu-box {
+ width: 80%;
+ margin: 0 auto;
+ margin-top: 40rpx;
}
-.menu-box-list{
- text-align:center;
- margin-bottom:30rpx;
+
+.menu-box-list {
+ text-align: center;
+ margin-bottom: 30rpx;
}
-.menu-box-list .menu-list-title{
- color:#6a7275;
- font-size:40rpx;
- font-weight:300;
- letter-spacing:20rpx;
+
+.menu-box-list .menu-list-title {
+ color: #6a7275;
+ font-size: 40rpx;
+ font-weight: 300;
+ letter-spacing: 20rpx;
position: relative;
}
-.menu-box-list .hover{
- color:#a78845;
+
+.menu-box-list .hover {
+ color: #a78845;
}
-.menu-box-list .hover .l{
- width:10rpx;
- height:10rpx;
- position:absolute;
- border:2rpx solid #a78845;
- border-radius:50%;
- margin-left:-38rpx;
- margin-top:30rpx;
+
+.menu-box-list .hover .l {
+ width: 10rpx;
+ height: 10rpx;
+ position: absolute;
+ border: 2rpx solid #a78845;
+ border-radius: 50%;
+ margin-left: -38rpx;
+ margin-top: 30rpx;
}
-.menu-box-list .hover .r{
- width:10rpx;
- height:10rpx;
- position:absolute;
- border:2rpx solid #a78845;
- border-radius:50%;
- margin-left:6rpx;
- margin-top:30rpx;
+
+.menu-box-list .hover .r {
+ width: 10rpx;
+ height: 10rpx;
+ position: absolute;
+ border: 2rpx solid #a78845;
+ border-radius: 50%;
+ margin-left: 6rpx;
+ margin-top: 30rpx;
}
-.menu-list-pro{
+
+.menu-list-pro {
overflow-x: scroll;
margin-top: 40rpx;
- white-space:nowrap;
- text-overflow:ellipsis;
+ white-space: nowrap;
+ text-overflow: ellipsis;
height: auto;
width: 100%;
overflow: hidden;
@@ -70,8 +78,8 @@
.menu-list-pro .icon {
height: 100rpx;
width: 100rpx;
- border-radius:12rpx;
- box-shadow:0px 4rpx 4rpx 0px #cfc9ca;
+ border-radius: 12rpx;
+ box-shadow: 0px 4rpx 4rpx 0px #cfc9ca;
}
.menu-list-pro .txt {
@@ -115,7 +123,7 @@
font-size: 30rpx;
}
- /* .menu-list-pro image{
+/* .menu-list-pro image{
height: 80px;
width: 80px;
margin-right: 34rpx;
@@ -132,4 +140,4 @@
color: #333;
height: 42rpx;
width: 80px;
-} */
\ No newline at end of file
+} */
diff --git a/renard-wx/pages/category/category.js b/renard-wx/pages/category/category.js
index c4953880..bf26877a 100644
--- a/renard-wx/pages/category/category.js
+++ b/renard-wx/pages/category/category.js
@@ -2,139 +2,139 @@ var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
- data: {
- navList: [],
- goodsList: [],
- id: 0,
- currentCategory: {},
- scrollLeft: 0,
- scrollTop: 0,
- scrollHeight: 0,
- page: 1,
- size: 100
- },
+ data: {
+ navList: [],
+ goodsList: [],
+ id: 0,
+ currentCategory: {},
+ scrollLeft: 0,
+ scrollTop: 0,
+ scrollHeight: 0,
+ page: 1,
+ size: 100
+ },
- onLoad: function(options) {
- // 页面初始化 options为页面跳转所带来的参数
- var that = this;
- 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) {
+ onLoad: function(options) {
+ // 页面初始化 options为页面跳转所带来的参数
+ var that = this;
+ if (options.id) {
that.setData({
- scrollLeft: currentIndex * 60
+ id: parseInt(options.id)
});
- }
-
- 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.getSystemInfo({
+ success: function(res) {
+ that.setData({
+ scrollHeight: res.windowHeight
+ });
+ }
});
- 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();
+ }
})
\ No newline at end of file
diff --git a/renard-wx/pages/category/category.json b/renard-wx/pages/category/category.json
index 505097e6..760102a4 100644
--- a/renard-wx/pages/category/category.json
+++ b/renard-wx/pages/category/category.json
@@ -1,5 +1,5 @@
{
- "usingComponents": {
- "goodList": "/components/goodList/goodList"
- }
+ "usingComponents": {
+ "goodList": "/components/goodList/goodList"
+ }
}
\ No newline at end of file
diff --git a/renard-wx/pages/category/category.wxml b/renard-wx/pages/category/category.wxml
index 19d847f5..8660d796 100644
--- a/renard-wx/pages/category/category.wxml
+++ b/renard-wx/pages/category/category.wxml
@@ -1,19 +1,19 @@
-
-
-
- {{item.name}}
-
-
-
-
-
-
-
- {{currentCategory.name}}
- {{currentCategory.frontName}}
-
-
+
+
+
+ {{item.name}}
+
+
-
+
+
+
+
+ {{currentCategory.name}}
+ {{currentCategory.frontName}}
+
+
+
+
\ No newline at end of file
diff --git a/renard-wx/pages/category/category.wxss b/renard-wx/pages/category/category.wxss
index e749cb75..afe0da15 100644
--- a/renard-wx/pages/category/category.wxss
+++ b/renard-wx/pages/category/category.wxss
@@ -1,69 +1,70 @@
-.container{
- background: #fff;
-}
-.cate-nav{
- position: fixed;
- left:0;
- top:0;
- z-index: 1000;
+.container {
+ background: #fff;
}
-.cate-nav-body{
- height: 84rpx;
- white-space: nowrap;
- background: #fff;
- border-top: 1px solid rgba(0,0,0,.15);
- overflow: hidden;
+.cate-nav {
+ position: fixed;
+ left: 0;
+ top: 0;
+ z-index: 1000;
}
-.cate-nav .item{
- display: inline-block;
- height: 84rpx;
- min-width: 130rpx;
- padding: 0 15rpx;
+.cate-nav-body {
+ height: 84rpx;
+ white-space: nowrap;
+ background: #fff;
+ border-top: 1px solid rgba(0, 0, 0, 0.15);
+ overflow: hidden;
}
-.cate-nav .item .name{
- display: block;
- height: 84rpx;
- padding: 0 20rpx;
- line-height: 84rpx;
- color: #333;
- font-size: 30rpx;
- width: auto;
+.cate-nav .item {
+ display: inline-block;
+ height: 84rpx;
+ min-width: 130rpx;
+ padding: 0 15rpx;
}
-.cate-nav .item.active .name{
- color: #a78845;
- border-bottom: 2px solid #a78845;
+.cate-nav .item .name {
+ display: block;
+ height: 84rpx;
+ padding: 0 20rpx;
+ line-height: 84rpx;
+ color: #333;
+ font-size: 30rpx;
+ width: auto;
}
-.cate-item{
- margin-top: 94rpx;
- height: auto;
- overflow: hidden;
+.cate-nav .item.active .name {
+ color: #a78845;
+ border-bottom: 2px solid #a78845;
}
-.cate-item .h{
- height: 145rpx;
- width: 750rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
+.cate-item {
+ margin-top: 94rpx;
+ height: auto;
+ overflow: hidden;
}
-.cate-item .h .name{
- display: block;
- height: 35rpx;
- margin-bottom: 18rpx;
- font-size: 30rpx;
- color: #333;
+.cate-item .h {
+ height: 145rpx;
+ width: 750rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
}
-.cate-item .h .desc{
- display: block;
- height: 24rpx;
- font-size: 24rpx;
- color: #999;
-}
\ No newline at end of file
+.cate-item .h .name {
+ display: block;
+ height: 35rpx;
+ margin-bottom: 18rpx;
+ font-size: 30rpx;
+ color: #333;
+}
+
+.cate-item .h .desc {
+ display: block;
+ height: 24rpx;
+ font-size: 24rpx;
+ color: #999;
+}
diff --git a/renard-wx/pages/comment/comment.js b/renard-wx/pages/comment/comment.js
index a0f2d019..688eb4f2 100644
--- a/renard-wx/pages/comment/comment.js
+++ b/renard-wx/pages/comment/comment.js
@@ -16,9 +16,12 @@ Page({
picPage: 1,
size: 20
},
- getCommentCount: function () {
+ getCommentCount: function() {
let that = this;
- util.request(api.CommentCount, { valueId: that.data.valueId, type: that.data.type}).then(function (res) {
+ util.request(api.CommentCount, {
+ valueId: that.data.valueId,
+ type: that.data.type
+ }).then(function(res) {
if (res.errno === 0) {
that.setData({
allCount: res.data.allCount,
@@ -27,15 +30,15 @@ Page({
}
});
},
- getCommentList: function(){
+ getCommentList: function() {
let that = this;
- util.request(api.CommentList, {
- valueId: that.data.valueId,
+ util.request(api.CommentList, {
+ valueId: that.data.valueId,
type: that.data.type,
size: that.data.size,
page: (that.data.showType == 0 ? that.data.allPage : that.data.picPage),
- showType: that.data.showType
- }).then(function (res) {
+ showType: that.data.showType
+ }).then(function(res) {
if (res.errno === 0) {
if (that.data.showType == 0) {
@@ -54,7 +57,7 @@ Page({
}
});
},
- onLoad: function (options) {
+ onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
type: options.type,
@@ -63,23 +66,23 @@ Page({
this.getCommentCount();
this.getCommentList();
},
- onReady: function () {
+ onReady: function() {
// 页面渲染完成
},
- onShow: function () {
+ onShow: function() {
// 页面显示
},
- onHide: function () {
+ onHide: function() {
// 页面隐藏
},
- onUnload: function () {
+ onUnload: function() {
// 页面关闭
},
- switchTab: function () {
+ switchTab: function() {
let that = this;
if (that.data.showType == 0) {
that.setData({
@@ -98,16 +101,16 @@ Page({
}
this.getCommentList();
},
- onReachBottom: function(){
+ onReachBottom: function() {
console.log('onPullDownRefresh');
- if ( this.data.showType == 0) {
+ if (this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) {
return false;
}
this.setData({
- 'allPage' : this.data.allPage + 1
+ 'allPage': this.data.allPage + 1
});
} else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) {
diff --git a/renard-wx/pages/comment/comment.wxml b/renard-wx/pages/comment/comment.wxml
index 8e4a8464..dfc28bb9 100644
--- a/renard-wx/pages/comment/comment.wxml
+++ b/renard-wx/pages/comment/comment.wxml
@@ -1,12 +1,12 @@