Authored by biao

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

... ... @@ -1263,11 +1263,45 @@
'cartUrl':'购物车url',
'addToCartUrl':'添加购物车url',
'soldOut':'已售罄',
'notForSale':'非卖品'
'notForSale':'非卖品',
thumb: [
{
id:1,
url : ''
},
...
],
name: '',
price: '',
salePrice: '',
colors: [
{
id: 1,
chosed: true,
name: '黄色',
colorNum:10,
shortUrl:'',
},
...
],
sizes: [
{
id: 2,
chosed: true,
name: 'X',
sizeNum: 2
},
...
],
totalNum: 20
},
'introUrl' : '',
'id' : '',
'preferenceUrl' :''
'preferenceUrl' :'',
}
### 评价列表页面
{
... ...
... ... @@ -42,12 +42,13 @@ class BindData
* @param string $mobile 手机号
*
*/
public static function sendBindMsg($mobile)
public static function sendBindMsg($area,$mobile)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.smsbind';
$param['mobile'] = $mobile;
$param['area'] = $area;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -57,13 +58,14 @@ class BindData
* 验证验证码是否正确
*
*/
public static function checkBindCode($mobile, $code)
public static function checkBindCode($area,$mobile, $code)
{
$param = Yohobuy::param();
$param['method'] = 'app.register.validRegCode';
$param['mobile'] = $mobile;
$param['code'] = $code;
$param['area'] = $area;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ...
... ... @@ -7,7 +7,8 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../../plugin/tip');
tip = require('../../plugin/tip'),
chosePanel = require('../../shopping-cart/chose-panel');
var likeEle = document.getElementById('likeBtn'),
likeHammer = likeEle && new Hammer(likeEle);
... ... @@ -70,14 +71,17 @@ if (likeHammer) {
if (addToCartHammer) {
addToCartHammer.on('tap', function(e) {
chosePanel.show();
// 统计代码:用于统计用户加入购物车的动作
if (window._yas) {
window._yas.sendCustomInfo({
pd: productId,
by: 1
}, false);
}
// if (window._yas) {
// window._yas.sendCustomInfo({
// pd: productId,
// by: 1
// }, false);
// }
});
}
... ...
... ... @@ -5,36 +5,45 @@
* @date: 2015/10/21
*/
var $ = require('jquery'),
Handlebars = require('yoho.handlebars');
var $ = require('jquery');
var $page = $('.yoho-page');
// Handlebars = require('yoho.handlebars');
// var $page = $('.yoho-page');
var $num;
var tpl;
// var tpl;
//读取partials
$.ajax({
type: 'GET',
url: '/shoppingCart/tpl',
success: function(data) {
tpl = Handlebars.compile(data);
}
});
// $.ajax({
// type: 'GET',
// url: '/shoppingCart/tpl',
// success: function(data) {
// tpl = Handlebars.compile(data);
// }
// });
//显示
function show(data) {
var html = tpl(data);
$page.append(html);
//显示
// function show(data) {
// // var html = tpl(data);
// $('.chose-panel').show();
// // $page.append(html);
// $('.chose-panel')
// $num = $('#good-num');
// }
function show() {
$('.chose-panel').show();
$('body').css('overflow', 'hidden');
$num = $('#good-num');
}
//移除当前Panel
function remove() {
$('.chose-panel').remove();
$('.chose-panel').hide();
$('body').css('overflow', 'auto');
}
$('.yoho-page').on('touchstart', '.chose-panel', function(e) {
... ... @@ -75,4 +84,5 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
$num.val(num + 1);
});
exports.show = show;
\ No newline at end of file
... ...
.chose-panel {
position: absolute;
position: fixed;
display: none;
height: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,.3);
z-index:3;
.main {
position: absolute;
height: 610rem / $pxConvertRem;
height: pxToRem(610px);
bottom: 0;
left: 0;
right: 0;
... ... @@ -18,7 +21,7 @@
.infos {
height: 460rem / $pxConvertRem;
padding: 0 22rem / $pxConvertRem;
padding-top: 30rem / $pxConvertRem;
// padding-top: 30rem / $pxConvertRem;
}
.chose-items {
... ... @@ -27,7 +30,10 @@
}
.basic-info {
margin-bottom: 30rem / $pxConvertRem;
overflow: hidden;
position: relative;
margin-bottom: pxToRem(30px);
margin-top: pxToRem(30px);
}
.thumb {
... ... @@ -37,12 +43,18 @@
}
.text-info {
margin-left: 102rem / $pxConvertRem;
position: absolute;
height: auto;
left: pxToRem(95px);
top:50%;
transform: translateY(-50%);
.name {
font-size: 28rem / $pxConvertRem;
}
.price{
font-size: pxToRem(24px);
}
.sale-price {
color: #e10;
... ...
... ... @@ -114,6 +114,7 @@
<div id="productDesc"> </div>
{{> product/recommend-for-you}}
{{> shopping-cart/chose-panel}}
{{#cartInfo}}
<div class="cart-bar">
... ... @@ -121,7 +122,8 @@
<a href="{{cartUrl}}" class="num-incart iconfont">&#xe62c;</a>
{{#if addToCartUrl}}
<a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a>
<!-- <a id="addtoCart" href="{{addToCartUrl}}" class="addto-cart">加入购物车</a> -->
<a id="addtoCart" href="javascript:;" class="addto-cart">加入购物车</a>
{{/if}}
{{#if soldOut}}
... ...
{{#cartInfo}}
<div class="chose-panel">
<div class="main">
<div class="infos">
... ... @@ -25,8 +26,8 @@
</ul>
</div>
<div class="size-list">
<span>尺码</span>
<ul class="clearfix" data-type="size">
<span>尺码</span>
<ul class="clearfix {{#if @first}}{{^}}hide{{/if}}" data-type="size" >
{{# sizes}}
<li class="block {{#if chosed}}chosed{{/if}}" data-id={{id}}>
{{name}}
... ... @@ -49,7 +50,8 @@
</div>
</div>
<div class="btn-wrap">
<button id="chose-btn-sure" class="btn btn-sure">确定</button>
<button id="chose-btn-sure" class="btn btn-sure">加入购物车</button>
</div>
</div>
</div>
\ No newline at end of file
</div>
{{/cartInfo}}
\ No newline at end of file
... ...
... ... @@ -306,7 +306,7 @@ class CartModel
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
// 根据地址id查询地址信息
... ... @@ -326,32 +326,50 @@ class CartModel
// 配送方式
if (isset($payReturn['delivery_way'])) {
$idArr = array();
$defaultKey = 0;
$oneDeliv = array();
foreach ($payReturn['delivery_way'] as $val) {
foreach ($payReturn['delivery_way'] as $key => $val) {
$oneDeliv = array();
$oneDeliv['id'] = $val['delivery_way_id'];
$oneDeliv['name'] = $val['delivery_way_name'];
($val['default'] === 'Y') && $defaultKey = $key;
isset($orderInfo['deliveryId']) && $orderInfo['deliveryId'] === $oneDeliv['id'] && $oneDeliv['isSelected'] = true;
$idArr[$key] = $oneDeliv['id'];
!isset($oneDeliv['isSelected']) && $oneDeliv['isSelected'] = ($val['default'] === 'Y');
$result['dispatchMode'][$key] = $oneDeliv;
}
$result['dispatchMode'][] = $oneDeliv;
if (isset($orderInfo['deliveryId'])) {
$flag = array_search($orderInfo['deliveryId'], $idArr);
$flag !== false && $result['dispatchMode'][$flag]['isSelected'] = true;
} else {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
}
// 配送时间
if (isset($payReturn['delivery_time'])) {
$idArr = array();
$defaultKey = 0;
$oneDelivTime = array();
foreach ($payReturn['delivery_time'] as $one) {
foreach ($payReturn['delivery_time'] as $key => $one) {
$oneDelivTime = array();
$oneDelivTime['id'] = $one['delivery_time_id'];
$oneDelivTime['name'] = $one['delivery_time_string'];
$oneDelivTime['default'] = ($one['default'] === 'Y');
isset($orderInfo['deliveryTimeId']) && $orderInfo['deliveryTimeId'] === $oneDelivTime['id'] && $oneDeliv['isSelected'] = true;
($one['default'] === 'Y') && $defaultKey = $key;
$idArr[$key] = $oneDelivTime['id'];
$result['dispatchTime'][] = $oneDelivTime;
}
if (isset($orderInfo['deliveryTimeId'])) {
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
} else {
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
}
}
// 订单商品
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use LibModels\Wap\Passport\BindData;
use LibModels\Wap\Passport\RegData;
use Plugin\Helpers;
/**
... ... @@ -15,14 +16,28 @@ class BindController extends AbstractAction
*/
public function indexAction()
{
$refer = $this->get('refer');
if (!empty($refer))
{
$this->setCookie('refer', $refer);
}
$this->setTitle('绑定手机号');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$nickname = $this->get('nickname');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'platform'=>$sourceType,
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'areaCode'=>'+86',//默认区号
'countrys'=>RegData::getAreasData(),//国别码
'nickname' => $nickname, //昵称
);
// 渲染模板
... ... @@ -38,16 +53,22 @@ class BindController extends AbstractAction
$this->setTitle('验证手机');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$area = $this->get('areaCode', '86');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$isReg = $this->get('isReg');
$mobile=$this->get('mobile');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'nickname' => $nickname, //昵称
'isReg' => $isReg, //是否是已注册过的手机号
'area' => $area //国别码
'areaCode' => $areaCode, //国别码
'phoneNum'=>$mobile,//手机号码
);
// 渲染模板
... ... @@ -63,13 +84,17 @@ class BindController extends AbstractAction
$this->setTitle('重新设置登录密码');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
$nickName = $this->get('nickName');
$area = $this->get('areaCode', '86');
$nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$data = array(
'bindIndex'=>true,//js标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'sourceType' => $sourceType, // 第三方登录来源
'openId' => $openId, // openId
'nickname' => $nickName, //昵称
'area' => $area //国别码
'nickname' => $nickname, //昵称
'areaCode' => $areaCode //国别码
);
// 渲染模板
... ... @@ -91,12 +116,12 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$openId = $this->post('openId');
$area = $this->post('areaCode', '86');
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
$nickName = $this->post('nickName');
$nickname = $this->post('nickname');
if (!is_numeric($mobile) || !$openId || !$area || !$sourceType)
if (!is_numeric($mobile) || !$openId || !$areaCode || !$sourceType)
{
break;
}
... ... @@ -108,7 +133,7 @@ class BindController extends AbstractAction
}
if ($res['code'] == 200)
{
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickName' => $nickName, 'areaCode' => $area, 'mobile' => $mobile));
$next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'mobile' => $mobile));
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('is_register' => $res['data']['is_register'], 'next' => $next));
}
else
... ... @@ -135,13 +160,14 @@ class BindController extends AbstractAction
}
$mobile = $this->post('mobile');
$areaCode = $this->post('areaCode');
if (!is_numeric($mobile))
{
break;
}
$data = BindData::sendBindMsg($mobile);
$data = BindData::sendBindMsg($areaCode,$mobile);
if (!isset($data['code']))
{
break;
... ... @@ -167,13 +193,14 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$msgCode = $this->post('msgCode');
$areaCode = $this->post('areaCode');
if (!is_numeric($mobile) || !$msgCode)
{
break;
}
$data = BindData::checkBindCode($mobile, $msgCode);
$data = BindData::checkBindCode($areaCode,$mobile, $msgCode);
if (!isset($data['code']))
{
break;
... ... @@ -199,17 +226,17 @@ class BindController extends AbstractAction
$mobile = $this->post('mobile');
$openId = $this->post('openId');
$area = $this->post('areaCode', '86');
$areaCode = $this->post('areaCode', '86');
$sourceType = $this->post('sourceType');
$nickName = $this->post('nickName');
$nickname = $this->post('nickname');
$password = $this->post('password');
if (!is_numeric($mobile) || !$openId || !$sourceType || !$area)
if (!is_numeric($mobile) || !$openId || !$sourceType || !$areaCode)
{
break;
}
$res = BindData::bindMobile($openId, $nickName, $sourceType, $mobile, $area, $password);
$res = BindData::bindMobile($openId, $nickname, $sourceType, $mobile, $areaCode, $password);
if (!isset($res['code']))
{
break;
... ...