├── static ├── .gitkeep └── css │ └── reset.css ├── .eslintignore ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── src ├── common │ ├── imgs │ │ └── loading.gif │ └── stylus │ │ └── mixins.styl ├── pages │ ├── Order │ │ ├── images │ │ │ └── person.png │ │ └── Order.vue │ ├── Shop │ │ ├── Shop.vue │ │ ├── ShopInfo │ │ │ └── ShopInfo.vue │ │ ├── ShopGoods │ │ │ └── ShopGoods.vue │ │ └── ShopRatings │ │ │ └── ShopRatings.vue │ ├── Msite │ │ ├── images │ │ │ └── msite_back.svg │ │ └── MSite.vue │ ├── Search │ │ └── Search.vue │ ├── Profile │ │ └── Profile.vue │ └── Login │ │ ├── images │ │ └── captcha.svg │ │ └── Login.vue ├── components │ ├── Star │ │ ├── images │ │ │ ├── star24_on@2x.png │ │ │ ├── star24_on@3x.png │ │ │ ├── star36_on@2x.png │ │ │ ├── star36_on@3x.png │ │ │ ├── star48_on@2x.png │ │ │ ├── star48_on@3x.png │ │ │ ├── star24_half@2x.png │ │ │ ├── star24_half@3x.png │ │ │ ├── star24_off@2x.png │ │ │ ├── star24_off@3x.png │ │ │ ├── star36_half@2x.png │ │ │ ├── star36_half@3x.png │ │ │ ├── star36_off@2x.png │ │ │ ├── star36_off@3x.png │ │ │ ├── star48_half@2x.png │ │ │ ├── star48_half@3x.png │ │ │ ├── star48_off@2x.png │ │ │ └── star48_off@3x.png │ │ └── Star.vue │ ├── ShopList │ │ ├── images │ │ │ └── shop_back.svg │ │ └── ShopList.vue │ ├── HeaderTop │ │ └── HeaderTop.vue │ ├── CartControl │ │ └── CartControl.vue │ ├── FooterGuide │ │ └── FooterGuide.vue │ ├── AlertTip │ │ └── AlertTip.vue │ ├── Food │ │ └── Food.vue │ ├── ShopCart │ │ └── ShopCart.vue │ └── ShopHeader │ │ └── ShopHeader.vue ├── filters │ └── index.js ├── store │ ├── index.js │ ├── state.js │ ├── getters.js │ ├── mutation-types.js │ ├── mutations.js │ └── actions.js ├── mock │ └── mockServer.js ├── main.js ├── App.vue ├── api │ ├── ajax.js │ └── index.js └── router │ └── index.js ├── server ├── views │ ├── error.ejs │ └── index.ejs ├── public │ └── stylesheets │ │ └── style.css ├── routes │ ├── users.js │ └── index.js ├── package.json ├── api │ └── ajax.js ├── db │ └── models.js ├── bin │ └── www ├── app.js ├── util │ └── sms_util.js ├── data │ └── index_category.json └── API文档.md ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── .babelrc ├── .eslintrc.js ├── index.html ├── README.md └── package.json /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | *.vue 6 | *.js 7 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /src/common/imgs/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/common/imgs/loading.gif -------------------------------------------------------------------------------- /server/views/error.ejs: -------------------------------------------------------------------------------- 1 |
<%= error.stack %>4 | -------------------------------------------------------------------------------- /src/pages/Order/images/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/pages/Order/images/person.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_on@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_on@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_on@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_on@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_on@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_on@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_on@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_on@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_on@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_on@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_on@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_on@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_half@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_half@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_half@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_half@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_off@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star24_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star24_off@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_half@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_half@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_half@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_half@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_off@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star36_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star36_off@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_half@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_half@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_half@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_half@3x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_off@2x.png -------------------------------------------------------------------------------- /src/components/Star/images/star48_off@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zionuke/vue2-takeaway/HEAD/src/components/Star/images/star48_off@3x.png -------------------------------------------------------------------------------- /server/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /server/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /server/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Welcome to <%= title %>
10 | 11 | 12 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/filters/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | // import moment from 'moment' 3 | import format from 'date-fns/format' 4 | 5 | // 自定义过滤器 6 | Vue.filter('date-format', function (value, formatStr='yyyy-MM-dd HH:mm:ss') { 7 | 8 | // return moment(value).format(formatStr) 9 | return format(value, formatStr) 10 | }) -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | vuex最核心的管理对象store 3 | */ 4 | import Vue from "vue" 5 | import Vuex from 'vuex' 6 | import state from './state' 7 | import actions from './actions' 8 | import mutations from './mutations' 9 | import getters from './getters' 10 | 11 | Vue.use(Vuex) 12 | 13 | export default new Vuex.Store({ 14 | state, 15 | actions, 16 | mutations, 17 | getters 18 | }) 19 | -------------------------------------------------------------------------------- /src/mock/mockServer.js: -------------------------------------------------------------------------------- 1 | /* 2 | 使用mockjs提供mock数据接口 3 | */ 4 | import Mock from 'mockjs' 5 | import data from './data.json' 6 | 7 | // 返回goods的接口 8 | Mock.mock('/goods', {code:0, data: data.goods}) 9 | // 返回ratings的接口 10 | Mock.mock('/ratings', {code:0, data: data.ratings}) 11 | // 返回info的接口 12 | Mock.mock('/info', {code:0, data: data.info}) 13 | 14 | // export default ??? 不需要向外暴露任何数据, 只需要保存能执行即可 -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime", ["component", [ 12 | { 13 | "libraryName": "mint-ui", 14 | "style": true 15 | } 16 | ]]] 17 | } 18 | -------------------------------------------------------------------------------- /src/store/state.js: -------------------------------------------------------------------------------- 1 | /* 2 | 状态对象 3 | */ 4 | export default { 5 | latitude: 30.513216871440488, // 纬度 6 | longitude: 114.4202863269456, // 经度 7 | address: {}, //地址相关信息对象 8 | categorys: [], // 食品分类数组 9 | shops: [], // 商家数组 10 | userInfo: {}, // 用户信息 11 | goods: [], // 商品列表 12 | ratings: [], // 商家评价列表 13 | info: {}, // 商家信息 14 | cartFoods: [], // 购物车中食物的列表 15 | searchShops: [], // 搜索得到的商家列表 16 | } -------------------------------------------------------------------------------- /src/store/getters.js: -------------------------------------------------------------------------------- 1 | /* 2 | 包含多个基于state的getter计算属性的对象 3 | */ 4 | export default { 5 | totalCount(state) { 6 | return state.cartFoods.reduce((prev, food) => prev + food.count, 0) 7 | }, 8 | 9 | totalPrice(state) { 10 | return state.cartFoods.reduce((prev, food) => prev + food.count*food.price, 0) 11 | }, 12 | 13 | positiveSize(state) { 14 | return state.ratings.reduce((prev, rating) => prev + (rating.rateType===0?1:0), 0) 15 | } 16 | } -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | 入口JS 3 | */ 4 | import Vue from 'vue' 5 | import { Button } from 'mint-ui' 6 | import VueLazyload from 'vue-lazyload' 7 | import App from './App' 8 | import router from './router' 9 | import store from './store' 10 | 11 | import './mock/mockServer' // 加载mockServer即可 12 | import loading from './common/imgs/loading.gif' 13 | import './filters' // 加载过滤器 14 | 15 | // 注册全局组件标签 16 | Vue.component(Button.name, Button) // 全局可使用
6 | {{alertText}}
9 |24 | {{item.name}} 25 |
26 |月售 {{item.month_sales||item.recent_order_num}} 单
27 |{{item.delivery_fee||item.float_minimum_order_amount}} 元起送 / 距离{{item.distance}}
28 |{{food.info}}
7 |{{food.description}}
46 |