├── .gitignore ├── README.md ├── app.js ├── app.json ├── app.wxss ├── components └── shortcut │ ├── shortcut.js │ ├── shortcut.json │ ├── shortcut.wxml │ └── shortcut.wxss ├── images ├── default-avatar.jpg ├── no_content.png ├── tabBar │ ├── cart.png │ ├── cart_on.png │ ├── cate.png │ ├── cate_on.png │ ├── home.png │ ├── home_on.png │ ├── user.png │ └── user_on.png ├── user-bg.png └── wechatapp.png ├── pages ├── address │ ├── create.js │ ├── create.json │ ├── create.wxml │ ├── create.wxss │ ├── detail.js │ ├── detail.json │ ├── detail.wxml │ ├── detail.wxss │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── category │ ├── index.js │ ├── index.json │ ├── index.wxml │ ├── index.wxss │ ├── list.js │ ├── list.json │ ├── list.wxml │ └── list.wxss ├── flow │ ├── checkout.js │ ├── checkout.json │ ├── checkout.wxml │ ├── checkout.wxss │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── goods │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── index │ ├── components │ │ ├── banner │ │ │ ├── banner.wxml │ │ │ └── banner.wxss │ │ └── search │ │ │ ├── search.wxml │ │ │ └── search.wxss │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── login │ ├── login.js │ ├── login.json │ ├── login.wxml │ └── login.wxss ├── order │ ├── detail.js │ ├── detail.json │ ├── detail.wxml │ ├── detail.wxss │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── search │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss └── user │ ├── help.js │ ├── help.json │ ├── help.wxml │ ├── help.wxss │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── siteinfo.js ├── sitemap.json ├── utils ├── common.wxss ├── iconfont.wxss ├── login.js ├── md5.js └── util.js ├── version.json └── wxParse ├── html2json.js ├── htmlparser.js ├── showdown.js ├── wxDiscode.js ├── wxParse.js ├── wxParse.wxml └── wxParse.wxss /.gitignore: -------------------------------------------------------------------------------- 1 | project.config.json 2 | .idea 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 萤火小程序商城(YoShop) 2 | 3 | 4 | #### 项目介绍 5 | 萤火小程序商城,是一款开源的电商系统,为中小企业提供最佳的新零售解决方案。采用稳定的MVC框架开发,执行效率、扩展性、稳定性值得信赖。 6 | 7 | #### 项目演示 8 | - 官网地址:[https://www.yiovo.com/](https://www.yiovo.com/) 9 | - 后台演示:[https://yoshop.xany6.com/](https://yoshop.xany6.com/) 10 | - QQ交流群:1055189864 11 | 12 | ![输入图片说明](https://images.gitee.com/uploads/images/2018/0727/210807_271acafd_597459.jpeg "gh_a376934c7da8_344.jpg") 13 | 14 | #### 项目截图 15 | ![输入图片说明](https://gitee.com/uploads/images/2018/0629/144738_39b279a7_597459.png "前端.png") 16 | 17 | #### 后台截图 18 | ![输入图片说明](https://gitee.com/uploads/images/2018/0629/144835_4e7858ef_597459.png "后台-商品列表.png") 19 | 20 | ![输入图片说明](https://gitee.com/uploads/images/2018/0629/144851_2a4c1e50_597459.png "后台-新增商品.png") 21 | 22 | ![输入图片说明](https://gitee.com/uploads/images/2018/0629/144952_acc1d20d_597459.png "后台-首页设计.png") 23 | 24 | ![输入图片说明](https://gitee.com/uploads/images/2018/0629/145004_5a5ba42c_597459.png "后台-配送设置.png") 25 | 26 | #### 环境要求 27 | - Nginx/Apache/IIS 28 | - PHP5.4+ 29 | - MySQL5.1+ 30 | 31 | 建议使用环境:Linux + Nginx1.14 + PHP7 + MySQL5.6 32 | 33 | 34 | #### 安全&缺陷 35 | 如果你发现了一个安全漏洞,请发送邮件到 developer@yiovo.com。所有的安全漏洞都将及时得到解决。 36 | 37 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * tabBar页面路径列表 (用于链接跳转时判断) 3 | * tabBarLinks为常量, 无需修改 4 | */ 5 | const tabBarLinks = [ 6 | 'pages/index/index', 7 | 'pages/category/index', 8 | 'pages/flow/index', 9 | 'pages/user/index' 10 | ]; 11 | 12 | // 站点信息 13 | import siteInfo from 'siteinfo.js'; 14 | 15 | App({ 16 | 17 | /** 18 | * 全局变量 19 | */ 20 | globalData: { 21 | user_id: null, 22 | }, 23 | 24 | api_root: '', // api地址 25 | 26 | /** 27 | * 生命周期函数--监听小程序初始化 28 | */ 29 | onLaunch() { 30 | let App = this; 31 | // 设置api地址 32 | App.setApiRoot(); 33 | }, 34 | 35 | /** 36 | * 当小程序启动,或从后台进入前台显示,会触发 onShow 37 | */ 38 | onShow(options) { 39 | 40 | }, 41 | 42 | /** 43 | * 设置api地址 44 | */ 45 | setApiRoot() { 46 | let App = this; 47 | App.api_root = `${siteInfo.siteroot}index.php?s=/api/`; 48 | }, 49 | 50 | /** 51 | * 获取小程序基础信息 52 | */ 53 | getWxappBase(callback) { 54 | let App = this; 55 | App._get('wxapp/base', {}, result => { 56 | // 记录小程序基础信息 57 | wx.setStorageSync('wxapp', result.data.wxapp); 58 | callback && callback(result.data.wxapp); 59 | }, false, false); 60 | }, 61 | 62 | /** 63 | * 执行用户登录 64 | */ 65 | doLogin() { 66 | // 保存当前页面 67 | let pages = getCurrentPages(); 68 | if (pages.length) { 69 | let currentPage = pages[pages.length - 1]; 70 | "pages/login/login" != currentPage.route && 71 | wx.setStorageSync("currentPage", currentPage); 72 | } 73 | // 跳转授权页面 74 | wx.navigateTo({ 75 | url: "/pages/login/login" 76 | }); 77 | }, 78 | 79 | /** 80 | * 当前用户id 81 | */ 82 | getUserId() { 83 | return wx.getStorageSync('user_id') || 0; 84 | }, 85 | 86 | /** 87 | * 显示成功提示框 88 | */ 89 | showSuccess(msg, callback) { 90 | wx.showToast({ 91 | title: msg, 92 | icon: 'success', 93 | success() { 94 | callback && (setTimeout(() => { 95 | callback(); 96 | }, 1500)); 97 | } 98 | }); 99 | }, 100 | 101 | /** 102 | * 显示失败提示框 103 | */ 104 | showError(msg, callback) { 105 | wx.showModal({ 106 | title: '友情提示', 107 | content: msg, 108 | showCancel: false, 109 | success(res) { 110 | // callback && (setTimeout(() => { 111 | // callback(); 112 | // }, 1500)); 113 | callback && callback(); 114 | } 115 | }); 116 | }, 117 | 118 | /** 119 | * get请求 120 | */ 121 | _get(url, data, success, fail, complete, check_login) { 122 | let App = this; 123 | wx.showNavigationBarLoading(); 124 | 125 | // 构造请求参数 126 | data = Object.assign({ 127 | wxapp_id: 10001, 128 | token: wx.getStorageSync('token') 129 | }, data); 130 | 131 | // if (typeof check_login === 'undefined') 132 | // check_login = true; 133 | 134 | // 构造get请求 135 | let request = () => { 136 | data.token = wx.getStorageSync('token'); 137 | wx.request({ 138 | url: App.api_root + url, 139 | header: { 140 | 'content-type': 'application/json' 141 | }, 142 | data, 143 | success(res) { 144 | if (res.statusCode !== 200 || typeof res.data !== 'object') { 145 | console.log(res); 146 | App.showError('网络请求出错'); 147 | return false; 148 | } 149 | if (res.data.code === -1) { 150 | // 登录态失效, 重新登录 151 | wx.hideNavigationBarLoading(); 152 | App.doLogin(); 153 | } else if (res.data.code === 0) { 154 | App.showError(res.data.msg); 155 | return false; 156 | } else { 157 | success && success(res.data); 158 | } 159 | }, 160 | fail(res) { 161 | // console.log(res); 162 | App.showError(res.errMsg, () => { 163 | fail && fail(res); 164 | }); 165 | }, 166 | complete(res) { 167 | wx.hideNavigationBarLoading(); 168 | complete && complete(res); 169 | }, 170 | }); 171 | }; 172 | // 判断是否需要验证登录 173 | check_login ? App.doLogin(request) : request(); 174 | }, 175 | 176 | /** 177 | * post提交 178 | */ 179 | _post_form(url, data, success, fail, complete) { 180 | wx.showNavigationBarLoading(); 181 | let App = this; 182 | // 构造请求参数 183 | data = Object.assign({ 184 | wxapp_id: 10001, 185 | token: wx.getStorageSync('token') 186 | }, data); 187 | wx.request({ 188 | url: App.api_root + url, 189 | header: { 190 | 'content-type': 'application/x-www-form-urlencoded', 191 | }, 192 | method: 'POST', 193 | data, 194 | success(res) { 195 | if (res.statusCode !== 200 || typeof res.data !== 'object') { 196 | App.showError('网络请求出错'); 197 | return false; 198 | } 199 | if (res.data.code === -1) { 200 | // 登录态失效, 重新登录 201 | App.doLogin(() => { 202 | App._post_form(url, data, success, fail); 203 | }); 204 | return false; 205 | } else if (res.data.code === 0) { 206 | App.showError(res.data.msg, () => { 207 | fail && fail(res); 208 | }); 209 | return false; 210 | } 211 | success && success(res.data); 212 | }, 213 | fail(res) { 214 | // console.log(res); 215 | App.showError(res.errMsg, () => { 216 | fail && fail(res); 217 | }); 218 | }, 219 | complete(res) { 220 | wx.hideLoading(); 221 | wx.hideNavigationBarLoading(); 222 | complete && complete(res); 223 | } 224 | }); 225 | }, 226 | 227 | /** 228 | * 验证是否存在user_info 229 | */ 230 | validateUserInfo() { 231 | let user_info = wx.getStorageSync('user_info'); 232 | return !!wx.getStorageSync('user_info'); 233 | }, 234 | 235 | /** 236 | * 对象转URL 237 | */ 238 | urlEncode(data) { 239 | var _result = []; 240 | for (var key in data) { 241 | var value = data[key]; 242 | if (value.constructor == Array) { 243 | value.forEach(_value => { 244 | _result.push(key + "=" + _value); 245 | }); 246 | } else { 247 | _result.push(key + '=' + value); 248 | } 249 | } 250 | return _result.join('&'); 251 | }, 252 | 253 | /** 254 | * 设置当前页面标题 255 | */ 256 | setTitle() { 257 | let App = this, 258 | wxapp; 259 | if (wxapp = wx.getStorageSync('wxapp')) { 260 | wx.setNavigationBarTitle({ 261 | title: wxapp.navbar.wxapp_title 262 | }); 263 | } else { 264 | App.getWxappBase(() => { 265 | App.setTitle(); 266 | }); 267 | } 268 | }, 269 | 270 | /** 271 | * 设置navbar标题、颜色 272 | */ 273 | setNavigationBar() { 274 | let App = this; 275 | // 获取小程序基础信息 276 | App.getWxappBase(wxapp => { 277 | // 设置navbar标题、颜色 278 | wx.setNavigationBarColor({ 279 | frontColor: wxapp.navbar.top_text_color.text, 280 | backgroundColor: wxapp.navbar.top_background_color 281 | }) 282 | }); 283 | }, 284 | 285 | /** 286 | * 获取tabBar页面路径列表 287 | */ 288 | getTabBarLinks() { 289 | return tabBarLinks; 290 | }, 291 | 292 | /** 293 | * 验证登录 294 | */ 295 | checkIsLogin() { 296 | return wx.getStorageSync('token') != '' && wx.getStorageSync('user_id') != ''; 297 | }, 298 | 299 | /** 300 | * 授权登录 301 | */ 302 | getUserInfo(e, callback) { 303 | let App = this; 304 | if (e.detail.errMsg !== 'getUserInfo:ok') { 305 | return false; 306 | } 307 | wx.showLoading({ 308 | title: "正在登录", 309 | mask: true 310 | }); 311 | // 执行微信登录 312 | wx.login({ 313 | success(res) { 314 | // 发送用户信息 315 | App._post_form('user/login', { 316 | code: res.code, 317 | user_info: e.detail.rawData, 318 | encrypted_data: e.detail.encryptedData, 319 | iv: e.detail.iv, 320 | signature: e.detail.signature 321 | }, result => { 322 | // 记录token user_id 323 | wx.setStorageSync('token', result.data.token); 324 | wx.setStorageSync('user_id', result.data.user_id); 325 | // 执行回调函数 326 | callback && callback(); 327 | }, false, () => { 328 | wx.hideLoading(); 329 | }); 330 | } 331 | }); 332 | }, 333 | 334 | }); -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/category/index", 5 | "pages/category/list", 6 | "pages/goods/index", 7 | "pages/search/index", 8 | "pages/flow/index", 9 | "pages/flow/checkout", 10 | "pages/user/index", 11 | "pages/user/help", 12 | "pages/order/index", 13 | "pages/order/detail", 14 | "pages/address/index", 15 | "pages/address/create", 16 | "pages/address/detail", 17 | "pages/login/login" 18 | ], 19 | "window": { 20 | "navigationBarBackgroundColor": "#ffffff", 21 | "navigationBarTitleText": "", 22 | "navigationBarTextStyle": "black", 23 | "backgroundTextStyle": "dark" 24 | }, 25 | "tabBar": { 26 | "color": "#6e6d6b", 27 | "selectedColor": "#ff9966", 28 | "borderStyle": "black", 29 | "backgroundColor": "#ffffff", 30 | "list": [ 31 | { 32 | "pagePath": "pages/index/index", 33 | "text": "首页", 34 | "iconPath": "images/tabBar/home.png", 35 | "selectedIconPath": "images/tabBar/home_on.png" 36 | }, 37 | { 38 | "pagePath": "pages/category/index", 39 | "text": "全部", 40 | "iconPath": "images/tabBar/cate.png", 41 | "selectedIconPath": "images/tabBar/cate_on.png" 42 | }, 43 | { 44 | "pagePath": "pages/flow/index", 45 | "text": "购物车", 46 | "iconPath": "images/tabBar/cart.png", 47 | "selectedIconPath": "images/tabBar/cart_on.png" 48 | }, 49 | { 50 | "pagePath": "pages/user/index", 51 | "text": "我的", 52 | "iconPath": "images/tabBar/user.png", 53 | "selectedIconPath": "images/tabBar/user_on.png" 54 | } 55 | ], 56 | "position": "bottom" 57 | }, 58 | "debug": false, 59 | "sitemapLocation": "sitemap.json" 60 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /* common.wxss */ 2 | @import "/utils/common.wxss"; 3 | 4 | page { 5 | background: #f7f7f7; 6 | } 7 | 8 | .common-header-xian { 9 | border-top: 1rpx solid #eee; 10 | position: fixed; 11 | top: 0; 12 | width: 100%; 13 | z-index: 100; 14 | } 15 | 16 | .del { 17 | text-decoration: line-through; 18 | padding-left: 10rpx; 19 | color: #999; 20 | } 21 | 22 | /* 没有更多 */ 23 | 24 | .no-more { 25 | text-align: center; 26 | color: #737373; 27 | padding: 20rpx 0; 28 | } 29 | 30 | .yoshop-notcont { 31 | margin: 130rpx 100rpx; 32 | } 33 | 34 | .yoshop-notcont .cont { 35 | display: block; 36 | text-align: center; 37 | font-size: 30rpx; 38 | color: #999; 39 | margin-top: 20rpx; 40 | } 41 | 42 | .yoshop-notcont .iconfont { 43 | font-size: 150rpx; 44 | color: #ccc; 45 | text-align: center; 46 | display: block; 47 | margin-bottom: 24rpx; 48 | } 49 | 50 | .yoshop-notcont .img { 51 | width: 200px; 52 | height: 120px; 53 | margin: 0 auto; 54 | } 55 | 56 | .yoshop-notcont .img image { 57 | width: 100%; 58 | height: 100%; 59 | } 60 | 61 | .category-list { 62 | overflow: hidden; 63 | } 64 | 65 | .category-list .list { 66 | box-sizing: border-box; 67 | width: 50%; 68 | float: left; 69 | } 70 | 71 | .category-list .list:nth-child(2n) { 72 | border-left: 2px solid #f7f7f7; 73 | border-bottom: 4px solid #f7f7f7; 74 | } 75 | 76 | .category-list .list:nth-child(2n-1) { 77 | border-right: 2px solid #f7f7f7; 78 | border-bottom: 4px solid #f7f7f7; 79 | } 80 | 81 | .category-list .list .left, .category-list .right { 82 | width: 100%; 83 | } 84 | 85 | .category-list .list .left .img image { 86 | width: 100%; 87 | height: 375rpx; 88 | display: block; 89 | } 90 | 91 | .category-list .right .cont { 92 | padding: 0 12rpx; 93 | } 94 | 95 | .category-list .right .cont .title { 96 | height: 76rpx; 97 | line-height: 1.3; 98 | } 99 | 100 | .category-list.arrange .list { 101 | overflow: hidden; 102 | padding: 15rpx; 103 | border-bottom: 1rpx solid #f7f7f7; 104 | width: 100%; 105 | } 106 | 107 | .category-list.arrange .list .left { 108 | width: 35%; 109 | float: left; 110 | } 111 | 112 | .category-list.arrange .list .right { 113 | width: 65%; 114 | float: left; 115 | } 116 | 117 | .category-list.arrange .list .left .img image { 118 | width: 220rpx; 119 | height: 220rpx; 120 | } 121 | 122 | .button-common button { 123 | background: none; 124 | line-height: inherit; 125 | border-radius: 0; 126 | border: 0; 127 | font-size: 30rpx; 128 | } 129 | 130 | .button-common button[disabled]:not([type]) { 131 | color: #fff; 132 | background-color: #ff495e; 133 | } 134 | 135 | .button-common button::after { 136 | content: " "; 137 | width: 0; 138 | height: 0; 139 | border: none; 140 | transform: scale(0); 141 | transform-origin: 0 0; 142 | box-sizing: border-box; 143 | border-radius: 0; 144 | } 145 | 146 | .commont-fixed-footer { 147 | position: fixed; 148 | bottom: 0; 149 | left: 0; 150 | right: 0; 151 | background: #fff; 152 | border-top: 1rpx solid #ddd; 153 | padding: 3px 0; 154 | z-index: 1000; 155 | } 156 | 157 | .commont-fixed-footer .li { 158 | color: #666; 159 | } 160 | 161 | .commont-fixed-footer .li.active { 162 | color: #ff495e; 163 | } 164 | 165 | .commont-fixed-footer .li image { 166 | width: 50rpx; 167 | height: 50rpx; 168 | } 169 | 170 | .bargain-mol { 171 | background: #fff; 172 | position: fixed; 173 | left: 0; 174 | right: 0; 175 | bottom: -100%; 176 | z-index: 120; 177 | visibility: hidden; 178 | } 179 | 180 | .bargain-mol.active { 181 | bottom: 0; 182 | visibility: visible; 183 | } 184 | 185 | .bargain-mol .header { 186 | background: #f1f1f5; 187 | } 188 | 189 | .bargain-mol .footer { 190 | background: #ff495e; 191 | padding: 26rpx 0; 192 | color: #fff; 193 | } 194 | 195 | .bargain-mol .max-cont { 196 | height: 600rpx; 197 | } 198 | 199 | .bargain-mol .icon-guanbi { 200 | font-size: 34rpx; 201 | float: right; 202 | color: #999; 203 | } 204 | 205 | .bargain-commont-bg { 206 | background: rgba(0, 0, 0, 0.6); 207 | position: fixed; 208 | right: 0; 209 | left: 0; 210 | top: 0; 211 | bottom: 0; 212 | z-index: 20; 213 | } 214 | 215 | .selectNumber { 216 | height: 34px; 217 | flex-direction: row; 218 | border: 1rpx solid #eee; 219 | border-radius: 10rpx; 220 | display: inline-block; 221 | } 222 | 223 | .selectNumber .default { 224 | width: 34px; 225 | height: 34px; 226 | float: left; 227 | line-height: 32px; 228 | padding: 0; 229 | background: #fff; 230 | color: #444; 231 | font-size: 48rpx; 232 | } 233 | 234 | .selectNumber .default-active { 235 | background: #f7f7f7; 236 | color: #ddd; 237 | } 238 | 239 | .selectNumber button:after { 240 | content: none; 241 | border: none; 242 | } 243 | 244 | .selectNumber input { 245 | float: left; 246 | width: 50px; 247 | height: 34px; 248 | line-height: 34px; 249 | border-right: 1rpx solid #eee; 250 | border-left: 1rpx solid #eee; 251 | text-align: center; 252 | font-size: 28rpx; 253 | color: #444; 254 | } 255 | 256 | /* 返回顶部 */ 257 | 258 | .widget-goTop { 259 | position: fixed; 260 | bottom: 150rpx; 261 | z-index: 20; 262 | right: 12px; 263 | background: rgba(255, 255, 255, 0.9); 264 | width: 76rpx; 265 | height: 76rpx; 266 | border-radius: 76rpx; 267 | border: 1rpx solid #eee; 268 | } 269 | 270 | .widget-goTop .icon-fanhuidingbu { 271 | color: #666; 272 | display: block; 273 | text-align: center; 274 | line-height: 76rpx; 275 | font-size: 32rpx; 276 | } 277 | 278 | .index-loading .loading { 279 | border-radius: 100%; 280 | margin: 150rpx auto 0; 281 | animation-fill-mode: both; 282 | border: 2px solid #ff495e; 283 | border-bottom-color: transparent; 284 | height: 25px; 285 | width: 25px; 286 | background: transparent !important; 287 | animation: rotate 0.75s 0s linear infinite; 288 | } 289 | 290 | @-webkit-keyframes rotate { 291 | 0% { 292 | transform: rotate(0deg) scale(1); 293 | } 294 | 295 | 100% { 296 | transform: rotate(360deg) scale(1); 297 | } 298 | } 299 | 300 | @keyframes rotate { 301 | 0% { 302 | transform: rotate(0deg) scale(1); 303 | } 304 | 305 | 100% { 306 | transform: rotate(360deg) scale(1); 307 | } 308 | } 309 | 310 | .title-header { 311 | height: 100rpx; 312 | line-height: 100rpx; 313 | font-weight: 700; 314 | margin-left: -10rpx; 315 | } 316 | 317 | .title-footer { 318 | position: relative; 319 | z-index: 1; 320 | height: 80rpx; 321 | line-height: 80rpx; 322 | overflow: hidden; 323 | color: #888; 324 | text-align: center; 325 | margin: 0 18rpx 0; 326 | } 327 | 328 | .title-footer .cont { 329 | background: #f7f7f7; 330 | padding: 0 12rpx; 331 | font-size: 28rpx; 332 | z-index: 10; 333 | } 334 | 335 | .title-footer .hr { 336 | background: #eee; 337 | height: 1rpx; 338 | border: 0; 339 | position: absolute; 340 | left: 10%; 341 | right: 10%; 342 | top: 50%; 343 | margin-top: 1px; 344 | z-index: -1; 345 | } 346 | 347 | .slide-image { 348 | width: 100%; 349 | height: 100%; 350 | margin: 0 auto; 351 | display: block; 352 | } 353 | 354 | .index_sale { 355 | background: #fff; 356 | padding: 0 12px 12px 12px; 357 | } 358 | 359 | .index_sale .nav_img, .index-list .nav_img { 360 | padding: 30rpx 0 0 0; 361 | width: 100%; 362 | height: 30rpx; 363 | } 364 | 365 | .index_sale scroll-view { 366 | width: 100%; 367 | white-space: nowrap; 368 | } 369 | 370 | .index_sale .sale_img { 371 | border: 1rpx solid #f2f2f2; 372 | border-radius: 4px; 373 | overflow: hidden; 374 | width: 159rpx; 375 | height: 159rpx; 376 | } 377 | 378 | .index_sale .sale_img image { 379 | width: 100%; 380 | height: 100%; 381 | } 382 | 383 | .index_sale .price { 384 | margin-top: 10rpx; 385 | display: block; 386 | } 387 | 388 | .index_sale .page-column { 389 | padding: 0 11rpx 11rpx 0; 390 | } 391 | 392 | .index_sale .content { 393 | width: 170rpx; 394 | } 395 | 396 | .index_sale .content text { 397 | font-size: 26rpx; 398 | margin: 5rpx 10rpx; 399 | width: 100%; 400 | } 401 | 402 | /* 403 | .flex { 404 | display: flex; 405 | } */ 406 | 407 | .goods-comment-box .admin { 408 | font-size: 26rpx; 409 | color: #999; 410 | padding-right: 10rpx; 411 | } 412 | 413 | .goods-comment-cont { 414 | font-size: 30rpx; 415 | color: #333; 416 | margin: 10rpx 0; 417 | } 418 | 419 | .footer-fixed { 420 | position: fixed; 421 | display: flex; 422 | bottom: 0px; 423 | left: 0px; 424 | right: 0px; 425 | height: 46px; 426 | z-index: 18; 427 | box-shadow: 1px 5px 15px rgba(50, 50, 50, 0.3); 428 | background: #fff; 429 | } 430 | 431 | .order-bt { 432 | width: 50%; 433 | background-color: #ff495e; 434 | color: #fff; 435 | text-align: center; 436 | line-height: 46px; 437 | } 438 | 439 | .swiper-box .wx-swiper-dot { 440 | /* width: 0rpx; 441 | height: 0rpx; */ 442 | } 443 | 444 | .goods_comment_box .comment_btn { 445 | width: 220rpx; 446 | margin: 0 auto; 447 | padding: 20rpx 0; 448 | } 449 | 450 | .goods_comment_box .comment_btn text { 451 | display: block; 452 | padding: 5rpx 0; 453 | color: #ff495e; 454 | font-size: 26rpx; 455 | text-align: center; 456 | border: 1px solid #ff495e; 457 | border-radius: 30rpx; 458 | } 459 | 460 | .goods-detail-box { 461 | padding: 0; 462 | min-height: 150px; 463 | } 464 | 465 | .com_xing .icon-shoucang1 { 466 | padding-right: 6rpx; 467 | color: #ccc; 468 | font-size: 26rpx; 469 | } 470 | 471 | .com_xing .icon-shoucang1.active { 472 | color: #f4a213; 473 | } 474 | 475 | .goods-comment-box .left { 476 | flex: 3; 477 | position: relative; 478 | } 479 | 480 | .goods-comment-box .right { 481 | flex: 3; 482 | } 483 | 484 | .bright789-text { 485 | font-size: 40rpx; 486 | line-height: 40px; 487 | color: #f00; 488 | } 489 | 490 | .bright789_view_hide { 491 | display: none; 492 | } 493 | 494 | .bright789_view_show { 495 | display: block; 496 | } 497 | 498 | .show { 499 | display: block; 500 | } 501 | 502 | .hide { 503 | display: none; 504 | } 505 | 506 | .com_xing { 507 | display: inline-block; 508 | } 509 | 510 | .flow-checkout-header { 511 | padding: 28rpx 0; 512 | background: #fff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANYAAAANCAYAAADVGpDCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NTc3MiwgMjAxNC8wMS8xMy0xOTo0NDowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3Yjk4M2ExYy1jMDhkLTQ1OTktYTI0Ny1kZjNjYzdiYTQ5ZTgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NDQwNkY3RkU5N0NGMTFFNUI3N0M4NTU4MzM2RjlFODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NDQwNkY3RkQ5N0NGMTFFNUI3N0M4NTU4MzM2RjlFODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDowNzgwZWI1NS03OGFhLTQzOTUtODQ4OC1lOWI5YmVlYTY1ZDciIHN0UmVmOmRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDo1OTRiYzUyMy1jMzc3LTExNzgtYTdkZS04NGY3YmM1ZGIxMDMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz556PLxAAACBElEQVR42tyaSyhEYRTHP48imlKibDQeSSlkSlEWLCRFsZNH5FE2FqQ8ErIRC9lIkTwXSpMkWWChhEJCSnlkoUZGSsr78f98n43CMFPu/Z/6NZuZ2zn33/+cb869XkmLx8IDEQaGQJbgiytQDSY3MyL+LYnL/HxPXSoHDIJQQq2WQQk4Dbbb/yUB29LJ+6e3B66VB3ZITbUIEqSpCGoJBP1ghtBUD6ARpEtTGSEhXzd+awE9oJzQUPegWdf3QlBPMhgDMYRa7YNisGWkpP5qrBQtVBShUHugUE9hs4fUtwG0utlEjRivoA/Ug1sj3vjffr8FNJEK1auPFHcE9UTq5pdK2PwcoAzMG7mjuRrRYEIfK9jiDJSCBZJ6ynSTsBBqNQ0qgdPISbq6vJCFbJOaagrEk5gqWNczRGiqG1Ah1LLMafRkf5pYIUKtZnMJDXUNasAIST2ZYFioRx9ssQaKwJFZEv5uYmWDXVJTrYBEElP562PfPKGpnkAbSDOTqb6aWAGgW6iHol5kQj2CdtAJngnqkc1hHMQRNr9DPaXWzZj8Z2PZtFCxhEIdaKE2CGqRJ4060AH8CLUaALX6f5VpBZLhI9SaeZXQVHKNLt84SCIxVbhQi5YuQlNd6OVElZlN9TGxrGBUn2PZ4lyoTdIsST0FQj0UDSLUak6ot3gcBLVY3wQYAJoVXxmNERajAAAAAElFTkSuQmCC') bottom left repeat-x; 513 | background-size: 120rpx auto; 514 | position: relative; 515 | } 516 | 517 | .flow-header-left { 518 | flex: 14; 519 | } 520 | 521 | .flow-header-right { 522 | flex: 1; 523 | } 524 | 525 | .flow-header-right image { 526 | width: 34rpx; 527 | height: 34rpx; 528 | margin-top: 20rpx; 529 | float: right; 530 | } 531 | 532 | .flow-checkout-header .flow-checkout-address { 533 | font-size: 26rpx; 534 | color: #777; 535 | margin-top: 6rpx; 536 | } 537 | 538 | .flow-shopList { 539 | padding: 20rpx 0; 540 | } 541 | 542 | .flow-shopList .flow-list-left { 543 | flex: 2; 544 | } 545 | 546 | .flow-shopList .flow-list-left image { 547 | width: 200rpx; 548 | height: 200rpx; 549 | border: 1rpx solid #eee; 550 | background: #fff; 551 | } 552 | 553 | .flow-shopList .flow-list-right { 554 | flex: 4; 555 | } 556 | 557 | .flow-shopList .flow-list-right .h4 { 558 | font-size: 30rpx; 559 | color: #333; 560 | } 561 | 562 | .flow-shopList .flow-list-right .flow-cont { 563 | font-size: 30rpx; 564 | color: #ff495e; 565 | } 566 | 567 | .flow-shopList .flow-list-right .small { 568 | float: right; 569 | font-size: 26rpx; 570 | color: #777; 571 | } 572 | 573 | .flow-shopList .flow-list-right .flow-list-cont { 574 | padding-top: 10rpx; 575 | } 576 | 577 | .flow-fixed-footer { 578 | position: fixed; 579 | bottom: 0; 580 | width: 100%; 581 | background: #fff; 582 | border-top: 1px solid #eee; 583 | z-index: 11; 584 | } 585 | 586 | .flow-num-box { 587 | font-size: 30rpx; 588 | color: #777; 589 | padding: 15rpx 12px; 590 | text-align: right; 591 | /* border-top: 1rpx solid #f1f1f1; */ 592 | } 593 | 594 | .flow-all-money { 595 | padding: 8px 12px; 596 | color: #444; 597 | } 598 | 599 | .flow-all-money .flow-all-list { 600 | font-size: 30rpx; 601 | padding: 20rpx 0; 602 | border-bottom: 1rpx solid #f1f1f1; 603 | } 604 | 605 | .flow-all-money .flow-all-list:last-child { 606 | border-bottom: none; 607 | } 608 | 609 | .flow-all-money .flow-all-list-cont { 610 | font-size: 28rpx; 611 | padding: 6rpx 0; 612 | } 613 | 614 | .flow-all-money .flow-arrow { 615 | justify-content: flex-end; 616 | align-items: center; 617 | } 618 | 619 | .flow-fixed-footer .chackout-left { 620 | font-size: 32rpx; 621 | line-height: 46px; 622 | color: #777; 623 | flex: 4; 624 | padding-left: 12px; 625 | } 626 | 627 | .flow-fixed-footer .chackout-right { 628 | font-size: 34rpx; 629 | flex: 2; 630 | } 631 | 632 | .flow-btn { 633 | background-color: #ff495e; 634 | color: #fff; 635 | text-align: center; 636 | line-height: 46px; 637 | display: block; 638 | } 639 | 640 | .flow-list .header .shop_name { 641 | padding-left: 10rpx; 642 | font-size: 30rpx; 643 | color: #333; 644 | } 645 | 646 | .flow-list .header .icon-dianpu2 { 647 | color: #ff495e; 648 | padding-left: 20rpx; 649 | font-size: 32rpx; 650 | } 651 | 652 | .flow-list .header image { 653 | width: 34rpx; 654 | height: 37rpx; 655 | position: absolute; 656 | top: 50%; 657 | margin-top: -18rpx; 658 | left: 15px; 659 | } 660 | 661 | .flow-list .header { 662 | background: #fdf9f9; 663 | padding: 24rpx 0; 664 | border-top: 1rpx solid #eee; 665 | border-bottom: 1rpx solid #eee; 666 | font-size: 30rpx; 667 | position: relative; 668 | } 669 | 670 | .flow-list custom-li, .addres-list custom-li { 671 | margin-top: 25rpx; 672 | display: block; 673 | } 674 | 675 | .flow-list custom-li:first-child, .addres-list custom-li:first-child { 676 | margin-top: 0; 677 | } 678 | 679 | .flow-distribution-right .icon-xiangyoujiantou { 680 | font-size: 26rpx; 681 | position: absolute; 682 | right: 15px; 683 | top: 50%; 684 | margin-top: -16rpx; 685 | color: #999; 686 | } 687 | 688 | .flow-checkout-address text { 689 | padding-right: 5rpx; 690 | } 691 | 692 | .flow-header-right .icon-xiangyoujiantou { 693 | position: absolute; 694 | right: 15px; 695 | top: 50%; 696 | margin-top: -13rpx; 697 | font-size: 32rpx; 698 | color: #999; 699 | } 700 | 701 | .wxParse-em, .WxEmojiView { 702 | display: inline-block; 703 | color: #333; 704 | } 705 | 706 | .flow-shopList .flow-list-left image { 707 | width: 180rpx; 708 | height: 180rpx; 709 | } 710 | 711 | .profile-btn button { 712 | background: #ff495e; 713 | color: white; 714 | margin-bottom: 20rpx; 715 | } 716 | 717 | .flow-checkout-header .icon-dingwei1 { 718 | position: absolute; 719 | top: 50%; 720 | left: 15px; 721 | font-size: 40rpx; 722 | color: #777; 723 | margin-top: -20rpx; 724 | } 725 | 726 | /* 727 | .index-cont-search { 728 | width: 85%; 729 | font-size: 32rpx; 730 | } */ 731 | 732 | .index-cont-search { 733 | width: 100%; 734 | font-size: 28rpx; 735 | position: relative; 736 | background: #f1f1f1; 737 | } 738 | 739 | .index-cont-search icon { 740 | position: absolute; 741 | left: 50%; 742 | margin-left: -70rpx; 743 | top: 50%; 744 | margin-top: -15rpx; 745 | } 746 | 747 | .index-cont-search text { 748 | margin-left: 72rpx; 749 | } 750 | 751 | @-webkit-keyframes shop { 752 | 0% { 753 | transform: translateY(-80px); 754 | } 755 | 756 | 50% { 757 | transform: translateY(0px); 758 | } 759 | 760 | 100% { 761 | transform: translateY(-80px); 762 | } 763 | } 764 | 765 | @keyframes shop { 766 | 0% { 767 | transform: translateY(-80px); 768 | } 769 | 770 | 50% { 771 | transform: translateY(0px); 772 | } 773 | 774 | 100% { 775 | transform: translateY(-80px); 776 | } 777 | } 778 | 779 | .user-order { 780 | background: #fff; 781 | } 782 | 783 | .user-orderIcon { 784 | width: 46rpx; 785 | height: 46rpx; 786 | padding-left: 15rpx; 787 | margin-top: 15rpx; 788 | } 789 | 790 | .user-orderName { 791 | font-size: 30rpx; 792 | color: #444; 793 | position: absolute; 794 | left: 90rpx; 795 | top: 50%; 796 | margin-top: -21rpx; 797 | } 798 | 799 | .user-orderJtou { 800 | color: #777; 801 | font-size: 26rpx; 802 | } 803 | 804 | .user-orderCont { 805 | font-size: 28rpx; 806 | color: #999; 807 | } 808 | 809 | .user-orderContBox { 810 | float: right; 811 | padding: 15rpx; 812 | } 813 | 814 | .userinfo { 815 | display: flex; 816 | flex-direction: column; 817 | align-items: center; 818 | } 819 | 820 | .address-box .left-name { 821 | width: 95px; 822 | } 823 | 824 | .address-box .right-cont { 825 | padding-right: 15px; 826 | font-size: 30rpx; 827 | color: #444; 828 | } 829 | 830 | .address-box .right-cont input { 831 | width: 100%; 832 | font-size: 30rpx; 833 | color: #444; 834 | } 835 | 836 | .address-cont-box picker { 837 | display: inline-block; 838 | margin-right: 15px; 839 | width: 100%; 840 | } 841 | 842 | .button { 843 | border: 1px solid #1aad19; 844 | border-radius: 2px; 845 | } 846 | 847 | .picker { 848 | padding: 13px; 849 | background-color: #fff; 850 | } 851 | 852 | .profile-list { 853 | padding: 24rpx 0; 854 | border-bottom: 1px solid #f6f6f9; 855 | } 856 | 857 | .profile-list .admin { 858 | font-size: 30rpx; 859 | color: #333; 860 | } 861 | 862 | .profile-btn button { 863 | background: #ff495e; 864 | color: white; 865 | } 866 | 867 | .profile-btn button[disabled] { 868 | background: #f16474; 869 | color: white; 870 | } 871 | 872 | .search-box .left { 873 | width: 28px; 874 | } 875 | 876 | .search-box .left icon { 877 | padding: 18rpx; 878 | } 879 | 880 | .search-box .right { 881 | flex: 1; 882 | } 883 | 884 | .wxParse-img { 885 | display: block; 886 | width: 100%; 887 | margin: 0 auto; 888 | } 889 | 890 | .wxParse-inline { 891 | font-size: 28rpx; 892 | text-align: center; 893 | } 894 | 895 | .wxParse-div { 896 | overflow: hidden; 897 | } 898 | 899 | .wxParse-div .kd_pic { 900 | float: left; 901 | width: 50%; 902 | margin: 0 auto; 903 | } 904 | 905 | .xEmojiView { 906 | margin: 15rpx 0; 907 | } 908 | -------------------------------------------------------------------------------- /components/shortcut/shortcut.js: -------------------------------------------------------------------------------- 1 | const App = getApp(); 2 | 3 | Component({ 4 | options: { 5 | multipleSlots: true // 在组件定义时的选项中启用多slot支持 6 | }, 7 | 8 | /** 9 | * 组件的属性列表 10 | * 用于组件自定义设置 11 | */ 12 | properties: { 13 | // 弹窗标题 14 | title: { 15 | type: String, 16 | value: '弹窗标题' 17 | } 18 | }, 19 | 20 | /** 21 | * 私有数据, 组件的初始数据 22 | * 可用于模版渲染 23 | */ 24 | data: { 25 | // 弹窗显示控制 26 | isShow: false, 27 | transparent: true 28 | }, 29 | 30 | /** 31 | * 组件的方法列表 32 | * 更新属性和数据的方法与更新页面数据的方法类似 33 | */ 34 | methods: { 35 | 36 | /** 37 | * 导航菜单切换事件 38 | */ 39 | _onToggleShow(e) { 40 | this.setData({ 41 | isShow: !this.data.isShow, 42 | transparent: false 43 | }) 44 | }, 45 | 46 | /** 47 | * 导航页面跳转 48 | */ 49 | _onTargetPage(e) { 50 | let urls = App.getTabBarLinks(); 51 | wx.switchTab({ 52 | url: '/' + urls[e.detail.target.dataset.index] 53 | }); 54 | } 55 | 56 | } 57 | }) -------------------------------------------------------------------------------- /components/shortcut/shortcut.json: -------------------------------------------------------------------------------- 1 | { 2 | "component": true, 3 | "usingComponents": {} 4 | } -------------------------------------------------------------------------------- /components/shortcut/shortcut.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 8 |
9 | 10 | 11 |
12 | 15 |
16 | 17 | 18 |
19 | 22 |
23 | 24 | 25 |
26 | 29 |
30 | 31 | 32 |
33 | 36 |
37 | 38 |
-------------------------------------------------------------------------------- /components/shortcut/shortcut.wxss: -------------------------------------------------------------------------------- 1 | @import "/utils/common.wxss"; 2 | 3 | /* 快捷导航 */ 4 | 5 | .shortcut { 6 | position: fixed; 7 | right: 12px; 8 | bottom: 250rpx; 9 | width: 76rpx; 10 | line-height: 1; 11 | z-index: 5; 12 | border-radius: 50%; 13 | } 14 | 15 | /* 导航菜单元素 */ 16 | 17 | .nav-item { 18 | position: absolute; 19 | bottom: 0; 20 | padding: 0; 21 | width: 76rpx; 22 | height: 76rpx; 23 | line-height: 76rpx; 24 | color: #fff; 25 | background: rgba(0, 0, 0, 0.4); 26 | border-radius: 50%; 27 | text-align: center; 28 | transform: rotate(0deg); 29 | opacity: 0; 30 | } 31 | 32 | .nav-item text { 33 | font-size: 40rpx; 34 | } 35 | 36 | /* 导航开关 */ 37 | 38 | .nav-item__switch { 39 | opacity: 1; 40 | } 41 | 42 | .shortcut_click_show { 43 | margin-bottom: 0; 44 | background: #ff5454; 45 | } 46 | 47 | /* 显示动画 */ 48 | 49 | .show_80 { 50 | bottom: 384rpx; 51 | animation: show_80 0.3s forwards; 52 | } 53 | 54 | .show_60 { 55 | bottom: 288rpx; 56 | animation: show_60 0.3s forwards; 57 | } 58 | 59 | .show_40 { 60 | bottom: 192rpx; 61 | animation: show_40 0.3s forwards; 62 | } 63 | 64 | .show_20 { 65 | bottom: 96rpx; 66 | animation: show_20 0.3s forwards; 67 | } 68 | 69 | @keyframes show_20 { 70 | from { 71 | bottom: 0; 72 | transform: rotate(0deg); 73 | opacity: 0; 74 | } 75 | 76 | to { 77 | bottom: 96rpx; 78 | transform: rotate(360deg); 79 | opacity: 1; 80 | } 81 | } 82 | 83 | @keyframes show_40 { 84 | from { 85 | bottom: 0; 86 | transform: rotate(0deg); 87 | opacity: 0; 88 | } 89 | 90 | to { 91 | bottom: 192rpx; 92 | transform: rotate(360deg); 93 | opacity: 1; 94 | } 95 | } 96 | 97 | @keyframes show_60 { 98 | from { 99 | bottom: 0; 100 | transform: rotate(0deg); 101 | opacity: 0; 102 | } 103 | 104 | to { 105 | bottom: 288rpx; 106 | transform: rotate(360deg); 107 | opacity: 1; 108 | } 109 | } 110 | 111 | @keyframes show_80 { 112 | from { 113 | bottom: 0; 114 | transform: rotate(0deg); 115 | opacity: 0; 116 | } 117 | 118 | to { 119 | bottom: 384rpx; 120 | transform: rotate(360deg); 121 | opacity: 1; 122 | } 123 | } 124 | 125 | /* 隐藏动画 */ 126 | 127 | .hide_80 { 128 | bottom: 0; 129 | animation: hide_80 0.3s; 130 | opacity: 0; 131 | } 132 | 133 | .hide_60 { 134 | bottom: 0; 135 | animation: hide_60 0.3s; 136 | opacity: 0; 137 | } 138 | 139 | .hide_40 { 140 | bottom: 0; 141 | animation: hide_40 0.3s; 142 | opacity: 0; 143 | } 144 | 145 | .hide_20 { 146 | bottom: 0; 147 | animation: hide_20 0.3s; 148 | opacity: 0; 149 | } 150 | 151 | @keyframes hide_20 { 152 | from { 153 | bottom: 96rpx; 154 | transform: rotate(360deg); 155 | opacity: 1; 156 | } 157 | 158 | to { 159 | bottom: 0; 160 | transform: rotate(0deg); 161 | opacity: 0; 162 | } 163 | } 164 | 165 | @keyframes hide_40 { 166 | from { 167 | bottom: 192rpx; 168 | transform: rotate(360deg); 169 | opacity: 1; 170 | } 171 | 172 | to { 173 | bottom: 0; 174 | transform: rotate(0deg); 175 | opacity: 0; 176 | } 177 | } 178 | 179 | @keyframes hide_60 { 180 | from { 181 | bottom: 288rpx; 182 | transform: rotate(360deg); 183 | opacity: 1; 184 | } 185 | 186 | to { 187 | bottom: 0; 188 | transform: rotate(0deg); 189 | opacity: 0; 190 | } 191 | } 192 | 193 | @keyframes hide_80 { 194 | from { 195 | bottom: 384rpx; 196 | transform: rotate(360deg); 197 | opacity: 1; 198 | } 199 | 200 | to { 201 | bottom: 0; 202 | transform: rotate(0deg); 203 | opacity: 0; 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /images/default-avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/default-avatar.jpg -------------------------------------------------------------------------------- /images/no_content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/no_content.png -------------------------------------------------------------------------------- /images/tabBar/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/cart.png -------------------------------------------------------------------------------- /images/tabBar/cart_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/cart_on.png -------------------------------------------------------------------------------- /images/tabBar/cate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/cate.png -------------------------------------------------------------------------------- /images/tabBar/cate_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/cate_on.png -------------------------------------------------------------------------------- /images/tabBar/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/home.png -------------------------------------------------------------------------------- /images/tabBar/home_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/home_on.png -------------------------------------------------------------------------------- /images/tabBar/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/user.png -------------------------------------------------------------------------------- /images/tabBar/user_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/tabBar/user_on.png -------------------------------------------------------------------------------- /images/user-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/user-bg.png -------------------------------------------------------------------------------- /images/wechatapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiovo/yoshop-wechat/3adeeb450add12a2ca9a455eafed156c01c2120b/images/wechatapp.png -------------------------------------------------------------------------------- /pages/address/create.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | disabled: false, 10 | nav_select: false, // 快捷导航 11 | 12 | name: '', 13 | region: '', 14 | phone: '', 15 | detail: '', 16 | 17 | error: '', 18 | }, 19 | 20 | /** 21 | * 生命周期函数--监听页面加载 22 | */ 23 | onLoad: function(options) { 24 | 25 | }, 26 | 27 | /** 28 | * 表单提交 29 | */ 30 | saveData: function(e) { 31 | let _this = this, 32 | values = e.detail.value 33 | values.region = _this.data.region; 34 | 35 | // 记录formId 36 | // App.saveFormId(e.detail.formId); 37 | 38 | // 表单验证 39 | if (!_this.validation(values)) { 40 | App.showError(_this.data.error); 41 | return false; 42 | } 43 | 44 | // 按钮禁用 45 | _this.setData({ 46 | disabled: true 47 | }); 48 | 49 | // 提交到后端 50 | App._post_form('address/add', values, function(result) { 51 | App.showSuccess(result.msg, function() { 52 | wx.navigateBack(); 53 | }); 54 | }, false, function() { 55 | // 解除禁用 56 | _this.setData({ 57 | disabled: false 58 | }); 59 | }); 60 | }, 61 | 62 | /** 63 | * 表单验证 64 | */ 65 | validation: function(values) { 66 | if (values.name === '') { 67 | this.data.error = '收件人不能为空'; 68 | return false; 69 | } 70 | if (values.phone.length < 1) { 71 | this.data.error = '手机号不能为空'; 72 | return false; 73 | } 74 | // if (values.phone.length !== 11) { 75 | // this.data.error = '手机号长度有误'; 76 | // return false; 77 | // } 78 | let reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/; 79 | if (!reg.test(values.phone)) { 80 | this.data.error = '手机号不符合要求'; 81 | return false; 82 | } 83 | if (!this.data.region) { 84 | this.data.error = '省市区不能空'; 85 | return false; 86 | } 87 | if (values.detail === '') { 88 | this.data.error = '详细地址不能为空'; 89 | return false; 90 | } 91 | return true; 92 | }, 93 | 94 | /** 95 | * 修改地区 96 | */ 97 | bindRegionChange: function(e) { 98 | this.setData({ 99 | region: e.detail.value 100 | }) 101 | }, 102 | 103 | }) -------------------------------------------------------------------------------- /pages/address/create.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "新增收货地址", 3 | "usingComponents": { 4 | "shortcut": "/components/shortcut/shortcut" 5 | } 6 | } -------------------------------------------------------------------------------- /pages/address/create.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 收货人 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 手机号 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 所在地区 27 | 28 | 29 | 30 | {{region}} 31 | 选择省、市、区 32 | 33 | 34 | 35 | 36 | 37 | 详细地址 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /pages/address/create.wxss: -------------------------------------------------------------------------------- 1 | .profile-list .admin { 2 | padding-left: 15px; 3 | font-size: 30rpx; 4 | color: #333; 5 | } 6 | 7 | .address-box .left-name { 8 | width: 85px; 9 | } 10 | 11 | .address-cont-title .list { 12 | width: auto; 13 | padding: 24rpx; 14 | } 15 | 16 | .tui-picker-detail text { 17 | padding: 0 10rpx; 18 | } 19 | 20 | .infoText { 21 | line-height: 56rpx; 22 | display: block; 23 | } 24 | 25 | picker-view { 26 | background-color: white; 27 | padding: 0; 28 | width: 100%; 29 | height: 480rpx; 30 | bottom: 0; 31 | position: fixed; 32 | } 33 | 34 | picker-view-column view { 35 | vertical-align: middle; 36 | font-size: 28rpx; 37 | line-height: 28rpx; 38 | height: 100%; 39 | display: flex; 40 | align-items: center; 41 | justify-content: center; 42 | } 43 | 44 | .animation-element-wrapper { 45 | display: flex; 46 | position: fixed; 47 | left: 0; 48 | top: 0; 49 | height: 100%; 50 | width: 100%; 51 | z-index: 21; 52 | } 53 | 54 | .animation-element { 55 | display: flex; 56 | position: fixed; 57 | width: 100%; 58 | height: 570rpx; 59 | bottom: 0; 60 | background-color: rgba(255, 255, 255, 1); 61 | } 62 | 63 | .animation-button { 64 | margin-top: 20rpx; 65 | top: 20rpx; 66 | width: 400rpx; 67 | height: 100rpx; 68 | line-height: 100rpx; 69 | align-items: center; 70 | } 71 | 72 | .address-text { 73 | color: #999; 74 | display: inline-flex; 75 | position: fixed; 76 | margin-top: 20rpx; 77 | height: 50rpx; 78 | text-align: center; 79 | line-height: 50rpx; 80 | font-size: 30rpx; 81 | font-family: Arial, Helvetica, sans-serif; 82 | } 83 | 84 | .left-bt { 85 | left: 30rpx; 86 | } 87 | 88 | .right-bt { 89 | right: 30rpx; 90 | color: #ec5151; 91 | } 92 | 93 | .line { 94 | display: block; 95 | position: fixed; 96 | height: 1rpx; 97 | width: 100%; 98 | margin-top: 89rpx; 99 | background-color: #eee; 100 | } 101 | 102 | .address-box .right-cont input { 103 | width: 100%; 104 | font-size: 30rpx; 105 | color: #444; 106 | } 107 | 108 | .bargain-commont-bg { 109 | background: rgba(0, 0, 0, 0.6); 110 | position: fixed; 111 | right: 0; 112 | left: 0; 113 | top: 0; 114 | bottom: 0; 115 | z-index: 20; 116 | } 117 | 118 | .f-34 { 119 | font-size: 34rpx; 120 | } 121 | 122 | .f-32 { 123 | font-size: 32rpx; 124 | } 125 | 126 | .f-31 { 127 | font-size: 31rpx; 128 | } 129 | 130 | .f-28 { 131 | font-size: 28rpx; 132 | } 133 | 134 | .f-26 { 135 | font-size: 26rpx; 136 | } 137 | 138 | .f-24 { 139 | font-size: 24rpx; 140 | } 141 | 142 | .f-22 { 143 | font-size: 22rpx; 144 | } 145 | 146 | .b-r { 147 | border-right: 1rpx solid #eee; 148 | } 149 | 150 | .b-b { 151 | border-bottom: 1rpx solid #eee; 152 | } 153 | 154 | .b-t { 155 | border-top: 1rpx solid #eee; 156 | } 157 | 158 | .m-top4 { 159 | margin-top: 4rpx; 160 | } 161 | 162 | .m-top10 { 163 | margin-top: 10rpx; 164 | } 165 | 166 | .m-top20 { 167 | margin-top: 25rpx; 168 | } 169 | 170 | .m-top35 { 171 | margin-top: 35rpx; 172 | } 173 | -------------------------------------------------------------------------------- /pages/address/detail.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | disabled: false, 10 | nav_select: false, // 快捷导航 11 | region: '', 12 | detail: {}, 13 | 14 | error: '', 15 | }, 16 | 17 | /** 18 | * 生命周期函数--监听页面加载 19 | */ 20 | onLoad: function(options) { 21 | // 获取当前地址信息 22 | this.getAddressDetail(options.address_id); 23 | }, 24 | 25 | /** 26 | * 获取当前地址信息 27 | */ 28 | getAddressDetail: function(address_id) { 29 | let _this = this; 30 | App._get('address/detail', { 31 | address_id 32 | }, function(result) { 33 | _this.setData(result.data); 34 | }); 35 | }, 36 | 37 | /** 38 | * 表单提交 39 | */ 40 | saveData: function(e) { 41 | let _this = this, 42 | values = e.detail.value 43 | values.region = _this.data.region; 44 | 45 | // 记录formId 46 | // App.saveFormId(e.detail.formId); 47 | 48 | // 表单验证 49 | if (!_this.validation(values)) { 50 | App.showError(_this.data.error); 51 | return false; 52 | } 53 | 54 | // 按钮禁用 55 | _this.setData({ 56 | disabled: true 57 | }); 58 | 59 | // 提交到后端 60 | values.address_id = _this.data.detail.address_id; 61 | App._post_form('address/edit', values, function(result) { 62 | App.showSuccess(result.msg, function() { 63 | wx.navigateBack(); 64 | }); 65 | }, false, function() { 66 | // 解除禁用 67 | _this.setData({ 68 | disabled: false 69 | }); 70 | }); 71 | }, 72 | 73 | /** 74 | * 表单验证 75 | */ 76 | validation: function(values) { 77 | if (values.name === '') { 78 | this.data.error = '收件人不能为空'; 79 | return false; 80 | } 81 | if (values.phone.length < 1) { 82 | this.data.error = '手机号不能为空'; 83 | return false; 84 | } 85 | // if (values.phone.length !== 11) { 86 | // this.data.error = '手机号长度有误'; 87 | // return false; 88 | // } 89 | let reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/; 90 | if (!reg.test(values.phone)) { 91 | this.data.error = '手机号不符合要求'; 92 | return false; 93 | } 94 | if (!this.data.region) { 95 | this.data.error = '省市区不能空'; 96 | return false; 97 | } 98 | if (values.detail === '') { 99 | this.data.error = '详细地址不能为空'; 100 | return false; 101 | } 102 | return true; 103 | }, 104 | 105 | /** 106 | * 修改地区 107 | */ 108 | bindRegionChange: function(e) { 109 | this.setData({ 110 | region: e.detail.value 111 | }) 112 | }, 113 | 114 | }) -------------------------------------------------------------------------------- /pages/address/detail.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "编辑收货地址", 3 | "usingComponents": { 4 | "shortcut": "/components/shortcut/shortcut" 5 | } 6 | } -------------------------------------------------------------------------------- /pages/address/detail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 收货人 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 手机号 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 所在地区 27 | 28 | 29 | 30 | {{ region }} 31 | 选择省、市、区 32 | 33 | 34 | 35 | 36 | 37 | 详细地址 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /pages/address/detail.wxss: -------------------------------------------------------------------------------- 1 | .profile-list .admin { 2 | padding-left: 15px; 3 | font-size: 30rpx; 4 | color: #333; 5 | } 6 | 7 | .address-box .left-name { 8 | width: 85px; 9 | } 10 | 11 | .address-cont-title .list { 12 | width: auto; 13 | padding: 24rpx; 14 | } 15 | 16 | .tui-picker-detail text { 17 | padding: 0 10rpx; 18 | } 19 | 20 | .infoText { 21 | line-height: 56rpx; 22 | display: block; 23 | } 24 | 25 | picker-view { 26 | background-color: white; 27 | padding: 0; 28 | width: 100%; 29 | height: 480rpx; 30 | bottom: 0; 31 | position: fixed; 32 | } 33 | 34 | picker-view-column view { 35 | vertical-align: middle; 36 | font-size: 28rpx; 37 | line-height: 28rpx; 38 | height: 100%; 39 | display: flex; 40 | align-items: center; 41 | justify-content: center; 42 | } 43 | 44 | .animation-element-wrapper { 45 | display: flex; 46 | position: fixed; 47 | left: 0; 48 | top: 0; 49 | height: 100%; 50 | width: 100%; 51 | z-index: 21; 52 | } 53 | 54 | .animation-element { 55 | display: flex; 56 | position: fixed; 57 | width: 100%; 58 | height: 570rpx; 59 | bottom: 0; 60 | background-color: rgba(255, 255, 255, 1); 61 | } 62 | 63 | .animation-button { 64 | margin-top: 20rpx; 65 | top: 20rpx; 66 | width: 400rpx; 67 | height: 100rpx; 68 | line-height: 100rpx; 69 | align-items: center; 70 | } 71 | 72 | .address-text { 73 | color: #999; 74 | display: inline-flex; 75 | position: fixed; 76 | margin-top: 20rpx; 77 | height: 50rpx; 78 | text-align: center; 79 | line-height: 50rpx; 80 | font-size: 30rpx; 81 | font-family: Arial, Helvetica, sans-serif; 82 | } 83 | 84 | .left-bt { 85 | left: 30rpx; 86 | } 87 | 88 | .right-bt { 89 | right: 30rpx; 90 | color: #ec5151; 91 | } 92 | 93 | .line { 94 | display: block; 95 | position: fixed; 96 | height: 1rpx; 97 | width: 100%; 98 | margin-top: 89rpx; 99 | background-color: #eee; 100 | } 101 | 102 | .address-box .right-cont input { 103 | width: 100%; 104 | font-size: 30rpx; 105 | color: #444; 106 | } 107 | 108 | .bargain-commont-bg { 109 | background: rgba(0, 0, 0, 0.6); 110 | position: fixed; 111 | right: 0; 112 | left: 0; 113 | top: 0; 114 | bottom: 0; 115 | z-index: 20; 116 | } 117 | 118 | .f-34 { 119 | font-size: 34rpx; 120 | } 121 | 122 | .f-32 { 123 | font-size: 32rpx; 124 | } 125 | 126 | .f-31 { 127 | font-size: 31rpx; 128 | } 129 | 130 | .f-28 { 131 | font-size: 28rpx; 132 | } 133 | 134 | .f-26 { 135 | font-size: 26rpx; 136 | } 137 | 138 | .f-24 { 139 | font-size: 24rpx; 140 | } 141 | 142 | .f-22 { 143 | font-size: 22rpx; 144 | } 145 | 146 | .b-r { 147 | border-right: 1rpx solid #eee; 148 | } 149 | 150 | .b-b { 151 | border-bottom: 1rpx solid #eee; 152 | } 153 | 154 | .b-t { 155 | border-top: 1rpx solid #eee; 156 | } 157 | 158 | .m-top4 { 159 | margin-top: 4rpx; 160 | } 161 | 162 | .m-top10 { 163 | margin-top: 10rpx; 164 | } 165 | 166 | .m-top20 { 167 | margin-top: 25rpx; 168 | } 169 | 170 | .m-top35 { 171 | margin-top: 35rpx; 172 | } 173 | -------------------------------------------------------------------------------- /pages/address/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | data: { 5 | list: [], 6 | default_id: null, 7 | }, 8 | 9 | onLoad: function(options) { 10 | // 当前页面参数 11 | this.data.options = options; 12 | }, 13 | 14 | onShow: function() { 15 | // 获取收货地址列表 16 | this.getAddressList(); 17 | }, 18 | 19 | /** 20 | * 获取收货地址列表 21 | */ 22 | getAddressList: function() { 23 | let _this = this; 24 | App._get('address/lists', {}, function(result) { 25 | _this.setData(result.data); 26 | }); 27 | }, 28 | 29 | /** 30 | * 添加新地址 31 | */ 32 | createAddress: function() { 33 | wx.navigateTo({ 34 | url: './create' 35 | }); 36 | }, 37 | 38 | /** 39 | * 编辑地址 40 | */ 41 | editAddress: function(e) { 42 | wx.navigateTo({ 43 | url: "./detail?address_id=" + e.currentTarget.dataset.id 44 | }); 45 | }, 46 | 47 | /** 48 | * 移除收货地址 49 | */ 50 | removeAddress: function(e) { 51 | let _this = this, 52 | address_id = e.currentTarget.dataset.id; 53 | wx.showModal({ 54 | title: "提示", 55 | content: "您确定要移除当前收货地址吗?", 56 | success: function(o) { 57 | o.confirm && App._post_form('address/delete', { 58 | address_id 59 | }, function(result) { 60 | _this.getAddressList(); 61 | }); 62 | } 63 | }); 64 | }, 65 | 66 | /** 67 | * 设置为默认地址 68 | */ 69 | setDefault: function(e) { 70 | let _this = this, 71 | address_id = e.detail.value; 72 | _this.setData({ 73 | default_id: parseInt(address_id) 74 | }); 75 | App._post_form('address/setDefault', { 76 | address_id 77 | }, function(result) { 78 | _this.data.options.from === 'flow' && wx.navigateBack(); 79 | }); 80 | return false; 81 | }, 82 | 83 | }); -------------------------------------------------------------------------------- /pages/address/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "收货地址", 3 | "usingComponents": { 4 | "shortcut": "/components/shortcut/shortcut" 5 | } 6 | } -------------------------------------------------------------------------------- /pages/address/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.name}} 8 | {{item.phone}} 9 | 10 | 11 | {{item.region.province}} {{item.region.city}} {{item.region.region}} {{item.detail}} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 编辑 29 | 30 | 31 | 32 | 删除 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 亲,您还没有收货列表 42 | 43 | 44 | 45 | 添加新地址 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /pages/address/index.wxss: -------------------------------------------------------------------------------- 1 | .address-list { 2 | border-bottom: 1px solid #f6f6f9; 3 | } 4 | 5 | .address-list .list { 6 | padding: 15rpx; 7 | } 8 | 9 | .address-list .list .title { 10 | font-size: 30rpx; 11 | padding: 0 24rpx 0 6rpx; 12 | color: #666; 13 | } 14 | 15 | .address-list .list .cont { 16 | font-size: 30rpx; 17 | color: #333; 18 | } 19 | 20 | .address-list .list navigator { 21 | display: inline-block; 22 | } 23 | 24 | .address-list .list image { 25 | width: 28rpx; 26 | height: 28rpx; 27 | } 28 | 29 | .address-left { 30 | flex: 6; 31 | } 32 | 33 | .address-right { 34 | flex: 3.2; 35 | } 36 | 37 | .address-right .iconfont { 38 | color: #777; 39 | font-size: 30rpx; 40 | } 41 | 42 | .flow-fixed-footer { 43 | position: fixed; 44 | bottom: 0; 45 | width: 100%; 46 | background: #f42424; 47 | z-index: 4999; 48 | } 49 | 50 | .flow-fixed-footer .chackout-left { 51 | font-size: 32rpx; 52 | line-height: 44px; 53 | color: #777; 54 | } 55 | 56 | .flow-fixed-footer .chackout-right { 57 | font-size: 34rpx; 58 | } 59 | 60 | .address-header { 61 | padding: 28rpx 0; 62 | border-bottom: 1px solid #f6f6f9; 63 | background-size: 120rpx auto; 64 | font-size: 1.7rem; 65 | } 66 | 67 | .flow-header-left { 68 | flex: 14; 69 | padding:0rpx 20rpx; 70 | } 71 | 72 | .flow-header-right { 73 | flex: 1; 74 | } 75 | 76 | .flow-header-right image { 77 | width: 34rpx; 78 | height: 34rpx; 79 | margin-top: 20rpx; 80 | float: right; 81 | } 82 | 83 | .address-header .flow-checkout-admin { 84 | font-size: 34rpx; 85 | color: #444; 86 | } 87 | 88 | .address-header .flow-checkout-admin text { 89 | padding: 0 10rpx; 90 | } 91 | 92 | .address-header .flow-checkout-address { 93 | font-size: 26rpx; 94 | color: #777; 95 | margin-top: 6rpx; 96 | } 97 | 98 | .radio-group raido { 99 | color: #f42424; 100 | } 101 | -------------------------------------------------------------------------------- /pages/category/index.js: -------------------------------------------------------------------------------- 1 | const App = getApp(); 2 | 3 | Page({ 4 | data: { 5 | // 搜索框样式 6 | searchColor: "rgba(0,0,0,0.4)", 7 | searchSize: "15", 8 | searchName: "搜索商品", 9 | 10 | // 列表高度 11 | scrollHeight: 0, 12 | 13 | // 当前选中的分类 14 | curIndex: -1, 15 | curCateId: 0, 16 | 17 | // 分类列表 18 | categoryList: [], 19 | 20 | // 商品列表 21 | goodsList: [], 22 | 23 | noMore: false, // 没有更多数据 24 | isLoading: true, // 是否正在加载中 25 | page: 1, // 当前页码 26 | 27 | }, 28 | 29 | onLoad() { 30 | let _this = this; 31 | // 设置分类列表高度 32 | _this.setListHeight(); 33 | // 获取分类列表 34 | _this.getCategoryList(); 35 | }, 36 | 37 | onShow() { 38 | 39 | }, 40 | 41 | /** 42 | * 设置分类列表高度 43 | */ 44 | setListHeight() { 45 | let _this = this; 46 | wx.getSystemInfo({ 47 | success(res) { 48 | _this.setData({ 49 | scrollHeight: res.windowHeight - 47, 50 | }); 51 | } 52 | }); 53 | }, 54 | 55 | /** 56 | * 获取分类主页数据 57 | * 1.所有分类列表 58 | * 2.所有商品列表 59 | */ 60 | getCategoryList() { 61 | let _this = this; 62 | App._get('category/index', {}, result => { 63 | let data = result.data; 64 | _this.setData({ 65 | categoryList: data['categoryList'], 66 | goodsList: data['goodsList'] 67 | }); 68 | }); 69 | }, 70 | 71 | /** 72 | * Api:获取商品列表 73 | */ 74 | getGoodsList(isPage, pageNum) { 75 | let _this = this; 76 | App._get('goods/lists', { 77 | page: pageNum || 1, 78 | category_id: _this.data.curCateId 79 | }, result => { 80 | let resList = result.data.list, 81 | dataList = _this.data.goodsList; 82 | if (isPage == true) { 83 | _this.setData({ 84 | 'goodsList.data': dataList.data.concat(resList.data), 85 | isLoading: false, 86 | }); 87 | } else { 88 | _this.setData({ 89 | goodsList: resList, 90 | isLoading: false, 91 | }); 92 | } 93 | }); 94 | }, 95 | 96 | /** 97 | * 跳转商品详情页 98 | */ 99 | onTargetGoods(e) { 100 | wx.navigateTo({ 101 | url: '../goods/index?goods_id=' + e.detail.target.dataset.id 102 | }); 103 | }, 104 | 105 | /** 106 | * 一级分类:选中分类 107 | */ 108 | onSelectNav(e) { 109 | let _this = this, 110 | curIndex = e.currentTarget.dataset.index; 111 | 112 | // 第一步:设置分类选中状态 113 | _this.setData({ 114 | curIndex, 115 | curCateId: curIndex > -1 ? _this.data.categoryList[curIndex].category_id : 0, 116 | goodsList: [], 117 | page: 1, 118 | noMore: false, 119 | isLoading: true, 120 | }); 121 | // 第二步:更新当前的商品列表 122 | _this.getGoodsList(); 123 | }, 124 | 125 | /** 126 | * 下拉到底加载数据 127 | */ 128 | onDownLoad() { 129 | let _this = this; 130 | // 已经是最后一页 131 | if (_this.data.page >= _this.data.goodsList.last_page) { 132 | _this.setData({ 133 | noMore: true 134 | }); 135 | return false; 136 | } 137 | // 加载下一页列表 138 | _this.getGoodsList(true, ++_this.data.page); 139 | }, 140 | 141 | /** 142 | * 设置分享内容 143 | */ 144 | onShareAppMessage() { 145 | return { 146 | title: "全部商品", 147 | path: "/pages/category/index" 148 | }; 149 | } 150 | 151 | }); -------------------------------------------------------------------------------- /pages/category/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "全部商品" 3 | } -------------------------------------------------------------------------------- /pages/category/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{searchName}} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 全部 18 | 19 | {{ item.name }} 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 56 |
57 |
58 | 亲, 没有更多了 59 | 60 | 61 | 62 | 63 | 亲,此处暂无商品哦 64 | 65 | 66 |
67 |
68 | 69 |
-------------------------------------------------------------------------------- /pages/category/index.wxss: -------------------------------------------------------------------------------- 1 | /* 搜索框 */ 2 | 3 | .index-search-box { 4 | background: #fff; 5 | padding: 13rpx 13rpx 18rpx 13rpx; 6 | } 7 | 8 | .index-search { 9 | border-bottom: 0; 10 | background: #fff; 11 | border-radius: 50rpx; 12 | overflow: hidden; 13 | position: relative; 14 | font-size: 28rpx; 15 | color: #999; 16 | box-sizing: border-box; 17 | height: 64rpx; 18 | line-height: 64rpx; 19 | } 20 | 21 | /* 通用 */ 22 | 23 | page { 24 | background: #fff; 25 | } 26 | 27 | .no-more { 28 | font-size: 28rpx; 29 | padding-top: 0; 30 | } 31 | 32 | /* 二级分类 20 */ 33 | 34 | .cate-content { 35 | width: 100%; 36 | background: #fff; 37 | } 38 | 39 | /* 左侧分类列表 */ 40 | 41 | .cate-left { 42 | flex-direction: column; 43 | display: flex; 44 | width: 22.2222%; 45 | color: #444; 46 | height: 100%; 47 | background: #f8f8f8; 48 | } 49 | 50 | .cate-left .type-nav { 51 | position: relative; 52 | height: 90rpx; 53 | line-height: 90rpx; 54 | text-align: center; 55 | z-index: 10; 56 | display: block; 57 | font-size: 26rpx; 58 | } 59 | 60 | .cate-left .type-nav.selected { 61 | background: #fff; 62 | color: #ff495e; 63 | border-right: none; 64 | font-size: 28rpx; 65 | } 66 | 67 | /* 单列商品 */ 68 | 69 | .cate-right { 70 | width: 77.7778%; 71 | } 72 | 73 | .goods-item { 74 | width: 100%; 75 | /* height: 280rpx; */ 76 | margin-bottom: 10rpx; 77 | padding: 16rpx; 78 | box-sizing: border-box; 79 | background: #fff; 80 | } 81 | 82 | .goods-item text { 83 | line-height: 1.6; 84 | } 85 | 86 | .goods-item:last-child { 87 | margin-bottom: 0; 88 | } 89 | 90 | .goods-item_left { 91 | display: flex; 92 | width: 36%; 93 | background: #fff; 94 | align-items: center; 95 | } 96 | 97 | .goods-item_left image { 98 | display: block; 99 | width: 190rpx; 100 | height: 190rpx; 101 | } 102 | 103 | .goods-item_right { 104 | position: relative; 105 | width: 60%; 106 | padding-left: 20rpx; 107 | } 108 | 109 | .goods-item_right .goods-item_title { 110 | height: 72rpx; 111 | margin-top: 20rpx; 112 | font-size: 26rpx; 113 | color: #333; 114 | } 115 | 116 | .goods-item_right .goods-item_title text { 117 | line-height: 1.3; 118 | } 119 | 120 | .goods-item_desc { 121 | margin-top: 8rpx; 122 | } 123 | 124 | .desc-selling_point { 125 | width: 100%; 126 | font-size: 24rpx; 127 | color: #ff495e; 128 | } 129 | 130 | .desc-goods_sales { 131 | color: #999; 132 | font-size: 24rpx; 133 | } 134 | 135 | .desc_footer .price_x { 136 | margin-right: 16rpx; 137 | color: #f03c3c; 138 | font-size: 27rpx; 139 | } 140 | 141 | .desc_footer .price_y { 142 | font-size: 24rpx; 143 | text-decoration: line-through; 144 | } 145 | -------------------------------------------------------------------------------- /pages/category/list.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | data: { 5 | searchColor: "rgba(0,0,0,0.4)", 6 | searchSize: "15", 7 | searchName: "搜索商品", 8 | 9 | scrollHeight: null, 10 | showView: false, 11 | arrange: "", 12 | 13 | sortType: 'all', // 排序类型 14 | sortPrice: false, // 价格从低到高 15 | 16 | option: {}, 17 | list: {}, 18 | 19 | noList: true, 20 | no_more: false, 21 | 22 | page: 1, 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面加载 27 | */ 28 | onLoad: function (option) { 29 | let _this = this; 30 | 31 | // 设置商品列表高度 32 | _this.setListHeight(); 33 | 34 | // 记录option 35 | _this.setData({ option}, function () { 36 | // 获取商品列表 37 | _this.getGoodsList(true); 38 | }); 39 | 40 | }, 41 | 42 | /** 43 | * 获取商品列表 44 | */ 45 | getGoodsList: function (is_super, page) { 46 | let _this = this; 47 | App._get('goods/lists', { 48 | page: page || 1, 49 | sortType: _this.data.sortType, 50 | sortPrice: _this.data.sortPrice ? 1: 0, 51 | category_id: _this.data.option.category_id || 0, 52 | search: _this.data.option.search || '', 53 | }, function (result) { 54 | let resultList = result.data.list 55 | , dataList = _this.data.list; 56 | if (is_super === true || typeof dataList.data === 'undefined') { 57 | // typeof dataList.data === 'undefined' 58 | _this.setData({ list: resultList, noList: false }); 59 | } else { 60 | _this.setData({ 'list.data': dataList.data.concat(resultList.data) }); 61 | } 62 | }); 63 | }, 64 | 65 | /** 66 | * 设置商品列表高度 67 | */ 68 | setListHeight: function () { 69 | let _this = this; 70 | wx.getSystemInfo({ 71 | success: function (res) { 72 | _this.setData({ 73 | scrollHeight: res.windowHeight - 90, 74 | }); 75 | } 76 | }); 77 | }, 78 | 79 | /** 80 | * 切换排序方式 81 | */ 82 | switchSortType: function (e) { 83 | let _this = this 84 | , newSortType = e.currentTarget.dataset.type 85 | , newSortPrice = newSortType === 'price' ? !_this.data.sortPrice : true; 86 | 87 | _this.setData({ 88 | list: {}, 89 | page: 1, 90 | sortType: newSortType, 91 | sortPrice: newSortPrice 92 | }, function () { 93 | // 获取商品列表 94 | _this.getGoodsList(true); 95 | }); 96 | }, 97 | 98 | /** 99 | * 跳转筛选 100 | */ 101 | toSynthesize: function (t) { 102 | wx.navigateTo({ 103 | url: "../category/screen?objectId=" 104 | }); 105 | }, 106 | 107 | /** 108 | * 切换列表显示方式 109 | */ 110 | onChangeShowState: function () { 111 | let _this = this; 112 | _this.setData({ 113 | showView: !_this.data.showView, 114 | arrange: _this.data.arrange ? "" : "arrange" 115 | }); 116 | }, 117 | 118 | /** 119 | * 下拉到底加载数据 120 | */ 121 | bindDownLoad: function () { 122 | // 已经是最后一页 123 | if (this.data.page >= this.data.list.last_page) { 124 | this.setData({ no_more: true }); 125 | return false; 126 | } 127 | this.getGoodsList(false, ++this.data.page); 128 | }, 129 | 130 | /** 131 | * 设置分享内容 132 | */ 133 | onShareAppMessage: function () { 134 | return { 135 | title: "全部分类", 136 | desc: "", 137 | path: "/pages/category/index" 138 | }; 139 | }, 140 | 141 | }); 142 | -------------------------------------------------------------------------------- /pages/category/list.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "商品列表", 3 | "enablePullDownRefresh": true 4 | } -------------------------------------------------------------------------------- /pages/category/list.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 搜索商品 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 综合 18 | 19 | 20 | 销量 21 | 22 | 23 | 价格 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | {{ item.goods_name }} 41 | 42 | ¥{{ item.goods_min_price }} 43 | {{ item.goods_sku.line_price }} 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 亲, 没有相关内容 59 | 60 | 61 | -------------------------------------------------------------------------------- /pages/category/list.wxss: -------------------------------------------------------------------------------- 1 | .store_nav_cont { 2 | padding: 10px 0; 3 | } 4 | 5 | .store_nav_cont #list-true { 6 | color: #ff495e; 7 | font-size: 28rpx; 8 | } 9 | 10 | .store_nav_cont #list-0 { 11 | color: #333; 12 | font-size: 28rpx; 13 | } 14 | 15 | .store_nav_cont #list-0 .icon-fenlei { 16 | padding-left: 8rpx; 17 | color: #777; 18 | font-size: 28rpx; 19 | } 20 | 21 | .store_nav_cont #list-true .icon-fenlei { 22 | padding-left: 8rpx; 23 | color: #ff495e; 24 | font-size: 28rpx; 25 | } 26 | 27 | .store_nav_cont .price { 28 | padding-right: 30rpx; 29 | } 30 | 31 | .store_nav_cont #list-0 .top_jiantou { 32 | position: absolute; 33 | right: 52rpx; 34 | top: 50%; 35 | margin-top: -16rpx; 36 | font-size: 18rpx; 37 | color: #777; 38 | } 39 | 40 | .store_nav_cont #list-true .top_jiantou { 41 | position: absolute; 42 | right: 52rpx; 43 | top: 50%; 44 | margin-top: -16rpx; 45 | font-size: 18rpx; 46 | color: #777; 47 | } 48 | 49 | .store_nav_cont #list-0 .bot_jiantou { 50 | position: absolute; 51 | right: 52rpx; 52 | top: 50%; 53 | margin-top: -2rpx; 54 | font-size: 18rpx; 55 | color: #777; 56 | } 57 | 58 | .store_nav_cont #list-true .bot_jiantou { 59 | position: absolute; 60 | right: 52rpx; 61 | top: 50%; 62 | margin-top: -2rpx; 63 | font-size: 18rpx; 64 | color: #777; 65 | } 66 | 67 | .store_nav_cont #list-true .top_jiantou.active, 68 | .store_nav_cont #list-true .bot_jiantou.active { 69 | color: #ff495e; 70 | } 71 | 72 | /* asd */ 73 | 74 | .container { 75 | position: relative; 76 | } 77 | 78 | .cate-btn { 79 | background: #ff495e; 80 | bottom: 18rpx; 81 | right: 18rpx; 82 | font-size: 20rpx; 83 | color: #fff; 84 | padding: 4px 18rpx; 85 | } 86 | 87 | .index-cont-search icon { 88 | left: 0; 89 | margin-left: 20rpx; 90 | } 91 | 92 | .index-search-box { 93 | top: 1rpx; 94 | left: 0rpx; 95 | right: 0rpx; 96 | z-index: 999; 97 | position: fixed; 98 | background: #fff; 99 | padding: 18rpx 13rpx; 100 | border-bottom: 1px solid #eee; 101 | } 102 | 103 | .index-search { 104 | border-bottom: 0; 105 | background: #fff; 106 | border-radius: 50rpx; 107 | overflow: hidden; 108 | position: relative; 109 | font-size: 32rpx; 110 | color: #999; 111 | box-sizing: border-box; 112 | height: 64rpx; 113 | line-height: 64rpx; 114 | margin: 0 10rpx; 115 | } 116 | 117 | .list-right { 118 | width: 60rpx; 119 | } 120 | 121 | .list-right text { 122 | height: 60rpx; 123 | line-height: 60rpx; 124 | font-size: 40rpx; 125 | } 126 | 127 | .list-header { 128 | position: fixed; 129 | top: 1rpx; 130 | left: 0; 131 | right: 0; 132 | } 133 | 134 | .no-more { 135 | text-align: center; 136 | color: #737373; 137 | margin: 10px 0; 138 | } 139 | 140 | .category-list { 141 | overflow: hidden; 142 | } 143 | 144 | .category-list .list { 145 | box-sizing: border-box; 146 | width: 50%; 147 | float: left; 148 | } 149 | 150 | .category-list .list:nth-child(2n) { 151 | border-left: 2px solid #f7f7f7; 152 | border-bottom: 4px solid #f7f7f7; 153 | } 154 | 155 | .category-list .list:nth-child(2n-1) { 156 | border-right: 2px solid #f7f7f7; 157 | border-bottom: 4px solid #f7f7f7; 158 | } 159 | 160 | .category-list.arrange .list { 161 | overflow: hidden; 162 | padding: 15rpx; 163 | border-bottom: 1rpx solid #f7f7f7; 164 | width: 100%; 165 | } 166 | 167 | .category-list.arrange .list .left { 168 | width: 35%; 169 | float: left; 170 | } 171 | 172 | .category-list.arrange .list .right { 173 | width: 65%; 174 | float: left; 175 | } 176 | 177 | .category-list.arrange .list .left .img image { 178 | width: 220rpx; 179 | height: 220rpx; 180 | } 181 | -------------------------------------------------------------------------------- /pages/flow/checkout.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | nav_select: false, // 快捷导航 10 | options: {}, // 当前页面参数 11 | 12 | address: null, // 默认收货地址 13 | exist_address: false, // 是否存在收货地址 14 | goods: {}, // 商品信息 15 | 16 | disabled: false, 17 | 18 | hasError: false, 19 | error: '', 20 | }, 21 | 22 | /** 23 | * 生命周期函数--监听页面加载 24 | */ 25 | onLoad: function(options) { 26 | // 当前页面参数 27 | this.data.options = options; 28 | console.log(options); 29 | }, 30 | 31 | /** 32 | * 生命周期函数--监听页面显示 33 | */ 34 | onShow: function() { 35 | // 获取当前订单信息 36 | this.getOrderData(); 37 | }, 38 | 39 | /** 40 | * 获取当前订单信息 41 | */ 42 | getOrderData: function() { 43 | let _this = this, 44 | options = _this.data.options; 45 | 46 | // 获取订单信息回调方法 47 | let callback = function(result) { 48 | if (result.code !== 1) { 49 | App.showError(result.msg); 50 | return false; 51 | } 52 | // 显示错误信息 53 | if (result.data.has_error) { 54 | _this.data.hasError = true; 55 | _this.data.error = result.data.error_msg; 56 | App.showError(_this.data.error); 57 | } else { 58 | _this.data.hasError = false; 59 | _this.data.error = ''; 60 | } 61 | _this.setData(result.data); 62 | }; 63 | 64 | // 立即购买 65 | if (options.order_type === 'buyNow') { 66 | App._get('order/buyNow', { 67 | goods_id: options.goods_id, 68 | goods_num: options.goods_num, 69 | goods_sku_id: options.goods_sku_id, 70 | }, function(result) { 71 | callback(result); 72 | }); 73 | } 74 | 75 | // 购物车结算 76 | else if (options.order_type === 'cart') { 77 | App._get('order/cart', {}, function(result) { 78 | callback(result); 79 | }); 80 | } 81 | 82 | }, 83 | 84 | /** 85 | * 选择收货地址 86 | */ 87 | selectAddress: function() { 88 | wx.navigateTo({ 89 | url: '../address/' + (this.data.exist_address ? 'index?from=flow' : 'create') 90 | }); 91 | }, 92 | 93 | /** 94 | * 订单提交 95 | */ 96 | submitOrder: function() { 97 | let _this = this, 98 | options = _this.data.options; 99 | 100 | if (_this.data.disabled) { 101 | return false; 102 | } 103 | 104 | if (_this.data.hasError) { 105 | App.showError(_this.data.error); 106 | return false; 107 | } 108 | 109 | // 订单创建成功后回调--微信支付 110 | let callback = function(result) { 111 | if (result.code === -10) { 112 | App.showError(result.msg, function() { 113 | // 跳转到未付款订单 114 | wx.redirectTo({ 115 | url: '../order/index?type=payment', 116 | }); 117 | }); 118 | return false; 119 | } 120 | // 发起微信支付 121 | wx.requestPayment({ 122 | timeStamp: result.data.payment.timeStamp, 123 | nonceStr: result.data.payment.nonceStr, 124 | package: 'prepay_id=' + result.data.payment.prepay_id, 125 | signType: 'MD5', 126 | paySign: result.data.payment.paySign, 127 | success: function(res) { 128 | // 跳转到订单详情 129 | wx.redirectTo({ 130 | url: '../order/detail?order_id=' + result.data.order_id, 131 | }); 132 | }, 133 | fail: function() { 134 | App.showError('订单未支付', function() { 135 | // 跳转到未付款订单 136 | wx.redirectTo({ 137 | url: '../order/index?type=payment', 138 | }); 139 | }); 140 | }, 141 | }); 142 | }; 143 | 144 | // 按钮禁用, 防止二次提交 145 | _this.data.disabled = true; 146 | 147 | // 显示loading 148 | wx.showLoading({ 149 | title: '正在处理...' 150 | }); 151 | 152 | // 创建订单-立即购买 153 | if (options.order_type === 'buyNow') { 154 | App._post_form('order/buyNow', { 155 | goods_id: options.goods_id, 156 | goods_num: options.goods_num, 157 | goods_sku_id: options.goods_sku_id, 158 | }, function(result) { 159 | // success 160 | console.log('success'); 161 | callback(result); 162 | }, function(result) { 163 | // fail 164 | console.log('fail'); 165 | }, function() { 166 | // complete 167 | console.log('complete'); 168 | // 解除按钮禁用 169 | _this.data.disabled = false; 170 | }); 171 | } 172 | 173 | // 创建订单-购物车结算 174 | else if (options.order_type === 'cart') { 175 | App._post_form('order/cart', {}, function(result) { 176 | // success 177 | console.log('success'); 178 | callback(result); 179 | }, function(result) { 180 | // fail 181 | console.log('fail'); 182 | }, function() { 183 | // complete 184 | console.log('complete'); 185 | // 解除按钮禁用 186 | _this.data.disabled = false; 187 | }); 188 | } 189 | 190 | }, 191 | 192 | 193 | }); -------------------------------------------------------------------------------- /pages/flow/checkout.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "订单确认" 3 | } -------------------------------------------------------------------------------- /pages/flow/checkout.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{address.name}} 11 | {{address.phone}} 12 | 13 | 14 | 15 | {{address.region.province}} {{address.region.city}} {{address.region.region}} {{address.detail}} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 去选择配送地址 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {{item.goods_name}} 48 | {{item.goods_sku.goods_attr}} 49 | 50 | ¥{{item.goods_price}} 51 | ×{{item.total_num}} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 共{{order_total_num}}件商品,合计: 59 | ¥{{order_total_price}} 60 | 61 | 62 | 63 | 64 | 65 | 66 | 商品总金额: 67 | 68 | ¥{{order_total_price}} 69 | 70 | 71 | 72 | 配送费用: 73 | 74 | 75 | +¥{{express_price}} 76 | 不在配送范围 77 | 78 | 79 | 请先选择配送地址 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 实付款: 89 | ¥{{order_pay_price}} 90 | 91 | 92 | 提交订单 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /pages/flow/checkout.wxss: -------------------------------------------------------------------------------- 1 | .checkout_list { 2 | padding: 10px 15px 2px 15px; 3 | background: #fff; 4 | border-bottom: 1rpx solid #eee; 5 | } 6 | 7 | .checkout_list .flow-shopList { 8 | padding: 5rpx 0 10rpx; 9 | border-bottom: 1rpx solid #eee; 10 | } 11 | 12 | .checkout_list .flow-shopList:last-child { 13 | border-bottom: 0; 14 | } 15 | 16 | .flow-header-left { 17 | padding-left: 90rpx; 18 | } 19 | -------------------------------------------------------------------------------- /pages/flow/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | goods_list: [], // 商品列表 10 | order_total_num: 0, 11 | order_total_price: 0, 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad(options) { 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面显示 23 | */ 24 | onShow() { 25 | let _this = this; 26 | _this.setData({ 27 | isLogin: App.checkIsLogin() 28 | }); 29 | if (_this.data.isLogin) { 30 | // 获取购物车列表 31 | _this.getCartList(); 32 | } 33 | }, 34 | 35 | /** 36 | * 获取购物车列表 37 | */ 38 | getCartList() { 39 | let _this = this; 40 | App._get('cart/lists', {}, function(result) { 41 | _this.setData(result.data); 42 | }); 43 | }, 44 | 45 | /** 46 | * 递增指定的商品数量 47 | */ 48 | addCount(e) { 49 | let _this = this, 50 | index = e.currentTarget.dataset.index, 51 | goodsSkuId = e.currentTarget.dataset.skuId, 52 | goods = _this.data.goods_list[index], 53 | order_total_price = _this.data.order_total_price; 54 | // 后端同步更新 55 | wx.showLoading({ 56 | title: '加载中', 57 | mask: true 58 | }) 59 | App._post_form('cart/add', { 60 | goods_id: goods.goods_id, 61 | goods_num: 1, 62 | goods_sku_id: goodsSkuId 63 | }, () => { 64 | goods.total_num++; 65 | _this.setData({ 66 | ['goods_list[' + index + ']']: goods, 67 | order_total_price: _this.mathadd(order_total_price, goods.goods_price) 68 | }); 69 | }); 70 | }, 71 | 72 | /** 73 | * 递减指定的商品数量 74 | */ 75 | minusCount(e) { 76 | let _this = this, 77 | index = e.currentTarget.dataset.index, 78 | goodsSkuId = e.currentTarget.dataset.skuId, 79 | goods = _this.data.goods_list[index], 80 | order_total_price = _this.data.order_total_price; 81 | 82 | if (goods.total_num > 1) { 83 | // 后端同步更新 84 | wx.showLoading({ 85 | title: '加载中', 86 | mask: true 87 | }) 88 | App._post_form('cart/sub', { 89 | goods_id: goods.goods_id, 90 | goods_sku_id: goodsSkuId 91 | }, () => { 92 | goods.total_num--; 93 | goods.total_num > 0 && 94 | _this.setData({ 95 | ['goods_list[' + index + ']']: goods, 96 | order_total_price: _this.mathsub(order_total_price, goods.goods_price) 97 | }); 98 | }); 99 | 100 | } 101 | }, 102 | 103 | /** 104 | * 删除商品 105 | */ 106 | del(e) { 107 | let _this = this, 108 | goods_id = e.currentTarget.dataset.goodsId, 109 | goodsSkuId = e.currentTarget.dataset.skuId; 110 | wx.showModal({ 111 | title: "提示", 112 | content: "您确定要移除当前商品吗?", 113 | success(e) { 114 | e.confirm && App._post_form('cart/delete', { 115 | goods_id, 116 | goods_sku_id: goodsSkuId 117 | }, function(result) { 118 | _this.getCartList(); 119 | }); 120 | } 121 | }); 122 | }, 123 | 124 | /** 125 | * 购物车结算 126 | */ 127 | submit(t) { 128 | wx.navigateTo({ 129 | url: '../flow/checkout?order_type=cart' 130 | }); 131 | }, 132 | 133 | /** 134 | * 加法 135 | */ 136 | mathadd(arg1, arg2) { 137 | return (Number(arg1) + Number(arg2)).toFixed(2); 138 | }, 139 | 140 | /** 141 | * 减法 142 | */ 143 | mathsub(arg1, arg2) { 144 | return (Number(arg1) - Number(arg2)).toFixed(2); 145 | }, 146 | 147 | /** 148 | * 去购物 149 | */ 150 | goShopping() { 151 | wx.switchTab({ 152 | url: '../index/index', 153 | }); 154 | }, 155 | 156 | }) -------------------------------------------------------------------------------- /pages/flow/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "购物车" 3 | } -------------------------------------------------------------------------------- /pages/flow/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | {{item.goods_name}} 16 | 17 | 18 | {{item.goods_sku.goods_attr}} 19 | 20 | 21 | ¥{{item.goods_price}} 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 合计:¥{{order_total_price}} 39 | 40 | 41 | 去结算 42 | 43 | 44 | 45 | 46 | 47 | 48 | 亲,购物车还没有商品哦 49 | 去逛逛 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /pages/flow/index.wxss: -------------------------------------------------------------------------------- 1 | @import "../../wxParse/wxParse.wxss"; 2 | 3 | .image { 4 | width: 100%; 5 | height: 100%; 6 | } 7 | 8 | .cart-tab-item-btn { 9 | width: 160rpx; 10 | display: block; 11 | height: 100rpx; 12 | line-height: 100rpx; 13 | font-size: 32rpx; 14 | background: #ff495e; 15 | color: #fff; 16 | float: right; 17 | text-align: center; 18 | } 19 | 20 | .cart-tab-item { 21 | width: 375rpx; 22 | } 23 | 24 | .cart-tab-wrp { 25 | height: 100rpx; 26 | position: fixed; 27 | bottom: 0rpx; 28 | background: #fff; 29 | border-top: 1rpx solid #ddd; 30 | display: flex; 31 | flex-direction: row; 32 | width: 100%; 33 | z-index: 10; 34 | color: black; 35 | } 36 | 37 | .cart-tab-item { 38 | overflow: hidden; 39 | line-height: 100rpx; 40 | } 41 | 42 | .cart-tab-item .cart-item-total-price { 43 | float: left; 44 | } 45 | 46 | .cart-item-total { 47 | padding-left: 30rpx; 48 | } 49 | 50 | .cart-item-total-price { 51 | font-size: 32rpx; 52 | color: #ff495e; 53 | text-align: center; 54 | } 55 | 56 | .cart-item-total-price em { 57 | display: block; 58 | } 59 | 60 | .cart-item-icon-wrp { 61 | width: 110rpx; 62 | height: 90rpx; 63 | position: absolute; 64 | top: -4rpx; 65 | } 66 | 67 | .cart-item-icon { 68 | width: 90rpx; 69 | height: 90rpx; 70 | } 71 | 72 | .dish-item { 73 | width: 100%; 74 | padding: 26rpx 0; 75 | border-bottom: 1rpx solid #eee; 76 | position: relative; 77 | background: #fff; 78 | } 79 | 80 | .dish-item-wrp { 81 | width: 100%; 82 | display: flex; 83 | flex-direction: row; 84 | } 85 | 86 | .dish-item-pic { 87 | width: 100%; 88 | margin-left: 15px; 89 | } 90 | 91 | .dish-item-pic image { 92 | width: 200rpx; 93 | height: 200rpx; 94 | margin: 0 auto; 95 | background: #fff; 96 | border: 1rpx solid #eee; 97 | } 98 | 99 | .dish-item-info { 100 | padding-left: 16rpx; 101 | margin-right: 15px; 102 | width: 68%; 103 | } 104 | 105 | .dish-item-sales { 106 | color: #ccc; 107 | font-size: 20rpx; 108 | line-height: 50rpx; 109 | } 110 | 111 | .dish-item-money { 112 | color: #ff495e; 113 | font-size: 32rpx; 114 | padding: 0 0 10rpx 0; 115 | } 116 | 117 | .wx-goods_price .dish-item-money { 118 | float: left; 119 | } 120 | 121 | .wx-goods_price { 122 | overflow: hidden; 123 | } 124 | 125 | .flow-dete { 126 | position: absolute; 127 | bottom: 25rpx; 128 | right: 30rpx; 129 | } 130 | 131 | .flow-dete .icon-lajixiang { 132 | color: #777; 133 | font-size: 34rpx; 134 | } 135 | 136 | .flow-btn-min { 137 | background: #fff; 138 | border: 1rpx solid #ccc; 139 | height: 30px; 140 | line-height: 30px; 141 | font-size: 28rpx; 142 | width: 200rpx; 143 | margin: 0 auto; 144 | border-radius: 5px; 145 | text-align: center; 146 | color: #777; 147 | margin-top: 25rpx; 148 | } 149 | -------------------------------------------------------------------------------- /pages/goods/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(), 2 | wxParse = require("../../wxParse/wxParse.js"); 3 | 4 | Page({ 5 | 6 | /** 7 | * 页面的初始数据 8 | */ 9 | data: { 10 | nav_select: false, // 快捷导航 11 | 12 | indicatorDots: true, // 是否显示面板指示点 13 | autoplay: true, // 是否自动切换 14 | interval: 3000, // 自动切换时间间隔 15 | duration: 800, // 滑动动画时长 16 | 17 | currentIndex: 1, // 轮播图指针 18 | floorstatus: false, // 返回顶部 19 | showView: true, // 显示商品规格 20 | 21 | detail: {}, // 商品详情信息 22 | goods_price: 0, // 商品价格 23 | line_price: 0, // 划线价格 24 | stock_num: 0, // 库存数量 25 | 26 | goods_num: 1, // 商品数量 27 | goods_sku_id: 0, // 规格id 28 | cart_total_num: 0, // 购物车商品总数量 29 | specData: {}, // 多规格信息 30 | }, 31 | 32 | // 记录规格的数组 33 | goods_spec_arr: [], 34 | 35 | /** 36 | * 生命周期函数--监听页面加载 37 | */ 38 | onLoad(options) { 39 | let _this = this; 40 | // 商品id 41 | _this.data.goods_id = options.goods_id; 42 | // 获取商品信息 43 | _this.getGoodsDetail(); 44 | }, 45 | 46 | /** 47 | * 获取商品信息 48 | */ 49 | getGoodsDetail() { 50 | let _this = this; 51 | App._get('goods/detail', { 52 | goods_id: _this.data.goods_id 53 | }, function(result) { 54 | // 初始化商品详情数据 55 | let data = _this.initGoodsDetailData(result.data); 56 | _this.setData(data); 57 | }); 58 | }, 59 | 60 | /** 61 | * 初始化商品详情数据 62 | */ 63 | initGoodsDetailData(data) { 64 | let _this = this; 65 | // 富文本转码 66 | if (data.detail.content.length > 0) { 67 | wxParse.wxParse('content', 'html', data.detail.content, _this, 0); 68 | } 69 | // 商品价格/划线价/库存 70 | data.goods_sku_id = data.detail.spec[0].spec_sku_id; 71 | data.goods_price = data.detail.spec[0].goods_price; 72 | data.line_price = data.detail.spec[0].line_price; 73 | data.stock_num = data.detail.spec[0].stock_num; 74 | // 初始化商品多规格 75 | if (data.detail.spec_type == 20) { 76 | data.specData = _this.initManySpecData(data.specData); 77 | } 78 | return data; 79 | }, 80 | 81 | /** 82 | * 初始化商品多规格 83 | */ 84 | initManySpecData(data) { 85 | for (let i in data.spec_attr) { 86 | for (let j in data.spec_attr[i].spec_items) { 87 | if (j < 1) { 88 | data.spec_attr[i].spec_items[0].checked = true; 89 | this.goods_spec_arr[i] = data.spec_attr[i].spec_items[0].item_id; 90 | } 91 | } 92 | } 93 | return data; 94 | }, 95 | 96 | /** 97 | * 点击切换不同规格 98 | */ 99 | modelTap(e) { 100 | let attrIdx = e.currentTarget.dataset.attrIdx, 101 | itemIdx = e.currentTarget.dataset.itemIdx, 102 | specData = this.data.specData; 103 | for (let i in specData.spec_attr) { 104 | for (let j in specData.spec_attr[i].spec_items) { 105 | if (attrIdx == i) { 106 | specData.spec_attr[i].spec_items[j].checked = false; 107 | if (itemIdx == j) { 108 | specData.spec_attr[i].spec_items[itemIdx].checked = true; 109 | this.goods_spec_arr[i] = specData.spec_attr[i].spec_items[itemIdx].item_id; 110 | } 111 | } 112 | } 113 | } 114 | this.setData({ 115 | specData 116 | }); 117 | // 更新商品规格信息 118 | this.updateSpecGoods(); 119 | }, 120 | 121 | /** 122 | * 更新商品规格信息 123 | */ 124 | updateSpecGoods() { 125 | let spec_sku_id = this.goods_spec_arr.join('_'); 126 | 127 | // 查找skuItem 128 | let spec_list = this.data.specData.spec_list, 129 | skuItem = spec_list.find((val) => { 130 | return val.spec_sku_id == spec_sku_id; 131 | }); 132 | 133 | // 记录goods_sku_id 134 | // 更新商品价格、划线价、库存 135 | if (typeof skuItem === 'object') { 136 | this.setData({ 137 | goods_sku_id: skuItem.spec_sku_id, 138 | goods_price: skuItem.form.goods_price, 139 | line_price: skuItem.form.line_price, 140 | stock_num: skuItem.form.stock_num, 141 | }); 142 | } 143 | }, 144 | 145 | /** 146 | * 设置轮播图当前指针 数字 147 | */ 148 | setCurrent(e) { 149 | this.setData({ 150 | currentIndex: e.detail.current + 1 151 | }); 152 | }, 153 | 154 | /** 155 | * 控制商品规格/数量的显示隐藏 156 | */ 157 | onChangeShowState() { 158 | this.setData({ 159 | showView: !this.data.showView 160 | }); 161 | }, 162 | 163 | /** 164 | * 返回顶部 165 | */ 166 | goTop(t) { 167 | this.setData({ 168 | scrollTop: 0 169 | }); 170 | }, 171 | 172 | /** 173 | * 显示/隐藏 返回顶部按钮 174 | */ 175 | scroll(e) { 176 | this.setData({ 177 | floorstatus: e.detail.scrollTop > 200 178 | }) 179 | }, 180 | 181 | /** 182 | * 增加商品数量 183 | */ 184 | up() { 185 | this.setData({ 186 | goods_num: ++this.data.goods_num 187 | }) 188 | }, 189 | 190 | /** 191 | * 减少商品数量 192 | */ 193 | down() { 194 | if (this.data.goods_num > 1) { 195 | this.setData({ 196 | goods_num: --this.data.goods_num 197 | }); 198 | } 199 | }, 200 | 201 | /** 202 | * 跳转购物车页面 203 | */ 204 | flowCart: function () { 205 | wx.switchTab({ 206 | url: "../flow/index" 207 | }); 208 | }, 209 | 210 | /** 211 | * 加入购物车and立即购买 212 | */ 213 | submit(e) { 214 | let _this = this, 215 | submitType = e.currentTarget.dataset.type; 216 | 217 | if (submitType === 'buyNow') { 218 | // 立即购买 219 | wx.navigateTo({ 220 | url: '../flow/checkout?' + App.urlEncode({ 221 | order_type: 'buyNow', 222 | goods_id: _this.data.goods_id, 223 | goods_num: _this.data.goods_num, 224 | goods_sku_id: _this.data.goods_sku_id, 225 | }) 226 | }); 227 | } else if (submitType === 'addCart') { 228 | // 加入购物车 229 | App._post_form('cart/add', { 230 | goods_id: _this.data.goods_id, 231 | goods_num: _this.data.goods_num, 232 | goods_sku_id: _this.data.goods_sku_id, 233 | }, function(result) { 234 | App.showSuccess(result.msg); 235 | _this.setData(result.data); 236 | }); 237 | } 238 | }, 239 | 240 | /** 241 | * 分享当前页面 242 | */ 243 | onShareAppMessage: function() { 244 | // 构建页面参数 245 | let _this = this; 246 | return { 247 | title: _this.data.detail.goods_name, 248 | path: "/pages/goods/index?goods_id=" + _this.data.goods_id 249 | }; 250 | }, 251 | 252 | }) -------------------------------------------------------------------------------- /pages/goods/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "商品详情", 3 | "usingComponents": { 4 | "shortcut": "/components/shortcut/shortcut" 5 | } 6 | } -------------------------------------------------------------------------------- /pages/goods/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | {{currentIndex}} 12 | /{{detail.image.length}} 13 | 14 | 15 | 16 | 17 | {{detail.goods_name}} 18 | 19 | 20 | ¥{{goods_price}} 21 | ¥{{line_price}} 22 | 23 | 24 | 销量:{{detail.goods_sales}} 25 | 库存:{{stock_num}} 26 | 27 | 28 | 29 | 已选 30 | {{goods_num}} 个 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | {{attr.group_name}} 40 | 41 | 42 | {{item.spec_value}} 43 | 44 | 45 | {{item.spec_value}} 46 | 47 | 48 | 49 | 50 | 51 | 购买数量 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 评价 67 | 查看更多 68 | 69 | 70 | 71 | 72 | 73 | 74 | {{item.name}} 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | {{item.cont}} 83 | {{item.time}} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 商品描述 94 | 95 | 96 | 97 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | {{cart_total_num}} 126 | 127 | 128 | 加入购物车 129 | 立即购买 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /pages/goods/index.wxss: -------------------------------------------------------------------------------- 1 | .slide-image { 2 | background: #fff; 3 | } 4 | 5 | .banner-box { 6 | height: 750rpx; 7 | border-bottom: 1rpx solid #e4e4e4; 8 | } 9 | 10 | .user-orderJtou { 11 | color: #999; 12 | font-size: 26rpx; 13 | position: absolute; 14 | top: 50%; 15 | margin-top: -9rpx; 16 | } 17 | 18 | .goods-title { 19 | overflow: hidden; 20 | padding: 0 0rpx 0 0; 21 | color: #333; 22 | } 23 | 24 | .money-box { 25 | margin-top: 10rpx; 26 | } 27 | 28 | .money-box .num { 29 | color: #ff495e; 30 | font-size: 40rpx; 31 | margin-top: 10rpx; 32 | } 33 | 34 | .money-box .del { 35 | font-size: 24rpx; 36 | color: #999; 37 | margin-left: 6rpx; 38 | TEXT-DECORATION: line-through; 39 | } 40 | 41 | .goods-sales-box { 42 | color: #888; 43 | } 44 | 45 | .goods-sales-box .stock { 46 | text-align: right; 47 | display: block; 48 | } 49 | 50 | .goods-property-box { 51 | position: relative; 52 | padding: 12px; 53 | } 54 | 55 | /* 56 | .goods-property-box .m-l { 57 | color: #ff495e; 58 | font-size: 30rpx; 59 | } */ 60 | 61 | .goods-property-jianTou { 62 | width: 52rpx; 63 | position: absolute; 64 | right: 0; 65 | top: 50%; 66 | margin-top: -13rpx; 67 | } 68 | 69 | .goods-property-jianTou image { 70 | height: 100%; 71 | width: 100%; 72 | } 73 | 74 | .modal_cont_box { 75 | padding: 20rpx 12px; 76 | border-top: 1rpx solid #eee; 77 | } 78 | 79 | .buy_number { 80 | justify-content: space-between; 81 | } 82 | 83 | .buyNumber { 84 | color: #888; 85 | background: #fff; 86 | border-radius: 10rpx; 87 | margin-bottom: 10rpx; 88 | } 89 | 90 | .tmall-types.mb20 { 91 | margin-bottom: 20rpx; 92 | } 93 | 94 | .tipstxt { 95 | font-size: 28rpx; 96 | color: #888; 97 | margin-bottom: 10rpx; 98 | } 99 | 100 | .cartypelist { 101 | display: inline-block; 102 | } 103 | 104 | .cartypeitem { 105 | position: relative; 106 | display: inline-block; 107 | overflow: hidden; 108 | height: 60rpx; 109 | font-size: 31rpx; 110 | line-height: 60rpx; 111 | padding: 0 30rpx; 112 | margin: 0 20rpx 20rpx 0; 113 | border: 1rpx solid #f3f2f8; 114 | background: #f3f2f8; 115 | border-radius: 10rpx; 116 | color: #444; 117 | } 118 | 119 | .cartypeitem.cur { 120 | background: #ff495e; 121 | color: #fff; 122 | border: 1rpx solid #ff495e; 123 | } 124 | 125 | .cartypeitem.cur:after { 126 | position: absolute; 127 | bottom: 0; 128 | right: 0; 129 | content: ''; 130 | display: inline-block; 131 | width: 16rpx; 132 | height: 16rpx; 133 | } 134 | 135 | .cartypeitem.disabled { 136 | color: #dedede; 137 | cursor: not-allowed; 138 | background: #eee; 139 | border: 2rpx dashed #dedede; 140 | } 141 | 142 | .number-banner { 143 | position: absolute; 144 | right: 30rpx; 145 | margin-top: -70rpx; 146 | padding: 0 18rpx; 147 | background: rgba(0, 0, 0, 0.3); 148 | border-radius: 50rpx; 149 | color: #fff; 150 | font-size: 32rpx; 151 | } 152 | 153 | .number-banner text:last-child { 154 | color: rgba(255, 255, 255, 0.6); 155 | font-size: 26rpx; 156 | } 157 | 158 | .cart { 159 | background-color: #fff; 160 | } 161 | 162 | .order-number { 163 | width: 50%; 164 | background-color: #f4a213; 165 | color: #fff; 166 | text-align: center; 167 | line-height: 46px; 168 | } 169 | 170 | .order-number button { 171 | background: none; 172 | padding: 0; 173 | font-size: 34rpx; 174 | color: #fff; 175 | line-height: inherit; 176 | border-radius: 0; 177 | border: 0; 178 | } 179 | 180 | .order-number button::after { 181 | content: " "; 182 | width: 0; 183 | height: 0; 184 | position: absolute; 185 | top: 0; 186 | left: 0; 187 | border: none; 188 | transform: scale(0); 189 | transform-origin: 0 0; 190 | box-sizing: border-box; 191 | border-radius: 0; 192 | } 193 | 194 | .default-btn { 195 | width: 50%; 196 | background-color: #ccc; 197 | color: #fff; 198 | text-align: center; 199 | line-height: 46px; 200 | } 201 | 202 | .user-orderJtou-1 { 203 | color: #999; 204 | font-size: 26rpx; 205 | position: absolute; 206 | -moz-transform: rotate(-90deg); 207 | -ms-transform: rotate(-90deg); 208 | -o-transform: rotate(-90deg); 209 | transform: rotate(-90deg); 210 | -moz-transition: all 0.2s; 211 | -o-transition: all 0.2s; 212 | transition: all 0.2s; 213 | } 214 | 215 | .user-orderJtou-2 { 216 | -moz-transform: rotate(90deg); 217 | -ms-transform: rotate(90deg); 218 | -o-transform: rotate(90deg); 219 | transform: rotate(90deg); 220 | -moz-transition: all 0.2s; 221 | -o-transition: all 0.2s; 222 | transition: all 0.2s; 223 | } 224 | 225 | .flow_num { 226 | background: #ff495e; 227 | position: absolute; 228 | right: 20rpx; 229 | top: 10rpx; 230 | border-radius: 30rpx; 231 | height: 30rpx; 232 | min-width: 30rpx; 233 | } 234 | 235 | .goods-cont-li .wxParse-inline { 236 | font-size: 30rpx; 237 | padding: 20rpx 10rpx; 238 | } 239 | 240 | .goods-cont-li image { 241 | width: 100%; 242 | display: block; 243 | margin: 0 auto; 244 | } 245 | 246 | .goods-cont-li .wxParse-inline { 247 | font-size: 30rpx; 248 | } 249 | 250 | .comment-num { 251 | position: absolute; 252 | right: 34px; 253 | top: 50%; 254 | margin-top: -20rpx; 255 | font-size: 28rpx; 256 | color: #333; 257 | } 258 | 259 | .top-nav-bar { 260 | display: flex; 261 | flex-wrap: wrap; 262 | /* justify-content: space-around; */ 263 | padding: 12px; 264 | font-size: 31rpx; 265 | } 266 | 267 | #top-nav-bar-true text { 268 | border: 1rpx #ff495e solid; 269 | color: #ff495e; 270 | } 271 | 272 | #top-nav-bar-0 span { 273 | color: #444; 274 | } 275 | 276 | /* 底部操作栏 */ 277 | 278 | .footer-fixed .goods-fixed-icon { 279 | width: 150rpx; 280 | background: #fff; 281 | margin: 0 auto; 282 | padding: 0 6rpx; 283 | border-left: 1rpx solid #eee; 284 | height: 92rpx; 285 | position: relative; 286 | } 287 | 288 | .footer-fixed .goods-fixed-icon:first-child { 289 | border-left: none; 290 | } 291 | 292 | .footer-fixed .goods-fixed-icon image { 293 | width: 56rpx; 294 | height: 56rpx; 295 | display: block; 296 | position: absolute; 297 | left: 0%; 298 | margin-left: 30rpx; 299 | top: 0%; 300 | margin-top: 17rpx; 301 | } 302 | 303 | .footer-fixed .goods-fixed-icon text { 304 | color: #7a7e83; 305 | font-size: 48rpx; 306 | } 307 | 308 | .footer-fixed .goods-fixed-icon .bargain-icon { 309 | height: 50rpx; 310 | } 311 | 312 | .footer-fixed .goods-fixed-icon .bargain-icon image { 313 | height: 50rpx; 314 | width: 50rpx; 315 | margin-top: -40rpx; 316 | } 317 | 318 | .footer-fixed .goods-fixed-icon .bargain-home { 319 | margin-top: 6rpx; 320 | text-align: center; 321 | } 322 | 323 | .footer-fixed .goods-fixed-icon .flow_num text { 324 | display: block; 325 | color: #fff; 326 | font-size: 22rpx; 327 | text-align: center; 328 | } 329 | 330 | .footer-fixed .goods-fixed-icon .icon-shoucang { 331 | font-size: 40rpx; 332 | } 333 | 334 | .footer-fixed .goods-fixed-icon .s_cont { 335 | color: #ff495e; 336 | } 337 | -------------------------------------------------------------------------------- /pages/index/components/banner/banner.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pages/index/components/banner/banner.wxss: -------------------------------------------------------------------------------- 1 | /* banner轮播 */ 2 | 3 | .diy-banner { 4 | position: relative; 5 | } 6 | 7 | /* 顶部置灰 */ 8 | 9 | .diy-banner .linear { 10 | position: absolute; 11 | top: 0; 12 | left: 0; 13 | width: 100%; 14 | height: 3.4rem; 15 | background: linear-gradient(#111, transparent); 16 | opacity: 0.6; 17 | z-index: 9; 18 | } 19 | 20 | .swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal { 21 | margin-bottom: 2rpx; 22 | } 23 | 24 | /* banner组件按钮 */ 25 | 26 | .swiper-box .wx-swiper-dot { 27 | height: 20rpx; 28 | width: 20rpx; 29 | } 30 | 31 | .swiper-box.dot-rectangle .wx-swiper-dot { 32 | width: 30rpx; 33 | border-radius: unset; 34 | } 35 | 36 | .swiper-box.dot-square .wx-swiper-dot { 37 | border-radius: unset; 38 | } 39 | -------------------------------------------------------------------------------- /pages/index/components/search/search.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{item.params.placeholder}} 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/index/components/search/search.wxss: -------------------------------------------------------------------------------- 1 | 2 | /* 搜索框 */ 3 | 4 | .diy-search-box { 5 | position: unset; 6 | background: #f1f1f2; 7 | padding: 10px 24rpx; 8 | } 9 | 10 | .diy-search-box .diy-search { 11 | width: 90%; 12 | border-bottom: 0; 13 | background: #fff; 14 | overflow: hidden; 15 | position: relative; 16 | color: #fff; 17 | box-sizing: border-box; 18 | margin: 0 auto; 19 | padding: 0 10px; 20 | line-height: 60rpx; 21 | border-radius: unset; 22 | } 23 | 24 | .diy-search-box .diy-search .cont .icon-sousuo { 25 | margin-right: 10rpx; 26 | } 27 | 28 | .diy-search-box text { 29 | color: #999; 30 | } 31 | 32 | /* 输入框四角风格 */ 33 | 34 | .diy-search-box .diy-search.angle-radius { 35 | border-radius: 5px; 36 | } 37 | 38 | .diy-search-box .diy-search.angle-round { 39 | border-radius: 80rpx; 40 | } 41 | 42 | /* 文字对齐 */ 43 | 44 | .diy-search-box .diy-search.text-center { 45 | text-align: center; 46 | } 47 | 48 | .diy-search-box .diy-search.text-right { 49 | text-align: right; 50 | } 51 | -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | data: { 5 | // banner轮播组件属性 6 | indicatorDots: true, // 是否显示面板指示点 7 | autoplay: true, // 是否自动切换 8 | interval: 3000, // 自动切换时间间隔 9 | duration: 800, // 滑动动画时长 10 | imgHeights: {}, // 图片的高度 11 | imgCurrent: {}, // 当前banne所在滑块指针 12 | 13 | // 页面元素 14 | items: {}, 15 | newest: {}, 16 | best: {}, 17 | 18 | scrollTop: 0, 19 | }, 20 | 21 | onLoad: function() { 22 | // 设置页面标题 23 | App.setTitle(); 24 | // 设置navbar标题、颜色 25 | App.setNavigationBar(); 26 | // 获取首页数据 27 | this.getIndexData(); 28 | }, 29 | 30 | /** 31 | * 获取首页数据 32 | */ 33 | getIndexData: function() { 34 | let _this = this; 35 | App._get('index/page', {}, function(result) { 36 | _this.setData(result.data); 37 | }); 38 | }, 39 | 40 | /** 41 | * 计算图片高度 42 | */ 43 | imagesHeight: function(e) { 44 | let imgId = e.target.dataset.id, 45 | itemKey = e.target.dataset.itemKey, 46 | ratio = e.detail.width / e.detail.height, // 宽高比 47 | viewHeight = 750 / ratio, // 计算的高度值 48 | imgHeights = this.data.imgHeights; 49 | 50 | // 把每一张图片的对应的高度记录到数组里 51 | if (typeof imgHeights[itemKey] === 'undefined') { 52 | imgHeights[itemKey] = {}; 53 | } 54 | imgHeights[itemKey][imgId] = viewHeight; 55 | // 第一种方式 56 | let imgCurrent = this.data.imgCurrent; 57 | if (typeof imgCurrent[itemKey] === 'undefined') { 58 | imgCurrent[itemKey] = Object.keys(this.data.items[itemKey].data)[0]; 59 | } 60 | this.setData({ 61 | imgHeights, 62 | imgCurrent 63 | }); 64 | }, 65 | 66 | bindChange: function(e) { 67 | let itemKey = e.target.dataset.itemKey, 68 | imgCurrent = this.data.imgCurrent; 69 | // imgCurrent[itemKey] = e.detail.current; 70 | imgCurrent[itemKey] = e.detail.currentItemId; 71 | this.setData({ 72 | imgCurrent 73 | }); 74 | }, 75 | 76 | goTop: function(t) { 77 | this.setData({ 78 | scrollTop: 0 79 | }); 80 | }, 81 | 82 | scroll: function(t) { 83 | this.setData({ 84 | indexSearch: t.detail.scrollTop 85 | }), t.detail.scrollTop > 300 ? this.setData({ 86 | floorstatus: !0 87 | }) : this.setData({ 88 | floorstatus: !1 89 | }); 90 | }, 91 | 92 | onShareAppMessage: function() { 93 | return { 94 | title: "小程序首页", 95 | desc: "", 96 | path: "/pages/index/index" 97 | }; 98 | } 99 | }); -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "enablePullDownRefresh": true 3 | } -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 新品推荐 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {{item.goods_name}} 27 | 28 | ¥{{item.spec[0].goods_price}} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 猜您喜欢 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {{item.goods_name}} 51 | ¥{{item.spec[0].goods_price}} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 我是有底线的 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /* 搜索框组件 */ 2 | @import "components/search/search.wxss"; 3 | 4 | /* banner组件 */ 5 | @import "components/banner/banner.wxss"; 6 | 7 | /* 猜您喜欢 */ 8 | 9 | .title-hrbg { 10 | position: relative; 11 | z-index: 1; 12 | height: 80rpx; 13 | line-height: 80rpx; 14 | overflow: hidden; 15 | color: #888; 16 | text-align: center; 17 | margin-top: 30rpx; 18 | } 19 | 20 | .title-hrbg .cont { 21 | background: #f7f7f7; 22 | padding: 1rem 0.6rem; 23 | font-size: 28rpx; 24 | z-index: 10; 25 | } 26 | 27 | .title-hrbg .cont .icon-huo { 28 | padding-right: 10rpx; 29 | } 30 | 31 | .title-hrbg .hr { 32 | background: #ddd; 33 | height: 1rpx; 34 | border: 0; 35 | position: absolute; 36 | left: 10%; 37 | right: 10%; 38 | top: 50%; 39 | margin-top: 1px; 40 | z-index: -1; 41 | } 42 | -------------------------------------------------------------------------------- /pages/login/login.js: -------------------------------------------------------------------------------- 1 | const App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | 10 | }, 11 | 12 | /** 13 | * 生命周期函数--监听页面加载 14 | */ 15 | onLoad(options) { 16 | 17 | }, 18 | 19 | /** 20 | * 授权登录 21 | */ 22 | getUserInfo(e) { 23 | let _this = this; 24 | App.getUserInfo(e, () => { 25 | // 跳转回原页面 26 | _this.onNavigateBack(); 27 | }); 28 | }, 29 | 30 | /** 31 | * 暂不登录 32 | */ 33 | onNotLogin() { 34 | let _this = this; 35 | // 跳转回原页面 36 | _this.onNavigateBack(); 37 | }, 38 | 39 | /** 40 | * 授权成功 跳转回原页面 41 | */ 42 | onNavigateBack() { 43 | wx.navigateBack(); 44 | }, 45 | 46 | }) -------------------------------------------------------------------------------- /pages/login/login.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "授权登录" 3 | } -------------------------------------------------------------------------------- /pages/login/login.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 申请获取以下权限 10 | 获得你的公开信息(昵称、头像等) 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /pages/login/login.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | background: #fff; 3 | font-size: 32rpx; 4 | } 5 | 6 | .container { 7 | padding: 0 60rpx; 8 | } 9 | 10 | .wechatapp { 11 | padding: 80rpx 0 48rpx; 12 | border-bottom: 1rpx solid #e3e3e3; 13 | margin-bottom: 72rpx; 14 | text-align: center; 15 | } 16 | 17 | .wechatapp .header { 18 | width: 190rpx; 19 | height: 190rpx; 20 | border: 2px solid #fff; 21 | margin: 0rpx auto 0; 22 | border-radius: 50%; 23 | overflow: hidden; 24 | box-shadow: 1px 0px 5px rgba(50, 50, 50, 0.3); 25 | } 26 | 27 | .auth-title { 28 | color: #585858; 29 | font-size: 34rpx; 30 | margin-bottom: 40rpx; 31 | } 32 | 33 | .auth-subtitle { 34 | color: #888; 35 | margin-bottom: 88rpx; 36 | font-size: 28rpx; 37 | } 38 | 39 | .login-btn { 40 | padding: 0 20rpx; 41 | } 42 | 43 | .login-btn button { 44 | height: 88rpx; 45 | line-height: 88rpx; 46 | background: #04be01; 47 | color: #fff; 48 | font-size: 30rpx; 49 | border-radius: 999rpx; 50 | text-align: center; 51 | } 52 | 53 | .no-login-btn { 54 | margin-top: 20rpx; 55 | padding: 0 20rpx; 56 | } 57 | 58 | .no-login-btn button { 59 | height: 88rpx; 60 | line-height: 88rpx; 61 | background: #dfdfdf; 62 | color: #fff; 63 | font-size: 30rpx; 64 | border-radius: 999rpx; 65 | text-align: center; 66 | } 67 | -------------------------------------------------------------------------------- /pages/order/detail.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | order_id: null, 10 | order: {}, 11 | }, 12 | 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | this.data.order_id = options.order_id; 18 | this.getOrderDetail(options.order_id); 19 | }, 20 | 21 | /** 22 | * 获取订单详情 23 | */ 24 | getOrderDetail: function (order_id) { 25 | let _this = this; 26 | App._get('user.order/detail', { order_id }, function (result) { 27 | _this.setData(result.data); 28 | }); 29 | }, 30 | 31 | /** 32 | * 跳转到商品详情 33 | */ 34 | goodsDetail: function (e) { 35 | let goods_id = e.currentTarget.dataset.id; 36 | wx.navigateTo({ 37 | url: '../goods/index?goods_id=' + goods_id 38 | }); 39 | }, 40 | 41 | /** 42 | * 取消订单 43 | */ 44 | cancelOrder: function (e) { 45 | let _this = this; 46 | let order_id = _this.data.order_id; 47 | wx.showModal({ 48 | title: "提示", 49 | content: "确认取消订单?", 50 | success: function (o) { 51 | if (o.confirm) { 52 | App._post_form('user.order/cancel', { order_id }, function (result) { 53 | wx.navigateBack(); 54 | }); 55 | } 56 | } 57 | }); 58 | }, 59 | 60 | /** 61 | * 发起付款 62 | */ 63 | payOrder: function (e) { 64 | let _this = this; 65 | let order_id = _this.data.order_id; 66 | 67 | // 显示loading 68 | wx.showLoading({ title: '正在处理...', }); 69 | App._post_form('user.order/pay', { order_id }, function (result) { 70 | if (result.code === -10) { 71 | App.showError(result.msg); 72 | return false; 73 | } 74 | // 发起微信支付 75 | wx.requestPayment({ 76 | timeStamp: result.data.timeStamp, 77 | nonceStr: result.data.nonceStr, 78 | package: 'prepay_id=' + result.data.prepay_id, 79 | signType: 'MD5', 80 | paySign: result.data.paySign, 81 | success: function (res) { 82 | _this.getOrderDetail(order_id); 83 | }, 84 | fail: function () { 85 | App.showError('订单未支付'); 86 | }, 87 | }); 88 | }); 89 | }, 90 | 91 | /** 92 | * 确认收货 93 | */ 94 | receipt: function (e) { 95 | let _this = this; 96 | let order_id = _this.data.order_id; 97 | wx.showModal({ 98 | title: "提示", 99 | content: "确认收到商品?", 100 | success: function (o) { 101 | if (o.confirm) { 102 | App._post_form('user.order/receipt', { order_id }, function (result) { 103 | _this.getOrderDetail(order_id); 104 | }); 105 | } 106 | } 107 | }); 108 | }, 109 | 110 | 111 | }); -------------------------------------------------------------------------------- /pages/order/detail.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "订单详情" 3 | } -------------------------------------------------------------------------------- /pages/order/detail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{order.address.name}} 9 | {{order.address.phone}} 10 | 11 | 12 | {{order.address.region.province}} {{order.address.region.city}} {{order.address.region.region}} {{order.address.detail}} 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 快递公司: {{order.express_company}} 22 | 23 | 24 | 快递单号: {{order.express_no}} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 商品列表 34 | 35 | 36 | {{order.pay_status.text}} 37 | {{order.delivery_status.text}} 38 | {{order.receipt_status.text}} 39 | {{order.order_status.text}} 40 | 41 | 42 | 43 | 44 | 45 | 46 | 订单号:{{order.order_no}} 47 | 48 | 49 | {{order.create_time}} 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | {{item.goods_name}} 62 | {{item.goods_attr}} 63 | 64 | ¥{{item.goods_price}} 65 | ×{{item.total_num}} 66 | 67 | 68 | 69 | 70 | 71 | 72 | 共{{order.goods.length}}件商品,合计: 73 | {{order.total_price}} 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 订单金额 82 | 83 | 84 | 商品金额: 85 | ¥{{order.total_price}} 86 | 87 | 88 | 配送费用: 89 | +¥{{order.express_price}} 90 | 91 | 92 | 应付金额: 93 | ¥{{order.pay_price}} 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 取消订单 103 | 104 | 105 | 去付款 106 | 107 | 108 | 109 | 确认收货 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /pages/order/detail.wxss: -------------------------------------------------------------------------------- 1 | .flow-distribution { 2 | padding: 18rpx 0; 3 | border-bottom: 1rpx solid #eee; 4 | } 5 | 6 | .flow-distribution .flow-dis { 7 | font-size: 30rpx; 8 | } 9 | 10 | .flow-distribution-left { 11 | flex: 14; 12 | } 13 | 14 | .flow-distribution-left .m-l { 15 | color: #333; 16 | float: right; 17 | } 18 | 19 | .flow-distribution-right { 20 | flex: 1; 21 | } 22 | 23 | .flow-distribution image { 24 | width: 30rpx; 25 | height: 30rpx; 26 | margin-top: 6rpx; 27 | float: right; 28 | } 29 | 30 | .flow-message-box { 31 | padding: 20rpx 15px; 32 | position: relative; 33 | } 34 | 35 | .flow-message-box .flow-message-title { 36 | color: #777; 37 | } 38 | 39 | .flow-message-box textarea { 40 | height: 100rpx; 41 | width: 100%; 42 | margin-top: 10rpx; 43 | padding: 10rpx 0; 44 | border-bottom: 1rpx solid #eee; 45 | } 46 | 47 | .flow-message-box .flow-message-num { 48 | position: absolute; 49 | bottom: 34rpx; 50 | right: 30rpx; 51 | font-size: 26rpx; 52 | color: #777; 53 | } 54 | 55 | /*asdasd*/ 56 | 57 | .flow-distribution .flow-dis { 58 | padding-right: 15px; 59 | } 60 | 61 | .flow-message-box { 62 | border-bottom: 1rpx solid #f1f1f1; 63 | } 64 | 65 | .flow-message-box .cont { 66 | padding: 10px 0; 67 | color: #000; 68 | } 69 | 70 | .order-cont { 71 | /* padding: 12rpx 0; */ 72 | justify-content: space-between; 73 | } 74 | 75 | .order-cont .order-num text, .order-cont .time { 76 | color: #888; 77 | } 78 | 79 | .order-cont .order-num text, .order-cont .order-time text { 80 | color: #777; 81 | font-size: 26rpx; 82 | } 83 | 84 | .order-header { 85 | border-bottom: 1rpx solid #f1f1f1; 86 | padding: 15rpx 0; 87 | } 88 | 89 | .order-header text { 90 | font-size: 28rpx; 91 | } 92 | 93 | .order-header text.title { 94 | color: #333; 95 | } 96 | 97 | .flow-list .header { 98 | position: relative; 99 | padding: 15rpx 0; 100 | background: #fff; 101 | border-bottom: 1rpx solid #f1f1f1; 102 | } 103 | 104 | .flow-list .header text { 105 | padding-left: 80rpx; 106 | font-size: 32rpx; 107 | } 108 | 109 | .flow-list .header image { 110 | width: 34rpx; 111 | height: 37rpx; 112 | position: absolute; 113 | top: 50%; 114 | margin-top: -18rpx; 115 | left: 15px; 116 | } 117 | 118 | /* 119 | .checkout_list { 120 | padding: 15px; 121 | background: #fff; 122 | } 123 | 124 | .checkout_list .flow-shopList { 125 | padding: 5rpx 0 10rpx; 126 | border-bottom: 1rpx solid #f1f1f1; 127 | } 128 | 129 | .checkout_list .flow-shopList:last-child { 130 | border-bottom: 0; 131 | } */ 132 | 133 | .chackout-right-detail, .chackout-left-detail { 134 | font-size: 34rpx; 135 | color: #333; 136 | } 137 | 138 | .chackout-left-detail { 139 | line-height: 44px; 140 | } 141 | -------------------------------------------------------------------------------- /pages/order/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | dataType: 'all', 10 | list: [], 11 | }, 12 | 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | this.data.dataType = options.type || 'all'; 18 | this.setData({ dataType: this.data.dataType }); 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面显示 23 | */ 24 | onShow: function () { 25 | // 获取订单列表 26 | this.getOrderList(this.data.dataType); 27 | }, 28 | 29 | /** 30 | * 获取订单列表 31 | */ 32 | getOrderList: function (dataType) { 33 | let _this = this; 34 | App._get('user.order/lists', { dataType }, function (result) { 35 | _this.setData(result.data); 36 | result.data.list.length && wx.pageScrollTo({ 37 | scrollTop: 0 38 | }); 39 | }); 40 | }, 41 | 42 | /** 43 | * 切换标签 44 | */ 45 | bindHeaderTap: function (e) { 46 | this.setData({ dataType: e.target.dataset.type }); 47 | // 获取订单列表 48 | this.getOrderList(e.target.dataset.type); 49 | }, 50 | 51 | /** 52 | * 取消订单 53 | */ 54 | cancelOrder: function (e) { 55 | let _this = this; 56 | let order_id = e.currentTarget.dataset.id; 57 | wx.showModal({ 58 | title: "提示", 59 | content: "确认取消订单?", 60 | success: function (o) { 61 | if (o.confirm) { 62 | App._post_form('user.order/cancel', { order_id }, function (result) { 63 | _this.getOrderList(_this.data.dataType); 64 | }); 65 | } 66 | } 67 | }); 68 | }, 69 | 70 | /** 71 | * 确认收货 72 | */ 73 | receipt: function (e) { 74 | let _this = this; 75 | let order_id = e.currentTarget.dataset.id; 76 | wx.showModal({ 77 | title: "提示", 78 | content: "确认收到商品?", 79 | success: function (o) { 80 | if (o.confirm) { 81 | App._post_form('user.order/receipt', { order_id }, function (result) { 82 | _this.getOrderList(_this.data.dataType); 83 | }); 84 | } 85 | } 86 | }); 87 | }, 88 | 89 | /** 90 | * 发起付款 91 | */ 92 | payOrder: function (e) { 93 | let _this = this; 94 | let order_id = e.currentTarget.dataset.id; 95 | 96 | // 显示loading 97 | wx.showLoading({ title: '正在处理...', }); 98 | App._post_form('user.order/pay', { order_id }, function (result) { 99 | if (result.code === -10) { 100 | App.showError(result.msg); 101 | return false; 102 | } 103 | // 发起微信支付 104 | wx.requestPayment({ 105 | timeStamp: result.data.timeStamp, 106 | nonceStr: result.data.nonceStr, 107 | package: 'prepay_id=' + result.data.prepay_id, 108 | signType: 'MD5', 109 | paySign: result.data.paySign, 110 | success: function (res) { 111 | // 跳转到已付款订单 112 | wx.navigateTo({ 113 | url: '../order/detail?order_id=' + order_id 114 | }); 115 | }, 116 | fail: function () { 117 | App.showError('订单未支付'); 118 | }, 119 | }); 120 | }); 121 | }, 122 | 123 | /** 124 | * 跳转订单详情页 125 | */ 126 | detail: function (e) { 127 | let order_id = e.currentTarget.dataset.id; 128 | wx.navigateTo({ 129 | url: '../order/detail?order_id=' + order_id 130 | }); 131 | }, 132 | 133 | onPullDownRefresh: function () { 134 | wx.stopPullDownRefresh(); 135 | } 136 | 137 | 138 | }); -------------------------------------------------------------------------------- /pages/order/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的订单" 3 | } -------------------------------------------------------------------------------- /pages/order/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 全部订单 5 | 待付款 6 | 待发货 7 | 待收货 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 商品列表 17 | 18 | 19 | {{item.pay_status.text}} 20 | {{item.delivery_status.text}} 21 | {{item.receipt_status.text}} 22 | {{item.order_status.text}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 订单号:{{item.order_no}} 30 | 31 | 32 | {{item.create_time}} 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 共{{item.goods.length}}件 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 合计: 58 | ¥{{item.pay_price}} 59 | 60 | 61 | 62 | 63 | 64 | 取消 65 | 66 | 67 | 付款 68 | 69 | 70 | 确认收货 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 亲,您还没有订单信息哦! 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /pages/order/index.wxss: -------------------------------------------------------------------------------- 1 | .header { 2 | width: 100%; 3 | height: 44px; 4 | border-bottom: 1rpx solid #e4e4e4; 5 | display: flex; 6 | background: #fff; 7 | line-height: 44px; 8 | position: fixed; 9 | top: 0; 10 | z-index: 100; 11 | } 12 | 13 | .header view { 14 | flex: 1; 15 | text-align: center; 16 | } 17 | 18 | .header .active { 19 | color: #fd4a5f; 20 | } 21 | 22 | .wrapper { 23 | margin-top: 54px; 24 | } 25 | 26 | .order-box { 27 | padding: 0 15px; 28 | } 29 | 30 | .order-header { 31 | /* border-bottom: 1rpx solid #e4e4e4; */ 32 | padding-top: 10rpx; 33 | } 34 | 35 | .order-header .title { 36 | font-size: 30rpx; 37 | color: #333; 38 | } 39 | 40 | .order-header .cont { 41 | /* display: block; */ 42 | font-size: 30rpx; 43 | color: #fd4a5f; 44 | } 45 | 46 | .order-cont { 47 | padding: 15rpx 0; 48 | justify-content: space-between; 49 | } 50 | 51 | .order-cont .order-num text, .order-cont .order-time text { 52 | color: #777; 53 | font-size: 26rpx; 54 | } 55 | 56 | .order-shop { 57 | padding: 16rpx 0 16rpx 0; 58 | } 59 | 60 | .order-shop-left, .order-shop-left image { 61 | width: 160rpx; 62 | height: 160rpx; 63 | /* border: 1rpx solid #e4e4e4; */ 64 | margin-right: 15rpx; 65 | display: inline-block; 66 | background: #fff; 67 | } 68 | 69 | .order-shop .num { 70 | float: right; 71 | } 72 | 73 | .order-btn { 74 | padding: 18rpx 0 18rpx 0; 75 | } 76 | 77 | .order-btn .order-left { 78 | flex: 3; 79 | } 80 | 81 | .order-btn .order-left text, .order-btn .order-left .text { 82 | font-size: 30rpx; 83 | } 84 | 85 | .order-btn .order-left .text { 86 | color: #777; 87 | } 88 | 89 | .order-btn .order-right { 90 | flex: 3; 91 | } 92 | 93 | .order-list-box .left { 94 | flex: 4; 95 | overflow: hidden; 96 | position: relative; 97 | } 98 | 99 | .order-list-box .right { 100 | flex: 1; 101 | } 102 | 103 | .goods-number { 104 | position: absolute; 105 | right: 12px; 106 | top: 35%; 107 | font-size: 28rpx; 108 | color: #777; 109 | } 110 | 111 | .btn-default { 112 | border-radius: 4px; 113 | border: 1rpx solid #ccc; 114 | padding: 6rpx 20rpx; 115 | font-size: 28rpx; 116 | color: #555; 117 | float: right; 118 | } 119 | 120 | .btn-main { 121 | border-radius: 4px; 122 | border: 1rpx solid #fd4a5f; 123 | padding: 6rpx 20rpx; 124 | font-size: 28rpx; 125 | color: #fd4a5f; 126 | margin-left: 10rpx; 127 | float: right; 128 | } 129 | 130 | .user-orderJtou { 131 | font-size: 24rpx; 132 | position: absolute; 133 | top: 50%; 134 | right: 0; 135 | margin-top: -20rpx; 136 | color: #888; 137 | } 138 | 139 | .order-img_list { 140 | background: #fff; 141 | border-top: 1rpx solid #f1f1f1; 142 | border-bottom: 1rpx solid #f1f1f1; 143 | } 144 | 145 | .order-right-name { 146 | position: absolute; 147 | top: 50%; 148 | left: 180rpx; 149 | font-size: 30rpx; 150 | color: #555; 151 | width: 100%; 152 | margin-top: -46rpx; 153 | line-height: 1.6; 154 | } 155 | -------------------------------------------------------------------------------- /pages/search/index.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | recentSearch: [], 10 | searchValue: '', 11 | }, 12 | 13 | /** 14 | * 生命周期函数--监听页面加载 15 | */ 16 | onLoad: function (options) { 17 | 18 | }, 19 | 20 | /** 21 | * 生命周期函数--监听页面显示 22 | */ 23 | onShow: function () { 24 | // 获取历史搜索 25 | this.getRecentSearch(); 26 | }, 27 | 28 | /** 29 | * 获取历史搜索 30 | */ 31 | getRecentSearch: function () { 32 | let recentSearch = wx.getStorageSync('recentSearch'); 33 | this.setData({ recentSearch }); 34 | }, 35 | 36 | /** 37 | * 绑定输入值 38 | */ 39 | getSearchContent: function (e) { 40 | this.data.searchValue = e.detail.value; 41 | }, 42 | 43 | /** 44 | * 搜索提交 45 | */ 46 | search: function () { 47 | if (this.data.searchValue) { 48 | // 记录最近搜索 49 | let recentSearch = wx.getStorageSync('recentSearch') || []; 50 | recentSearch.unshift(this.data.searchValue); 51 | wx.setStorageSync('recentSearch', recentSearch) 52 | // 跳转到商品列表页 53 | wx.navigateTo({ 54 | url: '../category/list?search=' + this.data.searchValue, 55 | }) 56 | } 57 | }, 58 | 59 | /** 60 | * 清空最近搜索记录 61 | */ 62 | clearSearch: function () { 63 | wx.removeStorageSync('recentSearch'); 64 | this.getRecentSearch(); 65 | }, 66 | 67 | /** 68 | * 跳转到最近搜索 69 | */ 70 | goSearch: function (e) { 71 | wx.navigateTo({ 72 | url: '../category/list?search=' + e.target.dataset.text, 73 | }) 74 | }, 75 | 76 | }) -------------------------------------------------------------------------------- /pages/search/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "搜索" 3 | } -------------------------------------------------------------------------------- /pages/search/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 最近搜索 20 | 21 | 22 | 23 | 24 | {{recent}} 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /pages/search/index.wxss: -------------------------------------------------------------------------------- 1 | .seconds-kill-li { 2 | padding: 10rpx; 3 | box-sizing: border-box; 4 | width: 33.3%; 5 | float: left; 6 | } 7 | 8 | .title-box { 9 | font-size: 10pt; 10 | padding: 50rpx 0 0 0; 11 | color: #777; 12 | } 13 | 14 | .title-box .icon-lajixiang { 15 | float: right; 16 | } 17 | 18 | .sale-button-box { 19 | padding: 10px 0; 20 | overflow: hidden; 21 | } 22 | 23 | .sale-button, .recent-button { 24 | background: #fff; 25 | padding: 10rpx; 26 | border-radius: 50px; 27 | justify-content: center; 28 | text-align: center; 29 | font-size: 26rpx; 30 | border: 1px solid #eee; 31 | overflow: hidden; 32 | white-space: nowrap; 33 | text-overflow: ellipsis; 34 | height: 30rpx; 35 | line-height: 30rpx; 36 | } 37 | 38 | .serch-button button { 39 | background: #ff495e; 40 | } 41 | 42 | /* asd */ 43 | 44 | .search-input-box { 45 | height: 64rpx; 46 | } 47 | 48 | .search-input { 49 | width: 80%; 50 | background: #fff; 51 | border-radius: 5px 0 0 5px; 52 | padding-left: 10rpx; 53 | box-sizing: border-box; 54 | overflow: hidden; 55 | } 56 | 57 | .search-input input { 58 | font-size: 30rpx; 59 | height: 64rpx; 60 | line-height: 64rpx; 61 | } 62 | 63 | .serch-button { 64 | width: 20%; 65 | box-sizing: border-box; 66 | } 67 | 68 | .serch-button button { 69 | line-height: 64rpx; 70 | height: 64rpx; 71 | font-size: 28rpx; 72 | border-radius: 0 5px 5px 0; 73 | } 74 | 75 | .seconds-kill-li { 76 | padding: 10rpx; 77 | box-sizing: border-box; 78 | } 79 | 80 | .title-box { 81 | font-size: 10pt; 82 | padding: 50rpx 0 0 0; 83 | color: #777; 84 | } 85 | 86 | .sale-button, .recent-button { 87 | background: #fff; 88 | padding: 10rpx; 89 | border-radius: 50px; 90 | justify-content: center; 91 | text-align: center; 92 | font-size: 26rpx; 93 | border: 1px solid #ccc; 94 | overflow: hidden; 95 | white-space: nowrap; 96 | text-overflow: ellipsis; 97 | height: 30rpx; 98 | line-height: 30rpx; 99 | } 100 | 101 | .search-cont { 102 | padding: 0 15px; 103 | background: #fff; 104 | } 105 | 106 | .search-box .left { 107 | width: 28px; 108 | } 109 | 110 | .search-box .right { 111 | flex: 1; 112 | } 113 | 114 | .sale-button-box .seconds-kill-li { 115 | width: 33.3%; 116 | float: left; 117 | } 118 | 119 | .title-box image { 120 | width: 35rpx; 121 | height: 35rpx; 122 | float: right; 123 | } 124 | -------------------------------------------------------------------------------- /pages/user/help.js: -------------------------------------------------------------------------------- 1 | let App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | list: [], 10 | }, 11 | 12 | /** 13 | * 生命周期函数--监听页面加载 14 | */ 15 | onLoad: function (options) { 16 | 17 | }, 18 | 19 | /** 20 | * 生命周期函数--监听页面显示 21 | */ 22 | onShow: function () { 23 | // 获取帮助列表 24 | this.getHelpList(); 25 | }, 26 | 27 | /** 28 | * 获取帮助列表 29 | */ 30 | getHelpList: function () { 31 | let _this = this; 32 | App._get('wxapp/help', {}, function (result) { 33 | _this.setData(result.data); 34 | }); 35 | }, 36 | 37 | }) -------------------------------------------------------------------------------- /pages/user/help.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "帮助" 3 | } -------------------------------------------------------------------------------- /pages/user/help.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{item.title}} 5 | 6 | 7 | {{item.content}} 8 | 9 | 10 | -------------------------------------------------------------------------------- /pages/user/help.wxss: -------------------------------------------------------------------------------- 1 | .help { 2 | border-bottom: 1px solid #f6f6f9; 3 | } 4 | 5 | .help .h4 { 6 | font-size: 32rpx; 7 | color: #333; 8 | margin-bottom: 5px; 9 | } 10 | 11 | .help .p { 12 | font-size: 26rpx; 13 | color: #666; 14 | } -------------------------------------------------------------------------------- /pages/user/index.js: -------------------------------------------------------------------------------- 1 | const App = getApp(); 2 | 3 | Page({ 4 | 5 | /** 6 | * 页面的初始数据 7 | */ 8 | data: { 9 | isLogin: false, 10 | userInfo: {}, 11 | orderCount: {}, 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad(options) { 18 | 19 | }, 20 | 21 | /** 22 | * 生命周期函数--监听页面显示 23 | */ 24 | onShow() { 25 | let _this = this; 26 | _this.setData({ 27 | isLogin: App.checkIsLogin() 28 | }); 29 | if (_this.data.isLogin) { 30 | // 获取当前用户信息 31 | _this.getUserDetail(); 32 | } 33 | }, 34 | 35 | /** 36 | * 获取当前用户信息 37 | */ 38 | getUserDetail() { 39 | let _this = this; 40 | App._get('user.index/detail', {}, result => { 41 | _this.setData(result.data); 42 | }); 43 | }, 44 | 45 | /** 46 | * 订单导航跳转 47 | */ 48 | onTargetOrder(e) { 49 | let _this = this; 50 | if (!_this.onCheckLogin()) { 51 | return false; 52 | } 53 | let urls = { 54 | all: '/pages/order/index?type=all', 55 | payment: '/pages/order/index?type=payment', 56 | delivery: '/pages/order/index?type=delivery', 57 | received: '/pages/order/index?type=received' 58 | }; 59 | // 转跳指定的页面 60 | wx.navigateTo({ 61 | url: urls[e.currentTarget.dataset.type] 62 | }) 63 | }, 64 | 65 | /** 66 | * 菜单列表导航跳转 67 | */ 68 | onTargetMenus(e) { 69 | let _this = this; 70 | if (!_this.onCheckLogin()) { 71 | return false; 72 | } 73 | wx.navigateTo({ 74 | url: '/' + e.currentTarget.dataset.url 75 | }) 76 | }, 77 | 78 | /** 79 | * 跳转到登录页 80 | */ 81 | onLogin() { 82 | wx.navigateTo({ 83 | url: '../login/login', 84 | }); 85 | }, 86 | 87 | /** 88 | * 验证是否已登录 89 | */ 90 | onCheckLogin() { 91 | let _this = this; 92 | if (!_this.data.isLogin) { 93 | App.showError('很抱歉,您还没有登录'); 94 | return false; 95 | } 96 | return true; 97 | }, 98 | 99 | 100 | }) -------------------------------------------------------------------------------- /pages/user/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "个人中心", 3 | "navigationBarBackgroundColor": "#ffdd00" 4 | } -------------------------------------------------------------------------------- /pages/user/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 点击登录 18 | 19 | 20 | 21 | 22 |
23 | 32 |
33 | 34 | 35 |
36 | 40 |
41 |
42 | 43 |
44 | 49 |
50 |
51 | 52 |
53 | 58 |
59 |
60 | 61 |
62 | 67 |
68 |
69 |
70 |
71 |
72 | 73 | 74 |
75 | 86 |
87 |
88 | 99 |
100 |
101 | 112 |
113 |
114 |
-------------------------------------------------------------------------------- /pages/user/index.wxss: -------------------------------------------------------------------------------- 1 | /* 用户信息 */ 2 | 3 | .user { 4 | position: relative; 5 | background: #fff; 6 | margin-bottom: 150rpx; 7 | } 8 | 9 | .user-header { 10 | display: flex; 11 | padding-top: 1px; 12 | width: 100%; 13 | height: 310rpx; 14 | align-content: center; 15 | background-color: #fd0; 16 | background-repeat: no-repeat; 17 | background-position: center right; 18 | background-size: auto 100%; 19 | } 20 | 21 | .user-header .user-header-cont { 22 | display: flex; 23 | margin: auto; 24 | margin-bottom: 135rpx; 25 | width: 79%; 26 | align-items: center; 27 | } 28 | 29 | .user-header .user-header-cont .user-header-avatar { 30 | display: block; 31 | margin-right: 30rpx; 32 | width: 120rpx; 33 | height: 120rpx; 34 | border-radius: 50%; 35 | border: 5rpx solid #fff; 36 | overflow: hidden; 37 | } 38 | 39 | .user-header .user-header-cont .user-header-avatar image { 40 | width: 120rpx; 41 | height: 120rpx; 42 | border-radius: 50%; 43 | } 44 | 45 | .user-header .user-header-cont .user-header-cont-name { 46 | font-size: 32rpx; 47 | padding: 20rpx 0; 48 | } 49 | 50 | /* 订单导航栏 */ 51 | 52 | .order-navbar { 53 | position: absolute; 54 | left: 19rpx; 55 | bottom: -125rpx; 56 | margin: auto; 57 | padding: 15rpx 0; 58 | width: 95%; 59 | box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05); 60 | font-size: 30rpx; 61 | border-top: 1rpx solid #eee; 62 | border-radius: 5rpx; 63 | background: #fff; 64 | } 65 | 66 | .order-navbar-header { 67 | margin: auto; 68 | padding-bottom: 10rpx; 69 | width: 91%; 70 | height: 70rpx; 71 | border-bottom: 1px solid #eee; 72 | justify-content: space-between; 73 | align-items: center; 74 | } 75 | 76 | .order-navbar-footer { 77 | width: 100%; 78 | padding: 10rpx 0px; 79 | } 80 | 81 | .order-navbar-footer .order-navbar-item .order-navbar__icon { 82 | text-align: center; 83 | margin: 0 auto; 84 | display: block; 85 | padding: 10rpx 0; 86 | color: #000; 87 | font-size: 36rpx; 88 | } 89 | 90 | .order-navbar-footer .order-navbar-item .order-navbar__name { 91 | display: block; 92 | font-size: 24rpx; 93 | color: #666; 94 | text-align: center; 95 | margin-right: 10rpx; 96 | } 97 | 98 | .order-navbar-footer .order-navbar-item .order-badge { 99 | position: absolute; 100 | top: 0; 101 | right: 55rpx; 102 | font-size: 22rpx; 103 | background: #ff495e; 104 | text-align: center; 105 | line-height: 28rpx; 106 | color: #fff; 107 | border-radius: 100%; 108 | min-height: 30rpx; 109 | min-width: 30rpx; 110 | padding: 1rpx; 111 | } 112 | 113 | /* 菜单列表 */ 114 | 115 | .menus-list .menus-item { 116 | position: relative; 117 | padding: 28rpx 28rpx; 118 | border-bottom: 1rpx solid #eee; 119 | } 120 | 121 | .menus-list .menus-item .menus-item__name { 122 | color: #444; 123 | margin-left: 20rpx; 124 | } 125 | -------------------------------------------------------------------------------- /siteinfo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 配置文件 3 | */ 4 | module.exports = { 5 | name: "萤火小程序商城", 6 | siteroot: "http://yoshop.cn/", // 必填: api地址,结尾要带/ 7 | }; -------------------------------------------------------------------------------- /sitemap.json: -------------------------------------------------------------------------------- 1 | { 2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", 3 | "rules": [{ 4 | "action": "allow", 5 | "page": "*" 6 | }] 7 | } -------------------------------------------------------------------------------- /utils/common.wxss: -------------------------------------------------------------------------------- 1 | /* iconfont */ 2 | @import "/utils/iconfont.wxss"; 3 | 4 | .container, input { 5 | font-family: PingFang-Medium, 6 | PingFangSC-Regular, 7 | Heiti, 8 | Heiti SC, 9 | DroidSans, 10 | DroidSansFallback, 11 | "Microsoft YaHei", 12 | sans-serif; 13 | -webkit-font-smoothing: antialiased; 14 | } 15 | 16 | .b-f { 17 | background: #fff; 18 | } 19 | 20 | .tf-180 { 21 | -moz-transform: rotate(-180deg); 22 | -ms-transform: rotate(-180deg); 23 | -o-transform: rotate(-180deg); 24 | transform: rotate(-180deg); 25 | } 26 | 27 | .tf-90 { 28 | -moz-transform: rotate(90deg); 29 | -ms-transform: rotate(90deg); 30 | -o-transform: rotate(90deg); 31 | transform: rotate(90deg); 32 | } 33 | 34 | .dis-block { 35 | display: block; 36 | } 37 | 38 | .dis-flex { 39 | display: flex !important; 40 | /* flex-wrap: wrap; */ 41 | } 42 | 43 | .flex-box { 44 | flex: 1; 45 | } 46 | 47 | .flex-dir-row { 48 | flex-direction: row; 49 | } 50 | 51 | .flex-dir-column { 52 | flex-direction: column; 53 | } 54 | 55 | .flex-x-center { 56 | /* display: flex; */ 57 | justify-content: center; 58 | } 59 | 60 | .flex-x-between { 61 | justify-content: space-between; 62 | } 63 | 64 | .flex-x-around { 65 | justify-content: space-around; 66 | } 67 | 68 | .flex-x-end { 69 | justify-content: flex-end; 70 | } 71 | 72 | .flex-y-center { 73 | align-items: center; 74 | } 75 | 76 | .flex-y-end { 77 | align-items: flex-end; 78 | } 79 | 80 | .flex-five { 81 | box-sizing: border-box; 82 | flex: 0 0 50%; 83 | } 84 | 85 | .flex-three { 86 | float: left; 87 | width: 33.3%; 88 | } 89 | 90 | .flex-four { 91 | box-sizing: border-box; 92 | flex: 0 0 25%; 93 | } 94 | 95 | .t-l { 96 | text-align: left; 97 | } 98 | 99 | .t-c { 100 | text-align: center; 101 | } 102 | 103 | .t-r { 104 | text-align: right; 105 | } 106 | 107 | .p-a { 108 | position: absolute; 109 | } 110 | 111 | .p-r { 112 | position: relative; 113 | } 114 | 115 | .fl { 116 | float: left; 117 | } 118 | 119 | .fr { 120 | float: right; 121 | } 122 | 123 | .clear::after { 124 | clear: both; 125 | content: " "; 126 | display: table; 127 | } 128 | 129 | .oh { 130 | overflow: hidden; 131 | } 132 | 133 | .tb-lr-center { 134 | display: -webkit-box; 135 | display: -ms-flexbox; 136 | display: flex !important; 137 | -webkit-box-pack: center; 138 | -ms-flex-pack: center; 139 | justify-content: center; 140 | -webkit-box-align: center; 141 | -ms-flex-align: center; 142 | align-items: center; 143 | } 144 | 145 | .f-34 { 146 | font-size: 34rpx; 147 | } 148 | 149 | .f-32 { 150 | font-size: 32rpx; 151 | } 152 | 153 | .f-31 { 154 | font-size: 31rpx; 155 | } 156 | 157 | .f-30 { 158 | font-size: 30rpx; 159 | } 160 | 161 | .f-29 { 162 | font-size: 29rpx; 163 | } 164 | 165 | .f-28 { 166 | font-size: 28rpx; 167 | } 168 | 169 | .f-26 { 170 | font-size: 26rpx; 171 | } 172 | 173 | .f-25 { 174 | font-size: 25rpx; 175 | } 176 | 177 | .f-24 { 178 | font-size: 24rpx; 179 | } 180 | 181 | .f-22 { 182 | font-size: 22rpx; 183 | } 184 | 185 | .f-w { 186 | font-weight: 700; 187 | } 188 | 189 | .f-n { 190 | font-weight: 400; 191 | } 192 | 193 | .col-f { 194 | color: #fff; 195 | } 196 | 197 | .col-3 { 198 | color: #333; 199 | } 200 | 201 | .col-6 { 202 | color: #666; 203 | } 204 | 205 | .col-7 { 206 | color: #777; 207 | } 208 | 209 | .col-8 { 210 | color: #888; 211 | } 212 | 213 | .col-9 { 214 | color: #999; 215 | } 216 | 217 | .col-m { 218 | color: #ff495e !important; 219 | } 220 | 221 | .col-s { 222 | color: #be0117 !important; 223 | } 224 | 225 | .col-green { 226 | color: #0ed339 !important; 227 | } 228 | 229 | .cont-box { 230 | padding: 20rpx; 231 | } 232 | 233 | .cont-bot { 234 | margin-bottom: 120rpx; 235 | } 236 | 237 | .padding-box { 238 | padding: 0 24rpx; 239 | box-sizing: border-box; 240 | } 241 | 242 | .pl-12 { 243 | padding-left: 12px; 244 | } 245 | 246 | .pr-12 { 247 | padding-right: 12px; 248 | } 249 | 250 | .pr-6 { 251 | padding-right: 6px; 252 | } 253 | 254 | .m-top4 { 255 | margin-top: 4rpx; 256 | } 257 | 258 | .m-top10 { 259 | margin-top: 10rpx; 260 | } 261 | 262 | .m-top20 { 263 | margin-top: 25rpx; 264 | } 265 | 266 | .p-bottom { 267 | padding-bottom: 112rpx; 268 | } 269 | 270 | .onelist-hidden { 271 | overflow: hidden; 272 | text-overflow: ellipsis; 273 | white-space: nowrap; 274 | } 275 | 276 | .twolist-hidden { 277 | display: -webkit-box; 278 | word-break: break-all; 279 | text-overflow: ellipsis; 280 | overflow: hidden; 281 | -webkit-box-orient: vertical; 282 | -webkit-line-clamp: 2; 283 | } 284 | 285 | .b-r { 286 | border-right: 1rpx solid #eee; 287 | } 288 | 289 | .b-b { 290 | border-bottom: 1rpx solid #eee; 291 | } 292 | 293 | .b-t { 294 | border-top: 1rpx solid #eee; 295 | } 296 | 297 | .ts-1 { 298 | -moz-transition: all 0.1s; 299 | -o-transition: all 0.1s; 300 | transition: all 0.1s; 301 | } 302 | 303 | .ts-2 { 304 | -moz-transition: all 0.2s; 305 | -o-transition: all 0.2s; 306 | transition: all 0.2s; 307 | } 308 | 309 | .ts-3 { 310 | -moz-transition: all 0.3s; 311 | -o-transition: all 0.3s; 312 | transition: all 0.3s; 313 | } 314 | 315 | .ts-5 { 316 | -moz-transition: all 0.5s; 317 | -o-transition: all 0.5s; 318 | transition: all 0.5s; 319 | } 320 | 321 | /* 无样式button (用于伪submit) */ 322 | 323 | .btn-normal { 324 | display: block; 325 | margin: 0; 326 | padding: 0; 327 | line-height: normal; 328 | background: none; 329 | border-radius: 0; 330 | box-shadow: none; 331 | border: none; 332 | font-size: unset; 333 | text-align: unset; 334 | overflow: visible; 335 | } 336 | 337 | .btn-normal:after { 338 | border: none; 339 | } 340 | 341 | .btn-normal.button-hover { 342 | color: inherit; 343 | } 344 | -------------------------------------------------------------------------------- /utils/iconfont.wxss: -------------------------------------------------------------------------------- 1 | @font-face {font-family: "iconfont"; 2 | src: url('//at.alicdn.com/t/font_948567_7qt13mxhklx.eot?t=1547714036925'); /* IE9 */ 3 | src: url('//at.alicdn.com/t/font_948567_7qt13mxhklx.eot?t=1547714036925#iefix') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('data:application/x-font-woff2;charset=utf-8;base64,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') format('woff2'), 5 | url('//at.alicdn.com/t/font_948567_7qt13mxhklx.woff?t=1547714036925') format('woff'), 6 | url('//at.alicdn.com/t/font_948567_7qt13mxhklx.ttf?t=1547714036925') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ 7 | url('//at.alicdn.com/t/font_948567_7qt13mxhklx.svg?t=1547714036925#iconfont') format('svg'); /* iOS 4.1- */ 8 | } 9 | 10 | .iconfont { 11 | font-family: "iconfont" !important; 12 | /* font-size: 16px; */ 13 | font-style: normal; 14 | -webkit-font-smoothing: antialiased; 15 | -moz-osx-font-smoothing: grayscale; 16 | } 17 | 18 | .icon-tubiao_kuaizhuangpailie:before { 19 | content: "\e616"; 20 | } 21 | 22 | .icon-tubiao_liebiaopailie:before { 23 | content: "\e617"; 24 | } 25 | 26 | .icon-ziyuan:before { 27 | content: "\e673"; 28 | } 29 | 30 | .icon-cate:before { 31 | content: "\e6d9"; 32 | } 33 | 34 | .icon-cart:before { 35 | content: "\e68c"; 36 | } 37 | 38 | .icon-daifukuan:before { 39 | content: "\e68d"; 40 | } 41 | 42 | .icon-daohang:before { 43 | content: "\e650"; 44 | } 45 | 46 | .icon-gouwuche1:before { 47 | content: "\e606"; 48 | } 49 | 50 | .icon-add:before { 51 | content: "\e6a8"; 52 | } 53 | 54 | .icon-daishouhuo:before { 55 | content: "\e6ac"; 56 | } 57 | 58 | .icon-daipingjia:before { 59 | content: "\e6b2"; 60 | } 61 | 62 | .icon-dingwei1:before { 63 | content: "\e6b4"; 64 | } 65 | 66 | .icon-edit1:before { 67 | content: "\e6b6"; 68 | } 69 | 70 | .icon-edit:before { 71 | content: "\e6b7"; 72 | } 73 | 74 | .icon-fanhuidingbu:before { 75 | content: "\e6b8"; 76 | } 77 | 78 | .icon-favorite:before { 79 | content: "\e6bb"; 80 | } 81 | 82 | .icon-favorites:before { 83 | content: "\e6bc"; 84 | } 85 | 86 | .icon-form:before { 87 | content: "\e6c0"; 88 | } 89 | 90 | .icon-fenxiang:before { 91 | content: "\e6c1"; 92 | } 93 | 94 | .icon-haoping2:before { 95 | content: "\e6c2"; 96 | } 97 | 98 | .icon-help:before { 99 | content: "\e6c3"; 100 | } 101 | 102 | .icon-huo:before { 103 | content: "\e6c4"; 104 | } 105 | 106 | .icon-jiantou-copy:before { 107 | content: "\e6c5"; 108 | } 109 | 110 | .icon-home:before { 111 | content: "\e6c7"; 112 | } 113 | 114 | .icon-lajixiang:before { 115 | content: "\e6cb"; 116 | } 117 | 118 | .icon-map:before { 119 | content: "\e6cc"; 120 | } 121 | 122 | .icon-profile:before { 123 | content: "\e6d1"; 124 | } 125 | 126 | .icon-shanchu:before { 127 | content: "\e6d2"; 128 | } 129 | 130 | .icon-sousuo:before { 131 | content: "\e6db"; 132 | } 133 | 134 | .icon-xiangyoujiantou:before { 135 | content: "\e6e4"; 136 | } 137 | 138 | .icon-cart_b:before { 139 | content: "\e6e0"; 140 | } 141 | 142 | .icon-icon_service:before { 143 | content: "\e657"; 144 | } 145 | 146 | .icon-yonghu:before { 147 | content: "\e603"; 148 | } 149 | 150 | .icon-fenlei_:before { 151 | content: "\e607"; 152 | } 153 | 154 | .icon-gouwuche:before { 155 | content: "\e608"; 156 | } 157 | 158 | .icon-shouye:before { 159 | content: "\e60d"; 160 | } 161 | -------------------------------------------------------------------------------- /utils/login.js: -------------------------------------------------------------------------------- 1 | module.exports = function(e) { 2 | var g; 3 | if ((g = getCurrentPages()).length) { 4 | var r = g[g.length - 1]; 5 | r && "pages/login/login" != r.route && wx.setStorageSync("login_pre_page", r); 6 | } 7 | wx.redirectTo({ 8 | url: "/pages/login/login" 9 | }); 10 | }; -------------------------------------------------------------------------------- /utils/md5.js: -------------------------------------------------------------------------------- 1 | function r(r) { 2 | return h(n(i(r), r.length * A)); 3 | } 4 | 5 | function n(r, n) { 6 | r[n >> 5] |= 128 << n % 32, r[14 + (n + 64 >>> 9 << 4)] = n; 7 | for (var t = 1732584193, a = -271733879, i = -1732584194, h = 271733878, v = 0; v < r.length; v += 16) { 8 | var A = t, l = a, d = i, g = h; 9 | a = c(a = c(a = c(a = c(a = o(a = o(a = o(a = o(a = e(a = e(a = e(a = e(a = u(a = u(a = u(a = u(a, i = u(i, h = u(h, t = u(t, a, i, h, r[v + 0], 7, -680876936), a, i, r[v + 1], 12, -389564586), t, a, r[v + 2], 17, 606105819), h, t, r[v + 3], 22, -1044525330), i = u(i, h = u(h, t = u(t, a, i, h, r[v + 4], 7, -176418897), a, i, r[v + 5], 12, 1200080426), t, a, r[v + 6], 17, -1473231341), h, t, r[v + 7], 22, -45705983), i = u(i, h = u(h, t = u(t, a, i, h, r[v + 8], 7, 1770035416), a, i, r[v + 9], 12, -1958414417), t, a, r[v + 10], 17, -42063), h, t, r[v + 11], 22, -1990404162), i = u(i, h = u(h, t = u(t, a, i, h, r[v + 12], 7, 1804603682), a, i, r[v + 13], 12, -40341101), t, a, r[v + 14], 17, -1502002290), h, t, r[v + 15], 22, 1236535329), i = e(i, h = e(h, t = e(t, a, i, h, r[v + 1], 5, -165796510), a, i, r[v + 6], 9, -1069501632), t, a, r[v + 11], 14, 643717713), h, t, r[v + 0], 20, -373897302), i = e(i, h = e(h, t = e(t, a, i, h, r[v + 5], 5, -701558691), a, i, r[v + 10], 9, 38016083), t, a, r[v + 15], 14, -660478335), h, t, r[v + 4], 20, -405537848), i = e(i, h = e(h, t = e(t, a, i, h, r[v + 9], 5, 568446438), a, i, r[v + 14], 9, -1019803690), t, a, r[v + 3], 14, -187363961), h, t, r[v + 8], 20, 1163531501), i = e(i, h = e(h, t = e(t, a, i, h, r[v + 13], 5, -1444681467), a, i, r[v + 2], 9, -51403784), t, a, r[v + 7], 14, 1735328473), h, t, r[v + 12], 20, -1926607734), i = o(i, h = o(h, t = o(t, a, i, h, r[v + 5], 4, -378558), a, i, r[v + 8], 11, -2022574463), t, a, r[v + 11], 16, 1839030562), h, t, r[v + 14], 23, -35309556), i = o(i, h = o(h, t = o(t, a, i, h, r[v + 1], 4, -1530992060), a, i, r[v + 4], 11, 1272893353), t, a, r[v + 7], 16, -155497632), h, t, r[v + 10], 23, -1094730640), i = o(i, h = o(h, t = o(t, a, i, h, r[v + 13], 4, 681279174), a, i, r[v + 0], 11, -358537222), t, a, r[v + 3], 16, -722521979), h, t, r[v + 6], 23, 76029189), i = o(i, h = o(h, t = o(t, a, i, h, r[v + 9], 4, -640364487), a, i, r[v + 12], 11, -421815835), t, a, r[v + 15], 16, 530742520), h, t, r[v + 2], 23, -995338651), i = c(i, h = c(h, t = c(t, a, i, h, r[v + 0], 6, -198630844), a, i, r[v + 7], 10, 1126891415), t, a, r[v + 14], 15, -1416354905), h, t, r[v + 5], 21, -57434055), i = c(i, h = c(h, t = c(t, a, i, h, r[v + 12], 6, 1700485571), a, i, r[v + 3], 10, -1894986606), t, a, r[v + 10], 15, -1051523), h, t, r[v + 1], 21, -2054922799), i = c(i, h = c(h, t = c(t, a, i, h, r[v + 8], 6, 1873313359), a, i, r[v + 15], 10, -30611744), t, a, r[v + 6], 15, -1560198380), h, t, r[v + 13], 21, 1309151649), i = c(i, h = c(h, t = c(t, a, i, h, r[v + 4], 6, -145523070), a, i, r[v + 11], 10, -1120210379), t, a, r[v + 2], 15, 718787259), h, t, r[v + 9], 21, -343485551), 10 | t = f(t, A), a = f(a, l), i = f(i, d), h = f(h, g); 11 | } 12 | return Array(t, a, i, h); 13 | } 14 | 15 | function t(r, n, t, u, e, o) { 16 | return f(a(f(f(n, r), f(u, o)), e), t); 17 | } 18 | 19 | function u(r, n, u, e, o, c, f) { 20 | return t(n & u | ~n & e, r, n, o, c, f); 21 | } 22 | 23 | function e(r, n, u, e, o, c, f) { 24 | return t(n & e | u & ~e, r, n, o, c, f); 25 | } 26 | 27 | function o(r, n, u, e, o, c, f) { 28 | return t(n ^ u ^ e, r, n, o, c, f); 29 | } 30 | 31 | function c(r, n, u, e, o, c, f) { 32 | return t(u ^ (n | ~e), r, n, o, c, f); 33 | } 34 | 35 | function f(r, n) { 36 | var t = (65535 & r) + (65535 & n); 37 | return (r >> 16) + (n >> 16) + (t >> 16) << 16 | 65535 & t; 38 | } 39 | 40 | function a(r, n) { 41 | return r << n | r >>> 32 - n; 42 | } 43 | 44 | function i(r) { 45 | for (var n = Array(), t = (1 << A) - 1, u = 0; u < r.length * A; u += A) n[u >> 5] |= (r.charCodeAt(u / A) & t) << u % 32; 46 | return n; 47 | } 48 | 49 | function h(r) { 50 | for (var n = v ? "0123456789ABCDEF" : "0123456789abcdef", t = "", u = 0; u < 4 * r.length; u++) t += n.charAt(r[u >> 2] >> u % 4 * 8 + 4 & 15) + n.charAt(r[u >> 2] >> u % 4 * 8 & 15); 51 | return t; 52 | } 53 | 54 | var v = 0, A = 8; 55 | 56 | module.exports = { 57 | hex_md5: r 58 | }; -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | function t(t) { 2 | return (t = t.toString())[1] ? t : "0" + t; 3 | } 4 | 5 | module.exports = { 6 | formatTime: function(e) { 7 | var n = e.getFullYear(), o = e.getMonth() + 1, r = e.getDate(), u = e.getHours(), i = e.getMinutes(), g = e.getSeconds(); 8 | return [ n, o, r ].map(t).join("/") + " " + [ u, i, g ].map(t).join(":"); 9 | } 10 | }; -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.15" 3 | } 4 | -------------------------------------------------------------------------------- /wxParse/html2json.js: -------------------------------------------------------------------------------- 1 | function e(e) { 2 | for (var t = {}, r = e.split(","), s = 0; s < r.length; s++) t[r[s]] = !0; 3 | return t; 4 | } 5 | 6 | function t(e) { 7 | return e.replace(/<\?xml.*\?>\n/, "").replace(/<.*!doctype.*\>\n/, "").replace(/<.*!DOCTYPE.*\>\n/, ""); 8 | } 9 | 10 | function r(e) { 11 | var t = []; 12 | if (0 == a.length || !n) return (d = {}).node = "text", d.text = e, s = [ d ]; 13 | e = e.replace(/\[([^\[\]]+)\]/g, ":$1:"); 14 | for (var r = new RegExp("[:]"), s = e.split(r), i = 0; i < s.length; i++) { 15 | var l = s[i], d = {}; 16 | n[l] ? (d.node = "element", d.tag = "emoji", d.text = n[l], d.baseSrc = o) : (d.node = "text", 17 | d.text = l), t.push(d); 18 | } 19 | return t; 20 | } 21 | 22 | var s = "https", a = "", o = "", n = {}, i = require("./wxDiscode.js"), l = require("./htmlparser.js"), d = (e("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"), 23 | e("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")), c = e("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"), u = e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); 24 | 25 | e("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"), 26 | e("wxxxcode-style,script,style,view,scroll-view,block"); 27 | 28 | module.exports = { 29 | html2json: function(e, a) { 30 | e = t(e), e = i.strDiscode(e); 31 | var o = [], n = { 32 | node: a, 33 | nodes: [], 34 | images: [], 35 | imageUrls: [] 36 | }; 37 | return l(e, { 38 | start: function(e, t, r) { 39 | var l = { 40 | node: "element", 41 | tag: e 42 | }; 43 | if (d[e] ? l.tagType = "block" : c[e] ? l.tagType = "inline" : u[e] && (l.tagType = "closeSelf"), 44 | 0 !== t.length && (l.attr = t.reduce(function(e, t) { 45 | var r = t.name, s = t.value; 46 | return "class" == r && (console.log(s), l.classStr = s), "style" == r && (console.log(s), 47 | l.styleStr = s), s.match(/ /) && (s = s.split(" ")), e[r] ? Array.isArray(e[r]) ? e[r].push(s) : e[r] = [ e[r], s ] : e[r] = s, 48 | e; 49 | }, {})), "img" === l.tag) { 50 | l.imgIndex = n.images.length; 51 | var p = l.attr.src; 52 | p = i.urlToHttpUrl(p, s), l.attr.src = p, l.from = a, n.images.push(l), n.imageUrls.push(p); 53 | } 54 | if ("font" === l.tag) { 55 | var m = [ "x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large" ], f = { 56 | color: "color", 57 | face: "font-family", 58 | size: "font-size" 59 | }; 60 | l.attr.style || (l.attr.style = []), l.styleStr || (l.styleStr = ""); 61 | for (var h in f) if (l.attr[h]) { 62 | var g = "size" === h ? m[l.attr[h] - 1] : l.attr[h]; 63 | l.attr.style.push(f[h]), l.attr.style.push(g), l.styleStr += f[h] + ": " + g + ";"; 64 | } 65 | } 66 | if ("source" === l.tag && (n.source = l.attr.src), r) { 67 | var v = o[0] || n; 68 | void 0 === v.nodes && (v.nodes = []), v.nodes.push(l); 69 | } else o.unshift(l); 70 | }, 71 | end: function(e) { 72 | var t = o.shift(); 73 | if (t.tag !== e && console.error("invalid state: mismatch end tag"), "video" === t.tag && n.source && (t.attr.src = n.source, 74 | delete result.source), 0 === o.length) n.nodes.push(t); else { 75 | var r = o[0]; 76 | void 0 === r.nodes && (r.nodes = []), r.nodes.push(t); 77 | } 78 | }, 79 | chars: function(e) { 80 | var t = { 81 | node: "text", 82 | text: e, 83 | textArray: r(e) 84 | }; 85 | if (0 === o.length) n.nodes.push(t); else { 86 | var s = o[0]; 87 | void 0 === s.nodes && (s.nodes = []), s.nodes.push(t); 88 | } 89 | }, 90 | comment: function(e) {} 91 | }), n; 92 | }, 93 | emojisInit: function() { 94 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "/wxParse/emojis/", r = arguments[2]; 95 | a = e, o = t, n = r; 96 | } 97 | }; 98 | -------------------------------------------------------------------------------- /wxParse/htmlparser.js: -------------------------------------------------------------------------------- 1 | function e(e) { 2 | for (var t = {}, r = e.split(","), s = 0; s < r.length; s++) t[r[s]] = !0; 3 | return t; 4 | } 5 | 6 | var t = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, r = /^<\/([-A-Za-z0-9_]+)[^>]*>/, s = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, a = e("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"), n = e("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"), i = e("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"), o = e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"), l = e("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"), c = e("wxxxcode-style,script,style,view,scroll-view,block"); 7 | 8 | module.exports = function(e, d) { 9 | function f(e, t) { 10 | if (t) for (t = t.toLowerCase(), r = b.length - 1; r >= 0 && b[r] != t; r--) ; else var r = 0; 11 | if (r >= 0) { 12 | for (var s = b.length - 1; s >= r; s--) d.end && d.end(b[s]); 13 | b.length = r; 14 | } 15 | } 16 | var p, u, h, b = [], m = e; 17 | for (b.last = function() { 18 | return this[this.length - 1]; 19 | }; e; ) { 20 | if (u = !0, b.last() && c[b.last()]) e = e.replace(new RegExp("([\\s\\S]*?)]*>"), function(e, t) { 21 | return t = t.replace(/|/g, "$1$2"), d.chars && d.chars(t), 22 | ""; 23 | }), f(0, b.last()); else if (0 == e.indexOf("\x3c!--") ? (p = e.indexOf("--\x3e")) >= 0 && (d.comment && d.comment(e.substring(4, p)), 24 | e = e.substring(p + 3), u = !1) : 0 == e.indexOf(""); 41 | } 42 | 43 | function l(e) { 44 | return e = e.replace(/Œ/g, "Œ"), e = e.replace(/œ/g, "œ"), e = e.replace(/Š/g, "Š"), 45 | e = e.replace(/š/g, "š"), e = e.replace(/Ÿ/g, "Ÿ"), e = e.replace(/ƒ/g, "ƒ"), 46 | e = e.replace(/ˆ/g, "ˆ"), e = e.replace(/˜/g, "˜"), e = e.replace(/ /g, ""), 47 | e = e.replace(/ /g, ""), e = e.replace(/ /g, ""), e = e.replace(/‌/g, ""), 48 | e = e.replace(/‍/g, ""), e = e.replace(/‎/g, ""), e = e.replace(/‏/g, ""), 49 | e = e.replace(/–/g, "–"), e = e.replace(/—/g, "—"), e = e.replace(/‘/g, "‘"), 50 | e = e.replace(/’/g, "’"), e = e.replace(/‚/g, "‚"), e = e.replace(/“/g, "“"), 51 | e = e.replace(/”/g, "”"), e = e.replace(/„/g, "„"), e = e.replace(/†/g, "†"), 52 | e = e.replace(/‡/g, "‡"), e = e.replace(/•/g, "•"), e = e.replace(/…/g, "…"), 53 | e = e.replace(/‰/g, "‰"), e = e.replace(/′/g, "′"), e = e.replace(/″/g, "″"), 54 | e = e.replace(/‹/g, "‹"), e = e.replace(/›/g, "›"), e = e.replace(/‾/g, "‾"), 55 | e = e.replace(/€/g, "€"), e = e.replace(/™/g, "™"), e = e.replace(/←/g, "←"), 56 | e = e.replace(/↑/g, "↑"), e = e.replace(/→/g, "→"), e = e.replace(/↓/g, "↓"), 57 | e = e.replace(/↔/g, "↔"), e = e.replace(/↵/g, "↵"), e = e.replace(/⌈/g, "⌈"), 58 | e = e.replace(/⌉/g, "⌉"), e = e.replace(/⌊/g, "⌊"), e = e.replace(/⌋/g, "⌋"), 59 | e = e.replace(/◊/g, "◊"), e = e.replace(/♠/g, "♠"), e = e.replace(/♣/g, "♣"), 60 | e = e.replace(/♥/g, "♥"), e = e.replace(/♦/g, "♦"); 61 | } 62 | 63 | function p(e) { 64 | return e = e.replace(/\r\n/g, ""), e = e.replace(/\n/g, ""), e = e.replace(/code/g, "wxxxcode-style"); 65 | } 66 | 67 | module.exports = { 68 | strDiscode: function(c) { 69 | return c = e(c), c = a(c), c = r(c), c = l(c), c = p(c); 70 | }, 71 | urlToHttpUrl: function(e, a) { 72 | return new RegExp("^//").test(e) && (e = a + ":" + e), e; 73 | } 74 | }; -------------------------------------------------------------------------------- /wxParse/wxParse.js: -------------------------------------------------------------------------------- 1 | function e(e) { 2 | return e && e.__esModule ? e : { 3 | default: e 4 | }; 5 | } 6 | 7 | function t(e) { 8 | var t = this, a = e.target.dataset.src, i = e.target.dataset.from; 9 | void 0 !== i && i.length > 0 && wx.previewImage({ 10 | current: a, 11 | urls: t.data[i].imageUrls 12 | }); 13 | } 14 | 15 | function a(e) { 16 | return false; 17 | var t = this, a = e.target.dataset.from, r = e.target.dataset.idx; 18 | void 0 !== a && a.length > 0 && i(e, r, t, a); 19 | } 20 | 21 | function i(e, t, a, i) { 22 | var d = a.data[i]; 23 | if (0 != d.images.length) { 24 | var n = d.images, s = r(e.detail.width, e.detail.height, a, i); 25 | n[t].width = s.imageWidth, n[t].height = s.imageheight, d.images = n; 26 | var o = {}; 27 | o[i] = d, a.setData(o); 28 | } 29 | } 30 | 31 | function r(e, t, a, i) { 32 | var r = 0, d = 0, n = 0, s = 0, o = {}; 33 | return wx.getSystemInfo({ 34 | success: function(g) { 35 | var h = a.data[i].view.imagePadding; 36 | r = g.windowWidth - 2 * h, d = g.windowHeight, e > r ? (s = (n = r) * t / e, o.imageWidth = n, 37 | o.imageheight = s) : (o.imageWidth = e, o.imageheight = t); 38 | } 39 | }), o; 40 | } 41 | 42 | var d = e(require("./showdown.js")), n = e(require("./html2json.js")); 43 | 44 | module.exports = { 45 | wxParse: function() { 46 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "wxParseData", i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "html", r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : '
数据不能为空
', s = arguments[3], o = arguments[4], g = s, h = {}; 47 | if ("html" == i) h = n.default.html2json(r, e); else if ("md" == i || "markdown" == i) { 48 | var m = new d.default.Converter().makeHtml(r); 49 | h = n.default.html2json(m, e); 50 | } 51 | h.view = {}, h.view.imagePadding = 0, void 0 !== o && (h.view.imagePadding = o); 52 | var l = {}; 53 | l[e] = h, g.setData(l), g.wxParseImgLoad = a, g.wxParseImgTap = t; 54 | }, 55 | wxParseTemArray: function(e, t, a, i) { 56 | for (var r = [], d = i.data, n = null, s = 0; s < a; s++) { 57 | var o = d[t + s].nodes; 58 | r.push(o); 59 | } 60 | e = e || "wxParseTemArray", (n = JSON.parse('{"' + e + '":""}'))[e] = r, i.setData(n); 61 | }, 62 | emojisInit: function() { 63 | var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "/wxParse/emojis/", a = arguments[2]; 64 | n.default.emojisInit(e, t, a); 65 | } 66 | }; -------------------------------------------------------------------------------- /wxParse/wxParse.wxss: -------------------------------------------------------------------------------- 1 | .wxParse { 2 | margin: 0 5px; 3 | font-family: Helvetica,sans-serif; 4 | font-size: 28rpx; 5 | color: #666; 6 | line-height: 1.8; 7 | } 8 | 9 | view { 10 | word-break: break-all; 11 | overflow: auto; 12 | } 13 | 14 | .wxParse-inline { 15 | display: inline; 16 | margin: 0; 17 | padding: 0; 18 | } 19 | 20 | .wxParse-div { 21 | margin: 0; 22 | padding: 0; 23 | } 24 | 25 | .wxParse-h1 { 26 | font-size: 2em; 27 | margin: .67em 0; 28 | } 29 | 30 | .wxParse-h2 { 31 | font-size: 1.5em; 32 | margin: .75em 0; 33 | } 34 | 35 | .wxParse-h3 { 36 | font-size: 1.17em; 37 | margin: .83em 0; 38 | } 39 | 40 | .wxParse-h4 { 41 | margin: 1.12em 0; 42 | } 43 | 44 | .wxParse-h5 { 45 | font-size: .83em; 46 | margin: 1.5em 0; 47 | } 48 | 49 | .wxParse-h6 { 50 | font-size: .75em; 51 | margin: 1.67em 0; 52 | } 53 | 54 | .wxParse-h1 { 55 | font-size: 18px; 56 | font-weight: 400; 57 | margin-bottom: .9em; 58 | } 59 | 60 | .wxParse-h2 { 61 | font-size: 16px; 62 | font-weight: 400; 63 | margin-bottom: .34em; 64 | } 65 | 66 | .wxParse-h3 { 67 | font-weight: 400; 68 | font-size: 15px; 69 | margin-bottom: .34em; 70 | } 71 | 72 | .wxParse-h4 { 73 | font-weight: 400; 74 | font-size: 14px; 75 | margin-bottom: .24em; 76 | } 77 | 78 | .wxParse-h5 { 79 | font-weight: 400; 80 | font-size: 13px; 81 | margin-bottom: .14em; 82 | } 83 | 84 | .wxParse-h6 { 85 | font-weight: 400; 86 | font-size: 12px; 87 | margin-bottom: .04em; 88 | } 89 | 90 | .wxParse-h1,.wxParse-h2,.wxParse-h3,.wxParse-h4,.wxParse-h5,.wxParse-h6,.wxParse-b,.wxParse-strong { 91 | font-weight: bolder; 92 | } 93 | 94 | .wxParse-i,.wxParse-cite,.wxParse-em,.wxParse-var,.wxParse-address { 95 | font-style: italic; 96 | } 97 | 98 | .wxParse-pre,.wxParse-tt,.wxParse-code,.wxParse-kbd,.wxParse-samp { 99 | font-family: monospace; 100 | } 101 | 102 | .wxParse-pre { 103 | white-space: pre; 104 | } 105 | 106 | .wxParse-big { 107 | font-size: 1.17em; 108 | } 109 | 110 | .wxParse-small,.wxParse-sub,.wxParse-sup { 111 | font-size: .83em; 112 | } 113 | 114 | .wxParse-sub { 115 | vertical-align: sub; 116 | } 117 | 118 | .wxParse-sup { 119 | vertical-align: super; 120 | } 121 | 122 | .wxParse-s,.wxParse-strike,.wxParse-del { 123 | text-decoration: line-through; 124 | } 125 | 126 | .wxParse-strong,.wxParse-s { 127 | display: inline; 128 | } 129 | 130 | .wxParse-a { 131 | color: deepskyblue; 132 | word-break: break-all; 133 | overflow: auto; 134 | } 135 | 136 | .wxParse-video { 137 | text-align: center; 138 | margin: 10px 0; 139 | } 140 | 141 | .wxParse-video-video { 142 | width: 100%; 143 | } 144 | 145 | .wxParse-img { 146 | background-color: #efefef; 147 | overflow: hidden; 148 | } 149 | 150 | .wxParse-blockquote { 151 | margin: 0; 152 | padding: 10px 0 10px 5px; 153 | font-family: Courier,Calibri,"宋体"; 154 | background: #f5f5f5; 155 | border-left: 3px solid #dbdbdb; 156 | } 157 | 158 | .wxParse-code,.wxParse-wxxxcode-style { 159 | display: inline; 160 | background: #f5f5f5; 161 | } 162 | 163 | .wxParse-ul { 164 | margin: 20rpx 10rpx; 165 | } 166 | 167 | .wxParse-li,.wxParse-li-inner { 168 | display: flex; 169 | align-items: baseline; 170 | margin: 10rpx 0; 171 | } 172 | 173 | .wxParse-li-text { 174 | align-items: center; 175 | line-height: 20px; 176 | } 177 | 178 | .wxParse-li-circle { 179 | display: inline-flex; 180 | width: 5px; 181 | height: 5px; 182 | background-color: #333; 183 | margin-right: 5px; 184 | } 185 | 186 | .wxParse-li-square { 187 | display: inline-flex; 188 | width: 10rpx; 189 | height: 10rpx; 190 | background-color: #333; 191 | margin-right: 5px; 192 | } 193 | 194 | .wxParse-li-ring { 195 | display: inline-flex; 196 | width: 10rpx; 197 | height: 10rpx; 198 | border: 2rpx solid #333; 199 | border-radius: 50%; 200 | background-color: #fff; 201 | margin-right: 5px; 202 | } 203 | 204 | .wxParse-u { 205 | text-decoration: underline; 206 | } 207 | 208 | .wxParse-hide { 209 | display: none; 210 | } 211 | 212 | .WxEmojiView { 213 | align-items: center; 214 | } 215 | 216 | .wxEmoji { 217 | width: 16px; 218 | height: 16px; 219 | } 220 | 221 | .wxParse-tr { 222 | display: flex; 223 | border-right: 1px solid #e0e0e0; 224 | border-bottom: 1px solid #e0e0e0; 225 | border-top: 1px solid #e0e0e0; 226 | } 227 | 228 | .wxParse-th,.wxParse-td { 229 | flex: 1; 230 | padding: 5px; 231 | font-size: 28rpx; 232 | border-left: 1px solid #e0e0e0; 233 | word-break: break-all; 234 | } 235 | 236 | .wxParse-td:last { 237 | border-top: 1px solid #e0e0e0; 238 | } 239 | 240 | .wxParse-th { 241 | background: #f0f0f0; 242 | border-top: 1px solid #e0e0e0; 243 | } --------------------------------------------------------------------------------