Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/cart

@@ -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 /**
@@ -42,12 +42,13 @@ class BindData @@ -42,12 +42,13 @@ class BindData
42 * @param string $mobile 手机号 42 * @param string $mobile 手机号
43 * 43 *
44 */ 44 */
45 - public static function sendBindMsg($mobile) 45 + public static function sendBindMsg($area,$mobile)
46 { 46 {
47 $param = Yohobuy::param(); 47 $param = Yohobuy::param();
48 48
49 $param['method'] = 'app.passport.smsbind'; 49 $param['method'] = 'app.passport.smsbind';
50 $param['mobile'] = $mobile; 50 $param['mobile'] = $mobile;
  51 + $param['area'] = $area;
51 $param['client_secret'] = Sign::getSign($param); 52 $param['client_secret'] = Sign::getSign($param);
52 53
53 return Yohobuy::get(Yohobuy::API_URL, $param); 54 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -57,13 +58,14 @@ class BindData @@ -57,13 +58,14 @@ class BindData
57 * 验证验证码是否正确 58 * 验证验证码是否正确
58 * 59 *
59 */ 60 */
60 - public static function checkBindCode($mobile, $code) 61 + public static function checkBindCode($area,$mobile, $code)
61 { 62 {
62 $param = Yohobuy::param(); 63 $param = Yohobuy::param();
63 64
64 $param['method'] = 'app.register.validRegCode'; 65 $param['method'] = 'app.register.validRegCode';
65 $param['mobile'] = $mobile; 66 $param['mobile'] = $mobile;
66 $param['code'] = $code; 67 $param['code'] = $code;
  68 + $param['area'] = $area;
67 $param['client_secret'] = Sign::getSign($param); 69 $param['client_secret'] = Sign::getSign($param);
68 70
69 return Yohobuy::get(Yohobuy::API_URL, $param); 71 return Yohobuy::get(Yohobuy::API_URL, $param);
  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');
@@ -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 +}
  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}}
@@ -308,3 +308,8 @@ @@ -308,3 +308,8 @@
308 seajs.use('js/me/pay'); 308 seajs.use('js/me/pay');
309 </script> 309 </script>
310 {{/if}} 310 {{/if}}
  311 +{{#if currencyDetail}}
  312 +<script>
  313 + seajs.use('js/me/currency');
  314 +</script>
  315 +{{/if}}
@@ -876,5 +876,44 @@ class HomeController extends AbstractAction @@ -876,5 +876,44 @@ 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 + $data['money'] = '0';
  887 + $page = $this->post('page',1);
  888 + $size = $this->post('size', 20);
  889 + // $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  890 + $data = UserModel::getYohoCoinLists(3965746,$page,$size);
  891 + $this->_view->display('currency-detail', array(
  892 + 'money' => $data['money'],
  893 + 'pageFooter' => true,
  894 + 'currencyDetail' => true,
  895 + 'currencyDetailPage' => true
  896 + ));
  897 +
  898 + }
  899 +
  900 + /**
  901 + * YOHO币详情 AJAX
  902 + */
  903 + public function ajaxCurrencyDetailAction()
  904 + {
  905 + $data['list'] = array();
  906 + $data['money'] = 0;
  907 + $page = $this->post('page',1);
  908 + $size = $this->post('size', 20);
  909 + $data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
  910 + // $data = UserModel::getYohoCoinLists(3965746,$page,$size);
  911 + $this->_view->display('ajax-currency-detail', array(
  912 + 'currency' => $data['list'],
  913 + 'pageFooter' => true,
  914 + 'currencyDetailPage' => true
  915 + ));
  916 +
  917 + }
879 918
880 } 919 }
@@ -156,7 +156,6 @@ class ShoppingCartController extends AbstractAction @@ -156,7 +156,6 @@ class ShoppingCartController extends AbstractAction
156 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) 156 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
157 ); 157 );
158 158
159 -  
160 $this->_view->display('order-ensure', $data); 159 $this->_view->display('order-ensure', $data);
161 } 160 }
162 161
@@ -169,10 +168,10 @@ class ShoppingCartController extends AbstractAction @@ -169,10 +168,10 @@ class ShoppingCartController extends AbstractAction
169 168
170 if ($this->isAjax()) { 169 if ($this->isAjax()) {
171 $cartType = $this->post('cartType', 'ordinary'); 170 $cartType = $this->post('cartType', 'ordinary');
172 - $deliveryWay = $this->post('deliveryWay', 1);  
173 - $paymentType = $this->post('paymentType', 1);  
174 - $couponCode = $this->post('paymentType', null);  
175 - $yohoCoin = $this->post('paymentType', null); 171 + $deliveryWay = $this->post('deliveryId', 1);
  172 + $paymentType = $this->post('paymentTypeId', 1);
  173 + $couponCode = $this->post('couponCode', null);
  174 + $yohoCoin = $this->post('yohoCoin', null);
176 $uid = $this->getUid(true); 175 $uid = $this->getUid(true);
177 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin); 176 $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin);
178 } 177 }
@@ -268,13 +267,13 @@ class ShoppingCartController extends AbstractAction @@ -268,13 +267,13 @@ class ShoppingCartController extends AbstractAction
268 $uid = $this->getUid(true); 267 $uid = $this->getUid(true);
269 $addressId = $this->post('addressId', null); 268 $addressId = $this->post('addressId', null);
270 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车 269 $cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
271 - $deliveryTime = $this->post('deliveryTime', 1); // 默认只工作日配送  
272 - $deliveryWay = $this->post('deliveryWay', 1); // 默认普通快递  
273 - $invoiceTitle = $this->post('invoiceTitle', null);  
274 - $invoiceId = $this->post('invoiceId', null);  
275 - $paymentId = $this->post('paymentId', 15); 270 + $deliveryTime = $this->post('deliveryTimeId', 1); // 默认只工作日配送
  271 + $deliveryWay = $this->post('deliveryId', 1); // 默认普通快递
  272 + $invoiceTitle = $this->post('invoiceText', null);
  273 + $invoiceId = $this->post('invoiceType', null);
  274 + $paymentId = $this->post('paymentTypeId', 15);
