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
dd82e9fa
authored
May 25, 2023
by
LJM
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://git.ichunt.net/xiaokang/H5_2.0
parents
f4ccffe9
ae34b9ef
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
625 additions
and
210 deletions
assets/css/brand/brand.scss
assets/css/classp/list.scss
assets/css/common/addcar.scss
assets/css/detail/detail.scss
assets/css/search/searchlist.scss
components/addcar.vue
pages/brand/brand.vue
pages/classp/list.vue
pages/detail/detail.vue
pages/index/index.vue
pages/search/search.vue
pages/search/searchlist.vue
router/index.js
util/util.js
assets/css/brand/brand.scss
View file @
dd82e9fa
...
...
@@ -170,7 +170,7 @@
height
:
48rpx
;
line-height
:
48rpx
;
margin-bottom
:
12rpx
;
navigator
{
.itemoneurl
{
height
:
48rpx
;
line-height
:
48rpx
;
.goodsName
{
...
...
@@ -189,6 +189,8 @@
position
:
relative
;
margin-left
:
10rpx
;
top
:
10rpx
;
font-size
:
22rpx
;
font-weight
:
normal
;
}
}
...
...
assets/css/classp/list.scss
View file @
dd82e9fa
...
...
@@ -44,7 +44,7 @@
height
:
48rpx
;
line-height
:
48rpx
;
margin-bottom
:
12rpx
;
navigator
{
.itemoneurl
{
height
:
48rpx
;
line-height
:
48rpx
;
.goodsName
{
...
...
@@ -63,6 +63,8 @@
position
:
relative
;
margin-left
:
10rpx
;
top
:
10rpx
;
font-size
:
22rpx
;
font-weight
:
normal
;
}
}
...
...
assets/css/common/addcar.scss
View file @
dd82e9fa
...
...
@@ -32,6 +32,8 @@
position
:
relative
;
margin-left
:
10rpx
;
top
:
10rpx
;
font-size
:
22rpx
;
font-weight
:
normal
;
}
}
.iconfont
{
...
...
@@ -133,15 +135,9 @@
line-height
:
41rpx
;
font-size
:
24rpx
;
color
:
$uni-color999
;
.pi1
{
width
:
139rpx
;}
.pi2
{
width
:
318rpx
;}
.w140
{
width
:
140rpx
;}
.w120
{
width
:
120rpx
;}
.hxj
{
color
:
#C2C4CC
!
important
;
font-weight
:
normal
!
important
;
text-decoration-line
:
line-through
;
}
.pi1
{
flex
:
2
;}
.pi2
{
flex
:
3
;}
.pi3
{
flex
:
3
;}
&
.titso
{
color
:
$uni-color666
;
font-weight
:
600
;
...
...
@@ -251,7 +247,7 @@
}
}
.kfbtn
{
border
:
2
px
solid
$uni-colorwarning
;
border
:
1
px
solid
$uni-colorwarning
;
color
:
$uni-colorwarning
;
}
}
...
...
assets/css/detail/detail.scss
View file @
dd82e9fa
...
...
@@ -46,6 +46,8 @@
color
:
#fff
;
font-size
:
20rpx
;
margin-left
:
16rpx
;
font-size
:
22rpx
;
font-weight
:
normal
;
}
.tdbox
{
width
:
120rpx
;
...
...
@@ -175,7 +177,6 @@
}
.cons
{
border
:
1rpx
solid
#C6C7CC
;
.groups
{
font-size
:
24rpx
;
color
:
$uni-color999
;
...
...
@@ -318,6 +319,26 @@
}
}
&
.act
{
.headprice
{
background
:
#FFF8F2
!
important
;
}
.detailfoot
.foo1
.checkbox
.icon
,
.detailfoot
.foo2
.pr
uni-text
{
color
:
#F98119
;
}
.detailfoot
.foo2
.pr
input
{
border-left
:
1rpx
solid
#F98119
;
border-right
:
1rpx
solid
#F98119
;
}
.detailfoot
.foo2
.pr
{
border
:
1px
solid
#F98119
;
}
.detailfoot
.btnbox
.totalpricebox
.addcarbtn
{
background
:
#F98119
;
}
}
}
...
...
assets/css/search/searchlist.scss
View file @
dd82e9fa
...
...
@@ -140,7 +140,7 @@
height
:
48rpx
;
line-height
:
48rpx
;
margin-bottom
:
12rpx
;
navigator
{
.itemoneurl
{
height
:
48rpx
;
line-height
:
48rpx
;
.goodsName
{
...
...
@@ -159,6 +159,7 @@
position
:
relative
;
margin-left
:
10rpx
;
top
:
10rpx
;
font-size
:
22rpx
;
}
}
...
...
components/addcar.vue
View file @
dd82e9fa
...
...
@@ -2,64 +2,64 @@
<view>
<uni-popup
ref=
"popup"
type=
"bottom"
>
<view
class=
"addcar "
>
<view
class=
"addcar-pop "
>
<view
class=
"addcar-pop "
:class=
"
{'actpop':obj.ac_type==10}"
>
<view
class=
"addcarpopbox"
>
<view
class=
"cons"
>
<view
class=
"pophead row bothSide"
>
<view
class=
"tits row"
>
<text
class=
"goodsName elep"
>
lm358asdasdasdasdasdads
</text>
<text
class=
"actag"
>
91折
</text>
<text
class=
"goodsName elep"
>
{{
obj
.
goods_name
}}
</text>
<text
class=
"actag"
v-if=
"obj.ac_type==10"
>
{{
obj
.
activity_info
.
sign
}}
</text>
</view>
<text
class=
"icon iconfont icon-xxx"
@
click=
"close()"
></text>
</view>
<view
class=
"popcons"
>
<view
class=
"infobox"
>
<view
class=
"infobox"
@
click
.
stop=
"clickbug"
>
<view
class=
"itemone row bothSide"
>
<view
class=
"il elep"
>
<text
class=
"label"
>
品牌:
</text>
<text>
Rice Lake Weighing
</text>
<text>
{{
obj
.
brand_name
}}
</text>
</view>
<view
class=
"ir"
>
<text
class=
"label"
>
ECCN:
</text>
<text>
ERA3006
</text>
<text>
{{
obj
.
eccn
||
'--'
}}
</text>
</view>
</view>
<view
class=
"itemone row bothSide"
>
<view
class=
"il elep"
>
<text
class=
"label"
>
供应商:
</text>
<text>
Mouser
</text>
<text>
{{
obj
.
supplier_name
||
'--'
}}
</text>
</view>
<view
class=
"ir"
>
<text
class=
"label"
>
递增量:
</text>
<text>
66666
</text>
<text>
{{
obj
.
multiple
||
obj
.
mpl
}}
</text>
</view>
</view>
<view
class=
"itemone row bothSide"
>
<view
class=
"il elep"
>
<text
class=
"label"
>
封装:
</text>
<text>
asdad
</text>
<text>
{{
obj
.
encap
||
'--'
}}
</text>
</view>
<view
class=
"ir"
>
<text
class=
"label"
>
起订量:
</text>
<text>
500
</text>
<text>
{{
obj
.
min_buy
}}
</text>
</view>
</view>
<view
class=
"itemone row bothSide"
>
<view
class=
"il elep"
>
<text
class=
"label"
>
包装:
</text>
<text>
Cut Tape
</text>
<text>
{{
obj
.
packing_name
||
'--'
}}
</text>
</view>
<view
class=
"ir"
>
<text
class=
"label"
>
库存:
</text>
<text
class=
"kcty"
>
654564654
</text>
<text
class=
"kcty"
>
{{
obj
.
goods_number
}}
</text>
</view>
</view>
<view
class=
"itemone row bothSide"
>
<view
class=
"il elep"
>
<text
class=
"label"
>
类别:
</text>
<text>
Cut Tape
</text>
<text>
{{
obj
.
class1_name
||
obj
.
class2_name
||
'--'
}}
</text>
</view>
</view>
</view>
...
...
@@ -67,19 +67,19 @@
<view
class=
"pricet row"
>
<view
class=
"pl row"
>
<text
class=
"label"
>
交期:
</text>
<view
class=
"row hqitem"
>
<text
class=
"checkbox
checked
"
><text
class=
"icon iconfont icon-xzs"
></text></text>
<text>
大陆
3-5日
</text>
<view
class=
"row hqitem"
@
click=
"tabhuoqi(1)"
v-if=
"obj.delivery_cn"
>
<text
class=
"checkbox
"
:class=
"
{'checked':isdl==1}
">
<text
class=
"icon iconfont icon-xzs"
></text></text>
<text>
大陆
{{
obj
.
delivery_time
[
'1'
]
}}
</text>
</view>
<view
class=
"row hqitem"
>
<text
class=
"checkbox"
></text>
<text>
香港
3-5日
</text>
<view
class=
"row hqitem"
@
click=
"tabhuoqi(2)"
v-if=
"obj.delivery_hk"
>
<text
class=
"checkbox"
:class=
"
{'checked':isdl==2}">
<text
class=
"icon iconfont icon-xzs"
></text
></text>
<text>
香港
{{
obj
.
delivery_time
[
'2'
]
}}
</text>
</view>
</view>
<view
class=
"pr row "
>
<text>
-
</text>
<input
type=
"number"
/>
<text>
+
</text>
<text
@
click
.
stop=
"stepgo('small')"
>
-
</text>
<input
type=
"number"
v-model=
"num"
@
input=
"onInput"
/>
<text
@
click
.
stop=
"stepgo('big')"
>
+
</text>
</view>
</view>
<view
class=
"priceb"
>
...
...
@@ -88,33 +88,25 @@
<view
class=
"pi2"
>
大陆交货(含税)
</view>
<view
class=
"pi3"
>
香港交货
</view>
</view>
<view
class=
"pitem row "
>
<view
class=
"pi1"
>
50000+:
</view>
<view
class=
"pi2 row"
><text
class=
"w140"
>
¥130.856
</text><text
class=
"hxj"
>
¥130.856
</text></view>
<view
class=
"pi3 row"
>
<text
class=
"w120"
>
$130.856
</text><text
class=
"hxj"
>
$130.856
</text></view>
<view
v-if=
"pticearr.length>0"
>
<view
class=
"pitem row "
:class=
"
{'act':item.checked}" v-for="(item,index) in pticearr" :key="index">
<view
class=
"pi1"
>
{{
item
.
purchases
}}
+:
</view>
<view
class=
"pi2 row"
><text
class=
"w140"
>
¥
{{
item
.
price_ac
||
item
.
price_cn
||
'--'
}}
</text></view>
<view
class=
"pi3 row"
>
<text
class=
"w120"
>
$
{{
item
.
price_ac_us
||
item
.
price_us
||
'--'
}}
</text></view>
</view>
<view
class=
"pitem row "
>
<view
class=
"pi1"
>
50000+:
</view>
<view
class=
"pi2 row"
><text
class=
"w140"
>
¥130.856
</text><text
class=
"hxj"
>
¥130.856
</text></view>
<view
class=
"pi3 row"
>
<text
class=
"w120"
>
$130.856
</text><text
class=
"hxj"
>
$130.856
</text></view>
</view>
<view
class=
"pitem row act"
>
<view
class=
"pi1"
>
50000+:
</view>
<view
class=
"pi2 row"
><text
class=
"w140"
>
¥130.856
</text><text
class=
"hxj"
>
¥130.856
</text></view>
<view
class=
"pi3 row"
>
<text
class=
"w120"
>
$130.856
</text><text
class=
"hxj"
>
$130.856
</text></view>
</view>
<view
class=
"noprice"
style=
"display:none;"
>
<view
class=
"noprice"
v-if=
"pticearr.length==0"
>
<text
class=
"icon iconfont icon-sanjiaoji"
></text>
暂无阶梯价格
</view>
</view>
</view>
<view
class=
"btnbox"
>
<view
class=
"totalpricebox row bothSide"
>
<view
class=
"hej"
>
合计:
<text
class=
"tje"
>
¥3235.6856
</text></view>
<view
class=
"addcarbtn"
>
加入购物车
</view>
<view
class=
"totalpricebox row bothSide"
v-if=
"obj.is_buy==1"
>
<view
class=
"hej"
>
合计:
<text
class=
"tje"
>
{{
isdl
==
1
?
'¥'
:
'$'
}}{{
totalmoney
}}
</text></view>
<view
class=
"addcarbtn"
@
click
.
stop=
"addCar"
>
加入购物车
</view>
</view>
<a
class=
"kfbtn row verCenter rowCenter"
href=
"#"
target=
"_blank"
style=
"display:none"
>
<a
class=
"kfbtn row verCenter rowCenter"
v-else
:href=
"kfqqurl"
target=
"_blank"
>
<text
class=
"icon iconfont icon-qq"
></text>
联系客服
</a>
...
...
@@ -142,13 +134,84 @@
},
data
()
{
return
{
timeout
:
""
,
//请求延迟定时器
obj
:{},
num
:
1
,
isdl
:
1
,
pticearr
:[],
totalmoney
:
0.00
,
kfqqurl
:
""
,
}
},
onLoad
:
function
()
{
},
mounted
()
{
setTimeout
(()
=>
{
this
.
kfqqurl
=
this
.
$globalData
.
kfqq_xk
},
500
);
},
methods
:
{
clickbug
(){
return
false
;
},
onInput
(
e
){
clearTimeout
(
this
.
timeout
);
this
.
timeout
=
setTimeout
(()
=>
{
let
mpl
=
Number
(
this
.
obj
.
multiple
||
this
.
obj
.
mpl
);
//倍数 加减的数量基数
let
stock
=
Number
(
this
.
obj
.
goods_number
);
//库存
let
moq
=
Number
(
this
.
obj
.
min_buy
);
//起订量
let
value_
=
Number
(
e
.
detail
.
value
);
//当前的数量
console
.
log
(
value_
)
value_
=
Math
.
ceil
(
value_
/
mpl
)
*
mpl
;
//失去焦点数量
this
.
num
=
value_
;
//最终的数量
if
(
value_
<
moq
)
{
this
.
num
=
moq
}
if
(
value_
>
stock
)
{
this
.
num
=
Math
.
floor
(
stock
/
mpl
)
*
mpl
;
}
this
.
pticeui
()
},
800
);
},
stepgo
(
type
){
let
mpl
=
Number
(
this
.
obj
.
multiple
||
this
.
obj
.
mpl
);
//倍数 加减的数量基数
let
stock
=
Number
(
this
.
obj
.
goods_number
);
//库存
let
moq
=
Number
(
this
.
obj
.
min_buy
);
//起订量
let
value_
=
this
.
num
;
//当前的数量
if
(
type
==
"small"
){
//减法
var
down_value
=
value_
-
mpl
;
//减过后的值
if
(
down_value
<
moq
)
{
this
.
num
=
moq
;
uni
.
showToast
({
title
:
'数量不能小于起订量'
,
duration
:
2000
,
icon
:
"none"
})
}
else
{
this
.
num
=
down_value
}
}
else
{
//加法
var
up_value
=
value_
+
mpl
;
//加过后的值
if
(
up_value
>
stock
)
{
uni
.
showToast
({
title
:
'数量不能大于库存'
,
duration
:
2000
,
icon
:
"none"
})
this
.
num
=
Math
.
floor
(
stock
/
mpl
)
*
mpl
;
}
else
{
this
.
num
=
up_value
}
}
this
.
pticeui
()
},
tabhuoqi
(
guid
){
this
.
isdl
=
guid
;
this
.
pticeui
()
},
open
()
{
this
.
$refs
.
popup
.
open
(
'bottom'
);
},
...
...
@@ -160,10 +223,99 @@
this
.
getData
(
goods_id
)
}
},
getData
:
function
(
goods_id
){
addCar
(){
let
datax
=
{
id
:
this
.
obj
.
goods_id
,
num
:
this
.
num
,
buy
:
1
,
delivery_place
:
this
.
isdl
,
isZy
:(
this
.
obj
.
goods_type
==
1
||
this
.
obj
.
goods_type
==
2
)?
0
:
1
,
}
this
.
request
(
Api_Url
+
"/cart/add"
,
'POST'
,
datax
,
true
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
==
0
)
{
uni
.
showToast
({
title
:
res
.
err_msg
,
duration
:
2000
,
icon
:
"success"
})
this
.
close
()
}
else
{
uni
.
showToast
({
title
:
res
.
err_msg
,
duration
:
2000
,
icon
:
"error"
})
}
});
},
//计算阶梯价格 总价
pticeui
(){
if
(
this
.
pticearr
.
length
==
0
){
return
}
//渲染阶梯价格
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
item
.
checked
=
false
})
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
let
value_
=
this
.
num
let
pus
=
item
.
purchases
var
next_pus
=
""
var
prev_pus
=
""
if
(
index
!=
this
.
pticearr
.
length
-
1
){
next_pus
=
this
.
pticearr
[
index
+
1
].
purchases
}
if
(
index
!=
0
){
prev_pus
=
this
.
pticearr
[
index
-
1
].
purchases
}
if
(
value_
==
pus
)
{
item
.
checked
=
true
return
false
;
}
if
(
index
==
0
){
if
(
value_
>
pus
){
item
.
checked
=
true
return
false
;
}
}
if
(
index
==
this
.
pticearr
.
length
-
1
){
if
(
value_
<
pus
){
item
.
checked
=
true
return
false
;
}
}
if
(
value_
<
pus
&&
value_
>
next_pus
)
{
this
.
pticearr
[
index
+
1
].
checked
=
true
return
false
;
}
if
(
value_
>
pus
&&
value_
<
prev_pus
)
{
item
.
checked
=
true
return
false
;
}
})
//计算价格
let
actitem
=
{};
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
checked
){
actitem
=
item
}
})
let
price_
=
Number
(
this
.
isdl
==
1
?(
actitem
.
price_ac
||
actitem
.
price_cn
||
0
):(
actitem
.
price_ac_us
||
actitem
.
price_us
||
0
));
this
.
totalmoney
=
(
price_
*
this
.
num
).
toFixed
(
2
)
},
getData
(
goods_id
){
//110225 1168482547080619839
this
.
request
(
Api_Url
+
"/goods/detail"
,
'POST'
,
{
id
:
goods_id
},
true
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
==
0
)
{
this
.
obj
=
res
.
data
;
this
.
num
=
this
.
obj
.
min_buy
this
.
pticearr
=
res
.
data
.
tiered
||
[]
if
((
!
this
.
obj
.
delivery_cn
)
&&
this
.
obj
.
delivery_hk
){
this
.
isdl
=
2
}
this
.
open
()
this
.
pticeui
()
}
else
{
}
...
...
pages/brand/brand.vue
View file @
dd82e9fa
...
...
@@ -4,40 +4,38 @@
<text
v-back
class=
"icon iconfont icon-arrleft"
></text>
<view
class=
"inputbox row verCenter"
>
<text
class=
"icon iconfont icon-search "
></text>
<input
placeholder=
"在此品牌下搜索型号"
@
focus=
"isSearch=!isSearch"
@
blur=
"isSearch=!isSearch
"
/>
<input
placeholder=
"在此品牌下搜索型号"
v-model=
"goods_name"
@
focus=
"isSearch=!isSearch"
@
blur=
"blurinputs
"
/>
</view>
<navigator
url=
"/joincart"
>
<text
class=
"icon iconfont icon-car"
></text>
</navigator>
<view
class=
"searchbtn"
>
搜索
</view>
<view
class=
"searchbtn"
@
click
.
stop=
"searchlistgo()"
>
搜索
</view>
</view>
<view
class=
"brandinfo"
>
<view
class=
"tp1 row bothSide verCenter"
>
<image
src=
"https://img.ichunt.com/images/brands/174.png"
></image>
<text>
关于ADI
</text>
</view>
<view
class=
"tp2 "
:class=
"
{'zazts elep2':!zkshow}">
Analog Devices以追求创新、品质和卓越为使命,是一家历史悠久,成长迅速的技术公司。Analog Devices的客户逾Analog Devices以追求创新、品质和卓越为使命,是一家历史悠久,成长迅速的技术公司。Analog Devices的客户逾……
<image
:src=
"brandInfo.brand_logo"
></image>
<text>
关于
{{
brandInfo
.
brand_name
}}
</text>
</view>
<view
class=
"tp2 "
:class=
"
{'zazts elep2':!zkshow}" v-html="brandInfo.brand_desc">asddddddddddd
</view>
<view
class=
"zkbtnsi row verCenter"
v-show=
"!zkshow"
@
click=
"zkshow=!zkshow"
>
展开详情
<text
class=
"icon iconfont icon-arrbot"
></text></view>
<view
class=
"zkbtnsi row verCenter"
v-show=
"zkshow"
@
click=
"zkshow=!zkshow"
>
收起详情
<text
class=
"icon iconfont icon-arrtop"
></text></view>
</view>
<view
class=
"datasc"
>
<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>
<view
class=
"databox branddataboxs"
>
<view
class=
"group"
v-for=
"(item,index) in list"
:key=
"index"
>
<view
class=
"toprs1 row bothSide"
>
<
navigator
:url=
"'/item?goods_id='+item.goods_id"
class=
"row
"
>
<
a
:href=
"'/#/item/'+item.goods_id"
class=
"row itemoneurl
"
>
<view
class=
"goodsName elep"
>
{{
item
.
goods_name
}}
</view>
<view
class=
"actag"
v-if=
"item.ac_type==10"
>
{{
item
.
activity_info
.
sign
}}
</view>
</
navigator
>
</
a
>
<view
class=
"addcar"
v-if=
"item.is_buy==1"
@
click=
"addcarpopfunc(item.goods_id)"
>
加入购物车
</view>
<
view
class=
"kfbtns"
v-if=
"item.is_buy!=1"
@
click=
"addcarpopfunc(item.goods_id)"
>
联系客服
</view
>
<
a
class=
"kfbtns"
v-if=
"item.is_buy!=1"
:href=
"kfurl"
>
联系客服
</a
>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
{{
item
.
brand_name
}}
</view>
...
...
@@ -85,12 +83,16 @@
zkshow
:
false
,
kfurl
:
""
,
list
:[],
brandInfo
:{},
isInitLogin
:
0
,
class_id1
:
""
,
class_id2
:
""
,
page
:
1
,
page_size
:
10
,
isLoadEnd
:
false
// 是否已全部加载完
isLoadEnd
:
false
,
// 是否已全部加载完
goods_name
:
""
,
tabType
:
1
,
stocksort
:
false
,
//库存升序 false 降序
pricesort
:
false
,
//价格升序 false 降序
}
},
onPageScroll
(
e
)
{
...
...
@@ -100,7 +102,11 @@
},
onShow
()
{
this
.
getData
();
this
.
getqqurl
()
},
mounted
()
{
setTimeout
(()
=>
{
this
.
kfurl
=
this
.
$globalData
.
kfqq_xk
},
500
);
},
onLoad
:
function
(
option
)
{
this
.
brand_id
=
this
.
$Route
.
query
.
brand_id
;
...
...
@@ -115,25 +121,51 @@
this
.
getData
();
},
methods
:
{
getqqurl
:
function
(){
this
.
request
(
Ichunt_Api
+
"/api/common/data"
,
'GET'
,
{},
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
kfurl
=
res
.
data
.
kfqq_xk
.
data
blurinputs
(){
setTimeout
(()
=>
{
this
.
isSearch
=!
this
.
isSearch
},
100
)
},
searchlistgo
(){
console
.
log
(
666
)
this
.
page
=
1
this
.
getData
()
},
tab
(
type
){
this
.
tabType
=
type
;
if
(
type
==
1
){
}
else
if
(
type
==
2
){
this
.
stocksort
=!
this
.
stocksort
;
}
else
if
(
type
==
3
){
this
.
pricesort
=!
this
.
pricesort
}
});
this
.
page
=
1
this
.
getData
()
},
getData
()
{
this
.
request
(
Api_Es
+
"/optimum/goods"
,
'POST'
,
{
class_id1
:
13396
,
page
:
this
.
page
,
page_size
:
this
.
page_size
},
true
,
true
).
then
(
res
=>
{
let
data_
=
{
'standard_brand_id/condition'
:
this
.
brand_id
,
'goods_name/condition'
:
this
.
goods_name
,
'offset'
:
this
.
page_size
,
'p'
:
this
.
page
}
if
(
this
.
tabType
==
2
){
data_
[
'stock_sort'
]
=
this
.
stocksort
?
"desc"
:
"asc"
}
if
(
this
.
tabType
==
3
){
data_
[
'single_sort'
]
=
this
.
pricesort
?
"asc"
:
"desc"
}
this
.
request
(
Api_Es
+
"/label/brandInfo"
,
'POST'
,
data_
,
true
,
true
).
then
(
res
=>
{
this
.
isInitLogin
=
1
;
if
(
res
.
error_code
==
0
)
{
this
.
class_id1_name
=
res
.
data
.
class_id1_name
;
this
.
class_id2_name
=
res
.
data
.
class_id2_name
;
this
.
page
++
;
let
newDataList
=
res
.
data
.
goods_lists
||
[];
this
.
brandInfo
=
res
.
data
.
brand_info
;
let
newDataList
=
res
.
data
.
goods_info
||
[];
this
.
list
=
this
.
list
.
concat
(
newDataList
);
if
(
newDataList
.
length
<
this
.
page_size
)
{
if
(
(
this
.
page
*
this
.
page_size
)
>=
Number
(
res
.
data
.
goods_count
)
)
{
this
.
isLoadEnd
=
true
;
}
this
.
page
++
;
}
else
{
this
.
list
=
[]
}
...
...
pages/classp/list.vue
View file @
dd82e9fa
...
...
@@ -8,12 +8,12 @@
<view
class=
"databox"
>
<view
class=
"group"
v-for=
"(item,index) in list"
:key=
"index"
>
<view
class=
"toprs1 row bothSide"
>
<
navigator
:url=
"'/item?goods_id='+item.goods_id"
class=
"row
"
>
<
a
:href=
"'/#/item/'+item.goods_id"
class=
"row itemoneurl
"
>
<view
class=
"goodsName elep"
>
{{
item
.
goods_name
}}
</view>
<view
class=
"actag"
v-if=
"item.ac_type==10"
>
{{
item
.
activity_info
.
sign
}}
</view>
</
navigator
>
</
a
>
<view
class=
"addcar"
v-if=
"item.is_buy==1"
@
click=
"addcarpopfunc(item.goods_id)"
>
加入购物车
</view>
<
view
class=
"kfbtns"
v-if=
"item.is_buy!=1"
@
click=
"addcarpopfunc(item.goods_id)"
>
联系客服
</view
>
<
a
class=
"kfbtns"
:href=
"kfurl"
target=
"_blank"
v-if=
"item1.is_buy!=1"
>
联系客服
</a
>
</view>
<view
class=
"toprs2 row bothSide"
>
<view
class=
"l2 elep"
><text
class=
"labelsd"
>
品牌:
</text>
{{
item
.
brand_name
}}
</view>
...
...
@@ -82,7 +82,12 @@
},
onShow
()
{
this
.
getData
();
this
.
getqqurl
()
},
mounted
()
{
setTimeout
(()
=>
{
this
.
kfurl
=
this
.
$globalData
.
kfqq_xk
},
500
);
},
onLoad
:
function
(
option
)
{
this
.
class_id1
=
option
.
class_id1
||
""
;
...
...
@@ -90,25 +95,18 @@
console
.
log
(
this
.
class_id1
,
this
.
class_id2
)
},
methods
:
{
getqqurl
:
function
(){
this
.
request
(
Ichunt_Api
+
"/api/common/data"
,
'GET'
,
{},
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
kfurl
=
res
.
data
.
kfqq_xk
.
data
}
});
},
getData
()
{
this
.
request
(
Api_Es
+
"/optimum/goods"
,
'POST'
,
{
class_id1
:
13396
,
page
:
this
.
page
,
page_size
:
this
.
page_size
},
true
,
true
).
then
(
res
=>
{
this
.
request
(
Api_Es
+
"/optimum/goods"
,
'POST'
,
{
class_id1
:
this
.
class_id1
,
class_id2
:
this
.
class_id2
,
page
:
this
.
page
,
page_size
:
this
.
page_size
},
true
,
true
).
then
(
res
=>
{
this
.
isInitLogin
=
1
;
if
(
res
.
error_code
==
0
)
{
this
.
class_id1_name
=
res
.
data
.
class_id1_name
;
this
.
class_id2_name
=
res
.
data
.
class_id2_name
;
this
.
page
++
;
let
newDataList
=
res
.
data
.
goods_lists
||
[];
this
.
list
=
this
.
list
.
concat
(
newDataList
);
if
(
newDataList
.
length
<
this
.
page_size
)
{
if
(
(
this
.
page
*
this
.
page_size
)
>=
Number
(
res
.
data
.
page
.
total
)
)
{
this
.
isLoadEnd
=
true
;
}
this
.
page
++
;
}
else
{
this
.
list
=
[]
}
...
...
pages/detail/detail.vue
View file @
dd82e9fa
<
template
>
<view
class=
"detailpage"
>
<view
class=
"detailpage
"
:class=
"
{'act':obj.ac_type==10}
">
<drag-button-follow
follow=
"left,right"
className=
"drag-button"
class=
"drag-button"
:url=
"kfurl"
></drag-button-follow>
<view
class=
"detailhead row verCenter bothSide"
>
<text
v-back
class=
"icon iconfont icon-arrleft"
></text>
...
...
@@ -12,8 +12,8 @@
<view
class=
"cons"
>
<view
class=
"tits row verCenter bothSide"
>
<view
class=
"row verCenter"
>
<text
class=
"goodsName elep"
>
lm358asda
</text>
<text
class=
"actag"
>
91折
</text>
<text
class=
"goodsName elep"
>
{{
obj
.
sku_name
||
obj
.
goods_name
}}
</text>
<text
class=
"actag"
v-if=
"obj.ac_type==10"
>
{{
obj
.
activity_info
.
sign
}}
</text>
</view>
<view
class=
"tdbox row verCenter"
@
click=
"open()"
>
<view
class=
"round row verCenter rowCenter"
><text
class=
"icon iconfont icon-tdzty"
></text></view>
...
...
@@ -22,17 +22,17 @@
</view>
<view
class=
"attrbox row"
>
<view
class=
"atl"
>
<view
class=
"item row"
>
品牌:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
供应商:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
封装:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
包装:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
ECCN:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
库存:
<text
class=
"stock"
>
500
</text></view>
<view
class=
"item row"
>
类别:
<text
class=
""
>
Rice Lake Weighing
</text></view>
<view
class=
"item row"
>
品牌:
<text
class=
""
>
{{
obj
.
standard_brand_name
||
obj
.
brand_name
}}
</text></view>
<view
class=
"item row"
>
供应商:
<text
class=
""
>
{{
obj
.
supplier_name
}}
</text></view>
<view
class=
"item row"
>
封装:
<text
class=
""
>
{{
obj
.
encap
||
'--'
}}
</text></view>
<view
class=
"item row"
>
包装:
<text
class=
""
>
{{
obj
.
packing
||
'--'
}}
</text></view>
<view
class=
"item row"
>
ECCN:
<text
class=
""
>
{{
obj
.
eccn
||
'--'
}}
</text></view>
<view
class=
"item row"
>
库存:
<text
class=
"stock"
>
{{
obj
.
stock_raw
}}
</text></view>
<view
class=
"item row"
>
类别:
<text
class=
""
>
{{
obj
.
class_name
||
'--'
}}
</text></view>
</view>
<view
class=
"atr"
>
<image
src=
"https://img.ichunt.com/images/cms/202304/07/9ecd831432bc35dcd9bac28a0136e57d.png
"
></image>
<a
href=
""
target=
"_blank"
class=
"row rowCenter verCenter
"
>
<image
:src=
"obj.goods_images||'https://static.ichunt.com/dist/res/home/images/goods_default.png'
"
></image>
<a
:href=
"obj.pdf"
target=
"_blank"
class=
"row rowCenter verCenter"
v-if=
"obj.pdf
"
>
<text
class=
"icon iconfont icon-down"
></text>
<text>
下载数据手册
</text>
</a>
...
...
@@ -45,59 +45,37 @@
<view
class=
"ptiem"
>
香港交货
</view>
</view>
<view
class=
"bodyprice"
>
<view
class=
"pricegroup row"
>
<view
class=
"ptiem ptiemone"
>
5000+:
</view>
<view
class=
"ptiem"
>
¥140.425
</view>
<view
class=
"ptiem"
>
$17.2125
</view>
</view>
<view
class=
"pricegroup row"
>
<view
class=
"ptiem ptiemone"
>
5000+:
</view>
<view
class=
"ptiem"
>
¥140.425
</view>
<view
class=
"ptiem"
>
$17.2125
</view>
</view>
<view
class=
"pricegroup row act"
>
<view
class=
"ptiem ptiemone"
>
5000+:
</view>
<view
class=
"ptiem"
>
¥140.425
</view>
<view
class=
"ptiem"
>
$17.2125
</view>
</view>
<view
class=
"pricegroup row"
>
<view
class=
"ptiem ptiemone"
>
5000+:
</view>
<view
class=
"ptiem"
>
¥140.425
</view>
<view
class=
"ptiem"
>
$17.2125
</view>
<view
class=
"pricegroup row"
:class=
"
{'act':item.checked}" v-for="(item,index) in pticearr" :key="index" v-show="(jtpricezk)||((!jtpricezk)
&&
index
<3
)"
>
<view
class=
"ptiem ptiemone"
>
{{
item
.
purchases_raw
}}
+:
</view>
<view
class=
"ptiem"
>
¥
{{
item
.
price_ac
||
item
.
price_cn
||
'--'
}}
</view>
<view
class=
"ptiem"
>
$
{{
item
.
price_ac_us
||
item
.
price_us
||
'--'
}}
</view>
</view>
</view>
<view
class=
"morebtn row verCenter"
>
<text>
更少阶梯价格
</text>
<text
class=
"icon iconfont
icon-arrtop
"
></text>
<view
class=
"morebtn row verCenter"
@
click
.
stop=
"jtpricezk=!jtpricezk"
v-if=
"pticearr.length>3"
>
<text>
{{
jtpricezk
?
'更少阶梯价格'
:
'更多阶梯价格'
}}
</text>
<text
class=
"icon iconfont
"
:class=
"
{'icon-arrtop':jtpricezk,'icon-arrbot':!jtpricezk}
">
</text>
</view>
<view
class=
"noprice"
style=
"display:none;
"
>
<view
class=
"noprice"
v-if=
"pticearr.length==0&&obj.goods_name
"
>
<text
class=
"icon iconfont icon-sanjiaoji"
></text>
暂无阶梯价格
</view>
</view>
</view>
</view>
<view
class=
"seoattr"
>
<view
class=
"seoattr"
v-if=
"obj.attrs&&obj.attrs.length>0"
:style=
"!zkattr?'padding-bottom:0px;':''"
>
<view
class=
"tio row bothSide verCenter"
>
<text>
参数
</text>
<text
class=
"icon iconfont icon-arrtop"
></text>
</view>
<view
class=
"cons"
>
<view
class=
"groups row"
>
<text
class=
"one1"
>
封装规格:
</text>
<text>
0603
</text>
</view>
<view
class=
"groups row"
>
<text
class=
"one1"
>
封装规格:
</text>
<text>
0603
</text>
<text
class=
"icon iconfont "
:class=
"
{'icon-arrtop':zkattr,'icon-arrbot':!zkattr}" @click.stop="zkattr=!zkattr">
</text>
</view>
<view
class=
"groups row"
>
<text
class=
"one1"
>
封装规格:
</text>
<text>
0603
</text>
<view
class=
"cons"
v-show=
"zkattr"
>
<view
class=
"groups row"
v-for=
"(item,index) in obj.attrs"
:key=
"index"
>
<text
class=
"one1"
>
{{
item
.
attr_name
}}
:
</text>
<text>
{{
item
.
attr_value
}}
</text>
</view>
<view
class=
"groups row"
>
<view
class=
"groups row"
v-if=
"obj.spu_brief"
>
<text
class=
"one1"
>
介绍:
</text>
<text>
ad上帝发誓法师法师地方上帝发誓法师法师地方上帝发誓法师法师地方上帝发誓法师法师地方上帝发誓法师法师地方上帝发誓法师法师地方上帝发誓法师法师地方
</text>
<text>
{{
obj
.
spu_brief
}}
</text>
</view>
</view>
</view>
...
...
@@ -107,30 +85,30 @@
<view
class=
"foo1 row bothSide verCenter"
>
<view>
交期:
</view>
<view
class=
"row"
>
<view
class=
"row hqitem"
>
<text
class=
"checkbox
checked
"
><text
class=
"icon iconfont icon-xzs"
></text></text>
<view
class=
"row hqitem"
@
click
.
stop=
"tabhuoqi(1)"
v-if=
"obj.cn_delivery_time"
>
<text
class=
"checkbox
"
:class=
"
{'checked':isdl==1}
">
<text
class=
"icon iconfont icon-xzs"
></text></text>
<text>
大陆3-5日
</text>
</view>
<view
class=
"row hqitem"
>
<text
class=
"checkbox"
></text>
<view
class=
"row hqitem"
@
click
.
stop=
"tabhuoqi(2)"
v-if=
"obj.hk_delivery_time"
>
<text
class=
"checkbox"
:class=
"
{'checked':isdl==2}">
<text
class=
"icon iconfont icon-xzs"
></text
></text>
<text>
香港3-5日
</text>
</view>
</view>
</view>
<view
class=
"foo2 row bothSide verCenter"
>
<view
>
数量:
<text
class=
"f9"
>
(起订量:
</text>
400
<text
class=
"f9 ml24"
>
递增量:
</text>
1
<text
class=
"f9"
>
)
</text></view>
<view
@
click=
"clickbug()"
>
数量:
<text
class=
"f9"
>
(起订量:
</text>
{{
obj
.
moq_mip
}}
<text
class=
"f9 ml24"
>
递增量:
</text>
{{
obj
.
multiple_mip
||
obj
.
mpq_mip
}}
<text
class=
"f9"
>
)
</text></view>
<view
class=
"pr row "
>
<text>
-
</text>
<input
type=
"number"
value=
"1
"
/>
<text>
+
</text>
<text
@
click
.
stop=
"stepgo('small')"
>
-
</text>
<input
type=
"number"
v-model=
"num"
@
input=
"onInput
"
/>
<text
@
click
.
stop=
"stepgo('big')"
>
+
</text>
</view>
</view>
<view
class=
"btnbox"
>
<view
class=
"totalpricebox row bothSide verCenter"
>
<view
class=
"hej"
>
合计:
<text
class=
"tje"
>
¥3235.6856
</text></view>
<view
class=
"addcarbtn"
>
加入购物车
</view>
<view
class=
"totalpricebox row bothSide verCenter"
v-if=
"obj.is_buy==1"
>
<view
class=
"hej"
>
合计:
<text
class=
"tje"
>
{{
isdl
==
1
?
'¥'
:
'$'
}}{{
totalmoney
}}
</text></view>
<view
class=
"addcarbtn"
@
click
.
stop=
"addCar"
>
加入购物车
</view>
</view>
<a
class=
"kfbtn"
style=
"display:none"
>
<a
class=
"kfbtn"
v-else
:href=
"kfurl"
target=
"_blank"
>
<text
class=
"icon iconfont icon-qq"
></text>
联系客服
</a>
...
...
@@ -161,10 +139,182 @@
export
default
{
data
()
{
return
{
jtpricezk
:
true
,
zkattr
:
true
,
timeout
:
""
,
//请求延迟定时器
kfurl
:
""
,
goods_id
:
""
,
obj
:{},
pticearr
:[],
num
:
1
,
isdl
:
1
,
totalmoney
:
0
}
},
mounted
()
{
setTimeout
(()
=>
{
this
.
kfurl
=
this
.
$globalData
.
kfqq_xk
;
},
500
);
},
onShow
()
{
this
.
goods_id
=
this
.
$Route
.
query
.
goods_id
;
this
.
getData
();
},
methods
:
{
clickbug
(){
return
false
;
},
onInput
(
e
){
clearTimeout
(
this
.
timeout
);
this
.
timeout
=
setTimeout
(()
=>
{
let
mpl
=
Number
(
this
.
obj
.
multiple_mip
||
this
.
obj
.
mpq_mip
);
//倍数 加减的数量基数
let
stock
=
Number
(
this
.
obj
.
stock_raw
);
//库存
let
moq
=
Number
(
this
.
obj
.
moq_mip
);
//起订量
let
value_
=
Number
(
e
.
detail
.
value
);
//当前的数量
console
.
log
(
value_
)
value_
=
Math
.
ceil
(
value_
/
mpl
)
*
mpl
;
//失去焦点数量
this
.
num
=
value_
;
//最终的数量
if
(
value_
<
moq
)
{
this
.
num
=
moq
}
if
(
value_
>
stock
)
{
this
.
num
=
Math
.
floor
(
stock
/
mpl
)
*
mpl
;
}
this
.
pticeui
()
},
800
);
},
stepgo
(
type
){
let
mpl
=
Number
(
this
.
obj
.
multiple_mip
||
this
.
obj
.
mpq_mip
);
//倍数 加减的数量基数
let
stock
=
Number
(
this
.
obj
.
stock_raw
);
//库存
let
moq
=
Number
(
this
.
obj
.
moq_mip
);
//起订量
let
value_
=
this
.
num
;
//当前的数量
if
(
type
==
"small"
){
//减法
var
down_value
=
value_
-
mpl
;
//减过后的值
if
(
down_value
<
moq
)
{
this
.
num
=
moq
;
uni
.
showToast
({
title
:
'数量不能小于起订量'
,
duration
:
2000
,
icon
:
"none"
})
}
else
{
this
.
num
=
down_value
}
}
else
{
//加法
var
up_value
=
value_
+
mpl
;
//加过后的值
if
(
up_value
>
stock
)
{
uni
.
showToast
({
title
:
'数量不能大于库存'
,
duration
:
2000
,
icon
:
"none"
})
this
.
num
=
Math
.
floor
(
stock
/
mpl
)
*
mpl
;
}
else
{
this
.
num
=
up_value
}
}
this
.
pticeui
()
},
tabhuoqi
(
guid
){
this
.
isdl
=
guid
;
this
.
pticeui
()
},
addCar
(){
let
datax
=
{
id
:
this
.
obj
.
goods_id
,
num
:
this
.
num
,
buy
:
1
,
delivery_place
:
this
.
isdl
,
isZy
:(
this
.
obj
.
goods_type
==
1
||
this
.
obj
.
goods_type
==
2
)?
0
:
1
,
}
this
.
request
(
Api_Url
+
"/cart/add"
,
'POST'
,
datax
,
true
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
==
0
)
{
uni
.
showToast
({
title
:
res
.
err_msg
,
duration
:
2000
,
icon
:
"success"
})
this
.
close
()
}
else
{
uni
.
showToast
({
title
:
res
.
err_msg
,
duration
:
2000
,
icon
:
"error"
})
}
});
},
//计算阶梯价格 总价
pticeui
(){
if
(
this
.
pticearr
.
length
==
0
){
return
}
//渲染阶梯价格
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
item
.
checked
=
false
})
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
let
value_
=
this
.
num
let
pus
=
item
.
purchases_raw
var
next_pus
=
""
var
prev_pus
=
""
if
(
index
!=
this
.
pticearr
.
length
-
1
){
next_pus
=
this
.
pticearr
[
index
+
1
].
purchases_raw
}
if
(
index
!=
0
){
prev_pus
=
this
.
pticearr
[
index
-
1
].
purchases_raw
}
if
(
value_
==
pus
)
{
item
.
checked
=
true
return
false
;
}
if
(
index
==
0
){
if
(
value_
>
pus
){
item
.
checked
=
true
return
false
;
}
}
if
(
index
==
this
.
pticearr
.
length
-
1
){
if
(
value_
<
pus
){
item
.
checked
=
true
return
false
;
}
}
if
(
value_
<
pus
&&
value_
>
next_pus
)
{
this
.
pticearr
[
index
+
1
].
checked
=
true
return
false
;
}
if
(
value_
>
pus
&&
value_
<
prev_pus
)
{
item
.
checked
=
true
return
false
;
}
})
//计算价格
let
actitem
=
{};
this
.
pticearr
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
checked
){
actitem
=
item
}
})
let
price_
=
Number
(
this
.
isdl
==
1
?(
actitem
.
price_ac
||
actitem
.
price_cn
||
0
):(
actitem
.
price_ac_us
||
actitem
.
price_us
||
0
));
this
.
totalmoney
=
(
price_
*
this
.
num
).
toFixed
(
2
)
},
getData
(){
this
.
request
(
Ichunt_Api
+
'/api/sku/detail'
,
'GET'
,
{
goods_id
:
this
.
goods_id
},
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
obj
=
res
.
data
.
sku
this
.
pticearr
=
this
.
obj
.
ladder_price
||
[]
this
.
num
=
this
.
obj
.
moq_mip
if
((
!
this
.
obj
.
cn_delivery_time
)
&&
this
.
obj
.
hk_delivery_time
){
this
.
isdl
=
2
}
this
.
pticeui
()
}
});
},
open
()
{
this
.
$refs
.
popup
.
open
(
'bottom'
);
},
...
...
pages/index/index.vue
View file @
dd82e9fa
...
...
@@ -76,7 +76,7 @@
<view
class=
"goods-box"
>
<view
class=
"titg"
>
精选物料
</view>
<scroll-view
class=
"goods-con"
scroll-x=
"true"
>
<
navigator
:url=
"'/item?goods_id=
' + item.goods_id"
class=
"goods-item"
v-for=
"(item, index) in obj.h5_home_choice_goods"
:key=
"index"
>
<
a
:href=
"'/#/item/
' + item.goods_id"
class=
"goods-item"
v-for=
"(item, index) in obj.h5_home_choice_goods"
:key=
"index"
>
<image
:src=
"item.goods_images"
></image>
<view
class=
"xhg elep"
>
{{
item
.
goods_name
}}
</view>
<view
class=
"ppg elep"
>
...
...
@@ -87,7 +87,7 @@
价格:
<text>
{{
item
.
price
}}
</text>
</view>
</
navigator
>
</
a
>
</scroll-view>
</view>
<view
class=
"fwbox"
>
...
...
@@ -165,7 +165,12 @@ export default {
intervalHandler
:
null
};
},
mounted
()
{
setTimeout
(()
=>
{
this
.
pbobj
=
this
.
$globalData
;
this
.
kfurl
=
this
.
$globalData
.
kfqq_xk
;
},
500
);
},
onShow
()
{
this
.
getData
();
},
...
...
@@ -209,12 +214,7 @@ export default {
},
10000
);
}
});
this
.
request
(
Ichunt_Api
+
'/api/common/data'
,
'GET'
,
{}).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
pbobj
=
res
.
data
;
this
.
kfurl
=
this
.
pbobj
.
kfqq_xk
.
data
;
}
});
this
.
request
(
Api_Url
+
'/msg/allnum'
,
'POST'
,
{},
false
,
true
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
newscount
=
res
.
data
;
...
...
pages/search/search.vue
View file @
dd82e9fa
...
...
@@ -65,11 +65,14 @@
console
.
log
(
option
);
this
.
searchVal
=
option
.
k
||
""
},
mounted
()
{
setTimeout
(()
=>
{
this
.
obj
=
this
.
$globalData
;
},
500
);
},
onShow
:
function
(){
//获取历史记录
console
.
log
(
this
.
searchVal
)
this
.
getsearchHistory
()
this
.
getData
()
},
methods
:
{
getListPOI
(
val_
){
...
...
@@ -79,13 +82,6 @@
}
});
},
getData
(){
this
.
request
(
Ichunt_Api
+
"/api/common/data"
,
'GET'
,
{},
).
then
(
res
=>
{
if
(
res
.
err_code
===
0
)
{
this
.
obj
=
res
.
data
;
}
});
},
getsearchHistory
(){
let
listhis_
=
uni
.
getStorageSync
(
'historyItems'
);
if
(
listhis_
){
...
...
pages/search/searchlist.vue
View file @
dd82e9fa
...
...
@@ -31,10 +31,10 @@
</view>
<view
class=
"group"
v-for=
"(item1,index1) in item.data"
:key=
"index1"
v-show=
"item1.isshow"
>
<view
class=
"toprs1 row bothSide"
>
<
navigator
:url=
"'/item?goods_id='+item1.goods_id"
class=
"row
"
>
<
a
:href=
"'/#/item/'+item1.goods_id"
class=
"row itemoneurl
"
>
<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
>
</
a
>
<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>
...
...
@@ -117,7 +117,7 @@
<
script
>
import
{
Ichunt_Api
,
Api_Url
,
Api_Es
,
Api_ES_Go
}
from
'@/util/api.js'
;
const
EsUrl
=
"//so12.ichunt.com"
//Api_Es
const
EsUrl
=
Api_Es
//Api_Es
import
addCar
from
'@/components/addcar.vue'
;
export
default
{
data
()
{
...
...
@@ -140,7 +140,13 @@
onLoad
:
function
(
option
)
{
this
.
searchVal
=
option
.
k
;
this
.
setHistoryItems
(
this
.
searchVal
)
this
.
getData
()
},
mounted
()
{
setTimeout
(()
=>
{
this
.
SEARCH_SUPPLIER_SINGLE
=
this
.
$globalData
.
SEARCH_SUPPLIER_SINGLE
;
this
.
kfqqurl
=
this
.
$globalData
.
kfqq_xk
this
.
getSupplierData
()
},
500
);
},
methods
:
{
//创建历史搜索缓存 最大10个
...
...
@@ -161,22 +167,76 @@
uni
.
setStorageSync
(
'historyItems'
,
historyItems
);
}
},
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
()
}
//综合排序
rankTotal
(){
//按供应商排序
this
.
list
.
sort
((
a
,
b
)
=>
{
if
(
a
.
supplier_name
==
'国内现货'
)
{
return
-
1
;
}
else
if
(
b
.
supplier_name
==
'国内现货'
)
{
return
1
;
}
else
if
(
a
.
supplier_name
==
'国际现货'
)
{
return
-
1
;
}
else
if
(
b
.
supplier_name
==
'国际现货'
)
{
return
1
;
}
return
0
;
});
//价格排序
this
.
list
.
forEach
(
item
=>
{
item
.
data
.
sort
((
a
,
b
)
=>
Number
(
a
.
ladder_price
[
0
].
price_ac
||
a
.
ladder_price
[
0
].
price_cn
)
-
Number
(
b
.
ladder_price
[
0
].
price_ac
||
b
.
ladder_price
[
0
].
price_cn
));
})
//完全匹配
this
.
list
.
forEach
(
item
=>
{
let
piarr_
=
JSON
.
parse
(
JSON
.
stringify
(
item
.
data
))
let
arr1
=
[]
let
arr2
=
[]
piarr_
.
forEach
((
iy
,
index
)
=>
{
if
(
iy
.
goods_name
.
toLowerCase
()
==
this
.
searchVal
.
toLowerCase
())
{
arr1
.
push
(
iy
)
}
else
{
arr2
.
push
(
iy
)
}
})
item
.
data
=
[]
item
.
data
=
item
.
data
.
concat
(
arr1
,
arr2
)
// console.log(piarr_)
// item.data.sort((a, b) => {
// if (a.goods_name.toLowerCase()==this.searchVal.toLowerCase()) {
// return -1;
// } else if (b.goods_name.toLowerCase()==this.searchVal.toLowerCase()) {
// return 1;
// }
// return 0;
// });
})
},
tab
(
type
){
this
.
tabType
=
type
;
if
(
type
==
2
){
this
.
stocksort
=!
this
.
stocksort
if
(
type
==
1
){
this
.
rankTotal
()
}
else
if
(
type
==
2
){
this
.
stocksort
=!
this
.
stocksort
;
if
(
this
.
stocksort
){
this
.
list
.
forEach
(
item
=>
{
item
.
data
.
sort
((
b
,
a
)
=>
Number
(
a
.
stock
)
-
Number
(
b
.
stock
));
})
}
else
{
this
.
list
.
forEach
(
item
=>
{
item
.
data
.
sort
((
a
,
b
)
=>
Number
(
a
.
stock
)
-
Number
(
b
.
stock
));
})
}
if
(
type
==
3
){
}
else
if
(
type
==
3
){
this
.
pricesort
=!
this
.
pricesort
if
(
this
.
pricesort
){
this
.
list
.
forEach
(
item
=>
{
item
.
data
.
sort
((
b
,
a
)
=>
Number
(
a
.
ladder_price
[
0
].
price_ac
||
a
.
ladder_price
[
0
].
price_cn
)
-
Number
(
b
.
ladder_price
[
0
].
price_ac
||
b
.
ladder_price
[
0
].
price_cn
));
})
}
else
{
this
.
list
.
forEach
(
item
=>
{
item
.
data
.
sort
((
a
,
b
)
=>
Number
(
a
.
ladder_price
[
0
].
price_ac
||
a
.
ladder_price
[
0
].
price_cn
)
-
Number
(
b
.
ladder_price
[
0
].
price_ac
||
b
.
ladder_price
[
0
].
price_cn
));
})
}
}
},
//品牌供应商搜索
...
...
@@ -285,15 +345,21 @@
name
:
key
,
checked
:
false
}
if
(
key
==
"国内现货"
){
this
.
supplierArr
.
unshift
(
is_
)
}
else
if
(
key
==
"猎芯期货"
){
this
.
supplierArr
.
push
(
is_
)
}
else
{
this
.
supplierArr
.
splice
(
1
,
0
,
is_
);
}
})
this
.
supplierArr
.
sort
((
a
,
b
)
=>
{
if
(
a
.
name
==
'国内现货'
)
{
return
-
1
;
}
else
if
(
b
.
name
==
'国内现货'
)
{
return
1
;
}
else
if
(
a
.
name
==
'国际现货'
)
{
return
-
1
;
}
else
if
(
b
.
name
==
'国际现货'
)
{
return
1
;
}
return
0
;
});
//品牌处理
obj
.
data
.
forEach
(
item
=>
{
let
keys_
=
(
item
.
standard_brand_name
||
item
.
brand_name
)
...
...
@@ -329,19 +395,15 @@
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
.
loadcount
==
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
)
.
length
){
if
(
this
.
list
.
length
==
0
){
this
.
isNOdata
=
1
;
}
else
{
this
.
rankTotal
()
}
}
});
...
...
@@ -373,9 +435,12 @@
}
//数据加载完
if
(
this
.
loadcount
==
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
)){
if
(
this
.
loadcount
==
Object
.
keys
(
this
.
SEARCH_SUPPLIER_SINGLE
).
length
){
if
(
this
.
list
.
length
==
0
){
this
.
isNOdata
=
1
;
}
else
{
this
.
rankTotal
()
}
}
});
...
...
router/index.js
View file @
dd82e9fa
...
...
@@ -60,14 +60,14 @@ const router = new Router({
},
{
path
:
'/pages/brand/brand'
,
aliasPath
:
'/brand'
,
aliasPath
:
'/brand
/:brand_id
'
,
meta
:
{
title
:
'品牌详情'
}
},
{
path
:
'/pages/detail/detail'
,
aliasPath
:
'/item'
,
aliasPath
:
'/item
/:goods_id
'
,
meta
:
{
title
:
'商品详情'
}
...
...
util/util.js
View file @
dd82e9fa
...
...
@@ -16,7 +16,7 @@ const request = (url = '', type = 'GET', param = {}, Loading, headertype) => {
pf
:
2
});
//请求es相关
if
(
url
.
indexOf
(
"so12.ichunt."
)
!=
-
1
||
url
.
indexOf
(
"/esapi/"
)
!=
-
1
||
url
.
indexOf
(
"/goods/detail"
)
!=
-
1
)
{
if
(
url
.
indexOf
(
"so12.ichunt."
)
!=
-
1
||
url
.
indexOf
(
"/esapi/"
)
!=
-
1
||
url
.
indexOf
(
"/goods/detail"
)
!=
-
1
||
url
.
indexOf
(
"/optimum/goods"
)
!=
-
1
)
{
params
=
Object
.
assign
(
param
,
{
hkyefgyd
:
1
});
}
...
...
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