Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
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
李俊赕
self-support
Commits
54414262
Commit
54414262
authored
Jun 24, 2021
by
Damon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 可用备件API对接
parent
c4f8ac8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
42 deletions
+70
-42
parts.js
src/common/api/parts.js
+6
-1
index.vue
src/components/select-parts/index.vue
+3
-0
parts.vue
src/pages/order/parts.vue
+61
-41
No files found.
src/common/api/parts.js
View file @
54414262
...
@@ -21,12 +21,17 @@ let partsApiFun = function(vm){
...
@@ -21,12 +21,17 @@ let partsApiFun = function(vm){
* 查询配件列表
* 查询配件列表
*/
*/
let
getPartsList
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/parts'
,
params
);
let
getPartsList
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/parts'
,
params
);
/**
* 查询自己的备件仓
*/
let
getMyReserve
=
async
(
params
=
{})
=>
await
vm
.
$u
.
get
(
parts
+
vm
.
vuex_token
+
'/items/reserve'
,
params
);
const
partsApi
=
{
const
partsApi
=
{
getSiteAddress
,
getSiteAddress
,
getCategoryList
,
getCategoryList
,
getBrandList
,
getBrandList
,
getPartsList
getPartsList
,
getMyReserve
}
}
return
partsApi
return
partsApi
}
}
...
...
src/components/select-parts/index.vue
View file @
54414262
...
@@ -88,6 +88,8 @@
...
@@ -88,6 +88,8 @@
font-size
:
32rpx
;
font-size
:
32rpx
;
color
:
#333
;
color
:
#333
;
font-weight
:
bold
;
font-weight
:
bold
;
height
:
50rpx
;
overflow
:
hidden
;
}
}
.right-content-desc
{
.right-content-desc
{
font-size
:
24rpx
;
font-size
:
24rpx
;
...
@@ -105,6 +107,7 @@
...
@@ -105,6 +107,7 @@
color
:
#999
;
color
:
#999
;
overflow
:
hidden
;
overflow
:
hidden
;
flex
:
1
;
flex
:
1
;
height
:
36rpx
;
}
}
.num
{
.num
{
flex
:
1
;
flex
:
1
;
...
...
src/pages/order/parts.vue
View file @
54414262
<
template
>
<
template
>
<view
class=
"u-flex det-wrap"
>
<view
class=
"u-flex det-wrap"
>
<view
class=
"search"
>
<u-search
:clearabled=
"true"
:action-style=
"searchStyle"
bg-color=
"#fff"
v-model=
"keyword"
@
custom=
"searchParts"
@
search=
"searchParts"
></u-search>
</view>
<view
class=
"content"
v-if=
"lists.length > 0"
>
<view
class=
"content"
v-if=
"lists.length > 0"
>
<scroll-view
style=
"height: 100%;"
scroll-y=
"true"
>
<scroll-view
style=
"height: 100%;"
scroll-y=
"true"
>
<select-parts
<select-parts
...
@@ -9,7 +20,6 @@
...
@@ -9,7 +20,6 @@
:show-checked=
"true"
:show-checked=
"true"
@
numChange=
"numChange($event, index)"
@
numChange=
"numChange($event, index)"
@
selectChange=
"selectChange($event, index)"
@
selectChange=
"selectChange($event, index)"
@
apply=
"apply(index)"
></select-parts>
></select-parts>
</scroll-view>
</scroll-view>
</view>
</view>
...
@@ -27,7 +37,7 @@
...
@@ -27,7 +37,7 @@
<submit-bar
<submit-bar
:partNum=
"partNum"
:partNum=
"partNum"
:num=
"num"
:num=
"num"
:btnStatus=
"
btnStatus
"
:btnStatus=
"
partNum > 0
"
:allChecked=
"allChecked"
:allChecked=
"allChecked"
@
select=
"allSelect"
@
select=
"allSelect"
@
submit=
"submit"
@
submit=
"submit"
...
@@ -46,48 +56,23 @@
...
@@ -46,48 +56,23 @@
},
},
data
()
{
data
()
{
return
{
return
{
lists
:
[
lists
:
[],
{
keyword
:
''
id
:
1
,
name
:
"正泰漏保"
,
no
:
'NO.202006170015'
,
desc
:
'这个空开盒子和其他的空开有什么不一样,这里可以写一下'
,
num
:
1
,
min
:
1
,
max
:
100
,
img
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
,
checked
:
false
,
disabled
:
true
},
{
id
:
1
,
name
:
"挚达广汽充电桩"
,
no
:
'NO.202006170014'
,
desc
:
'这个空开盒子和其他的空开有什么不一样,这里可以写一下'
,
num
:
3
,
min
:
1
,
max
:
5
,
img
:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"
,
checked
:
false
,
disabled
:
true
}
],
val
:
[]
}
}
},
},
computed
:
{
computed
:
{
searchStyle
()
{
return
{
color
:
"#2272FF"
};
},
// 配件数
// 配件数
partNum
()
{
partNum
()
{
return
this
.
lists
.
reduce
((
counter
,
{
checked
})
=>
checked
?
counter
+=
1
:
counter
,
0
)
return
this
.
lists
.
reduce
((
counter
,
{
checked
})
=>
checked
?
counter
+=
1
:
counter
,
0
)
},
},
// 总数
// 总数
num
()
{
num
()
{
return
this
.
lists
.
reduce
((
counter
,
{
checked
,
num
})
=>
checked
?
counter
+=
num
:
counter
,
0
)
return
this
.
lists
.
reduce
((
counter
,
{
checked
,
quantity
})
=>
checked
?
counter
+=
quantity
:
counter
,
0
)
},
// 按钮状态
btnStatus
()
{
const
count
=
this
.
lists
.
reduce
((
counter
,
{
checked
})
=>
checked
?
counter
+=
1
:
counter
,
0
)
return
count
>
0
||
false
},
},
// 全选状态
// 全选状态
allChecked
()
{
allChecked
()
{
...
@@ -95,12 +80,34 @@
...
@@ -95,12 +80,34 @@
return
count
===
0
||
false
return
count
===
0
||
false
}
}
},
},
created
()
{
this
.
getReserve
()
},
methods
:
{
methods
:
{
apply
(
index
)
{
getReserve
()
{
this
.
$set
(
this
.
lists
[
index
],
'disabled'
,
false
)
const
params
=
{
keyword
:
this
.
keyword
}
this
.
$u
.
api
.
getMyReserve
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
const
data
=
res
.
data
||
[]
this
.
lists
=
data
.
map
(
v
=>
{
v
.
min
=
1
v
.
max
=
v
.
stock
v
.
checked
=
false
v
.
quantity
=
v
.
stock
return
v
})
}
})
},
// 搜索配件
searchParts
(
val
)
{
this
.
keyword
=
val
this
.
getReserve
()
},
},
numChange
(
val
,
index
)
{
numChange
(
val
,
index
)
{
this
.
$set
(
this
.
lists
[
index
],
'
num
'
,
val
)
this
.
$set
(
this
.
lists
[
index
],
'
quantity
'
,
val
)
},
},
selectChange
(
val
,
index
)
{
selectChange
(
val
,
index
)
{
this
.
$set
(
this
.
lists
[
index
],
'checked'
,
val
)
this
.
$set
(
this
.
lists
[
index
],
'checked'
,
val
)
...
@@ -112,7 +119,16 @@
...
@@ -112,7 +119,16 @@
})
})
},
},
submit
()
{
submit
()
{
console
.
log
(
'submit'
)
let
pages
=
getCurrentPages
()
let
prevPage
=
pages
[
pages
.
length
-
2
]
const
lists
=
this
.
lists
.
filter
(
v
=>
v
.
checked
).
map
(
v
=>
{
return
{
part_id
:
v
.
skuId
,
quantity
:
v
.
quantity
}
})
console
.
log
(
lists
)
},
},
qnFile
(
src
)
{
qnFile
(
src
)
{
return
process
.
uniEnv
.
qn_base_url
+
src
return
process
.
uniEnv
.
qn_base_url
+
src
...
@@ -123,11 +139,15 @@
...
@@ -123,11 +139,15 @@
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.det-wrap
{
.det-wrap
{
background
:
#fff
;
flex-flow
:
column
;
flex-flow
:
column
;
height
:
100vh
;
height
:
100vh
;
.search
{
width
:
100%
;
padding
:
30rpx
;
}
.content
{
.content
{
border-radius
:
12rpx
;
background
:
#fff
;
border-radius
:
30rpx
30rpx
0
0
;
padding
:
10rpx
10rpx
0
10rpx
;
padding
:
10rpx
10rpx
0
10rpx
;
width
:
100%
;
width
:
100%
;
flex
:
1
;
flex
:
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