Authored by hf

fixes bug to call product detail api and order status

... ... @@ -26,9 +26,11 @@
{{#if unpaid}}
<div class="order-opt">
<span class="btn cancel">取消订单</span>
{{#if payUrl}}
<a class="locHref" href="{{payUrl}}">
<span class="btn pay">立即付款</span>
</a>
{{/if}}
</div>
{{/if}}
... ...
... ... @@ -52,7 +52,7 @@ class HomeController extends AbstractAction
$uid = $this->getUid(true);
if ($uid) {
$data['isLogin'] = true;
$udid = $this->getUdid();
$udid = $this->getUdid();
$data += UserModel::getUserProfileData($uid);
$data += UserModel::getInfoNumData($uid, $udid);
}
... ... @@ -463,18 +463,17 @@ class HomeController extends AbstractAction
*/
public function onlineServiceDetailAction()
{
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
$service = array(
'header' => array('title' => '在线客服'),
$service = array(
'header' => array('title' => '在线客服'),
'pageFooter' => true,
'service' => $service
);
'service' => $service
);
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
... ... @@ -761,7 +760,8 @@ class HomeController extends AbstractAction
$this->setNavHeader('物流详情');
$orderCode = $this->get('order_code');
$data = OrderModel::Logistics($orderCode, $this->_uid);
$data = OrderModel::Logistics($orderCode, $this->_uid);
$data['logisticInfoPage'] = true;
$data['pageFooter'] = true;
... ... @@ -771,18 +771,28 @@ class HomeController extends AbstractAction
/*
* 我的订单-付款跳转页
*/
public function payAction()
{
$this->setTitle('支付');
$this->setNavHeader('支付');
$this->_view->display('pay', array(
'payAppInfo' => array(
0 => array(
'appIcon' => '',
'weixin' => true,
'app' => '微信支付',
'hint' => '需下载微信客户端',
'subHint' => '推荐使用',
),
'appIcon' => '',
'appId' => 'weixin',
'app' => '微信支付',
'hint' => '需下载微信客户端',
'subHint' => '推荐使用',
),
1 => array(
'appIcon' => '',
'appId' => 'baidu',
'app' => '百度支付',
'hint' => '需下载百度支付客户端',
'subHint' => '推荐使用',
),
),
));
}
... ...
... ... @@ -17,13 +17,51 @@ class OrderModel
/**
* 订单相关数据处理
*
* payment_type:
'1' => array(//在线支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'2' => array(//货到付款
0 => '备货中',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'3' => array(//现金支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'4' => array(//抵消支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
)
*/
public static function getOrder($type, $page, $limit, $gender, $yh_channel, $uid)
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, 5772257);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ... @@ -33,7 +71,7 @@ class OrderModel
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $vo['status_str'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
... ... @@ -47,8 +85,8 @@ class OrderModel
break;
}
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
... ... @@ -79,7 +117,8 @@ class OrderModel
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0:
case 0:
$result[$key]['unpaid'] = true;
break;
case 1:
case 2:
... ... @@ -126,7 +165,7 @@ class OrderModel
public static function Logistics($orderCode, $uid)
{
$result = array();
if (isset($orderCode) && is_numeric($uid)) {
$logistics = OrderData::LogisticsData($orderCode, $uid);
if (!empty($logistics['data'])) {
... ... @@ -134,7 +173,7 @@ class OrderModel
$result['logisticImg'] = $logistics['data']['logo'];
$result['logisticCompany'] = $logistics['data']['caption'];
$result['logisticNumber'] = $logistics['data']['express_number'];
$build = array();
foreach ($logistics['data']['express_detail'] as $value) {
$build['status'] = $value['accept_address'];
... ... @@ -143,10 +182,10 @@ class OrderModel
}
}
}
return $result;
}
/**
* 根据type值设置nav属性
*/
... ... @@ -163,7 +202,7 @@ class OrderModel
'name' => $value,
'typeId' => $key,
'active' => $act,
'url' => Helpers::url('/home/order', array('type' => $key))
'url' => Helpers::url('/home/orders', array('type' => $key))
);
}
... ...
... ... @@ -300,8 +300,12 @@ class DetailModel
$referenceName = '参考尺码(女)';
}
$showReference = false;
$sizeNameList = array(0 => array('param' => '吊牌尺码')); // 尺码名称
// 判断是否显示参考尺码
$showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']);
if ($showReference) {
$sizeNameList[1] = array('param' => $referenceName);
}
$referenceList = array();
$sizeBoGroup = array(); // 尺码按ID分组
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
... ... @@ -309,6 +313,9 @@ class DetailModel
}
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
$sizeNameList[] = array('param' => $value['sizeName']);
if (!empty($value['referenceSize']['gender']) && ($value['referenceSize']['gender'] == $gender || $value['referenceSize']['gender'] == 3)) {
$referenceList[] = array('param' => $value['referenceSize']['referenceName']);
}
foreach ($value['sortAttributes'] as $attr) {
$sizeBoGroup[$attr['id']][] = array('param' => $attr['sizeValue']);
}
... ... @@ -316,6 +323,9 @@ class DetailModel
// 根据模板页面的显示,按表格一列一列来显示
$result['sizeInfo']['detail']['list'][0]['params'] = $sizeNameList;
if ($showReference) {
$result['sizeInfo']['detail']['list'][1]['params'] = $referenceList;
}
foreach ($sizeBoGroup as $value) {
$result['sizeInfo']['detail']['list'][]['params'] = $value;
}
... ...
... ... @@ -16,14 +16,20 @@ class LoginController extends AbstractAction
* 登录页
*/
public function indexAction()
{
$this->setTitle('登录');
{
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
$this->setTitle('登录');
$data = array(
'loginIndex' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -47,13 +53,19 @@ class LoginController extends AbstractAction
*/
public function internationalAction()
{
$this->setTitle('国际账号登录');
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
$this->setTitle('国际账号登录');
$data = array();
$data['loginInternational'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
... ... @@ -61,6 +73,7 @@ class LoginController extends AbstractAction
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 渲染模板
$this->_view->display('international', $data);
}
... ... @@ -74,7 +87,7 @@ class LoginController extends AbstractAction
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
LoginData::signoutSession($token);
$this->go($refer);
... ... @@ -127,7 +140,6 @@ class LoginController extends AbstractAction
}
$data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$data['data']['href'] = $refer;
} while (false);
$this->echoJson($data);
... ... @@ -174,14 +186,14 @@ class LoginController extends AbstractAction
if (isset($realName, $email, $userId)) {
$result = LoginData::signinByOpenID($realName, $userId, 'alipay');
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
} else {
$refer = rawurldecode($refer);
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
... ... @@ -201,7 +213,7 @@ class LoginController extends AbstractAction
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
}
$refer = $this->getCookie('refer');
... ... @@ -210,7 +222,7 @@ class LoginController extends AbstractAction
} else {
$refer = rawurldecode($refer);
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
... ... @@ -239,7 +251,7 @@ class LoginController extends AbstractAction
} else {
$refer = rawurldecode($refer);
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
... ...