Authored by 陈轩

save

@@ -50,3 +50,21 @@ exports.fetchImHistory = (uid, pageSize, startTime, endTime) => { @@ -50,3 +50,21 @@ exports.fetchImHistory = (uid, pageSize, startTime, endTime) => {
50 50
51 return ImAPI.get('/api/conversationMessage/pageList', params); 51 return ImAPI.get('/api/conversationMessage/pageList', params);
52 }; 52 };
  53 +
  54 +/**
  55 + * 获取用户订单, 默认最近10笔
  56 + * @param {int} uid 用户uid
  57 + * @param {init} createTimeBegin 开始时间
  58 + */
  59 +exports.fetchOrderList = (uid, createTimeBegin) => {
  60 + let params = {
  61 + uid,
  62 + encryptedUid: encryptedUid(uid)
  63 + };
  64 +
  65 + _.forEach({createTimeBegin}, (key, val) => {
  66 + val && (params[key] = val)
  67 + });
  68 +
  69 + return ImAPI.get('/api/cs/queryUserLastTenOrdersNgoodsInfo', params);
  70 +};
@@ -4,6 +4,7 @@ const orderModel = require('../../home/models/order'); @@ -4,6 +4,7 @@ const orderModel = require('../../home/models/order');
4 const crypto = global.yoho.crypto; 4 const crypto = global.yoho.crypto;
5 const indexModel = require('../../home/models/index'); 5 const indexModel = require('../../home/models/index');
6 const imApi = require('../../serverAPI/im'); 6 const imApi = require('../../serverAPI/im');
  7 +const imModel = require('../models/im');
7 8
8 exports.page = (req, res, next) => { 9 exports.page = (req, res, next) => {
9 res.render('chat/index', { 10 res.render('chat/index', {
@@ -49,6 +50,13 @@ exports.msghistory = (req, res, next) => { @@ -49,6 +50,13 @@ exports.msghistory = (req, res, next) => {
49 }); 50 });
50 }; 51 };
51 52
  53 +/**
  54 + * Request: 发表留言
  55 + * type: POST
  56 + * params:
  57 + * conversationId 会话id
  58 + * content 留言内容
  59 + */
52 exports.saveMSG = (req, res, next) => { 60 exports.saveMSG = (req, res, next) => {
53 const uid = req.user.uid; 61 const uid = req.user.uid;
54 const conversationId = req.body.conversationId; 62 const conversationId = req.body.conversationId;
@@ -59,3 +67,22 @@ exports.saveMSG = (req, res, next) => { @@ -59,3 +67,22 @@ exports.saveMSG = (req, res, next) => {
59 res.json(result); 67 res.json(result);
60 }); 68 });
61 }; 69 };
  70 +
  71 +/**
  72 + * Request: 获取订单
  73 + * type: GET
  74 + *
  75 + * TODO:
  76 + * 1. 分页, 目前接口不支持
  77 + * 2. 失败情况
  78 + */
  79 +exports.fetchOrders = (req, res, next) => {
  80 + const uid = req.user.uid;
  81 +
  82 + imApi.fetchOrderList(uid)
  83 + .then(result => {
  84 + imModel.handleOrderList(result.data);
  85 + res.json(result);
  86 + });
  87 +};
  88 +
  1 +'use strict';
  2 +
  3 +/**
  4 + * im 接口数据的 处理
  5 + */
  6 +
  7 +/**
  8 + * function: 处理 订单返回的数据
  9 + */
  10 +exports.handleOrderList = data => {
  11 + if (!data.length) {
  12 + return;
  13 + }
  14 +
  15 + data.forEach(order => {
  16 + order.goods = order.ordersGoodsBoList.map(good => {
  17 + return {
  18 + id: good.productSku,
  19 + name: good.productName,
  20 + thumb: good.imgUrl,
  21 + color: good.colorName,
  22 + size: good.sizeName,
  23 + count: good.buyNumber,
  24 + price: good.lastPrice
  25 + };
  26 + });
  27 + order.count = order.ordersGoodsBoList.reduce((sum, good) => {
  28 + return sum + good.buyNumber;
  29 + }, 0);
  30 + });
  31 +};
