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.

  1 +/**
  2 + * 个人中心-订单列表 controller
  3 + * @author: jing.li<jing.li@yoho.cn>
  4 + * @date: 2016/08/15
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +// const headerModel = require('../../../doraemon/models/header'); // 头部model
  10 +const orderModel = require('../models/order');
  11 +
  12 +exports.order = (req, res, next) => {
  13 + let params = {
  14 + type: req.query.type || 1,
  15 + page: req.query.page || 1,
  16 + gender: req.query.gender || '1,3',
  17 + yh_channel: req.query.channel || 1,
  18 + uid: req.user.uid || 20000266
  19 + };
  20 +
  21 + orderModel.order(params).then(result => {
  22 + res.render('order', {
  23 + module: 'home',
  24 + page: 'order',
  25 + title: 'Yoho!Buy 有货',
  26 + order: result
  27 + });
  28 + }).catch(next);
  29 +};
  30 +
  31 +exports.getOrders = (req, res, next) => {
  32 + let params = {
  33 + type: req.query.type || 1,
  34 + page: req.query.page || 1,
  35 + gender: req.query.gender || '1,3',
  36 + yh_channel: req.query.channel || 1,
  37 + uid: req.user.uid || 20000266
  38 + };
  39 +
  40 + orderModel.order(params).then(result => {
  41 + res.render('order-template', {
  42 + layout: false,
  43 + order: result,
  44 + resultOut: JSON.stringify(result, 0, 4)
  45 + });
  46 + }).catch(next);
  47 +};
  1 +/**
  2 + * 个人中心 controller
  3 + * @author: chengyao.guo<chengyao.guo@yoho.cn>
  4 + * @date: 2016/08/10
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +const headerModel = require('../../../doraemon/models/header'); // 头部model
  10 +const orderDetailModel = require('../models/orderDetail');
  11 +
  12 +exports.orderDetail = (req, res, next) => {
  13 + let params = {
  14 + uid: req.user.uid || 6228593
  15 + };
  16 +
  17 + let headerData = headerModel.setNav({
  18 + navTitle: '订单详情'
  19 + });
  20 +
  21 + orderDetailModel.orderDetail(params).then(result => {
  22 + if (result) {
  23 + res.render('orderDetail', Object.assign(result, {
  24 + isLogin: params.uid ? true : false,
  25 + module: 'home',
  26 + page: 'index',
  27 + title: 'Yoho!Buy 有货',
  28 + pageHeader: headerData,
  29 + pageFooter: true
  30 + }));
  31 + }
  32 + }).catch(next);
  33 +
  34 +};
  1 +'use strict';
  2 +
  3 +const api = global.yoho.API;
  4 +const singleAPI = global.yoho.SingleAPI;
  5 +const helpers = global.yoho.helpers;
  6 +const camelCase = global.yoho.camelCase;
  7 +const _ = require('lodash');
  8 +
  9 +// const _getOrderData = (type, page, limit, gender, yh_channel, uid) => {
  10 +// return api.get('', {
  11 +// method: 'app.SpaceOrders.get',
  12 +// type: type,
  13 +// page: page,
  14 +// limit: limit,
  15 +// gender: gender,
  16 +// yh_channel: yh_channel,
  17 +// uid: uid
  18 +// }, {code: 200});
  19 +// };
  20 +
  21 +const processOrderData = (data) => {
  22 + let formartData = [];
  23 +
  24 + data = data || [];
  25 + data = camelCase(data);
  26 +
  27 + _.forEach(data.orderList, (obj) => {
  28 + let newObj = {
  29 + orderNum: obj.orderCode,
  30 + orderStatus: obj.statusStr,
  31 + sumCost: obj.amount,
  32 +
  33 + // if (obj.shippingCost > 0) {
  34 + // shippingCost : obj.shippingCost
  35 + // }
  36 + // 类内调用格式化订单商品数据方法
  37 + tickets: false,
  38 +
  39 + // if (virtualType && pbj.virtualType * 1 == 3) {
  40 + // tickets : true,
  41 + // isVirtual : true,//虚拟商品
  42 + // }
  43 + count: obj.count,
  44 + // //倒计时时间
  45 + // if (counterFlag && obj.counterFlag == 'Y') {
  46 + // leftTime : payLefttime*1000;
  47 + // }
  48 + };
  49 +
  50 + formartData.push(newObj);
  51 + });
  52 +
  53 + // console.log(formartData);
  54 + return formartData;
  55 +};
  56 +
  57 +const getNavs = (data) => {
  58 + // navType = ["全部", "待付款", "待发货", "待收货"];
  59 + // nav = [];
  60 + // _.forEach(navType, (obj) => {
  61 + // // obj.act = false;
  62 + // // if (obj.type == obj.key) {
  63 + // // obj.act = true;
  64 + // // }
  65 + // let newObj = {
  66 + // name : obj.value,
  67 + // typeId : obj.key,
  68 + // active : obj.act,
  69 + // //url : Helpers::url('/home/orders', array('type' => $key))
  70 + // }
  71 + // nav.push(newObj);
  72 + // }
  73 +
  74 + // return nav;
  75 +};
  76 +
  77 +// type, page, limit, gender, yh_channel, uid
  78 +const order = (params) => {
  79 + return api.get('', _.assign({
  80 + method: 'app.SpaceOrders.get',
  81 + limit: 10,
  82 + }, params)).then((data) => {
  83 + if (data && data.code === 200) {
  84 + return processOrderData(data.data);
  85 + }
  86 + });
  87 +};
  88 +
  89 +module.exports = {
  90 + order
  91 +};
  1 +/**
  2 + * Created by PhpStorm.
  3 + * User: Targaryen
  4 + * Date: 2016/8/10
  5 + * Time: 13:43
  6 + */
  7 +
  8 +'use strict';
  9 +
  10 +const api = global.yoho.API;
  11 +const singleAPI = global.yoho.SingleAPI;
  12 +const helpers = global.yoho.helpers;
  13 +const camelCase = global.yoho.camelCase;
  14 +
  15 +/**
  16 + * 个人详情数据
  17 + */
  18 +const _viewOrderData = (orderCode, uid, sessionKey) => {
  19 + return api.get('', {
  20 + method: 'app.SpaceOrders.detail',
  21 + orderCode: orderCode,
  22 + uid: uid,
  23 + sessionKey: sessionKey
  24 + }, {code: 200});
  25 +};
  26 +
  27 +const orderDetail = (orderCode, uid, sessionKey) => {
  28 + let result = {
  29 +
  30 + };
  31 +
  32 + return api.all([
  33 + _viewOrderData(1, 10851797, 1)
  34 + ]).then(result => {
  35 + console.log(result[0].data);
  36 + return result;
  37 + });
  38 +};
  39 +
  40 +module.exports = {
  41 + orderDetail
  42 +};
