Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖康
/
H5_2.0
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9b9e739d
authored
May 24, 2023
by
肖康
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
搜索页面修改
parent
49e40f44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
265 additions
and
91 deletions
pages/search/searchlist.vue
pages/search/searchlist.vue
View file @
9b9e739d
...
...
@@ -13,108 +13,64 @@
</navigator>
</view>
<view
class=
"shiftbox row avarage"
>
<view
class=
"rank1 row "
>
综合
</view>
<view
class=
"rank2 row sjpx
act top
"
>
库存
</view>
<view
class=
"rank3 row sjpx
act bot
"
>
价格
</view>
<view
class=
"rank1 row "
@
click=
"tab(1)"
:class=
"
{'act':tabType==1}"
>综合
</view>
<view
class=
"rank2 row sjpx
"
@
click=
"tab(2)"
:class=
"
{'act':tabType==2,'top':stocksort,'bot':(!stocksort)}
">库存
</view>
<view
class=
"rank3 row sjpx
"
@
click=
"tab(3)"
:class=
"
{'act':tabType==3,'top':pricesort,'bot':(!pricesort)}
">价格
</view>
<view
class=
"sxbox row"
@
click=
"opensx()"
>
筛选
<text
class=
"icon iconfont icon-sxs"
></text></view>
</view>
</view>
<view
class=
"cons"
>
<view
class=
"databox"
>
<view
class=
"databoxgroup"
>
<view
class=
"databoxgroup"
v-for=
"(item,index) in list"
:key=
"index"
v-show=
"item.isshow"
>
<view
class=
"grouphead row bothSide"
>
<view
class=
"row"
>
<image
src=
"https://img.ichunt.com/images/cms/202101/18/9b017ebeeb8594aeb3c0490272128ab2.jpg"
>
</image>
<text>
Mouser
</text>
<image
:src=
"item.supplier_logo"
v-if=
"item.supplier_logo"
>
</image>
<text>
{{
item
.
supplier_name
}}
</text>
</view>
<a
href=
""
class=
"elep"
>
啊实打实大苏打啊实打实阿斯顿萨达啊实打实
</a>
<a
:href=
"item.supplier_ad.url"
class=
"elep"
target=
"_blank"
v-if=
"item.supplier_ad"
>
{{
item
.
supplier_ad
.
ad
}}
</a>
</view>
<view
class=
"group"
>
<view
class=
"group"
v-for=
"(item1,index1) in item.data"
:key=
"index1"
v-show=
"item1.isshow"
>
<view
class=
"toprs1 row bothSide"
>
<navigator
url=
"#
"
class=
"row"
>
<view
class=
"goodsName elep"
>
LM358adsasd
</view>
<view
class=
"actag"
>
95折
</view>
<navigator
:url=
"'/item?goods_id='+item1.goods_id
"
class=
"row"
>
<view
class=
"goodsName elep"
>
{{
item1
.
goods_name_org
||
item1
.
goods_name
}}
</view>
<view
class=
"actag"
v-if=
"item1.ac_type==10"
>
{{
item1
.
activity_info
.
sign
}}
</view>
</navigator>
<view
class=
"addcar"
style=
"display:none;"
@
click=
"addcarpopfunc('10001'
)"
>
加入购物车
</view>
<
view
class=
"kfbtns"
@
click=
"addcarpopfunc('10001')"
>
联系客服
</view
>
<view
class=
"addcar"
v-if=
"item1.is_buy==1"
@
click=
"addcarpopfunc(item1.goods_id
)"
>
加入购物车
</view>
<
a
class=
"kfbtns"
:href=
"kfqqurl"
target=
"_blank"
v-if=
"item1.is_buy!=1"
>
联系客服
</a
>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
ST
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
600
</view>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
{{
item1
.
standard_brand_name
||
item1
.
brand_name
}}
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
{{
item1
.
moq
}}
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
mouser
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
6000000
</view>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
{{
item1
.
supplier_name
}}
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
{{
item1
.
stock
}}
</view>
</view>
<view
class=
"toprs3 row bothSide"
>
<view
class=
"row"
>
<text
class=
"labelsd"
>
价格:
</text>
<view
class=
"row priceb"
>
<text
class=
"p1"
>
660
+
</text>
<text
class=
"p2"
>
¥
130.86
</text>
<text
class=
"p3"
>
$
130.86
</text>
<view
class=
"row priceb"
v-if=
"item1.ladder_price.length>0"
>
<text
class=
"p1"
>
{{
item1
.
ladder_price
[
0
].
purchases
}}
+
</text>
<text
class=
"p2"
>
¥
{{
item1
.
ladder_price
[
0
].
price_ac
||
item1
.
ladder_price
[
0
].
price_cn
||
'--'
}}
</text>
<text
class=
"p3"
>
$
{{
item1
.
ladder_price
[
0
].
price_ac_us
||
item1
.
ladder_price
[
0
].
price_us
||
'--'
}}
</text>
</view>
</view>
<text
class=
"labelsd"
@
click=
"addcarpopfunc('10001')"
>
更多阶梯价
<text
class=
"icon iconfont icon-arrbot"
></text></text>
</view>
</view>
</view>
<view
class=
"databoxgroup"
>
<view
class=
"grouphead row bothSide"
>
<view
class=
"row"
>
<image
src=
"https://img.ichunt.com/images/cms/202101/18/9b017ebeeb8594aeb3c0490272128ab2.jpg"
>
</image>
<text>
Mouser
</text>
</view>
<a
href=
""
class=
"elep"
>
啊实打实大苏打啊实打实阿斯顿萨达啊实打实
</a>
</view>
<view
class=
"group"
>
<view
class=
"toprs1 row bothSide"
>
<navigator
url=
"#"
class=
"row"
>
<view
class=
"goodsName elep"
>
LM358adsasd
</view>
<view
class=
"actag"
>
95折
</view>
</navigator>
<view
class=
"addcar"
style=
"display:none;"
@
click=
"addcarpopfunc('10001')"
>
加入购物车
</view>
<view
class=
"kfbtns"
@
click=
"addcarpopfunc('10001')"
>
联系客服
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
ST
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
起订量:
</text>
600
</view>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
供应商:
</text>
mouser
</view>
<view
class=
"r2 elep"
><text
class=
"labelsd"
>
库存:
</text>
6000000
</view>
</view>
<view
class=
"toprs3 row bothSide"
>
<view
class=
"row"
>
<text
class=
"labelsd"
>
价格:
</text>
<view
class=
"row priceb"
>
<text
class=
"p1"
>
660+
</text>
<text
class=
"p2"
>
¥130.86
</text>
<text
class=
"p3"
>
$130.86
</text>
</view>
</view>
<text
class=
"labelsd"
@
click=
"addcarpopfunc('10001')"
>
更多阶梯价
<text
<text
class=
"labelsd"
v-if=
"item1.ladder_price.length>0"
@
click=
"addcarpopfunc(item1.goods_id)"
>
更多阶梯价
<text
class=
"icon iconfont icon-arrbot"
></text></text>
</view>
</view>
</view>
</view>
<view
class=
"pagebot"
v-show=
"list.length>0"
>
—— 已经到底了 ——
</view>
<view
class=
"nodatabox"
v-show=
"
list.length==0
"
>
<view
class=
"pagebot"
v-show=
"list.length>0
&&!isNOdata
"
>
—— 已经到底了 ——
</view>
<view
class=
"nodatabox"
v-show=
"
isNOdata
"
>
<image
src=
"https://img.ichunt.com/images/ichunt/202304/10/d502aef8d15d42187482a48915196270.png"
>
</image>
<view>
抱歉,没有找到商品,您可以直接咨询客服
</view>
<
view
class=
"kfqqbtns
"
>
<
a
class=
"kfqqbtns"
:href=
"kfqqurl"
target=
"_blank
"
>
<text
class=
"icon iconfont icon-qq"
></text>
联系客服
</
view
>
</
a
>
</view>
</view>
...
...
@@ -130,34 +86,24 @@
<view
class=
"popcons"
>
<view
class=
"tpt row bothSide"
>
<text>
供应商
</text>
<text
class=
"cleartj"
>
清除条件
</text>
<text
class=
"cleartj"
@
click=
"clearshift(2)"
>
清除条件
</text>
</view>
<view
class=
"tpo row"
>
<view
class=
"toitem act"
>
TI
</view>
<view
class=
"toitem"
>
MOUSEKJLJL
</view>
<view
class=
"toitem"
>
国内现货
</view>
<view
class=
"toitem"
>
TI
</view>
<view
class=
"toitem"
>
MOUSEKJLJL
</view>
<view
class=
"toitem"
>
国内现货
</view>
<view
class=
"toitem "
@
click=
"chooseShit(item.name,2)"
:class=
"
{'act':item.checked}" v-for="(item,index) in supplierArr" :key="index">
{{
item
.
name
}}
</view>
</view>
</view>
<view
class=
"popcons"
>
<view
class=
"tpt row bothSide"
>
<text>
品牌
</text>
<text
class=
"cleartj"
>
清除条件
</text>
<text
class=
"cleartj"
@
click=
"clearshift(1)"
>
清除条件
</text>
</view>
<view
class=
"tpo row"
>
<view
class=
"toitem act"
>
TI
</view>
<view
class=
"toitem"
>
MOUSEKJLJL
</view>
<view
class=
"toitem"
>
国内现货
</view>
<view
class=
"toitem"
>
TI
</view>
<view
class=
"toitem"
>
MOUSEKJLJL
</view>
<view
class=
"toitem"
>
国内现货
</view>
<view
class=
"toitem "
@
click=
"chooseShit(item.name,1)"
:class=
"
{'act':item.checked}" v-for="(item,index) in brandArr" :key="index">
{{
item
.
name
}}
</view>
</view>
</view>
<view
class=
"foot row bothSide"
>
<view
class=
"cz"
>
重置
</view>
<view
class=
"cx"
@
click
.
stop=
"searchgo
"
>
查询
</view>
<view
class=
"cz"
@
click=
"clearshift()"
>
重置
</view>
<view
class=
"cx"
@
click
=
"searchGO()
"
>
查询
</view>
</view>
</view>
...
...
@@ -170,18 +116,31 @@
</
template
>
<
script
>
import
{
Ichunt_Api
,
Api_Url
,
Api_Es
,
Api_ES_Go
}
from
'@/util/api.js'
;
const
EsUrl
=
"//so12.ichunt.com"
//Api_Es
import
addCar
from
'@/components/addcar.vue'
;
export
default
{
data
()
{
return
{
kfqqurl
:
""
,
searchVal
:
""
,
//搜索值
list
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
]
list
:[],
//搜索数据
limit
:
10
,
//
SEARCH_SUPPLIER_SINGLE
:
""
,
//供应商渠道
loadcount
:
0
,
//记录加载数据次数
isNOdata
:
0
,
//是否加载完没有数据
supplierArr
:[],
brandArr
:[],
brand_
:[],
tabType
:
1
,
stocksort
:
false
,
//库存升序 false 降序
pricesort
:
false
,
//价格升序 false 降序
}
},
onLoad
:
function
(
option
)
{
this
.
searchVal
=
option
.
k
;
this
.
setHistoryItems
(
this
.
searchVal
)
console
.
log
(
this
.
searchVal
);
this
.
getData
()
},
methods
:
{
//创建历史搜索缓存 最大10个
...
...
@@ -203,10 +162,225 @@
}
},
getData
()
{
this
.
request
(
Ichunt_Api
+
"/api/common/data"
,
'GET'
,
{},
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
SEARCH_SUPPLIER_SINGLE
=
res
.
data
.
SEARCH_SUPPLIER_SINGLE
;
this
.
kfqqurl
=
res
.
data
.
kfqq_xk
.
data
this
.
getSupplierData
()
}
});
},
tab
(
type
){
this
.
tabType
=
type
;
if
(
type
==
2
){
this
.
stocksort
=!
this
.
stocksort
}
if
(
type
==
3
){
this
.
pricesort
=!
this
.
pricesort
}
},
//品牌供应商搜索
searchGO
(){
//供应商
let
checksupplier
=
[];
this
.
supplierArr
.
forEach
(
item
=>
{
if
(
item
.
checked
){
checksupplier
.
push
(
item
.
name
)
}
})
this
.
list
.
forEach
(
item
=>
{
if
(
checksupplier
.
length
==
0
){
item
.
isshow
=
true
}
else
{
if
(
checksupplier
.
indexOf
(
item
.
supplier_name
)
!=-
1
){
item
.
isshow
=
true
}
else
{
item
.
isshow
=
false
}
}
})
//品牌
let
checkbrand
=
[];
this
.
brandArr
.
forEach
(
item
=>
{
if
(
item
.
checked
){
checkbrand
.
push
(
item
.
name
)
}
})
let
issupplier_show
=
0
;
this
.
list
.
forEach
(
item
=>
{
var
isnobrand
=
0
;
item
.
data
.
forEach
(
item1
=>
{
if
(
checkbrand
.
length
==
0
){
item1
.
isshow
=
true
}
else
{
let
brand_name_
=
(
item1
.
standard_brand_name
||
item1
.
brand_name
)
if
(
checkbrand
.
indexOf
(
brand_name_
)
!=-
1
){
item1
.
isshow
=
true
isnobrand
=
1
}
else
{
item1
.
isshow
=
false
}
}
})
if
(
checkbrand
.
length
!=
0
){
if
(
!
isnobrand
){
item
.
isshow
=
false
}
}
if
(
item
.
isshow
){
issupplier_show
=
1
;
}
})
if
(
!
issupplier_show
){
this
.
isNOdata
=
true
}
else
{
this
.
isNOdata
=
false
}
this
.
closesx
();
},
searchgo
()
{
this
.
shiftPopShow
=
!
this
.
shiftPopShow
;
//choos参数
chooseShit
(
name_
,
type
){
if
(
type
==
1
){
this
.
brandArr
.
forEach
(
item
=>
{
if
(
item
.
name
==
name_
){
item
.
checked
=
true
}
})
}
else
if
(
type
==
2
){
this
.
supplierArr
.
forEach
(
item
=>
{
if
(
item
.
name
==
name_
){
item
.
checked
=
true
}
})
}
},
//清楚品牌参数 供应商参数
clearshift
(
type
){
if
(
type
==
1
){
this
.
brandArr
.
forEach
(
item
=>
{
item
.
checked
=
false
})
}
else
if
(
type
==
2
){
this
.
supplierArr
.
forEach
(
item
=>
{
item
.
checked
=
false
})
}
else
{
this
.
brandArr
.
forEach
(
item
=>
{
item
.
checked
=
false
})
this
.
supplierArr
.
forEach
(
item
=>
{
item
.
checked
=
false
})
}
},
getBrandAndSupplier
:
function
(
obj
){
//供应商处理
let
itemmap
=
new
Map
();
itemmap
.
set
(
obj
.
supplier_name
,
false
)
itemmap
.
forEach
((
el
,
key
)
=>
{
let
is_
=
{
name
:
key
,
checked
:
false
}
if
(
key
==
"国内现货"
){
this
.
supplierArr
.
unshift
(
is_
)
}
else
if
(
key
==
"猎芯期货"
){
this
.
supplierArr
.
push
(
is_
)
}
else
{
this
.
supplierArr
.
splice
(
1
,
0
,
is_
);
}
})
//品牌处理
obj
.
data
.
forEach
(
item
=>
{
let
keys_
=
(
item
.
standard_brand_name
||
item
.
brand_name
)
this
.
brand_
.
push
(
keys_
);
this
.
brand_
=
[...
new
Set
(
this
.
brand_
)]
})
this
.
brandArr
=
[]
this
.
brand_
.
forEach
(
item
=>
{
this
.
brandArr
.
push
({
name
:
item
,
checked
:
false
})
})
},
getSupplierData
(){
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
).
forEach
((
item
)
=>
{
if
(
item
==
46001
||
item
==
46002
||
item
==
46003
){
let
goods_label
=
item
.
split
(
""
)[
item
.
length
-
1
];
this
.
request
(
EsUrl
+
"/search/label/index"
,
'GET'
,
{
offset
:
this
.
limit
,
keyword
:
this
.
searchVal
,
goods_label
:
goods_label
,
source
:
"search"
}).
then
(
res
=>
{
this
.
loadcount
++
;
if
(
res
.
error_code
==
0
)
{
let
obj_
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
obj_
.
supplier_id
=
item
if
(
item
==
46001
){
obj_
.
supplier_name
=
"国内现货"
}
else
if
(
item
==
46002
){
obj_
.
supplier_name
=
"国际现货"
}
else
if
(
item
==
46003
){
obj_
.
supplier_name
=
"猎芯期货"
}
obj_
.
isshow
=
true
;
obj_
.
data
.
forEach
(
it
=>
{
it
.
isshow
=
true
})
if
(
obj_
.
supplier_name
==
"国内现货"
){
this
.
list
.
unshift
(
obj_
)
}
else
if
(
obj_
.
supplier_name
==
"猎芯期货"
){
this
.
list
.
push
(
obj_
)
}
else
{
this
.
list
.
splice
(
1
,
0
,
obj_
);
}
this
.
getBrandAndSupplier
(
obj_
)
}
//数据加载完
if
(
this
.
loadcount
==
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
)){
if
(
this
.
list
.
length
==
0
){
this
.
isNOdata
=
1
;
}
}
});
}
else
{
this
.
request
(
EsUrl
+
"/search/getData/index"
,
'GET'
,
{
supplier_id
:
item
,
offset
:
this
.
limit
,
keyword
:
this
.
searchVal
,
source
:
"search"
}).
then
(
res
=>
{
this
.
loadcount
++
;
if
(
res
.
error_code
==
0
)
{
if
(
item
==
0
){
let
obj_
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
obj_
.
forEach
((
item
)
=>
{
item
.
isshow
=
true
item
.
data
.
forEach
(
it
=>
{
it
.
isshow
=
true
})
})
this
.
list
=
this
.
list
.
concat
(
obj_
);
obj_
.
forEach
((
item
)
=>
{
this
.
getBrandAndSupplier
(
item
)
})
}
else
{
let
obj_
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
))
obj_
.
isshow
=
true
;
obj_
.
data
.
forEach
(
it
=>
{
it
.
isshow
=
true
})
this
.
list
.
push
(
obj_
);
this
.
getBrandAndSupplier
(
obj_
)
}
}
//数据加载完
if
(
this
.
loadcount
==
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
)){
if
(
this
.
list
.
length
==
0
){
this
.
isNOdata
=
1
;
}
}
});
}
})
},
addcarpopfunc
(
goods_id
)
{
this
.
$refs
.
addCarPop
.
addcarpopfunc
(
goods_id
);
...
...
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