Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-app-operator-master
Commits
5570f6ee
Commit
5570f6ee
authored
Oct 14, 2023
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量設置路線價格可以勾選篩選結果
parent
088a5859
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
33 deletions
+93
-33
product.js
src/api/ecw/product.js
+9
-0
index.vue
src/components/ProductsSelector/index.vue
+35
-21
index.vue
src/views/ecw/coupon/index.vue
+23
-2
batchEdit.vue
src/views/ecw/productPrice/batchEdit.vue
+12
-5
batchIncrease.vue
src/views/ecw/productPrice/batchIncrease.vue
+14
-5
No files found.
src/api/ecw/product.js
View file @
5570f6ee
...
...
@@ -61,6 +61,15 @@ export function getProductPage(query) {
})
}
// 获得产品ID
export
function
getProductIds
(
params
)
{
return
request
({
url
:
'
/ecw/product/simpleIdList
'
,
params
,
method
:
'
get
'
})
}
// 导出产品 Excel
export
function
exportProductExcel
(
query
)
{
return
request
({
...
...
src/components/ProductsSelector/index.vue
View file @
5570f6ee
...
...
@@ -3,18 +3,19 @@
<div
class=
"flex-1"
>
<el-card>
<div
slot=
"header"
class=
"header"
>
<el-select
v-model=
"queryParams.typeId"
:placeholder=
"$t('选择类型')"
style=
"width:120px"
clearable
>
<el-select
v-model=
"queryParams.typeId"
:placeholder=
"$t('选择类型')"
style=
"width:120px"
clearable
@
change=
"getList"
:disabled=
"loading"
>
<el-option
v-for=
"item in typeList"
:key=
"item.id"
:label=
"item.titleZh"
:value=
"item.id"
/>
</el-select>
<el-select
v-model=
"queryParams.attrId"
:placeholder=
"$t('选择属性')"
style=
"width:120px"
clearable
>
<el-select
v-model=
"queryParams.attrId"
:placeholder=
"$t('选择属性')"
style=
"width:120px"
clearable
@
change=
"getList"
:disabled=
"loading"
>
<el-option
v-for=
"item in attrList"
:key=
"item.id"
:label=
"item.attrName"
:value=
"item.id"
/>
</el-select>
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('产品关键字')"
style=
"width:120px"
clearable
/>
<el-button
type=
"primary"
@
click=
"reLoad"
>
{{
$t
(
'
搜索
'
)
}}
</el-button>
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('产品关键字')"
style=
"width:120px"
clearable
:disabled=
"loading"
/>
<el-button
type=
"primary"
@
click=
"reLoad"
:loading=
"loading"
>
{{
$t
(
'
搜索
'
)
}}
</el-button>
<div
v-if=
"showAll"
>
<el-checkbox
:label=
"$t('全选') + `($
{total > 500 ? $t('最多500') : $t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct">
</el-checkbox>
<el-checkbox
:label=
"$t('全选库内商品(共
{cnt}个)', {cnt: allTotal})" v-model="isAllProduct">
</el-checkbox>
<el-checkbox
:label=
"$t('全选') + `($
{total > 500 ? $t('最多500') : $t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct || loading">
</el-checkbox>
<el-checkbox
:label=
"$t('全选库内商品(共
{cnt}个)', {cnt: allTotal})" v-model="isAllProduct" :disabled="loading">
</el-checkbox>
<el-checkbox
v-if=
"showFiltered && enableFiltered"
:label=
"$t('根据商品搜索结果(共
{cnt}个)', {cnt: total})" v-model="isAllFiltered" :disabled="loading">
</el-checkbox>
</div>
</div>
<div
class=
"list"
>
...
...
@@ -28,9 +29,9 @@
<div
class=
"flex-1 ml-10"
>
<el-card
style=
"height:100%"
>
<div
slot=
"header"
class=
"header flex"
>
<div
class=
"flex-1 flex items-center"
>
{{
$t
(
'
已选{cnt
}
个产品
'
,
{
cnt
:
isAllProduct
?
total
:
choosedList
.
length
}
)
}}
<
/div
>
<div
class=
"flex-1 flex items-center"
>
{{
$t
(
'
已选{cnt
}
个产品
'
,
{
cnt
:
isAllProduct
||
isAllFiltered
?
total
:
choosedList
.
length
}
)
}}
<
/div
>
<
el
-
button
v
-
if
=
"
choosedList.length
"
type
=
"
text
"
@
click
=
"
clearAll
"
>
{{
$t
(
'
全部清除
'
)
}}
<
/el-button
>
<
el
-
button
:
disabled
=
"
!
choosedList.length
"
type
=
"
text
"
@
click
=
"
clearAll
"
>
{{
$t
(
'
全部清除
'
)
}}
<
/el-button
>
<
/div
>
<
div
class
=
"
list
"
>
<
div
class
=
"
item
"
v
-
for
=
"
(choosed) in choosedList
"
:
key
=
"
choosed.id
"
:
data
-
data
=
"
JSON.stringify(choosed)
"
>
...
...
@@ -43,7 +44,7 @@
<
/div
>
<
/template
>
<
script
>
import
{
getProductPage
,
getProductList
}
from
'
@/api/ecw/product
'
import
{
getProductPage
,
getProductList
,
getProductIds
}
from
'
@/api/ecw/product
'
import
{
getProductTypeList
}
from
'
@/api/ecw/productType
'
import
{
getProductAttrList
}
from
'
@/api/ecw/productAttr
'
...
...
@@ -56,10 +57,13 @@ export default {
}
}
,
showAll
:
Boolean
,
isall
:
Boolean
isall
:
Boolean
,
// 是否允许勾选全部搜索结果,优惠券那边无法回显所以不能启用,编辑路线价格等不需要回显的场景可以启用
enableFiltered
:
Boolean
}
,
data
()
{
return
{
loading
:
false
,
list
:
[],
page
:
1
,
pages
:
1
,
...
...
@@ -75,7 +79,10 @@ export default {
choosedList
:
[],
typeList
:
[],
attrList
:
[],
isAllProduct
:
false
isAllProduct
:
false
,
isAllFiltered
:
false
,
// 是否全部搜索结果
// 是否显示搜索结果勾选,有筛选条件才显示
showFiltered
:
false
}
}
,
computed
:
{
...
...
@@ -101,6 +108,11 @@ export default {
this
.
choosedList
=
[]
this
.
$emit
(
'
setall
'
,
isAllProduct
)
}
,
isAllFiltered
(
isAllFiltered
){
this
.
choosedList
=
[]
this
.
isAllProduct
=
false
this
.
$emit
(
'
setFiltered
'
,
isAllFiltered
)
}
,
defaultIds
(
newValue
,
oldValue
){
if
(
!
oldValue
||
!
oldValue
.
length
){
this
.
loadDefaultProds
()
...
...
@@ -158,21 +170,23 @@ export default {
this
.
getList
()
}
,
getList
()
{
this
.
loading
=
true
getProductPage
(
this
.
queryParams
).
then
(
res
=>
{
this
.
list
=
res
.
data
.
list
//.concat(res.data.list || [])
this
.
page
=
res
.
data
.
page
this
.
pages
=
res
.
data
.
pages
this
.
total
=
res
.
data
.
total
// this.choosedList = [] //搜搜重置,数据回显
/* if (this.defaultIds.length > 0) {
this.defaultIds.map(item => {
this.list.map(items => {
if (items.id == item) {
this.choosedList.push(items)
}
}
)
}
)
}
*/
// 必须在搜索之后才显示勾选,这个时候才有数量
this
.
showFiltered
=
!!
this
.
queryParams
.
attrId
||
!!
this
.
queryParams
.
titleZh
||
!!
this
.
queryParams
.
typeId
}
).
finally
(()
=>
{
this
.
loading
=
false
}
)
}
,
// 获得指定条件的商品的全部ID
getFilteredIds
(){
return
getProductIds
(
this
.
queryParams
).
then
(
res
=>
{
return
res
.
data
}
)
}
,
toggleCheck
(
item
,
checked
)
{
...
...
src/views/ecw/coupon/index.vue
View file @
5570f6ee
...
...
@@ -70,7 +70,7 @@
<
el
-
table
-
column
:
label
=
"
$t('结束时间')
"
align
=
"
center
"
prop
=
"
endTime
"
width
=
"
180
"
>
<
template
slot
-
scope
=
"
{row
}
"
>
<
div
:
style
=
"
{color: !row.overdueStatus ? 'red' : null
}
"
>
{{
parseTime
(
row
.
endTime
,
'
{y
}
-{m
}
-{d
}
'
)
}}
<
/div
>
<
div
v
-
if
=
"
!row.overdueStatus
"
style
=
"
color: red
"
>
{{
$t
(
'
已过期
'
)
}}
<
/div
>
<
div
style
=
"
color: red
"
>
{{
!
row
.
overdueStatus
?
$t
(
'
已过期
'
)
:
expireTips
(
row
.
endTime
)
}}
<
/div
>
<
/template
>
<
/el-table-column
>
<!--
...
...
@@ -115,7 +115,7 @@
v
-
hasPermi
=
"
['ecw:coupon:update']
"
>
{{
$t
(
'
编辑
'
)
}}
<
/el-button
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-edit
"
@
click
=
"
handleCopy(scope.row)
"
v
-
hasPermi
=
"
['ecw:coupon:copy']
"
>
{{
$t
(
'
复制
'
)
}}
<
/el-button
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-edit
"
@
click
=
"
updateEndtimeItem = scope.row
"
v
-
if
=
"
scope.row.endTime
&& scope.row.status
"
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-edit
"
@
click
=
"
updateEndtimeItem = scope.row
"
v
-
if
=
"
scope.row.endTime
"
v
-
hasPermi
=
"
['ecw:coupon:delay']
"
>
{{
$t
(
'
延期
'
)
}}
<
/el-button
>
<
el
-
button
size
=
"
mini
"
type
=
"
text
"
icon
=
"
el-icon-delete
"
@
click
=
"
handleDelete(scope.row)
"
v
-
hasPermi
=
"
['ecw:coupon:delete']
"
>
{{
$t
(
'
删除
'
)
}}
<
/el-button
>
...
...
@@ -232,6 +232,27 @@ export default {
{
required
:
!
this
.
updateEndtimeForm
.
forever
,
message
:
"
请填写结束时间
"
}
]
}
}
,
expireTips
(){
return
endTime
=>
{
if
(
!
endTime
)
return
''
console
.
log
({
endTime
}
)
// 7天以内用红色标注提醒:“还有N天到期”,最后一天显示1天过期
let
endDate
=
new
Date
(
endTime
.
replace
(
/-/g
,
'
/
'
))
if
(
endDate
.
getHours
()
==
0
){
endDate
.
setHours
(
23
)
endDate
.
setMinutes
(
59
)
endDate
.
setSeconds
(
59
)
}
let
now
=
new
Date
()
let
diff
=
endDate
.
getTime
()
-
now
.
getTime
()
let
days
=
Math
.
ceil
(
diff
/
(
24
*
60
*
60
*
1000
))
if
(
days
<=
1
){
return
this
.
$t
(
'
1天内过期
'
)
}
else
if
(
days
<=
7
){
return
this
.
$t
(
'
还有{days
}
天到期
'
,
{
days
}
)
}
}
}
}
,
watch
:{
...
...
src/views/ecw/productPrice/batchEdit.vue
View file @
5570f6ee
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"150px"
>
<products-selector
ref=
"productSelector"
v-model=
"form.productIdList"
show-all
@
setall=
"isAllProduct=$event"
:default-ids=
"form.productIdList"
class=
"mb-20"
/>
<products-selector
ref=
"productSelector"
v-model=
"form.productIdList"
show-all
@
setall=
"isAllProduct=$event"
:default-ids=
"form.productIdList"
enable-filtered
@
setFiltered=
"isAllFilteredProduct=$event"
class=
"mb-20"
/>
<routers-selector
v-model=
"selectedRoutes"
:type=
"type"
/>
...
...
@@ -216,6 +216,7 @@ export default {
// dayLimit: 10000
}
,
isAllProduct
:
false
,
// 是否全部商品
isAllFilteredProduct
:
false
,
// 是否勾選全部搜索結果
specialProducts
:
[],
// priceStepList: [
{
}
,{
}
],
// 阶梯价格
// specialList:[], // 特殊需求,默认四个
...
...
@@ -465,14 +466,20 @@ export default {
this
.
$message
.
error
(
this
.
$t
(
'
请选择线路
'
));
return
;
}
if
(
!
this
.
isAllProduct
&&
(
!
this
.
form
.
productIdList
||
!
this
.
form
.
productIdList
.
length
)){
return
this
.
$message
.
error
(
'
请选择商品
'
)
}
let
data
=
Object
.
assign
({
}
,
this
.
form
,
{
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct
:
this
.
isAllProduct
?
1
:
0
}
)
// 如果是勾選了全部篩選商品,則獲取商品ID
if
(
this
.
isAllFilteredProduct
){
data
.
productIdList
=
await
this
.
$refs
.
productSelector
.
getFilteredIds
()
}
if
(
!
data
.
isAllProduct
&&
(
!
data
.
productIdList
||
!
data
.
productIdList
.
length
)){
return
this
.
$message
.
error
(
'
请选择商品
'
)
}
/* if(this.form.stepPrice == 1){
data.priceStepList = this.form.priceStepList
}
*/
...
...
@@ -488,7 +495,7 @@ export default {
}
await
this
.
$confirm
(
this
.
$t
(
'
已选择{route
}
条路线,{product
}
个商品;确认提交修改?
'
,
{
route
:
data
.
lineChannelList
.
length
,
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
this
.
form
.
productIdList
.
length
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
data
.
productIdList
.
length
}
))
this
.
loading
=
true
batchUpdateProductPrice
(
data
).
then
(
response
=>
{
...
...
src/views/ecw/productPrice/batchIncrease.vue
View file @
5570f6ee
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"150px"
>
<products-selector
ref=
"productSelector"
v-model=
"form.productIdList"
show-all
@
setall=
"isAllProduct=$event"
:default-ids=
"form.productIdList"
class=
"mb-20"
/>
<products-selector
ref=
"productSelector"
v-model=
"form.productIdList"
show-all
@
setall=
"isAllProduct=$event"
enable-filtered
@
setFiltered=
"isAllFilteredProduct=$event"
:default-ids=
"form.productIdList"
class=
"mb-20"
/>
<routers-selector
v-model=
"selectedRoutes"
:type=
"type"
/>
...
...
@@ -96,6 +98,7 @@ export default {
stepPrice
:
0
},
isAllProduct
:
false
,
// 是否全部商品
isAllFilteredProduct
:
false
,
// 是否全部篩選商品
specialProducts
:
[],
rules
:
{},
product
:
null
,
...
...
@@ -252,15 +255,21 @@ export default {
this
.
$message
.
error
(
this
.
$t
(
'
请选择线路
'
));
return
;
}
if
(
!
this
.
isAllProduct
&&
(
!
this
.
form
.
productIdList
||
!
this
.
form
.
productIdList
.
length
)){
return
this
.
$message
.
error
(
'
请选择商品
'
)
}
let
data
=
Object
.
assign
({},
this
.
form
,
{
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct
:
this
.
isAllProduct
?
1
:
0
})
// 如果是勾選了全部篩選商品,則獲取商品ID
if
(
this
.
isAllFilteredProduct
){
data
.
productIdList
=
await
this
.
$refs
.
productSelector
.
getFilteredIds
()
}
if
(
!
data
.
isAllProduct
&&
(
!
data
.
productIdList
||
!
data
.
productIdList
.
length
)){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择商品
'
)
+
"
!
"
)
}
data
.
lineChannelList
=
this
.
selectedRoutes
if
(
data
.
lineChannelList
.
length
<
1
){
...
...
@@ -268,7 +277,7 @@ export default {
}
await
this
.
$confirm
(
this
.
$t
(
'
已选择{route}条路线,{product}个商品;确认提交修改?
'
,
{
route
:
data
.
lineChannelList
.
length
,
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
this
.
form
.
productIdList
.
length
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
data
.
productIdList
.
length
}))
this
.
loading
=
true
batchAddPrice
(
data
).
then
(
async
(
response
)
=>
{
...
...
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