Authored by yangyang

解决home.php冲突,保留order控制器

... ... @@ -955,7 +955,7 @@
//订单
{
orderNum: '',
tradingStatus: '',
orderStatus: '',
goods: [
{
id: '',
... ... @@ -1014,11 +1014,10 @@
... //订单商品
}
],
sumPrice: ''
salePrice: ''
freight: ''
coupon: ''
yohoCoin: ''
sumPrice: '',
salePrice: '',
freight: '',
yohoCoin: '',
price: ''
}
}
... ...
... ... @@ -161,7 +161,7 @@ class UserData
public static function couponData($uid, $status, $page = 1, $limit = 10)
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.lists';
$param['method'] = 'app.coupons.li';
$param['uid'] = $uid;
$param['status'] = $status;
$param['page'] = $page;
... ... @@ -188,6 +188,76 @@ class UserData
}
/**
* 获取三级地址列表数据
*
* @param int $uid 用户ID
* @return array 地址接口返回的数据
*/
public static function addressListData($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.address.getlist';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 保存地址数据
*
* @param int $uid 用户ID
* @param string $address 地址信息
* @param int $area_code 城市码
* @param string $consignee 收货人
* @param string $email 邮箱地址
* @param int $id 地址唯一标识符id
* @param string $mobile 手机号码
* @param string $zip_code 邮编
* @return array 地址接口返回的数据
*/
public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code)
{
$param = Yohobuy::param();
$param['address'] = $address;
$param['area_code'] = $area_code;
$param['consignee'] = $consignee;
$param['email'] = $email;
if ($id !== null) { // 修改
$param['id'] = $id;
$param['method'] = 'app.address.update';
} else { // 添加
$param['method'] = 'app.address.add';
}
$param['mobile'] = $mobile;
$param['zip_code'] = $zip_code;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 设置默认地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array 接口返回的数据
*/
public static function setDefaultAddress($uid, $id)
{
$param = Yohobuy::param();
$param['id'] = $id;
$param['method'] = 'app.address.setdefault';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 意见反馈数据
*
* @param string $udid 客户端唯一标识
... ...
... ... @@ -4,12 +4,4 @@
* @date: 2015/11/12
*/
var Swiper = require('yoho.iswiper');
var recommendSwiper;
recommendSwiper = new Swiper('.swiper-recommend', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
slidesPerView: 'auto'
});
\ No newline at end of file
require('../product/recommend-for-you.js');
\ No newline at end of file
... ...
... ... @@ -10,13 +10,18 @@ var $ = require('jquery'),
var orderId = $('#order-detail').data('id');
var delHammer;
var optHammer;
lazyLoad();
//订单删除
delHammer = new Hammer(document.getElementsByClassName('btn-del')[0]);
delHammer.on('tap', function() {
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
optHammer.on('tap', function(e) {
var $cur = $(e.target);
if ($cur.hasClass('btn-del')) {
//删除订单
if (confirm('确定删除订单吗?')) {
$.ajax({
type: 'GET',
... ... @@ -26,4 +31,17 @@ delHammer.on('tap', function() {
}
});
}
} else if ($cur.hasClass('btn-cancel')) {
//取消订单
if (confirm('确定取消订单吗?')) {
$.ajax({
type: 'GET',
url: '/home/cancelOrder',
data: {
id: orderId
}
});
}
}
});
\ No newline at end of file
... ...
/**
* 为您优选
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/16
*/
var Swiper = require('yoho.iswiper');
var recommendSwiper;
recommendSwiper = new Swiper('.swiper-recommend', {
// lazyLoading: true,
// lazyLoadingInPrevNext: true,
slidesPerView: 'auto'
});
\ No newline at end of file
... ...
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "recommend-for-you", "fav", "suggest", "address", "online-service";
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service";
... ...
... ... @@ -15,6 +15,30 @@
}
}
.sub {
position: relative;
.iconfont {
left: 0;
}
}
.logistics {
display: block;
.icon-right {
right: 25rem / $pxConvertRem;
left: auto;
color: #b0b0b0;
}
.sub-content {
border-top: 1px solid #e0e0e0;
margin-top: 20rem / $pxConvertRem;
padding-top: 20rem / $pxConvertRem;
}
}
.owner-info {
border-bottom: 1px solid #e0e0e0;
line-height: 1.5;
... ... @@ -41,6 +65,7 @@
margin: 20rem / $pxConvertRem 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
padding-right: 0;
}
.sub-content span {
... ... @@ -98,4 +123,11 @@
text-align: center;
border: 1px solid #000;
}
.btn-pay {
color: #fff;
border: none;
background: #d0021b;
margin-left: 10rem / $pxConvertRem;
}
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,7 @@
border-bottom: 1px solid #e0e0e0;
}
.trading-status {
.order-status {
float: right;
}
... ...
@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank";
\ No newline at end of file
@import "new-arrival", "discount", "list", "detail", "suspend-cart", "hot-rank", "_recommend-for-you.scss";
\ No newline at end of file
... ...
... ... @@ -87,6 +87,6 @@
</div>
</div>
{{> me/recommend-for-you}}
{{> product/recommend-for-you}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -4,11 +4,10 @@
<div class="question">
<div class="question-title">问题查询</div>
<div class="question-tab">
<span class="tab-item" data-tab="order">订单问题</span>
<span class="line"></span>
<span class="tab-item current" data-tab="shopping">购物问题</span>
<span class="line"></span>
<span class="tab-item" data-tab="other">其他问题</span>
{{#tab}}
<span class="tab-item {{#current}}current{{/current}}" data-tab="{{tabid}}">{{tabname}}</span>
{{#iscut}}<span class="line"></span>{{/iscut}}
{{/tab}}
</div>
{{#question}}
<ul class="question-list {{#current}}current{{/current}}" data-tab-name="{{name}}">
... ... @@ -26,7 +25,7 @@
{{/ service}}
<div class="connect-info">
<div class="connect-item connect-online">
<a href="#" title="在线客服">
<a href="http://chat80.live800.com/live800/chatClient/chatbox.jsp?companyID=493979&amp;configID=123576&amp;jid=9277320930" target="_blank" title="在线客服">
<span class="icon iconfont icon-chat">&#xe620;</span>
在线客服
<span class="iconfont icon-yoho-enter">&#xe604;</span>
... ...
... ... @@ -32,7 +32,7 @@
<span>物流公司:{{logisticsCompany}}</span>
<span>快递单号:{{logisticsNum}}</span>
</p>
<span class="iconfont">&#xe614;</span>
<span class="iconfont icon-right">&#xe614;</span>
</a>
{{/if}}
</section>
... ... @@ -57,10 +57,6 @@
<span>+¥{{freight}}</span>
</li>
<li>
优惠券
<span>-¥{{coupon}}</span>
</li>
<li>
YOHO币
<span>-¥{{yohoCoin}}</span>
</li>
... ...
<div class="order" data-id="{{orderNum}}">
<header class="header">
订单编号:{{orderNum}}
<span class="trading-status">{{tradingStatus}}</span>
<span class="order-status">{{orderStatus}}</span>
</header>
<section class="order-goods">
{{# goods}}
... ...
... ... @@ -2,17 +2,17 @@
<div class="recommend-for-you">
<div class="title">为您优选新品</div>
<div class="swiper-recommend">
<div class="swiper-wrapper">
<ul class="swiper-wrapper">
{{#recommendList}}
<div class="swiper-slider">
<li class="swiper-slider">
<img class="img-box" src="{{thumb}}">
<div class="price">
<span class="sale-price"{{salePrice}}</span>
<span class="old-price"{{price}}</span>
</div>
</div>
</li>
{{/recommendList}}
</div>
</ul>
</div>
</div>
{{/ recommendForYou}}
\ No newline at end of file
... ...
... ... @@ -146,9 +146,20 @@ class HomeController extends AbstractAction
$uid = 967016;
$currency = \Index\UserModel::getYohoCoinData($uid);
$this->_view->display('currency', $currency);
}
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$coupons = array(
'couponsUrl' => array(
\Index\UserModel::getCouponData($uid, 0),
\Index\UserModel::getCouponData($uid, 1),
),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
}
/**
* 优惠券
*/
... ... @@ -194,36 +205,68 @@ class HomeController extends AbstractAction
$uid = 967016;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($address);
$this->_view->display('address', array(
'addressPage' => true,
'pageFooter' => true,
'address' => $address
'address' => $address,
'addressList' => $addressList
));
}
/**
* 修改地址
* 修改地址或者添加新地址
*/
public function editAddressAction() {
// 设置网站标题
$this->setTitle('修改地址');
$this->setNavHeader('修改地址', true, SITE_MAIN);
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
$email = $this->post('email', '');
$id = $this->post('id', null);
$mobile = $this->post('mobile', '');
$zip_code = $this->post('zip_code', '');
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
$address = \Index\UserModel::getAddressData($uid);
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
// print_r($address);
}
/**
* 设置默认地址
*/
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
$this->_view->display('edit_address', array(
'editAddressPage' => true,
'pageFooter' => true,
'address' => $address
));
}
//在线客服
... ... @@ -245,9 +288,13 @@ class HomeController extends AbstractAction
public function onlineServiceDetailAction() {
$service = array();
$cateId = $this->get('cateId', 0);
if ($cateId > 0) {
$cateName = $this->get('cateName', '');
if ($cateId > 0)
{
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online_service_detail', $service);
}
... ...
... ... @@ -218,7 +218,7 @@ class UserModel
// 处理优惠券数据
if (isset($coupons['data']) && !empty($coupons['data'])) {
$result = $coupons['data'];
$result = $coupons['data']['info'];
}
return $result;
... ... @@ -246,6 +246,96 @@ class UserModel
}
/**
* 处理地址列表数据
*
* @param int $uid 用户ID
* @return array|mixed 处理之后的地址列表数据
*/
public static function getAddressListData($uid)
{
$result = array();
// 调用接口获取地址列表数据
$address = UserData::addressListData($uid);
// 处理地址数据
if (isset($address['data']) && !empty($address['data'])) {
$result = $address['data'];
}
return $result;
}
/**
* 保存地址数据
*
* @param int $uid 用户ID
* @param string $address 地址信息
* @param int $area_code 城市码
* @param string $consignee 收货人
* @param string $email 邮箱地址
* @param int $id 地址唯一标识符id
* @param string $mobile 手机号码
* @param string $zip_code 邮编
* @return array|mixed 处理之后的地址列表数据
*/
public static function saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code)
{
$result = array();
// 参数验证
if (empty($uid)) {
$result['code'] = 400;
$result['message'] = '用户不可用';
} else if (empty($address)) {
$result['code'] = 401;
$result['message'] = '请输入可用的地址信息';
} else if (empty($area_code)) {
$result['code'] = 402;
$result['message'] = '地区码不可用';
} else if (empty($consignee)) {
$result['code'] = 403;
$result['message'] = '请输入收件人姓名';
} else if (!empty($email) && Helpers::verifyEmail($email)) {
$result['code'] = 404;
$result['message'] = '输入的邮箱地址格式不正确';
} else if (!empty($mobile) && Helpers::verifyMobile($mobile)) {
$result['code'] = 404;
$result['message'] = '输入的手机号码格式不正确';
} else {
// 调用接口保存地址数据
$address = UserData::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
// 处理返回结果
if (isset($address['code']) && $address['code'] == 200) {
$result = $address['data'];
}
}
return $result;
}
/**
* 设置默认地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array|mixed 处理之后的返回数据
*/
public static function setDefaultAddress($uid, $id)
{
$result = array('code' => 400, 'message' => '错误');
// 调用接口设置默认地址
$address = UserData::setDefaultAddress($uid, $id);
// 处理返回结果
if ($address && isset($address['code'])) {
$result = $address;
}
return $result;
}
/**
* 处理意见反馈数据
*
* @param string $udid 客户端唯一标识
... ...
... ... @@ -230,16 +230,27 @@ class NewsaleModel
/**
* 筛选出来的热销排行榜商品数据处理
*
* @param array $data 筛选出来的原数据
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 处理之后的数据
*/
public static function selectTopData($data)
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
{
$result = array();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::newSaleData($data['data']);
unset($result['filter']);
if ($notab) {
unset($result['tabs']);
}
}
return $result;
... ...
... ... @@ -42,7 +42,7 @@ class OnlineModel
foreach ($sub as $sk => $sv)
{
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name'];
}
}
$question[$key]['list'] = $qTmp;
... ...
... ... @@ -106,12 +106,11 @@ class NewsaleController extends AbstractAction
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean)$this->get('notab', false);
// 获取性别
$gender = Helpers::getGenderByCookie();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$result = \Product\NewsaleModel::selectTopData($data);
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
... ...