Authored by 郭成尧

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

 the commit.
@@ -34,13 +34,12 @@ const refund = { @@ -34,13 +34,12 @@ const refund = {
34 }).catch(next); 34 }).catch(next);
35 }, 35 },
36 logistics(req, res, next) { 36 logistics(req, res, next) {
37 - const applyid = req.query.applyid;  
38 -  
39 refundModel.getExpressCompany().then(result => { 37 refundModel.getExpressCompany().then(result => {
40 res.render('logistics', { 38 res.render('logistics', {
41 module: 'me', 39 module: 'me',
42 page: 'logistics', 40 page: 'logistics',
43 - applyid: applyid, 41 + applyid: req.query.applyid,
  42 + type: req.query.type,
44 company_list: result ? JSON.stringify(result.data) : '' 43 company_list: result ? JSON.stringify(result.data) : ''
45 }); 44 });
46 }).catch(next); 45 }).catch(next);
@@ -48,11 +47,13 @@ const refund = { @@ -48,11 +47,13 @@ const refund = {
48 saveLogistics(req, res, next) { 47 saveLogistics(req, res, next) {
49 const uid = req.user.uid; 48 const uid = req.user.uid;
50 const applyid = req.body.applyid; 49 const applyid = req.body.applyid;
51 - const expressCompany = req.body.expressCompany;  
52 - const expressId = req.body.expressId;  
53 - const expressNumber = req.body.expressNumber;  
54 50
55 - refundModel.setexpress(applyid, uid, expressCompany, expressId, expressNumber).then(data => { 51 + refundModel.setexpress(applyid, uid, {
  52 + type: req.body.type,
  53 + expressCompany: req.body.expressCompany,
  54 + expressNumber: req.body.expressNumber,
  55 + expressId: req.body.expressId
  56 + }).then(data => {
56 return res.json(data); 57 return res.json(data);
57 }).catch(next); 58 }).catch(next);
58 }, 59 },
@@ -32,14 +32,16 @@ const refund = { @@ -32,14 +32,16 @@ const refund = {
32 code: 200 32 code: 200
33 }); 33 });
34 }, 34 },
35 - setexpress(applyid, uid, expressCompany, expressId, expressNumber) { 35 + setexpress(applyid, uid, data) {
  36 + const method = data.type === 'refund' ? 'app.refund.setexpress' : 'app.change.setexpress';
  37 +
36 return api.get('', { 38 return api.get('', {
37 - method: 'app.refund.setexpress', 39 + method: method,
38 id: applyid, 40 id: applyid,
39 uid: uid, 41 uid: uid,
40 - express_company: expressCompany,  
41 - express_number: expressNumber,  
42 - express_id: expressId 42 + express_company: data.expressCompany,
  43 + express_number: data.expressNumber,
  44 + express_id: data.expressId
43 }); 45 });
44 }, 46 },
45 getChangeDetail(id, uid) { 47 getChangeDetail(id, uid) {
1 <div class="logistics-page" id="logistics"> 1 <div class="logistics-page" id="logistics">
2 - <components :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' company_list='{{company_list}}' keep-alive></components> 2 + <components :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' type='{{type}}' company_list='{{company_list}}' keep-alive></components>
3 </div> 3 </div>
@@ -244,7 +244,7 @@ @@ -244,7 +244,7 @@
244 }); 244 });
245 245
246 if (yoho.isApp) { 246 if (yoho.isApp) {
247 - bus.$on('app.favourite.tabChange', this.updateNavBar); 247 + bus.$on('app.favourite.tabChange', this.updateNavBar);
248 } 248 }
249 } 249 }
250 }; 250 };
@@ -81,6 +81,7 @@ @@ -81,6 +81,7 @@
81 }; 81 };
82 }, 82 },
83 created() { 83 created() {
  84 + this.updateNavBar();
84 this.getOrderData(); 85 this.getOrderData();
85 86
86 yohoAPI.addNativeMethod('goToService', () => { 87 yohoAPI.addNativeMethod('goToService', () => {
@@ -89,6 +90,14 @@ @@ -89,6 +90,14 @@
89 }); 90 });
90 }, 91 },
91 methods: { 92 methods: {
  93 + updateNavBar() {
  94 + const header = $.extend({}, interceptClick.defaultTitleMap[2]);
  95 +
  96 + header.title.des = '订单详情';
  97 + yoho.updateNavigationBar({
  98 + header: header
  99 + });
  100 + },
92 getOrderData() { 101 getOrderData() {
93 $.ajax({ 102 $.ajax({
94 url: '/me/get-order', 103 url: '/me/get-order',
@@ -139,7 +148,10 @@ @@ -139,7 +148,10 @@
139 reason: this.selected.reason || this.options[0].reason 148 reason: this.selected.reason || this.options[0].reason
140 }, (result) => { 149 }, (result) => {
141 if (result.code === 200) { 150 if (result.code === 200) {
142 - location.reload(); 151 + tip('取消成功');
  152 + setTimeout(() => {
  153 + location.reload();
  154 + }, 1000);
143 } else if (result.code !== 500) { 155 } else if (result.code !== 500) {
144 tip(result.message); 156 tip(result.message);
145 } 157 }
@@ -202,7 +214,7 @@ @@ -202,7 +214,7 @@
202 } 214 }
203 }).then(result => { 215 }).then(result => {
204 if (result.code === 200) { 216 if (result.code === 200) {
205 - yohoAPI.goBack(true); 217 + yohoAPI.goBack();
206 return false; 218 return false;
207 } else if (result.code !== 500) { 219 } else if (result.code !== 500) {
208 tip(result.message); 220 tip(result.message);
@@ -127,7 +127,10 @@ @@ -127,7 +127,10 @@
127 reason: this.selected.reason || this.options[0].reason 127 reason: this.selected.reason || this.options[0].reason
128 }, (result) => { 128 }, (result) => {
129 if (result.code === 200) { 129 if (result.code === 200) {
130 - location.reload(); 130 + tip('取消成功');
  131 + setTimeout(() => {
  132 + location.reload();
  133 + }, 1000);
131 } else if (result.code !== 500) { 134 } else if (result.code !== 500) {
132 tip(result.message); 135 tip(result.message);
133 } 136 }
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 </div> 31 </div>
32 <div v-if="(detail.deliveryTpye === '10' || type ==='refund') && detail.status == 10" 32 <div v-if="(detail.deliveryTpye === '10' || type ==='refund') && detail.status == 10"
33 class="logistics"> 33 class="logistics">
34 - <a href="/me/return/logistics?applyid={{applyid}}">填写商品寄回的快递信息</a> 34 + <a href="/me/return/logistics?applyid={{applyid}}&type={{type}}">填写商品寄回的快递信息</a>
35 </div> 35 </div>
36 </div> 36 </div>
37 <div class="exchange-details"> 37 <div class="exchange-details">
@@ -125,9 +125,41 @@ @@ -125,9 +125,41 @@
125 }; 125 };
126 }, 126 },
127 methods: { 127 methods: {
  128 + reload() {
  129 + this.id = '';
  130 + this.sourceOrderCode = '';
  131 + this.show = false;
  132 + this.detail = {};
  133 +
  134 + $.ajax({
  135 + url: '/me/return/status-detail',
  136 + data: {
  137 + applyid: this.applyid,
  138 + type: this.type
  139 + }
  140 + }).then(res => {
  141 + if (res.code === 200) {
  142 + this.show = true;
  143 + this.detail = res.data;
  144 + if (!this.detail.goodsList) {
  145 + return;
  146 + }
  147 +
  148 + this.id = this.detail.id;
  149 + this.sourceOrderCode = this.detail.sourceOrderCode;
  150 + } else if (result.code !== 500) {
  151 + tip(result.message);
  152 + } else {
  153 + tip('数据获取失败');
  154 + }
  155 + }).fail(() => {
  156 + tip('网络错误');
  157 + });
  158 + },
128 cancel() { 159 cancel() {
129 let id = this.id; 160 let id = this.id;
130 let url = ''; 161 let url = '';
  162 + let _this = this;
131 163
132 if (!id) { 164 if (!id) {
133 return false; 165 return false;
@@ -138,6 +170,7 @@ @@ -138,6 +170,7 @@
138 url = '/me/return/exchange/cancel-apply'; 170 url = '/me/return/exchange/cancel-apply';
139 } 171 }
140 172
  173 +
141 Modal.confirm('', '确认取消吗?', function() { 174 Modal.confirm('', '确认取消吗?', function() {
142 this.hide(); 175 this.hide();
143 $.ajax({ 176 $.ajax({
@@ -148,7 +181,7 @@ @@ -148,7 +181,7 @@
148 } 181 }
149 }).then(data => { 182 }).then(data => {
150 if (data.code === 200) { 183 if (data.code === 200) {
151 - interceptClick.intercept('/me/return'); 184 + _this.reload();
152 } else { 185 } else {
153 tip(data.message); 186 tip(data.message);
154 } 187 }
@@ -157,35 +190,13 @@ @@ -157,35 +190,13 @@
157 } 190 }
158 }, 191 },
159 created() { 192 created() {
160 - $.ajax({  
161 - url: '/me/return/status-detail',  
162 - data: {  
163 - applyid: this.applyid,  
164 - type: this.type  
165 - }  
166 - }).then(res => {  
167 - if (res.code === 200) {  
168 - this.show = true;  
169 - this.detail = res.data;  
170 - if (!this.detail.goodsList) {  
171 - return;  
172 - } 193 + this.reload();
173 194
174 - this.id = this.detail.id;  
175 - this.sourceOrderCode = this.detail.sourceOrderCode;  
176 - this.detail.goodsList.forEach(d => {  
177 - // d.evidenceImages = d.evidenceImages.map(p => {  
178 - // return util.getImgHost(p) + '?imageView2/2/w/154/h/154';  
179 - // })  
180 - });  
181 - } else if (result.code !== 500) {  
182 - tip(result.message);  
183 - } else {  
184 - tip('数据获取失败'); 195 + document.addEventListener('visibilitychange', () => {
  196 + if (!document.hidden) {
  197 + this.reload();
185 } 198 }
186 - }).fail(() => {  
187 - tip('网络错误');  
188 - });; 199 + });
189 } 200 }
190 }; 201 };
191 </script> 202 </script>
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 const yoho = require('yoho'); 20 const yoho = require('yoho');
21 21
22 module.exports = { 22 module.exports = {
23 - props: ['applyid', 'company_id', 'company_name'], 23 + props: ['applyid', 'type', 'company_id', 'company_name'],
24 data() { 24 data() {
25 return { 25 return {
26 num: '', 26 num: '',
@@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
47 url: '/me/return/save-logistics', 47 url: '/me/return/save-logistics',
48 data: { 48 data: {
49 applyid: this.applyid, 49 applyid: this.applyid,
  50 + type: this.type,
50 expressId: this.company_id, 51 expressId: this.company_id,
51 expressCompany: this.company_name, 52 expressCompany: this.company_name,
52 expressNumber: this.num 53 expressNumber: this.num
@@ -58,7 +59,7 @@ @@ -58,7 +59,7 @@
58 if (res.code !== 200) { 59 if (res.code !== 200) {
59 tip(res.message || '网络错误'); 60 tip(res.message || '网络错误');
60 } else { 61 } else {
61 - yoho.goBack(true); 62 + yoho.goBack();
62 } 63 }
63 }); 64 });
64 return false; 65 return false;