拆单小程序优化

This commit is contained in:
chenbo 2019-11-30 20:01:25 +08:00
parent ffc626d881
commit 55f2322ab0
281 changed files with 28188 additions and 1 deletions

View File

@ -1,7 +1,8 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2019 DTS-SHOP qiguliuxing<623659388@qq.com>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

31
wx-mini-program/app.js Normal file
View File

@ -0,0 +1,31 @@
var util = require('./utils/util.js');
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
}
})

99
wx-mini-program/app.json Normal file
View File

@ -0,0 +1,99 @@
{
"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/feedback/feedback",
"pages/ucenter/footprint/footprint",
"pages/ucenter/order/order",
"pages/ucenter/orderDetail/orderDetail",
"pages/ucenter/couponList/couponList",
"pages/ucenter/couponSelect/couponSelect",
"pages/ucenter/collect/collect",
"pages/ucenter/user/user",
"pages/auth/login/login",
"pages/auth/accountLogin/accountLogin",
"pages/auth/register/register",
"pages/auth/reset/reset",
"pages/payResult/payResult",
"pages/comment/comment",
"pages/logs/logs",
"pages/commentPost/commentPost",
"pages/topic/topic",
"pages/topicComment/topicComment",
"pages/topicDetail/topicDetail",
"pages/topicCommentPost/topicCommentPost",
"pages/brand/brand",
"pages/brandDetail/brandDetail",
"pages/search/search",
"pages/category/category",
"pages/cart/cart",
"pages/checkout/checkout",
"pages/goods/goods",
"pages/about/about",
"pages/groupon/myGroupon/myGroupon",
"pages/groupon/grouponDetail/grouponDetail",
"pages/groupon/grouponList/grouponList",
"pages/coupon/coupon",
"pages/brokerage/main/main",
"pages/brokerage/order/order",
"pages/brokerage/record/record",
"pages/brokerage/withdrawal/withdrawal",
"pages/ucenter/expressInfo/expressInfo",
"pages/article/article",
"lib/coupon-window/index",
"lib/home/index"
],
"window": {
"navigationBarBackgroundColor": "#85c43f",
"navigationBarTitleText": "聚惠星",
"enablePullDownRefresh": true,
"navigationBarTextStyle": "white",
"backgroundColor": "#FFFFFF",
"backgroundTextStyle": "dark"
},
"tabBar": {
"backgroundColor": "#fafafa",
"borderStyle": "white",
"selectedColor": "#85c43f",
"color": "#666",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/images/home.png",
"selectedIconPath": "static/images/home@selected.png",
"text": "首页"
},
{
"pagePath": "pages/catalog/catalog",
"iconPath": "static/images/category.png",
"selectedIconPath": "static/images/category@selected.png",
"text": "分类"
},
{
"pagePath": "pages/cart/cart",
"iconPath": "static/images/cart.png",
"selectedIconPath": "static/images/cart@selected.png",
"text": "购物车"
},
{
"pagePath": "pages/ucenter/index/index",
"iconPath": "static/images/my.png",
"selectedIconPath": "static/images/my@selected.png",
"text": "我的"
}
]
},
"networkTimeout": {
"request": 10000,
"connectSocket": 10000,
"uploadFile": 10000,
"downloadFile": 10000
},
"debug": true,
"sitemapLocation": "sitemap.json"
}

83
wx-mini-program/app.wxss Normal file
View File

