master
tangyi 2022-04-06 16:07:18 +08:00
parent b1f0eae65c
commit cd9365cfbb
3 changed files with 188 additions and 78 deletions

View File

@ -8,7 +8,7 @@
<view class="type">
<view class="li" @click="typeIndexFun(index)" :class="index==typeIndex?'on':''"
v-for="(item,index) in typeData">
{{item.title}}
{{item.name}}
</view>
</view>
</view>
@ -17,25 +17,25 @@
<view class="title">
<text class="cor">*</text>产品名称
</view>
<input class="input" type="text" value="全彩LED显示屏" />
<input class="input" v-model="data.title" type="text" placeholder="请填写产品名称" />
</view>
<view class="li">
<view class="title">
<text class="cor">*</text>规格型号
</view>
<input class="input" type="text" value="P2.5" />
<input class="input" type="text" v-model="data.model" placeholder="请填写产品规格型号" />
</view>
<view class="li">
<view class="title">产品品牌</view>
<input class="input" type="text" value="" placeholder="请输入品牌" />
<input class="input" type="text" v-model="data.brand" value="" placeholder="请输入品牌" />
</view>
<view class="li">
<view class="title">
<text class="cor">*</text>产品尺寸
</view>
<input class="input" type="text" value="宽:38.5m x 高14.5m" />
<input class="input" type="text" v-model="data.width" placeholder="请填写产品尺寸 宽" />
<input class="input" type="text" v-model="data.height" placeholder="请填写产品尺寸 高" />
</view>
</view>
<view class="supplementTitle">补充信息</view>
@ -44,70 +44,80 @@
<view class="title">
<text class="cor">*</text>联系人
</view>
<input type="text" class="input" value="王富贵" />
<input type="text" class="input" v-model="data.contact_name" placeholder="请填写联系人名称" />
</view>
<view class="li">
<view class="">
<text class="cor">*</text>联系电话
</view>
<input type="text" class="input" value="18256666666" />
<input type="text" v-model="data.contact_phone" class="input" placeholder="请填写联系电话" />
</view>
<view class="li">
<view class="">
<text class="cor">*</text>预约时间
</view>
<input type="text" class="input" value="2022-02-16" />
<input type="text" v-model="data.appointment_time" class="input" @tap="openDatetimePicker"
placeholder="请选择预约时间" />
</view>
<yy-mm-dd-hh-ss ref="myPicker" @submit="handleSubmit" :start-year="2022" :end-year="2122">
</yy-mm-dd-hh-ss>
<view class="li-textarea">
<view class="title">*详细地址</view>
<textarea class="textarea" value="湖南省株洲市荷塘区红旗中路456号五矿二十三冶综合楼" placeholder="" />
<textarea class="textarea" v-model="data.addres" placeholder="请输入详细地址" />
</view>
<view class="scene-img">
<view class="title">现场图片</view>
<view class="img-content">
<image class="img" src="../../static/del/img003.png" mode=""></image>
<image class="img" src="../../static/del/img003.png" mode=""></image>
<image v-for="(item,index) in imgsrcArr" class="img" :src="item" :key="index"
mode="aspectFill"></image>
</view>
<view class="iocn-content">
<view class="iocn-content" @click="chooseImg()">
<image class="icon" src="../../static/iocn/jia.png" mode=""></image>
</view>
</view>
</view>
<button class="submit-button" type="default">确认提交</button>
<button class="submit-button" @click="submitData()" type="default">确认提交</button>
</view>
</container-subgroup-two>
</container-subgroup-two>
</view>
</view>
</template>
<script>
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import statusNav from '../../components/status-nav.vue';
import yyMmDdHhSs from '@/components/dates/yy-mm-dd-hh-ss.vue';
import {
uploadImg
} from '@/jsFile/public-api.js';
export default {
components: {
statusNav,
containerSubgroupTwo,
yyMmDdHhSs
},
data() {
return {
data:{
type_id:1,
title:"",
brand:"",
model:"型号",
width:"",
height:"",
contact_name:"",
contact_phone:"",
appointment_time:'',
addres:"",
pictures:"",
data: {
type_id: 1,
title: "",
brand: "",
model: "",
width: "",
height: "",
contact_name: "",
contact_phone: "",
appointment_time: '',
addres: "",
pictures: "",
},
imgsrcArr: [],
typeIndex: 0,
typeData: [{
title: '巡检',
@ -129,12 +139,101 @@
}
},
onLoad(op) {
this.getType()
if (op.index != undefined) this.typeIndex = op.index;
},
methods: {
//
typeIndexFun(index) {
this.typeIndex = index
this.data.type_id=this.typeData
this.data.type_id = this.typeData
},
getType() {
this.$requst.post('/universal/api.vas/vas_type', this.data).then(res => {
if (res.code == 1) {
this.typeData = [...res.data]
console.log(this.typeData)
} else {
}
})
},
openDatetimePicker() {
this.$refs.myPicker.show();
},
//
handleSubmit(e) {
// {year: "2019", month: "07", day: "17", hour: "15", minute: "21"}
console.log(e)
this.data.appointment_time = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
},
//
chooseImg() {
uni.chooseImage({
count: 2,
sourceType: ['album', 'camera'],
success: (res) => {
this.imgsrcArr = []
let imgsrc = res.tempFilePaths;
imgsrc.forEach(item => {
this.imgsrcArr.push(item);
})
for (var i = 0; i < res.tempFilePaths.length; i++) {
uploadImg({
path: res.tempFilePaths[i]
}).then(res => {
if (res.code) {
this.$toolAll.tools.showToast('上传成功');
if (!this.data.pictures) {
this.data.pictures = res.data.id + ","
} else {
this.data.pictures += res.data.id
}
}
})
}
}
})
},
//
submitData() {
if (!this.data.title) {
this.$toolAll.tools.showToast("请填写产品名称");
return
}
if (!this.data.contact_name) {
this.$toolAll.tools.showToast("请填写联系人名称");
return
}
var reg_tel =
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; //11
if (!reg_tel.test(this.data.contact_phone)) {
this.$toolAll.tools.showToast("请正确填写联系人电话");
return
}
if (!this.data.appointment_time) {
this.$toolAll.tools.showToast("请选择预约时间");
return
}
if (!this.data.addres) {
this.$toolAll.tools.showToast("请正确填写详细地址");
return
}
if (!this.data.pictures) {
this.$toolAll.tools.showToast("请选择现场图片");
return
}
this.data.appointment_time = new Date(this.data.appointment_time).getTime()
this.$requst.post('/universal/api.vas/vas', this.data).then(res => {
if (res.code == 1) {
console.log(res)
} else {
}
})
}
}
}
@ -206,13 +305,15 @@
.appreciationServe-from .li {
display: flex;
height: 80rpx;
border-bottom: 1rpx solid #f5f5f7;
border-bottom: 1rpx solid #f5f5f7;
align-items: center;
}
.appreciationServe-from .li:last-child {
border-bottom: none;
}
.appreciationServe-from .li:last-child {
border-bottom: none;
}
.appreciationServe-from .li .title {
font-size: 26rpx;
color: #333333;

View File

@ -25,22 +25,24 @@
<view class="padding">
<view class="devicename" @click="scanCodeFun()" v-if="navDataState[0].state">
<view class="">请填写设备名称和型号或扫描二维码</view>
<image class="sm" src="../../static/iocn/sm.png" lazy-load mode=""></image>
<image class="sm" src="../../static/iocn/sm.png" lazy-load mode=""></image>
</view>
<input v-model="data.device_name" class="devicename" placeholder="请填写设备名称和型号" v-else />
<view class="fault-pictures radius10" @click="chooseImg">
<image class="fault-pictures-img" v-if="imgsrcArr.length>=1" :src="imgsrcArr[0]" mode="aspectFill"></image>
<image class="fault-pictures-img" v-if="imgsrcArr.length>=1" :src="imgsrcArr[0]"
mode="aspectFill"></image>
<view class="fault-pictures-con" v-else>
<image class="img" src="../../static/iocn/gz.png" lazy-load mode="aspectFill"></image>
<view class="text">添加故障图片</view>
</view>
<image class="img" src="../../static/iocn/gz.png" lazy-load mode="aspectFill"></image>
<view class="text">添加故障图片</view>
</view>
</view>
<textarea v-model="data.fault_describe" class="fault-description radius10" placeholder="故障情况描述"
placeholder-class="fault-description-text" />
<view class="detailed-address inputCss">
<input type="text" v-model="data.address" class="fon26 width100"
<input type="text" v-model="data.service_address" class="fon26 width100"
placeholder="请输入详细的上门服务地址" placeholder-class="inputCss-input" />
<image @click="mapFun()" src="../../static/iocn/map.png" class="map flexs" mode="aspectFill"></image>
<image @click="mapFun()" src="../../static/iocn/map.png" class="map flexs" mode="aspectFill">
</image>
</view>
<input type="text" class="inputCss" v-model="data.username" placeholder="请填写您的姓名"
placeholder-class="inputCss-input" />
@ -48,7 +50,8 @@
placeholder-class="inputCss-input" />
<input type="text" class="inputCss" @tap="openDatetimePicker" disabled v-model="data.visit_time"
placeholder="请选择上门时间" placeholder-class="inputCss-input" />
<yy-mm-dd-hh-ss ref="myPicker" @submit="handleSubmit" :start-year="2022" :end-year="2122"></yy-mm-dd-hh-ss>
<yy-mm-dd-hh-ss ref="myPicker" @submit="handleSubmit" :start-year="2022" :end-year="2122">
</yy-mm-dd-hh-ss>
<button class="submit-button" @click="submitButton()" type="default">提交故障申报</button>
</view>
</view>
@ -58,7 +61,9 @@
<script>
import yyMmDdHhSs from '@/components/dates/yy-mm-dd-hh-ss.vue';
import { uploadImg } from '@/jsFile/public-api.js';
import {
uploadImg
} from '@/jsFile/public-api.js';
export default {
components: {
yyMmDdHhSs
@ -70,17 +75,16 @@
is_device: 0,
fault_type: "",
device_name: "华为LED",
condition: "",
project_number: "",
service_address:"",
address: "",
service_address: "",
username: "",
fault_describe:"",
images:"",
fault_picture: "",
fault_describe: "",
images: "",
phone: "",
visit_time: ""
},
imgsrcArr:[],
imgsrcArr: [],
indexType: 0,
navDataState: [{
title: "有设备",
@ -99,7 +103,7 @@
onLoad() {
this.getType()
},
methods: {
//
getType() {
@ -135,20 +139,25 @@
count: 1,
sourceType: ['album', 'camera'],
success: (res) => {
this.imgsrcArr=[]
this.imgsrcArr = []
let imgsrc = res.tempFilePaths;
imgsrc.forEach(item => {
this.data.images=item
this.data.images = item
this.imgsrcArr.push(item);
})
uploadImg({path:res.tempFilePaths[0]}).then(res=>{
if(res.code) {
this.$toolAll.tools.showToast('上传成功');
}
uploadImg({
path: res.tempFilePaths[0]
}).then(res => {
if (res.code) {
console.log(res.data.id)
this.$toolAll.tools.showToast('上传成功');
this.data.fault_picture = res.data.id
}
})
}
})
},
@ -193,11 +202,12 @@
this.$toolAll.tools.showToast("请正确填写您的电话");
return
}
this.$requst.post('/universal/api.work_order/repair',this.data).then(res => {
if (res.code == 1) {
console.log(res)
console.log(this.data)
this.$requst.post('/universal/api.work_order/repair', this.data).then(res => {
if (res.code == 1) {
console.log(res)
} else {
}
@ -209,19 +219,15 @@
},
mapFun() {
const that = this
uni.getLocation({
type: 'gcj02', //uni.openLocation
success: function(res) {
const latitude = res.latitude;
const longitude = res.longitude;
console.log(latitude, longitude, 78);
uni.chooseLocation({
success: function(res) {
console.log(res, 81);
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.data.service_address = res.address
}
});
// uni.openLocation({
@ -373,11 +379,13 @@
background-color: #FFFFFF;
flex-direction: column;
}
.fault-pictures-con{
display: flex;
flex-direction: column;
align-items: center;
}
.fault-pictures-con {
display: flex;
flex-direction: column;
align-items: center;
}
.fault-pictures .img {
width: 87rpx;
margin-bottom: 27rpx;
@ -457,9 +465,10 @@
width: 42rpx;
height: 36rpx;
}
.fault-pictures-img{
.fault-pictures-img {
width: 100%;
height: 100%;
}
</style>

View File

@ -242,7 +242,7 @@
},
data() {
return {
role: 1, // 1 2: 3: 4
role: 4, // 1 2: 3: 4
statusHeight: uni.getSystemInfoSync().statusBarHeight + 50,
messageNumber: 16 ,//
noticeList:['2021年11月06日公司团建维修服务暂停一天服务暂停一天服务暂停一天。','51akslfj;dkpiojasdjf;j1ij'],//