Repository: congwa/orderSystem Branch: master Commit: 23cf3305f7c1 Files: 125 Total size: 1.2 MB Directory structure: gitextract_jxxs9e2u/ ├── README.md └── client/ ├── app.js ├── app.json ├── app.wxss ├── pages/ │ ├── appointment/ │ │ ├── appointment.js │ │ ├── appointment.json │ │ ├── appointment.wxml │ │ └── appointment.wxss │ ├── az/ │ │ ├── az.js │ │ ├── az.json │ │ ├── az.wxml │ │ └── az.wxss │ ├── component/ │ │ ├── all_food.wxml │ │ ├── coupon.wxml │ │ ├── date-select/ │ │ │ ├── date-select.js │ │ │ ├── date-select.json │ │ │ ├── date-select.wxml │ │ │ └── date-select.wxss │ │ ├── index_list.wxml │ │ ├── key_component/ │ │ │ ├── component.js │ │ │ ├── component.json │ │ │ ├── component.wxml │ │ │ └── component.wxss │ │ ├── multiple-rate/ │ │ │ ├── multiple-rate.js │ │ │ ├── multiple-rate.json │ │ │ ├── multiple-rate.wxml │ │ │ └── multiple-rate.wxss │ │ ├── nearby.wxml │ │ ├── pocket.js │ │ ├── pocket.json │ │ ├── pocket.wxml │ │ ├── pocket.wxss │ │ └── soft_list.wxml │ ├── coupon/ │ │ ├── coupon.js │ │ ├── coupon.json │ │ ├── coupon.wxml │ │ └── coupon.wxss │ ├── droppassword/ │ │ ├── droppassword.js │ │ ├── droppassword.json │ │ ├── droppassword.wxml │ │ └── droppassword.wxss │ ├── indent/ │ │ ├── indent.js │ │ ├── indent.json │ │ ├── indent.wxml │ │ └── indent.wxss │ ├── index/ │ │ ├── index.js │ │ ├── index.json │ │ ├── index.wxml │ │ ├── index.wxss │ │ └── type.js │ ├── mycenter/ │ │ ├── mycenter.js │ │ ├── mycenter.json │ │ ├── mycenter.wxml │ │ └── mycenter.wxss │ ├── mytalk/ │ │ ├── mytalk.js │ │ ├── mytalk.json │ │ ├── mytalk.wxml │ │ └── mytalk.wxss │ ├── order/ │ │ ├── order.js │ │ ├── order.json │ │ ├── order.wxml │ │ ├── order.wxss │ │ └── type.js │ ├── pay_input/ │ │ ├── pay_input.js │ │ ├── pay_input.json │ │ ├── pay_input.wxml │ │ └── pay_input.wxss │ ├── pay_success/ │ │ ├── pay_success.js │ │ ├── pay_success.json │ │ ├── pay_success.wxml │ │ └── pay_success.wxss │ ├── pocket/ │ │ ├── pocket.js │ │ ├── pocket.json │ │ ├── pocket.wxml │ │ └── pocket.wxss │ ├── points/ │ │ ├── points.js │ │ ├── points.json │ │ ├── points.wxml │ │ └── points.wxss │ ├── review/ │ │ ├── index.wxss │ │ ├── review.js │ │ ├── review.json │ │ ├── review.wxml │ │ └── review.wxss │ ├── reviewfdetails/ │ │ ├── reviewfdetails.js │ │ ├── reviewfdetails.json │ │ ├── reviewfdetails.wxml │ │ └── reviewfdetails.wxss │ ├── reviewlist/ │ │ ├── reviewlist.js │ │ ├── reviewlist.json │ │ ├── reviewlist.wxml │ │ └── reviewlist.wxss │ ├── shop/ │ │ ├── shop.js │ │ ├── shop.json │ │ ├── shop.wxml │ │ └── shop.wxss │ ├── shop_list/ │ │ ├── shop_list.js │ │ ├── shop_list.json │ │ ├── shop_list.wxml │ │ ├── shop_list.wxss │ │ └── type.js │ ├── switchcity/ │ │ ├── switchcity.js │ │ ├── switchcity.json │ │ ├── switchcity.wxml │ │ └── switchcity.wxss │ ├── talk/ │ │ ├── talk.js │ │ ├── talk.json │ │ ├── talk.wxml │ │ └── talk.wxss │ └── topay/ │ ├── topay.js │ ├── topay.json │ ├── topay.wxml │ └── topay.wxss ├── project.config.json ├── style/ │ └── weui.wxss ├── utils/ │ ├── area.js │ ├── area2.js │ ├── bmap-wx.js │ ├── city.js │ ├── httpClient.js │ ├── payment.js │ ├── qqmap-wx-jssdk.js │ ├── urlModel.js │ └── util.js └── weui.wxss ================================================ FILE CONTENTS ================================================ ================================================ FILE: README.md ================================================ # orderSystem 微信小程序-仿照美团、大众点评做的一个点餐的小程序,内容包含登录、页面跳转、楼梯效果、点餐动画、订桌、订餐、城市定位与天气定位(使用baiduapi)、微信支付,评论等功能 ### 项目结构 "pages/az/az", ---------- 登录页(小程序登录自己服务器) "pages/index/index",------- 首页 "pages/mycenter/mycenter",- 个人中心 "pages/indent/indent",----- 订单 "pages/order/order",------- 点餐 "pages/appointment/appointment",-订餐 "pages/shop/shop", ------- 商铺 "pages/shop_list/shop_list",-- 商铺详情 "pages/topay/topay", --------点餐支付 "pages/pay_input/pay_input",--面对面付款 "pages/pay_success/pay_success",-支付成功 "pages/points/points", ---------- "pages/coupon/coupon", ---------优惠券(小程序中有微信自己的卡券,建议用那个) "pages/pocket/pocket",---------- "pages/reviewlist/reviewlist",-- "pages/reviewfdetails/reviewfdetails", "pages/review/review",----------评论(使用组件) "pages/component/key_component/component",-6格密码输入组件 "pages/switchcity/switchcity",-------------城市选择器 "pages/mytalk/mytalk", --------------------评论 "pages/droppassword/droppassword"----------修改密码 ================================================ FILE: client/app.js ================================================ //app.js import {URL} from './utils/urlModel.js'; /** * 用户所用到的 */ var scope = { userInfo:false, userLocation:false, address: false, writePhotosAlbum:false, camera:false } App({ onLaunch: function () { var _this = this; wx.getSystemInfo({ success: function (res) { console.log('手机信息', res); _this.globalData.systemInfo = res; var systemInfo = res; var windowHeight = (systemInfo.windowHeight * (750 / systemInfo.windowWidth)); //将高度乘以换算后的该设备的rpx与px的 _this.globalData.windowHeight = windowHeight; } }); }, bezier: function (pots, amount) { var pot; var lines; var ret = []; var points; for (var i = 0; i <= amount; i++) { points = pots.slice(0); lines = []; while (pot = points.shift()) { if (points.length) { lines.push(pointLine([pot, points[0]], i / amount)); } else if (lines.length > 1) { points = lines; lines = []; } else { break; } } ret.push(lines[0]); } function pointLine(points, rate) { var pointA, pointB, pointDistance, xDistance, yDistance, tan, radian, tmpPointDistance; var ret = []; pointA = points[0];//点击 pointB = points[1];//中间 xDistance = pointB.x - pointA.x; yDistance = pointB.y - pointA.y; pointDistance = Math.pow(Math.pow(xDistance, 2) + Math.pow(yDistance, 2), 1 / 2); tan = yDistance / xDistance; radian = Math.atan(tan); tmpPointDistance = pointDistance * rate; ret = { x: pointA.x + tmpPointDistance * Math.cos(radian), y: pointA.y + tmpPointDistance * Math.sin(radian) }; return ret; } return { 'bezier_points': ret }; }, /** * 全局变量数据 */ globalData: { userInfo: null, // userInfo微信的 token:null, //登录后的token值 systemInfo:null, //用户当前手机信息 area:null, //本程序支持的所有区域的信息详情 windowHeight:900 }, /** * 当前选择的城市信息 */ citySelect:{ provriceId:110000, //省 cityId:110100, //市 districtId:110101 //区 }, /** * 今天第一次打开项目吗?(第一次打开项目) */ oneDayOneLogin:true, /** *当前选择的店铺ID */ currentShopId:null, near :{ "id": -1, "name": "附近", "fullname": "附近", "py": "", "spy": "", "lat": "25.04347", "lng": "102.70737", "parent": '', "base":'', "municipality": "2" }, /** * 桌号信息 */ number:{ cid:'', //店铺id number:''//桌号 }, appid:'wxa9b73f826b3fb0c4' // issigned:true//首页判断是否已签到 }) ================================================ FILE: client/app.json ================================================ { "pages": [ "pages/az/az", "pages/index/index", "pages/mycenter/mycenter", "pages/indent/indent", "pages/order/order", "pages/appointment/appointment", "pages/shop/shop", "pages/shop_list/shop_list", "pages/topay/topay", "pages/pay_input/pay_input", "pages/pay_success/pay_success", "pages/points/points", "pages/coupon/coupon", "pages/pocket/pocket", "pages/reviewlist/reviewlist", "pages/reviewfdetails/reviewfdetails", "pages/review/review", "pages/component/key_component/component", "pages/switchcity/switchcity", "pages/mytalk/mytalk", "pages/droppassword/droppassword" ], "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "小橘点餐", "navigationBarTextStyle": "black" }, "tabBar": { "backgroundColor": "#fff", "color": "#888888", "selectedColor": "#ff6b12", "borderStyle": "#b7b7b7", "list": [ { "selectedIconPath": "pages/images/6shop_65.png", "iconPath": "pages/images/6shop_61.png", "pagePath": "pages/index/index", "text": "首页" }, { "selectedIconPath": "pages/images/order_15.png", "iconPath": "pages/images/order_14.png", "pagePath": "pages/indent/indent", "text": "订单" }, { "selectedIconPath": "pages/images/my_04.png", "iconPath": "pages/images/my_03.png", "pagePath": "pages/mycenter/mycenter", "text": "我的" } ] } } ================================================ FILE: client/app.wxss ================================================ /**app.wxss**/ @import 'style/weui.wxss'; .container { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; box-sizing: border-box; } ================================================ FILE: client/pages/appointment/appointment.js ================================================ // pages/appointment/appointment.js var app = getApp(); import { Http } from '../../utils/httpClient'; var httpClient = new Http(); import { timestampToTime } from '../../utils/util.js'; const date = new Date(); const nowYear = date.getFullYear(); const nowMonth = date.getMonth() + 1; const nowDay = date.getDate(); const nowHour = date.getHours(); const nowMinute = date.getMinutes(); var date2 = new Date(date); date2.setDate(date.getDate() + 30); var endDate = date2.getTime(); console.log('end', endDate); var a = timestampToTime(date.getTime() + 1000 * 60 * 30).split(' ') console.log('time', a); console.log('endTime', timestampToTime(endDate).split(' ')); //let daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] // 根据年月 获取当月的总天数 // let getDays = function (year, month) { // if (month === 2) { // return ((year % 4 === 0) && ((year % 100) !== 0)) || (year % 400 === 0) ? 29 : 28 // } else { // return daysInMonth[month - 1] // } // } // 根据年月日设置当前月有多少天 并更新年月日数组 // let setDate = function (month, day, hour, minute, _th) { // // let daysNum = nowYear === nowYear && month === nowMonth ? nowDay : getDays(nowYear, month) // let daysNum = getDays(nowYear, month); // day = day > daysNum ? 1 : day // //let monthsNum = nowYear === nowYear ? nowMonth : 12 // let monthsNum = 12; // let hourNum = 24 // let minuteNum = 60 // // let years = [] // let months = [] // let days = [] // let hours = [] // let minutes = [] // // let yearIdx = 9999 // let monthIdx = 0 // let dayIdx = 0 // let hourIdx = 0 // let minuteIdx = 0 // // 重新设置年份列表 // // for (let i = nowYear; i <= nowYear + 20; i++) { // // years.push(i) // // } // // years.map((v, idx) => { // // if (v === year) { // // yearIdx = idx // // } // // }) // // 重新设置月份列表 // for (let i = nowMonth; i <= monthsNum; i++) { // months.push(i) // } // months.map((v, idx) => { // if (v === month) { // monthIdx = idx // } // }) // // 重新设置日期列表 // for (let i = nowDay; i <= daysNum; i++) { // days.push(i) // } // days.map((v, idx) => { // if (v === day) { // dayIdx = idx // } // }) // //重新设置小时列表 // for (let i = nowHour; i <= hourNum; i++) { // hours.push(i) // } // hours.map((v, idx) => { // if (v === hour) { // hourIdx = idx // } // }) // //重新设置分钟列表 // for (let i = nowMinute; i <= minuteNum; i++) { // minutes.push(i) // } // minutes.map((v, idx) => { // if (v === minute) { // minuteIdx = idx // } // }) // _th.setData({ // //years: years,//年份列表 // months: months,//月份列表 // days: days,//日期列表 // hours: hours, // minutes: minutes, // value: [monthIdx, dayIdx, hourIdx, minuteIdx], // // year: year, // month: month, // day: day, // hour: hour, // minute: minute // }) // } Page({ /** * 组件的初始数据 */ data: { /***********时间选择器需要变量*********/ /** * 时间选择器需要变量 */ // years: [], // year: date.getFullYear(), // canOrder: '',//可以跳转吗 // isloop: '',//循环过吗 // months: [], // month: nowMonth, // days: [], // day: nowDay, // hours: [], // hour: nowHour, // minutes: [], // minute: nowMinute, // value: [nowMonth, nowDay, nowHour, nowMinute], // dateSelectHidden: false, // showbak: false, /** * 旧的日期 */ // oldDate: { // // year: nowYear, // month: nowMonth, // day: nowDay, // hour: nowHour, // minute: nowMinute // }, nowYear: date.getFullYear(), nowMonth: date.getMonth() + 1, nowDay: date.getDate(), nowHour: date.getHours(), nowMinute: date.getMinutes(), //当前时间向后推迟半个小时的算法 date: timestampToTime(date.getTime() + 1000 * 60 * 30).split(' ')[0], time: timestampToTime(date.getTime() + 1000 * 60 * 30).split(' ')[1], endDate: timestampToTime(endDate).split(' ')[0], endTime: timestampToTime(endDate).split(' ')[1], /** * 用餐时间 */ mealTime: '', /** * 用餐人数 */ mealNumber: '', /** * 用餐人姓名 */ mealSurname: '', /** * 性别选择 */ mealSex: '', /** * 电话号码 */ mealIphone: '', /** * 备注 */ mealDesc: '', }, /** * 更新时间 * 总是获取最新的时间,总是推迟到30天后的时间 */ upDateDate() { const date = new Date(); const nowYear = date.getFullYear(); const nowMonth = date.getMonth() + 1; const nowDay = date.getDate(); const nowHour = date.getHours(); const nowMinute = date.getMinutes(); var date2 = new Date(date); date2.setDate(date.getDate() + 30); var endDate = date2.getTime(); this.setData({ date:timestampToTime(date.getTime() + 1000 * 60 * 30).split(' ')[0], time: timestampToTime(date.getTime() + 1000 * 60 * 30).split(' ')[1], endTime:timestampToTime(endDate).split(' ')[1], endDate:timestampToTime(endDate).split(' ')[0] }) }, toOrder() { wx.navigateTo({ url: "../order/order" }) }, /** * 时间日期改变回调 */ bindChange: function (e) { var self = this; const val = e.detail.value //setDate(this.data.months[val[0]], this.data.days[val[1]], this.data.hours[val[2]], this.data.minutes[val[3]], this) }, onLoad: function () { //setDate(this.data.month, this.data.day, this.data.hour, this.data.minute, this) this.upDateDate(); }, /** * 日期选择器显示 * @param e */ // showMaskDateSelect: function (e) { // this.setData({ // dateSelectHidden: true, // showbak: true // }) // for (var i in this.data.oldDate) { // this.data.oldDate[i] = this.data[i]; // } // }, /** * 日期选择器取消按钮 * @param e */ // cancleMaskDateSelect: function (e) { // this.setData({ // dateSelectHidden: false, // showbak: false // }) // for (let i in this.data.oldDate) { // this.data[i] = this.data.oldDate[i]; // } // }, /** * 日期选择器确定按钮 */ // enterMaskDateSelect: function (e) { // var time = nowYear + '-' + this.data.month + '-' + this.data.day + ' ' + this.data.hour + ':' + this.data.minute + ':00'; // console.log('选择当前预定时间', time) // //var tTime = new Date(time).getTime() / 1000; // this.setData({ // dateSelectHidden: false, // mealTime: time, // showbak: false // }) // }, bindDateChange(e){ console.log(e); this.setData({ date:e.detail.value }) }, bindTimeChange(e){ console.log(e); this.setData({ date:e.detail.value }) }, /** * 用餐人数改变选择回调 */ mealNumberChange(e) { var value = e.detail.value; this.data.mealNumber = value; }, /** * 键盘输入时候改变 */ bindinputnumber(e) { this.data.mealNumber = e.detail.value; console.log('用餐人数改变: ', e.detail.value); }, /** * 用餐人姓名改变回调 * @param {} e */ mealSurnameChange(e) { var value = e.detail.value; this.data.mealSurname = value; console.log('姓名改变', value); }, /** * 性别选择 */ radioChange(e) { this.data.mealSex = e.detail.value; console.log('性别改变回调', e.detail.value); }, /** * 电话号码改变 * @param {} e d */ mealIphoneChange(e) { this.data.mealIphone = e.detail.value; console.log('电话号码改变', e.detail.value); }, //手机号码验证 pattern(e) { var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; if (e.detail.value.length == 0) { wx.showToast({ title: '输入的手机号为空', icon: 'success', duration: 1500 }) return false; } else if (e.detail.value.length < 11) { wx.showToast({ title: '手机号长度有误!', icon: 'success', duration: 1500 }) return false; } else if (!myreg.test(e.detail.value)) { wx.showToast({ title: '手机号有误!', icon: 'success', duration: 1500 }) return false; } // else { // wx.showToast({ // title: '填写正确', // icon: 'success', // duration: 1500 // }) // } this.data.mealIphone = e.detail.value; console.log('电话号码改变', e.detail.value); }, /** * 备注 * @param {*} e */ mealDescChange(e) { this.data.mealDesc = e.detail.value; console.log('备注改变回调', e.detail.value); }, /** * 预定桌位 */ setTable(e) { // var contacts = { // number: this.data.mealNumber, // uname: this.data.mealSurname, // addtime: this.data.mealTime, // sex: this.data.mealSex, // iphone: this.data.mealIphone, // desc: this.data.mealDesc // } // console.log(obj) // var obj=contacts; // delete(obj.desc); // for (var key in contacts) { // if (!contacts[key] && key != "desc") { // wx.showToast({ // title: '输入不能有空' // }) // this.setData({ // canOrder: false // }) // break; // } else if (key == "desc") { // continue; // } // this.setData({ // isloop: true, // canOrder: true // }) // } // console.log(this.data.canOrder, this.data.isloop, contacts); // console.log(contacts); // var argu = { // lid: app.currentShopId, // token: app.globalData.token, // contacts: JSON.stringify(contacts) // } var argu = { token: app.globalData.token, lid : this.data.shopId, time: this.data.date + ' ' + this.data.time, name: this.data.mealSurname, number: this.data.mealNumber, tel:this.date.mealIphone, remark:this.data.mealDesc } var type = 'onlyTable'; if (this.data.canOrder != false && this.data.isloop) { httpClient.postV2AppointmentFound(argu).then((res) => { console.log('预定下单', res); if (res.code == 200) { wx.navigateTo({ url: '../pay_success/pay_success?type=' + type }) } wx.showToast({ title: res.meg }) }).catch((e) => { wx.showToast({ title: '订桌失败' }); }) } }, /** * 预定点餐 */ appointmentOrderFood(e) { //预约 点餐 字段名 var contacts = { number: this.data.mealNumber, uname: this.data.mealSurname, addtime: this.data.mealTime, sex: this.data.mealSex, iphone: this.data.mealIphone, desc: this.data.mealDesc } for (var key in contacts) { if (!contacts[key] && key != "desc") { wx.showToast({ title: '输入不能有空' }) // if(key=="iphone"){ // } this.setData({ canOrder: false }) break; } this.setData({ isloop: true, canOrder: true }) } console.log(this.data.canOrder, this.data.isloop, contacts); console.log('contacts', contacts); var type = 'appointment'; if (this.data.canOrder != false && this.data.isloop) { wx.navigateTo({ url: '../order/order?type=' + type + '&contacts=' + JSON.stringify(contacts) }) } } }) ================================================ FILE: client/pages/appointment/appointment.json ================================================ { "navigationBarTitleText": "预约", "component": true, "disableScroll": true, "usingComponents": {} } ================================================ FILE: client/pages/appointment/appointment.wxml ================================================ 用餐日期 {{date}} 用餐时间 {{time}} 联系人 就餐人数 联系电话 备注 取消订桌 放弃 申请退款 × {{refundTitle}} 金额¥{{refundPrice}} 申请退款 取消 ================================================ FILE: client/pages/indent/indent.wxss ================================================ .container { background: #f5f5f9; width: 100%; padding: 2%; font-size: 30rpx; color: #333333; } .scroll_container{ height: auto; } .container .order_part { width: 96%; margin-bottom: 20rpx; background: #fff; padding: 0 2% 10rpx; } .container .order_part .shop_phone { width: 100%; height: 77rpx; line-height: 77rpx; border-bottom: 1rpx dashed #dddddd; text-align: center; position: relative; margin: 0 !important; } .container .order_part .shop_phone image { width: 25rpx; height: 25rpx; } .container .order_part .shop_phone::before, .container .order_part .shop_phone::after { display: block; content: ""; width: 28rpx; height: 28rpx; background: #f5f5f9; -webkit-border-radius: 28rpx; -moz-border-radius: 28rpx; border-radius: 28rpx; position: absolute; bottom: -14rpx; } .container .order_part .shop_phone::before { left: -28rpx; } .container .order_part .shop_phone::after { right: -28rpx; } .container .order_part .restaurant { width: 96%; padding: 30rpx 2% 20rpx; display: flex; align-items: center; justify-content: space-between; } .container .order_part .restaurant image { display: block; width: 100rpx; height: 100rpx; border-radius: 5rpx; } .container .order_part .restaurant .restaurant_name { width: 380rpx; height: 100rpx; display: flex; flex-direction: column; align-items: center; } .container .order_part .restaurant .restaurant_name text { display: block; width: 100%; font-size: 30rpx; } .container .order_part .restaurant .restaurant_name text:last-of-type { color: #888888; font-size: 24rpx; } .container .order_part .restaurant .status { width: 160rpx; height: 100rpx; } .container .order_part .restaurant .status text { color: #ff6b12; text-align: center; display: block; } .container .order_part .restaurant .status view { width: 160rpx; height: 48rpx; color: #fff; line-height: 48rpx; font-size: 30rpx; background: #ff6b12; -webkit-border-radius: 5rpx; -moz-border-radius: 5rpx; border-radius: 5rpx; text-align: center; } .container .order_part .restaurant .status view.goEvaluate { background: #47cacc; } .container .order_part .restaurant .status view.evaluated { color: #47cacc; background: #fff; border: 1rpx solid #47cacc; box-sizing: border-box; } .container .order_part .restaurant .status view.refund { width: 160rpx; font-size: 25rpx; border-color: #ddd ; background: #f8f8f8; color: #888; } .container .order_part .order_sheet { width: 96%; padding: 0rpx 2% ; } .container .order_part .order_sheet .order_sheet_part { width: 96%; padding: 25rpx 2% 0; height: 80rpx; background: #f8f8f8; display: flex; align-items: center; justify-content: space-between; } .container .order_part .order_sheet .order_sheet_part image { display: block; width: 80rpx; height: 80rpx; border-radius: 5rpx; } .container .order_part .order_sheet .order_sheet_part .foods_name { width: 463rpx; height: 100%; } .container .order_part .order_sheet .order_sheet_part .foods_name text { display: block; font-size: 26rpx; color: #333333; } .container .order_part .order_sheet .order_sheet_part .foods_name text:last-of-type { color: #888888; } .container .order_part .order_sheet .order_sheet_part:last-of-type { padding-bottom: 25rpx; } .container .order_part .discounts { border-bottom: 1rpx dashed #ddd; width: 92%; padding: 30rpx 4% 26rpx; } .container .order_part .discounts .disct_info { width: 100%; height: 50rpx; display: flex; align-items: center; justify-content: space-between; } .container .order_part .discounts .disct_info view { font-size: 26rpx ; color: #888; } .container .order_part .discounts .disct_info view text { display: inline-block; width: 30rpx; height: 30rpx; line-height: 30rpx; border-radius: 30rpx; background: #ff6b12; color: #fff; margin-right: 20rpx ; font-size: 22rpx; text-align: center; } .container .order_part .discounts .disct_info view:last-of-type { color: #ff2b4d; } .container .order_part .sum_price { width: 92%; padding: 0 4%; height: 90rpx; border-bottom: 1rpx dashed #ddd; display: flex; justify-content: flex-end; align-items: center; } .container .order_part .sum_price .cheap { display: block; color: #888; font-size: 26rpx ; margin-right: 40rpx; } .container .order_part .sum_price .sum { color: #333; font-size: 26rpx; } .container .order_part .sum_price .sum text { color: #ff2b4d; } .container .order_part .pay_infomation { width: 92%; border-bottom: 1rpx dashed #ddd; padding: 25rpx 4%; } .container .order_part .pay_infomation .pay_part { width: 100%; padding: 15rpx 0; color: #888; display: flex; justify-content: space-between; align-items: center; } .container .order_part .pay_infomation .pay_part text { display: block; font-size: 26rpx; } .container .order_part .pay_infomation .pay_part text:first-of-type { width: 151rpx; } .container .order_part .pay_infomation .pay_part text:last-of-type { color: #333; } .container .order_part .pay_infomation .pay_part text.pay_status { color: #47cacc ; } .container .order_part .customer { border: none; } .container .order_part .customer .remark { align-items: flex-start; } .cancel_table_container { width: 100%; height: 100%; position: fixed; background: rgba(0, 0, 0, 0.5); top: 0; left: 0; } .cancel_table_container .cancel_table { width: 92%; height: 575rpx; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; background: #fff; } .cancel_table_container .cancel_table .cancel_title { width: 92%; margin: 0 auto; height: 120rpx; display: flex; justify-content: center; align-items: center; font-size: 30rpx; color: #333; font-weight: bold; position: relative; } .cancel_table_container .cancel_table .cancel_title text { position: absolute; top: 15%; right: 10rpx; color: #888; font-size: 40rpx; } .cancel_table_container .cancel_table .code_container { width: 92%; margin: 30rpx auto; } .cancel_table_container .cancel_table .code_container .refund_title, .cancel_table_container .cancel_table .code_container .can_tit { color: #666; font-size: 30rpx; } .cancel_table_container .cancel_table .code_container .refund_title { display: flex; justify-content: space-between; align-items: center; } .cancel_table_container .cancel_table .code_container .refund_title text:last-of-type { color: #ff6b12; } .cancel_table_container .cancel_table .code_container textarea { width: 100%; height: 196rpx; padding: 10rpx 4%; box-sizing: border-box; border: 1rpx solid #ddd; margin-top: 30rpx; } .cancel_table_container .cancel_table .btn_container { width: 92%; margin: 40rpx auto; height: 80rpx; display: flex; justify-content: space-between; align-items: center; } .cancel_table_container .cancel_table .btn_container view { width: 280rpx; height: 80rpx; color: #333; font-size: 30rpx; border-radius: 5rpx; line-height: 80rpx; text-align: center; box-sizing: border-box; } .cancel_table_container .cancel_table .btn_container view.cancel_btn { border: 1rpx solid #ddd; } .cancel_table_container .cancel_table .btn_container view.ensure { background: #ff6b12; color: #fff; } .empty_container{ width: 100%; height: 100%; position: fixed; top: 0; left: 0; background: #fff; } .empty_container .empty{ width: 300rpx; height: 400rpx; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; text-align: center; } .empty_container .empty image{ display:block; width: 110rpx; height: 100rpx; margin: 20rpx auto; } .empty_container .empty text{ display: block; width: 100%; text-align: center; color: #666; font-size: 26rpx; } ================================================ FILE: client/pages/index/index.js ================================================ //index.js //获取应用实例 const app = getApp() import {URL} from '../../utils/urlModel.js'; import {Http} from '../../utils/httpClient.js'; import {nearby,nav_data_0} from './type.js'; import {area} from '../../utils/area.js'; import {area2} from '../../utils/area2.js'; app.globalData.area = {...area,...area2}; var httpClient = new Http(); Page({ data: { windowHeight:app.globalData.windowHeight, URL:URL, // issign:false, near:app.near, imgUrls: [ '../images/index_06.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg', 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' ], indicatorDots: false, autoplay: false, interval: 5000, duration: 1000, idx:0, /** * 是否在搜索状态 */ searchBool:false, /** * 当前城市名字 */ cityName:'北京市', /** * 当前温度 */ temperature:'28', /** * 当前城市街道信息 */ cityData:area[app.citySelect.provriceId].children[app.citySelect.cityId], /** * 首页bnner数据 */ banner_indexData:[], /** * 首页店铺分类 * 真实数据 */ nav_indexData:[], /** * 商铺展示信息 */ shop_List:[], /** * 距离假数据 */ dis_list:['500','800','1000','1500','2000'], /** * 距离排序 */ soft_list: [ { text:"距离排序" },{ text:"口味排序" },{ text:"环境排序" },{ text:"服务排序" } ], /** * 附近遮罩层是否显示 */ markNearby:false, /** * 全部美食弹窗 */ markAllFood:false, /** * 距离排序弹窗 */ markSoft:false, /** * 当前选择Tab * 0:全部美食 1:附近 2:距离排序 */ curTab:1, /** * 选中结果 附近弹窗左侧选中结果 city字段 */ nearbyLeftTab:-1, // /** // * 附近弹窗 左侧临时选中 // */ // nearbyMockLeftTab:0, /** * 附近弹窗 是否进行了选中 */ isNearbySelect:false, /** *当前选中结果 附近弹窗中选项卡 对应county字段 * */ nearbyTab:-1, /** * 当前选中结果 全部美食选项卡 对应字段type */ allFoodTab:0, /** * 当前选中结果 距离排序选项卡 */ softListTab:0, /** * 图片选择 */ pics:[], /** * 当前页码 */ page:1, /** * 总条数 */ count:1, }, onShow(){ // 查看是否授权 var that = this; that.initData(); }, /** * 初始化数据 */ initData(){ // this.setData({ // issign:app.issigned // }) //获取积分余额及是否已经签到过 // this.getUserIters(); var httpClient = new Http(); var _this = this; /** * 获取首页导航栏接口 */ httpClient.getNavIndex() .then((data)=>{ data.splice(0,0,nav_data_0); _this.setData({ nav_indexData:data }); console.log('nav_indexData: ',_this.data.nav_indexData); }) .catch(e =>console.log(e)); /** * 获取banner接口 */ httpClient.getBannerIndex() .then((data) => { // _this.setData({ // nav_indexData: data // }); console.log('banner: ',data); _this.setData({ banner_indexData:data }); }) .catch(e =>console.log(e)); if(app.oneDayOneLogin){ httpClient.getCity().then((res)=>{ console.log('城市信息',res); var code = res.addressComponent.adcode; var cityName = res.addressComponent.city; app.citySelect.provriceId = parseInt(code/10000)*10000; app.citySelect.cityId = parseInt(code/100)*100; app.citySelect.districtId = code; app.near.lat = res.location.lat; app.near.lng = res.location.lng; app.near.parent = app.citySelect.cityId; app.near.base = app.citySelect.provriceId; console.log('第一次进入',res); _this.setData({ cityName:cityName, nearbyLeftTab:code, near:app.near }) var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; _this.setData({ cityData:cityData }) var argu = { lat:app.near.lat, lng:app.near.lng, type:-1, //店铺分类 city: app.citySelect.cityId, county: app.citySelect.districtId, sort:-1, page:1 } return httpClient.getListIndex(argu) }).then((data)=>{ console.log('ListIndex: ',data); _this.setData({ shop_List:data?data.list || [] : [], count:data?data.count || 1:1 }) }).catch(e => console.log(e)); app.oneDayOneLogin = false; }else{ var cityName = area[app.citySelect.provriceId].children[app.citySelect.cityId].name; _this.setData({ cityName:cityName, nearbyLeftTab:app.citySelect.districtId }) /** * 获取首页商铺列表 */ var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; _this.setData({ cityData:cityData, allFoodTab:0, nearbyTab:-1, nearbyLeftTab:-1, softListTab:0 }) var argu = { lat:cityData.lat, lng:cityData.lng, type:(_this.data.allFoodTab == 0?-1:_this.data.all_food), //店铺分类 city:app.citySelect.cityId, county:app.citySelect.districtId, sort:(_this.data.softListTab == 0?-1:_this.data.softListTab), page:1 } httpClient.getListIndex(argu).then((data)=>{ console.log('ListIndex: ',data); if(data){ _this.setData({ shop_List:data?data.list || []:[], count:data.count || 1 }) }else{ _this.setData({ shop_List:[], count: 1 }) } }).catch((res)=>{ }) } /** * 获取天气 */ httpClient.getWeather().then((res)=>{ var data = res.currentWeather[0].date; var weatherDesc = res.currentWeather[0].weatherDesc; console.log(data); var str = parseInt(data.split(':')[1]); console.log(str); _this.setData({ temperature:str }) }).catch(()=>{ }) /** * 获取店铺信息 */ httpClient.getStoreDetail().then((data)=>{ console.log('店铺信息为:', data); }).then((e)=>{ console.log('店铺信息为:', e); }).catch(e => console.log(e)) }, /** * 重新获取店铺数据 */ getListIndex() { var httpClient = new Http(); var _this = this; var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; var argu = { lat: this.data.nearbyLeftTab ==-1?app.near.lat:cityData.lat, lng: this.data.nearbyLeftTab ==-1?app.near.lng:cityData.lng, type: (_this.data.allFoodTab == 0 ? -1 : _this.data.allFoodTab), //店铺分类 city: this.data.nearbyLeftTab ==-1?-1:app.citySelect.cityId, county:this.data.nearbyLeftTab ==-1?this.data.nearbyTab:app.citySelect.districtId, sort: (_this.data.softListTab == 0 ? -1 : _this.data.softListTab), page: 1 } httpClient.getListIndex(argu).then((data) => { console.log('ListIndex: ', data); _this.setData({ shop_List: data?data.list || []:[], count: 1 }) }) }, /** * 页面下拉触底事件 */ onReachBottom() { console.log('下拉触底'); this.nextPage(); }, /** * 导航到shop页面 */ toShop(e) { app.currentShopId = e.currentTarget.dataset.shopid; console.log('全局shopId改变:', app.currentShopId ); wx.navigateTo({ url: "../shop/shop?shopId="+e.currentTarget.dataset.shopid }) }, toSwichtcity(){ wx.navigateTo({ url: '../switchcity/switchcity' }) }, //店铺列表 toshopList(e) { var index = e.currentTarget.dataset.index; wx.navigateTo({ url: '../shop_list/shop_list?foodType='+index }) this.setData({ idx:e.currentTarget.dataset.index }) }, /** * */ changeIndicatorDots: function (e) { this.setData({ indicatorDots: !this.data.indicatorDots }) }, /** * */ changeAutoplay: function (e) { this.setData({ autoplay: !this.data.autoplay }) }, /** * */ intervalChange: function (e) { this.setData({ interval: e.detail.value }) }, //我的积分页面签到 gosign(){ wx.navigateTo({ url:'../points/points' }) }, // //获取用户积分 // getUserIters(){ // var httpClient = new Http(); // httpClient.getUserIntegral({token:app.globalData.token}).then((data)=>{ // console.log("我的积分余额",data); // if(data.is_sign==1){ // app.issigned= false; // this.setData({ // issign:false // }) // }else if(data.is_sign==2){ // app.issigned= true; // this.setData({ // issign:true // }) // } // }) // }, /** * */ durationChange: function (e) { this.setData({ duration: e.detail.value }) }, /** * 点击->附近选项卡左侧回调(没选择真实数据以假数据为准) */ clickNearbyLeft: function(e){ this.setData({ nearbyLeftTab: e.target.dataset.type }) app.citySelect.districtId = e.target.dataset.type; console.log(this.data.nearbyLeftTab); if(e.target.dataset.type != -1){ this.closeAllMark(); this.getListIndex(); this.setData({ nearbyTab:-1 }) } }, /** * 全部美食 选中结果回调 */ clickAllFoodSelect: function(e){ console.log('选中了全部美食 选项卡选中结果: ', e); this.setData({ allFoodTab: e.target.dataset.type }) this.closeAllMark(); this.getListIndex(); }, /** * 附近选项卡 选中结果回调 */ clickNearbySelect: function(e){ console.log('选中了附近 选项卡选中结果: ',e); this.setData({ nearbyTab: e.target.dataset.type, }) this.closeAllMark(); this.getListIndex(); }, /** * 距离排序选项卡 选中结果回调 */ clickSoftListSelect: function(e){ console.log('选中了 距离排序 选项卡选中结果: ', e); this.setData({ softListTab: e.target.dataset.type }) this.closeAllMark(); this.getListIndex(); }, /** * 附近弹出层 */ markNearbyCancle: function(e){ this.setData({ markNearby: false }) }, /** * 全部美食弹出层 */ markAllFoodCancle: function(e){ this.setData({ markAllFood: false }) }, /** *距离排序弹出层 */ markSoftCancle: function(e){ this.setData({ markSoft: false }) }, /** * 进入全部美食弹出层 */ enterMarkAllFood: function(e){ this.setData({ markNearby:false, markAllFood: true, markSoft: false }) console.log("进入全部美食弹出层"); }, /** * 关闭所有弹出层 */ closeAllMark: function(e){ this.setData({ markNearby: false, markAllFood: false, markSoft: false }) console.log('关闭所有弹出层'); }, /** * 进入附近弹出层 */ enterMarkNearby: function(e){ this.setData({ markNearby: true, markAllFood: false, markSoft: false }) console.log("进入附近弹出层"); }, /** * 进入距离排序弹出层 */ enterMarkSoftList: function(e){ this.setData({ markNearby: false, markAllFood: false, markSoft: true }) console.log("进入距离排序弹出层"); }, next(){ if(this.data.searchBool){ this.nextSearchPage(); }else{ this.nextPage(); } }, /** * 下一頁 */ nextPage(){ /** * 获取首页商铺列表 */ var _this = this; var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; var page = _this.data.page; var argu = { lat:cityData.lat, lng:cityData.lng, type:(_this.data.allFoodTab == 0?-1:_this.data.all_food), //店铺分类 city:app.citySelect.cityId, county:app.citySelect.districtId, sort:(_this.data.softListTab == 0?-1:_this.data.softListTab), page:++page } httpClient.getListIndex(argu).then((data)=>{ console.log('ListIndex: ',data); if(data){ _this.setData({ shop_List:data?data.list || []:[], count:data.count || 1, page:page }) }else{ wx.showToast({ title: '已经触底', icon: 'loading', duration: 500 }) } }) }, /** * 搜索下一页 */ nextSearchPage(){ var _this = this; var page = this.data.page; var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; httpClient.search({ page:++page, keyword:e.detail.value, lat:cityData.lat, lng:cityData.lng, type:(_this.data.allFoodTab == 0 ? -1 : _this.data.allFoodTab), city:app.citySelect.cityId, county:app.citySelect.districtId, sort:(_this.data.softListTab == 0 ? -1 : _this.data.softListTab) }).then((data)=>{ if(data && data.list){ _this.setData({ shop_List:data?data.list || []:[], count:data.count || 1, page:page }) }else{ wx.showToast({ title: '搜索触底', icon: 'loading', duration: 500 }) } }).catch((res)=>{ wx.showToast({ title: '搜索触底', icon: 'loading', duration: 500 }) }) }, /** * 搜索 * var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; var argu = { lat: cityData.lat, lng: cityData.lng, type: (_this.data.allFoodTab == 0 ? -1 : _this.data.allFoodTab), //店铺分类 city: app.citySelect.cityId, county:app.citySelect.districtId, sort: (_this.data.softListTab == 0 ? -1 : _this.data.softListTab), page: 1 } */ searchShop(e){ var _this = this; if(e.detail.value.length <=0){ _this.setData({ page:1, searchBool:false }) this.getListIndex(); return; } var provriceId = app.citySelect.provriceId; var cityId = app.citySelect.cityId; var cityData = area[provriceId].children[cityId]; httpClient.search({ page:1, keyword:e.detail.value, lat:cityData.lat, lng:cityData.lng, type:(_this.data.allFoodTab == 0 ? -1 : _this.data.allFoodTab), city:app.citySelect.cityId, county:app.citySelect.districtId, sort:(_this.data.softListTab == 0 ? -1 : _this.data.softListTab) }).then((data)=>{ _this.setData({ shop_List:data?data.list || []:[], count:data.count || 1, searchBool:true }) }).catch((res)=>{ wx.showToast({ title: '正在搜索', icon: 'loading', duration: 500 }) }) }, /** * 清空输入框的数据 * @param {*} e */ searchEnd(e){ } }) ================================================ FILE: client/pages/index/index.json ================================================ { "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black", "backgroundColor": "#eeeeee", "backgroundTextStyle": "light" } ================================================ FILE: client/pages/index/index.wxml ================================================