@@ -18,6 +18,7 @@ router.get('/im', chat.page); @@ -18,6 +18,7 @@ router.get('/im', chat.page);
18 router.get('/getOrders', chat.getOrders); 18 router.get('/getOrders', chat.getOrders);
19 router.get('/userinfo', chat.userinfo); 19 router.get('/userinfo', chat.userinfo);
20 router.get('/msghistory', chat.msghistory); 20 router.get('/msghistory', chat.msghistory);
  21 +router.get('/order-list', chat.fetchOrders);
21 router.post('/leavemsg/save.json', chat.saveMSG); 22 router.post('/leavemsg/save.json', chat.saveMSG);
22 23
23 router.get('/chatQaList', chatQa.qaList); // 问题搜索列表页 24 router.get('/chatQaList', chatQa.qaList); // 问题搜索列表页
@@ -42,11 +42,11 @@ @@ -42,11 +42,11 @@
42 <div class="icon"></div> 42 <div class="icon"></div>
43 <p class="menu-name">相册</p> 43 <p class="menu-name">相册</p>
44 </div> 44 </div>
45 - <div class="icon-wrap order" id="js-order-list"> 45 + <div class="icon-wrap order" data-trigger="order-list">
46 <div class="icon"></div> 46 <div class="icon"></div>
47 <p class="menu-name">订单</p> 47 <p class="menu-name">订单</p>
48 </div> 48 </div>
49 - <div class="icon-wrap broad-order"> 49 + <div class="icon-wrap broad-order" data-trigger="order-list" data-param="international">
50 <div class="icon"></div> 50 <div class="icon"></div>
51 <p class="menu-name">境外订单</p> 51 <p class="menu-name">境外订单</p>
52 </div> 52 </div>
@@ -55,16 +55,7 @@ @@ -55,16 +55,7 @@
55 </div> 55 </div>
56 56
57 {{> chat-comment}} 57 {{> chat-comment}}
58 -{{> leave-msg}}  
59 -{{> order-list}}  
60 -  
61 -{{!--订单--}}  
62 -<div id="order-list" class="chat-page chat-page-hide">  
63 - <header class="yoho-header chat-header">  
64 - <a href="javascript:void 0;" class="iconfont nav-back">&#xe610;</a>  
65 - <div class="title">选择订单</div>  
66 - </header>  
67 - <div class="main"></div>  
68 -</div> 58 +{{> chat/leave-msg}}
  59 +{{> chat/order-list}}
69 60
70 <input type="hidden" id="encrypteduid" value="{{encrypteduid}}"> 61 <input type="hidden" id="encrypteduid" value="{{encrypteduid}}">
@@ -7,5 +7,5 @@ @@ -7,5 +7,5 @@
7 <div class="main"> 7 <div class="main">
8 <textarea name="leave-text" class="leave-text" placeholder="请输入留言文字,Yoho!客服会以短信形式回复您,谢谢您对Yoho!有货的支持!"></textarea> 8 <textarea name="leave-text" class="leave-text" placeholder="请输入留言文字,Yoho!客服会以短信形式回复您,谢谢您对Yoho!有货的支持!"></textarea>
9 <button class="leave-submit">提交</button> 9 <button class="leave-submit">提交</button>
10 - <div> 10 + </div>
11 </div> 11 </div>
  1 +{{!--订单--}}
  2 +<div id="order-list" class="chat-page chat-page-hide">
  3 + <header class="yoho-header chat-header">
  4 + <a href="javascript:void 0;" class="iconfont chat-page-back nav-back">&#xe610;</a>
  5 + <div class="title">选择订单</div>
  6 + </header>
  7 + <div class="main">
  8 + <div data-tab="local"><!-- 订单 --></div>
  9 + <div data-tab="global"><!-- 海外订单 --></div>
  10 + </div>
  11 +</div>
