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
047475bb
Commit
047475bb
authored
Jun 08, 2020
by
ljd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内容滚动初始化
parent
11477121
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
20 deletions
+40
-20
cartcontrol.vue
web/src/views/pc/haier/components/goods/cartcontrol.vue
+9
-8
shopcart.vue
web/src/views/pc/haier/components/goods/shopcart.vue
+1
-1
service.vue
web/src/views/pc/haier/order/service.vue
+30
-11
No files found.
web/src/views/pc/haier/components/goods/cartcontrol.vue
View file @
047475bb
...
...
@@ -9,7 +9,7 @@
<input
class=
"input"
maxlength=
"10"
v-model=
"food.count"
type=
"number"
/>
<!--
{{
food
.
count
}}
-->
</div>
<div
class=
"cart-add cart-btn"
@
click=
"addCart"
>
+
</div>
<div
class=
"cart-add cart-btn"
@
click
.
stop
.
prevent
=
"addCart"
>
+
</div>
</div>
</
template
>
...
...
@@ -26,16 +26,16 @@ export default {
},
methods
:
{
addCart
(
event
)
{
console
.
log
(
event
,
'event'
)
console
.
log
(
event
,
'event'
)
// if (!event._constructed) {
// return
// }
//
if (!this.food.count) {
//
Vue.set(this.food, 'count', 1)
//
} else {
//
this.food.count++
//
}
//
this.$emit('cart-add', event.target)
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
)
{
...
...
@@ -79,6 +79,7 @@ export default {
input{font-size:px2px(24);max-width:px2px(150);border-bottom:1px solid #aeb0b3;text-align: center;}
}
.cart-btn{
cursor: pointer;
vertical-align:middle;
display:inline-block;
height:px2px(40);
...
...
web/src/views/pc/haier/components/goods/shopcart.vue
View file @
047475bb
...
...
@@ -48,7 +48,7 @@
<
script
>
import
BScroll
from
'better-scroll'
import
cartcontrol
from
'@/views/
h5
/haier/components/goods/cartcontrol'
import
cartcontrol
from
'@/views/
pc
/haier/components/goods/cartcontrol'
export
default
{
components
:
{
cartcontrol
...
...
web/src/views/pc/haier/order/service.vue
View file @
047475bb
...
...
@@ -58,10 +58,11 @@ import {
getVap
}
from
'@/api/haier/order/service'
import
{
Toast
,
Indicator
}
from
'mint-ui'
import
BScroll
from
'better-scroll'
import
shopcart
from
'@/views/
h5
/haier/components/goods/shopcart.vue'
import
cartcontrol
from
'@/views/
h5
/haier/components/goods/cartcontrol'
import
shopcart
from
'@/views/
pc
/haier/components/goods/shopcart.vue'
import
cartcontrol
from
'@/views/
pc
/haier/components/goods/cartcontrol'
export
default
{
name
:
'HaierOrderService'
,
components
:
{
...
...
@@ -119,6 +120,7 @@ export default {
computed
:
{
},
created
()
{
this
.
scrollY
=
0
if
(
this
.
$route
.
query
.
orderId
)
{
this
.
inApp
=
false
this
.
getOrderId
(
this
.
$route
.
query
.
orderId
)
...
...
@@ -137,6 +139,19 @@ export default {
},
methods
:
{
foodPageScorll
()
{
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
const
foodWrapper
=
document
.
getElementsByClassName
(
'foods-wrapper'
)
console
.
log
(
foodWrapper
,
'foodWrapper'
)
foodWrapper
[
0
].
addEventListener
(
'scroll'
,
el
=>
{
this
.
scrollY
=
foodWrapper
[
0
].
scrollTop
})
},
getOrderId
(
orderId
)
{
this
.
orderId
=
orderId
||
'6099514'
this
.
getList
()
...
...
@@ -191,10 +206,11 @@ export default {
})
return
false
}
// this.$nextTick(() => {
// this._initScroll()
// this._calculateHeight()
// })
this
.
$nextTick
(()
=>
{
this
.
foodPageScorll
()
// this._initScroll()
this
.
_calculateHeight
()
})
}).
catch
((
error
)
=>
{
this
.
loading
=
false
Indicator
.
close
()
...
...
@@ -209,9 +225,9 @@ export default {
this
.
$refs
.
food
.
show
()
},
selectMenu
(
index
,
event
)
{
if
(
!
event
.
_constructed
)
{
return
}
//
if (!event._constructed) {
//
return
//
}
const
foodList
=
this
.
$refs
.
foodsWrapper
.
getElementsByClassName
(
'food-list-hook'
)
...
...
@@ -226,7 +242,8 @@ export default {
el
=
foodList
[
foodList
.
length
-
1
]
}
this
.
currentTime
=
new
Date
().
getTime
()
this
.
foodsScroll
.
scrollToElement
(
el
,
0
)
window
.
scrollTo
(
0
,
1000
)
// this.foodsScroll.scrollToElement(el, 0)
},
_initScroll
()
{
this
.
menuScroll
=
new
BScroll
(
this
.
$refs
.
menuWrapper
,
{
...
...
@@ -355,5 +372,7 @@ export default {
.cartcontrol .cart-add {display:inline-block;padding:6px;font-size:24px;line-height:24px;color:#00a0dc;}
// only for pc
.goods .foods-wrapper{overflow: auto;}
.goods .menu-wrapper{overflow: auto;}
.goods .menu-wrapper .menu-item{cursor: pointer;}
</
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