Commit 1bf70585 authored by Facius's avatar Facius

Merge branch 'dev-1.4.3' into test

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