1 -<div id="order-list-wrap">  
2 - <!--im 头部-->  
3 - <header id="chat-header" class="yoho-header">  
4 - <a href="#" class="iconfont nav-back order-back">&#xe610;</a>  
5 - <div class="header-status">  
6 - <span class="service-name">订单列表</span>  
7 - </div>  
8 - </header>  
9 -  
10 - <div id="order-container" class="order-container">  
11 - <div class="orders"></div>  
12 - </div>  
13 -  
14 -</div>  
  1 +<div class="msg-wrap {{style}}">
  2 + <img src="{{avatar}}" alt="" class="head-icon">
  3 + <div class="chat-info">
  4 + {{#data}}
  5 + {{> (lookup .. 'type')}}
  6 + {{/data}}
  7 + {{!--订单--}}
  8 + {{!--{{# order}}
  9 +
  10 + {{/ order}}--}}
  11 +
  12 + {{!--文字类型--}}
  13 + {{!--{{# text}}
  14 + {{/ text}}--}}
  15 +
  16 + {{!--图片类型--}}
  17 + {{!--{{# picture}}
  18 + {{/ picture}}--}}
  19 +
  20 + {{!--语音--}}
  21 + {{!--{{# voice}}
  22 + {{/ voice}}--}}
  23 + </div>
  24 +</div>
  25 +
  26 +
  27 +{{!--inline partails--}}
  28 +{{#*inline 'order'}}
  29 + <div class="chat-order">
  30 + <img src="{{thumb}}">
  31 + <div>
  32 + <span class="label">订单号: </span><span>{{orderCode}}</span><br>
  33 + <span class="label">金额: </span><span class="red">{{cost}}</span><br>
  34 + <span class="label">下单时间: </span><span>{{createTime}}</span><br>
  35 + <span class="label">订单状态</span><span>{{orderStatus}}</span><br>
  36 + </div>
  37 +</div>
  38 +{{/inline}}
  39 +
  40 +{{#*inline 'text'}}
  41 + <div class="chat-txt">
  42 + TODO
  43 + </div>
  44 +{{/inline}}
  45 +
  46 +{{#*inline 'picture'}}
  47 + <div class="chat-pic">
  48 + TODO
  49 + </div>
  50 +{{/inline}}
  51 +
  52 +{{#*inline 'voice'}}
  53 + <div class="chat-voice">
  54 + TODO
  55 + </div>
  56 +{{/inline}}
  57 +
  58 +{{#*inline 'system'}}
  59 + <div class="">
  60 +
  61 + </div>
  62 +{{/inline}}
  1 +<div class="chat-txt chat-txt-order">
  2 + <img src="{{thumb}}">
  3 + <div>
  4 + <span class="label">订单号: </span><span>{{orderCode}}</span><br>
  5 + <span class="label">金额: </span><span class="red">{{cost}}</span><br>
  6 + <span class="label">下单时间: </span><span>{{createTime}}</span><br>
  7 + <span class="label">订单状态</span><span>{{orderStatus}}</span><br>
  8 + </div>
  9 +</div>
  1 +{{#each orders}}
  2 +<div class="order-page">
  3 + <div class="order" data-id="{{orderCode}}" data-href="{{detailUrl}}">
  4 + <header class="header">
  5 + 订单编号:{{orderCode}}
  6 + <span class="order-status">{{orderStatusDesc}}</span>
  7 + </header>
  8 + <section class="order-goods">
  9 + {{# goods}}
  10 + {{> order/good}}
  11 + {{/ goods}}
  12 + </section>
  13 + <footer class="footer">
  14 +{{count}}件商品 实付<span class="sum-cost">¥{{sumCost}}</span>
  15 + {{#shippingCost}}(含运费¥{{.}}){{/shippingCost}}
  16 + </footer>
  17 + <div class="send-order clearfix">
  18 + <button class="send-order-btn">发送订单</button>
  19 + </div>
  20 + </div>
  21 + <input class="js-create-time" type="hidden" name="human-time" value="{{time}}">
  22 +</div>
  23 +{{/each}}
@@ -5,10 +5,21 @@ @@ -5,10 +5,21 @@
5 5
6 'use strict'; 6 'use strict';
7 7
8 -import { time } from './time';  
9 -import { tip } from './tip';  
10 -import { Customer, Employee} from './role';  
11 -import { RatingView, LeaveMSGView, OrderListView } from './view'; 8 +import {
  9 + time
  10 +} from './time';
  11 +import {
  12 + tip
  13 +} from './tip';
  14 +import {
  15 + Customer,
  16 + Employee
  17 +} from './role';
  18 +import {
  19 + RatingView,
  20 + LeaveMSGView,
  21 + OrderListView
  22 +} from './view';
12 23
13 require('../../home/jquery.upload'); 24 require('../../home/jquery.upload');
14 var saveImage = require('../../home/save-image'); 25 var saveImage = require('../../home/save-image');
@@ -37,14 +48,18 @@ const resizeFooter = () => { @@ -37,14 +48,18 @@ const resizeFooter = () => {
37 48
38 var chat = { 49 var chat = {
39 $chat: null, 50 $chat: null,
  51 + $chatWin: null,
  52 +
  53 + messageT: require('service/chat/msg.hbs'),
40 54
41 // 初始化websocket 55 // 初始化websocket
42 init: function() { 56 init: function() {
43 this.$chat = $('#chat-main-wrap'); 57 this.$chat = $('#chat-main-wrap');
  58 + this.$chatWin = this.$chat.find('#chat-window');
44 59
45 // TODO: chat view 与 LeaveMSGView, OrderListView的通信 解耦 60 // TODO: chat view 与 LeaveMSGView, OrderListView的通信 解耦
46 this.leaveMSGView = new LeaveMSGView('#leave-msg'); 61 this.leaveMSGView = new LeaveMSGView('#leave-msg');
47 - this.orderListView = new OrderListView(); 62 + this.orderListView = new OrderListView('#order-list');
48 63
49 const self = this; 64 const self = this;
50 65
@@ -64,8 +79,8 @@ var chat = { @@ -64,8 +79,8 @@ var chat = {
64 var received = JSON.parse(e.data); 79 var received = JSON.parse(e.data);
65 console.log(received); 80 console.log(received);
66 cmEntity.conversationId = received.newConversationId > 0 ? 81 cmEntity.conversationId = received.newConversationId > 0 ?
67 - received.newConversationId :  
68 - received.conversationId; 82 + received.newConversationId :
  83 + received.conversationId;
69 84
70 self.getMessage(received); 85 self.getMessage(received);
71 } 86 }
@@ -84,13 +99,73 @@ var chat = { @@ -84,13 +99,73 @@ var chat = {
84 .on('click.leaveMSG', '[data-trigger=leave-msg]', function() { 99 .on('click.leaveMSG', '[data-trigger=leave-msg]', function() {
85 self.leaveMSGView.trigger('show.LeaveMSGView'); 100 self.leaveMSGView.trigger('show.LeaveMSGView');
86 }) 101 })
87 - .on('click.orderList', '#js-order-list', function() { 102 + .on('click.orderList', '[data-trigger=order-list]', function() {
88 self.orderListView.trigger('show.OderListView'); 103 self.orderListView.trigger('show.OderListView');
89 }); 104 });
90 105
  106 +
  107 + this.orderListView
  108 + .on('selectOrder.OrderListView', function(event, data) {
  109 + let msg = {
  110 + type: 'order',
  111 + data
  112 + };
  113 +
  114 + self.sendMSG(msg);
  115 + });
  116 +
91 // TODO 117 // TODO
92 }, 118 },
93 119
  120 + /**
  121 + * method: 在聊天窗口上, 画出信息
  122 + * @param object msg
  123 + * {
  124 + * from: str //来源 ["customer", "robot", "employee", "system"]
  125 + * type: str //消息类型 see swtich msg.type
  126 + * data: object //消息数据
  127 + * }
  128 + *
  129 + * 测试数据:
  130 + chat.sendMSG({
  131 + type: 'order',
  132 + data: {
  133 + imgSrc: '123123123123',
  134 + orderCode: '123123123123',
  135 + cost: '123123123123',
  136 + createTime: '123123123123',
  137 + orderStatus: '123123123123'
  138 + }
  139 + })
  140 + *
  141 + */
  142 + sendMSG: function(msg) {
  143 + this._drawMSG(msg);
  144 +
  145 + switch (msg.type) {
  146 + case 'order': // 订单消息
  147 + break;
  148 + case 'pic': // 图片消息
  149 + break;
  150 + case 'voice': // 语音消息
  151 + break;
  152 + default: // 文字消息
  153 + break;
  154 + }
  155 + },
  156 +
  157 +
  158 + /**
  159 + * 订单消息
  160 + * @param object viewData 订单消息模版数据
  161 + */
  162 + _drawMSG: function(viewData) {
  163 + let chatWin = this.$chatWin[0];
  164 + let html = this.messageT(viewData);
  165 +
  166 + this.$chatWin.append(html);
  167 + chatWin.scrollTop = chatWin.scrollHeight; },
  168 +
94 // 获取10条历史记录 169 // 获取10条历史记录
95 fetchHistoryMsg: function(cb) { 170 fetchHistoryMsg: function(cb) {
96 const self = this; 171 const self = this;
@@ -134,9 +209,9 @@ var chat = { @@ -134,9 +209,9 @@ var chat = {
134 this.handleCusMsg(rec, msgType, message); 209 this.handleCusMsg(rec, msgType, message);
135 break; 210 break;
136 211
137 - // case allTypes.BREAK_TIME:  
138 - // breakCountdown(message);  
139 - // break; 212 + // case allTypes.BREAK_TIME:
  213 + // breakCountdown(message);
  214 + // break;
140 215
141 case allTypes.ROBOT_SEND: 216 case allTypes.ROBOT_SEND:
142 rec.csName = rec.csName || '客服机器人'; 217 rec.csName = rec.csName || '客服机器人';
@@ -150,16 +225,16 @@ var chat = { @@ -150,16 +225,16 @@ var chat = {
150 this.handleCsMsg(rec, msgType, message); 225 this.handleCsMsg(rec, msgType, message);
151 break; 226 break;
152 227
153 - // case allTypes.EVAL_INVITE:  
154 - // // 客服发起  
155 - // processInfo.promoter = 2;  
156 - // showEvalModal();  
157 - // break; 228 + // case allTypes.EVAL_INVITE:
  229 + // // 客服发起
  230 + // processInfo.promoter = 2;
  231 + // showEvalModal();
  232 + // break;
158 233
159 - // case allTypes.CS_CHATTING:  
160 - // // 正在人工会话  
161 - // csChatting(message);  
162 - // break; 234 + // case allTypes.CS_CHATTING:
  235 + // // 正在人工会话
  236 + // csChatting(message);
  237 + // break;
163 238
164 case allTypes.OFFLINE: 239 case allTypes.OFFLINE:
165 append(time(Date.now()).show()); 240 append(time(Date.now()).show());
@@ -301,4 +376,5 @@ $('#chat-window').on('click', '.chat-image', function() { @@ -301,4 +376,5 @@ $('#chat-window').on('click', '.chat-image', function() {
301 }); 376 });
302 377
303 378
304 -window.$ = $;  
  379 +window.$ = $;
  380 +window.chat = chat;
@@ -50,6 +50,15 @@ let api = { @@ -50,6 +50,15 @@ let api = {
50 conversationId: conversation.conversationId, 50 conversationId: conversation.conversationId,
51 content, 51 content,
52 }); 52 });
  53 + },
  54 +
  55 + /**
  56 + * 获取订单
  57 + * TODO:
  58 + * 1. 目前接口不支持分页
  59 + */
  60 + fetchOrders: function() {
  61 + return $.get('/service/order-list');
53 } 62 }
54 }; 63 };
55 64
@@ -2,7 +2,7 @@ const loading = require('../../plugin/loading'), @@ -2,7 +2,7 @@ const loading = require('../../plugin/loading'),
2 lazyLoad = require('yoho-jquery-lazyload'); 2 lazyLoad = require('yoho-jquery-lazyload');
3 3
4 require('../../common'); 4 require('../../common');
5 -import {EventEmitter, bus} from './store'; 5 +import {EventEmitter, bus, api} from './store';
6 6
7 7
8 const LeaveMSGView = function(elem) { 8 const LeaveMSGView = function(elem) {
@@ -12,7 +12,7 @@ const LeaveMSGView = function(elem) { @@ -12,7 +12,7 @@ const LeaveMSGView = function(elem) {
12 this.bindEvents(); 12 this.bindEvents();
13 }; 13 };
14 14
15 -LeaveMSGView.prototype = $.extend(EventEmitter.prototype, { 15 +LeaveMSGView.prototype = $.extend({}, EventEmitter.prototype, {
16 /** 16 /**
17 * 绑定事件 17 * 绑定事件
18 * 1. 提交按钮事件 18 * 1. 提交按钮事件
@@ -22,7 +22,7 @@ LeaveMSGView.prototype = $.extend(EventEmitter.prototype, { @@ -22,7 +22,7 @@ LeaveMSGView.prototype = $.extend(EventEmitter.prototype, {
22 22
23 this.$elem 23 this.$elem
24 .on('click', '.chat-page-back', function() { 24 .on('click', '.chat-page-back', function() {
25 - self.toggleView(true); 25 + self.toggleHide(true);
26 }) 26 })
27 .on('click.LeavseMSG.submit', '.leave-submit', function() { 27 .on('click.LeavseMSG.submit', '.leave-submit', function() {
28 self.submit(); 28 self.submit();
@@ -103,87 +103,81 @@ class RatingView { @@ -103,87 +103,81 @@ class RatingView {
103 } 103 }
104 } 104 }
105 105
106 -/*  
107 - 订单列表view  
108 -*/  
109 -class OrderListView {  
110 - constructor() {  
111 - this.bindEvent();  
112 - this.order = {  
113 - page: 0,  
114 - end: false  
115 - };  
116 - this.$curContainer = $('#order-container').children('.orders:not(.hide)');  
117 - this.getOrder(this);  
118 - } 106 +const OrderListView = function(elem) {
  107 + this.$elem = $(elem);
  108 + this.orderListT = require('service/chat/orders.hbs');
  109 +
  110 + this.$localOrders = this.$elem.find('[data-tab=local]');
  111 + this.$globalOrders = this.$elem.find('[data-tab=global]');
  112 +
  113 + this.bindEvents();
  114 + this.fetchOrders();
  115 +};
119 116
120 - bindEvent() {  
121 - // 订单  
122 - $('body').on('touchstart', '.menu .order', function() {  
123 - $('#chat-main-wrap').hide();  
124 - $('#order-list-wrap').show(); 117 +OrderListView.prototype = $.extend({}, EventEmitter.prototype, {
  118 + bindEvents: function() {
  119 + const self = this;
  120 +
  121 + this.$elem
  122 + .on('click.OrderListView.back', '.chat-page-back', function() {
  123 + self.toggleHide(true);
  124 + })
  125 + .on('click.OrderListView.select', '[data-action=select]', function() {
125 126
126 - $('.order-back').on('click', function() {  
127 - $('#order-list-wrap').hide();  
128 - $('#chat-main-wrap').show();  
129 }); 127 });
130 - });  
131 - }  
132 128
133 - getOrder(self, cb, option) {  
134 - var opt = {  
135 - type: 1,  
136 - page: self.order.page + 1 129 + // 被通知显示,执行显示
  130 + this.on('show.OderListView', $.proxy(this.toggleHide, this, false));
  131 + },
  132 +
  133 + /**
  134 + * method: 选择订单,然后关闭
  135 + */
  136 + selectOrder: function() {
  137 + let $order = $(event.target).closest('.order-page');
  138 +
  139 + // 订单数据
  140 + let data = {
  141 + imgSrc: $order.find('.thumb').attr('src'),
  142 + orderCode: $order.find('[data-id]'),
  143 + cost: $order.find('.sum-cost').text(),
  144 + createTime: $order.find('.js-create-time').val(),
  145 + orderStatus: $order.find('.order-status').text()
137 }; 146 };
138 147
139 - var show = option && !option.noLoadingMask;  
140 -  
141 - if (this.inAjax) {  
142 - return;  
143 - }  
144 -  
145 - this.inAjax = true;  
146 - show && loading.showLoadingMask();  
147 -  
148 - $.ajax({  
149 - type: 'GET',  
150 - url: '/service/getOrders',  
151 - data: opt,  
152 - success: function(data) {  
153 - var num;  
154 -  
155 - if (data) {  
156 - self.order.page = opt.page;  
157 -  
158 - if (opt.page === 1) {  
159 - self.$curContainer.html(data);  
160 - lazyLoad(self.$curContainer.find('.lazy'), {  
161 - try_again_css: 'order-failure'  
162 - });  
163 - } else {  
164 - num = self.$curContainer.children('.order').length;  
165 - self.$curContainer.append(data);  
166 -  
167 - // lazyload  
168 - lazyLoad(self.$curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {  
169 - try_again_css: 'order-failure'  
170 - });  
171 - }  
172 -  
173 - window.rePosFooter(); // 重新计算底部位置  
174 - } else {  
175 - if (opt.page > 1) {  
176 - return;  
177 - }  
178 - self.$curContainer.html('<div class="no-order"><div class="icon"></div><span>你还没有订单!</span><a class="walk-way" href="//m.yohobuy.com/product/new">随便逛逛</a></div>');  
179 - self.order.end = true;  
180 - } 148 + // 通知chat,订单列表已选择订单
  149 + this.trigger('selectOrder.OrderListView', [data]);
  150 +
  151 + // 关闭
  152 + this.toggleHide(true);
  153 + },
181 154
182 - this.inAjax = false;  
183 - show && loading.hideLoadingMask();  
184 - } 155 + /**
  156 + * method: show/hide 订单列表
  157 + * @param boolean willHide;
  158 + * @return this
  159 + */
  160 + toggleHide: function(willHide) {
  161 + this.$elem.toggleClass('chat-page-hide', willHide);
  162 +
  163 + return this;
  164 + },
  165 +
  166 +
  167 + /**
  168 + * method: 获取订单
  169 + */
  170 + fetchOrders: function() {
  171 + const self = this;
  172 +
  173 + return api.fetchOrders().done(result => {
  174 + let html = self.orderListT({orders: result.data});
  175 +
  176 + self.$localOrders.append(html);
185 }); 177 });
186 } 178 }
187 -} 179 +});
  180 +
  181 +OrderListView.prototype.constructer = OrderListView;
188 182
189 -export {RatingView, LeaveMSGView, OrderListView}; 183 +export {RatingView, LeaveMSGView, OrderListView};
@@ -91,6 +91,18 @@ @@ -91,6 +91,18 @@
91 z-index: 100; 91 z-index: 100;
92 background-color: #f0f0f0; 92 background-color: #f0f0f0;
93 transition: .3s; 93 transition: .3s;
  94 +
  95 + .main {
  96 + position: absolute;
  97 + width: 100%;
  98 + top: 105px;
  99 + bottom: 0;
  100 + overflow: auto;
  101 + }
  102 +
  103 + .main::-webkit-scrollbar {
  104 + width: 0;
  105 + }
94 } 106 }
95 107
96 .chat-page-hide { 108 .chat-page-hide {
@@ -10,11 +10,11 @@ @@ -10,11 +10,11 @@
10 } 10 }
11 11
12 .send-order-btn { 12 .send-order-btn {
13 - display: inline-block;  
14 float: right; 13 float: right;
15 height: 60px; 14 height: 60px;
16 width: 145px; 15 width: 145px;
17 line-height: 60px; 16 line-height: 60px;
  17 + padding: 0;
18 text-align: center; 18 text-align: center;
19 font-size: 28px; 19 font-size: 28px;
20 color: #fff; 20 color: #fff;
@@ -57,6 +57,9 @@ module.exports = { @@ -57,6 +57,9 @@ module.exports = {
57 query: { 57 query: {
58 helperDirs: [ 58 helperDirs: [
59 path.join(__dirname, '/js/common/helpers') 59 path.join(__dirname, '/js/common/helpers')
  60 + ],
  61 + partialDirs: [
  62 + path.join(__dirname, '../doraemon/views/partial')
60 ] 63 ]
61 } 64 }
62 }] 65 }]