Authored by ccbikai

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

@@ -21,13 +21,16 @@ const handleBrandList = origin => { @@ -21,13 +21,16 @@ const handleBrandList = origin => {
21 indexList: [] 21 indexList: []
22 }; 22 };
23 23
  24 + _.sortBy(origin, (o) => {
  25 + return o.key;
  26 + });
  27 +
24 _.forEach(origin, (value, key) => { 28 _.forEach(origin, (value, key) => {
25 let brands = []; 29 let brands = [];
26 30
27 _.forEach(value, (subValue) => { 31 _.forEach(value, (subValue) => {
28 brands.push({ 32 brands.push({
29 name: subValue.brand_name, 33 name: subValue.brand_name,
30 - link: '/brand/' + subValue.brand_domain,  
31 logo: subValue.brand_ico, 34 logo: subValue.brand_ico,
32 domain: subValue.brand_domain 35 domain: subValue.brand_domain
33 }); 36 });
@@ -69,9 +72,7 @@ const getBrandListData = params => { @@ -69,9 +72,7 @@ const getBrandListData = params => {
69 * @returns {*|Promise.<TResult>} 72 * @returns {*|Promise.<TResult>}
70 */ 73 */
71 const getCateListData = params => { 74 const getCateListData = params => {
72 - return brandApi.getCateListData(params).then(result => {  
73 - return camelCase(result);  
74 - }); 75 + return brandApi.getCateListData(params).then(camelCase);
75 }; 76 };
76 77
77 module.exports = { 78 module.exports = {
@@ -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');
@@ -81,14 +81,37 @@ @@ -81,14 +81,37 @@
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', () => {
87 interceptClick.intercept('/me/service'); 88 interceptClick.intercept('/me/service');
88 return false; 89 return false;
89 }); 90 });
  91 +
  92 + document.addEventListener('visibilitychange', () => {
  93 + if (!document.hidden) {
  94 + this.reload();
  95 + }
  96 + });
90 }, 97 },
91 methods: { 98 methods: {
  99 + updateNavBar() {
  100 + const header = $.extend({}, interceptClick.defaultTitleMap[2]);
  101 +
  102 + header.title.des = '订单详情';
  103 + yoho.updateNavigationBar({
  104 + header: header
  105 + });
  106 + },
  107 + reload() {
  108 + this.show = false;
  109 + this.order = {};
  110 + this.selected = {};
  111 + this.cancelbusy = false;
  112 +
  113 + this.getOrderData();
  114 + },
92 getOrderData() { 115 getOrderData() {
93 $.ajax({ 116 $.ajax({
94 url: '/me/get-order', 117 url: '/me/get-order',
@@ -141,7 +164,7 @@ @@ -141,7 +164,7 @@
141 if (result.code === 200) { 164 if (result.code === 200) {
142 tip('取消成功'); 165 tip('取消成功');
143 setTimeout(() => { 166 setTimeout(() => {
144 - location.reload(); 167 + this.reload();
145 }, 1000); 168 }, 1000);
146 } else if (result.code !== 500) { 169 } else if (result.code !== 500) {
147 tip(result.message); 170 tip(result.message);
@@ -181,7 +204,7 @@ @@ -181,7 +204,7 @@
181 reason: this.options.length ? this.options[0].reason : null 204 reason: this.options.length ? this.options[0].reason : null
182 }, (result) => { 205 }, (result) => {
183 if (result.code === 200) { 206 if (result.code === 200) {
184 - location.reload(); 207 + this.reload();
185 } 208 }
186 }); 209 });
187 }; 210 };
@@ -216,7 +239,9 @@ @@ -216,7 +239,9 @@
216 }); 239 });
217 }, 240 },
218 confirmGoods(code) { 241 confirmGoods(code) {
219 - Modal.confirm('', '确认收货', function() { 242 + let _this = this;
  243 +
  244 + Modal.confirm('', '确认收货吗?', function() {
220 this.hide(); 245 this.hide();
221 $.ajax({ 246 $.ajax({
222 url: '/me/confirmReceive', 247 url: '/me/confirmReceive',
@@ -226,7 +251,7 @@ @@ -226,7 +251,7 @@
226 } 251 }
227 }).then(result => { 252 }).then(result => {
228 if (result.code === 200) { 253 if (result.code === 200) {
229 - location.reload(); 254 + _this.reload();
230 } else if (result.code !== 500) { 255 } else if (result.code !== 500) {
231 tip(result.message); 256 tip(result.message);
232 } 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 }
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 title: result.shopName, 90 title: result.shopName,
91 des: shareSubTitle, 91 des: shareSubTitle,
92 url: shareUrl, 92 url: shareUrl,
93 - img: result.shopBg, 93 + img: result.shopLogo ? result.shopLogo : '',
94 isBlkShop: result.isBlkShop, 94 isBlkShop: result.isBlkShop,
95 domain: locationQuery.domain, 95 domain: locationQuery.domain,
96 brandName: result.brandName, 96 brandName: result.brandName,