Authored by yangyang

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

... ... @@ -160,15 +160,24 @@ class UserData
*/
public static function couponData($uid, $status, $page = 1, $limit = 10)
{
$urlList = array();
$param = Yohobuy::param();
$param['method'] = 'app.coupons.li';
$param['uid'] = $uid;
$param['status'] = $status;
$param['status'] = 0;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
$urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::get(Yohobuy::API_URL, $param);
unset($param['client_secret']);
$param['status'] = 1;
$param['client_secret'] = Sign::getSign($param);
$urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList);
}
/**
... ... @@ -224,7 +233,7 @@ class UserData
$param['consignee'] = $consignee;
$param['email'] = $email;
if ($id !== null) { // 修改
if (!empty($id)) { // 修改
$param['id'] = $id;
$param['method'] = 'app.address.update';
} else { // 添加
... ...
/**
* 地址管理
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/17
*/
var $ = require('jquery'),
tip = require('../plugin/tip');
var $action = $('.action'),
$addressForm = $('.edit-address'),
$submit = $('.submit'),
$addAddress = $('.add-address'),
$editAddressPage = $('.my-edit-address-page'),
$addressListPage = $('.my-address-list-page'),
$area = $('.area'),
$footer = $('#yoho-footer'),
isSubmiting,
newArea = [];
function editAddress(data) {
data = data || {};
$addressForm.find('[name="id"]').val(data.id || '');
$addressForm.find('[name="consignee"]').val(data.consignee || '');
$addressForm.find('[name="mobile"]').val(data.mobile || '');
$addressForm.find('[name="area_code"]').val(data.areaCode || '');
$addressForm.find('[name="area"]').val(data.area || '');
$addressForm.find('[name="address"]').val(data.address || '');
$editAddressPage.show();
$addressForm.find('[name="consignee"]').focus();
}
function deleteAddress(data) {
}
// 添加地址
$addAddress.on('touchend', function() {
editAddress();
});
// 编辑或删除
$action.on('touchend', '.edit', function() {
editAddress($(this).data());
}).on('touchend', '.del', function() {
deleteAddress();
});
$submit.on('touchend', function() {
$addressForm.submit();
return false;
});
$addressForm.on('submit', function() {
if (isSubmiting) {
return false;
}
isSubmiting = true;
$.ajax({
method: 'POST',
url: '/home/saveaddress',
data: $(this).serialize()
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip.show(res.message || '网络出了点问题~');
} else {
window.location.reload();
}
}).fail(function() {
tip.show('网络出了点问题~');
}).always(function() {
isSubmiting = false;
});
return false;
});
// 省市区
$area.on('touchend', function() {
$footer.hide();
$addressListPage.show();
});
$addressListPage.on('touchend', '.address', function() {
newArea.push($(this).children('.caption').text());
$(this).siblings().hide();
$(this).children('ul').show();
return false;
}).on('touchend', '.address-last', function() {
// 填结果到 html
newArea.push($(this).children('.caption').text());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($(this).data('id'));
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide();
$addressListPage.children('ul').show().children('li').show();
$footer.show();
newArea = [];
return false;
});
... ...
... ... @@ -102,7 +102,7 @@
.my-edit-address-page {
position: absolute;
bottom: 0;
top: pxToRem(90px);
top: 0;
width: 100%;
color: #d0d0d0;
background: #f0f0f0;
... ... @@ -157,7 +157,7 @@
textarea {
height: pxToRem(58px) * 2;
padding: pxToRem(20px) pxToRem(10px);
padding: pxToRem(20px) 0;
}
}
... ... @@ -172,3 +172,31 @@
line-height: pxToRem(88px);
}
}
.my-address-list-page {
position: absolute;
bottom: 0;
top: 0;
width: 100%;
color: #444;
background: #fff;
li {
padding: 0 pxToRem(30px);
font-size: pxToRem(32px);
line-height: pxToRem(88px);
border-bottom: 1px solid #e0e0e0;
.iconfont {
float: right;
color: #d0d0d0;
}
ul {
display: none;
position: absolute;
top: 0;
left: 0;
background: #fff;
width: 100%;
}
}
}
... ...
... ... @@ -6,7 +6,7 @@
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
<div class="action iconfont">
<a href="/home/address/edit?id={{address_id}}" class="edit">&#xe61e;</a>
<span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
<span class="del" data-id="{{address_id}}">&#xe621;</span>
</div>
</div>
... ... @@ -30,5 +30,7 @@
</div>
</div>
</div>
{{> me/address/edit-address}}
{{> me/address/address-list}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -238,3 +238,8 @@
seajs.use('js/me/online-service');
</script>
{{/if}}
{{#if addressPage}}
<script>
seajs.use('js/me/address');
</script>
{{/if}}
\ No newline at end of file
... ...
<div class="my-address-list-page hide">
<ul class="address-list">
{{# addressList}}
<li class="address">
<span class="caption">{{caption}}</span>
<span class="iconfont">&#xe604;</span>
<ul>
{{# sub}}
<li class="address">
<span class="caption">{{caption}}</span>
<span class="iconfont">&#xe604;</span>
<ul class="address-list">
{{# sub}}
<li class="address-last" data-id="{{code}}">
<span class="caption">{{caption}}</span>
</li>
{{/ sub}}
</ul>
</li>
{{/ sub}}
</ul>
</li>
{{/ addressList}}
</ul>
</div>
\ No newline at end of file
... ...
{{> layout/header}}
<div class="my-edit-address-page yoho-page">
<div class="my-edit-address-page hide">
<form class="edit-address">
<input type="hidden" name="id" value="">
<label class="username">
用户名
<input type="text" name="name" value="张三">
收件人
<input type="text" name="consignee" value="">
</label>
<label class="mobile">
手机号码
<input type="text" name="mobile" value="18911110110">
<input type="text" name="mobile" value="">
</label>
<label class="area">
省市区
<input type="text" name="area" value="江苏省南京市栖霞区">
<input type="hidden" name="area_code" value="">
<input type="text" name="area" value="" readonly>
<span class="iconfont">&#xe604;</span>
</label>
<label class="address">
详细地址
<textarea name="address">东大街西大66号茶馆东大街西大66号茶馆东大街西大66号茶馆</textarea>
<textarea name="address"></textarea>
</label>
</form>
... ... @@ -25,4 +26,3 @@
确认
</div>
</div>
\ No newline at end of file
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -188,8 +188,9 @@ class HomeController extends AbstractAction
*/
public function currencyAction() {
$this->setTitle('YOHO币');
$this->setNavHeader('优惠券', true, SITE_MAIN);
$this->setNavHeader('YOHO币', true, false);
// $uid = $this->getUid();
$uid = 967016;
$currency = \Index\UserModel::getYohoCoinData($uid);
... ... @@ -211,8 +212,8 @@ class HomeController extends AbstractAction
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
'couponsPage' => true
);
print_r($coupons);
$this->_view->display('coupons', $coupons);
}
... ... @@ -244,7 +245,7 @@ class HomeController extends AbstractAction
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($address);
// print_r($addressList);
$this->_view->display('address', array(
'addressPage' => true,
... ... @@ -310,7 +311,7 @@ class HomeController extends AbstractAction
$service = home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online_service', array(
$this->_view->display('online-service', array(
'onlineServicePage' => true,
// 'pageFooter' => true,
'service' => $service
... ... @@ -327,7 +328,7 @@ class HomeController extends AbstractAction
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online_service_detail', $service);
$this->_view->display('online-service-detail', $service);
}
/**
... ... @@ -351,31 +352,11 @@ class HomeController extends AbstractAction
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
print_r($suggest);
$this->_view->display('suggest', array(
'suggestPage' => true, //加载js
'pageFooter' => true,
'suggest' => true,
'suggestContent' => array(
0 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => true,
'bad' => false),
1 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => false,
'bad' => true),
2 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => false,
'bad' => false)
)
'suggestContent' => $suggest
));
}
... ...
... ... @@ -30,7 +30,7 @@ class UserModel
// 调用接口获取个人详情
$userData = UserData::userData($uid);
// 处理个人详情数
// 处理个人详情数
if (isset($userData['data']) && !empty($userData['data'])) {
$result = $userData['data'];
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
... ... @@ -213,8 +213,11 @@ class UserModel
$coupons = UserData::couponData($uid, $status);
// 处理优惠券数据
if (isset($coupons['data']) && !empty($coupons['data'])) {
$result = $coupons['data']['info'];
if (!empty($coupons['unused'])) {
$result['unused'] = $coupons['unused']['info'];
}
if (!empty($coupons['used'])) {
$result['used'] = $coupons['used']['info'];
}
return $result;
... ... @@ -353,14 +356,11 @@ class UserModel
$one = array();
foreach ($suggest['data']['list'] as $val) {
$one = array();
$one['hasImage'] = $val['has_image'];
$one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
$one['title'] = $val['filter_content'];
$one['content'] = $val['reply_content'];
$one['good'] = $val['is_reliable'];
$one['bad'] = !$val['is_reliable'];
$one['goodNum'] = $val['reliable'];
$one['badNum'] = $val['unreliable'];
$one['good'] = boolval($val['is_reliable']);
$one['bad'] = !$one['good'];
$result[] = $one;
}
... ...