提交 e4cbd66e authored 作者: lidongxu's avatar lidongxu

feat(newterminal.vue): 新增:勤策移动端_售点稽查_新增终端门店功能完成

上级 c87e9789
...@@ -212,6 +212,11 @@ const getInspectionTaskDetailFn = async () => { ...@@ -212,6 +212,11 @@ const getInspectionTaskDetailFn = async () => {
} }
if (skuNum === 0) form.skuNum = '' if (skuNum === 0) form.skuNum = ''
if (!cgclRiskRArr) form.cgclRiskRArr = [] if (!cgclRiskRArr) form.cgclRiskRArr = []
if (route.query.selectedType) form.selectedType = [route.query.selectedType]
// 如果从新建稽查任务页面过来的,门头照路由上传递过来的
if (route.query.taskStatus && route.query.storePicture) form.commitStorePicture = [{
url: route.query.storePicture
}]
// 前端特有属性回显数值 // 前端特有属性回显数值
if (storePicture) form.commitStorePicture = [{ if (storePicture) form.commitStorePicture = [{
...@@ -278,6 +283,7 @@ const getLocationFn = () => { ...@@ -278,6 +283,7 @@ const getLocationFn = () => {
await createInspectionTaskAPI({ await createInspectionTaskAPI({
rstId: form.rstId, rstId: form.rstId,
storeCode: form.storeCode, storeCode: form.storeCode,
storeName: form.storeName,
province: province, province: province,
city: city, city: city,
address: standard_address, address: standard_address,
......
...@@ -7,22 +7,22 @@ ...@@ -7,22 +7,22 @@
<p class="title">录入终端信息</p> <p class="title">录入终端信息</p>
<div class="content"> <div class="content">
<!-- 终端名称输入 --> <!-- 终端名称输入 -->
<van-field v-model="terminalName" <van-field v-model="form.storeName"
label="终端名称:" label="终端名称:"
label-align="top" label-align="top"
placeholder="请输入" placeholder="请输入"
class="input-field" /> class="input-field" />
<!-- 门头照上传 --> <!-- 门头照上传 -->
<div class="header-photo-section"> <div class="header-photo-section">
<van-field label="门头照" <van-field label="门头照"
label-align="top"> label-align="top">
<template #input> <template #input>
<van-uploader :max-count="2" <van-uploader :max-count="1"
accept="image/*" accept="image/*"
v-model="form.posPhotos" capture="camera"
:model-value="form.storePicture"
:after-read="posPhotosRead" :after-read="posPhotosRead"
preview-size="120" preview-size="78"
@delete="deletePosPhotos"> @delete="deletePosPhotos">
</van-uploader> </van-uploader>
</template> </template>
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<!-- 门店类型选择 --> <!-- 门店类型选择 -->
<van-field :model-value="form.selectedType.join('')" <van-field :model-value="form.selectedType.join('')"
readonly
label="门店类型" label="门店类型"
label-align="top" label-align="top"
placeholder="请选择" placeholder="请选择"
...@@ -54,11 +55,6 @@ ...@@ -54,11 +55,6 @@
@click="handleCreateTask"> @click="handleCreateTask">
创建任务 创建任务
</van-button> </van-button>
<van-button type="info"
block
@click="handleCancel">
取消
</van-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -68,72 +64,52 @@ ...@@ -68,72 +64,52 @@
import { uploadFileToOSSAPI } from '@/api' import { uploadFileToOSSAPI } from '@/api'
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { typeOptions as typeOption } from '@/views/mobile/constant' import { typeOptions as typeOption } from '@/views/mobile/constant'
import useUserStore from '@/store/modules/user'
const router = useRouter(); const router = useRouter();
const form = ref({ const form = reactive({
storeName: '',
storePicture: [],
selectedType: [] selectedType: []
}) })
const terminalName = ref('');
const headerPhotoUrl = ref('');
const typeOptions = ref(typeOption); // 门店类型 const typeOptions = ref(typeOption); // 门店类型
const selectedType = ref('');
const showTypePopup = ref(false); const showTypePopup = ref(false);
// 门头照上传逻辑 // 门头照上传逻辑
// POS 两张照片
const posPhotosRead = async (file) => { const posPhotosRead = async (file) => {
const pictureUrl = await uploadFileToOSSAPI(`risk/newTerminal-storePhoto/${useUserStore().empInfo.empNo}/${uuidv4()}.png`, file.file)
// 处理上传的文件 form.storePicture = [{
const date = new Date()
const month = date.getMonth() + 1
const theDate = date.getDate()
const pictureUrl = await uploadFileToOSSAPI(`risk/${date.getFullYear()}-${month}/${theDate}/${planId.value}/${employeeNo}/${uuidv4()}.png`, file.file)
// 判断 objectUrl
const index = form.value.posPhotos.findIndex(o => o.objectUrl)
form.value.posPhotos[index] = {
url: pictureUrl url: pictureUrl
} }]
showNotify({ type: 'success', message: '照片上传成功' })
} }
// 删除 照片 // 删除照片
const deletePosPhotos = async () => { const deletePosPhotos = async () => {
if (isInitializing.value) return form.storePicture = []
await createExamine({ showNotify({ type: 'success', message: '照片删除成功' })
id: form.value.id,
posPhotos: form.value.posPhotos.map(o => o.url),
employeeId: userStore().userInfo.userId, // 稽查人id
employeeName: userStore().userInfo.nickName, // 稽查人名字
employeeNo: employeeNo, // 稽查人工号
})
showNotify({ type: 'success', message: 'POS 照片删除成功' })
} }
// 确认门店类型 // 确认门店类型
const handleTypeConfirm = (val) => { const handleTypeConfirm = ({selectedValues}) => {
form.selectedType = val; form.selectedType = selectedValues;
showTypePopup.value = false; showTypePopup.value = false;
}; };
// 创建任务(可根据需求对接接口 // 创建任务(跳转路由传参即可
const handleCreateTask = () => { const handleCreateTask = () => {
console.log('创建任务:', { router.push({
terminalName: terminalName.value, path: '/inspectionTask',
headerPhoto: headerPhotoUrl.value, query: {
storeType: selectedType.value, taskStatus: true,
}); storeName: form.storeName,
// 此处可补充接口请求逻辑 storeCode: null,
storePicture: form.storePicture[0]?.url,
selectedType: form.selectedType[0]
}
})
}; };
// 取消操作
const handleCancel = () => {
console.log('取消操作');
// 可重置表单等逻辑
terminalName.value = '';
headerPhotoUrl.value = '';
selectedType.value = 'KA';
};
</script> </script>
<style lang="scss" <style lang="scss"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论