Commit 0d033b16 authored by 郭欢's avatar 郭欢

'优化逻辑,'

parent fe2ff37d
<template>
<div id="app">
<keep-alive v-if="$route.meta.keepAlive">
<router-view />
<keep-alive >
<router-view v-if="$route.meta.keepAlive" />
</keep-alive>
<router-view v-else />
<router-view v-if="!$route.meta.keepAlive" />
<div class="goBack-btn flex-h flex-hc flex-align-center" v-if="!$route.meta.hideBack" >
<i class="iconfont icon-icon_fanhuishouye" @click="gohome"></i>
</div>
......
// export const SELFSHOP = 'self_shop'
export const REFRESH_LIST = 'REFRESH_LIST'
/**
* 设置缓存 getLocalStorage
......
......@@ -21,7 +21,7 @@
width: 1.5rem;
height: 100%;
text-align: center;
font-size: 0.26rem;
font-size: 0.3rem;
color: #333333;
}
......@@ -30,7 +30,7 @@
}
.tabbar-item img {
width: 0.44rem;
height: 0.44rem;
width: 0.56rem;
height: 0.56rem;
margin: 0 auto;
}
\ No newline at end of file
......@@ -29,7 +29,8 @@ const routes = [{
name: 'mine',
meta: {
title: '我的',
hideBack: true
hideBack: true,
keepAlive: true
},
component: () => import('../views/tabbar/mine.vue')
},
......@@ -66,7 +67,8 @@ const routes = [{
name: 'order_detail',
meta: {
title: '工单详情',
hideBack: true
hideBack: true,
keepAlive: true
},
component: () => import('@/views/my/order_detail.vue')
},
......@@ -94,7 +96,7 @@ const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes,
scrollBehavior(to, from, savePosition) {
scrollBehavior (to, from, savePosition) {
if (savePosition) {
return savePosition
} else {
......
......@@ -9,7 +9,7 @@
<div
class="item-desc que-desc"
>{{order.repair_type.type_name}}-{{order.description}}</div>
<div class="item flex-h flex-vc">
<div class="item flex-h flex-start">
<div class="item-title">服务地址:</div>
<div
class="item-desc"
......@@ -25,9 +25,9 @@
</div>
<div class="item flex-h flex-vc">
<div class="item-title">提交时间:</div>
<div class="item-desc">{{ item.created_at }}</div>
<div class="item-desc">{{ order.created_at }}</div>
</div>
<div class="item flex-h flex-vc">
<div class="item flex-h flex-start">
<div class="item-title">图片详情:</div>
<div
class="img"
......@@ -62,7 +62,7 @@
<div class="item_line"></div>
</div>
<div class="material" v-if="order.pay_order != ''">
<div class="item-title">已支付耗材</div>
<div class="item-title">已支付耗材</div>
<div v-for="(parent, index) in order.pay_order" :key="index">
<div
class="ma-item flex-h flex-hb"
......@@ -80,7 +80,7 @@
<div class="item_line"></div>
</div>
<div class="material" v-if="order.free_material_order">
<div class="item-title bz-title">备注耗材</div>
<div class="item-title bz-title">备注耗材</div>
<div
class="ma-item flex-h flex-hb"
v-for="(child, index) in order.free_material_order.goods"
......@@ -99,11 +99,11 @@
<div class="item_line"></div>
</div>
<div class="item flex-h flex-start" v-if="order.orderlog_transfer">
<div class="item-title">转单备注:</div>
<div class="item-title">转单备注</div>
<div class="item-desc">{{order.orderlog_transfer.remark}}</div>
</div>
<div class="item flex-h flex-start" v-if="order.orderlog_cancel">
<div class="item-title">退回备注:</div>
<div class="item-title">退回备注</div>
<div class="item-desc">{{order.orderlog_cancel.remark}}</div>
</div>
<div v-if="order.is_can_assign_worker==1">
......
......@@ -147,6 +147,7 @@
<script>
import { ImagePreview } from 'vant'
import { REFRESH_LIST, setLocalStorage } from '@assets/js/self.js'
export default {
name: 'charge',
data () {
......@@ -343,6 +344,7 @@ export default {
console.log('执行了吗')
this.$toast.success('发起成功')
this.$router.go(-1)
setLocalStorage(REFRESH_LIST, true)
})
.catch(() => { })
},
......
......@@ -13,7 +13,7 @@
<div
class="item-desc que-desc"
>{{ order.repair_type.type_name }}-{{ order.description }}</div>
<div class="item flex-h flex-vc">
<div class="item flex-h flex-start">
<div class="item-title">服务地址:</div>
<div class="item-desc">
{{ order.region.region_name }}-{{
......@@ -33,7 +33,7 @@
<div class="item-title">提交时间:</div>
<div class="item-desc">{{ order.created_at}}</div>
</div>
<div class="item flex-h flex-vc">
<div class="item flex-h flex-start">
<div class="item-title">图片详情:</div>
<div
class="img"
......@@ -249,6 +249,7 @@
<script>
import { ImagePreview } from 'vant'
import { trimStrSpace } from '@assets/js/format.js'
import { REFRESH_LIST, getLocalStorage, removeLocalStorage } from '@assets/js/self.js'
export default {
name: 'order_detail',
data () {
......@@ -321,6 +322,7 @@ export default {
this.order = res.order
this.locked = false
this.isloading = false
removeLocalStorage(REFRESH_LIST)
})
.catch(() => {
this.locked = false
......@@ -482,8 +484,14 @@ export default {
},
fetchData (to, from) {
this.order_id = to.query ? to.query.id : ''
if (this.order_id) {
this.getDetail()
if (from.path !== undefined && from.path.indexOf('/charge') !== -1) {
if (getLocalStorage(REFRESH_LIST)) {
this.getDetail()
}
} else {
if (this.order_id) {
this.getDetail()
}
}
}
......
......@@ -327,6 +327,7 @@ import myTabbar from '@components/common/tabbar.vue'
import { trimStrSpace } from '@assets/js/format.js'
import { ImagePreview } from 'vant'
import { share } from '@/api/wxShare.js'
import { REFRESH_LIST, getLocalStorage, removeLocalStorage } from '@assets/js/self.js'
export default {
name: 'home',
components: {
......@@ -517,7 +518,7 @@ export default {
this.isloading = false
this.loading = false
this.finished = false
this.getUserInfo()
// this.getUserInfo()
},
getStatus () {
this.$http
......@@ -533,6 +534,7 @@ export default {
.get(this.$myApi.USERINFO)
.then((res) => {
this.user = res
this.getList()
})
.catch(() => { })
},
......@@ -567,6 +569,7 @@ export default {
this.count = data.count
this.loading = false
this.finished = !data.more
removeLocalStorage(REFRESH_LIST)
})
.catch(() => {
this.locked = false
......@@ -784,13 +787,25 @@ export default {
tz_charge (id) {
console.log(id, 'jaeofne')
this.$router.push({
path: '/charge',
query: { id }
name: 'charge',
query: {
id: id
}
})
},
fetchData (to, from) {
this.getList()
this.getUserInfo()
console.log(from.path, 'from----------------')
if (from.path !== undefined && from.path.indexOf('/charge') !== -1) {
console.log(!this.list.length, '!this.list.length-------', this.list)
console.log(getLocalStorage(REFRESH_LIST), 'getLocalStorage(REFRESH_LIST)-------')
if (!this.list.length || getLocalStorage(REFRESH_LIST)) {
this.initData()
this.getList()
}
} else {
this.initData()
this.getUserInfo()
}
}
},
beforeRouteEnter (to, from, next) {
......@@ -799,6 +814,8 @@ export default {
})
},
beforeRouteLeave (to, from, next) {
console.log(this.list, ' this.list-------------')
// return
next()
}
}
......
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