提交 5ceac0f6 authored 作者: lidongxu's avatar lidongxu

refactor(inspectiontask/*): 修改:勤策移动端_售点稽查_查看和新增任务代码修改

上级 f93a46da
...@@ -178,7 +178,6 @@ export const dynamicRoutes = [ ...@@ -178,7 +178,6 @@ export const dynamicRoutes = [
} }
] ]
const router = createRouter({ const router = createRouter({
// 路由模式:createWebHashHistory,createWebHistory // 路由模式:createWebHashHistory,createWebHistory
history: createWebHashHistory(), history: createWebHashHistory(),
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
</div> </div>
<div class="terminal-info"> <div class="terminal-info">
<p>终端编码:P0500052306</p> <p>终端编码:{{ form.storeCode }}</p>
<p>经销商:秦皇岛红朗森商贸有限公司</p> <p>经销商:{{ form.dealerName }}</p>
<p>地址:河北省秦皇岛市海港区北环路街道秦皇岛冻结附录</p> <p>地址:{{ form.address }}</p>
</div> </div>
</div> </div>
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
</template> </template>
</van-field> </van-field>
</div> </div>
<!-- 门店类型选择 --> <!-- 渠道类型选择 -->
<van-field label-width="150px" <van-field label-width="150px"
label-position="top" label-position="top"
label="门店类型:" label="渠道类型:"
:model-value="form.selectedType" :model-value="form.selectedType"
placeholder="请选择"> placeholder="请选择">
<template #input> <template #input>
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</van-field> </van-field>
<!-- <van-field :model-value="form.selectedType.join('')" <!-- <van-field :model-value="form.selectedType.join('')"
readonly readonly
label="门店类型" label="渠道类型"
label-align="top" label-align="top"
placeholder="请选择" placeholder="请选择"
@click="showTypePopup = true" @click="showTypePopup = true"
...@@ -200,7 +200,7 @@ const categoryInformationRef = ref(null) ...@@ -200,7 +200,7 @@ const categoryInformationRef = ref(null)
/*************** 稽查任务总体 ***************/ /*************** 稽查任务总体 ***************/
const isInitializing = ref(true) const isInitializing = ref(true)
const form = reactive({ // 当前页信息总对象 const form = reactive({ // 当前页信息总对象
rstId: '', // 稽查任务 ID(获取详情接口有则保存,没有则主动新建一次并获取 id) rstId: route.query.rstId, // 稽查任务 ID(获取详情接口有则保存,没有则主动新建一次并获取 id)
storePicture: route.query.storePicture, // 门店照片(原始门店照片,来自于上一页的接口) storePicture: route.query.storePicture, // 门店照片(原始门店照片,来自于上一页的接口)
storeName: route.query.storeName, // 门店名称 storeName: route.query.storeName, // 门店名称
storeCode: route.query.storeCode, // 门店编码 storeCode: route.query.storeCode, // 门店编码
...@@ -212,13 +212,14 @@ const form = reactive({ // 当前页信息总对象 ...@@ -212,13 +212,14 @@ const form = reactive({ // 当前页信息总对象
longTimePictureArr: [], // 大日期产品照片 longTimePictureArr: [], // 大日期产品照片
// 前端特有属性和后端接口不一致 // 前端特有属性和后端接口不一致
commitStorePicture: [], // 上报拍摄的门店照片 commitStorePicture: [], // 上报拍摄的门店照片
selectedType: "", // 门店类型 selectedType: "", // 渠道类型
}) })
// 稽查任务详情 // 稽查任务详情
const getInspectionTaskDetailFn = async () => { const getInspectionTaskDetailFn = async () => {
const res = await getInspectionTaskDetailAPI({ const res = await getInspectionTaskDetailAPI({
storeCode: form.storeCode storeCode: form.storeCode,
rstId: form.rstId,
}) })
if (res.data) { if (res.data) {
Object.assign(form, res.data) Object.assign(form, res.data)
...@@ -256,6 +257,7 @@ const getInspectionTaskDetailFn = async () => { ...@@ -256,6 +257,7 @@ const getInspectionTaskDetailFn = async () => {
// 没有的话调用新建接口,得到一个总体稽查任务 id // 没有的话调用新建接口,得到一个总体稽查任务 id
const res = await createInspectionTaskAPI({ const res = await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName
}) })
form.rstId = res.data.rstId form.rstId = res.data.rstId
} }
...@@ -271,7 +273,21 @@ const getInspectionTaskDetailFn = async () => { ...@@ -271,7 +273,21 @@ const getInspectionTaskDetailFn = async () => {
// 一定在这里获取地理位置(保证稽查任务 id 创建完毕) // 一定在这里获取地理位置(保证稽查任务 id 创建完毕)
getLocationFn() getLocationFn()
} }
getInspectionTaskDetailFn() onMounted(async () => {
if (route.query.taskStatus) {
// 从新建稽查任务页面过来的,直接初始化
// 先走一次创建任务,再走查询详情
// 没有的话调用新建接口,得到一个总体稽查任务 id
const res = await createInspectionTaskAPI({
storeName: route.query.storeName,
storePicture: route.query.storePicture,
selectedType: route.query.selectedType
})
form.rstId = res.data.rstId
}
getInspectionTaskDetailFn()
})
// 门店图片预览 // 门店图片预览
const previewStoreImage = () => { const previewStoreImage = () => {
...@@ -284,6 +300,7 @@ const previewStoreImage = () => { ...@@ -284,6 +300,7 @@ const previewStoreImage = () => {
const handleStoreNameChange = async () => { const handleStoreNameChange = async () => {
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
rStoreName: form.storeName // 修改门店名称 rStoreName: form.storeName // 修改门店名称
}) })
...@@ -357,6 +374,7 @@ const commitStorePhotosRead = async (file) => { ...@@ -357,6 +374,7 @@ const commitStorePhotosRead = async (file) => {
}] }]
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
storePicture: pictureUrl storePicture: pictureUrl
}) })
...@@ -368,6 +386,7 @@ const deleteCommitStorePhotos = async () => { ...@@ -368,6 +386,7 @@ const deleteCommitStorePhotos = async () => {
form.commitStorePicture = [] form.commitStorePicture = []
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
storePicture: "" storePicture: ""
}) })
...@@ -375,16 +394,18 @@ const deleteCommitStorePhotos = async () => { ...@@ -375,16 +394,18 @@ const deleteCommitStorePhotos = async () => {
showNotify({ type: 'success', message: '门头照,删除成功' }) showNotify({ type: 'success', message: '门头照,删除成功' })
} }
/*************** 门店类型 ***************/ /*************** 渠道类型 ***************/
const typeOptions = ref(typeOption) // 门店类型 const typeOptions = ref(typeOption) // 渠道类型
const showTypePopup = ref(false) const showTypePopup = ref(false)
// 确认门店类型 // 确认渠道类型
const handleTypeConfirm = async () => { const handleTypeConfirm = async () => {
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
storeType: form.selectedType storeType: form.selectedType
}) })
showNotify({ type: 'success', message: '渠道类型,修改成功' })
} }
/*************** tabs 组 ***************/ /*************** tabs 组 ***************/
...@@ -396,6 +417,7 @@ const handleLhldArrChange = async () => { ...@@ -396,6 +417,7 @@ const handleLhldArrChange = async () => {
if (isInitializing.value) return if (isInitializing.value) return
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
lhldArr: form.lhldArr lhldArr: form.lhldArr
}) })
...@@ -406,6 +428,7 @@ const handleLhldArrChange = async () => { ...@@ -406,6 +428,7 @@ const handleLhldArrChange = async () => {
const handleSkuNumChange = async () => { const handleSkuNumChange = async () => {
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
skuNum: form.skuNum * 1 skuNum: form.skuNum * 1
}) })
...@@ -416,6 +439,7 @@ const handleSkuNumChange = async () => { ...@@ -416,6 +439,7 @@ const handleSkuNumChange = async () => {
const handleRemarkChange = async () => { const handleRemarkChange = async () => {
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
remark: form.remark remark: form.remark
}) })
...@@ -433,6 +457,7 @@ const longTimePictureArrRead = async (file) => { ...@@ -433,6 +457,7 @@ const longTimePictureArrRead = async (file) => {
}) })
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
longTimePictureArr: form.longTimePictureArr.map(o => o.url) longTimePictureArr: form.longTimePictureArr.map(o => o.url)
}) })
...@@ -443,6 +468,7 @@ const deleteLongTimePictureArr = async (file, { name, index }) => { ...@@ -443,6 +468,7 @@ const deleteLongTimePictureArr = async (file, { name, index }) => {
form.longTimePictureArr.splice(index, 1) form.longTimePictureArr.splice(index, 1)
await createInspectionTaskAPI({ await createInspectionTaskAPI({
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId, rstId: form.rstId,
longTimePictureArr: form.longTimePictureArr.map(o => o.url) longTimePictureArr: form.longTimePictureArr.map(o => o.url)
}) })
......
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
</template> </template>
</van-field> </van-field>
</div> </div>
<!-- 门店类型选择 --> <!-- 渠道类型选择 -->
<van-field label-width="150px" <van-field label-width="150px"
label-position="top" label-position="top"
label="门店类型:" label="渠道类型:"
:model-value="form.selectedType" :model-value="form.selectedType"
placeholder="请选择" placeholder="请选择"
:rules="[{ required: true, message: '请选择门店类型' }]"> :rules="[{ required: true, message: '请选择渠道类型' }]">
<template #input> <template #input>
<el-select v-model="form.selectedType" <el-select v-model="form.selectedType"
placeholder="请选择"> placeholder="请选择">
...@@ -49,11 +49,11 @@ ...@@ -49,11 +49,11 @@
</van-field> </van-field>
<!-- <van-field :model-value="form.selectedType.join('')" <!-- <van-field :model-value="form.selectedType.join('')"
readonly readonly
label="门店类型" label="渠道类型"
label-align="top" label-align="top"
placeholder="请选择" placeholder="请选择"
@click="showTypePopup = true" @click="showTypePopup = true"
:rules="[{ required: true, message: '请选择门店类型' }]" /> :rules="[{ required: true, message: '请选择渠道类型' }]" />
<van-popup v-model:show="showTypePopup" <van-popup v-model:show="showTypePopup"
position="bottom" position="bottom"
@close="showTypePopup = false"> @close="showTypePopup = false">
...@@ -91,7 +91,7 @@ const form = reactive({ ...@@ -91,7 +91,7 @@ const form = reactive({
storePicture: [], storePicture: [],
selectedType: '' selectedType: ''
}) })
const typeOptions = ref(typeOption); // 门店类型 const typeOptions = ref(typeOption); // 渠道类型
const showTypePopup = ref(false); const showTypePopup = ref(false);
// 门头照上传逻辑 // 门头照上传逻辑
...@@ -111,7 +111,7 @@ const deletePosPhotos = async () => { ...@@ -111,7 +111,7 @@ const deletePosPhotos = async () => {
showNotify({ type: 'success', message: '照片删除成功' }) showNotify({ type: 'success', message: '照片删除成功' })
} }
// 确认门店类型 // 确认渠道类型
// const handleTypeConfirm = ({ selectedValues }) => { // const handleTypeConfirm = ({ selectedValues }) => {
// form.selectedType = selectedValues; // form.selectedType = selectedValues;
// showTypePopup.value = false; // showTypePopup.value = false;
...@@ -128,7 +128,6 @@ const handleCreateTask = () => { ...@@ -128,7 +128,6 @@ const handleCreateTask = () => {
query: { query: {
taskStatus: true, taskStatus: true,
storeName: form.storeName, storeName: form.storeName,
storeCode: null,
storePicture: form.storePicture[0]?.url, storePicture: form.storePicture[0]?.url,
selectedType: form.selectedType selectedType: form.selectedType
} }
......
...@@ -121,7 +121,7 @@ const handleClickStore = (item) => { ...@@ -121,7 +121,7 @@ const handleClickStore = (item) => {
// 确实提示 // 确实提示
showConfirmDialog({ showConfirmDialog({
title: '提示', title: '提示',
message: '是否创建本店稽查任务?', message: '是否创建/查看本店稽查任务?',
confirmButtonText: '前往', confirmButtonText: '前往',
cancelButtonText: '取消' cancelButtonText: '取消'
}).then(() => { }).then(() => {
......
...@@ -81,7 +81,6 @@ ...@@ -81,7 +81,6 @@
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'
...@@ -140,6 +139,7 @@ const handleClickStore = (item) => { ...@@ -140,6 +139,7 @@ const handleClickStore = (item) => {
query: { query: {
storeName: item.storeName, storeName: item.storeName,
storeCode: item.storeCode, storeCode: item.storeCode,
rstId: item.rstId,
storePicture: item.storePictures?.split(",")[0] storePicture: item.storePictures?.split(",")[0]
} }
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论