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="type">
<view class="li" @click="typeIndexFun(index)" :class="index==typeIndex?'on':''" <view class="li" @click="typeIndexFun(index)" :class="index==typeIndex?'on':''"
v-for="(item,index) in typeData"> v-for="(item,index) in typeData">
{{item.title}} {{item.name}}
</view> </view>
</view> </view>
</view> </view>
@ -17,25 +17,25 @@
<view class="title"> <view class="title">
<text class="cor">*</text>产品名称 <text class="cor">*</text>产品名称
</view> </view>
<input class="input" type="text" value="全彩LED显示屏" /> <input class="input" v-model="data.title" type="text" placeholder="请填写产品名称" />
</view> </view>
<view class="li"> <view class="li">
<view class="title"> <view class="title">
<text class="cor">*</text>规格型号 <text class="cor">*</text>规格型号
</view> </view>
<input class="input" type="text" value="P2.5" /> <input class="input" type="text" v-model="data.model" placeholder="请填写产品规格型号" />
</view> </view>
<view class="li"> <view class="li">
<view class="title">产品品牌</view> <view class="title">产品品牌</view>
<input class="input" type="text" value="" placeholder="请输入品牌" /> <input class="input" type="text" v-model="data.brand" value="" placeholder="请输入品牌" />
</view> </view>
<view class="li"> <view class="li">
<view class="title"> <view class="title">
<text class="cor">*</text>产品尺寸 <text class="cor">*</text>产品尺寸
</view> </view>
<input class="input" type="text" v-model="data.width" placeholder="请填写产品尺寸 宽" />
<input class="input" type="text" value="宽:38.5m x 高14.5m" /> <input class="input" type="text" v-model="data.height" placeholder="请填写产品尺寸 高" />
</view> </view>
</view> </view>
<view class="supplementTitle">补充信息</view> <view class="supplementTitle">补充信息</view>
@ -44,70 +44,80 @@
<view class="title"> <view class="title">
<text class="cor">*</text>联系人 <text class="cor">*</text>联系人
</view> </view>
<input type="text" class="input" value="王富贵" /> <input type="text" class="input" v-model="data.contact_name" placeholder="请填写联系人名称" />
</view> </view>
<view class="li"> <view class="li">
<view class=""> <view class="">
<text class="cor">*</text>联系电话 <text class="cor">*</text>联系电话
</view> </view>
<input type="text" class="input" value="18256666666" /> <input type="text" v-model="data.contact_phone" class="input" placeholder="请填写联系电话" />
</view> </view>
<view class="li"> <view class="li">
<view class=""> <view class="">
<text class="cor">*</text>预约时间 <text class="cor">*</text>预约时间
</view> </view>
<input type="text" class="input" value="2022-02-16" /> <input type="text" v-model="data.appointment_time" class="input" @tap="openDatetimePicker"
placeholder="请选择预约时间" />
</view> </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="li-textarea">
<view class="title">*详细地址</view> <view class="title">*详细地址</view>
<textarea class="textarea" value="湖南省株洲市荷塘区红旗中路456号五矿二十三冶综合楼" placeholder="" /> <textarea class="textarea" v-model="data.addres" placeholder="请输入详细地址" />
</view> </view>
<view class="scene-img"> <view class="scene-img">
<view class="title">现场图片</view> <view class="title">现场图片</view>
<view class="img-content"> <view class="img-content">
<image class="img" src="../../static/del/img003.png" mode=""></image> <image v-for="(item,index) in imgsrcArr" class="img" :src="item" :key="index"
<image class="img" src="../../static/del/img003.png" mode=""></image> mode="aspectFill"></image>
</view> </view>
<view class="iocn-content"> <view class="iocn-content" @click="chooseImg()">
<image class="icon" src="../../static/iocn/jia.png" mode=""></image> <image class="icon" src="../../static/iocn/jia.png" mode=""></image>
</view> </view>
</view> </view>
</view> </view>
<button class="submit-button" type="default">确认提交</button> <button class="submit-button" @click="submitData()" type="default">确认提交</button>
</view> </view>
</container-subgroup-two> </container-subgroup-two>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue'; import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import statusNav from '../../components/status-nav.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 { export default {
components: { components: {
statusNav, statusNav,
containerSubgroupTwo, containerSubgroupTwo,
yyMmDdHhSs
}, },
data() { data() {
return { return {
data:{ data: {
type_id:1, type_id: 1,
title:"", title: "",
brand:"", brand: "",
model:"型号", model: "",
width:"", width: "",
height:"", height: "",
contact_name:"", contact_name: "",
contact_phone:"", contact_phone: "",
appointment_time:'', appointment_time: '',
addres:"", addres: "",
pictures:"", pictures: "",
}, },
imgsrcArr: [],
typeIndex: 0, typeIndex: 0,
typeData: [{ typeData: [{
title: '巡检', title: '巡检',
@ -129,12 +139,101 @@
} }
}, },
onLoad(op) { onLoad(op) {
this.getType()
if (op.index != undefined) this.typeIndex = op.index; if (op.index != undefined) this.typeIndex = op.index;
}, },
methods: { methods: {
//
typeIndexFun(index) { typeIndexFun(index) {
this.typeIndex = 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 { .appreciationServe-from .li {
display: flex; display: flex;
height: 80rpx; height: 80rpx;
border-bottom: 1rpx solid #f5f5f7; border-bottom: 1rpx solid #f5f5f7;
align-items: center; align-items: center;
} }
.appreciationServe-from .li:last-child {
border-bottom: none; .appreciationServe-from .li:last-child {
} border-bottom: none;
}
.appreciationServe-from .li .title { .appreciationServe-from .li .title {
font-size: 26rpx; font-size: 26rpx;
color: #333333; color: #333333;

View File

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

View File

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