Authored by lijing

订单

Showing 100 changed files with 486 additions and 3 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

/**
* 个人中心-订单列表 controller
* @author: jing.li<jing.li@yoho.cn>
* @date: 2016/08/15
*/
'use strict';
// const headerModel = require('../../../doraemon/models/header'); // 头部model
const orderModel = require('../models/order');
exports.order = (req, res, next) => {
let params = {
type: req.query.type || 1,
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 20000266
};
orderModel.order(params).then(result => {
res.render('order', {
module: 'home',
page: 'order',
title: 'Yoho!Buy 有货',
order: result
});
}).catch(next);
};
exports.getOrders = (req, res, next) => {
let params = {
type: req.query.type || 1,
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 20000266
};
orderModel.order(params).then(result => {
res.render('order-template', {
layout: false,
order: result,
resultOut: JSON.stringify(result, 0, 4)
});
}).catch(next);
};
... ...
/**
* 个人中心 controller
* @author: chengyao.guo<chengyao.guo@yoho.cn>
* @date: 2016/08/10
*/
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const orderDetailModel = require('../models/orderDetail');
exports.orderDetail = (req, res, next) => {
let params = {
uid: req.user.uid || 6228593
};
let headerData = headerModel.setNav({
navTitle: '订单详情'
});
orderDetailModel.orderDetail(params).then(result => {
if (result) {
res.render('orderDetail', Object.assign(result, {
isLogin: params.uid ? true : false,
module: 'home',
page: 'index',
title: 'Yoho!Buy 有货',
pageHeader: headerData,
pageFooter: true
}));
}
}).catch(next);
};
... ...
'use strict';
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
// const _getOrderData = (type, page, limit, gender, yh_channel, uid) => {
// return api.get('', {
// method: 'app.SpaceOrders.get',
// type: type,
// page: page,
// limit: limit,
// gender: gender,
// yh_channel: yh_channel,
// uid: uid
// }, {code: 200});
// };
const processOrderData = (data) => {
let formartData = [];
data = data || [];
data = camelCase(data);
_.forEach(data.orderList, (obj) => {
let newObj = {
orderNum: obj.orderCode,
orderStatus: obj.statusStr,
sumCost: obj.amount,
// if (obj.shippingCost > 0) {
// shippingCost : obj.shippingCost
// }
// 类内调用格式化订单商品数据方法
tickets: false,
// if (virtualType && pbj.virtualType * 1 == 3) {
// tickets : true,
// isVirtual : true,//虚拟商品
// }
count: obj.count,
// //倒计时时间
// if (counterFlag && obj.counterFlag == 'Y') {
// leftTime : payLefttime*1000;
// }
};
formartData.push(newObj);
});
// console.log(formartData);
return formartData;
};
const getNavs = (data) => {
// navType = ["全部", "待付款", "待发货", "待收货"];
// nav = [];
// _.forEach(navType, (obj) => {
// // obj.act = false;
// // if (obj.type == obj.key) {
// // obj.act = true;
// // }
// let newObj = {
// name : obj.value,
// typeId : obj.key,
// active : obj.act,
// //url : Helpers::url('/home/orders', array('type' => $key))
// }
// nav.push(newObj);
// }
// return nav;
};
// type, page, limit, gender, yh_channel, uid
const order = (params) => {
return api.get('', _.assign({
method: 'app.SpaceOrders.get',
limit: 10,
}, params)).then((data) => {
if (data && data.code === 200) {
return processOrderData(data.data);
}
});
};
module.exports = {
order
};
... ...
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/8/10
* Time: 13:43
*/
'use strict';
const api = global.yoho.API;
const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
/**
* 个人详情数据
*/
const _viewOrderData = (orderCode, uid, sessionKey) => {
return api.get('', {
method: 'app.SpaceOrders.detail',
orderCode: orderCode,
uid: uid,
sessionKey: sessionKey
}, {code: 200});
};
const orderDetail = (orderCode, uid, sessionKey) => {
let result = {
};
return api.all([
_viewOrderData(1, 10851797, 1)
]).then(result => {
console.log(result[0].data);
return result;
});
};
module.exports = {
orderDetail
};
... ...
... ... @@ -10,8 +10,13 @@ const router = express.Router(); // eslint-disable-line
const cRoot = './controllers';
const personalController = require(`${cRoot}/qrcode`);
const orderController = require(`${cRoot}/order`);
const orderDetailController = require(`${cRoot}/orderDetail`);
// 查看二维码
router.get('/QRcode/:id', personalController.QRcode);
router.get('/order', orderController.order);
router.get('/getOrders', orderController.getOrders);
router.get('/orderDetail', orderDetailController.orderDetail);
module.exports = router;
... ...
{{# order}}
<ul id="order-nav" class="order-nav clearfix">
{{#each navs}}
<li class="tap-hightlight {{#if active}}active{{/if}}" data-type="{{typeId}}">
<a href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
<div id="order-container" class="order-container">
{{#each navs}}
<div class="orders{{#unless active}} hide{{/unless}}"></div>
{{/each}}
</div>
<div class="reason-mask">
<div class="reason-box" >
<div class="box-head"><span class="box-cmp">完成2</span></div>
<div class="swiper-container box-main">
<ul class="swiper-wrapper">
{{#cancelReason}}
<li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
{{/cancelReason}}
</ul>
<div class="active-mask"></div>
</div>
</div>
</div>
{{/ order}}
... ...
<div class="order-page yoho-page">
{{# order}}
<ul id="order-nav" class="order-nav clearfix">
{{#each navs}}
<li class="tap-hightlight {{#if active}}active{{/if}}" data-type="{{typeId}}">
<a href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
<div id="order-container" class="order-container">
{{#each navs}}
<div class="orders{{#unless active}} hide{{/unless}}"></div>
{{/each}}
</div>
<div class="reason-mask">
<div class="reason-box" >
<div class="box-head"><span class="box-cmp">完成111</span></div>
<div class="swiper-container box-main">
<ul class="swiper-wrapper">
{{#cancelReason}}
<li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
{{/cancelReason}}
</ul>
<div class="active-mask"></div>
</div>
</div>
</div>
{{/ order}}
</div>
... ...
test
<div class="order-detail-page yoho-page">
{{# orderDetail}}
<div id="order-detail" data-id="{{orderNum}}">
{{#if isVirtual}}
<section class="block">
<div class="tickets-mobile">
<span class="pull-left">手机号码:</span>
<span class="pull-right">{{mobile}}</span>
</div>
</section>
{{else}}
<section class="owner-info block" data-changeable="{{changeable}}" data-url="{{url}}">
<span class="iconfont">&#xe637;</span>
<div class="beside-icon">
<p class="name-phone">
{{name}}
<span>{{phoneNum}}</span>
</p>
<p class="address">
{{address}}
</p>
<div class="rest">其他地址<span class="iconfont iconAddress">&#xe614;</span></div>
</div>
</section>
<div class="range"></div>
{{/if}}
<section class="order-status block">
<div class="status sub">
<span class="iconfont">&#xe632;</span>
<p class="beside-icon sub-content">
<span class="sub-title">订单编号:{{orderNum}}</span>
<span >订单状态:{{orderStatus}}</span>
<span>下单时间:{{orderTime}}</span>
</p>
</div>
{{#if logisticsUrl}}
<a class="logistics sub" href="{{logisticsUrl}}">
<span class="iconfont">&#xe630;</span>
<p class="beside-icon sub-content">
<span class="sub-title">物流信息</span>
<span>物流公司:{{logisticsCompany}}</span>
{{#if logisticsNum}}
<span>快递单号:{{logisticsNum}}</span>
{{/if}}
</p>
<span class="iconfont icon-right">&#xe614;</span>
</a>
{{/if}}
</section>
<section class="goods block">
{{#if isJit}}
{{> me/order/jit-more}}
{{/if}}
{{# goods}}
{{> me/order/good}}
{{/ goods}}
</section>
<ul class="cost block">
{{#each orderBalance}}
<li> {{promotion}}:
<span>{{account}}</span>
</li>
{{/each}}
<li>
实付金额
<span>{{price}}</span>
</li>
</ul>
{{#if yohoCoin}}
<p class="dollar">
<span class="bg-dollar"></span>
共返YOHO币:
<span>{{yohoCoin}}</span>
</p>
{{/if}}
{{#invoice}}
<ul class="invoice-info">
<li>
<span>发票信息</span>
<span class="invoice-fr">{{#if type}}电子发票{{else}}纸质发票{{/if}}</span>
</li>
<li>
<span>发票抬头</span>
<span class="invoice-fr invoice-title">{{title}}</span>
</li>
<li>
<span>发票内容</span>
<span class="invoice-fr">{{contentValue}}</span>
</li>
{{#if pdfUrl}}
<li>
<a href="{{pdfUrl}}"><span class="invoice-fr invoice-see">点击下载PDF发票</span></a>
</li>
{{/if}}
</ul>
{{/invoice}}
<div class="opt block">
{{#unless unreceived}}
{{#unless unpaid}}
<span class="btn btn-del">删除订单</span>
{{#if isVirtual}}
<!--虚拟商品-->
{{else}}
<span class="btn btn-rebuy">再次购买</span>
{{/if}}
{{/unless}}
{{/unless}}
{{#if unpaid}}
<ul class="count-down hide">
<li>
<span class="iconfont count-down-icon">&#xe64a;</span>
</li>
<li>
<span class="hours">{{leftTime}}</span>
</li>
</ul>
<span class="btn btn-cancel">取消订单</span>
{{#if payUrl}}
<a href="{{payUrl}}">
<span class="btn btn-pay">立即付款</span>
</a>
{{/if}}
{{/if}}
{{#if logisticsUrl}}
<a href="{{logisticsUrl}}">
<span class="btn btn-check-logistics">查看物流</span>
</a>
{{/if}}
{{#if qrcode}}
<a href="{{qrcode}}">
<span class="btn btn-check-logistics">查看二维码</span>
</a>
{{/if}}
</div>
</div>
<div class="reason-mask">
<div class="reason-box" >
<div class="box-head"><span class="box-cmp">完成</span></div>
<div class="swiper-container box-main">
<ul class="swiper-wrapper">
{{#cancelReason}}
<li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
{{/cancelReason}}
</ul>
<div class="active-mask"></div>
</div>
</div>
</div>
{{/ orderDetail}}
</div>
<script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
<script type="text/javascript" src="//static.yohobuy.com/m/v1/js/AG_Tracking.js"></script>
<script type="text/javascript">
var _agq = _agq || [];
_agq.push(['_cid', '415']); //生成value
_agq.push(['_eid', '102']); //生成value
_agq.push(['_orderSum', "{{orderTotal}}"]);//订单金额,客户在页面填写
_agq.push(['_orderNo', "{{orderCode}}"]);//订单号,客户在页面填写
_agq.push(['_orderNew', "{{isOldUser}}"]);//是否新客单,客户标记是为true否为false
_agq.push(['_orderCount', "{{orderCount}}"]);//订单货品数目,客户填写
ag_send(_agq);
var __order_code = "{{orderCode}}";
var __order_amount = "{{orderTotal}}";
var __order_user = "{{isOldUser}}";
var __order_goods_num = {{orderCount}};
var __order_uid = '{{uid}}';
var _fxcmd = _fxcmd || [];
_fxcmd.push(['trackOrder', {
oid: "{{orderCode}}",
otp: "{{orderTotalFormat}}",
unid: "{{uid}}"
}]);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event: "setAccount", account: [21397]},
{event: "setHashedEmail", email: ""},
{event: "setSiteType", type: "m"},
{event: "trackTransaction", id: "{{orderCode}}", currency: "CNY", item: ""}
);
</script>
... ...
... ... @@ -34,9 +34,9 @@ module.exports = {
useOneapm: false,
useCache: false,
memcache: {
master: ['192.168.102.222:12111'],
slave: ['192.168.102.222:12111'],
session: ['192.168.102.222:12111'],
master: ['192.168.102.205:12111'],
slave: ['192.168.102.205:12111'],
session: ['192.168.102.205:12111'],
timeout: 1000,
retries: 0
},
... ...