276 $paymentType = $this->post('paymentType', 1); // 默认在线支付 275 $paymentType = $this->post('paymentType', 1); // 默认在线支付
277 - $remark = $this->post('remark', null); // 默认在线支付 276 + $remark = $this->post('msg', null);
278 $yohoCoin = $this->post('yohoCoin', 1); 277 $yohoCoin = $this->post('yohoCoin', 1);
279 $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin); 278 $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
280 } 279 }
@@ -283,7 +282,7 @@ class ShoppingCartController extends AbstractAction @@ -283,7 +282,7 @@ class ShoppingCartController extends AbstractAction
283 echo ' '; 282 echo ' ';
284 } else { 283 } else {
285 // 提交成功清除Cookie 284 // 提交成功清除Cookie
286 - $this->setCookie('orderInfo', null); 285 + $this->setCookie('order-info', null);
287 286
288 $this->echoJson($result); 287 $this->echoJson($result);
289 } 288 }
@@ -306,7 +306,7 @@ class CartModel @@ -306,7 +306,7 @@ class CartModel
306 // cookie保存的数据 306 // cookie保存的数据
307 if (!empty($cookieData)) { 307 if (!empty($cookieData)) {
308 $orderInfo = json_decode($cookieData, true); 308 $orderInfo = json_decode($cookieData, true);
309 - $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); 309 +// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
310 } 310 }
311 311
312 // 根据地址id查询地址信息 312 // 根据地址id查询地址信息
@@ -326,32 +326,50 @@ class CartModel @@ -326,32 +326,50 @@ class CartModel
326 326
327 // 配送方式 327 // 配送方式
328 if (isset($payReturn['delivery_way'])) { 328 if (isset($payReturn['delivery_way'])) {
  329 + $idArr = array();
  330 + $defaultKey = 0;
329 $oneDeliv = array(); 331 $oneDeliv = array();
330 - foreach ($payReturn['delivery_way'] as $val) { 332 + foreach ($payReturn['delivery_way'] as $key => $val) {
331 $oneDeliv = array(); 333 $oneDeliv = array();
332 $oneDeliv['id'] = $val['delivery_way_id']; 334 $oneDeliv['id'] = $val['delivery_way_id'];
333 $oneDeliv['name'] = $val['delivery_way_name']; 335 $oneDeliv['name'] = $val['delivery_way_name'];
  336 + ($val['default'] === 'Y') && $defaultKey = $key;
334 337
335 - isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true; 338 + $idArr[$key] = $oneDeliv['id'];
336 339
337 - !isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y'); 340 + $result['dispatchMode'][$key] = $oneDeliv;
  341 + }
338 342
339 - $result['dispatchMode'][] = $oneDeliv; 343 + if (isset($orderInfo['deliveryId'])) {
  344 + $flag = array_search($orderInfo['deliveryId'], $idArr);
  345 + $flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
  346 + } else {
  347 + $result['dispatchMode'][$defaultKey]['isSelected'] = true;
340 } 348 }
341 } 349 }
342 350
343 // 配送时间 351 // 配送时间
344 if (isset($payReturn['delivery_time'])) { 352 if (isset($payReturn['delivery_time'])) {
  353 + $idArr = array();
  354 + $defaultKey = 0;
345 $oneDelivTime = array(); 355 $oneDelivTime = array();
346 - foreach ($payReturn['delivery_time'] as $one) { 356 + foreach ($payReturn['delivery_time'] as $key => $one) {
347 $oneDelivTime = array(); 357 $oneDelivTime = array();
348 $oneDelivTime['id'] = $one['delivery_time_id']; 358 $oneDelivTime['id'] = $one['delivery_time_id'];
349 $oneDelivTime['name'] = $one['delivery_time_string']; 359 $oneDelivTime['name'] = $one['delivery_time_string'];
350 - $oneDelivTime['default'] = ($one['default'] === 'Y');  
351 - isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true; 360 + ($one['default'] === 'Y') && $defaultKey = $key;
  361 +
  362 + $idArr[$key] = $oneDelivTime['id'];
352 363
353 $result['dispatchTime'][] = $oneDelivTime; 364 $result['dispatchTime'][] = $oneDelivTime;
354 } 365 }
  366 +
  367 + if (isset($orderInfo['deliveryTimeId'])) {
  368 + $flag = array_search($orderInfo['deliveryTimeId'], $idArr);
  369 + $flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
  370 + } else {
  371 + $result['dispatchTime'][$defaultKey]['isSelected'] = true;
  372 + }
355 } 373 }
356 374
357 // 订单商品 375 // 订单商品
@@ -407,13 +425,21 @@ class CartModel @@ -407,13 +425,21 @@ class CartModel
407 $one = array(); 425 $one = array();
408 $one['id'] = $inv['invoices_type_id']; 426 $one['id'] = $inv['invoices_type_id'];
409 $one['name'] = $inv['invoices_type_name']; 427 $one['name'] = $inv['invoices_type_name'];
  428 + $one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true;
410 429
411 $result['invoice'][] = $one; 430 $result['invoice'][] = $one;
412 } 431 }
  432 +
  433 + // 发票信息需要记录
  434 + $result['needInvoice'] = $orderInfo['invoice'];
  435 + $result['invoiceText'] = $orderInfo['invoiceText'];
413 } 436 }
414 437
  438 + // 留言
  439 + $result['msg'] = $orderInfo['msg'];
  440 +
415 // 优惠券数据 441 // 优惠券数据
416 - $coupons = array('notUsed' => true); 442 + $coupons = array();
417 !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue']; 443 !empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
418 $coupons += self::getCouponList($uid, 0, 1, true); 444 $coupons += self::getCouponList($uid, 0, 1, true);
419 $result['coupon'] = $coupons; 445 $result['coupon'] = $coupons;
@@ -369,6 +369,35 @@ class UserModel @@ -369,6 +369,35 @@ 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 + $coinList = $yohoCoin['data']['coinlist'];
  387 + $data['money'] = $yohoCoin['data']['total'];
  388 + foreach($coinList as $key => $val){
  389 + $result[$key]['title'] = $val['message'];
  390 + $result[$key]['time'] = $val['date'];
  391 + if($val['num'] > 0){
  392 + $val['num'] = '+'.$val['num'];
  393 + }
  394 + $result[$key]['count'] = $val['num'];
  395 + }
  396 + $data['list'] = $result;
  397 + return $data;
  398 + }
  399 +
  400 + /**
372 * 处理优惠券数据 401 * 处理优惠券数据
373 * 402 *
374 * @param int $uid 用户ID 403 * @param int $uid 用户ID
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\Wap\Passport\BindData; 4 use LibModels\Wap\Passport\BindData;
  5 +use LibModels\Wap\Passport\RegData;
5 use Plugin\Helpers; 6 use Plugin\Helpers;
6 7
7 /** 8 /**
@@ -15,14 +16,28 @@ class BindController extends AbstractAction @@ -15,14 +16,28 @@ class BindController extends AbstractAction
15 */ 16 */
16 public function indexAction() 17 public function indexAction()
17 { 18 {
  19 + $refer = $this->get('refer');
  20 + if (!empty($refer))
  21 + {
  22 + $this->setCookie('refer', $refer);
  23 + }
  24 +
18 $this->setTitle('绑定手机号'); 25 $this->setTitle('绑定手机号');
  26 +
19 $openId = $this->get('openId'); 27 $openId = $this->get('openId');
20 $sourceType = $this->get('sourceType'); 28 $sourceType = $this->get('sourceType');
21 - $nickName = $this->get('nickName'); 29 + $nickname = $this->get('nickname');
22 $data = array( 30 $data = array(
  31 + 'bindIndex'=>true,//js标识
  32 + 'backUrl' => '/', // 返回的URL链接
  33 + 'showHeaderImg' => true, // 控制显示头部图片
  34 + 'isPassportPage' => true, // 模板中模块标识
23 'sourceType' => $sourceType, // 第三方登录来源 35 'sourceType' => $sourceType, // 第三方登录来源
  36 + 'platform'=>$sourceType,
24 'openId' => $openId, // openId 37 'openId' => $openId, // openId
25 - 'nickname' => $nickName, //昵称 38 + 'areaCode'=>'+86',//默认区号
  39 + 'countrys'=>RegData::getAreasData(),//国别码
  40 + 'nickname' => $nickname, //昵称
26 ); 41 );
27 42
28 // 渲染模板 43 // 渲染模板
@@ -38,16 +53,22 @@ class BindController extends AbstractAction @@ -38,16 +53,22 @@ class BindController extends AbstractAction
38 $this->setTitle('验证手机'); 53 $this->setTitle('验证手机');
39 $openId = $this->get('openId'); 54 $openId = $this->get('openId');
40 $sourceType = $this->get('sourceType'); 55 $sourceType = $this->get('sourceType');
41 - $nickName = $this->get('nickName');  
42 - $area = $this->get('areaCode', '86'); 56 + $nickname = $this->get('nickname');
  57 + $areaCode = $this->get('areaCode', '86');
43 $isReg = $this->get('isReg'); 58 $isReg = $this->get('isReg');
  59 + $mobile=$this->get('mobile');
44 60
45 $data = array( 61 $data = array(
  62 + 'bindIndex'=>true,//js标识
  63 + 'backUrl' => '/', // 返回的URL链接
  64 + 'showHeaderImg' => true, // 控制显示头部图片
  65 + 'isPassportPage' => true, // 模板中模块标识
46 'sourceType' => $sourceType, // 第三方登录来源 66 'sourceType' => $sourceType, // 第三方登录来源
47 'openId' => $openId, // openId 67 'openId' => $openId, // openId
48 - 'nickname' => $nickName, //昵称 68 + 'nickname' => $nickname, //昵称
49 'isReg' => $isReg, //是否是已注册过的手机号 69 'isReg' => $isReg, //是否是已注册过的手机号
50 - 'area' => $area //国别码 70 + 'areaCode' => $areaCode, //国别码
  71 + 'phoneNum'=>$mobile,//手机号码
51 ); 72 );
52 73
53 // 渲染模板 74 // 渲染模板
@@ -63,13 +84,17 @@ class BindController extends AbstractAction @@ -63,13 +84,17 @@ class BindController extends AbstractAction
63 $this->setTitle('重新设置登录密码'); 84 $this->setTitle('重新设置登录密码');
64 $openId = $this->get('openId'); 85 $openId = $this->get('openId');
65 $sourceType = $this->get('sourceType'); 86 $sourceType = $this->get('sourceType');
66 - $nickName = $this->get('nickName');  
67 - $area = $this->get('areaCode', '86'); 87 + $nickname = $this->get('nickname');
  88 + $areaCode = $this->get('areaCode', '86');
68 $data = array( 89 $data = array(
  90 + 'bindIndex'=>true,//js标识
  91 + 'backUrl' => '/', // 返回的URL链接
  92 + 'showHeaderImg' => true, // 控制显示头部图片
  93 + 'isPassportPage' => true, // 模板中模块标识
69 'sourceType' => $sourceType, // 第三方登录来源 94 'sourceType' => $sourceType, // 第三方登录来源
70 'openId' => $openId, // openId 95 'openId' => $openId, // openId
71 - 'nickname' => $nickName, //昵称  
72 - 'area' => $area //国别码 96 + 'nickname' => $nickname, //昵称
  97 + 'areaCode' => $areaCode //国别码
73 ); 98 );
74 99
75 // 渲染模板 100 // 渲染模板
@@ -91,12 +116,12 @@ class BindController extends AbstractAction @@ -91,12 +116,12 @@ class BindController extends AbstractAction
91 116
92 $mobile = $this->post('mobile'); 117 $mobile = $this->post('mobile');
93 $openId = $this->post('openId'); 118 $openId = $this->post('openId');
94 - $area = $this->post('areaCode', '86'); 119 + $areaCode = $this->post('areaCode', '86');
95 $sourceType = $this->post('sourceType'); 120 $sourceType = $this->post('sourceType');
96 - $nickName = $this->post('nickName'); 121 + $nickname = $this->post('nickname');
97 122
98 123
99 - if (!is_numeric($mobile) || !$openId || !$area || !$sourceType) 124 + if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType)
100 { 125 {
101 break; 126 break;
102 } 127 }
@@ -108,8 +133,8 @@ class BindController extends AbstractAction @@ -108,8 +133,8 @@ class BindController extends AbstractAction
108 } 133 }
109 if ($res['code'] == 200) 134 if ($res['code'] == 200)
110 { 135 {
111 - $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickName' => $nickName, 'areaCode' => $area, 'mobile' => $mobile));  
112 - $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, 'mobile' => $mobile));
  137 + $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next));
113 } 138 }
114 else 139 else
115 { 140 {
@@ -135,13 +160,14 @@ class BindController extends AbstractAction @@ -135,13 +160,14 @@ class BindController extends AbstractAction
135 } 160 }
136 161
137 $mobile = $this->post('mobile'); 162 $mobile = $this->post('mobile');
  163 + $areaCode = $this->post('areaCode');
138 164
139 if (!is_numeric($mobile)) 165 if (!is_numeric($mobile))
140 { 166 {
141 break; 167 break;
142 } 168 }
143 169
144 - $data = BindData::sendBindMsg($mobile); 170 + $data = BindData::sendBindMsg($areaCode,$mobile);
145 if (!isset($data['code'])) 171 if (!isset($data['code']))
146 { 172 {
147 break; 173 break;
@@ -167,13 +193,14 @@ class BindController extends AbstractAction @@ -167,13 +193,14 @@ class BindController extends AbstractAction
167 193
168 $mobile = $this->post('mobile'); 194 $mobile = $this->post('mobile');
169 $msgCode = $this->post('msgCode'); 195 $msgCode = $this->post('msgCode');
  196 + $areaCode = $this->post('areaCode');
170 197
171 if (!is_numeric($mobile) || !$msgCode) 198 if (!is_numeric($mobile) || !$msgCode)
172 { 199 {
173 break; 200 break;
174 } 201 }
175 202
176 - $data = BindData::checkBindCode($mobile, $msgCode); 203 + $data = BindData::checkBindCode($areaCode,$mobile, $msgCode);
177 if (!isset($data['code'])) 204 if (!isset($data['code']))
178 { 205 {
179 break; 206 break;
@@ -199,17 +226,17 @@ class BindController extends AbstractAction @@ -199,17 +226,17 @@ class BindController extends AbstractAction
199 226
200 $mobile = $this->post('mobile'); 227 $mobile = $this->post('mobile');
201 $openId = $this->post('openId'); 228 $openId = $this->post('openId');
202 - $area = $this->post('areaCode', '86'); 229 + $areaCode = $this->post('areaCode', '86');
203 $sourceType = $this->post('sourceType'); 230 $sourceType = $this->post('sourceType');
204 - $nickName = $this->post('nickName'); 231 + $nickname = $this->post('nickname');
205 $password = $this->post('password'); 232 $password = $this->post('password');
206 233
207 - if (!is_numeric($mobile) || !$openId || !$sourceType || !$area) 234 + if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode)
208 { 235 {
209 break; 236 break;
210 } 237 }
211 238
212 - $res = BindData::bindMobile($openId, $nickName, $sourceType, $mobile, $area, $password); 239 + $res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password);
213 if (!isset($res['code'])) 240 if (!isset($res['code']))
214 { 241 {
215 break; 242 break;