Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
ming-order
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fengzhaoyu
ming-order
Commits
7a76d31d
Commit
7a76d31d
authored
Oct 16, 2019
by
fengzhaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MOD:增加了没有分类和没有菜品的情况
parent
103a8eab
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
23 deletions
+114
-23
vcs.xml
.idea/vcs.xml
+3
-1
workspace.xml
.idea/workspace.xml
+0
-0
index.css
css/index.css
+49
-0
noClassification.png
img/noClassification.png
+0
-0
menu.html
menu.html
+62
-22
No files found.
.idea/vcs.xml
View file @
7a76d31d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$/.."
vcs=
"Git"
/>
<mapping
directory=
"F:"
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
7a76d31d
This diff is collapsed.
Click to expand it.
css/index.css
View file @
7a76d31d
...
...
@@ -45,6 +45,9 @@ li {
text-align
:
center
;
line-height
:
64px
;
border-right
:
5px
solid
#ffffff
;
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
/*点菜*/
.menu
{
...
...
@@ -258,3 +261,49 @@ li {
margin-left
:
-172px
;
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
;
}
img/noClassification.png
0 → 100644
View file @
7a76d31d
13 KB
menu.html
View file @
7a76d31d
...
...
@@ -11,7 +11,8 @@
<script
src=
"js/axios.min.js"
></script>
</head>
<body>
<div
id=
"order"
>
<div
id=
"gen"
>
<div
id=
"order"
v-if=
"isCategorys"
>
<!-- 菜单分类-->
<div
class=
"category"
>
<ul>
...
...
@@ -25,7 +26,7 @@
</div>
<!-- 点菜-->
<div
class=
"menu"
>
<ul
>
<ul
v-if=
"isProduct"
>
<li
v-for=
"(menu,index) in defaultProduct"
:key=
"menu.productId"
@
click=
"addCar(menu,index)"
v-cloak
>
<div
class=
"imgContainer"
>
<img
:src=
'menu.productIcon'
alt=
""
>
...
...
@@ -34,6 +35,12 @@
<div
class=
"price"
>
¥{{menu.productPrice}}
</div>
</li>
</ul>
<ul
v-else
class=
"noProduct"
>
<img
src=
"img/noClassification.png"
alt=
""
>
<p>
该分类下没有菜品
</p>
</ul>
</div>
<!-- 支付-->
<div
class=
"payment"
>
...
...
@@ -41,16 +48,16 @@
<span>
已选菜单
</span>
<div
class=
"clear"
@
click=
"clearCar()"
>
清空
</div>
</div>
<div
class=
"scroll3"
>
<div
class=
"scroll3"
ref=
'scroll3'
>
<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=
"num"
>
<div
@
click=
"reduce(index)"
class=
"reduce"
></div>
<span>
{{item.count}}
</span>
<div
@
click=
"add(index)"
class=
"add"
></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>
</ul>
</div>
...
...
@@ -62,16 +69,26 @@
<div
class=
"checkout"
@
click =
'checkout'
>
结账
</div>
</div>
</div>
<div
class=
"noCategory"
v-else
v-cloak
>
<img
src=
"img/noClassification.png"
alt=
""
>
<p>
您暂时还没有菜品分类,请到后台添加
</p>
</div>
</div>
</body>
<script>
// 获取orgId
var
orgId
=
window
.
android
.
getOrgId
()
localStorage
.
setItem
(
'orgId'
,
orgId
)
//
localStorage.setItem('orgId','ding9ddd48137390507735c2f4657eb6378f')
//
var orgId = window.android.getOrgId()
//
localStorage.setItem('orgId',orgId)
localStorage
.
setItem
(
'orgId'
,
'ding9ddd48137390507735c2f4657eb6378f'
)
// 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
=
{
request
:
(
url
,
method
,
data
)
=>
{
...
...
@@ -93,7 +110,7 @@
var
order
=
new
Vue
({
el
:
'#
order
'
,
el
:
'#
gen
'
,
data
:
{
categorys
:
[],
// 菜单分类
defaultProduct
:
[],
// 默认展示的菜
...
...
@@ -109,6 +126,8 @@
allPrice
:
0
,
// 购物车里商品总价格
isDisplay
:
true
,
// 菜品分类是否展示隐藏 默认展示
isUp
:
true
,
//菜品是否上架 菜品上架
isCategorys
:
true
,
// 有没有分类
isProduct
:
true
// 有无菜品
},
created
()
{
let
data
=
{
...
...
@@ -121,15 +140,32 @@
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
})
}).
then
(
e
=>
{
.
then
(
e
=>
{
console
.
log
(
e
.
data
.
data
,
111111111
)
if
(
e
.
data
.
data
.
length
!=
0
)
{
this
.
isProduct
=
true
e
.
data
.
data
.
forEach
((
product
)
=>
{
// 菜品是否展示
if
(
product
.
productStatus
==
'UP'
)
{
this
.
defaultProduct
.
push
(
product
)
}
})
}
else
{
this
.
isProduct
=
false
}
})
}
// 左侧没有分类的情况下
else
{
this
.
isCategorys
=
false
return
}
})
},
mounted
()
{
...
...
@@ -142,11 +178,18 @@
this
.
defaultProduct
=
[]
this
.
$http
.
request
(
'/v1/product/list_product'
,
'post'
,{
productCategoryId
:
menu
.
productCategoryId
})
.
then
(
res
=>
{
if
(
res
.
data
.
data
.
length
!=
0
)
{
this
.
isProduct
=
true
res
.
data
.
data
.
forEach
(
product
=>
{
if
(
product
.
productStatus
==
'UP'
)
{
this
.
defaultProduct
.
push
(
product
)
}
})
}
else
{
this
.
isProduct
=
false
}
})
.
catch
(
err
=>
{
console
.
log
(
err
)
...
...
@@ -163,7 +206,7 @@
count
:
0
}
// 判断购物车里是否已经存在商品
this
.
carList
.
some
(
item
=>
{
this
.
carList
.
some
(
(
item
,
index
)
=>
{
if
(
gooodinfo
.
productId
==
item
.
productId
)
{
item
.
count
+=
parseInt
(
gooodinfo
.
count
)
+
1
flag
=
true
...
...
@@ -177,18 +220,15 @@
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
console
.
log
(
this
.
allPrice
)
this
.
allPrice
=
((
this
.
allPrice
*
100
+
gooodinfo
.
productPrice
*
100
)
/
100
).
toFixed
(
2
)
// 让最后加入右侧购物车列表的菜进入视野
setTimeout
(()
=>
{
this
.
$refs
.
foodItem
[
this
.
carList
.
length
-
1
].
scrollIntoView
()
},
0
)
},
// 清空购物车
clearCar
:
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment