Authored by 陈轩

Merge branch 'feature/service' of http://git.yoho.cn/fe/yohobuywap-node into feature/service

... ... @@ -62,7 +62,8 @@ exports.fetchImHistory = (uid, pageSize, startTime, endTime) => {
exports.fetchOrderList = (uid, createTimeBegin) => {
let params = {
uid,
encryptedUid: encryptedUid(uid)
encryptedUid: encryptedUid(uid),
imgSize: '90x120',
};
_.forEach({createTimeBegin}, (key, val) => {
... ...
... ... @@ -13,8 +13,8 @@
{{!--inline partails--}}
{{#*inline 'order'}}
<div class="chat-order">
<img src="{{thumb}}">
<div>
<img src="{{imgSrc}}">
<div class="order-info">
<span class="label">订单号: </span><span>{{orderCode}}</span><br>
<span class="label">金额: </span><span class="red">{{cost}}</span><br>
<span class="label">下单时间: </span><span>{{createTime}}</span><br>
... ...
... ... @@ -7,15 +7,51 @@
</header>
<section class="order-goods">
{{# goods}}
{{> order/good}}
<div class="order-good" data-id="{{id}}">
<div class="thumb-wrap">
{{#if link}}
<a href="{{link}}"><img class="thumb lazy" src="{{image thumb 90 120}}"></a>
{{else}}
<img class="thumb lazy" src="{{image thumb 90 120}}">
{{/if}}
<p class="tag{{#if gift}} gift-tag{{/if}}{{#if advanceBuy}} advance-buy-tag{{/if}}"></p>
</div>
<div class="deps">
<p class="name row">{{name}}</p>
<p class="row">
{{#if color}}
<span class="color">
{{#if tickets}}日期{{else}}颜色{{/if}}:{{color}}
</span>
{{/if}}
{{#if size}}
<span class="size">
{{#if tickets}}区域{{else}}尺码{{/if}}:{{size}}
</span>
{{/if}}
</p>
<p class="row price-wrap">
<span class="price">
¥{{price}}
</span>
<span class="count">
×{{count}}
</span>
{{#if appearDate}}
<span class="appear-date">上市期:{{appearDate}}</span>
{{/if}}
</p>
</div>
</div>
{{/ goods}}
</section>
<footer class="footer">
{{count}}件商品 实付<span class="sum-cost">¥{{sumCost}}</span>
{{count}}件商品 实付<span class="sum-cost">¥{{lastOrderAmount}}</span>
{{#shippingCost}}(含运费¥{{.}}){{/shippingCost}}
</footer>
<div class="send-order clearfix">
<button class="send-order-btn">发送订单</button>
<button class="send-order-btn" data-action="select">发送订单</button>
</div>
</div>
<input class="js-create-time" type="hidden" name="human-time" value="{{time}}">
... ...
... ... @@ -6,7 +6,7 @@
'use strict';
import {
time
time
} from './time';
import {
tip
... ... @@ -17,12 +17,10 @@ import {
OrderListView
} from './view';
require('../../home/jquery.upload');
var saveImage = require('../../home/save-image');
var socket = require('./socket-chat'),
socketConf = require('./socket-config'),
cmEntity = socketConf.conversationMessage;
cmEntity = socketConf.conversationMessage,
lastTimeShow = 0;
const chatBox = $('#chat-window'),
encryptedUid = $('#encrypteduid').val();
... ... @@ -57,6 +55,8 @@ var chat = {
state: {
lastMSGTime: ''
},
$ratingView: $('#chat-comment'),
messageT: require('service/chat/msg.hbs'),
... ... @@ -149,12 +149,23 @@ var chat = {
.on('selectOrder.OrderListView', function(event, data) {
let msg = {
type: 'order',
data
data,
style: 'send-msg',
};
self.sendMSG(msg);
});
this.$ratingView.on('click', '.submit', function() {
self.ratingView.post({
encryptedUid,
conversationId: cmEntity.conversationId,
});
}).on('rating-success', function(e, data) {
append(tip(`您对我们的服务评价为:${data}`).onLine());
resizeFooter();
});
window.addEventListener('online', function() {
self._networkSick(false);
});
... ... @@ -455,39 +466,11 @@ var chat = {
chat.init();
// 触发菜单
$('.menu-trigger').on('touchend', function() {
$('.menu-trigger').on('click', function() {
let $menu = $('.menu');
if ($menu.css('display') === 'none') {
$menu.show();
resizeFooter();
} else {
$menu.hide();
resizeFooter();
}
$('.upload-img').upload({
auto: true,
fileType: 'image/*',
uploadScript: '/api/upload/image',
fileObjName: 'filename',
fileSizeLimit: 5000000,
height: '100%',
width: '100%',
multi: false,
formData: {
bucket: 'suggest'
},
onUploadComplete: function(file, data) {
let url;
data = saveImage.saveImage(data);
url = data.imgList[0].imgRelUrl + '?imageView2/2/w/640/q/90';
url = 'http://img11.static.yhbimg.com/suggest' + url;
sendMsg(2, url);
}
});
$('.uploadifive-button').css('position', 'absolute');
$menu.toggle();
resizeFooter();
});
... ...
... ... @@ -93,17 +93,20 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
const curVal = this.rank = $rank.index();
this.rankText = rankMap[curVal];
this.$label.text(rankMap[curVal]);
this.$ranks.removeClass('rated');
this.$ranks.toggleClass(index => {
return index <= curVal ? 'rated' : null;
});
},
post(data) {
const elem = this.elem;
const self = this,
elem = this.elem;
var params = {
stars: this.rank,
stars: ++this.rank,
promoter: 1,
reasonMsg: elem.find('.words-to-say').val(),
};
... ... @@ -115,7 +118,8 @@ RatingView.prototype = $.extend({}, EventEmitter.prototype, {
data: params,
success: function(res) {
if (res && res.code === 200) {
elem.hide();
elem.trigger('rating-success', [self.rankText]);
}
},
error: function() {
... ... @@ -151,7 +155,7 @@ OrderListView.prototype = $.extend({}, EventEmitter.prototype, {
self.toggleHide(true);
})
.on('click.OrderListView.select', '[data-action=select]', function() {
self.selectOrder($(event.target));
});
// 被通知显示,执行显示
... ... @@ -161,13 +165,13 @@ OrderListView.prototype = $.extend({}, EventEmitter.prototype, {
/**
* method: 选择订单,然后关闭
*/
selectOrder: function() {
let $order = $(event.target).closest('.order-page');
selectOrder: function($btn) {
let $order = $btn.closest('.order-page');
// 订单数据
let data = {
imgSrc: $order.find('.thumb').attr('src'),
orderCode: $order.find('[data-id]'),
orderCode: $order.find('[data-id]').attr('data-id'),
cost: $order.find('.sum-cost').text(),
createTime: $order.find('.js-create-time').val(),
orderStatus: $order.find('.order-status').text()
... ... @@ -202,6 +206,7 @@ OrderListView.prototype = $.extend({}, EventEmitter.prototype, {
let html = self.orderListT({orders: result.data});
self.$localOrders.append(html);
lazyLoad($('img.lazy'));
});
}
});
... ...
... ... @@ -131,6 +131,54 @@
}
}
.chat-order {
padding: 25px 35px;
background: #fff;
margin: 0 12px 0 0;
overflow: hidden;
&:after {
content: "";
position: absolute;
display: inline-block;
width: 0;
height: 0;
font-size: 0;
border: 10px solid;
border-radius: 2px;
top: 0;
right: 0;
border-color: #fff transparent transparent #fff;
}
img {
height: 173px;
width: 128px;
float: left;
margin-right: 10px;
}
.order-info {
overflow: hidden;
line-height: 1.7;
}
span {
float: left;
padding: 0;
font-size: 28px;
line-height: 1;
}
.red {
color: #d0021b;
}
.label {
color: #b0b0b0;
}
}
/* 网络连接失败 */
.connection-failed {
position: absolute;
... ...