Authored by 沈志敏

fix bug

@@ -6,12 +6,10 @@ const exchangeModel = require('../models/exchange'); @@ -6,12 +6,10 @@ const exchangeModel = require('../models/exchange');
6 6
7 const exchange = { 7 const exchange = {
8 exchange(req, res) { 8 exchange(req, res) {
9 - const view = { 9 + res.render('exchange', {
10 module: 'me', 10 module: 'me',
11 page: 'exchange' 11 page: 'exchange'
12 - };  
13 -  
14 - res.render('exchange', view); 12 + });
15 }, 13 },
16 14
17 // 订单 可换货商品列表 15 // 订单 可换货商品列表
@@ -95,7 +95,7 @@ const refund = { @@ -95,7 +95,7 @@ const refund = {
95 refundOrders(req, res) { 95 refundOrders(req, res) {
96 res.render('refund-order', { 96 res.render('refund-order', {
97 module: 'me', 97 module: 'me',
98 - page: 'return' 98 + page: 'refund-order'
99 }); 99 });
100 }, 100 },
101 101
@@ -46,10 +46,10 @@ router.post('/me/del-favdel', favorite.deletefav); // 个人中心 - 收藏商 @@ -46,10 +46,10 @@ router.post('/me/del-favdel', favorite.deletefav); // 个人中心 - 收藏商
46 46
47 // 退换货 47 // 退换货
48 router.get('/me/return', refund.refundOrders); // 退换货 - 订单列表 48 router.get('/me/return', refund.refundOrders); // 退换货 - 订单列表
  49 +router.get('/me/return/getOrderList', refund.getRefundOrders); // 退换货 - 获取订单列表数据
49 router.get('/me/return/refund/detail/:applyId', refund.refundStatus); // 退换货 - 退货状态 50 router.get('/me/return/refund/detail/:applyId', refund.refundStatus); // 退换货 - 退货状态
50 router.get('/me/return/exchange/detail/:applyId', refund.exchangeStatus); // 退换货 - 换货状态 51 router.get('/me/return/exchange/detail/:applyId', refund.exchangeStatus); // 退换货 - 换货状态
51 router.get('/me/return/status-detail', refund.statusDetail); // 退换货 - 状态详细信息 52 router.get('/me/return/status-detail', refund.statusDetail); // 退换货 - 状态详细信息
52 -router.get('/me/return/getOrderList', refund.getRefundOrders); // 退换货 - 获取订单列表数据  
53 53
54 // 退货申请 54 // 退货申请
55 router.get('/me/return/refund', refund.refund); // 退货申请 55 router.get('/me/return/refund', refund.refund); // 退货申请
1 <div class="order-detail" id="order-detail"> 1 <div class="order-detail" id="order-detail">
2 - <order-detail></order-detail>  
3 - <input type="hidden" id="order-code" value="{{orderCode}}">  
4 -</div>  
  2 + <order-detail order_code="{{orderCode}}"></order-detail>
  3 +</div>
1 const yoho = require('yoho'); 1 const yoho = require('yoho');
  2 +const interceptClick = require('common/intercept-click');
  3 +const Modal = require('common/modal');
2 4
3 const getImgHost = function(url, bucket = 'goodsimg') { 5 const getImgHost = function(url, bucket = 'goodsimg') {
4 let urlArr = url.split('/'), 6 let urlArr = url.split('/'),
@@ -34,8 +36,57 @@ const getImgUrl = function(src, width = 300, height = 300, mode = 2) { @@ -34,8 +36,57 @@ const getImgUrl = function(src, width = 300, height = 300, mode = 2) {
34 }) : ''; 36 }) : '';
35 }; 37 };
36 38
  39 +// 退换货 申请 成功, 打开 modal
  40 +const applySuccuss = function(type, applyId) {
  41 + yoho.store.set('orderDetail', true);
  42 +
  43 + const config = {
  44 + exchange: {
  45 + name: '换货',
  46 + detailUrl: `/me/return/exchange/detail/${applyId}`
  47 + },
  48 + refund: {
  49 + name: '退货',
  50 + detailUrl: `/me/return/refund/detail/${applyId}`
  51 + }
  52 + };
  53 + const kind = config[type];
  54 + const goStatusPage = function() {
  55 + const header = Object.assign({}, interceptClick.defaultTitleMap[1]);
  56 +
  57 + header.left.action = location.origin + '/me/return';
  58 + header.title.des = `${kind.name}状态`;
  59 + return yoho.goNewPage({
  60 + header: header,
  61 + url: location.origin + kind.detailUrl,
  62 + backThrough: '1'
  63 + });
  64 + };
  65 +
  66 + const modal = new Modal({
  67 + styleClass: 'return-success-modal',
  68 + text: `${kind.name}申请已提交,请等待审核.....`,
  69 + buttons: [{
  70 + text: '返回订单',
  71 + handler: function() {
  72 + this.hide();
  73 + yoho.goBack();
  74 + }
  75 + }, {
  76 + text: '查看进度',
  77 + handler: function() {
  78 + this.hide();
  79 + goStatusPage();
  80 + }
  81 + }]
  82 + });
  83 +
  84 + modal.show();
  85 +};
  86 +
37 module.exports = { 87 module.exports = {
38 getImgHost, 88 getImgHost,
39 getImgUrl, 89 getImgUrl,
  90 + applySuccuss,
40 visibilitychange 91 visibilitychange
41 }; 92 };
@@ -15,9 +15,6 @@ require('common/count-down'); @@ -15,9 +15,6 @@ require('common/count-down');
15 yoho.ready(() => { 15 yoho.ready(() => {
16 new Vue({ 16 new Vue({
17 el: '#order-detail', 17 el: '#order-detail',
18 - data: {  
19 - orderCode: document.getElementById('order-code').value  
20 - },  
21 components: { 18 components: {
22 OrderDetail 19 OrderDetail
23 } 20 }
1 -const yoho = require('yoho');  
2 -const interceptClick = require('common/intercept-click');  
3 -const Modal = require('common/modal');  
4 -  
5 -// 退换货 申请 成功, 打开 modal  
6 -exports.applySuccuss = function(type, applyId) {  
7 - let config = {  
8 - exchange: {  
9 - name: '换货',  
10 - detailUrl: `/me/return/exchange/detail/${applyId}`  
11 - },  
12 - refund: {  
13 - name: '退货',  
14 - detailUrl: `/me/return/refund/detail/${applyId}`  
15 - }  
16 - };  
17 -  
18 - let kind = config[type];  
19 -  
20 - let goStatusPage = function() {  
21 - let header = Object.assign({}, interceptClick.defaultTitleMap[1]);  
22 -  
23 - header.left.action = location.origin + '/me/return';  
24 - header.title.des = `${kind.name}状态`;  
25 - return yoho.goNewPage({  
26 - header: header,  
27 - url: location.origin + kind.detailUrl,  
28 - backThrough: '1'  
29 - });  
30 - };  
31 -  
32 - const modal = new Modal({  
33 - styleClass: 'return-success-modal',  
34 - text: `${kind.name}申请已提交,请等待审核.....`,  
35 - buttons: [{  
36 - text: '返回订单',  
37 - handler: function() {  
38 - this.hide();  
39 - yoho.goBack();  
40 - }  
41 - }, {  
42 - text: '查看进度',  
43 - handler: function() {  
44 - this.hide();  
45 - goStatusPage();  
46 - }  
47 - }]  
48 - });  
49 -  
50 - modal.show();  
51 -};  
@@ -38,8 +38,8 @@ @@ -38,8 +38,8 @@
38 const tip = require('common/tip'); 38 const tip = require('common/tip');
39 const bus = require('common/vue-bus'); 39 const bus = require('common/vue-bus');
40 const Modal = require('common/modal'); 40 const Modal = require('common/modal');
  41 + const returnUtil = require('common/util');
41 const yoho = require('yoho'); 42 const yoho = require('yoho');
42 - const returnUtil = require('me/return/util');  
43 43
44 const productList = require('me/return/list.vue'); 44 const productList = require('me/return/list.vue');
45 const featureSelector = require('component/product/feature-selector.vue'); 45 const featureSelector = require('component/product/feature-selector.vue');
@@ -300,12 +300,12 @@ @@ -300,12 +300,12 @@
300 body { 300 body {
301 background-color: #f6f6f6; 301 background-color: #f6f6f6;
302 } 302 }
303 - 303 +
304 .exchange-info { 304 .exchange-info {
305 margin: 30px 0; 305 margin: 30px 0;
306 background-color: #fff; 306 background-color: #fff;
307 } 307 }
308 - 308 +
309 .exchange-address { 309 .exchange-address {
310 .consignee { 310 .consignee {
311 font-size: 32px; 311 font-size: 32px;
@@ -317,7 +317,7 @@ @@ -317,7 +317,7 @@
317 color: #b0b0b0; 317 color: #b0b0b0;
318 } 318 }
319 } 319 }
320 - 320 +
321 .exchange-mode { 321 .exchange-mode {
322 font-size: 34px; 322 font-size: 34px;
323 .icon, 323 .icon,
@@ -72,6 +72,7 @@ @@ -72,6 +72,7 @@
72 const genderSelect = require('common/select'); 72 const genderSelect = require('common/select');
73 73
74 module.exports = { 74 module.exports = {
  75 + props: ['order_code'],
75 data() { 76 data() {
76 return { 77 return {
77 show: false, 78 show: false,
@@ -90,6 +91,12 @@ @@ -90,6 +91,12 @@
90 interceptClick.intercept('/me/service'); 91 interceptClick.intercept('/me/service');
91 return false; 92 return false;
92 }); 93 });
  94 +
  95 + document.addEventListener('visibilitychange', () => {
  96 + if (!document.hidden && yoho.store.get('orderDetail')) {
  97 + this.reload();
  98 + }
  99 + });
93 }, 100 },
94 methods: { 101 methods: {
95 updateNavBar() { 102 updateNavBar() {
@@ -111,10 +118,12 @@ @@ -111,10 +118,12 @@
111 this.getOrderData(); 118 this.getOrderData();
112 }, 119 },
113 getOrderData() { 120 getOrderData() {
  121 + yoho.store.remove('orderDetail');
  122 +
114 $.ajax({ 123 $.ajax({
115 url: '/me/get-order', 124 url: '/me/get-order',
116 data: { 125 data: {
117 - orderCode: this.$parent.$data.orderCode 126 + orderCode: this.order_code
118 } 127 }
119 }).then(result => { 128 }).then(result => {
120 if (result.code === 200) { 129 if (result.code === 200) {
@@ -52,10 +52,10 @@ @@ -52,10 +52,10 @@
52 const $ = require('jquery'); 52 const $ = require('jquery');
53 const qs = require('yoho-qs'); 53 const qs = require('yoho-qs');
54 const modal = require('common/modal'); 54 const modal = require('common/modal');
  55 + const returnUtil = require('common/util');
55 const yoho = require('yoho'); 56 const yoho = require('yoho');
56 const productList = require('me/return/list.vue'); 57 const productList = require('me/return/list.vue');
57 const reasonConfig = require('me/return/reason'); 58 const reasonConfig = require('me/return/reason');
58 - const returnUtil = require('me/return/util');  
59 59
60 module.exports = { 60 module.exports = {
61 data() { 61 data() {
@@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
156 const self = this; 156 const self = this;
157 157
158 if (!this.checkSubmitData()) { 158 if (!this.checkSubmitData()) {
159 - modal.alert('请填写完整退货信息'); 159 + modal.alert('请填写完整退货信息');
160 } 160 }
161 $.ajax({ 161 $.ajax({
162 method: 'POST', 162 method: 'POST',