Commit 7a76d31d by fengzhaoyu

MOD:增加了没有分类和没有菜品的情况

parent 103a8eab
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" /> <mapping directory="F:" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -2,94 +2,8 @@ ...@@ -2,94 +2,8 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3f11f0c2-4f1a-448b-9322-b444722d73f2" name="Default Changelist" comment=""> <list default="true" id="3f11f0c2-4f1a-448b-9322-b444722d73f2" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/../.idea/work.iml" afterDir="false" /> <change afterPath="$PROJECT_DIR$/img/noClassification.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/.babelrc" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/.editorconfig" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/.postcssrc.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/README.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/build.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/check-versions.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/logo.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/utils.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/vue-loader.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/webpack.base.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/webpack.dev.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/build/webpack.prod.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/config/dev.env.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/config/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/config/prod.env.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/index.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/package-lock.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/package.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/App.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/assets/logo.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/components/affix.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/components/bt.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/components/grid.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/components/layout.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/main.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/src/router/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/static/.gitkeep" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../antDesignVue/static/util/hello.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/.babelrc" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/.editorconfig" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/.postcssrc.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/README.md" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/build.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/check-versions.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/logo.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/utils.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/vue-loader.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/webpack.base.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/webpack.dev.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/build/webpack.prod.conf.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/config/dev.env.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/config/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/config/prod.env.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/index.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/package-lock.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/package.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/API/http.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/App.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/assets/logo.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/components/HelloWorld.vue" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/main.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/src/utils/constants.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../diancai/static/.gitkeep" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../guofeng" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../mingPay-Mobile" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../mingPay-web" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../mingpay/mingPay-Mobile" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../mingwork-H3C" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../order/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../pig" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/.idea/text.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/css/selectSeat.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/ff.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/16宫格自由变色.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/Es6解析.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/object。key.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/原生区域滚动.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/对象转化成字符串.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/幸运大转盘.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/影院选座.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/循环显示颜色.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/时钟转动.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/点击特效.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/html/调用摄像头.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/img/bg_body.gif" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/img/dogSeat.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/img/meSeat.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/img/otherSeat.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/js/jquery-3.4.1.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../text/js/showColor.menmgmeng.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/../waimai" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/css/index.css" beforeDir="false" afterPath="$PROJECT_DIR$/css/index.css" afterDir="false" /> <change beforePath="$PROJECT_DIR$/css/index.css" beforeDir="false" afterPath="$PROJECT_DIR$/css/index.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/menu.html" beforeDir="false" afterPath="$PROJECT_DIR$/menu.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/menu.html" beforeDir="false" afterPath="$PROJECT_DIR$/menu.html" afterDir="false" />
...@@ -108,7 +22,7 @@ ...@@ -108,7 +22,7 @@
</option> </option>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="ProjectId" id="1RVZjC7Veum5HAS9awJ6LOFgQe7" /> <component name="ProjectId" id="1RVZjC7Veum5HAS9awJ6LOFgQe7" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
...@@ -116,7 +30,7 @@ ...@@ -116,7 +30,7 @@
<property name="DefaultHtmlFileTemplate" value="HTML File" /> <property name="DefaultHtmlFileTemplate" value="HTML File" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/img" />
<property name="node.js.detected.package.eslint" value="true" /> <property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" /> <property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" /> <property name="node.js.path.for.package.eslint" value="project" />
...@@ -126,6 +40,7 @@ ...@@ -126,6 +40,7 @@
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="F:\ming-order\img" />
<recent name="F:\work\ming-order\js" /> <recent name="F:\work\ming-order\js" />
<recent name="F:\work\ming-order\img" /> <recent name="F:\work\ming-order\img" />
</key> </key>
...@@ -164,6 +79,9 @@ ...@@ -164,6 +79,9 @@
<workItem from="1570670327176" duration="1220000" /> <workItem from="1570670327176" duration="1220000" />
<workItem from="1570781784702" duration="15433000" /> <workItem from="1570781784702" duration="15433000" />
<workItem from="1570843686159" duration="23451000" /> <workItem from="1570843686159" duration="23451000" />
<workItem from="1571017846901" duration="8561000" />
<workItem from="1571102112992" duration="17373000" />
<workItem from="1571188950681" duration="581000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -183,15 +101,4 @@ ...@@ -183,15 +101,4 @@
</map> </map>
</option> </option>
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="javascript">
<url>file://$PROJECT_DIR$/menu.html</url>
<line>75</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project> </project>
\ No newline at end of file
...@@ -45,6 +45,9 @@ li { ...@@ -45,6 +45,9 @@ li {
text-align: center; text-align: center;
line-height: 64px; line-height: 64px;
border-right: 5px solid #ffffff; border-right: 5px solid #ffffff;
overflow: hidden;
white-space:nowrap;
text-overflow:ellipsis;
} }
/*点菜*/ /*点菜*/
.menu { .menu {
...@@ -258,3 +261,49 @@ li { ...@@ -258,3 +261,49 @@ li {
margin-left: -172px; margin-left: -172px;
cursor: pointer; cursor: pointer;
} }
/*左侧没有分类*/
.noCategory {
width: 100%;
position: relative;
}
.noCategory img {
width: 179px;
height: 152px;
position: absolute;
top: 236px;
left: 50%;
margin-left: -89px;
}
.noCategory p {
position: absolute;
top: 408px;
width: 100%;
text-align: center;
color: #999999;
font-size: 14px;
}
/*没有菜品*/
.noProduct {
width: 100%;
position: relative;
}
.noProduct img {
width: 179px;
height: 152px;
position: absolute;
top: 236px;
left: 50%;
margin-left: -89px;
}
.noProduct p {
position: absolute;
top: 408px;
width: 179px;
left: 50%;
margin-left: -95px;
text-align: center;
color: #999999;
font-size: 14px;
}
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
<script src="js/axios.min.js"></script> <script src="js/axios.min.js"></script>
</head> </head>
<body> <body>
<div id="order" > <div id="gen">
<div id="order" v-if="isCategorys" >
<!-- 菜单分类--> <!-- 菜单分类-->
<div class="category"> <div class="category">
<ul> <ul>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
</div> </div>
<!-- 点菜--> <!-- 点菜-->
<div class="menu" > <div class="menu" >
<ul > <ul v-if="isProduct">
<li v-for="(menu,index) in defaultProduct" :key="menu.productId" @click="addCar(menu,index)" v-cloak> <li v-for="(menu,index) in defaultProduct" :key="menu.productId" @click="addCar(menu,index)" v-cloak>
<div class="imgContainer"> <div class="imgContainer">
<img :src='menu.productIcon' alt=""> <img :src='menu.productIcon' alt="">
...@@ -34,6 +35,12 @@ ...@@ -34,6 +35,12 @@
<div class="price">¥{{menu.productPrice}}</div> <div class="price">¥{{menu.productPrice}}</div>
</li> </li>
</ul> </ul>
<ul v-else class="noProduct">
<img src="img/noClassification.png" alt="">
<p>
该分类下没有菜品
</p>
</ul>
</div> </div>
<!-- 支付--> <!-- 支付-->
<div class="payment"> <div class="payment">
...@@ -41,16 +48,16 @@ ...@@ -41,16 +48,16 @@
<span>已选菜单</span> <span>已选菜单</span>
<div class="clear" @click="clearCar()" >清空</div> <div class="clear" @click="clearCar()" >清空</div>
</div> </div>
<div class="scroll3"> <div class="scroll3" ref='scroll3'>
<ul> <ul>
<li v-for="(item, index) in carList" :key="item.productId" v-cloak> <li v-for="(item, index) in carList" :key="item.productId" v-cloak ref='foodItem'>
<div class="name">{{item.productName}}</div> <div class="name">{{item.productName}}</div>
<div class="num"> <div class="num">
<div @click="reduce(index)" class="reduce"></div> <div @click="reduce(index)" class="reduce"></div>
<span>{{item.count}}</span> <span>{{item.count}}</span>
<div @click="add(index)" class="add"></div> <div @click="add(index)" class="add"></div>
</div> </div>
<div class="money">¥{{item.count * (item.productPrice*100)/100}}</div> <div class="money">¥{{(item.count * (item.productPrice*100)/100).toFixed(2)}}</div>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -62,16 +69,26 @@ ...@@ -62,16 +69,26 @@
<div class="checkout" @click ='checkout'>结账</div> <div class="checkout" @click ='checkout'>结账</div>
</div> </div>
</div> </div>
<div class="noCategory" v-else v-cloak>
<img src="img/noClassification.png" alt="">
<p>
您暂时还没有菜品分类,请到后台添加
</p>
</div>
</div>
</body> </body>
<script> <script>
// 获取orgId // 获取orgId
var orgId = window.android.getOrgId() // var orgId = window.android.getOrgId()
localStorage.setItem('orgId',orgId) // localStorage.setItem('orgId',orgId)
// localStorage.setItem('orgId','ding9ddd48137390507735c2f4657eb6378f') localStorage.setItem('orgId','ding9ddd48137390507735c2f4657eb6378f')
// axios.defaults.baseURL = 'http://192.168.1.101:9999/mingpay-phone' // 本地钱 // axios.defaults.baseURL = 'http://192.168.1.101:9999/mingpay-phone' // 本地钱
axios.defaults.baseURL = 'http://139.224.55.14:9999/mingpay-phone' // beta环境 axios.defaults.baseURL = 'https://gateway.mingwork.com/mingpay-phone' // beta环境
// axios.defaults.headers['Content-Type'] = 'application/json'
const $http = { const $http = {
request: (url,method,data) => { request: (url,method,data) => {
...@@ -93,7 +110,7 @@ ...@@ -93,7 +110,7 @@
var order = new Vue({ var order = new Vue({
el: '#order', el: '#gen',
data: { data: {
categorys: [], // 菜单分类 categorys: [], // 菜单分类
defaultProduct: [], // 默认展示的菜 defaultProduct: [], // 默认展示的菜
...@@ -109,6 +126,8 @@ ...@@ -109,6 +126,8 @@
allPrice: 0 ,// 购物车里商品总价格 allPrice: 0 ,// 购物车里商品总价格
isDisplay: true, // 菜品分类是否展示隐藏 默认展示 isDisplay: true, // 菜品分类是否展示隐藏 默认展示
isUp: true, //菜品是否上架 菜品上架 isUp: true, //菜品是否上架 菜品上架
isCategorys: true, // 有没有分类
isProduct: true // 有无菜品
}, },
created() { created() {
let data = { let data = {
...@@ -121,15 +140,32 @@ ...@@ -121,15 +140,32 @@
this.categorys.push(item) this.categorys.push(item)
} }
}) })
console.log(this.categorys,33333333333333333) // 左侧有分类的情况下
if(this.categorys.length != 0) {
return this.$http.request('/v1/product/list_product','post',{ productCategoryId: this.categorys[0].productCategoryId }) return this.$http.request('/v1/product/list_product','post',{ productCategoryId: this.categorys[0].productCategoryId })
}).then(e => { .then(e => {
console.log( e.data.data,111111111)
if( e.data.data.length != 0) {
this.isProduct = true
e.data.data.forEach((product) => { e.data.data.forEach((product) => {
// 菜品是否展示 // 菜品是否展示
if(product.productStatus == 'UP') { if(product.productStatus == 'UP') {
this.defaultProduct.push(product) this.defaultProduct.push(product)
} }
}) })
}
else {
this.isProduct = false
}
})
}
// 左侧没有分类的情况下
else {
this.isCategorys = false
return
}
}) })
}, },
mounted() { mounted() {
...@@ -142,11 +178,18 @@ ...@@ -142,11 +178,18 @@
this.defaultProduct = [] this.defaultProduct = []
this.$http.request('/v1/product/list_product','post',{productCategoryId: menu.productCategoryId}) this.$http.request('/v1/product/list_product','post',{productCategoryId: menu.productCategoryId})
.then(res => { .then(res => {
if(res.data.data.length != 0) {
this.isProduct = true
res.data.data.forEach(product => { res.data.data.forEach(product => {
if(product.productStatus == 'UP') { if(product.productStatus == 'UP') {
this.defaultProduct.push(product) this.defaultProduct.push(product)
} }
}) })
}
else {
this.isProduct = false
}
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)
...@@ -163,7 +206,7 @@ ...@@ -163,7 +206,7 @@
count: 0 count: 0
} }
// 判断购物车里是否已经存在商品 // 判断购物车里是否已经存在商品
this.carList.some(item => { this.carList.some((item,index) => {
if(gooodinfo.productId == item.productId ) { if(gooodinfo.productId == item.productId ) {
item.count += parseInt(gooodinfo.count) + 1 item.count += parseInt(gooodinfo.count) + 1
flag = true flag = true
...@@ -177,18 +220,15 @@ ...@@ -177,18 +220,15 @@
this.carList.push(gooodinfo) this.carList.push(gooodinfo)
} }
//计算总数量 总价格 //计算总数量 总价格
console.log(typeof(gooodinfo.productPrice))
var num1 = 270.72*10000
var num2 = 45.12*10000
console.log( (num1 + num2 )/10000)
console.log( num1)
console.log( num2)
this.allNum = this.allNum + 1 this.allNum = this.allNum + 1
console.log(this.allPrice )
this.allPrice = ((this.allPrice*100 + gooodinfo.productPrice*100)/100).toFixed(2) this.allPrice = ((this.allPrice*100 + gooodinfo.productPrice*100)/100).toFixed(2)
// 让最后加入右侧购物车列表的菜进入视野
setTimeout(() => {
this.$refs.foodItem[this.carList.length - 1].scrollIntoView()
},0)
}, },
// 清空购物车 // 清空购物车
clearCar:function() { clearCar:function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment