提交 66796a6a authored 作者: lidongxu's avatar lidongxu

Merge branch 'release' into 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.dealerName }}</p>
<p>地址:{{ form.address }}</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"
......@@ -201,7 +201,7 @@ 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, // 门店编码
......@@ -213,13 +213,15 @@ const form = reactive({ // 当前页信息总对象
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)
......@@ -257,6 +259,7 @@ const getInspectionTaskDetailFn = async () => {
// 没有的话调用新建接口,得到一个总体稽查任务 id
const res = await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName
})
form.rstId = res.data.rstId
}
......@@ -274,6 +277,7 @@ const getInspectionTaskDetailFn = async () => {
}
getInspectionTaskDetailFn()
// 门店图片预览
const previewStoreImage = () => {
showImagePreview({
......@@ -285,6 +289,7 @@ const previewStoreImage = () => {
const handleStoreNameChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
rStoreName: form.storeName // 修改门店名称
})
......@@ -349,15 +354,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 +380,7 @@ const deleteCommitStorePhotos = async () => {
form.commitStorePicture = []
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
storePicture: ""
})
......@@ -376,16 +388,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 +411,7 @@ const handleLhldArrChange = async () => {
if (isInitializing.value) return
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
lhldArr: form.lhldArr
})
......@@ -407,6 +422,7 @@ const handleLhldArrChange = async () => {
const handleSkuNumChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
skuNum: form.skuNum * 1
})
......@@ -417,6 +433,7 @@ const handleSkuNumChange = async () => {
const handleRemarkChange = async () => {
await createInspectionTaskAPI({
storeCode: form.storeCode,
storeName: form.storeName,
rstId: form.rstId,
remark: form.remark
})
......@@ -425,15 +442,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 +469,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: '删除分组成功' })
})
}
......@@ -185,12 +185,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 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 +242,7 @@ const handleOverallChange = async () => {
rstId: props.form.rstId,
cgclRiskRArr: props.form.cgclRiskRArr
})
showNotify({ type: 'success', message: '核查结果,保存成功' })
showNotify({ type: 'success', message: '总体核查结果,保存成功' })
}
defineExpose({
......
......@@ -150,7 +150,7 @@ const deleteItem = async (obj, index) => {
nextTick(() => {
isDeleteNow.value = false
})
showNotify({ type: 'success', message: '删除成功' })
showNotify({ type: 'success', message: '删除分组成功' })
})
}
/*************** 基本信息 ***************/
......@@ -183,12 +183,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}/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 +204,7 @@ const displayPhotosRead = async (file, { name, index }) => {
}
})
showNotify({ type: 'success', message: '档期陈列照片,上传成功' })
showNotify({ type: 'success', message: '档期补差照片,上传成功' })
}
// 删除照片
const deletedisplayPhotos = async (file, { name, index }) => {
......@@ -211,7 +217,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: '删除分组成功' })
})
}
/*************** 基本信息 ***************/
......@@ -183,12 +183,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 +240,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"
......
......@@ -121,7 +121,7 @@ const handleClickStore = (item) => {
// 确实提示
showConfirmDialog({
title: '提示',
message: '是否创建本店稽查任务?',
message: '是否创建/查看本店稽查任务?',
confirmButtonText: '前往',
cancelButtonText: '取消'
}).then(() => {
......
......@@ -81,7 +81,6 @@
import { getInspectionTaskListAPI} from '@/api'
import { parseTime } from '@/utils'
import { showNotify } from 'vant';
defineOptions({
name: 'Sales_point_inspection'
......@@ -140,6 +139,7 @@ const handleClickStore = (item) => {
query: {
storeName: item.storeName,
storeCode: item.storeCode,
rstId: item.rstId,
storePicture: item.storePictures?.split(",")[0]
}
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论