接车时应有拍照上传功能
This commit is contained in:
parent
641d0b3780
commit
38373ee3de
@ -162,9 +162,18 @@
|
|||||||
|
|
||||||
<project-picker ref="proj" @confirm="projConfirm"></project-picker>
|
<project-picker ref="proj" @confirm="projConfirm"></project-picker>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 普通弹窗---拍照上传 -->
|
||||||
|
<uni-popup ref="popup" background-color="#fff">
|
||||||
|
<view class="popup-content">
|
||||||
|
<view class="dl-avatar-box">
|
||||||
|
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile" limit="9" title="请上传车辆照片(最多选择9张图片)"></uni-file-picker>
|
||||||
|
</view>
|
||||||
|
<button type="primary" @click="submit">保存</button>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
|
||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="btn" @click="submit">创建工单</view>
|
<view class="btn" @click="submitUpload">创建工单</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -178,6 +187,7 @@ import request from "@/utils/request";
|
|||||||
import {getToken, setUserInfo, getUserInfo} from '@/utils/auth.js'
|
import {getToken, setUserInfo, getUserInfo} from '@/utils/auth.js'
|
||||||
import config from "@/config";
|
import config from "@/config";
|
||||||
import {formatTimestamp, formatTimestampCustom} from "@/utils/utils";
|
import {formatTimestamp, formatTimestampCustom} from "@/utils/utils";
|
||||||
|
import upload from "@/utils/upload";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -186,6 +196,9 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
//上传的图片数组
|
||||||
|
fileList: [],
|
||||||
|
sizeType:['compressed'],
|
||||||
phone: '',
|
phone: '',
|
||||||
carList: [],
|
carList: [],
|
||||||
activeCarIndex: 0,
|
activeCarIndex: 0,
|
||||||
@ -226,13 +239,41 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
afterRead(file) {
|
||||||
|
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||||
|
upload({
|
||||||
|
url:'/admin-api/infra/file/upload',
|
||||||
|
filePath: file.tempFilePaths[i]
|
||||||
|
}).then((res)=>{
|
||||||
|
this.fileList.push({
|
||||||
|
url: config.baseImageUrl+res.data
|
||||||
|
})
|
||||||
|
console.log(this.fileList)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteFile(file, index) {
|
||||||
|
this.fileList.splice(index, 1);
|
||||||
|
},
|
||||||
|
|
||||||
|
saveWorkingItem(){
|
||||||
|
console.log(this.fileList,145)
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createUniqueCodeByHead(head = '') {
|
createUniqueCodeByHead(head = '') {
|
||||||
const min = 100; // 最小值
|
const min = 100; // 最小值
|
||||||
const max = 999; // 最大值
|
const max = 999; // 最大值
|
||||||
return head.toString() + Date.now().toString() + Math.floor(Math.random() * (max - min + 1)) + min;
|
return head.toString() + Date.now().toString() + Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
},
|
},
|
||||||
//新增工单
|
|
||||||
submit() {
|
/**
|
||||||
|
* 创建工单前上传图片
|
||||||
|
*/
|
||||||
|
submitUpload(){
|
||||||
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0) {
|
if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请完善信息',
|
title: '请完善信息',
|
||||||
@ -240,6 +281,12 @@ export default {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.$refs.popup.open("bottom");
|
||||||
|
},
|
||||||
|
|
||||||
|
//新增工单
|
||||||
|
submit() {
|
||||||
|
let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",")
|
||||||
const data = {
|
const data = {
|
||||||
userId: this.userInfo.id,
|
userId: this.userInfo.id,
|
||||||
ticketNo: this.ticketNo,
|
ticketNo: this.ticketNo,
|
||||||
@ -254,7 +301,8 @@ export default {
|
|||||||
adviserId: getUserInfo().id,
|
adviserId: getUserInfo().id,
|
||||||
adviserName: getUserInfo().nickname,
|
adviserName: getUserInfo().nickname,
|
||||||
ticketType: this.ticketType,
|
ticketType: this.ticketType,
|
||||||
itemList: this.formatItem(this.selectedProj)
|
itemList: this.formatItem(this.selectedProj),
|
||||||
|
fileStr:fileStr
|
||||||
}
|
}
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: '/pages-repair/signature/signature?data=' + JSON.stringify(data)
|
// url: '/pages-repair/signature/signature?data=' + JSON.stringify(data)
|
||||||
@ -428,6 +476,14 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
.popup-content {
|
||||||
|
@include flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 15px;
|
||||||
|
height: auto;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
.container {
|
.container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #F3F5F7;
|
background-color: #F3F5F7;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
<view class="handTitle">请签名</view>
|
<view class="handTitle">请签名</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<pickerColor :isShow="showPickerColor" :bottom="0" @callback='getPickerColor' />
|
<pickerColor :isShow="showPickerColor" :bottom="0" @callback='getPickerColor' />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -424,10 +423,15 @@
|
|||||||
url: '/admin-api/common/upload',
|
url: '/admin-api/common/upload',
|
||||||
filePath: res.tempFilePath,
|
filePath: res.tempFilePath,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log('服务器返回图片地址', res);
|
// console.log('服务器返回图片地址', res);
|
||||||
console.log('打印data',newData)
|
// console.log('打印data',newData)
|
||||||
newData.image = res.data.url
|
console.log(res.data.url,'服务器返回图片地址')
|
||||||
console.log('提交的内容', newData)
|
if (newData.fileStr == null || newData.fileStr == ''){
|
||||||
|
newData.image = res.data.url
|
||||||
|
} else {
|
||||||
|
newData.image = newData.fileStr + ',' + res.data.url
|
||||||
|
}
|
||||||
|
// console.log('提交的内容', newData)
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/repair/tickets/create',
|
url: '/admin-api/repair/tickets/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
Loading…
Reference in New Issue
Block a user