├── .gitattributes ├── LICENSE ├── README.md ├── app.js ├── app.json ├── app.wxss ├── config.js ├── page ├── diancan │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── fuwu │ ├── fuwu.js │ ├── fuwu.json │ ├── fuwu.wxml │ └── fuwu.wxss ├── my │ ├── my.js │ ├── my.json │ ├── my.wxml │ └── my.wxss ├── resources │ ├── json │ │ └── menus.js │ └── pic │ │ ├── call2.png │ │ ├── countMinus.png │ │ ├── countSelAdd.png │ │ ├── countSelect.png │ │ ├── dish-close.png │ │ ├── dropdown.png │ │ ├── localtion2.png │ │ ├── my.png │ │ ├── mySelected.png │ │ ├── orderList.png │ │ ├── orderListSelected.png │ │ ├── return.png │ │ ├── shouye.png │ │ ├── shouyeSelected.png │ │ └── star.jpg ├── shop │ ├── shop.js │ ├── shop.json │ ├── shop.wxml │ └── shop.wxss └── thisorder │ ├── thisorder.js │ ├── thisorder.json │ ├── thisorder.wxml │ └── thisorder.wxss ├── project.config.json ├── screemshot ├── 0.jpg ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 4.png ├── 5.jpg ├── 6.jpg ├── 7.jpg ├── 8.jpg ├── doortip.png └── huzhan.jpg └── util ├── autoheight.js ├── qqmap-wx-jssdk.js ├── util.js └── vendor └── qcloud-weapp-client-sdk ├── .bower.json ├── index.js └── lib ├── constants.js ├── login.js ├── request.js ├── session.js └── utils.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 olive.zhang 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 微信扫码点餐小程序 2 | 微扫点餐是资深餐饮行业团队倾心打造的数字化餐饮解决方案,首批自主研发的小程序功能强大、服务专业。 3 | 4 | 本程序可以直接在微信开发者工具运行(测试服务端已经部署) 5 | 6 | # 基本功能 7 | 下单 8 | 9 | 预定 10 | 11 | 外卖 12 | 13 | 支付 14 | 15 | 定位(有限制1公里范围内用户才能下单的开关) 16 | 17 | USB打印机 18 | 19 | 网络打印机 20 | 21 | GPRS云打印机(支持易联云) 22 | 23 | 微信支付 24 | 25 | # 营销功能 26 | 27 | 优惠券:新用户进店得优惠,早餐券,午餐券,晚餐券,1个月内有效 28 | 29 | 会员折扣:如:消费满1000,一级会员,可享受95折 30 | 31 | 充值赠送:冲1000送200 32 | 33 | # 后台功能 34 | 35 | 添加门店 36 | 37 | 菜品管理 38 | 39 | 桌台管理 40 | 41 | 台牌打印 42 | 43 | 会员管理 44 | 45 | 打印机管理 46 | 47 | 前台订单 48 | 49 | 厨房订单 50 | 51 | 会员管理 52 | 53 | 营业日报 54 | 55 | 商品统计 56 | 57 | 公众号粉丝 58 | 59 | 充值记录 60 | 61 | 优惠券 62 | 63 | 64 | # 技术栈 65 | 66 | 微信开发工具版本:v1.02.1811290 67 | 68 | vs2015 69 | 70 | mysql:5.7 71 | 72 | 扫码 试用 73 | 74 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/0.jpg) 75 | 首页 76 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/1.jpg) 77 | #浏览 78 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/2.jpg) 79 | #前台 80 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/3.jpg) 81 | #台牌 82 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/4.jpg) 83 | #桌帖 84 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/5.jpg) 85 | #手机端订单 86 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/6.jpg) 87 | 新订单通知 88 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/7.jpg) 89 | 小票 90 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/8.jpg) 91 | 92 | 宣传单 93 | ![Image text](https://github.com/zhyqieqie/wechatscan/blob/master/screemshot/doortip.png) 94 | 95 | 96 | # 链接 97 | 网站:https://wechatscan.com 98 | 99 | 问题反馈QQ:58520051 100 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:app 5 | 文件功能描述:全局js 6 | 7 | ----------------------------------------------------------------*/ 8 | //import allmenu from 'page/resources/json/menus.js' 9 | var qcloud = require('./util/vendor/qcloud-weapp-client-sdk/index'); 10 | var util = require('./util/util.js') 11 | var config = require('./config'); 12 | 13 | App({ 14 | globalData: { 15 | hasLogin: false, 16 | userInfo: {}, 17 | zhuoziid: '262',//7826 pipi //256凯旋 //201赣水肴 //5873 诸葛烤鱼 272鱼你相约 //肥子汤馆 //262青春里 //8120聚朋酒家 8133大秦小厨 18 | //8178阿辉生煎 19 | menus: null, 20 | dingdanno: '', 21 | total: { 22 | count: 0, 23 | money: 0 24 | }, 25 | hasGeo: false, 26 | phonemodel: '', 27 | phonesystem: '', 28 | networkType: '', 29 | scene: 1000, 30 | moshi: '',//加菜模式 31 | jiacaiDingdanno: '', 32 | aFendian:{},//分店对象 33 | aZhuozi: {},//桌子对象 34 | aKehu: {}//分店对象 35 | }, 36 | onLaunch: function (options) { 37 | var that = this 38 | console.log('App onLaunch'); 39 | wx.getSystemInfo({ 40 | success: function (res) { 41 | that.globalData.phonemodel = res.model 42 | that.globalData.phonesystem = res.system + '-' + res.version + '-' + res.platform 43 | } 44 | }); 45 | wx.getNetworkType({ 46 | success: function (res) { 47 | that.globalData.networkType = res.networkType 48 | } 49 | }); 50 | if (options != undefined && options.scene != undefined) { 51 | that.globalData.scene = options.scene 52 | } 53 | }, 54 | onHide: function () { 55 | console.log('App Hide') 56 | }, 57 | onShow: function () { 58 | console.log('onShow'); 59 | }, 60 | //记录手机端错误 61 | onError: function (msg) { 62 | var that = this 63 | qcloud.request({ 64 | url: config.service.errorUrl, 65 | hasLogin: that.globalData.hasLogin, 66 | data: { 67 | fendianid: that.globalData.aFendian.fendianid, 68 | zhuoziid: that.globalData.zhuoziid, 69 | hasLogin: that.globalData.hasLogin, 70 | userInfo: JSON.stringify(that.globalData.userInfo), 71 | phonemodel: that.globalData.phonemodel, 72 | phonesystem: that.globalData.phonesystem, 73 | networkType: that.globalData.networkType, 74 | scene: that.globalData.scene, 75 | msg:msg 76 | } 77 | }); 78 | }, 79 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "page/shop/shop", 4 | "page/diancan/index", 5 | "page/thisorder/thisorder", 6 | "page/my/my", 7 | "page/fuwu/fuwu" 8 | ], 9 | "window": { 10 | "enablePullDownRefresh": true 11 | }, 12 | "tabBar": { 13 | "color": "#454545", 14 | "selectedColor": "#F25B02", 15 | "borderStyle": "white", 16 | "backgroundColor": "#ffffff", 17 | "position": "bottom", 18 | "list": [ 19 | { 20 | "pagePath": "page/shop/shop", 21 | "iconPath": "page/resources/pic/shouye.png", 22 | "selectedIconPath": "page/resources/pic/shouyeSelected.png", 23 | "text": "门店" 24 | }, 25 | { 26 | "pagePath": "page/diancan/index", 27 | "iconPath": "page/resources/pic/orderList.png", 28 | "selectedIconPath": "page/resources/pic/orderListSelected.png", 29 | "text": "点餐" 30 | }, 31 | { 32 | "pagePath": "page/my/my", 33 | "iconPath": "page/resources/pic/my.png", 34 | "selectedIconPath": "page/resources/pic/mySelected.png", 35 | "text": "我的" 36 | } 37 | ] 38 | }, 39 | "networkTimeout": { 40 | "request": 10000, 41 | "connectSocket": 10000, 42 | "uploadFile": 10000, 43 | "downloadFile": 10000 44 | }, 45 | "debug": true 46 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | .index { 2 | background-color: #fbf9fe; 3 | font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif; 4 | max-height: 100%; 5 | font-size: 32rpx; 6 | overflow: hidden; 7 | border-top: 1rpx solid #ddd; 8 | } 9 | 10 | .strong { 11 | font-weight: bold; 12 | } 13 | 14 | .bc_red { 15 | background-color: #f25b02; 16 | } 17 | 18 | .bc_gray { 19 | background-color: #c9c9c9; 20 | } 21 | 22 | .section { 23 | border-bottom: 1rpx solid #ddd; 24 | height: 80rpx; 25 | margin-top: 20rpx; 26 | } 27 | 28 | .section_gap { 29 | padding: 0 30rpx; 30 | } 31 | 32 | .image { 33 | width: 100%; 34 | height: 100%; 35 | border-radius: 5px; 36 | } 37 | 38 | .image120 { 39 | width: 120%; 40 | height: 120%; 41 | border-radius: 5px; 42 | } 43 | 44 | /*tab导航*/ 45 | 46 | .swiper-item { 47 | display: block; 48 | height: 300rpx; 49 | } 50 | 51 | .nav-tab-wrp { 52 | height: 88rpx; 53 | width: 100%; 54 | display: flex; 55 | flex-direction: row; 56 | background: rgba(250, 250, 250, 1); 57 | position: fixed; 58 | top: -1rpx; 59 | z-index: 10; 60 | } 61 | 62 | .nav-tab-item { 63 | width: 250rpx; 64 | text-align: center; 65 | line-height: 88rpx; 66 | color: rgb(102, 102, 102); 67 | } 68 | 69 | /*底部浮动*/ 70 | 71 | .cart-tab-wrp { 72 | height: 90rpx; 73 | position: fixed; 74 | bottom: 0rpx; 75 | background: black; 76 | display: flex; 77 | flex-direction: row; 78 | width: 100%; 79 | z-index: 10; 80 | color: black; 81 | margin-bottom: -2rpx; 82 | } 83 | 84 | .cart-item-total { 85 | padding-left: 30rpx; 86 | } 87 | 88 | .cart-item-icon-wrp { 89 | width: 60rpx; 90 | height: 90rpx; 91 | position: absolute; 92 | top: 17rpx; 93 | left: 360rpx; 94 | } 95 | 96 | .cart-item-icon { 97 | width: 90rpx; 98 | height: 90rpx; 99 | } 100 | 101 | .cart-item-total-num { 102 | display: inline-block; 103 | width: 30rpx; 104 | height: 30rpx; 105 | font-size: 22rpx; 106 | color: white; 107 | line-height: 30rpx; 108 | text-align: center; 109 | position: absolute; 110 | right: 2rpx; 111 | } 112 | 113 | .cart-item-total-price { 114 | display: inline-block; 115 | width: 201rpx; 116 | height: 40rpx; 117 | font-size: 30rpx; 118 | color: white; 119 | line-height: 80rpx; 120 | text-align: center; 121 | margin-top: 7rpx; 122 | } 123 | 124 | .cart-tab-item-btn { 125 | width: 160rpx; 126 | display: block; 127 | height: 90rpx; 128 | line-height: 90rpx; 129 | font-size: 42rpx; 130 | background: #5cba42; 131 | color: #fff; 132 | float: right; 133 | text-align: center; 134 | } 135 | 136 | .cart-tab-item { 137 | width: 375rpx; 138 | } 139 | 140 | .cart-item-total-num-button { 141 | display: inline-block; 142 | width: 45rpx; 143 | height: 45rpx; 144 | font-size: 30rpx; 145 | color: white; 146 | line-height: 45rpx; 147 | border-radius: 60rpx; 148 | text-align: center; 149 | position: absolute; 150 | right: 2rpx; 151 | border: solid white 2rpx; 152 | margin-top: 4rpx; 153 | } 154 | 155 | .cart-item-total-car-button { 156 | display: inline-block; 157 | width: 45rpx; 158 | height: 45rpx; 159 | font-size: 30rpx; 160 | color: white; 161 | line-height: 45rpx; 162 | border-radius: 60rpx; 163 | text-align: center; 164 | position: absolute; 165 | right: 2rpx; 166 | border: solid white 2rpx; 167 | margin-top: 4rpx; 168 | } 169 | 170 | .cart-item-total-car-button image { 171 | width: 30rpx; 172 | height: 30rpx; 173 | margin: 0 auto; 174 | } 175 | 176 | /*菜单wrap*/ 177 | 178 | .menu-wrp { 179 | overflow: hidden; 180 | width: 100%; 181 | height: 1020rpx; 182 | display: flex; 183 | /* margin-top: rpx; */ 184 | margin-left: 1rpx; 185 | background-color: white; 186 | flex-direction: row; 187 | } 188 | 189 | /*左侧菜单*/ 190 | 191 | .menu-item-wrp { 192 | text-align: center; 193 | } 194 | 195 | .menu-item { 196 | width: 200rpx; 197 | height: 200rpx; 198 | color: #fff; 199 | display: flex; 200 | justify-content: center; 201 | align-items: center; 202 | } 203 | 204 | .m-item-icon { 205 | width: 100rpx; 206 | height: 100rpx; 207 | margin: 0 auto; 208 | border-radius: 50%; 209 | } 210 | 211 | .m-item-title { 212 | font-size: 24rpx; 213 | color: black; 214 | } 215 | 216 | .left-side { 217 | height: 1000rpx; 218 | padding-bottom: 88rpx; 219 | display: flex; 220 | width: 200rpx; 221 | background-color: #ededed; 222 | flex-direction: column; 223 | z-index: 1; 224 | } 225 | 226 | .left { 227 | color: "#454545"; 228 | float: left; 229 | width: 200rpx; 230 | overflow-y: auto; 231 | background-color: #ededed; 232 | flex-direction: column; 233 | } 234 | 235 | .left_none { 236 | float: left; 237 | width: 200rpx; 238 | height: 70rpx; 239 | } 240 | 241 | .type_none { 242 | float: left; 243 | width: 150rpx; 244 | height: 110rpx; 245 | font-size: 28rpx; 246 | background-color: #ededed; 247 | cursor: pointer; 248 | } 249 | 250 | .type_none_select { 251 | float: left; 252 | width: 150rpx; 253 | height: 110rpx; 254 | font-size: 28rpx; 255 | background-color: #fff; 256 | cursor: pointer; 257 | border-left: 4rpx solid #f25b02; 258 | } 259 | 260 | .type_none_text { 261 | float: left; 262 | margin-left: 20rpx; 263 | margin-top: 30rpx; 264 | } 265 | 266 | /*右侧菜品*/ 267 | 268 | .dish-category-title { 269 | font-size: 28rpx; 270 | color: #888; 271 | border-bottom: 1rpx solid #ededed; 272 | padding: 20rpx 0; 273 | margin-bottom: 6rpx; 274 | padding-left: 12rpx; 275 | } 276 | 277 | .right-side { 278 | width: 100%; 279 | /*height: 1000rpx;*/ 280 | color: #fff; 281 | justify-content: center; 282 | align-items: center; 283 | } 284 | 285 | .menu-footer { 286 | height: 100rpx; 287 | } 288 | 289 | /*菜品信息*/ 290 | 291 | .dish-item { 292 | width: 100%; 293 | padding: 16rpx 0; 294 | } 295 | 296 | .dish-item-wrp { 297 | width: 100%; 298 | display: flex; 299 | flex-direction: row; 300 | padding-left: 12rpx; 301 | } 302 | 303 | .dish-item-pic { 304 | width: 128rpx; 305 | float: right; 306 | } 307 | 308 | .dish-item-pic image { 309 | width: 128rpx; 310 | height: 80rpx; 311 | margin: 0 auto; 312 | } 313 | 314 | .dish-item-info { 315 | width: 220rpx; 316 | padding-left: 16rpx; 317 | } 318 | 319 | .dish-item-name { 320 | color: #454545; 321 | font-size: 36rpx; 322 | line-height: 50rpx; 323 | font-family: Microsoft YaHei; 324 | } 325 | 326 | .dish-item-sales { 327 | color: #ccc; 328 | font-size: 20rpx; 329 | line-height: 50rpx; 330 | } 331 | 332 | .dish-item-money_nouse { 333 | color: #454545; 334 | font-size: 20rpx; 335 | text-decoration: line-through; 336 | line-height: 50rpx; 337 | } 338 | 339 | .dish-item-money { 340 | color: #5cba42; 341 | font-size: 26rpx; 342 | line-height: 50rpx; 343 | } 344 | 345 | .dish-item-money_nouse_detail { 346 | color: gray; 347 | text-decoration: line-through; 348 | float: left; 349 | font-size: 26rpx; 350 | margin-left: 20rpx; 351 | margin-top: 18rpx; 352 | } 353 | 354 | .dish-item-money_detail { 355 | color: #5cba42; 356 | font-size: 46rpx; 357 | float: left; 358 | margin-left: 20rpx; 359 | } 360 | 361 | .dish-item-select { 362 | width: 50rpx; 363 | padding-left: 16rpx; 364 | } 365 | 366 | .dish-item-select image { 367 | width: 50rpx; 368 | height: 50rpx; 369 | margin-top: 23rpx; 370 | } 371 | 372 | .dish-item-select-saoji { 373 | width: 60rpx; 374 | height: 30rpx; 375 | margin-top: 23rpx; 376 | } 377 | 378 | .dish-footer { 379 | /*background: red;*/ 380 | height: 100rpx; 381 | } 382 | 383 | /*操作菜品数量*/ 384 | 385 | .dish-item-count { 386 | width: 260rpx; 387 | display: flex; 388 | font-size: 26rpx; 389 | float: right; 390 | } 391 | 392 | .dish-item-tab { 393 | width: 50rpx; 394 | height: 50rpx; 395 | } 396 | 397 | .dish-item-count-minus { 398 | width: 50rpx; 399 | height: 50rpx; 400 | } 401 | 402 | .dish-item-count-text { 403 | color: #333; 404 | font-size: 31rpx; 405 | line-height: 60rpx; 406 | text-align: center; 407 | margin-left: 5rpx; 408 | } 409 | 410 | .dish-item-count-plus { 411 | width: 50rpx; 412 | height: 50rpx; 413 | } 414 | 415 | input { 416 | display: block; 417 | background: #fff; 418 | border: #f25b02 solid 1rpx; 419 | margin-top: 30rpx; 420 | margin-left: 35rpx; 421 | align-self: center; 422 | color: black; 423 | border-radius: 8rpx; 424 | width: 90%; 425 | height: 90rpx; 426 | } 427 | 428 | /*选择口味*/ 429 | 430 | /*.cell-select { 431 | margin-left: 40%; 432 | margin-top: 8px; 433 | width: 48px; 434 | height: 23px; 435 | float: left; 436 | text-align: center; 437 | line-height: 23px; 438 | border-radius: 5px; 439 | border: 1px solid #aeaeae; 440 | font-size: 12px; 441 | color: #858585; 442 | }*/ 443 | 444 | .select-whole { 445 | margin-left: 10rpx; 446 | margin-top: 5px; 447 | width: 65px; 448 | height: 23px; 449 | float: left; 450 | text-align: center; 451 | line-height: 23px; 452 | border-radius: 5px; 453 | border: 1px solid #aeaeae; 454 | font-size: 12px; 455 | color: #858585; 456 | } 457 | 458 | .select-whole-right { 459 | height: 20px; 460 | float: right; 461 | text-align: center; 462 | line-height: 20px; 463 | border-radius: 5px; 464 | border: 1px solid #aeaeae; 465 | font-size: 12px; 466 | color: #858585; 467 | margin-right: 8rpx; 468 | } 469 | 470 | .active { 471 | border-color: #f25b02; 472 | color: #f25b02; 473 | } 474 | 475 | /*弹窗*/ 476 | 477 | .goods-detail .mask { 478 | position: fixed; 479 | left: 0; 480 | top: 0; 481 | width: 100%; 482 | height: 100%; 483 | z-index: 999999; 484 | } 485 | 486 | .goods-detail .mask { 487 | background: rgba(0, 0, 0, 0.7); 488 | } 489 | 490 | .close-zhuce { 491 | position: fixed; 492 | z-index: 99999999999999; 493 | top: 85%; 494 | left: 45%; 495 | color: #fff; 496 | font-size: 70rpx; 497 | width: 80rpx; 498 | height: 80rpx; 499 | line-height: 60rpx; 500 | /*border: 2rpx solid #fff;*/ 501 | text-align: center; 502 | border-radius: 60rpx; 503 | background-size: 100%; 504 | background-color: #a5a5a5; 505 | border: none; 506 | } 507 | 508 | .winZhuce { 509 | position: fixed; 510 | top: 40%; 511 | width: 75%; 512 | height: 850rpx; 513 | left: 13%; 514 | margin-top: -400rpx; 515 | background: #de5447; 516 | z-index: 999999; 517 | border-radius: 10px; 518 | overflow: hidden; 519 | } 520 | 521 | .winZhuce-title { 522 | border-bottom: 1rpx solid #dcefad; 523 | left: 15rpx; 524 | text-align: center; 525 | padding-top: 20rpx; 526 | padding-bottom: 20rpx; 527 | color: #dcefad; 528 | } 529 | 530 | .winZhuce-item { 531 | left: 15rpx; 532 | } 533 | 534 | .winZhuce-fendian { 535 | text-align: center; 536 | width: 100%; 537 | max-width: 960rpx; 538 | margin: 0 auto; 539 | padding: 15rpx 5rpx; 540 | margin-top: 150rpx; 541 | color: #FFC4A1; 542 | font-size: 30rpx; 543 | } 544 | .winZhuce-fale { 545 | text-align: center; 546 | width: 100%; 547 | max-width: 960rpx; 548 | margin: 0 auto; 549 | color: #FFC4A1; 550 | font-size: 30rpx; 551 | } 552 | .winZhuce-wancheng { 553 | text-align: center; 554 | width: 100%; 555 | max-width: 960rpx; 556 | margin: 0 auto; 557 | padding: 15rpx 5rpx; 558 | color: #dcefad; 559 | margin-top: 30rpx; 560 | } 561 | 562 | .winZhuce-item-name { 563 | text-align: left; 564 | padding-left: 40rpx; 565 | } 566 | 567 | .winZhuce-item-check { 568 | margin-left: 100rpx; 569 | } 570 | 571 | .winZhuce-btn { 572 | font-size: 80rpx; 573 | font-weight: bold; 574 | color: black; 575 | background: #dcefad; 576 | text-align: center; 577 | width: 200rpx; 578 | height: 200rpx; 579 | margin-left: 30%; 580 | margin-top: 70rpx; 581 | border-radius: 100rpx; 582 | } 583 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | //var host = 'weixincaidan.xyz/Xiaochengxu'; 2 | var host = 'wechatscan.com/Xiaochengxu'; 3 | var config = { 4 | service: { 5 | host, 6 | // 登录地址,用于建立会话 7 | loginUrl: `https://${host}`, 8 | getMenuUrl: `https://${host}/GetMenu`, 9 | getOrderUrl: `https://${host}/GetOrder`, 10 | submitOrderUrl: `https://${host}/submitOrder`, 11 | CancelItemUrl: `https://${host}/CancelItem`, 12 | getFirstPageUrl: `https://${host}/firstPage`, 13 | fuwuyuanUrl: `https://${host}/fuwu`, 14 | errorUrl: `https://${host}/error`, 15 | chongzhiUrl: `https://${host}/chongzhi`, 16 | getPhoneNumberUrl: `https://${host}/getPhoneNumber`, 17 | saveClientInfoUrl: `https://${host}/saveClientInfo`, 18 | keyongYouhuiquanUrl: `https://${host}/keyongYouhuiquan`, 19 | // 测试的信道服务地址 20 | tunnelUrl: `https://${host}/tunnel`, 21 | } 22 | }; 23 | 24 | module.exports = config; -------------------------------------------------------------------------------- /page/diancan/index.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:diancan/index 5 | 文件功能描述:点餐首页 6 | 7 | ----------------------------------------------------------------*/ 8 | /*import allmenu from '../../page/resources/json/menus.js'*/ 9 | var util = require('../../util/util.js') 10 | var app = getApp() 11 | var qcloud = require('../../util/vendor/qcloud-weapp-client-sdk/index'); 12 | var config = require('../../config'); 13 | var util = require('../../util/util.js'); 14 | var QQMapWX = require('../../util/qqmap-wx-jssdk.js'); 15 | var qqmapsdk; 16 | //几个栏位错用 cai.fendianid 用于口味id cai.fendianmingcheng用于口味名称 17 | //fenlei.url用于分类数量累计 18 | Page({ 19 | data: { 20 | duration: 1200, 21 | toView: 'blue', 22 | menus: app.globalData.menus, 23 | selectedMenuId: 1, 24 | total: app.globalData.total, 25 | showGoodsDetail: false, 26 | goodsDetailUrl: '', 27 | goodsDetailName: '', 28 | goodsDetailMemo: '', 29 | goodsDetailSalePrice: 0.00, 30 | goodsDetailMenberPrice: 0.00, 31 | goodsDetailDanwei: '例', 32 | goodsDetailTuijian: 0, 33 | goodsDetailId: 0, 34 | goodsDetailMenuId: 0, 35 | animationData: {}, 36 | hidAnim: true, 37 | X: 0, 38 | Y: 0, 39 | lastX: 0, 40 | lastY: 0, 41 | targetX: 200, 42 | targetY: 600, 43 | currGoods: null, 44 | selectedKouWeiMingCheng: '', 45 | canDiancan: true, //因地理位置限制 是否限制用户看本店菜单 46 | userDenyLocaltion: false, //用户拒绝地理位置授权,需要显示“重新获取地理位置” 47 | canDiancanChangjing: true, 48 | yincangShouquan: true, //隐藏用户授权 49 | aFendian: {},//分店对象 50 | aZhuozi: {},//桌子对象 51 | aKehu: {}//分店对象 52 | }, 53 | selectMenu: function (event) { 54 | let data = event.currentTarget.dataset 55 | this.setData({ 56 | toView: data.tag, 57 | selectedMenuId: data.id 58 | }) 59 | }, 60 | selectKouWei: function (event) { 61 | let data = event.currentTarget.dataset 62 | util.arrfind(util.arrfind(app.globalData.menus, this.data.currGoods.fenleiid).dishs, this.data.currGoods.id).fendianid = 0; 63 | util.arrfind(util.arrfind(app.globalData.menus, this.data.currGoods.fenleiid).dishs, this.data.currGoods.id).fendianmingcheng = data.name; 64 | this.setData({ 65 | 'menus': app.globalData.menus, 66 | currGoods: util.arrfind(util.arrfind(app.globalData.menus, this.data.currGoods.fenleiid).dishs, this.data.currGoods.id) 67 | }) 68 | }, 69 | addCount: function (event) { 70 | let data = event.currentTarget.dataset 71 | let menu = util.arrfind(this.data.menus, data.cid) 72 | let aDish = util.arrfind(menu.dishs, data.id) 73 | if (aDish != null && aDish.kouWeiList != null && aDish.fendianid > 0 && data.hide != 'true') { 74 | this.selectItem(event); 75 | return 76 | } 77 | if (menu.url == null) { 78 | menu.url = 0; 79 | util.arrfind(app.globalData.menus, data.cid).url = 0; 80 | } 81 | if (data.hide == 'true') { 82 | if (aDish != null && aDish.kouWeiList != null && aDish.fendianid > 0) { 83 | util.showFailModal('提示', '请选择口味或做法。'); 84 | return 85 | } 86 | this.hideGoodsDetail(); 87 | } 88 | menu.url += 1; 89 | util.arrfind(app.globalData.menus, data.cid).url += 1; 90 | let dish = util.arrfind(menu.dishs, data.id) 91 | dish.count += 1; 92 | this.data.total.count += 1 93 | this.data.total.money = (parseFloat(this.data.total.money) + parseFloat(dish.huiyuanjia)).toFixed(2) 94 | app.globalData.total.count += 1 95 | app.globalData.total.money = (parseFloat(app.globalData.total.money) + parseFloat(dish.huiyuanjia)).toFixed(2) 96 | util.arrfind(util.arrfind(app.globalData.menus, data.cid).dishs, data.id).count += 1; 97 | 98 | // 获取click事件Y坐标 99 | var tranX = event.touches[0].pageX - this.data.targetX; 100 | var tranY = event.touches[0].pageY - this.data.targetY; 101 | this.setData({ 102 | menus: this.data.menus, 103 | total: this.data.total, 104 | hidAnim: true, 105 | X: event.touches[0].pageX - tranX, 106 | Y: event.touches[0].pageY - tranY 107 | }) 108 | 109 | var aAnimation = wx.createAnimation({ 110 | duration: 100, 111 | timingFunction: 'linear', 112 | delay: 0 113 | }) 114 | this.animation = aAnimation 115 | 116 | //回来 117 | // setTimeout(function () { 118 | aAnimation.translate(tranX, tranY).step() 119 | this.setData({ 120 | animationData: aAnimation.export() 121 | }) 122 | //}.bind(this), 500); 123 | //下去 124 | this.setData({ 125 | hidAnim: false 126 | }) 127 | aAnimation = wx.createAnimation({ 128 | duration: 3000, 129 | timingFunction: 'linear', 130 | delay: 0 131 | }) 132 | this.animation = aAnimation 133 | setTimeout(function () { 134 | aAnimation.translate((-1) * tranX, (-1) * tranY).step() 135 | this.setData({ 136 | animationData: aAnimation.export() 137 | }) 138 | }.bind(this), 100); 139 | 140 | 141 | //记录本次位置,作为下次新位置 142 | this.data.lastX = event.touches[0].pageX; 143 | this.data.lastY = event.touches[0].pageY; 144 | }, 145 | minusCount: function (event) { 146 | let data = event.currentTarget.dataset 147 | let menu = util.arrfind(this.data.menus, data.cid) 148 | menu.url = menu.url - 1; 149 | util.arrfind(app.globalData.menus, data.cid).url -= 1; 150 | let dish = util.arrfind(menu.dishs, data.id) 151 | if (dish.count <= 0) 152 | return 153 | dish.count -= 1; 154 | this.data.total.count -= 1 155 | this.data.total.money = (this.data.total.money - dish.huiyuanjia).toFixed(2) 156 | app.globalData.total.count -= 1 157 | app.globalData.total.money = (app.globalData.total.money - dish.huiyuanjia).toFixed(2) 158 | util.arrfind(util.arrfind(app.globalData.menus, data.cid).dishs, data.id).count -= 1; 159 | this.setData({ 160 | menus: this.data.menus, 161 | total: this.data.total 162 | }) 163 | }, 164 | selectItem: function (event) { 165 | let data = event.currentTarget.dataset 166 | let menu = util.arrfind(this.data.menus, data.cid) 167 | if (menu.url == null) { 168 | menu.url = 0; 169 | util.arrfind(app.globalData.menus, data.cid).url = 0; 170 | } 171 | let dish = util.arrfind(menu.dishs, data.id) 172 | 173 | this.setData({ 174 | showGoodsDetail: true, 175 | goodsDetailUrl: dish.url, 176 | goodsDetailName: dish.caiming, 177 | goodsDetailMemo: dish.memo, 178 | goodsDetailSalePrice: dish.xiaoshoujia, 179 | goodsDetailMenberPrice: dish.huiyuanjia, 180 | goodsDetailDanwei: dish.danwei, 181 | goodsDetailTuijian: dish.tuijianzhishu, 182 | goodsDetailId: data.id, 183 | goodsDetailMenuId: data.cid, 184 | currGoods: dish 185 | }) 186 | }, 187 | hideGoodsDetail: function () { 188 | this.setData({ 189 | showGoodsDetail: false 190 | }); 191 | }, 192 | showGoodsDetail: function () { 193 | this.setData({ 194 | showGoodsDetail: true 195 | }); 196 | }, 197 | onShow: function () { 198 | this.setData({ 199 | 'menus': app.globalData.menus, 200 | 'total': app.globalData.total 201 | }); 202 | 203 | wx.setNavigationBarTitle({ 204 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng + app.globalData.moshi 205 | }); 206 | }, 207 | onReady: function () { 208 | /* setTimeout(function () { 209 | util.hideBusy(); 210 | }.bind(this), 2000);*/ 211 | }, 212 | onLoad: function (params) { 213 | util.showBusy('请稍候。。。'); 214 | var that = this 215 | if (params.zhuoziid) { 216 | app.globalData.zhuoziid = params.zhuoziid 217 | } 218 | 219 | if (!app.globalData.hasLogin) { 220 | wx.login({ 221 | success: function (loginResult) { 222 | wx.getUserInfo({ 223 | success: function (userResult) { 224 | app.globalData.hasLogin = true; 225 | userResult.userInfo.code = loginResult.code; 226 | app.globalData.userInfo = userResult.userInfo; 227 | that.requestWrap(); 228 | }, 229 | fail: function (userError) { 230 | app.globalData.hasLogin = false; 231 | if (app.globalData.aFendian.zhifu){ 232 | that.setData({ 233 | yincangShouquan: false 234 | }); 235 | } 236 | that.requestWrap(); 237 | }, 238 | }); 239 | }, 240 | fail: function (loginError) { 241 | util.hideBusy(); 242 | app.globalData.hasLogin = false; 243 | util.showFailModal('微信登陆失败,原因可能是首次登陆本门店,请关闭程序后重新扫描登陆。', loginError); 244 | }, 245 | complete: function () { 246 | } 247 | }); 248 | } 249 | else { 250 | that.requestWrap(); 251 | } 252 | }, 253 | onShareAppMessage: function () { 254 | return { 255 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng, 256 | path: '/page/shop/shop?zhuoziid=' + app.globalData.zhuoziid 257 | } 258 | }, 259 | dorequest: function () { 260 | var that = this 261 | //请求数据 262 | qcloud.request({ 263 | url: config.service.getMenuUrl, 264 | hasLogin: app.globalData.hasLogin, 265 | data: { 266 | zhuoziid: app.globalData.zhuoziid, 267 | hasLogin: app.globalData.hasLogin, 268 | userInfo: JSON.stringify(app.globalData.userInfo), 269 | phonemodel: app.globalData.phonemodel, 270 | phonesystem: app.globalData.phonesystem, 271 | networkType: app.globalData.networkType, 272 | scene: app.globalData.scene 273 | }, 274 | success: function (requestResult) { 275 | if (requestResult.statusCode == 200) 276 | if (requestResult.data.code == 200) { 277 | app.globalData.menus = requestResult.data.data; 278 | app.globalData.userInfo.openId = app.globalData.userInfo.openId ? app.globalData.userInfo.openId: requestResult.data.openId; 279 | app.globalData.userInfo.session_key = app.globalData.userInfo.session_key ? app.globalData.userInfo.session_key : requestResult.data.session_key; 280 | app.globalData.aFendian = requestResult.data.aFendian; 281 | app.globalData.aZhuozi = requestResult.data.aZhuozi; 282 | app.globalData.aKehu = requestResult.data.aKehu; 283 | that.setData({ 284 | 'menus': app.globalData.menus, 285 | 'total': app.globalData.total, 286 | aFendian: app.globalData.aFendian, 287 | aZhuozi: app.globalData.aZhuozi, 288 | aKehu: app.globalData.aKehu 289 | }); 290 | wx.setNavigationBarTitle({ 291 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng + app.globalData.moshi 292 | }); 293 | //获取位置数据 294 | console.log('app.globalData.aFendian.phonecity', app.globalData.aFendian.phonecity) 295 | if (app.globalData.aFendian.phonecity == '' || app.globalData.aFendian.phonecity == null 296 | || app.globalData.aFendian.phonecity == undefined) { 297 | qqmapsdk = new QQMapWX({ 298 | key: 'PCLBZ-Q46LD-PO64S-PLAQW-ESMJF-RXBRZ' 299 | }); 300 | // 调用接口 301 | wx.getLocation({ 302 | type: 'gcj02', 303 | success: function (res) { 304 | app.globalData.hasGeo = true 305 | app.globalData.aFendian.lat = res.latitude 306 | app.globalData.aFendian.lng = res.longitude 307 | qqmapsdk.reverseGeocoder({ 308 | location: { 309 | latitude: app.globalData.aFendian.lat, 310 | longitude: app.globalData.aFendian.lng 311 | }, 312 | success: function (res) { 313 | app.globalData.hasGeo = true 314 | if (res.status == 0) { 315 | app.globalData.aFendian.phoneaddress = res.result.address 316 | app.globalData.aFendian.phoneprovince = res.result.address_component.province 317 | app.globalData.aFendian.phonecity = res.result.address_component.city 318 | app.globalData.aFendian.phonedistrict = res.result.address_component.district 319 | app.globalData.aFendian.phonestreet = res.result.address_component.street 320 | app.globalData.aFendian.phonestreet_number = res.result.address_component.street_number 321 | } 322 | else { 323 | app.globalData.aFendian.address = res.status 324 | } 325 | }, 326 | fail: function (res) { 327 | console.log(res); 328 | }, 329 | complete: function (res) { 330 | } 331 | }); 332 | } 333 | }); 334 | } 335 | util.hideBusy(); 336 | } 337 | else { 338 | util.hideBusy(); 339 | util.showFailModal('提示', requestResult.data.code + ':' + requestResult.data.message); 340 | } 341 | else { 342 | util.hideBusy(); 343 | util.showFailModal('网络错误:', requestResult.data.message); 344 | } 345 | }, 346 | fail: function (requestResult) { 347 | util.hideBusy(); 348 | util.showFailModal('获取服务器数据失败。', requestResult); 349 | }, 350 | }); 351 | }, 352 | requestWrap: function () { 353 | var that = this 354 | 355 | //判断是否在允许的范围内 356 | if (app.globalData.aFendian.keyongbanjing > 0 && app.globalData.aFendian.lat > 0 && app.globalData.aFendian.lng > 0) { 357 | //计算距离 358 | qqmapsdk = new QQMapWX({ 359 | key: 'PCLBZ-Q46LD-PO64S-PLAQW-ESMJF-RXBRZ' 360 | }); 361 | wx.getLocation({ 362 | type: 'gcj02', 363 | success: function (res) { 364 | qqmapsdk.calculateDistance({ 365 | mode: 'walking', 366 | to: [{ 367 | latitude: app.globalData.aFendian.lat, 368 | longitude: app.globalData.aFendian.lng 369 | }], 370 | success: function (res) { 371 | if (res.status == 0) { 372 | if (res.result.elements[0].distance < app.globalData.aFendian.keyongbanjing) { 373 | that.setData({ 374 | userDenyLocaltion: false, 375 | canDiancan: true 376 | }) 377 | that.dorequest() 378 | } 379 | else { 380 | that.setData({ 381 | userDenyLocaltion: false, 382 | canDiancan: false 383 | }) 384 | util.hideBusy(); 385 | } 386 | } 387 | else { 388 | that.setData({ 389 | userDenyLocaltion: false, 390 | canDiancan: false 391 | }) 392 | util.hideBusy(); 393 | } 394 | }, 395 | fail: function (res) { 396 | console.log('calculateDistance-fail', res); 397 | that.setData({ 398 | userDenyLocaltion: false, 399 | canDiancan: false 400 | }) 401 | util.hideBusy(); 402 | }, 403 | complete: function (res) { 404 | } 405 | }); 406 | }, 407 | fail: function (res) { 408 | util.hideBusy(); 409 | console.log('wx.getLocation-fail', res); 410 | that.setData({ 411 | userDenyLocaltion: true, 412 | canDiancan: false 413 | }) 414 | } 415 | }); 416 | } 417 | else 418 | this.dorequest() 419 | }, 420 | 421 | reLocaltion: function () { 422 | var that = this 423 | //获取用户授权 424 | if (wx.getSetting) { 425 | wx.getSetting({ 426 | success(res) { 427 | console.log(res); 428 | if (!res.authSetting['scope.userLocation']) { 429 | wx.openSetting({ 430 | success: (res) => { 431 | res.authSetting = { 432 | "scope.userLocation": true 433 | } 434 | that.requestWrap() 435 | } 436 | }) 437 | } 438 | } 439 | }); 440 | } 441 | }, 442 | 443 | reAuthor: function () { 444 | var that = this 445 | //获取用户授权 446 | if (wx.getSetting) { 447 | wx.getSetting({ 448 | success(res) { 449 | console.log(res); 450 | if (!res.authSetting['scope.userInfo']) { 451 | wx.openSetting({ 452 | success: (res) => { 453 | res.authSetting = { 454 | "scope.userInfo": true 455 | } 456 | if (!app.globalData.hasLogin) { 457 | wx.login({ 458 | success: function (loginResult) { 459 | wx.getUserInfo({ 460 | success: function (userResult) { 461 | app.globalData.hasLogin = true; 462 | userResult.userInfo.code = loginResult.code; 463 | app.globalData.userInfo = userResult.userInfo; 464 | that.setData({ 465 | yincangShouquan: true 466 | }); 467 | }, 468 | fail: function (userError) { 469 | app.globalData.hasLogin = false; 470 | if (app.globalData.aFendian.zhifu) { 471 | that.setData({ 472 | yincangShouquan: false 473 | }); 474 | } 475 | }, 476 | }); 477 | }, 478 | fail: function (loginError) { 479 | app.globalData.hasLogin = false; 480 | if (app.globalData.aFendian.zhifu) { 481 | that.setData({ 482 | yincangShouquan: false 483 | }); 484 | } 485 | util.showFailModal('微信登陆失败,原因可能是首次登陆本门店,请关闭程序后重新扫描登陆。', loginError); 486 | }, 487 | complete: function () { 488 | } 489 | }); 490 | } 491 | } 492 | }) 493 | } 494 | } 495 | }); 496 | } 497 | }, 498 | }) -------------------------------------------------------------------------------- /page/diancan/index.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /page/diancan/index.wxml: -------------------------------------------------------------------------------- 1 | 9 | 17 | 25 | -------------------------------------------------------------------------------- /page/diancan/index.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | font-family: "微软雅黑"; 3 | padding-bottom: 100rpx; 4 | } 5 | 6 | .clear { 7 | clear: both; 8 | } 9 | 10 | .header { 11 | position: fixed; 12 | display: -webkit-flex; 13 | left: 0; 14 | top: 0; 15 | width: 100%; 16 | padding: 0; 17 | box-sizing: border-box; 18 | z-index: 1; 19 | background: #fff; 20 | height: 80rpx; 21 | line-height: 80rpx; 22 | } 23 | 24 | .header { 25 | display: -webkit-flex; 26 | position: fixed; 27 | display: -webkit-flex; 28 | left: 0; 29 | top: 0; 30 | width: 100%; 31 | padding: 0; 32 | box-sizing: border-box; 33 | z-index: 19999999999999999999; 34 | background: #fff; 35 | height: 80rpx; 36 | line-height: 80rpx; 37 | } 38 | 39 | .header .filter { 40 | width: 50%; 41 | text-align: center; 42 | color: #3c3c3c; 43 | font-size: 30rpx; 44 | } 45 | 46 | .header .left { 47 | color: #f38815; 48 | border-bottom: 1px solid #f38815; 49 | } 50 | 51 | .shop { 52 | position: relative; 53 | top: 20rpx; 54 | padding: 10rpx 0; 55 | margin-bottom: 200rpx; 56 | } 57 | 58 | .shop .goods { 59 | width: 50%; 60 | float: left; 61 | text-align: center; 62 | } 63 | 64 | .shop .goods .goodsbox { 65 | background: #fff; 66 | width: 90%; 67 | margin: 0 auto; 68 | height: 400rpx; 69 | position: relative; 70 | margin-top: 30rpx; 71 | box-shadow: 0 0 5px #eee; 72 | } 73 | 74 | .shop .goods image { 75 | width: 100%; 76 | height: 250rpx; 77 | } 78 | 79 | /*下方购物车*/ 80 | 81 | .cart-detail, .cart-detail .mask { 82 | position: fixed; 83 | left: 0; 84 | top: 0; 85 | width: 100%; 86 | height: 100%; 87 | z-index: 999999; 88 | } 89 | 90 | .cart-detail .mask { 91 | background: rgba(0, 0, 0, 0.7); 92 | } 93 | 94 | .cart-detail .list { 95 | position: absolute; 96 | left: 0; 97 | bottom: 100rpx; 98 | width: 100%; 99 | background: #f7f7f7; 100 | padding: 0 0 70rpx; 101 | z-index: 9999999; 102 | } 103 | 104 | .cart-detail .list .item { 105 | display: -webkit-flex; 106 | color: #333; 107 | font-size: 36rpx; 108 | line-height: 50rpx; 109 | padding: 20rpx 40rpx; 110 | border-bottom: 1px solid #d5d5d5; 111 | } 112 | 113 | .cart-detail .list .item .name { 114 | -webkit-flex: 1; 115 | font-size: 30rpx; 116 | color: #606060; 117 | } 118 | 119 | .cart-detail .list .item .total { 120 | width: 120rpx; 121 | font-size: 36rpx; 122 | color: #373737; 123 | font-weight: bold; 124 | } 125 | 126 | .cart-detail .list .item .reduce, .cart-detail .list .item .add { 127 | font-size: 50rpx; 128 | background: #4a4a4a; 129 | width: 50rpx; 130 | height: 50rpx; 131 | text-align: center; 132 | border-radius: 50%; 133 | color: #fff; 134 | line-height: 40rpx; 135 | border: 1px solid #4a4a4a; 136 | } 137 | 138 | .cart-detail .list .item .reduce { 139 | background: #fff; 140 | color: #4a4a4a; 141 | border: 1px solid #4a4a4a; 142 | } 143 | 144 | .cart-detail .list .item .num { 145 | width: 50rpx; 146 | text-align: center; 147 | margin: 0 5rpx; 148 | color: #4a4a4a; 149 | } 150 | 151 | .cart { 152 | display: -webkit-flex; 153 | position: fixed; 154 | left: 0; 155 | bottom: 0; 156 | width: 100%; 157 | height: 100rpx; 158 | background: #3c3d41; 159 | z-index: 999999; 160 | } 161 | 162 | .cart .data { 163 | -webkit-flex: 1; /*border-top: 1rpx solid #e7e7e7;*/ 164 | } 165 | 166 | .cart .data .icon { 167 | position: absolute; 168 | left: 40rpx; 169 | top: -40rpx; 170 | width: 100rpx; 171 | height: 100rpx; 172 | background: #393939; 173 | border-radius: 50%; 174 | border: 5px solid #3c3d41; 175 | box-shadow: 0 0 5px #000; 176 | } 177 | 178 | .cart .data .icon image { 179 | position: absolute; 180 | left: 15rpx; 181 | top: 15rpx; 182 | width: 70rpx; 183 | height: 70rpx; 184 | } 185 | 186 | .cart .data .icon .count { 187 | position: absolute; 188 | left: 70rpx; 189 | top: -20rpx; 190 | font-size: 30rpx; 191 | width: 50rpx; 192 | height: 50rpx; 193 | line-height: 50rpx; 194 | color: #fff; 195 | background: #f45044; 196 | border-radius: 50%; 197 | text-align: center; 198 | } 199 | 200 | .cart .data .total { 201 | color: #f45044; 202 | font-size: 36rpx; 203 | line-height: 100rpx; 204 | padding-left: 160rpx; 205 | } 206 | 207 | .cart button { 208 | width: 200rpx; 209 | height: 100%; 210 | font-size: 30rpx; 211 | background: #f38815; 212 | color: #fff; 213 | line-height: 100rpx; 214 | border-radius: 0; 215 | } 216 | 217 | .cart button[disabled][type="default"], wx-button[disabled]:not([type]) { 218 | color: #fff; 219 | background-color: #333; 220 | } 221 | 222 | .carttit { 223 | background: #e5e5e5; 224 | padding: 0 20rpx; 225 | height: 100rpx; 226 | line-height: 100rpx; 227 | } 228 | 229 | .carttit0 { 230 | width: 200rpx; 231 | height: 50rpx; 232 | font-size: 30rpx; 233 | float: left; 234 | color: #4a4a4a; 235 | margin-top: 25rpx; 236 | line-height: 50rpx; 237 | border-left: 3px solid #ffd600; 238 | text-indent: 15rpx; 239 | } 240 | 241 | .cartempty { 242 | font-size: 30rpx; 243 | float: right; 244 | color: #4a4a4a; 245 | text-align: right; 246 | } 247 | 248 | .carttxt { 249 | padding: 0 20rpx; 250 | height: 80rpx; 251 | line-height: 80rpx; 252 | border-bottom: 1px solid #d5d5d5; 253 | } 254 | 255 | .carttxt0 { 256 | width: 100rpx; 257 | height: 50rpx; 258 | font-size: 24rpx; 259 | float: left; 260 | color: #f38d1e; 261 | margin-top: 15rpx; 262 | line-height: 50rpx; 263 | border: 1px solid #f38d1e; 264 | text-align: center; 265 | border-radius: 3px; 266 | margin-right: 5px; 267 | } 268 | 269 | .carttxt1 { 270 | float: left; 271 | font-size: 24rpx; 272 | color: #4a4a4a; 273 | text-align: right; 274 | } 275 | 276 | .cartimg { 277 | width: 30rpx; 278 | height: 40rpx; 279 | position: relative; 280 | top: 8rpx; 281 | margin-right: 3px; 282 | } 283 | 284 | 285 | 286 | .goodsdetail { 287 | position: fixed; 288 | top: 50%; 289 | width: 90%; 290 | height: 760rpx; 291 | left: 5%; 292 | margin-top: -400rpx; 293 | background: #fff; 294 | z-index: 999999; 295 | border-radius: 10px; 296 | overflow: hidden; 297 | } 298 | 299 | .banner { 300 | height: 500rpx; 301 | border-radius: 10px; 302 | } 303 | 304 | .banner image { 305 | width: 100%; 306 | height: 100%; 307 | border-radius: 10px 10px 0 0; 308 | } 309 | 310 | .goodsdetail .title1 { 311 | padding: 10rpx 20rpx; 312 | color: #3c3c3c; 313 | font-size: 36rpx; 314 | } 315 | 316 | .goodsdetail .title2 { 317 | padding: 5rpx 20rpx; 318 | color: #3c3c3c; 319 | font-size: 24rpx; 320 | text-align: left; 321 | line-height: 30rpx; 322 | height: 30rpx; 323 | } 324 | 325 | .goodsdetail .title3 { 326 | padding: 5rpx 20rpx; 327 | color: #3c3c3c; 328 | font-size: 24rpx; 329 | } 330 | 331 | .goodsdetail .title3 image { 332 | width: 24rpx; 333 | height: 24rpx; 334 | } 335 | 336 | .goodsdetail .title4 { 337 | width: 100%; 338 | position: absolute; 339 | color: #3c3c3c; 340 | top:520rpx; 341 | left:270rpx; 342 | } 343 | 344 | .goodsdetail .title5 { 345 | width: 70%; 346 | float: left; 347 | font-size: 36rpx; 348 | } 349 | 350 | .goodsdetail .title6 { 351 | width: 170rpx; 352 | height: 80rpx; 353 | font-size: 24rpx; 354 | line-height: 80rpx; 355 | background: #f25b02; 356 | color: #fff; 357 | text-align: center; 358 | border-radius: 5px; 359 | position: fixed; 360 | top: 680rpx; 361 | left:510rpx; 362 | } 363 | 364 | .goodsdetail .title7 { 365 | height: 80rpx; 366 | font-size: 24rpx; 367 | float: right; 368 | color: #4a4a4a; 369 | text-align: center; 370 | margin-right: 30rpx; 371 | border-radius: 5px; 372 | } 373 | 374 | .goodsdetail .title7 .reduce, .goodsdetail .title7 .add { 375 | font-size: 50rpx; 376 | background: #feb70f; 377 | width: 50rpx; 378 | height: 50rpx; 379 | text-align: center; 380 | border-radius: 50%; 381 | float: left; 382 | line-height: 50rpx; 383 | } 384 | 385 | .goodsdetail .title7 .num { 386 | float: left; 387 | width: 50rpx; 388 | line-height: 50rpx; 389 | text-align: center; 390 | margin: 0 10rpx; 391 | } 392 | 393 | .close-bg { 394 | position: fixed; 395 | z-index: 99999999999999; 396 | top: 85%; 397 | left: 45%; 398 | color: #fff; 399 | font-size: 35px; 400 | width: 40px; 401 | height: 40px; 402 | line-height: 30px; 403 | /*border: 1px solid #fff;*/ 404 | text-align: center; 405 | border-radius: 30px; 406 | background-size: 100%; 407 | background-color: #a5a5a5; 408 | border: none; 409 | } 410 | 411 | -------------------------------------------------------------------------------- /page/fuwu/fuwu.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:fuwu/index 5 | 文件功能描述:服务 6 | 7 | ----------------------------------------------------------------*/ 8 | // page/shop/index.js 9 | var imageUtil = require('../../util/autoheight.js') 10 | var util = require('../../util/util.js') 11 | var qcloud = require('../../util/vendor/qcloud-weapp-client-sdk/index') 12 | var config = require('../../config') 13 | var app = getApp() 14 | Page({ 15 | data: { 16 | focus:false, 17 | fuwuNeirong:'', 18 | fuwuBeizhu:'', 19 | items: [ 20 | { name: '餐巾纸', value: '餐巾纸' }, 21 | { name: '茶水', value: '茶水' }, 22 | { name: '牙签', value: '牙签' }, 23 | { name: '打包', value: '打包' }, 24 | { name: '起菜', value: '起菜' }, 25 | { name: '米饭', value: '米饭' }, 26 | { name: '其他', value: '其他' }, 27 | ] 28 | }, 29 | radioChange: function (e) { 30 | console.log('radio发生change事件,携带value值为:', e.detail.value) 31 | this.data.fuwuNeirong = e.detail.value 32 | if (e.detail.value == '其他') 33 | { 34 | this.setData({ 35 | focus: true 36 | }) 37 | } 38 | }, 39 | bindback: function (event) { 40 | wx.navigateBack({ 41 | delta: 1, // 回退前 delta(默认为1) 页面 42 | success: function (res) { 43 | console.log('返回ok') 44 | }, 45 | fail: function () { 46 | console.log('返回fail') 47 | }, 48 | complete: function () { 49 | // complete 50 | } 51 | }) 52 | }, 53 | charChange: function (e) { 54 | this.setData({ 55 | fuwuBeizhu: e.detail.value 56 | }); 57 | }, 58 | bindsubmit: function (event) { 59 | var that = this 60 | var beizhu='' 61 | if (that.data.fuwuNeirong == '' && that.data.fuwuBeizhu =='') 62 | { 63 | util.showFailModal('发送内容不能为空') 64 | return; 65 | } 66 | if (that.data.fuwuBeizhu !='') 67 | beizhu = ' ' + that.data.fuwuBeizhu 68 | var fuwuContent = app.globalData.aZhuozi.zhuozimingcheng + '需要:' + that.data.fuwuNeirong + beizhu 69 | wx.showModal({ 70 | title: '即将发商户处理:', 71 | content: fuwuContent, 72 | confirmText: "确定", 73 | cancelText: "取消", 74 | success: function (res) { 75 | console.log('that.fuwuContent:',fuwuContent); 76 | if (res.confirm) { 77 | var ret = true; 78 | var msg = ''; 79 | var tempdata = { 80 | fuwuContent: fuwuContent, 81 | zhuoziid: app.globalData.zhuoziid, 82 | hasLogin: app.globalData.hasLogin, 83 | userInfo: JSON.stringify(app.globalData.userInfo), 84 | }; 85 | util.showBusy; 86 | qcloud.request({ 87 | url: config.service.fuwuyuanUrl, 88 | hasLogin: app.globalData.hasLogin, 89 | data: tempdata, 90 | success(result) { 91 | if (result.statusCode == "200") { 92 | if (result.data.code == "200") { 93 | let ret = true; 94 | let msg = result.data.message; 95 | wx.showModal({ 96 | title: '', 97 | content: msg, 98 | showCancel: false, 99 | complete: function (res) { 100 | if (ret) { 101 | wx.switchTab({ 102 | url: '/page/my/my' 103 | }) 104 | } 105 | } 106 | }) 107 | } 108 | else { 109 | let ret = false; 110 | let msg = '出现异常,错误代码:' + result.data.code; 111 | wx.showModal({ 112 | title: '订单处理结果:', 113 | content: msg, 114 | showCancel: false, 115 | complete: function (res) { 116 | if (ret) { 117 | wx.switchTab({ 118 | url: '/page/my/my' 119 | }) 120 | } 121 | else { 122 | util.navigateBack1; 123 | } 124 | } 125 | }) 126 | //directret(false, '下单出现异常,请联系客服!' + '错误代码:' + result.data.code); 127 | } 128 | } 129 | else { 130 | let ret = false; 131 | let msg = '请求失败,' + '错误代码:' + result.statusCode; 132 | console.log(msg); 133 | console.log(result); 134 | wx.showModal({ 135 | title: '订单处理结果:', 136 | content: msg, 137 | showCancel: false, 138 | complete: function (res) { 139 | if (ret) { 140 | wx.switchTab({ 141 | url: '/page/my/my' 142 | }) 143 | } 144 | else { 145 | util.navigateBack1; 146 | } 147 | } 148 | }) 149 | } 150 | app.globalData.moshi = '' 151 | app.globalData.jiacaiDingdanno = '' 152 | }, 153 | fail(error) { 154 | let ret = false; 155 | let msg = '请求失败' + error; 156 | wx.showModal({ 157 | title: '订单处理结果:', 158 | content: msg, 159 | showCancel: false, 160 | complete: function (res) { 161 | if (ret) { 162 | wx.switchTab({ 163 | url: '/page/my/my' 164 | }) 165 | } 166 | else { 167 | util.navigateBack1; 168 | } 169 | } 170 | }) 171 | } 172 | }); 173 | } else { 174 | console.log('用户点击辅助操作') 175 | } 176 | }, 177 | fail: function (error) { 178 | util.showFailModel('调用模式窗体失败', error); 179 | } 180 | }); 181 | }, 182 | onLoad: function (params) { 183 | 184 | }, 185 | onReady: function () { 186 | wx.setNavigationBarTitle({ 187 | title: app.globalData.aZhuozi.zhuozimingcheng +'-呼叫服务员' 188 | }); 189 | }, 190 | onShow: function () { 191 | // 页面显示 192 | }, 193 | onHide: function () { 194 | // 页面隐藏 195 | }, 196 | onUnload: function () { 197 | // 页面关闭 198 | }, 199 | onShareAppMessage: function () { 200 | return { 201 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng, 202 | path: '/page/shop/shop?zhuoziid=' + app.globalData.zhuoziid 203 | } 204 | } 205 | }) -------------------------------------------------------------------------------- /page/fuwu/fuwu.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /page/fuwu/fuwu.wxml: -------------------------------------------------------------------------------- 1 | 2 | 需要: 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 发送 23 | 24 | -------------------------------------------------------------------------------- /page/fuwu/fuwu.wxss: -------------------------------------------------------------------------------- 1 | .fuwuRadioGroup { 2 | margin-top: 10rpx; 3 | } 4 | .fuwuTitle{ 5 | margin-top: 30rpx; 6 | } 7 | .fuwuItem { 8 | padding-left: 50rpx; 9 | font-family: "微软雅黑"; 10 | background: #fff; 11 | padding-bottom: 25rpx; 12 | } 13 | -------------------------------------------------------------------------------- /page/my/my.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:my/index 5 | 文件功能描述:我的 6 | 7 | ----------------------------------------------------------------*/ 8 | var util = require('../../util/util.js') 9 | var qcloud = require('../../util/vendor/qcloud-weapp-client-sdk/index'); 10 | var config = require('../../config'); 11 | var app = getApp() 12 | Page({ 13 | data: { 14 | userInfo: {}, 15 | orderList: {}, 16 | aKehu: {}, 17 | yincangXiaofeiJilu: true, 18 | yincangChongzhi: true, 19 | yincangHuiyuanLeibie: true, 20 | yincangShouquan: true, //隐藏用户授权 21 | yincangYouhuiquan: true, //优惠券 22 | xiaofeijiluList: {}, 23 | youhuiquanList: {}, 24 | youhuiquan1List: [], 25 | youhuiquan2List: [], 26 | youhuiquan3List: [], 27 | chongzhizengsongList: {}, 28 | huiyuanleibieList: {}, 29 | chongzhiLeixingId: 0, // 选择要充值的栏位 30 | chongzhizengsongItems: [] , 31 | huiyuanleibieId: 0, // 选择要充值的栏位 32 | huiyuanleibieItems: [], 33 | yincangZhuce: true, //隐藏注册窗体 34 | selectedLeixing:'未使用', 35 | aFendian: {}, //分店对象 36 | firstShow:true 37 | }, 38 | refreshDate: function (event) { 39 | util.showBusy('请稍候。。。'); 40 | var that = this 41 | //如果没有登陆,那么再登陆一次 42 | if (app.globalData.hasLogin == false) { 43 | if (app.globalData.aFendian.zhifu) { 44 | that.setData({ 45 | yincangShouquan: false 46 | }); 47 | } 48 | } 49 | qcloud.request({ 50 | url: config.service.getOrderUrl, 51 | hasLogin: app.globalData.hasLogin, 52 | data: { 53 | hasLogin: app.globalData.hasLogin, 54 | dingdanno: app.globalData.dingdanno, 55 | userInfo: JSON.stringify(app.globalData.userInfo), 56 | zhuoziid: app.globalData.zhuoziid, 57 | }, 58 | success: function (requestResult) { 59 | if (requestResult.data.code == '200') { 60 | app.globalData.userInfo.openId = app.globalData.userInfo.openId ? app.globalData.userInfo.openId : requestResult.data.openId; 61 | app.globalData.userInfo.session_key = app.globalData.userInfo.session_key ? app.globalData.userInfo.session_key : requestResult.data.session_key; 62 | that.setData({ 63 | 'orderList': requestResult.data.data, 64 | userInfo: app.globalData.userInfo, 65 | xiaofeijiluList: requestResult.data.xiaofeijiluList, 66 | chongzhizengsongList: requestResult.data.chongzhizengsongList, 67 | huiyuanleibieList: requestResult.data.huiyuanleibieList, 68 | 'aKehu': requestResult.data.aKehu, 69 | youhuiquanList: requestResult.data.youhuiquanList, 70 | }); 71 | //优惠券 分类 72 | if (requestResult.data.youhuiquanList){ 73 | that.data.youhuiquan1List = [] 74 | that.data.youhuiquan2List = [] 75 | that.data.youhuiquan3List = [] 76 | for (var i = 0; i < requestResult.data.youhuiquanList.length; i++) 77 | { 78 | if (requestResult.data.youhuiquanList[i].shiyongshijian) 79 | { 80 | that.data.youhuiquan2List.push(requestResult.data.youhuiquanList[i]) 81 | } 82 | else if (requestResult.data.youhuiquanList[i].jieshuriqi > util.currentDate()) 83 | { 84 | that.data.youhuiquan1List.push(requestResult.data.youhuiquanList[i]) 85 | } 86 | else{ 87 | that.data.youhuiquan3List.push(requestResult.data.youhuiquanList[i]) 88 | } 89 | } 90 | that.setData({ 91 | youhuiquan1List: that.data.youhuiquan1List, 92 | youhuiquan2List: that.data.youhuiquan2List, 93 | youhuiquan3List: that.data.youhuiquan3List, 94 | }); 95 | } 96 | //若没有注册电话,显示注册窗口 97 | if (app.globalData.aFendian.zhifu && (!(requestResult.data.aKehu && requestResult.data.aKehu.dianhua)) && app.globalData.userInfo && app.globalData.userInfo.openId && wx.canIUse('button.open-type.getPhoneNumber')) { 98 | that.setData({ 99 | yincangZhuce: false 100 | }); 101 | } 102 | //若第一次显示页面,可以自动显示优惠券,有号码才有优惠券 103 | if (requestResult.data.aKehu && requestResult.data.aKehu.dianhua && that.data.firstShow && that.data.youhuiquan1List && that.data.youhuiquan1List.length>0){ 104 | that.setData({ 105 | yincangYouhuiquan: false, 106 | firstShow: false 107 | }); 108 | } 109 | if (requestResult.data.chongzhizengsongList) { 110 | var temp = [] 111 | for (var i = 0; i < requestResult.data.chongzhizengsongList.length; i++) { 112 | if (requestResult.data.chongzhizengsongList[i].leibiemingcheng) { 113 | var chongzhizengsong = new Object 114 | chongzhizengsong.name = requestResult.data.chongzhizengsongList[i].leibiemingcheng 115 | chongzhizengsong.value = requestResult.data.chongzhizengsongList[i].id 116 | if (i == 0) 117 | { 118 | that.data.chongzhiLeixingId = chongzhizengsong.value 119 | chongzhizengsong.checked = true 120 | } 121 | temp.push(chongzhizengsong) 122 | } 123 | } 124 | that.setData({ 125 | chongzhizengsongItems: temp 126 | }) 127 | } 128 | if (requestResult.data.huiyuanleibieList) { 129 | var temp = [] 130 | 131 | for (var i = 0; i < requestResult.data.huiyuanleibieList.length; i++) { 132 | if (requestResult.data.huiyuanleibieList[i].leibiemingcheng) { 133 | var ss = parseFloat(requestResult.data.huiyuanleibieList[i].shangxian) < 1000 ? "(< ¥ ": "(<¥" 134 | var huiyuanleibie = new Object 135 | huiyuanleibie.name = requestResult.data.huiyuanleibieList[i].leibiemingcheng 136 | + ss 137 | + requestResult.data.huiyuanleibieList[i].shangxian + ") " + 138 | requestResult.data.huiyuanleibieList[i].zhekou+"折" 139 | huiyuanleibie.value = requestResult.data.huiyuanleibieList[i].id 140 | if (requestResult.data.aKehu && requestResult.data.aKehu.leibieid && huiyuanleibie.value == requestResult.data.aKehu.leibieid) 141 | huiyuanleibie.checked = true 142 | temp.push(huiyuanleibie) 143 | } 144 | } 145 | that.setData({ 146 | huiyuanleibieItems: temp 147 | }) 148 | } 149 | } 150 | else { 151 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 152 | } 153 | util.hideBusy(); 154 | }, 155 | fail: function (requestResult) { 156 | util.hideBusy(); 157 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 158 | }, 159 | complete: function () { 160 | wx.stopPullDownRefresh(); 161 | } 162 | }); 163 | }, 164 | CancelItem: function (event) { 165 | var that = this 166 | let data = event.currentTarget.dataset 167 | console.log('app.globalData.userInfo', app.globalData.userInfo) 168 | wx.showModal({ 169 | title: '是否取消?', 170 | content: '是否取消"' + data.name + '"?', 171 | confirmText: "取消该项", 172 | cancelText: "保留该项", 173 | success: function (res) { 174 | if (res.confirm) { 175 | qcloud.request({ 176 | url: config.service.CancelItemUrl, 177 | data: { 178 | id: data.id, 179 | hasLogin: app.globalData.hasLogin, 180 | dingdanno: app.globalData.dingdanno, 181 | userInfo: JSON.stringify(app.globalData.userInfo) 182 | }, 183 | success: function (requestResult) { 184 | if (requestResult.data.code == '200') { 185 | console.log('requestResult.data'); 186 | console.log(requestResult.data); 187 | that.refreshDate(); 188 | } 189 | else { 190 | util.showFailModal('处理结果', requestResult.data.code + ':' + requestResult.data.message); 191 | } 192 | }, 193 | fail: function (requestResult) { 194 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 195 | }, 196 | complete: wx.stopPullDownRefresh() 197 | }); 198 | } 199 | }, 200 | fail: function (error) { 201 | util.showFailModel('调用模式窗体失败', error); 202 | } 203 | }); 204 | }, 205 | jiaCai: function (event) { 206 | var that = this 207 | let data = event.currentTarget.dataset 208 | console.log('app.globalData.userInfo', app.globalData.userInfo) 209 | app.globalData.moshi = '(加菜)' 210 | app.globalData.jiacaiDingdanno = data.id 211 | wx.switchTab({ 212 | url: '/page/diancan/index' 213 | }) 214 | }, 215 | 216 | onLoad: function () { 217 | wx.setNavigationBarTitle({ 218 | title: app.globalData.aFendian.fendianmingcheng + '-' + '下单记录' 219 | }); 220 | }, 221 | onPullDownRefresh() { 222 | this.refreshDate(); 223 | }, 224 | onShow: function () { 225 | console.log('aFendian:', app.globalData.aFendian) 226 | this.setData({ 227 | aFendian: app.globalData.aFendian 228 | }); 229 | this.refreshDate(); 230 | }, 231 | onShareAppMessage: function () { 232 | return { 233 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng, 234 | path: '/page/shop/shop?zhuoziid=' + app.globalData.zhuoziid 235 | } 236 | }, 237 | 238 | hideXiaofeiJilu: function () { 239 | this.setData({ 240 | yincangXiaofeiJilu: true 241 | }); 242 | }, 243 | showXiaofeiJilu: function () { 244 | this.setData({ 245 | yincangXiaofeiJilu: false 246 | }); 247 | }, 248 | 249 | hideYouhuiquan: function () { 250 | this.setData({ 251 | yincangYouhuiquan: true 252 | }); 253 | }, 254 | showYouhuiquan: function () { 255 | this.setData({ 256 | yincangYouhuiquan: false 257 | }); 258 | }, 259 | 260 | hideChongzhi: function () { 261 | this.setData({ 262 | yincangChongzhi: true 263 | }); 264 | }, 265 | showChongzhi: function () { 266 | this.setData({ 267 | yincangChongzhi: false 268 | }); 269 | }, 270 | 271 | hideHuiyuanLeibie: function () { 272 | this.setData({ 273 | yincangHuiyuanLeibie: true 274 | }); 275 | }, 276 | showHuiyuanLeibie: function () { 277 | this.setData({ 278 | yincangHuiyuanLeibie: false 279 | }); 280 | }, 281 | hideZhuce: function () { 282 | this.setData({ 283 | yincangZhuce: true 284 | }); 285 | }, 286 | showZhuce: function () { 287 | this.setData({ 288 | yincangZhuce: false 289 | }); 290 | }, 291 | radioChange: function (e) { 292 | var radioItems = this.data.chongzhizengsongItems; 293 | for (var i = 0, len = radioItems.length; i < len; ++i) { 294 | radioItems[i].checked = radioItems[i].value == e.detail.value; 295 | if (radioItems[i].checked) 296 | this.setData({ 297 | chongzhiLeixingId: radioItems[i].value 298 | }); 299 | } 300 | this.setData({ 301 | chongzhizengsongItems: radioItems 302 | }); 303 | }, 304 | reAuthor: function () { 305 | var that = this 306 | //获取用户授权 307 | if (wx.getSetting) { 308 | wx.getSetting({ 309 | success(res) { 310 | console.log(res); 311 | if (!res.authSetting['scope.userInfo']) { 312 | wx.openSetting({ 313 | success: (res) => { 314 | res.authSetting = { 315 | "scope.userInfo": true 316 | } 317 | if (!app.globalData.hasLogin) { 318 | wx.login({ 319 | success: function (loginResult) { 320 | wx.getUserInfo({ 321 | success: function (userResult) { 322 | app.globalData.hasLogin = true; 323 | userResult.userInfo.code = loginResult.code; 324 | app.globalData.userInfo = userResult.userInfo; 325 | that.setData({ 326 | yincangShouquan: true 327 | }); 328 | that.refreshDate(); 329 | }, 330 | fail: function (userError) { 331 | app.globalData.hasLogin = false; 332 | if (app.globalData.aFendian.zhifu) { 333 | that.setData({ 334 | yincangShouquan: false 335 | }); 336 | } 337 | }, 338 | }); 339 | }, 340 | fail: function (loginError) { 341 | app.globalData.hasLogin = false; 342 | if (app.globalData.aFendian.zhifu) { 343 | that.setData({ 344 | yincangShouquan: false 345 | }); 346 | } 347 | util.showFailModal('微信登陆失败,原因可能是首次登陆本门店,请关闭程序后重新扫描登陆。', loginError); 348 | }, 349 | complete: function () { 350 | } 351 | }); 352 | } 353 | } 354 | }) 355 | } 356 | } 357 | }); 358 | } 359 | }, 360 | chongzhi: function () { 361 | var that = this 362 | if (!app.globalData.aFendian.zhifu) { 363 | util.showFailModal('提示', '本店未开通支付功能。') 364 | return; 365 | } 366 | if (!(app.globalData.aKehu && app.globalData.aKehu.dianhua)) { 367 | util.showFailModal('提示', '请注册为会员后充值。') 368 | return; 369 | } 370 | //开通支付,必须允许授权 371 | if (app.globalData.hasLogin == false || !app.globalData.userInfo.openId) { 372 | util.showFailModal('提示', '根据微信要求,订单支付时,本系统需要获得用户授权许可。请点击登录,并允许授权,谢谢配合。') 373 | return; 374 | } 375 | if (this.data.chongzhiLeixingId == 0) { 376 | util.showFailModal('提示', '未找到充值类型,请退出后重试。') 377 | return; 378 | } 379 | //发起充值 380 | qcloud.request({ 381 | url: config.service.chongzhiUrl, 382 | hasLogin: app.globalData.hasLogin, 383 | data: { 384 | chongzhiLeixingId: this.data.chongzhiLeixingId, 385 | userInfo: JSON.stringify(app.globalData.userInfo), 386 | }, 387 | success: function (requestResult) { 388 | if (requestResult.statusCode == 200) { 389 | console.log('requestResult.data.prepay', requestResult.data.prepay) 390 | var aPrepay = requestResult.data.prepay 391 | if (aPrepay.code == 6000) { 392 | wx.requestPayment({ 393 | 'timeStamp': aPrepay.timeStamp, 394 | 'nonceStr': aPrepay.nonceStr, 395 | 'package': aPrepay.package, 396 | 'signType': aPrepay.signType, 397 | 'paySign': aPrepay.paySign, 398 | 'success': function (res) { 399 | console.log('wx.requestPayment success', res); 400 | wx.showModal({ 401 | title: '订单处理结果:', 402 | content: '充值成功', 403 | showCancel: false, 404 | complete: function (res) { 405 | that.refreshDate() 406 | that.setData({ 407 | 'aKehu': that.aKehu 408 | }); 409 | } 410 | }) 411 | }, 412 | 'fail': function (res) { 413 | console.log('wx.requestPayment fail', res) 414 | util.navigateBack1(); 415 | } 416 | }); 417 | } 418 | else { 419 | util.hideBusy(); 420 | util.showFailModal('提示', aPrepay.code + ':' + aPrepay.message); 421 | } 422 | } 423 | else { 424 | util.hideBusy(); 425 | util.showFailModal('网络错误:', requestResult.statusCode); 426 | } 427 | console.log('successsuccesssuccess'); 428 | that.hideChongzhi() 429 | }, 430 | fail: function (requestResult) { 431 | console.log('failfailfailfail'); 432 | that.hideChongzhi() 433 | util.hideBusy(); 434 | util.showFailModal('获取服务器数据失败。', requestResult); 435 | } 436 | }); 437 | }, 438 | 439 | getPhoneNumber: function (e) { 440 | var that = this 441 | if (!e.detail.encryptedData) return 442 | var tempdata = { 443 | zhuoziid: app.globalData.zhuoziid, 444 | iv: e.detail.iv, 445 | encryptedData: e.detail.encryptedData, 446 | userInfo: JSON.stringify(app.globalData.userInfo), 447 | }; 448 | qcloud.request({ 449 | url: config.service.getPhoneNumberUrl, 450 | hasLogin: app.globalData.hasLogin, 451 | data: tempdata, 452 | success(result) { 453 | if (result.statusCode == "200") { 454 | if (result.data.code == "200") { 455 | let ret = true; 456 | let msg = result.data.message; 457 | wx.showModal({ 458 | title: '', 459 | content: msg, 460 | showCancel: false, 461 | complete: function (res) { 462 | that.hideZhuce() 463 | that.refreshDate(); 464 | } 465 | }) 466 | 467 | } 468 | else { 469 | let ret = false; 470 | let msg = '出现异常,错误代码:' + result.data.code; 471 | wx.showModal({ 472 | title: '订单处理结果:', 473 | content: msg, 474 | showCancel: false, 475 | complete: function (res) { 476 | if (ret) { 477 | wx.switchTab({ 478 | url: '/page/my/my' 479 | }) 480 | } 481 | else { 482 | util.navigateBack1; 483 | } 484 | } 485 | }) 486 | //directret(false, '下单出现异常,请联系客服!' + '错误代码:' + result.data.code); 487 | } 488 | } 489 | else { 490 | let ret = false; 491 | let msg = '请求失败,' + '错误代码:' + result.statusCode; 492 | console.log(msg); 493 | console.log(result); 494 | that.refreshDate() 495 | } 496 | }, 497 | fail(error) { 498 | let ret = false; 499 | let msg = '请求失败' + error; 500 | wx.showModal({ 501 | title: '订单处理结果:', 502 | content: msg, 503 | showCancel: false, 504 | complete: function (res) { 505 | if (ret) { 506 | wx.switchTab({ 507 | url: '/page/my/my' 508 | }) 509 | } 510 | else { 511 | util.navigateBack1; 512 | } 513 | } 514 | }) 515 | } 516 | }); 517 | }, 518 | //选择 未使用 已使用 已过期 519 | selectLeixing: function (event) { 520 | let data = event.currentTarget.dataset 521 | if (data.id =='未使用') 522 | { 523 | this.data.youhuiquanList = this.data.youhuiquan1List 524 | } 525 | else if (data.id == '已使用') { 526 | this.data.youhuiquanList = this.data.youhuiquan2List 527 | } 528 | else if (data.id == '已过期') { 529 | this.data.youhuiquanList = this.data.youhuiquan3List 530 | } 531 | this.setData({ 532 | youhuiquanList: this.data.youhuiquanList, 533 | selectedLeixing: data.id 534 | }) 535 | } 536 | }) 537 | -------------------------------------------------------------------------------- /page/my/my.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /page/my/my.wxml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {{userInfo?userInfo.nickName:""}} 17 | 18 | 19 | 手机号:{{aKehu && aKehu.dianhua?aKehu.dianhua:""}} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 账号余额 29 | 30 | 31 | ¥{{aKehu && aKehu.shengyujine && aKehu.shengyujine != 'null' ?aKehu.shengyujine:'0.00'}} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 充值赠送 43 | 44 | 45 | {{chongzhizengsongItems[0].name}} 46 | 47 | 48 | {{chongzhizengsongItems[1].name}} 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 会员折扣 60 | 61 | 62 | 63 | 64 | 享{{aKehu.zhekou}}折优惠 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 优惠券 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 我的订单 86 | 87 | 88 | 89 | 90 | 订单号:{{ fitem.dingdanno }} 91 | 92 | 加菜 93 | 94 | 呼叫服务员 95 | 96 | 97 | 98 | 台位:{{ fitem.fendianmingcheng }}-{{ fitem.zhuozimingcheng }} 99 | 100 | 101 | 时间:{{ fitem.shijian }} 102 | 103 | 104 | 备注:{{fitem.kehubeizhu }} 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | {{ fitem.zhuangtai }} 113 | 114 | 115 | 116 | {{ citem.zhuangtai }} 117 | 118 | 119 | {{ fitem.zhuangtai }} 120 | 121 | 122 | {{ citem.zhuangtai }} 123 | 124 | {{fitem.caiming }} 125 | {{ citem.caiming }} 126 | x{{ fitem.shuliang }} ¥{{(fitem.shuliang *(fitem.huiyuanjia*100))/100 }} 127 | x{{ citem.shuliang }} ¥{{ (citem.shuliang*(100*citem.huiyuanjia))/100 }} 128 | 129 | 130 | 131 | 132 | 133 | 134 | ¥{{ fitem.zonghuiyuanjia }} 135 | 应付: 136 | ¥{{(fitem.zongxiaoshoujia*1000- fitem.zonghuiyuanjia*1000)/1000 }} 137 | 优惠: 138 | 139 | ¥{{ fitem.zongxiaoshoujia }} 140 | 总额: 141 | 142 | 143 | 144 | 145 | 146 | 147 | 暂无订单 148 | 149 | 150 | 技术支持:微扫点餐 151 | 152 | 153 | 154 | 155 | 181 | 182 | 183 | 204 | 205 | 206 | 226 | 227 | 228 | 249 | 250 | 251 | -------------------------------------------------------------------------------- /page/my/my.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | line-height: 1.6; 3 | font-family: -apple-system-font, "Helvetica Neue", sans-serif; 4 | } 5 | 6 | icon { 7 | vertical-align: middle; 8 | } 9 | 10 | .weui-cells { 11 | position: relative; 12 | margin-top: 1.17647059em; 13 | background-color: #fff; 14 | line-height: 60rpx; 15 | font-size: 28rpx; 16 | } 17 | 18 | .weui-cells__title { 19 | margin-top: 8rpx; 20 | padding-left: 25rpx; 21 | font-size: 28rpx; 22 | border-bottom: 1rpx solid #d9d9d9; 23 | } 24 | 25 | .weui-cells_after-title { 26 | margin-top: 0; 27 | border-bottom: 1rpx solid #d9d9d9; 28 | } 29 | 30 | .weui-cells__tips { 31 | margin-top: 0.3em; 32 | color: #999; 33 | padding-left: 15rpx; 34 | padding-right: 15rpx; 35 | font-size: 14rpx; 36 | } 37 | 38 | .weui-cell { 39 | padding: 10rpx 40rpx; 40 | position: relative; 41 | display: -webkit-box; 42 | display: -webkit-flex; 43 | display: flex; 44 | -webkit-box-align: center; 45 | -webkit-align-items: center; 46 | align-items: center; 47 | } 48 | 49 | .weui-cell:before { 50 | content: " "; 51 | position: absolute; 52 | top: 0; 53 | right: 0; 54 | height: 1rpx; 55 | border-top: 1rpx solid #d9d9d9; 56 | color: #d9d9d9; 57 | left: 15rpx; 58 | } 59 | 60 | .weui-cell:first-child:before { 61 | display: none; 62 | } 63 | 64 | .weui-cell_active { 65 | background-color: #ececec; 66 | } 67 | 68 | .weui-cell_primary { 69 | -webkit-box-align: start; 70 | -webkit-align-items: flex-start; 71 | align-items: flex-start; 72 | } 73 | 74 | .weui-cell__bd { 75 | -webkit-box-flex: 1; 76 | -webkit-flex: 1; 77 | flex: 1; 78 | } 79 | 80 | .weui-cell__ft { 81 | text-align: right; 82 | color: #999; 83 | } 84 | 85 | .weui-cell_access { 86 | color: inherit; 87 | } 88 | 89 | .weui-cell__ft_in-access { 90 | padding-right: 13rpx; 91 | position: relative; 92 | } 93 | 94 | .weui-cell__ft_in-access:after { 95 | content: " "; 96 | display: inline-block; 97 | height: 6rpx; 98 | width: 6rpx; 99 | border-width: 2rpx 2rpx 0 0; 100 | border-color: #c8c8cd; 101 | border-style: solid; 102 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 103 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 104 | position: relative; 105 | top: -2rpx; 106 | top: 50%; 107 | margin-top: -4rpx; 108 | right: 2rpx; 109 | } 110 | 111 | .weui-cell_link { 112 | color: #586c94; 113 | font-size: 14rpx; 114 | } 115 | 116 | .weui-cell_link:active { 117 | background-color: #ececec; 118 | } 119 | 120 | .weui-cell_link:first-child:before { 121 | display: block; 122 | } 123 | 124 | .weui-icon-radio { 125 | margin-left: 3.2rpx; 126 | margin-right: 3.2rpx; 127 | } 128 | 129 | .weui-icon-checkbox_circle, .weui-icon-checkbox_success { 130 | margin-left: 4.6rpx; 131 | margin-right: 4.6rpx; 132 | } 133 | 134 | .weui-check__label:active { 135 | background-color: #ececec; 136 | } 137 | 138 | .weui-check { 139 | position: absolute; 140 | left: -9999rpx; 141 | } 142 | 143 | .weui-check__hd_in-checkbox { 144 | padding-right: 0.35em; 145 | } 146 | 147 | .weui-cell__ft_in-radio { 148 | padding-left: 0.35em; 149 | } 150 | 151 | .weui-cell_input { 152 | padding-top: 0; 153 | padding-bottom: 0; 154 | } 155 | 156 | .weui-label { 157 | word-wrap: break-word; 158 | word-break: break-all; 159 | } 160 | 161 | .weui-input { 162 | height: 2.58823529em; 163 | min-height: 2.58823529em; 164 | line-height: 2.58823529em; 165 | } 166 | 167 | .weui-toptips { 168 | position: fixed; 169 | -webkit-transform: translateZ(0); 170 | transform: translateZ(0); 171 | top: 0; 172 | left: 0; 173 | right: 0; 174 | padding: 5rpx; 175 | font-size: 14rpx; 176 | text-align: center; 177 | color: #fff; 178 | z-index: 5000; 179 | word-wrap: break-word; 180 | word-break: break-all; 181 | } 182 | 183 | .weui-toptips_warn { 184 | background-color: #e64340; 185 | } 186 | 187 | .weui-textarea { 188 | display: block; 189 | width: 100%; 190 | } 191 | 192 | .weui-textarea-counter { 193 | color: #b2b2b2; 194 | text-align: right; 195 | } 196 | 197 | .weui-textarea-counter_warn { 198 | color: #e64340; 199 | } 200 | 201 | .weui-cell_warn { 202 | color: #e64340; 203 | } 204 | 205 | .weui-form-preview { 206 | position: relative; 207 | background-color: #fff; 208 | } 209 | 210 | .weui-form-preview:before { 211 | content: " "; 212 | position: absolute; 213 | left: 0; 214 | top: 0; 215 | right: 0; 216 | height: 1rpx; 217 | color: #d9d9d9; 218 | } 219 | 220 | .weui-form-preview:after { 221 | content: " "; 222 | position: absolute; 223 | left: 0; 224 | bottom: 0; 225 | right: 0; 226 | height: 1rpx; 227 | color: #d9d9d9; 228 | } 229 | 230 | .weui-form-preview__value { 231 | font-size: 14rpx; 232 | } 233 | 234 | .weui-form-preview__value_in-hd { 235 | float: left; 236 | font-size: 30rpx; 237 | } 238 | 239 | .weui-form-preview__value_in-hd2 { 240 | float: right; 241 | font-size: 30rpx; 242 | } 243 | 244 | .weui-form-preview__value_in-hd3 { 245 | float: left; 246 | margin-right: 1em; 247 | min-width: 4em; 248 | line-height: 30rpx; 249 | color: #999; 250 | text-align: justify; 251 | text-align-last: justify; 252 | } 253 | 254 | .weui-form-preview__hd { 255 | position: relative; 256 | padding-left: 25rpx; 257 | text-align: right; 258 | line-height: 32rpx; 259 | margin-top: 20rpx; 260 | } 261 | 262 | .weui-form-preview__bd { 263 | padding: 10rpx 25rpx; 264 | font-size: 1em; 265 | text-align: right; 266 | color: #999; 267 | line-height: 45rpx; 268 | } 269 | 270 | .weui-form-preview__sum { 271 | position: relative; 272 | padding-left: 10rpx; 273 | padding-bottom: 40rpx; 274 | text-align: right; 275 | line-height: 32rpx; 276 | border-top: 1rpx solid #d5d5d6; 277 | } 278 | 279 | .weui-form-preview__item_sum { 280 | overflow: hidden; 281 | line-height: 30rpx; 282 | padding-top: 10rpx; 283 | } 284 | 285 | .weui-form-preview__value_in-sum { 286 | float: right; 287 | font-size: 30rpx; 288 | } 289 | 290 | .weui-form-preview__sum_value { 291 | float: right; 292 | font-size: 40rpx; 293 | color: #f25b02; 294 | padding-right: 40rpx; 295 | } 296 | 297 | .weui-form-preview__ft { 298 | position: relative; 299 | line-height: 50rpx; 300 | display: -webkit-box; 301 | display: -webkit-flex; 302 | display: flex; 303 | } 304 | 305 | .weui-form-preview__ft:after { 306 | content: " "; 307 | position: absolute; 308 | left: 0; 309 | top: 0; 310 | right: 0; 311 | height: 1rpx; 312 | border-top: 2rpx solid #d5d5d6; 313 | color: #d5d5d6; 314 | } 315 | 316 | .weui-form-preview__item { 317 | overflow: hidden; 318 | height: 40rpx; 319 | } 320 | 321 | .weui-form-preview__bd_item_warp { 322 | border-top: 1rpx dotted #d5d5d6; 323 | } 324 | 325 | .weui-form-preview__label { 326 | float: left; 327 | color: #454545; 328 | font-size: 30rpx; 329 | } 330 | 331 | .weui-form-preview__label2 { 332 | float: right; 333 | min-width: 4em; 334 | color: #454545; 335 | font-size: 30rpx; 336 | } 337 | 338 | .weui-form-preview__value { 339 | display: block; 340 | overflow: hidden; 341 | word-break: normal; 342 | word-wrap: break-word; 343 | } 344 | 345 | .weui-form-preview__btn { 346 | position: relative; 347 | display: block; 348 | -webkit-box-flex: 1; 349 | -webkit-flex: 1; 350 | flex: 1; 351 | color: #3cc51f; 352 | text-align: center; 353 | } 354 | 355 | .weui-form-preview__btn:after { 356 | content: " "; 357 | position: absolute; 358 | left: 0; 359 | top: 0; 360 | width: 1rpx; 361 | bottom: 0; 362 | border-left: 1rpx solid #d5d5d6; 363 | color: #d5d5d6; 364 | } 365 | 366 | .weui-form-preview__btn:first-child:after { 367 | display: none; 368 | } 369 | 370 | .weui-form-preview__btn_active { 371 | background-color: #eee; 372 | } 373 | 374 | .weui-form-preview__btn_default { 375 | color: #999; 376 | } 377 | 378 | .weui-form-preview__btn_primary { 379 | color: #0bb20c; 380 | } 381 | 382 | .weui-cell_select { 383 | padding: 0; 384 | } 385 | 386 | .weui-select { 387 | position: relative; 388 | padding-left: 15rpx; 389 | padding-right: 30rpx; 390 | height: 2.58823529em; 391 | min-height: 2.58823529em; 392 | line-height: 2.58823529em; 393 | border-right: 1rpx solid #d9d9d9; 394 | } 395 | 396 | .weui-select:before { 397 | content: " "; 398 | display: inline-block; 399 | height: 16rpx; 400 | width: 16rpx; 401 | border-width: 2rpx 2rpx 0 0; 402 | border-color: #c8c8cd; 403 | border-style: solid; 404 | -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 405 | transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0); 406 | top: -2rpx; 407 | position: absolute; 408 | top: 50%; 409 | right: 25rpx; 410 | margin-top: -4rpx; 411 | } 412 | 413 | .weui-select_in-select-after { 414 | padding-left: 0; 415 | } 416 | 417 | .weui-cell__hd_in-select-after, .weui-cell__bd_in-select-before { 418 | padding-left: 25rpx; 419 | } 420 | 421 | .weui-cell_vcode { 422 | padding-right: 0; 423 | } 424 | 425 | .weui-vcode-img { 426 | margin-left: 5rpx; 427 | height: 2.58823529em; 428 | vertical-align: middle; 429 | } 430 | 431 | .weui-vcode-btn { 432 | display: inline-block; 433 | margin-left: 5rpx; 434 | padding: 0 0.6em 0 0.7em; 435 | border-left: 1rpx solid #e5e5e5; 436 | vertical-align: middle; 437 | font-size: 34rpx; 438 | color: #3cc51f; 439 | white-space: nowrap; 440 | text-align: left; 441 | } 442 | 443 | .weui-vcode-btn:active { 444 | color: #52a341; 445 | } 446 | 447 | .weui-cell_switch { 448 | padding-top: 6rpx; 449 | padding-bottom: 6rpx; 450 | } 451 | 452 | .weui-uploader__hd { 453 | display: -webkit-box; 454 | display: -webkit-flex; 455 | display: flex; 456 | padding-bottom: 10rpx; 457 | -webkit-box-align: center; 458 | -webkit-align-items: center; 459 | align-items: center; 460 | } 461 | 462 | .weui-uploader__title { 463 | -webkit-box-flex: 1; 464 | -webkit-flex: 1; 465 | flex: 1; 466 | } 467 | 468 | .weui-uploader__info { 469 | color: #b2b2b2; 470 | } 471 | 472 | .weui-uploader__bd { 473 | margin-bottom: -4rpx; 474 | margin-right: -9rpx; 475 | overflow: hidden; 476 | } 477 | 478 | .weui-uploader__file { 479 | float: left; 480 | margin-right: 9rpx; 481 | margin-bottom: 9rpx; 482 | } 483 | 484 | .weui-uploader__img { 485 | display: block; 486 | width: 79rpx; 487 | height: 79rpx; 488 | } 489 | 490 | .weui-uploader__file_status { 491 | position: relative; 492 | } 493 | 494 | .weui-uploader__file_status:before { 495 | content: " "; 496 | position: absolute; 497 | top: 0; 498 | right: 0; 499 | bottom: 0; 500 | left: 0; 501 | background-color: rgba(0, 0, 0, 0.5); 502 | } 503 | 504 | .weui-uploader__file-content { 505 | position: absolute; 506 | top: 50%; 507 | left: 50%; 508 | -webkit-transform: translate(-50%, -50%); 509 | transform: translate(-50%, -50%); 510 | color: #fff; 511 | } 512 | 513 | .weui-uploader__input-box { 514 | float: left; 515 | position: relative; 516 | margin-right: 9rpx; 517 | margin-bottom: 9rpx; 518 | width: 77rpx; 519 | height: 77rpx; 520 | border: 1rpx solid #d9d9d9; 521 | } 522 | 523 | .weui-uploader__input-box:before, .weui-uploader__input-box:after { 524 | content: " "; 525 | position: absolute; 526 | top: 50%; 527 | left: 50%; 528 | -webkit-transform: translate(-50%, -50%); 529 | transform: translate(-50%, -50%); 530 | background-color: #d9d9d9; 531 | } 532 | 533 | .weui-uploader__input-box:before { 534 | width: 2rpx; 535 | height: 39.5rpx; 536 | } 537 | 538 | .weui-uploader__input-box:after { 539 | width: 39.5rpx; 540 | height: 2rpx; 541 | } 542 | 543 | .weui-uploader__input-box:active { 544 | border-color: #999; 545 | } 546 | 547 | .weui-uploader__input-box:active:before, .weui-uploader__input-box:active:after { 548 | background-color: #999; 549 | } 550 | 551 | .weui-uploader__input { 552 | position: absolute; 553 | z-index: 1; 554 | top: 0; 555 | left: 0; 556 | width: 100%; 557 | height: 100%; 558 | opacity: 0; 559 | } 560 | 561 | .weui-article { 562 | padding: 20rpx 15rpx; 563 | font-size: 15rpx; 564 | } 565 | 566 | .weui-article__section { 567 | margin-bottom: 1.5em; 568 | } 569 | 570 | .weui-article__h1 { 571 | font-size: 18rpx; 572 | font-weight: 400; 573 | margin-bottom: 0.9em; 574 | } 575 | 576 | .weui-article__h2 { 577 | font-size: 16rpx; 578 | font-weight: 400; 579 | margin-bottom: 0.34em; 580 | } 581 | 582 | .weui-article__h3 { 583 | font-weight: 400; 584 | font-size: 15rpx; 585 | margin-bottom: 0.34em; 586 | } 587 | 588 | .weui-article__p { 589 | margin: 0 0 0.8em; 590 | } 591 | 592 | .weui-msg { 593 | padding-top: 36rpx; 594 | text-align: center; 595 | } 596 | 597 | .weui-msg__link { 598 | display: inline; 599 | color: #586c94; 600 | } 601 | 602 | .weui-msg__icon-area { 603 | margin-bottom: 30rpx; 604 | } 605 | 606 | .weui-msg__text-area { 607 | margin-bottom: 25rpx; 608 | padding: 0 20rpx; 609 | } 610 | 611 | .weui-msg__title { 612 | margin-bottom: 5rpx; 613 | font-weight: 400; 614 | font-size: 20rpx; 615 | } 616 | 617 | .weui-msg__desc { 618 | font-size: 14rpx; 619 | color: #999; 620 | } 621 | 622 | .weui-msg__opr-area { 623 | margin-bottom: 25rpx; 624 | } 625 | 626 | .weui-msg__extra-area { 627 | margin-bottom: 15rpx; 628 | font-size: 14rpx; 629 | color: #999; 630 | } 631 | 632 | @media screen and (min-height: 438rpx) { 633 | .weui-msg__extra-area { 634 | position: fixed; 635 | left: 0; 636 | bottom: 0; 637 | width: 100%; 638 | text-align: center; 639 | } 640 | } 641 | 642 | .weui-flex { 643 | display: -webkit-box; 644 | display: -webkit-flex; 645 | display: flex; 646 | } 647 | 648 | .weui-flex__item { 649 | -webkit-box-flex: 1; 650 | -webkit-flex: 1; 651 | flex: 1; 652 | } 653 | 654 | .weui-btn { 655 | margin-top: 15rpx; 656 | } 657 | 658 | .weui-btn:first-child { 659 | margin-top: 0; 660 | } 661 | 662 | .weui-btn-area { 663 | margin: 1.17647059em 15rpx 0.3em; 664 | } 665 | 666 | .weui-agree { 667 | display: block; 668 | padding: 0.5em 15rpx; 669 | font-size: 13rpx; 670 | } 671 | 672 | .weui-agree__text { 673 | color: #999; 674 | } 675 | 676 | .weui-agree__link { 677 | display: inline; 678 | color: #586c94; 679 | } 680 | 681 | .weui-agree__checkbox { 682 | position: absolute; 683 | left: -9999rpx; 684 | } 685 | 686 | .weui-agree__checkbox-icon { 687 | position: relative; 688 | top: 2rpx; 689 | display: inline-block; 690 | border: 1rpx solid #d1d1d1; 691 | background-color: #fff; 692 | border-radius: 3rpx; 693 | width: 11rpx; 694 | height: 11rpx; 695 | } 696 | 697 | .weui-agree__checkbox-icon-check { 698 | position: absolute; 699 | top: 1rpx; 700 | left: 1rpx; 701 | } 702 | 703 | .weui-footer { 704 | color: #999; 705 | font-size: 14rpx; 706 | text-align: center; 707 | } 708 | 709 | .weui-footer_fixed-bottom { 710 | position: relative; 711 | bottom: 0.52em; 712 | left: 0; 713 | right: 0; 714 | } 715 | 716 | .weui-footer__links { 717 | font-size: 0; 718 | } 719 | 720 | .weui-footer__link { 721 | display: inline-block; 722 | vertical-align: top; 723 | margin: 0 0.62em; 724 | position: relative; 725 | font-size: 28rpx; 726 | color: #586c94; 727 | } 728 | 729 | .weui-footer__link:before { 730 | content: " "; 731 | position: absolute; 732 | left: 0; 733 | top: 0; 734 | width: 1rpx; 735 | bottom: 0; 736 | border-left: 1rpx solid #c7c7c7; 737 | color: #c7c7c7; 738 | left: -0.65em; 739 | } 740 | 741 | .weui-footer__link:first-child:before { 742 | display: none; 743 | } 744 | 745 | .weui-footer__text { 746 | padding: 0 0.34em; 747 | font-size: 12rpx; 748 | } 749 | 750 | .weui-grids { 751 | border-top: 1rpx solid #d9d9d9; 752 | border-left: 1rpx solid #d9d9d9; 753 | } 754 | 755 | .weui-grid { 756 | position: relative; 757 | float: left; 758 | padding: 20rpx 10rpx; 759 | width: 33.33333333%; 760 | box-sizing: border-box; 761 | border-right: 1rpx solid #d9d9d9; 762 | border-bottom: 1rpx solid #d9d9d9; 763 | } 764 | 765 | .weui-grid_active { 766 | background-color: #ececec; 767 | } 768 | 769 | .weui-grid__icon { 770 | display: block; 771 | width: 28rpx; 772 | height: 28rpx; 773 | margin: 0 auto; 774 | } 775 | 776 | .weui-grid__label { 777 | margin-top: 5rpx; 778 | display: block; 779 | text-align: center; 780 | color: #000; 781 | font-size: 14rpx; 782 | white-space: nowrap; 783 | text-overflow: ellipsis; 784 | overflow: hidden; 785 | } 786 | 787 | .weui-loading { 788 | margin: 0 5rpx; 789 | width: 20rpx; 790 | height: 20rpx; 791 | display: inline-block; 792 | vertical-align: middle; 793 | -webkit-animation: weuiLoading 1s steps(12, end) infinite; 794 | animation: weuiLoading 1s steps(12, end) infinite; 795 | background: transparent url(data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iciIgd2lkdGg9JzEyMHB4JyBoZWlnaHQ9JzEyMHB4JyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICAgIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBmaWxsPSJub25lIiBjbGFzcz0iYmsiPjwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjRTlFOUU5JwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoMCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICA8L3JlY3Q+CiAgICA8cmVjdCB4PSc0Ni41JyB5PSc0MCcgd2lkdGg9JzcnIGhlaWdodD0nMjAnIHJ4PSc1JyByeT0nNScgZmlsbD0nIzk4OTY5NycKICAgICAgICAgIHRyYW5zZm9ybT0ncm90YXRlKDMwIDUwIDUwKSB0cmFuc2xhdGUoMCAtMzApJz4KICAgICAgICAgICAgICAgICByZXBlYXRDb3VudD0naW5kZWZpbml0ZScvPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyM5Qjk5OUEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSg2MCA1MCA1MCkgdHJhbnNsYXRlKDAgLTMwKSc+CiAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9J2luZGVmaW5pdGUnLz4KICAgIDwvcmVjdD4KICAgIDxyZWN0IHg9JzQ2LjUnIHk9JzQwJyB3aWR0aD0nNycgaGVpZ2h0PScyMCcgcng9JzUnIHJ5PSc1JyBmaWxsPScjQTNBMUEyJwogICAgICAgICAgdHJhbnNmb3JtPSdyb3RhdGUoOTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNBQkE5QUEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxMjAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNCMkIyQjInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxNTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNCQUI4QjknCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgxODAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNDMkMwQzEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyMTAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNDQkNCQ0InCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEMkQyRDInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgyNzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNEQURBREEnCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMDAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0PgogICAgPHJlY3QgeD0nNDYuNScgeT0nNDAnIHdpZHRoPSc3JyBoZWlnaHQ9JzIwJyByeD0nNScgcnk9JzUnIGZpbGw9JyNFMkUyRTInCiAgICAgICAgICB0cmFuc2Zvcm09J3JvdGF0ZSgzMzAgNTAgNTApIHRyYW5zbGF0ZSgwIC0zMCknPgogICAgPC9yZWN0Pgo8L3N2Zz4=) no-repeat; 796 | background-size: 100%; 797 | } 798 | 799 | @-webkit-keyframes weuiLoading { 800 | 0% { 801 | -webkit-transform: rotate3d(0, 0, 1, 0deg); 802 | transform: rotate3d(0, 0, 1, 0deg); 803 | } 804 | 805 | 100% { 806 | -webkit-transform: rotate3d(0, 0, 1, 360deg); 807 | transform: rotate3d(0, 0, 1, 360deg); 808 | } 809 | } 810 | 811 | @keyframes weuiLoading { 812 | 0% { 813 | -webkit-transform: rotate3d(0, 0, 1, 0deg); 814 | transform: rotate3d(0, 0, 1, 0deg); 815 | } 816 | 817 | 100% { 818 | -webkit-transform: rotate3d(0, 0, 1, 360deg); 819 | transform: rotate3d(0, 0, 1, 360deg); 820 | } 821 | } 822 | 823 | .weui-loadmore { 824 | width: 65%; 825 | margin: 1.5em auto; 826 | line-height: 1.6em; 827 | font-size: 14rpx; 828 | text-align: center; 829 | } 830 | 831 | .weui-loadmore__tips { 832 | display: inline-block; 833 | vertical-align: middle; 834 | } 835 | 836 | .weui-loadmore_line { 837 | border-top: 1rpx solid #e5e5e5; 838 | margin-top: 2.4em; 839 | } 840 | 841 | .weui-loadmore__tips_in-line { 842 | position: relative; 843 | top: -0.9em; 844 | padding: 0 0.55em; 845 | background-color: #fff; 846 | color: #999; 847 | } 848 | 849 | .weui-loadmore__tips_in-dot { 850 | position: relative; 851 | padding: 0 0.16em; 852 | width: 4rpx; 853 | height: 1.6em; 854 | } 855 | 856 | .weui-loadmore__tips_in-dot:before { 857 | content: " "; 858 | position: absolute; 859 | top: 50%; 860 | left: 50%; 861 | margin-top: -1rpx; 862 | margin-left: -2rpx; 863 | width: 4rpx; 864 | height: 4rpx; 865 | border-radius: 50%; 866 | background-color: #e5e5e5; 867 | } 868 | 869 | .weui-panel { 870 | background-color: #fff; 871 | margin-top: 10rpx; 872 | position: relative; 873 | overflow: hidden; 874 | } 875 | 876 | .weui-panel:first-child { 877 | margin-top: 0; 878 | } 879 | 880 | .weui-panel:before { 881 | content: " "; 882 | position: absolute; 883 | left: 0; 884 | top: 0; 885 | right: 0; 886 | height: 1rpx; 887 | border-top: 1rpx solid #e5e5e5; 888 | color: #e5e5e5; 889 | } 890 | 891 | .weui-panel:after { 892 | content: " "; 893 | position: absolute; 894 | left: 0; 895 | bottom: 0; 896 | right: 0; 897 | height: 1rpx; 898 | border-bottom: 1rpx solid #e5e5e5; 899 | color: #e5e5e5; 900 | } 901 | 902 | .weui-panel__hd { 903 | padding: 14rpx 15rpx 10rpx; 904 | color: #999; 905 | font-size: 13rpx; 906 | position: relative; 907 | } 908 | 909 | .weui-panel__hd:after { 910 | content: " "; 911 | position: absolute; 912 | left: 0; 913 | bottom: 0; 914 | right: 0; 915 | height: 1rpx; 916 | border-bottom: 1rpx solid #e5e5e5; 917 | color: #e5e5e5; 918 | left: 15rpx; 919 | } 920 | 921 | .weui-media-box { 922 | padding: 15rpx; 923 | position: relative; 924 | } 925 | 926 | .weui-media-box:before { 927 | content: " "; 928 | position: absolute; 929 | left: 0; 930 | top: 0; 931 | right: 0; 932 | height: 1rpx; 933 | border-top: 1rpx solid #e5e5e5; 934 | color: #e5e5e5; 935 | left: 15rpx; 936 | } 937 | 938 | .weui-media-box:first-child:before { 939 | display: none; 940 | } 941 | 942 | .weui-media-box__title { 943 | font-weight: 400; 944 | font-size: 17rpx; 945 | width: auto; 946 | overflow: hidden; 947 | text-overflow: ellipsis; 948 | white-space: nowrap; 949 | word-wrap: normal; 950 | word-wrap: break-word; 951 | word-break: break-all; 952 | } 953 | 954 | .weui-media-box__desc { 955 | color: #999; 956 | font-size: 13rpx; 957 | line-height: 1.2; 958 | overflow: hidden; 959 | text-overflow: ellipsis; 960 | display: -webkit-box; 961 | -webkit-box-orient: vertical; 962 | -webkit-line-clamp: 2; 963 | } 964 | 965 | .weui-media-box__info { 966 | margin-top: 15rpx; 967 | padding-bottom: 5rpx; 968 | font-size: 13rpx; 969 | color: #cecece; 970 | line-height: 1em; 971 | list-style: none; 972 | overflow: hidden; 973 | } 974 | 975 | .weui-media-box__info__meta { 976 | float: left; 977 | padding-right: 1em; 978 | } 979 | 980 | .weui-media-box__info__meta_extra { 981 | padding-left: 1em; 982 | border-left: 1rpx solid #cecece; 983 | } 984 | 985 | .weui-media-box__title_in-text { 986 | margin-bottom: 8rpx; 987 | } 988 | 989 | .weui-media-box_appmsg { 990 | display: -webkit-box; 991 | display: -webkit-flex; 992 | display: flex; 993 | -webkit-box-align: center; 994 | -webkit-align-items: center; 995 | align-items: center; 996 | } 997 | 998 | .weui-media-box__thumb { 999 | width: 100%; 1000 | height: 100%; 1001 | vertical-align: top; 1002 | } 1003 | 1004 | .weui-media-box__hd_in-appmsg { 1005 | margin-right: 0.8em; 1006 | width: 60rpx; 1007 | height: 60rpx; 1008 | line-height: 60rpx; 1009 | text-align: center; 1010 | } 1011 | 1012 | .weui-media-box__bd_in-appmsg { 1013 | -webkit-box-flex: 1; 1014 | -webkit-flex: 1; 1015 | flex: 1; 1016 | min-width: 0; 1017 | } 1018 | 1019 | .weui-media-box_small-appmsg { 1020 | padding: 0; 1021 | } 1022 | 1023 | .weui-cells_in-small-appmsg { 1024 | margin-top: 0; 1025 | } 1026 | 1027 | .weui-cells_in-small-appmsg:before { 1028 | display: none; 1029 | } 1030 | 1031 | .weui-progress { 1032 | display: -webkit-box; 1033 | display: -webkit-flex; 1034 | display: flex; 1035 | -webkit-box-align: center; 1036 | -webkit-align-items: center; 1037 | align-items: center; 1038 | } 1039 | 1040 | .weui-progress__bar { 1041 | -webkit-box-flex: 1; 1042 | -webkit-flex: 1; 1043 | flex: 1; 1044 | } 1045 | 1046 | .weui-progress__opr { 1047 | margin-left: 15rpx; 1048 | font-size: 0; 1049 | } 1050 | 1051 | .weui-navbar { 1052 | display: -webkit-box; 1053 | display: -webkit-flex; 1054 | display: flex; 1055 | position: absolute; 1056 | z-index: 500; 1057 | top: 0; 1058 | width: 100%; 1059 | border-bottom: 1rpx solid #ccc; 1060 | } 1061 | 1062 | .weui-navbar__item { 1063 | position: relative; 1064 | display: block; 1065 | -webkit-box-flex: 1; 1066 | -webkit-flex: 1; 1067 | flex: 1; 1068 | padding: 13rpx 0; 1069 | text-align: center; 1070 | font-size: 0; 1071 | } 1072 | 1073 | .weui-navbar__item.weui-bar__item_on { 1074 | color: #1aad19; 1075 | } 1076 | 1077 | .weui-navbar__slider { 1078 | position: absolute; 1079 | content: " "; 1080 | left: 0; 1081 | bottom: 0; 1082 | width: 6em; 1083 | height: 3rpx; 1084 | background-color: #1aad19; 1085 | -webkit-transition: -webkit-transform 0.3s; 1086 | transition: -webkit-transform 0.3s; 1087 | transition: transform 0.3s; 1088 | } 1089 | 1090 | .weui-navbar__title { 1091 | display: inline-block; 1092 | font-size: 15rpx; 1093 | max-width: 8em; 1094 | width: auto; 1095 | overflow: hidden; 1096 | text-overflow: ellipsis; 1097 | white-space: nowrap; 1098 | word-wrap: normal; 1099 | } 1100 | 1101 | .weui-tab { 1102 | position: relative; 1103 | height: 100%; 1104 | } 1105 | 1106 | .weui-tab__panel { 1107 | box-sizing: border-box; 1108 | height: 100%; 1109 | padding-top: 50rpx; 1110 | overflow: auto; 1111 | -webkit-overflow-scrolling: touch; 1112 | } 1113 | 1114 | .weui-search-bar { 1115 | position: relative; 1116 | padding: 8rpx 10rpx; 1117 | display: -webkit-box; 1118 | display: -webkit-flex; 1119 | display: flex; 1120 | box-sizing: border-box; 1121 | background-color: #efeff4; 1122 | border-top: 1rpx solid #d7d6dc; 1123 | border-bottom: 1rpx solid #d7d6dc; 1124 | } 1125 | 1126 | .weui-icon-search { 1127 | margin-right: 8rpx; 1128 | } 1129 | 1130 | .weui-icon-search_in-box { 1131 | position: absolute; 1132 | left: 10rpx; 1133 | top: 7rpx; 1134 | } 1135 | 1136 | .weui-search-bar__text { 1137 | display: inline-block; 1138 | font-size: 14rpx; 1139 | vertical-align: middle; 1140 | } 1141 | 1142 | .weui-search-bar__form { 1143 | position: relative; 1144 | -webkit-box-flex: 1; 1145 | -webkit-flex: auto; 1146 | flex: auto; 1147 | border-radius: 5rpx; 1148 | background: #fff; 1149 | border: 1rpx solid #e6e6ea; 1150 | } 1151 | 1152 | .weui-search-bar__box { 1153 | position: relative; 1154 | padding-left: 30rpx; 1155 | padding-right: 30rpx; 1156 | width: 100%; 1157 | box-sizing: border-box; 1158 | z-index: 1; 1159 | } 1160 | 1161 | .weui-search-bar__input { 1162 | height: 28rpx; 1163 | line-height: 28rpx; 1164 | font-size: 14rpx; 1165 | } 1166 | 1167 | .weui-icon-clear { 1168 | position: absolute; 1169 | top: 0; 1170 | right: 0; 1171 | padding: 7rpx 8rpx; 1172 | font-size: 0; 1173 | } 1174 | 1175 | .weui-search-bar__label { 1176 | position: absolute; 1177 | top: 0; 1178 | right: 0; 1179 | bottom: 0; 1180 | left: 0; 1181 | z-index: 2; 1182 | border-radius: 3rpx; 1183 | text-align: center; 1184 | color: #9b9b9b; 1185 | background: #fff; 1186 | line-height: 28rpx; 1187 | } 1188 | 1189 | .weui-search-bar__cancel-btn { 1190 | margin-left: 10rpx; 1191 | line-height: 28rpx; 1192 | color: #09bb07; 1193 | white-space: nowrap; 1194 | } 1195 | 1196 | .scroll-list { 1197 | overflow: hidden; 1198 | } 1199 | 1200 | .bottom_no_order { 1201 | padding-top: 36rpx; 1202 | text-align: center; 1203 | margin-top: 200rpx; 1204 | font-size: 80rpx; 1205 | margin-bottom: 50rpx; 1206 | } 1207 | 1208 | /*新的样式*/ 1209 | 1210 | .icon-line { 1211 | margin-left: 25rpx; 1212 | margin-top: 25rpx; 1213 | display: flex; 1214 | align-items: center; 1215 | text-align: left; 1216 | font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif; 1217 | -webkit-tap-highlight-color: transparent; 1218 | } 1219 | 1220 | .icon-headurl { 1221 | margin-right: 36rpx; 1222 | font-size: 186rpx; 1223 | width: 100rpx; 1224 | height: 100rpx; 1225 | } 1226 | 1227 | .icon-content { 1228 | flex-shrink: 100; 1229 | margin: 0; 1230 | padding: 0; 1231 | display: block; 1232 | text-align: left; 1233 | -webkit-tap-highlight-color: transparent; 1234 | } 1235 | 1236 | .icon-content-name { 1237 | font-size: 35rpx; 1238 | display: block; 1239 | text-align: left; 1240 | } 1241 | 1242 | .icon-content-phone { 1243 | font-size: 25rpx; 1244 | color: #888; 1245 | margin: 0; 1246 | padding: 0; 1247 | display: block; 1248 | text-align: left; 1249 | } 1250 | 1251 | .area-line { 1252 | height: 16rpx; 1253 | background: #ededed; 1254 | } 1255 | 1256 | .huiyuan-neirong { 1257 | margin-left: 380rpx; 1258 | width: 180rpx; 1259 | float: left; 1260 | text-align: center; 1261 | line-height: 40rpx; 1262 | border-radius: 10rpx; 1263 | font-size: 28rpx; 1264 | color: #fff; 1265 | background: #5cba42; 1266 | } 1267 | 1268 | .huiyuan-yue { 1269 | margin-left: 445rpx; 1270 | width: 50rpx; 1271 | float: left; 1272 | text-align: center; 1273 | line-height: 40rpx; 1274 | border-radius: 10rpx; 1275 | font-size: 40rpx; 1276 | color: gray; 1277 | } 1278 | 1279 | .huiyuan-chongzhi1 { 1280 | margin-left: 230rpx; 1281 | width: 150rpx; 1282 | float: left; 1283 | text-align: center; 1284 | line-height: 40rpx; 1285 | border-radius: 10rpx; 1286 | font-size: 28rpx; 1287 | color: #fff; 1288 | background: #5cba42; 1289 | } 1290 | 1291 | .huiyuan-chongzhi2 { 1292 | margin-left: 20rpx; 1293 | width: 160rpx; 1294 | float: left; 1295 | text-align: center; 1296 | line-height: 40rpx; 1297 | border-radius: 10rpx; 1298 | font-size: 28rpx; 1299 | color: #fff; 1300 | background: #5cba42; 1301 | } 1302 | 1303 | .winChongzhi { 1304 | position: fixed; 1305 | top: 50%; 1306 | width: 75%; 1307 | height: 540rpx; 1308 | left: 13%; 1309 | margin-top: -400rpx; 1310 | background: #fff; 1311 | z-index: 999999; 1312 | border-radius: 20rpx; 1313 | overflow: hidden; 1314 | } 1315 | 1316 | .winChongzhi-title { 1317 | border-bottom: 1rpx solid #d9d9d9; 1318 | left: 15rpx; 1319 | text-align: center; 1320 | padding-top: 20rpx; 1321 | padding-bottom: 20rpx; 1322 | } 1323 | 1324 | .winChongzhi-item { 1325 | border-bottom: 1rpx solid #d9d9d9; 1326 | left: 15rpx; 1327 | } 1328 | 1329 | .winChongzhi-item-name { 1330 | text-align: left; 1331 | padding-left: 40rpx; 1332 | } 1333 | 1334 | .winChongzhi-item-check { 1335 | margin-left: 100rpx; 1336 | } 1337 | 1338 | .winChongzhi-btn { 1339 | line-height: 80rpx; 1340 | font-size: 48rpx; 1341 | color: #fff; 1342 | background: #5cba42; 1343 | text-align: center; 1344 | width: 90%; 1345 | margin-left: 5%; 1346 | margin-top: 10rpx; 1347 | border-radius: 10rpx; 1348 | } 1349 | 1350 | .close-bg { 1351 | position: fixed; 1352 | z-index: 99999999999999; 1353 | top: 65%; 1354 | left: 45%; 1355 | color: #fff; 1356 | font-size: 70rpx; 1357 | width: 80rpx; 1358 | height: 80rpx; 1359 | line-height: 60rpx; 1360 | /*border: 2rpx solid #fff;*/ 1361 | text-align: center; 1362 | border-radius: 60rpx; 1363 | background-size: 100%; 1364 | background-color: #a5a5a5; 1365 | border: none; 1366 | } 1367 | 1368 | .winXiaofeijilu { 1369 | position: fixed; 1370 | top: 40%; 1371 | width: 90%; 1372 | height: 86%; 1373 | left: 5%; 1374 | margin-top: -400rpx; 1375 | background: #fff; 1376 | z-index: 999999; 1377 | border-radius: 20rpx; 1378 | overflow: hidden; 1379 | } 1380 | 1381 | .winXiaofeijilu-title { 1382 | border-bottom: 2rpx solid #d9d9d9; 1383 | left: 15rpx; 1384 | text-align: center; 1385 | padding-top: 20rpx; 1386 | padding-bottom: 90rpx; 1387 | } 1388 | 1389 | .winXiaofeijilu-title-left { 1390 | float: left; 1391 | padding-left: 40rpx; 1392 | padding-top: 10rpx; 1393 | } 1394 | 1395 | .winXiaofeijilu-title-right { 1396 | float: right; 1397 | padding-right: 40rpx; 1398 | color: #5cba42; 1399 | } 1400 | 1401 | .winXiaofeijilu-item { 1402 | border-bottom: 0.5rpx solid #d9d9d9; 1403 | padding-bottom: 110rpx; 1404 | font-size: 30rpx; 1405 | } 1406 | 1407 | .winXiaofeijilu-item-name { 1408 | text-align: left; 1409 | padding-left: 40rpx; 1410 | } 1411 | 1412 | .winXiiaofejilu-item-check { 1413 | margin-left: 100rpx; 1414 | } 1415 | 1416 | .close-bg_xiaofejilu { 1417 | position: fixed; 1418 | z-index: 99999999999999; 1419 | top: 91%; 1420 | left: 45%; 1421 | color: #fff; 1422 | font-size: 70rpx; 1423 | width: 80rpx; 1424 | height: 80rpx; 1425 | line-height: 60rpx; 1426 | /*border: 2rpx solid #fff;*/ 1427 | text-align: center; 1428 | border-radius: 60rpx; 1429 | background-size: 100%; 1430 | background-color: #a5a5a5; 1431 | border: none; 1432 | } 1433 | 1434 | .jilu-cell { 1435 | position: relative; 1436 | /* display: -webkit-box; 1437 | display: -webkit-flex; 1438 | display: flex; */ 1439 | -webkit-box-align: center; 1440 | -webkit-align-items: center; 1441 | align-items: center; 1442 | } 1443 | 1444 | .jilu-cell:before { 1445 | content: " "; 1446 | position: absolute; 1447 | top: 0; 1448 | right: 0; 1449 | height: 1rpx; 1450 | /* border-top: 1rpx solid #d9d9d9; */ 1451 | color: #d9d9d9; 1452 | left: 15rpx; 1453 | } 1454 | 1455 | .jilu:first-child:before { 1456 | display: none; 1457 | } 1458 | 1459 | .weui-cell__bd_up_left { 1460 | float: left; 1461 | margin-left: 30rpx; 1462 | display: default; 1463 | } 1464 | 1465 | .weui-cell__bd_up_right { 1466 | float: right; 1467 | padding-left: 200rpx; 1468 | margin-right: 25rpx; 1469 | display: default; 1470 | } 1471 | 1472 | .weui-cell__bd_down_left { 1473 | float: left; 1474 | margin-left: 30rpx; 1475 | /* border-bottom: 1rpx solid #d5d5d6; */ 1476 | color: #797979; 1477 | } 1478 | 1479 | .weui-cell__bd_down_right { 1480 | float: right; 1481 | padding-left: 211rpx; 1482 | /* border-bottom: 1rpx solid #d5d5d6; */ 1483 | margin-right: 20rpx; 1484 | color: #797979; 1485 | } 1486 | 1487 | /* 优惠券 */ 1488 | 1489 | .youhuiquan-title { 1490 | position: absolute; 1491 | width: 100%; 1492 | height: 60rpx; 1493 | background-color: #fff; 1494 | display: block; 1495 | } 1496 | 1497 | .youhuiquan-title-item { 1498 | float: left; 1499 | width: 33%; 1500 | height: 60rpx; 1501 | border-bottom: 2rpx solid #ccc; 1502 | cursor: pointer; 1503 | text-align: center; 1504 | } 1505 | 1506 | .youhuiquan-title-sed { 1507 | color: #ff7000; 1508 | border-bottom: 2rpx solid #ff7000; 1509 | } 1510 | 1511 | .youhuiquan-scroll { 1512 | margin-top: 60rpx; 1513 | float: left; 1514 | overflow-y: auto; 1515 | flex-direction: column; 1516 | margin-left: 15rpx; 1517 | width: 95.5%; 1518 | } 1519 | 1520 | .stamp { 1521 | margin: 0rpx; 1522 | list-style: none; 1523 | font-family: "Microsoft YaHei", 'Source Code Pro', Menlo, Consolas, Monaco, monospace; 1524 | height: 230rpx; 1525 | padding: 0rpx 10rpx; 1526 | margin-top: 40rpx; 1527 | position: relative; 1528 | overflow: hidden; 1529 | width: 95.5%; 1530 | } 1531 | 1532 | .stamp::before { 1533 | content: ''; 1534 | position: absolute; 1535 | top: 0rpx; 1536 | bottom: 0rpx; 1537 | left: 20rpx; 1538 | right: 20rpx; 1539 | z-index: -1; 1540 | } 1541 | 1542 | .stamp .par { 1543 | float: left; 1544 | margin-left: 20rpx; 1545 | width: 400rpx; 1546 | border-right: 2rpx dashed rgba(255, 255, 255, 0.3); 1547 | text-align: left; 1548 | height: 230rpx; 1549 | } 1550 | 1551 | .stamp .par .yuan { 1552 | float: left; 1553 | font-size: 30rpx; 1554 | color: #fff; 1555 | line-height: 130rpx; 1556 | } 1557 | 1558 | .stamp .par .jine { 1559 | float: left; 1560 | font-size: 60rpx; 1561 | color: #fff; 1562 | line-height: 110rpx; 1563 | font-weight: bold; 1564 | } 1565 | 1566 | .stamp .par .leixing { 1567 | font-size: 30rpx; 1568 | color: #fff; 1569 | margin-right: 10rpx; 1570 | line-height: 130rpx; 1571 | } 1572 | 1573 | .stamp .par .tiaojian { 1574 | color: #fff; 1575 | font-size: 26rpx; 1576 | line-height: 32rpx; 1577 | } 1578 | 1579 | .stamp .par .sub { 1580 | position: relative; 1581 | top: -10rpx; 1582 | color: rgba(255, 255, 255, 0.8); 1583 | } 1584 | 1585 | .block { 1586 | display: block; 1587 | position: absolute; 1588 | } 1589 | 1590 | .stamp .copy { 1591 | display: inline-block; 1592 | width: 180rpx; 1593 | vertical-align: text-bottom; 1594 | font-size: 30rpx; 1595 | color: rgb(255, 255, 255); 1596 | text-align: center; 1597 | line-height: initial; 1598 | margin-top: 30rpx; 1599 | } 1600 | 1601 | .stamp .copy p { 1602 | font-size: 32rpx; 1603 | margin-top: 30rpx; 1604 | } 1605 | 1606 | .maxlength { 1607 | height: 35rpx; 1608 | overflow: hidden; 1609 | } 1610 | 1611 | .stamp02 { 1612 | background: radial-gradient(transparent 0, transparent 10rpx, #d24161 10rpx); 1613 | background-size: 30rpx 30rpx; 1614 | background-position: 18rpx 6rpx; 1615 | } 1616 | 1617 | .stamp02:before { 1618 | background-color: #d24161; 1619 | } 1620 | -------------------------------------------------------------------------------- /page/resources/json/menus.js: -------------------------------------------------------------------------------- 1 | export default 2 | 3 | [{id:169,tag:'a','fenleimingcheng':"招牌",'dishs':[{"id":169,"caiming":"必点菜石锅鱼","url":"https://weixincaidan.xyz/imgcdn/image/cai/169/thumb17485da5.jpg","xiaoshoujia":33.00,"zongxiaoliang":119,"count":0}]}] -------------------------------------------------------------------------------- /page/resources/pic/call2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/call2.png -------------------------------------------------------------------------------- /page/resources/pic/countMinus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/countMinus.png -------------------------------------------------------------------------------- /page/resources/pic/countSelAdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/countSelAdd.png -------------------------------------------------------------------------------- /page/resources/pic/countSelect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/countSelect.png -------------------------------------------------------------------------------- /page/resources/pic/dish-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/dish-close.png -------------------------------------------------------------------------------- /page/resources/pic/dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/dropdown.png -------------------------------------------------------------------------------- /page/resources/pic/localtion2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/localtion2.png -------------------------------------------------------------------------------- /page/resources/pic/my.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/my.png -------------------------------------------------------------------------------- /page/resources/pic/mySelected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/mySelected.png -------------------------------------------------------------------------------- /page/resources/pic/orderList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/orderList.png -------------------------------------------------------------------------------- /page/resources/pic/orderListSelected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/orderListSelected.png -------------------------------------------------------------------------------- /page/resources/pic/return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/return.png -------------------------------------------------------------------------------- /page/resources/pic/shouye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/shouye.png -------------------------------------------------------------------------------- /page/resources/pic/shouyeSelected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/shouyeSelected.png -------------------------------------------------------------------------------- /page/resources/pic/star.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/page/resources/pic/star.jpg -------------------------------------------------------------------------------- /page/shop/shop.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:shop/index 5 | 文件功能描述:首页 6 | 7 | ----------------------------------------------------------------*/ 8 | // page/shop/index.js 9 | var imageUtil = require('../../util/autoheight.js') 10 | var util = require('../../util/util.js') 11 | var qcloud = require('../../util/vendor/qcloud-weapp-client-sdk/index') 12 | var config = require('../../config') 13 | var app = getApp() 14 | Page({ 15 | data: { 16 | kaishishijian: '', 17 | jieshushijian: '', 18 | aFendian: {},//分店对象 19 | aZhuozi: {},//桌子对象 20 | aKehu: {},//分店对象 21 | yincangZhuce: true //隐藏注册窗体 22 | }, 23 | makeCall: function () { 24 | wx.makePhoneCall({ 25 | phoneNumber: this.data.aFendian.dianhua 26 | }) 27 | }, 28 | openLocation: function () { 29 | wx.openLocation({ 30 | latitude: app.globalData.aFendian.lat, 31 | longitude: app.globalData.aFendian.lng, 32 | scale: 28 33 | }) 34 | }, 35 | 36 | hideZhuce: function () { 37 | this.setData({ 38 | yincangZhuce: true 39 | }); 40 | }, 41 | showZhuce: function () { 42 | this.setData({ 43 | yincangZhuce: false 44 | }); 45 | }, 46 | getFirstPage: function (event) { 47 | var that = this 48 | qcloud.request({ 49 | url: config.service.getFirstPageUrl, 50 | hasLogin: app.globalData.hasLogin, 51 | data: { 52 | zhuoziid: app.globalData.zhuoziid, 53 | hasLogin: app.globalData.hasLogin, 54 | userInfo: JSON.stringify(app.globalData.userInfo) 55 | }, 56 | success: function (requestResult) { 57 | if (requestResult.data.code == '200') { 58 | that.setData({ 59 | kaishishijian: requestResult.data.kaishishijian, 60 | jieshushijian: requestResult.data.jieshushijian, 61 | aFendian: requestResult.data.aFendian, 62 | aZhuozi: requestResult.data.aZhuozi, 63 | aKehu: requestResult.data.aKehu 64 | }); 65 | app.globalData.userInfo.openId = app.globalData.userInfo.openId ? app.globalData.userInfo.openId : requestResult.data.openId; 66 | app.globalData.userInfo.session_key = app.globalData.userInfo.session_key ? app.globalData.userInfo.session_key : requestResult.data.session_key; 67 | app.globalData.aFendian = requestResult.data.aFendian; 68 | app.globalData.aZhuozi = requestResult.data.aZhuozi; 69 | app.globalData.aKehu = requestResult.data.aKehu; 70 | if (app.globalData.aFendian.zhifu && (!(requestResult.data.aKehu && requestResult.data.aKehu.dianhua)) && app.globalData.userInfo && app.globalData.userInfo.openId && wx.canIUse('button.open-type.getPhoneNumber')) { 71 | that.setData({ 72 | yincangZhuce: false 73 | }); 74 | } 75 | wx.setNavigationBarTitle({ 76 | title: '欢迎光临:' + app.globalData.aFendian.fendianmingcheng 77 | }); 78 | util.hideBusy(); 79 | } 80 | else { 81 | util.hideBusy(); 82 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 83 | } 84 | }, 85 | fail: function (requestResult) { 86 | util.hideBusy(); 87 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 88 | }, 89 | complete: wx.stopPullDownRefresh() 90 | }); 91 | }, 92 | onLoad: function (params) { 93 | util.showBusy('请稍候。。。') 94 | var that = this 95 | if (params.zhuoziid) { 96 | app.globalData.zhuoziid = params.zhuoziid; 97 | } 98 | if (!app.globalData.hasLogin) { 99 | wx.login({ 100 | success: function (loginResult) { 101 | 102 | wx.getUserInfo({ 103 | success: function (userResult) { 104 | console.log('userResult:', userResult) 105 | app.globalData.hasLogin = true; 106 | userResult.userInfo.code = loginResult.code; 107 | app.globalData.userInfo = userResult.userInfo; 108 | that.getFirstPage(); 109 | }, 110 | fail: function (userError) { 111 | util.hideBusy(); 112 | app.globalData.hasLogin = false; 113 | that.getFirstPage(); 114 | }, 115 | }); 116 | }, 117 | fail: function (loginError) { 118 | util.hideBusy(); 119 | app.globalData.hasLogin = false; 120 | util.showFailModal('微信登陆失败,原因可能是首次登陆本门店,请关闭程序后重新扫描登陆。', loginError); 121 | }, 122 | complete: function () { 123 | } 124 | }); 125 | } 126 | else 127 | that.getFirstPage(); 128 | }, 129 | onReady: function () { 130 | // 页面渲染完成 131 | }, 132 | onShow: function () { 133 | // 页面显示 134 | 135 | }, 136 | onHide: function () { 137 | // 页面隐藏 138 | }, 139 | onUnload: function () { 140 | // 页面关闭 141 | }, 142 | onShareAppMessage: function () { 143 | return { 144 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng, 145 | path: '/page/shop/shop?zhuoziid=' + app.globalData.zhuoziid 146 | } 147 | }, 148 | getPhoneNumber: function (e) { 149 | var that = this 150 | if (!e.detail.encryptedData) return 151 | var tempdata = { 152 | zhuoziid: app.globalData.zhuoziid, 153 | iv: e.detail.iv, 154 | encryptedData: e.detail.encryptedData, 155 | userInfo: JSON.stringify(app.globalData.userInfo), 156 | }; 157 | 158 | qcloud.request({ 159 | url: config.service.getPhoneNumberUrl, 160 | hasLogin: app.globalData.hasLogin, 161 | data: tempdata, 162 | success(result) { 163 | if (result.statusCode == "200") { 164 | if (result.data.code == "200") { 165 | let ret = true; 166 | let msg = result.data.message; 167 | wx.showModal({ 168 | title: '', 169 | content: msg, 170 | showCancel: false, 171 | complete: function (res) { 172 | if (ret) { 173 | wx.switchTab({ 174 | url: '/page/my/my' 175 | }) 176 | } 177 | } 178 | }) 179 | that.hideZhuce() 180 | } 181 | else { 182 | let ret = false; 183 | let msg = '出现异常,错误代码:' + result.data.code; 184 | wx.showModal({ 185 | title: '订单处理结果:', 186 | content: msg, 187 | showCancel: false, 188 | complete: function (res) { 189 | if (ret) { 190 | wx.switchTab({ 191 | url: '/page/my/my' 192 | }) 193 | } 194 | else { 195 | util.navigateBack1; 196 | } 197 | } 198 | }) 199 | //directret(false, '下单出现异常,请联系客服!' + '错误代码:' + result.data.code); 200 | } 201 | } 202 | else { 203 | let ret = false; 204 | let msg = '请求失败,' + '错误代码:' + result.statusCode; 205 | console.log(msg); 206 | console.log(result); 207 | wx.showModal({ 208 | title: '订单处理结果:', 209 | content: msg, 210 | showCancel: false, 211 | complete: function (res) { 212 | if (ret) { 213 | wx.switchTab({ 214 | url: '/page/my/my' 215 | }) 216 | } 217 | else { 218 | util.navigateBack1; 219 | } 220 | } 221 | }) 222 | } 223 | }, 224 | fail(error) { 225 | let ret = false; 226 | let msg = '请求失败' + error; 227 | wx.showModal({ 228 | title: '订单处理结果:', 229 | content: msg, 230 | showCancel: false, 231 | complete: function (res) { 232 | if (ret) { 233 | wx.switchTab({ 234 | url: '/page/my/my' 235 | }) 236 | } 237 | else { 238 | util.navigateBack1; 239 | } 240 | } 241 | }) 242 | } 243 | }); 244 | } 245 | 246 | }) -------------------------------------------------------------------------------- /page/shop/shop.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /page/shop/shop.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 门店地址:{{aFendian.dizhi}} 15 | 16 | 17 | 18 | 19 | 预约电话:{{aFendian.dianhua}} 20 | 21 | 22 | 23 | 24 | 营业时间:{{kaishishijian}} - {{jieshushijian}} 25 | 26 | 27 | 28 | 29 | {{aFendian.jieshao}} 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /page/shop/shop.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | font-family: "微软雅黑"; 3 | background: #fff; 4 | padding-bottom: 150rpx; 5 | } 6 | 7 | .detailtop { 8 | height: 320rpx; 9 | background: #fff; 10 | text-align: center; 11 | } 12 | 13 | .detailtoppic image { 14 | width: 700rpx; 15 | height: 300rpx; 16 | border-radius: 10rpx; 17 | /* border: 3px solid #f38815;*/ 18 | margin-top: 10rpx; 19 | } 20 | 21 | .indexbom { 22 | width: 95%; 23 | margin: 0 auto; 24 | } 25 | 26 | .indexbom image { 27 | width: 48%; 28 | height: 240rpx; 29 | margin: 1% 1%; 30 | } 31 | 32 | .indexbom-tit { 33 | border-left: 3px solid #f38815; 34 | width: 93%; 35 | height: 30rpx; 36 | margin: 20rpx auto; 37 | font-size: 30rpx; 38 | color: #4a4a4a; 39 | line-height: 30rpx; 40 | text-indent: 10px; 41 | } 42 | 43 | .indextop { 44 | width: 95%; 45 | text-align: left; 46 | font-size: 24rpx; 47 | color: #fff; 48 | background: url(/imgs/mjbg.png) repeat-x top left; 49 | background-size: 20rpx auto; 50 | margin: 0 auto; 51 | padding-top: 20rpx; 52 | margin-top: 60rpx; 53 | } 54 | 55 | .indextopSpan { 56 | display: inline-block; 57 | text-align: center; 58 | width: 40rpx; 59 | height: 40rpx; 60 | border-radius: 5px; 61 | background: #3ba2f9; 62 | font-size: 24rpx; 63 | color: #fff; 64 | line-height: 40rpx; 65 | } 66 | 67 | .detailtoptit { 68 | font-size: 30rpx; 69 | color: #4a4a4a; 70 | margin-top: 10rpx; 71 | } 72 | 73 | .detailtopstate { 74 | font-size: 36rpx; 75 | color: #4a4a4a; 76 | font-weight: bold; 77 | margin-top: 10rpx; 78 | } 79 | 80 | .detaillist { 81 | background: #fff; 82 | margin-top: 30rpx; 83 | padding: 30rpx 0 0; 84 | } 85 | 86 | .detaillist .table { 87 | width: 100%; 88 | font-size: 30rpx; 89 | color: #606060; 90 | text-align: center; 91 | border-bottom: 1px solid #e8e8e8; 92 | } 93 | 94 | .detailmid { 95 | background: #fff; 96 | font-size: 30rpx; 97 | color: #565656; 98 | } 99 | 100 | .detailmidli { 101 | position: relative; 102 | border-top: 1px solid #efefef; 103 | height: 100rpx; 104 | line-height: 100rpx; 105 | } 106 | 107 | .detailmidlileft { 108 | width: 50rpx; 109 | height: 100rpx; 110 | display: inline-block; 111 | margin-left: 20rpx; 112 | } 113 | 114 | .detailmidliright { 115 | float: left; 116 | } 117 | 118 | .detailmidpic { 119 | width: 30rpx; 120 | height: 100rpx; 121 | } 122 | 123 | .detailmidli0 { 124 | position: relative; 125 | /* border-top: 1px solid #efefef;*/ 126 | height: auto; 127 | line-height: 40rpx; 128 | border-bottom: 1px solid #efefef; 129 | padding: 30rpx 0 30rpx 70rpx; 130 | } 131 | 132 | .detailmidpic0 { 133 | width: 40rpx; 134 | height: 40rpx; 135 | position: absolute; 136 | top: 25rpx; 137 | left: 20rpx; 138 | margin-top: 6rpx; 139 | } 140 | 141 | .detailmidpic1 { 142 | width: 40rpx; 143 | height: 40rpx; 144 | position: absolute; 145 | top: 30rpx; 146 | right: 20rpx; 147 | } 148 | 149 | .tr { 150 | display: flex; 151 | padding: 15rpx 20rpx; 152 | } 153 | 154 | .th, .td { 155 | border: 0; 156 | width: 100%; 157 | } 158 | 159 | .ordername { 160 | width: 70%; 161 | text-align: left; 162 | } 163 | 164 | .ordernum { 165 | width: 15%; 166 | } 167 | 168 | .orderprice { 169 | width: 15%; 170 | text-align: right; 171 | } 172 | 173 | .trbom { 174 | display: flex; 175 | padding: 15rpx 20rpx; 176 | } 177 | 178 | .tdbomtit { 179 | text-align: left; 180 | width: 85%; 181 | font-size: 28rpx; 182 | } 183 | 184 | .tdbomprice { 185 | text-align: right; 186 | width: 15%; 187 | color: #f38815; 188 | } 189 | 190 | .tabletotal { 191 | font-size: 36rpx; 192 | color: #f38815; 193 | text-align: right; 194 | padding: 20rpx; 195 | } 196 | 197 | .detailinfo { 198 | background: #fff; 199 | margin-top: 30rpx; 200 | padding: 20rpx 20rpx 30rpx; 201 | font-size: 30rpx; 202 | color: #606060; 203 | } 204 | 205 | .detailtit { 206 | padding: 15rpx 0; 207 | font-size: 30rpx; 208 | font-weight: bold; 209 | } 210 | 211 | .detailtxt { 212 | padding: 5rpx 0; 213 | } 214 | 215 | .shopTuiJian{ 216 | margin-left: 20rpx; 217 | margin-right: 15rpx; 218 | margin-top: 10rpx; 219 | width: 710rpx; 220 | height: 952rpx; 221 | } -------------------------------------------------------------------------------- /page/thisorder/thisorder.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:thisorder/index 5 | 文件功能描述:点餐 6 | 7 | ----------------------------------------------------------------*/ 8 | var util = require('../../util/util.js') 9 | var app = getApp() 10 | var qcloud = require('../../util/vendor/qcloud-weapp-client-sdk/index'); 11 | var config = require('../../config'); 12 | var QQMapWX = require('../../util/qqmap-wx-jssdk.js'); 13 | var qqmapsdk; 14 | Page({ 15 | data: { 16 | menus: app.globalData.menus, 17 | total: app.globalData.total, 18 | kehuliuyan: '', 19 | leixingItems: [ 20 | { name: '堂食', value: '堂食', checked: true }, 21 | { name: '打包带走', value: '打包带走' }, 22 | { name: '外卖', value: '外卖' } 23 | ], 24 | renshuArray: ['---', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '大于15人'], 25 | daoDianArray: ['已在店', '今天', '明天', '后天'], 26 | renshuIndex: 0, //人数 27 | daoDianIndex: 0, //已在店 今天 明天 后天 28 | date: '2016-09-01', 29 | time: '---', //到店时间 30 | aLeixing: '堂食', //类型 31 | aWaiMaiDiZhi: '', 32 | aLianXiDianHua: '', 33 | aFendian: {},//分店对象 34 | aZhuozi: {},//桌子对象 35 | aKehu: {},//分店对象 36 | aYouhuiquan: {}, // 可用优惠券 37 | youhuiquanJine: 0 //优惠券可用金额 38 | }, 39 | selectMenu: function (event) { 40 | let data = event.currentTarget.dataset 41 | }, 42 | addCount: function (event) { 43 | let data = event.currentTarget.dataset 44 | let menu = util.arrfind(this.data.menus, data.cid) 45 | if (menu.url == null) { 46 | menu.url = 0 47 | util.arrfind(app.globalData.menus, data.cid).url = 0 48 | } 49 | menu.url += 1; 50 | util.arrfind(app.globalData.menus, data.cid).url += 1; 51 | let dish = util.arrfind(menu.dishs, data.id) 52 | dish.count += 1; 53 | this.data.total.count += 1 54 | this.data.total.money = (parseFloat(this.data.total.money) + parseFloat(dish.huiyuanjia)).toFixed(2) 55 | app.globalData.total.count += 1 56 | app.globalData.total.money = (parseFloat(app.globalData.total.money) + parseFloat(dish.huiyuanjia)).toFixed(2) 57 | util.arrfind(util.arrfind(app.globalData.menus, data.cid).dishs, data.id).count += 1; 58 | if (this.data.aYouhuiquan && this.data.aYouhuiquan.zuidixiaofei <= this.data.total.money) { 59 | this.data.youhuiquanJine = this.data.aYouhuiquan.jine 60 | } 61 | else { 62 | this.data.youhuiquanJine = 0 63 | } 64 | this.setData({ 65 | menus: this.data.menus, 66 | total: this.data.total, 67 | youhuiquanJine: this.data.youhuiquanJine 68 | }) 69 | }, 70 | minusCount: function (event) { 71 | let data = event.currentTarget.dataset 72 | let menu = util.arrfind(this.data.menus, data.cid) 73 | menu.url = menu.url - 1; 74 | util.arrfind(app.globalData.menus, data.cid).url -= 1; 75 | let dish = util.arrfind(menu.dishs, data.id) 76 | if (dish.count <= 0) 77 | return 78 | dish.count -= 1; 79 | this.data.total.count -= 1 80 | this.data.total.money = (this.data.total.money - dish.huiyuanjia).toFixed(2) 81 | app.globalData.total.count -= 1 82 | app.globalData.total.money = (app.globalData.total.money - dish.huiyuanjia).toFixed(2) 83 | util.arrfind(util.arrfind(app.globalData.menus, data.cid).dishs, data.id).count -= 1; 84 | if (this.data.aYouhuiquan && this.data.aYouhuiquan.zuidixiaofei <= this.data.total.money) { 85 | this.data.youhuiquanJine = this.data.aYouhuiquan.jine 86 | } 87 | else { 88 | this.data.youhuiquanJine = 0 89 | } 90 | this.setData({ 91 | menus: this.data.menus, 92 | total: this.data.total, 93 | youhuiquanJine: this.data.youhuiquanJine 94 | }) 95 | }, 96 | bindback: function (event) { 97 | wx.navigateBack({ 98 | delta: 1, // 回退前 delta(默认为1) 页面 99 | success: function (res) { 100 | console.log('返回ok') 101 | }, 102 | fail: function () { 103 | console.log('返回fail') 104 | }, 105 | complete: function () { 106 | // complete 107 | } 108 | }) 109 | }, 110 | bindsubmit: function (event) { 111 | var that = this 112 | //判断是否有最小销售数量不满足情况 113 | var judgeBidiancai = util.judgeBidiancai(app.globalData.menus); 114 | if (judgeBidiancai != '') { 115 | util.showFailModal('下单限制:', judgeBidiancai) 116 | return; 117 | } 118 | //强制选人数 119 | if (app.globalData.aFendian.qiangzhixuanrenshu && (that.data.renshuIndex <= 0 || that.data.renshuIndex > 14)) { 120 | util.showFailModal('提示', '请选择人数') 121 | return; 122 | } 123 | //开通支付,必须允许授权 124 | if (app.globalData.aFendian.zhifu && app.globalData.hasLogin == false) { 125 | util.navigateBack1(); 126 | util.showFailModal('提示', '根据微信要求,订单支付时,本系统需要获得用户授权许可。请点击登录,并允许授权,谢谢配合。') 127 | return; 128 | } 129 | var tmemo = this.data.kehuliuyan; 130 | wx.showModal({ 131 | title: '订单即将发商户处理:', 132 | content: '是否提交?', 133 | confirmText: "提交", 134 | cancelText: "取消", 135 | success: function (res) { 136 | if (res.confirm) { 137 | var ret = true; 138 | var msg = ''; 139 | var tempdata = { 140 | memo: tmemo, 141 | order: JSON.stringify(util.getThisOrder(app.globalData.menus)), 142 | zhuoziid: app.globalData.zhuoziid, 143 | hasLogin: app.globalData.hasLogin, 144 | userInfo: JSON.stringify(app.globalData.userInfo), 145 | 146 | hasGeo: app.globalData.hasGeo, 147 | lat: app.globalData.aFendian.lat, 148 | lng: app.globalData.aFendian.lng, 149 | phoneaddress: app.globalData.aFendian.phoneaddress, 150 | phoneprovince: app.globalData.aFendian.phoneprovince, 151 | phonecity: app.globalData.aFendian.phonecity, 152 | phonedistrict: app.globalData.aFendian.phonedistrict, 153 | phonestreet: app.globalData.aFendian.phonestreet, 154 | phonestreet_number: app.globalData.aFendian.phonestreet_number, 155 | 156 | jiacaiDingdanno: app.globalData.jiacaiDingdanno, 157 | dingDanLeiXing: that.data.aLeixing, 158 | renShu: that.data.renshuArray[that.data.renshuIndex], 159 | daoDianShiJian: that.data.daoDianIndex == 0 ? '' : that.data.daoDianArray[that.data.daoDianIndex] + '-' + that.data.time, 160 | waiMaiDiZhi: that.data.aWaiMaiDiZhi, 161 | lianXiDianHua: that.data.aLianXiDianHua, 162 | youhuiquan: that.data.youhuiquanJine > 0 ? JSON.stringify(that.data.aYouhuiquan) : '' 163 | }; 164 | util.showBusy('请稍候。。。'); 165 | qcloud.request({ 166 | url: config.service.submitOrderUrl, 167 | hasLogin: app.globalData.hasLogin, 168 | data: tempdata, 169 | success(result) { 170 | that.setData({ 171 | aYouhuiquan: {}, // 可用优惠券 172 | youhuiquanJine: 0 173 | }) 174 | util.hideBusy(); 175 | if (result.statusCode == "200") { 176 | var aPrepay = result.data.prepay 177 | app.globalData.userInfo.openId = app.globalData.userInfo.openId ? app.globalData.userInfo.openId : result.data.openId; 178 | app.globalData.userInfo.session_key = app.globalData.userInfo.session_key ? app.globalData.userInfo.session_key : result.data.session_key; 179 | if (aPrepay.code == "200") {//不需要在线支付 180 | let msg = aPrepay.message; 181 | app.globalData.total.count = 0; 182 | app.globalData.total.money = 0; 183 | app.globalData.dingdanno = aPrepay.dingdanno; 184 | app.globalData.menus = util.resetMenu(app.globalData.menus); 185 | wx.showModal({ 186 | title: '订单处理结果:', 187 | content: msg, 188 | showCancel: false, 189 | complete: function (res) { 190 | wx.switchTab({ 191 | url: '/page/my/my' 192 | }) 193 | } 194 | }) 195 | } 196 | else if (aPrepay.code == "300") {//通过余额支付 197 | let msg = aPrepay.message; 198 | app.globalData.total.count = 0; 199 | app.globalData.total.money = 0; 200 | app.globalData.dingdanno = aPrepay.dingdanno; 201 | app.globalData.menus = util.resetMenu(app.globalData.menus); 202 | wx.showModal({ 203 | title: '订单处理结果:', 204 | content: msg, 205 | showCancel: false, 206 | complete: function (res) { 207 | wx.switchTab({ 208 | url: '/page/my/my' 209 | }) 210 | } 211 | }) 212 | } 213 | else if (aPrepay.code == "400") {//通过在线支付 214 | let msg = aPrepay.message; 215 | app.globalData.total.count = 0; 216 | app.globalData.total.money = 0; 217 | app.globalData.dingdanno = aPrepay.dingdanno; 218 | app.globalData.menus = util.resetMenu(app.globalData.menus); 219 | wx.requestPayment({ 220 | 'timeStamp': aPrepay.timeStamp, 221 | 'nonceStr': aPrepay.nonceStr, 222 | 'package': aPrepay.package, 223 | 'signType': aPrepay.signType, 224 | 'paySign': aPrepay.paySign, 225 | 'success': function (res) { 226 | wx.showModal({ 227 | title: '订单处理结果:', 228 | content: res, 229 | showCancel: false, 230 | complete: function (res) { 231 | wx.switchTab({ 232 | url: '/page/my/my' 233 | }) 234 | } 235 | }) 236 | }, 237 | 'fail': function (res) { 238 | console.log('wx.requestPayment fail', res) 239 | util.navigateBack1(); 240 | } 241 | }); 242 | } 243 | else { 244 | let msg = '下单出现异常,错误代码:' + aPrepay.code; 245 | wx.showModal({ 246 | title: '订单处理结果:', 247 | content: msg, 248 | showCancel: false, 249 | complete: function (res) { 250 | wx.switchTab({ 251 | url: '/page/my/my' 252 | }) 253 | } 254 | }) 255 | } 256 | } 257 | else { 258 | let ret = false; 259 | let msg = '请求失败,' + '错误代码:' + result.statusCode; 260 | wx.showModal({ 261 | title: '订单处理结果:', 262 | content: msg, 263 | showCancel: false, 264 | complete: function (res) { 265 | if (ret) { 266 | wx.switchTab({ 267 | url: '/page/my/my' 268 | }) 269 | } 270 | else { 271 | util.navigateBack1(); 272 | } 273 | } 274 | }) 275 | } 276 | app.globalData.moshi = '' 277 | app.globalData.jiacaiDingdanno = '' 278 | }, 279 | fail(error) { 280 | util.hideBusy(); 281 | console.log('error:', error) 282 | let ret = false; 283 | let msg = '请求失败' + error; 284 | wx.showModal({ 285 | title: '订单处理结果:', 286 | content: msg, 287 | showCancel: false, 288 | complete: function (res) { 289 | if (ret) { 290 | wx.switchTab({ 291 | url: '/page/my/my' 292 | }) 293 | } 294 | else { 295 | util.navigateBack1(); 296 | } 297 | } 298 | }) 299 | } 300 | }); 301 | } else { 302 | console.log('用户点击辅助操作') 303 | } 304 | }, 305 | fail: function (error) { 306 | util.showFailModel('调用模式窗体失败', error); 307 | } 308 | }); 309 | }, 310 | onShow: function () { 311 | this.setData({ 312 | 'menus': app.globalData.menus, 313 | 'total': app.globalData.total, 314 | time: util.currentTime(), 315 | aFendian: app.globalData.aFendian, 316 | aZhuozi: app.globalData.aZhuozi, 317 | aKehu: app.globalData.aKehu 318 | }); 319 | wx.setNavigationBarTitle({ 320 | title: '确认订单' + app.globalData.moshi 321 | }); 322 | //提醒未点酒水 堂食非加菜模式提醒 323 | if (app.globalData.aFendian.tishixuanjiushui == true) { 324 | var judgeJiushuiyingliao = util.judgeJiushuiyingliao(app.globalData.menus); 325 | if (judgeJiushuiyingliao == '' && app.globalData.moshi == '' && this.data.aLeixing == '堂食') { 326 | wx.showModal({ 327 | title: '提示:', 328 | content: '您没有点酒水或饮料,需要吗?', 329 | confirmText: "去点酒水", 330 | cancelText: "不要", 331 | complete: function (res) { 332 | if (res.confirm) { 333 | console.log('您没有点酒水或饮料,需要吗?', res) 334 | wx.navigateBack({ 335 | delta: 1 336 | }) 337 | } 338 | } 339 | }) 340 | return; 341 | } 342 | } 343 | //获取可用优惠券id 344 | var that = this 345 | qcloud.request({ 346 | url: config.service.keyongYouhuiquanUrl, 347 | hasLogin: app.globalData.hasLogin, 348 | data: { 349 | zhuoziid: app.globalData.zhuoziid, 350 | hasLogin: app.globalData.hasLogin, 351 | userInfo: JSON.stringify(app.globalData.userInfo) 352 | }, 353 | success: function (requestResult) { 354 | if (requestResult.data.code == '200') { 355 | if (requestResult.data.aYouhuiquan && requestResult.data.aYouhuiquan.zuidixiaofei <= that.data.total.money) { 356 | that.setData({ 357 | aYouhuiquan: requestResult.data.aYouhuiquan, 358 | youhuiquanJine: requestResult.data.aYouhuiquan.jine 359 | }); 360 | } 361 | else { 362 | that.setData({ 363 | youhuiquanJine: 0 364 | }); 365 | } 366 | util.hideBusy(); 367 | } 368 | else { 369 | util.hideBusy(); 370 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 371 | } 372 | }, 373 | fail: function (requestResult) { 374 | util.hideBusy(); 375 | util.showFailModal('处理结果', '请求失败,请稍候再试。' + requestResult); 376 | }, 377 | }); 378 | }, 379 | onReady: function () { 380 | wx.setNavigationBarTitle({ 381 | title: '确认订单' + app.globalData.moshi 382 | } 383 | ) 384 | /*setTimeout(function () { 385 | util.hideBusy(); 386 | }.bind(this), 1000);*/ 387 | //桌子名称 含外卖 外送,自动切换外卖模式 388 | if (app.globalData.aZhuozi.zhuozimingcheng.indexOf('外卖') > -1 || app.globalData.aZhuozi.zhuozimingcheng.indexOf('外送') > -1) { 389 | var tLeiXingItems = this.data.leixingItems 390 | tLeiXingItems[2].checked = true 391 | this.setData({ 392 | leixingItems: tLeiXingItems, 393 | aLeixing: '外卖', 394 | }); 395 | this.setAdd() 396 | } 397 | util.hideBusy(); 398 | }, 399 | onShareAppMessage: function () { 400 | return { 401 | title: app.globalData.aFendian.fendianmingcheng + '-' + app.globalData.aZhuozi.zhuozimingcheng, 402 | path: '/page/shop/shop?zhuoziid=' + app.globalData.zhuoziid 403 | } 404 | }, 405 | bindRenshuChange: function (e) { 406 | this.setData({ 407 | renshuIndex: e.detail.value 408 | }) 409 | //堂食 非加菜模式 根据人数增加商品数 410 | if (app.globalData.moshi == '' && this.data.aLeixing == '堂食') { 411 | if (e.detail.value > 0 && e.detail.value < 14) { 412 | var ret = util.ziDongTianJiaShangPin(app.globalData.menus, this.data.renshuArray[e.detail.value], '堂食按人数') 413 | app.globalData.menus = ret.menu 414 | app.globalData.total.count = parseFloat(app.globalData.total.count * 1 + ret.count) 415 | app.globalData.total.money = parseFloat((app.globalData.total.money * 100 + ret.cash * 100) / 100) 416 | this.setData({ 417 | 'menus': app.globalData.menus, 418 | 'total': app.globalData.total 419 | }); 420 | } 421 | } 422 | }, 423 | bindDateChange: function (e) { 424 | this.setData({ 425 | date: e.detail.value 426 | }) 427 | }, 428 | bindTimeChange: function (e) { 429 | this.setData({ 430 | time: e.detail.value 431 | }) 432 | }, 433 | radioChange: function (e) { 434 | this.setData({ 435 | aLeixing: e.detail.value 436 | }) 437 | this.setAdd() 438 | }, 439 | bindDaoDianChange: function (e) { 440 | this.setData({ 441 | daoDianIndex: e.detail.value 442 | }) 443 | }, 444 | bindMemoblur: function (e) { 445 | this.setData({ 446 | kehuliuyan: e.detail.value 447 | }) 448 | }, 449 | bindWaiMaiDiZhiblur: function (e) { 450 | this.setData({ 451 | aWaiMaiDiZhi: e.detail.value 452 | }) 453 | }, 454 | bindLianXiDianHuablur: function (e) { 455 | this.setData({ 456 | aLianXiDianHua: e.detail.value 457 | }) 458 | }, 459 | setAdd: function () { 460 | var that = this 461 | if (this.data.aLeixing.indexOf('外卖') > -1 || this.data.aLeixing.indexOf('外送') > -1) { 462 | if (((app.globalData.aKehu && app.globalData.aKehu.dianhua))) { 463 | that.setData({ 464 | aLianXiDianHua: app.globalData.aKehu.dianhua 465 | }); 466 | } 467 | 468 | qqmapsdk = new QQMapWX({ 469 | key: 'PCLBZ-Q46LD-PO64S-PLAQW-ESMJF-RXBRZ' 470 | }); 471 | wx.getLocation({ 472 | type: 'gcj02', 473 | success: function (res) { 474 | qqmapsdk.reverseGeocoder({ 475 | location: { 476 | latitude: res.latitude, 477 | longitude: res.longitude 478 | }, 479 | success: function (resp) { 480 | console.log(' qqmapsdk.reverseGeocoder sucess:', resp); 481 | if (resp.status == 0) { 482 | that.setData({ 483 | aWaiMaiDiZhi: resp.result.address_reference.landmark_l2.title 484 | }) 485 | } 486 | }, 487 | fail: function (resp) { 488 | console.log('qqmapsdk.reverseGeocoder fail:', resp); 489 | }, 490 | complete: function (resp) { 491 | console.log('qqmapsdk.reverseGeocoder complete:', resp); 492 | } 493 | }); 494 | }, 495 | fail: function (res) { 496 | console.log('wx.getLocation fail:', res); 497 | }, 498 | complete: function (res) { 499 | console.log('wx.getLocation complete:', res); 500 | } 501 | }); 502 | } 503 | }, 504 | 505 | }) -------------------------------------------------------------------------------- /page/thisorder/thisorder.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /page/thisorder/thisorder.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{total.count}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ¥{{(total.money*100- youhuiquanJine*100)/100}} 20 | 21 | 22 | 23 | 24 | 25 | 类型: 26 | 27 | 32 | 33 | 34 | 47 | 72 | 76 | 80 | 81 | 备注: 82 | 83 | 84 | 94 | 95 | 96 | 点餐明细: 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /page/thisorder/thisorder.wxss: -------------------------------------------------------------------------------- 1 | .goback { 2 | width: 160rpx; 3 | display: block; 4 | height: 100rpx; 5 | line-height: 100rpx; 6 | font-size: 28rpx; 7 | background: lightgray; 8 | color: black; 9 | float: right; 10 | text-align: center; 11 | border-radius: 5rpx; 12 | margin-right: 10rpx; 13 | } 14 | 15 | .section__title { 16 | float: left; 17 | font-size: 32rpx; 18 | width: 180rpx; 19 | line-height: 60rpx; 20 | text-align: right; 21 | } 22 | 23 | .querenRadioGroup { 24 | margin-top: 20rpx; 25 | display: flex; 26 | } 27 | 28 | .querenTitle { 29 | margin-top: 30rpx; 30 | } 31 | 32 | .querenItem { 33 | padding-left: 20rpx; 34 | font-family: "微软雅黑"; 35 | padding-bottom: 25rpx; 36 | } 37 | 38 | .select_wrap { 39 | border: 1rpx solid #ddd; 40 | width: 200rpx; 41 | float: left; 42 | border-radius: 10rpx; 43 | height: 50rpx; 44 | margin-top: 5rpx; 45 | } 46 | 47 | .select_left { 48 | margin-left: 15rpx; 49 | text-align: left; 50 | margin-top: 5rpx; 51 | float: left; 52 | } 53 | 54 | .image_dropdown { 55 | width: 45rpx; 56 | height: 40rpx; 57 | border-radius: 5px; 58 | float: right; 59 | text-align: right; 60 | margin-right: 10rpx; 61 | margin-top: 5rpx; 62 | } 63 | 64 | .select_wrap_daodian { 65 | width: 700rpx; 66 | } 67 | 68 | .select_wrap_riqi { 69 | border: 1rpx solid #ddd; 70 | width: 200rpx; 71 | float: left; 72 | border-radius: 10rpx; 73 | height: 50rpx; 74 | margin-top: 5rpx; 75 | margin-right: 20rpx; 76 | font-size: 30rpx; 77 | } 78 | 79 | .input_waimaidizhi { 80 | border: 1rpx solid #ddd; 81 | width: 450rpx; 82 | float: left; 83 | border-radius: 10rpx; 84 | height: 65rpx; 85 | margin-top: 0rpx; 86 | margin-left: 0rpx; 87 | } 88 | 89 | .section_half_left { 90 | width: 49.5%; 91 | float: left; 92 | font-size: 32rpx; 93 | line-height: 60rpx; 94 | display: block; 95 | border-right: 1rpx solid #ddd; 96 | } 97 | 98 | .section_half_right { 99 | width: 49.5%; 100 | float: left; 101 | font-size: 32rpx; 102 | line-height: 60rpx; 103 | display: block; 104 | } 105 | 106 | .label_left { 107 | float: left; 108 | height: 65rpx; 109 | margin-top: 0rpx; 110 | margin-left: 20rpx; 111 | } 112 | 113 | .label_right { 114 | float: left; 115 | height: 65rpx; 116 | margin-top: 0rpx; 117 | margin-left: 0rpx; 118 | color: #5cba42; 119 | } 120 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件", 3 | "packOptions": { 4 | "ignore": [] 5 | }, 6 | "setting": { 7 | "urlCheck": true, 8 | "es6": true, 9 | "postcss": true, 10 | "minified": true, 11 | "newFeature": true, 12 | "autoAudits": false 13 | }, 14 | "compileType": "miniprogram", 15 | "libVersion": "2.0.4", 16 | "appid": "wxc956c28d6095f044", 17 | "projectname": "%E5%BE%AE%E6%89%AB%E7%82%B9%E9%A4%90", 18 | "debugOptions": { 19 | "hidedInDevtools": [] 20 | }, 21 | "isGameTourist": false, 22 | "condition": { 23 | "search": { 24 | "current": -1, 25 | "list": [] 26 | }, 27 | "conversation": { 28 | "current": -1, 29 | "list": [] 30 | }, 31 | "game": { 32 | "currentL": -1, 33 | "list": [] 34 | }, 35 | "miniprogram": { 36 | "current": -1, 37 | "list": [] 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /screemshot/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/0.jpg -------------------------------------------------------------------------------- /screemshot/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/1.jpg -------------------------------------------------------------------------------- /screemshot/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/2.jpg -------------------------------------------------------------------------------- /screemshot/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/3.jpg -------------------------------------------------------------------------------- /screemshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/4.png -------------------------------------------------------------------------------- /screemshot/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/5.jpg -------------------------------------------------------------------------------- /screemshot/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/6.jpg -------------------------------------------------------------------------------- /screemshot/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/7.jpg -------------------------------------------------------------------------------- /screemshot/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/8.jpg -------------------------------------------------------------------------------- /screemshot/doortip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/doortip.png -------------------------------------------------------------------------------- /screemshot/huzhan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhyqieqie/wechatscan/44dec0a64b4f8406d43150f6673fe5e0cb9d497f/screemshot/huzhan.jpg -------------------------------------------------------------------------------- /util/autoheight.js: -------------------------------------------------------------------------------- 1 | //autoheight.js 2 | function imageUtil(e) { 3 | var imageSize = {}; 4 | var originalWidth = e.detail.width;//图片原始宽 5 | var originalHeight = e.detail.height;//图片原始高 6 | var originalScale = originalHeight/originalWidth;//图片高宽比 7 | console.log('originalWidth: ' + originalWidth) 8 | console.log('originalHeight: ' + originalHeight) 9 | //获取屏幕宽高 10 | wx.getSystemInfo({ 11 | success: function (res) { 12 | var windowWidth = res.windowWidth; 13 | var windowHeight = res.windowHeight; 14 | var windowscale = windowHeight/windowWidth;//屏幕高宽比 15 | console.log('windowWidth: ' + windowWidth) 16 | console.log('windowHeight: ' + windowHeight) 17 | if(originalScale < windowscale){//图片高宽比小于屏幕高宽比 18 | //图片缩放后的宽为屏幕宽 19 | imageSize.imageWidth = windowWidth; 20 | imageSize.imageHeight = (windowWidth * originalHeight) / originalWidth; 21 | }else{//图片高宽比大于屏幕高宽比 22 | //图片缩放后的高为屏幕高 23 | imageSize.imageHeight = windowHeight; 24 | imageSize.imageWidth = (windowHeight * originalWidth) / originalHeight; 25 | } 26 | 27 | } 28 | }) 29 | console.log('缩放后的宽: ' + imageSize.imageWidth) 30 | console.log('缩放后的高: ' + imageSize.imageHeight) 31 | return imageSize; 32 | } 33 | 34 | module.exports = { 35 | imageUtil: imageUtil 36 | } 37 | -------------------------------------------------------------------------------- /util/qqmap-wx-jssdk.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:diancan/index 5 | 文件功能描述:位置 6 | 7 | ----------------------------------------------------------------*/ 8 | 9 | var ERROR_CONF = { 10 | KEY_ERR: 311, 11 | KEY_ERR_MSG: 'key格式错误', 12 | PARAM_ERR: 310, 13 | PARAM_ERR_MSG: '请求参数信息有误', 14 | SYSTEM_ERR: 600, 15 | SYSTEM_ERR_MSG: '系统错误', 16 | WX_ERR_CODE: 1000, 17 | WX_OK_CODE: 200 18 | }; 19 | var BASE_URL = 'https://apis.map.qq.com/ws/'; 20 | var URL_SEARCH = BASE_URL + 'place/v1/search'; 21 | var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; 22 | var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; 23 | var URL_CITY_LIST = BASE_URL + 'district/v1/list'; 24 | var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; 25 | var URL_DISTANCE = BASE_URL + 'distance/v1/'; 26 | var Utils = { 27 | /** 28 | * 得到终点query字符串 29 | * @param {Array|String} 检索数据 30 | */ 31 | location2query(data) { 32 | if (typeof data == 'string') { 33 | return data; 34 | } 35 | var query = ''; 36 | for (var i = 0; i < data.length; i++) { 37 | var d = data[i]; 38 | if (!!query) { 39 | query += ';'; 40 | } 41 | if (d.location) { 42 | query = query + d.location.lat + ',' + d.location.lng; 43 | } 44 | if (d.latitude && d.longitude) { 45 | query = query + d.latitude + ',' + d.longitude; 46 | } 47 | } 48 | return query; 49 | }, 50 | 51 | /** 52 | * 使用微信接口进行定位 53 | */ 54 | getWXLocation(success, fail, complete) { 55 | wx.getLocation({ 56 | type: 'gcj02', 57 | success: success, 58 | fail: fail, 59 | complete: complete 60 | }); 61 | }, 62 | 63 | /** 64 | * 获取location参数 65 | */ 66 | getLocationParam(location) { 67 | if (typeof location == 'string') { 68 | var locationArr = location.split(','); 69 | if (locationArr.length === 2) { 70 | location = { 71 | latitude: location.split(',')[0], 72 | longitude: location.split(',')[1] 73 | }; 74 | } else { 75 | location = {}; 76 | } 77 | } 78 | return location; 79 | }, 80 | 81 | /** 82 | * 回调函数默认处理 83 | */ 84 | polyfillParam(param) { 85 | param.success = param.success || function () { }; 86 | param.fail = param.fail || function () { }; 87 | param.complete = param.complete || function () { }; 88 | }, 89 | 90 | /** 91 | * 验证param对应的key值是否为空 92 | * 93 | * @param {Object} param 接口参数 94 | * @param {String} key 对应参数的key 95 | */ 96 | checkParamKeyEmpty(param, key) { 97 | if (!param[key]) { 98 | var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误'); 99 | param.fail(errconf); 100 | param.complete(errconf); 101 | return true; 102 | } 103 | return false; 104 | }, 105 | 106 | /** 107 | * 验证参数中是否存在检索词keyword 108 | * 109 | * @param {Object} param 接口参数 110 | */ 111 | checkKeyword(param){ 112 | return !this.checkParamKeyEmpty(param, 'keyword'); 113 | }, 114 | 115 | /** 116 | * 验证location值 117 | * 118 | * @param {Object} param 接口参数 119 | */ 120 | checkLocation(param) { 121 | var location = this.getLocationParam(param.location); 122 | if (!location || !location.latitude || !location.longitude) { 123 | var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误') 124 | param.fail(errconf); 125 | param.complete(errconf); 126 | return false; 127 | } 128 | return true; 129 | }, 130 | 131 | /** 132 | * 构造错误数据结构 133 | * @param {Number} errCode 错误码 134 | * @param {Number} errMsg 错误描述 135 | */ 136 | buildErrorConfig(errCode, errMsg) { 137 | return { 138 | status: errCode, 139 | message: errMsg 140 | }; 141 | }, 142 | 143 | /** 144 | * 构造微信请求参数,公共属性处理 145 | * 146 | * @param {Object} param 接口参数 147 | * @param {Object} param 配置项 148 | */ 149 | buildWxRequestConfig(param, options) { 150 | var that = this; 151 | options.header = { "content-type": "application/json" }; 152 | options.method = 'GET'; 153 | options.success = function (res) { 154 | var data = res.data; 155 | if (data.status === 0) { 156 | param.success(data); 157 | } else { 158 | param.fail(data); 159 | } 160 | }; 161 | options.fail = function (res) { 162 | res.statusCode = ERROR_CONF.WX_ERR_CODE; 163 | param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, result.errMsg)); 164 | }; 165 | options.complete = function (res) { 166 | var statusCode = +res.statusCode; 167 | switch(statusCode) { 168 | case ERROR_CONF.WX_ERR_CODE: { 169 | param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); 170 | break; 171 | } 172 | case ERROR_CONF.WX_OK_CODE: { 173 | var data = res.data; 174 | if (data.status === 0) { 175 | param.complete(data); 176 | } else { 177 | param.complete(that.buildErrorConfig(data.status, data.message)); 178 | } 179 | break; 180 | } 181 | default:{ 182 | param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)); 183 | } 184 | 185 | } 186 | } 187 | return options; 188 | }, 189 | 190 | /** 191 | * 处理用户参数是否传入坐标进行不同的处理 192 | */ 193 | locationProcess(param, locationsuccess, locationfail, locationcomplete) { 194 | var that = this; 195 | locationfail = locationfail || function (res) { 196 | res.statusCode = ERROR_CONF.WX_ERR_CODE; 197 | param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); 198 | }; 199 | locationcomplete = locationcomplete || function (res) { 200 | console.log(' locationProcess locationcomplete:',res) 201 | if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { 202 | param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); 203 | } 204 | }; 205 | if (!param.location) { 206 | that.getWXLocation(locationsuccess, locationfail, locationcomplete); 207 | } else if (that.checkLocation(param)) { 208 | var location = Utils.getLocationParam(param.location); 209 | locationsuccess(location); 210 | } 211 | } 212 | } 213 | 214 | 215 | class QQMapWX { 216 | 217 | /** 218 | * 构造函数 219 | * 220 | * @param {Object} options 接口参数,key 为必选参数 221 | */ 222 | constructor(options) { 223 | if (!options.key) { 224 | throw Error('key值不能为空'); 225 | } 226 | this.key = options.key; 227 | } 228 | 229 | /** 230 | * POI周边检索 231 | * 232 | * @param {Object} options 接口参数对象 233 | * 234 | * 参数对象结构可以参考 235 | * @see http://lbs.qq.com/webservice_v1/guide-search.html 236 | */ 237 | search(options) { 238 | var that = this; 239 | options = options || {}; 240 | 241 | Utils.polyfillParam(options); 242 | 243 | if (!Utils.checkKeyword(options)) { 244 | return; 245 | } 246 | 247 | var requestParam = { 248 | keyword: options.keyword, 249 | orderby: options.orderby || '_distance', 250 | page_size: options.page_size || 10, 251 | page_index: options.page_index || 1, 252 | output: 'json', 253 | key: that.key 254 | }; 255 | 256 | if (options.address_format) { 257 | requestParam.address_format = options.address_format; 258 | } 259 | 260 | if (options.filter) { 261 | requestParam.filter = options.filter; 262 | } 263 | 264 | var distance = options.distance || "1000"; 265 | var auto_extend = options.auto_extend || 1; 266 | 267 | var locationsuccess = function (result) { 268 | requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend +")"; 269 | wx.request(Utils.buildWxRequestConfig(options, { 270 | url: URL_SEARCH, 271 | data: requestParam 272 | })); 273 | } 274 | Utils.locationProcess(options, locationsuccess); 275 | } 276 | 277 | /** 278 | * sug模糊检索 279 | * 280 | * @param {Object} options 接口参数对象 281 | * 282 | * 参数对象结构可以参考 283 | * http://lbs.qq.com/webservice_v1/guide-suggestion.html 284 | */ 285 | getSuggestion(options) { 286 | var that = this; 287 | options = options || {}; 288 | Utils.polyfillParam(options); 289 | 290 | if (!Utils.checkKeyword(options)) { 291 | return; 292 | } 293 | 294 | var requestParam = { 295 | keyword: options.keyword, 296 | region: options.region || '全国', 297 | region_fix: options.region_fix || 0, 298 | policy: options.policy || 0, 299 | output: 'json', 300 | key: that.key 301 | }; 302 | wx.request(Utils.buildWxRequestConfig(options, { 303 | url: URL_SUGGESTION, 304 | data: requestParam 305 | })); 306 | } 307 | 308 | /** 309 | * 逆地址解析 310 | * 311 | * @param {Object} options 接口参数对象 312 | * 313 | * 请求参数结构可以参考 314 | * http://lbs.qq.com/webservice_v1/guide-gcoder.html 315 | */ 316 | reverseGeocoder(options) { 317 | var that = this; 318 | options = options || {}; 319 | Utils.polyfillParam(options); 320 | var requestParam = { 321 | coord_type: options.coord_type || 5, 322 | get_poi: options.get_poi || 0, 323 | output: 'json', 324 | key: that.key 325 | }; 326 | if (options.poi_options) { 327 | requestParam.poi_options = options.poi_options 328 | } 329 | 330 | var locationsuccess = function (result) { 331 | requestParam.location = result.latitude + ',' + result.longitude; 332 | wx.request(Utils.buildWxRequestConfig(options, { 333 | url: URL_GET_GEOCODER, 334 | data: requestParam 335 | })); 336 | }; 337 | Utils.locationProcess(options, locationsuccess); 338 | } 339 | 340 | /** 341 | * 地址解析 342 | * 343 | * @param {Object} options 接口参数对象 344 | * 345 | * 请求参数结构可以参考 346 | * http://lbs.qq.com/webservice_v1/guide-geocoder.html 347 | */ 348 | geocoder(options) { 349 | var that = this; 350 | options = options || {}; 351 | Utils.polyfillParam(options); 352 | 353 | if (Utils.checkParamKeyEmpty(options, 'address')) { 354 | return; 355 | } 356 | 357 | var requestParam = { 358 | address: options.address, 359 | output: 'json', 360 | key: that.key 361 | }; 362 | 363 | wx.request(Utils.buildWxRequestConfig(options, { 364 | url: URL_GET_GEOCODER, 365 | data: requestParam 366 | })); 367 | } 368 | 369 | 370 | /** 371 | * 获取城市列表 372 | * 373 | * @param {Object} options 接口参数对象 374 | * 375 | * 请求参数结构可以参考 376 | * http://lbs.qq.com/webservice_v1/guide-region.html 377 | */ 378 | getCityList(options) { 379 | var that = this; 380 | options = options || {}; 381 | Utils.polyfillParam(options); 382 | var requestParam = { 383 | output: 'json', 384 | key: that.key 385 | }; 386 | 387 | wx.request(Utils.buildWxRequestConfig(options, { 388 | url: URL_CITY_LIST, 389 | data: requestParam 390 | })); 391 | } 392 | 393 | /** 394 | * 获取对应城市ID的区县列表 395 | * 396 | * @param {Object} options 接口参数对象 397 | * 398 | * 请求参数结构可以参考 399 | * http://lbs.qq.com/webservice_v1/guide-region.html 400 | */ 401 | getDistrictByCityId(options) { 402 | var that = this; 403 | options = options || {}; 404 | Utils.polyfillParam(options); 405 | 406 | if (Utils.checkParamKeyEmpty(options, 'id')) { 407 | return; 408 | } 409 | 410 | var requestParam = { 411 | id: options.id || '', 412 | output: 'json', 413 | key: that.key 414 | }; 415 | 416 | wx.request(Utils.buildWxRequestConfig(options, { 417 | url: URL_AREA_LIST, 418 | data: requestParam 419 | })); 420 | } 421 | 422 | /** 423 | * 用于单起点到多终点的路线距离(非直线距离)计算: 424 | * 支持两种距离计算方式:步行和驾车。 425 | * 起点到终点最大限制直线距离10公里。 426 | * 427 | * @param {Object} options 接口参数对象 428 | * 429 | * 请求参数结构可以参考 430 | * http://lbs.qq.com/webservice_v1/guide-distance.html 431 | */ 432 | calculateDistance(options) { 433 | var that = this; 434 | options = options || {}; 435 | Utils.polyfillParam(options); 436 | 437 | if (Utils.checkParamKeyEmpty(options, 'to')) { 438 | return; 439 | } 440 | 441 | var requestParam = { 442 | mode: options.mode || 'walking', 443 | to: Utils.location2query(options.to), 444 | output: 'json', 445 | key: that.key 446 | }; 447 | 448 | var locationsuccess = function (result) { 449 | requestParam.from = result.latitude + ',' + result.longitude; 450 | wx.request(Utils.buildWxRequestConfig(options, { 451 | url: URL_DISTANCE, 452 | data: requestParam 453 | })); 454 | } 455 | if (options.from) { 456 | options.location = options.from; 457 | } 458 | 459 | Utils.locationProcess(options, locationsuccess); 460 | } 461 | } 462 | 463 | module.exports = QQMapWX; -------------------------------------------------------------------------------- /util/util.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:verdor 5 | 文件功能描述:util.js 6 | 7 | ----------------------------------------------------------------*/ 8 | var app = getApp(); 9 | var qcloud = require('./vendor/qcloud-weapp-client-sdk/index'); 10 | var config = require('../config'); 11 | function currentTime() { 12 | var timestamp = Date.parse(new Date()); 13 | timestamp = timestamp / 1000; 14 | 15 | //获取当前时间 16 | var n = timestamp * 1000; 17 | var date = new Date(n); 18 | //年 19 | var Y = date.getFullYear(); 20 | //月 21 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1); 22 | //日 23 | var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(); 24 | //时 25 | var h = date.getHours(); 26 | //分 27 | var m = date.getMinutes(); 28 | //秒 29 | var s = date.getSeconds(); 30 | 31 | return h + ":" + m 32 | } 33 | 34 | function currentDate() { 35 | var timestamp = Date.parse(new Date()); 36 | timestamp = timestamp / 1000; 37 | 38 | //获取当前时间 39 | var n = timestamp * 1000; 40 | var date = new Date(n); 41 | //年 42 | var Y = date.getFullYear(); 43 | //月 44 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1); 45 | //日 46 | var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate(); 47 | //时 48 | var h = date.getHours(); 49 | //分 50 | var m = date.getMinutes(); 51 | //秒 52 | var s = date.getSeconds(); 53 | 54 | return Y + "-" + M+ "-" + D 55 | } 56 | 57 | Array.prototype.find = function (func) { 58 | var temp = []; 59 | for (var i = 0; i < this.length; i++) { 60 | if (func(this[i])) { 61 | temp[temp.length] = this[i]; 62 | } 63 | } 64 | return temp; 65 | } 66 | 67 | function arrfind(arr, item) { 68 | var temp = [] 69 | for (var i = 0; i < arr.length; i++) { 70 | if (arr[i].id == item) 71 | return arr[i] 72 | } 73 | } 74 | 75 | var getThisOrder = (menus) => { 76 | var returnmenus = [] 77 | if (menus != null && menus.length > 0) { 78 | for (var i = 0; i < menus.length; i++) { 79 | var havemenu = false 80 | var amenu = menus[i] 81 | if (amenu != null && amenu.dishs != null && amenu.dishs != undefined && amenu.dishs.length > 0) { 82 | for (var j = 0; j < amenu.dishs.length; j++) { 83 | var adish = menus[i].dishs[j] 84 | if (adish.count > 0) { 85 | var tdish = new Object 86 | tdish.id = adish.id 87 | tdish.caiming = adish.caiming 88 | tdish.xiaoshoujia = adish.xiaoshoujia 89 | tdish.huiyuanjia = adish.huiyuanjia 90 | tdish.count = adish.count 91 | tdish.fendianid = adish.fendianid 92 | tdish.fendianmingcheng = adish.fendianmingcheng 93 | returnmenus.push(tdish) 94 | } 95 | } 96 | } 97 | } 98 | } 99 | return returnmenus 100 | }; 101 | 102 | //必点菜 103 | var judgeBidiancai = (menus) => { 104 | var ret = '' 105 | if (menus != null && menus.length > 0) { 106 | for (var i = 0; i < menus.length; i++) { 107 | var havemenu = false 108 | var amenu = menus[i] 109 | if (amenu != null && amenu.dishs != null && amenu.dishs != undefined && amenu.dishs.length > 0) { 110 | for (var j = 0; j < amenu.dishs.length; j++) { 111 | var adish = menus[i].dishs[j] 112 | if (adish.count > 0 && adish.count < adish.zuixiaoshuliang) { 113 | ret += adish.caiming + ' 起订量:' + adish.zuixiaoshuliang + adish.danwei 114 | } 115 | } 116 | } 117 | } 118 | } 119 | return ret 120 | }; 121 | 122 | //是否点酒水或饮料 123 | var judgeJiushuiyingliao = (menus) => { 124 | var ret = '' 125 | if (menus != null && menus.length > 0) { 126 | for (var i = 0; i < menus.length; i++) { 127 | var havemenu = false 128 | var amenu = menus[i] 129 | if (amenu != null && amenu.dishs != null && amenu.dishs != undefined && amenu.dishs.length > 0) { 130 | for (var j = 0; j < amenu.dishs.length; j++) { 131 | var adish = menus[i].dishs[j] 132 | if (adish.count > 0) { 133 | if (adish.fenleimingcheng.indexOf('酒水') > -1 || adish.fenleimingcheng.indexOf('饮料') > -1 134 | || adish.fenleimingcheng.indexOf('红酒') > -1 || adish.fenleimingcheng.indexOf('啤酒') > -1 135 | || adish.fenleimingcheng.indexOf('黄酒') > -1 || adish.fenleimingcheng.indexOf('白酒') > -1 136 | || adish.fenleimingcheng.indexOf('鲜榨') > -1 || adish.fenleimingcheng.indexOf('饮品') > -1) { 137 | ret += adish.caiming 138 | } 139 | } 140 | } 141 | } 142 | } 143 | } 144 | return ret 145 | }; 146 | //按人数配置商品数量 如餐具 米饭 147 | var ziDongTianJiaShangPin = (menus, renshu, leixing) => { 148 | var ret = new Object 149 | ret.count = 0 150 | ret.cash = 0.00 151 | renshu = parseFloat(renshu) 152 | if (menus != null && menus.length > 0) { 153 | for (var i = 0; i < menus.length; i++) { 154 | var amenu = menus[i] 155 | if (amenu != null && amenu.dishs != null && amenu.dishs != undefined && amenu.dishs.length > 0) { 156 | for (var j = 0; j < amenu.dishs.length; j++) { 157 | var adish = menus[i].dishs[j] 158 | if (adish.goumaileixing == leixing) { 159 | menus[i].url += (renshu - menus[i].dishs[j].count) 160 | ret.count += (renshu - menus[i].dishs[j].count) 161 | ret.cash += (renshu - menus[i].dishs[j].count) * menus[i].dishs[j].huiyuanjia 162 | menus[i].dishs[j].count = renshu 163 | } 164 | } 165 | } 166 | } 167 | } 168 | ret.menu = menus 169 | return ret 170 | }; 171 | 172 | var resetMenu = (menus) => { 173 | if (menus != null && menus.length > 0) { 174 | for (var i = 0; i < menus.length; i++) { 175 | menus[i].url = 0 176 | var amenu = menus[i] 177 | if (amenu != null && amenu.dishs != null && amenu.dishs != undefined && amenu.dishs.length > 0) { 178 | for (var j = 0; j < menus[i].dishs.length; j++) { 179 | menus[i].dishs[j].count = 0 180 | } 181 | } 182 | } 183 | } 184 | return menus 185 | }; 186 | // 显示繁忙提示 187 | var showBusy = text => wx.showToast({ 188 | title: text, 189 | icon: '处理中。。。', 190 | duration: 10000 191 | }); 192 | var hideBusy = function () { 193 | wx.hideToast(); 194 | }; 195 | // 显示成功提示 196 | var showSuccess = text => { 197 | wx.hideToast(); 198 | wx.showToast({ 199 | title: text, 200 | icon: 'success' 201 | }); 202 | }; 203 | // 显示失败提示 204 | var showFailModal = (title, content) => { 205 | wx.hideToast(); 206 | wx.showModal({ 207 | title, 208 | content: JSON.stringify(content), 209 | showCancel: false 210 | }); 211 | }; 212 | var navigateBack1 = function () { 213 | wx.navigateBack({ 214 | delta: 1, // 回退前 delta(默认为1) 页面 215 | success: function (res) { 216 | 217 | }, 218 | fail: function () { 219 | // fail 220 | }, 221 | complete: function () { 222 | // complete 223 | } 224 | }) 225 | }; 226 | module.exports = { 227 | currentDate: currentDate, 228 | currentTime: currentTime, 229 | arrfind: arrfind, 230 | showBusy: showBusy, 231 | hideBusy: hideBusy, 232 | showSuccess: showSuccess, 233 | showFailModal: showFailModal, 234 | getThisOrder: getThisOrder, 235 | judgeBidiancai: judgeBidiancai, 236 | judgeJiushuiyingliao: judgeJiushuiyingliao, 237 | resetMenu: resetMenu, 238 | navigateBack1: navigateBack1, 239 | ziDongTianJiaShangPin: ziDongTianJiaShangPin 240 | } -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "qcloud-weapp-client-sdk", 3 | "description": "QCloud 微信小程序客户端 SDK", 4 | "main": "index.js", 5 | "authors": [ 6 | "Tencent Cloud" 7 | ], 8 | "license": "MIT", 9 | "keywords": [ 10 | "qcloud", 11 | "weapp", 12 | "wechat", 13 | "sdk", 14 | "client", 15 | "auth", 16 | "websocket" 17 | ], 18 | "homepage": "https://github.com/tencentyun/weapp-client-sdk", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "tests", 25 | "typings.json", 26 | "jsconfig.json", 27 | "package.json", 28 | ".npmignore", 29 | ".travis.yml", 30 | ".gitignore" 31 | ], 32 | "version": "0.8.2", 33 | "_release": "0.8.2", 34 | "_resolution": { 35 | "type": "version", 36 | "tag": "v0.8.2", 37 | "commit": "0944545afe0b6bc4aec8c39e8437dbe95a07a8d9" 38 | }, 39 | "_source": "https://github.com/tencentyun/weapp-client-sdk.git", 40 | "_target": "*", 41 | "_originalSource": "qcloud-weapp-client-sdk" 42 | } -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/index.js: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------- 2 | Copyright (C) 2019 筱程 wechatscan.com 3 | 4 | 文件名:diancan/index 5 | 文件功能描述:lib/index.js 6 | 7 | ----------------------------------------------------------------*/ 8 | var constants = require('./lib/constants'); 9 | var login = require('./lib/login'); 10 | var Session = require('./lib/session'); 11 | var request = require('./lib/request'); 12 | 13 | var exports = module.exports = { 14 | login: login.login, 15 | setLoginUrl: login.setLoginUrl, 16 | LoginError: login.LoginError, 17 | 18 | clearSession: Session.clear, 19 | 20 | request: request.request, 21 | setRequestUrl: request.setRequestUrl, 22 | RequestError: request.RequestError, 23 | setRequestData: request.setRequestData 24 | }; 25 | 26 | // 导出错误类型码 27 | Object.keys(constants).forEach(function (key) { 28 | if (key.indexOf('ERR_') === 0) { 29 | exports[key] = constants[key]; 30 | } 31 | }); -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/lib/constants.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | WX_HEADER_CODE: 'X-WX-Code', 3 | WX_HEADER_ENCRYPTED_DATA: 'X-WX-Encrypted-Data', 4 | WX_HEADER_IV: 'X-WX-IV', 5 | WX_HEADER_ID: 'X-WX-Id', 6 | WX_HEADER_SKEY: 'X-WX-Skey', 7 | 8 | WX_SESSION_MAGIC_ID: 'F2C224D4-2BCE-4C64-AF9F-A6D872000D1A', 9 | 10 | ERR_INVALID_PARAMS: 'ERR_INVALID_PARAMS', 11 | 12 | ERR_WX_LOGIN_FAILED: 'ERR_WX_LOGIN_FAILED', 13 | ERR_WX_GET_USER_INFO: 'ERR_WX_GET_USER_INFO', 14 | ERR_LOGIN_TIMEOUT: 'ERR_LOGIN_TIMEOUT', 15 | ERR_LOGIN_FAILED: 'ERR_LOGIN_FAILED', 16 | ERR_LOGIN_SESSION_NOT_RECEIVED: 'ERR_LOGIN_MISSING_SESSION', 17 | 18 | ERR_INVALID_SESSION: 'ERR_INVALID_SESSION', 19 | ERR_CHECK_LOGIN_FAILED: 'ERR_CHECK_LOGIN_FAILED', 20 | }; -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/lib/login.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils'); 2 | var constants = require('./constants'); 3 | var Session = require('./session'); 4 | 5 | /*** 6 | * @class 7 | * 表示登录过程中发生的异常 8 | */ 9 | var LoginError = (function () { 10 | function LoginError(type, message) { 11 | Error.call(this, message); 12 | this.type = type; 13 | this.message = message; 14 | } 15 | 16 | LoginError.prototype = new Error(); 17 | LoginError.prototype.constructor = LoginError; 18 | 19 | return LoginError; 20 | })(); 21 | 22 | /** 23 | * 微信登录,获取 code 和 encryptedData 24 | */ 25 | var getWxLoginResult = function getLoginCode(callback) { 26 | wx.login({ 27 | success: function (loginResult) { 28 | wx.getUserInfo({ 29 | success: function (userResult) { 30 | callback(null, { 31 | code: loginResult.code, 32 | encryptedData: userResult.encryptedData, 33 | iv: userResult.iv, 34 | userInfo: userResult.userInfo, 35 | }); 36 | }, 37 | 38 | fail: function (userError) { 39 | var error = new LoginError(constants.ERR_WX_GET_USER_INFO, '获取微信用户信息失败。'); 40 | error.detail = userError; 41 | //重新登陆 42 | wx.getUserInfo({ 43 | success: function (userResult) { 44 | callback(null, { 45 | code: loginResult.code, 46 | encryptedData: userResult.encryptedData, 47 | iv: userResult.iv, 48 | userInfo: userResult.userInfo, 49 | }); 50 | }, 51 | fail: function () { callback(error, null); } 52 | }); 53 | }, 54 | }); 55 | }, 56 | 57 | fail: function (loginError) { 58 | var error = new LoginError(constants.ERR_WX_LOGIN_FAILED, '微信登录失败,请检查网络状态'); 59 | error.detail = loginError; 60 | callback(error, null); 61 | }, 62 | }); 63 | }; 64 | 65 | var noop = function noop() { }; 66 | var defaultOptions = { 67 | method: 'GET', 68 | success: noop, 69 | fail: noop, 70 | //loginUrl: null, 71 | data: { 72 | x: 'xxxx', 73 | y: 'yyyy' 74 | }, 75 | }; 76 | 77 | /** 78 | * @method 79 | * 进行服务器登录,以获得登录会话 80 | * 81 | * @param {Object} options 登录配置 82 | * @param {string} options.loginUrl 登录使用的 URL,服务器应该在这个 URL 上处理登录请求 83 | * @param {string} [options.method] 请求使用的 HTTP 方法,默认为 "GET" 84 | * @param {Function} options.success(userInfo) 登录成功后的回调函数,参数 userInfo 微信用户信息 85 | * @param {Function} options.fail(error) 登录失败后的回调函数,参数 error 错误信息 86 | */ 87 | var login = function login(options) { 88 | options = utils.extend({}, defaultOptions, options); 89 | 90 | var doLogin = () => getWxLoginResult(function (wxLoginError, wxLoginResult) { 91 | if (wxLoginError) { 92 | options.fail(wxLoginError); 93 | return; 94 | } 95 | var userInfo = wxLoginResult.userInfo; 96 | 97 | userInfo.requestcode = wxLoginResult.code; 98 | options.success(userInfo); 99 | }); 100 | doLogin(); 101 | }; 102 | 103 | var setLoginUrl = function (loginUrl) { 104 | defaultOptions.loginUrl = loginUrl; 105 | }; 106 | 107 | module.exports = { 108 | LoginError: LoginError, 109 | login: login, 110 | setLoginUrl: setLoginUrl, 111 | }; -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/lib/request.js: -------------------------------------------------------------------------------- 1 | var constants = require('./constants'); 2 | var utils = require('./utils'); 3 | var Session = require('./session'); 4 | var loginLib = require('./login'); 5 | 6 | var noop = function noop() { }; 7 | 8 | var buildAuthHeader = function buildAuthHeader(session) { 9 | var header = {}; 10 | 11 | if (session && session.id && session.skey) { 12 | header[constants.WX_HEADER_ID] = session.id; 13 | header[constants.WX_HEADER_SKEY] = session.skey; 14 | } 15 | return header; 16 | }; 17 | 18 | /*** 19 | * @class 20 | * 表示请求过程中发生的异常 21 | */ 22 | var RequestError = (function () { 23 | function RequestError(type, message) { 24 | Error.call(this, message); 25 | this.type = type; 26 | this.message = message; 27 | } 28 | 29 | RequestError.prototype = new Error(); 30 | RequestError.prototype.constructor = RequestError; 31 | 32 | return RequestError; 33 | })(); 34 | 35 | var defaultOptions = { 36 | method: 'POST', 37 | header: { 38 | "content-type": "application/x-www-form-urlencoded" 39 | }, 40 | success: noop, 41 | fail: noop, 42 | url: null, 43 | }; 44 | function request(options) { 45 | options = utils.extend({}, defaultOptions, options); 46 | if (typeof options !== 'object') { 47 | var message = '请求传参应为 object 类型,但实际传了 ' + (typeof options) + ' 类型'; 48 | throw new RequestError(constants.ERR_INVALID_PARAMS, message); 49 | } 50 | //options.url = defaultOptions.url; 51 | //options.data = defaultOptions.data; 52 | console.log('options.url:' + options.url); 53 | var requireLogin = options.login; 54 | var success = options.success || noop; 55 | var fail = options.fail || noop; 56 | var complete = options.complete || noop; 57 | var originHeader = options.header || {}; 58 | 59 | // 成功回调 60 | var callSuccess = function () { 61 | success.apply(null, arguments); 62 | complete.apply(null, arguments); 63 | }; 64 | 65 | // 失败回调 66 | var callFail = function (error) { 67 | fail.call(null, error); 68 | complete.call(null, error); 69 | }; 70 | // 是否已经进行过重试 71 | var hasRetried = false; 72 | 73 | if (requireLogin) { 74 | doRequestWithLogin(); 75 | } else { 76 | doRequest(); 77 | } 78 | 79 | // 登录后再请求 80 | function doRequestWithLogin() { 81 | loginLib.login({ success: doRequest, fail: callFail }); 82 | } 83 | 84 | // 实际进行请求的方法 85 | function doRequest() { 86 | var authHeader = buildAuthHeader(Session.get()); 87 | wx.request(utils.extend({}, options, { 88 | header: utils.extend({}, originHeader, authHeader), 89 | success: function (response) { 90 | var data = response.data; 91 | callSuccess.apply(null, arguments); 92 | }, 93 | fail: callFail, 94 | complete: noop, 95 | })); 96 | }; 97 | }; 98 | 99 | var setRequestUrl = function (requestUrl) { 100 | defaultOptions.url = requestUrl; 101 | }; 102 | var setRequestData = function (data) { 103 | defaultOptions.data = data; 104 | }; 105 | 106 | module.exports = { 107 | RequestError: RequestError, 108 | request: request, 109 | setRequestUrl: setRequestUrl, 110 | setRequestData: setRequestData, 111 | }; -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/lib/session.js: -------------------------------------------------------------------------------- 1 | var constants = require('./constants'); 2 | var SESSION_KEY = 'weapp_session_' + constants.WX_SESSION_MAGIC_ID; 3 | 4 | var Session = { 5 | get: function () { 6 | return wx.getStorageSync(SESSION_KEY) || null; 7 | }, 8 | 9 | set: function (session) { 10 | wx.setStorageSync(SESSION_KEY, session); 11 | }, 12 | 13 | clear: function () { 14 | wx.removeStorageSync(SESSION_KEY); 15 | }, 16 | }; 17 | 18 | module.exports = Session; -------------------------------------------------------------------------------- /util/vendor/qcloud-weapp-client-sdk/lib/utils.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 拓展对象 4 | */ 5 | exports.extend = function extend(target) { 6 | var sources = Array.prototype.slice.call(arguments, 1); 7 | 8 | for (var i = 0; i < sources.length; i += 1) { 9 | var source = sources[i]; 10 | for (var key in source) { 11 | if (source.hasOwnProperty(key)) { 12 | target[key] = source[key]; 13 | } 14 | } 15 | } 16 | return target; 17 | }; --------------------------------------------------------------------------------