Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shop_mobile_uni
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
郑秀明
shop_mobile_uni
Commits
165ec619
Commit
165ec619
authored
Mar 30, 2020
by
王建威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
倒计时
parent
48c59aa5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
3 deletions
+101
-3
countDown.vue
components/countDown.vue
+62
-0
search.vue
pages/search/search.vue
+39
-3
No files found.
components/countDown.vue
0 → 100644
View file @
165ec619
<
template
>
<view
class=
"time_box"
v-if=
"flag"
>
<view
class=
"black_bg"
v-if=
"day > 0"
>
{{
day
}}
天
{{
hour
}}
时
</view>
<view
class=
"black_bg"
v-if=
"day === 0 && hour > 0"
>
{{
hour
}}
时
{{
minute
}}
分
</view>
<view
class=
"black_bg"
v-if=
"day === 0 && hour === 0"
>
{{
minute
}}
分
{{
second
}}
秒
</view>
</view>
</
template
>
<
script
>
import
moment
from
'moment'
;
export
default
{
props
:
{
time
:
{
type
:
String
,
default
:
''
}
},
data
()
{
return
{
day
:
''
,
hour
:
''
,
minute
:
''
,
second
:
''
,
flag
:
true
}
},
mounted
()
{
let
timer
=
setInterval
(()
=>
{
const
now
=
moment
(
new
Date
(),
'YYYY-MM-DD HH:mm:ss'
).
format
(
'x'
)
-
0
,
end
=
moment
(
this
.
time
,
'YYYY-MM-DD HH:mm:ss'
).
format
(
'x'
)
-
0
,
du
=
moment
.
duration
(
end
-
now
);
this
.
day
=
du
.
days
();
this
.
hour
=
du
.
hours
();
this
.
minute
=
du
.
minutes
();
this
.
second
=
du
.
seconds
();
if
(
du
.
days
()
<=
0
&&
du
.
hours
()
<=
0
&&
du
.
minutes
()
<=
0
&&
du
.
seconds
()
<=
0
)
{
clearInterval
(
timer
);
this
.
flag
=
false
;
}
},
1000
);
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.time_box {
position: absolute;
left: 26rpx;
top: 40rpx;
z-index: 10;
}
.black_bg {
background:rgba(0,0,0,1);
height: 36rpx;
line-height: 36rpx;
color: #FFFFFF;
font-size: 24rpx;
padding: 0 20rpx;
width: 132rpx;
text-align: center;
}
</
style
>
pages/search/search.vue
View file @
165ec619
...
@@ -44,12 +44,23 @@
...
@@ -44,12 +44,23 @@
<!-- 商品列表 -->
<!-- 商品列表 -->
<view
class=
"goods-list"
v-if=
"goods_list.length > 0"
>
<view
class=
"goods-list"
v-if=
"goods_list.length > 0"
>
<view
class=
"goods-item"
v-for=
"(item,index) in goods_list"
:key=
"index"
>
<view
class=
"goods-item"
v-for=
"(item,index) in goods_list"
:key=
"index"
>
<countDown
v-if=
"item._source.is_pro === 1"
:time=
"item._source.end_time"
></countDown>
<view
class=
"image-outer"
@
click=
"jumpPhpPage(`app=goods&id=$
{item._source.goods_id}`)">
<view
class=
"image-outer"
@
click=
"jumpPhpPage(`app=goods&id=$
{item._source.goods_id}`)">
<image
:src=
"item._source.default_image || $noGoodsImg"
lazy-load
@
error=
"$__reloadResource(item)"
mode=
"aspectFill"
></image>
<image
:src=
"item._source.default_image || $noGoodsImg"
lazy-load
@
error=
"$__reloadResource(item)"
mode=
"aspectFill"
></image>
</view>
</view>
<view
class=
"title"
>
{{
item
.
_source
.
goods_name
}}
</view>
<view
class=
"title"
>
{{
item
.
_source
.
goods_name
}}
</view>
<view
class=
"sub-title"
>
{{
item
.
_source
.
goods_subname
}}
</view>
<view
class=
"sub-title"
>
{{
item
.
_source
.
goods_subname
}}
</view>
<view
v-if=
"isLogin"
class=
"price"
><text
class=
"price-tips"
>
¥
</text>
{{
item
.
_source
.
price
}}
</view>
<view
v-if=
"isLogin"
>
<view
v-if=
"item._source.is_pro === 1"
>
<view
class=
"price"
><text
class=
"price-tips"
>
¥
</text>
{{
item
.
_source
.
pro_price
.
toFixed
(
2
)
}}
<text
class=
"discount"
>
{{
(
item
.
_source
.
pro_price
*
10
/
Number
(
item
.
_source
.
price
)).
toFixed
(
1
)
}}
折
</text>
</view>
<view
class=
"origin_price"
>
¥
{{
item
.
_source
.
price
}}
</view>
</view>
<view
v-if=
"item._source.is_pro === 0"
>
<view
class=
"price"
><text
class=
"price-tips"
>
¥
</text>
{{
item
.
_source
.
price
}}
</view>
</view>
</view>
<view
v-if=
"!isLogin"
class=
"unlogin_price"
>
登录显示价格
</view>
<view
v-if=
"!isLogin"
class=
"unlogin_price"
>
登录显示价格
</view>
<!--
<view
class=
"old-price"
><text
class=
"price-tips"
>
¥
</text>
30.00
</view>
-->
<!--
<view
class=
"old-price"
><text
class=
"price-tips"
>
¥
</text>
30.00
</view>
-->
<image
class=
"cart-icon"
@
click=
"addCart(item._source.default_spec, 1)"
src=
"https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/global/icon_gouwuche%402x.png"
></image>
<image
class=
"cart-icon"
@
click=
"addCart(item._source.default_spec, 1)"
src=
"https://dbc-static.oss-cn-beijing.aliyuncs.com/credit_shop/global/icon_gouwuche%402x.png"
></image>
...
@@ -61,6 +72,7 @@
...
@@ -61,6 +72,7 @@
<
script
>
<
script
>
import
uniIcons
from
"@/components/uni-icons/uni-icons.vue"
;
import
uniIcons
from
"@/components/uni-icons/uni-icons.vue"
;
import
countDown
from
"@/components/countDown.vue"
;
import
uniLoadMore
from
"@/components/uni-load-more/uni-load-more.vue"
;
import
uniLoadMore
from
"@/components/uni-load-more/uni-load-more.vue"
;
import
empty
from
'@/components/empty.vue'
;
import
empty
from
'@/components/empty.vue'
;
import
service
from
'@/components/service.vue'
;
import
service
from
'@/components/service.vue'
;
...
@@ -69,7 +81,8 @@
...
@@ -69,7 +81,8 @@
components
:
{
components
:
{
uniIcons
,
uniIcons
,
empty
,
empty
,
uniLoadMore
uniLoadMore
,
countDown
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -166,6 +179,10 @@
...
@@ -166,6 +179,10 @@
this
.
goods_list
=
[];
this
.
goods_list
=
[];
}
}
this
.
goods_list
=
this
.
goods_list
.
concat
(
data
.
data
);
this
.
goods_list
=
this
.
goods_list
.
concat
(
data
.
data
);
this
.
goods_list
.
map
((
item
,
key
)
=>
{
if
(
item
.
_source
.
is_pro
===
1
&&
new
Date
(
item
.
_source
.
end_time
).
getTime
()
<
new
Date
().
getTime
())
item
.
_source
.
is_pro
=
0
;
});
this
.
isLogin
=
data
.
login_flg
===
1
;
this
.
isLogin
=
data
.
login_flg
===
1
;
const
{
total
,
page_size
,
current
}
=
data
.
page
;
const
{
total
,
page_size
,
current
}
=
data
.
page
;
this
.
param
.
current
=
current
;
this
.
param
.
current
=
current
;
...
@@ -386,10 +403,29 @@
...
@@ -386,10 +403,29 @@
height: 44rpx;
height: 44rpx;
line-height: 44rpx;
line-height: 44rpx;
font-size: 32rpx;
font-size: 32rpx;
color: #
212121
;
color: #
AE8A57
;
.price-tips{
.price-tips{
font-size: 26rpx;
font-size: 26rpx;
}
}
.discount {
display: inline-block;
padding: 0 14rpx;
height: 28rpx;
line-height: 28rpx;
text-align: center;
background:rgba(254,244,232,1);
color: #AE8A57;
font-size: 20rpx;
margin-left: 8px;
position: relative;
top: -4rpx;
}
}
.origin_price {
color: #aeaeae;
font-size: 24rpx;
line-height: 34rpx;
text-decoration: line-through;
}
}
.old-price{
.old-price{
height: 34rpx;
height: 34rpx;
...
...
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