Authored by lea guo

订单列表操作刷新问题修改

@@ -35,7 +35,6 @@ export default { @@ -35,7 +35,6 @@ export default {
35 params: { 35 params: {
36 owner: ownType.SELL, 36 owner: ownType.SELL,
37 status, 37 status,
38 - isRefetch: true  
39 } 38 }
40 }); 39 });
41 } 40 }
@@ -3,7 +3,13 @@ @@ -3,7 +3,13 @@
3 <div 3 <div
4 class="video-wrapper" 4 class="video-wrapper"
5 v-if="appraiseVideoUrl && pageName === 'list'" 5 v-if="appraiseVideoUrl && pageName === 'list'"
6 - @click="() => onVideoHandler({videoUrl:appraiseVideoUrl, orderCode: order.orderCode})" 6 + @click="
  7 + () =>
  8 + onVideoHandler({
  9 + videoUrl: appraiseVideoUrl,
  10 + orderCode: order.orderCode
  11 + })
  12 + "
7 > 13 >
8 <div class="play-btn"></div> 14 <div class="play-btn"></div>
9 <div class="play-txt">鉴定视频</div> 15 <div class="play-txt">鉴定视频</div>
@@ -14,7 +20,8 @@ @@ -14,7 +20,8 @@
14 v-for="action in actionList" 20 v-for="action in actionList"
15 :key="action.code" 21 :key="action.code"
16 @click="() => onActionHandler(action)" 22 @click="() => onActionHandler(action)"
17 - >{{ action.text }}</Button> 23 + >{{ action.text }}</Button
  24 + >
