├── .gitignore ├── LICENSE ├── README.md ├── app.js ├── app.json ├── app.wxss ├── common └── weui.wxss ├── icon ├── Capture1.jpeg ├── Capture2.jpeg ├── Capture3.jpeg ├── Capture4.jpeg ├── Capture5.jpeg ├── Capture6.jpeg ├── Capture7.jpeg ├── cake-1.png ├── cake-2.png ├── cart-1.png ├── cart-2.png ├── home-1.png ├── home-2.png ├── icon_more.png ├── my-1.png └── my-2.png ├── pages ├── buy │ ├── buy.js │ ├── buy.json │ ├── buy.wxml │ └── buy.wxss ├── cake │ ├── cake.js │ ├── cake.json │ ├── cake.wxml │ └── cake.wxss ├── cakeDetail │ ├── cakeDetail.js │ ├── cakeDetail.json │ ├── cakeDetail.wxml │ └── cakeDetail.wxss ├── cart │ ├── cart.js │ ├── cart.json │ ├── cart.wxml │ └── cart.wxss ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── login │ ├── login.js │ ├── login.json │ ├── login.wxml │ └── login.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss ├── order │ ├── order.js │ ├── order.json │ ├── order.wxml │ └── order.wxss ├── payment │ ├── payment.js │ ├── payment.json │ ├── payment.wxml │ └── payment.wxss ├── phone │ ├── phone.js │ ├── phone.json │ ├── phone.wxml │ └── phone.wxss ├── success │ ├── success.js │ ├── success.json │ ├── success.wxml │ └── success.wxss └── user │ ├── editaddress │ ├── editaddress.js │ ├── editaddress.json │ ├── editaddress.wxml │ └── editaddress.wxss │ ├── myaddress │ ├── myaddress.js │ ├── myaddress.json │ ├── myaddress.wxml │ └── myaddress.wxss │ ├── mycoupons │ ├── mycoupons.js │ ├── mycoupons.json │ ├── mycoupons.wxml │ └── mycoupons.wxss │ ├── myjzb │ ├── myjzb.js │ ├── myjzb.json │ ├── myjzb.wxml │ └── myjzb.wxss │ ├── myorder │ ├── myorder.js │ ├── myorder.json │ ├── myorder.wxml │ └── myorder.wxss │ ├── myorderdetals │ ├── myorderdetals.js │ ├── myorderdetals.json │ ├── myorderdetals.wxml │ └── myorderdetals.wxss │ ├── user.js │ ├── user.json │ ├── user.wxml │ └── user.wxss ├── project.config.json └── utils ├── common.js ├── jzData.js ├── preview.js └── util.js /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # phpstorm project files 3 | .idea 4 | .DS_STORE 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 yaleiliu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wxbestcake-master 2 | 电商类小程序 包含预览、购物车、添加地址、支付、购买等一系列完整的流程 3 | 4 | # 项目说明 5 | 6 | - **基于微信小程序开发的一款移动端电商** 7 | - **基于 weui.wxss、es6 前端技术开发** 8 | - **前台[wxbestcake-master](https://github.com/kuhami/wxbestcake-master)** 9 | 10 | ## 目录结构 11 | 12 | ``` 13 | wxbestcake-master/ 14 | |-pages/ # 小程序页面相关文件 15 | |- buy 16 | |- index.js 17 | |- index.json 18 | |- index.wxml 19 | |- index.wxss 20 | |- ... 21 | |-app.js # 小程序逻辑 22 | |-app.json # 小程序公共设置 23 | |-app.wxss # 小程序公共样式表 24 | |-... 25 | ``` 26 | 27 | ## Usage 28 | 29 | ```bash 30 | $ git clone https://github.com/kuhami/wxbestcake-master.git 31 | $ cd wxbestcake-master 32 | //导入微信开发者工具就可以啦 33 | ``` 34 | ## 商城截图 35 | 36 |

37 | 38 |

39 | 40 |

41 | 42 |

43 | 44 |

45 | 46 |

47 | 48 |

