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

'优化逻辑,'

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