Authored by 陈轩

退换货申请

1 -<div class="modal"> 1 +<div class="modal {{styleClass}}">
2 <h2>{{title}}</h2> 2 <h2>{{title}}</h2>
3 <p>{{text}}</p> 3 <p>{{text}}</p>
4 <hr> 4 <hr>
@@ -22,6 +22,7 @@ class Modal { @@ -22,6 +22,7 @@ class Modal {
22 this.defaults = { 22 this.defaults = {
23 isModal: true, 23 isModal: true,
24 template: template, 24 template: template,
  25 + styleClass: '',
25 title: '', 26 title: '',
26 text: '', 27 text: '',
27 buttons: [ 28 buttons: [
@@ -37,6 +38,7 @@ class Modal { @@ -37,6 +38,7 @@ class Modal {
37 // 初始化参数 38 // 初始化参数
38 this.settings = Object.assign({}, this.defaults, opts); 39 this.settings = Object.assign({}, this.defaults, opts);
39 const tpl = this.settings.template({ 40 const tpl = this.settings.template({
  41 + styleClass: this.settings.styleClass,
40 title: this.settings.title, 42 title: this.settings.title,
41 text: this.settings.text, 43 text: this.settings.text,
42 buttons: this.settings.buttons 44 buttons: this.settings.buttons
@@ -15,6 +15,7 @@ console.log(vm); @@ -15,6 +15,7 @@ console.log(vm);
15 15
16 /* eslint-disable */ 16 /* eslint-disable */
17 // 私有包测试 17 // 私有包测试
  18 +var $ = require('jquery');
18 var qs = require('yoho-qs'); 19 var qs = require('yoho-qs');
19 console.log(qs); 20 console.log(qs);
20 21
  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 = interceptClick.titleMap[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 + });
  29 + };
  30 +
  31 + const modal = new Modal({
  32 + styleClass: 'return-success-modal',
  33 + text: `${kind.name}申请已提交,请等待审核.....`,
  34 + buttons: [
  35 + {
  36 + text: '返回订单',
  37 + handler: function() {
  38 + this.hide();
  39 + yoho.goBack();
  40 + }
  41 + },
  42 + {
  43 + text: '查看进度',
  44 + handler: function() {
  45 + this.hide();
  46 + goStatusPage();
  47 + }
  48 + }
  49 + ]
  50 + });
  51 +
  52 + modal.show();
  53 +};
@@ -17,8 +17,7 @@ @@ -17,8 +17,7 @@
17 p { 17 p {
18 font-size: 21px; 18 font-size: 21px;
19 text-align: center; 19 text-align: center;
20 - margin-top: 20px;  
21 - margin-bottom: 48px; 20 + margin: 20px 40px 48px;
22 } 21 }
23 22
24 hr { 23 hr {
  1 +.return-success-modal {
  2 + p {
  3 + font-size: 30px;
  4 + }
  5 +
  6 + .button-group .modal-button:first-of-type {
  7 + color: #b0b0b0;
  8 + }
  9 +}
@@ -37,9 +37,9 @@ @@ -37,9 +37,9 @@
37 const qs = require('yoho-qs'); 37 const qs = require('yoho-qs');
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');  
41 - const interceptClick = require('common/intercept-click'); 40 + const Modal = require('common/modal');
42 const yoho = require('yoho'); 41 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');
@@ -245,22 +245,15 @@ @@ -245,22 +245,15 @@
245 data 245 data
246 }).then(result => { 246 }).then(result => {
247 if (result.code === 200) { 247 if (result.code === 200) {
248 - let header = interceptClick.titleMap[1];  
249 -  
250 - header.left.action = location.origin + '/me/return'  
251 - header.title.des = '换货状态';;  
252 - return yoho.goNewPage({  
253 - header: header,  
254 - url: location.origin + `/me/return/exchange/detail/${result.data.applyId}`  
255 - }); 248 + returnUtil.applySuccuss(self.page, result.data.applyId);
256 } else { 249 } else {
257 - modal.alert(result.message); 250 + Modal.alert(result.message);
258 } 251 }
259 }).always(()=>{ 252 }).always(()=>{
260 self.processing = false; 253 self.processing = false;
261 }); 254 });
262 } else { 255 } else {
263 - modal.alert(msg); 256 + Modal.alert(msg);
264 } 257 }
265 } 258 }
266 }, 259 },
@@ -302,6 +295,8 @@ @@ -302,6 +295,8 @@
302 295
303 </script> 296 </script>
304 <style> 297 <style>
  298 + @import "../../scss/me/_return.css";
  299 +
305 body { 300 body {
306 background-color: #f6f6f6; 301 background-color: #f6f6f6;
307 } 302 }
@@ -52,14 +52,15 @@ @@ -52,14 +52,15 @@
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 interceptClick = require('common/intercept-click');  
56 const yoho = require('yoho'); 55 const yoho = require('yoho');
57 const productList = require('me/return/list.vue'); 56 const productList = require('me/return/list.vue');
58 const reasonConfig = require('me/return/reason'); 57 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() {
62 return { 62 return {
  63 + page: 'refund',
63 list: [], 64 list: [],
64 amount: {}, 65 amount: {},
65 refundData: {} 66 refundData: {}
@@ -150,6 +151,8 @@ @@ -150,6 +151,8 @@
150 return true; 151 return true;
151 }, 152 },
152 submit() { 153 submit() {
  154 + const self = this;
  155 +
153 if (!this.checkSubmitData()) { 156 if (!this.checkSubmitData()) {
154 modal.alert('请填写完整退换货信息'); 157 modal.alert('请填写完整退换货信息');
155 } 158 }
@@ -159,14 +162,7 @@ @@ -159,14 +162,7 @@
159 data: this.submitData 162 data: this.submitData
160 }).then(result => { 163 }).then(result => {
161 if (result.code === 200) { 164 if (result.code === 200) {
162 - let header = interceptClick.titleMap[1];  
163 -  
164 - header.left.action = location.origin + '/me/return'  
165 - header.title.des = '退货状态';;  
166 - return yoho.goNewPage({  
167 - header: header,  
168 - url: location.origin + `/me/return/refund/detail/${result.data.applyId}`  
169 - }); 165 + returnUtil.applySuccuss(self.page, result.data.applyId);
170 } else { 166 } else {
171 modal.alert(result.message); 167 modal.alert(result.message);
172 } 168 }
@@ -180,6 +176,8 @@ @@ -180,6 +176,8 @@
180 </script> 176 </script>
181 177
182 <style> 178 <style>
  179 + @import "../../scss/me/_return.css";
  180 +
183 .main-wrap { 181 .main-wrap {
184 background: #f6f6f6; 182 background: #f6f6f6;
185 } 183 }