Browse Source

Change 完善商家详情页

enilu 6 years ago
parent
commit
0313034f73

+ 2 - 0
README.md

@@ -27,6 +27,8 @@
 ```
 mongorestore.exe -d flash-waimai d:\\elm
 ```
+- 下载测试图片:链接:https://pan.baidu.com/s/1rvZDspoapWa6rEq2D_5kzw 提取码:urzw ,将图片存放到t_sys_cfg表中system.file.upload.path配置的目录的目录
+
 - 启动管理平台,进入flash-waimai-manage目录:
     - 运行 npm install --registry=https://registry.npm.taobao.org
     - 运行npm run dev

+ 1 - 1
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/FileController.java

@@ -150,7 +150,7 @@ public class FileController extends BaseController {
             out.write(b);
             out.flush();
         } catch (Exception e) {
-            logger.error("getImgStream error",e);
+            logger.error("文件不存在",e.getMessage());
         } finally {
             if (fis != null) {
                 try {

+ 14 - 2
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/FoodController.java

@@ -5,6 +5,7 @@ import cn.enilu.flash.bean.constant.factory.PageFactory;
 import cn.enilu.flash.bean.entity.front.Food;
 import cn.enilu.flash.bean.entity.front.Ids;
 import cn.enilu.flash.bean.entity.front.KeyValue;
+import cn.enilu.flash.bean.entity.front.Menu;
 import cn.enilu.flash.bean.entity.front.SpecFood;
 import cn.enilu.flash.bean.vo.business.FoodVo;
 import cn.enilu.flash.bean.vo.business.SpecVo;
@@ -86,9 +87,11 @@ public class FoodController extends BaseController {
         food.setPinyin_name(StringUtils.getPingYin(food.getName()));
         food.setSatisfy_rate(new BigDecimal(Math.ceil(Math.random() * 100)).setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue());
         food.setSatisfy_count(new BigDecimal(Math.ceil(Math.random() * 1000)).setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue());
-        food.setRating(new BigDecimal(Math.random() * 5).setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue());
-        System.out.println(Json.toJson(food));
+        food.setRating(new BigDecimal(Math.random() * 5).setScale(1,BigDecimal.ROUND_HALF_UP).doubleValue());        
         mongoRepository.save(food);
+        Menu menu = mongoRepository.findOne(Menu.class,food.getCategory_id());
+        menu.getFoods().add(food);
+        mongoRepository.update(menu);
         return Rets.success();
     }
     @RequestMapping(value="/v2/foods",method = RequestMethod.GET)
@@ -134,6 +137,15 @@ public class FoodController extends BaseController {
         old.setImage_path(food.getImagePath());
         old.setSpecfoods(specList);
         mongoRepository.update(old);
+        Menu menu = mongoRepository.findOne(Menu.class,old.getCategory_id());
+        for(Food item:menu.getFoods()){
+            if(item.getItem_id().intValue() == old.getItem_id().intValue()){
+                menu.getFoods().remove(item);
+                menu.getFoods().add(old);
+                break;
+            }
+        }
+        mongoRepository.update(menu);
         return Rets.success();
     }
 

+ 5 - 4
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/RatingController.java

@@ -1,6 +1,7 @@
 package cn.enilu.flash.api.controller.business;
 
 import cn.enilu.flash.api.controller.BaseController;
+import cn.enilu.flash.bean.vo.front.Rets;
 import cn.enilu.flash.dao.MongoRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
@@ -19,17 +20,17 @@ import java.util.Map;
 public class RatingController extends BaseController {
     @Autowired
     private MongoRepository mongoRepository;
-    @RequestMapping(value = "/ugc/v2/restaurants/${restaurant_id}/ratings",method = RequestMethod.GET)
+    @RequestMapping(value = "/ugc/v2/restaurants/{restaurant_id}/ratings",method = RequestMethod.GET)
     public Object ratings(@PathVariable("restaurant_id")Long restaurantId){
         Map map = mongoRepository.findOne("ratings","restaurant_id",restaurantId);
-        return map.get("ratings");
+        return Rets.success(map.get("ratings"));
     }
-    @RequestMapping(value = "ugc/v2/restaurants/${restaurant_id}/ratings/scores",method = RequestMethod.GET)
+    @RequestMapping(value = "ugc/v2/restaurants/{restaurant_id}/ratings/scores",method = RequestMethod.GET)
     public Object score(@PathVariable("restaurant_id")Long restaurantId){
         Map map = mongoRepository.findOne("ratings","restaurant_id",restaurantId);
         return map.get("scores");
     }
-    @RequestMapping(value = "ugc/v2/restaurants/${restaurant_id}/ratings/tags",method = RequestMethod.GET)
+    @RequestMapping(value = "ugc/v2/restaurants/{restaurant_id}/ratings/tags",method = RequestMethod.GET)
     public Object tags(@PathVariable("restaurant_id")Long restaurantId){
         Map map = mongoRepository.findOne("ratings","restaurant_id",restaurantId);
         return map.get("tags");

+ 1 - 2
flash-waimai-api/src/main/java/cn/enilu/flash/api/controller/business/ShopController.java

@@ -248,8 +248,7 @@ public class ShopController extends BaseController {
     }
 
     @RequestMapping(value = "/v2/menu", method = RequestMethod.GET)
-
-    public Object getMenu(@RequestParam("restaurant_id") Long restaurantId, @RequestParam("allMenu") boolean allMEnu) {
+    public Object getMenu(@RequestParam("restaurant_id") Long restaurantId, @RequestParam(name="allMenu",required=false) boolean allMEnu) {
         return Rets.success(mongoRepository.findAll("menus", "restaurant_id", restaurantId));
     }
 

+ 4 - 1
flash-waimai-mobile/build/webpack.base.conf.js

@@ -67,7 +67,10 @@ module.exports = {
         }),
         postcss: [
             require('autoprefixer')({
-                browsers: ['last 10 versions']
+                browsers: [
+                    'Android >= 4.4',
+                    'iOS >= 8'
+                  ]
             })
         ]
     }

+ 1 - 1
flash-waimai-mobile/package.json

@@ -11,7 +11,7 @@
     "build": "node build/build.js"
   },
   "dependencies": {
-    "better-scroll": "^0.1.15",
+    "better-scroll": "1.15.2",
     "fastclick": "^1.0.6",
     "iscroll": "^5.2.0",
     "showdown": "^1.6.4",

+ 0 - 7
flash-waimai-mobile/src/main.js

@@ -4,13 +4,6 @@ import routes from './router/router'
 import store from './store/'
 import {routerMode} from './config/env'
 import './config/rem'
-import FastClick from 'fastclick'
-
-if ('addEventListener' in document) {
-    document.addEventListener('DOMContentLoaded', function() {
-        FastClick.attach(document.body);
-    }, false);
-}
 
 Vue.use(VueRouter)
 const router = new VueRouter({

+ 2 - 1
flash-waimai-mobile/src/page/order/order.vue

@@ -1,6 +1,7 @@
  <template>
     <div class="order_page">
         <head-top head-title="订单列表" go-back='true'></head-top>
+       
         <ul class="order_list_ul" v-load-more="loaderMore">
             <li class="order_list_li" v-for="item in orderList" :key="item.id">
                 <img :src="imgBaseUrl + item.restaurant_image_url" class="restaurant_image">
@@ -144,7 +145,7 @@
         p, span, h4{
             font-family: Helvetica Neue,Tahoma,Arial;
         }
-    }
+    }    
     .order_list_ul{
         padding-top: 1.95rem;
         .order_list_li{

+ 2 - 4
flash-waimai-mobile/src/page/shop/children/foodDetail.vue

@@ -1,4 +1,4 @@
- <template>
+<template>
 	<div class="rating_page">
         <head-top :head-title="name" go-back='true'></head-top>
         <section class="header_img">
@@ -35,7 +35,6 @@
     import ratingStar from 'src/components/common/ratingStar'
     import buyCart from 'src/components/common/buyCart'
     import {imgBaseUrl} from 'src/config/env'
-
     export default {
     	data(){
             return{
@@ -155,5 +154,4 @@
             }
         }
     }
-
-</style>
+</style>

+ 1 - 2
flash-waimai-mobile/src/page/shop/children/shopDetail.vue

@@ -81,7 +81,6 @@
     import {mapState} from 'vuex'
     import {getImgPath} from 'src/components/common/mixin'
     import {imgBaseUrl} from 'src/config/env'
-
     export default {
     	data(){
             return{
@@ -243,4 +242,4 @@
         transform: translate3d(2rem, 0, 0);
         opacity: 0;
     }
-</style>
+</style>

+ 20 - 21
flash-waimai-mobile/src/page/shop/shop.vue

@@ -1,4 +1,4 @@
- <template>
+<template>
     <div>
         <section v-if="!showLoading" class="shop_container">
             <nav class="goback" @click="goback">
@@ -7,7 +7,9 @@
                 </svg>
             </nav>
             <header class="shop_detail_header" ref="shopheader" :style="{zIndex: showActivities? '14':'10'}">
-                <img :src="imgBaseUrl + shopDetailData.image_path" class="header_cover_img">
+                <div class="header_cover_img_con">
+                  <img :src="imgBaseUrl + shopDetailData.image_path" class="header_cover_img">
+                </div>
                 <section class="description_header">
                     <router-link to="/shop/shopDetail" class="description_top">
                         <section class="description_left">
@@ -324,7 +326,6 @@
     import {loadMore, getImgPath} from 'src/components/common/mixin'
     import {imgBaseUrl} from 'src/config/env'
     import BScroll from 'better-scroll'
-
     export default {
         data(){
             return{
@@ -465,11 +466,9 @@
                     swipeTime: 2000,
                     click: true,
                 });
-
                 const wrapperMenu = new BScroll('#wrapper_menu', {
                     click: true,
                 });
-
                 const wrapMenuHeight = this.$refs.wrapperMenu.clientHeight;
                 this.foodScroll.on('scroll', (pos) => {
                     if (!this.$refs.wrapperMenu) {
@@ -758,15 +757,21 @@
         padding-left: 0.2rem;
     }
     .shop_detail_header{
-        overflow: hidden;
+        // overflow: hidden;
         position: relative;
-        .header_cover_img{
-            width: 100%;
-            position: absolute;
-            top: 0;
-            left: 0;
-            z-index: 9;
-            filter: blur(10px);
+        .header_cover_img_con {
+          height: 100%;
+          overflow: hidden;
+          position: absolute;
+          width: 100%;
+          .header_cover_img{
+              width: 100%;
+              position: absolute;
+              top: 0;
+              left: 0;
+              z-index: 9;
+              filter: blur(10px);
+          }
         }
         .description_header{
             position: relative;
@@ -888,7 +893,6 @@
                 padding: .2rem .4rem;
                 border-radius: 0.5rem;
             }
-
         }
         .close_activities{
             position: absolute;
@@ -896,11 +900,11 @@
             @include cl;
         }
     }
-
     .food_container{
         display: flex;
         flex: 1;
         padding-bottom: 2rem;
+        overflow: hidden;
     }
     .menu_container{
         display: flex;
@@ -1080,7 +1084,6 @@
                                 display: inline-block;
                                 transform: scale(.8);
                                 margin-left: -0.35rem;
-
                             }
                         }
                     }
@@ -1157,7 +1160,6 @@
             .cart_num{
                 @include ct;
                 left: 3.5rem;
-
                 div{
                     color: #fff;
                 }
@@ -1235,7 +1237,6 @@
                     span:nth-of-type(1){
                         @include sc(.6rem, #f60);
                         font-family: Helvetica Neue,Tahoma;
-
                     }
                     span:nth-of-type(2){
                         @include sc(.7rem, #f60);
@@ -1538,7 +1539,6 @@
         position: fixed;
         bottom: 30px;
         left: 30px;
-
         svg{
             @include wh(.9rem, .9rem);
             fill: #3190e8;
@@ -1572,5 +1572,4 @@
     .toggle-cart-enter, .toggle-cart-leave-active {
         transform: translateY(100%);
     }
-
-</style>
+</style>