Authored by biao

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

... ... @@ -10,7 +10,7 @@ var $ = require('jquery'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
orderInfo = require('./order-info').orderInfo;
order = require('./order-info');
var dispatchModeHammer,
dispatchTimeHammer,
... ... @@ -18,10 +18,15 @@ var dispatchModeHammer,
$price = $('.price-cal'),
payType,
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
queryString = $.queryString();
queryString = $.queryString(),
orderInfo = order.orderInfo;
lazyLoad();
if (window.getUid() !== orderInfo('uid')) {
order.init();
}
function dispacthTapEvt(e) {
var $cur = $(e.target).closest('li');
... ... @@ -79,6 +84,9 @@ function orderCompute() {
if (!res) {
tip.show('网络出错');
} else {
if (res.last_order_amount) {
res.last_order_amount = (+res.last_order_amount).toFixed(2);
}
priceHtml = priceTmpl({
sumPrice: res.order_amount,
salePrice: res.discount_amount,
... ...
... ... @@ -6,11 +6,9 @@
var $ = require('jquery');
var info = window.cookie('order-info');
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
function init() {
info = {
uid: window.getUid(),
deliveryId: 1,
deliveryTimeId: 1,
paymentTypeId: 1,
... ... @@ -26,6 +24,15 @@ try {
window.setCookie('order-info', JSON.stringify(info));
}
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
init();
}
exports.init = init;
exports.orderInfo = function(key, value) {
if (value === undefined) {
return info[key];
... ...
... ... @@ -75,6 +75,20 @@
.goods {
margin-right: -20rem / $pxConvertRem;
.price-wrap {
position: static;
text-align: left;
.price {
color: #444;
}
.count {
display: inline;
margin-left: 20rem / $pxConvertRem;
}
}
}
.sale-invoice {
... ... @@ -148,21 +162,27 @@
}
}
.block input {
box-sizing: border-box;
margin: pxToRem(20px) 0;
padding: 0 pxToRem(12px);
width: 100%;
height: pxToRem(60px);
color: #444;
background: #efefef;
font-size: pxToRem(16px);
line-height: 1;
outline: 0;
border: 0;
@include border-radius(4px);
}
#invoice {
input {
width: 100%;
height: pxToRem(90px);
outline: 0;
border: 0;
border-top: 1px solid #f7f7f7;
border-bottom: 1px solid #f7f7f7;
}
border-top: 1px solid #f7f7f7;
label {
position: relative;
width: 100%;
height: pxToRem(90px);
border-bottom: 1px solid #f7f7f7;
display: block;
border-top: 1px solid #f7f7f7;
}
select {
... ... @@ -178,13 +198,7 @@
#msg {
padding-top: pxToRem(20px);
input {
padding: pxToRem(10px);
width: pxToRem(580px);
height: pxToRem(50px);
outline: 0;
border: 0;
border: 1px solid #f7f7f7;
border-radius: pxToRem(4px);
margin: 0;
}
}
... ...
... ... @@ -41,10 +41,10 @@
<section class="block">
<ul class="sale-invoice">
{{# coupon}}
<li class="coupon">
<a href="/cart/index/selectCoupon">
<span class="title">优惠券</span>
<li class="coupon">
<a href="/cart/index/selectCoupon">
<span class="title">优惠券</span>
{{# coupon}}
{{#if count}}
<span class="coupon-count">
{{count}}张可用
... ... @@ -62,13 +62,12 @@
<i class="iconfont">&#xe614;</i>
</span>
{{/if}}
</a>
</li>
{{/coupon}}
{{/coupon}}
</a>
</li>
<li class="coin" data-yoho-coin="{{yohoCoin}}">
<span class="title">YOHO币</span>
<span class="desc">可抵¥{{yohoCoin}}</span>
<span class="desc">可抵¥{{yohoCoin}}</span>
<span class="coin-check">
<em>- ¥ {{yohoCoin}}</em>
<i class="iconfont checkbox icon-cb-checked"></i>
... ...
... ... @@ -466,8 +466,10 @@ class HomeController extends AbstractAction
*/
public function onlineServiceDetailAction()
{
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
$cateInfo = $this->get('cateInfo', '');
$cate = explode("_", $cateInfo);
$cateId = intval($cate[0]);
$cateName = $cate[1];
if ($cateId > 0) {
$service = Home\OnlineModel::getOnlineServiceDetail($cateId);
}
... ... @@ -831,7 +833,7 @@ class HomeController extends AbstractAction
/**
* 订单详情页
*/
public function orderDetailAction()
public function orderdetailAction()
{
// 审判跳转登录页
$this->auditJumpLogin();
... ...
... ... @@ -39,7 +39,7 @@ class OnlineModel
if ($sub) {
foreach ($sub as $sk => $sv) {
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateId' => $sv['id'], 'cateName' => $sv['category_name']));
$qTmp[$sk]['link'] = Helpers::url('/home/onlineservicedetail', array('cateInfo' => $sv['id'].'_'.$sv['category_name']));
}
}
$question[$key]['list'] = $qTmp;
... ...
... ... @@ -80,7 +80,7 @@ class OrderModel
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count);
$result[$key]['detailUrl'] = Helpers::url('/home/orderDetail', array('order_code' => $vo['order_code']));
$result[$key]['detailUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $vo['order_code']));
$result[$key]['count'] = $count;
}
}
... ...
... ... @@ -100,20 +100,23 @@ class UserModel
/**
* 处理个人中心页面优选新品数据
*
* @param int $yh_channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
* @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
* @return array|mixed 处理之后的个人中心页面优选新品数据
*/
public static function getPreferenceData($yh_channel)
public static function getPreferenceData($channel)
{
$result = array();
// 调用接口获取个人中心页面优选新品数据
$preferenceData = UserData::preference($yh_channel);
$preferenceData = UserData::preference($channel);
// 处理个人中心页面优选新品数据
if (isset($preferenceData['data']) && !empty($preferenceData['data'])) {
foreach ($preferenceData['data'] as $val) {
$result['recommendList'][] = Helpers::formatProduct($val, false, true, true, 299, 388, false, false);
if (!empty($preferenceData['data'])) {
foreach ($preferenceData['data'] as $value) {
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
if (false !== $value) {
$result['recommendList'][] = $value;
}
}
}
... ...
... ... @@ -33,12 +33,6 @@ class DetailModel
// 调用服务
$baseInfo = DetailData::baseInfo($productId, $uid);
// // 因PC目前是不判断的,先保持一致,以后有需要,可以去掉
// // 判断商品是否在架
// if (empty($baseInfo['status'])) {
// return $result;
// }
// 商品名称
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
... ... @@ -241,7 +235,7 @@ class DetailModel
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'], // 库存量
);
$soldOut = ($baseInfo['storage'] == 0) || ($totalStorageNum === 0);
$soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0);
$notForSale = $baseInfo['attribute'] == 2;
// 显示加入购物车链接
if (!$soldOut && !$notForSale) {
... ... @@ -556,7 +550,10 @@ class DetailModel
$preference = DetailData::preference($productSkn, $channel, $brandId);
if (!empty($preference)) {
foreach ($preference as $value) {
$result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
if (false !== $value) {
$result['recommendList'][] = $value;
}
}
}
}
... ...
... ... @@ -356,7 +356,8 @@ class IndexController extends AbstractAction
}
if (empty($result)) {
echo ' ';
// 这儿需要返回空数组,勿改!!!
echo '[]';
} else {
$this->echoJson($result);
}
... ...
... ... @@ -108,7 +108,7 @@ routes.girls.type = "rewrite"
routes.girls.match = "/girl$"
routes.girls.route.module = Index
routes.girls.route.controller = Girls
routes.girls.route.action = index
routes.girls.route.action = Index
; 商品筛选
routes.goodsfilter.type = "rewrite"
... ... @@ -147,3 +147,9 @@ routes.productintro.route.controller = Detail
routes.productintro.route.action = Intro
routes.productintro.map.1 = productSkn
; 订单相关
routes.cart.type = "rewrite"
routes.cart.match = "/home/order/detail$"
routes.cart.route.module = Index
routes.cart.route.controller = Home
routes.cart.route.action = Homedetail
\ No newline at end of file
... ...