Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-shop-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-shop-show-h5
Commits
d45b0574
提交
d45b0574
authored
6月 03, 2021
作者:
pengxiaohui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改bug
上级
26d9bd73
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
122 行增加
和
65 行删除
+122
-65
AppSearchBar.vue
src/components/AppSearchBar.vue
+34
-22
index.vue
src/pages/buy/index.vue
+42
-15
index.vue
src/pages/home/index.vue
+40
-22
axios.js
src/utils/axios.js
+6
-6
没有找到文件。
src/components/AppSearchBar.vue
浏览文件 @
d45b0574
<
template
>
<div
class=
"search-bar"
>
<form
action
@
submit
.
prevent=
"onSearch"
>
<div
class=
"inner"
>
<input
type=
"search"
class=
"search-input"
:placeholder=
"placeholder"
v-model=
"currentValue"
v-bind=
"$attrs"
@
input=
"onChange"
ref=
"formInput"
/>
<div
class=
"search-icon"
></div>
</div>
</form>
</div>
<van-sticky
class=
"search-cont"
>
<div
class=
"search-bar"
>
<form
action
@
submit
.
prevent=
"onSearch"
>
<div
class=
"inner"
>
<div
class=
"search-icon"
></div>
<input
type=
"search"
class=
"search-input"
:placeholder=
"placeholder"
v-model=
"currentValue"
v-bind=
"$attrs"
@
input=
"onChange"
ref=
"formInput"
/>
</div>
</form>
</div>
</van-sticky>
</
template
>
<
script
>
...
...
@@ -59,8 +61,10 @@ export default {
</
script
>
<
style
lang=
"scss"
>
.search-bar
{
padding
:
0
.2rem
0
0
;
.inner
{
display
:
flex
;
background
:
#fff
;
border-radius
:
0
.33rem
;
}
.search-input
{
display
:
block
;
...
...
@@ -83,9 +87,17 @@ export default {
background
:url
(
'https://webapp-pub.oss-cn-beijing.aliyuncs.com/shop-h5/icon_search.png'
)
no-repeat
center
center
;
background-size
:
0
.4rem
0
.4rem
;
}
.inner
{
display
:
flex
;
background
:
#fff
;
border-radius
:
0
.33rem
;
.search-cont
{
.van-sticky
{
padding
:
0
.2rem
0
.3rem
0
.3rem
;
}
.van-sticky--fixed
{
background
:
#fff
;
box-shadow
:
0
8px
12px
#ebedf0
;
.inner
,
.search-input
{
background
:
#f7f7f7
;
}
}
}
</
style
>
src/pages/buy/index.vue
浏览文件 @
d45b0574
...
...
@@ -30,11 +30,12 @@
</div>
</div>
<div
class=
"item shop-item"
>
<van-cell
value=
"进
点
逛逛"
is-link
@
click=
"navShop(shopInfo.shop_id)"
>
<van-cell
value=
"进
店
逛逛"
is-link
@
click=
"navShop(shopInfo.shop_id)"
>
<!-- 使用 title 插槽来自定义标题 -->
<template
#
title
>
<img
class=
"shop-logo"
:src=
"shopInfo.shop_logo"
>
<span>
{{
shopInfo
.
shop_name
}}
</span>
<!--
<span
class=
"van-ellipsis"
>
{{
shopInfo
.
shop_name
}}
</span>
-->
<span
class=
"shop-name van-ellipsis"
>
进店逛逛进店逛逛进店逛逛进店逛逛进店逛逛
</span>
</
template
>
</van-cell>
</div>
...
...
@@ -124,8 +125,6 @@ export default {
if
(
isLogin
)
{
if
(
this
.
isWxBrowser
)
{
this
.
payment_method
=
'3'
}
else
{
this
.
payment_method
=
'4'
}
this
.
popupVisiable
=
true
}
else
{
...
...
@@ -240,24 +239,25 @@ export default {
padding
:
0
.3rem
0
.35rem
;
}
.price-item
{
line-height
:
24px
;
line-height
:
0
.48rem
;
h6
{
color
:
#C01540
;
line-height
:
32px
;
font-size
:
18px
;
line-height
:
0
.64rem
;
font-size
:
0
.36rem
;
span
{
font-size
:
12px
;
font-size
:
0
.24rem
;
}
}
p
{
display
:flex
;
.title
{
flex
:
1
;
font-size
:
0
.28rem
;
}
.surplus
{
line-height
:
24px
;
line-height
:
0
.48rem
;
color
:
#B4B4B4
;
font-size
:
13px
;
font-size
:
0
.26rem
;
}
}
}
...
...
@@ -265,6 +265,7 @@ export default {
div
{
display
:flex
;
line-height
:
0
.8rem
;
font-size
:
0
.26rem
;
span
{
width
:
1rem
;
color
:
#9B9B9B
;
...
...
@@ -287,16 +288,41 @@ export default {
}
.shop-item
{
.van-cell
{
width
:
100%
;
padding
:
0
.2rem
0
;
}
.shop-logo
{
width
:
0
.8rem
;
height
:
0
.8rem
;
border-radius
:
0
.1rem
;
line-height
:
0
.8rem
;
align-items
:center
;
::v-deep
.van-cell__title
{
display
:flex
;
width
:
calc
(
100%
-
1
.6rem
);
.shop-logo
{
width
:
0
.8rem
;
height
:
0
.8rem
;
border-radius
:
0
.1rem
;
}
.shop-name
{
width
:calc
(
100
%
-
0
.8rem
)
;
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
font-size
:
0
.28rem
;
margin
:
0
0
.1rem
;
}
}
::v-deep
.van-cell__value
{
flex
:
unset
;
font-size
:
0
.28rem
;
width
:
1
.4rem
;
}
}
}
.bottom-bar
{
padding
:
0
.2rem
0
.8rem
;
background
:
#fff
;
.van-button
{
height
:
0
.64rem
;
line-height
:
0
.64rem
;
font-size
:
0
.24rem
;
}
}
</
style
>
\ No newline at end of file
src/pages/home/index.vue
浏览文件 @
d45b0574
<
template
>
<div
class=
"main-container"
>
<app-search-bar
readonly
@
click
.
native=
"toSearch"
/>
<div
class=
"notice"
>
<app-search-bar
v-model=
"search"
@
change=
"handleSearchChange"
/>
<
!--
<
div
class=
"notice"
>
<van-notice-bar
color=
"#333"
background=
"transparent"
scrollable
text=
"技术是开发它的人的共同灵魂。"
>
<template
slot=
"left-icon"
>
<span
class=
"left-title"
style=
""
>
公告
</span>
</
template
>
</van-notice-bar>
</div>
<van-swipe
class=
"my-swipe"
:autoplay=
"3000"
indicator-color=
"white"
>
</div>
-->
<
!-- <
van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
<van-swipe-item>1</van-swipe-item>
<van-swipe-item>2</van-swipe-item>
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
</van-swipe>
</van-swipe>
-->
<ul
class=
"goods-list"
>
<li
class=
"goods-item"
v-for=
"item in goodsList"
:key=
"item.id"
@
click=
"handleClick(item)"
>
<div
class=
"thumb"
>
...
...
@@ -22,12 +22,13 @@
<div
class=
"content"
>
<div
class=
"top"
>
<div
class=
"price"
>
¥
<span>
{{item.price_zone}}
</span></div>
<div
class=
"right-tag"
>
剩余{{item.stock}}件
</div>
<div
class=
"right-tag"
>
{{item.sales_volume}}人付款
</div>
</div>
<p
class=
"title van-ellipsis"
>
{{item.spu_name}}
</p>
</div>
</li>
</ul>
<van-empty
description=
"暂无商品"
v-if=
"goodsList.length === 0"
/>
</div>
</template>
<
script
>
...
...
@@ -38,19 +39,28 @@ export default {
components
:
{
AppSearchBar
},
data
()
{
return
{
search
:
''
,
goodsList
:
[]
}
},
computed
:
{
shop_id
()
{
const
query
=
this
.
$route
.
query
return
query
.
shop_id
||
'6800681447305773056'
query
()
{
return
this
.
$route
.
query
},
shop_id
()
{
return
this
.
query
.
shop_id
||
'6800681447305773056'
},
group_id
()
{
return
this
.
query
.
group_id
||
''
}
},
methods
:
{
handleClick
(
val
)
{
this
.
$router
.
push
({
path
:
'buy'
,
query
:
{
spu_id
:
val
.
spu_id
,
shop_id
:
val
.
shop_id
}
})
},
handleSearchChange
()
{
this
.
fetchGetList
()
},
imgJsonParse
(
val
)
{
if
(
typeof
val
===
'string'
&&
typeof
JSON
.
parse
(
val
)
===
'object'
)
{
const
[
first
=
{}]
=
JSON
.
parse
(
val
)
...
...
@@ -61,11 +71,16 @@ export default {
},
fetchGetList
()
{
const
params
=
{
shop_id
:
this
.
shop_id
shop_id
:
this
.
shop_id
,
group_id
:
this
.
group_id
,
spu_name
:
this
.
search
,
status
:
'2'
}
getGoodsList
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
0
&&
res
.
msg
===
'成功'
)
{
this
.
goodsList
=
res
.
data
}
else
{
this
.
goodsList
=
[]
}
})
}
...
...
@@ -99,18 +114,20 @@ export default {
background
:
#fff
;
position
:relative
;
box-sizing
:border-box
;
padding
:
2
.6vw
0
2
.6vw
30vw
;
height
:
26vw
;
margin-bottom
:
15px
;
border-radius
:
3px
;
padding
:
0
.2rem
0
0
.2rem
3rem
;
height
:
2rem
;
margin-bottom
:
0
.3rem
;
border-radius
:
0
.06rem
;
cursor
:
pointer
;
.thumb
{
width
:
2
6vw
;
height
:
2
6vw
;
width
:
2
rem
;
height
:
2
rem
;
position
:absolute
;
left
:
0
;
top
:
0
;
img
{
width
:
80%
;
height
:
80%
;
display
:block
;
margin
:
10%
auto
;
}
...
...
@@ -119,26 +136,27 @@ export default {
display
:flex
;
flex-direction
:column
;
height
:
100%
;
padding-right
:
10px
;
padding-right
:
0
.2rem
;
.top
{
line-height
:
30px
;
line-height
:
0
.6rem
;
flex
:
1
;
display
:flex
;
.price
{
color
:
#C01540
;
font-size
:
12px
;
font-size
:
0
.24rem
;
flex
:
1
;
span
{
font-size
:
20px
;
font-size
:
0
.4rem
;
}
}
.right-tag
{
font-size
:
13px
;
font-size
:
0
.26rem
;
color
:
#b5b5b5
;
}
}
.title
{
line-height
:
32px
;
line-height
:
0
.64rem
;
font-size
:
0
.28rem
;
}
}
}
...
...
src/utils/axios.js
浏览文件 @
d45b0574
...
...
@@ -34,12 +34,12 @@ httpRequest.interceptors.request.use(
httpRequest
.
interceptors
.
response
.
use
(
function
(
response
)
{
const
{
data
}
=
response
if
(
data
.
code
)
{
// if (![1010, 1001].includes(data.code)) {
// Toast.fail(data.msg || data.message)
// }
return
Promise
.
reject
(
data
)
}
//
if (data.code) {
//
// if (![1010, 1001].includes(data.code)) {
//
// Toast.fail(data.msg || data.message)
//
// }
//
return Promise.reject(data)
//
}
return
data
},
function
(
error
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论