Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
a19ebb32
提交
a19ebb32
authored
6月 10, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(promotion): 促销计划_变更计划时_门店可以修改(局限于当前经销商范围内)
新增计划时,门店是所有的
上级
3e263fa4
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
38 行增加
和
35 行删除
+38
-35
plan.js
src/api/promotion/plan.js
+2
-5
index.js
src/hooks/promotion/index.js
+16
-14
index.vue
src/mobile/views/promotion/plan/editing/index.vue
+7
-5
index.vue
src/mobile/views/promotion/plan/index/index.vue
+3
-3
effectivePlan.vue
src/views/promotion/plan/effectivePlan.vue
+10
-8
没有找到文件。
src/api/promotion/plan.js
浏览文件 @
a19ebb32
...
@@ -84,15 +84,12 @@ export function updatePlanByWebAPI(data) {
...
@@ -84,15 +84,12 @@ export function updatePlanByWebAPI(data) {
}
}
// 查询门店列表
// 查询门店列表
export
function
getPlanStoreListAPI
(
queryParams
=
{}
)
{
export
function
getPlanStoreListAPI
(
data
)
{
return
request
({
return
request
({
baseURL
:
VITE_APP_PROMOTION
,
baseURL
:
VITE_APP_PROMOTION
,
url
:
'/user/clientele/query/store/list'
,
url
:
'/user/clientele/query/store/list'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
storeNameVague
:
queryParams
.
storeName
,
storeCode
:
queryParams
.
storeCode
,
}
})
})
}
}
...
...
src/hooks/promotion/index.js
浏览文件 @
a19ebb32
import
{
parseTime
}
from
'@/utils'
import
{
parseTime
}
from
'@/utils'
/**
/**
* 判断计划是否可
编辑
/删除
* 判断计划是否可
变更
/删除
* @param {*} row 计划信息对象
* @param {*} row 计划信息对象
* @returns boolean true 可
编辑/删除,false 不可编辑
/删除
* @returns boolean true 可
变更/删除,false 不可变更
/删除
*/
*/
export
const
checkPlanExpire
=
(
row
)
=>
{
export
const
checkPlanExpire
=
(
row
)
=>
{
// 1. 计划已经开始,不可编辑/删除
// 1. 计划已经开始,不可变更/删除
if
(
row
.
planStatus
===
0
)
{
// 2. 计划未开始,但是上班时间已经 1 小时后,不可变更/删除
return
false
}
// 2. 计划未开始,但是上班时间已经 1 小时后,不可编辑/删除
const
date
=
new
Date
()
const
date
=
new
Date
()
const
rowDate
=
new
Date
(
row
.
clockInTime
)
const
rowDate
=
new
Date
(
row
.
clockInTime
)
rowDate
.
setHours
(
rowDate
.
getHours
()
+
1
)
rowDate
.
setHours
(
rowDate
.
getHours
()
+
1
)
if
(
row
.
planStatus
===
1
&&
rowDate
<
date
)
{
return
!
(
rowDate
<
date
||
row
.
planStatus
===
1
)
return
false
}
}
// 3. 计划为 2 和 3(审核中/审核拒绝),不可编辑/删除
/**
if
(
row
.
planStatus
===
2
||
row
.
planStatus
===
3
)
{
* 判断计划是否可变更(单独判断按钮禁用状态)
return
false
* 活动日期小于等于今日日期,则禁用变更按钮
}
* @param {*} row 计划信息对象
* @returns boolean true 可变更,false 不可变更
*/
export
const
checkPlanChangeExpire
=
(
row
)
=>
{
const
date
=
new
Date
()
const
rowDate
=
new
Date
(
row
.
activityDate
)
return
!
(
rowDate
<=
date
)
}
}
/**
/**
...
...
src/mobile/views/promotion/plan/editing/index.vue
浏览文件 @
a19ebb32
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
<van-cell-group
inset
>
<van-cell-group
inset
>
<van-field
v-model=
"form.storeName"
<van-field
v-model=
"form.storeName"
is-link
is-link
:disabled=
"!!planId"
label=
"选择门店"
label=
"选择门店"
required
required
:rules=
"[
{ required: true, message: '请选择门店' }]"
:rules=
"[
{ required: true, message: '请选择门店' }]"
...
@@ -24,8 +23,7 @@
...
@@ -24,8 +23,7 @@
readonly
readonly
:value=
"form.storeName"
:value=
"form.storeName"
name=
"storeName"
name=
"storeName"
placeholder=
"点击选择门店"
placeholder=
"点击选择门店"
>
:disabled=
"!!planId"
>
<p
v-if=
"form.storeName && !planId"
>
{{
form
.
storeAddr
}}
-
{{
form
.
storeCode
}}
</p>
<p
v-if=
"form.storeName && !planId"
>
{{
form
.
storeAddr
}}
-
{{
form
.
storeCode
}}
</p>
</div>
</div>
</
template
>
</
template
>
...
@@ -33,7 +31,6 @@
...
@@ -33,7 +31,6 @@
<van-field
:modelValue=
"parseTime(form.date, '{y}-{m}-{d}')"
<van-field
:modelValue=
"parseTime(form.date, '{y}-{m}-{d}')"
is-link
is-link
readonly
readonly
:disabled=
"!!planId"
name=
"date"
name=
"date"
label=
"活动日期"
label=
"活动日期"
placeholder=
"点击选择时间"
placeholder=
"点击选择时间"
...
@@ -177,6 +174,7 @@ const route = useRoute()
...
@@ -177,6 +174,7 @@ const route = useRoute()
const
clickBack
=
()
=>
{
const
clickBack
=
()
=>
{
router
.
back
()
router
.
back
()
}
}
const
editDealerId
=
ref
(
null
)
// 变更计划的经销商 ID
const
planId
=
route
.
params
.
planId
const
planId
=
route
.
params
.
planId
const
init
=
async
()
=>
{
const
init
=
async
()
=>
{
...
@@ -188,6 +186,8 @@ const init = async () => {
...
@@ -188,6 +186,8 @@ const init = async () => {
form
.
inTime
=
parseTime
(
res
.
data
.
planInfo
.
clockInTime
,
"{h}:{i}"
)
form
.
inTime
=
parseTime
(
res
.
data
.
planInfo
.
clockInTime
,
"{h}:{i}"
)
form
.
outTime
=
parseTime
(
res
.
data
.
planInfo
.
clockOutTime
,
"{h}:{i}"
)
form
.
outTime
=
parseTime
(
res
.
data
.
planInfo
.
clockOutTime
,
"{h}:{i}"
)
minTime
.
value
=
form
.
inTime
+
":00"
minTime
.
value
=
form
.
inTime
+
":00"
editDealerId
.
value
=
res
.
data
.
planInfo
.
dealerId
}
}
if
(
planId
)
{
if
(
planId
)
{
init
()
init
()
...
@@ -241,7 +241,8 @@ const selStoreName = async () => {
...
@@ -241,7 +241,8 @@ const selStoreName = async () => {
// 获取门店列表
// 获取门店列表
const
getStoreList
=
async
(
storeName
)
=>
{
const
getStoreList
=
async
(
storeName
)
=>
{
const
res
=
await
getPlanStoreListAPI
({
const
res
=
await
getPlanStoreListAPI
({
storeName
storeNameVague
:
storeName
,
dealerId
:
editDealerId
.
value
})
})
columns
.
value
=
res
.
data
.
map
(
item
=>
({
columns
.
value
=
res
.
data
.
map
(
item
=>
({
text
:
item
.
storeName
,
text
:
item
.
storeName
,
...
@@ -352,6 +353,7 @@ const reset = () => {
...
@@ -352,6 +353,7 @@ const reset = () => {
form
.
outTime
=
''
form
.
outTime
=
''
form
.
salary
=
0
form
.
salary
=
0
form
.
incidentals
=
0
form
.
incidentals
=
0
editDealerId
.
value
=
null
}
}
// Picker 选择器
// Picker 选择器
...
...
src/mobile/views/promotion/plan/index/index.vue
浏览文件 @
a19ebb32
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
v
-
if
=
"!showSelect && !query.isDeleted"
>
v
-
if
=
"!showSelect && !query.isDeleted"
>
<
van
-
button
square
<
van
-
button
square
type
=
"success"
type
=
"success"
text
=
"
编辑
"
text
=
"
变更
"
@
click
=
"editPlan(item)"
/>
@
click
=
"editPlan(item)"
/>
<
van
-
button
square
<
van
-
button
square
type
=
"danger"
type
=
"danger"
...
@@ -194,10 +194,10 @@ const querySearch = () => {
...
@@ -194,10 +194,10 @@ const querySearch = () => {
getPlanList
()
getPlanList
()
}
}
//
编辑
计划
//
变更
计划
const
editPlan
=
(
row
)
=>
{
const
editPlan
=
(
row
)
=>
{
if
(
!
checkPlanExpire
(
row
))
{
if
(
!
checkPlanExpire
(
row
))
{
return
proxy
.
$modal
.
msgWarning
(
'无法
编辑
,已执行或之前计划'
)
return
proxy
.
$modal
.
msgWarning
(
'无法
变更
,已执行或之前计划'
)
}
}
router
.
push
(
`/m/promotion_plan_editing/${row.id
}
`
)
router
.
push
(
`/m/promotion_plan_editing/${row.id
}
`
)
}
}
...
...
src/views/promotion/plan/effectivePlan.vue
浏览文件 @
a19ebb32
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
link
link
:disabled=
"!selectableFn(scope.row)"
:disabled=
"!selectableFn(scope.row)"
@
click=
"editFn(scope.row)"
>
@
click=
"editFn(scope.row)"
>
编辑
变更
</el-button>
</el-button>
<el-button
type=
"danger"
<el-button
type=
"danger"
link
link
...
@@ -152,8 +152,7 @@
...
@@ -152,8 +152,7 @@
clearable
clearable
@
change=
"selStoreInfo"
@
change=
"selStoreInfo"
remote
remote
:remote-method=
"remoteStoreMethod"
:remote-method=
"remoteStoreMethod"
>
:disabled=
"!!addOrEditPlanForm.id"
>
<el-option
v-for=
"item in storeList"
<el-option
v-for=
"item in storeList"
:key=
"item.value"
:key=
"item.value"
:label=
"item.label"
:label=
"item.label"
...
@@ -178,8 +177,7 @@
...
@@ -178,8 +177,7 @@
:clearable=
"false"
:clearable=
"false"
start-placeholder=
"活动日期"
start-placeholder=
"活动日期"
value-format=
"YYYY-MM-DDTHH:mm:ss"
value-format=
"YYYY-MM-DDTHH:mm:ss"
:disabled-date=
"disabledDateFn"
:disabled-date=
"disabledDateFn"
/>
:disabled=
"!!addOrEditPlanForm.id"
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
...
@@ -414,18 +412,21 @@ const editFn = (row) => {
...
@@ -414,18 +412,21 @@ const editFn = (row) => {
inTime
:
parseTime
(
row
.
clockInTime
,
"{h}:{i}:{s}"
),
inTime
:
parseTime
(
row
.
clockInTime
,
"{h}:{i}:{s}"
),
outTime
:
parseTime
(
row
.
clockOutTime
,
"{h}:{i}:{s}"
)
outTime
:
parseTime
(
row
.
clockOutTime
,
"{h}:{i}:{s}"
)
}
}
editDealerId
.
value
=
row
.
dealerId
addOrEditPlanVisible
.
value
=
true
addOrEditPlanVisible
.
value
=
true
}
}
/*************** 新增/修改计划弹框 ***************/
/*************** 新增/修改计划弹框 ***************/
// 新增/
编辑
计划表单弹框
// 新增/
变更
计划表单弹框
const
addOrEditPlanVisible
=
ref
(
false
)
const
addOrEditPlanVisible
=
ref
(
false
)
const
addOrEditPlanForm
=
ref
({})
const
addOrEditPlanForm
=
ref
({})
const
activityModeList
=
ref
(
PROMOTION_ACTIVITY_MODE_LIST
)
// 活动模式
const
activityModeList
=
ref
(
PROMOTION_ACTIVITY_MODE_LIST
)
// 活动模式
const
editDealerId
=
ref
(
null
)
// 经销商 ID
// 重置表单
// 重置表单
const
resetAddOrEditPlanForm
=
()
=>
{
const
resetAddOrEditPlanForm
=
()
=>
{
addOrEditPlanForm
.
value
=
{}
addOrEditPlanForm
.
value
=
{}
selecteStoreInfo
.
value
=
''
selecteStoreInfo
.
value
=
''
editDealerId
.
value
=
null
isInfoError
.
value
=
false
isInfoError
.
value
=
false
}
}
// 表单验证(所有都是必填项)
// 表单验证(所有都是必填项)
...
@@ -494,7 +495,8 @@ const selecteStoreInfo = ref('')
...
@@ -494,7 +495,8 @@ const selecteStoreInfo = ref('')
const
isInfoError
=
ref
(
false
)
const
isInfoError
=
ref
(
false
)
const
getStoreList
=
async
()
=>
{
const
getStoreList
=
async
()
=>
{
const
{
data
}
=
await
getPlanStoreListAPI
({
const
{
data
}
=
await
getPlanStoreListAPI
({
storeName
:
addOrEditPlanForm
.
value
.
storeName
storeNameVague
:
addOrEditPlanForm
.
value
.
storeName
,
dealerId
:
editDealerId
.
value
})
})
allStoreList
.
value
=
data
allStoreList
.
value
=
data
storeList
.
value
=
data
.
map
(
item
=>
{
storeList
.
value
=
data
.
map
(
item
=>
{
...
@@ -587,7 +589,7 @@ const selEmployee = () => {
...
@@ -587,7 +589,7 @@ const selEmployee = () => {
}
}
// 保存新增/
编辑
计划
// 保存新增/
变更
计划
const
handleAddOrEditPlan
=
async
()
=>
{
const
handleAddOrEditPlan
=
async
()
=>
{
// 表单校验
// 表单校验
await
proxy
.
$refs
.
addOrEditPlanRef
.
validate
()
await
proxy
.
$refs
.
addOrEditPlanRef
.
validate
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论