Commit 37caa8cc authored by 李超鹏's avatar 李超鹏

update:add、update

scope:self-support
body:完工页面交互调试
parent 02d04def
......@@ -73,6 +73,21 @@ let orderApiFun = function(vm){
*/
let getWatermark= async (params = {}) => await vm.$u.get('wxh-worker-rest/rest/'+ vm.vuex_token+'/photo/watermark', params);
/**
* 获取订单的完工项目(配置+数据)
*/
let getCompleteConfigAndData= async (orderId) => await vm.$u.get('wxh-worker-rest/rest/'+ vm.vuex_token+'/order/'+ orderId +'/maintain/info');
/**
* 查询措施
*/
let getMeasure= async (params = {}) => await vm.$u.get('wxh-worker-rest/rest/service/'+ vm.vuex_token+'/measure/queryMeasureItems', params);
/**
* 保存售后记录
*/
let saveCompleteData = async (params = {},orderId) => await vm.$u.post('wxh-worker-rest/rest/'+ vm.vuex_token+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params);
const orderApi = {
listByRecommendOrder,
listOrderCount,
......@@ -84,13 +99,15 @@ let orderApiFun = function(vm){
listOrderRecord,
orderAccept,
orderGan,
maintainWorkerCheckin,
feedbackConfig,
traceAndAppointment,
rejectOrder,
orderStandard,
saveImage,
getWatermark
getWatermark,
getCompleteConfigAndData,
getMeasure,
saveCompleteData
}
return orderApi
}
......
......@@ -2,7 +2,7 @@
<template>
<view class="list">
<view v-for="(item,index) in settings" :key="index"
:class="{'txt':true,'active':checkStatus(item)}" @click="setValue(item)">{{item}}
:class="{'txt':true,'active':checkStatus(item.key)}" @click="setValue(item.key)">{{item.label}}
</view>
</view>
</template>
......@@ -20,7 +20,7 @@
},
computed: {
settings() {
return this.item.settings || []
return this.item.fieldsOptions || []
}
},
watch: {},
......@@ -51,22 +51,22 @@
</script>
<style lang="scss" scoped>
.list {
display: flex;
display: flex;
flex-wrap: wrap;
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
}
}
</style>
......@@ -5,48 +5,48 @@
<view class="txt u-flex-1">{{item.fieldsTitle}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> -->
<view class="pics u-flex u-flex-wrap">
<view class="pics u-flex u-flex-wrap">
<view class="img-list" v-for="(item,index) in imgList" :key="index">
<u-image class="pic" width="170" height="170" :src="item.path" @click.stop="prviewImage(item.path,index)"></u-image>
<view class="icon-del-box" @click.stop="delFile(index)">
<view class="icon-del"></view>
<view class="icon-del rotate"></view>
</view>
</view>
<view class="img-list" @click="choose">
<u-image class="pic" width="170rpx" height="170" @click="selectUpload" src="https://gitee.com/xuqu/uView/blob/master/static/uview/example/min_button.png"></u-image>
<u-image class="pic" width="170" height="170" :src="item.path" @click.stop="prviewImage(item.path,index)"></u-image>
<view class="icon-del-box" @click.stop="delFile(index)">
<view class="icon-del"></view>
<view class="icon-del rotate"></view>
</view>
</view>
<view class="img-list">
<u-image class="pic" width="170rpx" height="170" @click="selectUpload" src="https://gitee.com/xuqu/uView/blob/master/static/uview/example/min_button.png"></u-image>
</view>
<!-- <u-image class="pic" v-for="item in 6" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image> -->
</view>
</view>
<u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
</view>
</template>
<script>
import objMixin from './objMixin'
import arrMixin from './arrMixin'
import baseFile from '@/components/upload/index';
export default {
name: 'XhFiles',
components: {},
mixins: [objMixin,baseFile],
props: {
files: {
type: Array,
}
mixins: [arrMixin,baseFile],
props: {
files: {
type: Array,
}
},
filters:{},
data() {
return {
maskShow:false,
list: [
{
text: '相册'
},
{
text: '拍照'
}
],
takeStatus: false,
maskShow:false,
list: [
{
text: '相册'
},
{
text: '拍照'
}
],
takeStatus: false,
}
},
computed: {
......@@ -54,34 +54,54 @@
return this.item.settings || []
}
},
watch: {
'takeStatus': function(val, oldVal){
this.$emit('getTakeStatus', {status: val, index: this.itemIndex})
},
'files': { // 处理相机拍照返回的图片
handler (val) {
this.imgList = val.map(v => {
v.path = v.src
return v
})
this.setValue()
},
deep:true,
immediate: true,
}
watch: {
'takeStatus': function(val, oldVal){
this.$emit('getTakeStatus', {status: val, index: this.itemIndex})
},
'files': { // 处理相机拍照返回的图片
handler (val) {
if(val && val.length > 0){
val.forEach((item,index,array)=>{
item.path = item.src
this.imgList.push(item)
})
// this.imgList = val.map(v => {
// v.path = v.src
// return v
// })
this.setValue()
}
},
deep:true,
immediate: true,
},
// 'value'(val, oldVal){
// if(val){
// this.imgList = val.map(img =>{
// return {path:img}
// })
// }
// }
},
mounted() {
if(this.value){
this.imgList = this.value.map(img =>{
return {path: img}
})
}
this.setValue()
},
mounted() {},
methods: {
selectUpload(){
// 弹窗展示
this.maskShow = true
},
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
async uploadFile(type){
const self = this
......@@ -89,8 +109,8 @@
// 直接打开相册
let config = {
options:{
sourceType:['album'],//['album', 'camera']
count: 5,
sourceType:['album'],//['album', 'camera']
count: 10,
sizeType: ['compressed']
}
}
......@@ -104,67 +124,67 @@
setValue() {
const dataValue = []
this.imgList.map(item=>{
dataValue.push(item.key)
})
console.log(this.imgList)
dataValue.push(item.src)
})
this.valueChange(dataValue)
},
prviewImage(url, index) {
uni.previewImage({
urls: [url],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
},
prviewImage(url, index) {
uni.previewImage({
urls: [url],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
}
}
}
</script>
<style lang="scss" scoped>
.pic{
margin-right: 15rpx;
margin-bottom: 15rpx;
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&:nth-child(3n){
margin-right: 0;
}
}
.img-list {
position: relative;
margin: 8rpx;
border: 1px solid #eee;
width: 170rpx;
height: 170rpx;
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
}
.img-list {
position: relative;
margin: 8rpx;
border: 1px solid #eee;
width: 170rpx;
height: 170rpx;
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
// .list {
// display: flex;
......
......@@ -16,8 +16,7 @@
return {}
},
computed: {
type() {
console.log(this.item)
type() {
if (this.item && this.item.fieldsType == 'password' || this.item.fieldsType == 'textarea') {
return this.item.fieldsType
} else {
......@@ -32,7 +31,7 @@
</script>
<style scoped>
.input-item{
background: #F4F5F7;
.input-item{
background: #F4F5F7;
}
</style>
<!-- ******************* 定位 ******************* -->
<template>
<template>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<!-- <u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">自动定位</u-button> -->
<view class="u-flex-1 location-name">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
<view class="u-flex-1 location-name">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
</view>
</template>
<script>
import objMixin from './objMixin'
import arrMixin from './arrMixin'
export default {
name: 'XhLocation',
components: {},
mixins: [objMixin],
mixins: [arrMixin],
props: {},
filters:{},
data() {
......@@ -28,18 +27,18 @@
valueTxt() {
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0].toFixed(4)+','+'纬度:'+dataValue[1].toFixed(4)
}
return str
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
},
watch: {},
created() {
this.getLocation()
created() {
this.getLocation()
},
methods: {
getLocation() {
......@@ -69,18 +68,18 @@
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx;
}
</style>
<!-- ******************* 单级/多级 选择 ******************* -->
<!-- ******************* 服务措施 ******************* -->
<template>
<view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker">
......
<!-- ******************* 单选框 ******************* -->
<template>
<view class="list">
<view v-for="(item,index) in settings" :key="index" :class="{'txt':true,'active':item===dataValue}"
@click="setValue(item)">{{item}}</view>
<view v-for="(item,index) in settings" :key="index" :class="{'txt':true,'active':item.key===dataValue}"
@click="setValue(item.key)">{{item.label}}</view>
</view>
</template>
......@@ -17,8 +17,8 @@
return {}
},
computed: {
settings(){
return this.item.settings || []
settings(){
return this.item.fieldsOptions || []
}
},
watch: {},
......@@ -33,23 +33,23 @@
</script>
<style lang="scss" scoped>
.list{
display: flex;
display: flex;
flex-wrap: wrap;
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
text-align: center;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
.txt{
color:#666;
padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
text-align: center;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
}
}
}
</style>
<!-- ******************* 单个下拉选择 ******************* -->
<template>
<view>
<u-input v-model="dataValue" readOnly @click="show=true" type="select" />
<u-input :value="text" readOnly @click="show=true" type="select" />
<u-action-sheet :list="settings" v-model="show" @click="actionSheetCallback"></u-action-sheet>
</view>
</template>
......@@ -28,22 +28,27 @@
},
settings() {
let result = []
let settings = this.item.settings || []
let settings = this.item.fieldsOptions || []
result = settings.map(item => {
return {
text: item
text: item.label,
id: item.key
}
})
return result
},
text(){
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:''
}
},
watch: {},
mounted() {},
methods: {
actionSheetCallback(index) {
let txt = this.settings[index].text;
this.dataValue = txt
this.valueChange(txt)
let id = this.settings[index].id;
this.dataValue = id
this.valueChange(id)
}
}
}
......
......@@ -2,8 +2,8 @@
<template>
<view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker">
<view class="txt">{{item.fieldsTitle}}</view>
<view class="txt u-flex-1">{{dataValue}}</view>
<!-- <view class="txt">{{item.fieldsTitle}}</view> -->
<view class="txt u-flex-1">{{dataValue||'请选择时间'}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker>
......@@ -25,10 +25,9 @@
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
// 选择时间的时间戳
hour: false,
minute: false,
second: false,
timestamp: true,
}
}
......@@ -49,11 +48,8 @@
this.showPicker = true
},
pickerConfirm(data) {
console.log(data, 'DATA')
let result = []
let dataValue = data.year + '-' + data.month + '-' + data.day + ' ' + data.hour + ':' + data.minute +
':' + data.second
console.log(dataValue, 'dataValue')
let dataValue = data.year + '-' + data.month + '-' + data.day
this.dataValue = dataValue
this.valueChange(dataValue)
},
......
<template>
<view>
<view class="u-wrap" v-if="!takeStatus">
<u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="26" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar>
<u-tabs-swiper ref="tabs" :current="tabIndex" :list="list" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
<view v-for="(item,index) in groupList" :key="index" class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.groupName}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box"
@scroll="rightScroll">
<u-form :model="form" ref="uForm">
<template v-for="(groupItem,groupIndex) in groupList">
<view class="class-item" :key="groupIndex">
<view class="title">{{groupItem.groupName}}</view>
<view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex"
label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="item.fieldsType!=='location'">
<!-- <text class="required" v-if="item.required">*</text> -->
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange">
</xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-multi-input>
<xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-radio>
<xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-checkbox>
<xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-select>
<xh-files v-else-if="typeToComponentType(item.fieldsType)==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
<template>
<view>
<view class="u-wrap" v-if="!takeStatus">
<u-navbar :background="{background: '#2272FF'}" back-icon-color="#fff" :title-size="26" title-color="#fff" :border-bottom="false" title="完工信息"></u-navbar>
<u-tabs-swiper ref="tabs" :current="tabIndex" name="panelName" :list="list" @change="tabsChange" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" :scroll-into-view="itemId" v-if="list[tabIndex].items.length > 1">
<view v-for="(item,index) in list[tabIndex].items" :key="index" class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.name}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box" @scroll="rightScroll">
<u-form :model="form" ref="uForm">
<template v-for="(groupItem, groupIndex) in (list.length>0?list[tabIndex].items:[])">
<view class="class-item" :key="groupIndex">
<view class="title">{{groupItem.name}}</view>
<view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex"
label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="typeToComponentType(item.fieldsType)!=='location'">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}}
</view>
<template v-if="item.fieldsType">
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
:itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' @value-change="fieldValueChange">
</xh-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-multi-input>
<xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-radio>
<xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-checkbox>
<xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-select>
<xh-files v-else-if="typeToComponentType(item.fieldsType)==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || []'
:files="files[itemIndex.toString()]"
@value-change="fieldValueChange" @getTakeStatus="getTakeStatus">
</xh-files>
<xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-location>
<xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-scan>
<xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-picker>
<xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item"
@value-change="fieldValueChange">
</xh-time>
</template>
</u-form-item>
</view>
</view>
</template>
</u-form>
</scroll-view>
</view>
<view class="btn-wrap flex-xc">
<u-button class="btn-submit" @click="$u.debounce(nextStep, 500)" :custom-style="buttonStyle"
type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
下一步
</u-button>
</view>
</view>
<take-photo v-else @close="closeTake"></take-photo>
</view>
@value-change="fieldValueChange" @getTakeStatus="getTakeStatus">
</xh-files>
<xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-location>
<xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-scan>
<xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-picker>
<xh-service-measure v-else-if="typeToComponentType(item.fieldsType)==='servicemeasure'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :orderId="orderId" :categoryId="categoryId"
:orderServiceType="orderServiceType" :specificationId="form['specificationId'] || 0" :value="form[item.fieldsName]"
@value-change="fieldValueChange">
</xh-service-measure>
<xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange">
</xh-time>
</template>
</u-form-item>
</view>
</view>
</template>
</u-form>
</scroll-view>
</view>
<view class="btn-wrap flex-xc">
<u-button class="btn-submit" @click="nextStep" :custom-style="buttonStyle"
type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
下一步
</u-button>
</view>
</view>
<take-photo v-else @close="closeTake"></take-photo>
</view>
</template>
<script>
import classifyData from '@/common/classify.data.js';
import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from '@/components/createCom/XhRadio.vue'
import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
import XhSelect from '@/components/createCom/XhSelect.vue'
import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from '@/components/createCom/XhScan.vue'
import XhPicker from '@/components/createCom/XhPicker.vue'
import XhTime from '@/components/createCom/XhTime.vue'
import takePhoto from '@/components/take/index.vue'
import classifyData from '@/common/classify.data.js';
import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from '@/components/createCom/XhRadio.vue'
import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
import XhSelect from '@/components/createCom/XhSelect.vue'
import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from '@/components/createCom/XhScan.vue'
import XhPicker from '@/components/createCom/XhPicker.vue'
import XhTime from '@/components/createCom/XhTime.vue'
import takePhoto from '@/components/take/index.vue'
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
// import XhRadio from '@/components/createCom/XhRadio.vue'
export default {
data() {
return {
list: [
{
name: '基础信息'
},
{
name: '勘察信息'
},
{
name: '安装信息'
}
],
tabIndex: 1,
scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0,
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id
groupList: classifyData, // 基本信息、安装 、勘察(其中一项表单数据)
menuItemPos: [],
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器
form: { // 一维表单
name: 'name',
radio: ''
},
rules: {
name: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
mobile: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}, {
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}]
},
submitBtnStatus: false,
takeStatus: false,
fileIndex: null,
files: []
}
},
components: {
XhInput,
XhMultiInput,
XhRadio,
XhCheckbox,
XhSelect,
XhFiles,
XhLocation,
XhScan,
XhPicker,
XhTime,
'take-photo': takePhoto
},
created() {
// console.log(allComponents,'allComponents')
},
onLoad() {
},
onReady() {
this.$refs.uForm.setRules(this.rules);
// 导航栏滚动切换
this.getMenuItemTop()
},
updated() {
//console.log(this.form.name, 'form.name')
},
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
buttonStyle() {
return this.submitBtnStatus ? {
'color': '#FFFFFF',
'background-color': '#2272FF;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
} : {
'color': '#FFFFFF',
'background-color': '#D1D4D4;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
}
}
},
methods: {
getTakeStatus(event) {
this.takeStatus = event.status
this.fileIndex = event.index.toString()
if(!this.files[event.index] || this.files[event.index].length < 1) this.files[event.index] = []
},
closeTake(images) {
this.takeStatus = false
//const newFile = this.files[this.fileIndex].concat(images)
this.$set(this.files, this.fileIndex, images)
},
// 字段的值更新
fieldValueChange(data) {
// data.groupIndex data.itemIndex值下标 data.value //值
console.log(data, 'data')
const groupItem = this.groupList[data.groupIndex]
let innerItem
if (groupItem.item) {
innerItem = groupItem.item[data.itemIndex]
}
console.log(data.value,'data.value',innerItem, 'innerItem')
if(innerItem.fieldsType ==='multiInput'){
// 多个输入框的值触发
let key = Object.keys(data.value)[0]
this.form[key] = data.value[key]
}else{
this.form[innerItem.fieldsName] = data.value
}
console.log(this.form, 'this.form')
},
nextStep(item) {
if (this.tabIndex < 3) this.tabIndex++
},
typeToComponentType(type) {
// 将fieldType类型统一转换为公共组件判定类型
let formType = ''
type = type.toLocaleLowerCase()
switch (type) {
case 'text':
case 'password':
case 'textarea':
case 'number':
formType = 'input'
break
case 'multiinput':
formType = 'multiinput'
break;
case 'select':
formType = 'select'
break
case 'radio':
formType = 'radio'
break
case 'checkbox':
formType = 'checkbox'
break
case 'file':
formType = 'file'
break
case 'location':
formType = 'location'
break
case 'scan':
formType = 'scan'
break
case 'picker':
case 'mutipicker':
formType = 'picker'
break
case 'time':
formType = 'time'
break
}
//console.log(formType,'formType')
return formType
},
// ------------------------- 以下方法为展示滚动切换 -------------------------
// 点击左边的栏目切换
async swichMenu(index) {
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop;
export default {
data() {
return {
orderId:0,
categoryId:0,
orderServiceType:'',
list: [],
tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0,
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id
groupList: classifyData, // 基本信息、安装 、勘察(其中一项表单数据)
menuItemPos: [],
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器
form: { // 一维表单
},
rules: {
name: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}],
mobile: [{
required: true,
min: 10,
message: '姓名不能为空',
// 可以单个或者同时写两个触发验证方式
trigger: ['change', 'blur'],
}, {
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说,返回true表示校验通过,返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}]
},
submitBtnStatus: false,
takeStatus: false,
fileIndex: null,
files: []
}
},
components: {
XhInput,
XhMultiInput,
XhRadio,
XhCheckbox,
XhSelect,
XhFiles,
XhLocation,
XhScan,
XhPicker,
XhTime,
XhServiceMeasure,
'take-photo': takePhoto
},
created() {
// console.log(allComponents,'allComponents')
},
onLoad(option) {
console.log(option)
if (option) {
this.orderId = option.orderId
this.categoryId = option.categoryId
this.orderServiceType = option.orderServiceType
} else {
this.orderId = 9708719
this.categoryId = 88
this.orderServiceType = '安装'
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
// 导航栏滚动切换
this.getMenuItemTop()
},
updated() {
//console.log(this.form.name, 'form.name')
},
computed: {
getCompleteData() {
let self = this
if(self.orderId){
self.$u.api.getCompleteConfigAndData(self.orderId).then((res) => {
if (res.code == 200) {
self.list = res.data.config
} else {
console.log(res.message, "获取订单详情失败!");
}
});
}
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
buttonStyle() {
return this.submitBtnStatus ? {
'color': '#FFFFFF',
'background-color': '#2272FF;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
} : {
'color': '#FFFFFF',
'background-color': '#D1D4D4;',
'width': '600rpx',
'height': '104rpx',
'font-size': '32rpx',
'font-weight': 'bold'
}
}
},
methods: {
getTakeStatus(event) {
this.takeStatus = event.status
this.fileIndex = event.index.toString()
if(!this.files[event.index] || this.files[event.index].length < 1) this.files[event.index] = []
},
tabsChange(index){
this.tabIndex = index
this.arr = []
this.scrollRightTop = 0;
this.current = 0;
this.leftMenuStatus(0)
this.$nextTick(function() {
this.scrollRightTop = this.arr[index];
this.current = index;
this.leftMenuStatus(index);
})
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this);
query.select('.' + elClass).fields({
size: true
}, res => {
// 如果节点尚未生成,res值为null,循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass);
}, 10);
return;
}
this[dataVal] = res.height;
resolve();
}).exec();
})
},
// 观测元素相交状态
async observer() {
this.tabbar.map((val, index) => {
let observer = uni.createIntersectionObserver(this);
// 检测右边scroll-view的id为itemxx的元素与right-box的相交状态
// 如果跟.right-box底部相交,就动态设置左边栏目的活动状态
observer.relativeTo('.right-box', {
top: 0
}).observe('#item' + index, res => {
if (res.intersectionRatio > 0) {
let id = res.id.substring(4);
this.leftMenuStatus(id);
}
})
this.getMenuItemTop()
})
},
// 设置左边菜单的滚动状态
async leftMenuStatus(index) {
this.current = index;
// 如果为0,意味着尚未初始化
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
await this.getElRect('menu-scroll-view', 'menuHeight');
await this.getElRect('u-tab-item', 'menuItemHeight');
}
// 将菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
},
// 获取右边菜单每个item到顶部的距离
getMenuItemTop() {
new Promise(resolve => {
let selectorQuery = uni.createSelectorQuery();
selectorQuery.selectAll('.class-item').boundingClientRect((rects) => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) {
setTimeout(() => {
this.getMenuItemTop();
}, 10);
return;
}
rects.forEach((rect) => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top);
resolve();
})
}).exec()
})
},
},
closeTake(images) {
this.takeStatus = false
//const newFile = this.files[this.fileIndex].concat(images)
this.$set(this.files, this.fileIndex, images)
},
// 字段的值更新
fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex]
let innerItem
if (groupItem.items) {
innerItem = groupItem.items[data.itemIndex]
}
if(innerItem.fieldsType ==='multiInput'){
// 多个输入框的值触发
let key = Object.keys(data.value)[0]
this.form[key] = data.value[key]
}else{
this.$set(this.form,innerItem.fieldsName,data.value)
}
console.log(this.form, 'this.form')
},
nextStep() {
if (this.tabIndex < this.list.length) {
this.tabIndex++
this.arr = []
this.$nextTick(function() {
this.getMenuItemTop()
})
}
},
typeToComponentType(type) {
// 将fieldType类型统一转换为公共组件判定类型
let formType = ''
type = type.toLocaleLowerCase()
switch (type) {
case 'text':
case 'password':
case 'textarea':
case 'number':
case 'decimal':
case 'double':
formType = 'input'
break
case 'multiinput':
formType = 'multiinput'
break;
case 'select':
case 'specifications':
formType = 'select'
break
case 'radio':
formType = 'radio'
break
case 'checkbox':
formType = 'checkbox'
break
case 'file':
case 'photos':
formType = 'file'
break
case 'location':
formType = 'location'
break
case 'scan':
formType = 'scan'
break
case 'picker':
case 'mutipicker':
formType = 'picker'
break
case 'service_measures':
formType = 'servicemeasure'
break
case 'time':
case 'date':
formType = 'time'
break
}
return formType
},
// ------------------------- 以下方法为展示滚动切换 -------------------------
// 点击左边的栏目切换
async swichMenu(index) {
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop;
this.$nextTick(function() {
this.scrollRightTop = this.arr[index];
this.current = index;
this.leftMenuStatus(index);
})
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this);
query.select('.' + elClass).fields({
size: true
}, res => {
// 如果节点尚未生成,res值为null,循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass);
}, 10);
return;
}
this[dataVal] = res.height;
resolve();
}).exec();
})
},
// 观测元素相交状态
async observer() {
this.tabbar.map((val, index) => {
let observer = uni.createIntersectionObserver(this);
// 检测右边scroll-view的id为itemxx的元素与right-box的相交状态
// 如果跟.right-box底部相交,就动态设置左边栏目的活动状态
observer.relativeTo('.right-box', {
top: 0
}).observe('#item' + index, res => {
if (res.intersectionRatio > 0) {
let id = res.id.substring(4);
this.leftMenuStatus(id);
}
})
})
},
// 设置左边菜单的滚动状态
async leftMenuStatus(index) {
this.current = index;
// 如果为0,意味着尚未初始化
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
await this.getElRect('menu-scroll-view', 'menuHeight');
await this.getElRect('u-tab-item', 'menuItemHeight');
}
// 将菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
},
// 获取右边菜单每个item到顶部的距离
getMenuItemTop() {
new Promise(resolve => {
let selectorQuery = uni.createSelectorQuery();
selectorQuery.selectAll('.class-item').boundingClientRect((rects) => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) {
setTimeout(() => {
this.getMenuItemTop();
}, 10);
return;
}
rects.forEach((rect) => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top);
resolve();
})
}).exec()
})
},
// 右边菜单滚动
async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
if (this.timer) return;
if (!this.menuHeight) {
await this.getElRect('menu-scroll-view', 'menuHeight');
}
this.timer = setTimeout(() => { // 节流
this.timer = null;
// scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop + this.menuHeight / 2;
for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i];
let height2 = this.arr[i + 1];
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
this.leftMenuStatus(i);
return;
}
}
}, 10)
}
}
}
// 右边菜单滚动
async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) {
await this.getMenuItemTop();
}
if (this.timer) return;
if (!this.menuHeight) {
await this.getElRect('menu-scroll-view', 'menuHeight');
}
this.timer = setTimeout(() => { // 节流
this.timer = null;
// scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop + this.menuHeight / 2;
for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i];
let height2 = this.arr[i + 1];
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
this.leftMenuStatus(i);
return;
}
}
}, 10)
}
}
}
</script>
<style lang="scss" scoped>
// ---------------------------- 表单样式begin ----------------------------
/deep/ .u-form-item {
.u-form-item__message {
padding-left: 0 !important;
}
// ---------------------------- 表单样式begin ----------------------------
/deep/ .u-form-item {
.u-form-item__message {
padding-left: 0 !important;
}
.u-form-item--left__content--required {
vertical-align: top;
}
}
.class-item {
padding: 50rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
.label {
color: #333;
font-size: 28rpx;
line-height: 40rpx;
}
.u-form-item--left__content--required {
vertical-align: top;
}
}
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.class-item {
padding: 50rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
.label {
color: #333;
font-size: 28rpx;
line-height: 40rpx;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
// ---------------------------- 表单样式end ----------------------------
// ---------------------------- 表单样式end ----------------------------
.u-wrap {
height: calc(100vh);
/* #ifdef H5 */
height: calc(100vh - var(--window-top));
/* #endif */
display: flex;
flex-direction: column;
}
.u-wrap {
height: calc(100vh);
/* #ifdef H5 */
height: calc(100vh - var(--window-top));
/* #endif */
display: flex;
flex-direction: column;
}
.u-search-box {
padding: 18rpx 30rpx;
}
.u-search-box {
padding: 18rpx 30rpx;
}
.u-menu-wrap {
flex: 1;
display: flex;
overflow: hidden;
}
.u-menu-wrap {
flex: 1;
display: flex;
overflow: hidden;
}
.u-search-inner {
background-color: rgb(234, 234, 234);
border-radius: 100rpx;
display: flex;
align-items: center;
padding: 10rpx 16rpx;
}
.u-search-inner {
background-color: rgb(234, 234, 234);
border-radius: 100rpx;
display: flex;
align-items: center;
padding: 10rpx 16rpx;
}
.u-search-text {
font-size: 26rpx;
color: $u-tips-color;
margin-left: 10rpx;
}
.u-search-text {
font-size: 26rpx;
color: $u-tips-color;
margin-left: 10rpx;
}
.u-tab-view {
width: 200rpx;
height: 100%;
}
.u-tab-view {
width: 200rpx;
height: 100%;
}
.u-tab-item {
height: 110rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #444;
font-weight: 400;
line-height: 1;
}
.u-tab-item {
height: 110rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #444;
font-weight: 400;
line-height: 1;
}
.u-tab-item-active {
position: relative;
color: #2272FF;
font-size: 30rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active {
position: relative;
color: #2272FF;
font-size: 30rpx;
font-weight: 600;
background: #fff;
}
// .u-tab-item-active::before {
// content: "";
// position: absolute;
// border-left: 4px solid $u-type-primary;
// height: 32rpx;
// left: 0;
// top: 39rpx;
// }
// .u-tab-item-active::before {
// content: "";
// position: absolute;
// border-left: 4px solid $u-type-primary;
// height: 32rpx;
// left: 0;
// top: 39rpx;
// }
.u-tab-view {
height: 100%;
}
.u-tab-view {
height: 100%;
}
.right-box {
background-color: rgb(250, 250, 250);
}
.right-box {
background-color: rgb(250, 250, 250);
}
.page-view {
padding: 16rpx;
}
.page-view {
padding: 16rpx;
}
.class-item {
margin-bottom: 30rpx;
background-color: #fff;
padding: 16rpx;
border-radius: 8rpx;
}
.class-item {
margin-bottom: 30rpx;
background-color: #fff;
padding: 16rpx;
border-radius: 8rpx;
}
.class-item:last-child {
min-height: 100vh;
}
.class-item:last-child {
min-height: 100vh;
}
.item-title {
font-size: 26rpx;
color: $u-main-color;
font-weight: bold;
}
.item-title {
font-size: 26rpx;
color: $u-main-color;
font-weight: bold;
}
.item-menu-name {
font-weight: normal;
font-size: 24rpx;
color: $u-main-color;
}
.item-menu-name {
font-weight: normal;
font-size: 24rpx;
color: $u-main-color;
}
.item-container {
display: flex;
flex-wrap: wrap;
}
.item-container {
display: flex;
flex-wrap: wrap;
}
.thumb-box {
width: 33.333333%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 20rpx;
}
.thumb-box {
width: 33.333333%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 20rpx;
}
.item-menu-image {
width: 120rpx;
height: 120rpx;
}
.item-menu-image {
width: 120rpx;
height: 120rpx;
}
/*提交按钮*/
.btn-wrap {
width: 100%;
padding: 20rpx 0 40rpx 0;
}
/*提交按钮*/
.btn-wrap {
width: 100%;
padding: 20rpx 0 40rpx 0;
}
</style>
......@@ -377,7 +377,9 @@
filish(){
// 去完工
uni.navigateTo({
url: 'pages/order/complete?orderId='+this.order.orderId
url: 'pages/order/complete?orderId='+this.order.orderId
+ "&categoryId=" + this.order.categoryId
+ "&orderServiceType=" + this.order.orderServiceType
})
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment