Authored by uedxwg

'解决冲突'

Showing 31 changed files with 758 additions and 150 deletions
@@ -1261,7 +1261,7 @@ @@ -1261,7 +1261,7 @@
1261 chosed: true, 1261 chosed: true,
1262 name: '黄色', 1262 name: '黄色',
1263 colorNum:10, 1263 colorNum:10,
1264 - shortUrl:'', 1264 + sizeNumStr:'10/20/30' //对应的商品尺码数目,用斜杠分割
1265 1265
1266 }, 1266 },
1267 ... 1267 ...
@@ -1271,7 +1271,8 @@ @@ -1271,7 +1271,8 @@
1271 id: 2, 1271 id: 2,
1272 chosed: true, 1272 chosed: true,
1273 name: 'X', 1273 name: 'X',
1274 - sizeNum: 2 1274 + sizeNum: 2,
  1275 + colorNumStr:'10/20/30' //对应的商品颜色数目用斜杠分割
1275 }, 1276 },
1276 ... 1277 ...
1277 ], 1278 ],
@@ -303,14 +303,15 @@ class CartData @@ -303,14 +303,15 @@ class CartData
303 * @param int $paymentId 支付方式ID 303 * @param int $paymentId 支付方式ID
304 * @param int $paymentType 支付类型ID 304 * @param int $paymentType 支付类型ID
305 * @param string $remark 留言 305 * @param string $remark 留言
  306 + * @param string $couponCode 优惠券码
