|
@@ -34,6 +34,34 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
|
|
|
$(a).text(c)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+// 刷新样式
|
|
|
+function time(view){
|
|
|
+ year=$('.year-span').text();
|
|
|
+ month=$('.month-span').text();
|
|
|
+ var startTime = year+'-'+month+'-01';
|
|
|
+ var endTime = year+'-'+month+'-30';
|
|
|
+ api.getUserTotalOrder({
|
|
|
+ user_id: user.id,
|
|
|
+ start_time: startTime,
|
|
|
+ end_time: endTime,
|
|
|
+ }, function (res) {
|
|
|
+ if (res.success) {
|
|
|
+ $('.total').text(res.message.total);
|
|
|
+ var tpl = template('myOrder/list', {
|
|
|
+ orders: res.message.result
|
|
|
+ });
|
|
|
+ $('.list-content', view).html(tpl);
|
|
|
+ setTimeout(function () {
|
|
|
+ pageData.scroll = new IScroll('#orderContainer');
|
|
|
+ }, 100);
|
|
|
+ } else {
|
|
|
+ $doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
+ message: '暂无订单数据!'
|
|
|
+ }])
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
var cachePageData = {}; //page内部的数据传递
|
|
|
|
|
|
return {
|
|
@@ -55,7 +83,8 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
|
|
|
});
|
|
|
|
|
|
//tab切换
|
|
|
- $.newTouch('.control-item', function (event) {
|
|
|
+ $.newTouch('.order-type-control .control-item', function (event) {
|
|
|
+ event.preventDefault();
|
|
|
var type = $(this).data('order-type');
|
|
|
$('.type-container', $view).hide();
|
|
|
switch (type) {
|
|
@@ -67,12 +96,7 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
|
|
|
break;
|
|
|
case 2:
|
|
|
$('#reviewContainer').show();
|
|
|
- year=$('.year-span').text();
|
|
|
- month=$('.month-span').text();
|
|
|
- console.log(month);
|
|
|
- setTimeout(function () {
|
|
|
- pageData.scroll = new IScroll('#orderContainer');
|
|
|
- }, 100);
|
|
|
+ time($view);
|
|
|
break;
|
|
|
}
|
|
|
}, $view);
|
|
@@ -96,11 +120,11 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
|
|
|
},$view);
|
|
|
$.newTouch('.btn-year-sub',function(event){
|
|
|
event.preventDefault();
|
|
|
- payCharge($('.modal-box-year'),false,'month');
|
|
|
+ payCharge($('.modal-box-year'),false,'year');
|
|
|
},$view);
|
|
|
$.newTouch('.btn-month-add',function(event){
|
|
|
event.preventDefault();
|
|
|
- payCharge($('.modal-box-month'),true,'year');
|
|
|
+ payCharge($('.modal-box-month'),true,'month');
|
|
|
},$view);
|
|
|
$.newTouch('.btn-month-sub',function(event){
|
|
|
event.preventDefault();
|
|
@@ -118,6 +142,7 @@ define(['$', 'template', 'IScroll', 'user', 'product', 'native', 'config', 'addr
|
|
|
$('.modal-box').css('display','none')
|
|
|
$('.year-span').text($('.modal-box-year').text());
|
|
|
$('.month-span').text($('.modal-box-month').text());
|
|
|
+ time($view);
|
|
|
},$view);
|
|
|
|
|
|
|