Authored by 沈志敏

merge

@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 */ 6 */
7 'use strict'; 7 'use strict';
8 8
9 -const api = global.yoho.API;  
10 const brandApi = require('./brand-api'); 9 const brandApi = require('./brand-api');
11 const logger = global.yoho.logger; 10 const logger = global.yoho.logger;
12 const _ = require('lodash'); 11 const _ = require('lodash');
@@ -55,9 +54,9 @@ const handleBrandList = origin => { @@ -55,9 +54,9 @@ const handleBrandList = origin => {
55 const getBrandListData = params => { 54 const getBrandListData = params => {
56 let finalResult = {}; 55 let finalResult = {};
57 56
58 - return api.all([brandApi.getBrandListOriginData(params)]).then(result => {  
59 - if (result[0].code === 200 && result[0].data) {  
60 - Object.assign(finalResult, handleBrandList(result[0].data.all_list)); 57 + return brandApi.getBrandListOriginData(params).then(result => {
  58 + if (result.code === 200 && result.data) {
  59 + Object.assign(finalResult, handleBrandList(result.data.all_list));
61 } else { 60 } else {
62 logger.error('getBrandListOriginData api code no 200 or data is null'); 61 logger.error('getBrandListOriginData api code no 200 or data is null');
63 } 62 }
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 */ 6 */
7 'use strict'; 7 'use strict';
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 -const api = global.yoho.API;  
10 const shopApi = require('./shop-api'); 9 const shopApi = require('./shop-api');
11 const processProductList = require(`${global.utils}/beautify/product`); 10 const processProductList = require(`${global.utils}/beautify/product`);
12 const camelCase = global.yoho.camelCase; 11 const camelCase = global.yoho.camelCase;
@@ -21,50 +20,44 @@ const prettyFilter = require(`${global.utils}/beautify/filters`); @@ -21,50 +20,44 @@ const prettyFilter = require(`${global.utils}/beautify/filters`);
21 const getShopData = params => { 20 const getShopData = params => {
22 let finalResult = {}; 21 let finalResult = {};
23 22
24 - return api.all([  
25 - shopApi.getBrandInfoByDomain({domain: params.domain})  
26 - ]).then(result => { 23 + return shopApi.getBrandInfoByDomain({domain: params.domain}).then(result => {
27 24
28 - if (result[0].code === 200) { 25 + if (result.code === 200) {
29 26
30 /* 品牌名称 */ 27 /* 品牌名称 */
31 Object.assign(finalResult, { 28 Object.assign(finalResult, {
32 - brandName: result[0].data.brand_name 29 + brandName: result.data.brand_name
33 }); 30 });
34 31
35 /* 品牌是否有店铺 */ 32 /* 品牌是否有店铺 */
36 - if (result[0].data.shop_id) { 33 + if (result.data.shop_id) {
37 34
38 /* 是 BLK 的店铺 */ 35 /* 是 BLK 的店铺 */
39 Object.assign(finalResult, { 36 Object.assign(finalResult, {
40 isBlkShop: true, 37 isBlkShop: true,
41 - shopId: result[0].data.shop_id 38 + shopId: result.data.shop_id
42 }); 39 });
43 40
44 - return api.all([  
45 - shopApi.getShopInfoData({  
46 - shopId: result[0].data.shop_id,  
47 - uid: params.uid 41 + return shopApi.getShopInfoData({
  42 + shopId: result.data.shop_id,
  43 + uid: params.uid
48 44
49 - // uid: '8050882'  
50 - })  
51 - ]).then(subResult => {  
52 - if (subResult[0].code === 200) { 45 + // uid: '8050882'
  46 + }).then(subResult => {
  47 + if (subResult.code === 200) {
53 48
54 /* 取店铺的基本信息 */ 49 /* 取店铺的基本信息 */
55 Object.assign(finalResult, { 50 Object.assign(finalResult, {
56 - shopLogo: subResult[0].data.shop_logo,  
57 - shopName: subResult[0].data.shop_name,  
58 - shopIntro: subResult[0].data.shop_intro,  
59 - isFav: subResult[0].data.is_favorite === 'Y' 51 + shopLogo: subResult.data.shop_logo,
  52 + shopName: subResult.data.shop_name,
  53 + shopIntro: subResult.data.shop_intro,
  54 + isFav: subResult.data.is_favorite === 'Y'
60 }); 55 });
61 56
62 /* 取资源位店铺背景图 */ 57 /* 取资源位店铺背景图 */
63 - return api.all([  
64 - shopApi.getShopsDecoratorList({shopId: result[0].data.shop_id})  
65 - ]).then(thResult => {  
66 - if (thResult[0].code === 200) {  
67 - _.forEach(thResult[0].data.list, value => { 58 + return shopApi.getShopsDecoratorList({shopId: result.data.shop_id}).then(thResult => {
  59 + if (thResult.code === 200) {
  60 + _.forEach(thResult.data.list, value => {
68 61
69 if (value.resource_name === 'shopTopBanner_app') { 62 if (value.resource_name === 'shopTopBanner_app') {
70 Object.assign(finalResult, { 63 Object.assign(finalResult, {
@@ -110,24 +103,20 @@ const getShopData = params => { @@ -110,24 +103,20 @@ const getShopData = params => {
110 const getBrandShopGoodsData = params => { 103 const getBrandShopGoodsData = params => {
111 let finalResult = {}; 104 let finalResult = {};
112 105
113 - return api.all([  
114 - shopApi.getBrandInfoByDomain({ domain: params.domain })  
115 - ]).then(result => {  
116 - if (result[0].code === 200) {  
117 - return api.all([  
118 - shopApi.getBrandShopGoodsOriginData(Object.assign(params, {  
119 - brand: result[0].data.id,  
120 - shopId: result[0].data.shop_id  
121 - }))  
122 - ]).then(subResult => {  
123 - if (subResult[0].code === 200 && subResult[0].data) {  
124 - prettyFilter(subResult[0].data.filter); 106 + return shopApi.getBrandInfoByDomain({ domain: params.domain }).then(result => {
  107 + if (result.code === 200) {
  108 + return shopApi.getBrandShopGoodsOriginData(Object.assign(params, {
  109 + brand: result.data.id,
  110 + shopId: result.data.shop_id
  111 + })).then(subResult => {
  112 + if (subResult.code === 200 && subResult.data) {
  113 + prettyFilter(subResult.data.filter);
125 finalResult = { 114 finalResult = {
126 data: { 115 data: {
127 - productList: processProductList(subResult[0].data.product_list),  
128 - filter: subResult[0].data.filter,  
129 - page: subResult[0].data.page,  
130 - pageTotal: subResult[0].data.page_total 116 + productList: processProductList(subResult.data.product_list),
  117 + filter: subResult.data.filter,
  118 + page: subResult.data.page,
  119 + pageTotal: subResult.data.page_total
131 }, 120 },
132 code: 200 121 code: 200
133 }; 122 };
@@ -151,8 +140,8 @@ const getBrandShopGoodsData = params => { @@ -151,8 +140,8 @@ const getBrandShopGoodsData = params => {
151 * @returns {*|Promise.<TResult>} 140 * @returns {*|Promise.<TResult>}
152 */ 141 */
153 const collectShopData = params => { 142 const collectShopData = params => {
154 - return api.all([shopApi.collectShopOriginData(params)]).then(result => {  
155 - return result[0]; 143 + return shopApi.collectShopOriginData(params).then(result => {
  144 + return result;
156 }); 145 });
157 }; 146 };
158 147
@@ -18,10 +18,8 @@ module.exports = { @@ -18,10 +18,8 @@ module.exports = {
18 app_type: 1 18 app_type: 1
19 }, 19 },
20 domains: { 20 domains: {
21 - // api: 'http://192.168.102.202:8080/gateway/',  
22 - // service: 'http://192.168.102.202:8080/gateway/',  
23 - // api: 'http://testapi.yoho.cn:28078/',  
24 - // service: 'http://testservice.yoho.cn:28077/' 21 + // api: 'http://api-test1.yohops.com:9999/',
  22 + // service: 'http://service-test1.yohops.com:9999/'
25 23
26 api: 'http://dev-api.yohops.com:9999/', 24 api: 'http://dev-api.yohops.com:9999/',
27 service: 'http://dev-service.yohops.com:9999/' 25 service: 'http://dev-service.yohops.com:9999/'
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 $ = require('jquery');
  2 +const yoho = require('yoho');
  3 +const interceptClick = require('common/intercept-click');
  4 +const Modal = require('common/modal');
  5 +
  6 +// 退换货 申请 成功, 打开 modal
  7 +exports.applySuccuss = function(type, applyId) {
  8 + let config = {
  9 + exchange: {
  10 + name: '换货',
  11 + detailUrl: `/me/return/exchange/detail/${applyId}`
  12 + },
  13 + refund: {
  14 + name: '退货',
  15 + detailUrl: `/me/return/refund/detail/${applyId}`
  16 + }
  17 + };
  18 +
  19 + let kind = config[type];
  20 +
  21 + let goStatusPage = function() {
  22 + let header = $.extend({}, interceptClick.defaultTitleMap[1]);
  23 +
  24 + header.left.action = location.origin + '/me/return';
  25 + header.title.des = `${kind.name}状态`;
  26 + return yoho.goNewPage({
  27 + header: header,
  28 + url: location.origin + kind.detailUrl
  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 +};
@@ -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 +}
@@ -71,13 +71,15 @@ @@ -71,13 +71,15 @@
71 .channel-tab { 71 .channel-tab {
72 position: fixed; 72 position: fixed;
73 top: 0; 73 top: 0;
74 - left: 0; 74 + left: 50%;
75 z-index: 1; 75 z-index: 1;
76 width: 100%; 76 width: 100%;
  77 + max-width: 750px;
77 height: 90px; 78 height: 90px;
78 font-size: 24px; 79 font-size: 24px;
79 text-align: center; 80 text-align: center;
80 background: #fff; 81 background: #fff;
  82 + transform: translate(-50%, 0);
81 83
82 .channel { 84 .channel {
83 display: inline-block; 85 display: inline-block;
@@ -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 = $.extend({}, interceptClick.defaultTitleMap[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 = $.extend({}, interceptClick.defaultTitleMap[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 }
@@ -115,8 +115,7 @@ @@ -115,8 +115,7 @@
115 self.page = result.data.page; 115 self.page = result.data.page;
116 self.totalPage = result.data.pageTotal; 116 self.totalPage = result.data.pageTotal;
117 self.$set('productList', self.productList.concat(result.data.productList)); 117 self.$set('productList', self.productList.concat(result.data.productList));
118 -  
119 - if (!self.filterConfig) { 118 + if ($.isEmptyObject(self.filterConfig)) {
120 self.$set('filterConfig', result.data.filter); 119 self.$set('filterConfig', result.data.filter);
121 } 120 }
122 } 121 }