@ -0,0 +1,83 @@
/**app.wxss**/
@import '/static/font/iconfont.wxss';
@import '/static/css/style.wxss';
@import '/static/css/animate.wxss';
.container {
box-sizing: border-box;
background-color: #f4f4f4;
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: #333;
}
.start{width: 122rpx; height: 30rpx;background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAADMCAYAAAC8yreMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4BpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpDMDg0NEE2QTVFNUQxMUU4QUI3RkNGOTgwNDYyRUZDOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozODU5QzVENDMwRjcxMUU5OTQ0QzlEOTQ5RkE1MTlBRiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozODU5QzVEMzMwRjcxMUU5OTQ0QzlEOTQ5RkE1MTlBRiIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpkN2ZhZTM5NC0wNmE4LTkzNGYtODA0OS0zNjBjNTcxOTU2YjAiIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpmYWI1M2NhMC04MWE1LTE5NGItYmJlYi1jMzI2MjIwNmNhOTYiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4ctYL1AAAHsElEQVR42uycS4gcVRiFq5Mm4yuKihoVlKg7IVlkI4oGFV9R4wPSJChBMW5ECYooKuIbEReCBBGJEDS+BkVJYEIMJgvJIossFATxCW58boRJEDEZz83cDk3TXc/7T9Xt+g783O7p6tP/9Km6dbvp+jpzc3MJmnwt4i0gaETQiKBRM+UWY8OVpt9XXXySakcZ34Xwp/fR3mWO6LWqW/Wilxnte5b+re29TNB3+fEeozfL0r+1vXdGTRmdTmfc9HGGG1Rd1d+qZecc/PGfcVPI2Bc19Kf3uSBHdM+/mNNpqtsD77WW/q3uvTtmDzpPw9kDxm5XW6q6b2jTB7XtrEZXc35vc/rNV7LQ/vQ+2rs75v/Zproux45yhWrniL/vUq1JeZ6lP70XmLpvVr1SYoo5qnrBrQ4ztrP0p/eiizFND9dreHdgOknTr25lqEXCvrwLGgt/ei+xGNOTP9ewUrUn48XclLGi/2J5ZelP7wVX3TJxJ/f3Mjbbpu3+KrOctPSn9+Ifr9ZWfLxOf3rPE7TOF1Mabhg68e/yy/q+1mi7bpn/xNKf3osd0deqTva3f1ZdpenCLeFXq37wfz9ddWXJvdbSn94LBH2bH9/2J/79/hzypV8wvD60XVFZ+tN7xhcmgzrRnQv0AjtHLBgOa9is6eOzCm+WpT+9p32ORpMnfmFC0IigEUEjgkYEjQgaETQiaETQBI0IGhE0ImhE0IigEUGj8oIaEEfvTtPT0ytVF5bxh3gQl/9TqkcWauqGeFCDv47kM5P5y2PP1+0lpkH7K+9v9HfX6/4JIf8ZS/+Ye/dap/pI5U4Nt1gf0RAP6vO/WrVX9YnqjqJPhnjQoN5Tpu0LNPzS6/XcZTmHdH9WdZbu/1kp6ARqQC29Kzw39d+rOqL6V7XY33Y/5n9pYNOtqpdd4BqX+G3dNqck81dgzuQN2l15766gf7zgDHHUN/RcxnaW/jH3fkC1QbVbR+v7Y88Rvd5BDZsGdhA3qzykWqXaP+o5EA8a2LuCe0DDparHFOqhHKvxLaovtO3Wcf4QDxrYuwJ7Q8Nbqu0KckVKyO5Kyu2qF/shl151Qw2ox1/BfaXhbtVrKZs9r7pT234T6uMV1IB6/N3F8N+mPP6dX7BV/xwNNaA+f786n+kvuFT3qzYMPL5n4Euaykc01ID6/N3HuL0K91yNH/odaKnuu3P3Mt1264SbQgUNNaAGfwU55fNxX3e+qXrCLbhUbpH2tF9pO4Dcqdp2cYig+1feb1LNDi1GDqs26+Y1Fc5Dlv4x977azwSX+AXXTwMLNTd7rPOzhfti5vIsM4gHDdIgxllH6XJ3tPrVd9qRf5GGWW33R/9vI78bIeh2iJ8SETQiaETQiKARQSOCRgSNCBoRNEEjgkYEjQgaETQiaETQiKARQSMnYDXheneqApSx9AZWE16lgTKW3sBqAqoqUMbSG1hNWFUCylh6A6sJq0pAGUtvYDUBYDJ+aq0MlLH0BlZTsHdLoAywmmL+1r2bAWUSYDX5/ReqdwugjKl32gv6N8xdcP1OxnTopruNg6yOPG+Whf9C9u6+wNDwrOoZvclfjwnCXfr6pOrRQdZI1vse2htYTYXeQwNlLL2B1VTvPRhQxtIbWE01mEySBATKWHoDq6nWe5IEBMpYegOrqdB7aKCMpTewmmq9BwXKWHrDMCkoU6AMsBpUVfyUiKARQSOCRgSNCBoRNCJoRNCIoAkaETQiaETQiKARQSOCRgSNMtQmholTFQ4IDJOwsva3ZIxY+8MwySNLxoi1PwyTYrJkjFj7wzApIEvGiLU/DJOcU58ZY8TaH4bJ6DfFjANi7Q/DpJi/JWPE2h+GSVKQYWLBAbH2h2FSkmESmgNi7Q/DpKS/JWPE2h+GSXFZMkas/YN5Z7I7xnBAdvsvNvpzzTEOiI66/0p8SWLqnwxxQPwixl1P/IF/vM8B+bhkGJb+wbwnnWGSJLaMEWt/GCY5v2gwY4xY+8MwKSZLxoi1PwyT1H/IkANi7Q/DBFUWPyUiaETQiKARQSOCRgSNCBoRNCJogkYEjQgaETQiaETQiKARQaMMNY1h4tRUDggMk/BqJAck5t4bxzBpMgck5t4bxTDxaiwHJObem8YwcWosByTm3mthmKRMT43mgMTcey0Mk1g5IDH3XhfDJEoOSMy918owiY0DEnPvtTNMYuKAxNx77QyTmDggMffeFIZJFByQmHuvnWHSf34SAQck5t6bwDBJkkg4IDH3XjvDJCYOSMy9N4FhEg0HJObeR56jh5bnGxM/Z6TIfXbeVxKS8b2bDcaxOvR3Z7tFe+2M/6q1Kd5R9Q7DpCXip0QEjQgaETQiaETQiKARQSOCRgRN0IigEUEjgkYEjQgamQhqQDt6L3tEt5IaEHPvhYNuMzUg5t7LHNGtpQbE3HuZoFtLDYi590UFp4/jV977yzmPXXkfcHoy8297790xxlADWkI8gBowYb13oAZAPDj+IT2BGhB975mLMagBk9F73lU31IDIe+/mfEGoAZH3nveIhhoQee95FmNT/nPbDn/OeLh/UbYeW67hVdWnyTwXdL0eO1JwQRPUn95LLsYSqAET0XueczTUgAnoHeJBS8RPiQgaETQiaNRM/S/AAOykxVBJG5QXAAAAAElFTkSuQmCC');background-repeat: no-repeat; background-size: 122rpx auto;}
.start.star5{background-position: 0 3rpx;}
.start.star4{background-position: 0 -30rpx;}
.start.star3{background-position: 0 -70rpx;}
.start.star2{background-position: 0 -105rpx;}
.start.star1{background-position: 0 -140rpx;}
.start.star0{background-position: 0 -175rpx;}
page{font-size:28rpx;background-color: #f5f5f5; color: #333;}
view{box-sizing:border-box;}
.acea-row{display:flex;flex-wrap:wrap;}
.acea-row.row-top{align-items:flex-start;}
.acea-row.row-middle{align-items:center;}
.acea-row.row-bottom{align-items:flex-end;}
.acea-row.row-left{justify-content:flex-start;}
.acea-row.row-center{justify-content:center;}
.acea-row.row-right{justify-content:flex-end;}
.acea-row.row-between{justify-content:space-between;}
.acea-row.row-around{justify-content:space-around;}
.acea-row.row-column{flex-direction:column;}
.acea-row.row-column-between{flex-direction:column;justify-content:space-between;}
.acea-row.row-column-around{flex-direction:column;justify-content:space-around;}
.acea-row.row-center-wrapper{align-items:center;justify-content:center;}
.acea-row.row-between-wrapper{align-items:center;justify-content:space-between;}
.font-color{color:#fc4141!important;}
.bg-color{background-color:#85c43f!important;}
.icon-color{color:#85c43f;}
.cart-color{color:#85c43f!important;border:1px solid #85c43f!important;}
/* 单选 */
radio .wx-radio-input{border-radius:50%;width:38rpx;height:38rpx;}
radio .wx-radio-input.wx-radio-input-checked{border: 1px solid #e93323 !important;
background-color: #e93323 !important;}
/* 多选 */
checkbox .wx-checkbox-input{border-radius:50%;width:38rpx;height:38rpx;}
checkbox .wx-checkbox-input.wx-checkbox-input-checked{
border: 1px solid #e93323 !important;background-color: #e93323 !important;color:#fff!important;}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {font-size:35rpx;}
.line1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.line2{word-break:break-all;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.mask{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:0.5;z-index:5;}
button{padding:0;margin:0;line-height:normal;background-color:#fff;}
button::after{border:0;}
@keyframes load
{
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
.loadingpic {
animation: load 3s linear 1s infinite;
}
.loading-list {
animation: load linear 1s infinite;
font-size:40rpx;margin-right:22rpx;
}
.loading{width:100%;height:100rpx;line-height:100rpx;align-items:center;justify-content:center;position: relative;text-align:center;}
.loading .line{position: absolute;width: 450rpx;left: 150rpx;top: 50rpx;height: 1px;border-top:1px solid #eee ;}
.loading .text{position: relative;display: inline-block;padding: 0 20rpx;background: #fff;z-index: 2;color: #777;}
.loadingicon .loading {animation: load linear 1s infinite;font-size:45rpx;color:#000;}
.loadingicon{width:100%;height:80rpx;}

View File

@ -0,0 +1,104 @@
// 以下是业务服务器API地址
// 本机开发API地址
var WxApiRoot = 'http://localhost:8070/wx/';
// 测试环境部署api地址
// var WxApiRoot = 'http://192.168.0.101:8070/wx/';
// 线上云平台api地址
//var WxApiRoot = 'https://www.dtsshop.com/wx/';
module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口
CatalogList: WxApiRoot + 'catalog/index', //分类目录全部分类数据接口
CatalogCurrent: WxApiRoot + 'catalog/current', //分类目录当前分类数据接口
AuthLoginByWeixin: WxApiRoot + 'auth/login_by_weixin', //微信登录
AuthLoginByAccount: WxApiRoot + 'auth/login', //账号登录
AuthLogout: WxApiRoot + 'auth/logout', //账号登出
AuthRegister: WxApiRoot + 'auth/register', //账号注册
AuthReset: WxApiRoot + 'auth/reset', //账号密码重置
AuthRegisterCaptcha: WxApiRoot + 'auth/regCaptcha', //验证码
AuthBindPhone: WxApiRoot + 'auth/bindPhone', //绑定微信手机号
GoodsCount: WxApiRoot + 'goods/count', //统计商品总数
GoodsList: WxApiRoot + 'goods/list', //获得商品列表
GoodsCategory: WxApiRoot + 'goods/category', //获得分类数据
GoodsDetail: WxApiRoot + 'goods/detail', //获得商品的详情
GoodsRelated: WxApiRoot + 'goods/related', //商品详情页的关联商品(大家都在看)
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', // 下单前信息确认
CollectList: WxApiRoot + 'collect/list', //收藏列表
CollectAddOrDelete: WxApiRoot + 'collect/addordelete', //添加或取消收藏
CommentList: WxApiRoot + 'comment/list', //评论列表
CommentCount: WxApiRoot + 'comment/count', //评论总数
CommentPost: WxApiRoot + 'comment/post', //发表评论
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', //搜索历史清楚
AddressList: WxApiRoot + 'address/list', //收货地址列表
AddressDetail: WxApiRoot + 'address/detail', //收货地址详情
AddressSave: WxApiRoot + 'address/save', //保存收货地址
AddressDelete: WxApiRoot + 'address/delete', //保存收货地址
ExpressQuery: WxApiRoot + 'express/query', //物流查询
RegionList: WxApiRoot + 'region/list', //获取区域列表
OrderSubmit: WxApiRoot + 'order/submit', // 提交订单
OrderPrepay: WxApiRoot + 'order/prepay', // 订单的预支付会话
OrderList: WxApiRoot + 'order/list', //订单列表
OrderDetail: WxApiRoot + 'order/detail', //订单详情
ExpressTrace: WxApiRoot + 'order/expressTrace', //订单物流
OrderCancel: WxApiRoot + 'order/cancel', //取消订单
OrderRefund: WxApiRoot + 'order/refund', //退款取消订单
OrderDelete: WxApiRoot + 'order/delete', //删除订单
OrderConfirm: WxApiRoot + 'order/confirm', //确认收货
OrderGoods: WxApiRoot + 'order/goods', // 代评价商品信息
OrderComment: WxApiRoot + 'order/comment', // 评价订单商品信息
FeedbackAdd: WxApiRoot + 'feedback/submit', //添加反馈
FootprintList: WxApiRoot + 'footprint/list', //足迹列表
FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
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-详情
CouponList: WxApiRoot + 'coupon/list', //优惠券列表
CouponMyList: WxApiRoot + 'coupon/mylist', //我的优惠券列表
CouponSelectList: WxApiRoot + 'coupon/selectlist', //当前订单可用优惠券列表
CouponReceive: WxApiRoot + 'coupon/receive', //优惠券领取
CouponReceiveAll: WxApiRoot + 'coupon/receiveAll', //优惠券领取
CouponExchange: WxApiRoot + 'coupon/exchange', //优惠券兑换
GetUserCoupon:WxApiRoot + 'coupon/getUserCoupon',//用户个人可领取优惠券查询
StorageUpload: WxApiRoot + 'storage/upload', //图片上传,
UserIndex: WxApiRoot + 'user/index', //个人页面用户相关信息
BrokerageMain: WxApiRoot + 'brokerage/main',//佣金收益主页面
SettleOrderList: WxApiRoot + 'brokerage/settleOrderList',//佣金收益主页面
ExtractList: WxApiRoot + 'brokerage/extractList',//佣金账号提现记录
ArticleDetail: WxApiRoot + 'article/detail' //公告详情
};

View File

@ -0,0 +1,48 @@
const util = require('../../utils/util.js');
const api = require('../../config/api.js');
const user = require('../../utils/user.js');
var app = getApp();
Component({
properties: {
window:{
type: Boolean,
value: true,
},
couponList:{
type:Array,
value:[],
}
},
data: {
},
attached: function () {
},
methods: {
close:function(){
this.triggerEvent('onColse');
},
getAllCoupon: function () {
if (!app.globalData.hasLogin) {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
util.request(api.CouponReceiveAll, null, 'POST').then(res => {
if (res.errno === 0) {
wx.showToast({
title: "领取成功"
});
this.triggerEvent('onColse');
}
else {
util.showErrorToast(res.errmsg);
}
})
},
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,17 @@
<view class='coupon-window {{window==true?"on":""}}'>
<view class='couponWinList'>
<view class='item acea-row row-between-wrapper' wx:for="{{couponList}}" wx:key>
<view class='money font-color'>¥<text class='num'>{{item.discount}}</text></view>
<view class='text'>
<view class='name'>【{{item.desc}}】购物买{{item.min}}减{{item.discount}}</view>
<view wx:if="{{item.days != 0}}">有效期:{{item.days}}天</view>
<view wx:else>{{item.startTime}}-{{item.endTime}}</view>
</view>
</view>
</view>
<view class='lid'>
<view hover-class='none' bindtap='getAllCoupon' class='bnt font-color'>立即领取</view>
<view class='iconfont icon-guanbi3' bindtap='close'></view>
</view>
</view>
<view class='mask' catchtouchmove="true" hidden='{{window==false}}'></view>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,77 @@
// components/home/index.js
Page({
/**
* 页面的初始数据
*/
data: {
homeActive:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
setTouchMove: function (e) {
var that = this;
if (e.touches[0].clientY < 400 && e.touches[0].clientY > 66) {
that.setData({
top: e.touches[0].clientY
})
}
},
open:function(){
this.setData({
homeActive: !this.data.homeActive
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"component": true
}

View File

@ -0,0 +1,9 @@
<view class='home' style=" top:{{top*2}}rpx;" catchtouchmove="setTouchMove">
<view class='homeCon bg-color acea-row row-column-between {{homeActive==true?"on":""}}'>
<navigator hover-class='none' url='/pages/index/index' open-type='switchTab' class='iconfont icon-shouye-xianxing'></navigator>
<navigator hover-class='none' url='/pages/cart/cart' open-type='switchTab' class='iconfont icon-caigou-xianxing'></navigator>
<navigator hover-class='none' url='/pages/ucenter/index/index' open-type='switchTab' class='iconfont icon-yonghu1'></navigator>
</view>
<view class='pictrue' bindtap='open'><image src='{{homeActive==false?"/static/images/close.gif":"/static/images/open.gif"}}'></image></view>
</view>

View File

@ -0,0 +1,7 @@
@import '/app.wxss';
.home{position: fixed ;top:580rpx;color: white;text-align: center;z-index:99;right:10rpx;}
.home .homeCon{width:86rpx;border-radius:50rpx;padding:34rpx 0;box-sizing:border-box;transition:all 0.3s ease-in-out 0s;opacity:0;transform: scale(0);height:0rpx;color:#e93323;}
.home .homeCon.on{opacity:1;transform: scale(1);height:300rpx;color:#fff;}
.home .homeCon .iconfont{font-size:48rpx;}
.home .pictrue{width:86rpx;height:86rpx;border-radius:50%;margin-top:20rpx;}
.home .pictrue image{width:100%;height:100%;border-radius:50%;}

View File

@ -0,0 +1,27 @@
var app = getApp();
Component({
properties: {
sharePacket:{
type:Object,
value:{
isState: true,
priceName:'',
}
}
},
data: {
},
attached: function () {
},
methods: {
closeShare:function(){
this.setData({
"sharePacket.isState": true
})
},
goShare:function(){
this.triggerEvent('listenerActionSheet');
},
}
})

View File

@ -0,0 +1,4 @@
{
"usingComponents": {},
"component": true
}

View File

@ -0,0 +1,13 @@
<view class='sharing-packets {{sharePacket.isState==true?"on":""}}'>
<view class='iconfont icon-guanbi' bindtap='closeShare'></view>
<view class='line'></view>
<view class='sharing-con' bindtap='goShare'>
<image src='/images/red-packets.png'></image>
<view class='text font-color'>
<view>会员分享返</view>
<view class='money'><text class='label'>¥</text>{{sharePacket.priceName}}</view>
<view class='tip'>下单即返佣金</view>
<view class='shareBut'>立即分享</view>
</view>
</view>
</view>

View File

@ -0,0 +1,12 @@
@import '/app.wxss';
.sharing-packets{position:fixed;right:30rpx;top:900rpx;z-index:5;transition:all 0.3s ease-in-out 0s;opacity:1;transform: scale(1);}
.sharing-packets.on{transform: scale(0);opacity:0;}
.sharing-packets .iconfont{width:44rpx;height:44rpx;border-radius:50%;text-align:center;line-height:44rpx;background-color:#999;font-size:20rpx;color:#fff;margin:0 auto;box-sizing:border-box;padding-left:1px;}
.sharing-packets .line{width:2rpx;height:40rpx;background-color:#999;margin:0 auto;}
.sharing-packets .sharing-con{width:187rpx;height:210rpx;position:relative;}
.sharing-packets .sharing-con image{width:100%;height:100%;}
.sharing-packets .sharing-con .text{position:absolute;top:30rpx;font-size:20rpx;width:100%;text-align:center;}
.sharing-packets .sharing-con .text .money{font-size:32rpx;font-weight:bold;margin-top:5rpx;}
.sharing-packets .sharing-con .text .money .label{font-size:20rpx;}
.sharing-packets .sharing-con .text .tip{font-size:18rpx;color:#999;margin-top:5rpx;}
.sharing-packets .sharing-con .text .shareBut{font-size:22rpx;color:#fff;margin-top:18rpx;height:50rpx;line-height:50rpx;}

View File

@ -0,0 +1,242 @@
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
var __placeImgeUrlHttps = "https";
var __emojisReg = '';
var __emojisBaseSrc = '';
var __emojis = {};
var wxDiscode = require('wxDiscode.js');
var HTMLParser = require('htmlparser.js');
// Empty Elements - HTML 5
var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
// Block Elements - HTML 5
var block = makeMap("br,a,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
// Inline Elements - HTML 5
var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
// Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
// Attributes that have their values filled in disabled="disabled"
var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
// Special Elements (can contain anything)
var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
function makeMap(str) {
var obj = {}, items = str.split(",");
for (var i = 0; i < items.length; i++)
obj[items[i]] = true;
return obj;
}
function q(v) {
return '"' + v + '"';
}
function removeDOCTYPE(html) {
return html
.replace(/<\?xml.*\?>\n/, '')
.replace(/<!doctype.*\>\n/, '')
.replace(/<!DOCTYPE.*\>\n/, '');
}
function html2json(html, bindName) {
//处理字符串
html = removeDOCTYPE(html);
html = wxDiscode.strDiscode(html);
//生成node节点
var bufArray = [];
var results = {
node: bindName,
nodes: [],
images:[],
imageUrls:[]
};
HTMLParser(html, {
start: function (tag, attrs, unary) {
//debug(tag, attrs, unary);
// node for this element
var node = {
node: 'element',
tag: tag,
};
if (block[tag]) {
node.tagType = "block";
} else if (inline[tag]) {
node.tagType = "inline";
} else if (closeSelf[tag]) {
node.tagType = "closeSelf";
}
if (attrs.length !== 0) {
node.attr = attrs.reduce(function (pre, attr) {
var name = attr.name;
var value = attr.value;
if (name == 'class') {
// console.dir(value);
// value = value.join("")
node.classStr = value;
}
// has multi attibutes
// make it array of attribute
if (name == 'style') {
// console.dir(value);
// value = value.join("")
node.styleStr = value;
}
if (value.match(/ /)) {
value = value.split(' ');
}
// if attr already exists
// merge it
if (pre[name]) {
if (Array.isArray(pre[name])) {
// already array, push to last
pre[name].push(value);
} else {
// single value, make it array
pre[name] = [pre[name], value];
}
} else {
// not exist, put it
pre[name] = value;
}
return pre;
}, {});
}
//对img添加额外数据
if (node.tag === 'img') {
node.imgIndex = results.images.length;
var imgUrl = node.attr.src;
imgUrl = wxDiscode.urlToHttpUrl(imgUrl, __placeImgeUrlHttps);
node.attr.src = imgUrl;
node.from = bindName;
results.images.push(node);
results.imageUrls.push(imgUrl);
}
if (unary) {
// if this tag dosen't have end tag
// like <img src="hoge.png"/>
// add to parents
var parent = bufArray[0] || results;
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
} else {
bufArray.unshift(node);
}
},
end: function (tag) {
//debug(tag);
// merge into parent tag
var node = bufArray.shift();
if (node.tag !== tag) console.error('invalid state: mismatch end tag');
if (bufArray.length === 0) {
results.nodes.push(node);
} else {
var parent = bufArray[0];
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
}
},
chars: function (text) {
//debug(text);
var node = {
node: 'text',
text: text,
textArray:transEmojiStr(text)
};
if (bufArray.length === 0) {
results.nodes.push(node);
} else {
var parent = bufArray[0];
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
}
},
comment: function (text) {
//debug(text);
var node = {
node: 'comment',
text: text,
};
var parent = bufArray[0];
if (parent.nodes === undefined) {
parent.nodes = [];
}
parent.nodes.push(node);
},
});
return results;
};
function transEmojiStr(str){
// var eReg = new RegExp("["+__reg+' '+"]");
// str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
var emojiObjs = [];
//如果正则表达式为空
if(__emojisReg.length == 0 || !__emojis){
var emojiObj = {}
emojiObj.node = "text";
emojiObj.text = str;
array = [emojiObj];
return array;
}
//这个地方需要调整
str = str.replace(/\[([^\[\]]+)\]/g,':$1:')
var eReg = new RegExp("[:]");
var array = str.split(eReg);
for(var i = 0; i < array.length; i++){
var ele = array[i];
var emojiObj = {};
if(__emojis[ele]){
emojiObj.node = "element";
emojiObj.tag = "emoji";
emojiObj.text = __emojis[ele];
emojiObj.baseSrc= __emojisBaseSrc;
}else{
emojiObj.node = "text";
emojiObj.text = ele;
}
emojiObjs.push(emojiObj);
}
return emojiObjs;
}
function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
__emojisReg = reg;
__emojisBaseSrc=baseSrc;
__emojis=emojis;
}
module.exports = {
html2json: html2json,
emojisInit:emojisInit
};

View File

@ -0,0 +1,182 @@
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
// Regular Expressions for parsing tags and attributes
var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/,
attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
// Empty Elements - HTML 5
var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr");
// Block Elements - HTML 5
var block = makeMap("a,address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video");
// Inline Elements - HTML 5
var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var");
// Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");
// Attributes that have their values filled in disabled="disabled"
var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected");
// Special Elements (can contain anything)
var special = makeMap("wxxxcode-style,script,style,view,scroll-view,block");
function HTMLParser(html, handler) {
var index, chars, match, stack = [], last = html;
stack.last = function () {
return this[this.length - 1];
};
while (html) {
chars = true;
// Make sure we're not in a script or style element
if (!stack.last() || !special[stack.last()]) {
// Comment
if (html.indexOf("<!--") == 0) {
index = html.indexOf("-->");
if (index >= 0) {
if (handler.comment)
handler.comment(html.substring(4, index));
html = html.substring(index + 3);
chars = false;
}
// end tag
} else if (html.indexOf("</") == 0) {
match = html.match(endTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(endTag, parseEndTag);
chars = false;
}
// start tag
} else if (html.indexOf("<") == 0) {
match = html.match(startTag);
if (match) {
html = html.substring(match[0].length);
match[0].replace(startTag, parseStartTag);
chars = false;
}
}
if (chars) {
index = html.indexOf("<");
var text = index < 0 ? html : html.substring(0, index);
html = index < 0 ? "" : html.substring(index);
if (handler.chars)
handler.chars(text);
}
} else {
html = html.replace(new RegExp("([\\s\\S]*?)<\/" + stack.last() + "[^>]*>"), function (all, text) {
text = text.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2");
if (handler.chars)
handler.chars(text);
return "";
});
parseEndTag("", stack.last());
}
if (html == last)
throw "Parse Error: " + html;
last = html;
}
// Clean up any remaining tags
parseEndTag();
function parseStartTag(tag, tagName, rest, unary) {
tagName = tagName.toLowerCase();
if (block[tagName]) {
while (stack.last() && inline[stack.last()]) {
parseEndTag("", stack.last());
}
}
if (closeSelf[tagName] && stack.last() == tagName) {
parseEndTag("", tagName);
}
unary = empty[tagName] || !!unary;
if (!unary)
stack.push(tagName);
if (handler.start) {
var attrs = [];
rest.replace(attr, function (match, name) {
var value = arguments[2] ? arguments[2] :
arguments[3] ? arguments[3] :
arguments[4] ? arguments[4] :
fillAttrs[name] ? name : "";
attrs.push({
name: name,
value: value,
escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //"
});
});
if (handler.start) {
handler.start(tagName, attrs, unary);
}
}
}
function parseEndTag(tag, tagName) {
// If no tag name is provided, clean shop
if (!tagName)
var pos = 0;
// Find the closest opened tag of the same type
else
for (var pos = stack.length - 1; pos >= 0; pos--)
if (stack[pos] == tagName)
break;
if (pos >= 0) {
// Close all the open elements, up the stack
for (var i = stack.length - 1; i >= pos; i--)
if (handler.end)
handler.end(stack[i]);
// Remove the open elements from the stack
stack.length = pos;
}
}
};
function makeMap(str) {
var obj = {}, items = str.split(",");
for (var i = 0; i < items.length; i++)
obj[items[i]] = true;
return obj;
}
module.exports = HTMLParser;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,206 @@
// HTML 支持的数学符号
function strNumDiscode(str){
str = str.replace(/&forall;/g, '∀');
str = str.replace(/&part;/g, '∂');
str = str.replace(/&exists;/g, '∃');
str = str.replace(/&empty;/g, '∅');
str = str.replace(/&nabla;/g, '∇');
str = str.replace(/&isin;/g, '∈');
str = str.replace(/&notin;/g, '∉');
str = str.replace(/&ni;/g, '∋');
str = str.replace(/&prod;/g, '∏');
str = str.replace(/&sum;/g, '∑');
str = str.replace(/&minus;/g, '');
str = str.replace(/&lowast;/g, '');
str = str.replace(/&radic;/g, '√');
str = str.replace(/&prop;/g, '∝');
str = str.replace(/&infin;/g, '∞');
str = str.replace(/&ang;/g, '∠');
str = str.replace(/&and;/g, '∧');
str = str.replace(/&or;/g, '');
str = str.replace(/&cap;/g, '∩');
str = str.replace(/&cap;/g, '');
str = str.replace(/&int;/g, '∫');
str = str.replace(/&there4;/g, '∴');
str = str.replace(/&sim;/g, '');
str = str.replace(/&cong;/g, '≅');
str = str.replace(/&asymp;/g, '≈');
str = str.replace(/&ne;/g, '≠');
str = str.replace(/&le;/g, '≤');
str = str.replace(/&ge;/g, '≥');
str = str.replace(/&sub;/g, '⊂');
str = str.replace(/&sup;/g, '⊃');
str = str.replace(/&nsub;/g, '⊄');
str = str.replace(/&sube;/g, '⊆');
str = str.replace(/&supe;/g, '⊇');
str = str.replace(/&oplus;/g, '⊕');
str = str.replace(/&otimes;/g, '⊗');
str = str.replace(/&perp;/g, '⊥');
str = str.replace(/&sdot;/g, '⋅');
return str;
}
//HTML 支持的希腊字母
function strGreeceDiscode(str){
str = str.replace(/&Alpha;/g, 'Α');
str = str.replace(/&Beta;/g, 'Β');
str = str.replace(/&Gamma;/g, 'Γ');
str = str.replace(/&Delta;/g, 'Δ');
str = str.replace(/&Epsilon;/g, 'Ε');
str = str.replace(/&Zeta;/g, 'Ζ');
str = str.replace(/&Eta;/g, 'Η');
str = str.replace(/&Theta;/g, 'Θ');
str = str.replace(/&Iota;/g, 'Ι');
str = str.replace(/&Kappa;/g, 'Κ');
str = str.replace(/&Lambda;/g, 'Λ');
str = str.replace(/&Mu;/g, 'Μ');
str = str.replace(/&Nu;/g, 'Ν');
str = str.replace(/&Xi;/g, 'Ν');
str = str.replace(/&Omicron;/g, 'Ο');
str = str.replace(/&Pi;/g, 'Π');
str = str.replace(/&Rho;/g, 'Ρ');
str = str.replace(/&Sigma;/g, 'Σ');
str = str.replace(/&Tau;/g, 'Τ');
str = str.replace(/&Upsilon;/g, 'Υ');
str = str.replace(/&Phi;/g, 'Φ');
str = str.replace(/&Chi;/g, 'Χ');
str = str.replace(/&Psi;/g, 'Ψ');
str = str.replace(/&Omega;/g, 'Ω');
str = str.replace(/&alpha;/g, 'α');
str = str.replace(/&beta;/g, 'β');
str = str.replace(/&gamma;/g, 'γ');
str = str.replace(/&delta;/g, 'δ');
str = str.replace(/&epsilon;/g, 'ε');
str = str.replace(/&zeta;/g, 'ζ');
str = str.replace(/&eta;/g, 'η');
str = str.replace(/&theta;/g, 'θ');
str = str.replace(/&iota;/g, 'ι');
str = str.replace(/&kappa;/g, 'κ');
str = str.replace(/&lambda;/g, 'λ');
str = str.replace(/&mu;/g, 'μ');
str = str.replace(/&nu;/g, 'ν');
str = str.replace(/&xi;/g, 'ξ');
str = str.replace(/&omicron;/g, 'ο');
str = str.replace(/&pi;/g, 'π');
str = str.replace(/&rho;/g, 'ρ');
str = str.replace(/&sigmaf;/g, 'ς');
str = str.replace(/&sigma;/g, 'σ');
str = str.replace(/&tau;/g, 'τ');
str = str.replace(/&upsilon;/g, 'υ');
str = str.replace(/&phi;/g, 'φ');
str = str.replace(/&chi;/g, 'χ');
str = str.replace(/&psi;/g, 'ψ');
str = str.replace(/&omega;/g, 'ω');
str = str.replace(/&thetasym;/g, 'ϑ');
str = str.replace(/&upsih;/g, 'ϒ');
str = str.replace(/&piv;/g, 'ϖ');
str = str.replace(/&middot;/g, '·');
return str;
}
//
function strcharacterDiscode(str){
// 加入常用解析
str = str.replace(/&nbsp;/g, ' ');
str = str.replace(/&quot;/g, '"');
str = str.replace(/&amp;/g, '&');
// str = str.replace(/&lt;/g, '');
// str = str.replace(/&gt;/g, '');
str = str.replace(/&lt;/g, '<');
str = str.replace(/&gt;/g, '>');
return str;
}
// HTML 支持的其他实体
function strOtherDiscode(str){
str = str.replace(/&OElig;/g, 'Œ');
str = str.replace(/&oelig;/g, 'œ');
str = str.replace(/&Scaron;/g, 'Š');
str = str.replace(/&scaron;/g, 'š');
str = str.replace(/&Yuml;/g, 'Ÿ');
str = str.replace(/&fnof;/g, 'ƒ');
str = str.replace(/&circ;/g, 'ˆ');
str = str.replace(/&tilde;/g, '˜');
str = str.replace(/&ensp;/g, '');
str = str.replace(/&emsp;/g, '');
str = str.replace(/&thinsp;/g, '');
str = str.replace(/&zwnj;/g, '');
str = str.replace(/&zwj;/g, '');
str = str.replace(/&lrm;/g, '');
str = str.replace(/&rlm;/g, '');
str = str.replace(/&ndash;/g, '');
str = str.replace(/&mdash;/g, '—');
str = str.replace(/&lsquo;/g, '');
str = str.replace(/&rsquo;/g, '');
str = str.replace(/&sbquo;/g, '');
str = str.replace(/&ldquo;/g, '“');
str = str.replace(/&rdquo;/g, '”');
str = str.replace(/&bdquo;/g, '„');
str = str.replace(/&dagger;/g, '†');
str = str.replace(/&Dagger;/g, '‡');
str = str.replace(/&bull;/g, '•');
str = str.replace(/&hellip;/g, '…');
str = str.replace(/&permil;/g, '‰');
str = str.replace(/&prime;/g, '');
str = str.replace(/&Prime;/g, '″');
str = str.replace(/&lsaquo;/g, '');
str = str.replace(/&rsaquo;/g, '');
str = str.replace(/&oline;/g, '‾');
str = str.replace(/&euro;/g, '€');
str = str.replace(/&trade;/g, '™');
str = str.replace(/&larr;/g, '←');
str = str.replace(/&uarr;/g, '↑');
str = str.replace(/&rarr;/g, '→');
str = str.replace(/&darr;/g, '↓');
str = str.replace(/&harr;/g, '↔');
str = str.replace(/&crarr;/g, '↵');
str = str.replace(/&lceil;/g, '⌈');
str = str.replace(/&rceil;/g, '⌉');
str = str.replace(/&lfloor;/g, '⌊');
str = str.replace(/&rfloor;/g, '⌋');
str = str.replace(/&loz;/g, '◊');
str = str.replace(/&spades;/g, '♠');
str = str.replace(/&clubs;/g, '♣');
str = str.replace(/&hearts;/g, '♥');
str = str.replace(/&diams;/g, '♦');
return str;
}
function strMoreDiscode(str){
str = str.replace(/\r\n/g,"");
str = str.replace(/\n/g,"");
str = str.replace(/code/g,"wxxxcode-style");
return str;
}
function strDiscode(str){
str = strNumDiscode(str);
str = strGreeceDiscode(str);
str = strcharacterDiscode(str);
str = strOtherDiscode(str);
str = strMoreDiscode(str);
return str;
}
function urlToHttpUrl(url,rep){
var patt1 = new RegExp("^//");
var result = patt1.test(url);
if(result){
url = rep+":"+url;
}
return url;
}
module.exports = {
strDiscode:strDiscode,
urlToHttpUrl:urlToHttpUrl
}

View File

@ -0,0 +1,146 @@
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
/**
* utils函数引入
**/
import showdown from 'showdown.js';
import HtmlToJson from 'html2json.js';
/**
* 配置及公有属性
**/
/**
* 主函数入口区
**/
function wxParse(bindName = 'wxParseData', type='html', data='<div class="color:red;">数据不能为空</div>', target,imagePadding) {
var that = target;
var transData = {};//存放转化后的数据
if (type == 'html') {
transData = HtmlToJson.html2json(data, bindName);
// console.log(JSON.stringify(transData, ' ', ' '));
} else if (type == 'md' || type == 'markdown') {
var converter = new showdown.Converter();
var html = converter.makeHtml(data);
transData = HtmlToJson.html2json(html, bindName);
// console.log(JSON.stringify(transData, ' ', ' '));
}
transData.view = {};
transData.view.imagePadding = 0;
if(typeof(imagePadding) != 'undefined'){
transData.view.imagePadding = imagePadding
}
var bindData = {};
bindData[bindName] = transData;
that.setData(bindData)
that.wxParseImgLoad = wxParseImgLoad;
that.wxParseImgTap = wxParseImgTap;
}
// 图片点击事件
function wxParseImgTap(e) {
var that = this;
var nowImgUrl = e.target.dataset.src;
var tagFrom = e.target.dataset.from;
if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
wx.previewImage({
current: nowImgUrl, // 当前显示图片的http链接
urls: that.data[tagFrom].imageUrls // 需要预览的图片http链接列表
})
}
}
/**
* 图片视觉宽高计算函数区
**/
function wxParseImgLoad(e) {
var that = this;
var tagFrom = e.target.dataset.from;
var idx = e.target.dataset.idx;
if (typeof (tagFrom) != 'undefined' && tagFrom.length > 0) {
calMoreImageInfo(e, idx, that, tagFrom)
}
}
// 假循环获取计算图片视觉最佳宽高
function calMoreImageInfo(e, idx, that, bindName) {
var temData = that.data[bindName];
if (temData.images.length == 0) {
return;
}
var temImages = temData.images;
//因为无法获取view宽度 需要自定义padding进行计算稍后处理
var recal = wxAutoImageCal(e.detail.width, e.detail.height,that,bindName);
temImages[idx].width = recal.imageWidth;
temImages[idx].height = recal.imageheight;
temData.images = temImages;
var bindData = {};
bindData[bindName] = temData;
that.setData(bindData);
}
// 计算视觉优先的图片宽高
function wxAutoImageCal(originalWidth, originalHeight,that,bindName) {
//获取图片的原始长宽
var windowWidth = 0, windowHeight = 0;
var autoWidth = 0, autoHeight = 0;
var results = {};
wx.getSystemInfo({
success: function (res) {
var padding = that.data[bindName].view.imagePadding;
windowWidth = res.windowWidth-2*padding;
windowHeight = res.windowHeight;
//判断按照那种方式进行缩放
// console.log("windowWidth" + windowWidth);
if (originalWidth > windowWidth) {//在图片width大于手机屏幕width时候
autoWidth = windowWidth;
// console.log("autoWidth" + autoWidth);
autoHeight = (autoWidth * originalHeight) / originalWidth;
// console.log("autoHeight" + autoHeight);
results.imageWidth = autoWidth;
results.imageheight = autoHeight;
} else {//否则展示原来的数据
results.imageWidth = originalWidth;
results.imageheight = originalHeight;
}
}
})
return results;
}
function wxParseTemArray(temArrayName,bindNameReg,total,that){
var array = [];
var temData = that.data;
var obj = null;
for(var i = 0; i < total; i++){
var simArr = temData[bindNameReg+i].nodes;
array.push(simArr);
}
temArrayName = temArrayName || 'wxParseTemArray';
obj = JSON.parse('{"'+ temArrayName +'":""}');
obj[temArrayName] = array;
that.setData(obj);
}
/**
* 配置emojis
*
*/
function emojisInit(reg='',baseSrc="/wxParse/emojis/",emojis){
HtmlToJson.emojisInit(reg,baseSrc,emojis);
}
module.exports = {
wxParse: wxParse,
wxParseTemArray:wxParseTemArray,
emojisInit:emojisInit
}

View File

@ -0,0 +1,928 @@
<!--**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/-->
<!--基础元素-->
<template name="wxParseVideo">
<!--增加video标签支持并循环添加-->
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<video class="{{item.classStr}} wxParse-{{item.tag}}-video" src="{{item.attr.src}}"></video>
</view>
</template>
<template name="wxParseImg">
<image class="{{item.classStr}} wxParse-{{item.tag}}" data-from="{{item.from}}" data-src="{{item.attr.src}}" data-idx="{{item.imgIndex}}" src="{{item.attr.src}}" mode="aspectFit" bindload="wxParseImgLoad" bindtap="wxParseImgTap" style="width:{{item.width}}px;height:{{item.height}}px;{{item.attr.style}}" />
</template>
<template name="WxEmojiView">
<view class="WxEmojiView wxParse-inline" style="{{item.styleStr}}">
<block wx:for="{{item.textArray}}" wx:key="">
<block class="{{item.text == '\\n' ? 'wxParse-hide':''}}" wx:if="{{item.node == 'text'}}">{{item.text}}</block>
<block wx:elif="{{item.node == 'element'}}">
<image class="wxEmoji" src="{{item.baseSrc}}{{item.text}}" />
</block>
</block>
</view>
</template>
<!--入口模版-->
<template name="wxParse">
<block wx:for="{{wxParseData}}" wx:key="">
<template is="wxParse0" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse0">
<!--<template is="wxParse1" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-c="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</view>
</block>
<block wx:elif="{{item.tag == 'table'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse1" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse1">
<!--<template is="wxParse2" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse2" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse2" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse2" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse2" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse2" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse2">
<!--<template is="wxParse3" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse3" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse3" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse3" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse3" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse3" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse3">
<!--<template is="wxParse4" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse4" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse4" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse4" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse4" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse4" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse4">
<!--<template is="wxParse5" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse5" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse5" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse5" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse5" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse5" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse5">
<!--<template is="wxParse6" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse6" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse6" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse6" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse6" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse6" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse6">
<!--<template is="wxParse7" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse7" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse7" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse7" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse7" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse7" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse7">
<!--<template is="wxParse8" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse8" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse8" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse8" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse8" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse8" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse8">
<!--<template is="wxParse9" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse9" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse9" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse9" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse9" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse9" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse9">
<!--<template is="wxParse10" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse10" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse10" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse10" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse10" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse10" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse10">
<!--<template is="wxParse11" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse11" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse11" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse11" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse11" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse11" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>
<!--循环模版-->
<template name="wxParse11">
<!--<template is="wxParse12" data="{{item}}" />-->
<!--判断是否是标签节点-->
<block wx:if="{{item.node == 'element'}}">
<block wx:if="{{item.tag == 'button'}}">
<button type="default" size="mini" >
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse12" data="{{item}}"/>
</block>
</button>
</block>
<!--li类型-->
<block wx:elif="{{item.tag == 'li'}}">
<view class="{{item.classStr}} wxParse-li">
<view class="{{item.classStr}} wxParse-li-inner">
<view class="{{item.classStr}} wxParse-li-text">
<view class="{{item.classStr}} wxParse-li-circle"></view>
</view>
<view class="{{item.classStr}} wxParse-li-text">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse12" data="{{item}}"/>
</block>
</view>
</view>
</view>
</block>
<!--video类型-->
<block wx:elif="{{item.tag == 'video'}}">
<template is="wxParseVideo" data="{{item}}"/>
</block>
<!--img类型-->
<block wx:elif="{{item.tag == 'img'}}">
<template is="wxParseImg" data="{{item}}"/>
</block>
<!--a类型-->
<block wx:elif="{{item.tag == 'a'}}">
<view bindtap="wxParseTagATap" class="wxParse-inline {{item.classStr}} wxParse-{{item.tag}}" data-src="{{item.attr.href}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse12" data="{{item}}"/>
</block>
</view>
</block>
<!--其他块级标签-->
<block wx:elif="{{item.tagType == 'block'}}">
<view class="{{item.classStr}} wxParse-{{item.tag}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse12" data="{{item}}"/>
</block>
</view>
</block>
<!--内联标签-->
<view wx:else class="{{item.classStr}} wxParse-{{item.tag}} wxParse-{{item.tagType}}" style="{{item.styleStr}}">
<block wx:for="{{item.nodes}}" wx:for-item="item" wx:key="">
<template is="wxParse12" data="{{item}}"/>
</block>
</view>
</block>
<!--判断是否是文本节点-->
<block wx:elif="{{item.node == 'text'}}">
<!--如果是,直接进行-->
<template is="WxEmojiView" data="{{item}}"/>
</block>
</template>

View File

@ -0,0 +1,202 @@
/**
* author: Di (微信小程序开发工程师)
* organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
* 垂直微信小程序开发交流社区
*
* github地址: https://github.com/icindy/wxParse
*
* for: 微信小程序富文本解析
* detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
*/
.wxParse{
margin: 0 5px;
font-family: Helvetica,sans-serif;
font-size: 28rpx;
color: #666;
line-height: 1.8;
}
view{
word-break:break-all; overflow:auto;
}
.wxParse-inline{
display: inline;
margin: 0;
padding: 0;
}
/*//标题 */
.wxParse-div{margin: 0;padding: 0;}
.wxParse-h1{ font-size:2em; margin: .67em 0 }
.wxParse-h2{ font-size:1.5em; margin: .75em 0 }
.wxParse-h3{ font-size:1.17em; margin: .83em 0 }
.wxParse-h4{ margin: 1.12em 0}
.wxParse-h5 { font-size:.83em; margin: 1.5em 0 }
.wxParse-h6{ font-size:.75em; margin: 1.67em 0 }
.wxParse-h1 {
font-size: 18px;
font-weight: 400;
margin-bottom: .9em;
}
.wxParse-h2 {
font-size: 16px;
font-weight: 400;
margin-bottom: .34em;
}
.wxParse-h3 {
font-weight: 400;
font-size: 15px;
margin-bottom: .34em;
}
.wxParse-h4 {
font-weight: 400;
font-size: 14px;
margin-bottom: .24em;
}
.wxParse-h5 {
font-weight: 400;
font-size: 13px;
margin-bottom: .14em;
}
.wxParse-h6 {
font-weight: 400;
font-size: 12px;
margin-bottom: .04em;
}
.wxParse-h1, .wxParse-h2, .wxParse-h3, .wxParse-h4, .wxParse-h5, .wxParse-h6, .wxParse-b, .wxParse-strong { font-weight: bolder }
.wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address{font-style:italic}
.wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp{font-family:monospace}
.wxParse-pre{white-space:pre}
.wxParse-big{font-size:1.17em}
.wxParse-small,.wxParse-sub,.wxParse-sup{font-size:.83em}
.wxParse-sub{vertical-align:sub}
.wxParse-sup{vertical-align:super}
.wxParse-s,.wxParse-strike,.wxParse-del{text-decoration:line-through}
/*wxparse-自定义个性化的css样式*/
/*增加video的css样式*/
.wxParse-strong,wxParse-s{display: inline}
.wxParse-a{
color: deepskyblue;
word-break:break-all;
overflow:auto;
}
.wxParse-video{
text-align: center;
margin: 10px 0;
}
.wxParse-video-video{
width:100%;
}
.wxParse-img{
background-color: #efefef;
overflow: hidden;
width:40px;
height: 40px;
}
.wxParse-blockquote {
margin: 0;
padding:10px 0 10px 5px;
font-family:Courier, Calibri,"宋体";
background:#f5f5f5;
border-left: 3px solid #dbdbdb;
}
.wxParse-code,.wxParse-wxxxcode-style{
display: inline;
background:#f5f5f5;
}
.wxParse-ul{
margin: 20rpx 10rpx;
}
.wxParse-li,.wxParse-li-inner{
display: flex;
align-items: baseline;
margin: 10rpx 0;
}
.wxParse-li-text{
align-items: center;
line-height: 20px;
}
.wxParse-li-circle{
display: inline-flex;
width: 5px;
height: 5px;
background-color: #333;
margin-right: 5px;
}
.wxParse-li-square{
display: inline-flex;
width: 10rpx;
height: 10rpx;
background-color: #333;
margin-right: 5px;
}
.wxParse-li-ring{
display: inline-flex;
width: 10rpx;
height: 10rpx;
border: 2rpx solid #333;
border-radius: 50%;
background-color: #fff;
margin-right: 5px;
}
/*.wxParse-table{
width: 100%;
height: 400px;
}
.wxParse-thead,.wxParse-tfoot,.wxParse-tr{
display: flex;
flex-direction: row;
}
.wxParse-th,.wxParse-td{
display: flex;
width: 580px;
overflow: auto;
}*/
.wxParse-u {
text-decoration: underline;
}
.wxParse-hide{
display: none;
}
.WxEmojiView{
align-items: center;
}
.wxEmoji{
width: 16px;
height:16px;
}
.wxParse-tr{
display: flex;
border-right:1px solid #e0e0e0;
border-bottom:1px solid #e0e0e0;
}
.wxParse-th,
.wxParse-td{
flex:1;
padding:5px;
font-size:28rpx;
border-left:1px solid #e0e0e0;
word-break: break-all;
}
.wxParse-td:last{
border-top:1px solid #e0e0e0;
}
.wxParse-th{
background:#f0f0f0;
border-top:1px solid #e0e0e0;
}

View File

@ -0,0 +1,31 @@
'use strict';
Component({
externalClasses: ['custom-class'],
/**
* 组件的属性列表
* 用于组件自定义设置
*/
properties: {
// 颜色状态
type: {
type: String,
value: ''
},
// 自定义颜色
color: {
type: String,
value: ''
},
// 左侧内容
leftText: {
type: String,
value: ''
},
// 右侧内容
rightText: {
type: String,
value: ''
}
}
});

View File

@ -0,0 +1,3 @@
{
"component": true
}

View File

@ -0,0 +1,10 @@
<view class="custom-class zan-capsule zan-capsule--{{type}}">
<block wx:if="{{color}}">
<view class="zan-capsule__left" style="background: {{ color }}; border-color: {{ color }}">{{ leftText }}</view>
<view class="zan-capsule__right" style="color: {{ color }}; border-color: {{ color }}">{{ rightText }}</view>
</block>
<block wx:else>
<view class="zan-capsule__left">{{ leftText }}</view>
<view class="zan-capsule__right">{{ rightText }}</view>
</block>
</view>

View File

@ -0,0 +1,42 @@
.zan-capsule {
display: inline-block;
font-size: 12px;
vertical-align: middle;
line-height: 19px;
-webkit-transform: scale(0.83);
transform: scale(0.83);
}
.zan-capsule__left, .zan-capsule__right {
display: inline-block;
line-height: 17px;
height: 19px;
vertical-align: middle;
box-sizing: border-box;
}
.zan-capsule__left {
padding: 0 2px;
color: #fff;
background: #999;
border-radius: 2px 0 0 2px;
border: 1rpx solid #999;
}
.zan-capsule__right {
padding: 0 5px;
color: #999;
border-radius: 0 2px 2px 0;
border: 1rpx solid #999;
}
.zan-capsule--danger .zan-capsule__left {
color: #fff;
background: #f24544;
border-color: #f24544;
}
.zan-capsule--danger .zan-capsule__right {
color: #f24544;
border-color: #f24544;
}

View File

@ -0,0 +1,49 @@
// about.js
var app = getApp()
var util = require("../../utils/util.js");
var api = require("../../config/api.js");
Page({
/**
* 页面的初始数据
*/
data: {
load_statue: true,
shopInfo: {
name: '聚惠星',
address: 'https://www.shequlianshang.com/dts/index.html',
latitude: 27.4871724214,
longitude: 110.8950504844,
linkPhone: '19908488612',
qqNumber: '686432822'
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
showLocation: function (e) {
var that = this
wx.openLocation({
latitude: that.data.shopInfo.latitude,
longitude: that.data.shopInfo.longitude,
name: that.data.shopInfo.name,
address: that.data.shopInfo.address,
})
},
callPhone: function (e) {
var that = this
wx.makePhoneCall({
phoneNumber: that.data.shopInfo.linkPhone,
})
},
reLoad: function (e) {
this.loadShopInfo();
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "关于我们",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,55 @@
<view class="container">
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">项目名称: </label>
<text>{{shopInfo.name}}</text>
</view>
<view class="item-right" bindtap="showLocation">
<image src="/static/images/ico-addr.png" class="right-icon"></image>
</view>
</view>
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">项目地址: </label>
<text>{{shopInfo.address}}</text>
</view>
</view>
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">电话号码: </label>
<text>{{shopInfo.linkPhone}}</text>
</view>
<view class="item-right" bindtap="callPhone">
<image src="/static/images/telephone.png" class="right-icon"></image>
</view>
</view>
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">QQ交流群: </label>
<text>{{shopInfo.qqNumber}}</text>
</view>
<view class="item-right">
<image src="/static/images/mobile.png" class="right-icon"></image>
</view>
</view>
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">当前版本: </label>
<text>1.0.0</text>
</view>
</view>
<view class="about-item">
<view class="item-left">
<label class="jhx_f12">开源协议: </label>
<text>MIT</text>
</view>
</view>
</view>

View File

@ -0,0 +1,44 @@
/* about.wxss */
page{
height: 100%;
background-color: #F2f2f2;
}
.page-view{
height: 100%;
}
.banner-image{
width: 100%;
height: 350rpx;
background: #ee1;
margin-bottom: 30rpx;
border-bottom: solid #f2f2f2 0.5dp;
}
.about-item{
background: white;
border-top: solid #f2f2f2 0.2rpx;
border-bottom: solid #f2f2f2 0.2rpx;
width: 100%;
height: 100rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.item-left{
font-size: 30rpx;
margin-left: 15rpx;
margin-top: auto;
margin-bottom: auto;
}
.item-right{
margin-right: 15rpx;
margin-top: auto;
margin-bottom: auto;
}
.right-icon{
width: 40rpx;
height: 40rpx;
}

View File

@ -0,0 +1,95 @@
var app = getApp();
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var WxParse = require('../../lib/wxParse/wxParse.js');
Page({
/**
* 页面的初始数据
*/
data: {
'title': '公告详情',
'content': "",
id:0,
"addTime":"2019-01-01",
"type":1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (options.hasOwnProperty('id')){
this.setData({ id: options.id});
}else{
wx.navigateBack({delta: 1 });
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getArticleOne();
},
getArticleOne:function(){
var that = this;
util.request(api.ArticleDetail, {
id: that.data.id
}).then(function(res) {
if (res.errno === 0) {
that.setData({
"title": res.data.title,
"content": res.data.content,
"addTime": res.data.addTime,
"type": res.data.type
});
//html转wxml
WxParse.wxParse('content', 'html', res.data.content, that, 0);
}
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,7 @@
{
"navigationBarTitleText": "公告详情",
"enablePullDownRefresh": false,
"usingComponents": {
"home": "../../lib/home/index"
}
}

View File

@ -0,0 +1,14 @@
<view class='newsDetail'>
<view class='title'>{{title}}</view>
<view class='list acea-row row-middle'>
<view wx:if="{{type == 1}}" class='label cart-color'>公告</view>
<view wx:else class='label cart-color'>新闻</view>
<view class='item'><text class='iconfont icon-shenhezhong'></text>{{addTime}}</view>
<view class='item'><text class='iconfont icon-liulan'></text>10000+</view>
</view>
<view class='conter'>
<template is="wxParse" data="{{wxParseData:content.nodes}}"/>
</view>
</view>
<import src="/lib/wxParse/wxParse.wxml" />
<home></home>

View File

@ -0,0 +1,9 @@
page{background-color:#fff!important;}
.newsDetail .title{padding:0 30rpx;font-size:34rpx;color:#282828;font-weight:bold;margin:45rpx 0 23rpx 0;line-height:1.5;}
.newsDetail .list{margin:0 30rpx;border-bottom:1rpx solid #eee;padding-bottom:25rpx;}
.newsDetail .list .label{font-size:24rpx;height:38rpx;border-radius:3rpx;text-align:center;line-height:38rpx;padding: 0 10rpx;}
.newsDetail .list .item{margin-left:27rpx;font-size:24rpx;color:#999;}
.newsDetail .list .item .iconfont{font-size:28rpx;margin-right:10rpx;}
.newsDetail .list .item .iconfont.icon-shenhezhong{font-size:26rpx;}
.newsDetail .conter{padding:0 15rpx;font-size:30rpx;color:#333;line-height:1.7;padding-top:35rpx;}
@import "/lib/wxParse/wxParse.wxss";

View File

@ -0,0 +1,117 @@
var api = require('../../../config/api.js');
var util = require('../../../utils/util.js');
var user = require('../../../utils/user.js');
var app = getApp();
Page({
data: {
username: '',
password: '',
code: '',
loginErrorCount: 0
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
accountLogin: function() {
var that = this;
if (this.data.password.length < 1 || this.data.username.length < 1) {
wx.showModal({
title: '错误信息',
content: '请输入用户名和密码',
showCancel: false
});
return false;
}
wx.request({
url: api.AuthLoginByAccount,
data: {
username: that.data.username,
password: that.data.password
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
that.setData({
loginErrorCount: 0
});
app.globalData.hasLogin = true;
wx.setStorageSync('userInfo', res.data.data.userInfo);
wx.setStorage({
key: "token",
data: res.data.data.token,
success: function() {
wx.switchTab({
url: '/pages/ucenter/index/index'
});
}
});
} else {
that.setData({
loginErrorCount: that.data.loginErrorCount + 1
});
app.globalData.hasLogin = false;
util.showErrorToast('账户登录失败');
}
}
});
},
bindUsernameInput: function(e) {
this.setData({
username: e.detail.value
});
},
bindPasswordInput: function(e) {
this.setData({
password: e.detail.value
});
},
bindCodeInput: function(e) {
this.setData({
code: e.detail.value
});
},
clearInput: function(e) {
switch (e.currentTarget.id) {
case 'clear-username':
this.setData({
username: ''
});
break;
case 'clear-password':
this.setData({
password: ''
});
break;
case 'clear-code':
this.setData({
code: ''
});
break;
}
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "账号登录",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,29 @@
<view class="container">
<view class="form-box">
<view class="form-item">
<input class="username" value="{{username}}" bindinput="bindUsernameInput" placeholder="账号"/>
<image wx:if="{{ username.length > 0 }}" id="clear-username" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码"/>
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<!-- <view class="form-item-code" wx-if="{{loginErrorCount >= 3}}">
<view class="form-item code-item">
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码"/>
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<image class="code-img" src="https://dl.reg.163.com/cp?pd=yanxuan_web&pkid=SkeBZeG&random=1489903563234"></image>
</view> -->
<button type="primary" class="login-btn" bindtap="accountLogin">账号登录</button>
<view class="form-item-text">
<navigator url="/pages/auth/register/register" class="register">注册账号</navigator>
<navigator url="/pages/auth/reset/reset" class="reset">忘记密码</navigator>
</view>
</view>
</view>

View File

@ -0,0 +1,103 @@
.form-box {
width: 100%;
height: auto;
overflow: hidden;
padding: 0 40rpx;
margin-top: 200rpx;
background: #f4f4f4;
}
.form-item {
position: relative;
background: #f4f4f4;
height: 96rpx;
border-bottom: 1px solid #d9d9d9;
}
.form-item .username, .form-item .password, .form-item .code {
position: absolute;
top: 26rpx;
left: 0;
display: block;
width: 100%;
height: 44rpx;
background: #f4f4f4;
color: #333;
font-size: 30rpx;
}
.form-item-code {
margin-top: 32rpx;
height: auto;
overflow: hidden;
width: 100%;
}
.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 .clear {
position: absolute;
top: 26rpx;
right: 18rpx;
z-index: 2;
display: block;
background: #f4f4f4;
height: 44rpx;
width: 44rpx;
}
.login-btn {
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
font-size: 30rpx;
border-radius: 6rpx;
width: 90%;
color: #f4f4f4;
right: 0;
display: flex;
justify-content: center;
align-items: center;
position: flex;
bottom: 0;
left: 0;
padding: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}
.form-item-text {
height: 35rpx;
width: 100%;
}
.form-item-text .register {
display: block;
height: 34rpx;
float: left;
font-size: 28rpx;
}
.form-item-text .reset {
display: block;
height: 34rpx;
float: right;
font-size: 28rpx;
}

View File

@ -0,0 +1,52 @@
var api = require('../../../config/api.js');
var util = require('../../../utils/util.js');
var user = require('../../../utils/user.js');
var app = getApp();
Page({
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
wxLogin: function(e) {
if (e.detail.userInfo == undefined) {
app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败');
return;
}
user.checkLogin().catch(() => {
user.loginByWeixin(e.detail.userInfo).then(res => {
app.globalData.hasLogin = true;
wx.navigateBack({
delta: 1
})
}).catch((err) => {
app.globalData.hasLogin = false;
util.showErrorToast('微信登录失败');
});
});
},
accountLogin: function() {
wx.navigateTo({
url: "/pages/auth/accountLogin/accountLogin"
});
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "登录",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,6 @@
<view class="container">
<view class="login-box">
<button type="primary" open-type="getUserInfo" class="wx-login-btn" bindgetuserinfo="wxLogin">微信直接登录</button>
<button type="primary" class="account-login-btn" bindtap="accountLogin">账号登录</button>
</view>
</view>

View File

@ -0,0 +1,61 @@
.login-box {
width: 100%;
height: auto;
overflow: hidden;
padding: 0 40rpx;
margin-top: 200rpx;
background: #f4f4f4;
}
.wx-login-btn {
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
font-size: 30rpx;
border-radius: 6rpx;
width: 90%;
color: #fff;
right: 0;
display: flex;
justify-content: center;
align-items: center;
position: flex;
bottom: 0;
left: 0;
padding: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
}
.account-login-btn {
width: 90%;
margin: 0 auto;
color: #fff;
font-size: 30rpx;
height: 96rpx;
line-height: 96rpx;
right: 0;
display: flex;
justify-content: center;
align-items: center;
position: flex;
bottom: 0;
left: 0;
border-radius: 0;
padding: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}

View File

@ -0,0 +1,230 @@
var api = require('../../../config/api.js');
var check = require('../../../utils/check.js');
var app = getApp();
Page({
data: {
username: '',
password: '',
confirmPassword: '',
mobile: '',
code: ''
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
sendCode: function() {
let that = this;
if (this.data.mobile.length == 0) {
wx.showModal({
title: '错误信息',
content: '手机号不能为空',
showCancel: false
});
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
wx.request({
url: api.AuthRegisterCaptcha,
data: {
mobile: that.data.mobile
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
wx.showModal({
title: '发送成功',
content: '验证码已发送',
showCancel: false
});
} else {
wx.showModal({
title: '错误信息',
content: res.data.errmsg,
showCancel: false
});
}
}
});
},
requestRegister: function(wxCode) {
let that = this;
wx.request({
url: api.AuthRegister,
data: {
username: that.data.username,
password: that.data.password,
mobile: that.data.mobile,
code: that.data.code,
wxCode: wxCode
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
app.globalData.hasLogin = true;
wx.setStorageSync('userInfo', res.data.data.userInfo);
wx.setStorage({
key: "token",
data: res.data.data.token,
success: function() {
wx.switchTab({
url: '/pages/ucenter/index/index'
});
}
});
} else {
wx.showModal({
title: '错误信息',
content: res.data.errmsg,
showCancel: false
});
}
}
});
},
startRegister: function() {
var that = this;
if (this.data.password.length < 6 || this.data.username.length < 6) {
wx.showModal({
title: '错误信息',
content: '用户名和密码不得少于6位',
showCancel: false
});
return false;
}
if (this.data.password != this.data.confirmPassword) {
wx.showModal({
title: '错误信息',
content: '确认密码不一致',
showCancel: false
});
return false;
}
if (this.data.mobile.length == 0 || this.data.code.length == 0) {
wx.showModal({
title: '错误信息',
content: '手机号和验证码不能为空',
showCancel: false
});
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
wx.login({
success: function(res) {
if (!res.code) {
wx.showModal({
title: '错误信息',
content: '注册失败',
showCancel: false
});
}
that.requestRegister(res.code);
}
});
},
bindUsernameInput: function(e) {
this.setData({
username: e.detail.value
});
},
bindPasswordInput: function(e) {
this.setData({
password: e.detail.value
});
},
bindConfirmPasswordInput: function(e) {
this.setData({
confirmPassword: e.detail.value
});
},
bindMobileInput: function(e) {
this.setData({
mobile: e.detail.value
});
},
bindCodeInput: function(e) {
this.setData({
code: e.detail.value
});
},
clearInput: function(e) {
switch (e.currentTarget.id) {
case 'clear-username':
this.setData({
username: ''
});
break;
case 'clear-password':
this.setData({
password: ''
});
break;
case 'clear-confirm-password':
this.setData({
confirmPassword: ''
});
break;
case 'clear-mobile':
this.setData({
mobile: ''
});
break;
case 'clear-code':
this.setData({
code: ''
});
break;
}
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "注册",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,35 @@
<view class="container">
<view class="form-box">
<view class="form-item">
<input class="username" value="{{username}}" bindinput="bindUsernameInput" placeholder="用户名" auto-focus/>
<image wx:if="{{ username.length > 0 }}" id="clear-username" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码" />
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="password" value="{{confirmPassword}}" password bindinput="bindConfirmPasswordInput" placeholder="确认密码" />
<image class="clear" id="clear-confirm-password" wx:if="{{ confirmPassword.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="mobile" value="{{mobile}}" bindinput="bindMobileInput" placeholder="手机号" />
<image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item-code">
<view class="form-item code-item">
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码" />
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="code-btn" bindtap="sendCode">获取验证码</view>
</view>
<button type="primary" class="register-btn" bindtap="startRegister">注册</button>
</view>
</view>

View File

@ -0,0 +1,69 @@
.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 #d9d9d9;
}
.form-item .username, .form-item .password, .form-item .mobile, .form-item .code {
position: absolute;
top: 26rpx;
left: 0;
display: block;
width: 100%;
height: 44rpx;
background: #fff;
color: #333;
font-size: 30rpx;
}
.form-item-code {
margin-top: 32rpx;
height: auto;
overflow: hidden;
width: 100%;
}
.form-item-code .form-item {
float: left;
width: 350rpx;
}
.form-item-code .code-btn {
float: right;
padding: 20rpx 40rpx;
border: 1px solid #d9d9d9;
border-radius: 10rpx;
color: #fff;
background: green;
}
.form-item .clear {
position: absolute;
top: 26rpx;
right: 18rpx;
z-index: 2;
display: block;
background: #fff;
height: 44rpx;
width: 44rpx;
}
.register-btn {
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
color: #fff;
font-size: 30rpx;
width: 100%;
border-radius: 6rpx;
}

View File

@ -0,0 +1,172 @@
var api = require('../../../config/api.js');
var check = require('../../../utils/check.js');
var app = getApp();
Page({
data: {
mobile: '',
code: '',
password: '',
confirmPassword: ''
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
// 页面渲染完成
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
sendCode: function() {
let that = this;
wx.request({
url: api.AuthRegisterCaptcha,
data: {
mobile: that.data.mobile
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
wx.showModal({
title: '发送成功',
content: '验证码已发送',
showCancel: false
});
} else {
wx.showModal({
title: '错误信息',
content: res.data.errmsg,
showCancel: false
});
}
}
});
},
startReset: function() {
var that = this;
if (this.data.mobile.length == 0 || this.data.code.length == 0) {
wx.showModal({
title: '错误信息',
content: '手机号和验证码不能为空',
showCancel: false
});
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
if (this.data.password.length < 3) {
wx.showModal({
title: '错误信息',
content: '用户名和密码不得少于3位',
showCancel: false
});
return false;
}
if (this.data.password != this.data.confirmPassword) {
wx.showModal({
title: '错误信息',
content: '确认密码不一致',
showCancel: false
});
return false;
}
wx.request({
url: api.AuthReset,
data: {
mobile: that.data.mobile,
code: that.data.code,
password: that.data.password
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
wx.navigateBack();
} else {
wx.showModal({
title: '密码重置失败',
content: res.data.errmsg,
showCancel: false
});
}
}
});
},
bindPasswordInput: function(e) {
this.setData({
password: e.detail.value
});
},
bindConfirmPasswordInput: function(e) {
this.setData({
confirmPassword: e.detail.value
});
},
bindMobileInput: function(e) {
this.setData({
mobile: e.detail.value
});
},
bindCodeInput: function(e) {
this.setData({
code: e.detail.value
});
},
clearInput: function(e) {
switch (e.currentTarget.id) {
case 'clear-password':
this.setData({
password: ''
});
break;
case 'clear-confirm-password':
this.setData({
confirmPassword: ''
});
break;
case 'clear-mobile':
this.setData({
mobile: ''
});
break;
case 'clear-code':
this.setData({
code: ''
});
break;
}
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "密码重置",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,30 @@
<view class="container">
<view class="form-box">
<view class="form-item">
<input class="mobile" value="{{mobile}}" bindinput="bindMobileInput" placeholder="手机号" />
<image wx:if="{{ mobile.length > 0 }}" id="clear-mobile" class="clear" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item-code">
<view class="form-item code-item">
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码" />
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="code-btn" bindtap="sendCode">获取验证码</view>
</view>
<view class="form-item">
<input class="password" value="{{password}}" password bindinput="bindPasswordInput" placeholder="密码" />
<image class="clear" id="clear-password" wx:if="{{ password.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="form-item">
<input class="password" value="{{confirmPassword}}" password bindinput="bindConfirmPasswordInput" placeholder="确认密码" />
<image class="clear" id="clear-confirm-password" wx:if="{{ confirmPassword.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<button type="default" class="reset-btn" bindtap="startReset">密码重置</button>
</view>
</view>

View File

@ -0,0 +1,68 @@
.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 #d9d9d9;
}
.form-item .mobile, .form-item .password, .form-item .code {
position: absolute;
top: 26rpx;
left: 0;
display: block;
width: 100%;
height: 44rpx;
background: #fff;
color: #333;
font-size: 30rpx;
}
.form-item-code {
margin-top: 32rpx;
height: auto;
overflow: hidden;
width: 100%;
}
.form-item-code .form-item {
float: left;
width: 350rpx;
}
.form-item-code .code-btn {
float: right;
padding: 20rpx 40rpx;
border: 1px solid #d9d9d9;
border-radius: 10rpx;
}
.form-item .clear {
position: absolute;
top: 26rpx;
right: 18rpx;
z-index: 2;
display: block;
background: #fff;
height: 44rpx;
width: 44rpx;
}
.reset-btn {
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
color: #fff;
font-size: 30rpx;
width: 100%;
background: #b4282d;
border-radius: 6rpx;
}

View File

@ -0,0 +1,59 @@
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
});
}
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() {
// 页面关闭
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "品牌厂商直供",
"enablePullDownRefresh": false
}

View File

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

View File

@ -0,0 +1,52 @@
.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 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 .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, 0.32);
color: #fff;
}
.brand-list .item .line .s {
padding: 0 10rpx;
font-size: 40rpx;
}

View File

@ -0,0 +1,69 @@
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var app = getApp();
Page({
data: {
id: 0,
brand: {},
goodsList: [],
page: 1,
size: 200
},
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) {
that.setData({
brand: res.data.brand
});
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() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "品牌商详情",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,28 @@
<view class="container">
<view class="brand-info">
<view class="name">
<image class="img" src="{{brand.picUrl}}" background-size="cover"></image>
<view class="info-box">
<view class="info">
<text class="txt">{{brand.name}}</text>
<text class="line"></text>
</view>
</view>
</view>
<view class="desc">
{{brand.desc}}
</view>
</view>
<view class="cate-item">
<view class="b">
<block wx:for="{{goodsList}}" wx:key="id" wx:for-index="iindex" wx:for-item="iitem">
<navigator class="item {{iindex % 2 == 0 ? 'item-b' : ''}}" url="../goods/goods?id={{iitem.id}}">
<image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
<text class="name">{{iitem.name}}</text>
<text class="price">¥{{iitem.retailPrice}}</text>
</navigator>
</block>
</view>
</view>
</view>

View File

@ -0,0 +1,111 @@
page {
background: #f4f4f4;
}
.brand-info .name {
width: 100%;
height: 290rpx;
position: relative;
}
.brand-info .img {
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;
}
.brand-info .info {
display: block;
}
.brand-info .txt {
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;
}
.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;
}
.cate-item .b {
width: 750rpx;
height: auto;
overflow: hidden;
border-top: 1rpx solid #f4f4f4;
margin-top: 20rpx;
}
.cate-item .b .item {
float: left;
background: #fff;
width: 375rpx;
padding-bottom: 33.333rpx;
border-bottom: 1rpx solid #f4f4f4;
height: auto;
overflow: hidden;
text-align: center;
}
.cate-item .b .item-b {
border-right: 1rpx solid #f4f4f4;
}
.cate-item .item .img {
margin-top: 10rpx;
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 35rpx;
padding: 0 20rpx;
overflow: hidden;
margin: 11.5rpx 0 22rpx 0;
text-align: center;
font-size: 30rpx;
color: #333;
}
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
font-size: 30rpx;
color: #b4282d;
}

View File

@ -0,0 +1,126 @@
var app = getApp();
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
Page({
data: {
today_type:"active",
yestoday_type:"disable",
week_type:"disable",
month_type: "disable",
hasLogin: false
},
onLoad: function(options) {
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
//获取用户的登录信息
if (app.globalData.hasLogin) {
let userInfo = wx.getStorageSync('userInfo');
this.setData({
userInfo: userInfo,
hasLogin: true
});
let that = this;
util.request(api.BrokerageMain).then(function (res) {
if (res.errno === 0) {
that.setData({
totalAmount: res.data.totalAmount,
remainAmount: res.data.remainAmount,
lastMonthSettleMoney: res.data.lastMonthSettleMoney,
currMonthSettleMoney: res.data.currMonthSettleMoney,
currType: res.data.todayData,
todayData: res.data.todayData,
yestodayData: res.data.yestodayData,
weekData: res.data.weekData,
monthData: res.data.monthData,
});
}
});
}
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchTabType:function(e){
var type = e.currentTarget.dataset.type;
var currType;
var today_type = "disable";
var yestoday_type = "disable";
var week_type = "disable";
var month_type = "disable";
if (type == 1){
currType = this.data.todayData;
today_type = "active";
} else if (type == 2) {
currType = this.data.yestodayData;
yestoday_type = "active";
} else if (type == 3) {
currType = this.data.weekData;
week_type = "active";
} else if (type == 4) {
currType = this.data.monthData;
month_type = "active";
}
this.setData({
currType: currType,
today_type: today_type,
yestoday_type: yestoday_type,
week_type: week_type,
month_type: month_type
})
},
goOrderList: function () {
if (this.data.hasLogin) {
wx.navigateTo({
url: "/pages/brokerage/order/order"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
goExtract: function () {
if (this.data.hasLogin) {
wx.navigateTo({
url: "/pages/brokerage/record/record"
});
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
},
extractMoney: function () {
if (this.data.hasLogin) {
if (this.data.remainAmount >= 1){
wx.navigateTo({
url: "/pages/brokerage/withdrawal/withdrawal?remainAmount=" + this.data.remainAmount
});
} else {
wx.showModal({
title: '提示',
content: '您的可提现金额小于1元暂时无法申请提现',
showCancel:false,
success (res) {
//暂时不做处理
}
});
}
} else {
wx.navigateTo({
url: "/pages/auth/login/login"
});
}
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "佣金收益",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,82 @@
<view class="container">
<view class="h">
<view class="line"></view>
<text class="title">可提现余额</text>
</view>
<view class="b">
<view class="number">¥ {{remainAmount}}</view>
<view class='extractBtn' bindtap="extractMoney">
<text class='btxt'>提现申请</text>
</view>
</view>
<view class='separate'></view>
<view class='user_area'>
<view class='user_row' bindtap='goExtract'>
<view class='user_row_left jhx_f4'>我的提现记录</view>
<text class='user_row_right iconfont icon-jiantou jhx_f6'></text>
</view>
<view class='user_column'>
<view class="item_left">
<text class="name"> 本月收益</text>
<text class="money" >¥ {{currMonthSettleMoney}}</text>
</view>
<view class="item_rigth">
<text class="name"> 上月收益 </text>
<text class="money">¥ {{lastMonthSettleMoney}}</text>
</view>
</view>
</view>
<view class='separate'></view>
<view class='order_area'>
<view class='user_row' bindtap='goOrderList'>
<view class='user_row_left jhx_f4'>推广订单明细</view>
<text class='user_row_right iconfont icon-jiantou jhx_f6'></text>
</view>
<view class="chose_type">
<button class='btn_left {{today_type}}' data-type="1" bindtap="switchTabType">
<text class='chose-p'>今日</text>
</button>
<button class='btn_center {{yestoday_type}}' data-type="2" bindtap="switchTabType">
<text class='chose-p'>昨日</text>
</button>
<button class='btn_center {{week_type}}' data-type="3" bindtap="switchTabType">
<text class='chose-p'>近7日</text>
</button>
<button class='btn_rigth {{month_type}}' data-type="4" bindtap="switchTabType">
<text class='chose-p'>近30日</text>
</button>
</view>
<view class='order_column'>
<view class="order_column_item">
<text class="info"> 推广用户数</text>
<text class="value" >{{currType.userCnt}} 个</text>
</view>
<view class="order_column_item">
<text class="info"> 推广订单数 </text>
<text class="value">{{currType.orderCnt}} 笔</text>
</view>
</view>
<view class='order_column'>
<view class="order_column_item">
<text class="info"> 预估收益</text>
<text class="value" >{{currType.orderSettleAmt}} 元</text>
</view>
<view class="order_column_item">
<text class="info"> 预估结算收益 </text>
<text class="value">{{currType.finalSettleAmt}} 元</text>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,294 @@
.container {
margin-bottom: 100rpx;
width: 750rpx;
height: auto;
overflow: hidden;
}
.container .h {
position: relative;
height: 145.5rpx;
width: 750rpx;
padding: 56.25rpx 0;
background: #fff;
text-align: center;
}
.container .h .line {
display: inline-block;
position: absolute;
top: 72rpx;
left: 0;
z-index: 2;
height: 1px;
margin-left: 125rpx;
width: 500rpx;
background: #ccc;
}
.container .h .title {
display: inline-block;
position: absolute;
top: 56.125rpx;
left: 0;
z-index: 3;
height: 33rpx;
margin-left: 285rpx;
width: 180rpx;
background: #fff;
}
.container .b {
width: 750rpx;
height: auto;
overflow: hidden;
padding: 0rpx 30rpx;
background: #fff;
}
.container .number {
height: auto;
overflow: hidden;
padding-bottom: 25rpx;
text-align: center;
font-size: 88rpx;
color:#e62222;
}
.extractBtnss {
width: 60%;
height: 80rpx;
margin-top: 20rpx;
background-color:#85c43f;
border-radius: 98rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
margin-bottom: 40rpx;
}
.extractBtn{background-color:#85c43f;font-size:32rpx;color:#fff;width:560rpx;height:90rpx;border-radius:50rpx;text-align:center;line-height:90rpx;margin:36rpx auto 40rpx auto;}
.extractBtn .btxt{
color: #fff;
font-size: 42rpx;
}
.btn::after {
border-radius: 98rpx;
border: 0;
}
.user_area {
width: 100%;
height: 246rpx;
margin-top: 5rpx;
background: #fff;
border-top: 8rpx solid #f4f4f4;
}
.user_row {
/* border: 1px solid black; */
height: 86rpx;
line-height: 86rpx;
border-bottom: 1px solid #eaeaea;
}
.user_row_left {
/* border: 1px solid #757575; */
float: left;
height: 86rpx;
line-height: 86rpx;
margin-left: 35rpx;
letter-spacing: 1rpx;
}
.user_row_right {
/* border: 1px solid #757575; */
float: right;
height: 40rpx;
width: 40rpx;
font-weight: 550;
line-height: 86rpx;
margin-right: 30rpx;
}
.user_column {
/* border: 1px solid black; */
height: 190rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-right: 30rpx;
line-height: 190rpx;
padding-bottom: 40rpx;
margin-bottom: 40rpx;
}
.item_left {
padding-top: 12rpx;
height: 115rpx;
width:50%;
float: left;
text-align: center;
position: relative;
border-right: 1rpx solid #eaeaea;
}
.item_rigth {
padding-top: 12rpx;
height: 115rpx;
width:50%;
text-align: center;
position: relative;
float: right;
}
.user_column .name {
display: block;
height: 45rpx;
line-height: 45rpx;
color: #999;
font-size: 32.5rpx;
margin-bottom: 15rpx;
}
.user_column .money {
display: block;
height: 30rpx;
text-align:center;
line-height: 30rpx;
margin-bottom: 10rpx;
color: #333;
font-size: 32rpx;
}
.order_area {
width: 100%;
height: 520rpx;
margin-top: 5rpx;
background: #fff;
border-top: 8rpx solid #f4f4f4;
}
.chose_type{
height: 80rpx;
line-height: 80rpx;
margin: 40rpx;
}
.chose-p{
line-height: 40rpx;
width: 100%;
height:40rpx;
}
.btn_left{
line-height: 60rpx;
height:60rpx;
width: 24%;
text-align: center;
float: left;
align-items: center;
}
.active{
background-color: #85c43f;
}
.active text{
color:#fff;
}
.disable{
background-color: #FFF;
}
.disable text{
color:#999;
}
.btn_center{
line-height: 60rpx;
height:60rpx;
width: 25%;
text-align: center;
float: left;
border-radius: 0;
align-items: center;
}
.btn_rigth {
line-height: 60rpx;
height:60rpx;
width: 25%;
text-align: center;
float: left;
align-items: center;
}
.order_area button{
border-radius: 0;
border: 1rpx solid #eaeaea;
margin-right: -1rpx;
}
.order_area button::after {
border-radius: 0;
}
button.btn_left {
border-radius: 0;
border-top-left-radius: 98rpx;
border-bottom-left-radius: 98rpx;
}
button.btn_left::after{
border-radius: 0;
border-top-left-radius: 98rpx;
border-bottom-left-radius: 98rpx;
}
button.btn_rigth{
border-radius: 0;
border-top-right-radius: 98rpx;
border-bottom-right-radius: 98rpx;
}
button.btn_rigth::after{
border-radius: 0;
border-top-right-radius: 98rpx;
border-bottom-right-radius: 98rpx;
}
.order_column {
height: 120rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-right: 30rpx;
line-height: 100rpx;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
}
.order_column_item {
width: 50%;
height: 100rpx;
background: #fff;
text-align: center;
position: relative;
}
.order_column_item .info {
display: block;
height: 45rpx;
line-height: 45rpx;
color: #999;
font-size: 30.5rpx;
margin-bottom: 15rpx;
}
.order_column_item .value {
display: block;
height: 30rpx;
line-height: 30rpx;
margin-bottom: 10rpx;
color: #000;
font-size: 34rpx;
}

View File

@ -0,0 +1,79 @@
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
Page({
data: {
orderList: [],
showType: 0,
page: 1,
size: 10,
totalPages: 1
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
let that = this
try {
var tab = wx.getStorageSync('tab');
this.setData({
showType: tab
});
} catch (e) {}
},
getOrderList() {
let that = this;
util.request(api.SettleOrderList, {
showType: that.data.showType,
page: that.data.page,
size: that.data.size
}).then(function(res) {
if (res.errno === 0) {
console.log(res.data);
that.setData({
orderList: that.data.orderList.concat(res.data.data),
totalPages: res.data.totalPages
});
}
});
},
onReachBottom() {
if (this.data.totalPages > this.data.page) {
this.setData({
page: this.data.page + 1
});
this.getOrderList();
} else {
wx.showToast({
title: '没有更多订单了',
icon: 'none',
duration: 2000
});
return false;
}
},
switchTab: function(event) {
let showType = event.currentTarget.dataset.index;
this.setData({
orderList: [],
showType: showType,
page: 1,
size: 10,
totalPages: 1
});
this.getOrderList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getOrderList();
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "我的推广订单",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,46 @@
<view class="container">
<view class="orders-switch">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
<view class="txt">所有订单</view>
</view>
<view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
<view class="txt">有效订单</view>
</view>
<view 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="/static/images/noCart_old.png" />
<text>还没有任何订单呢</text>
</view>
</view>
<view class="orders">
<view class="order" open-type="redirect" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
<image src="{{gitem.picUrl}}"></image>
</view>
<view class="info">
<text class="name">{{gitem.goodsName}}</text>
</view>
<view class="status"></view>
</view>
<view class="b">
<view class="l price">实付:¥{{item.actualPrice}}</view>
</view>
</view>
</view>
</view>

View File

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

View File

@ -0,0 +1,44 @@
var util = require('../../../utils/util.js');
var api = require('../../../config/api.js');
var app = getApp();
Page({
data: {
accountTraceList: [],
page: 1,
size: 10,
totalPages: 1
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
this.getRecordList();
},
getRecordList() {
let that = this;
util.request(api.ExtractList, {
page: that.data.page,
size: that.data.size
}).then(function (res) {
if (res.errno === 0) {
console.log(res.data);
that.setData({
accountTraceList: res.data.accountTraceList,
totalPages: res.data.totalPages
});
}
});
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "我的提现记录",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,24 @@
<view class="container">
<view class="address-list" wx:if="{{ accountTraceList.length > 0 }}">
<view class="item" wx:for="{{accountTraceList}}" wx:key="id" data-address-id="{{item.id}}">
<view class="l">
<view class="name">{{item.amount}}</view>
<view class="default" wx:if="{{item.type == 1}}">提现中</view>
<view class="default" wx:if="{{item.type == 2}}">已提现</view>
<view class="default" wx:if="{{item.type == 0}}">月结</view>
</view>
<view class="c">
<view class="mobile" wx:if="{{item.type == 1}}">{{item.mobile}}</view>
<view class="mobile" wx:if="{{item.type == 0}}">系统</view>
<view class="address">时间:{{item.traceTime}}</view>
</view>
<view class="r">
<view class="del">余额:{{item.remainAmount}}</view>
</view>
</view>
</view>
<view class="empty-view" wx:if="{{ recordList.length <= 0 }}">
<image class="icon" src="http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/noAddress-26d570cefa.png"></image>
<text class="text">您尚未有提现记录,努力加油推广吧!</text>
</view>
</view>

View File

@ -0,0 +1,139 @@
page {
height: 100%;
width: 100%;
background: #f4f4f4;
}
.container {
height: 100%;
width: 100%;
}
.address-list {
padding-left: 31.25rpx;
background: #fff;
background-size: auto 10.5rpx;
margin-bottom: 90rpx;
}
.address-list .item {
height: 156.55rpx;
align-items: center;
display: flex;
border-bottom: 1rpx solid #dcd9d9;
}
.address-list .l {
width: 155rpx;
height: 80rpx;
overflow: hidden;
}
.address-list .name {
width: 155rpx;
height: 43rpx;
font-size: 29rpx;
color: #333;
margin-bottom: 5.2rpx;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.address-list .default {
width: 82.5rpx;
height: 33rpx;
line-height: 28rpx;
text-align: center;
font-size: 20rpx;
color: #b4282d;
border: 1rpx solid #b4282d;
visibility: visible;
}
.address-list .c {
flex: 1;
height: auto;
overflow: hidden;
}
.address-list .mobile {
height: 29rpx;
font-size: 29rpx;
line-height: 29rpx;
overflow: hidden;
color: #333;
margin-bottom: 6.25rpx;
}
.address-list .address {
height: 37rpx;
font-size: 25rpx;
line-height: 37rpx;
overflow: hidden;
color: #666;
}
.address-list .r {
width: 252rpx;
height: auto;
overflow: hidden;
margin-right: 16.5rpx;
}
.address-list .del {
display: block;
width: 252rpx;
height: 52rpx;
padding-left: 40rpx;
}
.add-address {
border: none;
right: 0;
display: flex;
justify-content: center;
align-items: center;
width: 90%;
height: 90rpx;
line-height: 98rpx;
position: absolute;
bottom: 0;
left: 0;
border-radius: 0;
padding: 0;
margin: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
font-size: 25rpx;
color: #f4f4f4;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}
.empty-view {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.empty-view .icon {
height: 248rpx;
width: 258rpx;
margin-bottom: 10rpx;
}
.empty-view .text {
width: auto;
font-size: 28rpx;
line-height: 35rpx;
color: #999;
}

View File

@ -0,0 +1,124 @@
var api = require('../../../config/api.js');
var check = require('../../../utils/check.js');
var app = getApp();
Page({
data: {
amt: '0.00',
mobile: '',
code: ''
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
let userInfo = wx.getStorageSync('userInfo');
this.setData({
amt: options.remainAmount,
mobile:userInfo.phone
});
// 页面渲染完成
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
sendCode: function() {
let that = this;
if (this.data.mobile.length == 0) {
wx.showModal({
title: '错误信息',
content: '手机号不能为空',
showCancel: false
});
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
wx.request({
url: api.AuthRegisterCaptcha,
data: {
mobile: that.data.mobile
},
method: 'POST',
header: {
'content-type': 'application/json'
},
success: function(res) {
if (res.data.errno == 0) {
wx.showModal({
title: '发送成功',
content: '验证码已发送',
showCancel: false
});
} else {
wx.showModal({
title: '错误信息',
content: res.data.errmsg,
showCancel: false
});
}
}
});
},
goWithdrawal: function() {
var that = this;
if (this.data.mobile.length == 0 || this.data.code.length == 0) {
wx.showModal({
title: '错误信息',
content: '手机号和验证码不能为空',
showCancel: false
});
return false;
}
if (!check.isValidPhone(this.data.mobile)) {
wx.showModal({
title: '错误信息',
content: '手机号输入不正确',
showCancel: false
});
return false;
}
//调用后台申请提现接口
},
bindMobileInput: function(e) {
this.setData({
mobile: e.detail.value
});
},
bindCodeInput: function(e) {
this.setData({
code: e.detail.value
});
},
clearInput: function(e) {
switch (e.currentTarget.id) {
case 'clear-code':
this.setData({
code: ''
});
break;
}
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "提现",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,22 @@
<view class="container">
<view class="form-box">
<view class="form-item">
<view class="amt">提现金额:{{amt}} 元</view>
</view>
<view class="form-item">
<view class="mobile" wx:if="{{mobile && mobile != ''}}">绑定手机号:{{mobile}}</view>
<view class="mobile" wx:else>请去设置页面绑定手机</view>
</view>
<view class="form-item-code">
<view class="form-item code-item">
<input class="code" value="{{code}}" bindinput="bindCodeInput" placeholder="验证码" />
<image class="clear" id="clear-code" wx:if="{{ code.length > 0 }}" src="/static/images/clear_input.png" catchtap="clearInput"></image>
</view>
<view class="code-btn" bindtap="sendCode">获取验证码</view>
</view>
<button type="primary" class="register-btn" bindtap="goWithdrawal">发起申请</button>
</view>
</view>

View File

@ -0,0 +1,68 @@
.form-box {
width: 100%;
height: auto;
overflow: hidden;
padding: 0 40rpx;
background: #fff;
}
.form-item {
position: relative;
background: #fff;
height: 96rpx;
border-bottom: 1px solid #d9d9d9;
}
.form-item .amt, .form-item .mobile, .form-item .code {
position: absolute;
top: 26rpx;
left: 0;
display: block;
width: 100%;
height: 44rpx;
background: #fff;
color: #333;
font-size: 30rpx;
}
.form-item-code {
margin-top: 32rpx;
height: auto;
overflow: hidden;
width: 100%;
}
.form-item-code .form-item {
float: left;
width: 350rpx;
}
.form-item-code .code-btn {
float: right;
padding: 20rpx 40rpx;
border: 1px solid #d9d9d9;
border-radius: 10rpx;
color: #fff;
background: green;
}
.form-item .clear {
position: absolute;
top: 26rpx;
right: 18rpx;
z-index: 2;
display: block;
background: #fff;
height: 44rpx;
width: 44rpx;
}
.register-btn {
margin: 60rpx 0 40rpx 0;
height: 96rpx;
line-height: 96rpx;
color: #fff;
font-size: 30rpx;
width: 100%;
border-radius: 6rpx;
}

View File

@ -0,0 +1,530 @@
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var user = require('../../utils/user.js');
var app = getApp();
Page({
data: {
isMultiOrderModel:0,
cartGoods: [],
brandCartgoods:[],
cartTotal: {
"goodsCount": 0,
"goodsAmount": 0.00,
"checkedGoodsCount": 0,
"checkedGoodsAmount": 0.00
},
isEditCart: false,
checkedAllStatus: true,
editCartList: [],
hasLogin: false
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
onReady: function() {
// 页面渲染完成
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getCartList();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
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"
});
},
getCartList: function() {
let that = this;
util.request(api.CartList).then(function(res) {
if (res.errno === 0) {
if (res.data.isMultiOrderModel === 1){
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
brandCartgoods: res.data.brandCartgoods,
cartTotal: res.data.cartTotal
});
} else {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
}
});
},
isChildCheckedAll: function (cartList){
return cartList.every(function (element, index, array) {
if (element.checked == true) {
return true;
} else {
return false;
}
});
},
isCheckedAll: function() {
let that = this;
if (that.data.isMultiOrderModel === 1){
//多店铺模式的商品全选判断
return that.data.brandCartgoods.every(function (element, index, array) {
if (that.isChildCheckedAll(element.cartList)){
return true;
} else {
return false;
}
});
} else {
//判断购物车商品已全选
return that.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()
});
},
getProductChecked:function(productId){
let that = this;
let isChecked = null;
if (that.data.isMultiOrderModel === 1) {
that.data.brandCartgoods.forEach(function (v) {
let cartList = v.cartList;
cartList.forEach(function(o){
if (o.productId === productId) {
isChecked = o.checked ? 0 : 1;
}
});
});
} else {
that.data.cartGoods.forEach(function(o){
if (o.productId === productId) {
isChecked = o.checked ? 0 : 1;
}
});
}
return isChecked;
},
checkedItem: function(event) {
//let itemIndex = event.target.dataset.itemIndex;
let productId = event.currentTarget.dataset.productid;
let that = this;
let productIds = [];
productIds.push(productId);
let isChecked = that.getProductChecked(productId);
if (!this.data.isEditCart) {
util.request(api.CartChecked, {
productIds: productIds,
isChecked: isChecked
}, 'POST').then(function(res) {
if (res.errno === 0) {
if (res.data.isMultiOrderModel === 1) {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
brandCartgoods: res.data.brandCartgoods,
cartTotal: res.data.cartTotal
});
} else {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
} else {
//编辑状态
if (that.data.isMultiOrderModel === 1) {
let tmpBrandCartData = this.data.brandCartgoods.map(function (element, index, array) {
let tmpBrandGoods = element.cartList.map(function (childEle,childIndex,childArr){
if (childEle.productId === productId) {
childEle.checked = !childEle.checked;
}
return childEle;
});
element.cartList = tmpBrandGoods;
return element;
});
that.setData({
brandCartgoods: tmpBrandCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
} else {
let tmpCartData = this.data.cartGoods.map(function (element, index, array) {
if (element.productId === productId) {
element.checked = !element.checked;
}
return element;
});
that.setData({
cartGoods: tmpCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
}
}
},
getCheckedGoodsCount: function() {
let that = this;
let checkedGoodsCount = 0;
if (that.data.isMultiOrderModel === 1) {
that.data.brandCartgoods.forEach(function (v) {
v.cartList.forEach(function (o){
if (o.checked === true) {
checkedGoodsCount += o.number;
}
});
});
} else {
that.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) {
let productIds = [];
if (that.data.isMultiOrderModel === 1) {
that.data.brandCartgoods.forEach(function (v) {
v.cartList.forEach(function (o) {
productIds.push(o.productId);
});
});
} else {
var productIds = that.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);
if (res.data.isMultiOrderModel === 1) {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
brandCartgoods: res.data.brandCartgoods,
cartTotal: res.data.cartTotal
});
} else {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
});
} else {
//编辑状态,将所有
let checkedAllStatus = that.isCheckedAll();
if (that.data.isMultiOrderModel === 1) {
let tmpBrandCartData = this.data.brandCartgoods.map(function (element, index, array) {
let tmpBrandGoods = element.cartList.map(function (childEle, childIndex, childArr) {
childEle.checked = !checkedAllStatus;
return childEle;
});
element.cartList = tmpBrandGoods;
return element;
});
that.setData({
brandCartgoods: tmpBrandCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
} else {
let tmpCartData = this.data.cartGoods.map(function (element, index, array) {
element.checked = !checkedAllStatus;
return element;
});
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 {
//编辑状态
if (that.data.isMultiOrderModel === 1) {
let tmpBrandCartData = that.data.brandCartgoods.map(function (element, index, array) {
let tmpBrandGoods = element.cartList.map(function (childEle, childIndex, childArr) {
childEle.checked = false;
return childEle;
});
element.cartList = tmpBrandGoods;
return element;
});
that.setData({
brandCartgoods: tmpBrandCartData,
isEditCart: !that.data.isEditCart,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
} else {
let tmpCartData = that.data.cartGoods.map(function (element, index, array) {
element.checked = false;
return element;
});
that.setData({
// editCartList: this.data.cartGoods,
cartGoods: tmpCartList,
isEditCart: !that.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()
});
});
},
getProductItem: function (productId){
let that = this;
let productItem = null;
if (that.data.isMultiOrderModel === 1) {
that.data.brandCartgoods.forEach(function (v) {
let cartList = v.cartList;
cartList.forEach(function (o) {
if (o.productId === productId) {
productItem = o;
}
});
});
} else {
that.data.cartGoods.forEach(function (o) {
if (o.productId === productId) {
productItem = o;
}
});
}
return productItem;
},
setProductItem: function (cartItem,productId){
let that = this;
if (that.data.isMultiOrderModel === 1) {
let tmpBrandCartData = this.data.brandCartgoods.map(function (element, index, array) {
let tmpBrandGoods = element.cartList.map(function (childEle, childIndex, childArr) {
if (childEle.productId === productId) {
return cartItem;
} else {
return childEle;
}
});
element.cartList = tmpBrandGoods;
return element;
});
that.setData({
brandCartgoods: tmpBrandCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
} else {
let tmpCartData = this.data.cartGoods.map(function (element, index, array) {
if (element.productId === productId) {
return cartItem;
} else {
return element;
}
});
that.setData({
cartGoods: tmpCartData,
checkedAllStatus: that.isCheckedAll(),
'cartTotal.checkedGoodsCount': that.getCheckedGoodsCount()
});
}
},
cutNumber: function(event) {
//let itemIndex = event.target.dataset.itemIndex;
let productId = event.currentTarget.dataset.productid;
let cartItem = this.getProductItem(productId);
let number = (cartItem.number - 1 > 1) ? cartItem.number - 1 : 1;
cartItem.number = number;
this.setProductItem(cartItem, productId);
this.updateCart(cartItem.productId, cartItem.goodsId, number, cartItem.id);
},
addNumber: function(event) {
// let itemIndex = event.target.dataset.itemIndex;
let productId = event.currentTarget.dataset.productid;
let cartItem = this.getProductItem(productId);
let number = cartItem.number + 1;
cartItem.number = number;
this.setProductItem(cartItem, productId);
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;
}*/
if(that.getCheckedGoodsCount() <= 0){
wx.showModal({
title: '错误信息',
content: '请勾选需要下单的商品!',
showCancel: false
});
return false;
}
// storage中设置了cartId则是购物车购买
try {
wx.setStorageSync('cartId', 0);
wx.navigateTo({
url: '/pages/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;
}*/
if (that.getCheckedGoodsCount() <= 0) {
wx.showModal({
title: '错误信息',
content: '请勾选需要删除的商品!',
showCancel: false
});
return false;
}
let productIds = [];
if (that.data.isMultiOrderModel === 1) {
that.data.brandCartgoods.forEach(function (v) {
v.cartList.forEach(function (o) {
if (o.checked == true){
productIds.push(o.productId);
}
});
});
} else {
productIds = that.data.cartGoods.map(function (v) {
if (v.checked == true) {
return v.productId;
}
});
}
util.request(api.CartDelete, {
productIds: productIds
}, 'POST').then(function(res) {
if (res.errno === 0) {
if (res.data.isMultiOrderModel === 1) {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
brandCartgoods: res.data.brandCartgoods,
cartTotal: res.data.cartTotal
});
} else {
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
cartGoods: res.data.cartList,
cartTotal: res.data.cartTotal
});
}
that.setData({
checkedAllStatus: that.isCheckedAll()
});
}
});
}
})

View File

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

View File

@ -0,0 +1,92 @@
<view class="container">
<view class="no-login" wx:if="{{!hasLogin}}">
<view class="c">
<image src="/static/images/noCart.png" />
<button style="background-color:#A9A9A9" bindtap="goLogin">去登录</button>
</view>
</view>
<view class='login' wx:else>
<view class="service-policy">
<view class="item">全场优惠券抵扣</view>
<view class="item">7天无忧快速退货</view>
<view class="item">满66元免邮费</view>
</view>
<view class="no-cart" wx:if="{{cartGoods.length <= 0 && brandCartgoods.length <=0 }}">
<view class="c">
<image src="/static/images/noCart.png" />
</view>
</view>
<view class="cart-view" wx:else>
<view class="list" wx:if="{{isMultiOrderModel==1}}">
<view class="group-item">
<view class="goods" wx:for="{{brandCartgoods}}" wx:key="brandId" wx:for-item="bitem">
<navigator url="../brandDetail/brandDetail?id={{bitem.brandId}}" class="h">
<view class="l">{{bitem.brandName}} > </view>
</navigator>
<view class="item {{isEditCart ? 'edit' : ''}}" wx:for="{{ bitem.cartList}}" wx:key="id">
<view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-productid="{{item.productId}}"></view>
<view class="cart-goods">
<image class="img" src="{{item.picUrl}}"></image>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
</view>
<view class="b">
<text class="price">¥{{item.price}}</text>
<text class="num"> x{{item.number}}</text>
<!-- <text class="attr">{{ isEditCart ? '已选择:' : ''}}{{item.specifications||''}}</text> -->
<view class="selnum">
<view class="cut" bindtap="cutNumber" data-productid="{{item.productId}}">-</view>
<input value="{{item.number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber" data-productid="{{item.productId}}">+</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="list" wx:else>
<view class="group-item">
<view class="goods">
<view class="item {{isEditCart ? 'edit' : ''}}" wx:for="{{cartGoods}}" wx:key="id">
<view class="checkbox {{item.checked ? 'checked' : ''}}" bindtap="checkedItem" data-productId="{{item.productId}}"></view>
<view class="cart-goods">
<image class="img" src="{{item.picUrl}}"></image>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
<text class="num">x{{item.number}}</text>
</view>
<view class="attr">{{ isEditCart ? '已选择:' : ''}}{{item.goodsSpecificationValues||''}}</view>
<view class="b">
<text class="price">¥{{item.price}}</text>
<view class="selnum">
<view class="cut" bindtap="cutNumber" data-productid="{{item.productId}}">-</view>
<input value="{{item.number}}" class="number" disabled="true" type="number" />
<view class="add" bindtap="addNumber" data-productid="{{item.productId}}">+</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='action_btn_area'>
<view class="{{!isEditCart ? 'edit' : 'sure'}}" bindtap="editCart">{{!isEditCart ? '编辑' : '完成'}}</view>
<view class="delete" bindtap="deleteCart" wx:if="{{isEditCart}}">删除({{cartTotal.checkedGoodsCount}})</view>
<view class="checkout" bindtap="checkoutOrder" wx:if="{{!isEditCart}}">下单</view>
<!-- </view> -->
</view>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,560 @@
page {
height: 100%;
min-height: 100%;
background: #f4f4f4;
}
.container {
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;
}
.service-policy .item {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAM1BMVEWrKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKytnkgnjAAAAEHRSTlMAERJMTU5ub3Z3hL7y8/T5Yye+AQAAAEVJREFUCB0FwQkCgCAMwLAyJyrj6P9fawJkrVUXwFDVAZenR/RjUj4An8U0AMLJNADCRfkAvBbp6a31Y8JQ1QFw196V8AOmRAMI0B3h8wAAAABJRU5ErkJggg==') 0 center no-repeat;
background-size: 10rpx;
padding-left: 15rpx;
display: flex;
align-items: center;
font-size: 25rpx;
color: #666;
}
.no-login {
width: 100%;
height: auto;
margin: 0 auto;
}
.no-login .c {
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-login .c image {
margin: 0 auto;
display: block;
text-align: center;
width: 414rpx;
height: 336rpx;
margin-bottom: 100rpx;
}
.no-login .c text {
margin: 0 auto;
display: block;
width: 258rpx;
height: 59rpx;
line-height: 29rpx;
text-align: center;
font-size: 35rpx;
color: #999;
}
.no-login button {
width: 90%;
margin: 40 auto;
color: #fff;
font-size: 30rpx;
height: 96rpx;
line-height: 96rpx;
right: 0;
display: flex;
justify-content: center;
align-items: center;
position: flex;
bottom: 0;
left: 0;
border-radius: 0;
padding: 0;
margin-left: 5%;
text-align: center;
/* padding-left: -5rpx; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #9a9ba1 100%);
}
.no-cart {
width: 100%;
height: auto;
margin: 0 auto;
}
.no-cart .c {
width: 100%;
height: auto;
margin-top: 200rpx;
}
.no-cart .c image {
margin: 0 auto;
display: block;
text-align: center;
width: 414rpx;
height: 336rpx;
}
.no-cart .c text {
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;
}
.cart-view .list {
height: auto;
width: 100%;
overflow: hidden;
background: #f4f4f4;
margin-bottom: 120rpx;
}
.cart-view .group-item {
height: auto;
width: 100%;
margin-top:20rpx;
background: #f4f4f4;
margin-bottom: 18rpx;
}
.goods {
margin-top: 20rpx;
background: #fff;
}
.goods .h {
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
border-bottom: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
}
.goods .h .l {
float: left;
font-weight:bold;
}
.cart-view .item {
height: 202rpx;
width: 100%;
overflow: hidden;
}
.cart-view .item .checkbox {
float: left;
height: 34rpx;
width: 34rpx;
margin: 65rpx 18rpx 65rpx 26rpx;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzAV+Z0EAAAAVdFJOUwAJ+KUEFTPay2bzRXdZ7RkhmJ6qJOWhY+QAAAEDSURBVDjLnZTplsIgDIUNWwK2tdt9/1cdxHGmVcAc+dH25Hw0+71cvjhztDIZM4mNc4txo+BwZKxSVwbSFoMn8iFuCeDrG0RLNkc6GGK+ttCZ8gIzuJcgBgPxJ4rB4T2OkM0HjgRyq8V7Y8i/3/V06YVb/nKECa0qBYPffB1jaFd8AD8+RrBrY8R41FkQew2MkPtrR6IeRglzoW1/HrbizfZ9Pv8jCH0slOAm+D7mMeUn4PoYwegxpVNlCsqCKMurbJay9R8GyT0HSTmWeciTYsh7K+MPK1MW0H9eQOU652sqcch+15rUrFQXLpuFy7ksXLYuXDUZbBZ9v4sqiqju34jyD97JD4dkfgo1AAAAAElFTkSuQmCC') no-repeat;
background-size: 34rpx;
}
.cart-view .item .checkbox.checked {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAAQlBMVEUAAACrKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyvw19exOzv////z4uK1Q0Pt0dGxOjp+CNkCAAAADnRSTlMARVn7B9cVoc/jIWtnJIM++AMAAADUSURBVDjLndRLEoMgEEVRPyCg+FAh+99qYqmAabFL7/hMaKCrN/VWyRZopbJ9ETUaWbq5RLXBX6YmSChcpMRZdRKX6e6kDAqZzAmNYlpEpnCTimfEbfWmhLlnZp8qmLY5a47pVY0oNIWArfV+h5Jy88FsNg2q3JTNRLIK8sd4hTZnwfmzSuVsmRdPFGV+d1S18QjJUQUZB5IcVVBxvMlRBRsvKzmq0JOr9y58yNU/eEj8s3zyyPkvcyQk9wH57/xwOfCrhl9cNMGswdQ4HEt1GKsXfQHGSThPkNi75AAAAABJRU5ErkJggg==') no-repeat;
background-size: 34rpx;
}
.cart-view .item .cart-goods {
float: left;
height: 204rpx;
width: 672rpx;
border-bottom: 1px solid #f4f4f4;
}
.cart-view .item .img {
float: left;
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
margin: 12.5rpx 18rpx 12.5rpx 0;
}
.cart-view .item .info {
flex: 1;
float: left;
height: 145.83rpx;
width: 453rpx;
margin: 15.5rpx 26rpx 15.5rpx 0;
}
.cart-view .item .t {
margin: 8rpx 0;
height: 80rpx;
font-size: 25rpx;
color: #333;
}
.cart-view .item .name {
/*height: 28rpx;
max-width: 310rpx;
line-height: 28rpx;
font-size: 25rpx;
color: #333;
overflow: hidden;*/
display: block;
float: left;
height: 33rpx;
line-height: 33rpx;
color: #333;
font-size: 30rpx;
}
.cart-view .item .num {
height: 28rpx;
line-height: 28rpx;
float: right;
}
.cart-view .item .attr {
margin-bottom: 17rpx;
height: 24rpx;
line-height: 24rpx;
font-size: 22rpx;
color: #666;
float: right;
}
.cart-view .item .b {
height: 28rpx;
line-height: 28rpx;
font-size: 25rpx;
color: #333;
overflow: hidden;
}
.cart-view .item .price {
float: left;
}
.cart-view .item .open {
height: 28rpx;
width: 150rpx;
display: block;
float: right;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAUBAMAAABL3sEiAAAAGFBMVEVmZmZ6enp7e3uDg4OEhITHx8fu7u7///8ummCmAAAARUlEQVQI12MoBwOGUjcwVcyUDqLKBNRAVHkSiMtQXqagBqLAXCAF4gIpEBdElSmYI1EQQagSiAaodohhYA7cIqi1EEcAAHB/LX9QfndHAAAAAElFTkSuQmCC') right center no-repeat;
background-size: 25rpx;
font-size: 25rpx;
color: #333;
}
.cart-view .item.edit .num{
display: none;
}
.cart-view .item.edit .attr {
text-align: right;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAUBAMAAABL3sEiAAAAGFBMVEVmZmZ6enp7e3uDg4OEhITHx8fu7u7///8ummCmAAAARUlEQVQI12MoBwOGUjcwVcyUDqLKBNRAVHkSiMtQXqagBqLAXCAF4gIpEBdElSmYI1EQQagSiAaodohhYA7cIqi1EEcAAHB/LX9QfndHAAAAAElFTkSuQmCC') 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;
}
.cart-view .item.edit .price {
line-height: 52rpx;
height: 52rpx;
flex: 1;
}
.cart-view .item .selnum {
display: none;
}
.cart-view .item.edit .selnum {
width: 235rpx;
height: 52rpx;
border: 1rpx solid #ccc;
display: flex;
}
.selnum .cut {
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;
}
.selnum .add {
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;
}
.cart-view .promotion .icon {
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;
}
.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;
}
.cart-view .promotion .txt {
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;
}
.cart-bottom {
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('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzAV+Z0EAAAAVdFJOUwAJ+KUEFTPay2bzRXdZ7RkhmJ6qJOWhY+QAAAEDSURBVDjLnZTplsIgDIUNWwK2tdt9/1cdxHGmVcAc+dH25Hw0+71cvjhztDIZM4mNc4txo+BwZKxSVwbSFoMn8iFuCeDrG0RLNkc6GGK+ttCZ8gIzuJcgBgPxJ4rB4T2OkM0HjgRyq8V7Y8i/3/V06YVb/nKECa0qBYPffB1jaFd8AD8+RrBrY8R41FkQew2MkPtrR6IeRglzoW1/HrbizfZ9Pv8jCH0slOAm+D7mMeUn4PoYwegxpVNlCsqCKMurbJay9R8GyT0HSTmWeciTYsh7K+MPK1MW0H9eQOU652sqcch+15rUrFQXLpuFy7ksXLYuXDUZbBZ9v4sqiqju34jyD97JD4dkfgo1AAAAAElFTkSuQmCC') no-repeat;
background-size: 34rpx;
font-size: 29rpx;
}
.cart-bottom .checkbox.checked {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAMAAACf4xmcAAAAQlBMVEUAAACrKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyurKyvw19exOzv////z4uK1Q0Pt0dGxOjp+CNkCAAAADnRSTlMARVn7B9cVoc/jIWtnJIM++AMAAADUSURBVDjLndRLEoMgEEVRPyCg+FAh+99qYqmAabFL7/hMaKCrN/VWyRZopbJ9ETUaWbq5RLXBX6YmSChcpMRZdRKX6e6kDAqZzAmNYlpEpnCTimfEbfWmhLlnZp8qmLY5a47pVY0oNIWArfV+h5Jy88FsNg2q3JTNRLIK8sd4hTZnwfmzSuVsmRdPFGV+d1S18QjJUQUZB5IcVVBxvMlRBRsvKzmq0JOr9y58yNU/eEj8s3zyyPkvcyQk9wH57/xwOfCrhl9cNMGswdQ4HEt1GKsXfQHGSThPkNi75AAAAABJRU5ErkJggg==') no-repeat;
background-size: 34rpx;
}
.cart-bottom .total {
height: 34rpx;
flex: 1;
margin: 33rpx 10rpx;
font-size: 29rpx;
}
.cart-bottom .delete {
text-align: center;
width: 180rpx;
height: 60rpx;
line-height: 82rpx;
padding: 0;
margin: 0;
margin-left: -5rpx;
padding-right: 25rpx;
font-size: 25rpx;
color: #f4f4f4;
/* text-align: center; */
border-top-left-radius: 0rpx;
border-bottom-left-radius: 0rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #9a9ba1 0%, #ae8b9c 100%);
}
.cart-bottom .checkout {
height: 100rpx;
width: 210rpx;
text-align: center;
line-height: 100rpx;
font-size: 29rpx;
background: #b4282d;
color: #fff;
}
.action_btn_area {
/* border: 1px solid #333; */
position: absolute;
display: flex;
justify-content: center;
align-items: center;
right: 0;
top: 0;
width: 380rpx;
height: 100rpx;
}
.action_btn_area .edit {
width: 140rpx;
/* border: 1px solid #000; */
height: 70rpx;
line-height: 70rpx;
padding: 0;
margin: 0;
margin-right: 5rpx;
text-align: center;
/* padding-left: 25rpx; */
font-size: 25rpx;
color: #f4f4f4;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
/* background-image: linear-gradient(to right, #ff7701 100%); */
background-image: linear-gradient(to right, #f8b230 0%, #ee9e09 100%);
}
.action_btn_area .checkout {
width: 140rpx;
height: 70rpx;
line-height: 70rpx;
padding: 0;
margin: 0;
margin-left: 5rpx;
/* padding-right: 25rpx; */
font-size: 25rpx;
color: #f4f4f4;
text-align: center;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #ce373c 0%, #b4282d 100%);
}
.action_btn_area .delete {
width: 140rpx;
/* border: 1px solid #000; */
height: 70rpx;
line-height: 70rpx;
padding: 0;
margin: 0;
margin-right: 5rpx;
text-align: center;
padding-left: -5rpx;
font-size: 25rpx;
color: #f4f4f4;
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #ff7701 0%, #fe4800 100%);
}
.action_btn_area .sure {
text-align: center;
width: 140rpx;
height: 70rpx;
line-height: 70rpx;
padding: 0;
margin: 0;
margin-right: 10rpx;
padding-left: -5rpx;
font-size: 25rpx;
color: #f4f4f4;
/* text-align: center; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #f8b230 0%, #ee9e09 100%);
/* background-image: linear-gradient(to right, #ff7701 0%, #fe4800 100%); */
}
.auth_btn {
position: fixed;
top: 55vh;
left: 10vw;
width: 80vw;
height: 96rpx;
line-height: 96rpx;
font-size: 25rpx;
color: #f4f4f4;
/* text-align: center; */
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-top-right-radius: 50rpx;
border-bottom-right-radius: 50rpx;
letter-spacing: 3rpx;
background-image: linear-gradient(to right, #f8b230 0%, #ee9e09 100%);
}

View File

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

View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "分类"
}

View File

@ -0,0 +1,30 @@
<view class="container">
<view class="search">
<navigator url="/pages/search/search" class="input jhx_bg1">
<image class="icon"></image>
<text class="txt jhx_f1">搜索, 共{{goodsCount}}款商品</text>
</navigator>
</view>
<view class="catalog">
<scroll-view class="nav" scroll-y="true">
<view class="item {{ currentCategory.id == item.id ? 'active' : ''}}" wx:for="{{categoryList}}" wx:key="id" data-id="{{item.id}}" data-index="{{index}}" bindtap="switchCate">{{item.name}}</view>
</scroll-view>
<scroll-view class="cate" scroll-y="true">
<navigator url="url" class="banner">
<image class="image" src="{{currentCategory.picUrl}}"></image>
<view class="txt">{{currentCategory.frontName}}</view>
</navigator>
<view class="hd">
<text class="line"></text>
<text class="txt">{{currentCategory.name}}分类</text>
<text class="line"></text>
</view>
<view class="bd">
<navigator url="/pages/category/category?id={{item.id}}" class="item {{(index+1) % 3 == 0 ? 'last' : ''}}" wx:key="id" wx:for="{{currentSubCategoryList}}">
<image class="icon" src="{{item.picUrl}}"></image>
<text class="txt jhx_f2">{{item.name}}</text>
</navigator>
</view>
</scroll-view>
</view>
</view>

View File

@ -0,0 +1,163 @@
page {
height: 100%;
}
.container {
background: #f9f9f9;
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}
.search {
height: 100rpx;
width: 100%;
padding: 0 30rpx;
background: #fff;
display: flex;
align-items: center;
}
.search .input {
width: 690rpx;
height: 70rpx;
border-radius: 20rpx;
display: flex;
padding-top: 18rpx;
padding-left: 20rpx;
align-items: left;
vertical-align: middle;
justify-content: left;
}
.search .icon {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA8UExURUdwTGZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZjQWelcAAAATdFJOUwDUDlMW8DUFcdHpnc3cSLkosSd78uTdAAAAvUlEQVQoz4WS6QLDEBCE131L0nn/d23J0VCV+bP4LLsM0S6Tg1NQLmRDnYz1OOVti18OcFZLI7Utw/XGtEIS10wkKH3NVoWF3/byBerMNQ5be4vZ4I4Vi8S7+niC3bd55L54yvA1VSDSryJqheE4oZVFKMFBD6AGK0FBDiCHKgEwA/hZfsxkszun1U77nL7Q9G3nvzL6z1sH2ndOANi3eRmrhzjx6qGo2Z327pMNJSMO34paSkc7PdJI/2lc3naRCwMB9sl5AAAAAElFTkSuQmCC') center no-repeat;
background-size: 100%;
width: 34rpx;
height: 34rpx;
}
.search .txt {
height: 42rpx;
line-height: 42rpx;
padding-left: 10rpx;
}
.catalog {
flex: 1;
width: 100%;
background: #fff;
display: flex;
border-top: 1px solid #fafafa;
}
.catalog .nav {
width: 162rpx;
height: 100%;
}
.catalog .nav .item {
text-align: center;
line-height: 90rpx;
width: 162rpx;
height: 90rpx;
color: #333;
font-size: 28rpx;
border-left: 6rpx solid #fff;
}
.catalog .nav .item.active {
color: #85c43f;
font-size: 29rpx;
border-left: 6rpx solid #85c43f;
}
.catalog .cate {
border-left: 1px solid #fafafa;
flex: 1;
height: 100%;
padding: 0 30rpx 0 30rpx;
}
.banner {
display: block;
height: 222rpx;
width: 100%;
position: relative;
}
.banner .image {
position: absolute;
top: 30rpx;
left: 0;
border-radius: 4rpx;
height: 192rpx;
width: 100%;
}
.banner .txt {
position: absolute;
top: 30rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
left: 0;
height: 192rpx;
line-height: 192rpx;
width: 100%;
}
.catalog .hd {
height: 108rpx;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.catalog .hd .txt {
font-size: 24rpx;
text-align: center;
color: #333;
padding: 0 10rpx;
width: auto;
}
.catalog .hd .line {
width: 100rpx;
height: 1px;
background: #d9d9d9;
}
.catalog .bd {
height: auto;
width: 100%;
overflow: hidden;
}
.catalog .bd .item {
display: block;
float: left;
height: 200rpx;
width: 152rpx;
margin-right: 28rpx;
}
.catalog .bd .item.last {
margin-right: 0;
}
.catalog .bd .item .icon {
height: 152rpx;
width: 152rpx;
}
.catalog .bd .item .txt {
display: block;
text-align: center;
font-size: 24rpx;
color: #333;
height: 62rpx;
width: 152rpx;
}

View File

@ -0,0 +1,132 @@
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: 500
},
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();
},
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
})
// 当id是L1分类id时这里需要重新设置成L1分类的一个子分类的id
if (res.data.parentCategory.id == that.data.id) {
that.setData({
id: res.data.currentCategory.id
});
}
//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() {
var that = this;
util.request(api.GoodsList, {
categoryId: that.data.id,
page: that.data.page,
size: that.data.size
})
.then(function(res) {
that.setData({
goodsList: res.data.goodsList,
});
});
},
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

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,25 @@
<view class="container">
<view class="cate-nav">
<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 class="name jhx_f7">{{item.name}}</view>
</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> -->
<view class="b">
<navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
<image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
<text class="name jhx_f2">{{iitem.name}}</text>
<text class="price jhx_f8">¥{{iitem.retailPrice}}</text>
</navigator>
</view>
</view>
</scroll-view>
</view>

View File

@ -0,0 +1,114 @@
.container {
background: #f9f9f9;
}
.cate-nav {
position: fixed;
left: 0;
top: 0;
z-index: 1000;
}
.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 {
display: inline-block;
height: 84rpx;
min-width: 130rpx;
padding: 0 15rpx;
}
.cate-nav .item .name {
display: block;
height: 84rpx;
padding: 0 20rpx;
line-height: 84rpx;
width: auto;
}
.cate-nav .item.active .name {
color: #85c43f;
border-bottom: 2px solid #85c43f;
}
.cate-item {
margin-top: 94rpx;
height: auto;
overflow: hidden;
}
.cate-item .h {
height: 145rpx;
width: 750rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.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;
}
.cate-item .b {
width: 750rpx;
padding: 0 6.25rpx;
height: auto;
overflow: hidden;
}
.cate-item .b .item {
float: left;
background: #fff;
width: 365rpx;
margin-bottom: 6.25rpx;
padding-bottom: 33.333rpx;
height: auto;
overflow: hidden;
text-align: center;
}
.cate-item .b .item-b {
margin-left: 6.25rpx;
}
.cate-item .item .img {
width: 302rpx;
height: 302rpx;
}
.cate-item .item .name {
display: block;
width: 365.625rpx;
height: 35rpx;
margin: 11.5rpx 0 22rpx 0;
text-align: center;
overflow: hidden;
padding: 0 20rpx;
font-size: 30rpx;
color: #333;
}
.cate-item .item .price {
display: block;
width: 365.625rpx;
height: 30rpx;
text-align: center;
}

View File

@ -0,0 +1,216 @@
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
var app = getApp();
var lastTime = null;
Page({
data: {
isMultiOrderModel: 0,
brandCartgoods:[],
checkedGoodsList: [],
checkedAddress: {},
availableCouponLength: 0, // 可用的优惠券数量
goodsTotalPrice: 0.00, //商品总价
freightPrice: 0.00, //快递费
couponPrice: 0.00, //优惠券的价格
grouponPrice: 0.00, //团购优惠价格
orderTotalPrice: 0.00, //订单总价
actualPrice: 0.00, //实际需要支付的总价
cartId: 0,
addressId: 0,
couponId: 0,
message: '',
grouponLinkId: 0, //参与的团购如果是发起则为0
grouponRulesId: 0 //团购规则ID
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
},
//获取checkou信息
getCheckoutInfo: function() {
let that = this;
util.request(api.CartCheckout, {
cartId: that.data.cartId,
addressId: that.data.addressId,
couponId: that.data.couponId,
grouponRulesId: that.data.grouponRulesId
}).then(function(res) {
if (res.errno === 0) {
let brandCartgoods = [];
let checkedGoodsList = [];
if (res.data.isMultiOrderModel === 1) {
brandCartgoods = res.data.brandCartgoods;
} else {
checkedGoodsList = res.data.checkedGoodsList;
}
that.setData({
isMultiOrderModel: res.data.isMultiOrderModel,
brandCartgoods: brandCartgoods,
checkedGoodsList: checkedGoodsList,
checkedAddress: res.data.checkedAddress,
availableCouponLength: res.data.availableCouponLength,
actualPrice: res.data.actualPrice,
couponPrice: res.data.couponPrice,
grouponPrice: res.data.grouponPrice,
freightPrice: res.data.freightPrice,
goodsTotalPrice: res.data.goodsTotalPrice,
orderTotalPrice: res.data.orderTotalPrice,
addressId: res.data.addressId,
couponId: res.data.couponId,
grouponRulesId: res.data.grouponRulesId,
});
}
wx.hideLoading();
});
},
selectAddress() {
wx.navigateTo({
url: '/pages/ucenter/address/address',
})
},
selectCoupon() {
wx.navigateTo({
url: '/pages/ucenter/couponSelect/couponSelect',
})
},
bindMessageInput: function(e) {
this.setData({
message: e.detail.value
});
},
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.jhxLoadShow("正在下单,请稍后...");
let nowTime = + new Date();
if (nowTime - lastTime > 5000 || !lastTime) { //5秒内避免重复提交订单
lastTime = nowTime;
} else {
return false;
}
util.request(api.OrderSubmit, {
cartId: this.data.cartId,
addressId: this.data.addressId,
couponId: this.data.couponId,
message: this.data.message,
grouponRulesId: this.data.grouponRulesId,
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
util.jhxLoadHide();
if (res.errno === 0) {
// 下单成功重置couponId
try {
wx.setStorageSync('couponId', 0);
} catch (error) {
}
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 {
wx.redirectTo({
url: '/pages/payResult/payResult?status=0&orderId=' + orderId
});
}
});
}
});

View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "填写订单"
}

View File

@ -0,0 +1,139 @@
<view class="container">
<view class="address-box">
<view class="address-item" bindtap="selectAddress" wx:if="{{checkedAddress.id > 0}}">
<view class="l">
<text class="name">{{checkedAddress.name}}</text>
<text class="default" wx:if="{{checkedAddress.isDefault}}">默认</text>
</view>
<view class="m">
<text class="mobile">{{checkedAddress.mobile}}</text>
<text class="address">{{checkedAddress.address}}</text>
</view>
<view class="r">
<image src="/static/images/address_right.png"></image>
</view>
</view>
<view class="address-item address-empty" bindtap="selectAddress" wx:else>
<view class="m">
还没有收货地址,去添加
</view>
<view class="r">
<image src="/static/images/address_right.png"></image>
</view>
</view>
</view>
<view class="coupon-box">
<view class="coupon-item" bindtap="selectCoupon">
<view class="l" wx:if="{{couponId == 0}}">
<text class="name">没有可用的优惠券</text>
<text class="txt">0张</text>
</view>
<view class="l" wx:elif="{{couponId == -1}}">
<text class="name">优惠券</text>
<text class="txt">{{availableCouponLength}}张</text>
</view>
<view class="l" wx:else>
<text class="name">优惠券</text>
<text class="txt">¥{{couponPrice}}元</text>
</view>
<view class="r">
<image src="/static/images/address_right.png"></image>
</view>
</view>
</view>
<view class="message-box">
<input class="message-item" bindinput="bindMessageInput" placeholder="如需要,请输入留言" value="{{message}}" placeholder-style="color: #ccc;" />
</view>
<view class="goods-items" wx:if="{{isMultiOrderModel==1}}">
<view class="group-item" wx:for="{{brandCartgoods}}" wx:key="brandId" wx:for-item="bitem">
<navigator url="../brandDetail/brandDetail?id={{bitem.brandId}}" class="h">
<view class="l">{{bitem.brandName}} > </view>
</navigator>
<view class="item" wx:for="{{bitem.cartList}}" wx:key="id">
<view class="img">
<image src="{{item.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{item.goodsName}}</text>
</view>
<view class="m">{{item.specifications}}</view>
<view class="b">¥{{item.price}}</view>
<text class="number">x{{item.number}}</text>
</view>
</view>
<view class="brand-order">
<view class="order-item">
<view class="l">
<text class="name">商品合计</text>
</view>
<view class="r">
<text class="txt">¥{{bitem.bandGoodsTotalPrice}}元</text>
</view>
</view>
<view class="order-item">
<view class="l">
<text class="name">运费</text>
</view>
<view class="r">
<text class="txt">¥{{bitem.bandFreightPrice}}元</text>
</view>
</view>
</view>
</view>
</view>
<view class="goods-items" wx:else>
<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-box" wx:if="{{isMultiOrderModel==1}}">
</view>
<view class="order-box" wx:else>
<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 class="order-item no-border">
<view class="l">
<text class="name">优惠券</text>
</view>
<view class="r">
<text class="txt">-¥{{couponPrice}}元</text>
</view>
</view>
</view>
<view class="order-total">
<view class="l">实付:¥{{actualPrice}}</view>
<view class="r" bindtap="submitOrder">去付款</view>
</view>
</view>

View File

@ -0,0 +1,372 @@
page {
height: auto;
min-height: 100%;
background: #f4f4f4;
}
.address-box {
width: 100%;
height: 166.55rpx;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAKCAMAAADfAc3wAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAYUExURc2AgICg1v///+rw+ffq6tKMjI2p2ouo2QT3I5MAAAA9SURBVCjPpcs5EgAgCARB5ND//9jEYwlZJp1q0ZTNAS3L10OgcGlYlYZNuGoRly3guv2YsA8z9mLKHsxZ3e5sBBsNqhCTAAAAAElFTkSuQmCC') 0 0 repeat-x;
background-size: 62.5rpx 10.5rpx;
margin-bottom: 20rpx;
padding-top: 10.5rpx;
}
.address-item {
display: flex;
height: 155.55rpx;
background: #fff;
padding: 41.6rpx 0 41.6rpx 31.25rpx;
}
.address-item.address-empty {
line-height: 75rpx;
text-align: center;
}
.address-box .l {
width: 125rpx;
height: 100%;
}
.address-box .l .name {
margin-left: 6.25rpx;
margin-top: -7.25rpx;
display: block;
width: 125rpx;
height: 43rpx;
line-height: 43rpx;
font-size: 30rpx;
color: #333;
margin-bottom: 15rpx;
}
.address-box .l .default {
margin-left: 6.25rpx;
display: block;
width: 62rpx;
height: 33rpx;
border-radius: 5rpx;
border: 1px solid #b4282d;
font-size: 20.5rpx;
text-align: center;
line-height: 29rpx;
color: #b4282d;
}
.address-box .m {
flex: 1;
height: 72.25rpx;
color: #999;
}
.address-box .mobile {
display: block;
height: 29rpx;
line-height: 29rpx;
margin-bottom: 16.25rpx;
font-size: 30rpx;
color: #333;
}
.address-box .address {
display: block;
height: 37.5rpx;
line-height: 37.5rpx;
font-size: 25rpx;
color: #666;
}
.address-box .r {
width: 77rpx;
height: 77rpx;
display: flex;
justify-content: center;
align-items: center;
}
.address-box .r image {
width: 52.078rpx;
height: 52.078rpx;
}
.coupon-box {
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
border-bottom: 1px solid #fafafa;
}
.coupon-box .coupon-item {
width: 100%;
height: 78.3rpx;
overflow: hidden;
background: #fff;
display: flex;
padding-left: 31.25rpx;
}
.coupon-box .l {
flex: 1;
height: 33rpx;
line-height: 33rpx;
padding-top: 25rpx;
}
.coupon-box .l .name {
float: left;
font-size: 30rpx;
color: #666;
}
.coupon-box .l .txt {
float: right;
font-size: 30rpx;
color: #666;
}
.coupon-box .r {
margin-top: 10.5rpx;
width: 77rpx;
height: 57rpx;
display: flex;
justify-content: center;
align-items: center;
}
.coupon-box .r image {
width: 52.078rpx;
height: 52.078rpx;
}
.message-box {
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
margin-bottom: 16.25rpx;
}
.message-box .message-item {
height: 72.078rpx;
overflow: hidden;
background: #fff;
display: flex;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
padding-top: 10rpx;
}
.group-item {
width: 100%;
background: #fff;
height: auto;
padding-right: 11.25rpx;
margin-bottom: 26.25rpx;
}
.group-item .h {
height: 83.3rpx;
line-height: 83.3rpx;
margin-left: 21.25rpx;
padding-right: 11.25rpx;
border-bottom: 1px solid #f4f4f4;
font-size: 30rpx;
color: #333;
}
.group-item .h .l {
float: left;
font-weight:bold;
}
.brand-order{
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
}
.brand-order .order-item {
height: 64.3rpx;
overflow: hidden;
background: #fff;
display: flex;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
padding-top: 16rpx;
border-bottom: 1px solid #fafafa;
}
.brand-order .order-item .l {
float: left;
height: 42rpx;
width: 50%;
line-height: 42rpx;
overflow: hidden;
}
.brand-order .order-item .r {
float: right;
text-align: right;
width: 50%;
height: 42rpx;
line-height: 42rpx;
overflow: hidden;
}
.order-box {
margin-top: 10rpx;
width: 100%;
height: auto;
overflow: hidden;
background: #fff;
margin-bottom: 120rpx;
}
.order-box .order-item {
height: 64.3rpx;
overflow: hidden;
background: #fff;
display: flex;
margin-left: 31.25rpx;
padding-right: 31.25rpx;
padding-top: 16rpx;
border-bottom: 1px solid #fafafa;
}
.order-box .order-item .l {
float: left;
height: 42rpx;
width: 50%;
line-height: 42rpx;
overflow: hidden;
}
.order-box .order-item .r {
float: right;
text-align: right;
width: 50%;
height: 42rpx;
line-height: 42rpx;
overflow: hidden;
}
.order-box .order-item.no-border {
border-bottom: none;
}
.goods-items {
margin-top: 20rpx;
width: 100%;
height: auto;
overflow: hidden;
margin-bottom: 20rpx;
}
.goods-items .item {
height: 162rpx;
padding-left: 11.25rpx;
padding-right: 31.25rpx;
display: flex;
align-items: center;
border-bottom: 1px solid #fafafa;
}
.goods-items .item.no-border {
border-bottom: none;
}
.goods-items .item:last-child {
border-bottom: none;
}
.goods-items .img {
height: 145.83rpx;
width: 145.83rpx;
background-color: #f4f4f4;
margin-right: 20rpx;
}
.goods-items .img image {
height: 145.83rpx;
width: 145.83rpx;
}
.goods-items .info {
flex: 1;
height: 145.83rpx;
padding-top: 5rpx;
}
.goods-items .t {
height: 33rpx;
line-height: 33rpx;
margin-bottom: 10rpx;
overflow: hidden;
font-size: 30rpx;
color: #333;
}
.goods-items .t .name {
display: block;
float: left;
}
.goods-items .b {
float: left;
height: 41rpx;
overflow: hidden;
line-height: 41rpx;
font-size: 30rpx;
color: #ec4223;
}
.goods-items .number {
display: block;
float: right;
text-align: right;
}
.goods-items .m {
height: 29rpx;
overflow: hidden;
line-height: 29rpx;
margin-bottom: 25rpx;
font-size: 25rpx;
color: #999;
}
.order-total {
position: fixed;
left: 0;
bottom: 0;
height: 100rpx;
width: 100%;
display: flex;
}
.order-total .l {
flex: 1;
height: 100rpx;
line-height: 100rpx;
color: #b4282d;
background: #fff;
font-size: 33rpx;
padding-left: 31.25rpx;
border-top: 1rpx solid rgba(0, 0, 0, 0.2);
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
}
.order-total .r {
width: 233rpx;
height: 100rpx;
background: #b4282d;
border: 1px solid #fafafa;
line-height: 100rpx;
text-align: center;
color: #fff;
font-size: 30rpx;
}

View File

@ -0,0 +1,127 @@
var app = getApp();
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
data: {
comments: [],
allCommentList: [],
picCommentList: [],
type: 0,
valueId: 0,
showType: 0,
allCount: 0,
hasPicCount: 0,
allPage: 1,
picPage: 1,
size: 20
},
getCommentCount: function() {
let that = this;
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,
hasPicCount: res.data.hasPicCount
});
}
});
},
getCommentList: function() {
let that = this;
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) {
if (res.errno === 0) {
if (that.data.showType == 0) {
that.setData({
allCommentList: that.data.allCommentList.concat(res.data.data),
allPage: res.data.currentPage,
comments: that.data.allCommentList.concat(res.data.data)
});
} else {
that.setData({
picCommentList: that.data.picCommentList.concat(res.data.data),
picPage: res.data.currentPage,
comments: that.data.picCommentList.concat(res.data.data)
});
}
}
});
},
onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
this.setData({
type: options.type,
valueId: options.valueId
});
this.getCommentCount();
this.getCommentList();
},
onReady: function() {
// 页面渲染完成
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
},
switchTab: function() {
let that = this;
if (that.data.showType == 0) {
that.setData({
allCommentList: [],
allPage: 1,
comments: [],
showType: 1
});
} else {
that.setData({
picCommentList: [],
picPage: 1,
comments: [],
showType: 0
});
}
this.getCommentList();
},
onReachBottom: function() {
console.log('onPullDownRefresh');
if (this.data.showType == 0) {
if (this.data.allCount / this.data.size < this.data.allPage) {
return false;
}
this.setData({
'allPage': this.data.allPage + 1
});
} else {
if (this.data.hasPicCount / this.data.size < this.data.picPage) {
return false;
}
this.setData({
'picPage': this.data.picPage + 1
});
}
this.getCommentList();
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "评价",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,30 @@
<view class="comments">
<view class="h">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab">
<view class="txt">全部({{allCount}})</view>
</view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
</view>
<view class="b">
<view class="item" wx:for="{{comments}}" wx:key="id">
<view class="info">
<view class="user">
<image src="{{item.userInfo.avatarUrl}}"></image>
<text>{{item.userInfo.nickname}}</text>
</view>
<view class="time">{{item.addTime}}</view>
</view>
<view class="comment">{{item.content}}</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="pitem" src="{{pitem}}"></image>
</view>
<view class="customer-service" wx:if="{{item.reply}}">
<text class="u">小商场回复:</text>
<text class="c">{{item.reply}}</text>
</view>
</view>
</view>
</view>

View File

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

View File

@ -0,0 +1,177 @@
// 上传组件 基于https://github.com/Tencent/weui-wxss/tree/master/src/example/uploader
var app = getApp();
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
Page({
data: {
orderId: 0,
type: 0,
valueId: 0,
orderGoods: {},
content: '',
stars: [0, 1, 2, 3, 4],
star: 5,
starText: '十分满意',
hasPicture: false,
picUrls: [],
files: []
},
chooseImage: function(e) {
if (this.data.files.length >= 5) {
util.showErrorToast('只能上传五张图片')
return false;
}
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
that.setData({
files: that.data.files.concat(res.tempFilePaths)
});
that.upload(res);
}
})
},
upload: function(res) {
var that = this;
const uploadTask = wx.uploadFile({
url: api.StorageUpload,
filePath: res.tempFilePaths[0],
name: 'file',
success: function(res) {
var _res = JSON.parse(res.data);
if (_res.errno === 0) {
var url = _res.data.url
that.data.picUrls.push(url)
that.setData({
hasPicture: true,
picUrls: that.data.picUrls
})
}
},
fail: function(e) {
wx.showModal({
title: '错误',
content: '上传失败',
showCancel: false
})
},
})
uploadTask.onProgressUpdate((res) => {
console.log('上传进度', res.progress)
console.log('已经上传的数据长度', res.totalBytesSent)
console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)
})
},
previewImage: function(e) {
wx.previewImage({
current: e.currentTarget.id, // 当前显示图片的http链接
urls: this.data.files // 需要预览的图片http链接列表
})
},
selectRater: function(e) {
var star = e.currentTarget.dataset.star + 1;
var starText;
if (star == 1) {
starText = '很差';
} else if (star == 2) {
starText = '不太满意';
} else if (star == 3) {
starText = '满意';
} else if (star == 4) {
starText = '比较满意';
} else {
starText = '十分满意'
}
this.setData({
star: star,
starText: starText
})
},
onLoad: function(options) {
var that = this;
that.setData({
orderId: options.orderId,
type: options.type,
valueId: options.valueId
});
this.getOrderGoods();
},
getOrderGoods: function() {
let that = this;
util.request(api.OrderGoods, {
orderId: that.data.orderId,
goodsId: that.data.valueId
}).then(function(res) {
if (res.errno === 0) {
that.setData({
orderGoods: res.data,
});
}
});
},
onClose: function() {
wx.navigateBack();
},
onPost: function() {
let that = this;
if (!this.data.content) {
util.showErrorToast('请填写评论')
return false;
}
util.request(api.OrderComment, {
orderGoodsId: that.data.orderGoods.id,
content: that.data.content,
star: that.data.star,
hasPicture: that.data.hasPicture,
picUrls: that.data.picUrls
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '评论成功',
complete: function() {
wx.switchTab({
url: '/pages/ucenter/index/index'
})
}
})
}
});
},
bindInputValue(event) {
let value = event.detail.value;
//判断是否超过140个字符
if (value && value.length > 140) {
return false;
}
this.setData({
content: event.detail.value,
})
},
onReady: function() {
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})

View File

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "评价",
"enablePullDownRefresh": false
}

View File

@ -0,0 +1,55 @@
<view class="container">
<view class="post-comment">
<view class="goods">
<view class="img">
<image src="{{orderGoods.picUrl}}"></image>
</view>
<view class="info">
<view class="t">
<text class="name">{{orderGoods.goodsName}} x{{orderGoods.number}}</text>
</view>
<view class="attr">{{orderGoods.goodsSpecificationValues}}</view>
</view>
</view>
<view class="rater">
<text class="rater-title">评分</text>
<block wx:for="{{stars}}" wx:key="*this" wx:for-item="item">
<image src="/static/images/icon_collect_checked.png" bindtap="selectRater" data-star="{{item}}" wx:if="{{item < star}}"></image>
<image src="/static/images/icon_collect.png" bindtap="selectRater" data-star="{{item}}" wx:else></image>
</block>
<text class="rater-desc">{{starText}}</text>
</view>
<view class="input-box">
<textarea class="content" focus="true" bindinput="bindInputValue" maxlength="140" placeholder="留言经过筛选后,对所有人可见" />
<text class="count">{{140 - content.length}}</text>
</view>
<view class="weui-uploader">
<view class="weui-uploader__hd">
<view class="weui-uploader__title">图片上传</view>
<view class="weui-uploader__info">{{picUrls.length}}/{{files.length}}</view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files" id="uploaderFiles">
<block wx:for="{{files}}" wx:key="*this">
<view class="weui-uploader__file" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
</view>
<!-- <view class="weui-uploader__file weui-uploader__file_status" bindtap="previewImage" id="{{item}}">
<image class="weui-uploader__img" src="{{item}}" mode="aspectFill" />
<view class="weui-uploader__file-content">50%</view>
</view> -->
</block>
<view class="weui-uploader__input-box">
<view class="weui-uploader__input" bindtap="chooseImage"></view>
</view>
</view>
</view>
</view>
<view class="btns">
<view class="close" bindtap="onClose">取消</view>
<view class="post" bindtap="onPost">发表</view>
</view>
</view>
</view>

View File

@ -0,0 +1,246 @@
page, .container {
height: 100%;
background: #f4f4f4;
}
.post-comment {
width: 750rpx;
height: auto;
overflow: hidden;
padding: 30rpx;
background: #fff;
}
.post-comment .goods {
display: flex;
align-items: center;
height: 199rpx;
margin-left: 31.25rpx;
}
.post-comment .goods .img {
height: 145.83rpx;
width: 145.83rpx;
background: #f4f4f4;
}
.post-comment .goods .img image {
height: 145.83rpx;
width: 145.83rpx;
}
.post-comment .goods .info {
height: 145.83rpx;
flex: 1;
padding-left: 20rpx;
}
.post-comment .goods .name {
margin-top: 30rpx;
display: block;
height: 44rpx;
line-height: 44rpx;
color: #333;
font-size: 30rpx;
}
.post-comment .goods .number {
display: block;
height: 37rpx;
line-height: 37rpx;
color: #666;
font-size: 25rpx;
}
.post-comment .goods .status {
width: 105rpx;
color: #b4282d;
font-size: 25rpx;
}
.post-comment .rater {
display: flex;
flex-direction: row;
height: 55rpx;
}
.post-comment .rater .rater-title {
font-size: 29rpx;
padding-right: 10rpx;
}
.post-comment .rater image {
padding-left: 5rpx;
height: 50rpx;
width: 50rpx;
}
.post-comment .rater .rater-desc {
font-size: 29rpx;
padding-left: 10rpx;
}
.post-comment .input-box {
height: 337.5rpx;
width: 690rpx;
position: relative;
background: #fff;
}
.post-comment .input-box .content {
position: absolute;
top: 0;
left: 0;
display: block;
background: #fff;
font-size: 29rpx;
border: 5px solid #f4f4f4;
height: 300rpx;
width: 650rpx;
padding: 20rpx;
}
.post-comment .input-box .count {
position: absolute;
bottom: 20rpx;
right: 20rpx;
display: block;
height: 30rpx;
width: 50rpx;
font-size: 29rpx;
color: #999;
}
.post-comment .btns {
height: 108rpx;
}
.post-comment .close {
float: left;
height: 108rpx;
line-height: 108rpx;
text-align: left;
color: #666;
padding: 0 30rpx;
}
.post-comment .post {
float: right;
height: 108rpx;
line-height: 108rpx;
text-align: right;
padding: 0 30rpx;
}
.weui-uploader {
margin-top: 50rpx;
}
.weui-uploader__hd {
display: -webkit-box;
display: -webkit-flex;
display: flex;
padding-bottom: 10px;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
}
.weui-uploader__title {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
}
.weui-uploader__info {
color: #b2b2b2;
}
.weui-uploader__bd {
margin-bottom: -4px;
margin-right: -9px;
overflow: hidden;
}
.weui-uploader__file {
float: left;
margin-right: 9px;
margin-bottom: 9px;
}
.weui-uploader__img {
display: block;
width: 79px;
height: 79px;
}
.weui-uploader__file_status {
position: relative;
}
.weui-uploader__file_status:before {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.weui-uploader__file-content {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
}
.weui-uploader__input-box {
float: left;
position: relative;
margin-right: 9px;
margin-bottom: 9px;
width: 77px;
height: 77px;
border: 1px solid #d9d9d9;
}
.weui-uploader__input-box:after, .weui-uploader__input-box:before {
content: " ";
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #d9d9d9;
}
.weui-uploader__input-box:before {
width: 2px;
height: 39.5px;
}
.weui-uploader__input-box:after {
width: 39.5px;
height: 2px;
}
.weui-uploader__input-box:active {
border-color: #999;
}
.weui-uploader__input-box:active:after, .weui-uploader__input-box:active:before {
background-color: #999;
}
.weui-uploader__input {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}

Some files were not shown because too many files have changed in this diff Show More