Authored by htoooth

Merge remote-tracking branch 'origin/release/1.0' into release/1.0

@@ -8,53 +8,11 @@ @@ -8,53 +8,11 @@
8 const helpModel = require('../models/help'); 8 const helpModel = require('../models/help');
9 9
10 /** 10 /**
11 - * 主界面  
12 - */  
13 -const index = (req, res) => {  
14 - let id = req.query.id || "11";  
15 - helpModel.getHelpDetail("81", 1, 15, "").then(result=> {  
16 - let content = {content: result.helpdetail_list[0].content};  
17 - let data = Object.assign(content, helpModel.menuData());  
18 - let nav = [  
19 - {  
20 - link: global.yoho.config.sitUrl,  
21 - name: 'YOHO!BLK首页'  
22 - },  
23 - {  
24 - name: '帮助中心'  
25 - }  
26 - ];  
27 - nav = nav.concat(getNav(id));  
28 - res.display('detail', {  
29 - module: 'help',  
30 - page: 'help',  
31 - content: Object.assign({nav}, data)  
32 - });  
33 - });  
34 - /* let data = Object.assign(getData(id), helpModel.menuData());  
35 - let nav = [  
36 - {  
37 - link: global.yoho.config.sitUrl,  
38 - name: 'YOHO!BLK首页'  
39 - },  
40 - {  
41 - name: '帮助中心'  
42 - }  
43 - ];  
44 - nav = nav.concat(getNav(id));  
45 - res.display('detail', {  
46 - module: 'help',  
47 - page: 'help',  
48 - content: Object.assign({nav}, data)  
49 - });*/  
50 -};  
51 -  
52 -/**  
53 * 根据id获取文章数据 11 * 根据id获取文章数据
54 * @param id 12 * @param id
55 * @returns {*} 13 * @returns {*}
56 */ 14 */
57 -const getData = (id)=> { 15 +/* const getData = (id)=> {
58 let contentData = helpModel.contentData().content; 16 let contentData = helpModel.contentData().content;
59 17
60 for (var i = 0; i < contentData.length; i++) { 18 for (var i = 0; i < contentData.length; i++) {
@@ -62,7 +20,7 @@ const getData = (id)=> { @@ -62,7 +20,7 @@ const getData = (id)=> {
62 return contentData[i] 20 return contentData[i]
63 } 21 }
64 } 22 }
65 -}; 23 + };*/
66 24
67 /** 25 /**
68 * 根据id获取当前所在位置,拼接面包屑 26 * 根据id获取当前所在位置,拼接面包屑
@@ -81,7 +39,7 @@ const getNav = (id)=> { @@ -81,7 +39,7 @@ const getNav = (id)=> {
81 }, { 39 }, {
82 name: menuData[i].subsets[j].text 40 name: menuData[i].subsets[j].text
83 } 41 }
84 - ] 42 + ];
85 } 43 }
86 } 44 }
87 } else { 45 } else {
@@ -90,12 +48,60 @@ const getNav = (id)=> { @@ -90,12 +48,60 @@ const getNav = (id)=> {
90 { 48 {
91 name: menuData[i].text 49 name: menuData[i].text
92 } 50 }
93 - ] 51 + ];
94 } 52 }
95 } 53 }
96 } 54 }
97 }; 55 };
98 56
  57 +/**
  58 + * 主界面
  59 + */
  60 +const index = (req, res,next) => {
  61 + let id = req.query.id || '11';
  62 +
  63 + helpModel.getHelpDetail('81', 1, 15, '').then(result=> {
  64 + let content = {content: result.helpdetail_list[0].content};
  65 + let data = Object.assign(content, helpModel.menuData());
  66 + let nav = [
  67 + {
  68 + link: global.yoho.config.sitUrl,
  69 + name: 'YOHO!BLK首页'
  70 + },
  71 + {
  72 + name: '帮助中心'
  73 + }
  74 + ];
  75 +
  76 + if (!(typeof (getNav(id)) === "undefined")) {
  77 + nav = nav.concat(getNav(id));
  78 + }
  79 + res.display('detail', {
  80 + module: 'help',
  81 + page: 'help',
  82 + content: Object.assign({nav}, data)
  83 + });
  84 + }).catch(next);
  85 +
  86 + /* let data = Object.assign(getData(id), helpModel.menuData());
  87 + let nav = [
  88 + {
  89 + link: global.yoho.config.sitUrl,
  90 + name: 'YOHO!BLK首页'
  91 + },
  92 + {
  93 + name: '帮助中心'
  94 + }
  95 + ];
  96 + nav = nav.concat(getNav(id));
  97 + res.display('detail', {
  98 + module: 'help',
  99 + page: 'help',
  100 + content: Object.assign({nav}, data)
  101 + });*/
  102 +};
  103 +
  104 +
99 module.exports = { 105 module.exports = {
100 index 106 index
101 }; 107 };
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 'use strict'; 7 'use strict';
8 8
9 const api = global.yoho.API; 9 const api = global.yoho.API;
  10 +
10 /** 11 /**
11 * 分类数据 12 * 分类数据
12 * @returns {{}} 13 * @returns {{}}
@@ -15,47 +16,47 @@ const menuData = ()=> { @@ -15,47 +16,47 @@ const menuData = ()=> {
15 return { 16 return {
16 menuData: [ 17 menuData: [
17 { 18 {
18 - id: "1",  
19 - text: "购物指南" 19 + id: '1',
  20 + text: '购物指南'
20 }, 21 },
21 { 22 {
22 - id: "2",  
23 - text: "支付方式" 23 + id: '2',
  24 + text: '支付方式'
24 }, 25 },
25 { 26 {
26 - id: "3",  
27 - text: "配送方式", 27 + id: '3',
  28 + text: '配送方式',
28 subsets: [ 29 subsets: [
29 { 30 {
30 - id: "31",  
31 - parendId: "3",  
32 - text: "配送时间与范围" 31 + id: '31',
  32 + parendId: '3',
  33 + text: '配送时间与范围'
33 }, 34 },
34 { 35 {
35 - id: "32",  
36 - parendId: "3",  
37 - text: "商品验收与签收" 36 + id: '32',
  37 + parendId: '3',
  38 + text: '商品验收与签收'
38 } 39 }
39 ] 40 ]
40 }, 41 },
41 { 42 {
42 - id: "4",  
43 - text: "售后服务", 43 + id: '4',
  44 + text: '售后服务',
44 subsets: [ 45 subsets: [
45 { 46 {
46 - id: "41",  
47 - parendId: "4",  
48 - text: "投诉与建议" 47 + id: '41',
  48 + parendId: '4',
  49 + text: '投诉与建议'
49 }, 50 },
50 { 51 {
51 - id: "42",  
52 - parendId: "4",  
53 - text: "退换货流程" 52 + id: '42',
  53 + parendId: '4',
  54 + text: '退换货流程'
54 }, 55 },
55 { 56 {
56 - id: "43",  
57 - parendId: "4",  
58 - text: "退换货政策" 57 + id: '43',
  58 + parendId: '4',
  59 + text: '退换货政策'
59 } 60 }
60 ] 61 ]
61 } 62 }
@@ -71,19 +72,19 @@ const contentData = ()=> { @@ -71,19 +72,19 @@ const contentData = ()=> {
71 return { 72 return {
72 content: [ 73 content: [
73 { 74 {
74 - id: "11",  
75 - content: "<h1>你好</h1><p>测试11</p>" 75 + id: '11',
  76 + content: '<h1>你好</h1><p>测试11</p>'
76 }, 77 },
77 { 78 {
78 - id: "12",  
79 - content: "<h1>你好</h1><p>测试12</p>" 79 + id: '12',
  80 + content: '<h1>你好</h1><p>测试12</p>'
80 }, 81 },
81 { 82 {
82 - id: "13",  
83 - content: "<h1>你好</h1><p>测试13</p>" 83 + id: '13',
  84 + content: '<h1>你好</h1><p>测试13</p>'
84 } 85 }
85 ] 86 ]
86 - } 87 + };
87 }; 88 };
88 89
89 /** 90 /**
@@ -15,6 +15,7 @@ const help = require(`${cRoot}/help`); @@ -15,6 +15,7 @@ const help = require(`${cRoot}/help`);
15 15
16 // 帮助中心 16 // 帮助中心
17 router.get('/', help.index); 17 router.get('/', help.index);
  18 +
18 // router.get('/search', help.search); 19 // router.get('/search', help.search);
19 20
20 21
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 {{#each menuData}} 2 {{#each menuData}}
3 3
4 {{#if subsets}} 4 {{#if subsets}}
5 - <li class="big-category cateId-{{id}}"> 5 + <li class="big-category cateId-{{id}} subsets">
6 <div class="plus inline-block"></div>{{text}}</li> 6 <div class="plus inline-block"></div>{{text}}</li>
7 {{#each subsets}} 7 {{#each subsets}}
8 <li class="smll-category cateId-{{id}} parentId-{{parendId}}"> 8 <li class="smll-category cateId-{{id}} parentId-{{parendId}}">
@@ -367,7 +367,7 @@ function getfilePath(req, res, next) { @@ -367,7 +367,7 @@ function getfilePath(req, res, next) {
367 367
368 req.filePath = filePath; 368 req.filePath = filePath;
369 req.pipe(uploadStream); 369 req.pipe(uploadStream);
370 - uploadStream.on('finish', function () { 370 + uploadStream.on('finish', function() {
371 next(); 371 next();
372 }); 372 });
373 } 373 }
  1 +/**
  2 + * 个人中心-我的订单model
  3 + * @author: 赵彪<bill.zhao@yoho.cn>
  4 + * @date: 2016/7/19
  5 + */
  6 +
1 'use strict'; 7 'use strict';
2 8
3 const api = global.yoho.API; 9 const api = global.yoho.API;
@@ -24,6 +30,7 @@ const paymentTypeStr = { @@ -24,6 +30,7 @@ const paymentTypeStr = {
24 4: '抵消支付' 30 4: '抵消支付'
25 }; 31 };
26 32
  33 +// 订单操作按钮
27 const btnMap = { 34 const btnMap = {
28 all: [ 35 all: [
29 { 36 {
@@ -135,11 +142,17 @@ const _convertUnixTime = src => { @@ -135,11 +142,17 @@ const _convertUnixTime = src => {
135 return moment.unix(src).format('YYYY-MM-DD hh:mm:ss'); 142 return moment.unix(src).format('YYYY-MM-DD hh:mm:ss');
136 }; 143 };
137 144
  145 +/**
  146 + * 获取订单物流信息
  147 + * @param { [Object] } addressList
  148 + * @param { String } createTime
  149 + * @return { [Object] }
  150 + */
138 const _convertAddress = (addressList, createTime) => { 151 const _convertAddress = (addressList, createTime) => {
139 let addrList = []; 152 let addrList = [];
140 153
141 addressList.forEach(addr => { 154 addressList.forEach(addr => {
142 - let address = { 155 + const address = {
143 time: '', 156 time: '',
144 city: '', 157 city: '',
145 action: '' 158 action: ''
@@ -169,7 +182,11 @@ const _convertAddress = (addressList, createTime) => { @@ -169,7 +182,11 @@ const _convertAddress = (addressList, createTime) => {
169 return _.reverse(addrList); 182 return _.reverse(addrList);
170 }; 183 };
171 184
172 -// 根据订单状态获取当前步骤 185 +/**
  186 + * 获取订单状态
  187 + * @param { String } st 订单状态
  188 + * @return { [Object] }
  189 + */
173 const _getStepByOrderStatus = st => { 190 const _getStepByOrderStatus = st => {
174 let steps = [ 191 let steps = [
175 { 192 {
@@ -197,6 +214,12 @@ const _getStepByOrderStatus = st => { @@ -197,6 +214,12 @@ const _getStepByOrderStatus = st => {
197 return steps; 214 return steps;
198 }; 215 };
199 216
  217 +/**
  218 + * 获取订单详情
  219 + * @param { Number } uid 用户id
  220 + * @param { Number } code 订单编码
  221 + * @return { Object } Promise 对象
  222 + */
200 const _getDetail = (uid, code) => { 223 const _getDetail = (uid, code) => {
201 return api.get('', { 224 return api.get('', {
202 method: 'app.SpaceOrders.detail', 225 method: 'app.SpaceOrders.detail',
@@ -207,6 +230,13 @@ const _getDetail = (uid, code) => { @@ -207,6 +230,13 @@ const _getDetail = (uid, code) => {
207 }); 230 });
208 }; 231 };
209 232
  233 +/**
  234 + * 获取订单列表
  235 + * @param { Number } uid 用户id
  236 + * @param { String } type 订单类型
  237 + * @param { Number } page 当前页
  238 + * @return { Object } Promise 对象
  239 + */
210 const _getUserOrder = (uid, type, page) => { 240 const _getUserOrder = (uid, type, page) => {
211 241
212 return api.get('', { 242 return api.get('', {
@@ -302,6 +332,12 @@ const _getUserOrder = (uid, type, page) => { @@ -302,6 +332,12 @@ const _getUserOrder = (uid, type, page) => {
302 }; 332 };
303 333
304 334
  335 +/**
  336 + * 删除订单
  337 + * @param { Number } uid 用户id
  338 + * @param { String } code 订单编码
  339 + * @return { Object } Promise 对象
  340 + */
305 const deleteOrder = (uid, code) => { 341 const deleteOrder = (uid, code) => {
306 return api.get('', { 342 return api.get('', {
307 method: 'app.SpaceOrders.delOrderByCode', 343 method: 'app.SpaceOrders.delOrderByCode',
@@ -310,6 +346,12 @@ const deleteOrder = (uid, code) => { @@ -310,6 +346,12 @@ const deleteOrder = (uid, code) => {
310 }); 346 });
311 }; 347 };
312 348
  349 +/**
  350 + * 取消订单
  351 + * @param { Number } uid 用户id
  352 + * @param { Object } data 调用接口所需的数据
  353 + * @return { Object } Promise 对象
  354 + */
313 const cancelOrder = (uid, data) => { 355 const cancelOrder = (uid, data) => {
314 return api.get('', { 356 return api.get('', {
315 method: 'app.SpaceOrders.close', 357 method: 'app.SpaceOrders.close',
@@ -320,6 +362,10 @@ const cancelOrder = (uid, data) => { @@ -320,6 +362,10 @@ const cancelOrder = (uid, data) => {
320 }); 362 });
321 }; 363 };
322 364
  365 +/**
  366 + * 获取取消订单的理由
  367 + * @return { Object } Promise 对象
  368 + */
323 const getCancelOrderReason = () => { 369 const getCancelOrderReason = () => {
324 return api.get('', { 370 return api.get('', {
325 method: 'app.SpaceOrders.closeReasons' 371 method: 'app.SpaceOrders.closeReasons'
@@ -328,6 +374,12 @@ const getCancelOrderReason = () => { @@ -328,6 +374,12 @@ const getCancelOrderReason = () => {
328 }); 374 });
329 }; 375 };
330 376
  377 +/**
  378 + * 获取快递信息
  379 + * @param { Number } uid 用户id
  380 + * @param { String } code 订单编号
  381 + * @return { Object } Promise 对象
  382 + */
331 const getExpressInfo = (uid, code) => { 383 const getExpressInfo = (uid, code) => {
332 return api.get('', { 384 return api.get('', {
333 method: 'app.express.get', 385 method: 'app.express.get',
@@ -338,6 +390,13 @@ const getExpressInfo = (uid, code) => { @@ -338,6 +390,13 @@ const getExpressInfo = (uid, code) => {
338 }); 390 });
339 }; 391 };
340 392
  393 +/**
  394 + * 获取全部订单
  395 + * @param { Number } uid 用户id
  396 + * @param { String } type 订单类型
  397 + * @param { Number } page 页码
  398 + * @return { Object } Promise 对象
  399 + */
341 const getOrderData = (uid, type, page) => { 400 const getOrderData = (uid, type, page) => {
342 const navBar = { 401 const navBar = {
343 tabs: [ 402 tabs: [
@@ -411,10 +470,16 @@ const getOrderData = (uid, type, page) => { @@ -411,10 +470,16 @@ const getOrderData = (uid, type, page) => {
411 }); 470 });
412 }; 471 };
413 472
  473 +/**
  474 + * 获取订单详情
  475 + * @param { Number } uid 用户id
  476 + * @param { String } code 订单编号
  477 + * @return { Object } Promise 对象
  478 + */
414 const getOrderDetail = (uid, code) => { 479 const getOrderDetail = (uid, code) => {
415 return api.all([_getDetail(uid, code), getExpressInfo(uid, code)]).then(result => { 480 return api.all([_getDetail(uid, code), getExpressInfo(uid, code)]).then(result => {
416 - let detail = result[0] && camelCase(result[0].data);  
417 - let express = result[1] && camelCase(result[1].data); 481 + const detail = result[0] && camelCase(result[0].data);
  482 + const express = result[1] && camelCase(result[1].data);
418 483
419 const st = parseInt(detail.status, 10); 484 const st = parseInt(detail.status, 10);
420 485
@@ -460,6 +525,11 @@ const getOrderDetail = (uid, code) => { @@ -460,6 +525,11 @@ const getOrderDetail = (uid, code) => {
460 }); 525 });
461 }; 526 };
462 527
  528 +/**
  529 + * 编辑订单
  530 + * @param { Object } data 调用接口所需的数据
  531 + * @return { Object } Promise 对象
  532 + */
463 const editOrder = data => { 533 const editOrder = data => {
464 return api.get('', { 534 return api.get('', {
465 method: 'app.SpaceOrders.updateDeliveryAddress', 535 method: 'app.SpaceOrders.updateDeliveryAddress',
@@ -474,6 +544,12 @@ const editOrder = data => { @@ -474,6 +544,12 @@ const editOrder = data => {
474 }); 544 });
475 }; 545 };
476 546
  547 +/**
  548 + * 重新购买
  549 + * @param { Number } uid 用户id
  550 + * @param { String } code 订单编号
  551 + * @return { Object } Promise 对象
  552 + */
477 const reAddCart = (uid, code) => { 553 const reAddCart = (uid, code) => {
478 return api.get('', { 554 return api.get('', {
479 method: 'app.Shopping.readd', 555 method: 'app.Shopping.readd',
@@ -483,6 +559,12 @@ const reAddCart = (uid, code) => { @@ -483,6 +559,12 @@ const reAddCart = (uid, code) => {
483 }); 559 });
484 }; 560 };
485 561
  562 +/**
  563 + * 确认收货
  564 + * @param { Number } uid 用户id
  565 + * @param { String } code 订单编号
  566 + * @return { Object } Promise 对象
  567 + */
486 const confirmReceive = (uid, code) => { 568 const confirmReceive = (uid, code) => {
487 return api.get('', { 569 return api.get('', {
488 method: 'app.SpaceOrders.confirm', 570 method: 'app.SpaceOrders.confirm',
@@ -44,8 +44,7 @@ const Search = { @@ -44,8 +44,7 @@ const Search = {
44 44
45 let finalParams = { 45 let finalParams = {
46 method: 'app.search.li', 46 method: 'app.search.li',
47 - limit: 45,  
48 - app_type: 1 47 + limit: 45
49 }; 48 };
50 49
51 Object.assign(finalParams, _paramHanlde(params)); 50 Object.assign(finalParams, _paramHanlde(params));
@@ -55,8 +54,7 @@ const Search = { @@ -55,8 +54,7 @@ const Search = {
55 queryProductOfBrand(params) { 54 queryProductOfBrand(params) {
56 let finalParams = { 55 let finalParams = {
57 method: 'app.search.li', 56 method: 'app.search.li',
58 - limit: 45,  
59 - app_type: 1 57 + limit: 45
60 }; 58 };
61 59
62 Object.assign(finalParams, _paramHanlde(params)); 60 Object.assign(finalParams, _paramHanlde(params));
@@ -66,8 +64,7 @@ const Search = { @@ -66,8 +64,7 @@ const Search = {
66 queryNewProduct(params) { 64 queryNewProduct(params) {
67 let finalParams = { 65 let finalParams = {
68 method: 'app.search.newProduct', 66 method: 'app.search.newProduct',
69 - limit: 45,  
70 - app_type: 1 67 + limit: 45
71 }; 68 };
72 69
73 Object.assign(finalParams, _paramHanlde(params)); 70 Object.assign(finalParams, _paramHanlde(params));
@@ -76,8 +73,7 @@ const Search = { @@ -76,8 +73,7 @@ const Search = {
76 }, 73 },
77 queryAllSort(params) { 74 queryAllSort(params) {
78 return api.get('', _.assign({ 75 return api.get('', _.assign({
79 - method: 'web.regular.groupsort',  
80 - app_type: 1 76 + method: 'web.regular.groupsort'
81 }, params), {code: 200}); 77 }, params), {code: 200});
82 } 78 }
83 }; 79 };
@@ -44,13 +44,15 @@ const Payment = { @@ -44,13 +44,15 @@ const Payment = {
44 beforePay(user, order, method) { 44 beforePay(user, order, method) {
45 return Promise.all([ 45 return Promise.all([
46 OrderData.updateOrderPayment(order.orderCode, method, user.uid), 46 OrderData.updateOrderPayment(order.orderCode, method, user.uid),
  47 + PayData.savePrePayInfo(order.orderCode, method, user.uid),
47 PayData.getBankByOrder(order.orderCode) 48 PayData.getBankByOrder(order.orderCode)
48 ]).then(result => { 49 ]).then(result => {
49 let paymentRecord = result[0]; 50 let paymentRecord = result[0];
50 - let bankRecord = result[1]; 51 + let prePayResult = result[1];
  52 + let bankRecord = result[2];
51 let bankCode = ''; // 暂时写成'', 参考php代码 Payment.php:564 53 let bankCode = ''; // 暂时写成'', 参考php代码 Payment.php:564
52 54
53 - if (!paymentRecord || paymentRecord.code !== 200) { 55 + if (!paymentRecord || paymentRecord.code !== 200 || !prePayResult || prePayResult.code !== 200) {
54 let message = paymentRecord && paymentRecord.message ? paymentRecord.message : '系统繁忙,请稍后再试'; 56 let message = paymentRecord && paymentRecord.message ? paymentRecord.message : '系统繁忙,请稍后再试';
55 57
56 return {code: 400, message: message}; 58 return {code: 400, message: message};
@@ -166,7 +166,7 @@ const submit = (uid, other) => { @@ -166,7 +166,7 @@ const submit = (uid, other) => {
166 166
167 Object.assign(theOther, other, { 167 Object.assign(theOther, other, {
168 delivery_time: 2, // 平时和周末都送货 168 delivery_time: 2, // 平时和周末都送货
169 - delivery_way: 1, // 普通快递 169 + delivery_way: 2, // blk统一为顺丰
170 payment_id: 1, // 支付宝 170 payment_id: 1, // 支付宝
171 payment_type: 1, // 在线支付 171 payment_type: 1, // 在线支付
172 use_yoho_coin: other.use_yoho_coin / 100 // 有货币稀释 172 use_yoho_coin: other.use_yoho_coin / 100 // 有货币稀释
@@ -55,6 +55,15 @@ const sendPayConfirm = (code, payment, uid) => { @@ -55,6 +55,15 @@ const sendPayConfirm = (code, payment, uid) => {
55 }); 55 });
56 }; 56 };
57 57
  58 +const savePrePayInfo = (code, payment, uid) => {
  59 + return api.get('', {
  60 + method: 'app.order.savePrePayInfo',
  61 + orderCode: code,
  62 + payment: payment,
  63 + uid: uid
  64 + });
  65 +};
  66 +
58 const sendMessage = (mobile, template, codes) => { 67 const sendMessage = (mobile, template, codes) => {
59 return api.get('', { 68 return api.get('', {
60 method: 'app.message.sendMsg', 69 method: 'app.message.sendMsg',
@@ -71,5 +80,6 @@ module.exports = { @@ -71,5 +80,6 @@ module.exports = {
71 setOrderPayBank, 80 setOrderPayBank,
72 updateOrderPayBank, 81 updateOrderPayBank,
73 sendPayConfirm, 82 sendPayConfirm,
  83 + savePrePayInfo,
74 sendMessage 84 sendMessage
75 }; 85 };
@@ -150,6 +150,21 @@ const updateOrderPayBank = (code, payment, bankCode) => { @@ -150,6 +150,21 @@ const updateOrderPayBank = (code, payment, bankCode) => {
150 }; 150 };
151 151
152 /** 152 /**
  153 + * 选择支付,校验时间间隔,插入数据
  154 + * @param code
  155 + * @param payment
  156 + * @param uid
  157 + */
  158 +const savePrePayInfo = (code, payment, uid) => {
  159 + return co(function *() {
  160 + let data = yield api.savePrePayInfo(code, payment, uid);
  161 +
  162 + return data;
  163 + })();
  164 +};
  165 +
  166 +
  167 +/**
153 * 支付确认 168 * 支付确认
154 * @param code 169 * @param code
155 * @param payment 170 * @param payment
@@ -228,6 +243,7 @@ module.exports = { @@ -228,6 +243,7 @@ module.exports = {
228 updateOrderPayBank, 243 updateOrderPayBank,
229 sendPayConfirm, 244 sendPayConfirm,
230 procOrderData, 245 procOrderData,
  246 + savePrePayInfo,
231 payments 247 payments
232 }; 248 };
233 249
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 "uuid": "^2.0.2", 61 "uuid": "^2.0.2",
62 "winston": "^2.2.0", 62 "winston": "^2.2.0",
63 "winston-daily-rotate-file": "^1.1.4", 63 "winston-daily-rotate-file": "^1.1.4",
64 - "yoho-node-lib": "0.0.28" 64 + "yoho-node-lib": "0.0.31"
65 }, 65 },
66 "devDependencies": { 66 "devDependencies": {
67 "autoprefixer": "^6.3.6", 67 "autoprefixer": "^6.3.6",
@@ -4,36 +4,31 @@ @@ -4,36 +4,31 @@
4 * @date: 2016/07/25 4 * @date: 2016/07/25
5 */ 5 */
6 6
7 -var queryId = location.search.split("=")[1] || "1";  
8 -var $cate = $(".cateId-" + queryId); 7 +var queryId = location.search.split('=')[1] || '1';
  8 +var $cate = $('.cateId-' + queryId);// 当前分类
  9 +var $subsets = $('.subsets');
  10 +var parentID = queryId.substr(0, 1);// 一级分类id
9 11
10 /** 12 /**
11 * 目录切换 13 * 目录切换
12 */ 14 */
13 15
14 -$(document).on("click", ".big-category .plus", function () {  
15 - var $parent = $(this).parent();//当前一级分类  
16 - var className = $parent.attr("class").split(" ")[1];  
17 - var parentId = "parentId-" + className.split("-")[1];  
18 - var $child = $parent.parent().find("." + parentId);//当前子分类 16 +$subsets.click(function() {
  17 + var $this = $(this);
  18 + var className = $this.attr('class').split(' ')[1];
  19 + var parentId = 'parentId-' + className.split('-')[1];
  20 + var $child = $this.parent().find('.' + parentId);// 当前子分类
19 21
20 - if ($parent.hasClass("open")) { 22 + if ($this.hasClass('open')) {
21 $child.hide(); 23 $child.hide();
22 - $parent.removeClass("open");  
23 - $(this).css("background-image", "url('../img/help/plus.png')"); 24 + $this.removeClass('open').children('.plus').css('background-image', 'url(\'../img/help/plus.png\')');
24 } else { 25 } else {
25 $child.show(); 26 $child.show();
26 - $parent.addClass("open");  
27 - $(this).css("background-image", "url('../img/help/minus.png')"); 27 + $this.addClass('open').children('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
28 } 28 }
29 }); 29 });
30 30
31 -if (!$cate.hasClass("big-category")) {  
32 - var parentId = queryId.substr(0, 1);  
33 - $(".parentId-" + parentId).show();  
34 - $(".cateId-" + parentId).find(".plus").css("background-image", "url('../img/help/minus.png')"); 31 +if (!$cate.hasClass('big-category')) {
  32 + $('.parentId-' + parentID).show();
  33 + $('.cateId-' + parentID).find('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
35 } 34 }
36 -  
37 -  
38 -  
39 -  
@@ -21,6 +21,9 @@ var reg = new RegExp(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57 @@ -21,6 +21,9 @@ var reg = new RegExp(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57
21 21
22 require('./me'); 22 require('./me');
23 require('../plugins/check'); 23 require('../plugins/check');
  24 +require('yoho-jquery-placeholder');
  25 +
  26 +$('[placeholder]').placeholder();
24 27
25 $(function() { 28 $(function() {
26 var address = cascadingAddress({el: '#address'}); 29 var address = cascadingAddress({el: '#address'});
@@ -450,6 +450,18 @@ function bindUploadEvent() { @@ -450,6 +450,18 @@ function bindUploadEvent() {
450 }); 450 });
451 } 451 }
452 452
  453 +function bindKeyUpEvent() {
  454 + $('.mark-text').on('keyup', function() {
  455 + var $this = $(this),
  456 + str = $.trim($this.val());
  457 +
  458 + if (str.length > 100) {
  459 + str = str.substring(0, 100);
  460 + }
  461 + $this.val(str);
  462 + });
  463 +}
  464 +
453 $(document).on('ready', function() { 465 $(document).on('ready', function() {
454 getProductInfo(); 466 getProductInfo();
455 bindSelectEvent(); 467 bindSelectEvent();
@@ -459,4 +471,5 @@ $(document).on('ready', function() { @@ -459,4 +471,5 @@ $(document).on('ready', function() {
459 initAddr($('#city').data('code')); 471 initAddr($('#city').data('code'));
460 bindBlurEvent(); 472 bindBlurEvent();
461 bindUploadEvent(); 473 bindUploadEvent();
  474 + bindKeyUpEvent();
462 }); 475 });
@@ -59,7 +59,7 @@ function cancelOrder(code, onCancel) { @@ -59,7 +59,7 @@ function cancelOrder(code, onCancel) {
59 ] 59 ]
60 }).show(); 60 }).show();
61 } else { 61 } else {
62 - new _alert('<h1>出错了!修改失败!</h1>').show(); 62 + new _alert('<h1>' + result.message + '</h1>').show();
63 } 63 }
64 64
65 }).fail(function(err) { 65 }).fail(function(err) {
@@ -11,8 +11,11 @@ module.exports = function(code) { @@ -11,8 +11,11 @@ module.exports = function(code) {
11 if (result.code === 200) { 11 if (result.code === 200) {
12 location.href = '/shopping/cart'; 12 location.href = '/shopping/cart';
13 } else { 13 } else {
14 - new _alert('出错了,请重试!').show(); 14 + new _alert(result.message).show();
15 } 15 }
  16 + }).fail(function(err) {
  17 + console.log(err);
  18 + new _alert('出错了!').show();
16 }); 19 });
17 }; 20 };
18 21
@@ -50,6 +50,7 @@ var Bll = { @@ -50,6 +50,7 @@ var Bll = {
50 50
51 require('./me'); 51 require('./me');
52 require('../plugins/check'); 52 require('../plugins/check');
  53 +require('yoho-jquery-placeholder');
53 54
54 // 第一步:身份验证 55 // 第一步:身份验证
55 require('../me/setting/validate'); 56 require('../me/setting/validate');
@@ -57,6 +58,7 @@ require('../me/setting/validate'); @@ -57,6 +58,7 @@ require('../me/setting/validate');
57 // 第二步:操作 58 // 第二步:操作
58 require('../me/setting/operate'); 59 require('../me/setting/operate');
59 60
  61 +$('[placeholder]').placeholder();
60 62
61 // 编辑头像移入移出切换效果 63 // 编辑头像移入移出切换效果
62 $('.user-icon').hover(function() { 64 $('.user-icon').hover(function() {
@@ -41,6 +41,10 @@ var validatePhoneNumLocal = function(phoneNum) { @@ -41,6 +41,10 @@ var validatePhoneNumLocal = function(phoneNum) {
41 } 41 }
42 }; 42 };
43 43
  44 +require('yoho-jquery-placeholder');
  45 +
  46 +$('[placeholder]').placeholder();
  47 +
44 /** 48 /**
45 * 绑定手机号码部分 49 * 绑定手机号码部分
46 */ 50 */
@@ -28,6 +28,10 @@ var disableSMSBtn = function() { @@ -28,6 +28,10 @@ var disableSMSBtn = function() {
28 } 28 }
29 }; 29 };
30 30
  31 +require('yoho-jquery-placeholder');
  32 +
  33 +$('[placeholder]').placeholder();
  34 +
31 // 发送手机验证码 35 // 发送手机验证码
32 $sms.click(function() { 36 $sms.click(function() {
33 var mobile = $('#real-mobile').val(); 37 var mobile = $('#real-mobile').val();
@@ -13,6 +13,34 @@ @@ -13,6 +13,34 @@
13 text-align: center; 13 text-align: center;
14 background: #fff; 14 background: #fff;
15 } 15 }
  16 + .nav {
  17 + li {
  18 + cursor: pointer;
  19 + padding: 10px 15px;
  20 + width: 200px;
  21 + font-size: 14px;
  22 +
  23 + .plus {
  24 + cursor: pointer;
  25 + margin-right: 10px;
  26 + height: 14px;
  27 + width: 14px;
  28 + background-repeat: no-repeat;
  29 + background-image: resolve('help/plus.png');
  30 + background-size: 14px 14px;
  31 + }
  32 +
  33 + .mult {
  34 + margin-right: 26px;
  35 + height: 14px;
  36 + width: 14px;
  37 + }
  38 + }
  39 +
  40 + .smll-category {
  41 + display: none;
  42 + }
  43 + }
16 } 44 }
17 45
18 .help-main { 46 .help-main {
@@ -22,5 +50,3 @@ @@ -22,5 +50,3 @@
22 } 50 }
23 51
24 } 52 }
25 -  
26 -@import "menu";  
1 -.nav {  
2 - li {  
3 - padding: 10px 15px;  
4 - width: 200px;  
5 - font-size: 14px;  
6 - }  
7 -  
8 - .smll-category {  
9 - display: none;  
10 - }  
11 -}  
12 -  
13 -.plus {  
14 - cursor: pointer;  
15 - margin-right: 10px;  
16 - height: 14px;  
17 - width: 14px;  
18 - background-repeat: no-repeat;  
19 - background-image: resolve('help/plus.png');  
20 - background-size: 14px 14px;  
21 -}  
22 -  
23 -.mult {  
24 - margin-right: 26px;  
25 - height: 14px;  
26 - width: 14px;  
27 -}  
  1 +/**
  2 + * 商品处理
  3 + * @author:
  4 + * @date:
  5 + */
  6 +
1 'use strict'; 7 'use strict';
  8 +
2 const _ = require('lodash'); 9 const _ = require('lodash');
3 10
4 const camelCase = global.yoho.camelCase; 11 const camelCase = global.yoho.camelCase;
@@ -114,35 +121,39 @@ exports.processProductList = (list, options) => { @@ -114,35 +121,39 @@ exports.processProductList = (list, options) => {
114 } 121 }
115 122
116 if (options.showTags) { 123 if (options.showTags) {
117 - product.tags = {};  
118 -  
119 - product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品  
120 - product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售  
121 - product.tags.isLimited = product.isLimited === 'Y'; // 限量  
122 - product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD  
123 - product.tags.midYear = product.midYear === 'Y'; // 年中  
124 - product.tags.yearEnd = product.yearEnd === 'Y'; // 年末  
125 - product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着 124 + let tags = {};
  125 +
  126 + Object.assign(tags, {
  127 + isNew: options.showNew && product.isNew === 'Y', // 新品
  128 + isDiscount: options.showSale && product.isDiscount === 'Y', // 在售
  129 + isLimited: product.isLimited === 'Y', // 限量
  130 + isYohood: product.isYohood === 'Y', // YOHOOD
  131 + midYear: product.midYear === 'Y', // 年中
  132 + yearEnd: product.yearEnd === 'Y', // 年末
  133 + isAdvance: product.isAdvance === 'Y' // 再到着
  134 + });
126 135
127 // 打折与即将售完组合显示打折 136 // 打折与即将售完组合显示打折
128 - if (product.isSoonSoldOut && product.tags.isDiscount) {  
129 - product.tags.isFew = false;  
130 - } else if (product.tags.isDiscount &&  
131 - (product.tags.isFew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) { 137 + if (product.isSoonSoldOut && tags.isDiscount) {
  138 + tags.isFew = false;
  139 + } else if (tags.isDiscount &&
  140 + (tags.isFew || tags.isLimited || tags.isYohood || tags.isAdvance)) {
132 // 打折与其它组合则隐藏打折 141 // 打折与其它组合则隐藏打折
133 - product.tags.isDiscount = false;  
134 - } else if (product.tags.isYohood && product.tags.isFew) { 142 + tags.isDiscount = false;
  143 + } else if (tags.isYohood && tags.isFew) {
135 // YOHOOD和新品组合显示YOHOOD 144 // YOHOOD和新品组合显示YOHOOD
136 - product.tags.isFew = false; 145 + tags.isFew = false;
137 } 146 }
  147 +
  148 + product.tags = tags;
138 } 149 }
139 150
140 pruductList.push(product); 151 pruductList.push(product);
141 }); 152 });
  153 +
142 return handleGoodsListData(pruductList); 154 return handleGoodsListData(pruductList);
143 }; 155 };
144 156
145 -  
146 /** 157 /**
147 * 处理筛选数据 158 * 处理筛选数据
148 * @param list 159 * @param list
@@ -311,34 +322,43 @@ exports.processProduct = (productData, options) => { @@ -311,34 +322,43 @@ exports.processProduct = (productData, options) => {
311 result.name = productData.product_name; 322 result.name = productData.product_name;
312 result.price = !productData.market_price ? false : productData.market_price; 323 result.price = !productData.market_price ? false : productData.market_price;
313 result.salePrice = productData.sales_price; 324 result.salePrice = productData.sales_price;
  325 +
314 if (options.showPoint) { 326 if (options.showPoint) {
315 - result.price += '.00';  
316 - result.salePrice += '.00'; 327 + result.price = parseInt(result.price, 10).toFixed(2);
  328 + result.salePrice = parseInt(result.salePrice, 10).toFixed(2);
317 } 329 }
318 330
319 result.is_soon_sold_out = (productData.is_soon_sold_out === 'Y'); 331 result.is_soon_sold_out = (productData.is_soon_sold_out === 'Y');
320 - result.url = helpers.urlFormat(`/product/pro_${productData.product_id}_${productData.goods_list[0].goods_id}/${productData.cn_alphabet}.html`, null, 'list'); // eslint-disable-line  
321 - 332 + result.url = helpers.urlFormat(`
  333 + /product/pro_${productData.product_id}_${productData.goods_list[0].goods_id}
  334 + /${productData.cn_alphabet}.html
  335 + `, null, 'list');
322 336
323 if (options.showTags) { 337 if (options.showTags) {
324 - result.tags = {};  
325 - result.tags.is_new = options.showNew && productData.is_new && productData.is_new === 'Y'; // 新品  
326 - result.tags.is_discount = options.showSale && productData.is_discount && productData.is_discount === 'Y'; // 在售  
327 - result.tags.is_limited = productData.is_limited && productData.is_limited === 'Y'; // 限量  
328 - result.tags.is_yohood = productData.is_yohood && productData.is_yohood === 'Y'; // YOHOOD  
329 - result.tags.midYear = productData['mid-year'] && productData['mid-year'] === 'Y'; // 年中  
330 - result.tags.yearEnd = productData['year-end'] && productData['year-end'] === 'Y'; // 年末  
331 - result.tags.is_advance = productData.is_advance && productData.is_advance === 'Y'; // 再到着  
332 -  
333 - if (result.is_soon_sold_out && result.tags.is_discount) {  
334 - result.tags.is_new = false;// 打折与即将售完组合显示打折  
335 - } else if (result.tags.is_discount &&  
336 - (result.tags.is_new || result.tags.is_limited || result.tags.is_yohood || result.tags.is_advance)) {  
337 - result.tags.is_discount = false;// 打折与其它组合则隐藏打折  
338 - } else if (result.tags.is_yohood && result.tags.is_new) {  
339 - result.tags.is_new = false;// YOHOOD和新品组合显示YOHOOD 338 + let tags = {};
  339 +
  340 + Object.assign(tags, {
  341 + is_new: options.showNew && productData.is_new && productData.is_new === 'Y', // 新品
  342 + is_discount: options.showSale && productData.is_discount && productData.is_discount === 'Y', // 在售
  343 + is_limited: productData.is_limited && productData.is_limited === 'Y', // 限量
  344 + is_yohood: productData.is_yohood && productData.is_yohood === 'Y', // YOHOOD
  345 + midYear: productData['mid-year'] && productData['mid-year'] === 'Y', // 年中
  346 + yearEnd: productData['year-end'] && productData['year-end'] === 'Y', // 年末
  347 + is_advance: productData.is_advance && productData.is_advance === 'Y' // 再到着
  348 + });
  349 +
  350 + if (result.is_soon_sold_out && tags.is_discount) {
  351 + tags.is_new = false;// 打折与即将售完组合显示打折
  352 + } else if (tags.is_discount &&
  353 + (tags.is_new || tags.is_limited || tags.is_yohood || tags.is_advance)) {
  354 + tags.is_discount = false;// 打折与其它组合则隐藏打折
  355 + } else if (tags.is_yohood && tags.is_new) {
  356 + tags.is_new = false;// YOHOOD和新品组合显示YOHOOD
340 } 357 }
  358 +
  359 + result.tags = tags;
341 } 360 }
  361 +
342 return result; 362 return result;
343 }; 363 };
344 364
  1 +/**
  2 + * 特殊资源位处理
  3 + * @author: bikai<bikai@yoho.cn>
  4 + * @date: 2016/4/25
  5 + */
  6 +
  7 +'use strict';
  8 +
1 const _ = require('lodash'); 9 const _ = require('lodash');
2 const camelCase = global.yoho.camelCase; 10 const camelCase = global.yoho.camelCase;
3 11