Authored by 郭成尧

Merge remote-tracking branch 'remotes/origin/develop' into feature/brand

@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 const refundModel = require('../models/refund'); 6 const refundModel = require('../models/refund');
7 const notLoginCode = 400; 7 const notLoginCode = 400;
8 const notLoginTip = '抱歉,您暂未登录!'; 8 const notLoginTip = '抱歉,您暂未登录!';
9 -const testUid = 8050378;// 测试uid 9 +const testUid = 8039837;// 测试uid
10 const isBLK = 1; 10 const isBLK = 1;
11 11
12 const refund = { 12 const refund = {
@@ -72,7 +72,6 @@ const refund = { @@ -72,7 +72,6 @@ const refund = {
72 let uid = req.query.id; 72 let uid = req.query.id;
73 let page = req.query.page; 73 let page = req.query.page;
74 let limit = req.query.limit; 74 let limit = req.query.limit;
75 - let isend = true;  
76 75
77 uid = testUid; 76 uid = testUid;
78 if (!uid && req.xhr) { 77 if (!uid && req.xhr) {
@@ -89,10 +88,7 @@ const refund = { @@ -89,10 +88,7 @@ const refund = {
89 }; 88 };
90 89
91 refundModel.getRefundOrders(param).then(result => { 90 refundModel.getRefundOrders(param).then(result => {
92 - if (result && page < result.pageTotal) {  
93 - isend = false;  
94 - }  
95 - return res.json(Object.assign({isend: isend}, result)); 91 + return res.json(result);
96 }); 92 });
97 } 93 }
98 }; 94 };
@@ -3,6 +3,5 @@ @@ -3,6 +3,5 @@
3 <div class="suggest-sub-form"> 3 <div class="suggest-sub-form">
4 <textarea name="" id="suggest-textarea" placeholder="请写下对于BLK的意见和建议,我们将及时根据您的意见作出改进"></textarea> 4 <textarea name="" id="suggest-textarea" placeholder="请写下对于BLK的意见和建议,我们将及时根据您的意见作出改进"></textarea>
5 </div> 5 </div>
6 - <input id="submit-button" type="button" value="提交" />  
7 {{/ suggestSub}} 6 {{/ suggestSub}}
8 -</div>  
  7 +</div>
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <span class="num">{{send_cargo_num}}</span> 35 <span class="num">{{send_cargo_num}}</span>
36 {{/if}} 36 {{/if}}
37 </a> 37 </a>
38 - <a class="type-item" href="/home/orders?type=5"> 38 + <a class="type-item" href="/home/refund/orders">
39 <span class="icon icon-refund-exchange"></span> 39 <span class="icon icon-refund-exchange"></span>
40 <br>退换货 40 <br>退换货
41 {{#if refund_exchange_num}} 41 {{#if refund_exchange_num}}
@@ -3,8 +3,9 @@ @@ -3,8 +3,9 @@
3 * @return {[type]} 3 * @return {[type]}
4 */ 4 */
5 const yoho = require('yoho'); 5 const yoho = require('yoho');
  6 +const parse = require('yoho-qs/parse'); // 提供解析函数
6 7
7 -const origin = 'http://m.yohoblk.com'; 8 +const origin = location.origin;
8 9
9 /** 10 /**
10 * 跳转 App 头部参数 11 * 跳转 App 头部参数
@@ -104,21 +105,97 @@ const matchHeader = (url) => { @@ -104,21 +105,97 @@ const matchHeader = (url) => {
104 return header; 105 return header;
105 } 106 }
106 107
107 - if (/\/product\/new/.test(url)) { 108 + if (/\/home\/mydetails$/.test(url)) {
108 header = titleMap[1]; 109 header = titleMap[1];
  110 + header.title.des = '个人信息';
  111 + return header;
  112 + }
109 113
110 - // header.xxx = '111';// 匹配到头类型以后,可修改里边的内容 114 + if (/\/home\/orders/.test(url)) {
  115 + var des = '',
  116 + u = url.split('?')[1],
  117 + u = parse(u);
  118 +
  119 + if (u.type === '1') {
  120 + des = '我的订单';
  121 + } else if (u.type === '2') {
  122 + des = '待付款';
  123 + } else if (u.type === '3') {
  124 + des = '待发货';
  125 + } else if (u.type === '4') {
  126 + des = '待收货';
  127 + }
  128 + header = titleMap[1];
  129 + header.title.des = des;
  130 + return header;
  131 + }
  132 +
  133 + if (/\/home\/refund\/orders/.test(url)) {
  134 + header = titleMap[1];
  135 + header.title.des = '退/换货';
  136 + return header;
  137 + }
  138 +
  139 + if (/\/home\/favorite/.test(url)) {
  140 + header = titleMap[5];
  141 + header.ltitle = {
  142 + des: '商品',
  143 + action: origin + '/home/favorite'
  144 + }
  145 + header.rtitle = {
  146 + des: '品牌',
  147 + action: origin + '/home/favorite?tab=brand'
  148 + }
  149 + header.right = {
  150 + des: '编辑',
  151 + action: 'editModel'
  152 + }
  153 + return header;
  154 + }
  155 +
  156 + if (/\/home\/mycurrency/.test(url)) {
  157 + header = titleMap[1];
  158 + header.title.des = '有货币';
  159 + return header;
  160 + }
  161 +
  162 + if (/\/home\/help$/.test(url)) {
  163 + header = titleMap[1];
  164 + header.title.des = '帮助中心';
  165 + return header;
  166 + }
  167 +
  168 + if (/chat8.live800.com/.test(url)) {
  169 + header = titleMap[1];
  170 + header.title.des = 'Yoho!Blk在线客服';
  171 + return header;
  172 + }
  173 +
  174 + if (/\/home\/feedback/.test(url)) {
  175 + header = titleMap[3];
  176 + header.title.des = '意见反馈';
  177 + header.right = {
  178 + des: '提交',
  179 + action: 'saveFeedback'
  180 + }
  181 + return header;
  182 + }
  183 +
  184 + if (/\/home\/about/.test(url)) {
  185 + header = titleMap[1];
  186 + header.title.des = '关于';
111 return header; 187 return header;
112 } 188 }
113 189
114 return header; 190 return header;
115 }; 191 };
116 192
  193 +
117 module.exports = (url) => { 194 module.exports = (url) => {
118 if (yoho.isApp) { 195 if (yoho.isApp) {
119 let data = { 196 let data = {
120 header: matchHeader(url), 197 header: matchHeader(url),
121 - url: /^(https?:)?\/\//i.test(url) ? url : location.origin + url 198 + url: /^(https?:)?\/\//i.test(url) ? url : origin + url
122 }; 199 };
123 200
124 // console.log(data); 201 // console.log(data);
@@ -5,11 +5,10 @@ @@ -5,11 +5,10 @@
5 */ 5 */
6 6
7 var $ = require('yoho-jquery'), 7 var $ = require('yoho-jquery'),
8 - tip = require('../common/tip'); 8 + tip = require('../common/tip'),
  9 + yoho = require('yoho');
9 10
10 -var submitButton = $('#submit-button');  
11 -  
12 -submitButton.on('click', function() { 11 +yoho.addNativeMethod('saveFeedback', function() {
13 var suggestText = $('#suggest-textarea').val(), 12 var suggestText = $('#suggest-textarea').val(),
14 textReg = /\S+/; 13 textReg = /\S+/;
15 14
@@ -3,6 +3,7 @@ const app = require('product/detail/index.vue'); @@ -3,6 +3,7 @@ const app = require('product/detail/index.vue');
3 const loading = require('common/loading'); 3 const loading = require('common/loading');
4 const lazyload = require('yoho-vue-lazyload'); 4 const lazyload = require('yoho-vue-lazyload');
5 5
  6 +require('common/vue-filter');
6 require('../common/overlay'); 7 require('../common/overlay');
7 8
8 Vue.use(lazyload); 9 Vue.use(lazyload);
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 props: ['title', 'class'], 21 props: ['title', 'class'],
22 methods: { 22 methods: {
23 goBack() { 23 goBack() {
24 - yoho.goBack({}, function() {}, function() {}); 24 + yoho.goBack({}, function() {}, function() {});
25 } 25 }
26 } 26 }
27 }; 27 };
@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 right: 0; 33 right: 0;
34 left: 0; 34 left: 0;
35 z-index: 210; 35 z-index: 210;
  36 + padding-top: 60px;
36 padding-left: 30px; 37 padding-left: 30px;
37 padding-right: 30px; 38 padding-right: 30px;
38 width: 100%; 39 width: 100%;
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 return { 23 return {
24 page: 0, 24 page: 0,
25 limit: 15, 25 limit: 15,
26 - pageTotal: 0, 26 + pageTotal: 1,
27 coinList: [], 27 coinList: [],
28 busy: false, 28 busy: false,
29 }; 29 };
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 let _that = this; 38 let _that = this;
39 39
40 this.busy = true; 40 this.busy = true;
41 - if (this.page > this.pageTotal) { 41 + if (this.page >= this.pageTotal) {
42 return; 42 return;
43 } 43 }
44 $.ajax({ 44 $.ajax({
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 <script> 32 <script>
33 const $ = require('yoho-jquery'); 33 const $ = require('yoho-jquery');
34 const tip = require('common/tip'); 34 const tip = require('common/tip');
  35 + const yoho = require('yoho');
35 36
36 module.exports = { 37 module.exports = {
37 props: ['brandUrl'], 38 props: ['brandUrl'],
@@ -73,12 +74,6 @@ @@ -73,12 +74,6 @@
73 tip('网络错误'); 74 tip('网络错误');
74 }); 75 });
75 }, 76 },
76 - editModel(action) {  
77 - this.editmodel = action;  
78 - if (!action) {  
79 - this.hideDelBth();  
80 - }  
81 - },  
82 showDelBtn(index) { 77 showDelBtn(index) {
83 this.hideDelBth(); 78 this.hideDelBth();
84 let delBtn = $('#del-' + index); 79 let delBtn = $('#del-' + index);
@@ -116,6 +111,16 @@ @@ -116,6 +111,16 @@
116 tip('网络错误'); 111 tip('网络错误');
117 }); 112 });
118 } 113 }
  114 + },
  115 + created: function() {
  116 + let _this = this;
  117 +
  118 + yoho.addNativeMethod('editModel', function(action) {
  119 + _this.editmodel = action;
  120 + if (!action) {
  121 + _this.hideDelBth();
  122 + }
  123 + });
119 } 124 }
120 }; 125 };
121 </script> 126 </script>
@@ -79,12 +79,6 @@ @@ -79,12 +79,6 @@
79 tip('网络错误'); 79 tip('网络错误');
80 }); 80 });
81 }, 81 },
82 - editModel(action) {  
83 - this.editmodel = action;  
84 - if (!action) {  
85 - this.hideDelBth();  
86 - }  
87 - },  
88 showDelBtn(index) { 82 showDelBtn(index) {
89 this.hideDelBth(); 83 this.hideDelBth();
90 let delBtn = $('#del-' + index); 84 let delBtn = $('#del-' + index);
@@ -122,6 +116,16 @@ @@ -122,6 +116,16 @@
122 tip('网络错误'); 116 tip('网络错误');
123 }); 117 });
124 } 118 }
  119 + },
  120 + created: function() {
  121 + let _this = this;
  122 +
  123 + yoho.addNativeMethod('editModel', function(action) {
  124 + _this.editmodel = action;
  125 + if (!action) {
  126 + _this.hideDelBth();
  127 + }
  128 + });
125 } 129 }
126 }; 130 };
127 </script> 131 </script>
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 return { 54 return {
55 page: 0, 55 page: 0,
56 limit: 10, 56 limit: 10,
57 - pageTotal: 0, 57 + pageTotal: 1,
58 type: this.$parent.$data.type, 58 type: this.$parent.$data.type,
59 orderList: [], 59 orderList: [],
60 busy: false, 60 busy: false,
@@ -70,7 +70,7 @@ @@ -70,7 +70,7 @@
70 let _that = this; 70 let _that = this;
71 71
72 this.busy = true; 72 this.busy = true;
73 - if (this.page > this.pageTotal) { 73 + if (this.page >= this.pageTotal) {
74 return; 74 return;
75 } 75 }
76 $.ajax({ 76 $.ajax({
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 </div> 28 </div>
29 </div> 29 </div>
30 </div> 30 </div>
31 - <div class="order-option"> 31 + <div class="order-option" v-show="order.canCancel == 'Y'">
32 <div class="goods-total"></div> 32 <div class="goods-total"></div>
33 <div class="options" v-show="order.canCancel == 'Y'"> 33 <div class="options" v-show="order.canCancel == 'Y'">
34 <button v-if="order.canCancel == 'Y'" class="normal">取消申请</button> 34 <button v-if="order.canCancel == 'Y'" class="normal">取消申请</button>
@@ -51,6 +51,7 @@ @@ -51,6 +51,7 @@
51 return { 51 return {
52 page: 0, 52 page: 0,
53 limit: 10, 53 limit: 10,
  54 + pageTotal: 1,
54 orderList: [], 55 orderList: [],
55 busy: false, 56 busy: false,
56 }; 57 };
@@ -65,6 +66,9 @@ @@ -65,6 +66,9 @@
65 let _that = this; 66 let _that = this;
66 67
67 this.busy = true; 68 this.busy = true;
  69 + if (this.page >= this.pageTotal) {
  70 + return;
  71 + }
68 $.ajax({ 72 $.ajax({
69 url: '/home/refund/get-orders', 73 url: '/home/refund/get-orders',
70 data: { 74 data: {
@@ -72,13 +76,10 @@ @@ -72,13 +76,10 @@
72 limit: this.limit 76 limit: this.limit
73 } 77 }
74 }).then(result => { 78 }).then(result => {
75 - if (result.isend) {  
76 - _that.busy = true;  
77 - } else {  
78 - _that.busy = false;  
79 - } 79 + _that.busy = false;
80 if (result.data.list.length > 0) { 80 if (result.data.list.length > 0) {
81 - this.$set('orderList', result.data.list); 81 + this.$set('orderList', _that.orderList.concat(result.data.list));
  82 + _that.pageTotal = result.data.totalPage;
82 } 83 }
83 }).fail(() => { 84 }).fail(() => {
84 tip('网络错误'); 85 tip('网络错误');
@@ -112,13 +113,4 @@ @@ -112,13 +113,4 @@
112 113
113 @import "../../scss/home/_order.css"; 114 @import "../../scss/home/_order.css";
114 115
115 - .order-wrapper {  
116 - height: 100%;  
117 -  
118 - ul {  
119 - height: 100%;  
120 - overflow-y: auto;  
121 - -webkit-overflow-scrolling: touch;  
122 - }  
123 - }  
124 </style> 116 </style>
1 <template> 1 <template>
2 <top-nav></top-nav> 2 <top-nav></top-nav>
3 - <div class="show-box no-padding first-box"> 3 + <div class="show-box no-padding first-box" :class="{'is-app': isApp}">
4 <div class="news-box"> 4 <div class="news-box">
5 <h1>{{article.articleTitle}}</h1> 5 <h1>{{article.articleTitle}}</h1>
6 <div class="status-bar"> 6 <div class="status-bar">
@@ -61,6 +61,10 @@ @@ -61,6 +61,10 @@
61 margin-top: 120px; 61 margin-top: 120px;
62 } 62 }
63 63
  64 + &.first-box.is-app {
  65 + margin-top: 180px;
  66 + }
  67 +
64 background: $bgcolor; 68 background: $bgcolor;
65 margin-top: 30px; 69 margin-top: 30px;
66 border-bottom: 1px solid #eee; 70 border-bottom: 1px solid #eee;
@@ -183,8 +187,9 @@ @@ -183,8 +187,9 @@
183 187
184 </style> 188 </style>
185 <script> 189 <script>
186 - require('common/vue-filter'); 190 + const yoho = require('yoho');
187 191
  192 + require('common/vue-filter');
188 module.exports = { 193 module.exports = {
189 components: { 194 components: {
190 'content-block': require('./content-block.vue'), 195 'content-block': require('./content-block.vue'),
@@ -193,6 +198,7 @@ @@ -193,6 +198,7 @@
193 }, 198 },
194 data() { 199 data() {
195 return { 200 return {
  201 + isApp: yoho.isApp,
196 article: {}, 202 article: {},
197 content: {}, 203 content: {},
198 brands: {}, 204 brands: {},
1 <template> 1 <template>
2 <div class="top-nav"> 2 <div class="top-nav">
3 - <a class="left-button" href="javascript:alert('TODO');">  
4 - <span class="icon icon-left"></span>  
5 - </a> 3 + <navbar>
  4 + <a slot="left" href="javascript:alert('TODO');">
  5 + <span class="icon icon-left"></span>
  6 + </a>
6 7
7 - <a class="right-button" href="javascript:alert('TODO');">  
8 - <span class="icon icon-share"></span>  
9 - </a>  
10 - <a class="right-button" href="javascript:alert('TODO');">  
11 - <span class="icon icon-love"></span>  
12 - </a>  
13 - <a class="right-button" href="javascript:alert('TODO');" :click="">  
14 - <span class="icon icon-check"></span>  
15 - {{likeCount}}  
16 - </a> 8 + <template slot="right">
  9 + <a class="right-button" href="javascript:alert('TODO');">
  10 + <span class="icon icon-check"></span>
  11 + {{likeCount}}
  12 + </a>
  13 +
  14 + <a class="right-button" href="javascript:alert('TODO');">
  15 + <span class="icon icon-love"></span>
  16 + </a>
  17 +
  18 + <a class="right-button" href="javascript:alert('TODO');">
  19 + <span class="icon icon-share"></span>
  20 + </a>
  21 + </template>
  22 + </navbar>
17 </div> 23 </div>
18 </template> 24 </template>
19 <style> 25 <style>
20 .top-nav { 26 .top-nav {
21 - position: fixed;  
22 - z-index: 10;  
23 - font-size: 40px;  
24 - padding: 30px;  
25 - width: 100%;  
26 - top: 0;  
27 - background: #fff;  
28 -  
29 - .left-button {  
30 - float: left;  
31 - }  
32 -  
33 .right-button { 27 .right-button {
34 - float: right;  
35 margin-left: 30px; 28 margin-left: 30px;
36 } 29 }
37 } 30 }
38 </style> 31 </style>
39 <script> 32 <script>
  33 + const yoho = require('yoho');
  34 +
40 require('common/vue-filter'); 35 require('common/vue-filter');
41 36
42 module.exports = { 37 module.exports = {
43 components: { 38 components: {
  39 + navbar: require('component/header.vue')
44 }, 40 },
45 data() { 41 data() {
46 return { 42 return {
  43 + isApp: yoho.isApp,
47 likeCount: 9, 44 likeCount: 9,
48 }; 45 };
49 }, 46 },
1 <template> 1 <template>
2 <div class="image-carousel"> 2 <div class="image-carousel">
3 - <swipe :continuous="false" :auto="0" :show-indicators="goods && goods.length > 1"> 3 + <swipe :continuous="false" :auto="0" :show-indicators="goods && goods.length > 1" v-ref:swipe>
4 <swipe-item v-for="item in goods"> 4 <swipe-item v-for="item in goods">
5 - <a href="javascript:void(0);" title="{{item.title}}" @click.prevent="showcase()">  
6 - <img :src="item.colorImage | resize 750 1000" width="100%" alt="">  
7 - </a> 5 + <img title="{{item.title}}"
  6 + :src="item.colorImage | resize 750 1000"
  7 + width="100%" alt=""
  8 + @click.prevent="showcase()">
8 </swipe-item> 9 </swipe-item>
9 </swipe> 10 </swipe>
10 </div> 11 </div>
@@ -63,7 +64,7 @@ @@ -63,7 +64,7 @@
63 images: this.goods.map((item)=> { 64 images: this.goods.map((item)=> {
64 return item.colorImage; 65 return item.colorImage;
65 }), 66 }),
66 - index: 0 // TODO: 活动下标无法获取 67 + index: this.$refs.swipe.index
67 }; 68 };
68 69
69 yoho.goImageBrowser(opts); 70 yoho.goImageBrowser(opts);
1 <template> 1 <template>
2 - <top-nav v-if="isApp" :title="entity.productName"></top-nav> 2 + <top-nav v-if="isApp" :title="entity.productName" :img="firstImage | resize 300 300"></top-nav>
3 <show-box :is-first="true"> 3 <show-box :is-first="true">
4 <image-carousel :goods="entity.goodsList"></image-carousel> 4 <image-carousel :goods="entity.goodsList"></image-carousel>
5 <div class="title-box"> 5 <div class="title-box">
@@ -401,6 +401,7 @@ @@ -401,6 +401,7 @@
401 yoho: yoho, 401 yoho: yoho,
402 isApp: yoho.isApp, 402 isApp: yoho.isApp,
403 intro: {}, 403 intro: {},
  404 + firstImage: '',
404 entity: { 405 entity: {
405 brand: { 406 brand: {
406 brandName: '', 407 brandName: '',
@@ -508,6 +509,13 @@ @@ -508,6 +509,13 @@
508 $.get(`/product/product_${pid}.json`).then((result) => { 509 $.get(`/product/product_${pid}.json`).then((result) => {
509 // TODO: 异常处理 510 // TODO: 异常处理
510 this.entity = result; 511 this.entity = result;
  512 +
  513 + this.entity.goodsList.forEach((goods)=> {
  514 + if (!this.firstImage && goods.colorImage) {
  515 + this.firstImage = goods.colorImage;
  516 + }
  517 + });
  518 +
511 return result; 519 return result;
512 }).then((result)=> { 520 }).then((result)=> {
513 loadIntroDeferred = () => { 521 loadIntroDeferred = () => {
1 <template> 1 <template>
2 <div class="top-nav"> 2 <div class="top-nav">
3 - <a class="left" href="javascript:void(0);" @click="yoho.goBack()"> 3 + <a class="left no-intercept" href="javascript:void(0);" @click="yoho.goBack()">
4 <span class="icon icon-left"></span> 4 <span class="icon icon-left"></span>
5 </a> 5 </a>
6 6
7 - <a class="right" href="javascript:void(0);" @click="yoho.goShare()"> 7 + <a class="right no-intercept" href="javascript:void(0);" @click="share()">
8 <span class="icon icon-share"></span> 8 <span class="icon icon-share"></span>
9 </a> 9 </a>
10 </div> 10 </div>
@@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
16 font-size: 40px; 16 font-size: 40px;
17 padding: 30px; 17 padding: 30px;
18 width: 100%; 18 width: 100%;
19 - top: 60px;  
20 19
21 .left { 20 .left {
22 float: left; 21 float: left;
@@ -25,14 +24,31 @@ @@ -25,14 +24,31 @@
25 .right { 24 .right {
26 float: right; 25 float: right;
27 } 26 }
  27 +
28 } 28 }
29 </style> 29 </style>
30 <script> 30 <script>
  31 + const yoho = require('yoho');
  32 +
31 module.exports = { 33 module.exports = {
32 data() { 34 data() {
33 return { 35 return {
34 - yoho: require('yoho') 36 + yoho: yoho
35 }; 37 };
  38 + },
  39 + props: {
  40 + title: String,
  41 + img: String
  42 + },
  43 + methods: {
  44 + share: function() {
  45 + yoho.goShare({
  46 + title: this.title || '',
  47 + des: '我在BLK发现了一个不错的商品,快来看看吧!',
  48 + img: this.img,
  49 + url: location.href
  50 + });
  51 + }
36 } 52 }
37 }; 53 };
38 </script> 54 </script>