Commit 6feded7e authored by 刘用法's avatar 刘用法
parents 502e8a73 5419b705
...@@ -8,93 +8,110 @@ let orderApiFun = function(vm){ ...@@ -8,93 +8,110 @@ let orderApiFun = function(vm){
* 工单数量查询接口 * 工单数量查询接口
*/ */
let listOrderCount = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/queryOrdersCount/V2', params); let listOrderCount = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/queryOrdersCount/V2', params);
/** /**
* 工单列表接口 * 工单列表接口
*/ */
let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/' + vm.vuex_token + '/list', params); let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/' + vm.vuex_token + '/list', params);
/** /**
* 获取师傅的预约日历 * 获取师傅的预约日历
*/ */
let workerCalendar = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/calendar', params); let workerCalendar = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/calendar', params);
/** /**
* 师傅预约 * 师傅预约
*/ */
let workerAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + '/'+orderId, params) let workerAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + '/'+orderId, params)
// 联系顾客时间更新接口,暂时没有 // 联系顾客时间更新接口,暂时没有
/** /**
* 师傅签到接口 * 师傅签到接口
*/ */
let maintainWorkerCheckin = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintainWorkerCheckin', params,{'content-type': 'application/x-www-form-urlencoded'}); let maintainWorkerCheckin = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintainWorkerCheckin', params,{'content-type': 'application/x-www-form-urlencoded'});
/** /**
* 订单详情查询 * 订单详情查询
*/ */
let orderDetail = async (params = {},orderId) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/'+orderId, params); let orderDetail = async (params = {},orderId) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/'+orderId, params);
/* 过程反馈查询接口 */ /* 过程反馈查询接口 */
let feedbackConfig = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/v2/getFeedBack/' + vm.vuex_token, params) let feedbackConfig = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/v2/getFeedBack/' + vm.vuex_token, params)
/* 预约+过程反馈 接口 */ /* 预约+过程反馈 接口 */
let traceAndAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + `/`+orderId, params) let traceAndAppointment = async (params = {}, orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/traceAndAppointment/trace/V2/' + vm.vuex_token + `/`+orderId, params)
/* 师傅拒单 */ /* 师傅拒单 */
let rejectOrder = async (params = {}, orderId) => await vm.$u.get(prefix + vm.vuex_token + `/order/${orderId}/workerReject/V2`, params) let rejectOrder = async (params = {}, orderId) => await vm.$u.get(prefix + vm.vuex_token + `/order/${orderId}/workerReject/V2`, params)
/** /**
* 查询工单操作记录列表接口 * 查询工单操作记录列表接口
*/ */
let listOrderRecord = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/listOrderRecord/'+params.orderId, params); let listOrderRecord = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/listOrderRecord/'+params.orderId, params);
/** /**
* 接单 * 接单
*/ */
let orderAccept = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+orderId+'/accept', params); let orderAccept = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token+'/order/'+orderId+'/accept', params);
/** /**
* 抢单 * 抢单
*/ */
let orderGan = async (params = {},orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/revision/applets/'+ vm.vuex_token+'/order/acceptAppletsOrder', params,{'content-type': 'application/x-www-form-urlencoded'}); let orderGan = async (params = {},orderId) => await vm.$u.post('/wxh-worker-rest/rest/order/revision/applets/'+ vm.vuex_token+'/order/acceptAppletsOrder', params,{'content-type': 'application/x-www-form-urlencoded'});
/** /**
* 获取拍照标准 * 获取拍照标准
*/ */
let orderStandard = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token+'/photo/standard', params); let orderStandard = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token+'/photo/standard', params);
/** /**
* 保存图片信息 * 保存图片信息
*/ */
let saveImage = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintain/saveImage', params); let saveImage = async (params = {},orderId) => await vm.$u.post(prefix + vm.vuex_token + '/order/'+orderId+'/maintain/saveImage', params);
/** /**
* 获取师傅水印 or 默认水印 * 获取师傅水印 or 默认水印
*/ */
let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params); let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params);
/** /**
* 获取师傅开放可选时间段 * 获取师傅开放可选时间段
*/ */
let openTimerange = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/timerange', params); let openTimerange = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/wokerOrder/appointment/timerange', params);
/** /**
* 联系时间接口 * 联系时间接口
*/ */
let contactTime = async (params = {},orderId) => await vm.$u.get('/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/contact/'+orderId, params); let contactTime = async (params = {},orderId) => await vm.$u.get('/wxh-worker-rest/rest/order/record/'+ vm.vuex_token+'/contact/'+orderId, params);
/** /**
* 检查是否可以拒单 * 检查是否可以拒单
*/ */
let checkRejectable = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/'+ vm.vuex_token+'/wokerOrder/checkRejectable', params); let checkRejectable = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/'+ vm.vuex_token+'/wokerOrder/checkRejectable', params);
/** /**
* 获取签到距离 * 获取签到距离
*/ */
let getSignDistance = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/' + vm.vuex_token + `/wokerOrder/sign/distance`, params) let getSignDistance = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/' + vm.vuex_token + `/wokerOrder/sign/distance`, params)
/**
* 获取订单的完工项目(配置+数据)
*/
let getCompleteConfigAndData= async (orderId) => await vm.$u.get(prefix+ 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(prefix+ vm.vuex_token+'/order/'+ orderId +'/maintain/saveMaintainInfoV2', params);
const orderApi = { const orderApi = {
listByRecommendOrder, listByRecommendOrder,
listOrderCount, listOrderCount,
...@@ -106,7 +123,6 @@ let orderApiFun = function(vm){ ...@@ -106,7 +123,6 @@ let orderApiFun = function(vm){
listOrderRecord, listOrderRecord,
orderAccept, orderAccept,
orderGan, orderGan,
maintainWorkerCheckin,
feedbackConfig, feedbackConfig,
traceAndAppointment, traceAndAppointment,
rejectOrder, rejectOrder,
...@@ -116,10 +132,13 @@ let orderApiFun = function(vm){ ...@@ -116,10 +132,13 @@ let orderApiFun = function(vm){
openTimerange, openTimerange,
contactTime, contactTime,
checkRejectable, checkRejectable,
getSignDistance getSignDistance,
getCompleteConfigAndData,
getMeasure,
saveCompleteData
} }
return orderApi return orderApi
} }
module.exports = { module.exports = {
orderApiFun orderApiFun
} }
\ No newline at end of file
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</template> </template>
<script> <script>
let now = Date.now() let now = new Date(new Date().toLocaleDateString()).getTime()
export default { export default {
props: { props: {
titleShow: { titleShow: {
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
return { return {
currentDay: 0, currentDay: 0,
currentTime: null, currentTime: null,
appointTime: Date.now(), appointTime: now,
appointRange: "", appointRange: "",
num: 0, num: 0,
hasLast: false hasLast: false
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
watch: { watch: {
title() { title() {
this.currentDay = 0 this.currentDay = 0
this.appointTime = Date.now() this.appointTime = now
this.currentTime = null this.currentTime = null
this.appointRange = "" this.appointRange = ""
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<view class="list"> <view class="list">
<view v-for="(item,index) in settings" :key="index" <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>
</view> </view>
</template> </template>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
}, },
computed: { computed: {
settings() { settings() {
return this.item.settings || [] return this.item.fieldsOptions || []
} }
}, },
watch: {}, watch: {},
...@@ -51,22 +51,22 @@ ...@@ -51,22 +51,22 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .list {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.txt{ .txt{
color:#666; color:#666;
padding:10rpx 30rpx; padding:10rpx 30rpx;
margin: 5rpx; margin: 5rpx;
background: #F4F5F7; background: #F4F5F7;
border-radius: 10rpx; border-radius: 10rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
line-height: 50rpx; line-height: 50rpx;
max-width: 48%; max-width: 48%;
&.active{ &.active{
background-color: #2272FF; background-color: #2272FF;
color:#fff; color:#fff;
} }
} }
} }
</style> </style>
...@@ -5,48 +5,48 @@ ...@@ -5,48 +5,48 @@
<view class="txt u-flex-1">{{item.fieldsTitle}}</view> <view class="txt u-flex-1">{{item.fieldsTitle}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon> <u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> --> </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"> <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> <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-box" @click.stop="delFile(index)">
<view class="icon-del"></view> <view class="icon-del"></view>
<view class="icon-del rotate"></view> <view class="icon-del rotate"></view>
</view> </view>
</view> </view>
<view class="img-list" @click="choose"> <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> <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> </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> --> <!-- <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> <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
</view> </view>
</template> </template>
<script> <script>
import objMixin from './objMixin' import arrMixin from './arrMixin'
import baseFile from '@/components/upload/index'; import baseFile from '@/components/upload/index';
export default { export default {
name: 'XhFiles', name: 'XhFiles',
components: {}, components: {},
mixins: [objMixin,baseFile], mixins: [arrMixin,baseFile],
props: { props: {
files: { files: {
type: Array, type: Array,
} }
}, },
filters:{}, filters:{},
data() { data() {
return { return {
maskShow:false, maskShow:false,
list: [ list: [
{ {
text: '相册' text: '相册'
}, },
{ {
text: '拍照' text: '拍照'
} }
], ],
takeStatus: false, takeStatus: false,
} }
}, },
computed: { computed: {
...@@ -54,34 +54,54 @@ ...@@ -54,34 +54,54 @@
return this.item.settings || [] return this.item.settings || []
} }
}, },
watch: { watch: {
'takeStatus': function(val, oldVal){ 'takeStatus': function(val, oldVal){
this.$emit('getTakeStatus', {status: val, index: this.itemIndex}) this.$emit('getTakeStatus', {status: val, index: this.itemIndex})
}, },
'files': { // 处理相机拍照返回的图片 'files': { // 处理相机拍照返回的图片
handler (val) { handler (val) {
this.imgList = val.map(v => { if(val && val.length > 0){
v.path = v.src val.forEach((item,index,array)=>{
return v item.path = item.src
}) this.imgList.push(item)
this.setValue() })
}, // this.imgList = val.map(v => {
deep:true, // v.path = v.src
immediate: true, // 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: { methods: {
selectUpload(){ selectUpload(){
// 弹窗展示 // 弹窗展示
this.maskShow = true this.maskShow = true
}, },
uploadSelect(index) { uploadSelect(index) {
if (index === 0) { if (index === 0) {
this.uploadFile('photo') this.uploadFile('photo')
} else { } else {
this.uploadFile() this.uploadFile()
} }
}, },
async uploadFile(type){ async uploadFile(type){
const self = this const self = this
...@@ -89,8 +109,8 @@ ...@@ -89,8 +109,8 @@
// 直接打开相册 // 直接打开相册
let config = { let config = {
options:{ options:{
sourceType:['album'],//['album', 'camera'] sourceType:['album'],//['album', 'camera']
count: 5, count: 10,
sizeType: ['compressed'] sizeType: ['compressed']
} }
} }
...@@ -104,67 +124,67 @@ ...@@ -104,67 +124,67 @@
setValue() { setValue() {
const dataValue = [] const dataValue = []
this.imgList.map(item=>{ this.imgList.map(item=>{
dataValue.push(item.key) dataValue.push(item.src)
}) })
console.log(this.imgList)
this.valueChange(dataValue) this.valueChange(dataValue)
}, },
prviewImage(url, index) { prviewImage(url, index) {
uni.previewImage({ uni.previewImage({
urls: [url], urls: [url],
current: index current: index
}); });
}, },
delFile(index) { delFile(index) {
this.imgList.splice(index, 1) this.imgList.splice(index, 1)
this.setValue()
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.pic{ .pic{
margin-right: 15rpx; // margin-right: 15rpx;
margin-bottom: 15rpx; // margin-bottom: 15rpx;
&:nth-child(3n){ &:nth-child(3n){
margin-right: 0; margin-right: 0;
} }
} }
.img-list { .img-list {
position: relative; position: relative;
margin: 8rpx; margin: 8rpx;
border: 1px solid #eee; border: 1px solid #eee;
width: 170rpx; width: 170rpx;
height: 170rpx; height: 170rpx;
.icon-del-box { .icon-del-box {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: absolute; position: absolute;
top: 10rpx; top: 10rpx;
right: 10rpx; right: 10rpx;
height: 40rpx; height: 40rpx;
width: 40rpx; width: 40rpx;
border-radius: 50%; border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
z-index: 2; z-index: 2;
transform: rotate(-45deg); transform: rotate(-45deg);
} }
.icon-del { .icon-del {
width: 30rpx; width: 30rpx;
height: 4rpx; height: 4rpx;
background-color: #fff; background-color: #fff;
border-radius: 2px; border-radius: 2px;
} }
.rotate { .rotate {
position: absolute; position: absolute;
transform: rotate(90deg); transform: rotate(90deg);
} }
} }
// .list { // .list {
// display: flex; // display: flex;
......
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
return {} return {}
}, },
computed: { computed: {
type() { type() {
console.log(this.item)
if (this.item && this.item.fieldsType == 'password' || this.item.fieldsType == 'textarea') { if (this.item && this.item.fieldsType == 'password' || this.item.fieldsType == 'textarea') {
return this.item.fieldsType return this.item.fieldsType
} else { } else {
...@@ -32,7 +31,7 @@ ...@@ -32,7 +31,7 @@
</script> </script>
<style scoped> <style scoped>
.input-item{ .input-item{
background: #F4F5F7; background: #F4F5F7;
} }
</style> </style>
<!-- ******************* 定位 ******************* --> <!-- ******************* 定位 ******************* -->
<template> <template>
<view> <view>
<view class="list u-flex u-row-between"> <view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view> <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">
<view class="u-flex-1 location-name"> <u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位 </view>
</view> </view>
</view> <view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
</view> </view>
</template> </template>
<script> <script>
import objMixin from './objMixin' import arrMixin from './arrMixin'
export default { export default {
name: 'XhLocation', name: 'XhLocation',
components: {}, components: {},
mixins: [objMixin], mixins: [arrMixin],
props: {}, props: {},
filters:{}, filters:{},
data() { data() {
...@@ -28,18 +27,18 @@ ...@@ -28,18 +27,18 @@
valueTxt() { valueTxt() {
let str = '' let str = ''
const dataValue = this.dataValue const dataValue = this.dataValue
if(dataValue && dataValue.length>1){ if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0].toFixed(4)+','+'纬度:'+dataValue[1].toFixed(4) str = '经度:'+dataValue[0].toFixed(4)+','+'纬度:'+dataValue[1].toFixed(4)
} }
return str return str
}, },
mixingImage() { mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png' return process.uniEnv.qn_base_url + 'mixing.png'
} }
}, },
watch: {}, watch: {},
created() { created() {
this.getLocation() this.getLocation()
}, },
methods: { methods: {
getLocation() { getLocation() {
...@@ -69,18 +68,18 @@ ...@@ -69,18 +68,18 @@
font-size: 28rpx; font-size: 28rpx;
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.item-image { .item-image {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
.location-name { .location-name {
color: #2272FF; color: #2272FF;
text-align: right; text-align: right;
} }
.location { .location {
background: #F4F5F7; background: #F4F5F7;
padding: 10rpx; padding: 10rpx;
} }
</style> </style>
<!-- ******************* 单级/多级 选择 ******************* --> <!-- ******************* 服务措施 ******************* -->
<template> <template>
<view class="picker-box"> <view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker"> <view class="u-flex u-row-between" @click="openPicker">
......
<!-- ******************* 单选框 ******************* --> <!-- ******************* 单选框 ******************* -->
<template> <template>
<view class="list"> <view class="list">
<view v-for="(item,index) in settings" :key="index" :class="{'txt':true,'active':item===dataValue}" <view v-for="(item,index) in settings" :key="index" :class="{'txt':true,'active':item.key===dataValue}"
@click="setValue(item)">{{item}}</view> @click="setValue(item.key)">{{item.label}}</view>
</view> </view>
</template> </template>
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
return {} return {}
}, },
computed: { computed: {
settings(){ settings(){
return this.item.settings || [] return this.item.fieldsOptions || []
} }
}, },
watch: {}, watch: {},
...@@ -33,23 +33,23 @@ ...@@ -33,23 +33,23 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.list{ .list{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
.txt{ .txt{
color:#666; color:#666;
padding:10rpx 30rpx; padding:10rpx 30rpx;
margin: 5rpx; margin: 5rpx;
background: #F4F5F7; background: #F4F5F7;
border-radius: 10rpx; border-radius: 10rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
line-height: 50rpx; line-height: 50rpx;
text-align: center; text-align: center;
max-width: 48%; max-width: 48%;
&.active{ &.active{
background-color: #2272FF; background-color: #2272FF;
color:#fff; color:#fff;
} }
} }
} }
</style> </style>
<!-- ******************* 单个下拉选择 ******************* --> <!-- ******************* 单个下拉选择 ******************* -->
<template> <template>
<view> <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> <u-action-sheet :list="settings" v-model="show" @click="actionSheetCallback"></u-action-sheet>
</view> </view>
</template> </template>
...@@ -28,22 +28,27 @@ ...@@ -28,22 +28,27 @@
}, },
settings() { settings() {
let result = [] let result = []
let settings = this.item.settings || [] let settings = this.item.fieldsOptions || []
result = settings.map(item => { result = settings.map(item => {
return { return {
text: item text: item.label,
id: item.key
} }
}) })
return result return result
},
text(){
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:''
} }
}, },
watch: {}, watch: {},
mounted() {}, mounted() {},
methods: { methods: {
actionSheetCallback(index) { actionSheetCallback(index) {
let txt = this.settings[index].text; let id = this.settings[index].id;
this.dataValue = txt this.dataValue = id
this.valueChange(txt) this.valueChange(id)
} }
} }
} }
......
<!-- ******************* 单级/多级 选择 ******************* -->
<template>
<view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker">
<view class="txt u-flex-1">{{text||''}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<u-picker v-model="showPicker" range-key="label" @columnchange="columnchange" :mode="isNotMulti?'selector':'multiSelector'" @confirm="pickerConfirm" :range="settings"></u-picker>
<!-- :default-selector='[0, 1]' -->
<u-toast ref="uToast" />
</view>
</template>
<script>
import objMixin from './objMixin'
export default {
name: 'XhPicker',
components: {},
mixins: [objMixin],
props: {
// 当mode=selector或者mode=multiSelector时,提供的默认选中的下标
defaultSelector: {
type: Array,
default() {
return [0];
}
},
// 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
rangeKey: {
type: String,
default: 'label'
},
value: {
type: String,
default: '{}'
},
orderId:{
type:Number,
default:0
},
categoryId:{
type:Number,
default:0
},
specificationId:{
type:String,
default:'0'
},
orderServiceType:{
type: String,
default: '安装'
},
},
filters:{},
data() {
return {
isNotMulti:true,
showPicker:false,
settings:[],
measure:[]
}
},
computed: {
text(){
let val = ''
if(this.value){
let data = JSON.parse(this.value);
val = data[0].measureTypeName + "-" + data[0].measureName
}
return val
}
},
watch: {
specificationId(val, oldVal){
this.initComponent()
},
},
mounted() {
this.isNotMulti = this.orderServiceType === '安装'
this.initComponent()
},
methods: {
openPicker(){
if(this.specificationId === '0'){
this.$refs.uToast.show({
title: '请先选择规格',
type: 'error'
})
return
}
this.showPicker = true
},
initComponent(){
if(this.isNotMulti){
this.initMeasure()
}else{
this.initSymptoms()
}
},
initSymptoms(){// 初始化现象
},
initCause(){// 初始化原因
},
initMeasure(){// 初始化措施
let self = this
if(self.orderId){
let param = {
orderId: self.orderId,
categoryId: self.categoryId,
specificationId: self.specificationId,
orderServiceTypeText: self.orderServiceType
}
self.$u.api.getMeasure(param).then((res) => {
if (res.code == 200) {
let result = []
for(let key in res.data){
self.measure = res.data[key].measureExtendDtos
res.data[key].measureExtendDtos.map((item,index) =>{
result.push({"id":item.measureId,"label":item.measureName})
})
}
if(self.orderServiceType === '安装'){
self.settings = result
}else{
self.settings[2] = result
}
} else {
console.log(res.message, "查询措施失败");
}
});
}
},
pickerConfirm(data){
let result = []
if(this.isMulti){// 维修
}else{// 安装
result.push(this.measure[data[0]])
}
this.valueChange(JSON.stringify(result))
},
columnchange(data){
// console.log(data,'data')
// // 树列改变时进行联动操作
// const {column ,index} = data
// let arr = [9,10,50]
// this.settings.splice(column+1,1,arr)
// console.log(this.settings,'this.settings')
},
}
}
</script>
<style lang="scss" scoped>
</style>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<template> <template>
<view class="picker-box"> <view class="picker-box">
<view class="u-flex u-row-between" @click="openPicker"> <view class="u-flex u-row-between" @click="openPicker">
<view class="txt">{{item.fieldsTitle}}</view> <!-- <view class="txt">{{item.fieldsTitle}}</view> -->
<view class="txt u-flex-1">{{dataValue}}</view> <view class="txt u-flex-1">{{dataValue||'请选择时间'}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon> <u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> </view>
<u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker> <u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker>
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
year: true, year: true,
month: true, month: true,
day: true, day: true,
hour: true, hour: false,
minute: true, minute: false,
second: true, second: false,
// 选择时间的时间戳
timestamp: true, timestamp: true,
} }
} }
...@@ -49,11 +48,8 @@ ...@@ -49,11 +48,8 @@
this.showPicker = true this.showPicker = true
}, },
pickerConfirm(data) { pickerConfirm(data) {
console.log(data, 'DATA')
let result = [] let result = []
let dataValue = data.year + '-' + data.month + '-' + data.day + ' ' + data.hour + ':' + data.minute + let dataValue = data.year + '-' + data.month + '-' + data.day
':' + data.second
console.log(dataValue, 'dataValue')
this.dataValue = dataValue this.dataValue = dataValue
this.valueChange(dataValue) this.valueChange(dataValue)
}, },
......
/** 自定义组件 共同逻辑 */
export default {
data() {
return {
dataValue:null
}
},
watch: {
value: function(val) {
this.dataValue = val
}
},
props: {
value: {
type: Array,
default: []
},
/** 索引值 用于更新数据 */
itemIndex: Number,
groupIndex: Number,
/** 包含数据源 */
item: Object,
disabled: {
type: Boolean,
default: false
}
},
mounted() {
/** 如果有值以传入值为主 如果无值 已默认值为主 */
this.dataValue = this.value
},
methods: {
// 输入的值
valueChange(val) {
const data = {
groupIndex: this.groupIndex, // 左侧菜单下标
itemIndex: this.itemIndex, //右侧某一项下标
value: val
}
this.$emit('value-change', data)
}
}
}
...@@ -62,8 +62,7 @@ export default { ...@@ -62,8 +62,7 @@ export default {
console.log("标识符4", this.userExamId); console.log("标识符4", this.userExamId);
console.log("标识符3" + num); console.log("标识符3" + num);
this.userExamId = num; this.userExamId = num.userExamId;
this.getExaminationQuestions(); this.getExaminationQuestions();
}, },
onUnload() { onUnload() {
...@@ -112,7 +111,7 @@ export default { ...@@ -112,7 +111,7 @@ export default {
"/serviceRule/next/" + "/serviceRule/next/" +
this.vuex_token + this.vuex_token +
"?userExamId=" + "?userExamId=" +
this.userExamId.userExamId, this.userExamId,
method: "POST", method: "POST",
header: { header: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
...@@ -134,7 +133,7 @@ export default { ...@@ -134,7 +133,7 @@ export default {
this.isQuestion = ""; this.isQuestion = "";
console.log("标识符6666", this.userExamId.userExamId); console.log("标识符6666", this.userExamId.userExamId);
wx.navigateTo({ wx.navigateTo({
url: "./result?userExamId=" + this.userExamId.userExamId, url: "./result?userExamId=" + this.userExamId,
}); });
} }
//判断有没有选 //判断有没有选
...@@ -154,7 +153,7 @@ export default { ...@@ -154,7 +153,7 @@ export default {
"/serviceRule/next/" + "/serviceRule/next/" +
this.vuex_token + this.vuex_token +
"?userExamId=" + "?userExamId=" +
this.userExamId.userExamId + this.userExamId +
"&questionId=" + "&questionId=" +
this.ExaminationQuestions.question.id + this.ExaminationQuestions.question.id +
"&userAnswerIds=" + "&userAnswerIds=" +
......
<template> <template>
<view class="study"> <view class="study">
<u-navbar <u-navbar :is-back="false" background="{background: transparent}" :border-bottom="false" :is-fixed="false">
:is-back="false"
background="{background: transparent}"
:border-bottom="false"
:is-fixed="false"
>
<text class="title-view">学习</text> <text class="title-view">学习</text>
</u-navbar> </u-navbar>
<image :src="bannerImage" mode="" class="banner"></image> <image :src="bannerImage" mode="" class="banner"></image>
<view> <view>
<u-tabs-swiper <u-tabs-swiper bg-color="#F4F5F7" inactive-color="#999999" font-size="28" ref="uTabs" :list="tabs"
bg-color="#F4F5F7" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
inactive-color="#999999"
font-size="28"
ref="uTabs"
:list="tabs"
:current="current"
@change="tabsChange"
:is-scroll="false"
swiperWidth="750"
></u-tabs-swiper>
</view> </view>
<swiper <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish"
:current="swiperCurrent" style="height: 755rpx;">
@transition="transition"
@animationfinish="animationfinish"
style="height: 755rpx"
>
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view <scroll-view scroll-y style="height:796rpx;width:100%;" @scrolltolower="onreachBottom">
scroll-y
style="height: 796rpx; width: 100%"
@scrolltolower="onreachBottom"
>
<view class="standard" @click="goToPrint"> <view class="standard" @click="goToPrint">
<text>充电桩交付规范</text> <text>充电桩交付规范</text>
<text>></text> <text>></text>
...@@ -41,20 +19,13 @@ ...@@ -41,20 +19,13 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view <scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom">
scroll-y <view v-for="item in list" :key="item.id" class="notice" @click="bbb(item)">
style="height: 100%; width: 100%" <view class="n-head">
@scrolltolower="onreachBottom" 《{{item.title}}》
> </view>
<view
v-for="item in list"
:key="item.id"
class="notice"
@click="bbb(item)"
>
<view class="n-head"> 《{{ item.title }}》 </view>
<view class="news" v-html="item.body"> <view class="news" v-html="item.body">
{{ item.body }} {{item.body}}
</view> </view>
</view> </view>
<view v-shou="isLoadMore"> <view v-shou="isLoadMore">
...@@ -63,116 +34,68 @@ ...@@ -63,116 +34,68 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item class="swiper-item"> <swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%; width: 100%"> <scroll-view scroll-y style="height:100%;width:100%;">
<view class="lean"> <view class="lean">
<view class="top"> <view class="top">
<view class="title u-margin-top-10 u-margin-bottom-30">通用课程</view>
<view class="currency-class"> <view class="currency-class">
<view class="title">通用课程</view> <view class="class1" @click=ccc(courselist[0].id)>
<view <image class="img" :src="courselist[0].pic" mode=""></image>
class="class1"
@click="ccc(courselist[0].id)"
>
<image
class="img"
:src="courselist[0].pic"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> <view class="u-font-32 font-bold">
{{ courselist[0].title }} {{ courselist[0].title }}
</view> </view>
<view class="intro"> <view class="u-font-24">
{{ courselist[0].desc }} {{ courselist[0].desc }}
</view> </view>
<view <view class="line-percent">
class="" <u-line-progress active-color="#2979ff" :percent="courselist[0].percent"
style=" :show-percent="false">
display: flex;
justify-content: space-between;
"
>
<u-line-progress
active-color="#2979ff"
:percent="courselist[0].percent"
style="width: 54%"
>
</u-line-progress> </u-line-progress>
<text <text class="font-default-color"
v-text="courselist[0].status" :class="{'font-active-color':courselist[0].percent}"
></text> v-text="courselist[0].status"></text>
</view> </view>
</view> </view>
</view> </view>
<view <view class="class1 u-margin-top-40" @click=ccc(courselist[1].id)>
class="class1" <image class="img" :src="courselist[1].pic" mode=""></image>
@click="ccc(courselist[1].id)"
>
<image
class="img"
:src="courselist[1].pic"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> <view class="u-font-32 font-bold">
{{ courselist[1].title }} {{ courselist[1].title }}
</view> </view>
<view class=""> <view class="u-font-24">
{{ courselist[1].desc }} {{ courselist[1].desc }}
</view> </view>
<view <view class="line-percent">
class="" <u-line-progress active-color="#2979ff" :percent="courselist[1].percent"
style=" :show-percent="false">
display: flex;
justify-content: space-between;
"
>
<u-line-progress
active-color="#2979ff"
:percent="courselist[1].percent"
style="width: 54%"
>
</u-line-progress> </u-line-progress>
<text <text class="font-default-color"
v-text="courselist[1].status" :class="{'font-active-color':courselist[1].percent}"
></text> v-text="courselist[1].status"></text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="title u-margin-top-50 u-margin-bottom-30">技能课程</view>
<view class="currency-class"> <view class="currency-class">
<view class="title">技能课程</view> <view class="class1" @click=ccc(courselist[2].id)>
<view <image class="img" :src="courselist[2].pic" mode=""></image>
class="class1"
@click="ccc(courselist[2].id)"
>
<image
class="img"
:src="courselist[2].pic"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> <view class="u-font-32 font-bold">
{{ courselist[2].title }} {{ courselist[2].title }}
</view> </view>
<view class=""> <view class="u-font-24">
{{ courselist[2].desc }} {{ courselist[2].desc }}
</view> </view>
<view <view class="line-percent" style="display:flex;justify-content: space-between;">
class="" <u-line-progress active-color="#2979ff" :percent="courselist[2].percent"
style=" :show-percent="false">
display: flex;
justify-content: space-between;
"
>
<u-line-progress
active-color="#2979ff"
:percent="courselist[2].percent"
style="width: 54%"
>
</u-line-progress> </u-line-progress>
<text <text class="font-default-color"
v-text="courselist[2].status" :class="{'font-active-color':courselist[2].percent}"
></text> v-text="courselist[2].status"></text>
</view> </view>
</view> </view>
</view> </view>
...@@ -182,91 +105,55 @@ ...@@ -182,91 +105,55 @@
</scroll-view> </scroll-view>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<scroll-view <scroll-view scroll-y style="height:100%;width:100%;" @scrolltolower="onreachBottom">
scroll-y
style="height: 100%; width: 100%"
@scrolltolower="onreachBottom"
>
<view class="lean"> <view class="lean">
<view class="top"> <view class="top">
<view class="title u-margin-top-10 u-margin-bottom-30">通用认证</view>
<view class="currency-class"> <view class="currency-class">
<text class="title">通用认证</text>
<view class="class1" @click="aaa"> <view class="class1" @click="aaa">
<image <image class="img" src="../../static/logo.png" mode=""></image>
class="img"
src="../../static/logo.png"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> 服务规范 </view> <view class="u-font-32 font-bold">
<view class=""> 服务规范
</view>
<view class="u-font-24">
通过本认证,是接单的前提条件 通过本认证,是接单的前提条件
</view> </view>
<view <view class="" style="display:flex;justify-content: space-between;">
class="" <text style="color: #a69999;">随机20题,及格20题</text>
style="
display: flex;
justify-content: space-between;
"
>
<text style="color: #a69999"
>随机20题,及格20题</text
>
<text>通过</text> <text>通过</text>
</view> </view>
</view> </view>
</view> </view>
<view class="class1" @click="aaa"> <view class="class1 u-margin-top-40" @click="aaa">
<image <image class="img" src="../../static/logo.png" mode=""></image>
class="img"
src="../../static/logo.png"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> 接单操作 </view> <view class="u-font-32 font-bold">
<view class=""> 接单操作
</view>
<view class="u-font-24">
快速认证,是否具备接单操作能力 快速认证,是否具备接单操作能力
</view> </view>
<view <view class="" style="display:flex;justify-content: space-between;">
class="" <text style="color: #a69999">随机20题,及格16题</text>
style="
display: flex;
justify-content: space-between;
"
>
<text style="color: #a69999"
>随机20题,及格16题</text
>
<text>未通过</text> <text>未通过</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="title u-margin-top-50 u-margin-bottom-30">技能认证</view>
<view class="currency-class"> <view class="currency-class">
<text class="title">技能认证</text>
<view class="class1" @click="aaa"> <view class="class1" @click="aaa">
<image <image class="img" src="../../static/logo.png" mode=""></image>
class="img"
src="../../static/logo.png"
mode=""
></image>
<view class="right"> <view class="right">
<view class=""> <view class="u-font-32 font-bold">
从0-1学习充电桩安装服务 从0-1学习充电桩安装服务
</view> </view>
<view class=""> <view class="u-font-24">
通过本认证后,可接充电桩业务单 通过本认证后,可接充电桩业务单
</view> </view>
<view <view class="" style="display:flex;justify-content: space-between;">
class="" <text style="color: #a69999;">随机30题,及格25题</text>
style="
display: flex;
justify-content: space-between;
"
>
<text style="color: #a69999"
>随机30题,及格25题</text
>
<text>未通过</text> <text>未通过</text>
</view> </view>
</view> </view>
...@@ -281,430 +168,453 @@ ...@@ -281,430 +168,453 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
msg: "赣南吴彦祖", msg: "赣南吴彦祖",
tabs: [ tabs: [{
{ name: "交付规范",
name: "交付规范", },
}, {
{ name: "培训通知",
name: "培训通知", },
}, {
{ name: "在线学习",
name: "在线学习", },
}, {
{ name: "考核认证",
name: "考核认证", },
],
current: 0,
swiperCurrent: 0,
params: {
start: 0,
}, },
], list: [],
current: 0, courselist: [{
swiperCurrent: 0, title: '服务规范',
params: { desc: '为用户提供更好服务,自己赚更多钱',
start: 0, percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 173
},
{
title: '接单操作',
desc: '快速学习,使用APP 接单、抢单',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 173
},
{
title: '从0-1学习充电桩安装服务',
desc: '让你全面了解充电桩市场及服务规范',
percent: 0,
status: '',
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 173
}
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中
course_id: "course_id_=173",
exam: null,
};
},
onLoad() {
// this.getList();
// this.getCourseList();
// this.getUserExamInfo();
},
computed: {
bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx@3x.png";
}, },
list: [],
courselist: [
{
title: "服务规范",
desc: "为用户提供更好服务,自己赚更多钱",
percent: 0,
status: "",
pic: process.uniEnv.qn_base_url + "guifan1@3x.png",
id: 173,
},
{
title: "接单操作",
desc: "快速学习,使用APP 接单、抢单",
percent: 0,
status: "",
pic: process.uniEnv.qn_base_url + "guifan2@3x.png",
id: 173,
},
{
title: "从0-1学习充电桩安装服务",
desc: "让你全面了解充电桩市场及服务规范",
percent: 0,
status: "",
pic: process.uniEnv.qn_base_url + "kecehng1@3x.png",
id: 173,
},
],
loadStatus: "loading", //加载样式:loadMore-加载前样式,loading-加载加载中样式,nomore-没有数据样式
isLoadMore: false, //是否加载中
course_id: "course_id_=173",
exam: null,
};
},
onLoad() {
// this.getList();
// this.getCourseList();
// this.getUserExamInfo();
},
computed: {
bannerImage() {
return process.uniEnv.qn_base_url + "banner-xx@3x.png";
}, },
}, methods: {
methods: { getList() {
getList() { this.$u.api
this.$u.api .getTrainingNoticeList(this.params)
.getTrainingNoticeList(this.params) .then((res) => {
.then((res) => { if (res.code == 200) {
if (res.code == 200) { if (res.data) {
if (res.data) { this.list = this.list.concat(res.data);
this.list = this.list.concat(res.data); if (res.data.length < 5) {
if (res.data.length < 5) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
//判断接口返回数据量小于请求数据量,则表示此为最后一页 this.isLoadMore = true;
this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
}
} else {
this.isLoadMore = true; this.isLoadMore = true;
this.loadStatus = "nomore"; this.loadStatus = "nomore";
} else {
this.isLoadMore = false;
} }
} else { } else {
this.isLoadMore = true; //接口请求失败的处理
this.loadStatus = "nomore"; uni.showToast({
title: res.message,
icon: "none",
});
this.isLoadMore = false;
if (this.params.start > 0) {
this.page -= 5;
}
} }
} else { })
//接口请求失败的处理 .catch((err) => {
uni.showToast({ uni.showToast({
title: res.message, title: err,
icon: "none", icon: "none",
}); });
this.isLoadMore = false; this.isLoadMore = false;
if (this.params.start > 0) { if (this.params.start > 0) {
this.page -= 5; this.page -= 5;
} }
}
})
.catch((err) => {
uni.showToast({
title: err,
icon: "none",
}); });
this.isLoadMore = false; },
if (this.params.start > 0) { getTypeName(percent) {
this.page -= 5; if (percent == 0) {
} return '未开始';
}); } else if (percent == '100') {
}, return '已完成';
getTypeName(percent) { } else {
if (percent == 0) { return '继续';
return "未开始"; }
} else if (percent == "100") { },
return "已完成"; //在线学习通用课程信息
} else { getCourseList() {
return "继续"; let courseLength = this.courselist.length;
} for (let i = 0; i < courseLength; i++) {
}, let param = {
//在线学习通用课程信息 course_id: this.courselist[i].id
getCourseList() { };
let courseLength = this.courselist.length; this.$u.api
for (let i = 0; i < courseLength; i++) { .CourseList(param)
let param = { .then((res) => {
course_id: this.courselist[i].id, if (res.code == 200) {
}; if (res.data) {
this.$u.api res.data.learnedInfo.learnPercent *= 100;
.CourseList(param) this.courselist[i].status = this.getTypeName(res.data.learnedInfo.learnPercent);
.then((res) => { this.courselist[i].percent = res.data.learnedInfo.learnPercent;
if (res.code == 200) { }
if (res.data) {
this.courselist[i].status = this.getTypeName(
res.data.learnedInfo.learnPercent
);
this.courselist[i].percent =
res.data.learnedInfo.learnPercent;
} }
} })
}) .catch((err) => {
.catch((err) => { uni.showToast({
uni.showToast({ title: err,
title: err, icon: "none",
icon: "none", });
}); });
}); }
} },
}, //tabs通知swiper切换
//tabs通知swiper切换 tabsChange(index) {
tabsChange(index) { this.swiperCurrent = index;
this.swiperCurrent = index; switch (index) {
switch (index) { case 1:
case 1: this.params.start = 0;
this.params.start = 0; this.list = [];
this.list = []; this.getList();
this.getList(); break;
break; case 2:
case 2: this.getCourseList();
this.getCourseList(); console.log('重新加载学习进度');
console.log("重新加载学习进度"); break;
break; case 3:
case 3: this.getUserExamInfo();
this.getUserExamInfo(); break;
break; }
} },
}, //swiper-item左右移动,通知tabs的滑块跟随移动
//swiper-item左右移动,通知tabs的滑块跟随移动 transition(e) {
transition(e) { let dx = e.detail.dx;
let dx = e.detail.dx; this.$refs.uTabs.setDx(dx);
this.$refs.uTabs.setDx(dx); },
}, animationfinish(e) {
animationfinish(e) { let current = e.detail.current;
let current = e.detail.current; this.$refs.uTabs.setFinishCurrent(current);
this.$refs.uTabs.setFinishCurrent(current); this.swiperCurrent = current;
this.swiperCurrent = current; this.current = current;
this.current = current; },
}, //跳转到assessment页面
//跳转到assessment页面 aaa() {
aaa() { var id = this.exam.id;
var id = this.exam.id; if (this.exam.examStatus == 0) {
if (this.exam.examStatus == 0) { console.log("这是个标识符", this.exam.id);
console.log("这是个标识符", this.exam.id);
wx.navigateTo({ wx.navigateTo({
url: "./answer?userExamId=" + id, url: "./answer?userExamId=" + id,
}); });
} else if (this.exam.examStatus == 1) { } else if (this.exam.examStatus == 1) {
wx.navigateTo({ wx.navigateTo({
url: "./result?userExamId=" + id, url: "./result?userExamId=" + id,
}); });
} else if (this.exam.examStatus == 2) { } else if (this.exam.examStatus == 2) {
wx.navigateTo({ wx.navigateTo({
url: "./assessment", url: "./assessment",
});
}
},
//跳转到课程介绍
ccc(id) {
uni.navigateTo({
url: "./curriculum?course_id=" + id,
}); });
} },
}, //跳转到
//跳转到课程介绍 bbb(e) {
ccc(id) { var news = {
uni.navigateTo({ body: e.body,
url: "./curriculum?course_id=" + id, id: e.id,
}); level: e.level,
}, title: e.title,
//跳转到 };
bbb(e) { // console.log(news)
var news = {
body: e.body,
id: e.id,
level: e.level,
title: e.title,
};
// console.log(news)
uni.navigateTo({ uni.navigateTo({
url: "./news-details", url: "./news-details",
}); });
setTimeout(() => { setTimeout(() => {
uni.$emit("news", news), console.log("发送数据"); uni.$emit("news", news), console.log("发送数据");
}, 500); }, 500);
console.log("跳转结束11111111"); console.log("跳转结束11111111");
}, },
//scroll-view到底部加载更多 //scroll-view到底部加载更多
onreachBottom() { onreachBottom() {
console.log("上拉触底函数"); console.log("上拉触底函数");
//上拉触底函数 //上拉触底函数
if (!this.isLoadMore) { if (!this.isLoadMore) {
this.isLoadMore = true; this.isLoadMore = true;
this.params.start += 5; this.params.start += 5;
if (this.loadStatus !== "nomore") { if (this.loadStatus !== "nomore") {
this.getList(); this.getList();
}
} }
} },
}, //跳转到拍照小程序首页
//跳转到拍照小程序首页 goToPrint() {
goToPrint() { console.log("111111");
console.log("111111"); uni.navigateToMiniProgram({
uni.navigateToMiniProgram({ appId: "wxd1d6eede324b0465",
appId: "wxd1d6eede324b0465", success(res) {
success(res) { //打开成功
//打开成功 console.log("success", res);
console.log("success", res); },
}, fail(err) {
fail(err) { console.log("err", err);
console.log("err", err); },
}, });
}); },
}, //考核认证,通用认证,考试通过or未通过查询接口请求
//考核认证,通用认证,考试通过or未通过查询接口请求 getUserExamInfo() {
getUserExamInfo() { uni.showLoading({
uni.showLoading({ title: "请稍候",
title: "请稍候", });
});
let that = this; let that = this;
uni.request({ let token = uni.getStorageSync('lifeData').vuex_token;
url: uni.request({
"http://192.168.1.22" + url: "http://192.168.1.22" +
"/wxh-worker-rest/rest/exam" + "/wxh-worker-rest/rest/exam" +
"/serviceRule/userExamInfo/" + "/serviceRule/userExamInfo/" +
that.vuex_token + token +
"?examId=" + "?examId=" +
2, 2,
method: "POST", method: "POST",
data: { data: {
//examId:this.examId, //examId:this.examId,
}, },
header: { header: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
}, },
success: (res) => { success: (res) => {
console.log(res.data); console.log(res.data);
uni.hideLoading(); uni.hideLoading();
if (!res.data) { if (!res.data) {
return;
}
if (res.data.code == 401 || res.data.code == 403) {
// uni.navigateTo({
// url: '/pages/login/wxlogin'
// })
// return
console.log("洪塘张学友");
}
if (res.data.code == 200) {
//examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.exam = res.data.data;
console.log(that.exam);
if (res.data.data.examStatus == 2) {
that.applyExam();
return; return;
} }
if (res.data.data.examStatus == 1) { if (res.data.code == 401 || res.data.code == 403) {
console.log("111111111111111111111111111"); // uni.navigateTo({
that.isComplete = true; // url: '/pages/login/wxlogin'
that.examScore = res.data.data.examScore; // })
that.postResult(); // return
return; console.log("洪塘张学友");
} }
if (res.data.data.examStatus == 0) { if (res.data.code == 200) {
that.userExamId = res.data.data.id; //examStatus 用户考试状态 0考试中 1考试完成 2未参与
that.getNext(); that.exam = res.data.data;
console.log(that.exam);
if (res.data.data.examStatus == 2) {
that.applyExam();
return;
}
if (res.data.data.examStatus == 1) {
console.log("111111111111111111111111111");
that.isComplete = true;
that.examScore = res.data.data.examScore;
that.postResult();
return;
}
if (res.data.data.examStatus == 0) {
that.userExamId = res.data.data.id;
that.getNext();
}
} else {
uni.showToast({
icon: "none",
title: res.data.message,
});
} }
} else { },
fail: (e) => {
uni.hideLoading();
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: res.data.message, title: "获取考试信息失败",
}); });
} },
}, });
fail: (e) => { },
uni.hideLoading();
uni.showToast({
icon: "none",
title: "获取考试信息失败",
});
},
});
}, },
}, };
};
</script> </script>
<style> <style>
.study { .study {
height: 100vh; height: 100vh;
background-color: #f4f5f7; background-color: #f4f5f7;
padding: 0rpx 30rpx 0 30rpx; padding: 0rpx 30rpx 0 30rpx;
} }
.title-view {
color: #333333;
font-weight: bold;
font-size: 40rpx;
}
.banner {
width: 690rpx;
height: 240rpx;
margin-top: 10rpx;
}
/* //交付规范 */
.standard {
width: 656rpx;
display: flex;
justify-content: space-between;
border-bottom: 1rpx solid #82848a;
padding: 0 34rpx;
margin: 72rpx auto;
}
/* //培训通知 */
.notice {
border: #808080 solid 2rpx;
width: 100%;
height: 400rpx;
margin-top: 36rpx;
overflow: hidden;
}
.n-head {
text-align: center;
margin: 32rpx 0;
}
.title-view { .news {}
color: #333333;
font-weight: bold;
font-size: 40rpx;
}
.banner { /* //在线学习 */
width: 690rpx; .currency-class {
height: 240rpx; width: 100%;
margin-top: 10rpx; /* height: 340rpx; */
} background: #ffffff;
padding: 30rpx;
/* margin-bottom: 11px; */
border-radius: 12rpx;
}
/* //交付规范 */ .title {
.standard { font-size: 32rpx;
width: 656rpx; font-weight: bold;
display: flex; font-family: PingFang-SC-Bold, PingFang-SC;
justify-content: space-between; }
border-bottom: 1rpx solid #82848a;
padding: 0 34rpx;
margin: 72rpx auto;
}
/* //培训通知 */ .class1 {
.notice { display: -webkit-box;
border: #808080 solid 2rpx; display: -webkit-flex;
width: 100%; display: flex;
height: 400rpx; -webkit-box-pack: justify;
margin-top: 36rpx; -webkit-justify-content: space-between;
overflow: hidden; justify-content: space-between;
} }
.n-head { .img {
text-align: center; width: 160rpx;
margin: 32rpx 0; height: 120rpx;
} /* display: block; */
/* margin-right: 0rpx; */
}
.news { .right {
} width: 434rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
/* //在线学习 */ .intro {
.currency-class { color: #9999a6;
width: 100%; }
background: #ffffff;
padding: 18rpx;
margin-bottom: 11px;
border-radius: 12rpx;
}
.title { .tab {
font-size: 32rpx; background: #fff;
font-weight: bold; height: 82rpx;
font-family: PingFang-SC-Bold, PingFang-SC; margin: 0 0;
} }
.class1 { .text {
display: flex; margin: 0 40rpx;
justify-content: space-between; line-height: 82rpx;
padding-top: 22rpx; color: #667eb5;
margin-top: 28rpx; }
border-top: 1rpx solid #808080;
}
.img { .content {
width: 201rpx; margin: 5px 0;
height: 201rpx; height: 485rpx;
display: block; background: #fff;
margin-right: 0rpx; }
}
.right { swiper {
width: 428rpx; height: 691rpx;
display: flex; }
flex-direction: column;
justify-content: space-between;
}
.intro { .line-percent {
color: #9999a6; display: flex;
} justify-content: space-between;
line-height: 24rpx;
font-size: 24rpx;
color: #999999;
}
.tab { .u-progress {
background: #fff; width: 280rpx !important;
height: 82rpx; height: 12rpx !important;
margin: 0 0; background-color: #ececec;
} }
.text { .font-bold {
margin: 0 40rpx; font-weight: bold;
line-height: 82rpx; }
color: #667eb5;
}
.content { .font-default-color {
margin: 5px 0; color: #999999;
height: 485rpx; }
background: #fff;
}
swiper { .font-active-color {
height: 691rpx; color: #2272FF;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<view> <view>
<view class="u-wrap" v-if="!takeStatus"> <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-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> <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"> <view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" <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">
:scroll-into-view="itemId"> <view v-for="(item,index) in list[tabIndex].items" :key="index" class="u-tab-item"
<view v-for="(item,index) in groupList" :key="index" class="u-tab-item" :class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)"> <text class="u-line-1">{{item.name}}</text>
<text class="u-line-1">{{item.groupName}}</text> </view>
</view> </scroll-view>
</scroll-view> <scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box" @scroll="rightScroll">
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box" <u-form :model="form" ref="uForm">
@scroll="rightScroll"> <template v-for="(groupItem, groupIndex) in (list.length>0?list[tabIndex].items:[])">
<view class="class-item" :key="groupIndex">
<u-form :model="form" ref="uForm"> <view class="title">{{groupItem.name}}</view>
<template v-for="(groupItem,groupIndex) in groupList"> <view class="class-bd">
<view class="class-item" :key="groupIndex"> <u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex"
<view class="title">{{groupItem.groupName}}</view> label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="class-bd"> <view class="label" v-if="typeToComponentType(item.fieldsType)!=='location'">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex" <image class="item-image" :src="mixingImage" v-if="item.required"></image>
label-position="top" :prop="item.fieldsName" :border-bottom="false"> {{item.fieldsTitle}}
<view class="label" v-if="item.fieldsType!=='location'"> </view>
<!-- <text class="required" v-if="item.required">*</text> --> <template v-if="item.fieldsType">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex"
{{item.fieldsTitle}} :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""' @value-change="fieldValueChange">
</view> </xh-input>
<template v-if="item.fieldsType"> <xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'"
<xh-input v-if="typeToComponentType(item.fieldsType)==='input'" :groupIndex="groupIndex" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
:itemIndex="itemIndex" :item="item" @value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-input> </xh-multi-input>
<xh-multi-input v-else-if="typeToComponentType(item.fieldsType)==='multiinput'" <xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-multi-input> </xh-radio>
<xh-radio v-else-if="typeToComponentType(item.fieldsType)==='radio'" <xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-radio> </xh-checkbox>
<xh-checkbox v-else-if="typeToComponentType(item.fieldsType)==='checkbox'" <xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-checkbox> </xh-select>
<xh-select v-else-if="typeToComponentType(item.fieldsType)==='select'" <xh-files v-else-if="typeToComponentType(item.fieldsType)==='file'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :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"
:files="files[itemIndex.toString()]" :files="files[itemIndex.toString()]"
@value-change="fieldValueChange" @getTakeStatus="getTakeStatus"> @value-change="fieldValueChange" @getTakeStatus="getTakeStatus">
</xh-files> </xh-files>
<xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'" <xh-location v-else-if="typeToComponentType(item.fieldsType)==='location'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-location> </xh-location>
<xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'" <xh-scan v-else-if="typeToComponentType(item.fieldsType)==='scan'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-scan> </xh-scan>
<xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'" <xh-picker v-else-if="typeToComponentType(item.fieldsType)==='picker'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
@value-change="fieldValueChange"> @value-change="fieldValueChange">
</xh-picker> </xh-picker>
<xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'" <xh-service-measure v-else-if="typeToComponentType(item.fieldsType)==='servicemeasure'"
:groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :orderId="orderId" :categoryId="categoryId"
@value-change="fieldValueChange"> :orderServiceType="orderServiceType" :specificationId="form['specificationId'] || 0" :value="form[item.fieldsName]"
</xh-time> @value-change="fieldValueChange">
</template> </xh-service-measure>
</u-form-item> <xh-time v-else-if="typeToComponentType(item.fieldsType)==='time'"
</view> :groupIndex="groupIndex" :itemIndex="itemIndex" :item="item" :value='form[item.fieldsName] || ""'
</view> @value-change="fieldValueChange">
</template> </xh-time>
</u-form> </template>
</scroll-view> </u-form-item>
</view> </view>
<view class="btn-wrap flex-xc"> </view>
<u-button class="btn-submit" @click="$u.debounce(nextStep, 500)" :custom-style="buttonStyle" </template>
type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'"> </u-form>
下一步 </scroll-view>
</u-button> </view>
</view> <view class="btn-wrap flex-xc">
</view> <u-button class="btn-submit" @click="nextStep" :custom-style="buttonStyle"
<take-photo v-else @close="closeTake"></take-photo> type="primary" shape="circle" :hover-class="submitStatus ? '' : 'none'">
</view> 下一步
</u-button>
</view>
</view>
<take-photo v-else @close="closeTake"></take-photo>
</view>
</template> </template>
<script> <script>
import classifyData from '@/common/classify.data.js'; import classifyData from '@/common/classify.data.js';
import XhInput from '@/components/createCom/XhInput.vue' import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from '@/components/createCom/XhMultiInput.vue' import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from '@/components/createCom/XhRadio.vue' import XhRadio from '@/components/createCom/XhRadio.vue'
import XhCheckbox from '@/components/createCom/XhCheckbox.vue' import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
import XhSelect from '@/components/createCom/XhSelect.vue' import XhSelect from '@/components/createCom/XhSelect.vue'
import XhFiles from '@/components/createCom/XhFiles.vue' import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from '@/components/createCom/XhLocation.vue' import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from '@/components/createCom/XhScan.vue' import XhScan from '@/components/createCom/XhScan.vue'
import XhPicker from '@/components/createCom/XhPicker.vue' import XhPicker from '@/components/createCom/XhPicker.vue'
import XhTime from '@/components/createCom/XhTime.vue' import XhTime from '@/components/createCom/XhTime.vue'
import takePhoto from '@/components/take/index.vue' import takePhoto from '@/components/take/index.vue'
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
// import XhRadio from '@/components/createCom/XhRadio.vue' // import XhRadio from '@/components/createCom/XhRadio.vue'
export default { export default {
data() { data() {
return { return {
list: [ orderId:0,
{ categoryId:0,
name: '基础信息' orderServiceType:'',
}, list: [],
{ tabIndex: 0,
name: '勘察信息' scrollTop: 0, //tab标题的滚动条位置
}, oldScrollTop: 0,
{ current: 0, // 预设当前项的值
name: '安装信息' menuHeight: 0, // 左边菜单的高度
} menuItemHeight: 0, // 左边菜单item的高度
], itemId: '', // 栏目右边scroll-view用于滚动的id
tabIndex: 1, groupList: classifyData, // 基本信息、安装 、勘察(其中一项表单数据)
scrollTop: 0, //tab标题的滚动条位置 menuItemPos: [],
oldScrollTop: 0, arr: [],
current: 0, // 预设当前项的值 scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
menuHeight: 0, // 左边菜单的高度 timer: null, // 定时器
menuItemHeight: 0, // 左边菜单item的高度 form: { // 一维表单
itemId: '', // 栏目右边scroll-view用于滚动的id },
groupList: classifyData, // 基本信息、安装 、勘察(其中一项表单数据) rules: {
menuItemPos: [], name: [{
arr: [], required: true,
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度 min: 10,
timer: null, // 定时器 message: '姓名不能为空',
form: { // 一维表单 // 可以单个或者同时写两个触发验证方式
name: 'name', trigger: ['change', 'blur'],
radio: '' }],
}, mobile: [{
rules: { required: true,
name: [{ min: 10,
required: true, message: '姓名不能为空',
min: 10, // 可以单个或者同时写两个触发验证方式
message: '姓名不能为空', trigger: ['change', 'blur'],
// 可以单个或者同时写两个触发验证方式 }, {
trigger: ['change', 'blur'], // 自定义验证函数,见上说明
}], validator: (rule, value, callback) => {
mobile: [{ // 上面有说,返回true表示校验通过,返回false表示不通过
required: true, // this.$u.test.mobile()就是返回true或者false的
min: 10, return this.$u.test.mobile(value);
message: '姓名不能为空', },
// 可以单个或者同时写两个触发验证方式 message: '手机号码不正确',
trigger: ['change', 'blur'], // 触发器可以同时用blur和change
}, { trigger: ['change', 'blur'],
// 自定义验证函数,见上说明 }]
validator: (rule, value, callback) => { },
// 上面有说,返回true表示校验通过,返回false表示不通过 submitBtnStatus: false,
// this.$u.test.mobile()就是返回true或者false的 takeStatus: false,
return this.$u.test.mobile(value); fileIndex: null,
}, files: []
message: '手机号码不正确', }
// 触发器可以同时用blur和change },
trigger: ['change', 'blur'], components: {
}] XhInput,
}, XhMultiInput,
submitBtnStatus: false, XhRadio,
takeStatus: false, XhCheckbox,
fileIndex: null, XhSelect,
files: [] XhFiles,
} XhLocation,
}, XhScan,
components: { XhPicker,
XhInput, XhTime,
XhMultiInput, XhServiceMeasure,
XhRadio, 'take-photo': takePhoto
XhCheckbox, },
XhSelect, created() {
XhFiles, // console.log(allComponents,'allComponents')
XhLocation, },
XhScan, onLoad(option) {
XhPicker, console.log(option)
XhTime, if (option) {
'take-photo': takePhoto this.orderId = option.orderId
}, this.categoryId = option.categoryId
created() { this.orderServiceType = option.orderServiceType
// console.log(allComponents,'allComponents') } else {
}, this.orderId = 9708719
onLoad() { this.categoryId = 88
this.orderServiceType = '安装'
}, }
onReady() { },
this.$refs.uForm.setRules(this.rules); onReady() {
// 导航栏滚动切换 this.$refs.uForm.setRules(this.rules);
this.getMenuItemTop() // 导航栏滚动切换
}, this.getMenuItemTop()
updated() { },
//console.log(this.form.name, 'form.name') updated() {
}, //console.log(this.form.name, 'form.name')
computed: { },
mixingImage() { computed: {
return process.uniEnv.qn_base_url + 'mixing.png' getCompleteData() {
}, let self = this
buttonStyle() { if(self.orderId){
return this.submitBtnStatus ? { self.$u.api.getCompleteConfigAndData(self.orderId).then((res) => {
'color': '#FFFFFF', if (res.code == 200) {
'background-color': '#2272FF;', self.list = res.data.config
'width': '600rpx', } else {
'height': '104rpx', console.log(res.message, "获取订单详情失败!");
'font-size': '32rpx', }
'font-weight': 'bold' });
} : { }
'color': '#FFFFFF', },
'background-color': '#D1D4D4;', mixingImage() {
'width': '600rpx', return process.uniEnv.qn_base_url + 'mixing.png'
'height': '104rpx', },
'font-size': '32rpx', buttonStyle() {
'font-weight': 'bold' return this.submitBtnStatus ? {
} 'color': '#FFFFFF',
} 'background-color': '#2272FF;',
}, 'width': '600rpx',
methods: { 'height': '104rpx',
getTakeStatus(event) { 'font-size': '32rpx',
this.takeStatus = event.status 'font-weight': 'bold'
this.fileIndex = event.index.toString() } : {
if(!this.files[event.index] || this.files[event.index].length < 1) this.files[event.index] = [] 'color': '#FFFFFF',
}, 'background-color': '#D1D4D4;',
closeTake(images) { 'width': '600rpx',
this.takeStatus = false 'height': '104rpx',
//const newFile = this.files[this.fileIndex].concat(images) 'font-size': '32rpx',
this.$set(this.files, this.fileIndex, images) 'font-weight': 'bold'
}, }
// 字段的值更新 }
fieldValueChange(data) { },
// data.groupIndex data.itemIndex值下标 data.value //值 methods: {
console.log(data, 'data') getTakeStatus(event) {
const groupItem = this.groupList[data.groupIndex] this.takeStatus = event.status
let innerItem this.fileIndex = event.index.toString()
if (groupItem.item) { if(!this.files[event.index] || this.files[event.index].length < 1) this.files[event.index] = []
innerItem = groupItem.item[data.itemIndex] },
} tabsChange(index){
console.log(data.value,'data.value',innerItem, 'innerItem') this.tabIndex = index
if(innerItem.fieldsType ==='multiInput'){ this.arr = []
// 多个输入框的值触发 this.scrollRightTop = 0;
let key = Object.keys(data.value)[0] this.current = 0;
this.form[key] = data.value[key] this.leftMenuStatus(0)
}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;
this.$nextTick(function() { this.$nextTick(function() {
this.scrollRightTop = this.arr[index]; this.getMenuItemTop()
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);
}
})
}) })
}, },
// 设置左边菜单的滚动状态 closeTake(images) {
async leftMenuStatus(index) { this.takeStatus = false
this.current = index; //const newFile = this.files[this.fileIndex].concat(images)
// 如果为0,意味着尚未初始化 this.$set(this.files, this.fileIndex, images)
if (this.menuHeight == 0 || this.menuItemHeight == 0) { },
await this.getElRect('menu-scroll-view', 'menuHeight'); // 字段的值更新
await this.getElRect('u-tab-item', 'menuItemHeight'); fieldValueChange(data) {
} const groupItem = this.list[this.tabIndex].items[data.groupIndex]
// 将菜单活动item垂直居中 let innerItem
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2; if (groupItem.items) {
}, innerItem = groupItem.items[data.itemIndex]
// 获取右边菜单每个item到顶部的距离 }
getMenuItemTop() { if(innerItem.fieldsType ==='multiInput'){
new Promise(resolve => { // 多个输入框的值触发
let selectorQuery = uni.createSelectorQuery(); let key = Object.keys(data.value)[0]
selectorQuery.selectAll('.class-item').boundingClientRect((rects) => { this.form[key] = data.value[key]
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行 }else{
if (!rects.length) { this.$set(this.form,innerItem.fieldsName,data.value)
setTimeout(() => { }
this.getMenuItemTop(); console.log(this.form, 'this.form')
}, 10); },
return; nextStep() {
} if (this.tabIndex < this.list.length) {
rects.forEach((rect) => { this.tabIndex++
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况) this.arr = []
this.arr.push(rect.top - rects[0].top); this.$nextTick(function() {
resolve(); this.getMenuItemTop()
}) })
}).exec() }
}) },
}, 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) { async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop; this.oldScrollTop = e.detail.scrollTop;
if (this.arr.length == 0) { if (this.arr.length == 0) {
await this.getMenuItemTop(); await this.getMenuItemTop();
} }
if (this.timer) return; if (this.timer) return;
if (!this.menuHeight) { if (!this.menuHeight) {
await this.getElRect('menu-scroll-view', 'menuHeight'); await this.getElRect('menu-scroll-view', 'menuHeight');
} }
this.timer = setTimeout(() => { // 节流 this.timer = setTimeout(() => { // 节流
this.timer = null; this.timer = null;
// scrollHeight为右边菜单垂直中点位置 // scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop + this.menuHeight / 2; let scrollHeight = e.detail.scrollTop + this.menuHeight / 2;
for (let i = 0; i < this.arr.length; i++) { for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i]; let height1 = this.arr[i];
let height2 = this.arr[i + 1]; let height2 = this.arr[i + 1];
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可 // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) { if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
this.leftMenuStatus(i); this.leftMenuStatus(i);
return; return;
} }
} }
}, 10) }, 10)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// ---------------------------- 表单样式begin ---------------------------- // ---------------------------- 表单样式begin ----------------------------
/deep/ .u-form-item { /deep/ .u-form-item {
.u-form-item__message { .u-form-item__message {
padding-left: 0 !important; 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 { .required {
vertical-align: top; padding-right: 10rpx;
} font-size: 28rpx;
} line-height: 40rpx;
color: #fa3534;
}
.class-item { .item-image {
padding: 50rpx; width: 24rpx;
.title { height: 24rpx;
font-weight: bold; margin-right: 10rpx;
font-size: 32rpx; }
line-height: 32rpx; }
color: #333;
}
.label {
color: #333;
font-size: 28rpx;
line-height: 40rpx;
}
.required { // ---------------------------- 表单样式end ----------------------------
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
// ---------------------------- 表单样式end ----------------------------
.u-wrap {
height: calc(100vh);
/* #ifdef H5 */
height: calc(100vh - var(--window-top));
/* #endif */
display: flex;
flex-direction: column;
}
.u-wrap { .u-search-box {
height: calc(100vh); padding: 18rpx 30rpx;
/* #ifdef H5 */ }
height: calc(100vh - var(--window-top));
/* #endif */
display: flex;
flex-direction: column;
}
.u-search-box { .u-menu-wrap {
padding: 18rpx 30rpx; flex: 1;
} display: flex;
overflow: hidden;
}
.u-menu-wrap { .u-search-inner {
flex: 1; background-color: rgb(234, 234, 234);
display: flex; border-radius: 100rpx;
overflow: hidden; display: flex;
} align-items: center;
padding: 10rpx 16rpx;
}
.u-search-inner { .u-search-text {
background-color: rgb(234, 234, 234); font-size: 26rpx;
border-radius: 100rpx; color: $u-tips-color;
display: flex; margin-left: 10rpx;
align-items: center; }
padding: 10rpx 16rpx;
}
.u-search-text { .u-tab-view {
font-size: 26rpx; width: 200rpx;
color: $u-tips-color; height: 100%;
margin-left: 10rpx; }
}
.u-tab-view { .u-tab-item {
width: 200rpx; height: 110rpx;
height: 100%; 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 { .u-tab-item-active {
height: 110rpx; position: relative;
background: #f6f6f6; color: #2272FF;
box-sizing: border-box; font-size: 30rpx;
display: flex; font-weight: 600;
align-items: center; background: #fff;
justify-content: center; }
font-size: 26rpx;
color: #444;
font-weight: 400;
line-height: 1;
}
.u-tab-item-active { // .u-tab-item-active::before {
position: relative; // content: "";
color: #2272FF; // position: absolute;
font-size: 30rpx; // border-left: 4px solid $u-type-primary;
font-weight: 600; // height: 32rpx;
background: #fff; // left: 0;
} // top: 39rpx;
// }
// .u-tab-item-active::before { .u-tab-view {
// content: ""; height: 100%;
// position: absolute; }
// border-left: 4px solid $u-type-primary;
// height: 32rpx;
// left: 0;
// top: 39rpx;
// }
.u-tab-view { .right-box {
height: 100%; background-color: rgb(250, 250, 250);
} }
.right-box { .page-view {
background-color: rgb(250, 250, 250); padding: 16rpx;
} }
.page-view { .class-item {
padding: 16rpx; margin-bottom: 30rpx;
} background-color: #fff;
padding: 16rpx;
border-radius: 8rpx;
}
.class-item { .class-item:last-child {
margin-bottom: 30rpx; min-height: 100vh;
background-color: #fff; }
padding: 16rpx;
border-radius: 8rpx;
}
.class-item:last-child { .item-title {
min-height: 100vh; font-size: 26rpx;
} color: $u-main-color;
font-weight: bold;
}
.item-title { .item-menu-name {
font-size: 26rpx; font-weight: normal;
color: $u-main-color; font-size: 24rpx;
font-weight: bold; color: $u-main-color;
} }
.item-menu-name { .item-container {
font-weight: normal; display: flex;
font-size: 24rpx; flex-wrap: wrap;
color: $u-main-color; }
}
.item-container { .thumb-box {
display: flex; width: 33.333333%;
flex-wrap: wrap; display: flex;
} align-items: center;
justify-content: center;
flex-direction: column;
margin-top: 20rpx;
}
.thumb-box { .item-menu-image {
width: 33.333333%; width: 120rpx;
display: flex; height: 120rpx;
align-items: center; }
justify-content: center;
flex-direction: column;
margin-top: 20rpx;
}
.item-menu-image { /*提交按钮*/
width: 120rpx; .btn-wrap {
height: 120rpx; width: 100%;
} padding: 20rpx 0 40rpx 0;
}
/*提交按钮*/
.btn-wrap {
width: 100%;
padding: 20rpx 0 40rpx 0;
}
</style> </style>
...@@ -223,7 +223,6 @@ ...@@ -223,7 +223,6 @@
} else { } else {
// 异常处理 // 异常处理
} }
this.orderId = '8371315'
this.loadOrderDetail() this.loadOrderDetail()
this.loadOrderRecord() this.loadOrderRecord()
this.getLocation() this.getLocation()
...@@ -534,7 +533,9 @@ ...@@ -534,7 +533,9 @@
filish(){ filish(){
// 去完工 // 去完工
uni.navigateTo({ 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
}) })
}, },
rejectOrder() { // 拒单 rejectOrder() { // 拒单
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</template> </template>
<script> <script>
let now = Date.now() let now = new Date(new Date().toLocaleDateString()).getTime()
import appointTime from '@/components/appoint/appoint-time.vue' import appointTime from '@/components/appoint/appoint-time.vue'
export default { export default {
data() { data() {
...@@ -132,7 +132,8 @@ ...@@ -132,7 +132,8 @@
nextTraceDatetime: '', // 下次跟踪时间 nextTraceDatetime: '', // 下次跟踪时间
remark: '', // 备注 remark: '', // 备注
}, },
appointTitle: "预约时间" appointTitle: "预约时间",
num: 0,
}; };
}, },
components:{ components:{
...@@ -162,7 +163,6 @@ ...@@ -162,7 +163,6 @@
}, },
}, },
async onLoad(e) { async onLoad(e) {
// this.$u.vuex('vuex_token', 'RTOKEN7493e6defc2f1a77782f105dc297a9366763fec5');
this.orderId = 1 this.orderId = 1
this.categoryId = 88 this.categoryId = 88
if(e) { if(e) {
...@@ -173,8 +173,6 @@ ...@@ -173,8 +173,6 @@
title: "数据加载中", title: "数据加载中",
mask: true mask: true
}) })
this.loadCalendar()
this.loadTimerange()
await this.initPageData() await this.initPageData()
}, },
methods: { methods: {
...@@ -182,7 +180,8 @@ ...@@ -182,7 +180,8 @@
async initPageData() { async initPageData() {
let self = this let self = this
let params = {categoryId: self.categoryId} let params = {categoryId: self.categoryId}
let res = await self.$u.api.feedbackConfig(params) let pse = await Promise.all([self.$u.api.feedbackConfig(params), self.loadCalendar(), self.loadTimerange()])
let res = pse[0]
if(res && res.code == 200) { if(res && res.code == 200) {
self.config = res.data self.config = res.data
self.initParams() self.initParams()
...@@ -219,7 +218,7 @@ ...@@ -219,7 +218,7 @@
self.appointTitle = '预约时间' self.appointTitle = '预约时间'
if(self.dateList && self.timeList) { if(self.dateList && self.timeList) {
self.timeList.map((item, index) => { self.timeList.map((item, index) => {
if(data.item.timeRange.indexOf(item.pkey) > -1) { if(self.dateList.indexOf(item.pkey) > -1) {
item.disabled = true item.disabled = true
} else { } else {
item.disabled = false item.disabled = false
...@@ -241,7 +240,7 @@ ...@@ -241,7 +240,7 @@
async loadCalendar() { async loadCalendar() {
let self = this let self = this
let params = { let params = {
num: 1 num: this.num
} }
let res = await this.$u.api.workerCalendar(params) let res = await this.$u.api.workerCalendar(params)
if(res && res.code == 200) { if(res && res.code == 200) {
...@@ -283,25 +282,11 @@ ...@@ -283,25 +282,11 @@
if (data && data.time) { if (data && data.time) {
let num = data.num let num = data.num
let time = data.time let time = data.time
this.num = num
if (num == 0) { if (num == 0) {
this.dateList = [ this.loadCalendar()
{day: time, timeRange: []},
{day: time + (1*86400000), timeRange: []},
{day: time + (2*86400000), timeRange: []},
{day: time + (3*86400000), timeRange: []},
{day: time + (4*86400000), timeRange: []},
{day: time + (5*86400000), timeRange: []},
{day: time + (6*86400000), timeRange: []},
]
} else { } else {
this.dateList = [ this.loadCalendar()
{day: time, timeRange: []},
{day: time + (1*86400000), timeRange: []},
{day: time + (2*86400000), timeRange: []},
{day: time + (3*86400000), timeRange: []},
{day: time + (4*86400000), timeRange: []},
{day: time + (5*86400000), timeRange: []},
]
} }
} }
......
<template> <template>
<TabBarPage title="订单" :fixed="true"> <TabBarPage title="订单" :fixed="true">
<!-- <view class="wrap"> --> <!-- <view class="wrap"> -->
<view class="tools-box"> <view class="tools-box">
<view class="search-sub"> <view class="search-sub">
<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white" <u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72" inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72"
bold> bold>
</u-subsection> </u-subsection>
</view> </view>
<view class="search-btn" @click="handleClickSearch"> <view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image> <image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text> <text class="search-btn-text">搜订单</text>
</view> </view>
</view> </view>
<view class="u-tabs-box" v-show="curNow == 0"> <view class="u-tabs-box" v-show="curNow == 0">
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" <u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4"
bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change" bar-width="44" :offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs> :is-scroll="false" font-size="28" bold></u-tabs>
</view> </view>
<view class="tab-view"> <view class="tab-view">
<!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> --> <!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh" refresher-background="#F4F5F7" @refresherpulling="triggered = true" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @refresherabort="onAbort"> @refresherrestore="onRestore" @refresherabort="onAbort">
<NoOrder v-if="noMore" customStyle="margin-top: 100rpx;background-color: #F4F5F7" /> <NoOrder v-if="noMore" customStyle="margin-top: 100rpx;background-color: #F4F5F7" />
<template v-else> <template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId"> <view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)" <OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick(item)"
@action="handleAction(item)"> </OrderCell> @action="handleAction(item)"> </OrderCell>
</view> </view>
<u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</template> </template>
</scroll-view> </scroll-view>
<!-- </swiper-item> --> <!-- </swiper-item> -->
</view> </view>
<!-- </view> --> <!-- </view> -->
<PopView title="aaaa" message="bbbb" :visible="visibale" /> <PopView title="aaaa" message="bbbb" :visible="visibale" />
</TabBarPage> </TabBarPage>
</template> </template>
<script> <script>
import TabBarPage from "@/components/tabBarList/index.vue" import TabBarPage from "@/components/tabBarList/index.vue"
import OrderCell from "@/components/order/index.vue" import OrderCell from "@/components/order/index.vue"
import NoOrder from "@/components/order/noOrder.vue" import NoOrder from "@/components/order/noOrder.vue"
export default { export default {
components: { components: {
TabBarPage, TabBarPage,
OrderCell, OrderCell,
NoOrder NoOrder
}, },
data() { data() {
return { return {
visibale: false, visibale: false,
showSview: true, showSview: true,
curNow: 0, curNow: 0,
pageNumber: 0, pageNumber: 0,
pageSize: 100, pageSize: 100,
orderList: [], orderList: [],
list: [{ list: [{
name: '待预约', name: '待预约',
total: 0, total: 0,
}, },
{ {
name: '待签到', name: '待签到',
total: 0, total: 0,
}, },
{ {
name: '待完工', name: '待完工',
total: 0, total: 0,
}, },
{ {
name: '审核中', name: '审核中',
total: 0, total: 0,
}, },
{ {
name: '异常单', name: '异常单',
total: 0, total: 0,
} }
], ],
current: 0, current: 0,
loadStatus: 'loading', loadStatus: 'loading',
dataValue: [], dataValue: [],
loaded: false, loaded: false,
triggered: false, triggered: false,
_freshing: false, _freshing: false,
}; };
}, },
onLoad() { onLoad() {
this._freshing = false; this._freshing = false;
this.getLocation(); this.getLocation();
// this.getOrderCount(); // this.getOrderCount();
this.getOrderList(0); this.getOrderList(0);
}, },
onShow() { onShow() {
this.getOrderCount() this.getOrderCount()
}, },
computed: { computed: {
subList() { subList() {
return ['待受理', '已完工'] return ['待受理', '已完工']
}, },
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工' // 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() { orderType() {
return this.indexStatus[this.currentIndex] return this.indexStatus[this.currentIndex]
}, },
currentIndex() { currentIndex() {
return this.curNow == 0 ? this.current : 5 return this.curNow == 0 ? this.current : 5
}, },
sousuoImage() { sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png' return process.uniEnv.qn_base_url + 'sousuo.png'
}, },
types() { types() {
return { return {
'waitAppointment': 0, // 待预约、 'waitAppointment': 0, // 待预约、
'waitCheckIn': 1, // 待签到、 'waitCheckIn': 1, // 待签到、
'waitFinish': 2, // 待完工、 'waitFinish': 2, // 待完工、
'audit': 3, // 审核中、 'audit': 3, // 审核中、
'exception': 4, // 异常单、 'exception': 4, // 异常单、
'finish': 5, //已完工 'finish': 5, //已完工
} }
}, },
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish //waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() { indexStatus() {
return { return {
0: 'waitAppointment', 0: 'waitAppointment',
1: 'waitCheckIn', 1: 'waitCheckIn',
2: 'waitFinish', 2: 'waitFinish',
3: 'audit', 3: 'audit',
4: 'exception', 4: 'exception',
5: 'finish' 5: 'finish'
} }
}, },
noMore() { noMore() {
console.log('nomore:', this.orderList.length == 0 && this.pageNumber != 0) console.log('nomore:', this.orderList.length == 0 && this.pageNumber != 0)
return this.orderList.length == 0 && this.loaded return this.orderList.length == 0 && this.loaded
} }
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
this.pageNumber = 0 this.pageNumber = 0
this.orderList = [] this.orderList = []
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(this.currentIndex) this.getOrderList(this.currentIndex)
}, },
// tab栏切换 // tab栏切换
change(index) { change(index) {
this.current = index; this.current = index;
this.pageNumber = 0 this.pageNumber = 0
this.orderList = [] this.orderList = []
this.loadStatus = 'loading' this.loadStatus = 'loading'
this.getOrderList(index); this.getOrderList(index);
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
*/ */
getLocation() { getLocation() {
let self = this let self = this
const dataValue = this.dataValue || [] const dataValue = this.dataValue || []
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: function(res) { success: function(res) {
dataValue.push(res.longitude) dataValue.push(res.longitude)
dataValue.push(res.latitude) dataValue.push(res.latitude)
self.dataValue = dataValue self.dataValue = dataValue
}, },
fail(err) { fail(err) {
} }
}); });
}, },
reachBottom(e) { reachBottom(e) {
if (this.loadStatus != 'loadmore') return if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading' this.loadStatus == 'loading'
this.getOrderList(this.currentIndex) this.getOrderList(this.currentIndex)
}, },
// 页面数据 // 页面数据
getOrderList(index) { getOrderList(index) {
// 状态处理 // 状态处理
this.pageNumber += 1 this.pageNumber += 1
this.loaded = false this.loaded = false
var param = { var param = {
pageNumber: this.pageNumber, pageNumber: this.pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize,
keyword: '', keyword: '',
type: this.indexStatus[index] type: this.indexStatus[index]
} }
var self = this; var self = this;
self.$u.api.listOrder(param).then((res) => { self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("getOrderList", res.data) // 后台需要返回type,防止数据返回延迟期间点击了其他的tab
/*↓↓↓↓↓↓↓↓↓↓测试数据↓↓↓↓↓↓↓↓↓↓*/ if (res.data.type != self.orderType) return
res.data.type = self.orderType self.triggered = false;
if (res.data.list) { self._freshing = false;
if (res.data.list.length == 0 && res.data.total > 0) { if (res.data.list) {
res.data.total = 15 self.orderList.push(...res.data.list)
res.data.list = [{ if (self.list[self.types[res.data.type]]) {
orderServiceType: '安装', // 服务类型:安装、维修 self.list[self.types[res.data.type]].total = res.data.total
categoryName: '充电桩', // 品类:充电桩 }
orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池 self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
orderNumber: 'OR2021041809827', // 工单编号 }
contactName: '郭小清', // 客户信息 } else {
contactPhone: '13631612077', // 联系方式 console.log(res.message, "获取订单数量失败!");
contactAddress: '湾街道荔枝花园D座125号', // 详细地址 }
contactAddressLatitud: '116.3896', // 联系人地址经度 this.loaded = true
contactAddressLongitud: '39.91917', // 联系人地址纬度 });
orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间 },
currentWillOverTime: 10000, // 剩余时间
currentOverTime: 0, // 超过时间 // 获取订单数量
auditDatetime: '2021.04.19 12:45:09', // 审核时间 getOrderCount() {
submissionTime: '2021.04.19 16:24:48', // 提交时间 var self = this; // 加载订单列表
auditResults: {}, // 审核结果 self.$u.api.listOrderCount().then((res) => {
orderBusinessType: 'R', // 业务类型 R 为抢单 if (res.code == 200) {
orderId: '1100000216' console.log("===", res.data)
}] if (res.data) {
res.data.list = [...res.data.list, ...res.data.list, ...res.data.list, ...res.data var count = 0
.list, self.list.forEach(item => {
...res.data.list, ...res.data.list, ...res.data.list, ...res.data.list, ... if (item.name === '待预约') {
res item.count = res.data.toAppointmentCount
.data.list, ...res.data.list } else if (item.name === '待签到') {
] item.count = res.data.toCheckinCount
} } else if (item.name === '待完工') {
} item.count = res.data.toFinishCount
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/ } else if (item.name === '待审核') {
item.count = res.data.reviewingCount
// 后台需要返回type,防止数据返回延迟期间点击了其他的tab } else if (item.name === '异常单') {
if (res.data.type != self.orderType) return item.count = res.data.exceptionCount
self.triggered = false; }
self._freshing = false; })
if (res.data.list) { var count = 0
self.orderList.push(...res.data.list) for (var i in res.data) {
if (self.list[self.types[res.data.type]]) { count += res.data[i]
self.list[self.types[res.data.type]].total = res.data.total }
} // 修改tab总数
self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore' uni.setTabBarBadge({
} index: 1,
} else { text: String(count)
console.log(res.message, "获取订单数量失败!"); })
} }
this.loaded = true } else {
}); console.log(res.message, "获取订单数量失败!");
}
}, });
},
// 获取订单数量 viewOderItem(orderId) { // 跳转工单详情页面
getOrderCount() { uni.navigateTo({
var self = this; // 加载订单列表 url: 'pages/order/detail?id=' + orderId
self.$u.api.listOrderCount().then((res) => { })
if (res.code == 200) { },
console.log("===", res.data) handleClick(item) {
if (res.data) { console.log('click cell')
var count = 0 this.viewOderItem(item.orderId)
self.list.forEach(item => { },
if (item.name === '待预约') { handleAction(item) {
item.count = res.data.toAppointmentCount console.log('click button')
} else if (item.name === '待签到') { this.viewOderItem(item.orderId)
item.count = res.data.toCheckinCount },
} else if (item.name === '待完工') { handleClickSearch() {
item.count = res.data.toFinishCount uni.navigateTo({
} else if (item.name === '待审核') { url: 'pages/order/search'
item.count = res.data.reviewingCount })
} else if (item.name === '异常单') { },
item.count = res.data.exceptionCount onPulling(e) {
} console.log("onpulling", e);
}) },
var count = 0 onRefresh() {
for (var i in res.data) { if (this._freshing) return;
count += res.data[i] this._freshing = true;
} this.pageNumber = 0
// 修改tab总数 this.orderList = []
uni.setTabBarBadge({ this.loadStatus = 'loading'
index: 1, this.getOrderCount();
text: String(count) this.getOrderList(this.currentIndex);
}) },
} onRestore() {
} else { this.triggered = 'restore'; // 需要重置
console.log(res.message, "获取订单数量失败!"); console.log("onRestore");
} },
}); onAbort() {
}, console.log("onAbort");
viewOderItem(orderId) { // 跳转工单详情页面 }
uni.navigateTo({ }
url: 'pages/order/detail?id=' + orderId };
}) </script>
},
handleClick(item) { <style>
console.log('click cell') /* #ifndef H5 */
this.viewOderItem(item.orderId) page {
}, height: 100%;
handleAction(item) { background-color: #f2f2f2;
console.log('click button') }
this.viewOderItem(item.orderId)
}, /* #endif */
handleClickSearch() { </style>
uni.navigateTo({
url: 'pages/order/search' <style lang="scss" scoped>
}) .u-tabs-box {
}, margin-bottom: 30rpx;
onPulling(e) { }
console.log("onpulling", e);
}, .order {
onRefresh() { // width: 710rpx;
if (this._freshing) return; // background-color: #ffffff;
this._freshing = true; // margin: 20rpx auto;
this.pageNumber = 0 // border-radius: 20rpx;
this.orderList = [] // box-sizing: border-box;
this.loadStatus = 'loading' // padding: 20rpx;
this.getOrderCount(); // font-size: 28rpx;
this.getOrderList(this.currentIndex);
}, .top {
onRestore() { display: flex;
this.triggered = 'restore'; // 需要重置 justify-content: space-between;
console.log("onRestore"); align-items: center;
},
onAbort() { .left {
console.log("onAbort"); display: flex;
} align-items: center;
}
}; .tag {
</script> text-align: center;
width: 84rpx;
<style> height: 40rpx;
/* #ifndef H5 */ background: linear-gradient(270deg, #47ABFF 0%, #2272FF 100%);
page { border-radius: 8rpx;
height: 100%; font-size: 22rpx;
background-color: #f2f2f2; font-weight: 500;
} color: #FFFFFF;
line-height: 40rpx;
/* #endif */ }
</style>
.store {
<style lang="scss" scoped> margin: 0 10rpx;
.u-tabs-box { font-size: 36rpx;
margin-bottom: 30rpx; font-weight: bold;
} color: #333333;
line-height: 36px;
.order { }
// width: 710rpx; }
// background-color: #ffffff;
// margin: 20rpx auto; .right {
// border-radius: 20rpx; height: 40rpx;
// box-sizing: border-box; background: #F4F5F7;
// padding: 20rpx; border-radius: 22rpx;
// font-size: 28rpx; padding: 8rpx 16rpx 8rpx 16rpx;
font-size: 22rpx;
.top { line-height: 24rpx;
display: flex; font-weight: 400;
justify-content: space-between; color: #333333;
align-items: center; }
}
.left {
display: flex; .item {
align-items: center; display: flex;
flex-direction: column;
.tag { margin: 20rpx 0 0;
text-align: center;
width: 84rpx; .content {
height: 40rpx; .title {
background: linear-gradient(270deg, #47ABFF 0%, #2272FF 100%); font-size: 26rpx;
border-radius: 8rpx; font-weight: 400;
font-size: 22rpx; color: #333333;
font-weight: 500; line-height: 52rpx;
color: #FFFFFF; }
line-height: 40rpx; }
}
.address {
.store { display: flex;
margin: 0 10rpx; justify-content: space-between;
font-size: 36rpx; align-items: center;
font-weight: bold; font-size: 24rpx;
color: #333333; font-weight: 400;
line-height: 36px; color: #333333;
} line-height: 52rpx;
}
.left {}
.right {
height: 40rpx; .right {}
background: #F4F5F7; }
border-radius: 22rpx; }
padding: 8rpx 16rpx 8rpx 16rpx;
font-size: 22rpx; .total {
line-height: 24rpx; margin-top: 20rpx;
font-weight: 400; text-align: right;
color: #333333; font-size: 24rpx;
}
} .total-price {
font-size: 32rpx;
.item { }
display: flex; }
flex-direction: column;
margin: 20rpx 0 0; .bottom {
display: flex;
.content { margin-top: 30rpx;
.title { padding: 0 10rpx;
font-size: 26rpx; justify-content: space-between;
font-weight: 400; align-items: center;
color: #333333;
line-height: 52rpx; .left {
} display: flex;
} align-items: center;
justify-content: space-between;
.address {
display: flex; .tag {
justify-content: space-between; text-align: center;
align-items: center; width: 54rpx;
font-size: 24rpx; height: 54rpx;
font-weight: 400; background: #FF930D;
color: #333333; font-size: 26rpx;
line-height: 52rpx; font-weight: 500;
color: #FFFFFF;
.left {} line-height: 54rpx;
border-radius: 50%;
.right {} margin-right: 20rpx;
} }
} }
.total { .right-btn {
margin-top: 20rpx; text-align: center;
text-align: right; width: 200rpx;
font-size: 24rpx; height: 80rpx;
background: #2272FF;
.total-price { border-radius: 40rpx;
font-size: 32rpx; font-size: 32rpx;
} font-weight: 600;
} color: #FFFFFF;
line-height: 80rpx;
.bottom { font-family: PingFangSC-Semibold, PingFang SC;
display: flex; }
margin-top: 30rpx; }
padding: 0 10rpx; }
justify-content: space-between;
align-items: center; .centre {
text-align: center;
.left { margin: 200rpx auto;
display: flex; font-size: 32rpx;
align-items: center;
justify-content: space-between; image {
width: 164rpx;
.tag { height: 164rpx;
text-align: center; border-radius: 50%;
width: 54rpx; margin-bottom: 20rpx;
height: 54rpx; }
background: #FF930D;
font-size: 26rpx; .tips {
font-weight: 500; font-size: 24rpx;
color: #FFFFFF; color: #999999;
line-height: 54rpx; margin-top: 20rpx;
border-radius: 50%; }
margin-right: 20rpx;
} .btn {
} margin: 80rpx auto;
width: 200rpx;
.right-btn { border-radius: 32rpx;
text-align: center; line-height: 64rpx;
width: 200rpx; color: #ffffff;
height: 80rpx; font-size: 26rpx;
background: #2272FF; background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
border-radius: 40rpx; }
font-size: 32rpx; }
font-weight: 600;
color: #FFFFFF; .wrap {
line-height: 80rpx; display: flex;
font-family: PingFangSC-Semibold, PingFang SC; flex-direction: column;
} height: calc(100vh - var(--window-top));
} width: 100%;
} }
.centre { .tab-view {
text-align: center; height: 100%;
margin: 200rpx auto; overflow: auto;
font-size: 32rpx; padding-bottom: 20rpx;
}
image {
width: 164rpx; // .swiper-box {
height: 164rpx; // flex: 1;
border-radius: 50%; // }
margin-bottom: 20rpx;
} // .swiper-item {
// height: 100%;
.tips { // .page-box {
font-size: 24rpx; // padding-bottom: 20rpx;
color: #999999; // }
margin-top: 20rpx; // }
}
.tools-box {
.btn { display: flex;
margin: 80rpx auto; flex-direction: row;
width: 200rpx; justify-content: space-between;
border-radius: 32rpx; padding-bottom: 20rpx;
line-height: 64rpx;
color: #ffffff; .search-sub {
font-size: 26rpx; height: 72rpx;
background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%); width: 320rpx;
} }
}
.search-btn {
.wrap { height: 72rpx;
display: flex; width: 220rpx;
flex-direction: column; background-color: #ffffff;
height: calc(100vh - var(--window-top)); border-radius: 36rpx;
width: 100%; color: #999999;
} display: flex;
justify-content: center;
.tab-view { align-items: center;
height: 100%;
overflow: auto; .search-image {
padding-bottom: 20rpx; width: 36rpx;
} height: 32rpx;
flex-shrink: 0;
// .swiper-box { margin-right: 24rpx;
// flex: 1; }
// }
.search-btn-text {
// .swiper-item { line-height: 36rpx;
// height: 100%; font-weight: 400;
// .page-box { font-size: 26rpx;
// padding-bottom: 20rpx; }
// } }
// } }
.tools-box { .order-taps {
display: flex; height: 80rpx;
flex-direction: row; padding: 8rpx 30rpx 20rpx 30rpx;
justify-content: space-between; display: flex;
padding-bottom: 20rpx; flex-direction: row;
justify-content: space-between;
.search-sub { align-items: center;
height: 72rpx;
width: 320rpx; .order-taps-item {
} font-size: 28rpx;
font-weight: 400;
.search-btn { color: #999999;
height: 72rpx; line-height: 20px;
width: 220rpx;
background-color: #ffffff; .taps-count {
border-radius: 36rpx; position: absolute;
color: #999999; font-size: 16rpx;
display: flex; font-weight: 400;
justify-content: center; line-height: 16rpx;
align-items: center; width: 36rpx;
height: 24rpx;
.search-image { background: #FFFFFF;
width: 36rpx; border-radius: 16rpx;
height: 32rpx; border: 2rpx solid #FA5A49;
flex-shrink: 0; text-align: center;
margin-right: 24rpx; color: #FA5A49;
} }
}
.search-btn-text { }
line-height: 36rpx;
font-weight: 400;
font-size: 26rpx;
}
}
}
.order-taps {
height: 80rpx;
padding: 8rpx 30rpx 20rpx 30rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
.order-taps-item {
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 20px;
.taps-count {
position: absolute;
font-size: 16rpx;
font-weight: 400;
line-height: 16rpx;
width: 36rpx;
height: 24rpx;
background: #FFFFFF;
border-radius: 16rpx;
border: 2rpx solid #FA5A49;
text-align: center;
color: #FA5A49;
}
}
}
</style> </style>
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