Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop
Showing
5 changed files
with
75 additions
and
27 deletions
@@ -5,11 +5,7 @@ | @@ -5,11 +5,7 @@ | ||
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | 7 | ||
8 | -// const _ = require('lodash'); | ||
9 | - | ||
10 | -// const helpers = global.yoho.helpers; | ||
11 | const api = global.yoho.API; | 8 | const api = global.yoho.API; |
12 | -const camelCase = global.yoho.camelCase; | ||
13 | 9 | ||
14 | /** | 10 | /** |
15 | * 商品详情 | 11 | * 商品详情 |
@@ -5,12 +5,13 @@ var util = require('common/util'); | @@ -5,12 +5,13 @@ var util = require('common/util'); | ||
5 | $(() => { | 5 | $(() => { |
6 | window.addEventListener('touchmove', function() { | 6 | window.addEventListener('touchmove', function() { |
7 | var topHeight = document.body.scrollTop; | 7 | var topHeight = document.body.scrollTop; |
8 | + | ||
8 | if (topHeight > 50) { | 9 | if (topHeight > 50) { |
9 | $('#header').addClass('top-change'); | 10 | $('#header').addClass('top-change'); |
10 | } else { | 11 | } else { |
11 | $('#header').removeClass('top-change'); | 12 | $('#header').removeClass('top-change'); |
12 | } | 13 | } |
13 | - }) | 14 | + }); |
14 | 15 | ||
15 | if (!yoho.isLogin) { | 16 | if (!yoho.isLogin) { |
16 | $('.auth').addClass('no-intercept'); | 17 | $('.auth').addClass('no-intercept'); |
@@ -88,6 +88,12 @@ | @@ -88,6 +88,12 @@ | ||
88 | interceptClick.intercept('/me/service'); | 88 | interceptClick.intercept('/me/service'); |
89 | return false; | 89 | return false; |
90 | }); | 90 | }); |
91 | + | ||
92 | + document.addEventListener('visibilitychange', () => { | ||
93 | + if (!document.hidden) { | ||
94 | + this.reload(); | ||
95 | + } | ||
96 | + }); | ||
91 | }, | 97 | }, |
92 | methods: { | 98 | methods: { |
93 | updateNavBar() { | 99 | updateNavBar() { |
@@ -98,6 +104,14 @@ | @@ -98,6 +104,14 @@ | ||
98 | header: header | 104 | header: header |
99 | }); | 105 | }); |
100 | }, | 106 | }, |
107 | + reload() { | ||
108 | + this.show = false; | ||
109 | + this.order = {}; | ||
110 | + this.selected = {}; | ||
111 | + this.cancelbusy = false; | ||
112 | + | ||
113 | + this.getOrderData(); | ||
114 | + }, | ||
101 | getOrderData() { | 115 | getOrderData() { |
102 | $.ajax({ | 116 | $.ajax({ |
103 | url: '/me/get-order', | 117 | url: '/me/get-order', |
@@ -150,7 +164,7 @@ | @@ -150,7 +164,7 @@ | ||
150 | if (result.code === 200) { | 164 | if (result.code === 200) { |
151 | tip('取消成功'); | 165 | tip('取消成功'); |
152 | setTimeout(() => { | 166 | setTimeout(() => { |
153 | - location.reload(); | 167 | + this.reload(); |
154 | }, 1000); | 168 | }, 1000); |
155 | } else if (result.code !== 500) { | 169 | } else if (result.code !== 500) { |
156 | tip(result.message); | 170 | tip(result.message); |
@@ -190,7 +204,7 @@ | @@ -190,7 +204,7 @@ | ||
190 | reason: this.options.length ? this.options[0].reason : null | 204 | reason: this.options.length ? this.options[0].reason : null |
191 | }, (result) => { | 205 | }, (result) => { |
192 | if (result.code === 200) { | 206 | if (result.code === 200) { |
193 | - location.reload(); | 207 | + this.reload(); |
194 | } | 208 | } |
195 | }); | 209 | }); |
196 | }; | 210 | }; |
@@ -225,7 +239,9 @@ | @@ -225,7 +239,9 @@ | ||
225 | }); | 239 | }); |
226 | }, | 240 | }, |
227 | confirmGoods(code) { | 241 | confirmGoods(code) { |
228 | - Modal.confirm('', '确认收货', function() { | 242 | + let _this = this; |
243 | + | ||
244 | + Modal.confirm('', '确认收货吗?', function() { | ||
229 | this.hide(); | 245 | this.hide(); |
230 | $.ajax({ | 246 | $.ajax({ |
231 | url: '/me/confirmReceive', | 247 | url: '/me/confirmReceive', |
@@ -235,7 +251,7 @@ | @@ -235,7 +251,7 @@ | ||
235 | } | 251 | } |
236 | }).then(result => { | 252 | }).then(result => { |
237 | if (result.code === 200) { | 253 | if (result.code === 200) { |
238 | - location.reload(); | 254 | + _this.reload(); |
239 | } else if (result.code !== 500) { | 255 | } else if (result.code !== 500) { |
240 | tip(result.message); | 256 | tip(result.message); |
241 | } | 257 | } |
@@ -73,22 +73,38 @@ | @@ -73,22 +73,38 @@ | ||
73 | limit: 10, | 73 | limit: 10, |
74 | pageTotal: 1, | 74 | pageTotal: 1, |
75 | type: this.$parent.$data.type, | 75 | type: this.$parent.$data.type, |
76 | - orderList: [], | ||
77 | busy: false, | 76 | busy: false, |
77 | + cancelbusy: false, | ||
78 | emptybox: 'hide', | 78 | emptybox: 'hide', |
79 | + currentCode: '', | ||
79 | selected: {}, | 80 | selected: {}, |
80 | options: [], | 81 | options: [], |
81 | - currentCode: '', | ||
82 | - cancelbusy: false | 82 | + orderList: [] |
83 | }; | 83 | }; |
84 | }, | 84 | }, |
85 | - | ||
86 | - ready() { | 85 | + created() { |
87 | this.getOrderData(); | 86 | this.getOrderData(); |
88 | this.getCancelReason(); | 87 | this.getCancelReason(); |
89 | - }, | ||
90 | 88 | ||
89 | + document.addEventListener('visibilitychange', () => { | ||
90 | + if (!document.hidden) { | ||
91 | + this.reload(); | ||
92 | + } | ||
93 | + }); | ||
94 | + }, | ||
91 | methods: { | 95 | methods: { |
96 | + reload() { | ||
97 | + this.page = 0; | ||
98 | + this.pageTotal = 1; | ||
99 | + this.busy = false; | ||
100 | + this.cancelbusy = false; | ||
101 | + this.emptybox = 'hide'; | ||
102 | + this.currentCode = ''; | ||
103 | + this.selected = {}; | ||
104 | + this.orderList = []; | ||
105 | + | ||
106 | + this.getOrderData(); | ||
107 | + }, | ||
92 | getOrderData() { | 108 | getOrderData() { |
93 | this.busy = true; | 109 | this.busy = true; |
94 | if (this.page >= this.pageTotal) { | 110 | if (this.page >= this.pageTotal) { |
@@ -129,7 +145,7 @@ | @@ -129,7 +145,7 @@ | ||
129 | if (result.code === 200) { | 145 | if (result.code === 200) { |
130 | tip('取消成功'); | 146 | tip('取消成功'); |
131 | setTimeout(() => { | 147 | setTimeout(() => { |
132 | - location.reload(); | 148 | + this.reload(); |
133 | }, 1000); | 149 | }, 1000); |
134 | } else if (result.code !== 500) { | 150 | } else if (result.code !== 500) { |
135 | tip(result.message); | 151 | tip(result.message); |
@@ -158,7 +174,7 @@ | @@ -158,7 +174,7 @@ | ||
158 | reason: this.options.length ? this.options[0].reason : null | 174 | reason: this.options.length ? this.options[0].reason : null |
159 | }, (result) => { | 175 | }, (result) => { |
160 | if (result.code === 200) { | 176 | if (result.code === 200) { |
161 | - location.reload(); | 177 | + this.reload(); |
162 | } | 178 | } |
163 | }); | 179 | }); |
164 | }; | 180 | }; |
@@ -209,7 +225,9 @@ | @@ -209,7 +225,9 @@ | ||
209 | }); | 225 | }); |
210 | }, | 226 | }, |
211 | confirmGoods(code) { | 227 | confirmGoods(code) { |
212 | - Modal.confirm('', '确认收货', function() { | 228 | + let _this = this; |
229 | + | ||
230 | + Modal.confirm('', '确认收货吗?', function() { | ||
213 | this.hide(); | 231 | this.hide(); |
214 | $.ajax({ | 232 | $.ajax({ |
215 | url: '/me/confirmReceive', | 233 | url: '/me/confirmReceive', |
@@ -219,7 +237,7 @@ | @@ -219,7 +237,7 @@ | ||
219 | } | 237 | } |
220 | }).then(result => { | 238 | }).then(result => { |
221 | if (result.code === 200) { | 239 | if (result.code === 200) { |
222 | - location.reload(); | 240 | + _this.reload(); |
223 | } else if (result.code !== 500) { | 241 | } else if (result.code !== 500) { |
224 | tip(result.message); | 242 | tip(result.message); |
225 | } | 243 | } |
@@ -65,10 +65,25 @@ | @@ -65,10 +65,25 @@ | ||
65 | emptybox: 'hide' | 65 | emptybox: 'hide' |
66 | }; | 66 | }; |
67 | }, | 67 | }, |
68 | - ready() { | ||
69 | - this.getRefundData(); | 68 | + created() { |
69 | + this.reload(); | ||
70 | + | ||
71 | + document.addEventListener('visibilitychange', () => { | ||
72 | + if (!document.hidden) { | ||
73 | + this.reload(); | ||
74 | + } | ||
75 | + }); | ||
70 | }, | 76 | }, |
71 | methods: { | 77 | methods: { |
78 | + reload() { | ||
79 | + this.page= 0; | ||
80 | + this.pageTotal = 1; | ||
81 | + this.orderList= []; | ||
82 | + this.busy= false; | ||
83 | + this.emptybox= 'hide'; | ||
84 | + | ||
85 | + this.getRefundData(); | ||
86 | + }, | ||
72 | getRefundData() { | 87 | getRefundData() { |
73 | this.busy = true; | 88 | this.busy = true; |
74 | if (this.page >= this.pageTotal) { | 89 | if (this.page >= this.pageTotal) { |
@@ -94,14 +109,13 @@ | @@ -94,14 +109,13 @@ | ||
94 | tip('网络错误'); | 109 | tip('网络错误'); |
95 | }); | 110 | }); |
96 | }, | 111 | }, |
97 | - /** | ||
98 | - * 取消申请 | ||
99 | - * @param id | ||
100 | - * @param type refundType 1为退货,2为换货 | ||
101 | - */ | ||
102 | cancelApply(id, type) { | 112 | cancelApply(id, type) { |
113 | + let _this = this; | ||
114 | + | ||
103 | Modal.confirm('', '确认取消吗?', function() { | 115 | Modal.confirm('', '确认取消吗?', function() { |
104 | this.hide(); | 116 | this.hide(); |
117 | + | ||
118 | + // type refundType 1为退货,2为换货 | ||
105 | $.ajax({ | 119 | $.ajax({ |
106 | url: '/me/return/' + (Number(type) === 2 ? 'exchange' : 'refund') + '/cancel-apply', | 120 | url: '/me/return/' + (Number(type) === 2 ? 'exchange' : 'refund') + '/cancel-apply', |
107 | type: 'post', | 121 | type: 'post', |
@@ -110,7 +124,10 @@ | @@ -110,7 +124,10 @@ | ||
110 | } | 124 | } |
111 | }).then(result => { | 125 | }).then(result => { |
112 | if (result.code === 200) { | 126 | if (result.code === 200) { |
113 | - location.reload(); | 127 | + tip('取消成功'); |
128 | + setTimeout(() => { | ||
129 | + _this.reload(); | ||
130 | + }, 1000); | ||
114 | } else { | 131 | } else { |
115 | tip(result.message); | 132 | tip(result.message); |
116 | } | 133 | } |
-
Please register or login to post a comment