Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
245c93c7
提交
245c93c7
authored
4月 18, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(add-edit): 促销计划移动端_新增编辑删除
同上
上级
2f99bade
全部展开
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
185 行增加
和
27 行删除
+185
-27
plan.js
src/api/promotion/plan.js
+1
-1
PickerSearch.vue
src/components/Mobile/PickerSearch.vue
+102
-0
main.js
src/main.js
+7
-1
index.vue
src/mobile_views/index.vue
+0
-12
index.vue
src/mobile_views/promotion/examine/index.vue
+0
-0
add-edit.vue
src/mobile_views/promotion/plan/add-edit.vue
+0
-0
index.vue
src/mobile_views/promotion/plan/detail/index.vue
+0
-0
index.vue
src/mobile_views/promotion/plan/index.vue
+47
-4
index.js
src/router/index.js
+12
-6
user.js
src/store/modules/user.js
+12
-0
index.js
src/utils/index.js
+2
-1
index.vue
src/views/promotion/plan/index.vue
+2
-2
没有找到文件。
src/api/promotion/plan.js
浏览文件 @
245c93c7
...
...
@@ -130,7 +130,7 @@ export function batchUpdatePlanAPI(data) {
})
}
//
mobile 端:
查询计划详情(获取促销员打卡任务列表)
// 查询计划详情(获取促销员打卡任务列表)
export
function
getPlanDetailAPI
(
id
)
{
return
request
({
baseURL
:
VITE_APP_PROMOTION
,
...
...
src/components/Mobile/PickerSearch.vue
0 → 100644
浏览文件 @
245c93c7
<
template
>
<div>
<van-popup
v-model:show=
"innerShowPicker"
destroy-on-close
round
position=
"bottom"
@
close=
"onPopupClose"
>
<van-picker
:columns=
"columns"
:cancel-button-text=
"searchShow ? '' : '取消'"
@
confirm=
"onConfirm"
>
<template
#
title
>
<!-- 搜索框 -->
<van-search
v-if=
"searchShow"
v-model=
"searchText"
:placeholder=
"placeholder"
shape=
"round"
@
update:model-value=
"onSearch"
/>
</
template
>
<
template
#
empty
>
<van-empty
image=
"https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
image-size=
"40"
description=
"暂无数据"
/>
</
template
>
</van-picker>
</van-popup>
</div>
</template>
<
script
setup
>
const
props
=
defineProps
({
// 控制弹窗显示隐藏
modelValue
:
{
type
:
Boolean
,
default
:
false
},
// 选择器列数据
columns
:
{
type
:
Array
,
default
:
()
=>
[]
},
// 占位提示文字
placeholder
:
{
type
:
String
,
default
:
'请输入搜索内容'
},
// 搜索是否显示
searchShow
:
{
type
:
Boolean
,
default
:
true
}
});
// 定义向外触发的事件
const
emit
=
defineEmits
([
'update:modelValue'
,
'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
);
};
/**
* 选择器确认事件处理函数
* @param values - 选中的值
* @param indexes - 选中项的索引
*/
const
onConfirm
=
(
values
)
=>
{
emit
(
'confirm'
,
values
);
emit
(
'update:modelValue'
,
false
);
};
/**
* 搜索事件处理函数
* @param values - 搜索的值
*/
const
onSearch
=
(
values
)
=>
{
emit
(
'search'
,
values
);
}
</
script
>
<
style
scoped
>
.van-search
{
flex
:
1
;
}
::v-deep
(
.van-picker__confirm
)
{
width
:
70px
;
}
</
style
>
\ No newline at end of file
src/main.js
浏览文件 @
245c93c7
...
...
@@ -55,7 +55,11 @@ import XLToolTip from '@/components/XLToolTip'
import
XlSelect
from
'@/components/XLSelect'
// 开窗查询组件
import
OpenDialog
from
'@/components/OpenDialog'
// 只有在移动端引入 flexible.js
// 移动端组件
import
PickerSearch
from
'@/components/Mobile/PickerSearch'
// 只有在移动端引入
if
(
isMobile
())
{
(
function
()
{
const
docEl
=
document
.
documentElement
;
...
...
@@ -102,6 +106,8 @@ app.component('BackToUp', BackToUp)
app
.
component
(
'XlToolTip'
,
XLToolTip
)
app
.
component
(
'XlSelect'
,
XlSelect
)
app
.
component
(
'OpenDialog'
,
OpenDialog
)
// 移动端组件
app
.
component
(
'PickerSearch'
,
PickerSearch
)
// 全局插件
app
.
use
(
plugins
)
...
...
src/mobile_views/index.vue
deleted
100644 → 0
浏览文件 @
2f99bade
<
template
>
<div>
这里只是针对移动设备开放的页面
</div>
</
template
>
<
script
setup
>
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
src/mobile_views/examine/index.vue
→
src/mobile_views/
promotion/
examine/index.vue
浏览文件 @
245c93c7
File moved
src/mobile_views/promotion/plan/add-edit.vue
0 → 100644
浏览文件 @
245c93c7
差异被折叠。
点击展开。
src/mobile_views/promotion/detail/index.vue
→
src/mobile_views/promotion/
plan/
detail/index.vue
浏览文件 @
245c93c7
File moved
src/mobile_views/promotion/p
romotion
.vue
→
src/mobile_views/promotion/p
lan/index
.vue
浏览文件 @
245c93c7
<
template
>
<div
class=
"mobile-container"
>
<van-nav-bar
right-text=
"搜索"
left-text=
"新增计划"
@
click-left=
"$router.push('/promotion_add')"
@
click-right=
"showSearch = true"
placeholder
fixed
/>
...
...
@@ -14,9 +16,9 @@
finished-text=
"没有更多了"
@
load=
"onLoad"
>
<van-cell-group
inset
>
<van-cell
v-for=
"item in planList"
:key=
"item.id"
:title=
"item.storeName"
<van-
swipe-
cell
v-for=
"item in planList"
:key=
"item.id"
>
<van-cell
:title=
"item.storeName"
:to=
"`/promotion_detail/$
{item.id}`">
<template
#
label
>
<p
class=
"employee"
>
{{
item
.
employeeName
}}
</p>
...
...
@@ -29,6 +31,17 @@
<p>
{{
parseTime
(
item
.
date
,
'{y
}
-{m
}
-{d
}
(周{a
}
)'
)
}}
<
/p
>
<
/template
>
<
/van-cell
>
<
template
#
right
>
<
van
-
button
square
type
=
"success"
text
=
"编辑"
@
click
=
"editPlan(item)"
/>
<
van
-
button
square
type
=
"danger"
text
=
"删除"
@
click
=
"deletePlan(item)"
/>
<
/template
>
<
/van-swipe-cell
>
<
/van-cell-group
>
<
/van-list
>
<
/van-pull-refresh
>
...
...
@@ -152,8 +165,10 @@ defineOptions({
}
)
import
{
parseTime
}
from
'@/utils'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
{
getChargeListAPI
,
getPlanListAPI
}
from
'@/api'
import
{
getChargeListAPI
,
getPlanListAPI
,
deletePlanAPI
}
from
'@/api'
import
store
from
'@/store'
import
useUserStore
from
'@/store/modules/user'
const
{
proxy
}
=
getCurrentInstance
();
const
{
recentPickerOptions
:
pickerOptions
,
thisYearDate
}
=
useDatePickerOptions
(
0
)
const
router
=
useRouter
()
...
...
@@ -355,6 +370,25 @@ const resetFn = () => {
getPlanList
()
}
// 编辑计划
const
editPlan
=
(
row
)
=>
{
router
.
push
(
`/promotion_add/${row.id
}
`
)
}
// 删除计划
const
deletePlan
=
(
row
)
=>
{
proxy
.
$modal
.
confirm
(
`确认删除计划吗?`
).
then
(
async
()
=>
{
await
deletePlanAPI
({
planIds
:
[
row
.
id
],
employeeNo
:
useUserStore
().
getEmployeeNo
}
)
proxy
.
$modal
.
msgSuccess
(
'删除成功'
)
// 找到 row 在数组里第几条删除
const
index
=
planList
.
value
.
findIndex
(
item
=>
item
.
id
===
row
.
id
)
planList
.
value
.
splice
(
index
,
1
)
}
)
}
<
/script
>
<
style
scoped
...
...
@@ -421,4 +455,12 @@ const resetFn = () => {
.
van
-
search
{
width
:
60
%
;
}
::
v
-
deep
(.
van
-
swipe
-
cell__right
)
{
display
:
flex
;
button
{
height
:
100
%
;
}
}
<
/style>
\ No newline at end of file
src/router/index.js
浏览文件 @
245c93c7
...
...
@@ -95,22 +95,28 @@ export const constantMobileRoutes = [
},
{
path
:
'/promotion'
,
component
:
()
=>
import
(
'@/mobile_views/promotion/p
romotion
'
),
name
:
'Mobile_promotion'
,
// 和组件内的名字保持一致
component
:
()
=>
import
(
'@/mobile_views/promotion/p
lan/index
'
),
name
:
'Mobile_promotion'
,
hidden
:
true
,
meta
:
{
keepAlive
:
true
}
// 标记该路由需要缓存
},
{
path
:
'/promotion_detail/:id'
,
component
:
()
=>
import
(
'@/mobile_views/promotion/detail'
),
path
:
'/promotion_detail/:id'
,
// 促销计划详情页
component
:
()
=>
import
(
'@/mobile_views/promotion/
plan/
detail'
),
name
:
'Detail'
,
hidden
:
true
,
},
{
path
:
'/examine/:examineId'
,
component
:
()
=>
import
(
'@/mobile_views/examine'
),
path
:
'/examine/:examineId'
,
// 稽查任务页
component
:
()
=>
import
(
'@/mobile_views/
promotion/
examine'
),
name
:
'Examine'
,
hidden
:
true
,
},
{
path
:
'/promotion_add/:planId?'
,
// 新增促销计划页
component
:
()
=>
import
(
'@/mobile_views/promotion/plan/add-edit'
),
name
:
'AddAndEdit'
,
hidden
:
true
,
}
]
...
...
src/store/modules/user.js
浏览文件 @
245c93c7
...
...
@@ -98,9 +98,21 @@ export default defineStore(
getPromotionIdentity
(
state
)
{
return
getPromotionRole
(
state
.
userInfo
.
privilegeId
)
===
CITY_MANAGER
},
// 获取员工工号,姓名,id
getEmployeeInfo
(
state
)
{
return
{
operNo
:
state
.
userInfo
.
userName
,
operName
:
state
.
userInfo
.
nickName
,
operId
:
state
.
userInfo
.
userId
}
},
// 获取员工工号
getEmployeeNo
(
state
)
{
return
state
.
userInfo
.
userName
},
// 获取员工姓名
getEmployeeName
(
state
)
{
return
state
.
userInfo
.
nickName
}
}
})
...
...
src/utils/index.js
浏览文件 @
245c93c7
...
...
@@ -162,7 +162,7 @@ export function toggleClass(element, className) {
* @param {boolean} immediate
* @return {*}
*/
export
function
debounce
(
func
,
wait
,
immediate
)
{
export
function
debounce
(
func
,
wait
=
500
,
immediate
)
{
let
timeout
,
args
,
context
,
timestamp
,
result
const
later
=
function
()
{
...
...
@@ -189,6 +189,7 @@ export function debounce(func, wait, immediate) {
// 如果延时不存在,重新设定延时
if
(
!
timeout
)
timeout
=
setTimeout
(
later
,
wait
)
if
(
callNow
)
{
console
.
log
(
args
,
'args'
)
result
=
func
.
apply
(
context
,
args
)
context
=
args
=
null
}
...
...
src/views/promotion/plan/index.vue
浏览文件 @
245c93c7
...
...
@@ -266,8 +266,8 @@
inline
>
<el-row>
<el-col
:span=
"12"
>
<!--
门店列表
-->
<el-form-item
label=
"
门店列表
"
<!--
选择门店
-->
<el-form-item
label=
"
选择门店
"
prop=
"storeCode"
>
<el-select
v-model=
"addOrEditPlanForm.storeCode"
placeholder=
"请选择门店"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论