提交 74c3f218 authored 作者: lidongxu's avatar lidongxu

Merge branch 'dev'

......@@ -178,7 +178,6 @@ export const dynamicRoutes = [
}
]
const router = createRouter({
// 路由模式:createWebHashHistory,createWebHistory
history: createWebHashHistory(),
......
......@@ -26,9 +26,9 @@
</div>
<div class="terminal-info">
<p>终端编码:P0500052306</p>
<p>经销商:秦皇岛红朗森商贸有限公司</p>
<p>地址:河北省秦皇岛市海港区北环路街道秦皇岛冻结附录</p>
<p>终端编码:{{ form.storeCode }}</p>
<p>经销商:{{ form.dealersName }}</p>
<p>地址:{{ form.storeAddr }}</p>
</div>
</div>
......@@ -60,10 +60,10 @@
</template>
</van-field>
</div>
<!-- 门店类型选择 -->
<!-- 渠道类型选择 -->
<van-field label-width="150px"
label-position="top"
label="门店类型:"
label="渠道类型:"
:model-value="form.selectedType"
placeholder="请选择">
<template #input>
......@@ -78,7 +78,7 @@
</van-field>
<!-- <van-field :model-value="form.selectedType.join('')"
readonly
label="门店类型"
label="渠道类型"
label-align="top"
placeholder="请选择"
@click="showTypePopup = true"
......@@ -151,7 +151,7 @@
<van-field label="大日期产品照片"
label-align="top">
<template #input>
<van-uploader :max-count="4"
<van-uploader :max-count="3"
accept="image/*"
capture="camera"
:model-value="form.longTimePictureArr"
......@@ -186,10 +186,6 @@ import { showImagePreview } from 'vant';
import useUserStore from '@/store/modules/user'
import { v4 as uuidv4 } from 'uuid';
defineOptions({
name: 'inspectionTask',
})
const router = useRouter()
const route = useRoute()
......@@ -201,29 +197,32 @@ const categoryInformationRef = ref(null)
/*************** 稽查任务总体 ***************/
const isInitializing = ref(true)
const form = reactive({ // 当前页信息总对象
rstId: '', // 稽查任务 ID(获取详情接口有则保存,没有则主动新建一次并获取 id)
rstId: route.query.rstId, // 稽查任务 ID(获取详情接口有则保存,没有则主动新建一次并获取 id)
storePicture: route.query.storePicture, // 门店照片(原始门店照片,来自于上一页的接口)
storeName: route.query.storeName, // 门店名称
storeCode: route.query.storeCode, // 门店编码
dealersName: '', // 经销商名称
storeAddr: '', // 门店地址
dealersName: route.query.dealersName, // 经销商名称
dealerCode: route.query.dealerCode, // 经销商编码
storeAddr: route.query.storeAddr, // 门店地址
lhldArr: [], // 其他-礼盒礼袋是否在售
skuNum: '', // 我品 SKU 总数
remark: '', // 备注
longTimePictureArr: [], // 大日期产品照片
// 前端特有属性和后端接口不一致
commitStorePicture: [], // 上报拍摄的门店照片
selectedType: "", // 门店类型
selectedType: "", // 渠道类型
})
// 稽查任务详情
const getInspectionTaskDetailFn = async () => {
const res = await getInspectionTaskDetailAPI({
storeCode: form.storeCode
storeCode: form.storeCode,
// storeName: form.storeName,
rstId: form.rstId,
})
if (res.data) {
Object.assign(form, res.data)
const { storeName, lhldArr, longTimePictureArr, storePicture, storeType, skuNum, cgclRiskRArr, dqclRiskRArr } = res.data
const { storeName, lhldArr, longTimePictureArr, storePicture, storeType, skuNum, cgclRiskRArr, dqclRiskRArr, dealerName, storeAddr } = res.data
// 终端门店照片一直应该是路由上的照片参数,如果路由上没有门头照证明上一个页面列表里这个门店就本身没有照片,那就用门头照拍摄的
if (route.query.storePicture) form.storePicture = route.query.storePicture
// 详情接口有门头照照片,需要设置到特有的属性commitStorePicture
......@@ -232,6 +231,10 @@ const getInspectionTaskDetailFn = async () => {
}]
// 详情接口门店名称如果是空的就用路由传递的
if (!storeName) form.storeName = route.query.storeName
// 详情接口经销商名称和门店地址是空的就用路由传递的
if (!dealerName) form.dealersName = route.query.dealersName
else form.dealersName = dealerName
if (!storeAddr) form.storeAddr = route.query.storeAddr
if (!lhldArr) form.lhldArr = []
if (!longTimePictureArr) form.longTimePictureArr = []
......@@ -250,13 +253,15 @@ const getInspectionTaskDetailFn = async () => {
url: route.query.storePicture
}]
if (storeType) form.selectedType = storeType
} else {
// 没有的话调用新建接口,得到一个总体稽查任务 id
const res = await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
dealerName: form.dealersName,
dealerCode: form.dealerCode
})
form.rstId = res.data.rstId
}
......@@ -274,6 +279,7 @@ const getInspectionTaskDetailFn = async () => {
}
getInspectionTaskDetailFn()
// 门店图片预览
const previewStoreImage = () => {
showImagePreview({
......@@ -285,6 +291,7 @@ const previewStoreImage = () => {
const handleStoreNameChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
rStoreName: form.storeName // 修改门店名称
})
......@@ -349,15 +356,21 @@ const handleClickLocation = () => {
/*************** 门头照上传 ***************/
// 上传照片
const commitStorePhotosRead = async (file) => {
form.commitStorePicture = [{
url: file.content,
status: 'uploading',
message: '上传中...'
}]
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/storeFrontPhoto/${useUserStore().empInfo.empNo}/${uuidv4()}.png`, file.file)
form.commitStorePicture = [{
url: pictureUrl
url: pictureUrl,
status: 'done'
}]
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
storePicture: pictureUrl
})
......@@ -369,6 +382,7 @@ const deleteCommitStorePhotos = async () => {
form.commitStorePicture = []
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
storePicture: ""
})
......@@ -376,16 +390,18 @@ const deleteCommitStorePhotos = async () => {
showNotify({ type: 'success', message: '门头照,删除成功' })
}
/*************** 门店类型 ***************/
const typeOptions = ref(typeOption) // 门店类型
/*************** 渠道类型 ***************/
const typeOptions = ref(typeOption) // 渠道类型
const showTypePopup = ref(false)
// 确认门店类型
// 确认渠道类型
const handleTypeConfirm = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
storeType: form.selectedType
})
showNotify({ type: 'success', message: '渠道类型,修改成功' })
}
/*************** tabs 组 ***************/
......@@ -397,6 +413,7 @@ const handleLhldArrChange = async () => {
if (isInitializing.value) return
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
lhldArr: form.lhldArr
})
......@@ -407,6 +424,7 @@ const handleLhldArrChange = async () => {
const handleSkuNumChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
skuNum: form.skuNum * 1
})
......@@ -417,6 +435,7 @@ const handleSkuNumChange = async () => {
const handleRemarkChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
remark: form.remark
})
......@@ -425,15 +444,23 @@ const handleRemarkChange = async () => {
// 大日期照片上传
const longTimePictureArrRead = async (file) => {
const index = form.longTimePictureArr.length
form.longTimePictureArr[index] = {
url: file.content,
status: 'uploading',
message: '上传中...'
}
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/longTimePicture/${useUserStore().empInfo.empNo}/${form.storeCode}/${uuidv4()}.png`, file.file)
form.longTimePictureArr.push({
url: pictureUrl
})
form.longTimePictureArr[index] = {
url: pictureUrl,
status: 'done'
}
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
longTimePictureArr: form.longTimePictureArr.map(o => o.url)
})
......@@ -444,6 +471,7 @@ const deleteLongTimePictureArr = async (file, { name, index }) => {
form.longTimePictureArr.splice(index, 1)
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
longTimePictureArr: form.longTimePictureArr.map(o => o.url)
})
......
......@@ -151,7 +151,7 @@ const deleteItem = async (obj, index) => {
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
showNotify({ type: 'success', message: '删除分组成功' })
})
}
......@@ -161,7 +161,9 @@ const handleModalityChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
......@@ -173,7 +175,9 @@ const handleCostChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
......@@ -183,14 +187,20 @@ const handleCostChange = async (index) => {
const displayPhotosRead = async (file, { name, index }) => {
// name:是当前照片组件所在陈列组的索引
// index: 当前照片组的索引
const date = new Date()
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const target = displayGroup.value[name]
const photoIndex = target.photoArr.length
target.photoArr[photoIndex] = {
url: file.content,
status: 'uploading',
message: '上传中...'
}
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/displayPhoto/${useUserStore().empInfo.empNo}/${props.form.storeCode}/${uuidv4()}.png`, file.file)
target.photoArr.push({
url: pictureUrl
})
target.photoArr[photoIndex] = {
url: pictureUrl,
status: 'done'
}
await createInspectionTaskDetailAPI({
taskDetail: {
......@@ -236,7 +246,7 @@ const handleOverallChange = async () => {
rstId: props.form.rstId,
cgclRiskRArr: props.form.cgclRiskRArr
})
showNotify({ type: 'success', message: '核查结果,保存成功' })
showNotify({ type: 'success', message: '总体核查结果,保存成功' })
}
defineExpose({
......
......@@ -10,25 +10,25 @@
@click="deleteItem(obj, index)" />
</p>
<van-cell-group inset>
<van-field v-model="obj.modal"
name="modal"
<van-field v-model="obj.bcNr"
name="bcNr"
label="提报内容"
placeholder="请输入提报内容"
auto-complete="off"
:rules="[{ required: true, message: '请输入提报内容' }]"
@change="handleModalityChange(index)" />
<van-field v-model="obj.cost"
name="cost"
<van-field v-model="obj.bcQk"
name="bcQk"
label="执行情况"
placeholder="执行情况"
auto-complete="off"
:rules="[{ required: true, message: '请输入执行情况' }]"
:rules="[{ required: true, message: '请输入执行情况' }]"
@change="handleCostChange(index)" />
<van-field label="档期补差照片"
label-align="top"
class="header-photo-section">
<template #input>
<van-uploader :max-count="2"
<van-uploader :max-count="3"
accept="image/*"
capture="camera"
:model-value="obj.photoArr"
......@@ -150,45 +150,55 @@ const deleteItem = async (obj, index) => {
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
showNotify({ type: 'success', message: '删除分组成功' })
})
}
/*************** 基本信息 ***************/
// 形式修改
// 提报内容
const handleModalityChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
showNotify({ type: 'success', message: '形式,保存成功' })
showNotify({ type: 'success', message: '提报内容,保存成功' })
}
// 费用修改
// 执行情况
const handleCostChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
showNotify({ type: 'success', message: '费用,保存成功' })
showNotify({ type: 'success', message: '执行情况,保存成功' })
}
// 上传照片
const displayPhotosRead = async (file, { name, index }) => {
// name:是当前照片组件所在陈列组的索引
// index: 当前照片组的索引
const date = new Date()
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const target = displayGroup.value[name]
const targetIndex = target.photoArr.length
target.photoArr[targetIndex] = {
url: file.content,
status: 'uploading',
message: '上传中...'
}
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/scheduleAdjustmentPhoto/${useUserStore().empInfo.empNo}/${props.form.storeCode}/${uuidv4()}.png`, file.file)
target.photoArr.push({
url: pictureUrl
})
target.photoArr[targetIndex] = {
url: pictureUrl,
status: 'done'
}
await createInspectionTaskDetailAPI({
taskDetail: {
......@@ -198,7 +208,7 @@ const displayPhotosRead = async (file, { name, index }) => {
}
})
showNotify({ type: 'success', message: '档期陈列照片,上传成功' })
showNotify({ type: 'success', message: '档期补差照片,上传成功' })
}
// 删除照片
const deletedisplayPhotos = async (file, { name, index }) => {
......@@ -211,7 +221,7 @@ const deletedisplayPhotos = async (file, { name, index }) => {
photoArr: target.photoArr.map(o => o.url)
}
})
showNotify({ type: 'success', message: '档期陈列照片,删除成功' })
showNotify({ type: 'success', message: '档期补差照片,删除成功' })
}
// 核查结果
const handleVerifyChange = async (index) => {
......
......@@ -150,7 +150,7 @@ const deleteItem = async (obj, index) => {
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
showNotify({ type: 'success', message: '删除分组成功' })
})
}
/*************** 基本信息 ***************/
......@@ -159,7 +159,9 @@ const handleModalityChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
......@@ -171,7 +173,9 @@ const handleCostChange = async (index) => {
await createInspectionTaskDetailAPI({
taskDetail: {
rstId: props.form.rstId,
...displayGroup.value[index]
...displayGroup.value[index],
// 照片单独处理
photoArr: displayGroup.value[index].photoArr.map(o => o.url)
}
})
......@@ -183,12 +187,18 @@ const displayPhotosRead = async (file, { name, index }) => {
// index: 当前照片组的索引
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const target = displayGroup.value[name]
const targetIndex = target.photoArr.length
target.photoArr[targetIndex] = {
url: file.content,
status: 'uploading',
message: '上传中...'
}
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/scheduleDisplayPhoto/${useUserStore().empInfo.empNo}/${props.form.storeCode}/${uuidv4()}.png`, file.file)
target.photoArr.push({
url: pictureUrl
})
target.photoArr[targetIndex] = {
url: pictureUrl,
status: 'done'
}
await createInspectionTaskDetailAPI({
taskDetail: {
......@@ -234,7 +244,7 @@ const handleOverallChange = async () => {
rstId: props.form.rstId,
dqclRiskRArr: props.form.dqclRiskRArr
})
showNotify({ type: 'success', message: '核查结果,保存成功' })
showNotify({ type: 'success', message: '总体核查结果,保存成功' })
}
defineExpose({
......
......@@ -31,13 +31,13 @@
</template>
</van-field>
</div>
<!-- 门店类型选择 -->
<!-- 渠道类型选择 -->
<van-field label-width="150px"
label-position="top"
label="门店类型:"
label="渠道类型:"
:model-value="form.selectedType"
placeholder="请选择"
:rules="[{ required: true, message: '请选择门店类型' }]">
:rules="[{ required: true, message: '请选择渠道类型' }]">
<template #input>
<el-select v-model="form.selectedType"
placeholder="请选择">
......@@ -49,11 +49,11 @@
</van-field>
<!-- <van-field :model-value="form.selectedType.join('')"
readonly
label="门店类型"
label="渠道类型"
label-align="top"
placeholder="请选择"
@click="showTypePopup = true"
:rules="[{ required: true, message: '请选择门店类型' }]" />
:rules="[{ required: true, message: '请选择渠道类型' }]" />
<van-popup v-model:show="showTypePopup"
position="bottom"
@close="showTypePopup = false">
......@@ -79,7 +79,7 @@
</template>
<script setup>
import { uploadFileToOSSAPI } from '@/api'
import { uploadFileToOSSAPI, createInspectionTaskAPI } from '@/api'
import { v4 as uuidv4 } from 'uuid';
import { typeOptions as typeOption } from '@/views/mobile/constant'
import useUserStore from '@/store/modules/user'
......@@ -91,51 +91,55 @@ const form = reactive({
storePicture: [],
selectedType: ''
})
const typeOptions = ref(typeOption); // 门店类型
const showTypePopup = ref(false);
const typeOptions = ref(typeOption); // 渠道类型
// 门头照上传逻辑
const posPhotosRead = async (file) => {
form.storePicture = [
{
url: file.content,
status: 'uploading',
message: '上传中...'
}
]
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`risk/newTerminal-storePhoto/${date.getFullYear()}-${month}/${useUserStore().empInfo.empNo}/${uuidv4()}.png`, file.file)
form.storePicture = [{
url: pictureUrl
url: pictureUrl,
status: 'done'
}]
showNotify({ type: 'success', message: '照片上传成功' })
}
// 删除照片
const deletePosPhotos = async () => {
form.storePicture = []
showNotify({ type: 'success', message: '照片删除成功' })
}
// 确认门店类型
// const handleTypeConfirm = ({ selectedValues }) => {
// form.selectedType = selectedValues;
// showTypePopup.value = false;
// };
// 创建任务(跳转路由传参即可)
const myFormRef = ref(null)
const handleCreateTask = () => {
// 校验整个表单
myFormRef.value.validate().then(() => {
// 校验通过,执行创建任务逻辑
myFormRef.value.validate().then(async () => {
const res = await createInspectionTaskAPI({
storeName: form.storeName,
storePicture: form.storePicture[0]?.url,
selectedType: form.selectedType
})
// 校验通过,跳到稽查任务详情页
router.push({
path: '/inspectionTask',
query: {
taskStatus: true,
rstId: res.data.rstId,
storeName: form.storeName,
storeCode: null,
storePicture: form.storePicture[0]?.url,
selectedType: form.selectedType
}
})
})
};
}
</script>
<style lang="scss"
......
......@@ -37,7 +37,7 @@
</template>
<template #label>
<div class="item-company">{{ item.dealersName }}</div>
<div class="item-address">{{ item.address }}</div>
<div class="item-address">{{ item.storeAddr }}</div>
</template>
</van-cell>
</van-cell-group>
......@@ -121,7 +121,7 @@ const handleClickStore = (item) => {
// 确实提示
showConfirmDialog({
title: '提示',
message: '是否创建本店稽查任务?',
message: '是否创建/查看本店稽查任务?',
confirmButtonText: '前往',
cancelButtonText: '取消'
}).then(() => {
......@@ -130,7 +130,10 @@ const handleClickStore = (item) => {
query: {
storeName: item.storeName,
storeCode: item.storeCode,
storePicture: item.storePictures?.split(",")[0]
storePicture: item.storePictures?.split(",")[0],
dealersName: item.dealersName,
dealerCode: item.dealerId,
storeAddr: item.storeAddr,
}
})
})
......
......@@ -65,7 +65,7 @@
type="date"
value-format="YYYY-MM-DD"
placeholder="输入搜索的日期"
@change="getInspectionTaskListFn" />
@change="search" />
</template>
</van-field>
<!-- 重置按钮 -->
......@@ -81,12 +81,6 @@
import { getInspectionTaskListAPI} from '@/api'
import { parseTime } from '@/utils'
import { showNotify } from 'vant';
defineOptions({
name: 'Sales_point_inspection'
})
const router = useRouter();
// 搜索
......@@ -103,6 +97,7 @@ const finished = ref(true);
const refreshLoading = ref(false)
const getInspectionTaskListFn = async () => {
const res = await getInspectionTaskListAPI(query)
console.log(res, 'res')
resultList.value = [...resultList.value, ...res.data.rows]
finished.value = res.data.total <= resultList.value.length
}
......@@ -140,23 +135,26 @@ const handleClickStore = (item) => {
query: {
storeName: item.storeName,
storeCode: item.storeCode,
rstId: item.rstId,
storePicture: item.storePictures?.split(",")[0]
}
})
}
// 路由离开守卫:控制是否缓存
onBeforeRouteLeave((to, from, next) => {
if (to.path === '/audit_activity/sales_point_inspection') {
// 强制刷新当前组件
resetFn()
}
next()
})
// 搜索地址
// onBeforeRouteLeave((to, from, next) => {
// if (to.path === '/audit_activity/sales_point_inspection') {
// // 强制刷新当前组件
// resetFn()
// }
// next()
// })
// 搜索地址/日期
const search = () => {
query.pageNum = 1
resultList.value = []
console.log('zoulema')
getInspectionTaskListFn()
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论