Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
e96c275b
提交
e96c275b
authored
4月 22, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(plan-search): 拆分搜索计划组件为单独的 vue 文件
同上
上级
c3f7190e
全部展开
显示空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
287 行增加
和
96 行删除
+287
-96
plan.js
src/api/promotion/plan.js
+1
-15
PickerSearch.vue
src/components/Mobile/PickerSearch.vue
+5
-21
index.js
src/dicts/index.js
+3
-5
index.vue
src/mobile/views/examine/index.vue
+24
-24
index.vue
src/mobile/views/promotion/plan/detail/index.vue
+2
-2
index.vue
src/mobile/views/promotion/plan/editing/index.vue
+4
-4
index.vue
src/mobile/views/promotion/plan/index/index.vue
+0
-0
plan-search.vue
src/mobile/views/promotion/plan/index/plan-search.vue
+220
-0
user.js
src/store/modules/user.js
+4
-4
date.js
src/utils/date.js
+14
-11
index.vue
src/views/promotion/plan/index.vue
+10
-10
没有找到文件。
src/api/promotion/plan.js
浏览文件 @
e96c275b
...
...
@@ -7,21 +7,7 @@ export function getPlanListAPI(queryParams) {
baseURL
:
VITE_APP_PROMOTION
,
url
:
'/plan/v2/query/page'
,
method
:
'POST'
,
data
:
{
pageNum
:
queryParams
.
pageNum
,
pageSize
:
queryParams
.
pageSize
,
queryParams
:
{
activityStartDate
:
queryParams
.
activityDate
&&
queryParams
.
activityDate
[
0
],
activityEndDate
:
queryParams
.
activityDate
&&
queryParams
.
activityDate
[
1
],
planStatus
:
queryParams
.
planStatus
,
province
:
queryParams
.
province
,
city
:
queryParams
.
city
,
dealerId
:
queryParams
.
zoneId
,
orgQcId
:
queryParams
.
warzoneId
,
employeeId
:
queryParams
.
employeeId
,
storeNameLike
:
queryParams
.
storeName
}
}
data
:
queryParams
})
}
...
...
src/components/Mobile/PickerSearch.vue
浏览文件 @
e96c275b
<
template
>
<div>
<van-popup
v-model:show=
"innerShowPicker"
<van-popup
destroy-on-close
round
teleport=
"body"
position=
"bottom"
@
close=
"onPopupClose"
>
<van-picker
:columns=
"columns"
<van-picker
:columns=
"columns"
:cancel-button-text=
"searchShow ? '' : '取消'"
@
confirm=
"onConfirm"
>
<template
#
title
>
...
...
@@ -24,16 +23,10 @@
</
template
>
</van-picker>
</van-popup>
</div>
</template>
<
script
setup
>
const
props
=
defineProps
({
// 控制弹窗显示隐藏
modelValue
:
{
type
:
Boolean
,
default
:
false
},
// 选择器列数据
columns
:
{
type
:
Array
,
...
...
@@ -52,22 +45,15 @@ const props = defineProps({
});
// 定义向外触发的事件
const
emit
=
defineEmits
([
'
update:modelValue'
,
'
confirm'
,
'search'
]);
const
emit
=
defineEmits
([
'confirm'
,
'search'
]);
// 内部显示状态
const
innerShowPicker
=
ref
(
props
.
modelValue
);
// 搜索文本
const
searchText
=
ref
(
''
);
// 监听 props 变化更新内部状态
watch
(()
=>
props
.
modelValue
,
(
newValue
)
=>
{
innerShowPicker
.
value
=
newValue
;
});
// 弹窗关闭时触发
const
onPopupClose
=
()
=>
{
searchText
.
value
=
''
;
emit
(
'
update:modelValue'
,
false
);
emit
(
'
search'
,
''
);
};
/**
...
...
@@ -77,8 +63,6 @@ const onPopupClose = () => {
*/
const
onConfirm
=
(
values
)
=>
{
emit
(
'confirm'
,
values
);
emit
(
'update:modelValue'
,
false
);
};
/**
...
...
src/dicts/index.js
浏览文件 @
e96c275b
...
...
@@ -11,17 +11,15 @@ export const getPromotionRole = (role) => {
}
// 促销活动状态
export
const
NOT_EXECUTION
=
'NOT_EXECUTION'
// 未执行
export
const
EXECUTION
=
'EXECUTION'
// 执行
// 后台:返回数字,又让我传给他英文字符
// 后台:返回数字,又让我传给他英文字符,页面展示中文
export
const
PROMOTION_STATUS
=
{
0
:
{
label
:
'未执行'
,
value
:
NOT_EXECUTION
value
:
'NOT_EXECUTION'
},
1
:
{
label
:
'执行'
,
value
:
EXECUTION
value
:
'EXECUTION'
}
}
export
const
getPromotionActiveStatus
=
(
statusNum
)
=>
{
...
...
src/mobile/views/examine/index.vue
浏览文件 @
e96c275b
...
...
@@ -231,7 +231,7 @@ const decreaseCount = async () => {
temNum
:
form
.
value
.
temNum
-
1
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
form
.
value
.
temNum
--
;
}
...
...
@@ -243,7 +243,7 @@ const increaseCount = async () => {
temNum
:
form
.
value
.
temNum
+
1
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
form
.
value
.
temNum
++
;
};
...
...
@@ -302,14 +302,14 @@ const storePictureRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storePicture
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除店铺门头照
...
...
@@ -319,7 +319,7 @@ const deleteStorePicture = async () => {
storePicture
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -331,7 +331,7 @@ const planStatusChange = async (val) => {
planStatus
:
form
.
value
.
planStatus
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -342,7 +342,7 @@ const changeStoreDd = async () => {
storeDd
:
form
.
value
.
storeDd
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -357,7 +357,7 @@ const changeTemOnWork = async () => {
temOnWork
:
form
.
value
.
temOnWork
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemOnWorkTimeRange
=
()
=>
{
...
...
@@ -378,7 +378,7 @@ const changeTemHs = async () => {
temHs
:
form
.
value
.
temHs
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemWl
=
async
()
=>
{
...
...
@@ -387,7 +387,7 @@ const changeTemWl = async () => {
temWl
:
form
.
value
.
temWl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
const
changeTemZz
=
async
()
=>
{
...
...
@@ -396,7 +396,7 @@ const changeTemZz = async () => {
temZz
:
form
.
value
.
temZz
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -406,7 +406,7 @@ const temWorkPhotosRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
// 如果当前对象包含 objectUrl 则是组件上传的,替换当前元素的对象
const
index
=
form
.
value
.
temWorkPhotos
.
findIndex
(
o
=>
o
.
objectUrl
)
form
.
value
.
temWorkPhotos
[
index
]
=
{
...
...
@@ -418,7 +418,7 @@ const temWorkPhotosRead = async (file) => {
temWorkPhotos
:
form
.
value
.
temWorkPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -429,7 +429,7 @@ const deleteTemWorkPhotos = async () => {
temWorkPhotos
:
form
.
value
.
temWorkPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -439,14 +439,14 @@ const storeTcPhotoRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storeTcPhoto
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -457,7 +457,7 @@ const deleteStoreTcPhoto = async () => {
storeTcPhoto
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -467,14 +467,14 @@ const temOnWorkPictureRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
await
createExamine
({
id
:
form
.
value
.
id
,
storeZhjPhoto
:
pictureUrl
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除主货架照片
...
...
@@ -484,7 +484,7 @@ const deleteStoreZhjPhoto = async () => {
storeZhjPhoto
:
''
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -494,7 +494,7 @@ const posPhotosRead = async (file) => {
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
theDate
=
date
.
getDate
()
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
const
pictureUrl
=
await
uploadFileToOSSAPI
(
`examine/
${
date
.
getFullYear
()}
-
${
month
}
/
${
theDate
}
/
${
planId
.
value
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.png`
,
file
.
file
)
// 判断 objectUrl
const
index
=
form
.
value
.
posPhotos
.
findIndex
(
o
=>
o
.
objectUrl
)
form
.
value
.
posPhotos
[
index
]
=
{
...
...
@@ -506,7 +506,7 @@ const posPhotosRead = async (file) => {
posPhotos
:
form
.
value
.
posPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
// 删除 POS 照片
...
...
@@ -516,7 +516,7 @@ const deletePosPhotos = async () => {
posPhotos
:
form
.
value
.
posPhotos
.
map
(
o
=>
o
.
url
),
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
@@ -527,7 +527,7 @@ const posRmbChange = async () => {
posRmb
:
form
.
value
.
posRmb
||
0
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
})
}
...
...
src/mobile/views/promotion/plan/detail/index.vue
浏览文件 @
e96c275b
...
...
@@ -95,7 +95,7 @@ import { parseTime } from '@/utils'
import
userStore
from
'@/store/modules/user'
const
{
proxy
}
=
getCurrentInstance
()
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
// 获取路由路径上的 id 参数
const
route
=
useRoute
();
const
router
=
useRouter
();
...
...
@@ -215,7 +215,7 @@ const clickExamine = async () => {
planStatus
:
planDetail
.
value
.
planStatus
===
0
?
'否'
:
'是'
,
employeeId
:
userStore
().
userInfo
.
userId
,
// 稽查人id
employeeName
:
userStore
().
userInfo
.
nickName
,
// 稽查人名字
employeeNo
:
userStore
().
getE
mployeeNo
,
// 稽查人工号
employeeNo
:
userStore
().
e
mployeeNo
,
// 稽查人工号
}
)
if
(
!
result
.
data
)
{
return
proxy
.
$modal
.
msgError
(
'创建稽查任务失败'
)
...
...
src/mobile/views/promotion/plan/editing/index.vue
浏览文件 @
e96c275b
...
...
@@ -153,7 +153,7 @@ import userStore from '@/store/modules/user'
import
{
parseTime
}
from
'@/utils'
const
myForm
=
ref
({})
const
{
proxy
}
=
getCurrentInstance
();
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
const
form
=
reactive
({})
const
router
=
useRouter
();
const
route
=
useRoute
()
...
...
@@ -197,7 +197,7 @@ const validatorIncidentals = (value, obj) => {
}
}
const
onSubmit
=
async
()
=>
{
const
data
=
userStore
().
getE
mployeeInfo
const
data
=
userStore
().
e
mployeeInfo
for
(
const
key
in
data
)
{
form
[
key
]
=
data
[
key
]
}
...
...
@@ -278,8 +278,8 @@ const getBelongList = async () => {
columns
.
value
=
allBelongList
.
value
// 判断如果是城市经理,则设置默认归属人为自己
if
(
isCityManager
.
value
)
{
form
.
employeeName
=
userStore
().
getE
mployeeName
form
.
employeeNo
=
userStore
().
getE
mployeeNo
form
.
employeeName
=
userStore
().
e
mployeeName
form
.
employeeNo
=
userStore
().
e
mployeeNo
}
}
getBelongList
()
...
...
src/mobile/views/promotion/plan/index/index.vue
浏览文件 @
e96c275b
差异被折叠。
点击展开。
src/mobile/views/promotion/plan/index/plan-search.vue
0 → 100644
浏览文件 @
e96c275b
<
template
>
<!-- 搜索组件 -->
<van-popup
position=
"right"
class=
"wrap"
>
<!-- 快捷日期 -->
<van-field
readonly
label=
"快捷日期"
>
<template
#
input
>
<van-button
size=
"small"
type=
"primary"
v-for=
"item in pickerOptions"
@
click=
"pickerSelDate(item)"
>
{{
item
.
text
}}
</van-button>
</
template
>
</van-field>
<!-- 日期区间 -->
<van-field
:modelValue=
"searchDateStr"
is-link
readonly
label=
"日期范围"
placeholder=
"选择日期"
@
click=
"selSearchCalendar"
>
</van-field>
<van-calendar
v-model:show=
"showCalendar"
:min-date=
"searchMinDate"
:show-mark=
"false"
type=
"range"
allow-same-day
teleport=
"body"
:default-date=
"[query.activityStartDate, query.activityEndDate]"
@
confirm=
"confirmCalendar"
/>
<!-- 活动类型 -->
<van-field
v-model=
"query.planStatus"
is-link
readonly
label=
"活动状态"
placeholder=
"选择活动状态"
@
click=
"showPlanStatus = true"
>
</van-field>
<van-popup
v-model:show=
"showPlanStatus"
destroy-on-close
teleport=
"body"
position=
"bottom"
>
<van-picker
:model-value=
"[planColumns.find(o => o.text === query.planStatus)?.value]"
:columns=
"planColumns"
@
cancel=
"showPlanStatus = false"
@
confirm=
"confirmPlan"
/>
</van-popup>
<!-- 归属人 -->
<van-field
:model-value=
"showEmployeeList.find(o => o.value === query.employeeId)?.text"
is-link
readonly
label=
"归属人"
placeholder=
"选择归属人"
:disabled=
"promotionIdentity"
@
click=
"showEmployee = true"
>
</van-field>
<PickerSearch
v-model:show=
"showEmployee"
:columns=
"showEmployeeList"
placeholder=
"搜索归属人"
@
confirm=
"onEmployeeConfirm"
@
search=
"searchEmployee"
/>
<!-- 店铺名 -->
<van-field
v-model=
"query.storeNameLike"
label=
"店铺名"
placeholder=
"请输入店铺名"
@
update:model-value=
"searchByStoreName"
clearable
/>
<!-- 重置按钮 -->
<van-button
icon=
"replay"
class=
"reset-btn"
block
@
click=
"resetFn"
>
重置
</van-button>
</van-popup>
</template>
<
script
setup
>
import
{
parseTime
}
from
'@/utils'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
userStore
from
'@/store/modules/user'
const
promotionIdentity
=
computed
(()
=>
userStore
().
promotionIdentity
)
const
employeeNo
=
computed
(()
=>
userStore
().
employeeNo
)
const
{
recentPickerOptions
:
pickerOptions
}
=
useDatePickerOptions
()
const
query
=
reactive
({})
const
props
=
defineProps
({
planColumns
:
{
// 活动状态列表
type
:
Array
,
default
:
[]
},
allEmpolyeeList
:
{
// 所有归属人
type
:
Array
,
default
:
[]
}
})
const
emits
=
defineEmits
([
'query'
])
watch
(
query
,
()
=>
{
emits
(
'query'
,
query
)
},
{
deep
:
true
})
// 选择快捷日期
const
pickerSelDate
=
(
item
)
=>
{
let
[
startTime
,
endTime
]
=
item
.
value
()
// 拿到日期对象
// 同步更新单独选择日期的选择器和参数
query
.
activityStartDate
=
startTime
query
.
activityEndDate
=
endTime
}
// 选择日期区间
const
showCalendar
=
ref
(
false
)
const
searchDateStr
=
computed
(()
=>
{
if
(
!
query
.
activityStartDate
||
!
query
.
activityEndDate
)
{
return
''
}
return
[
query
.
activityStartDate
,
query
.
activityEndDate
].
map
(
o
=>
parseTime
(
o
,
"{y}-{m}-{d}"
)).
join
(
' 至 '
)
})
// 日历最小范围
const
searchMinDate
=
computed
(()
=>
{
return
new
Date
(
!
query
.
activityStartDate
?
new
Date
().
getFullYear
()
-
1
:
query
.
activityStartDate
.
getFullYear
()
-
1
,
0
,
1
)
})
// 日期日历范围
const
selSearchCalendar
=
()
=>
{
// 默认设置今日日期
if
(
!
query
.
activityStartDate
||
!
query
.
activityEndDate
)
{
query
.
activityStartDate
=
new
Date
()
query
.
activityEndDate
=
new
Date
()
}
showCalendar
.
value
=
true
}
// 确定日期
const
confirmCalendar
=
(
value
)
=>
{
showCalendar
.
value
=
false
query
.
activityStartDate
=
value
[
0
]
query
.
activityEndDate
=
value
[
1
]
}
// 活动状态
const
showPlanStatus
=
ref
(
false
)
// 选中的活动状态
const
confirmPlan
=
(
val
)
=>
{
query
.
planStatus
=
val
.
selectedOptions
[
0
].
text
showPlanStatus
.
value
=
false
}
// 归属人
const
showEmployee
=
ref
(
false
)
// 展示归属人
const
showEmployeeList
=
ref
([])
watch
(()
=>
props
.
allEmpolyeeList
,
(
newValue
)
=>
{
showEmployeeList
.
value
=
newValue
// 如果是城市经理默认填充
if
(
promotionIdentity
.
value
)
{
// 找到员工的 id
const
obj
=
newValue
.
find
(
o
=>
o
.
employeeNo
===
employeeNo
.
value
)
query
.
employeeId
=
obj
.
value
}
})
const
searchEmployee
=
(
searchName
)
=>
{
showEmployeeList
.
value
=
props
.
allEmpolyeeList
.
filter
(
item
=>
{
return
item
.
text
.
includes
(
searchName
)
})
}
// 确定归属人
const
onEmployeeConfirm
=
(
val
)
=>
{
query
.
employeeId
=
val
.
selectedOptions
[
0
].
value
showEmployee
.
value
=
false
}
// 店铺名
const
searchByStoreName
=
(
val
)
=>
{
query
.
storeNameLike
=
val
}
// 重置
const
resetFn
=
()
=>
{
query
.
activityStartDate
=
''
query
.
activityEndDate
=
''
query
.
planStatus
=
''
query
.
employeeId
=
''
query
.
storeNameLike
=
''
}
</
script
>
<
style
scoped
lang=
"scss"
>
.wrap
{
--van-field-label-width
:
80px
;
height
:
100vh
;
width
:
85%
!
important
;
.van-field
:first-of-type
{
.van-button
{
margin
:
0
2
.5px
;
padding
:
0
5px
;
font-size
:
12px
!
important
;
}
}
.van-search
{
width
:
60%
;
}
.reset-btn
{
margin-top
:
20px
;
}
}
</
style
>
\ No newline at end of file
src/store/modules/user.js
浏览文件 @
e96c275b
...
...
@@ -95,11 +95,11 @@ export default defineStore(
},
getters
:
{
// 获取促销系统身份(true 城市经理)
getP
romotionIdentity
(
state
)
{
p
romotionIdentity
(
state
)
{
return
getPromotionRole
(
state
.
userInfo
.
privilegeId
)
===
CITY_MANAGER
},
// 获取员工工号,姓名,id
getE
mployeeInfo
(
state
)
{
e
mployeeInfo
(
state
)
{
return
{
operNo
:
state
.
userInfo
.
userName
,
operName
:
state
.
userInfo
.
nickName
,
...
...
@@ -107,11 +107,11 @@ export default defineStore(
}
},
// 获取员工工号
getE
mployeeNo
(
state
)
{
e
mployeeNo
(
state
)
{
return
state
.
userInfo
.
userName
},
// 获取员工姓名
getE
mployeeName
(
state
)
{
e
mployeeName
(
state
)
{
return
state
.
userInfo
.
nickName
}
}
...
...
src/utils/date.js
浏览文件 @
e96c275b
// 把日期对象转成年-月-日前面补0 的数组
/**
* 把日期对象转成年-月-日前面补0 的数组
* @param {*} date 日期对象
* @returns [年,月,日]
* @example 2023-09-01 => [2023, 09, 01]
*/
export
function
formatDateToArr
(
date
)
{
const
year
=
date
.
getFullYear
();
// 获取年份
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 获取月份并补零
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
);
// 获取日期并补零
return
[
year
,
month
,
day
];
}
/**
* 生成时间列表
* @param {*} startDate 起始时间
...
...
@@ -207,13 +221,3 @@ export function addDateRange(params, dateRange, propName) {
return
search
;
}
/**
* 生成唯一字符串
* @returns {string}
*/
export
function
createUniqueString
()
{
const
timestamp
=
+
new
Date
()
+
''
const
randomNum
=
parseInt
((
1
+
Math
.
random
())
*
65536
)
+
''
return
(
+
(
randomNum
+
timestamp
)).
toString
(
32
)
}
\ No newline at end of file
src/views/promotion/plan/index.vue
浏览文件 @
e96c275b
...
...
@@ -461,7 +461,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
import
{
usePromotionHooks
}
from
'@/hooks'
const
{
proxy
}
=
getCurrentInstance
();
const
isCityManager
=
ref
(
userStore
().
getP
romotionIdentity
)
const
isCityManager
=
ref
(
userStore
().
p
romotionIdentity
)
const
{
recentPickerOptions
:
pickerOptions
}
=
useDatePickerOptions
()
const
queryParams
=
reactive
({
...
...
@@ -707,9 +707,9 @@ const getPlanList = async () => {
// 城市经理查自己,职能角色查所有
if
(
isCityManager
.
value
)
{
// 城市经理 (用员工 ID(1,2,3),而不是工号,employeeNo 是工号(000535))
queryParams
.
employeeId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
getE
mployeeNo
)?.
value
queryParams
.
employeeId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
e
mployeeNo
)?.
value
// 先从归属人查询当前登录用户的战区 ID
queryParams
.
warzoneId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
getE
mployeeNo
)?.
deptQcId
queryParams
.
warzoneId
=
belongPerList
.
value
.
find
(
item
=>
item
.
employeeNo
===
userStore
().
e
mployeeNo
)?.
deptQcId
}
// 日期格式化一下
if
(
queryParams
.
activityDate
?.
length
>
0
)
{
...
...
@@ -811,11 +811,11 @@ const uploadFile = async (file) => {
// 拼接当前月数为文件夹名
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
targetAPI
=
isCityManager
.
value
?
addPlanAPI
:
addPlanByRoleAPI
const
res
=
await
targetAPI
({
"excelUrl"
:
excelUrl
,
"employeeNo"
:
userStore
().
getE
mployeeNo
"employeeNo"
:
userStore
().
e
mployeeNo
})
planTableList
.
value
=
res
.
data
.
table
confirmExcelUUID
.
value
=
res
.
data
.
uuid
...
...
@@ -1061,7 +1061,7 @@ const handleAdd = () => {
resetAddOrEditPlanForm
()
// 只有城市经理情况下,默认填充当前登录人为归属人
if
(
isCityManager
.
value
)
{
addOrEditPlanForm
.
value
.
employeeNo
=
userStore
().
getE
mployeeNo
addOrEditPlanForm
.
value
.
employeeNo
=
userStore
().
e
mployeeNo
}
addOrEditPlanVisible
.
value
=
true
}
...
...
@@ -1116,7 +1116,7 @@ const editFn = (row) => {
const
handleAddOrEditPlan
=
async
()
=>
{
// 表单校验
await
addOrEditPlanRef
.
value
.
validate
()
addOrEditPlanForm
.
value
.
operNo
=
userStore
().
getE
mployeeNo
addOrEditPlanForm
.
value
.
operNo
=
userStore
().
e
mployeeNo
addOrEditPlanForm
.
value
.
operName
=
store
.
state
.
value
.
user
.
userInfo
.
nickName
addOrEditPlanForm
.
value
.
operId
=
store
.
state
.
value
.
user
.
userInfo
.
userId
...
...
@@ -1154,7 +1154,7 @@ const handleDelete = async () => {
})
await
deletePlanAPI
({
planIds
:
checkedRowList
.
value
.
map
(
o
=>
o
.
id
),
employeeNo
:
userStore
().
getE
mployeeNo
employeeNo
:
userStore
().
e
mployeeNo
})
ElMessage
.
success
(
'删除成功'
)
getPlanList
()
...
...
@@ -1221,10 +1221,10 @@ const uploadChangeFile = async (file) => {
// 拼接当前月数为文件夹名
const
date
=
new
Date
()
const
month
=
date
.
getMonth
()
+
1
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
getE
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
excelUrl
=
await
uploadFileToOSSAPI
(
`planExcel/
${
date
.
getFullYear
()}
-
${
month
}
/
${
userStore
().
e
mployeeNo
}
/
${
uuidv4
()}
.xlsx`
,
file
.
file
)
const
res
=
await
updatePlanAPI
({
"excelUrl"
:
excelUrl
,
"employeeNo"
:
userStore
().
getE
mployeeNo
"employeeNo"
:
userStore
().
e
mployeeNo
})
planTableList
.
value
=
res
.
data
.
table
confirmExcelUUID
.
value
=
res
.
data
.
uuid
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论