提交 0a2b5f86 authored 作者: lidongxu's avatar lidongxu

feat(inspectiontask): 新增:勤策移动端_售点稽查_陈列分组支持删除操作

上级 528b218c
...@@ -41,3 +41,12 @@ export function getInspectionTaskListAPI(params) { ...@@ -41,3 +41,12 @@ export function getInspectionTaskListAPI(params) {
params params
}) })
} }
// 售点稽查-删除 tab 里面子任务中的小分组
export function deleteInspectionTaskAPI(params) {
return request({
url: '/operation/risk/core/d_store_detail',
method: 'DELETE',
params
})
}
\ No newline at end of file
...@@ -165,6 +165,10 @@ import { showImagePreview } from 'vant'; ...@@ -165,6 +165,10 @@ import { showImagePreview } from 'vant';
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
defineOptions({
name: 'inspectionTask',
})
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<!-- 常规陈列 --> <!-- 常规陈列 -->
<div class="item" <div class="item"
v-for="(obj, index) in displayGroup"> v-for="(obj, index) in displayGroup">
<p class="title">常规陈列{{ index + 1 }}</p> <p class="title">
<span>常规陈列{{ index + 1 }}</span>
<van-icon name="delete"
size="0.45rem"
@click="deleteItem(obj, index)" />
</p>
<van-cell-group inset> <van-cell-group inset>
<van-field v-model="obj.modal" <van-field v-model="obj.modal"
name="modal" name="modal"
...@@ -72,7 +77,7 @@ ...@@ -72,7 +77,7 @@
</template> </template>
<script setup> <script setup>
import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI } from '@/api' import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI, deleteInspectionTaskAPI } from '@/api'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
...@@ -126,6 +131,30 @@ const init = () => { ...@@ -126,6 +131,30 @@ const init = () => {
createTask() createTask()
} }
} }
// 删除分组
const isDeleteNow = ref(false)
const deleteItem = async (obj, index) => {
// 确认询问框
showConfirmDialog({
title: '删除提示',
message: '确定删除吗?',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
isDeleteNow.value = true
await deleteInspectionTaskAPI({
rstdId: obj.rstdId
})
displayGroup.value.splice(index, 1)
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
})
}
/*************** 基本信息 ***************/ /*************** 基本信息 ***************/
// 形式修改 // 形式修改
const handleModalityChange = async (index) => { const handleModalityChange = async (index) => {
...@@ -186,6 +215,7 @@ const deletedisplayPhotos = async (file, { name, index }) => { ...@@ -186,6 +215,7 @@ const deletedisplayPhotos = async (file, { name, index }) => {
} }
// 核查结果 // 核查结果
const handleVerifyChange = async (index) => { const handleVerifyChange = async (index) => {
if (isDeleteNow.value) return
const target = displayGroup.value[index] const target = displayGroup.value[index]
await createInspectionTaskDetailAPI({ await createInspectionTaskDetailAPI({
taskDetail: { taskDetail: {
...@@ -224,6 +254,9 @@ defineExpose({ ...@@ -224,6 +254,9 @@ defineExpose({
margin: 0; margin: 0;
font-weight: 900; font-weight: 900;
color: var(--main-color); color: var(--main-color);
display: flex;
justify-content: space-between;
} }
/* 每个分组 */ /* 每个分组 */
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<!-- 档期补差 --> <!-- 档期补差 -->
<div class="item" <div class="item"
v-for="(obj, index) in displayGroup"> v-for="(obj, index) in displayGroup">
<p class="title">档期补差{{ index + 1 }}</p> <p class="title">
<span>档期补差{{ index + 1 }}</span>
<van-icon name="delete"
size="0.45rem"
@click="deleteItem(obj, index)" />
</p>
<van-cell-group inset> <van-cell-group inset>
<van-field v-model="obj.modal" <van-field v-model="obj.modal"
name="modal" name="modal"
...@@ -71,7 +76,7 @@ ...@@ -71,7 +76,7 @@
<script setup> <script setup>
import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI } from '@/api' import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI, deleteInspectionTaskAPI } from '@/api'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
...@@ -125,6 +130,29 @@ const init = () => { ...@@ -125,6 +130,29 @@ const init = () => {
createTask() createTask()
} }
} }
// 删除分组
const isDeleteNow = ref(false)
const deleteItem = async (obj, index) => {
// 确认询问框
showConfirmDialog({
title: '删除提示',
message: '确定删除吗?',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
isDeleteNow.value = true
await deleteInspectionTaskAPI({
rstdId: obj.rstdId
})
displayGroup.value.splice(index, 1)
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
})
}
/*************** 基本信息 ***************/ /*************** 基本信息 ***************/
// 形式修改 // 形式修改
const handleModalityChange = async (index) => { const handleModalityChange = async (index) => {
...@@ -185,6 +213,7 @@ const deletedisplayPhotos = async (file, { name, index }) => { ...@@ -185,6 +213,7 @@ const deletedisplayPhotos = async (file, { name, index }) => {
} }
// 核查结果 // 核查结果
const handleVerifyChange = async (index) => { const handleVerifyChange = async (index) => {
if (isDeleteNow.value) return
const target = displayGroup.value[index] const target = displayGroup.value[index]
await createInspectionTaskDetailAPI({ await createInspectionTaskDetailAPI({
taskDetail: { taskDetail: {
...@@ -213,6 +242,9 @@ defineExpose({ ...@@ -213,6 +242,9 @@ defineExpose({
margin: 0; margin: 0;
font-weight: 900; font-weight: 900;
color: var(--main-color); color: var(--main-color);
display: flex;
justify-content: space-between;
} }
/* 每个分组 */ /* 每个分组 */
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<!-- 档期陈列 --> <!-- 档期陈列 -->
<div class="item" <div class="item"
v-for="(obj, index) in displayGroup"> v-for="(obj, index) in displayGroup">
<p class="title">档期陈列{{ index + 1 }}</p> <p class="title">
<span>档期陈列{{ index + 1 }}</span>
<van-icon name="delete"
size="0.45rem"
@click="deleteItem(obj, index)" />
</p>
<van-cell-group inset> <van-cell-group inset>
<van-field v-model="obj.modal" <van-field v-model="obj.modal"
name="modal" name="modal"
...@@ -71,7 +76,7 @@ ...@@ -71,7 +76,7 @@
</template> </template>
<script setup> <script setup>
import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI } from '@/api' import { uploadFileToOSSAPI, createInspectionTaskAPI, createInspectionTaskDetailAPI, deleteInspectionTaskAPI } from '@/api'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
...@@ -125,6 +130,29 @@ const init = () => { ...@@ -125,6 +130,29 @@ const init = () => {
createTask() createTask()
} }
} }
// 删除分组
const isDeleteNow = ref(false)
const deleteItem = async (obj, index) => {
// 确认询问框
showConfirmDialog({
title: '删除提示',
message: '确定删除吗?',
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
isDeleteNow.value = true
await deleteInspectionTaskAPI({
rstdId: obj.rstdId
})
displayGroup.value.splice(index, 1)
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
})
}
/*************** 基本信息 ***************/ /*************** 基本信息 ***************/
// 形式修改 // 形式修改
const handleModalityChange = async (index) => { const handleModalityChange = async (index) => {
...@@ -185,6 +213,7 @@ const deletedisplayPhotos = async (file, { name, index }) => { ...@@ -185,6 +213,7 @@ const deletedisplayPhotos = async (file, { name, index }) => {
} }
// 核查结果 // 核查结果
const handleVerifyChange = async (index) => { const handleVerifyChange = async (index) => {
if (isDeleteNow.value) return
const target = displayGroup.value[index] const target = displayGroup.value[index]
await createInspectionTaskDetailAPI({ await createInspectionTaskDetailAPI({
taskDetail: { taskDetail: {
...@@ -223,6 +252,9 @@ defineExpose({ ...@@ -223,6 +252,9 @@ defineExpose({
margin: 0; margin: 0;
font-weight: 900; font-weight: 900;
color: var(--main-color); color: var(--main-color);
display: flex;
justify-content: space-between;
} }
/* 每个分组 */ /* 每个分组 */
......
...@@ -6,46 +6,48 @@ ...@@ -6,46 +6,48 @@
<div class="terminal-info-container"> <div class="terminal-info-container">
<p class="title">录入终端信息</p> <p class="title">录入终端信息</p>
<div class="content"> <div class="content">
<!-- 终端名称输入 --> <van-form ref="myFormRef">
<van-field v-model="form.storeName" <!-- 终端名称输入 -->
label="终端名称:" <van-field v-model="form.storeName"
label-align="top" label="终端名称:"
placeholder="请输入" label-align="top"
class="input-field" /> placeholder="请输入"
<!-- 门头照上传 --> class="input-field"
<div class="header-photo-section"> :rules="[{ required: true, message: '请输入终端名称' }]" />
<van-field label="门头照" <!-- 门头照上传 -->
label-align="top"> <div class="header-photo-section">
<template #input> <van-field label="门头照"
<van-uploader :max-count="1" label-align="top"
accept="image/*" :rules="[{ required: true, message: '请上传门头照' }]">
capture="camera" <template #input>
:model-value="form.storePicture" <van-uploader :max-count="1"
:after-read="posPhotosRead" accept="image/*"
preview-size="78" capture="camera"
@delete="deletePosPhotos"> :model-value="form.storePicture"
</van-uploader> :after-read="posPhotosRead"
</template> preview-size="78"
</van-field> @delete="deletePosPhotos">
</div> </van-uploader>
</template>
<!-- 门店类型选择 --> </van-field>
<van-field :model-value="form.selectedType.join('')" </div>
readonly <!-- 门店类型选择 -->
label="门店类型" <van-field :model-value="form.selectedType.join('')"
label-align="top" readonly
placeholder="请选择" label="门店类型"
@click="showTypePopup = true" /> label-align="top"
<van-popup v-model:show="showTypePopup" placeholder="请选择"
position="bottom" @click="showTypePopup = true" :rules="[{ required: true, message: '请选择门店类型' }]"/>
@close="showTypePopup = false"> <van-popup v-model:show="showTypePopup"
<van-picker v-model="form.selectedType" position="bottom"
:columns="typeOptions" @close="showTypePopup = false">
@confirm="handleTypeConfirm" <van-picker v-model="form.selectedType"
@cancel="showTypePopup = false" /> :columns="typeOptions"
</van-popup> @confirm="handleTypeConfirm"
@cancel="showTypePopup = false" />
</van-popup>
</van-form>
</div> </div>
</div> </div>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div class="button-group"> <div class="button-group">
...@@ -91,22 +93,27 @@ const deletePosPhotos = async () => { ...@@ -91,22 +93,27 @@ const deletePosPhotos = async () => {
} }
// 确认门店类型 // 确认门店类型
const handleTypeConfirm = ({selectedValues}) => { const handleTypeConfirm = ({ selectedValues }) => {
form.selectedType = selectedValues; form.selectedType = selectedValues;
showTypePopup.value = false; showTypePopup.value = false;
}; };
// 创建任务(跳转路由传参即可) // 创建任务(跳转路由传参即可)
const myFormRef = ref(null)
const handleCreateTask = () => { const handleCreateTask = () => {
router.push({ // 校验整个表单
path: '/inspectionTask', myFormRef.value.validate().then(() => {
query: { // 校验通过,执行创建任务逻辑
taskStatus: true, router.push({
storeName: form.storeName, path: '/inspectionTask',
storeCode: null, query: {
storePicture: form.storePicture[0]?.url, taskStatus: true,
selectedType: form.selectedType[0] storeName: form.storeName,
} storeCode: null,
storePicture: form.storePicture[0]?.url,
selectedType: form.selectedType[0]
}
})
}) })
}; };
......
...@@ -18,10 +18,12 @@ ...@@ -18,10 +18,12 @@
class="result-list" class="result-list"
@load="onLoadMore"> @load="onLoadMore">
<van-cell-group inset> <van-cell-group inset>
<!-- <van-swipe-cell v-for="(item, index) in resultList"
:key="index"> -->
<van-cell v-for="(item, index) in resultList" <van-cell v-for="(item, index) in resultList"
:key="index" :key="index"
class="result-item" @click="handleClickStore(item)"
@click="handleClickStore(item)"> class="result-item">
<template #title> <template #title>
<div class="item-title"> <div class="item-title">
<span>{{ item.storeName }}</span> <span>{{ item.storeName }}</span>
...@@ -33,6 +35,13 @@ ...@@ -33,6 +35,13 @@
<div class="item-address">{{ item.address }}</div> <div class="item-address">{{ item.address }}</div>
</template> </template>
</van-cell> </van-cell>
<template #right>
<van-button square
type="danger"
text="删除"
@click="deleteFn(item, index)" />
</template>
<!-- </van-swipe-cell> -->
</van-cell-group> </van-cell-group>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
...@@ -49,7 +58,7 @@ ...@@ -49,7 +58,7 @@
<template #input> <template #input>
<van-search v-model="query.storeName" <van-search v-model="query.storeName"
placeholder="请输入勤策终端编码/名称" placeholder="请输入勤策终端编码/名称"
@update:model-value="getInspectionTaskListFn" @update:model-value="search"
class="search-bar" /> class="search-bar" />
</template> </template>
</van-field> </van-field>
...@@ -78,8 +87,9 @@ ...@@ -78,8 +87,9 @@
<script setup> <script setup>
import { getInspectionTaskListAPI } from '@/api' import { getInspectionTaskListAPI} from '@/api'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import { showNotify } from 'vant';
defineOptions({ defineOptions({
name: 'Sales_point_inspection' name: 'Sales_point_inspection'
...@@ -110,6 +120,7 @@ getInspectionTaskListFn() ...@@ -110,6 +120,7 @@ getInspectionTaskListFn()
const onRefresh = async () => { const onRefresh = async () => {
refreshLoading.value = true refreshLoading.value = true
query.pageNum = 1 query.pageNum = 1
query.storeName = ''
resultList.value = [] resultList.value = []
await getInspectionTaskListFn() await getInspectionTaskListFn()
refreshLoading.value = false refreshLoading.value = false
...@@ -141,6 +152,35 @@ const handleClickStore = (item) => { ...@@ -141,6 +152,35 @@ const handleClickStore = (item) => {
} }
}) })
} }
// 路由离开守卫:控制是否缓存
onBeforeRouteLeave((to, from, next) => {
if (to.path === '/audit_activity/sales_point_inspection') {
// 强制刷新当前组件
resetFn()
}
next()
})
// 搜索地址
const search = () => {
resultList.value = []
getInspectionTaskListFn()
}
// 删除任务
const deleteFn = async (item, index) => {
// console.log(item)
// await deleteInspectionTaskAPI({
// rstdId: item.rstId
// })
// resultList.value.splice(index, 1)
// showNotify({
// message: '删除成功',
// type: 'success',
// })
}
</script> </script>
<style scoped <style scoped
...@@ -199,6 +239,17 @@ const handleClickStore = (item) => { ...@@ -199,6 +239,17 @@ const handleClickStore = (item) => {
color: #a6a4a4; color: #a6a4a4;
line-height: 1.4; line-height: 1.4;
} }
}
/* 滑动右侧按钮 */
::v-deep(.van-swipe-cell__right) {
height: 100px;
.van-button {
height: 100%;
}
} }
} }
...@@ -225,5 +276,6 @@ const handleClickStore = (item) => { ...@@ -225,5 +276,6 @@ const handleClickStore = (item) => {
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -21,17 +21,17 @@ export const constantMobileRoutes = [ ...@@ -21,17 +21,17 @@ export const constantMobileRoutes = [
name: 'm_menu' name: 'm_menu'
}, },
{ {
path: 'promotion_plan_detail/:planId', // 详情 path: 'promotion_plan_detail/:planId', // CP 促销计划,详情页
component: () => import('@/views/mobile/pages/cp_activity/promotion/plan/detail'), component: () => import('@/views/mobile/pages/cp_activity/promotion/plan/detail'),
name: 'm_promotion_detail', name: 'm_promotion_detail',
}, },
{ {
path: 'promotion_plan_editing/:planId?', // path: 'promotion_plan_editing/:planId?', // CP 促销计划,增加,修
component: () => import('@/views/mobile/pages/cp_activity/promotion/plan/editing'), component: () => import('@/views/mobile/pages/cp_activity/promotion/plan/editing'),
name: 'm_promotion_editing', name: 'm_promotion_editing',
}, },
{ {
path: 'examine/:examineId', // 促销内稽查 path: 'examine/:examineId', // CP 促销计划,稽查
component: () => import('@/views/mobile/pages/cp_activity/examine'), component: () => import('@/views/mobile/pages/cp_activity/examine'),
name: 'm_promotion_examine', name: 'm_promotion_examine',
}, },
...@@ -41,17 +41,17 @@ export const constantMobileRoutes = [ ...@@ -41,17 +41,17 @@ export const constantMobileRoutes = [
name: 'logistics' name: 'logistics'
}, },
{ {
path: 'newTerminal', // 新建终端门店 path: 'newTerminal', // 售点稽查_新建终端门店
component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/newTerminal'), component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/newTerminal'),
name: 'newTerminal' name: 'newTerminal'
}, },
{ {
path: 'taskList', // 稽查记录 path: 'taskList', // 售点稽查_稽查记录列表
component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/taskList'), component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/taskList'),
name: 'taskList' name: 'taskList'
}, },
{ {
path: 'inspectionTask', // 稽查任务(终端门店) path: 'inspectionTask', // 售点稽查_稽查任务
component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/inspectionTask/index'), component: () => import('@/views/mobile/pages/audit_activity/sales_point_inspection/examine/inspectionTask/index'),
name: 'inspectionTask' name: 'inspectionTask'
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论