49 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | version: { 4 | key: "version", 5 | current: "1.0.2", 6 | getValue: function () { 7 | return wx.getStorageSync(this.key); 8 | } 9 | }, 10 | path: { 11 | res: "https://res.bestcake.com/", 12 | //www: "https://mcstj.bestcake.com/" 13 | www:"http://localhost:9419/" 14 | }, 15 | user: { 16 | userid: 0,//用户ID 17 | sessionid: "",//秘钥 18 | jzb: 0, 19 | exp: 0, 20 | phone: "", 21 | levels: 0, 22 | headimg: "", 23 | islogin: function (tp) { 24 | var re = false; 25 | if (this.userid > 0) { 26 | re = true; 27 | } else { 28 | if (tp == true) { 29 | wx.navigateTo({ 30 | url: '../phone/phone' 31 | }) 32 | } 33 | } 34 | return re; 35 | }, 36 | key: "userkey", 37 | setCache: function (obj) { 38 | wx.setStorageSync(this.key, obj); 39 | }, 40 | getCache: function () { 41 | return wx.getStorageSync(this.key); 42 | }, 43 | clear: function () { 44 | wx.removeStorageSync(this.key); 45 | } 46 | }, 47 | city: { 48 | 49 | }, 50 | cart: { 51 | key: "cart", 52 | ref: "", 53 | add: function (p) { 54 | var re = false; 55 | if (p.supplyno && p.price && p.size && p.name && p.num) { 56 | var dic = wx.getStorageSync(this.key) || {}; 57 | if (p.supplyno in dic) { 58 | dic[p.supplyno].num += p.num; 59 | } else { 60 | dic[p.supplyno] = { name: p.name, price: p.price, size: p.size, num: p.num, brand: p.brand } 61 | } 62 | wx.setStorageSync(this.key, dic); 63 | re = true; 64 | } 65 | return re; 66 | }, 67 | exist: function (sno) { 68 | var re = false; 69 | var dic = wx.getStorageSync(this.key) || {}; 70 | if (sno in dic) { 71 | re = true; 72 | } 73 | return re; 74 | }, 75 | remove: function (sno) { 76 | var dic = wx.getStorageSync(this.key) || {}; 77 | if (sno in dic) { 78 | delete dic[sno]; 79 | wx.setStorageSync(this.key, dic); 80 | } 81 | }, 82 | getNum: function () { 83 | var n = 0; 84 | var dic = wx.getStorageSync(this.key) || {} 85 | for (var i in dic) { 86 | n += dic[i].num; 87 | } 88 | return n; 89 | }, 90 | num: function (sno, n) { 91 | var dic = wx.getStorageSync(this.key) || {}; 92 | if (sno in dic) { 93 | if (n > 0) { 94 | dic[sno].num = n; 95 | } else { 96 | delete dic[sno]; 97 | } 98 | wx.setStorageSync(this.key, dic); 99 | } 100 | }, 101 | getList: function () { 102 | var list = []; 103 | var dic = wx.getStorageSync(this.key); 104 | for (var p in dic) { 105 | list.push({ supplyno: p, name: dic[p].name, price: dic[p].price, size: dic[p].size, num: dic[p].num, brand: dic[p].brand }); 106 | } 107 | return list; 108 | }, 109 | clear: function () { 110 | wx.removeStorageSync(this.key); 111 | } 112 | }, 113 | cake: { 114 | tab: null, 115 | key: "cake", 116 | setCache: function (obj) { 117 | wx.setStorageSync(this.key, obj); 118 | var vs = getApp().version; 119 | wx.setStorageSync(vs.key, vs.current);//设置当前版本号 120 | }, 121 | getCache: function () { 122 | return wx.getStorageSync(this.key); 123 | }, 124 | getByName: function (nm) { 125 | var p = null; 126 | var dic = wx.getStorageSync(this.key) || {}; 127 | if (nm in dic) { 128 | p = dic[nm]; 129 | } 130 | return p; 131 | } 132 | }, 133 | onLaunch: function () { 134 | //调用API从本地缓存中获取数据 135 | var _this = this; 136 | var obj = _this.user.getCache("userkey"); 137 | if (obj != null) { 138 | _this.user.userid = obj.userid; 139 | _this.user.sessionid = obj.sessionid; 140 | _this.user.jzb = obj.jzb; 141 | _this.user.exp = obj.exp; 142 | _this.user.phone = obj.phone; 143 | _this.user.levels = obj.levels; 144 | _this.user.headimg = obj.headimg; 145 | 146 | } 147 | }, 148 | onLoad: function () { 149 | 150 | }, 151 | onShow: function () { 152 | var rrr = 1; 153 | }, 154 | onHide: function () { 155 | var rrr = 1; 156 | }, 157 | getUserInfo: function (cb) { 158 | var that = this 159 | if (this.globalData.userInfo) { 160 | typeof cb == "function" && cb(this.globalData.userInfo) 161 | } else { 162 | //调用登录接口 163 | wx.login({ 164 | success: function (v) { 165 | console.log(v); 166 | wx.getUserInfo({ 167 | success: function (res) { 168 | console.log(res); 169 | that.globalData.userInfo = res.userInfo 170 | typeof cb == "function" && cb(that.globalData.userInfo) 171 | } 172 | }) 173 | } 174 | }) 175 | } 176 | }, 177 | globalData: { 178 | userInfo: null 179 | }, 180 | current: function () { 181 | var list = getCurrentPages(); 182 | return list[list.length - 1]; 183 | }, 184 | load: function (p) { 185 | p = p ? p : {}; 186 | var _obj = {//标准化 187 | data: { 188 | }, 189 | }; 190 | var base = { "onLoad": function () { }, "onReady": function () { }, "onShow": function () { }, "onHide": function () { }, "onUnload": function () { } }; 191 | for (var i in base) { 192 | _obj[i] = (function (etype) { 193 | var _etype = "_" + etype; 194 | if (etype in p) { 195 | _obj[_etype] = p[i];//重写局部定义 196 | }; 197 | return function (e) { 198 | base[etype]();//执行 global 199 | _obj[_etype] && _obj[_etype](e); 200 | } 201 | })(i) 202 | }; 203 | for (var o in p) { 204 | if (!(o in base)) { 205 | if (o == "data") { 206 | for (var d in p[o]) { 207 | _obj.data[d] = p[o][d]; 208 | } 209 | } else { 210 | _obj[o] = p[o]; 211 | } 212 | } 213 | }; 214 | Page(_obj); 215 | }, 216 | modal: function (p) { 217 | wx.showModal(p); 218 | }, 219 | toast: function (p) { 220 | wx.showToast(p); 221 | }, 222 | loading: (function () { 223 | return { 224 | show: function (p) { 225 | p = p ? p : {}; 226 | wx.showToast({ 227 | title: p.title || '加载中', 228 | icon: 'loading', 229 | duration: p.duration || 10000 230 | }) 231 | }, 232 | hide: function () { 233 | wx.hideToast(); 234 | } 235 | } 236 | })(), 237 | get: function (p, suc, tit) { 238 | var _this = this; 239 | //var loaded = false;//请求状态 240 | _this.loading.show({ title: tit }); 241 | // setTimeout(function () { 242 | // if (!loaded) { 243 | // _this.loading.show(); 244 | // } 245 | // }, 500); 246 | if (_this.user.islogin()) { 247 | p.userid = _this.user.userid; 248 | p.sessionid = _this.user.sessionid; 249 | } 250 | wx.request({ 251 | url: this.path.www + 'client.ashx?v=' + Math.random(), 252 | data: p, 253 | header: { 254 | 'Content-Type': 'application/json' 255 | }, 256 | method: "GET", 257 | success: function (res) { 258 | suc(res); 259 | }, 260 | fail: function (e) { 261 | _this.toast({ title: "请求出错!" }) 262 | }, 263 | complete: function () { 264 | //loaded = true;//完成 265 | _this.loading.hide(); 266 | } 267 | }) 268 | }, 269 | post: function (p, suc) { 270 | var _this = this; 271 | var loaded = false;//请求状态 272 | setTimeout(function () { 273 | if (!loaded) { 274 | _this.loading.show(); 275 | } 276 | }, 500); 277 | if (_this.user.islogin()) { 278 | p.userid = _this.user.userid; 279 | p.sessionid = _this.user.sessionid; 280 | } 281 | wx.request({ 282 | url: this.path.www + 'client.ashx', 283 | data: _this.json2Form(p), 284 | header: { 285 | // 'Content-Type': 'application/json' 286 | "Content-Type": "application/x-www-form-urlencoded" 287 | }, 288 | method: "POST", 289 | success: function (res) { 290 | suc(res); 291 | }, 292 | fail: function (e) { 293 | _this.toast({ title: "请求出错!" }) 294 | }, 295 | complete: function () { 296 | loaded = true;//完成 297 | _this.loading.hide(); 298 | } 299 | }) 300 | }, 301 | json2Form: function (json) { 302 | var str = []; 303 | for (var p in json) { 304 | str.push(encodeURIComponent(p) + "=" + encodeURIComponent(json[p])); 305 | } 306 | return str.join("&"); 307 | } 308 | }); -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/index", 4 | "pages/success/success", 5 | "pages/payment/payment", 6 | "pages/order/order", 7 | "pages/cake/cake", 8 | "pages/cakeDetail/cakeDetail", 9 | "pages/buy/buy", 10 | "pages/phone/phone", 11 | "pages/cart/cart", 12 | "pages/user/user", 13 | "pages/login/login", 14 | "pages/logs/logs", 15 | "pages/user/myorder/myorder", 16 | "pages/user/myjzb/myjzb", 17 | "pages/user/myorderdetals/myorderdetals", 18 | "pages/user/myaddress/myaddress", 19 | "pages/user/mycoupons/mycoupons", 20 | "pages/user/editaddress/editaddress" 21 | ], 22 | "window": { 23 | "backgroundTextStyle": "dark", 24 | "navigationBarBackgroundColor": "#576b95", 25 | "navigationBarTitleText": "BigCake", 26 | "navigationBarTextStyle": "white" 27 | }, 28 | "tabBar": { 29 | "list": [ 30 | { 31 | "pagePath": "pages/index/index", 32 | "text": "首页", 33 | "iconPath": "icon/home-1.png", 34 | "selectedIconPath": "icon/home-2.png" 35 | }, 36 | { 37 | "pagePath": "pages/cake/cake", 38 | "text": "蛋糕馆", 39 | "iconPath": "icon/cake-1.png", 40 | "selectedIconPath": "icon/cake-2.png" 41 | }, 42 | { 43 | "pagePath": "pages/cart/cart", 44 | "text": "购物车", 45 | "iconPath": "icon/cart-1.png", 46 | "selectedIconPath": "icon/cart-2.png" 47 | }, 48 | { 49 | "pagePath": "pages/user/user", 50 | "text": "我的", 51 | "iconPath": "icon/my-1.png", 52 | "selectedIconPath": "icon/my-2.png" 53 | } 54 | ], 55 | "backgroundColor": "#f3f3f3", 56 | "color": "#999", 57 | "selectedColor": "#576b95" 58 | }, 59 | "networkTimeout": { 60 | "request": 10000, 61 | "downloadFile": 10000, 62 | "uploadFile": 10000 63 | } 64 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | @import "common/weui.wxss"; 3 | /*.cityselect{position: fixed;z-index: 1000; height: 30px;line-height: 30px; text-align: center; width:200px; left:-1px;top: -30px;background: #000;opacity: 0.4;border: 1px solid #fff; border-radius: 0 15px 15px 0;}*/ -------------------------------------------------------------------------------- /common/weui.wxss: -------------------------------------------------------------------------------- 1 | /*! 2 | * weui.js v1.1.0 (https://github.com/weui/weui-wxss) 3 | * Copyright 2016, wechat ui team 4 | * MIT license 5 | */ 6 | page { 7 | line-height: 1.6; 8 | font-family: -apple-system-font, "Helvetica Neue", sans-serif; 9 | } 10 | icon { 11 | vertical-align: middle; 12 | } 13 | .weui-cells { 14 | position: relative; 15 | margin-top: 1.17647059em; 16 | background-color: #FFFFFF; 17 | line-height: 1.41176471; 18 | font-size: 17px; 19 | } 20 | .weui-cells:before { 21 | content: " "; 22 | position: absolute; 23 | left: 0; 24 | top: 0; 25 | right: 0; 26 | height: 1px; 27 | border-top: 1rpx solid #D9D9D9; 28 | color: #D9D9D9; 29 | } 30 | .weui-cells:after { 31 | content: " "; 32 | position: absolute; 33 | left: 0; 34 | bottom: 0; 35 | right: 0; 36 | height: 1px; 37 | border-bottom: 1rpx solid #D9D9D9; 38 | color: #D9D9D9; 39 | } 40 | .weui-cells__title { 41 | margin-top: .77em; 42 | margin-bottom: .3em; 43 | padding-left: 15px; 44 | padding-right: 15px; 45 | color: #999999; 46 | font-size: 14px; 47 | } 48 | .weui-cells_after-title { 49 | margin-top: 0; 50 | } 51 | .weui-cells__tips { 52 | margin-top: .3em; 53 | color: #999999; 54 | padding-left: 15px; 55 | padding-right: 15px; 56 | font-size: 14px; 57 | } 58 | .weui-cell { 59 | padding: 10px 15px; 60 | position: relative; 61 | display: -webkit-box; 62 | display: -webkit-flex; 63 | display: flex; 64 | -webkit-box-align: center; 65 | -webkit-align-items: center; 66 | align-items: center; 67 | } 68 | .weui-cell:before { 69 | content: " "; 70 | position: absolute; 71 | left: 0; 72 | top: 0; 73 | right: 0; 74 | height: 1px; 75 | border-top: 1rpx solid #D9D9D9; 76 | color: #D9D9D9; 77 | left: 15px; 78 | } 79 | .weui-cell:first-child:before { 80 | display: none; 81 | } 82 | .weui-cell_active { 83 | background-color: #ECECEC; 84 | } 85 | .weui-cell_primary { 86 | -webkit-box-align: start; 87 | -webkit-align-items: flex-start; 88 | align-items: flex-start; 89 | } 90 | .weui-cell__bd { 91 | -webkit-box-flex: 1; 92 | -webkit-flex: 1; 93 | flex: 1; 94 | } 95 | .weui-cell__ft { 96 | text-align: right; 97 | color: #999999; 98 | } 99 | .weui-cell_access { 100 | color: inherit; 101 | } 102 | .weui-cell__ft_in-access { 103 | padding-right: 13px; 104 | position: relative; 105 | } 106 | .weui-cell__ft_in-access:after { 107 | content: " "; 108 | display: inline-block; 109 | height: 6px; 110 | width: 6px; 111 | border-width: 2px 2px 0 0; 112 | border-color: #C8C8CD; 113 | border-style: solid; 114 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 115 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 116 | position: relative; 117 | top: -2px; 118 | position: absolute; 119 | top: 50%; 120 | margin-top: -4px; 121 | right: 2px; 122 | } 123 | .weui-cell_link { 124 | color: #586C94; 125 | font-size: 14px; 126 | } 127 | .weui-cell_link:active { 128 | background-color: #ECECEC; 129 | } 130 | .weui-cell_link:first-child:before { 131 | display: block; 132 | } 133 | .weui-icon-radio { 134 | margin-left: 3.2px; 135 | margin-right: 3.2px; 136 | } 137 | .weui-icon-checkbox_circle, 138 | .weui-icon-checkbox_success { 139 | margin-left: 4.6px; 140 | margin-right: 4.6px; 141 | } 142 | .weui-check__label:active { 143 | background-color: #ECECEC; 144 | } 145 | .weui-check { 146 | position: absolute; 147 | left: -9999px; 148 | } 149 | .weui-check__hd_in-checkbox { 150 | padding-right: 0.35em; 151 | } 152 | .weui-cell__ft_in-radio { 153 | padding-left: 0.35em; 154 | } 155 | .weui-cell_input { 156 | padding-top: 0; 157 | padding-bottom: 0; 158 | } 159 | .weui-label { 160 | width: 105px; 161 | word-wrap: break-word; 162 | word-break: break-all; 163 | } 164 | .weui-input { 165 | height: 2.58823529em; 166 | min-height: 2.58823529em; 167 | line-height: 2.58823529em; 168 | } 169 | .weui-toptips { 170 | position: fixed; 171 | -webkit-transform: translateZ(0); 172 | transform: translateZ(0); 173 | top: 0; 174 | left: 0; 175 | right: 0; 176 | padding: 5px; 177 | font-size: 14px; 178 | text-align: center; 179 | color: #FFFFFF; 180 | z-index: 5000; 181 | word-wrap: break-word; 182 | word-break: break-all; 183 | } 184 | .weui-toptips_warn { 185 | background-color: #E64340; 186 | } 187 | .weui-textarea { 188 | display: block; 189 | width: 100%; 190 | } 191 | .weui-textarea-counter { 192 | color: #B2B2B2; 193 | text-align: right; 194 | } 195 | .weui-textarea-counter_warn { 196 | color: #E64340; 197 | } 198 | .weui-cell_warn { 199 | color: #E64340; 200 | } 201 | .weui-form-preview { 202 | position: relative; 203 | background-color: #FFFFFF; 204 | } 205 | .weui-form-preview:before { 206 | content: " "; 207 | position: absolute; 208 | left: 0; 209 | top: 0; 210 | right: 0; 211 | height: 1px; 212 | border-top: 1rpx solid #D9D9D9; 213 | color: #D9D9D9; 214 | } 215 | .weui-form-preview:after { 216 | content: " "; 217 | position: absolute; 218 | left: 0; 219 | bottom: 0; 220 | right: 0; 221 | height: 1px; 222 | border-bottom: 1rpx solid #D9D9D9; 223 | color: #D9D9D9; 224 | } 225 | .weui-form-preview__value { 226 | font-size: 14px; 227 | } 228 | .weui-form-preview__value_in-hd { 229 | font-size: 26px; 230 | } 231 | .weui-form-preview__hd { 232 | position: relative; 233 | padding: 10px 15px; 234 | text-align: right; 235 | line-height: 2.5em; 236 | } 237 | .weui-form-preview__hd:after { 238 | content: " "; 239 | position: absolute; 240 | left: 0; 241 | bottom: 0; 242 | right: 0; 243 | height: 1px; 244 | border-bottom: 1rpx solid #D9D9D9; 245 | color: #D9D9D9; 246 | left: 15px; 247 | } 248 | .weui-form-preview__bd { 249 | padding: 10px 15px; 250 | font-size: .9em; 251 | text-align: right; 252 | color: #999999; 253 | line-height: 2; 254 | } 255 | .weui-form-preview__ft { 256 | position: relative; 257 | line-height: 50px; 258 | display: -webkit-box; 259 | display: -webkit-flex; 260 | display: flex; 261 | } 262 | .weui-form-preview__ft:after { 263 | content: " "; 264 | position: absolute; 265 | left: 0; 266 | top: 0; 267 | right: 0; 268 | height: 1px; 269 | border-top: 1rpx solid #D5D5D6; 270 | color: #D5D5D6; 271 | } 272 | .weui-form-preview__item { 273 | overflow: hidden; 274 | } 275 | .weui-form-preview__label { 276 | float: left; 277 | margin-right: 1em; 278 | min-width: 4em; 279 | color: #999999; 280 | text-align: justify; 281 | text-align-last: justify; 282 | } 283 | .weui-form-preview__value { 284 | display: block; 285 | overflow: hidden; 286 | word-break: normal; 287 | word-wrap: break-word; 288 | } 289 | .weui-form-preview__btn { 290 | position: relative; 291 | display: block; 292 | -webkit-box-flex: 1; 293 | -webkit-flex: 1; 294 | flex: 1; 295 | color: #3CC51F; 296 | text-align: center; 297 | } 298 | .weui-form-preview__btn:after { 299 | content: " "; 300 | position: absolute; 301 | left: 0; 302 | top: 0; 303 | width: 1px; 304 | bottom: 0; 305 | border-left: 1rpx solid #D5D5D6; 306 | color: #D5D5D6; 307 | } 308 | .weui-form-preview__btn:first-child:after { 309 | display: none; 310 | } 311 | .weui-form-preview__btn_active { 312 | background-color: #EEEEEE; 313 | } 314 | .weui-form-preview__btn_default { 315 | color: #999999; 316 | } 317 | .weui-form-preview__btn_primary { 318 | color: #0BB20C; 319 | } 320 | .weui-cell_select { 321 | padding: 0; 322 | } 323 | .weui-select { 324 | position: relative; 325 | padding-left: 15px; 326 | padding-right: 30px; 327 | height: 2.58823529em; 328 | min-height: 2.58823529em; 329 | line-height: 2.58823529em; 330 | border-right: 1rpx solid #D9D9D9; 331 | } 332 | .weui-select:before { 333 | content: " "; 334 | display: inline-block; 335 | height: 6px; 336 | width: 6px; 337 | border-width: 2px 2px 0 0; 338 | border-color: #C8C8CD; 339 | border-style: solid; 340 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 341 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 342 | position: relative; 343 | top: -2px; 344 | position: absolute; 345 | top: 50%; 346 | right: 15px; 347 | margin-top: -4px; 348 | } 349 | .weui-select_in-select-after { 350 | padding-left: 0; 351 | } 352 | .weui-cell__hd_in-select-after, 353 | .weui-cell__bd_in-select-before { 354 | padding-left: 15px; 355 | } 356 | .weui-cell_vcode { 357 | padding-right: 0; 358 | } 359 | .weui-vcode-img { 360 | margin-left: 5px; 361 | height: 2.58823529em; 362 | vertical-align: middle; 363 | } 364 | .weui-vcode-btn { 365 | display: inline-block; 366 | height: 2.58823529em; 367 | margin-left: 5px; 368 | padding: 0 0.6em 0 0.7em; 369 | border-left: 1px solid #E5E5E5; 370 | line-height: 2.58823529em; 371 | vertical-align: middle; 372 | font-size: 17px; 373 | color: #3CC51F; 374 | white-space: nowrap; 375 | } 376 | .weui-vcode-btn:active { 377 | color: #52a341; 378 | } 379 | .weui-cell_switch { 380 | padding-top: 6px; 381 | padding-bottom: 6px; 382 | } 383 | .weui-uploader__hd { 384 | display: -webkit-box; 385 | display: -webkit-flex; 386 | display: flex; 387 | padding-bottom: 10px; 388 | -webkit-box-align: center; 389 | -webkit-align-items: center; 390 | align-items: center; 391 | } 392 | .weui-uploader__title { 393 | -webkit-box-flex: 1; 394 | -webkit-flex: 1; 395 | flex: 1; 396 | } 397 | .weui-uploader__info { 398 | color: #B2B2B2; 399 | } 400 | .weui-uploader__bd { 401 | margin-bottom: -4px; 402 | margin-right: -9px; 403 | overflow: hidden; 404 | } 405 | .weui-uploader__file { 406 | float: left; 407 | margin-right: 9px; 408 | margin-bottom: 9px; 409 | } 410 | .weui-uploader__img { 411 | display: block; 412 | width: 79px; 413 | height: 79px; 414 | } 415 | .weui-uploader__file_status { 416 | position: relative; 417 | } 418 | .weui-uploader__file_status:before { 419 | content: " "; 420 | position: absolute; 421 | top: 0; 422 | right: 0; 423 | bottom: 0; 424 | left: 0; 425 | background-color: rgba(0, 0, 0, 0.5); 426 | } 427 | .weui-uploader__file-content { 428 | position: absolute; 429 | top: 50%; 430 | left: 50%; 431 | -webkit-transform: translate(-50%, -50%); 432 | transform: translate(-50%, -50%); 433 | color: #FFFFFF; 434 | } 435 | .weui-uploader__input-box { 436 | float: left; 437 | position: relative; 438 | margin-right: 9px; 439 | margin-bottom: 9px; 440 | width: 77px; 441 | height: 77px; 442 | border: 1px solid #D9D9D9; 443 | } 444 | .weui-uploader__input-box:before, 445 | .weui-uploader__input-box:after { 446 | content: " "; 447 | position: absolute; 448 | top: 50%; 449 | left: 50%; 450 | -webkit-transform: translate(-50%, -50%); 451 | transform: translate(-50%, -50%); 452 | background-color: #D9D9D9; 453 | } 454 | .weui-uploader__input-box:before { 455 | width: 2px; 456 | height: 39.5px; 457 | } 458 | .weui-uploader__input-box:after { 459 | width: 39.5px; 460 | height: 2px; 461 | } 462 | .weui-uploader__input-box:active { 463 | border-color: #999999; 464 | } 465 | .weui-uploader__input-box:active:before, 466 | .weui-uploader__input-box:active:after { 467 | background-color: #999999; 468 | } 469 | .weui-uploader__input { 470 | position: absolute; 471 | z-index: 1; 472 | top: 0; 473 | left: 0; 474 | width: 100%; 475 | height: 100%; 476 | opacity: 0; 477 | } 478 | .weui-article { 479 | padding: 20px 15px; 480 | font-size: 15px; 481 | } 482 | .weui-article__section { 483 | margin-bottom: 1.5em; 484 | } 485 | .weui-article__h1 { 486 | font-size: 18px; 487 | font-weight: 400; 488 | margin-bottom: .9em; 489 | } 490 | .weui-article__h2 { 491 | font-size: 16px; 492 | font-weight: 400; 493 | margin-bottom: .34em; 494 | } 495 | .weui-article__h3 { 496 | font-weight: 400; 497 | font-size: 15px; 498 | margin-bottom: .34em; 499 | } 500 | .weui-article__p { 501 | margin: 0 0 .8em; 502 | } 503 | .weui-msg { 504 | padding-top: 36px; 505 | text-align: center; 506 | } 507 | .weui-msg__link { 508 | display: inline; 509 | color: #586C94; 510 | } 511 | .weui-msg__icon-area { 512 | margin-bottom: 30px; 513 | } 514 | .weui-msg__text-area { 515 | margin-bottom: 25px; 516 | padding: 0 20px; 517 | } 518 | .weui-msg__title { 519 | margin-bottom: 5px; 520 | font-weight: 400; 521 | font-size: 20px; 522 | } 523 | .weui-msg__desc { 524 | font-size: 14px; 525 | color: #999999; 526 | } 527 | .weui-msg__opr-area { 528 | margin-bottom: 25px; 529 | } 530 | .weui-msg__extra-area { 531 | margin-bottom: 15px; 532 | font-size: 14px; 533 | color: #999999; 534 | } 535 | @media screen and (min-height: 438px) { 536 | .weui-msg__extra-area { 537 | position: fixed; 538 | left: 0; 539 | bottom: 0; 540 | width: 100%; 541 | text-align: center; 542 | } 543 | } 544 | .weui-flex { 545 | display: -webkit-box; 546 | display: -webkit-flex; 547 | display: flex; 548 | } 549 | .weui-flex__item { 550 | -webkit-box-flex: 1; 551 | -webkit-flex: 1; 552 | flex: 1; 553 | } 554 | .weui-btn { 555 | margin-top: 15px; 556 | } 557 | .weui-btn:first-child { 558 | margin-top: 0; 559 | } 560 | .weui-btn-area { 561 | margin: 1.17647059em 15px 0.3em; 562 | } 563 | .weui-agree { 564 | display: block; 565 | padding: .5em 15px; 566 | font-size: 13px; 567 | } 568 | .weui-agree__text { 569 | color: #999999; 570 | } 571 | .weui-agree__link { 572 | display: inline; 573 | color: #586C94; 574 | } 575 | .weui-agree__checkbox { 576 | position: absolute; 577 | left: -9999px; 578 | } 579 | .weui-agree__checkbox-icon { 580 | position: relative; 581 | top: 2px; 582 | display: inline-block; 583 | border: 1px solid #D1D1D1; 584 | background-color: #FFFFFF; 585 | border-radius: 3px; 586 | width: 11px; 587 | height: 11px; 588 | } 589 | .weui-agree__checkbox-icon-check { 590 | position: absolute; 591 | top: 1px; 592 | left: 1px; 593 | } 594 | .weui-footer { 595 | color: #999999; 596 | font-size: 14px; 597 | text-align: center; 598 | } 599 | .weui-footer_fixed-bottom { 600 | position: fixed; 601 | bottom: .52em; 602 | left: 0; 603 | right: 0; 604 | } 605 | .weui-footer__links { 606 | font-size: 0; 607 | } 608 | .weui-footer__link { 609 | display: inline-block; 610 | vertical-align: top; 611 | margin: 0 .62em; 612 | position: relative; 613 | font-size: 14px; 614 | color: #586C94; 615 | } 616 | .weui-footer__link:before { 617 | content: " "; 618 | position: absolute; 619 | left: 0; 620 | top: 0; 621 | width: 1px; 622 | bottom: 0; 623 | border-left: 1rpx solid #C7C7C7; 624 | color: #C7C7C7; 625 | left: -0.65em; 626 | top: .36em; 627 | bottom: .36em; 628 | } 629 | .weui-footer__link:first-child:before { 630 | display: none; 631 | } 632 | .weui-footer__text { 633 | padding: 0 .34em; 634 | font-size: 12px; 635 | } 636 | .weui-grids { 637 | border-top: 1rpx solid #D9D9D9; 638 | border-left: 1rpx solid #D9D9D9; 639 | overflow: hidden; 640 | } 641 | .weui-grid { 642 | position: relative; 643 | float: left; 644 | padding: 20px 10px; 645 | width: 33.33333333%; 646 | box-sizing: border-box; 647 | border-right: 1rpx solid #D9D9D9; 648 | border-bottom: 1rpx solid #D9D9D9; 649 | } 650 | .weui-grid_active { 651 | background-color: #ECECEC; 652 | } 653 | .weui-grid__icon { 654 | display: block; 655 | width: 28px; 656 | height: 28px; 657 | margin: 0 auto; 658 | } 659 | .weui-grid__label { 660 | margin-top: 5px; 661 | display: block; 662 | text-align: center; 663 | color: #000000; 664 | font-size: 14px; 665 | white-space: nowrap; 666 | text-overflow: ellipsis; 667 | overflow: hidden; 668 | } 669 | .weui-loading { 670 | margin: 0 5px; 671 | width: 20px; 672 | height: 20px; 673 | display: inline-block; 674 | vertical-align: middle; 675 | -webkit-animation: weuiLoading 1s steps(12, end) infinite; 676 | animation: weuiLoading 1s steps(12, end) infinite; 677 | background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat; 678 | background-size: 100%; 679 | } 680 | @-webkit-keyframes weuiLoading { 681 | 0% { 682 | -webkit-transform: rotate3d(0, 0, 1, 0deg); 683 | transform: rotate3d(0, 0, 1, 0deg); 684 | } 685 | 100% { 686 | -webkit-transform: rotate3d(0, 0, 1, 360deg); 687 | transform: rotate3d(0, 0, 1, 360deg); 688 | } 689 | } 690 | @keyframes weuiLoading { 691 | 0% { 692 | -webkit-transform: rotate3d(0, 0, 1, 0deg); 693 | transform: rotate3d(0, 0, 1, 0deg); 694 | } 695 | 100% { 696 | -webkit-transform: rotate3d(0, 0, 1, 360deg); 697 | transform: rotate3d(0, 0, 1, 360deg); 698 | } 699 | } 700 | .weui-badge { 701 | display: inline-block; 702 | padding: .15em .4em; 703 | min-width: 8px; 704 | border-radius: 18px; 705 | background-color: #F43530; 706 | color: #FFFFFF; 707 | line-height: 1.2; 708 | text-align: center; 709 | font-size: 12px; 710 | vertical-align: middle; 711 | } 712 | .weui-badge_dot { 713 | padding: .4em; 714 | min-width: 0; 715 | } 716 | .weui-loadmore { 717 | width: 65%; 718 | margin: 1.5em auto; 719 | line-height: 1.6em; 720 | font-size: 14px; 721 | text-align: center; 722 | } 723 | .weui-loadmore__tips { 724 | display: inline-block; 725 | vertical-align: middle; 726 | } 727 | .weui-loadmore_line { 728 | border-top: 1px solid #E5E5E5; 729 | margin-top: 2.4em; 730 | } 731 | .weui-loadmore__tips_in-line { 732 | position: relative; 733 | top: -0.9em; 734 | padding: 0 .55em; 735 | background-color: #FFFFFF; 736 | color: #999999; 737 | } 738 | .weui-loadmore__tips_in-dot { 739 | position: relative; 740 | padding: 0 .16em; 741 | width: 4px; 742 | height: 1.6em; 743 | } 744 | .weui-loadmore__tips_in-dot:before { 745 | content: " "; 746 | position: absolute; 747 | top: 50%; 748 | left: 50%; 749 | margin-top: -1px; 750 | margin-left: -2px; 751 | width: 4px; 752 | height: 4px; 753 | border-radius: 50%; 754 | background-color: #E5E5E5; 755 | } 756 | .weui-panel { 757 | background-color: #FFFFFF; 758 | margin-top: 10px; 759 | position: relative; 760 | overflow: hidden; 761 | } 762 | .weui-panel:first-child { 763 | margin-top: 0; 764 | } 765 | .weui-panel:before { 766 | content: " "; 767 | position: absolute; 768 | left: 0; 769 | top: 0; 770 | right: 0; 771 | height: 1px; 772 | border-top: 1rpx solid #E5E5E5; 773 | color: #E5E5E5; 774 | } 775 | .weui-panel:after { 776 | content: " "; 777 | position: absolute; 778 | left: 0; 779 | bottom: 0; 780 | right: 0; 781 | height: 1px; 782 | border-bottom: 1rpx solid #E5E5E5; 783 | color: #E5E5E5; 784 | } 785 | .weui-panel__hd { 786 | padding: 14px 15px 10px; 787 | color: #999999; 788 | font-size: 13px; 789 | position: relative; 790 | } 791 | .weui-panel__hd:after { 792 | content: " "; 793 | position: absolute; 794 | left: 0; 795 | bottom: 0; 796 | right: 0; 797 | height: 1px; 798 | border-bottom: 1rpx solid #E5E5E5; 799 | color: #E5E5E5; 800 | left: 15px; 801 | } 802 | .weui-media-box { 803 | padding: 15px; 804 | position: relative; 805 | } 806 | .weui-media-box:before { 807 | content: " "; 808 | position: absolute; 809 | left: 0; 810 | top: 0; 811 | right: 0; 812 | height: 1px; 813 | border-top: 1rpx solid #E5E5E5; 814 | color: #E5E5E5; 815 | left: 15px; 816 | } 817 | .weui-media-box:first-child:before { 818 | display: none; 819 | } 820 | .weui-media-box__title { 821 | font-weight: 400; 822 | font-size: 17px; 823 | width: auto; 824 | overflow: hidden; 825 | text-overflow: ellipsis; 826 | white-space: nowrap; 827 | word-wrap: normal; 828 | word-wrap: break-word; 829 | word-break: break-all; 830 | } 831 | .weui-media-box__desc { 832 | color: #999999; 833 | font-size: 13px; 834 | line-height: 1.2; 835 | overflow: hidden; 836 | text-overflow: ellipsis; 837 | display: -webkit-box; 838 | -webkit-box-orient: vertical; 839 | -webkit-line-clamp: 2; 840 | } 841 | .weui-media-box__info { 842 | margin-top: 15px; 843 | padding-bottom: 5px; 844 | font-size: 13px; 845 | color: #CECECE; 846 | line-height: 1em; 847 | list-style: none; 848 | overflow: hidden; 849 | } 850 | .weui-media-box__info__meta { 851 | float: left; 852 | padding-right: 1em; 853 | } 854 | .weui-media-box__info__meta_extra { 855 | padding-left: 1em; 856 | border-left: 1px solid #CECECE; 857 | } 858 | .weui-media-box__title_in-text { 859 | margin-bottom: 8px; 860 | } 861 | .weui-media-box_appmsg { 862 | display: -webkit-box; 863 | display: -webkit-flex; 864 | display: flex; 865 | -webkit-box-align: center; 866 | -webkit-align-items: center; 867 | align-items: center; 868 | } 869 | .weui-media-box__thumb { 870 | width: 100%; 871 | height: 100%; 872 | vertical-align: top; 873 | } 874 | .weui-media-box__hd_in-appmsg { 875 | margin-right: .8em; 876 | width: 60px; 877 | height: 60px; 878 | line-height: 60px; 879 | text-align: center; 880 | } 881 | .weui-media-box__bd_in-appmsg { 882 | -webkit-box-flex: 1; 883 | -webkit-flex: 1; 884 | flex: 1; 885 | min-width: 0; 886 | } 887 | .weui-media-box_small-appmsg { 888 | padding: 0; 889 | } 890 | .weui-cells_in-small-appmsg { 891 | margin-top: 0; 892 | } 893 | .weui-cells_in-small-appmsg:before { 894 | display: none; 895 | } 896 | .weui-progress { 897 | display: -webkit-box; 898 | display: -webkit-flex; 899 | display: flex; 900 | -webkit-box-align: center; 901 | -webkit-align-items: center; 902 | align-items: center; 903 | } 904 | .weui-progress__bar { 905 | -webkit-box-flex: 1; 906 | -webkit-flex: 1; 907 | flex: 1; 908 | } 909 | .weui-progress__opr { 910 | margin-left: 15px; 911 | font-size: 0; 912 | } 913 | .weui-navbar { 914 | display: -webkit-box; 915 | display: -webkit-flex; 916 | display: flex; 917 | position: absolute; 918 | z-index: 500; 919 | top: 0; 920 | width: 100%; 921 | border-bottom: 1rpx solid #CCCCCC; 922 | } 923 | .weui-navbar__item { 924 | position: relative; 925 | display: block; 926 | -webkit-box-flex: 1; 927 | -webkit-flex: 1; 928 | flex: 1; 929 | padding: 13px 0; 930 | text-align: center; 931 | font-size: 0; 932 | } 933 | .weui-navbar__item.weui-bar__item_on { 934 | color: #1AAD19; 935 | } 936 | .weui-navbar__slider { 937 | position: absolute; 938 | content: " "; 939 | left: 0; 940 | bottom: 0; 941 | width: 6em; 942 | height: 3px; 943 | background-color: #1AAD19; 944 | -webkit-transition: -webkit-transform .3s; 945 | transition: -webkit-transform .3s; 946 | transition: transform .3s; 947 | transition: transform .3s, -webkit-transform .3s; 948 | } 949 | .weui-navbar__title { 950 | display: inline-block; 951 | font-size: 15px; 952 | max-width: 8em; 953 | width: auto; 954 | overflow: hidden; 955 | text-overflow: ellipsis; 956 | white-space: nowrap; 957 | word-wrap: normal; 958 | } 959 | .weui-tab { 960 | position: relative; 961 | height: 100%; 962 | } 963 | .weui-tab__panel { 964 | box-sizing: border-box; 965 | height: 100%; 966 | padding-top: 50px; 967 | overflow: auto; 968 | -webkit-overflow-scrolling: touch; 969 | } 970 | .weui-search-bar { 971 | position: relative; 972 | padding: 8px 10px; 973 | display: -webkit-box; 974 | display: -webkit-flex; 975 | display: flex; 976 | box-sizing: border-box; 977 | background-color: #EFEFF4; 978 | border-top: 1rpx solid #D7D6DC; 979 | border-bottom: 1rpx solid #D7D6DC; 980 | } 981 | .weui-icon-search { 982 | margin-right: 8px; 983 | font-size: inherit; 984 | } 985 | .weui-icon-search_in-box { 986 | position: absolute; 987 | left: 10px; 988 | top: 7px; 989 | } 990 | .weui-search-bar__text { 991 | display: inline-block; 992 | font-size: 14px; 993 | vertical-align: middle; 994 | } 995 | .weui-search-bar__form { 996 | position: relative; 997 | -webkit-box-flex: 1; 998 | -webkit-flex: auto; 999 | flex: auto; 1000 | border-radius: 5px; 1001 | background: #FFFFFF; 1002 | border: 1rpx solid #E6E6EA; 1003 | } 1004 | .weui-search-bar__box { 1005 | position: relative; 1006 | padding-left: 30px; 1007 | padding-right: 30px; 1008 | width: 100%; 1009 | box-sizing: border-box; 1010 | z-index: 1; 1011 | } 1012 | .weui-search-bar__input { 1013 | height: 28px; 1014 | line-height: 28px; 1015 | font-size: 14px; 1016 | } 1017 | .weui-icon-clear { 1018 | position: absolute; 1019 | top: 0; 1020 | right: 0; 1021 | padding: 7px 8px; 1022 | font-size: 0; 1023 | } 1024 | .weui-search-bar__label { 1025 | position: absolute; 1026 | top: 0; 1027 | right: 0; 1028 | bottom: 0; 1029 | left: 0; 1030 | z-index: 2; 1031 | border-radius: 3px; 1032 | text-align: center; 1033 | color: #9B9B9B; 1034 | background: #FFFFFF; 1035 | line-height: 28px; 1036 | } 1037 | .weui-search-bar__cancel-btn { 1038 | margin-left: 10px; 1039 | line-height: 28px; 1040 | color: #09BB07; 1041 | white-space: nowrap; 1042 | } 1043 | -------------------------------------------------------------------------------- /icon/Capture1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture1.jpeg -------------------------------------------------------------------------------- /icon/Capture2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture2.jpeg -------------------------------------------------------------------------------- /icon/Capture3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture3.jpeg -------------------------------------------------------------------------------- /icon/Capture4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture4.jpeg -------------------------------------------------------------------------------- /icon/Capture5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture5.jpeg -------------------------------------------------------------------------------- /icon/Capture6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture6.jpeg -------------------------------------------------------------------------------- /icon/Capture7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/Capture7.jpeg -------------------------------------------------------------------------------- /icon/cake-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/cake-1.png -------------------------------------------------------------------------------- /icon/cake-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/cake-2.png -------------------------------------------------------------------------------- /icon/cart-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/cart-1.png -------------------------------------------------------------------------------- /icon/cart-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/cart-2.png -------------------------------------------------------------------------------- /icon/home-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/home-1.png -------------------------------------------------------------------------------- /icon/home-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/home-2.png -------------------------------------------------------------------------------- /icon/icon_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/icon_more.png -------------------------------------------------------------------------------- /icon/my-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/my-1.png -------------------------------------------------------------------------------- /icon/my-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kuhami/wxbestcake-master/b48d888e7938fe1744a60bedc322c5e5b097c4f8/icon/my-2.png -------------------------------------------------------------------------------- /pages/buy/buy.js: -------------------------------------------------------------------------------- 1 | var base = getApp(); 2 | Page({ 3 | data: { 4 | pay: 1, 5 | brand: 0, 6 | pro: "", 7 | phone: "", 8 | phoneOk: false 9 | }, 10 | onLoad: function (e) { 11 | var obj = { 12 | price: 0.01 || e.price, 13 | brand: e.type 14 | } 15 | if (e.pay && e.pay == "free") { 16 | wx.setNavigationBarTitle({ title: "领取奖励" }); 17 | obj.pay = 0; 18 | obj.title = "获赠商品"; 19 | obj.btn = "领取" 20 | } else { 21 | obj.pay = 1; 22 | obj.title = "购买商品"; 23 | obj.btn = "确认并支付" 24 | } 25 | var s = ""; 26 | if (e.type == 0) { 27 | s += "经典系列" 28 | } else if (e.type == 1) { 29 | s += "吉致系列" 30 | } 31 | obj.pro = s + obj.price + "元优惠券" 32 | this.setData(obj); 33 | }, 34 | checkPhone: function (e) { 35 | var v = e.detail.value; 36 | if (v && v.length == 11) { 37 | this.setData({ 38 | phone: v, 39 | phoneOk: true 40 | }); 41 | } else { 42 | this.setData({ 43 | phone: "", 44 | phoneOk: false 45 | }); 46 | } 47 | }, 48 | pay: function () { 49 | var _this = this; 50 | if (this.data.phoneOk) { 51 | base.loading.show({title:"验证信息..."}); 52 | wx.login({ 53 | success: function (res) { 54 | console.log(res); 55 | if (res.code) { 56 | if (_this.data.pay == 1) { 57 | base.get({ c: "ActApiCenter", m: "Apply", brand: _this.data.brand == 0 ? "ksk" : "jzcake", price: _this.data.price, phone: _this.data.phone, code: res.code }, function (res) { 58 | var d = res.data; 59 | if (d.Status == "ok") { 60 | wx.requestPayment({ 61 | 'timeStamp': d.Tag.timeStamp, 62 | 'nonceStr': d.Tag.nonceStr, 63 | 'package': d.Tag.package, 64 | 'signType': d.Tag.signType, 65 | 'paySign': d.Tag.sign, 66 | 'success': function (res) { 67 | 68 | //if (res.requestPayment == "ok") { 69 | base.modal({ 70 | title: '支付成功!', 71 | content: "优惠券密码已下发到手机号" + _this.data.phone + ",请查收!", 72 | showCancel: false, 73 | confirmText: "确认", 74 | success: function (res) { 75 | if (res.confirm) { 76 | wx.switchTab({ 77 | url: "../cake/cake" 78 | }) 79 | } 80 | } 81 | }) 82 | //} 83 | }, 84 | 'fail': function (res) { 85 | 86 | } 87 | }) 88 | } else { 89 | base.modal({ 90 | title: '提交失败', 91 | content: d.Msg || "" 92 | }); 93 | } 94 | },"提交中..."); 95 | } else { 96 | 97 | } 98 | } else { 99 | base.modal({ 100 | title: '获取信息失败!' 101 | }); 102 | } 103 | }, 104 | fail: function () { 105 | base.modal({ 106 | title: '获取信息失败!' 107 | }); 108 | } 109 | }); 110 | 111 | 112 | 113 | } 114 | } 115 | }); -------------------------------------------------------------------------------- /pages/buy/buy.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "购买优惠券", 3 | "backgroundColor": "#f3f3f3", 4 | "enablePullDownRefresh":false 5 | } -------------------------------------------------------------------------------- /pages/buy/buy.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{pro}} 5 | 6 | 7 | +86 8 | 9 | 10 | 优惠券密码将发送到此手机号 11 | {{btn}} 12 | -------------------------------------------------------------------------------- /pages/buy/buy.wxss: -------------------------------------------------------------------------------- 1 | page{background-color: #f3f3f3;} 2 | .c{padding: 20rpx 30rpx;} 3 | .pro{padding: 0;font-size: 13pt;text-align: center;} 4 | .pro label{color: #000;} 5 | .pro text{color: #ff6a00;} 6 | .fm{width: 700rpx;display: flex; border: 1rpx solid #ddd;background-color: #fff; margin: 20rpx auto 0;border-radius:3px;height:50px;line-height: 50px;} 7 | .fm input{flex: 1;padding: 0 10px; height: 100%; font-size: 15pt;} 8 | 9 | .phone .label{width: 100rpx; border-right: 1rpx solid #eee;text-align: center; color: #999;} 10 | .des{color: #aaa;font-size: 11pt;padding: 10rpx 0;text-align: center;} 11 | 12 | .sub{width: 700rpx;height: 50px;line-height: 50px; text-align: center;border-radius:3px; margin:30rpx auto; } 13 | .sub-ok{background-color:#576b95;color: #fff;} 14 | .sub-dis{background-color: #d0d0d0;color: #999;} -------------------------------------------------------------------------------- /pages/cake/cake.js: -------------------------------------------------------------------------------- 1 | var base = getApp(); 2 | var jzData = require('../../utils/jzData.js') 3 | Page({ 4 | data: { 5 | tab: 0, 6 | list: [], 7 | listJz: [] 8 | }, 9 | onLoad: function () { 10 | var _this = this; 11 | var _dic = base.cake.getCache(); 12 | if (_dic) { 13 | this.setlist(_dic); 14 | } else { 15 | this.initData(); 16 | } 17 | //极致系列 18 | var list = [],_jzlist = []; 19 | var dic = jzData.data; 20 | for (var i in dic) { 21 | _jzlist.push({ 22 | name: i, 23 | price: dic[i].CakeType[0].CurrentPrice + ".00", 24 | des: dic[i].Means, 25 | imgUrl: base.path.res + dic[i].img 26 | }) 27 | list.push({ 28 | name: i, 29 | price: dic[i].CakeType[0].CurrentPrice + ".00", 30 | des: dic[i].Means, 31 | imgUrl: base.path.res + dic[i].img 32 | }) 33 | } 34 | this.setData({ 35 | "listJz": _jzlist, 36 | "list": list, 37 | }); 38 | }, 39 | onShow: function (e) { 40 | if (base.cake.tab != null) { 41 | this.setData({ "tab": base.cake.tab }); 42 | base.cake.tab = null; 43 | } 44 | // if (base.version.current != base.version.getValue()) { 45 | 46 | // this.initData(); 47 | // } 48 | }, 49 | initData: function () { 50 | var _this = this; 51 | // var _dic = base.cake.getCache(); 52 | // if (_dic) { 53 | // _this.setlist(_dic); 54 | // } else { 55 | base.get({ c: "Product", m: "GetAllProduct", City: "上海" }, function (d) { 56 | var data = d.data; 57 | if (data.Status == "ok") { 58 | base.cake.setCache(data.Tag); 59 | _this.setlist(data.Tag); 60 | } 61 | }) 62 | //} 63 | 64 | }, 65 | setlist: function (dic) { 66 | var _list = []; 67 | for (var i in dic) { 68 | _list.push({ 69 | name: i, 70 | price: dic[i].CakeType[0].CurrentPrice + ".00", 71 | des: dic[i].Means, 72 | //imgUrl: base.path.res + "images/ksk/mlist/item/" + i + ".jpg" 73 | imgUrl: base.path.res + "/images-2/index-3/jdcake/w_240/" + encodeURI(i) + ".png" 74 | }) 75 | } 76 | this.setData({ "list": _list }); 77 | }, 78 | ing: function (e) { 79 | var price = e.currentTarget.dataset.price; 80 | base.modal({ 81 | title: '是否需要购买优惠券?', 82 | showCancel: true, 83 | confirmText: "去购买", 84 | success: function (res) { 85 | if (res.confirm) { 86 | wx.navigateTo({ 87 | url: "../buy/buy?type=1&price=" + price 88 | }) 89 | } 90 | } 91 | }) 92 | }, 93 | changeTab: function (e) { 94 | var d = e.currentTarget.dataset.index; 95 | this.setData({ tab: d }); 96 | }, 97 | goDetail: function (e) { 98 | var d = e.currentTarget.dataset.pname; 99 | var b = e.currentTarget.dataset.brand; 100 | if (d) { 101 | wx.navigateTo({ 102 | url: '../cakeDetail/cakeDetail?pname=' + d + "&brand=" + b 103 | }) 104 | } 105 | } 106 | }); -------------------------------------------------------------------------------- /pages/cake/cake.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "蛋糕馆", 3 | "backgroundColor": "#f3f3f3", 4 | "enablePullDownRefresh":false 5 | } -------------------------------------------------------------------------------- /pages/cake/cake.wxml: -------------------------------------------------------------------------------- 1 | 2 | 经典系列 3 | 吉致系列 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{p.name}} 13 | {{p.des}} 14 | ¥ 15 | {{p.price}} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {{p.name}} 27 | {{p.des}} 28 | ¥ 29 | {{p.price}} 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /pages/cake/cake.wxss: -------------------------------------------------------------------------------- 1 | page{padding: 55px 0 0;background-color: #f3f3f3;} 2 | .tab{width: 720rpx; position: fixed;z-index: 100; left: 14rpx; top:10rpx;border:1px solid #576b95;height: 40px; line-height:40px;border-radius: 5px;display: flex;font-size: 13pt;} 3 | .tab-layer{width: 750rpx;height: 50px; background: #fff;opacity: 0.9;left: 0;top: 0; position: fixed;z-index: 99; border-bottom: 1rpx solid #dedede;} 4 | .tab .tab-on{background-color: #576b95;text-align: center; color: #fff;flex: 1;} 5 | .tab .tab-out{text-align: center;flex: 1;} 6 | 7 | .item{display: flex; padding: 10px 0; background-color: #fff;border-bottom: 1px solid #eee;} 8 | .item:active{background-color: #f5f5f5;} 9 | .item .img{width:300rpx; text-align: center;} 10 | .itemjd .img image{width: 250rpx;height: 180rpx; } 11 | .itemjz .img image{width:100%;height:200rpx;} 12 | .item .con{flex: 1; padding: 0 10px 0 0;} 13 | .con .nm{font-size: 14pt; font-weight: bold;} 14 | .con .des{line-height: 22px; font-size: 10pt; padding: 5px 0;color: #999;} 15 | .con .sub{color: #ff6a00;font-size: 10pt;} 16 | .con .sub text{font-size: 15pt;} 17 | 18 | .jzitem image{width: 720rpx; height:540rpx; } -------------------------------------------------------------------------------- /pages/cakeDetail/cakeDetail.js: -------------------------------------------------------------------------------- 1 | var base = getApp(); 2 | var jzData = require('../../utils/jzData.js'); 3 | var preview=require('../../utils/preview.js'); 4 | Page({ 5 | data: { 6 | brand: 0, 7 | loaded: false, 8 | cartNum: 0, 9 | }, 10 | onLoad: function (e) { 11 | var brand = e && e.brand ? e.brand : 0; 12 | this.setData({ brand: brand }); 13 | var _this = this; 14 | if (brand == 0) {//经典系列 15 | var key = e.pname || "极地牛乳"; 16 | var obj = base.cake.getByName(key); 17 | if (obj) { 18 | _this.setData({ loaded: true }); 19 | this.initCake(obj); 20 | } else { 21 | base.get({ c: "Product", m: "GetCakeByName", City: "上海", ProName: key }, function (d) { 22 | _this.setData({ loaded: true }); 23 | var data = d.data; 24 | if (data.Status == "ok") { 25 | _this.initCake(data.Tag); 26 | } 27 | }); 28 | } 29 | } else {//吉致系列 30 | var obj = jzData.data[e.pname]; 31 | this.initCake(obj); 32 | _this.setData({ loaded: true }); 33 | } 34 | }, 35 | initCake: function (d) { 36 | var _this = this; 37 | wx.setNavigationBarTitle({ title: d.Name }); 38 | this.setData({ 39 | imgMinList: (function () { 40 | var _list = []; 41 | if (_this.data.brand == 0) { 42 | for (var i = 1; i <= 4; i++) { 43 | _list.push(base.path.res + "images-2/classical-detail/" + d.Name + "/w_400/" + d.Name + "-" + i + ".jpg"); 44 | } 45 | } else { 46 | _list.push(base.path.res + "images/ksk/item/w_400/" + d.Name + ".jpg"); 47 | } 48 | return _list; 49 | })(), 50 | name: d.Name, 51 | num: 1, 52 | des: d.Means, 53 | resource: d.Resourse, 54 | fresh: d.KeepFresh, 55 | current: { 56 | size: d.CakeType[0].Size, 57 | price: d.CakeType[0].CurrentPrice, 58 | supplyno: d.CakeType[0].SupplyNo, 59 | des: d.CakeType[0].PackingList 60 | }, 61 | CakeType: d.CakeType 62 | }); 63 | }, 64 | onShow: function (e) { 65 | this.setData({ cartNum: base.cart.getNum() }); 66 | }, 67 | previewImg: function (e) { 68 | preview.show(this.data.name,this.data.brand,e.currentTarget.dataset.index) 69 | }, 70 | changeCurrent: function (e) { 71 | var s = e.currentTarget.dataset.size; 72 | var p = e.currentTarget.dataset.price; 73 | var sno = e.currentTarget.dataset.supplyno; 74 | if (s && p && this.data.current.size != s) { 75 | this.setData({ "current.size": s, "current.price": p, "current.supplyno": sno }) 76 | } 77 | }, 78 | addCart: function () { 79 | var _this = this; 80 | if (base.cart.add({ 81 | supplyno: this.data.current.supplyno, 82 | name: this.data.name, 83 | size: this.data.current.size, 84 | price: this.data.current.price, 85 | num: this.data.num, 86 | brand:this.data.brand 87 | })) { 88 | this.setData({ cartNum: base.cart.getNum() }) 89 | base.modal({ 90 | title: '加入成功!', 91 | content: "跳转到购物车或留在当前页", 92 | showCancel: true, 93 | cancelText: "留在此页", 94 | confirmText: "去购物车", 95 | success: function (res) { 96 | if (res.confirm) { 97 | _this.goc(); 98 | } 99 | } 100 | }) 101 | // base.toast({ 102 | // title: '加入成功', 103 | // icon: 'success', 104 | // duration: 1500 105 | // }) 106 | } 107 | }, 108 | goCart: function () { 109 | if (!base.cart.exist(this.data.current.supplyno)) { 110 | base.cart.add({ 111 | supplyno: this.data.current.supplyno, 112 | name: this.data.name, 113 | size: this.data.current.size, 114 | price: this.data.current.price, 115 | num: this.data.num 116 | }) 117 | } 118 | this.goc(); 119 | }, 120 | goc: function () { 121 | var _this = this; 122 | base.cart.ref = "../cakeDetail/cakeDetail?pname=" + _this.data.name + "&brand=" + _this.data.brand; 123 | wx.switchTab({ 124 | url: "../cart/cart" 125 | }) 126 | }, 127 | _go: function () { 128 | var _this = this; 129 | wx.navigateTo({ 130 | url: "../buy/buy?type="+_this.data.brand+"&price=" + _this.data.current.price 131 | }) 132 | } 133 | }); -------------------------------------------------------------------------------- /pages/cakeDetail/cakeDetail.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/cakeDetail/cakeDetail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{name}} 11 | {{des}} 12 | 13 | ¥ 14 | {{(current.price*num)+".00"}} 15 | 16 | 17 | 18 | 19 | {{s.Size}} 20 | 21 | 22 | 主要原料: 23 | {{resource}} 24 | 25 | 贮存条件: 26 | {{fresh}} 27 | 28 | 29 | 30 | 加入购物车({{cartNum}}) 31 | 购买等额优惠券 32 | 33 | -------------------------------------------------------------------------------- /pages/cakeDetail/cakeDetail.wxss: -------------------------------------------------------------------------------- 1 | .c{padding: 0 0 80px;} 2 | .hd{height:500rpx;background-color: #f3f3f3; } 3 | .hd image{width:750rpx;height:500rpx; } 4 | .tit{font-size: 17pt; font-weight: bold;padding:20rpx 30rpx; margin: 10rpx 0 0; background-color: #fff;} 5 | .des{font-size: 10pt;line-height: 22px;padding:0 35rpx 20rpx;color: #999;} 6 | 7 | .pp{padding:20rpx;color: #ff6a00;border-top: 1rpx solid #eee; display: flex} 8 | .price{flex: 1;} 9 | .price text{font-size: 23pt; font-weight: bold;} 10 | 11 | .size{display: flex;padding:20rpx 15rpx 30rpx;border-bottom: 1rpx solid #eee; } 12 | .size .sitem{flex: 1;text-align: center;padding: 0 15rpx;max-width:400rpx;} 13 | .size .sitem text{height:40px;line-height:40px; display:block;border-radius: 2px} 14 | .size .sitem-on text{border: 2rpx solid #576b95; color: #576b95;font-weight: bold;position: relative;} 15 | .size .sitem-on text:after{content: " "; display:block;position: absolute; width: 0;height: 0;border-top:10px solid #576b95;border-left:10px solid transparent;border-right:10px solid transparent; right:-7px;bottom:-2px;transform:rotateZ(-45deg);} 16 | .size .sitem-out text{border: 1rpx solid #ddd;} 17 | .sm{padding:20px 35rpx 0;font-size: 10pt;line-height: 22px;} 18 | .sm text{color: #999;} 19 | 20 | 21 | .tool{position: fixed;left: 0;bottom: 0; padding: 20rpx 0; display: flex; width: 750rpx;border-top: 1rpx solid #ddd;box-shadow: 0 -1px 5px 0 #eee;background-color: #fff; } 22 | .tool .tbtn{height: 40px;line-height: 40px; text-align: center;border-radius: 3px;} 23 | .tool .add{background-color: #f0f0f0;border: 1rpx solid #ddd;flex:1;margin: 0 10rpx 0 20rpx; position: relative;} 24 | .tool .buy{background-color: #576b95;border: 1rpx solid #576b95; color: #fff;flex:1;margin: 0 20rpx 0 10rpx;} 25 | /*.cart-num{position: absolute; left: 5px;top: -20px; width: 40px; height:40px; line-height: 40px; text-align: center; border: 2px solid #fff;border-radius: 50%; background-color: #f00;color: #fff; box-shadow: 0 0 5px 0 #ccc;}*/ 26 | .cart-num{color:#f00;} 27 | -------------------------------------------------------------------------------- /pages/cart/cart.js: -------------------------------------------------------------------------------- 1 | var base = getApp(); 2 | var preview=require('../../utils/preview.js'); 3 | Page({ 4 | data: { 5 | plist: [], 6 | total: 0, 7 | his: "" 8 | }, 9 | onLoad: function (e) { 10 | 11 | }, 12 | onShow: function (e) { 13 | if (base.cart.ref) { 14 | this.setData({ his: base.cart.ref }); 15 | base.cart.ref = ""; 16 | } 17 | var l = base.cart.getList(); 18 | for (var i = 0; i < l.length; i++) { 19 | l[i].img = base.path.res + 'images/ksk/item/w_127/' + l[i].name + '.jpg'; 20 | l[i].index = i; 21 | } 22 | this.setData({ plist: l }); 23 | this.changeTotal(); 24 | }, 25 | goBack: function () { 26 | var _this = this; 27 | wx.navigateTo({ 28 | url: _this.data.his 29 | }) 30 | }, 31 | previewImg: function (e) { 32 | preview.show(e.currentTarget.dataset.name,e.currentTarget.dataset.brand,e.currentTarget.dataset.index) 33 | }, 34 | changeTotal: function () { 35 | var l = this.data.plist; 36 | var t = 0; 37 | for (var i = 0; i < l.length; i++) { 38 | if (!l[i].del) {//排除删除选项 39 | t += l[i].price * l[i].num; 40 | } 41 | } 42 | this.setData({ total: t }); 43 | }, 44 | changeNum: function (e) { 45 | var t = e.currentTarget.dataset.type; 46 | var index = e.currentTarget.dataset.index; 47 | var re = this.data.plist[index].num + parseInt(t); 48 | if (re < 100 && re > 0) { 49 | var key = "plist[" + index + "].num"; 50 | var obj = {}; obj[key] = re; 51 | this.setData(obj); 52 | this.changeTotal(); 53 | base.cart.num(this.data.plist[index].supplyno, obj[key]); 54 | } 55 | }, 56 | del: function (e) { 57 | var index = e.currentTarget.dataset.index; 58 | var sno = this.data.plist[index].supplyno; 59 | //var l = this.data.plist; 60 | // var _l = []; 61 | //var obj = { total: 0 }; 62 | // for (var i = 0; i < l.length; i++) { 63 | // if (i != index) { 64 | // // _l.push(l[i]); 65 | // obj.total += l[i].price * l[i].num; 66 | // } 67 | // } 68 | 69 | var key1 = "plist[" + index + "].del"; 70 | var obj = {}; 71 | obj[key1] = true; 72 | 73 | 74 | 75 | // var ani = wx.createAnimation({ 76 | // duration: 300, 77 | // timingFunction:"ease" 78 | // }) 79 | // ani.height(0).step(); 80 | // var key = "plist[" + index + "]._ani"; 81 | // obj[key] = ani.export(); 82 | 83 | this.setData(obj); 84 | 85 | 86 | 87 | this.changeTotal(); 88 | base.cart.remove(sno); 89 | }, 90 | 91 | clearCart: function () { 92 | var _this = this; 93 | if (this.data.total > 0) { 94 | base.modal({ 95 | title: "确认清空所有商品?", confirmText: "清空", success: function (res) { 96 | if (res.confirm) { 97 | _this.setData({ plist: [], total: 0 }); 98 | base.cart.clear(); 99 | } 100 | } 101 | }) 102 | } 103 | }, 104 | goOrder: function () { 105 | // this.ing(); 106 | if (this.data.plist.length > 0 && this.data.total > 0) { 107 | wx.navigateTo({ 108 | url: '../order/order?from=cart' 109 | }) 110 | } else { 111 | base.modal({ 112 | title: '购物车无商品', 113 | showCancel: false 114 | }) 115 | } 116 | }, 117 | tips: ["尽请期待!", "不用点了、暂时下不了单!", "真de、不骗你!", "不信再试试?!", "没错吧?!", "您可以去其它地方转转了!", "嘿、还挺执着!", "就喜欢你这股子劲!", "但没有任何niao用!", "你已经陷入无限轮回..."], 118 | //,"......", ".........", "好吧、你赢了!", "你即将获得一份随机奖励!", "just for your 执着!", "不过先声明、我们真的还未开放下单!"], 119 | tipsN: 0, 120 | ing: function () { 121 | if (this.tipsN >= this.tips.length) { 122 | this.tipsN = 0; 123 | } 124 | 125 | base.modal({ 126 | title: this.tips[this.tipsN], 127 | showCancel: false 128 | }); 129 | this.tipsN += 1; 130 | 131 | 132 | 133 | // if (this.tipsN < this.tips.length) { 134 | // base.modal({ 135 | // title: this.tips[this.tipsN], 136 | // showCancel: false 137 | // }); 138 | // this.tipsN += 1; 139 | // } 140 | // else { 141 | // base.modal({ 142 | // title: "恭喜", 143 | // content: "您已免费获得价值88元经典系列蛋糕优惠券,限领一次", 144 | // cancelText: "放弃机会", 145 | // confirmText: "立即领取", 146 | // showCancel: true, 147 | // success: function (res) { 148 | // if (res.confirm) { 149 | // wx.navigateTo({ 150 | // url: "../buy/buy?type=0&price=88&&pay=free" 151 | // }) 152 | // } else { 153 | 154 | // } 155 | // } 156 | // }) 157 | // } 158 | 159 | }, 160 | p: { 161 | currentIndex: -1, 162 | eventOk: true, 163 | eventStartOk: true, 164 | aniOk: true, 165 | len: 0,//当前位置 166 | ani: wx.createAnimation(), 167 | // _ani: wx.createAnimation({ 168 | // duration: 200, 169 | // timingFunction: 'ease-out'// 170 | // }), 171 | max: 80, 172 | size: 40 173 | }, 174 | moveTo: function (index, x) { 175 | this.p.eventOk = false;//停止事件 176 | if (x == 0) { 177 | this.p.currentIndex = -1; 178 | if (this.p.len > 0 - this.p.max / 2) { 179 | if (this.p.len > 0) { 180 | this.p.ani.translateX(this.p.size).step({ 181 | duration: 100, 182 | timingFunction: 'ease-out' 183 | }); 184 | 185 | } 186 | this.p.ani.translateX(0 - this.p.size).step({ 187 | duration: 200, 188 | timingFunction: 'ease' 189 | }); 190 | } 191 | } 192 | if (x == 0 - this.p.max) { 193 | this.p.currentIndex = index; 194 | this.p.ani.translateX(x - this.p.size).step({ 195 | duration: 200, 196 | timingFunction: 'ease' 197 | }); 198 | } 199 | this.p.ani.translateX(x).step({ 200 | duration: 200, 201 | timingFunction: 'ease-out' 202 | }); 203 | var obj = {}; 204 | var key = "plist[" + index + "].ani"; 205 | obj[key] = this.p.ani.export(); 206 | this.setData(obj); 207 | }, 208 | ptouchsatrt: function (e) { 209 | 210 | var index = e.currentTarget.dataset.index; 211 | if (this.p.currentIndex >= 0) { 212 | this.moveTo(this.p.currentIndex, 0); 213 | return; 214 | } 215 | if (this.p.eventStartOk) { 216 | this.p.eventOk = true; 217 | this.p.len = 0; 218 | var pt = e.changedTouches[0]; 219 | pt.aaaaaaa = 11111; 220 | this.p.x = pt.pageX; 221 | this.p.y = pt.pageY; 222 | console.log("start") 223 | } 224 | }, 225 | ptouchend: function (e) { 226 | if (this.p.eventOk) { 227 | var pt = e.changedTouches[0]; 228 | var len = pt.pageX - this.p.x;//预计目标位置 229 | var ht = pt.pageY - this.p.y; 230 | if (len != 0 && Math.abs(ht) / Math.abs(len) < 0.3) {//滑动倾斜度限制 231 | this.p.len = len; 232 | var index = e.currentTarget.dataset.index; 233 | if (len > 0 - this.p.max / 2) { 234 | this.moveTo(index, 0); 235 | } else { 236 | this.moveTo(index, 0 - this.p.max); 237 | } 238 | } 239 | } 240 | this.p.eventOk = false; 241 | this.p.eventStartOk = false; 242 | var _this = this; 243 | if (this.p.tm) { 244 | clearTimeout(this.p.tm); 245 | } 246 | this.p.tm = setTimeout(function () { 247 | _this.p.eventStartOk = true; 248 | }, 300); 249 | } 250 | }); -------------------------------------------------------------------------------- /pages/cart/cart.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "购物车(体验版)", 3 | "backgroundColor": "#f3f3f3", 4 | "enablePullDownRefresh":false 5 | } -------------------------------------------------------------------------------- /pages/cart/cart.wxml: -------------------------------------------------------------------------------- 1 | 2 | 返回 3 | 详情(滑动可移除) 4 | 清空 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{p.name}} 13 | {{p.size}} 14 | 15 | ¥{{p.price*p.num}} 16 | 17 | - 18 | {{p.num}} 19 | + 20 | 21 | 22 | 23 | 删除 24 | 25 | 26 | 暂无商品 27 | 28 | 总金额: 29 | ¥{{total}} 30 | 31 | 确认下单 32 | 33 | -------------------------------------------------------------------------------- /pages/cart/cart.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | padding: 0 0 55px; 3 | background-color: #f3f3f3; 4 | } 5 | 6 | .tit { 7 | border-bottom: 1rpx solid #ddd; 8 | padding: 20rpx 25rpx; 9 | display: flex; 10 | align-items: center; 11 | background-color: #f0f0f0; 12 | } 13 | 14 | .tit-back { 15 | flex: 1; 16 | text-align: left; 17 | color: #576b95; 18 | } 19 | 20 | .tit-text { 21 | font-size: 11pt; 22 | color: #999; 23 | flex: 2; 24 | } 25 | 26 | .tit-tool { 27 | flex: 1; 28 | text-align: right; 29 | color: #576b95; 30 | } 31 | 32 | .pro { 33 | border-bottom: 1rpx solid #eee; 34 | position: relative; 35 | overflow-x: hidden; 36 | } 37 | 38 | .del { 39 | position: absolute; 40 | right: 0; 41 | top: 0; 42 | width: 80px; 43 | height:99.5%; 44 | text-align: center; 45 | background-color: #f00; 46 | color: #fff; 47 | z-index: 1; 48 | font-size: 15pt; 49 | display: flex; 50 | justify-content: center; 51 | align-items: center; 52 | } 53 | 54 | .del text { 55 | flex: 1; 56 | } 57 | 58 | .pro-con { 59 | height: 140rpx; 60 | position: relative; 61 | z-index: 2; 62 | background-color: #fff; 63 | display: flex; 64 | justify-content: center; 65 | align-items: center; 66 | } 67 | 68 | .pro-con .pimg { 69 | width: 150rpx; 70 | text-align: center; 71 | } 72 | 73 | .pro-con .pimg image { 74 | width: 110rpx; 75 | height: 100rpx; 76 | border-radius: 5px; 77 | } 78 | 79 | .pro-con .pname { 80 | flex: 1; 81 | } 82 | 83 | .pname .name { 84 | font-size: 11pt; 85 | } 86 | 87 | .pname .des { 88 | font-size: 11pt; 89 | color: #999; 90 | } 91 | 92 | .pro-con .ptprice { 93 | width: 150rpx; 94 | text-align: right; 95 | padding: 0 30rpx 0 0; 96 | color: #ff6a00; 97 | font-size: 13pt; 98 | } 99 | 100 | .pro-con .pnum { 101 | width: 110px; 102 | display: flex; 103 | align-items: center; 104 | } 105 | 106 | .num { 107 | width: 30px; 108 | height: 30px; 109 | border-radius: 50%; 110 | text-align: center; 111 | font-size: 20px; 112 | font-weight: bold; 113 | display: flex; 114 | align-items: center; 115 | align-content: center; 116 | } 117 | .num text{flex: 1;} 118 | .num-a { 119 | border: 1rpx solid #999; 120 | color: #ff6a00; 121 | background-color: #f6f6f6; 122 | } 123 | 124 | .num-b { 125 | border: 1rpx solid #ff6a00; 126 | background-color: #ff6a00; 127 | color: #fff; 128 | } 129 | 130 | .num-text { 131 | width: 30px; 132 | line-height: 30px; 133 | text-align: center; 134 | } 135 | 136 | .null { 137 | text-align: center; 138 | padding: 20px 0; 139 | color: #ccc; 140 | background-color: #fff; 141 | } 142 | 143 | .tool { 144 | position: fixed; 145 | left: 0; 146 | bottom: 6px; 147 | z-index: 3; 148 | display: flex; 149 | width: 750rpx; 150 | align-items: center; 151 | } 152 | 153 | .tool .total { 154 | flex: 2; 155 | text-align: left; 156 | padding: 0 20rpx; 157 | font-size: 11pt; 158 | color: #999; 159 | } 160 | 161 | .tool .total text { 162 | color: #ff6a00; 163 | font-size: 15pt; 164 | } 165 | 166 | .tool .gobuy { 167 | flex: 1; 168 | height: 40px; 169 | line-height: 40px; 170 | text-align: center; 171 | border-radius: 3px; 172 | background-color: #576b95; 173 | border: 1rpx solid #576b95; 174 | color: #fff; 175 | margin: 0 20rpx 0 10rpx; 176 | } 177 | 178 | .tool-layer { 179 | position: fixed; 180 | left: 0; 181 | bottom: 0; 182 | z-index: 2; 183 | width: 100%; 184 | height: 53px; 185 | background-color: #fff; 186 | opacity: 0.9; 187 | box-shadow: 0 -1px 5px 0 #eee; 188 | } 189 | -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | var base = getApp(); 4 | Page({ 5 | data: { 6 | path:base.path.res+"smallexe/index/", 7 | motto: '你好、BigCake!', 8 | userInfo: {}, 9 | array: ['上海', '北京', '杭州', '宁波'], 10 | index: 0 11 | }, 12 | goCake: function (e) { 13 | var brand = e.currentTarget.dataset.brand; 14 | if(brand&&brand==1){ 15 | base.cake.tab=1; 16 | } 17 | wx.switchTab({ url: '../cake/cake' }); 18 | }, 19 | goDetail: function (e) { 20 | var nm = e.currentTarget.dataset.pname; 21 | var b = e.currentTarget.dataset.brand; 22 | wx.navigateTo({ 23 | url: '../cakeDetail/cakeDetail?pname=' + nm+"&brand="+(b||0) 24 | }) 25 | }, 26 | bindPickerChange: function (e) { 27 | this.setData({ 28 | index: e.detail.value 29 | }) 30 | }, 31 | //事件处理函数 32 | bindViewTap: function () { 33 | wx.showActionSheet({ 34 | itemList: ['A', 'B', 'C'], 35 | success: function (res) { 36 | if (!res.cancel) { 37 | console.log(res.tapIndex) 38 | } 39 | } 40 | }) 41 | 42 | //wx.navigateTo({ 43 | //url: '../socket/socket' 44 | //}) 45 | }, 46 | onLoad: function () { 47 | var that = this 48 | //调用应用实例的方法获取全局数据 49 | //app.getUserInfo(function (userInfo) { 50 | //更新数据 51 | //that.setData({ 52 | //userInfo: userInfo 53 | //}) 54 | //}) 55 | 56 | }, 57 | onPullDownRefresh: function () { 58 | wx.stopPullDownRefresh() 59 | }, 60 | onShareAppMessage: function () { 61 | return { 62 | title: 'BigCake(体验版)', 63 | desc: '', 64 | path: '/pages/index/index?id=123' 65 | } 66 | } 67 | }) 68 | -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "BigCake", 3 | "backgroundColor": "#fff" 4 | } -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{array[index]}} 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 | 41 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | page{background-color: #fff;} 3 | .cityselect{position: fixed;width: 150rpx;height: 30px;line-height: 30px; font-size: 12pt; z-index: 1000;background-color: #000;text-align: center;box-shadow: 0 0 5px 0 #fff;border:1rpx solid #fff; border-radius: 15px;opacity: 0.5;left:20rpx;top: 20rpx;color: #fff;} 4 | 5 | .m{background-color: #fff;margin: 0 0 20rpx;} 6 | .m .mg{height: 750rpx;width: 750rpx;} 7 | .m .mg-1{height:540rpx;width:100%;} 8 | .m .mg-2{margin: 15rpx 20rpx 45rpx; height: 140rpx;} 9 | .m .mg-3{height:500rpx;width:100%;} 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/login/login.js: -------------------------------------------------------------------------------- 1 | // pages/login/login.js 2 | 3 | var base = getApp(); 4 | Page({ 5 | data: { 6 | phone: "", 7 | pwd: "" 8 | }, 9 | onLoad: function (options) { 10 | // 页面初始化 options为页面跳转所带来的参数 11 | }, 12 | changephone: function (e) { 13 | this.setData({ 14 | phone: e.detail.value 15 | }); 16 | }, 17 | changepwd: function (e) { 18 | this.setData({ 19 | pwd: e.detail.value 20 | }); 21 | }, 22 | submit: function () { 23 | var _this = this; 24 | base.get({ c: "User", m: "Login", phone: _this.data.phone, pwd: _this.data.pwd, }, function (d) { 25 | var dt = d.data; 26 | if (dt.Status == "ok") { 27 | base.user.userid = dt.Tag.Uid; 28 | base.user.sessionid = dt.Tag.SessionId; 29 | base.user.jzb = dt.Tag.Money; 30 | base.user.exp = dt.Tag.Exp; 31 | base.user.phone = dt.Tag.Phone; 32 | base.user.levels = dt.Tag.Levels; 33 | base.user.headimg = dt.Tag.HeadImgPath; 34 | wx.switchTab({ 35 | url: '../user/user' 36 | }) 37 | } 38 | else { 39 | wx.showModal({ 40 | showCancel: false, 41 | title: '', 42 | content: dt.Msg 43 | }); 44 | 45 | } 46 | }) 47 | 48 | } 49 | }) -------------------------------------------------------------------------------- /pages/login/login.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/login/login.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 登 录 11 | -------------------------------------------------------------------------------- /pages/login/login.wxss: -------------------------------------------------------------------------------- 1 | .body { 2 | margin: 20px 0; 3 | background-color: #fff; 4 | box-shadow: 5px 0 #f7f7f7; 5 | font-size: 15px; 6 | font-family: 'microsoft yahei',Verdana,Arial,Helvetica,sans-serif; 7 | } 8 | .ipt{background: #eee; margin: 10px;width:95%;} 9 | .ipt input{height:40px;} 10 | .btn { 11 | display: block; 12 | height: 1.777em; 13 | line-height: 1.777em; 14 | margin: 10px auto; 15 | width: 80%; 16 | text-align: center; 17 | background: #ff6000; 18 | color: #fff; 19 | border-radius: 8px; 20 | border: none; 21 | font-size: 1.333em; 22 | } -------------------------------------------------------------------------------- /pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | //logs.js 2 | var util = require('../../utils/util.js') 3 | Page({ 4 | data: { 5 | logs: [] 6 | }, 7 | onLoad: function () { 8 | this.setData({ 9 | logs: (wx.getStorageSync('logs') || []).map(function (log) { 10 | return util.formatTime(new Date(log)) 11 | }) 12 | }) 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志" 3 | } -------------------------------------------------------------------------------- /pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{index + 1}}. {{log}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | .log-list { 2 | display: flex; 3 | flex-direction: column; 4 | padding: 40rpx; 5 | } 6 | .log-item { 7 | margin: 10rpx; 8 | } 9 | -------------------------------------------------------------------------------- /pages/order/order.js: -------------------------------------------------------------------------------- 1 | var base = getApp(); 2 | var common = require('../../utils/common.js'); 3 | Page({ 4 | data: { 5 | arrTime: ['选择配送时间', '10:00-11:00', '11:00-12:00', '12:00-13:00', '13:00-14:00', '14:00-15:00', '15:00-16:00', '16:00-17:00', '17:00-18:00'], 6 | objectArrTime: [ 7 | {id: 0, name: '选择配送时间'}, 8 | {id: 1, name: '10:00-11:00'}, 9 | {id: 2, name: '11:00-12:00'}, 10 | {id: 3, name: '12:00-13:00'}, 11 | {id: 4, name: '13:00-14:00'}, 12 | {id: 5, name: '14:00-15:00'}, 13 | {id: 6, name: '15:00-16:00'}, 14 | {id: 7, name: '16:00-17:00'}, 15 | {id: 8, name: '17:00-18:00'}], 16 | arrTimeIndex: 0, 17 | addr: "", 18 | addresslist: [{ 19 | name: '刘先生', 20 | phone: '13623834531', 21 | city: '上海', 22 | area: '上海市', 23 | address: '浦东张江高科', 24 | id: 0 25 | }, { 26 | name: '张先生', 27 | phone: '13623834531', 28 | city: '上海', 29 | area: '上海市', 30 | address: '浦东张江高科', 31 | id: 1 32 | }, { 33 | name: '刘先生', 34 | phone: '13623834531', 35 | city: '上海', 36 | area: '上海市', 37 | address: '浦东张江高科', 38 | id: 2 39 | }, { 40 | name: '刘先生', 41 | phone: '13623834531', 42 | city: '上海', 43 | area: '上海市', 44 | address: '浦东张江高科', 45 | id: 3 46 | }], 47 | addrShow: false, 48 | scrollTop: 100, 49 | selectedID: -1, 50 | oinfo: { 51 | OrderSource: "all|web", 52 | Consignee: "", 53 | Cellphone: "", 54 | City: "", 55 | District: "", 56 | Address: "", 57 | DeliveryDate: "", 58 | DeliveryTime: "", 59 | Payment: "", 60 | Remarks: "", 61 | TotalPrice: 0 62 | }, 63 | dateStart: "2017-01-01", 64 | dateEnd: "2017-01-01", 65 | }, 66 | bindTimeChange: function (e) { 67 | var _this = this; 68 | if (e.detail.value > 0) { 69 | _this.setData({ 70 | arrTimeIndex: e.detail.value, 71 | "oinfo.DeliveryTime": _this.data.arrTime[e.detail.value] 72 | }); 73 | } 74 | }, 75 | bindDateChange: function (e) { 76 | this.setData({ 77 | "oinfo.DeliveryDate": e.detail.value 78 | }) 79 | }, 80 | myaddrChange: function () {//触摸选择地址 81 | this.setData({addrShow: true}); 82 | }, 83 | myaddrCancel: function () {//点击地址簿中取消按钮 84 | this.setData({addrShow: false}); 85 | }, 86 | closeaddr: function () {//触摸遮罩层关闭地址选项 87 | this.setData({addrShow: false}); 88 | }, 89 | toSelect: function (e) {//选中地址 90 | var _this = this; 91 | var id = e.currentTarget.dataset.aid; 92 | _this.setData({selectedID: id}); 93 | for (var i = 0; i < _this.data.addresslist.length; i++) { 94 | if (_this.data.addresslist[i].id == id) { 95 | _this.setData({ 96 | "oinfo.City": _this.data.addresslist[i].city, 97 | "oinfo.District": _this.data.addresslist[i].area, 98 | "oinfo.Consignee": _this.data.addresslist[i].name, 99 | "oinfo.Cellphone": _this.data.addresslist[i].phone, 100 | "oinfo.Address": _this.data.addresslist[i].address, 101 | addr: _this.data.addresslist[i].city + ' ' + _this.data.addresslist[i].area + ' ' + _this.data.addresslist[i].address, 102 | addrShow: false 103 | }); 104 | break; 105 | } 106 | } 107 | }, 108 | onLoad: function (e) { 109 | var _this = this; 110 | var now = new Date(); 111 | if (base.user.islogin()) { 112 | if (e.from && e.from == "cart") { 113 | var l = base.cart.getList(); 114 | for (var i = 0; i < l.length; i++) { 115 | l[i].img = base.path.res + 'images/ksk/item/w_127/' + l[i].name + '.jpg' 116 | 117 | } 118 | _this.setData({ 119 | plist: l, 120 | dateStart: common.addDate(now, 1), 121 | dateEnd: common.addDate(now, 90) 122 | }); 123 | } 124 | } 125 | this.getAddressList(); 126 | console.log(this.data.plist); 127 | }, 128 | getAddressList: function () { 129 | var _this = this; 130 | 131 | base.get({c: "UserCenter", m: "GetAllAddress"}, function (d) { 132 | var dt = d.data; 133 | if (dt.Status == "ok") { 134 | var arr = []; 135 | for (var i = 0; i < dt.Tag.length; i++) { 136 | var obj = dt.Tag[i]; 137 | if (i == 0) { 138 | obj.isDefault = true; 139 | } 140 | arr.push(obj); 141 | 142 | } 143 | _this.setData({ 144 | addresslist: arr 145 | }) 146 | 147 | } 148 | }) 149 | }, 150 | onShow: function (e) { 151 | 152 | }, 153 | 154 | getTotalPrice: function () {//应付金额 155 | var _this = this; 156 | var pl = _this.data.plist;//name: p.name, price: p.price, size: p.size, num: p.num, brand: p.brand,supplyno 157 | var alltotal = 0; 158 | for (var i = 0; i < pl.length; i++) { 159 | if (!isNaN(pl[i].price)) { 160 | alltotal += parseFloat(pl[i].price); 161 | } 162 | } 163 | this.setData({ 164 | "oinfo.TotalPrice": alltotal 165 | }); 166 | }, 167 | getProductList: function () { 168 | var _this = this; 169 | var arr_pro = []; 170 | var pl = _this.data.plist;//name: p.name, price: p.price, size: p.size, num: p.num, brand: p.brand,supplyno 171 | for (var i = 0; i < pl.length; i++) { 172 | arr_pro.push({ 173 | ProductName: pl[i].name, 174 | Price: pl[i].price, 175 | Size: pl[i].size, 176 | Num: pl[i].num, 177 | CakeNo: 0, 178 | OType: 0, 179 | IType: 0, 180 | SupplyNo: pl[i].supplyno, 181 | //生日内容 182 | IsCutting: 0, 183 | CutNum: 0, 184 | BrandCandleType: 0, 185 | Remarks: '', 186 | Premark: null,//生产备注 187 | }); 188 | } 189 | return arr_pro; 190 | }, 191 | valid: function () { 192 | var _this = this; 193 | var err = ""; 194 | if (!_this.data.oinfo.Consignee) { 195 | err = "请选择收货人信息!"; 196 | wx.showModal({ 197 | showCancel: false, 198 | title: '', 199 | content: err 200 | }) 201 | return false; 202 | } 203 | if (!_this.data.oinfo.DeliveryDate) { 204 | err = "请选择配送日期!"; 205 | wx.showModal({ 206 | showCancel: false, 207 | title: '', 208 | content: err 209 | }) 210 | return false; 211 | } 212 | if (!_this.data.oinfo.DeliveryTime) { 213 | err = "请选择配送时间段!"; 214 | wx.showModal({ 215 | showCancel: false, 216 | title: '', 217 | content: err 218 | }) 219 | return false; 220 | } 221 | return true; 222 | }, 223 | submit: function () { 224 | var _this = this; 225 | if (_this.valid()) { 226 | _this.getTotalPrice(); 227 | var obj = {}; 228 | obj.UserName = base.user.phone; 229 | obj.UserPhone = base.user.phone; 230 | obj.OrderSource = _this.data.oinfo.OrderSource; 231 | obj.Consignee = _this.data.oinfo.Consignee; 232 | obj.Cellphone = _this.data.oinfo.Cellphone; 233 | obj.City = _this.data.oinfo.City; 234 | obj.District = _this.data.oinfo.District; 235 | obj.Address = _this.data.oinfo.Address; 236 | obj.DeliveryDate = _this.data.oinfo.DeliveryDate; 237 | obj.DeliveryTime = _this.data.oinfo.DeliveryTime; 238 | obj.Payment = _this.data.oinfo.Payment; 239 | obj.Uid = base.user.userid; 240 | obj.Remarks = _this.data.oinfo.Remarks; 241 | obj.TotalPrice = _this.data.oinfo.TotalPrice; 242 | obj.TotalPrice = obj.TotalPrice < 0 ? 0 : obj.TotalPrice; 243 | var oplArr = _this.getProductList(); 244 | var oal = []; 245 | base.post({ 246 | c: "OrderCenter", 247 | m: "AddOrder", 248 | p: JSON.stringify(obj), 249 | proInfo: JSON.stringify(oplArr), 250 | oalInfo: JSON.stringify(oal) 251 | }, function (d) { 252 | console.log(d) 253 | var dt = d.data; 254 | if (dt.Status == "ok") { 255 | base.cart.clear(); 256 | wx.redirectTo({ 257 | url: "../payment/payment?oid=" + dt.Tag 258 | }) 259 | } 260 | 261 | }) 262 | 263 | } 264 | } 265 | }) -------------------------------------------------------------------------------- /pages/order/order.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/order/order.wxml: -------------------------------------------------------------------------------- 1 | 2 | 收货人信息 3 | 4 | {{oinfo.Consignee}} {{oinfo.Cellphone}} 5 | {{addr?addr:'选择收货人信息'}} 6 | 7 | 8 | 9 | 配送日期/时间 10 | 11 | 13 | {{oinfo.DeliveryDate?oinfo.DeliveryDate:'选择配送日期'}} 14 | 15 | 17 | {{arrTime[arrTimeIndex]}} 18 | 19 | 20 | 21 | 22 | 商品详情 23 | 24 | 25 | {{p.name}} 26 | {{p.price}} x {{p.num}} 27 | {{p.price*p.num}} 28 | 29 | 30 | 31 | 配件 32 | 33 | 34 | 优惠方式 35 | 36 | 37 | 代金卡 38 | 39 | 40 | 41 | 优惠券 42 | 43 | 44 | 45 | 46 | 47 | 备注 48 |