306 * @param mixed $yohoCoin 使用的YOHO币数量或为空 307 * @param mixed $yohoCoin 使用的YOHO币数量或为空
307 * @return array 接口返回的数据 308 * @return array 接口返回的数据
308 */ 309 */
309 - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin) 310 + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
310 { 311 {
311 $param = Yohobuy::param(); 312 $param = Yohobuy::param();
312 $param['method'] = 'app.Shopping.submit'; 313 $param['method'] = 'app.Shopping.submit';
313 - $param['addressId'] = $addressId; 314 + $param['address_id'] = $addressId;
314 $param['cart_type'] = $cartType; 315 $param['cart_type'] = $cartType;
315 $param['delivery_time'] = $deliveryTime; 316 $param['delivery_time'] = $deliveryTime;
316 $param['delivery_way'] = $deliveryWay; 317 $param['delivery_way'] = $deliveryWay;
@@ -324,6 +325,9 @@ class CartData @@ -324,6 +325,9 @@ class CartData
324 $param['payment_id'] = $paymentId; 325 $param['payment_id'] = $paymentId;
325 $param['payment_type'] = $paymentType; 326 $param['payment_type'] = $paymentType;
326 $param['remark'] = $remark; 327 $param['remark'] = $remark;
  328 + if (!empty($couponCode)) {
  329 + $param['coupon_code'] = $couponCode;
  330 + }
327 if (!empty($yohoCoin)) { 331 if (!empty($yohoCoin)) {
328 $param['use_yoho_coin'] = $yohoCoin; 332 $param['use_yoho_coin'] = $yohoCoin;
329 } 333 }
@@ -212,9 +212,10 @@ class UserData @@ -212,9 +212,10 @@ class UserData
212 * @param int $uid 用户ID 212 * @param int $uid 用户ID
213 * @param int $page 第几页,默认1 213 * @param int $page 第几页,默认1
214 * @param int $limit 限制读取的数目,默认10 214 * @param int $limit 限制读取的数目,默认10
  215 + * @param string $type 请求类型 get,post
215 * @return array YOHO币接口返回的数据 216 * @return array YOHO币接口返回的数据
216 */ 217 */
217 - public static function yohoCoinData($uid, $page = 1, $limit = 10) 218 + public static function yohoCoinData($uid, $page = 1, $limit = 10,$type = 'get')
218 { 219 {
219 $param = Yohobuy::param(); 220 $param = Yohobuy::param();
220 $param['method'] = 'app.yohocoin.lists'; 221 $param['method'] = 'app.yohocoin.lists';
@@ -223,7 +224,7 @@ class UserData @@ -223,7 +224,7 @@ class UserData
223 $param['limit'] = $limit; 224 $param['limit'] = $limit;
224 $param['client_secret'] = Sign::getSign($param); 225 $param['client_secret'] = Sign::getSign($param);
225 226
226 - return Yohobuy::get(Yohobuy::API_URL, $param); 227 + return Yohobuy::$type(Yohobuy::API_URL, $param);
227 } 228 }
228 229
229 /** 230 /**
@@ -556,6 +556,86 @@ class Helpers @@ -556,6 +556,86 @@ class Helpers
556 } 556 }
557 557
558 /** 558 /**
  559 + * 格式化购物车商品
  560 + *
  561 + * @param array $cartGoods 购物车商品列表
  562 + * @param bool $haveLink 控制是否需要商品链接
  563 + */
  564 + public static function formatCartGoods($cartGoods, $haveLink = false)
  565 + {
  566 + $arr = array();
  567 +
  568 + $oneGoods = array();
  569 + foreach ($cartGoods as $key => $value) {
  570 + $oneGoods['id'] = $value['product_sku'];
  571 + $oneGoods['skn'] = $value['product_skn'];
  572 + $oneGoods['name'] = $value['product_name'];
  573 + $oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : '';
  574 + $oneGoods['color'] = $value['color_name'];
  575 + $oneGoods['size'] = $value['size_name'];
  576 + $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
  577 + $oneGoods['price'] = $value['real_price'];
  578 + $oneGoods['count'] = $value['buy_number'];
  579 + $oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']);
  580 + //gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
  581 + if (!isset($value['goods_type'])) {
  582 + $oneGoods['soldOut'] = true;
  583 + } elseif ($value['goods_type'] == 'gift') {
  584 + $oneGoods['gift'] = true;
  585 + } elseif ($value['goods_type'] == 'price_gift') {
  586 + $oneGoods['advanceBuy'] = true;
  587 + }
  588 + // 上市期
  589 + if (!empty($value['expect_arrival_time'])) {
  590 + $oneGoods['appearDate'] = $value['expect_arrival_time'];
  591 + }
  592 + // 商品链接
  593 + if ($haveLink && isset($value['product_id'])) {
  594 + $oneGoods['link'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
  595 + }
  596 +
  597 + $arr[$key] = $oneGoods;
  598 + }
  599 +
  600 + return $arr;
  601 + }
  602 +
  603 + /**
  604 + * 格式化加价购商品
  605 + *
  606 + * @param array $advanceGoods 加价购商品列表
  607 + * @param bool $haveLink 控制是否需要商品链接
  608 + */
  609 + public static function formatAdvanceGoods($advanceGoods)
  610 + {
  611 + $arr = array();
  612 +
  613 +
  614 + $gift = array();
  615 + $oneGoods = array();
  616 + foreach ($advanceGoods as $value) {
  617 + $gift = array();
  618 + $gift['promotionTitle'] = $value['promotion_title'];
  619 +
  620 + foreach ($value['goods_list'] as $single) {
  621 + $oneGoods['id'] = $single['product_skn'];
  622 + $oneGoods['name'] = $single['product_name'];
  623 + $oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : '';
  624 + $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
  625 + $oneGoods['price'] = $single['last_price'];
  626 + $oneGoods['marketPrice'] = $single['market_price'];
  627 + $oneGoods['count'] = $single['storage_number'];
  628 +
  629 + $gift['goods'][] = $oneGoods;
  630 + }
  631 +
  632 + $arr[] = $gift;
  633 + }
  634 +
  635 + return $arr;
  636 + }
  637 +
  638 + /**
559 * 订单状态,按订单支付类型和订单状态 639 * 订单状态,按订单支付类型和订单状态
560 * @var array 640 * @var array
561 */ 641 */
  1 +var $ = require('jquery');
  2 +var page = 1;
  3 +
  4 +function ajaxCurrencyDetail(page) {
  5 + $.ajax({
  6 + type: 'POST',
  7 + url: '/home/ajaxCurrencyDetail',
  8 + dataType: 'html',
  9 + data: {
  10 + page: page
  11 + },
  12 + success: function(data) {
  13 + $('.coin-detail').append(data);
  14 + window.rePosFooter();
  15 + }
  16 + });
  17 +}
  18 +
  19 +$(window).scroll(function() {
  20 + if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) {
  21 + page++;
  22 + ajaxCurrencyDetail(page);
  23 + return;
  24 + }
  25 +});
  26 +
  27 +ajaxCurrencyDetail(page);
@@ -18,3 +18,4 @@ require('./address-act'); @@ -18,3 +18,4 @@ require('./address-act');
18 require('./logistic'); 18 require('./logistic');
19 require('./pay'); 19 require('./pay');
20 require('./personal-details'); 20 require('./personal-details');
  21 +require('./currency');
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
  8 + lazyLoad = require('yoho.lazyload'),
8 Hammer = require('yoho.hammer'); 9 Hammer = require('yoho.hammer');
9 10
10 var $cartContent = $('.cart-content'); 11 var $cartContent = $('.cart-content');
@@ -13,6 +14,8 @@ var navHammer; @@ -13,6 +14,8 @@ var navHammer;
13 14
14 require('./good'); 15 require('./good');
15 16
  17 +lazyLoad($('img.lazy'));
  18 +
16 navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]); 19 navHammer = new Hammer(document.getElementsByClassName('cart-nav')[0]);
17 navHammer.on('tap', function(e) { 20 navHammer.on('tap', function(e) {
18 var $this = $(e.target).closest('li'); 21 var $this = $(e.target).closest('li');
@@ -58,21 +58,51 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { @@ -58,21 +58,51 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
58 }).on('touchstart', '#chose-btn-sure', function() { 58 }).on('touchstart', '#chose-btn-sure', function() {
59 59
60 //确定 60 //确定
61 -}).on('touchstart', '.block', function() { 61 +}).on('touchstart', '.block', function(e) {
62 62
63 //尺寸颜色点选 63 //尺寸颜色点选
64 - var $this = $(this);  
65 -  
66 - if ($this.hasClass('.chosed') || $this.hasClass('disable')) { 64 + var $this = $(this),
  65 + $that = $(e.target).closest('.chose-items'),
  66 + numArray,
  67 + index;
  68 +
  69 + if ($this.hasClass('chosed')) {
  70 + $this.parent().find('.block').removeClass('chosed');
  71 + $that.find('.num .left-num').html('');
  72 + } else if ($this.hasClass('disable')) {
  73 + $this.css('background-color', '#000');
67 return; 74 return;
  75 + } else if (!$this.hasClass('chosed')) {
  76 + $this.siblings('.chosed').removeClass('chosed');
  77 + $this.addClass('chosed');
  78 + index = $this.index();
  79 +
  80 +
  81 + //根据颜色切换图片
  82 + if ($this.closest('.block-list').hasClass('color-list')) {
  83 + $('.chose-panel .basic-info').find('.thumb').addClass('hide').eq(index).removeClass('hide');
  84 + }
  85 +
  86 + //剩余的商品数
  87 + if ($that.find('.color-list ul>li').hasClass('chosed') && $that.find('.size-list ul>li').hasClass('chosed')) {
  88 + numArray = $this.closest('.block-list').siblings(':first').find('.chosed').data('numstr').split('/');
  89 + $that.find('.num .left-num').html('剩余' + numArray[index] + '件');
  90 + } else {
  91 + $that.find('.num .left-num').html('');
  92 + }
  93 +
  94 + //点击切换
68 } 95 }
69 96
70 - $this.siblings('.chosed').removeClass('chosed');  
71 - $this.addClass('chosed');  
72 }).on('touchstart', '.btn-minus', function() { 97 }).on('touchstart', '.btn-minus', function() {
73 var num = +$num.val(); 98 var num = +$num.val();
74 99
75 - if (num === 1) { 100 + //若颜色和尺码没有被同时选中,则不能点击
  101 + if ($('.block-list>ul>li.chosed').length < 2) {
  102 + return;
  103 + }
  104 +
  105 + if (num === 0) {
76 return; 106 return;
77 } 107 }
78 108
@@ -80,6 +110,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) { @@ -80,6 +110,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
80 }).on('touchstart', '.btn-plus', function() { 110 }).on('touchstart', '.btn-plus', function() {
81 var num = +$num.val(); 111 var num = +$num.val();
82 112
  113 + //若颜色和尺码没有被同时选中,则不能点击
  114 + if ($('.block-list>ul>li.chosed').length < 2) {
  115 + return;
  116 + }
  117 +
83 //TODO:库存数验证 118 //TODO:库存数验证
84 $num.val(num + 1); 119 $num.val(num + 1);
85 }); 120 });
@@ -8,78 +8,152 @@ var $ = require('jquery'), @@ -8,78 +8,152 @@ var $ = require('jquery'),
8 ellipsis = require('mlellipsis'), 8 ellipsis = require('mlellipsis'),
9 lazyLoad = require('yoho.lazyload'); 9 lazyLoad = require('yoho.lazyload');
10 10
11 -var chosePanel = require('./chose-panel'); 11 +var dialog = require('../me/dialog'),
  12 + tip = require('../plugin/tip');
12 13
13 -var $curDelPanel; 14 +var $names;
14 15
15 -//删除面板显示后任何点击行为都将触发隐藏面板  
16 -function docTouchEvt() {  
17 - $curDelPanel && $curDelPanel.addClass('hide'); 16 +//chosePanel = require('./chose-panel');
18 17
19 - //  
20 - $(document).off('touchstart', docTouchEvt);  
21 -} 18 +var cartType = 'ordinary';
  19 +
  20 +//var $curDelPanel;
  21 +
  22 +////删除面板显示后任何点击行为都将触发隐藏面板
  23 +//function docTouchEvt() {
  24 +// $curDelPanel && $curDelPanel.addClass('hide');
  25 +//
  26 +// //
  27 +// $(document).off('touchstart', docTouchEvt);
  28 +//}
22 29
23 ellipsis.init(); 30 ellipsis.init();
24 31
25 -lazyLoad($('.lazy')); 32 +lazyLoad({
  33 + try_again_css: 'order-failure'
  34 +});
  35 +
26 36
27 -// $('.name')[0].mlellipsis(2); 37 +$names = $('.name');
  38 +if ($names.length > 0) {
  39 + $names[0].mlellipsis(2);
  40 +}
28 41
29 //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods 42 //TIP:事件委托在.cart-goods,商品列表的容器统一需要有.cart-goods
30 $('.cart-goods').on('touchstart', '.checkbox', function() { 43 $('.cart-goods').on('touchstart', '.checkbox', function() {
31 - var $this = $(this);  
32 -  
33 - if ($this.hasClass('icon-cb-checked')) {  
34 - $this.removeClass('icon-cb-checked').addClass('icon-checkbox');  
35 - } else {  
36 - $this.removeClass('icon-checkbox').addClass('icon-cb-checked');  
37 - }  
38 -}).on('touchstart', '.icon-edit', function() {  
39 - var id = $(this).closest('.shopping-cart-good').data('id'); 44 + var $this = $(this),
  45 + id = $(this).closest('.shopping-cart-good').data('id');
40 46
41 $.ajax({ 47 $.ajax({
42 type: 'GET', 48 type: 'GET',
43 - url: '/shoppingCart/goodinfo', 49 + url: '/shoppingCart/select',
44 data: { 50 data: {
45 id: id 51 id: id
46 - },  
47 - success: function(data) {  
48 - if (data.code === 200) {  
49 - chosePanel.show(data.data); 52 + }
  53 + }).then(function(data) {
  54 + if (data.code === 200) {
  55 + if ($this.hasClass('icon-cb-checked')) {
  56 + $this.removeClass('icon-cb-checked').addClass('icon-checkbox');
  57 + } else {
  58 + $this.removeClass('icon-checkbox').addClass('icon-cb-checked');
50 } 59 }
51 } 60 }
  61 + $.ajax({
  62 + type: 'GET',
  63 + url: '/shoppingCart/getCartData',
  64 + data: {
  65 + id: id
  66 + },
  67 + success: function(data) {
  68 + if (data) {
  69 + $('#good-totalprice').html('¥' + data.commonCart.price);
  70 + $('#good-activityPrice').html('¥' + data.commonCart.activityPrice);
  71 + $('#good-total').html(data.commonCart.count + '件总计:¥' + data.commonCart.sumPrice);
  72 + }
  73 + },
  74 + error: function() {
  75 + tip.show('网络错误');
  76 + }
  77 + });
  78 +
  79 + }).fail(function() {
  80 + tip.show('网络错误');
52 }); 81 });
  82 +}).on('touchstart', '.icon-edit', function() {
  83 +
53 }).on('touchstart', '.icon-del', function(e) { 84 }).on('touchstart', '.icon-del', function(e) {
  85 + var $this = $(this);
  86 +
54 e.stopPropagation(); 87 e.stopPropagation();
55 88
56 //手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板 89 //手动触发docTouchEvt清除因点击到del按钮上而被阻止冒泡到doc上的事件从而清除已打开的删除面板
57 - docTouchEvt();  
58 -  
59 - $curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');  
60 -  
61 - $(document).on('touchstart', docTouchEvt);  
62 -}).on('touchstart', '.opt-panel', function() {  
63 - var $this = $(this),  
64 - id = $this.closest('.shopping-cart-good').data('id'),  
65 - url;  
66 -  
67 - if ($this.closest('.put-in-favorite').length > 0) {  
68 -  
69 - //移入收藏夹  
70 - url = '/shoppingCart/col';  
71 - } else {  
72 -  
73 - //删除  
74 - url = '/shoppingCart/del';  
75 - } 90 + //docTouchEvt();
  91 + //
  92 + //$curDelPanel = $(this).closest('.shopping-cart-good').children('.opt-panel').removeClass('hide');
  93 + //
  94 + //$(document).on('touchstart', docTouchEvt);
76 95
77 - $.ajax({  
78 - type: 'POST',  
79 - url: url,  
80 - data: {  
81 - id: id 96 + dialog.showDialog({
  97 + dialogText: '您确定要从购物车中删除吗?',
  98 + hasFooter: {
  99 + leftBtnText: '取消',
  100 + rightBtnText: '确定'
82 } 101 }
  102 + }, function() {
  103 + var id = $this.closest('.shopping-cart-good').data('id');
  104 +
  105 + $.ajax({
  106 + method: 'post',
  107 + url: '/shoppingCart/del',
  108 + data: {
  109 + id: id
  110 + }
  111 + }).then(function(data) {
  112 + if (data.code === 200) {
  113 + dialog.showDialog({
  114 + dialogText: '删除成功',
  115 + autoHide: true,
  116 + fast: true
  117 + });
  118 + history.go(0);
  119 + }
  120 + }).fail(function() {
  121 + dialog.showDialog({
  122 + autoHide: true,
  123 + dialogText: '网络错误~'
  124 + });
  125 + });
83 }); 126 });
  127 +
  128 +});
  129 +
  130 +// .on('touchstart', '.opt-panel', function() {
  131 +// var $this = $(this),
  132 +// id = $this.closest('.shopping-cart-good').data('id'),
  133 +// url;
  134 +//
  135 +// if ($this.closest('.put-in-favorite').length > 0) {
  136 +//
  137 +// //移入收藏夹
  138 +// url = '/shoppingCart/col';
  139 +// } else {
  140 +//
  141 +// //删除
  142 +// url = '/shoppingCart/del';
  143 +// }
  144 +//
  145 +// $.ajax({
  146 +// type: 'POST',
  147 +// url: url,
  148 +// data: {
  149 +// id: id
  150 +// }
  151 +// });
  152 +//})
  153 +
  154 +
  155 +$('.btn-balance').on('touchend', function() {
  156 + window.location.href = '/shoppingCart/orderEnsure?cartType=' + cartType;
84 }); 157 });
85 158
  159 +
@@ -7,11 +7,15 @@ @@ -7,11 +7,15 @@
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 lazyLoad = require('yoho.lazyload'), 8 lazyLoad = require('yoho.lazyload'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
  10 + Handlebars = require('yoho.handlebars'),
  11 + tip = require('../plugin/tip'),
10 orderInfo = require('./order-info').orderInfo; 12 orderInfo = require('./order-info').orderInfo;
11 13
12 var dispatchModeHammer, 14 var dispatchModeHammer,
13 dispatchTimeHammer, 15 dispatchTimeHammer,
14 - $invoice = $('.invoice'); 16 + $invoice = $('.invoice'),
  17 + $price = $('.price-cal'),
  18 + priceTmpl = Handlebars.compile($('#tmpl-price').html());
15 19
16 lazyLoad(); 20 lazyLoad();
17 21
@@ -55,9 +59,66 @@ $('.invoice').on('touchend', '.checkbox', function() { @@ -55,9 +59,66 @@ $('.invoice').on('touchend', '.checkbox', function() {
55 } 59 }
56 }); 60 });
57 61
  62 +function orderCompute() {
  63 + $.ajax({
  64 + method: 'POST',
  65 + url: '/shoppingCart/orderCompute',
  66 + data: {
  67 + cartType: orderInfo('cartType'),
  68 + deliveryId: orderInfo('deliveryId'),
  69 + paymentTypeId: orderInfo('paymentTypeId'),
  70 + couponCode: orderInfo('couponCode'),
  71 + yohoCoin: orderInfo('yohoCoin')
  72 + }
  73 + }).then(function(res) {
  74 + var priceHtml;
  75 +
  76 + if (!res) {
  77 + tip.show('网络出错');
  78 + } else {
  79 + priceHtml = priceTmpl({
  80 + sumPrice: res.order_amount,
  81 + salePrice: res.discount_amount,
  82 + freight: res.promotion_formula_list[1].promotion_amount,
  83 + yohoCoin: res.use_yoho_coin,
  84 + price: res.last_order_amount
  85 + });
  86 +
  87 + $price.html(priceHtml);
  88 + }
  89 + }).fail(function() {
  90 + tip.show('网络出错');
  91 + });
  92 +}
  93 +
  94 +function submitOrder() {
  95 + $.ajax({
  96 + method: 'POST',
  97 + url: '/shoppingCart/orderSub',
  98 + data: {
  99 + addressId: orderInfo('addressId'),
  100 + cartType: orderInfo('cartType'),
  101 + deliveryId: orderInfo('deliveryId'),
  102 + deliveryTimeId: orderInfo('deliveryTimeId'),
  103 + invoiceText: orderInfo('invoiceText'),
  104 + invoiceType: orderInfo('invoiceType'),
  105 + msg: orderInfo('msg'),
  106 + paymentTypeId: orderInfo('paymentTypeId'),
  107 + paymentType: orderInfo('paymentType'), //支付方式
  108 + couponCode: orderInfo('couponCode'),
  109 + yohoCoin: orderInfo('yohoCoin')
  110 + }
  111 + }).then(function(res) {
  112 + console.log(res);
  113 + }).fail(function() {
  114 + tip.show('网络出错');
  115 + });
  116 +}
  117 +