@@ -10,8 +10,13 @@ const router = express.Router(); // eslint-disable-line @@ -10,8 +10,13 @@ const router = express.Router(); // eslint-disable-line
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 11
12 const personalController = require(`${cRoot}/qrcode`); 12 const personalController = require(`${cRoot}/qrcode`);
  13 +const orderController = require(`${cRoot}/order`);
  14 +const orderDetailController = require(`${cRoot}/orderDetail`);
13 15
14 // 查看二维码 16 // 查看二维码
15 router.get('/QRcode/:id', personalController.QRcode); 17 router.get('/QRcode/:id', personalController.QRcode);
  18 +router.get('/order', orderController.order);
  19 +router.get('/getOrders', orderController.getOrders);
  20 +router.get('/orderDetail', orderDetailController.orderDetail);
16 21
17 module.exports = router; 22 module.exports = router;
  1 +{{# order}}
  2 + <ul id="order-nav" class="order-nav clearfix">
  3 + {{#each navs}}
  4 + <li class="tap-hightlight {{#if active}}active{{/if}}" data-type="{{typeId}}">
  5 + <a href="{{url}}">{{name}}</a>
  6 + </li>
  7 + {{/each}}
  8 + </ul>
  9 +
  10 + <div id="order-container" class="order-container">
  11 + {{#each navs}}
  12 + <div class="orders{{#unless active}} hide{{/unless}}"></div>
  13 + {{/each}}
  14 + </div>
  15 +
  16 + <div class="reason-mask">
  17 + <div class="reason-box" >
  18 + <div class="box-head"><span class="box-cmp">完成2</span></div>
  19 + <div class="swiper-container box-main">
  20 +
  21 + <ul class="swiper-wrapper">
  22 + {{#cancelReason}}
  23 + <li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
  24 + {{/cancelReason}}
  25 + </ul>
  26 + <div class="active-mask"></div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 +{{/ order}}
  31 +
  1 +<div class="order-page yoho-page">
  2 + {{# order}}
  3 + <ul id="order-nav" class="order-nav clearfix">
  4 + {{#each navs}}
  5 + <li class="tap-hightlight {{#if active}}active{{/if}}" data-type="{{typeId}}">
  6 + <a href="{{url}}">{{name}}</a>
  7 + </li>
  8 + {{/each}}
  9 + </ul>
  10 +
  11 + <div id="order-container" class="order-container">
  12 + {{#each navs}}
  13 + <div class="orders{{#unless active}} hide{{/unless}}"></div>
  14 + {{/each}}
  15 + </div>
  16 +
  17 + <div class="reason-mask">
  18 + <div class="reason-box" >
  19 + <div class="box-head"><span class="box-cmp">完成111</span></div>
  20 + <div class="swiper-container box-main">
  21 +
  22 + <ul class="swiper-wrapper">
  23 + {{#cancelReason}}
  24 + <li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
  25 + {{/cancelReason}}
  26 + </ul>
  27 + <div class="active-mask"></div>
  28 + </div>
  29 + </div>
  30 + </div>
  31 + {{/ order}}
  32 +</div>
  33 +
  1 +test
  2 +<div class="order-detail-page yoho-page">
  3 + {{# orderDetail}}
  4 + <div id="order-detail" data-id="{{orderNum}}">
  5 + {{#if isVirtual}}
  6 + <section class="block">
  7 + <div class="tickets-mobile">
  8 + <span class="pull-left">手机号码:</span>
  9 + <span class="pull-right">{{mobile}}</span>
  10 + </div>
  11 + </section>
  12 + {{else}}
  13 + <section class="owner-info block" data-changeable="{{changeable}}" data-url="{{url}}">
  14 + <span class="iconfont">&#xe637;</span>
  15 +
  16 + <div class="beside-icon">
  17 + <p class="name-phone">
  18 + {{name}}
  19 + <span>{{phoneNum}}</span>
  20 + </p>
  21 +
  22 + <p class="address">
  23 + {{address}}
  24 + </p>
  25 +
  26 + <div class="rest">其他地址<span class="iconfont iconAddress">&#xe614;</span></div>
  27 + </div>
  28 +
  29 + </section>
  30 + <div class="range"></div>
  31 + {{/if}}
  32 + <section class="order-status block">
  33 + <div class="status sub">
  34 + <span class="iconfont">&#xe632;</span>
  35 +
  36 + <p class="beside-icon sub-content">
  37 + <span class="sub-title">订单编号:{{orderNum}}</span>
  38 + <span >订单状态:{{orderStatus}}</span>
  39 + <span>下单时间:{{orderTime}}</span>
  40 + </p>
  41 + </div>
  42 + {{#if logisticsUrl}}
  43 + <a class="logistics sub" href="{{logisticsUrl}}">
  44 + <span class="iconfont">&#xe630;</span>
  45 +
  46 + <p class="beside-icon sub-content">
  47 + <span class="sub-title">物流信息</span>
  48 + <span>物流公司:{{logisticsCompany}}</span>
  49 + {{#if logisticsNum}}
  50 + <span>快递单号:{{logisticsNum}}</span>
  51 + {{/if}}
  52 + </p>
  53 + <span class="iconfont icon-right">&#xe614;</span>
  54 + </a>
  55 + {{/if}}
  56 + </section>
  57 +
  58 + <section class="goods block">
  59 + {{#if isJit}}
  60 + {{> me/order/jit-more}}
  61 + {{/if}}
  62 + {{# goods}}
  63 + {{> me/order/good}}
  64 + {{/ goods}}
  65 + </section>
  66 +
  67 + <ul class="cost block">
  68 + {{#each orderBalance}}
  69 + <li> {{promotion}}:
  70 + <span>{{account}}</span>
  71 + </li>
  72 + {{/each}}
  73 + <li>
  74 + 实付金额
  75 + <span>{{price}}</span>
  76 + </li>
  77 + </ul>
  78 + {{#if yohoCoin}}
  79 + <p class="dollar">
  80 + <span class="bg-dollar"></span>
  81 + 共返YOHO币:
  82 + <span>{{yohoCoin}}</span>
  83 + </p>
  84 + {{/if}}
  85 +
  86 + {{#invoice}}
  87 + <ul class="invoice-info">
  88 + <li>
  89 + <span>发票信息</span>
  90 + <span class="invoice-fr">{{#if type}}电子发票{{else}}纸质发票{{/if}}</span>
  91 + </li>
  92 + <li>
  93 + <span>发票抬头</span>
  94 + <span class="invoice-fr invoice-title">{{title}}</span>
  95 + </li>
  96 + <li>
  97 + <span>发票内容</span>
  98 + <span class="invoice-fr">{{contentValue}}</span>
  99 + </li>
  100 + {{#if pdfUrl}}
  101 + <li>
  102 + <a href="{{pdfUrl}}"><span class="invoice-fr invoice-see">点击下载PDF发票</span></a>
  103 + </li>
  104 + {{/if}}
  105 + </ul>
  106 + {{/invoice}}
  107 +
  108 + <div class="opt block">
  109 + {{#unless unreceived}}
  110 + {{#unless unpaid}}
  111 + <span class="btn btn-del">删除订单</span>
  112 + {{#if isVirtual}}
  113 + <!--虚拟商品-->
  114 + {{else}}
  115 + <span class="btn btn-rebuy">再次购买</span>
  116 + {{/if}}
  117 + {{/unless}}
  118 + {{/unless}}
  119 +
  120 + {{#if unpaid}}
  121 + <ul class="count-down hide">
  122 + <li>
  123 + <span class="iconfont count-down-icon">&#xe64a;</span>
  124 + </li>
  125 + <li>
  126 + <span class="hours">{{leftTime}}</span>
  127 + </li>
  128 + </ul>
  129 + <span class="btn btn-cancel">取消订单</span>
  130 + {{#if payUrl}}
  131 + <a href="{{payUrl}}">
  132 + <span class="btn btn-pay">立即付款</span>
  133 + </a>
  134 + {{/if}}
  135 + {{/if}}
  136 +
  137 + {{#if logisticsUrl}}
  138 + <a href="{{logisticsUrl}}">
  139 + <span class="btn btn-check-logistics">查看物流</span>
  140 + </a>
  141 + {{/if}}
  142 +
  143 + {{#if qrcode}}
  144 + <a href="{{qrcode}}">
  145 + <span class="btn btn-check-logistics">查看二维码</span>
  146 + </a>
  147 + {{/if}}
  148 + </div>
  149 + </div>
  150 +
  151 + <div class="reason-mask">
  152 + <div class="reason-box" >
  153 + <div class="box-head"><span class="box-cmp">完成</span></div>
  154 + <div class="swiper-container box-main">
  155 + <ul class="swiper-wrapper">
  156 + {{#cancelReason}}
  157 + <li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
  158 + {{/cancelReason}}
  159 + </ul>
  160 + <div class="active-mask"></div>
  161 + </div>
  162 + </div>
  163 + </div>
  164 + {{/ orderDetail}}
  165 +</div>
  166 +<script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
  167 +<script type="text/javascript" src="//static.yohobuy.com/m/v1/js/AG_Tracking.js"></script>
  168 +<script type="text/javascript">
  169 + var _agq = _agq || [];
  170 + _agq.push(['_cid', '415']); //生成value
  171 + _agq.push(['_eid', '102']); //生成value
  172 + _agq.push(['_orderSum', "{{orderTotal}}"]);//订单金额,客户在页面填写
  173 + _agq.push(['_orderNo', "{{orderCode}}"]);//订单号,客户在页面填写
  174 + _agq.push(['_orderNew', "{{isOldUser}}"]);//是否新客单,客户标记是为true否为false
  175 + _agq.push(['_orderCount', "{{orderCount}}"]);//订单货品数目,客户填写
  176 + ag_send(_agq);
  177 +
  178 + var __order_code = "{{orderCode}}";
  179 + var __order_amount = "{{orderTotal}}";
  180 + var __order_user = "{{isOldUser}}";
  181 + var __order_goods_num = {{orderCount}};
  182 + var __order_uid = '{{uid}}';
  183 +
  184 + var _fxcmd = _fxcmd || [];
  185 + _fxcmd.push(['trackOrder', {
  186 + oid: "{{orderCode}}",
  187 + otp: "{{orderTotalFormat}}",
  188 + unid: "{{uid}}"
  189 + }]);
  190 +</script>
  191 +<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
  192 +<script type="text/javascript">
  193 + window.criteo_q = window.criteo_q || [];
  194 + window.criteo_q.push(
  195 + {event: "setAccount", account: [21397]},
  196 + {event: "setHashedEmail", email: ""},
  197 + {event: "setSiteType", type: "m"},
  198 + {event: "trackTransaction", id: "{{orderCode}}", currency: "CNY", item: ""}
  199 + );
  200 +</script>
@@ -34,9 +34,9 @@ module.exports = { @@ -34,9 +34,9 @@ module.exports = {
34 useOneapm: false, 34 useOneapm: false,
35 useCache: false, 35 useCache: false,
36 memcache: { 36 memcache: {
37 - master: ['192.168.102.222:12111'],  
38 - slave: ['192.168.102.222:12111'],  
39 - session: ['192.168.102.222:12111'], 37 + master: ['192.168.102.205:12111'],
  38 + slave: ['192.168.102.205:12111'],
  39 + session: ['192.168.102.205:12111'],
40 timeout: 1000, 40 timeout: 1000,
41 retries: 0 41 retries: 0
42 }, 42 },