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

下班后不能再修改上传照片

上级 61f7966a
...@@ -264,6 +264,7 @@ export default { ...@@ -264,6 +264,7 @@ export default {
const { id, name } = this.$store.getters.user const { id, name } = this.$store.getters.user
// 配置考勤参数 // 配置考勤参数
console.log(this.onWorkRecord.id, 'this.onWorkRecord.id')
const attObj = { const attObj = {
temporaryId: id, // 促销员 ID temporaryId: id, // 促销员 ID
temporaryName: name, // 促销员姓名 temporaryName: name, // 促销员姓名
...@@ -278,17 +279,16 @@ export default { ...@@ -278,17 +279,16 @@ export default {
clockArea: this.addressObj.area, // 区域 clockArea: this.addressObj.area, // 区域
} }
try { try {
// 打卡
await getOnWorkCardAPI(attObj)
if (type === 1) { if (type === 1) {
// 创建上报记录-才算完成打卡 // 创建上报记录-才算完成打卡
const res = await createOnWorkPlanAPI({ const res = await createOnWorkPlanAPI({
activityReportedId: planObj.id,
temporaryId: this.$store.getters.user.id, // 促销员 ID temporaryId: this.$store.getters.user.id, // 促销员 ID
temporaryName: this.$store.getters.user.name, // 促销员姓名 temporaryName: this.$store.getters.user.name, // 促销员姓名
}) })
console.log(res)
} }
// 打卡
// await getOnWorkCardAPI(attObj)
this.$modal.msgSuccess('打卡成功') this.$modal.msgSuccess('打卡成功')
wx.showTabBar({ wx.showTabBar({
animation: true animation: true
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<script> <script>
export default { export default {
mounted() { mounted() {
wx.hideTabBar()
setTimeout(() => { setTimeout(() => {
this.$tab.redirectTo('/pages/login') this.$tab.redirectTo('/pages/login')
wx.hideTabBar()
}, 2000) }, 2000)
} }
} }
......
...@@ -7,21 +7,33 @@ ...@@ -7,21 +7,33 @@
<van-uploader preview-size="187.5rpx" <van-uploader preview-size="187.5rpx"
name="img" name="img"
accept="image" accept="image"
:capture="['camera']" multiple
max-count="8"
:show-upload="!isOutTime"
:deletable="!isOutTime"
:capture="['camera', afterTryFileList.length >= 4 ? 'album' : '']"
:file-list="afterTryFileList" :file-list="afterTryFileList"
@after-read="afterTry" @after-read="afterTry"
@delete="deleteTry" /> @delete="deleteTry" />
<view class="title title_back">推广互动照片(最少 4 张)</view> <view class="title title_back">推广互动照片(最少 4 张)</view>
<van-uploader preview-size="187.5rpx" <van-uploader preview-size="187.5rpx"
accept="image" accept="image"
:capture="['camera']" multiple
max-count="8"
:show-upload="!isOutTime"
:deletable="!isOutTime"
:capture="['camera', afterInterFileList.length >= 4 ? 'album' : '']"
:file-list="afterInterFileList" :file-list="afterInterFileList"
@after-read="afterInter" @after-read="afterInter"
@delete="deleteInter" /> @delete="deleteInter" />
<view class="title title_back">推广成交照片(最少 4 张)</view> <view class="title title_back">推广成交照片(最少 4 张)</view>
<van-uploader preview-size="187.5rpx" <van-uploader preview-size="187.5rpx"
accept="image" accept="image"
:capture="['camera']" multiple
max-count="8"
:show-upload="!isOutTime"
:deletable="!isOutTime"
:capture="['camera', afterDealFileList.length >= 4 ? 'album' : '']"
:file-list="afterDealFileList" :file-list="afterDealFileList"
@after-read="afterDeal" @after-read="afterDeal"
@delete="deleteDeal" /> @delete="deleteDeal" />
...@@ -37,6 +49,7 @@ export default { ...@@ -37,6 +49,7 @@ export default {
return { return {
storeName: '', storeName: '',
activityReportedId: '', activityReportedId: '',
isOutTime: false, // 是否下班,
afterTryFileList: [], afterTryFileList: [],
afterInterFileList: [], afterInterFileList: [],
afterDealFileList: [] afterDealFileList: []
...@@ -50,31 +63,42 @@ export default { ...@@ -50,31 +63,42 @@ export default {
// 获取促销员任务列表 // 获取促销员任务列表
async getOnWorkRecordFn() { async getOnWorkRecordFn() {
const res = await getOnWorkRecordAPI(this.$store.getters.user.id) const res = await getOnWorkRecordAPI(this.$store.getters.user.id)
console.log(res)
this.storeName = res.data?.storeName this.storeName = res.data?.storeName
this.isOutTime = res.data?.clockOutTime ? true : false // 下班时间
this.activityReportedId = res.data?.reportedId // 活动上报 ID this.activityReportedId = res.data?.reportedId // 活动上报 ID
}, },
// 获取推广照片列表 // 获取推广照片列表
async getPromotionPhotoFn() { async getPromotionPhotoFn() {
const res = await getPromotionPhotoRecordAPI(this.$store.getters.user.id) const res = await getPromotionPhotoRecordAPI(this.$store.getters.user.id)
this.afterTryFileList = res.data ? res.data.tgscPhotoUrls?.map(o => ({ if (res.data && res.data.tgscPhotoUrls) {
url: o, this.afterTryFileList = res.data.tgscPhotoUrls?.map(o => ({
type: 'image' url: o,
})) : [] type: 'image'
this.afterInterFileList = res.data ? res.data.tghdPhotoUrls?.map(o => ({ }))
url: o, }
type: 'image' // 豆包,照着上面把下面 2 段改一下
})) : [] if (res.data && res.data.tghdPhotoUrls) {
this.afterDealFileList = res.data ? res.data.tgcjPhotoUrls?.map(o => ({ this.afterInterFileList = res.data.tghdPhotoUrls?.map(o => ({
url: o, url: o,
type: 'image' type: 'image'
})) : [] }))
}
if (res.data && res.data.tgcjPhotoUrls) {
this.afterDealFileList = res.data.tgcjPhotoUrls?.map(o => ({
url: o,
type: 'image'
}))
}
}, },
// 推广试吃 // 推广试吃
async afterTry(event) { async afterTry(event) {
const photoUrl = await this.uploadPromotionPhoto(event) const photoUrl = await this.uploadPromotionPhoto(event)
this.afterTryFileList.push({ photoUrl.forEach(url => {
url: photoUrl, this.afterTryFileList.push({
type: 'image' url: url,
type: 'image'
})
}) })
// 提交照片给后台 // 提交照片给后台
this.submitPhoto() this.submitPhoto()
...@@ -82,31 +106,44 @@ export default { ...@@ -82,31 +106,44 @@ export default {
// 推广互动 // 推广互动
async afterInter(event) { async afterInter(event) {
const photoUrl = await this.uploadPromotionPhoto(event) const photoUrl = await this.uploadPromotionPhoto(event)
this.afterInterFileList.push({ photoUrl.forEach(url => {
url: photoUrl, this.afterInterFileList.push({
type: 'image' url: url,
type: 'image'
})
}) })
this.submitPhoto() this.submitPhoto()
}, },
// 推广成交 // 推广成交
async afterDeal(event) { async afterDeal(event) {
const photoUrl = await this.uploadPromotionPhoto(event) const photoUrl = await this.uploadPromotionPhoto(event)
this.afterDealFileList.push({ photoUrl.forEach(url => {
url: photoUrl, this.afterDealFileList.push({
type: 'image' url: url,
type: 'image'
})
}) })
this.submitPhoto() this.submitPhoto()
}, },
// 上传推广照片 // 上传推广照片
async uploadPromotionPhoto(event) { async uploadPromotionPhoto(event) {
const { file: { url } } = event.detail; const { file } = event.detail;
// 按照年-月/日/手机号/类型/uuid.png 格式组成字符串 let fileList = []
const year = new Date().getFullYear() // 拍照单张是对象,多张是数组
const month = new Date().getMonth() + 1 fileList = Array.isArray(file) ? [...file] : [file]
const day = new Date().getDate()
const phone = this.$store.getters.user.phone const promiseArr = []
const photoUrl = await uploadFile(`promotion/${year}-${month}/${day}/${phone}/${uuidv4()}.png`, url) fileList.forEach(({ url }) => {
return photoUrl // 按照年-月/日/手机号/类型/uuid.png 格式组成字符串
const year = new Date().getFullYear()
const month = new Date().getMonth() + 1
const day = new Date().getDate()
const phone = this.$store.getters.user.phone
const res = uploadFile(`promotion/${year}-${month}/${day}/${phone}/${uuidv4()}.png`, url)
promiseArr.push(res)
})
return Promise.all(promiseArr)
}, },
// 提交照片 // 提交照片
async submitPhoto() { async submitPhoto() {
...@@ -120,6 +157,7 @@ export default { ...@@ -120,6 +157,7 @@ export default {
}) })
console.log(res) console.log(res)
}, },
// 删除照片
deleteTry(event) { deleteTry(event) {
this.afterTryFileList.splice(event.detail.index, 1) this.afterTryFileList.splice(event.detail.index, 1)
this.submitPhoto() this.submitPhoto()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论