Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wxh-order-h5
Project
Project
Details
Activity
Releases
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
李俊赕
wxh-order-h5
Commits
a6b1ddce
Commit
a6b1ddce
authored
May 26, 2020
by
ljd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样式优化
parent
9b28ccb8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
213 deletions
+154
-213
mixin.less
web/src/assets/css/mixin.less
+2
-0
goods.vue
web/src/views/haier/components/goods.vue
+0
-189
cartcontrol.vue
web/src/views/haier/components/goods/cartcontrol.vue
+81
-0
service.vue
web/src/views/haier/order/service.vue
+71
-24
No files found.
web/src/assets/css/mixin.less
0 → 100644
View file @
a6b1ddce
web/src/views/haier/components/goods.vue
deleted
100644 → 0
View file @
9b28ccb8
<
template
>
<div
class=
"goods"
>
<div
class=
"menu-wrapper"
ref=
"menuWrapper"
>
<ul>
<li
v-for=
"(item, index) in goods"
class=
"menu-item"
:class=
"
{'current':currentIndex === index}"
:key="index"
@click="selectMenu(index, $event)"
>
<span
class=
"text border-1px"
>
<span
v-show=
"item.type >0"
class=
"icon"
:class=
"classMap[item.type]"
></span>
{{
item
.
name
}}
</span>
</li>
</ul>
</div>
<div
class=
"foods-wrapper"
ref=
"foodsWrapper"
>
<ul>
<li
v-for=
"(item, index) in goods"
class=
"food-list food-list-hook"
:key=
"index"
>
<h1
class=
"title"
>
{{
item
.
name
}}
</h1>
<ul>
<li
@
click=
"selectFood(food, $event)"
v-for=
"(food, index) in item.foods"
class=
"food-item border-1px"
:key=
"index"
>
<div
class=
"icon"
>
<img
width=
"57"
height=
"57"
:src=
"food.icon"
alt
/>
</div>
<div
class=
"content"
>
<h2
class=
"name"
>
{{
food
.
name
}}
</h2>
<p
class=
"desc"
>
{{
food
.
description
}}
</p>
<div
class=
"extra"
>
<span
class=
"count"
>
月售
{{
food
.
sellCount
}}
份
</span>
<span>
好评率
{{
food
.
rating
}}
%
</span>
</div>
<div
class=
"price"
>
<span
class=
"now"
>
¥
{{
food
.
price
}}
</span>
<span
v-show=
"food.oldPrice"
class=
"old"
>
¥
{{
food
.
oldPrice
}}
</span>
</div>
<div
class=
"cartcontrol-wrapper"
>
<cartcontrol
:food=
"food"
v-on:cart-add=
"_cartAdd"
/>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
</
template
>
<
script
>
import
BScroll
from
'better-scroll'
var
appData
=
require
(
'@/data.json'
)
// var seller = appData.seller
var
goods
=
appData
.
goods
// var ratings = appData.ratings
// import shopcart from '@/components/shopcart/shopcart.vue'
// import cartcontrol from '@/components/cartcontrol/cartcontrol'
// import food from '@/components/food/food'
export
default
{
props
:
{
seller
:
{
type
:
Object
}
},
data
()
{
return
{
goods
:
goods
,
listHeight
:
[],
scrollY
:
0
,
selectedFood
:
{}
}
},
created
()
{
console
.
log
(
'goods'
,
goods
)
},
computed
:
{
currentIndex
()
{
for
(
let
i
=
0
;
i
<
this
.
listHeight
.
length
;
i
++
)
{
const
height1
=
this
.
listHeight
[
i
]
const
height2
=
this
.
listHeight
[
i
+
1
]
if
(
!
height2
||
(
this
.
scrollY
>=
height1
&&
this
.
scrollY
<
height2
)
)
{
return
i
}
}
return
0
},
selectFoods
()
{
const
foods
=
[]
this
.
goods
.
forEach
(
good
=>
{
good
.
foods
.
forEach
(
food
=>
{
if
(
food
.
count
)
{
foods
.
push
(
food
)
}
})
})
return
foods
}
},
created
()
{
this
.
classMap
=
[
'decrease'
,
'discount'
,
'special'
,
'invoice'
,
'guarantee'
]
this
.
$http
.
get
(
'api/goods'
).
then
(
response
=>
{
response
=
response
.
body
if
(
response
.
errno
===
ERR_OK
)
{
this
.
goods
=
response
.
data
this
.
$nextTick
(()
=>
{
this
.
_initScroll
()
this
.
_calculateHeight
()
})
}
})
},
methods
:
{
selectFood
(
food
,
event
)
{
if
(
!
event
.
_constructed
)
{
return
}
this
.
selectedFood
=
food
this
.
$refs
.
food
.
show
()
},
selectMenu
(
index
,
event
)
{
if
(
!
event
.
_constructed
)
{
return
}
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
const
el
=
foodList
[
index
]
this
.
foodsScroll
.
scrollToElement
(
el
,
300
)
},
_drop
(
target
)
{
this
.
nextTick
(()
=>
{
this
.
$refs
.
shopcart
.
_drop
(
target
)
})
},
_initScroll
()
{
this
.
menuScroll
=
new
BScroll
(
this
.
$refs
.
menuWrapper
,
{
click
:
true
})
this
.
foodsScroll
=
new
BScroll
(
this
.
$refs
.
foodsWrapper
,
{
probeType
:
3
,
click
:
true
})
this
.
foodsScroll
.
on
(
'scroll'
,
pos
=>
{
this
.
scrollY
=
Math
.
abs
(
Math
.
round
(
pos
.
y
))
})
},
_calculateHeight
()
{
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
var
height
=
0
this
.
listHeight
.
push
(
height
)
for
(
let
i
=
0
;
i
<
foodList
.
length
;
i
++
)
{
const
item
=
foodList
[
i
]
height
+=
item
.
clientHeight
this
.
listHeight
.
push
(
height
)
}
},
_cartAdd
(
event
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
shopcart
.
drop
(
event
)
})
}
}
// components: {
// shopcart,
// cartcontrol,
// food
// }
}
</
script
>
<
style
lang=
"less"
>
</
style
>
web/src/views/haier/components/goods/cartcontrol.vue
0 → 100644
View file @
a6b1ddce
<
template
>
<div
class=
"cartcontrol"
>
<transition
name =
"move"
>
<div
class=
"cart-decrease cart-btn"
v-show=
"food.count"
@
click
.
stop
.
prevent=
"decreaseCart"
>
-
</div>
</transition>
<div
class=
"cart-count"
v-show=
"food.count"
>
{{
food
.
count
}}
</div>
<div
class=
"cart-add cart-btn"
@
click
.
stop
.
prevent=
"addCart"
>
+
</div>
</div>
</
template
>
<
script
>
import
Vue
from
'vue'
export
default
{
props
:
{
food
:
{
type
:
Object
}
},
created
()
{
},
methods
:
{
addCart
(
event
)
{
if
(
!
this
.
food
.
count
)
{
Vue
.
set
(
this
.
food
,
'count'
,
1
)
}
else
{
this
.
food
.
count
++
}
this
.
$emit
(
'cart-add'
,
event
.
target
)
},
decreaseCart
()
{
if
(
this
.
food
.
count
)
{
this
.
food
.
count
--
}
}
}
}
</
script
>
<
style
lang=
"less"
>
@import '../../../assets/css/func.less';
.cartcontrol{
.cart-decrease{
line-height:px2rem(16)!important;
transition:all 0.4s linear;
&.move-transition{
opacity:1;
transform:translate3d(0, 0, 0);
}
&.move-enter, &.move-leave-to{
opacity:0;
transform:translate3d(px2rem(24), 0, 0);
.inner{
transform:rotate(360deg);
}
}
}
.cart-count{
display:inline-block;
vertical-align:middle;
min-width:px2rem(20);
line-height:px2rem(24);
text-align:center;
font-size:px2rem(14);
color:rgb(147,153,159);
}
.cart-btn{
vertical-align:middle;
display:inline-block;
height:px2rem(20);
font-size:px2rem(20);
line-height:px2rem(18);
width:px2rem(20);
color:rgb(0, 160, 220);
border-radius: 50%;
border:1px solid rgb(0, 160, 220);
}
}
</
style
>
web/src/views/haier/order/service.vue
View file @
a6b1ddce
...
...
@@ -15,10 +15,10 @@
:key="index"
@click="selectMenu(index, $event)"
>
<
span
class=
"text border-1px"
>
<
div
class=
"text border-1px"
>
<span
v-show=
"item.type >0"
class=
"icon"
></span>
{{
item
.
name
}}
</
span
>
</
div
>
</li>
</ul>
</div>
...
...
@@ -33,19 +33,12 @@
class=
"food-item border-1px"
:key=
"index"
>
<div
class=
"icon"
>
<img
width=
"57"
height=
"57"
:src=
"food.icon"
alt
/>
</div>
<div
class=
"content"
>
<h2
class=
"name"
>
{{
food
.
name
}}
</h2>
<p
class=
"desc"
>
{{
food
.
description
}}
</p>
<div
class=
"extra"
>
<span
class=
"count"
>
月售
{{
food
.
sellCount
}}
份
</span>
<span>
好评率
{{
food
.
rating
}}
%
</span>
</div>
<div
class=
"price"
>
<div
class=
"price"
>
指导价:
<span
class=
"now"
>
¥
{{
food
.
price
}}
</span>
<
span
v-show=
"food.oldPrice"
class=
"old"
>
¥
{{
food
.
oldPrice
}}
</span
>
<
!--
<span
v-show=
"food.oldPrice"
class=
"old"
>
¥
{{
food
.
oldPrice
}}
</span>
--
>
</div>
<div
class=
"cartcontrol-wrapper"
>
<cartcontrol
:food=
"food"
v-on:cart-add=
"_cartAdd"
/>
...
...
@@ -62,19 +55,22 @@
<
script
>
import
{
Header
,
Button
}
from
'mint-ui'
import
BScroll
from
'better-scroll'
// var ratings = appData.ratings
// import shopcart from '@/components/shopcart/shopcart.vue'
import
cartcontrol
from
'@/views/haier/components/goods/cartcontrol'
var
appData
=
require
(
'@/data.json'
)
// var seller = appData.seller
var
goods
=
appData
.
goods
// var ratings = appData.ratings
// import shopcart from '@/components/shopcart/shopcart.vue'
// import cartcontrol from '@/components/cartcontrol/cartcontrol'
// import food from '@/components/food/food'
export
default
{
name
:
'HaierOrderService'
,
components
:
{
'mt-header'
:
Header
,
'mt-button'
:
Button
'mt-button'
:
Button
,
// shopcart,
cartcontrol
// food
},
props
:
{
seller
:
{
...
...
@@ -183,18 +179,69 @@ export default {
}
},
_cartAdd
(
event
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
shopcart
.
drop
(
event
)
})
//
this.$nextTick(() => {
//
this.$refs.shopcart.drop(event)
//
})
}
}
// components: {
// shopcart,
// cartcontrol,
// food
// }
}
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
scoped
>
@import '../../../assets/css/func.less';
.goods{
display:flex;
position:absolute;
top:50px;
bottom:46px;
width:100%;
overflow:hidden;
.menu-wrapper{
flex: 0 0 80px;
width: 80px;
background:#f3f5f7;
.menu-item{
padding:0 10px;
width: auto;
line-height: 20px;;
font-size: 12px;
&.current{
position: relative;
z-index: 10;
background: #fff;
font-weight: 700;
}
.text{
display: block;
text-align: center;
line-height:20px;
padding:10px 0;
position: relative;
&:after{
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100%;
border-top: 1px solid rgba(7,17,27,0.1);
content: '';
}
}
}
}
}
.goods .foods-wrapper {-webkit-box-flex:1;-ms-flex:1;flex:1;}
.goods .foods-wrapper .title {padding-left:14px;height:26px;line-height:26px;border-left:2px solid #d9dde1;font-size:12px;color:#93999f;background:#f3f5f7;}
.goods .foods-wrapper .food-item {display:-webkit-box;display:-ms-flexbox;display:flex;margin:18px;padding-bottom:18px;position:relative;}
// .goods .foods-wrapper .food-item .content {-webkit-box-flex:1;-ms-flex:1;flex:1;}
.goods .foods-wrapper .food-item .content .name {margin:2px 0 8px 0;line-height:14px;height:14px;font-size:14px;color:#07111b;}
.goods .foods-wrapper .food-item .content .desc {margin-bottom:8px;line-height:12px;}
.goods .foods-wrapper .food-item .content .desc,.goods .foods-wrapper .food-item .content .extra {font-size:10px;line-height:10px;color:#93999f;}
.goods .foods-wrapper .food-item .content .extra .count {margin-right:12px;}
.goods .foods-wrapper .food-item .content .cartcontrol-wrapper {position:absolute;right:0;bottom:12px;}
.cartcontrol .cart-decrease {display:inline-block;padding:6px;-webkit-transition:all 0.4s linear;transition:all 0.4s linear;}
.cartcontrol .cart-decrease .inner {display:inline-block;font-size:24px;line-height:24px;color:#00a0dc;-webkit-transition:all 0.4s linear;transition:all 0.4s linear;-webkit-transform:rotate(0);transform:rotate(0);}
.cartcontrol .cart-count {display:inline-block;vertical-align:top;width:12px;padding-top:6px;line-height:24px;text-align:center;font-size:10px;color:#93999f;}
.cartcontrol .cart-add {display:inline-block;padding:6px;font-size:24px;line-height:24px;color:#00a0dc;}
</
style
>
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