58 // 界面点击,状态存 cookie 118 // 界面点击,状态存 cookie
59 $('.dispatch-mode').on('touchend', 'li', function() { 119 $('.dispatch-mode').on('touchend', 'li', function() {
60 orderInfo('deliveryId', $(this).data('id')); 120 orderInfo('deliveryId', $(this).data('id'));
  121 + orderCompute();
61 }); 122 });
62 123
63 $('.dispatch-time').on('touchend', 'li', function() { 124 $('.dispatch-time').on('touchend', 'li', function() {
@@ -69,9 +130,12 @@ $('.coin').on('touchend', function() { @@ -69,9 +130,12 @@ $('.coin').on('touchend', function() {
69 130
70 if ($this.find('.checkbox').hasClass('icon-cb-checked')) { 131 if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
71 orderInfo('yohoCoin', $this.data('yoho-coin')); 132 orderInfo('yohoCoin', $this.data('yoho-coin'));
  133 + $this.find('.coin-check em').show();
72 } else { 134 } else {
73 orderInfo('yohoCoin', 0); 135 orderInfo('yohoCoin', 0);
  136 + $this.find('.coin-check em').hide();
74 } 137 }
  138 + orderCompute();
75 }); 139 });
76 140
77 $invoice.on('touchend', function() { 141 $invoice.on('touchend', function() {
@@ -92,4 +156,6 @@ $('#msg').find('input').on('blur', function() { @@ -92,4 +156,6 @@ $('#msg').find('input').on('blur', function() {
92 156
93 $('.pay-mode').on('click', 'li', function() { 157 $('.pay-mode').on('click', 'li', function() {
94 orderInfo('paymentTypeId', $(this).data('pay-id')); 158 orderInfo('paymentTypeId', $(this).data('pay-id'));
  159 + orderInfo('paymentType', $(this).data('pay-type'));
  160 + submitOrder();
95 }); 161 });
@@ -9,7 +9,19 @@ var info = window.cookie('order-info'); @@ -9,7 +9,19 @@ var info = window.cookie('order-info');
9 try { 9 try {
10 info = JSON.parse(info); 10 info = JSON.parse(info);
11 } catch (e) { 11 } catch (e) {
12 - info = {}; 12 + info = {
  13 + deliveryId: null,
  14 + deliveryTimeId: null,
  15 + paymentTypeId: null,
  16 + yohoCoin: null,
  17 + addressId: null,
  18 + couponCode: null,
  19 + couponValue: null,
  20 + invoice: null,
  21 + invoiceText: null,
  22 + invoiceType: null,
  23 + msg: null
  24 + };
13 } 25 }
14 26
15 exports.orderInfo = function(key, value) { 27 exports.orderInfo = function(key, value) {
1 $vip: sprite-map("me/vip/*.png", $spacing: 10px); 1 $vip: sprite-map("me/vip/*.png", $spacing: 10px);
2 $fav: sprite-map("me/fav/*.png", $spacing: 5px); 2 $fav: sprite-map("me/fav/*.png", $spacing: 5px);
3 3
4 -@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record", "logistic", "pay";  
5 - 4 +@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang", "ihelp", "browse-record", "logistic", "pay","yoho-coin-new", "yoho-coin-detail";
  1 +.yoho-coin-detail-page {
  2 + background: #f0f0f0;
  3 + .money{
  4 + width: 100%;
  5 + height: pxToRem(70px);
  6 + background:#fff;
  7 + margin-bottom: pxToRem(20px);
  8 + line-height: pxToRem(70px);
  9 + font-size: pxToRem(30px);
  10 + text-indent: 1em;
  11 + span{
  12 + color: #f00;
  13 + font-weight: bold;
  14 + }
  15 + }
  16 + .coin-detail {
  17 + background: #fff;
  18 + border-top: 1px solid #e0e0e0;
  19 + border-bottom: 1px solid #e0e0e0;
  20 + }
  21 +
  22 + .detail-item {
  23 + position: relative;
  24 + margin-left: pxToRem(30px);
  25 + border-bottom: 1px solid #e0e0e0;
  26 + color: #444;
  27 + padding: pxToRem(15px) 0;
  28 +
  29 + .title {
  30 + width: pxToRem(480px);
  31 + font-size: pxToRem(28px);
  32 + line-height: pxToRem(40px);
  33 + font-weight: bold;
  34 + overflow: hidden;
  35 + text-overflow: ellipsis;
  36 + white-space: nowrap;
  37 + }
  38 +
  39 + .time {
  40 + font-size: pxToRem(20px);
  41 + line-height: pxToRem(30px);
  42 + color: #b0b0b0;
  43 + }
  44 +
  45 + .count {
  46 + position: absolute;
  47 + right: 0;
  48 + top: 0;
  49 + margin-right: pxToRem(30px);
  50 + font-size: pxToRem(28px);
  51 + font-weight: bold;
  52 + line-height: pxToRem(100px);
  53 + }
  54 + }
  55 +
  56 + li:last-child {
  57 + .detail-item {
  58 + border-bottom: none;
  59 + }
  60 + }
  61 +}
  1 +.yoho-coin-new-page {
  2 + padding-top: pxToRem(30px);
  3 + text-align: center;
  4 +
  5 + .coin-num {
  6 + color: #d0021b;
  7 + font-size: pxToRem(66px);
  8 + font-weight: bold;
  9 + line-height: pxToRem(106px);
  10 + letter-spacing: pxToRem(8px);
  11 + }
  12 +
  13 + .info {
  14 + color: #b0b0b0;
  15 + font-size: pxToRem(24px);
  16 + line-height: 1;
  17 +
  18 + .dollar {
  19 + display: inline-block;
  20 + margin-right: pxToRem(6px);
  21 + vertical-align: middle;
  22 + width: pxToRem(24px);
  23 + height: pxToRem(24px);
  24 + background: image-url("me/yoho-coin/dollar.png") center center;
  25 + background-size: 100%;
  26 + }
  27 + }
  28 +
  29 + .more {
  30 + display: inline-block;
  31 + margin: pxToRem(30px) 0;
  32 + color: #444;
  33 + font-size: pxToRem(24px);
  34 + line-height: pxToRem(36px);
  35 + width: pxToRem(152px);
  36 + height: pxToRem(36px);
  37 + text-align: center;
  38 + border: 1px solid #444;
  39 + border-radius: pxToRem(36px);
  40 + }
  41 +
  42 + .coin-tip {
  43 + margin-bottom: pxToRem(30px);
  44 + padding: pxToRem(20px) pxToRem(30px);
  45 + font-size: pxToRem(24px);
  46 + line-height: pxToRem(32px);
  47 + color: #dc6870;
  48 + border-top: 1px solid #e0e0e0;
  49 + border-bottom: 1px solid #e0e0e0;
  50 +
  51 + .icon {
  52 + display: inline-block;
  53 + width: pxToRem(32px);
  54 + height: pxToRem(32px);
  55 + font-weight: bold;
  56 + border: 2px solid #dc6870;
  57 + border-radius: 50%;
  58 + }
  59 + }
  60 +
  61 + .banner {
  62 + margin-bottom: pxToRem(30px);
  63 + }
  64 +}
@@ -79,6 +79,11 @@ @@ -79,6 +79,11 @@
79 left: 0; 79 left: 0;
80 top: 20rem / $pxConvertRem; 80 top: 20rem / $pxConvertRem;
81 } 81 }
  82 + >span.left-num{
  83 + position: absolute;
  84 + left: pxToRem(380px);
  85 + top: 20rem / $pxConvertRem;
  86 + }
82 } 87 }
83 88
84 .block { 89 .block {
@@ -99,6 +104,11 @@ @@ -99,6 +104,11 @@
99 background-position: bottom right; 104 background-position: bottom right;
100 color: #e10; 105 color: #e10;
101 } 106 }
  107 +
  108 + &.disable {
  109 + color: #e0e0e0;
  110 + border-color: #e0e0e0;
  111 + }
102 } 112 }
103 113
104 .num { 114 .num {
  1 +{{# currency}}
  2 + <li>
  3 + <div class="detail-item">
  4 + <p class="title">{{title}}</p>
  5 + <p class="time">{{time}}</p>
  6 + <div class="count">
  7 + {{count}}
  8 + </div>
  9 + </div>
  10 + </li>
  11 +{{/ currency}}
  1 +
  2 +{{> layout/header}}
  3 +<div class="yoho-coin-detail-page yoho-page">
  4 + <div class="money">你拥有的有货币:<span>{{ money}}</span></div>
  5 +
  6 + <ul class="coin-detail"></ul>
  7 +</div>
  8 +{{> layout/footer}}
  1 +{{> layout/header}}
  2 +<div class="yoho-coin-new-page yoho-page">
  3 + <div class="coin">
  4 + <p class="coin-num">
  5 + 7876
  6 + </p>
  7 + <p class="info">
  8 + <span class="dollar"></span>
  9 + YOHO
  10 + </p>
  11 + <a href="" class="more">查看明细</a>
  12 + <div class="coin-tip">
  13 + <span class="icon">!</span>
  14 + 您有300个YOHO币即将于20171231日过期,请尽快使用
  15 + </div>
  16 + </div>
  17 + <div class="banner">
  18 + <a href="">
  19 + {{!-- 演示图片 --}}
  20 + <img src="http://temp.im/640x200" alt="">
  21 + </a>
  22 + </div>
  23 +
  24 + {{> home/maybe_like}}
  25 +</div>
  26 +{{> layout/footer}}
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 优惠券 81 优惠券
82 <span class="iconfont num">{{coupon_num}} &#xe604;</span> 82 <span class="iconfont num">{{coupon_num}} &#xe604;</span>
83 </a> 83 </a>
84 - <a class="list-item" href="/home/currency"> 84 + <a class="list-item" href="/home/currencyDetail">
85 <span class="iconfont icon">&#xe635;</span> 85 <span class="iconfont icon">&#xe635;</span>
86 YOHO 86 YOHO
87 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span> 87 <span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 41
42 <section class="block"> 42 <section class="block">
43 <ul class="sale-invoice"> 43 <ul class="sale-invoice">
44 - {{# coupon}} 44 + {{#if coupon}}
45 <li class="coupon"> 45 <li class="coupon">
46 <a href="/shoppingCart/selectCoupon"> 46 <a href="/shoppingCart/selectCoupon">
47 <!-- <a href="{{url}}"> --> 47 <!-- <a href="{{url}}"> -->
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 {{/if}} 65 {{/if}}
66 </a> 66 </a>
67 </li> 67 </li>
68 - {{/ coupon}} 68 + {{/if}}
69 69
70 {{# yohoCoin}} 70 {{# yohoCoin}}
71 <li class="coin" data-yoho-coin="{{.}}"> 71 <li class="coin" data-yoho-coin="{{.}}">
@@ -79,16 +79,16 @@ @@ -79,16 +79,16 @@
79 {{/ yohoCoin}} 79 {{/ yohoCoin}}
80 80
81 {{#if invoice}} 81 {{#if invoice}}
82 - <li class="invoice"> 82 + <li class="invoice {{#if needInvoice}}focus{{/if}}">
83 <span class="title">发票</span> 83 <span class="title">发票</span>
84 - <span class="iconfont checkbox icon-checkbox"></span> 84 + <span class="iconfont checkbox {{#if needInvoice}}icon-cb-checked{{else}}icon-checkbox{{/if}}"></span>
85 <form id="invoice"> 85 <form id="invoice">
86 - <input type="text" name="invoice-title" value="" placeholder="发票抬头"> 86 + <input type="text" name="invoice-title" value="{{invoiceText}}" placeholder="发票抬头">
87 <label> 87 <label>
88 发票类型 88 发票类型
89 <select class="invoice-type" name="invoice-type"> 89 <select class="invoice-type" name="invoice-type">
90 {{# invoice}} 90 {{# invoice}}
91 - <option value="{{id}}">{{name}}</option> 91 + <option value="{{id}}" {{#if isSelected}}selected{{/if}}>{{name}}</option>
92 {{/ invoice}} 92 {{/ invoice}}
93 </select> 93 </select>
94 </label> 94 </label>
@@ -98,27 +98,27 @@ @@ -98,27 +98,27 @@
98 </ul> 98 </ul>
99 99
100 <form id="msg" action="" method="post"> 100 <form id="msg" action="" method="post">
101 - <input type="text" name="msg" value="" placeholder="留言"> 101 + <input type="text" name="msg" value="{{msg}}" placeholder="留言">
102 </form> 102 </form>
103 </section> 103 </section>
104 104
105 - <section class="block"> 105 + <section class="price-cal block">
106 <ul class="total"> 106 <ul class="total">
107 <li> 107 <li>
108 <span>总价</span> 108 <span>总价</span>
109 - &nbsp;&nbsp;¥ {{sumPrice}} 109 + &nbsp;&nbsp;¥{{sumPrice}}
110 </li> 110 </li>
111 <li> 111 <li>
112 <span>活动价</span> 112 <span>活动价</span>
113 - - ¥ {{salePrice}} 113 + - ¥{{salePrice}}
114 </li> 114 </li>
115 <li> 115 <li>
116 <span>运费</span> 116 <span>运费</span>
117 - + ¥ {{freight}} 117 + + ¥{{freight}}
118 </li> 118 </li>
119 <li> 119 <li>
120 <span>YOHO币</span> 120 <span>YOHO币</span>
121 - - ¥ {{yohoCoin}} 121 + - ¥{{yohoCoin}}
122 </li> 122 </li>
123 <li class="cost"> 123 <li class="cost">
124 应付金额: <em>¥{{price}}</em> 124 应付金额: <em>¥{{price}}</em>
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 128
129 <ul class="pay-mode"> 129 <ul class="pay-mode">
130 {{# paymentWay}} 130 {{# paymentWay}}
131 - <li class="{{#if default}}default{{/if}}" data-pay-id={{id}}> 131 + <li class="{{#if default}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
132 <span class="iconfont"> 132 <span class="iconfont">
133 {{#if default}} 133 {{#if default}}
134 &#xe62f; 134 &#xe62f;
@@ -142,4 +142,27 @@ @@ -142,4 +142,27 @@
142 </ul> 142 </ul>
143 {{/ orderEnsure}} 143 {{/ orderEnsure}}
144 </div> 144 </div>
  145 +<script id="tmpl-price" type="text/tmpl">
  146 + <ul class="total">
  147 + <li>
  148 + <span>总价</span>
  149 + &nbsp;&nbsp;¥\{{sumPrice}}
  150 + </li>
  151 + <li>
  152 + <span>活动价</span>
  153 + - ¥\{{salePrice}}
  154 + </li>
  155 + <li>
  156 + <span>运费</span>
  157 + + \{{freight}}
  158 + </li>
  159 + <li>
  160 + <span>YOHO币</span>
  161 + - ¥\{{yohoCoin}}
  162 + </li>
  163 + <li class="cost">
  164 + 应付金额: <em>¥\{{price}}</em>
  165 + </li>
  166 + </ul>
  167 +</script>
145 {{> layout/footer}} 168 {{> layout/footer}}
@@ -309,3 +309,8 @@ @@ -309,3 +309,8 @@
309 seajs.use('js/me/pay'); 309 seajs.use('js/me/pay');
310 </script> 310 </script>
311 {{/if}} 311 {{/if}}
  312 +{{#if currencyDetail}}
  313 +<script>
  314 + seajs.use('js/me/currency');
  315 +</script>
  316 +{{/if}}
@@ -32,26 +32,26 @@ @@ -32,26 +32,26 @@
32 <div class="price-compute"> 32 <div class="price-compute">
33 <p class="sum-price"> 33 <p class="sum-price">
34 <span class="title">总价</span> 34 <span class="title">总价</span>
35 - ¥{{price}} 35 + <span id="good-totalprice">¥{{price}}</span>
36 </p> 36 </p>
37 <p class="activity-price"> 37 <p class="activity-price">
38 <span class="title"> 38 <span class="title">
39 活动价 39 活动价
40 <i class="minus">-</i> 40 <i class="minus">-</i>
41 </span> 41 </span>
42 - ¥{{activityPrice}} 42 + <span id="good-activityPrice">¥{{activityPrice}}</span>
43 </p> 43 </p>
44 </div> 44 </div>
45 45
46 <div class="balance"> 46 <div class="balance">
47 <span class="iconfont icon-cb-checked"></span> 47 <span class="iconfont icon-cb-checked"></span>
48 <p> 48 <p>
49 - <span> 49 + <span id="good-total">
50 {{count}}件总计:¥{{sumPrice}} 50 {{count}}件总计:¥{{sumPrice}}
51 </span> 51 </span>
52 <span class="tip">(不含运费)</span> 52 <span class="tip">(不含运费)</span>
53 </p> 53 </p>
54 - <button class="btn-balance"> 54 + <a class="btn-balance">
55 结算 55 结算
56 - </button> 56 + </a>
57 </div> 57 </div>
@@ -3,7 +3,13 @@ @@ -3,7 +3,13 @@
3 <div class="main"> 3 <div class="main">
4 <div class="infos"> 4 <div class="infos">
5 <div class="basic-info"> 5 <div class="basic-info">
6 - <img class="thumb" src={{thumb}}> 6 + {{#thumbs}}
  7 + {{#if @first}}
  8 + <img class="thumb" src={{img}}>
  9 + {{else}}
  10 + <img class="thumb hide" src={{img}}>
  11 + {{/if}}
  12 + {{/thumbs}}
7 <div class="text-info"> 13 <div class="text-info">
8 <p class="name">{{name}}</p> 14 <p class="name">{{name}}</p>
9 <p class="price"> 15 <p class="price">
@@ -15,21 +21,21 @@ @@ -15,21 +21,21 @@
15 </div> 21 </div>
16 </div> 22 </div>
17 <div class="chose-items"> 23 <div class="chose-items">
18 - <div class="color-list"> 24 + <div class="color-list block-list">
19 <span>颜色</span> 25 <span>颜色</span>
20 <ul class="clearfix" data-type="color"> 26 <ul class="clearfix" data-type="color">
21 {{# colors}} 27 {{# colors}}
22 - <li class="block {{#if chosed}}chosed{{/if}}" data-id={{id}}> 28 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}disable{{/unless}}" data-id={{id}} data-numstr="{{sizeNumStr}}">
23 {{name}} 29 {{name}}
24 </li> 30 </li>
25 {{/ colors}} 31 {{/ colors}}
26 </ul> 32 </ul>
27 </div> 33 </div>
28 - <div class="size-list"> 34 + <div class="size-list block-list">
29 <span>尺码</span> 35 <span>尺码</span>
30 - <ul class="clearfix {{#if @first}}{{^}}hide{{/if}}" data-type="size" > 36 + <ul class="clearfix" data-type="size" >
31 {{# sizes}} 37 {{# sizes}}
32 - <li class="block {{#if chosed}}chosed{{/if}}" data-id={{id}}> 38 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}disable{{/unless}}" data-id={{id}} data-numstr="{{colorNumStr}}">
33 {{name}} 39 {{name}}
34 </li> 40 </li>
35 {{/ sizes}} 41 {{/ sizes}}
@@ -44,8 +50,9 @@ @@ -44,8 +50,9 @@
44 <input id="good-num" class="good-num" type="text" value={{num}}> 50 <input id="good-num" class="good-num" type="text" value={{num}}>
45 <a class="btn btn-plus" href="javascript:void(0);"> 51 <a class="btn btn-plus" href="javascript:void(0);">
46 <span class="iconfont">&#xe624;</span> 52 <span class="iconfont">&#xe624;</span>
47 - </a> 53 + </a>
48 </div> 54 </div>
  55 + <span class="left-num"></span>
49 </div> 56 </div>
50 </div> 57 </div>
51 </div> 58 </div>
@@ -22,6 +22,9 @@ @@ -22,6 +22,9 @@
22 <span class="price"> 22 <span class="price">
23 ¥{{price}} 23 ¥{{price}}
24 </span> 24 </span>
  25 + <span class="price">
  26 + ¥{{salePrice}}
  27 + </span>
25 <span class="count"> 28 <span class="count">
26 ×{{count}} 29 ×{{count}}
27 </span> 30 </span>
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 </p> 51 </p>
52 </div> 52 </div>
53 </div> 53 </div>
54 - <div class="opt-panel hide"> 54 + <!--<div class="opt-panel hide">
55 <div class="put-in-favorite"> 55 <div class="put-in-favorite">
56 <span class="iconfont">&#xe622;</span> 56 <span class="iconfont">&#xe622;</span>
57 <span>移入</span> 57 <span>移入</span>
@@ -61,5 +61,5 @@ @@ -61,5 +61,5 @@
61 <span class="iconfont">&#xe626;</span> 61 <span class="iconfont">&#xe626;</span>
62 删除 62 删除
63 </div> 63 </div>
64 - </div> 64 + </div>-->
65 </div> 65 </div>
@@ -876,5 +876,45 @@ class HomeController extends AbstractAction @@ -876,5 +876,45 @@ class HomeController extends AbstractAction
876 ); 876 );
877 $this->_view->display('helpDetail', $data); 877 $this->_view->display('helpDetail', $data);
878 } 878 }
  879 + /**
  880 + * YOHO币详情 新版
  881 + */
  882 + public function currencyDetailAction()
  883 + {
  884 + $this->setTitle('YOHO币');
  885 + $this->setNavHeader('YOHO币', true, false);
  886 +
  887 + $data['money'] = '0';
  888 + $page = $this->post('page',1);
  889 + $size = $this->post('size', 20);
  890 + // $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  891 + $data = UserModel::getYohoCoinLists(3965746,$page,$size);
  892 + $this->_view->display('currency-detail', array(
  893 + 'money' => $data['money'],
  894 + 'pageFooter' => true,
  895 + 'currencyDetail' => true,
  896 + 'currencyDetailPage' => true
  897 + ));
  898 +
  899 + }
  900 +
  901 + /**
  902 + * YOHO币详情 AJAX
  903 + */
  904 + public function ajaxCurrencyDetailAction()
  905 + {
  906 + $data['list'] = array();
  907 + $data['money'] = 0;
  908 + $page = $this->post('page',1);
  909 + $size = $this->post('size', 20);
  910 + $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  911 + //$data = UserModel::getYohoCoinLists(3965746,$page,$size);
  912 + $this->_view->display('ajax-currency-detail', array(
  913 + 'currency' => $data['list'],
  914 + 'pageFooter' => true,
  915 + 'currencyDetailPage' => true
  916 + ));
  917 +
  918 + }
879 919
880 } 920 }
@@ -196,7 +196,6 @@ class ShoppingCartController extends AbstractAction @@ -196,7 +196,6 @@ class ShoppingCartController extends AbstractAction
196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) 196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
197 ); 197 );
198 198
199 -  
200 $this->_view->display('order-ensure', $data); 199 $this->_view->display('order-ensure', $data);
201 } 200 }
202 201
@@ -209,10 +208,10 @@ class ShoppingCartController extends AbstractAction @@ -209,10 +208,10 @@ class ShoppingCartController extends AbstractAction
209 208
210 if ($this->isAjax()) { 209 if ($this->isAjax()) {
211 $cartType = $this->post('cartType', 'ordinary'); 210 $cartType = $this->post('cartType', 'ordinary');
212 - $deliveryWay = $this->post('deliveryWay', 1);  
213 - $paymentType = $this->post('paymentType', 1);  
214 - $couponCode = $this->post('paymentType', null);  
215 - $yohoCoin = $this->post('paymentType', null); 211 + $deliveryWay = $this->post('deliveryId', 1);
  212 + $paymentType = $this->post('paymentTypeId', 1);
  213 + $couponCode = $this->post('couponCode', null);
  214 + $yohoCoin = $this->post('yohoCoin', null);
216 $uid = $this->getUid(true); 215 $uid = $this->getUid(true);
217 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); 216 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
218 } 217 }
@@ -308,22 +307,23 @@ class ShoppingCartController extends AbstractAction @@ -308,22 +307,23 @@ class ShoppingCartController extends AbstractAction
308 $uid = $this->getUid(true); 307 $uid = $this->getUid(true);
309 $addressId = $this->post('addressId', null); 308 $addressId = $this->post('addressId', null);
310 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 309 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
311 - $deliveryTime = $this->post('deliveryTime', 1); // 默认只工作日配送  
312 - $deliveryWay = $this->post('deliveryWay', 1); // 默认普通快递  
313 - $invoiceTitle = $this->post('invoiceTitle', null);  
314 - $invoiceId = $this->post('invoiceId', null);  
315 - $paymentId = $this->post('paymentId', 15); 310 + $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
  311 + $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
  312 + $invoiceTitle = $this->post('invoiceText', null);
  313 + $invoiceId = $this->post('invoiceType', null);
  314 + $paymentId = $this->post('paymentTypeId', 15);
316 $paymentType = $this->post('paymentType', 1); // 默认在线支付 315 $paymentType = $this->post('paymentType', 1); // 默认在线支付
317 - $remark = $this->post('remark', null); // 默认在线支付 316 + $remark = $this->post('msg', null);
  317 + $couponCode = $this->post('couponCode', null);
318 $yohoCoin = $this->post('yohoCoin', 1); 318 $yohoCoin = $this->post('yohoCoin', 1);
319 - $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin); 319 + $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
320 } 320 }
321 321
322 if (empty($result)) { 322 if (empty($result)) {
323 echo ' '; 323 echo ' ';
324 } else { 324 } else {
325 // 提交成功清除Cookie 325 // 提交成功清除Cookie
326 - $this->setCookie('orderInfo', null); 326 + $this->setCookie('order-info', null);
327 327
328 $this->echoJson($result); 328 $this->echoJson($result);
329 } 329 }
@@ -63,13 +63,13 @@ class CartModel @@ -63,13 +63,13 @@ class CartModel
63 63
64 /* 普通购物车 */ 64 /* 普通购物车 */
65 if(isset($cart['ordinary_cart_data'])) { 65 if(isset($cart['ordinary_cart_data'])) {
66 - $result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']); 66 + $result['commonGoodsCount'] = $cart['ordinary_cart_data']['shopping_cart_data']['goods_count'];
67 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']); 67 $result['commonCart'] = self::procCartData($cart['ordinary_cart_data']);
68 } 68 }
69 69
70 /* 预售购物车 */ 70 /* 预售购物车 */
71 if(isset($cart['advance_cart_data'])) { 71 if(isset($cart['advance_cart_data'])) {
72 - $result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']); 72 + $result['presellGoodsCount'] = $cart['advance_cart_data']['shopping_cart_data']['goods_count'];
73 $result['preSellCart'] = self::procCartData($cart['advance_cart_data']); 73 $result['preSellCart'] = self::procCartData($cart['advance_cart_data']);
74 } 74 }
75 75
@@ -330,7 +330,7 @@ class CartModel @@ -330,7 +330,7 @@ class CartModel
330 // cookie保存的数据 330 // cookie保存的数据
331 if (!empty($cookieData)) { 331 if (!empty($cookieData)) {
332 $orderInfo = json_decode($cookieData, true); 332 $orderInfo = json_decode($cookieData, true);
333 -// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); 333 + $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
334 } 334 }
335 335
336 // 根据地址id查询地址信息 336 // 根据地址id查询地址信息
@@ -449,13 +449,24 @@ class CartModel @@ -449,13 +449,24 @@ class CartModel
449 $one = array(); 449 $one = array();
450 $one['id'] = $inv['invoices_type_id']; 450 $one['id'] = $inv['invoices_type_id'];
451 $one['name'] = $inv['invoices_type_name']; 451 $one['name'] = $inv['invoices_type_name'];
  452 + isset($orderInfo['invoiceType']) && $one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true;
452 453
453 $result['invoice'][] = $one; 454 $result['invoice'][] = $one;
454 } 455 }
  456 +
  457 + // 发票信息需要记录
  458 + if (isset($orderInfo['invoice'])) {
  459 + $result['needInvoice'] = $orderInfo['invoice'];
  460 + $result['invoiceText'] = $orderInfo['invoiceText'];
  461 + }
  462 +
455 } 463 }
456 464
  465 + // 留言
  466 + isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
  467 +
457 // 优惠券数据 468 // 优惠券数据
458 - $coupons = array('notUsed' => true); 469 + $coupons = array();
459 !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue']; 470 !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
460 $coupons += self::getCouponList($uid, 0, 1, true); 471 $coupons += self::getCouponList($uid, 0, 1, true);
461 $result['coupon'] = $coupons; 472 $result['coupon'] = $coupons;
@@ -556,16 +567,28 @@ class CartModel @@ -556,16 +567,28 @@ class CartModel
556 * @param int $paymentId 支付方式ID 567 * @param int $paymentId 支付方式ID
557 * @param int $paymentType 支付类型ID 568 * @param int $paymentType 支付类型ID
558 * @param string $remark 留言 569 * @param string $remark 留言
  570 + * @param string $couponCode 优惠券码
559 * @param mixed $yohoCoin 使用的YOHO币数量或为空 571 * @param mixed $yohoCoin 使用的YOHO币数量或为空
560 * @return array 接口返回的数据 572 * @return array 接口返回的数据
561 */ 573 */
562 - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin) 574 + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
563 { 575 {
564 - $result = array();  
565 -  
566 - $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);  
567 - if ($orderSubRes && isset($orderSubRes['code']) && $orderSubRes['code'] === 200) {  
568 - $result = $orderSubRes; 576 + $result = array('code' => 400, 'message' => '出错啦');
  577 +
  578 + if (empty($addressId)) {
  579 + $result['code'] = 401;
  580 + $result['message'] = '配送地址不能为空';
  581 + } elseif (empty($deliveryTime)) {
  582 + $result['code'] = 402;
  583 + $result['message'] = '请选择配送时间';
  584 + } elseif (empty($deliveryWay)) {
  585 + $result['code'] = 403;
  586 + $result['message'] = '请选择配送方式';
  587 + } else {
  588 + $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
  589 + if ($orderSubRes && isset($orderSubRes['code'])) {
  590 + $result = $orderSubRes;
  591 + }
569 } 592 }
570 593
571 return $result; 594 return $result;
@@ -583,26 +606,19 @@ class CartModel @@ -583,26 +606,19 @@ class CartModel
583 $result = array(); 606 $result = array();
584 607
585 $oneGoods = array(); 608 $oneGoods = array();
586 - // 购买的商品列表  
587 - foreach ($data['goods_list'] as $value) {  
588 - $oneGoods['id'] = $value['product_sku'];  
589 - $oneGoods['skn'] = $value['product_skn'];  
590 - $oneGoods['name'] = $value['product_name'];  
591 - $oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);  
592 - $oneGoods['color'] = $value['color_name'];  
593 - $oneGoods['size'] = $value['size_name'];  
594 - $oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据  
595 - $oneGoods['price'] = $value['real_price'];  
596 - $oneGoods['count'] = $value['buy_number'];  
597 - $oneGoods['lowStocks'] = true;  
598 -  
599 - $result['goods'][] = $oneGoods;  
600 - } 609 + // 购买的可用商品列表
  610 + $validGoods = Helpers::formatCartGoods($data['goods_list']);
  611 + !empty($validGoods) && $result['goods'] = $validGoods;
  612 +
  613 + // 失效商品列表
  614 + $notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
  615 + !empty($notValidGoods) && $result['$notValidGoods'] = $notValidGoods;
  616 +
601 // 赠品 617 // 赠品
602 (count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true; 618 (count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true;
603 $result['freebie'] = $data['gift_list']; 619 $result['freebie'] = $data['gift_list'];
604 // 加价购 620 // 加价购
605 - $result['advanceBuy'] = $data['price_gift']; 621 + $result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
606 // 结算数据 622 // 结算数据
607 $result['price'] = $data['shopping_cart_data']['order_amount']; 623 $result['price'] = $data['shopping_cart_data']['order_amount'];
608 $result['activityPrice'] = $data['shopping_cart_data']['discount_amount']; 624 $result['activityPrice'] = $data['shopping_cart_data']['discount_amount'];
@@ -369,6 +369,37 @@ class UserModel @@ -369,6 +369,37 @@ class UserModel
369 } 369 }
370 370
371 /** 371 /**
  372 + * 处理YOHO币变化履历数据
  373 + *
  374 + * @param int $uid 用户ID
  375 + * @param int $page 当前页
  376 + * @param int $limit 一页记录数
  377 + * @return array|mixed 处理之后的YOHO币数据
  378 + */
  379 + public static function getYohoCoinLists($uid, $page, $limit)
  380 + {
  381 + $result = array();
  382 +
  383 + // 调用接口获取YOHO币
  384 + $yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
  385 + // 处理YOHO币数据
  386 + if(isset($yohoCoin['data']) && !empty($yohoCoin['data'])){
  387 + $coinList = $yohoCoin['data']['coinlist'];
  388 + $data['money'] = $yohoCoin['data']['total'];
  389 + foreach($coinList as $key => $val){
  390 + $result[$key]['title'] = $val['message'];
  391 + $result[$key]['time'] = $val['date'];
  392 + if($val['num'] > 0){
  393 + $val['num'] = '+'.$val['num'];
  394 + }
  395 + $result[$key]['count'] = $val['num'];
  396 + }
  397 + }
  398 + $data['list'] = $result;
  399 + return $data;
  400 + }
  401 +
  402 + /**
372 * 处理优惠券数据 403 * 处理优惠券数据
373 * 404 *
374 * @param int $uid 用户ID 405 * @param int $uid 用户ID
@@ -56,8 +56,8 @@ class BindController extends AbstractAction @@ -56,8 +56,8 @@ class BindController extends AbstractAction
56 $nickname = $this->get('nickname'); 56 $nickname = $this->get('nickname');
57 $areaCode = $this->get('areaCode', '86'); 57 $areaCode = $this->get('areaCode', '86');
58 $isReg = $this->get('isReg'); 58 $isReg = $this->get('isReg');
59 - $mobile=$this->get('mobile');  
60 - 59 + $phoneNum=$this->get('phoneNum');
  60 +
61 $data = array( 61 $data = array(
62 'bindIndex'=>true,//js标识 62 'bindIndex'=>true,//js标识
63 'backUrl' => '/', // 返回的URL链接 63 'backUrl' => '/', // 返回的URL链接
@@ -68,7 +68,7 @@ class BindController extends AbstractAction @@ -68,7 +68,7 @@ class BindController extends AbstractAction
68 'nickname' => $nickname, //昵称 68 'nickname' => $nickname, //昵称
69 'isReg' => $isReg, //是否是已注册过的手机号 69 'isReg' => $isReg, //是否是已注册过的手机号
70 'areaCode' => $areaCode, //国别码 70 'areaCode' => $areaCode, //国别码
71 - 'phoneNum'=>$mobile,//手机号码 71 + 'phoneNum'=>$phoneNum,//手机号码
72 ); 72 );
73 73
74 // 渲染模板 74 // 渲染模板
@@ -114,31 +114,31 @@ class BindController extends AbstractAction @@ -114,31 +114,31 @@ class BindController extends AbstractAction
114 break; 114 break;
115 } 115 }
116 116
117 - $mobile = $this->post('mobile'); 117 + $phoneNum = $this->post('phoneNum');
118 $openId = $this->post('openId'); 118 $openId = $this->post('openId');
119 $areaCode = $this->post('areaCode', '86'); 119 $areaCode = $this->post('areaCode', '86');
120 $sourceType = $this->post('sourceType'); 120 $sourceType = $this->post('sourceType');
121 $nickname = $this->post('nickname'); 121 $nickname = $this->post('nickname');
122 122
123 123
124 - if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType) 124 + if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType)
125 { 125 {
126 break; 126 break;
127 } 127 }
128 128
129 - $res = BindData::bindCheck($mobile, $openId, $sourceType); 129 + $res = BindData::bindCheck($phoneNum, $openId, $sourceType);
130 if (!isset($res['code'])) 130 if (!isset($res['code']))
131 { 131 {
132 break; 132 break;
133 } 133 }
134 if ($res['code'] == 200) 134 if ($res['code'] == 200)
135 { 135 {
136 - $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile));  
137 - $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next)); 136 + $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'phoneNum' => $phoneNum));
  137 + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
138 } 138 }
139 else 139 else
140 { 140 {
141 - $data = array('code' => 500, 'message' => $res['message'], 'data' => $res['data']); 141 + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']);
142 } 142 }
143 } 143 }
144 while (false); 144 while (false);
@@ -159,15 +159,15 @@ class BindController extends AbstractAction @@ -159,15 +159,15 @@ class BindController extends AbstractAction
159 break; 159 break;
160 } 160 }
161 161
162 - $mobile = $this->post('mobile'); 162 + $phoneNum = $this->post('phoneNum');
163 $areaCode = $this->post('areaCode'); 163 $areaCode = $this->post('areaCode');
164 164
165 - if (!is_numeric($mobile)) 165 + if (!is_numeric($phoneNum))
166 { 166 {
167 break; 167 break;
168 } 168 }
169 169
170 - $data = BindData::sendBindMsg($areaCode,$mobile); 170 + $data = BindData::sendBindMsg($areaCode,$phoneNum);
171 if (!isset($data['code'])) 171 if (!isset($data['code']))
172 { 172 {
173 break; 173 break;
@@ -191,16 +191,16 @@ class BindController extends AbstractAction @@ -191,16 +191,16 @@ class BindController extends AbstractAction
191 break; 191 break;
192 } 192 }
193 193
194 - $mobile = $this->post('mobile'); 194 + $phoneNum = $this->post('phoneNum');
195 $msgCode = $this->post('msgCode'); 195 $msgCode = $this->post('msgCode');
196 $areaCode = $this->post('areaCode'); 196 $areaCode = $this->post('areaCode');
197 197
198 - if (!is_numeric($mobile) || !$msgCode) 198 + if (!is_numeric($phoneNum) || !$msgCode)
199 { 199 {
200 break; 200 break;
201 } 201 }
202 202
203 - $data = BindData::checkBindCode($areaCode,$mobile, $msgCode); 203 + $data = BindData::checkBindCode($areaCode,$phoneNum, $msgCode);
204 if (!isset($data['code'])) 204 if (!isset($data['code']))
205 { 205 {
206 break; 206 break;
@@ -224,19 +224,19 @@ class BindController extends AbstractAction @@ -224,19 +224,19 @@ class BindController extends AbstractAction
224 break; 224 break;
225 } 225 }
226 226
227 - $mobile = $this->post('mobile'); 227 + $phoneNum = $this->post('phoneNum');
228 $openId = $this->post('openId'); 228 $openId = $this->post('openId');
229 $areaCode = $this->post('areaCode', '86'); 229 $areaCode = $this->post('areaCode', '86');
230 $sourceType = $this->post('sourceType'); 230 $sourceType = $this->post('sourceType');
231 $nickname = $this->post('nickname'); 231 $nickname = $this->post('nickname');
232 $password = $this->post('password'); 232 $password = $this->post('password');
233 233
234 - if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode) 234 + if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode)
235 { 235 {
236 break; 236 break;
237 } 237 }
238 238
239 - $res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password); 239 + $res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password);
240 if (!isset($res['code'])) 240 if (!isset($res['code']))
241 { 241 {
242 break; 242 break;