Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
op-web-service
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
bp
op-web-service
Commits
2aa07df8
Commit
2aa07df8
authored
Jul 08, 2021
by
mengwenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' of
https://git.yidian-inc.com:8021/bp/op-web-service
into test
parents
1ccd7433
ac77655e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
137 deletions
+125
-137
index.vue
src/pages/Goods/Retail/index.vue
+125
-137
No files found.
src/pages/Goods/Retail/index.vue
View file @
2aa07df8
<
template
>
<layout>
<el-card
class=
"container"
style=
"width: 100%; height: 100%"
>
<el-card
class=
"container"
style=
"width: 100%; height: 100%"
>
<div
class=
"retail"
>
<el-form
inline
:model=
"retailActivitie"
ref=
"retailActivitie"
>
<el-form
inline
:model=
"retailActivitie"
ref=
"retailActivitie"
>
<!-- 查询 -->
<el-row>
<el-form-item
label=
"分销活动id"
prop=
"marketing_id"
>
<el-form-item
label=
"分销活动id"
prop=
"marketing_id"
>
<!-- :rules="[
{ type: 'number', message: '活动id必须为数字值' }]" -->
<el-input
onkeyup=
"value=value.replace(/[^\d]/g,'')"
...
...
@@ -44,10 +34,7 @@
</el-form-item>
<!-- 按钮操作 -->
<el-form-item
class=
"search_button"
>
<el-button
type=
"primary"
@
click=
"toSearch"
>
搜索
</el-button>
<el-button
type=
"primary"
@
click=
"toSearch"
>
搜索
</el-button>
<el-button
@
click=
"reset('retailActivitie')"
>
重置
</el-button>
</el-form-item>
</el-row>
...
...
@@ -55,14 +42,10 @@
type=
"primary"
style=
"margin-bottom: 10px"
@
click=
"createDtb"
>
创建分销活动
</el-button>
<!-- Tab -->
<el-table
:data=
"tableData"
type=
"index"
align=
"center"
border
>
创建分销活动
</el-button
>
<!-- Tab -->
<el-table
:data=
"tableData"
type=
"index"
align=
"center"
border
>
<el-table-column
align=
"center"
prop=
"marketing_id"
...
...
@@ -94,20 +77,18 @@
label=
"二级分销金额"
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"online_status"
label=
"状态"
>
<el-table-column
align=
"center"
prop=
"online_status"
label=
"状态"
>
<template
#
default=
"scope"
>
<span
:style=
"
{ color: scope.row.online_status == 3 ? 'red' : '' }">
<span
:style=
"
{ color: scope.row.online_status == 3 ? 'red' : '' }"
>
{{
scope
.
row
.
online_status
==
2
?
"关闭"
:
scope
.
row
.
online_status
==
1
?
"启用"
:
"到期"
}}
scope
.
row
.
online_status
==
2
?
"关闭"
:
scope
.
row
.
online_status
==
1
?
"启用"
:
"到期"
}}
</span>
</
template
>
</el-table-column>
...
...
@@ -117,17 +98,9 @@
label=
"创建人"
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"create_time"
label=
"创建时间"
>
<el-table-column
align=
"center"
prop=
"create_time"
label=
"创建时间"
>
</el-table-column>
<el-table-column
align=
"center"
prop=
"update_time"
label=
"更新时间"
>
<el-table-column
align=
"center"
prop=
"update_time"
label=
"更新时间"
>
</el-table-column>
<el-table-column
align=
"center"
...
...
@@ -135,24 +108,22 @@
label=
"分销到期时间"
>
</el-table-column>
<el-table-column
fixed=
"right"
align=
"center"
label=
"操作"
>
<el-table-column
fixed=
"right"
align=
"center"
label=
"操作"
>
<
template
#
default=
"scope"
>
<el-button
@
click=
"handleClick(scope.row)"
type=
"text"
size=
"mini"
>
查看
</el-button>
>
查看
</el-button
>
<el-button
type=
"text"
size=
"mini"
@
click
.
stop=
"handelEnable(scope.row, 2)"
v-if=
"
scope.row.online_status === 1 && scope.row.online_status !== 3
"
scope.row.online_status === 1 &&
scope.row.online_status !== 3
"
>
关闭
</el-button>
...
...
@@ -160,10 +131,12 @@
type=
"text"
size=
"mini"
v-if=
"
scope.row.online_status === 2 && scope.row.online_status !== 3
"
scope.row.online_status === 2 &&
scope.row.online_status !== 3
"
@
click
.
stop=
"handelEnable(scope.row, 1)"
>
启用
</el-button>
>
启用
</el-button
>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -210,20 +183,21 @@
:disabled=
"shopStart !== 0"
></el-input>
</el-form-item>
<el-form-item
label=
"一级佣金:"
prop=
"first_commission_value"
>
<el-form-item
label=
"一级佣金:"
prop=
"first_commission_value"
>
<el-input
v-model=
"ruleForm.first_commission_value"
v-model
.
number
=
"ruleForm.first_commission_value"
:disabled=
"shopStart !== 0"
></el-input>
>
<
template
#
append
>
%
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"二级佣金: "
>
<el-form-item
label=
"二级佣金: "
prop=
"second_commission_value"
>
<el-input
v-model=
"ruleForm.second_commission_value"
v-model
.
number
=
"ruleForm.second_commission_value"
:disabled=
"shopStart !== 0"
></el-input>
>
<
template
#
append
>
%
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"活动生效时间:"
>
<el-date-picker
...
...
@@ -248,10 +222,7 @@
ref=
"ruleIdForm"
size=
"mini"
>
<div
class=
"queryBox"
v-show=
"shopStart == 0"
>
<div
class=
"queryBox"
v-show=
"shopStart == 0"
>
<el-form-item
label=
"关联商品:"
>
</el-form-item>
<el-form-item
label=
"商品id:"
>
<el-input
...
...
@@ -270,7 +241,8 @@
size=
"mini"
style=
"margin-bottom: 30px"
@
click=
"findProducts"
>
查询
</el-button>
>
查询
</el-button
>
</div>
<div
:class=
"shopStart == 0 ? 'newTab' : 'readTab'"
>
<el-table
...
...
@@ -283,10 +255,7 @@
style=
"width: 100%"
@
selection-change=
"selectGoodsChange"
>
<el-table-column
align=
"center"
type=
"selection"
>
<el-table-column
align=
"center"
type=
"selection"
>
</el-table-column>
<el-table-column
align=
"center"
...
...
@@ -320,11 +289,7 @@
</div>
<
template
#
footer
>
<span
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"cancel"
style=
"width: 150px"
>
{{
<el-button
type=
"primary"
@
click=
"cancel"
style=
"width: 150px"
>
{{
shopStart
==
0
?
"取消"
:
"返回"
}}
</el-button>
<el-button
...
...
@@ -332,7 +297,8 @@
@
click=
"addList"
style=
"width: 150px"
v-if=
"shopStart == 0"
>
确 定
</el-button>
>
确 定
</el-button
>
</span>
</
template
>
</el-dialog>
...
...
@@ -343,12 +309,11 @@ import {
getFindGoodsList
,
getAddMarketingList
,
getMarketingInfo
,
updateMarketingList
updateMarketingList
,
}
from
"@/service/Goods/goods"
;
import
{
ElMessage
}
from
"element-plus"
;
import
Layout
from
"../layout/index.vue"
;
// 开启关闭防抖
function
debounce
(
callback
,
delay
)
{
function
debounce
(
callback
,
delay
)
{
let
timer
=
null
;
return
function
(...
args
)
{
if
(
timer
)
{
...
...
@@ -362,24 +327,35 @@ function debounce (callback, delay) {
}
export
default
{
name
:
"GoodsRetail"
,
components
:
{
Layout
},
data
()
{
data
()
{
// var commission = (rule, value, callback) => {
// // if (!value) {
// // return callback(new Error("请填写一级佣金"));
// // }
// setTimeout(() => {
// if (!Number.isInteger(value)) {
// callback(new Error("请输入数字值"));
// } else {
// callback();
// }
// }, 100);
// };
return
{
tableData
:
[
{
create_user_email
:
"v-pengyuqian@yidian-inc.com"
}
],
tableData
:
[],
// 详情页
detailInfo
:
{
marketing_name
:
""
,
first_commission_value
:
""
,
second_commission_value
:
""
,
start_time
:
""
,
end_time
:
""
end_time
:
""
,
},
goods_list
:
[],
options
:
[
{
value
:
0
,
label
:
"全部"
},
{
value
:
1
,
label
:
"启用"
},
{
value
:
2
,
label
:
"关闭"
},
{
value
:
3
,
label
:
"到期"
}
{
value
:
3
,
label
:
"到期"
}
,
],
// 搜索条件
retailActivitie
:
{
...
...
@@ -388,8 +364,8 @@ export default {
goods_sku_id
:
""
,
online_status
:
[],
page
:
1
,
page_size
:
5
,
count
:
0
page_size
:
20
,
count
:
0
,
},
ruleForm
:
{
...
...
@@ -398,26 +374,38 @@ export default {
second_commission_value
:
""
,
start_time
:
""
,
end_time
:
""
,
goods_sku_id
:
[]
goods_sku_id
:
[]
,
},
timeSelect
:
[],
ruleIdForm
:
{
life_account_id
:
""
,
goods_sku_id
:
""
,
start_time
:
""
,
end_time
:
""
end_time
:
""
,
},
rules
:
{
marketing_name
:
[
{
required
:
true
,
message
:
"请输入活动名称"
,
trigger
:
"blur"
},
{
min
:
1
,
max
:
50
,
message
:
"长度在 50个字符内"
,
trigger
:
"blur"
}
{
min
:
1
,
max
:
50
,
message
:
"长度在 50个字符内"
,
trigger
:
"blur"
}
,
],
first_commission_value
:
[
{
required
:
true
,
message
:
"请填写一级佣金"
,
trigger
:
"blur"
}
]
// goods_sku_id: [
// { type: "number", message: "商品id必须为数字值", trigger: "change" },
// ],
{
required
:
true
,
// validator: commission,
message
:
"请填写一级佣金"
,
trigger
:
"blur"
,
},
{
type
:
"number"
,
message
:
"必须为数值型"
},
// { validator: commission, trigger: "change" },
],
second_commission_value
:
[
{
type
:
"number"
,
message
:
"必须为数值型"
},
// {
// validator: commission,
// trigger: "change",
// },
],
},
allList
:
[],
dialogFormVisible
:
false
,
...
...
@@ -426,12 +414,12 @@ export default {
endTime
:
""
,
marketing_id
:
""
,
marketing_info
:
{},
disabled
:
false
disabled
:
false
,
};
},
methods
:
{
// 查看详情列表
async
handleClick
(
row
)
{
async
handleClick
(
row
)
{
this
.
dialogFormVisible
=
true
;
this
.
shopStart
=
1
;
this
.
disabled
=
true
;
...
...
@@ -447,13 +435,13 @@ export default {
}
},
// 页码变化
handleCurrentChange
(
e
)
{
handleCurrentChange
(
e
)
{
this
.
retailActivitie
.
page
=
e
;
this
.
getMarketingList
();
},
// 营销活动列表
async
getMarketingList
()
{
async
getMarketingList
()
{
try
{
const
res
=
await
getMarketingList
(
this
.
retailActivitie
);
this
.
tableData
=
res
.
result
;
...
...
@@ -490,42 +478,48 @@ export default {
// ElMessage("请求开启状态失败");
// }
// },
// 开启关闭
handelEnable
:
debounce
(
async
function
(
row
,
type
)
{
try
{
await
updateMarketingList
({
const
res
=
await
updateMarketingList
({
marketing_id
:
row
.
marketing_id
,
online_status
:
type
online_status
:
type
,
});
this
.
getMarketingList
();
ElMessage
.
success
(
type
===
1
?
"状态已启用"
:
"状态已关闭"
);
// const res = {code:4150007,reason:"更新失败",status:"failed"}
if
(
res
.
code
!==
0
)
{
ElMessage
.
error
(
res
.
reason
);
}
else
{
this
.
getMarketingList
();
ElMessage
.
success
(
type
===
1
?
"状态已启用"
:
"状态已关闭"
);
}
}
catch
(
error
)
{
ElMessage
.
error
(
"请求开启状态失败"
);
}
},
300
),
// 创建分销活动
createDtb
()
{
createDtb
()
{
this
.
dialogFormVisible
=
true
;
this
.
shopStart
=
0
;
},
// 重置
reset
(
retailActivitie
)
{
reset
(
retailActivitie
)
{
(
this
.
retailActivitie
=
{
marketing_id
:
""
,
marketing_name
:
""
,
goods_sku_id
:
""
,
online_status
:
[],
page
:
1
,
page_size
:
5
page_size
:
20
,
}),
this
.
$refs
[
retailActivitie
].
resetFields
();
this
.
getMarketingList
({});
},
// 搜索
toSearch
()
{
toSearch
()
{
this
.
getMarketingList
();
console
.
log
(
this
.
retailActivitie
);
},
selectTime
(
e
)
{
selectTime
(
e
)
{
let
date
=
new
Date
();
if
(
e
&&
e
[
1
]
<
date
)
{
ElMessage
(
`'活动结束时间不能早于当前时间'`
);
...
...
@@ -533,9 +527,9 @@ export default {
}
},
// 获取时间格式
formatTime
(
date
)
{
formatTime
(
date
)
{
// 封装函数判断是否要在目标前边加 ’0‘
function
getStr
(
target
)
{
function
getStr
(
target
)
{
return
(
""
+
target
).
length
===
1
?
"0"
+
target
:
target
;
}
// 获取月
...
...
@@ -556,7 +550,7 @@ export default {
return
timeStr
;
},
// 查询商品列表
async
findProducts
()
{
async
findProducts
()
{
// 获取参数
const
{
goods_sku_id
,
life_account_id
}
=
this
.
ruleIdForm
;
let
[
start_time
,
end_time
]
=
this
.
timeSelect
;
...
...
@@ -573,7 +567,7 @@ export default {
goods_sku_id
,
life_account_id
,
start_time
,
end_time
end_time
,
};
try
{
// 发请求
...
...
@@ -585,18 +579,18 @@ export default {
ElMessage
.
error
(
"请求查询商品列表失败"
);
}
},
selectGoodsChange
(
e
)
{
this
.
ruleForm
.
goods_sku_id
=
e
.
map
(
item
=>
item
.
goods_sku_id
);
selectGoodsChange
(
e
)
{
this
.
ruleForm
.
goods_sku_id
=
e
.
map
(
(
item
)
=>
item
.
goods_sku_id
);
},
async
getAllList
()
{
async
getAllList
()
{
let
all
=
await
getMarketingList
({
page
:
1
,
page_size
:
this
.
retailActivitie
.
count
page_size
:
this
.
retailActivitie
.
count
,
});
this
.
allList
=
all
.
result
;
},
// 添加活动列表
async
addList
()
{
async
addList
()
{
console
.
log
(
this
.
ruleForm
.
goods_sku_id
);
if
(
this
.
ruleForm
.
goods_sku_id
.
length
<=
0
)
{
ElMessage
(
"请选择商品"
);
...
...
@@ -606,11 +600,8 @@ export default {
this
.
ruleForm
.
goods_sku_id
&&
this
.
ruleForm
.
goods_sku_id
.
join
(
","
);
}
// console.log(goods_sku_id);
let
{
marketing_name
,
first_commission_value
,
second_commission_value
}
=
this
.
ruleForm
;
let
{
marketing_name
,
first_commission_value
,
second_commission_value
}
=
this
.
ruleForm
;
let
[
start_time
,
end_time
]
=
this
.
timeSelect
;
if
(
!
marketing_name
||
...
...
@@ -627,7 +618,7 @@ export default {
first_commission_value
,
second_commission_value
,
start_time
:
this
.
formatTime
(
start_time
),
end_time
:
this
.
formatTime
(
end_time
)
end_time
:
this
.
formatTime
(
end_time
)
,
};
// let resList = [];
// // 遍历选择的商品
...
...
@@ -668,14 +659,14 @@ export default {
},
// 清空
resetDate
()
{
resetDate
()
{
(
this
.
ruleForm
=
{
marketing_name
:
""
,
first_commission_value
:
""
,
second_commission_value
:
""
,
start_time
:
""
,
end_time
:
""
,
goods_sku_id
:
[]
goods_sku_id
:
[]
,
}),
(
this
.
timeSelect
=
[]),
(
this
.
goods_list
=
[]),
...
...
@@ -683,20 +674,20 @@ export default {
life_account_id
:
""
,
goods_sku_id
:
""
,
start_time
:
""
,
end_time
:
""
end_time
:
""
,
});
},
// 取消
cancel
()
{
cancel
()
{
this
.
dialogFormVisible
=
false
;
this
.
resetDate
();
this
.
getMarketingList
();
}
}
,
},
created
()
{
created
()
{
this
.
getMarketingList
();
this
.
getAllList
();
}
}
,
};
</
script
>
<
style
lang=
"less"
scoped
>
...
...
@@ -732,9 +723,6 @@ export default {
.container
>>>
.el-card__body
{
width
:
100%
;
}
/* .bor >>> .el-row {
width: 100%;
} */
.queryBox
>>>
.el-form-item--mini
,
.marketing
{
margin-top
:
0
;
...
...
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