Commit 1bf70585 authored by Facius's avatar Facius

Merge branch 'dev-1.4.3' into test

parents 09e358de c4508d5a
(function () {
let NODE_ENV = 'test'; // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null;
let VERSION_NUMBER = '1.3.13';//版本号
//小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频
if (process.env.NODE_ENV === "development") {
if (NODE_ENV === 'dev') {
ENV_VAR = require('./.env.dev.js');
} else if (NODE_ENV === 'test') {
ENV_VAR = require('./.env.test.js');
} else if (NODE_ENV === 'prod') {
ENV_VAR = require('./.env.prod.js');
}
// 百度地图AK,请勿删除
ENV_VAR['bmapAK'] = 'G1wPip2Oj62NnoUctXhiE1faZVHbeo2A'
} else if (process.env.NODE_ENV === "production") {
if (NODE_ENV === 'test') {
ENV_VAR = require('./.env.test.js');
} else if (NODE_ENV === 'prod') {
ENV_VAR = require('./.env.prod.js');
}
// 百度地图AK,请勿删除
ENV_VAR['bmapAK'] = 'lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI'
}
if (ENV_VAR) {
process.uniEnv = {};
process.uniEnv['node_env'] = NODE_ENV;
process.uniEnv['version_number'] = VERSION_NUMBER;
for (let key in ENV_VAR) {
process.uniEnv[key] = ENV_VAR[key];
}
}
})();
;(function() {
let NODE_ENV = 'prod' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null
let VERSION_NUMBER = '1.3.19' //版本号
//小程序是否审核通过,参数配置在ucenter库version表,对应版本号的is_audit设置为1,将显示学习视频
if (process.env.NODE_ENV === 'development') {
if (NODE_ENV === 'dev') {
ENV_VAR = require('./.env.dev.js')
} else if (NODE_ENV === 'test') {
ENV_VAR = require('./.env.test.js')
} else if (NODE_ENV === 'prod') {
ENV_VAR = require('./.env.prod.js')
}
// 百度地图AK,请勿删除
ENV_VAR['bmapAK'] = 'G1wPip2Oj62NnoUctXhiE1faZVHbeo2A'
} else if (process.env.NODE_ENV === 'production') {
if (NODE_ENV === 'test') {
ENV_VAR = require('./.env.test.js')
} else if (NODE_ENV === 'prod') {
ENV_VAR = require('./.env.prod.js')
}
// 百度地图AK,请勿删除
ENV_VAR['bmapAK'] = 'lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI'
}
if (ENV_VAR) {
process.uniEnv = {}
process.uniEnv['node_env'] = NODE_ENV
process.uniEnv['version_number'] = VERSION_NUMBER
for (let key in ENV_VAR) {
process.uniEnv[key] = ENV_VAR[key]
}
}
})()
<!-- ******************* 多选框 ******************* -->
<template>
<view class="list">
<view v-for="(item,index) in settings" :key="index"
:class="{'txt':true,'active':checkStatus(item.key)}" @click="setValue(item.key)">{{item.label}}
</view>
</view>
<view class="list">
<view
v-for="(item, index) in settings"
:key="index"
:class="{ txt: true, active: checkStatus(item.key) }"
@click="setValue(item.key)"
>{{ item.label }}
</view>
</view>
</template>
<script>
import arrMixin from './arrMixin'
export default {
name: 'XhRadio',
components: {},
mixins: [arrMixin],
props: {},
filters:{},
data() {
return {}
},
computed: {
settings() {
return this.item.fieldsOptions || []
}
},
watch: {},
mounted() {},
methods: {
checkStatus(item){
if(!item){
return false
}
const dataValue = this.dataValue
let flag = Array.isArray(dataValue) && dataValue.indexOf(item)>-1
return flag
},
setValue(txt) {
const dataValue = this.dataValue || []
let idx = dataValue.indexOf(txt)
if (idx > -1) {
dataValue.splice(idx,1)
} else {
dataValue.push(txt)
}
this.dataValue = dataValue
this.valueChange(this.dataValue)
}
}
}
import arrMixin from './arrMixin'
export default {
name: 'XhRadio',
components: {},
mixins: [arrMixin],
props: {},
filters: {},
data() {
return {}
},
computed: {
settings() {
return this.item.fieldsOptions || []
},
},
watch: {},
mounted() {},
methods: {
checkStatus(item) {
if (!item) {
return false
}
const dataValue = this.dataValue
let flag = Array.isArray(dataValue) && dataValue.indexOf(item) > -1
return flag
},
setValue(txt) {
if (this.disabled) return
const dataValue = this.dataValue || []
let idx = dataValue.indexOf(txt)
if (idx > -1) {
dataValue.splice(idx, 1)
} else {
dataValue.push(txt)
}
this.dataValue = dataValue
this.valueChange(this.dataValue)
},
},
}
</script>
<style lang="scss" scoped>
.list {
display: flex;
flex-wrap: wrap;
.txt{
color:#333;
padding:10rpx 30rpx;
margin: 10rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 46%;
align-items: center;
&.active{
background-color: #2272FF;
color:#fff;
}
}
}
.list {
display: flex;
flex-wrap: wrap;
.txt {
color: #333;
padding: 10rpx 30rpx;
margin: 10rpx;
background: #f4f5f7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 46%;
align-items: center;
&.active {
background-color: #2272ff;
color: #fff;
}
}
}
</style>
<!-- ******************* 文件上传 ******************* -->
<template>
<view>
<view class="file-box">
<view class="pics u-flex u-flex-wrap">
<view class="img-list" v-for="(item,index) in imgList" :key="index">
<u-image class="pic" width="160" height="160" :src="item.path ? item.path : item.src + '?imageView2/1/w/100/h/100/q/75'" :border-radius="10" @click.stop="prviewImage(item,index)" fade lazy-load ></u-image>
<view class="icon-del-box" @click.stop="delFile(index)">
<view class="icon-del"></view>
<view class="icon-del rotate"></view>
</view>
</view>
<slot></slot>
<!-- <view class="img-list">
<view>
<view class="file-box">
<view class="pics u-flex u-flex-wrap">
<view class="img-list" v-for="(item, index) in imgList" :key="index">
<u-image
class="pic"
width="160"
height="160"
:src="
item.path
? item.path
: item.src + '?imageView2/1/w/100/h/100/q/75'
"
:border-radius="10"
@click.stop="prviewImage(item, index)"
fade
lazy-load
></u-image>
<view
class="icon-del-box"
v-if="!disabled"
@click.stop="delFile(index)"
>
<view class="icon-del"></view>
<view class="icon-del rotate"></view>
</view>
</view>
<slot></slot>
<!-- <view class="img-list">
<u-image class="pic" width="160rpx" height="160rpx" :border-radius="10" @click="selectUpload" :src="uploadImage"></u-image>
</view> -->
</view>
<!-- <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet> -->
</view>
<!-- <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo> -->
</view>
</view>
<!-- <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet> -->
</view>
<!-- <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo> -->
</view>
</template>
<script>
import arrMixin from './arrMixin'
import baseFile from '@/components/upload/index';
import takePhoto from '@/components/take/index.vue'
// import uploader from '@/plugins/uploader/index.js'
import arrMixin from './arrMixin'
import baseFile from '@/components/upload/index'
import takePhoto from '@/components/take/index.vue'
// import uploader from '@/plugins/uploader/index.js'
export default {
name: 'XhFiles',
components: {
'take-photo': takePhoto
},
mixins: [arrMixin,baseFile],
props: {
files: {
type: Array,
},
partnerCompanyId: {
type: String,
default: ''
},
categoryId: {
type: String,
default: ''
},
brandId: {
type: String,
default: ''
},
},
filters:{},
data() {
return {
maskShow:false,
list: [
{
text: '相册'
},
{
text: '拍照'
}
],
takeStatus: false,
currentItemDate:{},
}
},
computed: {
settings() {
return this.item.settings || []
},
uploadImage() {
return process.uniEnv.qn_base_url + 'upload-file.png'
},
},
mounted() {
if(this.value){
this.imgList = this.value.filter(v => v).map(img =>{
return {src:img ? img : ''}
})
this.setValue()
}
},
methods: {
setTmpValue(values) {
this.imgList = this.imgList.concat(values)
const dataValue = this.imgList.map(v => v.src)
this.valueChange(dataValue)
},
setValue() {
const dataValue = this.imgList.map(item => item.src)
this.valueChange(dataValue)
},
prviewImage(item, index) {
uni.previewImage({
urls: [item.path ? item.path : item.src],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
},
/*
export default {
name: 'XhFiles',
components: {
'take-photo': takePhoto,
},
mixins: [arrMixin, baseFile],
props: {
files: {
type: Array,
},
partnerCompanyId: {
type: String,
default: '',
},
categoryId: {
type: String,
default: '',
},
brandId: {
type: String,
default: '',
},
},
filters: {},
data() {
return {
maskShow: false,
list: [
{
text: '相册',
},
{
text: '拍照',
},
],
takeStatus: false,
currentItemDate: {},
}
},
computed: {
settings() {
return this.item.settings || []
},
uploadImage() {
return process.uniEnv.qn_base_url + 'upload-file.png'
},
},
mounted() {
if (this.value) {
this.imgList = this.value
.filter((v) => v)
.map((img) => {
return { src: img ? img : '' }
})
this.setValue()
}
},
methods: {
setTmpValue(values) {
this.imgList = this.imgList.concat(values)
const dataValue = this.imgList.map((v) => v.src)
this.valueChange(dataValue)
},
setValue() {
const dataValue = this.imgList.map((item) => item.src)
this.valueChange(dataValue)
},
prviewImage(item, index) {
uni.previewImage({
urls: [item.path ? item.path : item.src],
current: index,
})
},
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
},
/*
selectUpload(){
if (this.imgList.length === 10) {
return this.$refs.uToast.show({
......@@ -197,66 +216,64 @@
}
});
}*/
}
}
},
}
</script>
<style lang="scss" scoped>
.img-list {
position: relative;
margin: 8rpx;
width: 160rpx;
height: 160rpx;
.pic {
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&:nth-child(3n) {
margin-right: 0;
}
}
.img-list {
position: relative;
margin: 8rpx;
width: 160rpx;
height: 160rpx;
.pic{
// margin-right: 15rpx;
// margin-bottom: 15rpx;
&:nth-child(3n){
margin-right: 0;
}
}
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
// .list {
// display: flex;
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
// .list {
// display: flex;
// .txt {
// color: #666;
// padding: 10rpx;
// .txt {
// color: #666;
// padding: 10rpx;
// &.active {
// background-color: red;
// color: #fff;
// }
// }
// }
// &.active {
// background-color: red;
// color: #fff;
// }
// }
// }
</style>
<!-- ******************* 定位 ******************* -->
<template>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1 location-name" @click="getLocation">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
</view>
<view>
<view class="list u-flex u-row-between">
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{ item.fieldsTitle }}</view>
<view class="u-flex-1 location-name" @click="getLocation">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{ valueTxt || '正在获取中...' }}</view>
</view>
</template>
<script>
import arrMixin from './arrMixin'
export default {
name: 'XhLocation',
components: {},
mixins: [arrMixin],
props: {},
filters:{},
data() {
return {}
},
computed: {
valueTxt() {
let str = ''
const dataValue = this.dataValue
if(dataValue && dataValue.length>1){
str = '经度:'+dataValue[0].toFixed(4)+','+'纬度:'+dataValue[1].toFixed(4)
}
return str
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
},
watch: {},
created() {
this.getLocation()
},
methods: {
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
self.setValue(dataValue)
},
fail(err) {}
});
},
setValue(txt) {
this.valueChange(this.dataValue)
}
}
}
import arrMixin from './arrMixin'
export default {
name: 'XhLocation',
components: {},
mixins: [arrMixin],
props: {},
filters: {},
data() {
return {}
},
computed: {
valueTxt() {
let str = ''
const dataValue = this.dataValue
if (dataValue && dataValue.length > 1) {
str =
'经度:' +
dataValue[0].toFixed(4) +
',' +
'纬度:' +
dataValue[1].toFixed(4)
}
return str
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
},
},
watch: {},
created() {
this.getLocation()
},
methods: {
getLocation() {
if (this.disabled) return
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
self.setValue(dataValue)
},
fail(err) {},
})
},
setValue(txt) {
this.valueChange(this.dataValue)
},
},
}
</script>
<style lang="scss" scoped>
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx 20rpx;
border-radius: 12rpx;
}
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272ff;
text-align: right;
}
.location {
background: #f4f5f7;
padding: 10rpx 20rpx;
border-radius: 12rpx;
}
</style>
<!-- ******************* 多个输入框 ******************* -->
<template>
<view class="u-flex u-flex-wrap">
<u-input class="input-item" v-for="(item,index) in inputOptions" v-model="item.value" @input="val=>{getValue(item)}" type="text" :key="index" :border="true" :placeholder="item.placeholder" />
</view>
<view class="u-flex u-flex-wrap">
<u-input
class="input-item"
v-for="(item, index) in inputOptions"
v-model="item.value"
@input="
(val) => {
getValue(item)
}
"
type="text"
:key="index"
:border="true"
:placeholder="item.placeholder"
:disabled="disabled"
/>
</view>
</template>
<script>
import objMixin from './objMixin'
export default {
name: 'XhMultiInput',
components: {},
mixins: [objMixin],
props: {},
data() {
return {}
},
computed: {
inputOptions() {
let options = this.item.inputOptions || []
let result = options.map(item => {
return {
...item,
value: ''
}
})
return result
}
},
watch: {},
mounted() {},
methods: {
getValue(item){
let currentValue = {}
currentValue[item.fieldsName] = item.value
// 以key,value的对象形式传递
this.valueChange(currentValue)
}
}
}
import objMixin from './objMixin'
export default {
name: 'XhMultiInput',
components: {},
mixins: [objMixin],
props: {},
data() {
return {}
},
computed: {
inputOptions() {
let options = this.item.inputOptions || []
let result = options.map((item) => {
return {
...item,
value: '',
}
})
return result
},
},
watch: {},
mounted() {},
methods: {
getValue(item) {
let currentValue = {}
currentValue[item.fieldsName] = item.value
// 以key,value的对象形式传递
this.valueChange(currentValue)
},
},
}
</script>
<style scoped>
.input-item{
width: 31%;
margin: 5rpx;
background: #F4F5F7;
}
.input-item {
width: 31%;
margin: 5rpx;
background: #f4f5f7;
}
</style>
<!-- ******************* 扫码 ******************* -->
<template>
<view class="">
<view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<view class="u-flex">
<u-input class="u-flex-1 input-item" v-model="dataValue" @input="valueChange" type="text" />
</view>
</view>
<view class="">
<view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<view class="u-flex">
<u-input
class="u-flex-1 input-item"
v-model="dataValue"
@input="valueChange"
type="text"
:disabled="disabled"
/>
</view>
</view>
</template>
<script>
import stringMixin from './stringMixin'
export default {
name: 'XhScan',
components: {},
mixins: [stringMixin],
props: {},
filters:{},
data() {
return {}
},
computed: {
},
watch: {},
mounted() {},
methods: {
scanCode(type){
const self = this
uni.scanCode({
success: function (res) {
let result = res.result
if (result.substring(0, 4) === 'http') {
let arr = result.split('/#/')
if (arr.length < 2) arr = result.split('?')
result = arr[1]
}
self.dataValue = result
self.valueChange(result)
}
});
}
}
}
import stringMixin from './stringMixin'
export default {
name: 'XhScan',
components: {},
mixins: [stringMixin],
props: {},
filters: {},
data() {
return {}
},
computed: {},
watch: {},
mounted() {},
methods: {
scanCode(type) {
if (this.disabled) return
const self = this
uni.scanCode({
success: function(res) {
let result = res.result
if (result.substring(0, 4) === 'http') {
let arr = result.split('/#/')
if (arr.length < 2) arr = result.split('?')
result = arr[1]
}
self.dataValue = result
self.valueChange(result)
},
})
},
},
}
</script>
<style lang="scss" scoped>
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.input-item{
background: #F4F5F7;
border-radius: 12rpx;
padding-left: 20rpx;
}
.required {
padding-right: 10rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #fa3534;
}
.input-item {
background: #f4f5f7;
border-radius: 12rpx;
padding-left: 20rpx;
}
</style>
<!-- ******************* 单个下拉选择 ******************* -->
<template>
<view class="xh-select" :style="{'width': fieldsWidth}">
<!-- <u-input :value="text" disabled @click="show=true" :placeholder="placeholder" :placeholder-style="placeholderStyle"
<view class="xh-select" :style="{ width: fieldsWidth }">
<!-- <u-input :value="text" disabled @click="show=true" :placeholder="placeholder" :placeholder-style="placeholderStyle"
:custom-style="customStyle" :clearable="false"></u-input>
<u-select :list="settings" v-model="show" @confirm="actionSheetCallback" safe-area-inset-bottom></u-select>
<u-icon class="input-icon" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon> -->
<view class="u-flex u-row-between picker-common">
<picker mode="selector" :value="index" range-key="label" :range="settings" @click="show = true" @change="pickerChange" class="u-flex-1">
<view class="txt">{{text || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
</view>
<view class="u-flex u-row-between picker-common">
<picker
mode="selector"
:value="index"
range-key="label"
:range="settings"
@click="show = true"
@change="pickerChange"
class="u-flex-1"
:disabled="disabled"
>
<view class="txt">{{ text || '请选择' }}</view>
</picker>
<u-icon
class="input-icon"
color="#2272FF"
:name="show ? 'arrow-up' : 'arrow-down'"
></u-icon>
</view>
</view>
</template>
<script>
import stringMixin from './stringMixin'
export default {
name: 'XhSelect',
components: {},
mixins: [stringMixin],
props: {
placeholder: {
type: String,
default: '请选择'
},
width: { // 例如:454rpx
type: String,
default: '100%'
}
},
data() {
return {
show: false,
index: ''
}
},
computed: {
type() {
if (this.item && this.item.fieldsType == 'password') {
return this.item.fieldsType
} else {
return 'text'
}
},
settings() {
let result = []
let settings = this.item.fieldsOptions || []
result = settings.map(item => {
return {
label: item.label,
value: item.key,
color: '#333333',
fontSize: 26
}
})
return result
},
text(){
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:''
},
placeholderStyle() {
return 'color:#999999;font-size:26rpx'
},
customStyle() {
return {
'background-color': '#F4F5F7',
'border-radius': '12rpx',
'color': '#333333',
'padding-left': '20rpx',
'padding-right': '60rpx',
'width': this.width,
'font-size':'26rpx',
'height': '76rpx'
}
},
fieldsWidth() {
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
},
watch: {},
mounted() {},
methods: {
actionSheetCallback(event) {
const id = event[0].value
this.dataValue = id
this.valueChange(id)
},
pickerChange(data) {
this.index = data.detail.value
const id = this.item.fieldsOptions[this.index].key
this.dataValue = id
this.valueChange(id)
},
}
}
import stringMixin from './stringMixin'
export default {
name: 'XhSelect',
components: {},
mixins: [stringMixin],
props: {
placeholder: {
type: String,
default: '请选择',
},
width: {
// 例如:454rpx
type: String,
default: '100%',
},
},
data() {
return {
show: false,
index: '',
}
},
computed: {
type() {
if (this.item && this.item.fieldsType == 'password') {
return this.item.fieldsType
} else {
return 'text'
}
},
settings() {
let result = []
let settings = this.item.fieldsOptions || []
result = settings.map((item) => {
return {
label: item.label,
value: item.key,
color: '#333333',
fontSize: 26,
}
})
return result
},
text() {
let option = this.item.fieldsOptions.find((a) => {
return a.key === this.dataValue
})
return option ? option.label : ''
},
placeholderStyle() {
return 'color:#999999;font-size:26rpx'
},
customStyle() {
return {
'background-color': '#F4F5F7',
'border-radius': '12rpx',
color: '#333333',
'padding-left': '20rpx',
'padding-right': '60rpx',
width: this.width,
'font-size': '26rpx',
height: '76rpx',
}
},
fieldsWidth() {
return this.item.fieldsWidth ? this.item.fieldsWidth + 'rpx' : '100%'
},
},
watch: {},
mounted() {},
methods: {
actionSheetCallback(event) {
const id = event[0].value
this.dataValue = id
this.valueChange(id)
},
pickerChange(data) {
this.index = data.detail.value
const id = this.item.fieldsOptions[this.index].key
this.dataValue = id
this.valueChange(id)
},
},
}
</script>
<style lang="scss" scoped>
.xh-select {
position: relative;
.input-icon {
position: absolute;
right: 20rpx;
top: 26rpx;
color: #2272FF;
}
}
.picker-common {
min-height: 35px;
background-color: #F4F5F7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.xh-select {
position: relative;
.input-icon {
position: absolute;
right: 20rpx;
top: 26rpx;
color: #2272ff;
}
}
.picker-common {
min-height: 35px;
background-color: #f4f5f7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>
......@@ -12,11 +12,12 @@
:value="index"
range-key="label"
:range="settings"
:disabled="disabled"
@click="showPicker = true"
@change="pickerChange"
class="txt u-flex-1"
>
<view>{{ text || "请选择" }}</view>
<view>{{ text || '请选择' }}</view>
</picker>
<u-icon
class="input-icon"
......@@ -30,9 +31,9 @@
</template>
<script>
import objMixin from "./objMixin";
import objMixin from './objMixin'
export default {
name: "XhPicker",
name: 'XhPicker',
components: {},
mixins: [objMixin],
props: {
......@@ -40,17 +41,17 @@ export default {
defaultSelector: {
type: Array,
default() {
return [0];
return [0]
},
},
// 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
rangeKey: {
type: String,
default: "label",
default: 'label',
},
value: {
type: String,
default: "{}",
default: '{}',
},
orderId: {
type: Number,
......@@ -62,11 +63,11 @@ export default {
},
specificationId: {
type: String,
default: "0",
default: '0',
},
orderServiceType: {
type: String,
default: "安装",
default: '安装',
},
},
filters: {},
......@@ -76,47 +77,47 @@ export default {
showPicker: false,
settings: [],
measure: [],
index: "",
};
index: '',
}
},
computed: {
text() {
let val = "";
let val = ''
if (this.value) {
let data = JSON.parse(this.value);
val = data[0].measureTypeName + "-" + data[0].measureName;
let data = JSON.parse(this.value)
val = data[0].measureTypeName + '-' + data[0].measureName
}
return val;
return val
},
fieldsWidth() {
return this.item.fieldsWidth ? this.item.fieldsWidth + "rpx" : "100%";
return this.item.fieldsWidth ? this.item.fieldsWidth + 'rpx' : '100%'
},
},
watch: {
specificationId(val, oldVal) {
this.initComponent();
this.initComponent()
},
},
mounted() {
this.isNotMulti = this.orderServiceType === "安装";
this.initComponent();
this.isNotMulti = this.orderServiceType === '安装'
this.initComponent()
},
methods: {
openPicker() {
if (this.specificationId === "0") {
if (this.specificationId === '0') {
this.$refs.uToast.show({
title: "请先选择规格",
type: "error",
});
return;
title: '请先选择规格',
type: 'error',
})
return
}
this.showPicker = true;
this.showPicker = true
},
initComponent() {
if (this.isNotMulti) {
this.initMeasure();
this.initMeasure()
} else {
this.initSymptoms();
this.initSymptoms()
}
},
initSymptoms() {
......@@ -133,50 +134,50 @@ export default {
categoryId: this.categoryId,
specificationId: this.specificationId,
orderServiceTypeText: this.orderServiceType,
};
this.$u.api.getMeasureV2(param).then(res => {
}
this.$u.api.getMeasureV2(param).then((res) => {
if (res.code == 200) {
let result = [];
let result = []
for (let key in res.data) {
this.measure = res.data[key].measureExtendDtos;
this.measure = res.data[key].measureExtendDtos
res.data[key].measureExtendDtos.map((item, index) => {
result.push({ id: item.measureId, label: item.measureName });
});
result.push({ id: item.measureId, label: item.measureName })
})
}
if (this.orderServiceType === "安装") {
this.settings = result;
if (this.orderServiceType === '安装') {
this.settings = result
} else {
this.settings[2] = result;
this.settings[2] = result
}
} else {
console.log(res.message, "查询措施失败");
console.log(res.message, '查询措施失败')
}
});
})
}
},
pickerConfirm(data) {
let result = [];
let result = []
if (this.isMulti) {
// 维修
} else {
// 安装
result.push(this.measure[data[0]]);
result.push(this.measure[data[0]])
}
this.valueChange(JSON.stringify(result));
this.valueChange(JSON.stringify(result))
},
pickerChange(data) {
this.showPicker = false;
this.index = data.detail.value;
this.showPicker = false
this.index = data.detail.value
let result = [];
let result = []
if (this.isMulti) {
// 维修
} else {
// 安装
result.push(this.measure[this.index]);
result.push(this.measure[this.index])
}
this.valueChange(JSON.stringify(result));
this.valueChange(JSON.stringify(result))
},
columnchange(data) {
// // 树列改变时进行联动操作
......@@ -185,7 +186,7 @@ export default {
// this.settings.splice(column+1,1,arr)
},
},
};
}
</script>
<style lang="scss" scoped>
.picker-common {
......
......@@ -23,66 +23,67 @@
</template>
<script>
import arrMixin from "./arrMixin";
import arrMixin from './arrMixin'
export default {
name: "XhInput", // 新建 input
name: 'XhInput', // 新建 input
components: {},
mixins: [arrMixin],
props: {
placeholder: {
type: String,
default: "请输入",
default: '请输入',
},
orderId: {
type: String,
default: "请输入",
default: '请输入',
},
},
data() {
return {
maxlength: 140,
};
}
},
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + "mixing.png";
return process.uniEnv.qn_base_url + 'mixing.png'
},
arrowText() {
if(this.$u.test.isEmpty(this.dataValue)) return "请选择";
if(this.item.fieldsName == "materialList") {
if (this.$u.test.isEmpty(this.dataValue)) return '请选择'
if (this.item.fieldsName == 'materialList') {
let hasMate = false
var newData = this.dataValue.find((item) => {
if(!this.$u.test.isEmpty(item.useLength)) {
if (!this.$u.test.isEmpty(item.useLength)) {
hasMate = true
return item.useLength != '0'
}
})
if(hasMate && this.$u.test.isEmpty(newData)) return "请选择"
if (hasMate && this.$u.test.isEmpty(newData)) return '请选择'
}
return "已选择";
return '已选择'
},
},
watch: {},
mounted() {},
methods: {
toMaterialPage() {
let self = this;
if (this.disabled) return
let self = this
uni.navigateTo({
url:
"pages/order/material?orderId=" +
'pages/order/material?orderId=' +
this.orderId +
"&fieldName=" +
'&fieldName=' +
this.item.fieldsName,
// 接口调用成功的回调函数,即跳转到B页面 test.vue 后的回调函数
success: function (res) {
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit("showMaterialData", self.dataValue);
res.eventChannel.emit('showMaterialData', self.dataValue)
},
});
})
},
},
};
}
</script>
<style lang="scss" scoped>
......
<!-- ******************* 单个下拉选择 ******************* -->
<template>
<view class="xh-specifications" :style="{'width': fieldsWidth}">
<view class="u-flex u-row-between picker-common" @click="$u.throttle(handleClick, 500)">
<view>{{text || '请选择'}}</view>
<u-icon class="input-icon" color="#2272FF" name="arrow-down"></u-icon>
</view>
</view>
<view class="xh-specifications" :style="{ width: fieldsWidth }">
<view
class="u-flex u-row-between picker-common"
@click="$u.throttle(handleClick, 500)"
>
<view>{{ text || '请选择' }}</view>
<u-icon class="input-icon" color="#2272FF" name="arrow-down"></u-icon>
</view>
</view>
</template>
<script>
import stringMixin from './stringMixin'
export default {
name: 'XhSpecifications',
components: {},
mixins: [stringMixin],
props: {
placeholder: {
type: String,
default: '请选择'
},
width: { // 例如:454rpx
type: String,
default: '100%'
},
type: {
type: String,
default: 'text'
},
},
data() {
return {
}
},
computed: {
fieldsWidth() { // 后台返回宽度就用后台的
return this.item.fieldsWidth ? (this.item.fieldsWidth + 'rpx') : '100%'
},
text(){ // 根据选中的key显示
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:''
}
},
watch: {},
mounted() {},
methods: {
handleClick() {
var pages = getCurrentPages();
if (pages.length >= 1) {
var page = pages[pages.length - 1];
page.info = this.item // 给下个页面传递数据
}
uni.navigateTo({ // 把选中的key传给下个页面
url: 'pages/order/specification?selectedId=' + this.dataValue
})
}
}
}
import stringMixin from './stringMixin'
export default {
name: 'XhSpecifications',
components: {},
mixins: [stringMixin],
props: {
placeholder: {
type: String,
default: '请选择',
},
width: {
// 例如:454rpx
type: String,
default: '100%',
},
type: {
type: String,
default: 'text',
},
},
data() {
return {}
},
computed: {
fieldsWidth() {
// 后台返回宽度就用后台的
return this.item.fieldsWidth ? this.item.fieldsWidth + 'rpx' : '100%'
},
text() {
// 根据选中的key显示
let option = this.item.fieldsOptions.find((a) => {
return a.key === this.dataValue
})
return option ? option.label : ''
},
},
watch: {},
mounted() {},
methods: {
handleClick() {
if (this.disabled) return
var pages = getCurrentPages()
if (pages.length >= 1) {
var page = pages[pages.length - 1]
page.info = this.item // 给下个页面传递数据
}
uni.navigateTo({
// 把选中的key传给下个页面
url: 'pages/order/specification?selectedId=' + this.dataValue,
})
},
},
}
</script>
<style lang="scss" scoped>
.xh-specifications {
position: relative;
.input-icon {
position: absolute;
right: 20rpx;
top: 26rpx;
color: #2272FF;
}
}
.picker-common {
min-height: 35px;
background-color: #F4F5F7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.xh-specifications {
position: relative;
.input-icon {
position: absolute;
right: 20rpx;
top: 26rpx;
color: #2272ff;
}
}
.picker-common {
min-height: 35px;
background-color: #f4f5f7;
border-radius: 6px;
color: #333333;
padding-left: 10px;
padding-right: 12px;
width: 100%;
height: 38px;
.txt {
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>
<!-- ******************* 输入框 ******************* -->
<template>
<view class="picker-box">
<!-- <view class="u-flex u-row-between" @click="openPicker">
<view class="picker-box">
<!-- <view class="u-flex u-row-between" @click="openPicker">
<view class="txt u-flex-1">{{dataValue||'请选择时间'}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> -->
<!-- <u-picker :params="params" v-model="showPicker" mode="time" @confirm="pickerConfirm"></u-picker> -->
<view class="u-flex u-row-between">
<picker mode="date" :value="dataValue" @change="bindDateChange" class="txt u-flex-1">
<view>{{dataValue || '请选择时间'}}</view>
</picker>
<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> -->
<view class="u-flex u-row-between">
<picker
mode="date"
:value="dataValue"
@change="bindDateChange"
class="txt u-flex-1"
:disabled="disabled"
>
<view>{{ dataValue || '请选择时间' }}</view>
</picker>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
</view>
</template>
<script>
import stringMixin from './stringMixin'
export default {
components: {},
mixins: [stringMixin],
props: {},
data() {
return {
showPicker: false,
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false,
timestamp: true,
},
date: '请选择',
}
},
mounted() {},
methods: {
openPicker() {
this.showPicker = true
},
pickerConfirm(data) {
let result = []
let dataValue = data.year + '-' + data.month + '-' + data.day
this.dataValue = dataValue
this.valueChange(dataValue)
},
bindDateChange: function(e) {
const value = e.target.value
this.dataValue = value
this.valueChange(value)
}
}
}
import stringMixin from './stringMixin'
export default {
components: {},
mixins: [stringMixin],
props: {},
data() {
return {
showPicker: false,
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false,
timestamp: true,
},
date: '请选择',
}
},
mounted() {},
methods: {
openPicker() {
this.showPicker = true
},
pickerConfirm(data) {
let result = []
let dataValue = data.year + '-' + data.month + '-' + data.day
this.dataValue = dataValue
this.valueChange(dataValue)
},
bindDateChange: function(e) {
const value = e.target.value
this.dataValue = value
this.valueChange(value)
},
},
}
</script>
<style>
</style>
<style></style>
......@@ -14,10 +14,10 @@
<view class="order-cell">
<text>合作厂商:</text>
<text>{{ order.partnerCompanyName }}</text>
</view>
<view class="order-cell">
<text>厂商编号:</text>
<text>{{ order.partnerSerialNumber }}</text>
</view>
<view class="order-cell">
<text>厂商编号:</text>
<text>{{ order.partnerSerialNumber }}</text>
</view>
<view class="order-cell between-cell">
<view class="left">
......@@ -131,6 +131,7 @@
if (this.operate) {
const latitude = this.order.contactAddressLatitud //res.latitude;
const longitude = this.order.contactAddressLongitud //res.longitude;
getApp().track("order_open_location", { address: address });
uni.openLocation({
latitude: Number(latitude),
longitude: Number(longitude),
......@@ -142,6 +143,7 @@
},
phoneToCustomer(phone) { // 联系客户
if (this.operate) {
getApp().track("order_make_phone_call", { phone: phone });
uni.makePhoneCall({
phoneNumber: phone, //仅为示例
complete() {}
......@@ -158,14 +160,14 @@
},
handleClick(val) {
this.$emit('update:readMore', val)
},
handleLongpress(text) {
uni.setClipboardData({
data: text,
success: function () {
console.log('success');
}
});
},
handleLongpress(text) {
uni.setClipboardData({
data: text,
success: function () {
console.log('success');
}
});
}
}
}
......@@ -299,4 +301,4 @@
text-align: left;
flex-shrink: 0;
}
</style>
</style>
<template>
<view class="order-view" @click="handleClickCell">
<view class="order-top-view">
<view class="left-view">
<view :class="['tag-view', {'active': active}]">
{{ orderData.orderServiceType }}
</view>
<view class="store-view">{{ orderData.categoryName }}</view>
</view>
<view class="right-view">{{ orderData.orderBusinessTypeText }}</view>
</view>
<view class="content-view">
<view class="info-view" v-for="(item, key) in infoTexts" :key="key">
<view class="info-title">
<text>{{item.name + ':'}}</text>
</view>
<view class="info-content">
<text @longpress="handleLongpress(key, orderData[key])">{{orderData[key]}}</text>
<text v-if="item.content">{{' / ' + orderData[item.content]}}</text>
</view>
</view>
<view class="address-view">
<view class="address-left-view">
<image class="address-image" :src="dizhiImage" mode="widthFix"></image>
<text>{{ formatAddress(orderData) }}</text>
</view>
<view v-if="showDistance" class="address-right-view">
{{orderDistance}}km
</view>
</view>
</view>
<view class="order-view" @click="handleClickCell">
<view class="order-top-view">
<view class="left-view">
<view :class="['tag-view', { active: active }]">
{{ orderData.orderServiceType }}
</view>
<view class="store-view">{{ orderData.categoryName }}</view>
</view>
<view class="right-view">{{ orderData.orderBusinessTypeText }}</view>
</view>
<view class="content-view">
<view class="info-view" v-for="(item, key) in infoTexts" :key="key">
<view class="info-title">
<text>{{ item.name + ':' }}</text>
</view>
<view class="info-content">
<text @longpress="handleLongpress(key, orderData[key])">{{
orderData[key]
}}</text>
<text v-if="item.content">{{ ' / ' + orderData[item.content] }}</text>
</view>
</view>
<view class="address-view">
<view class="address-left-view">
<image
class="address-image"
:src="dizhiImage"
mode="widthFix"
></image>
<text>{{ formatAddress(orderData) }}</text>
</view>
<view v-if="showDistance" class="address-right-view">
{{ orderDistance }}km
</view>
</view>
</view>
<view class="line-view"></view>
<view class="reason-view" v-if="showReason">
<view class="reason-title"><text>未通过原因:</text></view>
<view class="reason-text"><text v-for="(item, index) in orderData.auditResults" :key="index">{{item}}</text></view>
</view>
<view class="bottom-view">
<view>
<view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view>
<u-count-down :timestamp="timestamp" font-size="40" show-days separator="zh"
:color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" separator-color="#666666" ref="order-count-down"></u-count-down>
</view>
<view v-else-if="showTime">
<text>{{timeTitle}}</text>
<text>{{timeText}}</text>
</view>
</view>
<u-button class="right-btn" @click.stop="handleClick" :custom-style="buttonStyle" type="primary"
shape="circle" :hover-class="buttonTextType ? 'none' : ''">
{{orderText}}
</u-button>
</view>
</view>
<view class="line-view"></view>
<view class="reason-view" v-if="showReason">
<view class="reason-title"><text>未通过原因:</text></view>
<view class="reason-text"
><text v-for="(item, index) in orderData.auditResults" :key="index">{{
item
}}</text></view
>
</view>
<view class="bottom-view">
<view>
<view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', { timeout: timeout }]"
><text>{{ tagText }}</text></view
>
<u-count-down
:timestamp="timestamp"
font-size="40"
show-days
separator="zh"
:color="timeout ? '#FA5A49' : '#FF930D'"
@change="handleChange"
separator-color="#666666"
ref="order-count-down"
></u-count-down>
</view>
<view v-else-if="showTime">
<text>{{ timeTitle }}</text>
<text>{{ timeText }}</text>
</view>
</view>
<u-button
class="right-btn"
@click.stop="handleClick"
:custom-style="buttonStyle"
type="primary"
shape="circle"
>
{{ orderText }}
</u-button>
</view>
</view>
</template>
<script>
export default {
props: {
orderData: {
type: Object,
default () {
return {
orderServiceType: '安装', // 服务类型:安装、维修
categoryName: '充电桩', // 品类:充电桩
orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
orderNumber: 'OR2021041809827', // 工单编号
contactName: '郭小清', // 客户信息
contactPhone: '13631612077', // 联系方式
contactAddress: '湾街道荔枝花园D座125号', // 详细地址
contactAddressLatitud: '116.3896', // 联系人地址经度
contactAddressLongitud: '39.91917', // 联系人地址纬度
orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间
currentWillOverTime: 10000, // 剩余时间
currentOverTime: new Date().getTime() + 10000, // 超过时间点
auditDatetime: '2021.04.19 12:45:09', // 审核时间
orderFinishDatetime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单
orderId: '0', // 订单id
}
}
},
/* 订单类型
export default {
props: {
orderData: {
type: Object,
default() {
return {
orderServiceType: '安装', // 服务类型:安装、维修
categoryName: '充电桩', // 品类:充电桩
orderBusinessTypeText: '分配单', // 业务类型:分配单、订单池
orderNumber: 'OR2021041809827', // 工单编号
contactName: '郭小清', // 客户信息
contactPhone: '13631612077', // 联系方式
contactAddress: '湾街道荔枝花园D座125号', // 详细地址
contactAddressLatitud: '116.3896', // 联系人地址经度
contactAddressLongitud: '39.91917', // 联系人地址纬度
orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间
currentWillOverTime: 10000, // 剩余时间
currentOverTime: new Date().getTime() + 10000, // 超过时间点
auditDatetime: '2021.04.19 12:45:09', // 审核时间
orderFinishDatetime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单
orderId: '0', // 订单id
}
},
},
/* 订单类型
waitAccept:待接单、
waitAppointment:待预约、
waitCheckIn:待签到、
......@@ -92,141 +117,173 @@
exception:异常单、
finish:已完工
*/
type: String,
location: { // 当前坐标
type: Array,
default () {
return [116.3896, 39.91917] // 纬度,经度
}
}
},
data() {
return {
timeout: false,
timestamp: 0,
};
},
computed: {
orderText() { // 按钮文字
return this.typeTexts[this.orderType]
},
buttonStyle() { // 按钮样式
/** orderType
0 待接单、
1 待预约、
2 待签到、
3 待完工、
4 审核中、
5 异常单、
6 已完工
type: String,
location: {
// 当前坐标
type: Array,
default() {
return [116.3896, 39.91917] // 纬度,经度
},
},
},
data() {
return {
timeout: false,
timestamp: 0,
}
},
computed: {
orderText() {
// 按钮文字
return this.typeTexts[this.orderType]
},
buttonStyle() {
// 按钮样式
/** orderType
0 待接单、
1 待预约、
2 待签到、
3 待完工、
4 审核中、
5 异常单、
6 已完工
*/
switch (this.orderType) {
case 0:
if (!this.isCompetition ) {
return this.buttonStyles[0]
} else {
return this.buttonStyles[1]
}
case 1:
case 2:
case 3:
case 5:
return this.buttonStyles[0]
case 4:
case 6:
return this.buttonStyles[2]
}
},
showCountTime() { // ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单)) && 有超过时间点
return ([1, 2, 3].indexOf(this.orderType) != -1 || (this.orderType == 0 && !this.isCompetition)) && this.orderData.currentOverTime
},
showTime() {
return [4, 5, 6].indexOf(this.orderType) != -1
},
infoTexts() {
return {
'orderNumber': {name:'工单编号'},
'partnerCompanyName': {name: '合作厂商'},
'contactName': {name: '客户信息', content: 'contactPhone'},
}
},
typeTexts() {
return [this.type0Text, '去预约', '去签到', '去完工', '审核中', '去处理', '已完工']
},
isCompetition() { // 是:订单池,抢单; 否:指派单,接单
return this.orderData.orderBusinessType == 'R'
},
type0Text() {
return !this.isCompetition ? '接单' : '抢单'
},
buttonStyles() {
return [{
'background-color': '#2272FF',
'color': '#FFFFFF',
'font-size': '32rpx',
'height': '80rpx',
'width': '200rpx'
}, {
'background-color': '#FF930D',
'color': '#FFFFFF',
'font-size': '32rpx',
'height': '80rpx',
'width': '200rpx'
}, {
'background-color': 'transparent',
'color': '#2272FF',
'font-size': '32rpx',
'height': '32rpx',
'width': '100rpx'
}]
},
buttonTextType() {
return this.orderType == 4 || this.orderType == 6
},
dizhiImage() {
return process.uniEnv.qn_base_url + 'shouye-dizhi.png'
},
active() {
return this.orderData.orderServiceType == '安装'
},
tagText() {
return this.timeout ? '超' : '剩'
},
timeText() {
let time = this.orderType == 4 ? this.orderData.orderFinishDatetime : this.orderData.auditDatetime
return time ? this.$u.timeFormat(time, 'yyyy.mm.dd hh:MM:ss') : ''
},
timeTitle() {
return this.orderType == 4 ? '提交时间:' : '审核时间:'
},
showReason() {
return this.orderType == 5
},
showDistance() {
return this.orderType == 0 && this.location.length >= 2 && (this.orderData.contactAddressLatitud || this.orderData.contactAddressLongitud)
},
isWaitFinish() {
return this.orderType == 3
},
isException() {
return this.orderType == 5
},
types() {
return {
'waitAccept': 0, // 待接单、
'waitAppointment': 1, // 待预约、
'waitCheckIn': 2, // 待签到、
'waitFinish': 3, // 待完工、
'audit': 4, // 审核中、
'exception': 5, // 异常单、
'finish': 6, //已完工
}
},
orderDistance() {
return this.distance(this.orderData.contactAddressLatitud,this.orderData.contactAddressLongitud, this.location[0], this.location[1])
},
/** orderType
switch (this.orderType) {
case 0:
if (!this.isCompetition) {
return this.buttonStyles[0]
} else {
return this.buttonStyles[1]
}
case 1:
case 2:
case 3:
case 5:
case 4:
case 6:
return this.buttonStyles[0]
}
},
showCountTime() {
// ((待预约、 待签到、 待完工) || (待接单 && 业务类型非抢单)) && 有超过时间点
return (
([1, 2, 3].indexOf(this.orderType) != -1 ||
(this.orderType == 0 && !this.isCompetition)) &&
this.orderData.currentOverTime
)
},
showTime() {
return [4, 5, 6].indexOf(this.orderType) != -1
},
infoTexts() {
return {
orderNumber: { name: '工单编号' },
partnerCompanyName: { name: '合作厂商' },
contactName: { name: '客户信息', content: 'contactPhone' },
}
},
typeTexts() {
return [
this.type0Text,
'去预约',
'去签到',
'去完工',
'去查看',
'去处理',
'去查看',
]
},
isCompetition() {
// 是:订单池,抢单; 否:指派单,接单
return this.orderData.orderBusinessType == 'R'
},
type0Text() {
return !this.isCompetition ? '接单' : '抢单'
},
buttonStyles() {
return [
{
'background-color': '#2272FF',
color: '#FFFFFF',
'font-size': '32rpx',
height: '80rpx',
width: '200rpx',
},
{
'background-color': '#FF930D',
color: '#FFFFFF',
'font-size': '32rpx',
height: '80rpx',
width: '200rpx',
},
// {
// 'background-color': 'transparent',
// color: '#2272FF',
// 'font-size': '32rpx',
// height: '32rpx',
// width: '100rpx',
// },
]
},
// buttonTextType() {
// return this.orderType == 4 || this.orderType == 6
// },
dizhiImage() {
return process.uniEnv.qn_base_url + 'shouye-dizhi.png'
},
active() {
return this.orderData.orderServiceType == '安装'
},
tagText() {
return this.timeout ? '超' : '剩'
},
timeText() {
let time =
this.orderType == 4
? this.orderData.orderFinishDatetime
: this.orderData.auditDatetime
return time ? this.$u.timeFormat(time, 'yyyy.mm.dd hh:MM:ss') : ''
},
timeTitle() {
return this.orderType == 4 ? '提交时间:' : '审核时间:'
},
showReason() {
return this.orderType == 5
},
showDistance() {
return (
this.orderType == 0 &&
this.location.length >= 2 &&
(this.orderData.contactAddressLatitud ||
this.orderData.contactAddressLongitud)
)
},
isWaitFinish() {
return this.orderType == 3
},
isException() {
return this.orderType == 5
},
types() {
return {
waitAccept: 0, // 待接单、
waitAppointment: 1, // 待预约、
waitCheckIn: 2, // 待签到、
waitFinish: 3, // 待完工、
audit: 4, // 审核中、
exception: 5, // 异常单、
finish: 6, //已完工
}
},
orderDistance() {
return this.distance(
this.orderData.contactAddressLatitud,
this.orderData.contactAddressLongitud,
this.location[0],
this.location[1]
)
},
/** orderType
0 待接单、
1 待预约、
2 待签到、
......@@ -235,281 +292,323 @@
5 异常单、
6 已完工
*/
orderType() {
/*
orderType() {
/*
orderStatus:
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/
if (!this.type) {
if (this.orderData.orderStatus < 31) {
return 0
} else if (this.orderData.orderStatus == 31) {
if (this.orderData.appointmentDatetime) {
return 2
} else {
return 1
}
} else if (this.orderData.orderStatus > 31 && this.orderData.orderStatus < 80) {
return 3
} else if (this.orderData.orderStatus == 85 || this.orderData.orderStatus == 87) {
return 4
} else if (this.orderData.orderStatus == 86 || this.orderData.orderStatus == 88) {
return 5
} else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) {
return 6
} else {
return 0
}
} else {
return this.types[this.type]
}
}
},
created() {
this.updateTime()
},
watch:{
'orderData.currentCellTime'(val) {
// 从后台重新获取数据之后,时间重新计算
this.updateTime()
}
},
methods: {
// title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
handleClick() {
var func = 'click'
if (this.isWaitFinish || this.isException) { // 不是待完工、不是异常单点按钮算点cell
func = 'action'
}
this.$emit(func, this.orderData, this.type, this.showCountTime ? 'show' : '')
},
handleClickCell() {
var func = 'click'
if (this.isException) { // 异常单点cell算点按钮
func = 'action'
}
this.$emit(func, this.orderData, this.type, this.showCountTime ? 'show' : '')
},
handleChange(timestamp) {
if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) { // 超时之后倒计时变为正计时
setTimeout(()=> {
this.timestamp = 1
this.timeout = true
}, 1000)
}
},
formatAddress(order) {
let address = ""
if(order) {
address = order.contactProvinceText || ""
address += order.contactCityText || ""
address += order.contactCommunityText || ""
address += order.contactStreetText || ""
address += order.contactAddress || ""
}
return address
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 纬度
* @param float $lat1 经度
* @param float $lon2 纬度
* @param float $lat2 经度
* @return float 浮点数
*/
distance(lat1, lng1, lat2, lng2) {
var radLat1 = this.Rad(lat1);
var radLat2 = this.Rad(lat2);
var a = radLat1 - radLat2;
var b = this.Rad(lng1) - this.Rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
s = s *6378.137 ;// EARTH_RADIUS;
s = Math.round(s * 10000)/10000 //输出为米
return Number(s?s.toFixed(2):0);
},
Rad(d){
return d * Math.PI / 180.0;//经纬度转换成三角函数中度分表形式。
},
updateTime() {
var time = new Date().getTime()
this.timeout = this.orderData.currentOverTime < time
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - time) / 1000)
},
handleLongpress(key, text) { // 长按复制单号
if (key == 'orderNumber') {
uni.setClipboardData({
data: text,
success: function () {
console.log('success');
}
});
}
}
}
}
if (!this.type) {
if (this.orderData.orderStatus < 31) {
return 0
} else if (this.orderData.orderStatus == 31) {
if (this.orderData.appointmentDatetime) {
return 2
} else {
return 1
}
} else if (
this.orderData.orderStatus > 31 &&
this.orderData.orderStatus < 80
) {
return 3
} else if (
this.orderData.orderStatus == 85 ||
this.orderData.orderStatus == 87
) {
return 4
} else if (
this.orderData.orderStatus == 86 ||
this.orderData.orderStatus == 88
) {
return 5
} else if (
[80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1
) {
return 6
} else {
return 0
}
} else {
return this.types[this.type]
}
},
},
created() {
this.updateTime()
},
watch: {
'orderData.currentCellTime'(val) {
// 从后台重新获取数据之后,时间重新计算
this.updateTime()
},
},
methods: {
handleExceptions() {
if (this.isException) {
getApp().track('order_handleExceptions', {})
}
},
// title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
handleClick() {
var func = 'click'
this.handleExceptions()
// 不是待完工、审核中、异常单、已完工点按钮算点cell
if ([3, 4, 5, 6].indexOf(this.orderType) != -1) {
func = 'action'
}
this.$emit(
func,
this.orderData,
this.type,
this.showCountTime ? 'show' : ''
)
},
handleClickCell() {
var func = 'click'
this.handleExceptions()
if (this.isException) {
// 异常单点cell算点按钮
func = 'action'
}
this.$emit(
func,
this.orderData,
this.type,
this.showCountTime ? 'show' : ''
)
},
handleChange(timestamp) {
if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) {
// 超时之后倒计时变为正计时
setTimeout(() => {
this.timestamp = 1
this.timeout = true
}, 1000)
}
},
formatAddress(order) {
let address = ''
if (order) {
address = order.contactProvinceText || ''
address += order.contactCityText || ''
address += order.contactCommunityText || ''
address += order.contactStreetText || ''
address += order.contactAddress || ''
}
return address
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 纬度
* @param float $lat1 经度
* @param float $lon2 纬度
* @param float $lat2 经度
* @return float 浮点数
*/
distance(lat1, lng1, lat2, lng2) {
var radLat1 = this.Rad(lat1)
var radLat2 = this.Rad(lat2)
var a = radLat1 - radLat2
var b = this.Rad(lng1) - this.Rad(lng2)
var s =
2 *
Math.asin(
Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) *
Math.cos(radLat2) *
Math.pow(Math.sin(b / 2), 2)
)
)
s = s * 6378.137 // EARTH_RADIUS;
s = Math.round(s * 10000) / 10000 //输出为米
return Number(s ? s.toFixed(2) : 0)
},
Rad(d) {
return (d * Math.PI) / 180.0 //经纬度转换成三角函数中度分表形式。
},
updateTime() {
var time = new Date().getTime()
this.timeout = this.orderData.currentOverTime < time
this.timestamp = Math.round(
Math.abs(this.orderData.currentOverTime - time) / 1000
)
},
handleLongpress(key, text) {
// 长按复制单号
if (key == 'orderNumber') {
uni.setClipboardData({
data: text,
success: function() {
console.log('success')
},
})
}
},
},
}
</script>
<style lang="scss" scoped>
.order-view {
width: 100%;
background-color: #FFFFFF;
border-radius: 12rpx;
padding: 30rpx;
margin-bottom: 20rpx;
.order-view {
width: 100%;
background-color: #ffffff;
border-radius: 12rpx;
padding: 30rpx;
margin-bottom: 20rpx;
.order-top-view {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.order-top-view {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
.left-view {
display: flex;
align-items: center;
.left-view {
display: flex;
align-items: center;
.tag-view {
text-align: center;
width: 84rpx;
height: 40rpx;
color: #ffffff;
border-radius: 8rpx;
background-image: linear-gradient(to right, #ff930d, #ffc174);
font-size: 22rpx;
line-height: 42rpx;
&.active {
background-image: linear-gradient(to right, #2272ff, #47abff);
}
}
.tag-view {
text-align: center;
width: 84rpx;
height: 40rpx;
color: #FFFFFF;
border-radius: 8rpx;
background-image: linear-gradient(to right, #FF930D, #FFC174);
font-size: 22rpx;
line-height: 42rpx;
&.active {
background-image: linear-gradient(to right, #2272FF, #47ABFF);
}
}
.store-view {
color: #333333;
font-size: 36rpx;
font-weight: bold;
margin-left: 20rpx;
}
}
.store-view {
color: #333333;
font-size: 36rpx;
font-weight: bold;
margin-left: 20rpx;
}
}
.right-view {
text-align: center;
width: 100rpx;
height: 40rpx;
background-color: #f4f5f7;
border-radius: 20rpx;
color: #333333;
font-size: 22rpx;
line-height: 40rpx;
}
}
.right-view {
text-align: center;
width: 100rpx;
height: 40rpx;
background-color: #F4F5F7;
border-radius: 20rpx;
color: #333333;
font-size: 22rpx;
line-height: 40rpx;
}
}
.content-view {
.info-view {
text-align: left;
color: #333333;
font-size: 26rpx;
margin-top: 18rpx;
margin-bottom: 18rpx;
display: flex;
align-items: flex-start;
.content-view {
.info-view {
text-align: left;
color: #333333;
font-size: 26rpx;
margin-top: 18rpx;
margin-bottom: 18rpx;
display: flex;
align-items: flex-start;
.info-title {
flex-shrink: 0;
}
.info-content {
word-break: break-all;
}
}
.info-title {
flex-shrink: 0;
}
.info-content {
word-break: break-all;
}
}
.address-view {
display: flex;
align-items: flex-start;
justify-content: space-between;
color: #333333;
font-size: 24rpx;
margin-top: 20rpx;
.address-view {
display: flex;
align-items: flex-start;
justify-content: space-between;
color: #333333;
font-size: 24rpx;
margin-top: 20rpx;
.address-left-view {
display: flex;
align-items: center;
align-items: flex-start;
text-align: left;
.address-image {
width: 26rpx;
height: 28rpx;
margin-right: 8rpx;
flex-shrink: 0;
margin-top: 4rpx;
}
}
.address-left-view {
display: flex;
align-items: center;
align-items: flex-start;
text-align: left;
.address-right-view {
margin-left: 30rpx;
}
}
}
.address-image {
width: 26rpx;
height: 28rpx;
margin-right: 8rpx;
flex-shrink: 0;
margin-top: 4rpx;
}
}
.line-view {
background-color: #F4F5F7;
height: 2rpx;
width: 100%;
margin-top: 30rpx;
}
.address-right-view {
margin-left: 30rpx;
}
}
}
.reason-view {
text-align: left;
margin-top: 30rpx;
font-size: 26rpx;
color: #FA5A49;
display: flex;
align-items: flex-start;
display: flex;
.reason-title {
flex-shrink: 0;
color: #666666;
}
.reason-text {
display: flex;
flex-direction: column;
}
}
.line-view {
background-color: #f4f5f7;
height: 2rpx;
width: 100%;
margin-top: 30rpx;
}
.bottom-view {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 30rpx;
.reason-view {
text-align: left;
margin-top: 30rpx;
font-size: 26rpx;
color: #fa5a49;
display: flex;
align-items: flex-start;
display: flex;
.reason-title {
flex-shrink: 0;
color: #666666;
}
.reason-text {
display: flex;
flex-direction: column;
}
}
.bottom-left-view {
display: flex;
align-items: center;
.bottom-view {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 30rpx;
.bottom-tag-view {
width: 52rpx;
height: 52rpx;
border-radius: 26rpx;
color: #FFFFFF;
font-size: 26rpx;
background-color: #FF930D;
margin-right: 16rpx;
display: flex;
justify-content: center;
align-items: center;
.bottom-left-view {
display: flex;
align-items: center;
&.timeout {
background-color: #FA5A49;
}
}
}
.bottom-tag-view {
width: 52rpx;
height: 52rpx;
border-radius: 26rpx;
color: #ffffff;
font-size: 26rpx;
background-color: #ff930d;
margin-right: 16rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
&.timeout {
background-color: #fa5a49;
}
}
}
}
}
</style>
......@@ -72,29 +72,43 @@
return
}
let path = ''
let pass = true
if(photo.tempPath.origin && photo?.waterSetting?.hasOrigin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
await this.saveLocal(path).then(res => {
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
}
}).catch(e => {
uni.showToast({
icon: 'none',
title: e
})
pass = false
that.$parent.goBack()
})
}
// 如果用户不同意保存到相册
if(!pass) return
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path)
if(result1){
this.saveLocal(path).then(res => {
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
resolve()
}
}).catch(e => {
uni.showToast({
icon: 'none',
title: e
})
that.$parent.goBack()
})
}
})
},
......@@ -105,8 +119,25 @@
success() {
resolve(true)
},
fail() {
reject('保存失败')
fail(e) {
uni.showModal({
content: '拒绝授权将无法保存图片到本地,是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if (res.confirm) {
wx.openSetting({
success(res) {
resolve(true)
}
})
} else if(res.cancel) {
reject('保存失败')
}
},
fail() {
}
})
}
})
})
......
......@@ -8,8 +8,8 @@
<u-image :src="partsImage(info.images)" width="200rpx" height="200rpx" />
</view>
<view class="u-flex right-content">
<view class="right-content-name">{{ info.name }}</view>
<view class="right-content-desc">{{ info.remark }}</view>
<view class="right-content-name u-line-2">{{ info.name }}</view>
<view class="right-content-desc u-line-2">{{ info.remark }}</view>
<view class="u-flex right-content-opera">
<view class="no" v-if="info.stock">
可用{{ info.stock }}件
......@@ -81,6 +81,7 @@
overflow: hidden;
.right-img {
padding-right: 20rpx;
align-self: baseline;
}
.right-content {
flex: 1;
......@@ -91,8 +92,6 @@
font-size: 32rpx;
color: #333;
font-weight: bold;
height: 48rpx;
overflow: hidden;
}
.right-content-desc {
font-size: 24rpx;
......
......@@ -268,12 +268,6 @@
t()
},
cameraError(e) {
const {
errMsg
} = e.detail
if (errMsg !== 'insertCamera:fail auth deny') {
return
}
this.showSettingModal('camera')
},
//获取位置
......@@ -329,9 +323,12 @@
success(res) {
if (res.confirm) {
self.openSetting()
} else if(res.cancel) {
if (type === 'camera' || type === 'location') self.goBack()
}
},
fail() {}
fail() {
}
})
},
openSetting() {
......@@ -346,6 +343,8 @@
// 位置授权成功
self.authSetting.location = true
self.getLocation()
} else {
self.showSettingModal('location')
}
if (res.authSetting['scope.camera']) {
self.authSetting.camera = true
......
......@@ -749,6 +749,7 @@ export default {
},
// 安装文件
goToDocument() {
getApp().track("learn_goToDocument", {})
this.$u.route({
url: 'pages/order/document',
})
......@@ -826,6 +827,10 @@ export default {
},
//跳转到播放
goPlay(info) {
getApp().track("learn_allPlayCounts", {courseId: info.id})
if(info.title === "小程序使用指南") {
getApp().track("learn_guidePlayCounts", {courseId: info.id})
}
uni.navigateTo({
url:
"/pages/learn/section?section_id=" +
......@@ -834,13 +839,14 @@ export default {
info.id,
});
},
//跳转到
//跳转到消息详情页
bbb(e) {
var news = {
body: e.body,
title: e.title,
create_at: e.create_at,
};
getApp().track("learn_goToMessage", {})
let that = this;
wx.navigateTo({
url: "/pages/learn/news-details",
......
<template>
<TabBarPage title="订单" :fixed="true" @click="goTop">
<view class="tools-box">
<view class="search-sub">
<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"
bold>
</u-subsection>
</view>
<view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<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"
:is-scroll="false" font-size="28" bold></u-tabs>
</view>
<TabBarPage title="订单" :fixed="true" @click="goTop">
<view class="tools-box">
<view class="search-sub">
<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"
bold
>
</u-subsection>
</view>
<view class="search-btn" @click="handleClickSearch">
<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text>
</view>
</view>
<view class="u-tabs-box" v-show="curNow == 0">
<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"
:is-scroll="false"
font-size="28"
bold
></u-tabs>
</view>
<view class="tab-view">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" :scroll-top="scrollTop"
refresher-background="#F4F5F7" @refresherrefresh="onRefresh"
@refresherrestore="onRestore" @scroll="scroll" enable-back-to-top>
<view class="loading-view" v-if="!loaded && !_freshing">
<u-loading mode="flower"></u-loading>
</view>
<NoOrder v-else-if="noMore" imageName="zwdd.png" :customStyle="noOrderCustomStyle" />
<template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell :orderData="item" :type="orderType" :location="dataValue" @click="handleClick"
@action="handleClickCellButton"> </OrderCell>
</view>
<view class="load-more-view">
<u-loadmore v-show="(pageNumber == 1 && loaded) || pageNumber > 1" :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view>
</template>
</scroll-view>
</view>
</TabBarPage>
<view class="tab-view">
<scroll-view
scroll-y
style="height: 100%;width: 100%;"
@scrolltolower="reachBottom"
scroll-anchoring
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
:scroll-top="scrollTop"
refresher-background="#F4F5F7"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@scroll="scroll"
enable-back-to-top
>
<view class="loading-view" v-if="!loaded && !_freshing">
<u-loading mode="flower"></u-loading>
</view>
<NoOrder
v-else-if="noMore"
imageName="zwdd.png"
:customStyle="noOrderCustomStyle"
/>
<template v-else>
<view v-for="(item, index) in orderList" :key="item.orderId">
<OrderCell
:orderData="item"
:type="orderType"
:location="dataValue"
@click="handleClick"
@action="handleClickCellButton"
>
</OrderCell>
</view>
<view class="load-more-view">
<u-loadmore
v-show="(pageNumber == 1 && loaded) || pageNumber > 1"
:status="loadStatus"
bgColor="#F4F5F7"
></u-loadmore>
</view>
</template>
</scroll-view>
</view>
</TabBarPage>
</template>
<script>
import TabBarPage from "@/components/tabBarList/index.vue"
import OrderCell from "@/components/order/index.vue"
import NoOrder from "@/components/order/noOrder.vue"
import TabBarPage from '@/components/tabBarList/index.vue'
import OrderCell from '@/components/order/index.vue'
import NoOrder from '@/components/order/noOrder.vue'
export default {
components: {
TabBarPage,
OrderCell,
NoOrder,
},
data() {
return {
curNow: 0,
pageNumber: 0,
pageSize: 1000, // 因为需要排序,所以暂时去掉分页
orderList: [],
list: [
{
name: '待预约',
total: 0,
},
{
name: '待签到',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '审核中',
total: 0,
},
{
name: '异常单',
total: 0,
},
],
current: 0,
loadStatus: 'loading',
dataValue: [],
loaded: false,
triggered: true,
_freshing: false,
scrollTop: 0,
old: {
scrollTop: 0,
},
}
},
computed: {
subList() {
return ['待处理', '已完工']
},
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() {
return this.indexStatus[this.currentIndex]
},
currentIndex() {
return this.curNow == 0 ? this.current : 5
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
},
types() {
return {
waitAppointment: 0, // 待预约、
waitCheckIn: 1, // 待签到、
waitFinish: 2, // 待完工、
audit: 3, // 审核中、
exception: 4, // 异常单、
finish: 5, //已完工
}
},
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() {
return {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'audit',
4: 'exception',
5: 'finish',
}
},
countKeys() {
return [
'toAppointmentCount',
'toCheckinCount',
'toFinishCount',
'reviewingCount',
'exceptionCount',
]
},
noMore() {
return this.orderList.length == 0 && this.loaded
},
noOrderCustomStyle() {
return this.curNow == 0
? 'margin-top: 100rpx;background-color: #F4F5F7'
: 'margin-top: 200rpx;background-color: #F4F5F7'
},
},
onLoad(e) {
getApp().trackPage('订单首页')
this._freshing = false
if (e && e.type) {
this.current = e.type
}
},
onShow() {
this.reloadOrderInfo()
},
methods: {
sectionChange(index) {
this.curNow = index
this.reloadOrderList()
},
// tab栏切换
change(index) {
this.current = index
this.reloadOrderList()
},
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
},
// 页面数据
getOrderList(index) {
// 状态处理
this.pageNumber += 1
if (this.pageNumber == 1) {
this.loaded = false
}
var param = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.indexStatus[index],
}
var self = this
self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) {
if (res.data.type != self.orderType) return
export default {
components: {
TabBarPage,
OrderCell,
NoOrder
},
data() {
return {
curNow: 0,
pageNumber: 0,
pageSize: 20,
orderList: [],
list: [{
name: '待预约',
total: 0,
},
{
name: '待签到',
total: 0,
},
{
name: '待完工',
total: 0,
},
{
name: '审核中',
total: 0,
},
{
name: '异常单',
total: 0,
}
],
current: 0,
loadStatus: 'loading',
dataValue: [],
loaded: false,
triggered: true,
_freshing: false,
scrollTop: 0,
old: {
scrollTop: 0
}
};
},
computed: {
subList() {
return ['待处理', '已完工']
},
// 0:'去预约', 1:'去签到', 2:'去完工', 3:'审核中', 4:'去处理', 5'已完工'
orderType() {
return this.indexStatus[this.currentIndex]
},
currentIndex() {
return this.curNow == 0 ? this.current : 5
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
},
types() {
return {
'waitAppointment': 0, // 待预约、
'waitCheckIn': 1, // 待签到、
'waitFinish': 2, // 待完工、
'audit': 3, // 审核中、
'exception': 4, // 异常单、
'finish': 5, //已完工
}
},
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
indexStatus() {
return {
0: 'waitAppointment',
1: 'waitCheckIn',
2: 'waitFinish',
3: 'audit',
4: 'exception',
5: 'finish'
}
},
countKeys() {
return ['toAppointmentCount', 'toCheckinCount', 'toFinishCount', 'reviewingCount', 'exceptionCount']
},
noMore() {
return this.orderList.length == 0 && this.loaded
},
noOrderCustomStyle() {
return this.curNow == 0 ? 'margin-top: 100rpx;background-color: #F4F5F7' : 'margin-top: 200rpx;background-color: #F4F5F7'
}
},
onLoad(e) {
getApp().trackPage('订单首页')
this._freshing = false;
if (e && e.type) {
this.current = e.type
}
},
onShow() {
this.reloadOrderInfo()
},
methods: {
sectionChange(index) {
this.curNow = index;
this.reloadOrderList()
},
// tab栏切换
change(index) {
this.current = index;
this.reloadOrderList()
},
if (self.pageNumber == 1) {
self.orderList = []
}
if (res.data.list) {
self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) {
self.list[self.types[res.data.type]].total = res.data.total
}
self.orderList.sort((x, y) => {
return x.currentOverTime <= y.currentOverTime ? 1 : -1
})
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getOrderList(this.currentIndex)
},
// 页面数据
getOrderList(index) {
// 状态处理
this.pageNumber += 1
if (this.pageNumber == 1) {
this.loaded = false
}
var param = {
pageNumber: this.pageNumber,
pageSize: this.pageSize,
keyword: '',
type: this.indexStatus[index]
}
var self = this;
self.$u.api.listOrder(param).then((res) => {
if (res.code == 200) {
if (res.data.type != self.orderType) return
if (self.pageNumber == 1) {
self.orderList = []
}
if (res.data.list) {
self.orderList.push(...res.data.list)
if (self.list[self.types[res.data.type]]) {
self.list[self.types[res.data.type]].total = res.data.total
}
self.loadStatus = res.data.total > self.orderList.length && res.data.list.length == self.pageSize ? 'loadmore' : 'nomore'
}
} else {
console.log(res.message, "获取订单数量失败!");
}
self.$nextTick(()=>{
if (self._freshing) {
self.triggered = false;
self._freshing = false;
}
})
this.loaded = true
});
self.loadStatus =
res.data.total > self.orderList.length &&
res.data.list.length == self.pageSize
? 'loadmore'
: 'nomore'
}
} else {
console.log(res.message, '获取订单数量失败!')
}
self.$nextTick(() => {
if (self._freshing) {
self.triggered = false
self._freshing = false
}
})
this.loaded = true
})
},
},
// 获取订单数量
getOrderCount() {
var self = this
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
if (res.data) {
// 修改各个tab数量
var i = 0
var count = 0
for (var item of self.list) {
item.total = res.data[self.countKeys[i]]
count += item.total
i++
}
// 获取订单数量
getOrderCount() {
var self = this
self.$u.api.listOrderCount().then((res) => {
if (res.code == 200) {
if (res.data) {
// 修改各个tab数量
var i = 0
var count = 0
for (var item of self.list) {
item.total = res.data[self.countKeys[i]]
count += item.total
i++
}
// 修改tab总数
if (count > 0) {
uni.setTabBarBadge({
index: 1,
text: String(count)
})
} else {
uni.removeTabBarBadge({
index: 1
})
}
}
} else {
console.log(res.message, "获取订单数量失败!");
}
});
},
handleClickCellButton(item) {
// 去完工
uni.navigateTo({
url: 'pages/order/complete?orderId='+item.orderId
+ "&categoryId=" + item.categoryId
+ "&orderServiceType=" + item.orderServiceType
+ "&inGuaranteePeriod=" + item.inGuaranteePeriod
+ "&partnerCompanyId=" + item.partnerCompanyId
+ "&auditResultsId=" + (item.auditResults?Object.keys(item.auditResults)[Object.keys(item.auditResults).length - 1]:'')
+ "&maintainStep=" + item.maintainStep
+ '&orderStatus=' + item.orderStatus
+ '&brandId=' + item.lianbaoBrandId
})
},
handleClick(item, type, showCountTime) { // type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
//type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({
url: 'pages/order/detail?id=' + item.orderId + '&type=' + type + '&showCountTime=' + showCountTime
})
},
handleClickSearch() {
uni.navigateTo({
url: 'pages/order/search'
})
},
onRefresh() {
if (this._freshing) return;
this._freshing = true;
this.reloadOrderInfo()
},
onRestore() {
this.triggered = 'restore'; // 需要重置
},
reloadOrderInfo() {
this.reloadOrderList()
this.getOrderCount();
},
reloadOrderList() {
this.pageNumber = 0
this.loadStatus = 'loading'
this.getOrderList(this.currentIndex);
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop
},
goTop(e) {
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
});
},
}
};
// 修改tab总数
if (count > 0) {
uni.setTabBarBadge({
index: 1,
text: String(count),
})
} else {
uni.removeTabBarBadge({
index: 1,
})
}
}
} else {
console.log(res.message, '获取订单数量失败!')
}
})
},
handleClickCellButton(item) {
// 去完工
uni.navigateTo({
url:
'pages/order/complete?orderId=' +
item.orderId +
'&categoryId=' +
item.categoryId +
'&orderServiceType=' +
item.orderServiceType +
'&inGuaranteePeriod=' +
item.inGuaranteePeriod +
'&partnerCompanyId=' +
item.partnerCompanyId +
'&maintainStep=' +
item.maintainStep +
'&orderStatus=' +
item.orderStatus +
'&brandId=' +
item.lianbaoBrandId +
'&auditResults=' +
(item.auditResults ? Object.keys(item.auditResults).join() : ''),
})
},
handleClick(item, type, showCountTime) {
// type:类型,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
//type类型
// 'waitAccept': 待接单、待抢单;'waitAppointment': 待预约;'waitCheckIn': 待签到;'waitFinish': 待完工;'audit': 审核中;'exception': 异常单;'finish': 已完工;'other': 工单结算信息
uni.navigateTo({
url:
'pages/order/detail?id=' +
item.orderId +
'&type=' +
type +
'&showCountTime=' +
showCountTime,
})
},
handleClickSearch() {
uni.navigateTo({
url: 'pages/order/search',
})
},
onRefresh() {
if (this._freshing) return
this._freshing = true
this.reloadOrderInfo()
},
onRestore() {
this.triggered = 'restore' // 需要重置
},
reloadOrderInfo() {
this.reloadOrderList()
this.getOrderCount()
},
reloadOrderList() {
this.pageNumber = 0
this.loadStatus = 'loading'
this.getOrderList(this.currentIndex)
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop
},
goTop(e) {
this.scrollTop = this.old.scrollTop
this.$nextTick(function() {
this.scrollTop = 0
})
},
},
}
</script>
<style lang="scss" scoped>
.u-tabs-box {
margin-bottom: 30rpx;
}
.u-tabs-box {
margin-bottom: 30rpx;
}
.tab-view {
height: 100%;
overflow: auto;
// padding-bottom: 20rpx;
.load-more-view {
margin-bottom: 20rpx;
}
.loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 300rpx;
position: absolute;
}
}
.tab-view {
height: 100%;
overflow: auto;
// padding-bottom: 20rpx;
.load-more-view {
margin-bottom: 20rpx;
}
.loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 300rpx;
position: absolute;
}
}
.tools-box {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-bottom: 20rpx;
.tools-box {
display: flex;
flex-direction: row;
justify-content: space-between;
padding-bottom: 20rpx;
.search-sub {
height: 72rpx;
width: 320rpx;
}
.search-sub {
height: 72rpx;
width: 320rpx;
}
.search-btn {
height: 72rpx;
width: 220rpx;
background-color: #ffffff;
border-radius: 36rpx;
color: #999999;
display: flex;
justify-content: center;
align-items: center;
.search-btn {
height: 72rpx;
width: 220rpx;
background-color: #ffffff;
border-radius: 36rpx;
color: #999999;
display: flex;
justify-content: center;
align-items: center;
.search-image {
width: 36rpx;
height: 32rpx;
flex-shrink: 0;
margin-right: 24rpx;
}
.search-image {
width: 36rpx;
height: 32rpx;
flex-shrink: 0;
margin-right: 24rpx;
}
.search-btn-text {
line-height: 36rpx;
font-weight: 400;
font-size: 26rpx;
}
}
}
.search-btn-text {
line-height: 36rpx;
font-weight: 400;
font-size: 26rpx;
}
}
}
</style>
......@@ -77,6 +77,7 @@ export default {
});
},
goBaidu(a) {
getApp().track("mine_lookContract", {url: a})
getApp().globalData.contractUrl = a;
wx.navigateTo({
url: "./out",
......
......@@ -62,7 +62,12 @@
label-position="top"
:prop="item.fieldsName"
:border-bottom="false"
v-show="item.fieldsName != 'actualPaid' || show200"
v-show="
(item.fieldsName != 'actualPaid' || show200) &&
((readOnly &&
!$u.test.isEmpty(form[item.fieldsName])) ||
!readOnly)
"
:id="`item${item.fieldsId}`"
>
<view
......@@ -84,7 +89,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="item.disabled || false"
:disabled="readOnly || item.disabled || false"
:slotContent="item.fieldsInfo"
@value-change="fieldValueChange"
>
......@@ -95,6 +100,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-multi-input>
......@@ -104,7 +110,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="item.disabled || false"
:disabled="readOnly || item.disabled || false"
@value-change="fieldValueChange"
>
</xh-radio>
......@@ -114,6 +120,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-checkbox>
......@@ -123,6 +130,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-select>
......@@ -132,6 +140,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-specifications>
......@@ -144,10 +153,11 @@
:partnerCompanyId="partnerCompanyId"
:categoryId="categoryId"
:value="form[item.fieldsName] || []"
:disabled="readOnly"
@value-change="fieldValueChange"
>
<template v-slot>
<view class="img-list">
<view class="img-list" v-if="!readOnly">
<u-image
class="pic"
width="160rpx"
......@@ -173,6 +183,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-location>
......@@ -182,6 +193,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-scan>
......@@ -195,6 +207,7 @@
:orderServiceType="orderServiceType"
:specificationId="form['specificationId'] || 0"
:value="form[item.fieldsName]"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-service-measure>
......@@ -204,6 +217,7 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-time>
......@@ -214,6 +228,7 @@
:item="item"
:order-id="orderId"
:value="form[item.fieldsName] || ''"
:disabled="readOnly"
@value-change="fieldValueChange"
>
</xh-service-more>
......@@ -235,7 +250,11 @@
:itemIndex="itemIndex"
:item="item"
:value="form[item.fieldsName] || ''"
:disabled="orderStatus === '88' || orderStatus === '86'"
:disabled="
orderStatus === '88' ||
orderStatus === '86' ||
readOnly
"
@value-change="fieldValueChange"
>
</xh-parts>
......@@ -247,9 +266,16 @@
</u-form>
</scroll-view>
</view>
<view :class="['btn-wrap', 'flex-xc', { 'btn-bottom': tabIndex > 0 }]">
<view
:class="[
'btn-wrap',
'flex-xc',
{ 'btn-bottom': tabIndex > 0, 'read-only': readOnly },
]"
>
<u-button
class="btn-submit"
v-if="!readOnly"
@click="saveComplete"
type="primary"
shape="circle"
......@@ -266,7 +292,15 @@
shape="circle"
:hover-class="submitStatus ? '' : 'none'"
>
{{ tabIndex === list.length - 1 ? "提交" : "下一步" }}
{{
tabIndex === list.length - 1
? readOnly
? '返回列表'
: '提交'
: readOnly
? '查看下一步'
: '下一步'
}}
</u-button>
</view>
</view>
......@@ -286,53 +320,53 @@
</view>
</template>
<script>
import XhInput from "@/components/createCom/XhInput.vue";
import XhMultiInput from "@/components/createCom/XhMultiInput.vue";
import XhRadio from "@/components/createCom/XhRadio.vue";
import XhCheckbox from "@/components/createCom/XhCheckbox.vue";
import XhSelect from "@/components/createCom/XhSelect.vue";
import XhSpecifications from "@/components/createCom/XhSpecifications.vue";
import XhFiles from "@/components/createCom/XhFiles.vue";
import XhLocation from "@/components/createCom/XhLocation.vue";
import XhScan from "@/components/createCom/XhScan.vue";
import XhTime from "@/components/createCom/XhTime.vue";
import XhServiceMeasure from "@/components/createCom/XhServiceMeasure.vue";
import XhServiceMore from "../../components/createCom/XhServiceMore";
import XhLabel from "../../components/createCom/XhLabel";
import XhParts from "@/components/createCom/XhParts";
import takePhoto from "@/components/take/index.vue";
import baseFile from "@/components/upload/index";
import Detail from "@/components/order/detail.vue";
import returnPartsVue from "../parts/returnParts.vue";
import XhInput from '@/components/createCom/XhInput.vue'
import XhMultiInput from '@/components/createCom/XhMultiInput.vue'
import XhRadio from '@/components/createCom/XhRadio.vue'
import XhCheckbox from '@/components/createCom/XhCheckbox.vue'
import XhSelect from '@/components/createCom/XhSelect.vue'
import XhSpecifications from '@/components/createCom/XhSpecifications.vue'
import XhFiles from '@/components/createCom/XhFiles.vue'
import XhLocation from '@/components/createCom/XhLocation.vue'
import XhScan from '@/components/createCom/XhScan.vue'
import XhTime from '@/components/createCom/XhTime.vue'
import XhServiceMeasure from '@/components/createCom/XhServiceMeasure.vue'
import XhServiceMore from '../../components/createCom/XhServiceMore'
import XhLabel from '../../components/createCom/XhLabel'
import XhParts from '@/components/createCom/XhParts'
import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index'
import Detail from '@/components/order/detail.vue'
import returnPartsVue from '../parts/returnParts.vue'
// 表单类型map
const formType = new Map([
["text", ["input", "textarea"]],
["password", ["password", "input"]],
["textarea", ["input", "digit"]],
["number", ["input", "digit"]],
["decimal", ["input", "digit"]],
["double", ["input", "digit"]],
["integer", ["input", "digit"]],
["string", ["input", "text"]],
["jscode", ["input", "text"]],
["multiinput", ["multiinput", "text"]],
["select", ["select", "text"]],
["specifications", ["select-new-page", "text"]],
["radio", ["radio", "text"]],
["checkbox", ["checkbox", "text"]],
["file", ["file", "text"]],
["photos", ["file", "text"]],
["location", ["location", "text"]],
["scan", ["scan", "text"]],
["machine_code", ["scan", "text"]],
["service_measures", ["servicemeasure", "text"]],
["time", ["time", "text"]],
["date", ["time", "text"]],
["form", ["form", "text"]],
["label", ["label", "text"]],
["parts", ["parts", "text"]],
]);
['text', ['input', 'textarea']],
['password', ['password', 'input']],
['textarea', ['input', 'digit']],
['number', ['input', 'digit']],
['decimal', ['input', 'digit']],
['double', ['input', 'digit']],
['integer', ['input', 'digit']],
['string', ['input', 'text']],
['jscode', ['input', 'text']],
['multiinput', ['multiinput', 'text']],
['select', ['select', 'text']],
['specifications', ['select-new-page', 'text']],
['radio', ['radio', 'text']],
['checkbox', ['checkbox', 'text']],
['file', ['file', 'text']],
['photos', ['file', 'text']],
['location', ['location', 'text']],
['scan', ['scan', 'text']],
['machine_code', ['scan', 'text']],
['service_measures', ['servicemeasure', 'text']],
['time', ['time', 'text']],
['date', ['time', 'text']],
['form', ['form', 'text']],
['label', ['label', 'text']],
['parts', ['parts', 'text']],
])
/**
* modal 弹窗校验
......@@ -345,80 +379,80 @@ const formType = new Map([
const actions = (name, pass, type, submit) => {
const handerProgrom = {
perfect: {
confirmText: "去完善",
action: "handerProgrom",
confirmText: '去完善',
action: 'handerProgrom',
},
appointment: {
confirmText: "好的,再次预约",
action: "appointment",
confirmText: '好的,再次预约',
action: 'appointment',
},
next: {
confirmText: "下一步",
action: "nextAction",
confirmText: '下一步',
action: 'nextAction',
},
noPerfectSubmit: {
confirmText: "去完善",
action: "handerProgrom",
cancelText: "部分提交",
cancelAction: "appointment",
confirmText: '去完善',
action: 'handerProgrom',
cancelText: '部分提交',
cancelAction: 'appointment',
},
submit: {
confirmText: "提交",
action: "orderFinish",
confirmText: '提交',
action: 'orderFinish',
},
confirm: {
confirmText: "确定",
action: "nextAction",
cancelText: "取消",
cancelAction: "closeCheckResult",
confirmText: '确定',
action: 'nextAction',
cancelText: '取消',
cancelAction: 'closeCheckResult',
},
};
if (name === "partnerInspectItem") {
}
if (name === 'partnerInspectItem') {
// 勘察
if (!pass) return handerProgrom.perfect;
if (!pass) return handerProgrom.perfect
return type
? type === "01"
? type === '01'
? handerProgrom.next
: handerProgrom.appointment
: handerProgrom.perfect;
} else if (name === "partnerInstallItem") {
: handerProgrom.perfect
} else if (name === 'partnerInstallItem') {
// 安装
let hander = "";
let hander = ''
switch (type) {
case "01": // 安装完成
hander = !pass ? handerProgrom.perfect : handerProgrom.next;
break;
case "02": // 二次安装
case '01': // 安装完成
hander = !pass ? handerProgrom.perfect : handerProgrom.next
break
case '02': // 二次安装
hander = !pass
? handerProgrom.noPerfectSubmit
: handerProgrom.appointment;
break;
case "03": //不安装
hander = handerProgrom.confirm;
break;
: handerProgrom.appointment
break
case '03': //不安装
hander = handerProgrom.confirm
break
default:
hander = handerProgrom.perfect;
break;
hander = handerProgrom.perfect
break
}
return hander;
return hander
} else {
// 基础信息
if (!pass) return handerProgrom.perfect;
return submit ? handerProgrom.submit : handerProgrom.next;
if (!pass) return handerProgrom.perfect
return submit ? handerProgrom.submit : handerProgrom.next
}
};
}
export default {
data() {
return {
hiddenTitle: ["location", "form", "label", "parts"],
hiddenTitle: ['location', 'form', 'label', 'parts'],
orderId: 0,
categoryId: 0,
brandId: 0,
orderServiceType: "",
inGuaranteePeriod: "",
partnerCompanyId: "",
auditResultsId: "",
orderServiceType: '',
inGuaranteePeriod: '',
partnerCompanyId: '',
auditResults: [],
list: [],
tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置
......@@ -426,8 +460,8 @@ export default {
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: "", // 栏目右边scroll-view用于滚动的id
oldItemId: "",
itemId: '', // 栏目右边scroll-view用于滚动的id
oldItemId: '',
menuItemPos: [],
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
......@@ -439,10 +473,10 @@ export default {
completeCheck: {
status: false,
resulut: [],
confirmText: "去完善",
cancelText: "",
action: "",
cancelAction: "",
confirmText: '去完善',
cancelText: '',
action: '',
cancelAction: '',
},
waitHandlerPanelIndex: 0,
waitHandlerGroupIndex: 0,
......@@ -451,20 +485,20 @@ export default {
// 上传组件相关
carmeraList: [
{
text: "相册",
text: '相册',
},
{
text: "拍照",
text: '拍照',
},
],
maskShow: false,
takeStatus: false,
currentItemDate: {},
photoItem: {},
maintainStep: "partnerInspectItem",
orderStatus: "",
maintainStep: 'partnerInspectItem',
orderStatus: '',
// showTab: true,
};
}
},
components: {
XhInput,
......@@ -482,187 +516,234 @@ export default {
XhLabel,
XhParts,
Detail,
"take-photo": takePhoto,
'take-photo': takePhoto,
},
mixins: [baseFile],
created() {
// console.log(allComponents,'allComponents')
},
onLoad(option) {
getApp().trackPage("订单完工信息页");
getApp().trackPage('订单完工信息页')
if (option) {
this.maintainStep = option.maintainStep;
this.orderId = option.orderId;
this.categoryId = option.categoryId;
this.brandId = option.brandId;
this.orderServiceType = decodeURIComponent(option.orderServiceType);
this.inGuaranteePeriod = option.inGuaranteePeriod;
this.partnerCompanyId = option.partnerCompanyId;
this.auditResultsId = option.auditResultsId;
this.orderStatus = option.orderStatus;
this.maintainStep = option.maintainStep
this.orderId = option.orderId
this.categoryId = option.categoryId
this.brandId = option.brandId
this.orderServiceType = decodeURIComponent(option.orderServiceType)
this.inGuaranteePeriod = option.inGuaranteePeriod
this.partnerCompanyId = option.partnerCompanyId
this.orderStatus = option.orderStatus
this.auditResults = option?.auditResults
? option?.auditResults.split(',')
: []
// this.showTab =item.partnerCompanyName == '挚达充电桩'
} else {
this.orderId = 11880091;
this.categoryId = 1100000214;
this.orderServiceType = "安装";
this.inGuaranteePeriod = "Y";
this.orderId = 11880091
this.categoryId = 1100000214
this.orderServiceType = '安装'
this.inGuaranteePeriod = 'Y'
}
this.getCompleteData();
this.getCompleteData()
},
updated() {
//console.log(this.form.name, 'form.name')
},
computed: {
readOnly() {
return [80, 81, 85, 87, 89, 110].indexOf(Number(this.orderStatus)) != -1
},
tabList() {
// 没有数据的时候tab要有占位数据,不然有页面有晃动
return this.list.length > 0
? this.list[this.tabIndex].items
: [{ name: "" }];
: [{ name: '' }]
},
mixingImage() {
return process.uniEnv.qn_base_url + "mixing.png";
return process.uniEnv.qn_base_url + 'mixing.png'
},
uploadImage() {
return process.uniEnv.qn_base_url + "upload-file.png";
return process.uniEnv.qn_base_url + 'upload-file.png'
},
buttonStyle() {
return {
color: "#FFFFFF",
"background-color": "#2272FF;",
width: "300rpx",
height: "104rpx",
"font-size": "32rpx",
"font-weight": "bold",
"margin-left": "50rpx",
};
color: '#FFFFFF',
'background-color': '#2272FF;',
width: '300rpx',
height: '104rpx',
'font-size': '32rpx',
'font-weight': 'bold',
'margin-left': '50rpx',
}
},
customStyle() {
return {
"background-color": "#D1D4D4",
width: "300rpx",
height: "104rpx",
"background-color": "transparent",
border: "1px solid #2272FF",
color: "#2272FF",
"font-weight": "bold",
"font-size": "32rpx",
};
'background-color': '#D1D4D4',
width: '300rpx',
height: '104rpx',
'background-color': 'transparent',
border: '1px solid #2272FF',
color: '#2272FF',
'font-weight': 'bold',
'font-size': '32rpx',
}
},
show200() {
return (
this.form.paymentMethodsType && this.form.paymentMethodsType != "03"
);
this.form.paymentMethodsType && this.form.paymentMethodsType != '03'
)
},
},
methods: {
getCompleteData() {
//获取工单配置的完工项目
uni.showLoading({
title: "加载中",
});
title: '加载中',
})
if (this.orderId) {
this.$u.api.getCompleteConfigAndData(this.orderId).then((res) => {
if (res.code == 200) {
this.initData(res);
this.initData(res)
} else {
this.$refs.uToast.show({
title: res.message || res.data,
type: "error",
});
type: 'error',
})
}
});
})
}
},
initData(res) {
this.form = res.data.value || {};
this.initFormData();
const list = res.data.config.sort((a, b) => a.order - b.order);
this.form = res.data.value || {}
this.initFormData()
const list = res.data.config.sort((a, b) => a.order - b.order)
if (this.readOnly) this.tabIndex = 0
list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName) this.tabIndex = index;
if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
this.tabIndex = index
}
item.items.forEach((v) => {
v.items.forEach((d) => {
const type = d.fieldsType.toLocaleLowerCase();
const formMap = formType.get(type) || formType.get("text");
d.formType = formMap[0];
d.inputType = formMap[1];
if (d.fieldsName === "actualPaid" && res.data.value) {
d.required = res.data.value["paymentMethodsType"]
? res.data.value["paymentMethodsType"] != "03"
: false;
const type = d.fieldsType.toLocaleLowerCase()
const formMap = formType.get(type) || formType.get('text')
d.formType = formMap[0]
d.inputType = formMap[1]
if (d.fieldsName === 'actualPaid' && res.data.value) {
d.required = res.data.value['paymentMethodsType']
? res.data.value['paymentMethodsType'] != '03'
: false
}
if (d.fieldsName === "pipe" || d.fieldsName === "pipeUseLength") {
if (d.fieldsName === 'pipe' || d.fieldsName === 'pipeUseLength') {
// 申请费用计算
this.calcMoney();
this.calcMoney()
}
if (d.fieldsName === "materialList") {
d.subtitle = "(必填项)";
if (d.fieldsName === 'materialList') {
d.subtitle = '(必填项)'
}
if (d.fieldsName === "craftList") {
d.subtitle = "(若有增项,则为必填项)";
if (d.fieldsName === 'craftList') {
d.subtitle = '(若有增项,则为必填项)'
}
});
});
});
})
})
})
this.list = list;
// this.showTab = this.list.length > 1
// 异常单处理
if (this.auditResultsId) this.checkCompleteError();
uni.hideLoading();
if (
this.auditResults.length > 0 &&
(this.orderStatus === '88' || this.orderStatus === '86')
) {
this.checkCompleteError(list)
} else {
this.list = list
}
uni.hideLoading()
},
initFormData() {
this.loadOrderDetail();
this.loadOrderDetail()
},
loadOrderDetail() {
if (!this.$u.test.isEmpty(this.form) && this.form.hasOwnProperty("installComfirmTime")
&& this.$u.test.isEmpty(this.form.installComfirmTime)) {
if (
!this.$u.test.isEmpty(this.form) &&
this.form.hasOwnProperty('installComfirmTime') &&
this.$u.test.isEmpty(this.form.installComfirmTime)
) {
this.$u.api.orderDetail(null, this.orderId).then((res) => {
if (res.code == 200) {
if (!this.$u.test.isEmpty(res.data.checkInDateTime)) {
this.$set(
this.form,
"installComfirmTime",
this.moment(res.data.checkInDateTime).format("YYYY-MM-DD")
);
'installComfirmTime',
this.moment(res.data.checkInDateTime).format('YYYY-MM-DD')
)
}
}
});
})
}
},
checkCompleteError() {
checkCompleteError(list) {
// 异常单定位错误项
let self = this;
self.list.forEach((panel, panelIndex) => {
let errArr = []
list.forEach((panel, panelIndex) => {
panel.items.forEach((group, groupIndex) => {
group.items.forEach((ele, eleIndex) => {
if (ele.fieldsName === self.auditResultsId) {
self.waitHandlerPanelIndex = panelIndex;
self.waitHandlerGroupIndex = groupIndex;
self.waitHandlerEleIndex = eleIndex;
self.oldItemId = `item${ele.fieldsId}`;
if (this.auditResults.includes(ele.fieldsName)) {
const errGroup = {
componentType: group.componentType,
name: group.name,
items: ele,
}
errArr.push(errGroup)
}
});
});
});
this.locationCompleteItem(
self.waitHandlerPanelIndex,
self.waitHandlerGroupIndex,
self.waitHandlerEleIndex
);
})
})
})
const result = errArr.reduce((groups, item) => {
let groupFound = groups.find((arrItem) => item.name === arrItem.name)
if (groupFound) {
groupFound.componentType = item.componentType
if (groupFound.items.indexOf(item.items) == -1) {
//去重
groupFound.items.push(item.items)
}
} else {
//不要直接在原来的对象修改,新建对象
let newGroup = {
name: item.name,
componentType: item.componentType,
items: [item.items],
}
groups.push(newGroup)
}
return groups
}, [])
let index = list.length++
list[index] = {
order: index + 1,
panelFieldsName: 'error',
panelName: '异常处理',
items: result,
}
this.list = list
this.tabIndex = index
},
handleSaveData() {
let param = {};
const name = this.list[this.tabIndex].panelFieldsName;
let param = {}
const name = this.list[this.tabIndex].panelFieldsName
this.list.forEach((panel) => {
param[panel.panelFieldsName] = [];
param[panel.panelFieldsName] = []
panel.items.forEach((group) => {
group.items.forEach((ele) => {
if(name === "partnerInspectItem") {
if(!this.form?.installationMethodType) {
this.$set(this.form, "installationMethodType", this.form.installType);
if (name === 'partnerInspectItem') {
if (!this.form?.installationMethodType) {
this.$set(
this.form,
'installationMethodType',
this.form.installType
)
}
}
if (this.form[ele.fieldsName]) {
......@@ -671,96 +752,95 @@ export default {
fieldsType: ele.fieldsType,
fieldsValue: this.form[ele.fieldsName],
required: ele.required,
});
})
}
});
});
});
return param;
})
})
})
return param
},
saveComplete() {
// 保存完工信息
// this.submitParts() // 不调这个接口;没完工不能调提交配件
const param = this.handleSaveData();
const param = this.handleSaveData()
this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
if (res.code == 200) {
this.$refs.uToast.show({
title: "保存成功",
type: "success",
});
title: '保存成功',
type: 'success',
})
} else {
this.$refs.uToast.show({
title: res.message || res.data,
type: "error",
});
type: 'error',
})
}
});
})
},
checkCompleteItem() {
let checkResult = [];
let pass = true;
let first = true;
const lists = this.tabList;
let checkResult = []
let pass = true
let first = true
const lists = this.tabList
lists.forEach((group, groupIndex) => {
const checkRequired = group.items.some((v) => v.required);
const checkRequired = group.items.some((v) => v.required)
if (checkRequired) {
let panelResult = {
label: group.name,
submitted: 0,
required: 0,
pass: true,
};
}
group.items.forEach((ele, eleIndex) => {
if (ele.required) {
panelResult.required++;
let value = this.form[ele.fieldsName];
panelResult.required++
let value = this.form[ele.fieldsName]
if (value && !Array.isArray(value)) {
panelResult.submitted++;
panelResult.submitted++
} else if (value && Array.isArray(value) && value.length > 0) {
if (ele.fieldsName === "materialList") {
let hasMate = false;
if (ele.fieldsName === 'materialList') {
let hasMate = false
let mateRow = value.find((mate) => {
if (mate.hasOwnProperty("useLength")) {
hasMate = true;
return !this.$u.test.isEmpty(mate.useLength);
if (mate.hasOwnProperty('useLength')) {
hasMate = true
return !this.$u.test.isEmpty(mate.useLength)
}
});
})
if (!hasMate || !this.$u.test.isEmpty(mateRow)) {
panelResult.submitted++;
panelResult.submitted++
}
panelResult.submitted++;
panelResult.submitted++
} else {
panelResult.submitted++;
panelResult.submitted++
}
} else if (first) {
// 记录第一个 为空 并且需要必填的项 用于定位
first = false;
this.waitHandlerPanelIndex = this.tabIndex;
this.waitHandlerGroupIndex = groupIndex;
this.waitHandlerEleIndex = eleIndex;
this.oldItemId = `item${ele.fieldsId}`;
first = false
this.waitHandlerPanelIndex = this.tabIndex
this.waitHandlerGroupIndex = groupIndex
this.waitHandlerEleIndex = eleIndex
this.oldItemId = `item${ele.fieldsId}`
}
}
});
panelResult.pass = panelResult.required <= panelResult.submitted;
pass = pass && panelResult.pass;
checkResult.push(panelResult);
})
panelResult.pass = panelResult.required <= panelResult.submitted
pass = pass && panelResult.pass
checkResult.push(panelResult)
}
});
})
console.log(checkResult);
this.completeCheck.result = checkResult;
return pass;
this.completeCheck.result = checkResult
return pass
},
// 检查结果窗口取消回调
closeCheckResult() {
this.completeCheck.status = false;
this[this.completeCheck.cancelAction]();
this.completeCheck.status = false
this[this.completeCheck.cancelAction]()
},
// 检查结果窗口 确认回调
confirm() {
this.completeCheck.status = false;
this[this.completeCheck.action]();
this.completeCheck.status = false
this[this.completeCheck.action]()
},
// 去完善
handerProgrom() {
......@@ -768,50 +848,64 @@ export default {
this.waitHandlerPanelIndex,
this.waitHandlerGroupIndex,
this.waitHandlerEleIndex
);
)
},
// 去预约
async appointment() {
const save = await this.nextStepSaveData();
const save = await this.nextStepSaveData()
if (save) {
uni.reLaunch({
url: "/pages/index/order?type=0",
});
url: '/pages/index/order?type=0',
})
}
},
// 下一步动作
async nextAction() {
const save = await this.nextStepSaveData();
if (this.tabIndex < this.list.length - 1 && save) {
this.tabIndex++;
this.arr = [];
this.scrollRightTop = 0;
this.current = 0;
const save = await this.nextStepSaveData()
if (save) {
this.nextTab()
}
},
nextTab() {
if (this.tabIndex < this.list.length - 1) {
this.tabIndex++
this.arr = []
this.scrollRightTop = 0
this.current = 0
//this.itemId = ''
//const itemId = this.list[this.tabIndex].items[0].items[0].fieldsId
//this.oldItemId = `item${itemId}`
this.$nextTick(async () => {
await this.swichMenu(0);
});
await this.swichMenu(0)
})
}
},
// 下一步弹窗处理
nextStep() {
this.pass = this.checkCompleteItem();
if (this.readOnly) {
if (this.tabIndex === this.list.length - 1) {
uni.navigateBack()
} else {
this.nextTab()
}
return
}
this.pass = this.checkCompleteItem()
const name = this.list[this.tabIndex].panelFieldsName;
const name = this.list[this.tabIndex].panelFieldsName
const type =
name === "partnerInspectItem"
name === 'partnerInspectItem'
? this.form.inspectConclusionType
: this.form.constructionConclusionType;
const submit = this.tabIndex === this.list.length - 1;
const result = actions(name, this.pass, type, submit);
: this.form.constructionConclusionType
const submit = this.tabIndex === this.list.length - 1
const result = actions(name, this.pass, type, submit)
this.completeCheck.status = true;
this.completeCheck.confirmText = result.confirmText;
this.completeCheck.action = result.action;
this.completeCheck.cancelText = result.cancelText || "";
this.completeCheck.cancelAction = result.cancelAction || "";
this.completeCheck.status = true
this.completeCheck.confirmText = result.confirmText
this.completeCheck.action = result.action
this.completeCheck.cancelText = result.cancelText || ''
this.completeCheck.cancelAction = result.cancelAction || ''
},
// 下一步数据保存
nextStepSaveData() {
......@@ -819,274 +913,274 @@ export default {
maintainFields: this.handleSaveData(),
currentStep: this.list[this.tabIndex].panelFieldsName,
nextStep: this.list[this.tabIndex + 1].panelFieldsName,
};
}
uni.showLoading({
title: "加载中",
});
title: '加载中',
})
return this.$u.api.completeNextStep(params, this.orderId).then((res) => {
uni.hideLoading();
uni.hideLoading()
if (res.code == 200) {
return Promise.resolve(true);
return Promise.resolve(true)
} else {
this.$refs.uToast.show({
title: res.message || res.data,
type: "error",
});
return Promise.resolve(false);
type: 'error',
})
return Promise.resolve(false)
}
});
})
},
locationCompleteItem(panelIndex, groupIndex, eleIndex) {
// 页面定位到某一项
this.tabIndex = panelIndex;
this.current = groupIndex;
this.itemId = "";
this.$nextTick(function () {
if (this.oldItemId) this.itemId = this.oldItemId;
});
this.tabIndex = panelIndex
this.current = groupIndex
this.itemId = ''
this.$nextTick(function() {
if (this.oldItemId) this.itemId = this.oldItemId
})
},
// 提交配件信息
submitParts() {
if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts);
const lists = orderSpareParts.filter((v) => v.quantity > 0);
const orderSpareParts = JSON.parse(this.form.orderSpareParts)
const lists = orderSpareParts.filter((v) => v.quantity > 0)
const params = {
workOrderId: this.orderId,
applyType: "10",
parts: lists ? JSON.stringify(lists) : "",
};
applyType: '10',
parts: lists ? JSON.stringify(lists) : '',
}
this.$u.api.createParts(params).then((res) => {
if (res.code !== 200) {
this.$refs.uToast.show({
title: res.data,
type: "error",
});
type: 'error',
})
}
});
})
}
},
// 提交订单
orderFinish() {
const param = this.handleSaveData();
const param = this.handleSaveData()
// 完工事件埋点
getApp().track("order_finish", {
getApp().track('order_finish', {
id: this.vuex_user.id,
mobile: this.vuex_user.mobile,
orderId: Number(this.orderId),
});
})
this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
if (res.code == 200) {
//完工项信息保存成功再次完工工单
if (this.inGuaranteePeriod === "Y") {
if (this.inGuaranteePeriod === 'Y') {
this.$u.api.inOrderFinish(this.orderId).then((res) => {
if (res.code == 200) {
this.submitParts();
this.submitParts()
this.$refs.uToast.show({
title: "提交成功",
type: "success",
title: '提交成功',
type: 'success',
callback: () => {
uni.reLaunch({
url: "/pages/index/order?type=3",
});
url: '/pages/index/order?type=3',
})
},
});
})
} else {
this.$refs.uToast.show({
title: res.data,
type: "error",
});
type: 'error',
})
}
});
})
} else {
this.$u.api
.outOrderFinish({ customerPayType: "CASH" }, this.orderId)
.outOrderFinish({ customerPayType: 'CASH' }, this.orderId)
.then((res) => {
if (res.code == 200) {
this.$refs.uToast.show({
title: "提交成功",
type: "success",
title: '提交成功',
type: 'success',
callback: () => {
uni.reLaunch({
url: "/pages/index/order?type=3",
});
url: '/pages/index/order?type=3',
})
},
});
})
} else {
this.$refs.uToast.show({
title: res.data,
type: "error",
});
type: 'error',
})
}
});
})
}
} else {
this.$refs.uToast.show({
title: res.data,
type: "error",
});
type: 'error',
})
}
});
})
},
calMaterialCraftListAmount(arr) {
let amount = 0;
let amount = 0
if (arr) {
arr.forEach((item) => {
let useLength =
(item.hasOwnProperty("useLength") && Number(item.useLength)) || 0;
(item.hasOwnProperty('useLength') && Number(item.useLength)) || 0
let freeLength =
(item.hasOwnProperty("freeLength") && Number(item.freeLength)) || 0;
(item.hasOwnProperty('freeLength') && Number(item.freeLength)) || 0
let unitAmt =
(item.hasOwnProperty("unitAmt") && Number(item.unitAmt)) || 0;
amount += Math.max(useLength - freeLength, 0) * unitAmt;
if (item.hasOwnProperty("extraAmt") && Number(item.extraAmt)) {
amount += Number(item.extraAmt);
(item.hasOwnProperty('unitAmt') && Number(item.unitAmt)) || 0
amount += Math.max(useLength - freeLength, 0) * unitAmt
if (item.hasOwnProperty('extraAmt') && Number(item.extraAmt)) {
amount += Number(item.extraAmt)
}
});
})
}
return amount;
return amount
},
setData(data) {
// 通过页面设置数据
Object.keys(data).forEach((key) => {
this.$set(this.form, key, data[key]);
});
this.$set(this.form, key, data[key])
})
// 更新预计超出金额
let amount = 0;
amount += this.calMaterialCraftListAmount(this.form.materialList);
amount += this.calMaterialCraftListAmount(this.form.craftList);
this.$set(this.form, "overAmount", amount || 0);
let amount = 0
amount += this.calMaterialCraftListAmount(this.form.materialList)
amount += this.calMaterialCraftListAmount(this.form.craftList)
this.$set(this.form, 'overAmount', amount || 0)
},
// 字段的值更新
fieldValueChange(data) {
const groupItem = this.list[this.tabIndex].items[data.groupIndex];
let innerItem;
const groupItem = this.list[this.tabIndex].items[data.groupIndex]
let innerItem
if (groupItem.items) {
innerItem = groupItem.items[data.itemIndex];
innerItem = groupItem.items[data.itemIndex]
}
if (innerItem.fieldsType === "multiInput") {
if (innerItem.fieldsType === 'multiInput') {
// 多个输入框的值触发
let key = Object.keys(data.value)[0];
this.form[key] = data.value[key];
let key = Object.keys(data.value)[0]
this.form[key] = data.value[key]
} else {
this.$set(this.form, innerItem.fieldsName, data.value);
this.$set(this.form, innerItem.fieldsName, data.value)
}
if (innerItem.fieldsName === "paymentMethodsType") {
if (innerItem.fieldsName === 'paymentMethodsType') {
// 选不需要收款的时候,收款金额修改为非必选
const row = groupItem.items.find((v) => v.fieldsName === "actualPaid");
row.required = data.value != "03";
const row = groupItem.items.find((v) => v.fieldsName === 'actualPaid')
row.required = data.value != '03'
}
if (
innerItem.fieldsName === "pipe" ||
innerItem.fieldsName === "pipeUseLength"
innerItem.fieldsName === 'pipe' ||
innerItem.fieldsName === 'pipeUseLength'
) {
// 申请费用计算
this.calcMoney();
this.calcMoney()
}
},
// 申请费用计算
calcMoney() {
const price = parseInt(this.form.pipe) || 0;
const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0;
const price = parseInt(this.form.pipe) || 0
const pipeUseLength = parseFloat(this.form.pipeUseLength) || 0
if (price && pipeUseLength) {
const money = (price * pipeUseLength).toFixed(2);
this.$set(this.form, "pipeAmount", money);
const money = (price * pipeUseLength).toFixed(2)
this.$set(this.form, 'pipeAmount', money)
} else {
this.$set(this.form, "pipeAmount", 0);
this.$set(this.form, 'pipeAmount', 0)
}
},
// ------------------------- 以下方法为上传组件相关 -------------------------
// 弹出上传选项
selectUpload(item, groupIndex, itemIndex) {
const imgList =
this.$refs[`fileChild${groupIndex}${itemIndex}`][0].imgList;
const imgList = this.$refs[`fileChild${groupIndex}${itemIndex}`][0]
.imgList
if (imgList.length === 10) {
return this.$refs.uToast.show({
title: "图片已超出最大数量",
type: "error",
});
title: '图片已超出最大数量',
type: 'error',
})
}
this.photoItem = {
...JSON.parse(item),
groupIndex,
itemIndex,
};
}
// 弹窗展示
this.maskShow = true;
this.maskShow = true
},
// 区分上传动作
uploadSelect(index) {
if (index === 0) {
this.uploadFile("photo");
this.uploadFile('photo')
} else {
this.uploadFile();
this.uploadFile()
}
},
// 拍照回调
async closeTake(val) {
if (val && val.length > 0) {
const files = val.map((v) => v.path);
const value = await this.saveToTask(files);
const files = val.map((v) => v.path)
const value = await this.saveToTask(files)
this.$refs[
`fileChild${this.photoItem.groupIndex}${this.photoItem.itemIndex}`
][0].setTmpValue(value);
][0].setTmpValue(value)
}
this.takeStatus = false;
this.takeStatus = false
},
// 上传图片
async uploadFile(type) {
const self = this;
if (type && type === "photo") {
const self = this
if (type && type === 'photo') {
// 直接打开相册
let options = {
sourceType: ["album"], //['album', 'camera']
sourceType: ['album'], //['album', 'camera']
count: 3,
sizeType: ["compressed"],
};
const value = await this.chooseImg(options);
sizeType: ['compressed'],
}
const value = await this.chooseImg(options)
self.$refs[
`fileChild${self.photoItem.groupIndex}${self.photoItem.itemIndex}`
][0].setTmpValue(value);
return;
][0].setTmpValue(value)
return
}
// 使用拍照工具拍摄
this.photograph();
this.getWatermark();
this.photograph()
this.getWatermark()
},
// 获取拍照规范
photograph() {
let self = this;
let self = this
let param = {
partnerCompanyId: this.partnerCompanyId || "",
partnerCompanyId: this.partnerCompanyId || '',
categoryId: this.categoryId,
brandId: this.brandId || "",
brandId: this.brandId || '',
fieldName: this.photoItem.fieldsName,
};
}
this.$u.api.orderStandardItem(param).then((res) => {
if (res.code == 200 && res.data.length > 0) {
self.currentItemDate = res.data[0];
self.currentItemDate = res.data[0]
} else {
console.log("获取完工项的拍照标准异常", res.data.message);
console.log('获取完工项的拍照标准异常', res.data.message)
}
self.takeStatus = true;
});
self.takeStatus = true
})
},
// 获取水印
getWatermark() {
if (getApp().globalData.photo.waterSetting) {
return;
return
}
var data = { partnerCompanyId: this.partnerCompanyId || "" };
var data = { partnerCompanyId: this.partnerCompanyId || '' }
this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data;
getApp().globalData.photo.waterSetting = res.data
} else {
console.log("获取水印备注异常", res.data.message);
console.log('获取水印备注异常', res.data.message)
}
});
})
},
// ------------------------- 以上方法为上传组件相关 -------------------------
......@@ -1094,77 +1188,77 @@ export default {
// 点击左边的栏目切换
async swichMenu(index) {
if (this.arr.length == 0) {
await this.getMenuItemTop();
await this.getMenuItemTop()
}
// if (index == this.current) return;
this.scrollRightTop = this.oldScrollTop;
this.$nextTick(function () {
this.scrollRightTop = this.oldScrollTop
this.$nextTick(function() {
setTimeout(() => {
// 没有指定滚动到某一小项,就滚动到大的项
this.scrollRightTop = this.arr[index];
this.current = index;
}, 100);
});
this.scrollRightTop = this.arr[index]
this.current = index
}, 100)
})
},
// 获取右边菜单每个item到顶部的距离
getMenuItemTop() {
new Promise((resolve) => {
let selectorQuery = uni.createSelectorQuery();
let selectorQuery = uni.createSelectorQuery()
selectorQuery
.selectAll(".class-item")
.selectAll('.class-item')
.boundingClientRect((rects) => {
// 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
if (!rects.length) {
setTimeout(() => {
this.getMenuItemTop();
}, 10);
return;
this.getMenuItemTop()
}, 10)
return
}
rects.forEach((rect) => {
// 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
this.arr.push(rect.top - rects[0].top);
resolve();
});
this.arr.push(rect.top - rects[0].top)
resolve()
})
})
.exec();
});
.exec()
})
},
// 右边菜单滚动
async rightScroll(e) {
this.oldScrollTop = e.detail.scrollTop;
this.oldScrollTop = e.detail.scrollTop
if (this.arr.length == 0) {
await this.getMenuItemTop();
await this.getMenuItemTop()
}
if (this.timer) return;
if (this.timer) return
this.timer = setTimeout(() => {
// 节流
this.timer = null;
this.timer = null
// scrollHeight为右边菜单垂直中点位置
let scrollHeight = e.detail.scrollTop;
let scrollHeight = e.detail.scrollTop
for (let i = 0; i < this.arr.length; i++) {
let height1 = this.arr[i];
let height2 = this.arr[i + 1];
let height1 = this.arr[i]
let height2 = this.arr[i + 1]
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
if (!height2 || (scrollHeight >= height1 && scrollHeight < height2)) {
this.current = i;
return;
this.current = i
return
}
}
}, 10);
}, 10)
},
handleTouchstart() {
// 防止输入光标滚动出现错乱
uni.hideKeyboard();
uni.hideKeyboard()
},
// 返回上一页更新订单状态
backGo() {
const pages = getCurrentPages();
const beforePage = pages[pages.length - 2];
if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail();
uni.navigateBack();
const pages = getCurrentPages()
const beforePage = pages[pages.length - 2]
if (beforePage.$vm.loadOrderDetail) beforePage.$vm.loadOrderDetail()
uni.navigateBack()
},
},
};
}
</script>
<style lang="scss" scoped>
......@@ -1362,6 +1456,10 @@ export default {
justify-content: center;
align-items: center;
}
.read-only {
justify-content: flex-end;
padding-right: 30rpx;
}
.btn-save {
color: #ffffff;
......
......@@ -642,9 +642,11 @@
this.clickFeedback()
break
case 2:
getApp().track("order_errorSign", {orderId: this.orderId})
this.take()
break
case 3:
getApp().track("order_scenePhotoClick", {orderId: this.orderId})
this.scenePhotoClick()
break
case 4:
......@@ -763,6 +765,10 @@
},
// 去业务材料页面
handleClickFile() {
getApp().track("order_click_view_files", {
brandId: this.order.lianbaoBrandId,
partnerCompanyId: this.order.partnerCompanyId
})
this.$u.route({url: 'pages/order/document' + '?partnerCompanyId=' + this.order.partnerCompanyId + '&brandId=' + this.order.lianbaoBrandId})
},
trackOrder() {
......@@ -788,6 +794,10 @@
this.centerBtnDisabled = true
},
clickFeedback(){
getApp().track("order_clickFeedback", {
orderId: this.order.orderId,
categoryId: this.order.categoryId
})
// 过程反馈
uni.navigateTo({
url: 'pages/order/feedback?orderId='+this.order.orderId+'&categoryId='+this.order.categoryId+'&showGY=' + (this.bottomButtonText != '预约' ? '1' : '0')
......
<template>
<view :class="['doc-wrap', {'order-file': orderFile}]">
<u-navbar back-icon-color="#333333" background="#FFFFFF" title="安装文件" titleColor="#333333"
:border-bottom="false" title-bold></u-navbar>
<template v-if="!orderFile">
<!-- 合作商、品牌标签列表 -->
<view v-for="(item, key) in labels" :key="key" class="label-list">
<view class="label-title">
<!-- 合作商或品牌 -->
<view>{{items[key]}}</view>
<!-- 跳转到所有标签页面的更多按钮 -->
<view class="label-file-right" @click="handleMore(key)" v-if="item.length > 3">
<text class="label-right-text">更多</text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<scroll-view scroll-x="true" class="label-content" :scroll-into-view="scrollId[key]">
<view v-for="(label, ind) in item" :key="ind" class="label-item" :id="idText + label.id">
<!-- 选中为蓝底,非选中状态为灰底 -->
<view :class="['label-normal', {'selected': label.id == selected[key].id}]" @click="handleClick(key, label)">
<text class="label-text">{{label.name}}</text>
</view>
</view>
<!-- 标签加载中 -->
<view class="tag-loading-view" v-if="tapLoading[key]">
<u-loading mode="flower"></u-loading>
</view>
<!-- 无供应商、无品牌 -->
<view class="tag-tip-view" v-else-if="item.length <= 0">{{'暂无' + items[key]}}</view>
</scroll-view>
</view>
</template>
<view class="file-title">文件列表</view>
<view class="file-list">
<!-- 文件列表 -->
<view class="file-row" v-for="(item, index) in list" :key="index">
<view class="file-left">
<view class="file-name">
<u-icon class="item-icon" name="doc" custom-prefix="wxh" size="52" color="#2272FF"></u-icon>
<!-- 文件后缀的首字母,大写 -->
<view class="file-format-text">{{formatText(item.name)}}</view>
</view>
<text>{{item.name}}</text>
</view>
<!-- 文件操作按钮 -->
<view class="file-right">
<u-button :custom-style="shareStyle" shape="circle" @click="handleShare(item)">分享</u-button>
<u-button :custom-style="previewStyle" shape="circle" @click="handlePreview(item)">查看</u-button>
</view>
</view>
<!-- 如果是加载中,就显示转圈;如果加载完成 -->
<view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<!-- 加载完成之后,没有数据的提示:未选择品牌提示、无文件提示 -->
<view class="tip-view" v-else-if="list.length <= 0">{{tipText}}</view>
</view>
</view>
<view :class="['doc-wrap', { 'order-file': orderFile }]">
<u-navbar
back-icon-color="#333333"
background="#FFFFFF"
title="安装文件"
titleColor="#333333"
:border-bottom="false"
title-bold
></u-navbar>
<template v-if="!orderFile">
<!-- 合作商、品牌标签列表 -->
<view v-for="(item, key) in labels" :key="key" class="label-list">
<view class="label-title">
<!-- 合作商或品牌 -->
<view>{{ items[key] }}</view>
<!-- 跳转到所有标签页面的更多按钮 -->
<view
class="label-file-right"
@click="handleMore(key)"
v-if="item.length > 3"
>
<text class="label-right-text">更多</text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<scroll-view
scroll-x="true"
class="label-content"
:scroll-into-view="scrollId[key]"
>
<view
v-for="(label, ind) in item"
:key="ind"
class="label-item"
:id="idText + label.id"
>
<!-- 选中为蓝底,非选中状态为灰底 -->
<view
:class="[
'label-normal',
{ selected: label.id == selected[key].id },
]"
@click="handleClick(key, label)"
>
<text class="label-text u-line-2">{{ label.name }}</text>
</view>
</view>
<!-- 标签加载中 -->
<view class="tag-loading-view" v-if="tapLoading[key]">
<u-loading mode="flower"></u-loading>
</view>
<!-- 无供应商、无品牌 -->
<view class="tag-tip-view" v-else-if="item.length <= 0">{{
'暂无' + items[key]
}}</view>
</scroll-view>
</view>
</template>
<view class="file-title">文件列表</view>
<view class="file-list">
<!-- 文件列表 -->
<view class="file-row" v-for="(item, index) in list" :key="index">
<view class="file-left">
<view class="file-name">
<u-icon
class="item-icon"
name="doc"
custom-prefix="wxh"
size="52"
color="#2272FF"
></u-icon>
<!-- 文件后缀的首字母,大写 -->
<view class="file-format-text">{{ formatText(item.name) }}</view>
</view>
<text>{{ item.name }}</text>
</view>
<!-- 文件操作按钮 -->
<view class="file-right">
<u-button
:custom-style="shareStyle"
shape="circle"
@click="handleShare(item)"
>分享</u-button
>
<u-button
:custom-style="previewStyle"
shape="circle"
@click="handlePreview(item)"
>查看</u-button
>
</view>
</view>
<!-- 如果是加载中,就显示转圈;如果加载完成 -->
<view class="loading-view" v-if="loading">
<u-loading mode="flower"></u-loading>
</view>
<!-- 加载完成之后,没有数据的提示:未选择品牌提示、无文件提示 -->
<view class="tip-view" v-else-if="list.length <= 0">{{ tipText }}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [], // 文件列表
firstLoad: true, // 初次加载
labels: { // 标签列表
'1': [], // 合作商标签列表
'2': [] // 品牌标签列表
},
selected: { // 选中的标签
'1': {}, // 选中的合作商
'2': {} // 选中的品牌
},
scrollId: {
'1': '', // 选中的合作商view的id
'2': '' // 选中的品牌view的id
},
loading: false, // 文件列表加载中
tapLoading: {
'1': true, // 合作商加载中
'2': true // 品牌加载中
},
orderFile: false, // 是否是订单详情进来
fileList: {}, // 文件地址缓存 {url最后一段: tmpPath}
};
},
computed: {
// 合作商的key是'1',品牌的key是'2'
items() {
return {
'1': '合作商',
'2': '品牌'
}
},
// 分享按钮风格
shareStyle() {
return {
marginRight: '10rpx',
width: '100rpx',
height: '52rpx',
background: '#FFFFFF',
color: '#2272FF',
fontSize: '24rpx',
fontWeight: '400',
lineHeight: '52rpx'
}
},
// 查看按钮风格
previewStyle() {
return {
width: '100rpx',
height: '52rpx',
background: '#2272FF',
color: '#FFFFFF',
fontSize: '24rpx',
fontWeight: '400',
lineHeight: '52rpx'
}
},
// 文件列表文件图片
wenjianImage() {
return process.uniEnv.qn_base_url + 'wenjian-bk.png'
},
// 列表无数据的提示文字
tipText() {
return (this.selected['2'].name || this.orderFile) ? '暂无文件' : '请选择品牌'
},
idText() {
return 'item'
}
},
onLoad(e) {
if (e && e.partnerCompanyId && e.brandId) { // 订单详情进来获取指定合作商和品牌的文件资料
this.orderFile = true
this.loadFileList(e.partnerCompanyId, e.brandId)
} else { // 获取所有文件资料
this.loadFileLabel('1')
}
this.fileList = getApp().globalData.fileList || {} // 文件地址缓存 {url最后一段: tmpPath}
},
onShow() {
// 从标签列表页面返回,获取选中的标签
let pages = getCurrentPages();
let page = pages[pages.length - 1];
let selectedItem = page.selectedItem;
if (selectedItem) {
page.selectedItem = null
for (var item of this.labels[selectedItem.type]) {
if (item.id == selectedItem.id) {
this.handleClick(selectedItem.type, item)
this.scrollId[selectedItem.type] = this.idText + selectedItem.id
return
}
}
}
},
methods: {
// 选中标签
handleClick(key, label) {
this.selected[key] = label
this.scrollId[key] = ''
if (key == '1') { // 合作商
this.selected['2'] = {} // 清空选中品牌标签
this.list = [] // 清空文件列表
this.loadFileLabel('2', label.id) // 获取新合作商对应品牌
} else {// 品牌
this.loadFileList(this.selected['1'].id, this.selected['2'].id) // 获取文件列表
}
},
// 跳转到所有标签
handleMore(key) {
var partnerCompanyId = '' // 合作商id
if (key == '2') { // 点击品牌的更多,跳转要传合作商id
partnerCompanyId = this.selected['1'].id
}
this.$u.route({url: 'pages/order/document-tag' + '?partnerCompanyId=' + partnerCompanyId + '&selectedId=' + this.selected[key].id})
},
// 点击了分享
handleShare(item) {
// 分享资料事件
getApp().track('share_document', {
id: this.vuex_user.id,
url: item.url
});
let filePath = this.fileList[(item.url || '').split('/').pop()]
if (filePath) { // 有下载记录
wx.shareFileMessage({ // 如果用checkFile检查文件是否存在后再分享,shareFileMess报错:shareFileMessage:fail can only be invoked by user TAP gesture.
filePath: filePath,
fileName: item.name,
success() {},
fail: (error) => {
console.log(error)
if (error.errMsg.indexOf('internal') != -1) { // 文件不存在重新下载
this.downloadFile(item.url, (result)=> {
wx.shareFileMessage({
filePath: result.tempFilePath,
fileName: item.name,
success() {},
fail: console.error,
})
})
}
},
})
} else { // 无下载记录
this.downloadFile(item.url, (res)=> { // 下载
wx.shareFileMessage({
filePath: res.tempFilePath,
fileName: item.name,
success() {},
fail: console.error,
})
})
}
},
// 点击了查看
handlePreview(item) {
// 查看资料事件
getApp().track('preview_document', {
id: this.vuex_user.id,
url: item.url
});
let filePath = this.fileList[(item.url || '').split('/').pop()]
if (filePath) { // 有下载记录
this.checkFile(filePath, (res)=> { // 文件是否还存在
if (res.size && res.size > 0) { // 存在,预览文件
this.previewFile(filePath)
} else { // 文件已经不存在, 下载
this.downloadFile(item.url, (result)=> {
this.previewFile(result.tempFilePath)
})
}
})
} else { // 无下载记录
this.downloadFile(item.url, (res)=> { // 下载
this.previewFile(res.tempFilePath)
})
}
},
// 缓存文件是否存在
checkFile(filePath, complete) {
uni.getFileInfo({
filePath: filePath,
complete: complete
})
},
// 下载文件
downloadFile(url, block) {
uni.showLoading({
title: '加载中'
})
uni.downloadFile({
url: url,
success: (res)=> {
uni.hideLoading()
this.fileList[url.split('/').pop()] = res.tempFilePath
block(res)
}
});
},
// 预览文件
previewFile(filePath) {
if (/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(filePath)) { // 查看图片
wx.previewImage({
current: filePath, // 当前显示图片的http链接
urls: [filePath] // 需要预览的图片http链接列表
})
} else { // 查看文件
uni.openDocument({
filePath: filePath,
success: function(res) {
console.log('打开文档成功');
}
});
}
},
// 获取合作商或品牌列表
async loadFileLabel(type, partnerCompanyId) {
this.tapLoading[type] = true
let param = {
type: type, // 1:合作商标签,2:品牌标签
}
if (type == '2') {
param.partnerCompanyId = partnerCompanyId // 合作商的标签id
}
let res = await this.$u.api.fileLabel(param)
this.tapLoading[type] = false
if (res && res.code == 200) {
this.labels[type] = res.data || []
// this.labels[type] = [...res.data,...res.data,...res.data,...res.data,...res.data,...res.data,...res.data] // 测试模拟多条数据
// 初次进入页面,获取完合作商列表之后,接着获取第一个合作商的品牌列表
if (this.firstLoad && type == '1') {
this.firstLoad = false
if (this.labels[type].length > 0) {
this.selected[type] = this.labels[type][0]
this.loadFileLabel('2', this.selected[type].id)
}
}
}
},
// 获取文件列表
async loadFileList(partnerCompanyId, brandId) {
this.loading = true
let res = await this.$u.api.fileList({
partnerCompanyId: partnerCompanyId, // 合作商标签
brandId: brandId // 品牌标签
})
this.loading = false
if (res && res.code == 200) {
this.list = res.data || []
// this.list = [...res.data,...res.data,...res.data,...res.data,...res.data,...res.data,...res.data] // 测试模拟多条数据
}
},
// 文件后缀的首字母,大写
formatText(name) {
let arr = name.split('.')
if (arr.length > 1) {
let item = arr.pop()
return item.substr(0, 1).toUpperCase()
} else {
return 'P'
}
},
}
};
<script>
export default {
data() {
return {
list: [], // 文件列表
firstLoad: true, // 初次加载
labels: {
// 标签列表
'1': [], // 合作商标签列表
'2': [], // 品牌标签列表
},
selected: {
// 选中的标签
'1': {}, // 选中的合作商
'2': {}, // 选中的品牌
},
scrollId: {
'1': '', // 选中的合作商view的id
'2': '', // 选中的品牌view的id
},
loading: false, // 文件列表加载中
tapLoading: {
'1': true, // 合作商加载中
'2': true, // 品牌加载中
},
orderFile: false, // 是否是订单详情进来
fileList: {}, // 文件地址缓存 {url最后一段: tmpPath}
}
},
computed: {
// 合作商的key是'1',品牌的key是'2'
items() {
return {
'1': '合作商',
'2': '品牌',
}
},
// 分享按钮风格
shareStyle() {
return {
marginRight: '10rpx',
width: '100rpx',
height: '52rpx',
background: '#FFFFFF',
color: '#2272FF',
fontSize: '24rpx',
fontWeight: '400',
lineHeight: '52rpx',
}
},
// 查看按钮风格
previewStyle() {
return {
width: '100rpx',
height: '52rpx',
background: '#2272FF',
color: '#FFFFFF',
fontSize: '24rpx',
fontWeight: '400',
lineHeight: '52rpx',
}
},
// 文件列表文件图片
wenjianImage() {
return process.uniEnv.qn_base_url + 'wenjian-bk.png'
},
// 列表无数据的提示文字
tipText() {
return this.selected['2'].name || this.orderFile
? '暂无文件'
: '请选择品牌'
},
idText() {
return 'item'
},
},
onLoad(e) {
if (e && e.partnerCompanyId && e.brandId) {
// 订单详情进来获取指定合作商和品牌的文件资料
this.orderFile = true
this.loadFileList(e.partnerCompanyId, e.brandId)
} else {
// 获取所有文件资料
this.loadFileLabel('1')
}
this.fileList = getApp().globalData.fileList || {} // 文件地址缓存 {url最后一段: tmpPath}
},
onShow() {
// 从标签列表页面返回,获取选中的标签
let pages = getCurrentPages()
let page = pages[pages.length - 1]
let selectedItem = page.selectedItem
if (selectedItem) {
page.selectedItem = null
for (var item of this.labels[selectedItem.type]) {
if (item.id == selectedItem.id) {
this.handleClick(selectedItem.type, item)
this.scrollId[selectedItem.type] = this.idText + selectedItem.id
return
}
}
}
},
methods: {
// 选中标签
handleClick(key, label) {
this.selected[key] = label
this.scrollId[key] = ''
if (key == '1') {
// 合作商
this.selected['2'] = {} // 清空选中品牌标签
this.list = [] // 清空文件列表
this.loadFileLabel('2', label.id) // 获取新合作商对应品牌
} else {
// 品牌
this.loadFileList(this.selected['1'].id, this.selected['2'].id) // 获取文件列表
}
},
// 跳转到所有标签
handleMore(key) {
var partnerCompanyId = '' // 合作商id
if (key == '2') {
// 点击品牌的更多,跳转要传合作商id
partnerCompanyId = this.selected['1'].id
}
this.$u.route({
url:
'pages/order/document-tag' +
'?partnerCompanyId=' +
partnerCompanyId +
'&selectedId=' +
this.selected[key].id,
})
},
// 点击了分享
handleShare(item) {
// 分享资料事件
getApp().track('share_document', {
id: this.vuex_user.id,
url: item.url,
})
let filePath = this.fileList[(item.url || '').split('/').pop()]
if (filePath) {
// 有下载记录
wx.shareFileMessage({
// 如果用checkFile检查文件是否存在后再分享,shareFileMess报错:shareFileMessage:fail can only be invoked by user TAP gesture.
filePath: filePath,
fileName: item.name,
success() {},
fail: (error) => {
console.log(error)
if (error.errMsg.indexOf('internal') != -1) {
// 文件不存在重新下载
this.downloadFile(item.url, (result) => {
wx.shareFileMessage({
filePath: result.tempFilePath,
fileName: item.name,
success() {},
fail: console.error,
})
})
}
},
})
} else {
// 无下载记录
this.downloadFile(item.url, (res) => {
// 下载
wx.shareFileMessage({
filePath: res.tempFilePath,
fileName: item.name,
success() {},
fail: console.error,
})
})
}
},
// 点击了查看
handlePreview(item) {
// 查看资料事件
getApp().track('preview_document', {
id: this.vuex_user.id,
url: item.url,
})
let filePath = this.fileList[(item.url || '').split('/').pop()]
if (filePath) {
// 有下载记录
this.checkFile(filePath, (res) => {
// 文件是否还存在
if (res.size && res.size > 0) {
// 存在,预览文件
this.previewFile(filePath)
} else {
// 文件已经不存在, 下载
this.downloadFile(item.url, (result) => {
this.previewFile(result.tempFilePath)
})
}
})
} else {
// 无下载记录
this.downloadFile(item.url, (res) => {
// 下载
this.previewFile(res.tempFilePath)
})
}
},
// 缓存文件是否存在
checkFile(filePath, complete) {
uni.getFileInfo({
filePath: filePath,
complete: complete,
})
},
// 下载文件
downloadFile(url, block) {
uni.showLoading({
title: '加载中',
})
uni.downloadFile({
url: url,
success: (res) => {
uni.hideLoading()
this.fileList[url.split('/').pop()] = res.tempFilePath
block(res)
},
})
},
// 预览文件
previewFile(filePath) {
if (/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(filePath)) {
// 查看图片
wx.previewImage({
current: filePath, // 当前显示图片的http链接
urls: [filePath], // 需要预览的图片http链接列表
})
} else {
// 查看文件
uni.openDocument({
filePath: filePath,
success: function(res) {
console.log('打开文档成功')
},
})
}
},
// 获取合作商或品牌列表
async loadFileLabel(type, partnerCompanyId) {
this.tapLoading[type] = true
let param = {
type: type, // 1:合作商标签,2:品牌标签
}
if (type == '2') {
param.partnerCompanyId = partnerCompanyId // 合作商的标签id
}
let res = await this.$u.api.fileLabel(param)
this.tapLoading[type] = false
if (res && res.code == 200) {
this.labels[type] = res.data || []
// this.labels[type] = [...res.data,...res.data,...res.data,...res.data,...res.data,...res.data,...res.data] // 测试模拟多条数据
// 初次进入页面,获取完合作商列表之后,接着获取第一个合作商的品牌列表
if (this.firstLoad && type == '1') {
this.firstLoad = false
if (this.labels[type].length > 0) {
this.selected[type] = this.labels[type][0]
this.loadFileLabel('2', this.selected[type].id)
}
}
}
},
// 获取文件列表
async loadFileList(partnerCompanyId, brandId) {
this.loading = true
let res = await this.$u.api.fileList({
partnerCompanyId: partnerCompanyId, // 合作商标签
brandId: brandId, // 品牌标签
})
this.loading = false
if (res && res.code == 200) {
this.list = res.data || []
// this.list = [...res.data,...res.data,...res.data,...res.data,...res.data,...res.data,...res.data] // 测试模拟多条数据
}
},
// 文件后缀的首字母,大写
formatText(name) {
let arr = name.split('.')
if (arr.length > 1) {
let item = arr.pop()
return item.substr(0, 1).toUpperCase()
} else {
return 'P'
}
},
},
}
</script>
<style lang="scss" scoped>
.doc-wrap {
background-color: #F4F5F7;
height: 100vh;
display: flex;
flex-direction: column;
&.order-file {
background-color: #FFFFFF;
}
.doc-wrap {
background-color: #f4f5f7;
height: 100vh;
display: flex;
flex-direction: column;
.label-list {
padding: 0 0 40rpx 30rpx;
&.order-file {
background-color: #ffffff;
}
.label-title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.label-list {
padding: 0 0 40rpx 30rpx;
.label-file-right {
display: flex;
align-items: center;
justify-content: flex-end;
color: #2272FF;
font-size: 26rpx;
padding-right: 30rpx;
.label-title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.label-right-text {
font-weight: 400;
}
}
}
.label-file-right {
display: flex;
align-items: center;
justify-content: flex-end;
color: #2272ff;
font-size: 26rpx;
padding-right: 30rpx;
.label-content {
width: 100%;
height: 104rpx;
white-space: nowrap;
.label-item {
overflow: hidden;
padding-right: 20rpx;
flex-shrink: 0;
display: inline-block;
.label-normal {
height: 104rpx;
width: 200rpx;
font-size: 26rpx;
color: #666666;
background-color: #FFFFFF;
border-radius: 8rpx;
padding-left: 20rpx;
padding-right: 20rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.label-text {
word-break:break-all;
white-space: normal !important;
}
&.selected {
color: #FFFFFF;
background-color: #2272FF;
}
}
}
.tag-loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 20rpx;
position: absolute;
padding-right: 30rpx;
}
.tag-tip-view {
color: #999999;
width: 100%;
margin-top: 30rpx;
text-align: center;
position: absolute;
padding-right: 30rpx;
}
}
}
}
.label-right-text {
font-weight: 400;
}
}
}
.file-title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
padding: 20rpx 30rpx;
border-radius: 32rpx;
background-color: #FFFFFF;
// margin-top: 10rpx;
}
.label-content {
width: 100%;
height: 104rpx;
white-space: nowrap;
.label-item {
overflow: hidden;
padding-right: 20rpx;
flex-shrink: 0;
display: inline-block;
.label-normal {
height: 104rpx;
width: 200rpx;
font-size: 26rpx;
color: #666666;
background-color: #ffffff;
border-radius: 8rpx;
padding-left: 20rpx;
padding-right: 20rpx;
text-align: center;
// display: flex;
// justify-content: center;
// align-items: center;
display: table;
.label-text {
word-break: break-all;
white-space: normal !important;
display: table-cell;
vertical-align: middle;
}
&.selected {
color: #ffffff;
background-color: #2272ff;
}
}
}
.tag-loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 20rpx;
position: absolute;
padding-right: 30rpx;
}
.tag-tip-view {
color: #999999;
width: 100%;
margin-top: 30rpx;
text-align: center;
position: absolute;
padding-right: 30rpx;
}
}
}
}
.file-list {
padding: 0 30rpx;
height: 100%;
overflow: auto;
background-color: #FFFFFF;
.file-title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
padding: 20rpx 30rpx;
border-radius: 32rpx;
background-color: #ffffff;
// margin-top: 10rpx;
}
.file-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10rpx;
margin-bottom: 50rpx;
.file-list {
padding: 0 30rpx;
height: 100%;
overflow: auto;
background-color: #ffffff;
.file-left {
display: flex;
align-items: center;
color: #333333;
font-size: 26rpx;
.file-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10rpx;
margin-bottom: 50rpx;
.file-name {
margin-right: 20rpx;
position: relative;
.item-icon {
position: absolute;
}
.file-format-text {
position: relative;
width: 52rpx;
height: 52rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #FFFFFF;
line-height: 52rpx;
}
}
.file-left {
display: flex;
align-items: center;
color: #333333;
font-size: 26rpx;
}
.file-name {
margin-right: 20rpx;
position: relative;
.item-icon {
position: absolute;
}
.file-format-text {
position: relative;
width: 52rpx;
height: 52rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
line-height: 52rpx;
}
}
}
.file-right {
display: flex;
align-items: center;
justify-content: flex-end;
.file-right {
display: flex;
align-items: center;
justify-content: flex-end;
.button-class {
margin-left: 10rpx;
}
}
}
.button-class {
margin-left: 10rpx;
}
}
}
.tip-view {
color: #999999;
width: 100%;
margin-top: 200rpx;
text-align: center;
}
.tip-view {
color: #999999;
width: 100%;
margin-top: 200rpx;
text-align: center;
}
.loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 200rpx;
}
}
</style>
.loading-view {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
margin-top: 200rpx;
}
}
</style>
......@@ -357,6 +357,10 @@ export default {
}
self.submiting = true;
getApp().track("order_feedback_submitForm", {
reasonType: self.trace.reasonType,
traceDate: self.traceDate
})
let params = this.$u.deepClone(self.trace);
if(self.trace.reasonType != '改约') {
if(self.timeItem && self.timeItem.pkey && self.traceDate){
......
......@@ -85,7 +85,10 @@
searchOrder(index) {
this.search.pageNumber = 1
this.loadStaus = 'loading';
this.getOrderList()
if(this.search.keyword) {
getApp().track('search_order', {keyword: this.search.keyword});
this.getOrderList()
}
},
// 页面数据
getOrderList(event) {
......
......@@ -224,6 +224,7 @@ export default {
if(!this.validateForm()) {
return false
}
getApp().track("parts_application_submitParts", {})
const address = this.addressInfo
let params = {
applyType: '1',
......
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