18 </div> 25 </div>
19 </div> 26 </div>
20 </template> 27 </template>
@@ -23,9 +30,6 @@ @@ -23,9 +30,6 @@
23 import { orderActionsMap, ownType } from "constants/order-constants"; 30 import { orderActionsMap, ownType } from "constants/order-constants";
24 import { createNamespacedHelpers } from "vuex"; 31 import { createNamespacedHelpers } from "vuex";
25 32
26 -const { mapActions } = createNamespacedHelpers("order/orderList");  
27 -const { mapMutations } = createNamespacedHelpers("address/address");  
28 -  
29 export default { 33 export default {
30 props: { 34 props: {
31 order: { 35 order: {
@@ -46,104 +50,8 @@ export default { @@ -46,104 +50,8 @@ export default {
46 } 50 }
47 }, 51 },
48 methods: { 52 methods: {
49 - ...mapActions([  
50 - "deleteOrder",  
51 - "cancelTradeConfirmInfo",  
52 - "cancelTrade",  
53 - "confirmReceipt"  
54 - ]),  
55 - ...mapMutations(["STORE_UPDATE_ADDRESS_INFO"]),  
56 onActionHandler(action) { 53 onActionHandler(action) {
57 - const { owner = ownType.SELL } = this.$route.params;  
58 - const {  
59 - orderCode,  
60 - priceInfo = {},  
61 - goodsInfo = {},  
62 - // 订单类表和订单详情地址信息返回地段不一致  
63 - addressInfo,  
64 - userAddress  
65 - } = this.order;  
66 -  
67 - const { productId, storageId, skup } = goodsInfo;  
68 -  
69 - switch (action.name) {  
70 - // 再次购买  
71 - case orderActionsMap.BUY_AGAIN.name:  
72 - this.$router.push({  
73 - name: "ProductDetail",  
74 - params: { productId }  
75 - });  
76 - break;  
77 -  
78 - // 查看详情  
79 - case orderActionsMap.SHOW_DETAIL.name:  
80 - const name =  
81 - owner === ownType.SELL ? "sellOrderDetail" : "buyOrderDetail";  
82 - this.$router.push({  
83 - name,  
84 - params: { owner, code: orderCode }  
85 - });  
86 - break;  
87 -  
88 - // 再次出售  
89 - case orderActionsMap.SOLD_AGAIN.name:  
90 - this.$router.push({  
91 - name: "OrderSellConfirm",  
92 - query: { productId, storageId }  
93 - });  
94 - break;  
95 -  
96 - // 查看物流  
97 - case orderActionsMap.SHOW_EXPRESS.name:  
98 - this.$router.push({  
99 - name: "orderLogisticsInfo",  
100 - params: { owner, code: orderCode }  
101 - });  
102 - break;  
103 - // 调价  
104 - // 非入住商家  
105 - case orderActionsMap.NOT_ENTRY_CHANGE_PRICE.name:  
106 - this.$router.push({  
107 - name: "PriceChangeNoEntry",  
108 - params: { orderCode }  
109 - });  
110 - break;  
111 -  
112 - // 入住商家  
113 - case orderActionsMap.STORAGE_MANAGE.name:  
114 - this.$router.push({  
115 - name: "PriceChangeEntry",  
116 - params: { orderId: productId }  
117 - });  
118 - break;  
119 -  
120 - // 我要发货  
121 - case orderActionsMap.DELIVER_GOODS.name:  
122 - this.$router.push({  
123 - name: "order.deliver",  
124 - params: { skup, code: orderCode }  
125 - });  
126 - break;  
127 -  
128 - // 修改地址  
129 - case orderActionsMap.MODIFY_ADDRESS.name: {  
130 - // 保存地址到store  
131 - let info = JSON.stringify(addressInfo || userAddress || {});  
132 - let updateInfo = JSON.parse(info || "{}");  
133 - Object.assign(updateInfo, { isUpdate: true, orderCode: orderCode });  
134 - this.STORE_UPDATE_ADDRESS_INFO(updateInfo);  
135 - this.$router.push({  
136 - name: 'addressEdit',  
137 - query: {  
138 - fromPage: 'OrderList'  
139 - }  
140 - });  
141 - break;  
142 - }  
143 -  
144 - default:  
145 - this.$emit("on-action", action);  
146 - } 54 + this.$emit("on-action", action);
147 }, 55 },
148 onVideoHandler(params) { 56 onVideoHandler(params) {
149 this.$emit("on-video", params); 57 this.$emit("on-video", params);
  1 +/* eslint-disable new-cap */
  2 +/* eslint-disable indent */
  3 +/* eslint-disable lines-around-comment */
1 /* eslint-disable operator-linebreak */ 4 /* eslint-disable operator-linebreak */
2 /* eslint-disable space-before-function-paren */ 5 /* eslint-disable space-before-function-paren */
3 import { orderActionsMap, ownType } from 'constants/order-constants'; 6 import { orderActionsMap, ownType } from 'constants/order-constants';
4 import { createNamespacedHelpers } from 'vuex'; 7 import { createNamespacedHelpers } from 'vuex';
5 import DialogConfirmInfo from '../components/dialog-confirm-info'; 8 import DialogConfirmInfo from '../components/dialog-confirm-info';
  9 +import refreshMixin from './refresh';
6 10
7 const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList'); 11 const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList');
  12 +const { mapMutations: addressMutations } = createNamespacedHelpers(
  13 + 'address/address',
  14 +);
8 15
9 export default { 16 export default {
10 - data() {  
11 - return {  
12 - hasAction: false,  
13 - };  
14 - }, 17 + mixins: [refreshMixin],
15 methods: { 18 methods: {
16 ...mapActions([ 19 ...mapActions([
17 'cancelTradeConfirmInfo', 20 'cancelTradeConfirmInfo',
@@ -19,20 +22,112 @@ export default { @@ -19,20 +22,112 @@ export default {
19 'deleteOrder', 22 'deleteOrder',
20 'computeChangePrice', 23 'computeChangePrice',
21 'confirmChangePrice', 24 'confirmChangePrice',
  25 + 'confirmReceipt',
22 ]), 26 ]),
23 ...mapMutations(['filterOrderList', 'resetData', 'resetOrderListItem']), 27 ...mapMutations(['filterOrderList', 'resetData', 'resetOrderListItem']),
  28 + ...addressMutations(['STORE_UPDATE_ADDRESS_INFO']),
24 29
25 async onAction({ action, order, isDetail = false } = {}) { 30 async onAction({ action, order, isDetail = false } = {}) {
26 - const { owner = ownType.SELL, type, status } = this.$route.params; 31 + const { owner = ownType.SELL, status } = this.$route.params;
27 const { 32 const {
28 orderCode, 33 orderCode,
29 realPrice = '', 34 realPrice = '',
30 bidDepositInfo = {}, 35 bidDepositInfo = {},
31 goodsInfo = {}, 36 goodsInfo = {},
32 priceInfo = {}, 37 priceInfo = {},
  38 +
  39 + // 订单类表和订单详情地址信息返回地段不一致
  40 + addressInfo,
  41 + userAddress,
33 } = order; 42 } = order;
  43 + const { productId, storageId, skup } = goodsInfo;
  44 +
  45 + if (isDetail) {
  46 + this.setIsRefresh(true);
  47 + }
34 48
35 switch (action.name) { 49 switch (action.name) {
  50 + // 再次购买
  51 + case orderActionsMap.BUY_AGAIN.name: {
  52 + this.$router.push({
  53 + name: 'ProductDetail',
  54 + params: { productId },
  55 + });
  56 + break;
  57 + }
  58 +
  59 + // 查看详情
  60 + case orderActionsMap.SHOW_DETAIL.name: {
  61 + this.setIsRefresh(false);
  62 + const name =
  63 + owner === ownType.SELL ? 'sellOrderDetail' : 'buyOrderDetail';
  64 +
  65 + this.$router.push({
  66 + name,
  67 + params: { owner, code: orderCode },
  68 + });
  69 + break;
  70 + }
  71 +
  72 + // 再次出售
  73 + case orderActionsMap.SOLD_AGAIN.name:
  74 + this.$router.push({
  75 + name: 'OrderSellConfirm',
  76 + query: { productId, storageId },
  77 + });
  78 + break;
  79 +
  80 + // 查看物流
  81 + case orderActionsMap.SHOW_EXPRESS.name:
  82 + this.setIsRefresh(false);
  83 + this.$router.push({
  84 + name: 'orderLogisticsInfo',
  85 + params: { owner, code: orderCode },
  86 + });
  87 + break;
  88 +
  89 + // 调价
  90 + // 非入住商家
  91 + case orderActionsMap.NOT_ENTRY_CHANGE_PRICE.name:
  92 + this.$router.push({
  93 + name: 'PriceChangeNoEntry',
  94 + params: { orderCode },
  95 + });
  96 + break;
  97 +
  98 + // 入住商家
  99 + case orderActionsMap.STORAGE_MANAGE.name:
  100 + this.$router.push({
  101 + name: 'PriceChangeEntry',
  102 + params: { orderId: productId },
  103 + });
  104 + break;
  105 +
  106 + // 我要发货
  107 + case orderActionsMap.DELIVER_GOODS.name:
  108 + this.$router.push({
  109 + name: 'order.deliver',
  110 + params: { skup, code: orderCode },
  111 + });
  112 + break;
  113 +
  114 + // 修改地址
  115 + case orderActionsMap.MODIFY_ADDRESS.name: {
  116 + // 保存地址到store
  117 + let info = JSON.stringify(addressInfo || userAddress || {});
  118 + let updateInfo = JSON.parse(info || '{}');
  119 +
  120 + Object.assign(updateInfo, { isUpdate: true, orderCode: orderCode });
  121 + this.STORE_UPDATE_ADDRESS_INFO(updateInfo);
  122 + this.$router.push({
  123 + name: 'addressEdit',
  124 + query: {
  125 + fromPage: 'OrderList',
  126 + },
  127 + });
  128 + break;
  129 + }
  130 +
36 case orderActionsMap.DEL_ORDER.name: { 131 case orderActionsMap.DEL_ORDER.name: {
37 this.$createConfirmDialog({ 132 this.$createConfirmDialog({
38 content: '确认删除订单?', 133 content: '确认删除订单?',
@@ -45,19 +140,13 @@ export default { @@ -45,19 +140,13 @@ export default {
45 }); 140 });
46 141
47 if (isOk) { 142 if (isOk) {
  143 + this.filterOrderList({
  144 + orderCode,
  145 + owner,
  146 + status,
  147 + });
48 if (isDetail) { 148 if (isDetail) {
49 - this.filterOrderList({  
50 - orderCode,  
51 - owner,  
52 - status,  
53 - });  
54 this.$router.back(); 149 this.$router.back();
55 - } else {  
56 - this.filterOrderList({  
57 - orderCode,  
58 - owner,  
59 - status,  
60 - });  
61 } 150 }
62 } 151 }
63 const txt = isOk ? '删除成功' : '删除失败'; 152 const txt = isOk ? '删除成功' : '删除失败';
@@ -95,7 +184,6 @@ export default { @@ -95,7 +184,6 @@ export default {
95 if (isOk) { 184 if (isOk) {
96 if (isDetail) { 185 if (isDetail) {
97 this.fetchOrderDetail(this.$route.params); 186 this.fetchOrderDetail(this.$route.params);
98 - this.hasAction = true;  
99 } else { 187 } else {
100 this.resetData(this.$route.params); 188 this.resetData(this.$route.params);
101 this.fetchData(this.$route.params); 189 this.fetchData(this.$route.params);
@@ -123,7 +211,6 @@ export default { @@ -123,7 +211,6 @@ export default {
123 pageBackName = 'OrderList'; 211 pageBackName = 'OrderList';
124 212
125 if (isDetail) { 213 if (isDetail) {
126 - this.hasAction = true;  
127 price = priceInfo.realPayPrice; 214 price = priceInfo.realPayPrice;
128 pageBackName = 'buyOrderDetail'; 215 pageBackName = 'buyOrderDetail';
129 } 216 }
@@ -149,7 +236,6 @@ export default { @@ -149,7 +236,6 @@ export default {
149 // 是否是求购 236 // 是否是求购
150 const isAskForBuy = status === 7; 237 const isAskForBuy = status === 7;
151 238
152 - this.hasAction = true;  
153 this.$createOrderPayType({ 239 this.$createOrderPayType({
154 orderCode, 240 orderCode,
155 price: parseFloat(bidDepositInfo.depositAmount).toFixed(2), 241 price: parseFloat(bidDepositInfo.depositAmount).toFixed(2),
@@ -180,7 +266,6 @@ export default { @@ -180,7 +266,6 @@ export default {
180 266
181 if (isOk) { 267 if (isOk) {
182 if (isDetail) { 268 if (isDetail) {
183 - this.hasAction = true;  
184 this.fetchOrderDetail(this.$route.params); 269 this.fetchOrderDetail(this.$route.params);
185 } else { 270 } else {
186 this.resetData(this.$route.params); 271 this.resetData(this.$route.params);
@@ -243,7 +328,7 @@ export default { @@ -243,7 +328,7 @@ export default {
243 params: isDetail 328 params: isDetail
244 ? { 329 ? {
245 owner: this.$route.params.owner, 330 owner: this.$route.params.owner,
246 - code: bidData.orderCode, //改为新订单号 331 + code: bidData.orderCode, // 改为新订单号
247 } 332 }
248 : this.$route.params, 333 : this.$route.params,
249 }, 334 },
@@ -10,11 +10,6 @@ const { mapMutations: inSaleMapMutations } = createNamespacedHelpers( @@ -10,11 +10,6 @@ const { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
10 ); 10 );
11 11
12 export default { 12 export default {
13 - data() {  
14 - return {  
15 - hasAction: false,  
16 - };  
17 - },  
18 methods: { 13 methods: {
19 ...mapActions(['cancelTradeConfirmInfo', 'cancelTrade']), 14 ...mapActions(['cancelTradeConfirmInfo', 'cancelTrade']),
20 ...inSaleMapMutations(['filterInSaleOrderList']), 15 ...inSaleMapMutations(['filterInSaleOrderList']),
@@ -49,7 +44,6 @@ export default { @@ -49,7 +44,6 @@ export default {
49 }); 44 });
50 45
51 if (isOk) { 46 if (isOk) {
52 - this.hasAction = true;  
53 if (isDetail) { 47 if (isDetail) {
54 this.fetchOrderDetail(this.$route.params); 48 this.fetchOrderDetail(this.$route.params);
55 } else { 49 } else {
@@ -80,7 +74,6 @@ export default { @@ -80,7 +74,6 @@ export default {
80 case orderActionsMap.PAY_EARNESTMONEY.name: { 74 case orderActionsMap.PAY_EARNESTMONEY.name: {
81 const pageBackName = isDetail ? 'sellOrderDetail' : 'InSaleOrderList'; 75 const pageBackName = isDetail ? 'sellOrderDetail' : 'InSaleOrderList';
82 76
83 - this.hasAction = true;  
84 this.$createOrderPayType({ 77 this.$createOrderPayType({
85 orderCode, 78 orderCode,
86 price: parseFloat(`${earnestMoney}`).toFixed(2), 79 price: parseFloat(`${earnestMoney}`).toFixed(2),
  1 +import { createNamespacedHelpers } from 'vuex';
  2 +const { mapMutations } = createNamespacedHelpers('order/orderList');
  3 +
  4 +export default {
  5 + methods: {
  6 + ...mapMutations(['setIsRefresh']),
  7 + },
  8 +};
1 -const STORE_PATH = 'order/orderDetail';  
2 -  
3 -export default {  
4 - beforeRouteEnter(to, from, next) {  
5 - next(vm => {  
6 - vm.$store.commit(`${STORE_PATH}/setFrom`, from);  
7 - });  
8 - },  
9 -};  
@@ -133,7 +133,6 @@ import OrderActions from "../components/order-actions"; @@ -133,7 +133,6 @@ import OrderActions from "../components/order-actions";
133 import VideoPlayer from "../order-list/components/video-player"; 133 import VideoPlayer from "../order-list/components/video-player";
134 134
135 import orderActionMixin from "../mixin/order-action"; 135 import orderActionMixin from "../mixin/order-action";
136 -import routeActionMinxin from "../mixin/route";  
137 136
138 const STORE_PATH = "order/orderDetail"; 137 const STORE_PATH = "order/orderDetail";
139 138
@@ -142,7 +141,7 @@ const { mapActions, mapState, mapGetters } = createNamespacedHelpers( @@ -142,7 +141,7 @@ const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
142 ); 141 );
143 142
144 export default { 143 export default {
145 - mixins: [orderActionMixin, routeActionMinxin], 144 + mixins: [orderActionMixin],
146 components: { 145 components: {
147 AddressInfo, 146 AddressInfo,
148 OrderItemInfo, 147 OrderItemInfo,
@@ -168,17 +167,8 @@ export default { @@ -168,17 +167,8 @@ export default {
168 asyncData({ store, router }) { 167 asyncData({ store, router }) {
169 return store.dispatch(`${STORE_PATH}/fetchOrderDetail`, router.params); 168 return store.dispatch(`${STORE_PATH}/fetchOrderDetail`, router.params);
170 }, 169 },
171 - beforeRouteLeave(to, from, next) {  
172 - if (this.from.name === "OrderPay" || this.hasAction) {  
173 - to.params.isRefetch = true;  
174 - }  
175 - if (to.name === "OrderList" || to.name === "InSaleOrderList") {  
176 - this.hasAction = false;  
177 - }  
178 - next();  
179 - },  
180 computed: { 170 computed: {
181 - ...mapState(["orderDetail", "from"]), 171 + ...mapState(["orderDetail"]),
182 ...mapGetters([ 172 ...mapGetters([
183 "lastExpressInfo", 173 "lastExpressInfo",
184 "priceInfo", 174 "priceInfo",
1 <template> 1 <template>
2 <div> 2 <div>
3 - <layout-app  
4 - :title="'\u200E'"  
5 - class="seller-order-detail-wrapper"  
6 - > 3 + <layout-app :title="'\u200E'" class="seller-order-detail-wrapper">
7 <div class="order-detail-wrapper"> 4 <div class="order-detail-wrapper">
8 <div class="content"> 5 <div class="content">
9 <!-- 状态信息 --> 6 <!-- 状态信息 -->
@@ -114,7 +111,6 @@ import OrderActions from "../components/order-actions"; @@ -114,7 +111,6 @@ import OrderActions from "../components/order-actions";
114 111
115 import orderActionMixin from "../mixin/order-action"; 112 import orderActionMixin from "../mixin/order-action";
116 import orderInSaleActionMixin from "../mixin/order-in-sale-action"; 113 import orderInSaleActionMixin from "../mixin/order-in-sale-action";
117 -import routeMixin from "../mixin/route";  
118 114
119 import PlatformFeeInfo from "../components/platform-fee-info"; 115 import PlatformFeeInfo from "../components/platform-fee-info";
120 116
@@ -125,7 +121,7 @@ const { mapActions, mapState, mapGetters } = createNamespacedHelpers( @@ -125,7 +121,7 @@ const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
125 ); 121 );
126 122
127 export default { 123 export default {
128 - mixins: [orderActionMixin, orderInSaleActionMixin, routeMixin], 124 + mixins: [orderActionMixin, orderInSaleActionMixin],
129 components: { 125 components: {
130 AddressInfo, 126 AddressInfo,
131 OrderItemInfo, 127 OrderItemInfo,
@@ -153,7 +149,7 @@ export default { @@ -153,7 +149,7 @@ export default {
153 }); 149 });
154 }, 150 },
155 computed: { 151 computed: {
156 - ...mapState(["orderDetail", "from"]), 152 + ...mapState(["orderDetail"]),
157 ...mapGetters([ 153 ...mapGetters([
158 "lastExpressInfo", 154 "lastExpressInfo",
159 "priceInfo", 155 "priceInfo",
@@ -163,10 +159,6 @@ export default { @@ -163,10 +159,6 @@ export default {
163 ]) 159 ])
164 }, 160 },
165 beforeRouteLeave(to, from, next) { 161 beforeRouteLeave(to, from, next) {
166 - if (this.from.name === "OrderPay" || this.hasAction) {  
167 - to.params.isRefetch = true;  
168 - }  
169 - this.hasAction = false;  
170 next(); 162 next();
171 }, 163 },
172 methods: { 164 methods: {
1 <template> 1 <template>
2 - <router-link :to="toLinkParam"> 2 + <router-link :to="toLinkParam" @click.native="onClickHandler">
3 <div class="order-item-wrapper"> 3 <div class="order-item-wrapper">
4 <div class="item-img"> 4 <div class="item-img">
5 <image-format 5 <image-format
@@ -33,8 +33,10 @@ @@ -33,8 +33,10 @@
33 <script> 33 <script>
34 import { ownType, orderActionsMap } from "constants/order-constants"; 34 import { ownType, orderActionsMap } from "constants/order-constants";
35 import { routeNames as detailRouteNames } from "../../order-detail"; 35 import { routeNames as detailRouteNames } from "../../order-detail";
  36 +import refreshMixin from "../../mixin/refresh";
36 37
37 export default { 38 export default {
  39 + mixins: [refreshMixin],
38 props: { 40 props: {
39 order: { 41 order: {
40 type: Object, 42 type: Object,
@@ -78,6 +80,11 @@ export default { @@ -78,6 +80,11 @@ export default {
78 } 80 }
79 return linkParam; 81 return linkParam;
80 } 82 }
  83 + },
  84 + methods: {
  85 + onClickHandler() {
  86 + this.setIsRefresh(false);
  87 + }
81 } 88 }
82 }; 89 };
83 </script> 90 </script>
1 <template> 1 <template>
2 - <router-link :to="toLinkParam"> 2 + <router-link :to="toLinkParam" @click.native="onClickHandler">
3 <div class="order-item-wrapper"> 3 <div class="order-item-wrapper">
4 <div class="item-img"> 4 <div class="item-img">
5 <image-format 5 <image-format
@@ -38,8 +38,10 @@ @@ -38,8 +38,10 @@
38 <script> 38 <script>
39 import { ownType } from "constants/order-constants"; 39 import { ownType } from "constants/order-constants";
40 import { routeNames as detailRouteNames } from "../../order-detail"; 40 import { routeNames as detailRouteNames } from "../../order-detail";
  41 +import refreshMixin from "../../mixin/refresh";
41 42
42 export default { 43 export default {
  44 + mixins: [refreshMixin],
43 props: { 45 props: {
44 order: { 46 order: {
45 type: Object, 47 type: Object,
@@ -70,6 +72,11 @@ export default { @@ -70,6 +72,11 @@ export default {
70 ); 72 );
71 } 73 }
72 } 74 }
  75 + },
  76 + methods: {
  77 + onClickHandler() {
  78 + this.setIsRefresh(false);
  79 + }
73 } 80 }
74 }; 81 };
75 </script> 82 </script>
@@ -107,11 +107,8 @@ export default { @@ -107,11 +107,8 @@ export default {
107 // 获取订单数据 107 // 获取订单数据
108 beforeRouteEnter(to, from, next) { 108 beforeRouteEnter(to, from, next) {
109 next(vm => { 109 next(vm => {
110 - const { isRefetch = false } = to.params;  
111 - if (isRefetch || !from.name) {  
112 - vm.$store.commit(`${IN_SALE_STORE_PATH}/resetData`);  
113 - vm.$store.dispatch(`${IN_SALE_STORE_PATH}/fetchEntryOrderList`);  
114 - } 110 + vm.$store.commit(`${IN_SALE_STORE_PATH}/resetData`);
  111 + vm.$store.dispatch(`${IN_SALE_STORE_PATH}/fetchEntryOrderList`);
115 }); 112 });
116 }, 113 },
117 activated() { 114 activated() {
@@ -77,10 +77,11 @@ import { orderStatusKey, getOrderStatus } from "constants/order-constants"; @@ -77,10 +77,11 @@ import { orderStatusKey, getOrderStatus } from "constants/order-constants";
77 77
78 const STORE_PATH = "order/orderList"; 78 const STORE_PATH = "order/orderList";
79 79
80 -const detailRouterNames = ["buyOrderDetail", "sellOrderDetail"];  
81 -const listRouterNames = ["OrderList", "InSaleOrderList"];  
82 -  
83 -const refetchBackList = ["OrderList"]; 80 +const clearScrollBlackList = [
  81 + "buyOrderDetail",
  82 + "sellOrderDetail",
  83 + "orderLogisticsInfo"
  84 +];
84 85
85 const { mapActions, mapState, mapMutations } = createNamespacedHelpers( 86 const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
86 STORE_PATH 87 STORE_PATH
@@ -109,7 +110,7 @@ export default { @@ -109,7 +110,7 @@ export default {
109 status: Number 110 status: Number
110 }, 111 },
111 computed: { 112 computed: {
112 - ...mapState(["orderListByType"]), 113 + ...mapState(["orderListByType", "isRefresh"]),
113 orderStatus() { 114 orderStatus() {
114 return this.orderListByType[orderStatusKey(this.owner, this.status)]; 115 return this.orderListByType[orderStatusKey(this.owner, this.status)];
115 }, 116 },
@@ -133,44 +134,46 @@ export default { @@ -133,44 +134,46 @@ export default {
133 // 只有列表进入详情返回时不刷新列表 134 // 只有列表进入详情返回时不刷新列表
134 beforeRouteEnter(to, from, next) { 135 beforeRouteEnter(to, from, next) {
135 next(vm => { 136 next(vm => {
136 - let { owner, status, isRefetch = false } = to.params;  
137 - status = getOrderStatus(owner, status);  
138 - // if (detailRouterNames.includes(from.name)) {  
139 - // const { from: detailFrom } = vm.$store.state.order.orderDetail;  
140 - // if (listRouterNames.includes(detailFrom.name)) {  
141 - // isRefetch = false;  
142 - // }  
143 - // }  
144 - if (isRefetch || !from.name) { 137 + console.log("------order----list-----isRefresh---", vm.isRefresh);
  138 + if (vm.isRefresh) {
  139 + let { owner, status } = to.params;
  140 + status = getOrderStatus(owner, status);
145 vm.$store.commit(`${STORE_PATH}/resetData`, { owner, status }); 141 vm.$store.commit(`${STORE_PATH}/resetData`, { owner, status });
146 vm.$store.dispatch(`${STORE_PATH}/fetchOrderList`, { owner, status }); 142 vm.$store.dispatch(`${STORE_PATH}/fetchOrderList`, { owner, status });
  143 + } else {
  144 + vm.setIsRefresh(true);
147 } 145 }
148 }); 146 });
149 }, 147 },
150 148
151 beforeRouteLeave(to, from, next) { 149 beforeRouteLeave(to, from, next) {
152 - if (!detailRouterNames.includes(to.name)) { 150 + if (!clearScrollBlackList.includes(to.name)) {
153 this.scrollY = 0; 151 this.scrollY = 0;
154 } 152 }
155 next(); 153 next();
156 }, 154 },
157 155
158 beforeRouteUpdate(to, from, next) { 156 beforeRouteUpdate(to, from, next) {
  157 + // 重置滚动位置
  158 + this.reinitScroll();
  159 + // 获取数据
159 let { owner, status } = to.params; 160 let { owner, status } = to.params;
160 status = getOrderStatus(owner, status); 161 status = getOrderStatus(owner, status);
161 -  
162 - this.scrollY = 0;  
163 - this.$refs.scroll.scrollTo(this.scrollY);  
164 this.resetData({ owner, status }); 162 this.resetData({ owner, status });
165 this.fetchOrderList({ owner, status }); 163 this.fetchOrderList({ owner, status });
166 next(); 164 next();
167 }, 165 },
168 methods: { 166 methods: {
169 ...mapActions(["fetchOrderList", "confirmReceipt"]), 167 ...mapActions(["fetchOrderList", "confirmReceipt"]),
170 - ...mapMutations(["resetData"]), 168 + ...mapMutations(["resetData", "setIsRefresh"]),
171 scrollHandler({ y }) { 169 scrollHandler({ y }) {
172 this.scrollY = -y; 170 this.scrollY = -y;
173 }, 171 },
  172 + // 滚动位置清零
  173 + reinitScroll() {
  174 + this.scrollY = 0;
  175 + this.$refs.scroll.scrollTo(this.scrollY);
  176 + },
174 fetchData() { 177 fetchData() {
175 if (this.isScrollFetch) { 178 if (this.isScrollFetch) {
176 this.fetchOrderList({ 179 this.fetchOrderList({
@@ -157,7 +157,6 @@ export default { @@ -157,7 +157,6 @@ export default {
157 case UserType.sell: { 157 case UserType.sell: {
158 this.$router.replace({ 158 this.$router.replace({
159 name: 'InSaleOrderList', 159 name: 'InSaleOrderList',
160 - isRefetch: true  
161 }); 160 });
162 break; 161 break;
163 } 162 }
@@ -166,7 +165,6 @@ export default { @@ -166,7 +165,6 @@ export default {
166 name: 'OrderList', 165 name: 'OrderList',
167 params: { 166 params: {
168 owner: UserType.buy, 167 owner: UserType.buy,
169 - isRefetch: true  
170 } 168 }
171 }); 169 });
172 break; 170 break;
@@ -176,7 +174,6 @@ export default { @@ -176,7 +174,6 @@ export default {
176 name: 'OrderList', 174 name: 'OrderList',
177 params: { 175 params: {
178 owner: UserType.buy, 176 owner: UserType.buy,
179 - isRefetch: true  
180 } 177 }
181 }); 178 });
182 break; 179 break;
@@ -583,7 +583,6 @@ export default { @@ -583,7 +583,6 @@ export default {
583 params: { 583 params: {
584 owner: this.selectSizeConfig.type, 584 owner: this.selectSizeConfig.type,
585 status: 2, // 待付款 585 status: 2, // 待付款
586 - isRefetch: true  
587 }, 586 },
588 }); 587 });
589 }, 588 },
@@ -95,7 +95,6 @@ export default function() { @@ -95,7 +95,6 @@ export default function() {
95 title: '出售中', 95 title: '出售中',
96 num: state.sellerNum, 96 num: state.sellerNum,
97 page: 'InSaleOrderList', 97 page: 'InSaleOrderList',
98 - params: { isRefetch: true },  
99 }, 98 },
100 order: { name: 'order' }, 99 order: { name: 'order' },
101 resource1: { name: 'resource1', data: state.resource1 }, 100 resource1: { name: 'resource1', data: state.resource1 },
@@ -110,14 +109,14 @@ export default function() { @@ -110,14 +109,14 @@ export default function() {
110 title: '我的购买订单', 109 title: '我的购买订单',
111 num: state.buyNum, 110 num: state.buyNum,
112 page: 'OrderList', 111 page: 'OrderList',
113 - params: { owner: ownType.BUY, status: 1, isRefetch: true }, 112 + params: { owner: ownType.BUY, status: 1 },
114 }, 113 },
115 buy: { 114 buy: {
116 name: 'buy', 115 name: 'buy',
117 title: '我的求购', 116 title: '我的求购',
118 num: state.askBuyNum, 117 num: state.askBuyNum,
119 page: 'OrderList', 118 page: 'OrderList',
120 - params: { owner: ownType.BUY, status: 7, isRefetch: true }, 119 + params: { owner: ownType.BUY, status: 7 },
121 }, 120 },
122 collect: { 121 collect: {
123 name: 'collect', 122 name: 'collect',
@@ -3,15 +3,11 @@ export default function() { @@ -3,15 +3,11 @@ export default function() {
3 namespaced: true, 3 namespaced: true,
4 state: { 4 state: {
5 orderDetail: {}, 5 orderDetail: {},
6 - from: {},  
7 }, 6 },
8 mutations: { 7 mutations: {
9 initData(state, data) { 8 initData(state, data) {
10 state.orderDetail = data; 9 state.orderDetail = data;
11 }, 10 },
12 - setFrom(state, from) {  
13 - state.from = from;  
14 - },  
15 }, 11 },
16 getters: { 12 getters: {
17 userAddress: state => state.orderDetail.userAddress || {}, // 用户使用地址 13 userAddress: state => state.orderDetail.userAddress || {}, // 用户使用地址
@@ -14,7 +14,7 @@ function initialOrderState() { @@ -14,7 +14,7 @@ function initialOrderState() {
14 // scroll 组件参数,是否触发上拉事件 14 // scroll 组件参数,是否触发上拉事件
15 pullUpLoad: true, 15 pullUpLoad: true,
16 isShowEmpty: false, 16 isShowEmpty: false,
17 - hasAction: false 17 + hasAction: false,
18 }; 18 };
19 } 19 }
20 20
@@ -34,6 +34,7 @@ const initialState = () => { @@ -34,6 +34,7 @@ const initialState = () => {
34 34
35 return { 35 return {
36 orderListByType, 36 orderListByType,
  37 + isRefresh: true,
37 }; 38 };
38 }; 39 };
39 40
@@ -42,6 +43,9 @@ export default function() { @@ -42,6 +43,9 @@ export default function() {
42 namespaced: true, 43 namespaced: true,
43 state: initialState, 44 state: initialState,
44 mutations: { 45 mutations: {
  46 + setIsRefresh(state, isRefresh) {
  47 + state.isRefresh = isRefresh;
  48 + },
45 setOrderList(state, { res, owner, status }) { 49 setOrderList(state, { res, owner, status }) {
46 let { page, pagetotal, data = [] } = res; 50 let { page, pagetotal, data = [] } = res;
47 const orderState = state.orderListByType[orderStatusKey(owner, status)]; 51 const orderState = state.orderListByType[orderStatusKey(owner, status)];