Authored by 梁志锋

merge 4.7

存放PC模板的预编译文件
\ No newline at end of file
... ... @@ -214,4 +214,23 @@ class OrderData
return Yohobuy::get(API_URL, $param);
}
/*
* 删除订单
*/
public static function deleteOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.delOrderByCode';
$param['client_secret'] = Sign::getSign($param);
//调用接口删除订单
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -236,6 +236,39 @@ class ReturnsData
return Yohobuy::post(API_URL, $param);
}
/**
* 取消退货申请
* @param $id
* @param $uid
* @return mixed
*/
public static function cancelRefund($id, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.refund.cancel';
$param['id'] = $id;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(API_URL, $param);
}
/**
* 取消换货申请
* @param $id
* @param $uid
* @return mixed
*/
public static function cancelChange($id, $uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.change.cancel';
$param['id'] = $id;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(API_URL, $param);
}
/**
* 获取换货方式
* @param $uid
... ...
... ... @@ -326,4 +326,19 @@ class ItemData
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(API_URL, $param);
}
/**
* 商品促销信息
* @param $skn 商品 skn
* @return mixed
*/
public static function promotion($skn)
{
$param = Yohobuy::param();
$param['method'] = 'app.product.promotion';
$param['product_skn'] = $skn;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
\ No newline at end of file
... ...
... ... @@ -270,4 +270,4 @@ class PhpLog
return "$time, " . "LOG, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------";
}
}
}
\ No newline at end of file
}
... ...
... ... @@ -283,7 +283,7 @@
<dl class="play-piao-pan pan">
<dt>索要发票</dt>
<dd>
<div class="play-pan">
<div class="play-pan">
<ul>
<li><label>发票抬头 :</label><input type="text" class="textbox" id="piaodesc" /></li>
<li><label>发票类型 :</label> <select class="dropdown" id="piaotype">
... ... @@ -293,7 +293,7 @@
{{/each}}
</select> </li>
</ul>
</div>
</div>
</dd>
</dl>
<dl class="play-remark-pan pan">
... ... @@ -393,5 +393,6 @@
</div>
{{/ orderEnsure}}
<div class="loading"><span></span>请稍后...</div>
</div>
{{> layout/footer}}
... ...
... ... @@ -56,7 +56,7 @@
{{> home/pager}}
</div>
{{> home/help-us}}
{{!> home/help-us}}
</div>
{{/ meOrders}}
</div>
... ...
... ... @@ -13,7 +13,8 @@
{{# exchange}}
<div class="return-prompt">
换货须知:<br>
<p>自您签收商品7日内可以退货,15日内可以换货,在商品不影响二次销售的情况下(包括产品吊牌和外包装),YOHO!BUY 有货将为您办理退换货服务,请在网站提交"退换货"申请。<span>特别提醒:非质量问题的退换货,来回运费由您承担。寄回商品时需垫付运费,到付件无法签收。</span>换货后VIP积分累计时间重新计算,以您收到换货订单后15个工作日累加,如有疑问,请致电客服电话:400-889-9646。</p>
<p>自您签收商品7日内可以退货,15日内可以换货,在商品不影响二次销售的情况下(包括产品吊牌和外包装),YOHO!有货将为您办理退换货服务,请在网站提交"退换货"申请。<span>特别提醒:非质量问题的退换货,来回运费由您承担。寄回商品时需垫付运费,到付件无法签收。</span>换货后VIP积分累计时间重新计算,以您收到换货订单后15个工作日累加,如有疑问,请联系 <a
href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=" target="_blank"><i class="icon-onlineservice"></i> 在线客服</a></p>
{{# tips}}
{{> home/return-tips}}
{{/ tips}}
... ... @@ -43,6 +44,15 @@
<td class="return-goods-info">
<a href="{{href}}">{{name}}</a>
<span>颜色:{{color}} 尺码:{{size}}</span>
{{#if specialNoticeBo}}
<div class="special-tip">
<span>{{specialNoticeBo.title}} <i class="doubt"></i></span>
<div class="special-content">
<span>{{specialNoticeBo.remark1}}<br/>{{specialNoticeBo.remark2}}</span>
<i class="arrow"></i>
</div>
</div>
{{/if}}
</td>
{{#if banMsg}}
... ... @@ -79,7 +89,7 @@
<option value="0">请选择换货原因</option>
{{#with exchange}}
{{# reason}}
<option value="{{id}}">{{name}}</option>
<option value="{{id}}" {{#if inactive}}disabled{{/if}}>{{name}}</option>
{{/ reason}}
{{/with}}
</select>
... ... @@ -135,7 +145,8 @@
{{# refund}}
<div class="return-prompt">
退货须知:<br>
<p>自您签收商品7日内可以退货,15日内可以换货,在商品不影响二次销售的情况下(包括产品吊牌和外包装),YOHO!BUY 有货将为您办理退换货服务,请在网站提交"退换货"申请。如您退货之后无法满足购买时参加的活动条件,请您将赠品同时申请退货。<span>特别提醒:非质量问题的退换货,来回运费由您承担,寄回商品时需垫付运费,到付件无法签收,如有疑问,请致电客服电话:400-889-9646。</span></p>
<p>自您签收商品7日内可以退货,15日内可以换货,在商品不影响二次销售的情况下(包括产品吊牌和外包装),YOHO!有货将为您办理退换货服务,请在网站提交"退换货"申请。如您退货之后无法满足购买时参加的活动条件,请您将赠品同时申请退货。<span>特别提醒:非质量问题的退换货,来回运费由您承担,寄回商品时需垫付运费,到付件无法签收,如有疑问,请联系 <a
href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=" target="_blank"><i class="icon-onlineservice"></i> 在线客服</a> </span></p>
{{# tips}}
{{> home/returns-tips}}
{{/ tips}}
... ... @@ -164,6 +175,15 @@
<td class="return-goods-info">
<a href="{{href}}">{{name}}</a>
<span>颜色:{{color}} 尺码:{{size}}</span>
{{#if specialNoticeBo}}
<div class="special-tip">
<span>{{specialNoticeBo.title}} <i class="doubt"></i></span>
<div class="special-content">
<span>{{specialNoticeBo.remark}}</span>
<i class="arrow"></i>
</div>
</div>
{{/if}}
</td>
<td class="refund-price">
{{price}}
... ... @@ -176,7 +196,7 @@
<option value="0">请选择退货原因</option>
{{#with refund}}
{{# reason}}
<option value="{{id}}">{{name}}</option>
<option value="{{id}}" {{#if inactive}}disabled{{/if}}>{{name}}</option>
{{/ reason}}
{{/with}}
</select>
... ... @@ -253,7 +273,7 @@
</div>
</div>
</div>
{{> home/help-us}}
{{!> home/help-us}}
</div>
{{/ returns}}
</div>
... ...
... ... @@ -21,6 +21,11 @@
{{/ statusList}}
</ul>
</div>
{{#if canCancelUrl}}
<div class="cancel-return">
如果您不想退货了,您可以 <a href="javascript:;" data-id="{{returnId}}" class="cancel-trigger" data-url="{{canCancelUrl}}">取消申请</a>
</div>
{{/if}}
<div class="detail-container">
{{# express}}
<h2>请填写寄回快递单号,以便我们查询</h2>
... ... @@ -79,7 +84,7 @@
</div>
{{/ detail}}
</div>
{{> home/help-us}}
{{!> home/help-us}}
</div>
{{/ returns}}
</div>
... ...
... ... @@ -65,8 +65,9 @@
<div class="return-status">
{{returnStatus}}
</div>
<div class="operation">
<a class="op-item" href="{{moreHref}}" target="_blank">查看详情</a>
<div class="operation {{#if canCancelUrl}}cancel-return{{/if}}">
{{#if canCancelUrl}}<a class="op-item cancel-trigger" href="javascript:;" data-id="{{returnId}}" data-url="{{canCancelUrl}}">取消申请</a>{{/if}}
<a class="op-item" href="{{moreHref}}" target="_blank">查看详情</a>
</div>
</div>
</div>
... ... @@ -77,7 +78,7 @@
{{> home/pager}}
</div>
{{> home/help-us}}
{{!> home/help-us}}
</div>
{{/ returns}}
</div>
... ...
... ... @@ -17,7 +17,10 @@
<div class="order" data-id="{{orderNum}}">
<p class="order-title">
订单编号:{{orderNum}}
<span class="right">下单时间:{{orderTime}}</span>
<span class="order-time">下单时间:{{orderTime}}</span>
{{#if canDelete}}
<a class="right order-delete" href="javascript:;">删除订单</a>
{{/if}}
</p>
<div class="order-wrap">
<ul>
... ... @@ -30,7 +33,7 @@
</a>
<div class="text-info">
{{#if refundStatus}}
<span class="had-refund">已退换</span>
<a href="{{goRefundUrl}}"><span class="had-refund">已退换</span></a>
{{/if}}
<a class="name" href="{{href}}" target="_blank">{{name}}</a>
<span class="color-size">
... ... @@ -63,6 +66,9 @@
<div class="pay">
{{pay}}
<span class="pay-tip">(含快递:{{fregit}}元)</span>
{{#if isExchanged}}
<span class="return-order">换货订单</span>
{{/if}}
</div>
<div class="order-status">
{{#if noPay}}
... ... @@ -125,6 +131,9 @@
{{/if}}
{{/if}}
{{/if}}
{{#if hasDelete}}
<span class="op-item restore-order">还原订单</span>
{{/if}}
{{/ operation}}
</div>
</div>
... ... @@ -132,4 +141,5 @@
{{/ orders}}
{{/if}}
</div>
{{> home/order-cancel-tpl}}
\ No newline at end of file
{{> home/order-cancel-tpl}}
{{> home/order-delete-confirm}}
\ No newline at end of file
... ...
<ul class="tabs clearfix">
{{# tabs}}
<div class="tabs-wrapper">
<ul class="tabs clearfix">
{{# tabs}}
<li {{#if active}}class="active"{{/if}}>
<a href="{{url}}">{{name}}</a>
<a href="{{url}}">{{name}}</a>
</li>
{{/ tabs}}
</ul>
\ No newline at end of file
{{/ tabs}}
</ul>
</div>
... ...
... ... @@ -13,52 +13,48 @@ var Dialog = dialog.Dialog;
var Confirm = dialog.Confirm;
var $tpl = $('#cancel-dialog-tpl');
var deleteDialog = '<div class="order-delete-confirm">' +
'<div class="header">' +
'<p>删除订单</p>' +
'<a href="javascript:;" title="关闭"></a>' +
'</div>' +
'<div class="body">' +
'<p class="confirm-tip"><i class="icon-doubt"></i>{{deleteMessage}}</p>' +
'<p class="delete-tip">{{deleteTip}}</p>' +
'</div>' +
'</div>';
var html = $tpl.html();
var active;
var dialogMessage = '<p class="message-title"><i class="order-icon {{messageIcon}}"></i>{{messageTitle}}</p><p class="message-summary">{{messageSummary}}</p>';
var $dialogEdit = $('#edit-dialog-tpl');
var $addressManage, $province, $city, $county, $selectList, $name, $phone, $address, $telCode, $tel, isProvinceChecked = false;
;
function cancelFactory(id) {
var options = {
mask: true,
mask: false,
btns: [
{
id: 'cancel-sure',
name: '确定并取消订单',
btnClass: ['cancel-sure'],
cb: function() {
cb: function () {
var $checked = $('.cancel-dialog :checked');
var $tip = $('.cancel-dialog .cancel-tip');
var text = '';
if ($checked.val() === '10') {
text = $checked.parent().find('#reason_other').val();
} else {
text = $checked.siblings('label').text();
}
if ($checked.length === 0) {
$tip.html('请选择要取消订单的原因');
return;
}
$.ajax({
type: 'POST',
url: '/home/orders/cancelorder',
data: {
orderCode: id,
reasonId: $checked.val(),
reason: text
reason: $checked.val()
}
}).then(function(data) {
}).then(function (data) {
if (data.code === 200) {
active.close();
active = showMessgaeDialog('icon-success', '订单修改', '您已成功取消了该订单', function() {
location.reload(true);
});
active.show();
history.go(0);
} else {
$tip.html(data.message);
}
... ... @@ -67,9 +63,9 @@ function cancelFactory(id) {
},
{
id: 'cancel-no',
name: '暂不取消',
name: '取消',
btnClass: ['cancel-no'],
cb: function() {
cb: function () {
active.close();
}
}
... ... @@ -81,91 +77,37 @@ function cancelFactory(id) {
return new Dialog(options);
}
function showMessgaeDialog(message_icon, message_title, message_summary, cb) {
var template = Handlebars.compile(dialogMessage);
var html = template({messageIcon: message_icon, messageTitle: message_title, messageSummary: message_summary});
var options = {
mask: true,
btns: [
{
id: 'message-sure',
name: '确定',
btnClass: ['message-sure'],
cb: function() {
active.close();
cb && cb();
}
}
],
content: html,
className: 'message-dialog',
};
return new Dialog(options);
}
// 编辑订单
function editOrder(id) {
var options = {
mask: true,
btns: [
{
id: 'edit-sure',
name: '确定',
btnClass: ['edit-sure'],
cb: function() {
saveAddress(id);
}
},
{
id: 'edit-no',
name: '取消',
btnClass: ['edit-no'],
cb: function() {
active.close();
}
}
],
content: $dialogEdit.html(),
className: 'edit-order-dialog'
};
return new Dialog(options);
}
$tpl.remove();
$dialogEdit.remove();
//查看物流
$('.check-logistics').click(function() {
$('.check-logistics').click(function () {
$(this).siblings('.logistics').removeClass('hide');
});
$('.close-logistics').click(function() {
$('.close-logistics').click(function () {
$(this).closest('.logistics').addClass('hide');
});
//订单列表&订单详情【取消订单和确认收货】
$('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
$('.me-orders, .order-detail').on('click', '.cancel-order', function (e) {
//取消订单
active = cancelFactory($(this).closest('.order, .order-detail').data('id'));
active.show();
}).on('click', '.confirm-received', function(e) {
}).on('click', '.confirm-received', function (e) {
var id = $(this).closest('.order, .order-detail').data('id');
//确认收货
active = new Confirm({
cb: function() {
cb: function () {
$.ajax({
type: 'POST',
url: '/home/orders/confirmorder',
data: {
orderCode: id
}
}).then(function(data) {
}).then(function (data) {
if (data.code === 200) {
active.close();
history.go(0);
... ... @@ -175,331 +117,57 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
content: '您确定要确认收货吗?'
});
active.show();
}).on('click', '.edit-order', function() {
$(this).addClass('edit-order-active');
active = editOrder($(this).closest('.order, .order-detail').data('id'))
}).on('click', '.order-delete', function () {
var id = $(this).closest('.order, .order-detail').data('id');
active = deleteOrder(id, this);
active.show();
newAddress(0);
});
// 地址操作
function newAddress(id) {
var code, codeId;
var pId = id || 0; //如果没有传id则获取所有省列表
var addressCodeReg = /[0-9]{2}/gi;
$addressManage = $('.edit-order-dialog');
$province = $addressManage.find('select[name="province"]');
$city = $addressManage.find('select[name="city"]');
$county = $addressManage.find('select[name="county"]');
$selectList = $addressManage.find('select[name="province"],select[name="city"]');
$name = $addressManage.find('.inp[name="name"]');
$phone = $addressManage.find('.inp[name="phone"]');
$address = $addressManage.find('.inp[name="address"]');
$telCode = $addressManage.find('.inp[name="tel-code"]');
$tel = $addressManage.find('.inp[name="tel"]');
var validate = validateForm();
code = $province.data("areacode") + '';
codeId = !!code && code.match(addressCodeReg);
//获取省
getAddress({
id: pId,
type: 'getProvince',
selectId: codeId[0]
}, function() {
var provinceId = $province.val();
if (provinceId !== '0') {
isProvinceChecked = true;
//如果获取的省有默认选中项则获取市
getAddress({
id: provinceId,
type: 'getCity',
selectId: '' + codeId[0] + codeId[1]
}, function() {
var cityId = $city.val();
//如果获取的市有默认选中项则获取县
if (cityId !== '0') {
getAddress({
id: cityId,
type: 'getCounty',
selectId: code
function deleteOrder(id, obj) {
// 是否为彻底删除
var isFullyDelete = true;
var $order = $(obj).parents(".order");
var deleteMessage = isFullyDelete ? "您确定要永久删除订单吗?" : "您确定要删除订单吗?";
var deleteTip = isFullyDelete ? "永久删除后,订单将无法恢复,您将无法对该订单的商品申请售后服务,请谨慎操作。" : "删除后,您可以在订单回收站找回该订单,也可以做永久删除。";
var insert = Handlebars.compile(deleteDialog);
var html = insert({deleteMessage: deleteMessage, deleteTip: deleteTip});
var options = {
mask: false,
btns: [
{
id: 'delete-sure',
name: '确定',
btnClass: ['delete-sure'],
cb: function () {
$.ajax({
type: 'POST',
url: '/home/orders/delOrder',
data: {
orderCode: id,
isFullyDelete: isFullyDelete,
}
}).then(function (data) {
if (data.code === 200) {
active.close();
$order.remove();
location.reload();
}else{
active.close();
new dialog.Alert(data.message).show();
}
});
}
});
} else {
$addressManage.find('select[name="city"]').html('<option value="0">请选择城市</option>');
$addressManage.find('select[name="county"]').html('<option value="0">请选择区县</option>');
}
});
// 发生change事件时获取下一级地址
$selectList.change(function() {
var $this = $(this);
if ($this.attr('name') === 'province') {
if ($this.val() === '0') {
$addressManage.find('select[name="city"]').html('<option value="0">请选择城市</option>');
$addressManage.find('select[name="county"]').html('<option value="0">请选择区县</option>');
} else {
getAddress({
id: $this.val(),
type: 'getCity'
}, function() {
isProvinceChecked = true;
});
$addressManage.find('select[name="county"]').html('<option value="0">请选择区县</option>');
}
}
if ($this.attr('name') === 'city' && isProvinceChecked) {
if ($this.val() === '0') {
$addressManage.find('select[name="county"]').html('<option value="0">请选择区县</option>');
} else {
getAddress({
id: $this.val(),
type: 'getCounty'
});
}
}
});
$name.on('blur', function() {
validate.name($.trim($name.val()));
});
$address.on('blur', function() {
validate.address($.trim($address.val()));
});
$phone.on('blur', function() {
validate.mobile($.trim($phone.val()));
});
$tel.on('blur', function() {
validate.tel($.trim($telCode.val()), $.trim($tel.val()));
})
$county.on('change', function() {
validate.city($province.val(), $city.val(),$county.val());
})
}
/**
* @description: 改函数会返回地址信息
* d {Object} type: 'getProvince'获取省 type: 'getCity'获取城市 type: 'getCounty'获取县
* id: 0 && type: 'getProvince' 获取所有省,默认没有选中项
* id !== 0 && type: 'getProvince' 获取所有省,默认选中用户所在的省
*/
function getAddress(d, callback) {
var $obj;
var selectId = d.selectId;
if (d.type === 'getProvince') {
//url = 'getProvince';
$obj = $province;
} else if (d.type === 'getCity') {
//url = 'getCity';
$obj = $city;
} else if (d.type === 'getCounty') {
//url = 'getCounty';
$obj = $county;
}
$.ajax({
type: 'GET',
url: '/cart/index/getAreaList',
dataType: 'json',
data: {
id: d.id * 1
}
}).then(function(d) {
structureOption($obj, d.data, selectId);
if (typeof callback === 'function') {
callback();
}
});
}
// 构建select下拉选项
function structureOption($obj, data, selectId) {
var i,
optionHtml = '',
defaultOption,
isStar = '';
for (i = 0; i < data.length; i++) {
if (data[i].is_support_express === 'Y') {
isStar = '*';
} else {
isStar = '';
}
if (data[i].id === selectId) {
optionHtml += '<option selected value="' + data[i].id + '">' + isStar + data[i].caption + '</option>';
} else {
optionHtml += '<option value="' + data[i].id + '">' + isStar + data[i].caption + '</option>';
}
}
if ($obj.attr('name') === 'province') {
defaultOption = '<option value="0">请选择省份</option>';
} else if ($obj.attr('name') === 'city') {
defaultOption = '<option value="0">请选择城市</option>';
} else if ($obj.attr('name') === 'county') {
defaultOption = '<option value="0">请选择区县</option>';
}
$obj.html(defaultOption + optionHtml);
}
// 保存地址
function saveAddress(id) {
var name = $name.val(),
province = $province.val(),
city = $city.val(),
county = $county.val(),
address = $address.val(),
phone = $phone.val(),
telCode = $telCode.val(),
tel = $tel.val();
// var $err_name = $name.siblings('.error'),
// $err_province = $province.siblings('.error'),
// $err_address = $address.siblings('.error'),
// $err_phone = $phone.siblings('.error'),
// $err_tel = $tel.siblings('.error');
var postData = {
orderCode: id,
userName: name,
areaCode: county,
address: address,
mobile: phone,
phoneCode: telCode,
phoneNum: tel
};
var validate = validateForm();
if (!validate.name(name) || !validate.city(province, city, county) || !validate.address(address) || !validate.mobile(phone) || !validate.tel(telCode, tel)) {
return;
}
$.ajax({
type: 'post',
url: '/home/orders/modifyAddress',
data: postData
}).then(function(d) {
if (d.code === 200) {
active.close();
active = showMessgaeDialog('icon-waiting', '订单修改', '您的订单正在尝试修改,请耐心等待。稍后可在订单详情页查看修改情况!', function() {
location.reload(true);
});
active.show();
} else {
new dialog.Alert(d.message).show();
}
})
}
function validateForm() {
var $err_name = $name.siblings('.error'),
$err_province = $province.siblings('.error'),
$err_address = $address.siblings('.error'),
$err_phone = $phone.siblings('.error'),
$err_tel = $tel.siblings('.error');
var nameReg = /^[\u4e00-\u9fa5]{2,5}$/;
var addressReg = /^[a-zA-Z0-9-#()()\u4e00-\u9fa5]+$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var telCodeReg = /^[0-9]{3,4}$/;
var telReg = /^[0-9]{8}$/;
var _right_html = '<i class="order-icon icon-right"></i>';
var _error_html = '<i class="order-icon icon-error"></i><b></b>';
return {
name: function(name) {
if (!nameReg.test(name)) {
$err_name.html(_error_html);
$err_name.find('b').html('真实姓名至少2个中文,最多5个中文');
$err_name.show();
return false;
} else {
$err_name.html(_right_html).show();
return true;
}
},
city: function(province, city, county) {
if (province === '0' || city === '0' || county === '0') {
$err_province.html(_error_html);
$err_province.find('b').html('请填写完整的省市区信息');
$err_province.show();
return false;
} else {
$err_province.html(_right_html).show();
return true;
}
},
address: function(address) {
if (!addressReg.test(address)) {
var message = '详细地址不能为空';
if ($.trim(address) !== '') {
message = '只能包含数字、字母、汉字、#、-、()及其组合';
}
$err_address.html(_error_html);
$err_address.find('b').html(message);
$err_address.show();
return false;
} else {
$err_address.html(_right_html).show();
return true;
}
},
mobile: function(phone) {
if (!phoneReg.test(phone)) {
var message = '手机号码不能为空';
if ($.trim(phone) !== '') {
message = '你输入的联系电话格式不正确';
},
{
id: 'delete-no',
name: '取消',
btnClass: ['delete-no'],
cb: function () {
active.close();
}
$err_phone.html(_error_html);
$err_phone.find('b').html(message);
$err_phone.show();
return false;
} else {
$err_phone.html(_right_html).show();
return true;
}
},
tel: function(telCode, tel) {
if(telCode === '' && tel === ''){
_right_html = '';
}
if ((!!telCode && !telCodeReg.test(telCode)) || (!!tel && !telReg.test(tel)) ||
(telCodeReg.test(telCode) && !telReg.test(tel)) ||
(!telCodeReg.test(telCode) && telReg.test(tel))) {
$err_tel.html(_error_html);
$err_tel.find('b').html('你输入的电话格式不正确');
$err_tel.show();
return false;
} else {
$err_tel.html(_right_html).show();
return true;
}
}
}
}
],
content: html,
className: 'delete-dialog',
};
return new Dialog(options);
}
\ No newline at end of file
... ...
... ... @@ -44,6 +44,19 @@ if (defaultPhone) {
$exchange.find('input[name="phone"]').val(disPhone);
}
$goodsTable.on('mouseenter mouseleave', '.doubt', function(e) {
var $this = $(this);
var $tipwrapper = $this.parents('.special-tip');
var $tipcontent = $tipwrapper.find('.special-content');
var width = $tipwrapper.find('> span').width();
if(e.type === 'mouseenter'){
$tipcontent.css({left: width+10,zIndex:1}).show();
}else if(e.type ==='mouseleave'){
$tipcontent.css({zIndxex:0}).hide();
}
});
function syncRefundMode(code) {
$.ajax({
type: 'POST',
... ...
... ... @@ -4,7 +4,9 @@
* @date: 2016/2/26
*/
var $ = require('yoho.jquery');
var $ = require('yoho.jquery'),
Handlebars = require('yoho.handlebars'),
dialog = require('../common/dialog');
var $returnState = $('.visual-return-state li'),
$detail = $('.detail-container'),
... ... @@ -20,6 +22,10 @@ var returnId = $('#return-id').val(),
expList = {},
isChange = false;
var Dialog = dialog.Dialog,
active,
cancelApplyDialog = '<p class="message-title"><i class="{{messageIcon}}"></i>{{messageTitle}}</p><p class="message-summary">{{messageSummary}}</p>';;
function syncExpressInfo() {
expCompany = expList[expId] ? expList[expId] : '';
$expressViewBox.html(expCompany + ' 快递单号:' + expNumber);
... ... @@ -74,6 +80,49 @@ function sendExpressCode() {
});
}
function cancelApply(id, url) {
var template = Handlebars.compile(cancelApplyDialog);
var html = template({messageIcon: 'icon-warn', messageTitle: '取消申请', messageSummary: '您确定要请取消申请吗?'});
var options = {
mask: true,
btns: [
{
id: 'cancel-sure',
name: '确定',
btnClass: ['cancel-sure'],
cb: function() {
$.ajax({
type: 'POST',
url: url,
data: {
id: id
}
}).then(function(data) {
active.close();
if (data.code === 200) {
location.reload();
} else {
new dialog.Alert(data.message).show();
}
});
}
},
{
id: 'cancel-no',
name: '取消',
btnClass: ['cancel-no'],
cb: function() {
active.close();
}
}
],
content: html,
className: 'cancel-dialog'
};
return new Dialog(options);
}
if ($detail.parent().hasClass('exchange-detail')) {
isChange = true;
}
... ... @@ -92,4 +141,9 @@ $('#modify').click(function() {
$('#submit-btn').click(function() {
sendExpressCode();
});
\ No newline at end of file
});
$('.cancel-return').on('click', '.cancel-trigger', function() {
active = cancelApply($(this).data('id'), $(this).data('url'));
active.show();
})
\ No newline at end of file
... ...
... ... @@ -11,8 +11,8 @@ var dialog = require('../common/dialog');
var accMul = function(arg1, arg2) {
var m = 0,
s1 = arg1.toString(),
s2 = arg2.toString();
s1 = arg1.toString(),
s2 = arg2.toString();
try {
m += s1.split('.')[1].length;
... ...
... ... @@ -32,6 +32,11 @@ class OrderModel
foreach ($orderInfo['data']['order_list'] as $orderK => $orderV) {
$orders[$orderK]['orderNum'] = $orderV['order_code']; //订单标识
$orders[$orderK]['orderTime'] = date("Y-m-d H:i:s", $orderV['create_time']); //下单时间
// $orders[$orderK]['hasDelete'] = true; //彻底删除
//删除订单
if($orderV['is_cancel'] == 'Y' || $orderV['status'] === 6) {
$orders[$orderK]['canDelete'] = true; //删除订单
}
$statusInfo = self::getOrderStatus($orderV['is_cancel'], $orderV['status'], $orderV['payment_type'], $orderV['payment_status']);
//订单状态
if ($statusInfo['cancel']) {
... ... @@ -64,6 +69,7 @@ class OrderModel
$goods[$gokey]['count'] = $buyNum;
$refundStatus = ($refundNum > 0) ? true : false; //只要发生一件退换,退换过的标记
$goods[$gokey]['refundStatus'] = $refundStatus;
$goods[$gokey]['goRefundUrl'] = Helpers::url('/home/returns');
$refundFlag[] = (($buyNum == $refundNum) && $refundNum > 0) ? 'finished' : 'unfinished'; //某一件商品全部退换结束
$goods[$gokey]['arrivalDate'] = $goval['expect_arrival_time'];
$goodsTagName = self::getGoodsTag($orderV['attribute'], $goval['goods_type']);
... ... @@ -80,6 +86,11 @@ class OrderModel
}
//操作
$orders[$orderK]['operation'] = self::getOperateInfo($orderV['attribute'], $orderV['is_cancel'], $orderV['status'], $orderV['payment_status'], $orderV['update_time'], $orderV['order_type'], $orderV['refund_status'], $orderV['payment_type'], $orderV['order_code'], $opRefundStatus);
// tar add 160701 换货订单标记
if ($orderV['order_type'] === 7) {
$orders[$orderK]['isExchanged'] = true;
}
}
if ($isPage) {
$orders['pager']['total'] = $orderInfo['data']['total'];
... ...
... ... @@ -6,7 +6,7 @@ use LibModels\Web\Home\ReturnsData;
use WebPlugin\Helpers;
use WebPlugin\HelperSearch;
use WebPlugin\Images;
use LibModels\Web\Home\OrderData;
use LibModels\Wap\Home\OrderData;
use Api\Yohobuy;
/**
... ... @@ -34,25 +34,32 @@ class ReturnsModel
if (isset($returnsData['code']) && $returnsData['code'] == 200 && !empty($returnsData['data']['list'])) {
//设置分页
$pager = self::setPager($returnsData['data']['page'], $returnsData['data']['total'], $returnsData['data']['total_page'], $limit);
foreach($returnsData['data']['list'] as $key => $value){
foreach ($returnsData['data']['list'] as $key => $value) {
$param = array(
'id' => $value['id']
);
$list[$key]['returnId'] = $value['id'];
$list[$key]['orderNum'] = $value['order_code'];
$list[$key]['orderTime'] = str_replace('-','/',$value['order_create_time']);
$list[$key]['orderTime'] = str_replace('-', '/', $value['order_create_time']);
$list[$key]['returnTime'] = $value['create_time'];
if ($value['refund_type'] == 1) {
if ($value['refund_type'] == 1) { // tar note 160624 终止退货
$list[$key]['isChange'] = false;
$uri = '/home/returns/refundDetail';
}elseif ($value['refund_type'] == 2) {
if ($value['canCancel'] === 'Y') {
$list[$key]['canCancelUrl'] = Helpers::url('/home/returns/cancelRefund');
}
} elseif ($value['refund_type'] == 2) { // tar note 160624 终止换货
$list[$key]['isChange'] = true;
$uri = '/home/returns/exchangeDetail';
if ($value['canCancel'] === 'Y') {
$list[$key]['canCancelUrl'] = Helpers::url('/home/returns/cancelChange');
}
}
$list[$key]['returnStatus'] = $value['status_name'];
$param = array(
'id' => $value['id']
);
$list[$key]['moreHref'] = Helpers::url($uri,$param);
$list[$key]['moreHref'] = helpers::url($uri, $param);
$list[$key]['goods'] = self::getGoodsData($value['goods']);
}
}else{
} else {
$list = array(
'empty' => '您没有退/换货订单'
);
... ... @@ -62,8 +69,8 @@ class ReturnsModel
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'orders' => $list,
'userThumb' => UserModel::getUserHeadImg($uid),
'pager' => $pager
... ... @@ -97,13 +104,17 @@ class ReturnsModel
$detail['express']['number'] = isset($res['notice']['express_number']) ? $res['notice']['express_number'] : '';
$detail['express']['id'] = isset($res['notice']['express_id']) ? $res['notice']['express_id'] : '';
}
foreach($res['statusList'] as $key=>$value){
$detail['statusList'][$key]['act'] = ($value['act' ] == 'Y') ? true : false;
foreach ($res['statusList'] as $key => $value) {
$detail['statusList'][$key]['act'] = ($value['act'] == 'Y') ? true : false;
$detail['statusList'][$key]['name'] = $value['name'];
}
$detail['goods'] = self::getDetailGoods($res['goods_list']);
$detail['expressList'] = self::getExpressCompany();
}else{
if ($res['canCancel'] === 'Y') {
$detail['canCancelUrl'] = Helpers::url('/home/returns/cancelChange');
}
} else {
return false;
}
... ... @@ -111,10 +122,10 @@ class ReturnsModel
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'userThumb' => UserModel::getUserHeadImg($uid),
'detail'=>$detail
'detail' => $detail
);
return $data;
... ... @@ -145,7 +156,7 @@ class ReturnsModel
$detail['express']['company'] = isset($res['notice']['express_company']) ? $res['notice']['express_company'] : '';
$detail['express']['number'] = isset($res['notice']['express_number']) ? $res['notice']['express_number'] : '';
}
foreach($res['statusList'] as $key=>$value){
foreach ($res['statusList'] as $key => $value) {
$detail['statusList'][$key]['act'] = ($value['act'] == 'Y') ? true : false;
$detail['statusList'][$key]['name'] = $value['name'];
}
... ... @@ -153,17 +164,21 @@ class ReturnsModel
$detail['backMode'] = isset($res['return_amount_mode_name']) ? $res['return_amount_mode_name'] : '';
$detail['goods'] = self::getDetailGoods($res['goods_list']);
$detail['expressList'] = self::getExpressCompany();
}else{
if ($res['canCancel'] === 'Y') {
$detail['canCancelUrl'] = Helpers::url('/home/returns/cancelRefund');
}
} else {
return false;
}
//面包屑-左侧导航
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'userThumb' => UserModel::getUserHeadImg($uid),
'detail'=>$detail
'detail' => $detail
);
return $data;
... ... @@ -184,7 +199,7 @@ class ReturnsModel
$cnAlphabet = $value['cn_alphabet'];
}
$result[$key]['href'] = Helpers::getUrlBySkc($value['product_id'], $value['goods_id'], $cnAlphabet);
$result[$key]['thumb'] = Helpers::getImageUrl($value['goods_image'],60,60);
$result[$key]['thumb'] = Helpers::getImageUrl($value['goods_image'], 60, 60);
$result[$key]['name'] = $value['product_name'];
$result[$key]['color'] = $value['color_name'];
$result[$key]['size'] = $value['size_name'];
... ... @@ -241,7 +256,7 @@ class ReturnsModel
$expressList = ReturnsData::getExpressCompany();
if (isset($expressList['code']) && $expressList['code'] == 200) {
$result = array_values($expressList['data']);
foreach($result as $key=>$value){
foreach ($result as $key => $value) {
$res = array_merge_recursive($res, $value);
}
}
... ... @@ -260,9 +275,9 @@ class ReturnsModel
* @param $isChange
* @return mixed
*/
public static function setExpressNumber($id, $expressId, $expressNumber,$uid, $expressCompany, $isChange)
public static function setExpressNumber($id, $expressId, $expressNumber, $uid, $expressCompany, $isChange)
{
$data = ReturnsData::setExpressNumber($id, $expressId, $expressNumber,$uid, $expressCompany, $isChange);
$data = ReturnsData::setExpressNumber($id, $expressId, $expressNumber, $uid, $expressCompany, $isChange);
return $data;
}
... ... @@ -282,13 +297,13 @@ class ReturnsModel
//调用接口成功,封装数据
if (isset($data['code']) && $data['code'] == 200 && isset($data['data']['goods_list']) && !empty($data['data']['goods_list'])) {
$amount = '';
foreach($data['data']['goods_list'] as $key=>$value){
foreach ($data['data']['goods_list'] as $key => $value) {
$cnAlphabet = '';
if (!empty($value['cn_alphabet'])) {
$cnAlphabet = $value['cn_alphabet'];
}
$result['goods'][$key]['href'] = Helpers::getUrlBySkc($value['product_id'], $value['goods_id'], $cnAlphabet);
$result['goods'][$key]['thumb'] = Helpers::getImageUrl($value['goods_image'],60,60);
$result['goods'][$key]['thumb'] = Helpers::getImageUrl($value['goods_image'], 60, 60);
$result['goods'][$key]['name'] = $value['product_name'];
$result['goods'][$key]['color'] = $value['color_name'];
$result['goods'][$key]['size'] = $value['size_name'];
... ... @@ -299,19 +314,42 @@ class ReturnsModel
$result['goods'][$key]['goods_type_id'] = $value['goods_type_id'];
$result['goods'][$key]['goods_type'] = $value['goods_type'];
$amount += $value['last_price'];//所以商品价格加起来,等于订单总价
$result['goods'][$key]['reason'] = $data['data']['return_reason'];
// tar note 为每个特殊商品都添加标识
if ($value['is_limit_skn'] === 'Y') {
$remarks = explode(' ', $data['data']['special_notice']['remark'], 2); // 使用3个空格拆分
$result['goods'][$key]['specialNoticeBo']['title'] = $data['data']['special_notice']['title'];
$result['goods'][$key]['specialNoticeBo']['remark1'] = $remarks[0];
$result['goods'][$key]['specialNoticeBo']['remark2'] = $remarks[1];
// tar note 对数组做处理,为不显示的添加 inactive
if (isset($data['data']['special_return_reason'])) {
foreach ($result['goods'][$key]['reason'] as $subKey => $item) {
if (!in_array($item, $data['data']['special_return_reason'])) {
$result['goods'][$key]['reason'][$subKey]['inactive'] = true;
}
}
}
}
// 对原因排序
asort($result['goods'][$key]['reason']);
//商品中有鞋类,传给前端标识
if ($value['hasShoes']) {
$result['tips']['footwear'] = true;
}
}
$result['orderCode'] = $orderCode;
$result['reason'] = $data['data']['return_reason'];
//计算相关支付细节
$result['amount'] = $amount - $data['data']['yoho_coin_num'] - $data['data']['coupon_amount'];
$result['yohoCoin'] = $data['data']['yoho_coin_num'];
$result['coupon'] = $data['data']['coupon_amount'];
$result['cash'] = $amount;
foreach($data['data']['return_amount_mode'] as &$value){
foreach ($data['data']['return_amount_mode'] as &$value) {
if ($value['is_default'] == 'Y') {
$value['default'] = true;
}
... ... @@ -324,8 +362,8 @@ class ReturnsModel
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$pager = array();
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'refund' => $result,
'pager' => $pager
);
... ... @@ -346,16 +384,18 @@ class ReturnsModel
//调用接口,根据订单号获取订单可换货商品信息
$data = ReturnsData::getChangeGoodsData($orderCode, $uid);
$isLimited = false;
$productSkn = array();
//数据获取成功,封装数据
if (isset($data['code']) && $data['code'] == 200 && isset($data['data']) && !empty($data['data'])) {
foreach ($data['data']['goods_list'] as $key=>$value) {
foreach ($data['data']['goods_list'] as $key => $value) {
$cnAlphabet = '';
if (!empty($value['cn_alphabet'])) {
$cnAlphabet = $value['cn_alphabet'];
}
$result['goods'][$key]['href'] = Helpers::getUrlBySkc($value['product_id'], $value['goods_id'], $cnAlphabet);
$result['goods'][$key]['thumb'] = Helpers::getImageUrl($value['goods_image'],60,60);
$result['goods'][$key]['thumb'] = Helpers::getImageUrl($value['goods_image'], 60, 60);
$result['goods'][$key]['name'] = $value['product_name'];
$result['goods'][$key]['color'] = $value['color_name'];
$result['goods'][$key]['size'] = $value['size_name'];
... ... @@ -364,13 +404,36 @@ class ReturnsModel
$result['goods'][$key]['skc'] = $value['product_skc'];
$result['goods'][$key]['sku'] = $value['product_sku'];
$result['goods'][$key]['goods_type_id'] = $value['goods_type_id'];
$result['goods'][$key]['reason'] = $data['data']['exchange_reason'];
// tar note 为每个特殊商品都添加标识
if ($value['is_limit_skn'] === 'Y') {
$remarks = explode(' ', $data['data']['specialNoticeBo']['remark'], 2); // 使用3个空格拆分
$result['goods'][$key]['specialNoticeBo']['title'] = $data['data']['specialNoticeBo']['title'];
$result['goods'][$key]['specialNoticeBo']['remark1'] = $remarks[0];
$result['goods'][$key]['specialNoticeBo']['remark2'] = $remarks[1];
// tar note 对数组做处理,为不显示的添加 inactive
if (isset($data['data']['special_exchange_reason'])) {
foreach ($result['goods'][$key]['reason'] as $subKey => $item) {
if (!in_array($item, $data['data']['special_exchange_reason'])) {
$result['goods'][$key]['reason'][$subKey]['inactive'] = true;
}
}
}
}
// 对原因排序
asort($result['goods'][$key]['reason']);
//给前端标识出鞋类
if ($value['hasShoes']) {
$result['tips']['footwear'] = true;
}
$productSkn[] += $value['product_skn'];
}
$result['reason'] = $data['data']['exchange_reason'];
$result['orderCode'] = $orderCode;
//换货地址相关数据(邮编为可空参数)
... ... @@ -393,8 +456,8 @@ class ReturnsModel
foreach ($product as $key => $value) {//遍历得到每件商品
$num = '0';//初始化每件商品的库存为0
foreach ($value['goods_list'] as $k=>$v) {//遍历商品得到每个颜色
foreach ($v['size_list'] as $k1=>$v1) {//遍历颜色得到每个尺码
foreach ($value['goods_list'] as $k => $v) {//遍历商品得到每个颜色
foreach ($v['size_list'] as $k1 => $v1) {//遍历颜色得到每个尺码
$num += $v1['storage_number'];//将商品颜色对应尺码下的每个商品的库存相加
if ($v1['storage_number'] > 0) {//当某个尺码下有库存时,将该颜色及其对应的尺码加入该商品选项下
$result['goods'][$key]['colorSize'][$k]['color'] = $v['color_name'];
... ... @@ -412,14 +475,14 @@ class ReturnsModel
$result['goods'][$key]['banMsg'] = '库存不足不能换货';
}
}
//面包屑-左侧导航
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$pager = array();
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'exchange' => $result,
'pager' => $pager
);
... ... @@ -435,7 +498,7 @@ class ReturnsModel
*/
public static function getSizeList($sizeList)
{
foreach ($sizeList as $key=>$value) {
foreach ($sizeList as $key => $value) {
if ($value['storage_number'] <= 0) {
unset($sizeList[$key]);
}
... ... @@ -479,7 +542,7 @@ class ReturnsModel
// if (!in_array($_FILES['fileData']['type'],$type)) {
// return array('code'=>'400','message'=>'图片格式错误');
// }
$result = Images::saveImage($filename, 'evidenceImages');
$result = Images::saveImage($filename);
}
return $result;
... ... @@ -498,7 +561,7 @@ class ReturnsModel
//调取接口查询订单详情
$order = OrderData::viewOrderData($orderCode, $uid, '');
if (empty($order)) {
return array('code'=>403,'message'=>'没有找到该订单');
return array('code' => 403, 'message' => '没有找到该订单');
}
// //订单7天后不能退款
// if (isset($order['code']) && $order['code'] == 200) {
... ... @@ -538,7 +601,7 @@ class ReturnsModel
//调取接口查询订单详情
$order = OrderData::viewOrderData($orderCode, $uid, '');
if (empty($order)) {
return array('code'=>403,'message'=>'没有找到该订单');
return array('code' => 403, 'message' => '没有找到该订单');
}
// //订单15天后不能换货
// if (isset($order['code']) && $order['code'] == 200) {
... ... @@ -573,15 +636,15 @@ class ReturnsModel
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'save' => array(
'type' => '退货',
'ordersHref' => Helpers::url('/home/orders'),
'returnsHref' => Helpers::url('/home/returns'),
'refund' => array( // 退货时传退货收件地址
'address' => '南京市江宁区江宁经济技术开发区苏源大道87号YOHO!BUY 有货物流中心东一楼',
'name' => 'YOHO!BUY 有货',
'address' => '南京市江宁区江宁经济技术开发区苏源大道87号YOHO!有货物流中心东一楼',
'name' => 'YOHO!有货',
'phone' => '400-889-9646',
'postcode' => '211106'
)
... ... @@ -603,8 +666,8 @@ class ReturnsModel
$path = UserModel::getCenterCrumb('退货/换货');
$leftNav = UserModel::getCenterLeftNav('我的退/换货', $uid);
$data = array(
'path'=>$path,
'homeNav'=>$leftNav,
'path' => $path,
'homeNav' => $leftNav,
'save' => array(
'type' => '换货',
'ordersHref' => Helpers::url('/home/orders'),
... ...
<?php
namespace Product;
use LibModels\Web\Product\ItemData;
use WebPlugin\Helpers;
use WebPlugin\Images;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Product\FavoriteData;
use Api\Yohobuy;
use WebPlugin\Cache;
use Configs\WebCacheConfig;
use Configs\ChannelConfig;
use Configs\WebCacheConfig;
use LibModels\Web\Product\BrandData;
use Product\BrandsModel;
use LibModels\Web\Product\FavoriteData;
use LibModels\Web\Product\ItemData;
use LibModels\Web\Product\SearchData;
use WebPlugin\Cache;
use WebPlugin\Helpers;
use WebPlugin\Images;
class ItemModel
{
/**
... ... @@ -35,7 +36,7 @@ class ItemModel
$statGoodsInfo = array();
$banner = array();
$baseInfo = ItemData::baseInfo($productId, $uid, $productSkn);
if(empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
if (empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
return array();
}
$baseInfo['uid'] = $uid;
... ... @@ -50,7 +51,7 @@ class ItemModel
$brandId = 0;
//设置并发请求数据
self::setMultiResourceByProductBaseInfo($baseInfo);
if(isset($baseInfo['brand']['id'])) {
if (isset($baseInfo['brand']['id'])) {
$brandId = $baseInfo['brand']['id'];
}
//收藏喜欢
... ... @@ -69,12 +70,13 @@ class ItemModel
$goodsInfo['isOutlets'] = $baseInfo['isOutlets'] == 'Y' ? 'outlets' : '';
}
// 商品价格
if (isset($baseInfo['productPriceBo'])) {
$goodsInfo['marketPrice'] = $baseInfo['productPriceBo']['formatMarketPrice'];
$goodsInfo['hasOtherPrice'] = true;//非市场价格
$goodsInfo['salePrice'] = $baseInfo['productPriceBo']['formatSalesPrice'];
if($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
if ($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
unset($goodsInfo['salePrice']);
$goodsInfo['hasOtherPrice'] = false;
}
... ... @@ -82,15 +84,32 @@ class ItemModel
//VIP数据
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel, $uid);
//促销活动banner
$goodsInfo['activity'] = self::getActivityDataByProductBaseInfo($baseInfo);
// 促销信息声明
$goodsInfo['activity'] = array();
// 促销 banner
$promotionBanner = self::getProductActivityBanner($baseInfo['id']);
if (!empty($promotionBanner)) {
$goodsInfo['activity'][] = $promotionBanner;
}
// 促销活动,另外调用接口获取
$activityOrigin = ItemData::promotion($baseInfo['productPriceBo']['productSkn']);
if ($activityOrigin['code'] === 200) {
$activityList = self::getActivityDataByProductBaseInfo($activityOrigin['data']);
if (!empty($activityList)) {
$goodsInfo['activity'] = array_merge($goodsInfo['activity'], $activityList);
}
}
if (isset($baseInfo['productPriceBo']['yohoCoinNum']) && $baseInfo['productPriceBo']['yohoCoinNum'] !== 0) {
array_push($goodsInfo['activity'],
array('type' => '返YOHO币', 'des' => '每件返 ' . $baseInfo['productPriceBo']['yohoCoinNum'] . '个 YOHO币')
);
}
// 上市期
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
... ... @@ -103,11 +122,11 @@ class ItemModel
$consultComment = self::getConsultCommentDataByProductInfo($baseInfo);
// 品牌信息
if (!empty($baseInfo['brand'])) {
$goodsInfo['brandImg'] = Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47);
$goodsInfo['brandImg'] = Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47);
$goodsInfo['brandName'] = $baseInfo['brand']['brandName'];
$goodsInfo['brandUrl'] = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
$banner = self::getBrandDataByProductBaseInfo($baseInfo);
if(isset($banner['isCollect']) && isset($favoriteData['brand'])) {
if (isset($banner['isCollect']) && isset($favoriteData['brand'])) {
$banner['isCollect'] = $favoriteData['brand'];
}
}
... ... @@ -133,12 +152,12 @@ class ItemModel
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
//潮流尖货状态
$goodsInfo['fashionTopGoods'] = array(
'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
'limitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
);
if($fashTopGoods['soldOut']) {
'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
'limitedCodeSoldOut' => $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
);
if ($fashTopGoods['soldOut']) {
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
$totalStorageNum = 0;//改总数为已售磬
} else {
... ... @@ -152,51 +171,52 @@ class ItemModel
$notForSale = $baseInfo['attribute'] == 2;//非卖品
$virtualGoods = $baseInfo['attribute'] == 3;//虚拟商品
if (!$soldOut && !$notForSale && !$virtualGoods) {
$goodsInfo['addToCart'] = true;
//立即购买或者即将开售存在
if((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
(isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])) {
$goodsInfo['addToCart'] = true;
//立即购买或者即将开售存在
if ((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
(isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])
) {
unset($goodsInfo['addToCart']);
}
}// 非卖品
}
// 非卖品
elseif ($notForSale) {
$goodsInfo['notForSale'] = true;
}
}
// 已售磬
elseif ($soldOut) {
$goodsInfo['soldOut'] = true;
unset($goodsInfo['fashionTopGoods']);
}
//虚拟商品
else if($virtualGoods) {
} //虚拟商品
else if ($virtualGoods) {
$goodsInfo['buyNow'] = true;//是否立即购买
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
$goodsInfo['virtualGoods'] = $virtualGoods;
if(isset($goodsInfo['salePrice'])) {
if (isset($goodsInfo['salePrice'])) {
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
unset($goodsInfo['salePrice']);
}
}
//去掉即将售罄
if(empty($totalStorageNum) || $soldOut) {
if(isset($goodsInfo['tags']['isFew'])) {
if (empty($totalStorageNum) || $soldOut) {
if (isset($goodsInfo['tags']['isFew'])) {
unset($goodsInfo['tags']['isFew']);//去掉即将售罄
}
}
//分享相关
$goodsInfo['weixinUrl'] = 'http:' . Helpers::url($_SERVER['REQUEST_URI'], array(),'item');
$goodsInfo['weixinUrl'] = Helpers::url($_SERVER['REQUEST_URI'], array(), 'item');
$goodsInfo['sharedTitle'] = $goodsInfo['name'];
$goodsInfo['shareImg'] = 'http:' . $goodsInfo['img'];
$goodsInfo['shareImg'] = $goodsInfo['img'];
$goodsInfo['shareDesc'] = $baseInfo['phrase'];
//统计需要的商品信息
$statGoodsInfo['uid'] = $uid;
$statGoodsInfo['skn'] = $baseInfo['erpProductId'];
$statGoodsInfo['productId'] = $productId;
$statGoodsInfo['productName'] = str_replace("'", "’",$goodsInfo['name']);
$statGoodsInfo['brandName'] = empty($goodsInfo['brandName'])? '' : str_replace("'", "’", $goodsInfo['brandName']);
$statGoodsInfo['productName'] = str_replace("'", "’", $goodsInfo['name']);
$statGoodsInfo['brandName'] = empty($goodsInfo['brandName']) ? '' : str_replace("'", "’", $goodsInfo['brandName']);
$statGoodsInfo['marketPrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
if(isset($goodsInfo['salePrice'])) {
if (isset($goodsInfo['salePrice'])) {
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['salePrice']);
} else {
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
... ... @@ -227,7 +247,7 @@ class ItemModel
$statGoodsInfo['productUrl'] = $goodsInfo['weixinUrl'];
$statGoodsInfo['smallSortId'] = $goodsInfo['smallSortId'];
$statGoodsInfo['soldOut'] = intval($soldOut);
return array('goodsInfo'=> $goodsInfo,'consultComment' => $consultComment, 'banner'=> $banner,'statGoodsInfo' => $statGoodsInfo);
return array('goodsInfo' => $goodsInfo, 'consultComment' => $consultComment, 'banner' => $banner, 'statGoodsInfo' => $statGoodsInfo);
}
/**
... ... @@ -242,11 +262,11 @@ class ItemModel
if (is_numeric($productSkn)) {
//并发资源中是否存在数据
$sizeInfo = self::getMultiDataByResourceName('ItemData::sizeInfo');
if(empty($sizeInfo)) {
if (empty($sizeInfo)) {
//获取尺码
$sizeInfo = ItemData::sizeInfo($productSkn);
}
if(empty($sizeInfo)) {
if (empty($sizeInfo)) {
return array();
}
$productId = $sizeInfo['productBo']['id'];
... ... @@ -266,15 +286,14 @@ class ItemModel
$fittingReport = self::getProductModelTry($productSkn);
//获取尺寸说明
$sizeAttr = array();
if(!empty($sizeInfo['sizeInfoBo'])) {
if (!empty($sizeInfo['sizeInfoBo'])) {
//根据最大分类ID获取尺寸属性
$sizeAttr = self::getSizeAttrByMaxSortId($maxSortId, $sizeInfo['sizeInfoBo']);
}
return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
'modelCards'=> $modelCards,'details'=> $details,'fittingReport' =>$fittingReport,
'description'=> $description,'sizeTitleJson' => json_encode($sizeAttr));
}
else {
return array('material' => $material, 'size' => $size, 'reference' => $reference,
'modelCards' => $modelCards, 'details' => $details, 'fittingReport' => $fittingReport,
'description' => $description, 'sizeTitleJson' => json_encode($sizeAttr));
} else {
return array();
}
... ... @@ -293,8 +312,8 @@ class ItemModel
$goodsInfo = array();
$size = array();
$baseInfo = ItemData::baseInfo($productId, $uid);
if(!empty($baseInfo)) {
if(empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
if (!empty($baseInfo)) {
if (empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
return array();
}
$goodsInfo['name'] = $baseInfo['productName'];
... ... @@ -310,7 +329,7 @@ class ItemModel
$goodsInfo['marketPrice'] = Helpers::transPrice($baseInfo['productPriceBo']['marketPrice']);
$goodsInfo['salePrice'] = Helpers::transPrice($baseInfo['productPriceBo']['salesPrice']);
$goodsInfo['hasOtherPrice'] = true;//非市场价格
if($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
if ($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
unset($goodsInfo['salePrice']);
$goodsInfo['hasOtherPrice'] = false;
}
... ... @@ -333,9 +352,9 @@ class ItemModel
$goodsInfo['img'] = $skuData['defaultImage'];
$goodsInfo['colors'] = $skuData['skuGoods'];
$favoriteData = FavoriteData::getUidProductFav($uid, $productId);
$goodsInfo['isCollect'] = $favoriteData['code'] == 200 && $favoriteData['data'] ? true:false;
$goodsInfo['isCollect'] = $favoriteData['code'] == 200 && $favoriteData['data'] ? true : false;
$sizeInfo = ItemData::sizeInfo($baseInfo['erpProductId']);
if(!empty($sizeInfo)) {
if (!empty($sizeInfo)) {
$size = self::getSizeDataBySizeInfo($sizeInfo);
$goodsInfo['size'] = $size;
}
... ... @@ -355,10 +374,10 @@ class ItemModel
$goodsInfo['fashionTopGoods'] = array(
'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
'limitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
'limitedCodeSoldOut' => $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
);
if($fashTopGoods['soldOut']) {
if ($fashTopGoods['soldOut']) {
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
$totalStorageNum = 0;//改总数为已售磬
} else {
... ... @@ -375,24 +394,23 @@ class ItemModel
if (!$soldOut && !$notForSale && !$virtualGoods) {
$goodsInfo['addToCart'] = true;
//立即购买或者即将开售存在
if((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
(isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])) {
unset($goodsInfo['addToCart']);
}
if ((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
(isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])
) {
unset($goodsInfo['addToCart']);
}
}// 非卖品
elseif ($notForSale) {
//$goodsInfo['notForSale'] = true;
$goodsInfo['addToCart'] = true;//赠品
}
// 已售磬
} // 已售磬
elseif ($soldOut) {
$goodsInfo['soldOut'] = true;
}
else if($virtualGoods) {
} else if ($virtualGoods) {
$goodsInfo['buyNow'] = true;//是否立即购买
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
$goodsInfo['virtualGoods'] = $virtualGoods;
if(isset($goodsInfo['salePrice'])) {
if (isset($goodsInfo['salePrice'])) {
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
unset($goodsInfo['salePrice']);
}
... ... @@ -410,19 +428,19 @@ class ItemModel
*/
public static function getSortNav($smallSortId)
{
$key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA.'_'.$smallSortId;
$key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA . '_' . $smallSortId;
$navs = Cache::get($key);
if(empty($navs)) {
$data = SearchData::getSortByCondition(array('sort'=> $smallSortId));
if(!empty($data['data'])) {
if (empty($navs)) {
$data = SearchData::getSortByCondition(array('sort' => $smallSortId));
if (!empty($data['data'])) {
$sort = current($data['data']['sort']);
//一级分类
$navs[] = array('href' => Helpers::url('', array('msort'=> $sort['sort_id'],
'gender' => Helpers::getGenderByCookie()),'list'), 'name' => $sort['sort_name'],'pathTitle' => $sort['sort_name']);
if(!empty($sort['sub'])) {//二级分类
$navs[] = array('href' => Helpers::url('', array('msort' => $sort['sort_id'],
'gender' => Helpers::getGenderByCookie()), 'list'), 'name' => $sort['sort_name'], 'pathTitle' => $sort['sort_name']);
if (!empty($sort['sub'])) {//二级分类
$subSort = current($sort['sub']);
$navs[] = array('href' => Helpers::url('', array('msort'=> $sort['sort_id'],'misort'=>$subSort['sort_id'],
'gender' => Helpers::getGenderByCookie()),'list'), 'name' => $subSort['sort_name'], 'pathTitle' => $subSort['sort_name']);
$navs[] = array('href' => Helpers::url('', array('msort' => $sort['sort_id'], 'misort' => $subSort['sort_id'],
'gender' => Helpers::getGenderByCookie()), 'list'), 'name' => $subSort['sort_name'], 'pathTitle' => $subSort['sort_name']);
}
Cache::set($key, $navs);
}
... ... @@ -459,7 +477,7 @@ class ItemModel
$build['like'] = intval($value['like']);
$build['isUseful'] = $value['is_useful'] === 'Y';
$build['useful'] = intval($value['useful']);
$build['total']= $value['total'];
$build['total'] = $value['total'];
$result[] = $build;
}
}
... ... @@ -484,8 +502,8 @@ class ItemModel
$build = array();
foreach ($commentList['data'] as $value) {
$headIco = ChannelConfig::$itemHeadDefaultImgIco;
if(!empty($value['head_ico'])) {
if(preg_match('@http://@', $value['head_ico'])) {
if (!empty($value['head_ico'])) {
if (preg_match('@http://@', $value['head_ico'])) {
$headIco = preg_replace('@http:\/\/img(.+)\.static\.yhbimg\.com\/headimg@', 'http://head.static.yhbimg.com/yhb-head/', $value['head_ico']);
$headIco = Images::getImageUrl($headIco, 30, 30);
}
... ... @@ -501,7 +519,7 @@ class ItemModel
}
}
}
return $result;
return $result;
}
/**
... ... @@ -514,11 +532,10 @@ class ItemModel
{
$result = array();
$data = self::getMultiDataByResourceName('ItemData::getProductBanner');
if(empty($data)) {
if (empty($data)) {
$data = ItemData::getProductBanner($productId);
}
if(isset($data['code']) && $data['code'] == 200 && !empty($data['data']))
{
if (isset($data['code']) && $data['code'] == 200 && !empty($data['data'])) {
$result['activityImg'] = Images::getImageUrl($data['data']['bannerImg'], 260, 64);
$result['url'] = Helpers::getUrlSafe($data['data']['promotionUrl']);
}
... ... @@ -535,20 +552,20 @@ class ItemModel
{
$result = array();
$data = ItemData::getProductHotArea($productId);
if(isset($data['code']) && $data['code'] == 200) {
if(!empty($data['data'])) {
if (isset($data['code']) && $data['code'] == 200) {
if (!empty($data['data'])) {
foreach ($data['data'] as $area) {
$temp = array();
$pos = 1;
if(isset($area['imageUrl'])) {
if (isset($area['imageUrl'])) {
$temp['img'] = Images::getForceSourceUrl($area['imageUrl']);
}
foreach($area['infos'] as $val) {
if(isset($val['product'])) {
$point = array('label' => $pos++,'height' => $val['height'],
'left' => $val['left'],'top' => $val['top'],
'width'=> $val['width'],'product' => array());
if(!empty($val['product']['goodsList'])) {
foreach ($area['infos'] as $val) {
if (isset($val['product'])) {
$point = array('label' => $pos++, 'height' => $val['height'],
'left' => $val['left'], 'top' => $val['top'],
'width' => $val['width'], 'product' => array());
if (!empty($val['product']['goodsList'])) {
$goods = current($val['product']['goodsList']);
//封面图
$point['img'] = Images::getImageUrl($goods['colorImage'], 60, 60);
... ... @@ -563,11 +580,11 @@ class ItemModel
$point['href'] = $point['product']['href'];
}
}
if(!empty($point)) {
if (!empty($point)) {
$temp['list'][] = $point;
}
}
if(!empty($temp)) {
if (!empty($temp)) {
$result[] = $temp;
}
}
... ... @@ -586,11 +603,11 @@ class ItemModel
{
$result = array();
$data = self::getMultiDataByResourceName('ItemData::getProductModelCard');
if(empty($data)) {
if (empty($data)) {
$data = ItemData::getProductModelCard($productId);
}
if(isset($data['code']) && $data['code'] == 200) {
foreach($data['data'] as $val) {
if (isset($data['code']) && $data['code'] == 200) {
foreach ($data['data'] as $val) {
$result[] = array(
'url' => Helpers::getUrlSafe(Images::getForceSourceUrl($val['modelImg'])),
'size' => $val['size'],
... ... @@ -624,15 +641,15 @@ class ItemModel
{
$result = array();
$comfort = self::getMultiDataByResourceName('ItemData::getProductComfort');
if(empty($comfort)) {
if (empty($comfort)) {
$comfort = ItemData::getProductComfort($productId);
}
if(!empty($comfort['data'])) {
foreach($comfort['data'] as $val) {
if (!empty($comfort['data'])) {
foreach ($comfort['data'] as $val) {
$blocks = array();
$flag = false;
for($i =1;$i<=5; $i++) {
if($i == $val['wearSense']['value']) {
for ($i = 1; $i <= 5; $i++) {
if ($i == $val['wearSense']['value']) {
$flag = true;
$blocks[] = array('cur' => true);
} else {
... ... @@ -640,12 +657,12 @@ class ItemModel
}
}
//存在,添加
if($flag) {
if ($flag) {
$result[] = array(
'name' => $val['caption']['caption'],
'minDes'=> $val['caption']['low'],
'blocks'=> $blocks,
'maxDes'=>$val['caption']['high']
'minDes' => $val['caption']['low'],
'blocks' => $blocks,
'maxDes' => $val['caption']['high']
);
}
}
... ... @@ -663,15 +680,15 @@ class ItemModel
public static function getProductFavoriteData($uid, $productId, $brandId)
{
$result = array('product' => false, 'brand' => false);
if(!empty($uid)) {
if(!empty($productId)) {
if (!empty($uid)) {
if (!empty($productId)) {
$productData = self::getMultiDataByResourceName('FavoriteData::getUidProductFav');
if(empty($productData)) {
if (empty($productData)) {
$productData = FavoriteData::getUidProductFav($uid, $productId);
}
$result['product'] = $productData['code'] == 200 && $productData['data'] ? true : false;
}
if(!empty($brandId)) {
if (!empty($brandId)) {
$brandData = FavoriteData::isFavoriteBrand($uid, $brandId);
$result['brand'] = isset($brandData['code']) && $brandData['code'] == 200 ? true : false;
}
... ... @@ -699,7 +716,7 @@ class ItemModel
$multiResourcesUrl['ItemData::getProductModelCard'] = ItemData::getProductModelCard($productId, $isOnlyUrl);
$multiResourcesUrl['ItemData::getProductModelTry'] = ItemData::getProductModelTry($skn, $isOnlyUrl);
$multiResourcesUrl['BrandData::getBannerInfo'] = BrandData::getBannerInfo($brandId, $isOnlyUrl);
if(!empty($uid)) {
if (!empty($uid)) {
$multiResourcesUrl['FavoriteData::getUidProductFav'] = FavoriteData::getUidProductFav($uid, $productId, $isOnlyUrl);
}
self::$multiResources = Yohobuy::getMulti($multiResourcesUrl, array(), false, 5, true);
... ... @@ -713,7 +730,7 @@ class ItemModel
*/
private static function getMultiDataByResourceName($resourceName)
{
if(isset(self::$multiResources[$resourceName])) {
if (isset(self::$multiResources[$resourceName])) {
return self::$multiResources[$resourceName];
} else {
return false;
... ... @@ -744,21 +761,21 @@ class ItemModel
$sizeInfos = array();
$attributeNames = array();
//获取属性名称
foreach($sizeList['sizeAttributeBos'] as $size) {
foreach ($sizeList['sizeAttributeBos'] as $size) {
$attributeNames[$size['id']] = $size['attributeName'];
}
foreach($sizeList['sizeBoList'] as $size) {
foreach ($sizeList['sizeBoList'] as $size) {
$sizeValues = array();
foreach($size['sortAttributes'] as $sort) {
if(in_array($sort['id'], $attributeIds)) {
if(!empty($sort['sizeValue'])) {
$sizeValues[] = $attributeNames[$sort['id']].' '.$sort['sizeValue'].'cm';
foreach ($size['sortAttributes'] as $sort) {
if (in_array($sort['id'], $attributeIds)) {
if (!empty($sort['sizeValue'])) {
$sizeValues[] = $attributeNames[$sort['id']] . ' ' . $sort['sizeValue'] . 'cm';
}
}
}
//获取尺寸属性
if(!empty($sizeValues)) {
if (!empty($sizeValues)) {
$sizeInfos[$size['sizeName']] = implode(' / ', $sizeValues);
}
}
... ... @@ -791,14 +808,14 @@ class ItemModel
}
// 判断是否显示参考尺码
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) ||
($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']));
if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
//尺码信息头部
$size['thead'] = array(0 => array('name' => '吊牌尺码', 'id' => ''));
//显示参考尺码
if ($showReference) {
$size['thead'][1] = array('name' => $referenceName,'id' => '');
$size['thead'][1] = array('name' => $referenceName, 'id' => '');
}
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
$size['thead'][] = array('name' => empty($attr['attributeName']) ? ' ' : $attr['attributeName'], 'id' => $attr['id']);
... ... @@ -809,11 +826,11 @@ class ItemModel
$sizes = array($value['sizeName']);
//判断是否显示参考尺码
if ($boyReference && ($gender == 1 || $gender == 3) && $showReference) {
$sizes[] = empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName'];
} else if ($girlReference && ($gender == 2 || $gender == 3) && $showReference) {
$sizes[] = empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName'];
} else if ($girlReference && ($gender == 2 || $gender == 3) && $showReference) {
$sizes[] = empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName'];
} else {
if(isset($size['thead'][1]) && $showReference) {
if (isset($size['thead'][1]) && $showReference) {
$size['thead'][1] = array();
}
}
... ... @@ -825,7 +842,7 @@ class ItemModel
$size['tbody'][] = $sizes;
}
//参考尺码为空
if(isset($size['thead'][1]) && empty($size['thead'][1]) && $showReference) {
if (isset($size['thead'][1]) && empty($size['thead'][1]) && $showReference) {
unset($size['thead'][1]);
$size['thead'] = array_values($size['thead']);
}
... ... @@ -883,21 +900,21 @@ class ItemModel
//模特信息
$reference['tbody'] = array();
$reference['thead'] = array(
array('name' => ''), array('name' => '模特', 'modelCol'=> true),
array('name' => '身高'),array('name' => '体重'),
array('name' => '三围'),array('name' => '吊牌尺码'),
array('name' => ''), array('name' => '模特', 'modelCol' => true),
array('name' => '身高'), array('name' => '体重'),
array('name' => '三围'), array('name' => '吊牌尺码'),
array('name' => '试穿描述'),
);
//模特数据
foreach($sizeInfo['modelBos'] as $value) {
foreach ($sizeInfo['modelBos'] as $value) {
$modelValue = array(Images::getForceSourceUrl($value['avatar']),
$value['modelName'],$value['height'],$value['weight'],$value['vitalStatistics'],
$value['fitModelBo']['fit_size'],$value['fitModelBo']['feel']
$value['modelName'], $value['height'], $value['weight'], $value['vitalStatistics'],
$value['fitModelBo']['fit_size'], $value['fitModelBo']['feel']
);
//是否有备注
if (!empty($value['fitModelBo']['fit_remark'])) {
$modelValue[] = $value['fitModelBo']['fit_remark'];
$reference['thead'][7] = array('name' => '备注','remarkCol' => true);
$reference['thead'][7] = array('name' => '备注', 'remarkCol' => true);
}
$reference['tbody'][] = $modelValue;
}
... ... @@ -918,6 +935,7 @@ class ItemModel
if (!empty($sizeInfo['washTipsBoList'])) {
$material['wash'] = array();
foreach ($sizeInfo['washTipsBoList'] as $value) {
//$material['wash'][] = array('name' => $value['caption'], 'img' => $value['img']);
$material['wash'][] = array('name' => $value['caption'],'img' => Helpers::getUrlSafe($value['img']));
}
}
... ... @@ -957,12 +975,12 @@ class ItemModel
$sex = '女款';
break;
}
$description['basic'][] = array('key' =>'编号','value' => $sizeInfo['productDescBo']['erpProductId']);
$description['basic'][] = array('key' =>'颜色','value' => $sizeInfo['productDescBo']['colorName'], 'dColor' => true);
$description['basic'][] = array('key' =>'性别','value' => $sex);
$description['basic'][] = array('key' => '编号', 'value' => $sizeInfo['productDescBo']['erpProductId']);
$description['basic'][] = array('key' => '颜色', 'value' => $sizeInfo['productDescBo']['colorName'], 'dColor' => true);
$description['basic'][] = array('key' => '性别', 'value' => $sex);
if (!empty($sizeInfo['productDescBo']['standardBos'])) {
foreach ($sizeInfo['productDescBo']['standardBos'] as $value) {
$description['basic'][] = array('key' => $value['standardName'], 'value'=> $value['standardVal']);
$description['basic'][] = array('key' => $value['standardName'], 'value' => $value['standardVal']);
}
}
$description['comfort'] = self::getProductComfort($sizeInfo['productBo']['id']);
... ... @@ -1011,8 +1029,8 @@ class ItemModel
$goodsGroup = array();
foreach ($baseInfo['goodsList'] as $pos => $value) {
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
if (empty($value['colorImage']) ) {
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
if (empty($value['colorImage'])) {
continue;
}
if (isset($value['goodsImagesList'])) {
... ... @@ -1020,52 +1038,52 @@ class ItemModel
$goodsGroup = array(
'productSkc' => $value['productSkc'],
'src' => Images::getImageUrl($value['colorImage'], 40, 40),
'title' => trim($baseInfo['productName']).' '.$value['colorName'],
'title' => trim($baseInfo['productName']) . ' ' . $value['colorName'],
'name' => $value['colorName'],
'focus'=> false,
'focus' => false,
'total' => 0,
'thumbs' => array(),
'size' => array(),
);
foreach ($value['goodsImagesList'] as $goods) {
if(!empty($goods['imageUrl'])) {
if (!empty($goods['imageUrl'])) {
$goodsGroup['thumbs'][] = array(
'url' => '','shower' => Images::getImageUrl($goods['imageUrl'], 420, 560),
'url' => '', 'shower' => Images::getImageUrl($goods['imageUrl'], 420, 560),
'img' => Images::getImageUrl($goods['imageUrl'], 75, 100),
);
}
}
//缩略图空,不显示
if(empty($goodsGroup['thumbs'])) {
if (empty($goodsGroup['thumbs'])) {
continue;
}
//默认第一张图片
if($pos == 0) {
if ($pos == 0) {
$defaultImage = Images::getImageUrl($value['colorImage'], 420, 560);
}
//商品的尺码列表
foreach ($value['goodsSizeBoList'] as $size) {
if($baseInfo['attribute'] == 3 ) { //虚拟商品,增加为一件
$size['goodsSizeStorageNum'] = $size['goodsSizeStorageNum'] > 1 ? 1: 0;
if ($baseInfo['attribute'] == 3) { //虚拟商品,增加为一件
$size['goodsSizeStorageNum'] = $size['goodsSizeStorageNum'] > 1 ? 1 : 0;
}
//如果status为0,即skc下架时就跳过该商品
if ($value['status'] === 0) {
$size['goodsSizeStorageNum'] = 0;
$size['goodsSizeStorageNum'] = 0;
}
$goodsGroup['size'][] = array(
'name' => $size['sizeName'],
'sku' => $size['goodsSizeSkuId'],
'num' => intval($size['goodsSizeStorageNum']),
'goodsId'=> $size['goodsId']
'goodsId' => $size['goodsId']
);
//单个sku商品的总数
$goodsGroup['total'] += intval($size['goodsSizeStorageNum']);
if($goodsGroup['total']> 0 && !$chooseSkuFlag) { //默认选中该sku商品
if ($goodsGroup['total'] > 0 && !$chooseSkuFlag) { //默认选中该sku商品
$goodsGroup['focus'] = true;
$chooseSkuFlag = true;//选中sku商品
}
... ... @@ -1074,11 +1092,11 @@ class ItemModel
}
$skuGoods[] = $goodsGroup;
}
if(!empty($skuGoods) && !$chooseSkuFlag) {//没有选中一个sku商品,默认选中第一个sku商品
if (!empty($skuGoods) && !$chooseSkuFlag) {//没有选中一个sku商品,默认选中第一个sku商品
$skuGoods[0]['focus'] = true;
}
}
return array('skuGoods' => $skuGoods,'totalStorageNum' => $totalStorageNum,
return array('skuGoods' => $skuGoods, 'totalStorageNum' => $totalStorageNum,
'defaultImage' => $defaultImage);
}
... ... @@ -1090,7 +1108,7 @@ class ItemModel
*/
private static function getBrandDataByProductBaseInfo(array &$baseInfo)
{
if(empty($baseInfo['brand'])) {
if (empty($baseInfo['brand'])) {
return array();
}
$brandId = $baseInfo['brand']['id'];
... ... @@ -1098,38 +1116,37 @@ class ItemModel
$logo = '';
$bannerInfo = array();
$result = self::getMultiDataByResourceName('BrandData::getBannerInfo');
if(empty($result)) {
if (empty($result)) {
$result = BrandData::getBannerInfo($brandId);//品牌banner
}
if(!empty($baseInfo['brand']['brandIco'])) {
if (!empty($baseInfo['brand']['brandIco'])) {
$logo = Images::getForceSourceUrl($baseInfo['brand']['brandIco']);
}
if(isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
$bannerInfo = $result['data'];
if(!empty($bannerInfo['bannerUrl'])) {
if (!empty($bannerInfo['bannerUrl'])) {
$bgImg = Images::getForceSourceUrl($bannerInfo['bannerUrl']);
}
}
//banner的logo
if(!empty($bannerInfo['logo']))
{
if (!empty($bannerInfo['logo'])) {
$logo = Images::getForceSourceUrl($bannerInfo['logo']);
}
$homeUrl = 'javascript:void(0)';
if(!empty($baseInfo['brand']['brandDomain'])){
if (!empty($baseInfo['brand']['brandDomain'])) {
$homeUrl = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
}
//导航的品牌banner
return array(
'brandId' => $baseInfo['brand']['id'],
'bgColor' => !empty($bannerInfo['colorValue']) ? $bannerInfo['colorValue']: '#000000',
'bgImg'=> $bgImg,
'logo'=> $logo,
'bgColor' => !empty($bannerInfo['colorValue']) ? $bannerInfo['colorValue'] : '#000000',
'bgImg' => $bgImg,
'logo' => $logo,
'alt' => $baseInfo['brand']['brandName'],
'brandName' => $baseInfo['brand']['brandName'],
'brandDomain' => $baseInfo['brand']['brandDomain'],
'homeUrl'=> $homeUrl,
'isCollect'=> false
'homeUrl' => $homeUrl,
'isCollect' => false
);
}
... ... @@ -1147,7 +1164,7 @@ class ItemModel
if (!empty($baseInfo['productPriceBo']['vipPrices'])) {
$build = array();
//不是普通会员
if($vipLevel > 0) {
if ($vipLevel > 0) {
foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
$build['level'] = $value['vipLevel'];
$build['price'] = $value['vipPrice'];
... ... @@ -1158,10 +1175,10 @@ class ItemModel
}
$vipData['unLogin'] = false;
//登录状态
if(empty($uid)) {
if (empty($uid)) {
$vipData['unLogin'] = Helpers::url('/signin.html', array());
}
if(empty($vipLevel) && !empty($uid)) {
if (empty($vipLevel) && !empty($uid)) {
$vipData['normalUser'] = true;
}
//查看vip进度
... ... @@ -1176,23 +1193,14 @@ class ItemModel
* @param array $baseInfo
* @return array
*/
private static function getActivityDataByProductBaseInfo(array &$baseInfo)
private static function getActivityDataByProductBaseInfo(array &$activityData)
{
$activity = array();
//促销活动banner
$activityBanner = self::getProductActivityBanner($baseInfo['id']);
if(!empty($activityBanner)) {
$activity[] = $activityBanner;
}
// 促销信息活动
if (isset($baseInfo['promotionBoList'])) {
$build = array();
foreach ($baseInfo['promotionBoList'] as $value) {
$build['type'] = $value['promotionType'];
$build['des'] = $value['promotionTitle'];
$activity[] = $build;
}
$build = array();
foreach ($activityData as $value) {
$build['type'] = $value['promotionType'];
$build['des'] = $value['promotionTitle'];
$activity[] = $build;
}
return $activity;
}
... ... @@ -1249,23 +1257,24 @@ class ItemModel
{
$modelTry = array();
$result = self::getMultiDataByResourceName('ItemData::getProductModelTry');
if(empty($result)) {
if (empty($result)) {
$result = ItemData::getProductModelTry($productSkn);
}
if(isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
//先显示模特信息
if(isset($result['data']['modelTryBoList']) && !empty($result['data']['modelTryBoList'])) {
$modelTry['thead'] = array('模特','身高','体重','三围','试穿尺码','试穿描述');
if (isset($result['data']['modelTryBoList']) && !empty($result['data']['modelTryBoList'])) {
$modelTry['thead'] = array('模特', '身高', '体重', '三围', '试穿尺码', '试穿描述');
$modelTry['tbody'] = array();
foreach($result['data']['modelTryBoList'] as $val) {
if(isset($val['modelBo']) && isset($val['sizeBo']) &&
isset($val['modelBo']['modelName']) && isset($val['sizeBo']['sizeName'])) {
foreach ($result['data']['modelTryBoList'] as $val) {
if (isset($val['modelBo']) && isset($val['sizeBo']) &&
isset($val['modelBo']['modelName']) && isset($val['sizeBo']['sizeName'])
) {
$modelTry['tbody'][] = array($val['modelBo']['modelName'],
$val['modelBo']['height'],$val['modelBo']['weight'],$val['modelBo']['vitalStatistics'],
$val['modelBo']['height'], $val['modelBo']['weight'], $val['modelBo']['vitalStatistics'],
$val['sizeBo']['sizeName'], $val['tryDesc']);
}
}
} else if(isset($result['data']['modelTryImgBoList']) && !empty($result['data']['modelTryImgBoList'])) {//后显示模特图
} else if (isset($result['data']['modelTryImgBoList']) && !empty($result['data']['modelTryImgBoList'])) {//后显示模特图
$tryImg = current($result['data']['modelTryImgBoList']);
$modelTry['frImg'] = Images::getForceSourceUrl($tryImg['tryImg']);
}
... ... @@ -1291,10 +1300,10 @@ class ItemModel
//buyNow //是否立即购买
$result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
'buyNow' => false, 'soldOut'=> false, 'getLimitedCodeDis'=> false);
'buyNow' => false, 'soldOut' => false, 'getLimitedCodeDis' => false);
// 显示获取限购码按钮
$result['getLimitedCode'] = true;
switch($showStatus) {
switch ($showStatus) {
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
if ($isBeginSale) { // 开售后
$result['buyNow'] = true;
... ... @@ -1319,7 +1328,7 @@ class ItemModel
$result['buyNow'] = true;
$result['dis'] = false;
$result['hasLimitedCode'] = true;
if(!empty($uid)) {//限购码失效
if (!empty($uid)) {//限购码失效
$result['getLimitedCodeDis'] = true;
}
break;
... ... @@ -1333,7 +1342,7 @@ class ItemModel
case 6: // 开售前,即将开售(用户已领取限购码)
$result['openSoon'] = true;
$result['hasLimitedCode'] = true;
if(!empty($uid)) {//限购码失效
if (!empty($uid)) {//限购码失效
$result['getLimitedCodeDis'] = true;
}
break;
... ... @@ -1341,7 +1350,7 @@ class ItemModel
$result['buyNow'] = true;
$result['dis'] = true;
$result['hasLimitedCode'] = true;
if(!empty($uid)) {//限购码失效
if (!empty($uid)) {//限购码失效
$result['getLimitedCodeDis'] = true;
}
default:
... ... @@ -1376,4 +1385,4 @@ class ItemModel
return $consultComment;
}
}
}
\ No newline at end of file
... ...
... ... @@ -94,7 +94,6 @@ class OrdersController extends WebAction
$orderCode = $this->get('order_code', '');
}
$detail = OrderModel::getOrderDetail($uid, $orderCode);
// print_r($detail);
//取消订单原因列表
$resons = OrderData::closeReasons();
$cancelReason = isset($resons['data']) ? $resons['data'] : '';
... ... @@ -269,4 +268,64 @@ class OrdersController extends WebAction
$this->echoJson($result);
}
/**
* 还原订单
*/
public function restoreOrderAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$uid = $this->auditJumpLogin();
$orderCode = trim($this->post('orderCode', ''));
// $data = OrderData::confirmUserOrder($uid, $orderCode);
$data = array('code' => 400, 'message' => '订单还原成功', 'data' => '');
if (!isset($data['code'])) {
break;
}
}
while (false);
$this->echoJson($data);
}
/*
* 我的订单-删除订单
*/
public function delOrderAction()
{
$result = array('code' => 400, 'message' => '删除失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
//传入orderCode删除订单
$orderCode = $this->post('orderCode','');
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid(true);
if (!$orderCode || !$uid) {
$result = array('code' => 400, 'message' => '缺失必填项', 'data' => '');
break;
}
//调用接口删除订单,并返回订单删除状态
$result = OrderData::deleteOrderData($orderCode, $uid, $gender, $channel);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($result);
}
}
... ...
... ... @@ -2,6 +2,7 @@
use Action\WebAction;
use Home\ReturnsModel;
use WebPlugin\Helpers;
use LibModels\Web\Home\ReturnsData;
class ReturnsController extends WebAction
{
... ... @@ -53,7 +54,7 @@ class ReturnsController extends WebAction
{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
return;
return;
}
$areaCode = $this->post('areaCode');
//获取必要参数
... ... @@ -82,14 +83,14 @@ class ReturnsController extends WebAction
$uid = $this->getUid();
$goods = $this->post('goods');
$payment = $this->post('payment');
if (empty($orderCode) || $orderCode<1 || empty($goods) || empty($payment)) {
$this->echoJson(array('code'=>203,'message'=>'非法提交'));
if (empty($orderCode) || $orderCode < 1 || empty($goods) || empty($payment)) {
$this->echoJson(array('code' => 203, 'message' => '非法提交'));
}
//调用模型提交退货申请
$res = ReturnsModel::saveRefund($orderCode, $uid, $goods, $payment);
//退货申请成功,返回前端相应格式,并返回退货成功页跳转地址
if (isset($res['code']) && $res['code'] == 200) {
$successUrl = Helpers::url('/home/returns/refundSuccess', array('orderCode'=>$orderCode));
$successUrl = Helpers::url('/home/returns/refundSuccess', array('orderCode' => $orderCode));
$res['data']['refer'] = $successUrl;
}
$this->echoJson($res);
... ... @@ -117,8 +118,8 @@ class ReturnsController extends WebAction
$deliveryType = $this->post('deliveryType');
//判断参数合法性
if (empty($orderCode) || $orderCode<1 || empty($goods) || empty($deliveryType) || empty($consigneeName) || empty($areaCode) || empty($address) || empty($mobile)) {
$this->echoJson(array('code'=>203,'message'=>'非法提交'));
if (empty($orderCode) || $orderCode < 1 || empty($goods) || empty($deliveryType) || empty($consigneeName) || empty($areaCode) || empty($address) || empty($mobile)) {
$this->echoJson(array('code' => 203, 'message' => '非法提交'));
return;
}
//调用模型提交换货申请
... ... @@ -126,7 +127,7 @@ class ReturnsController extends WebAction
//换货成功,返回前端相应格式,并返回换货成功页跳转链接
if (isset($res['code']) && $res['code'] == '200') {
$successUrl = Helpers::url('/home/returns/exchangeSuccess', array('orderCode'=>$orderCode));
$successUrl = Helpers::url('/home/returns/exchangeSuccess', array('orderCode' => $orderCode));
$res['data']['refer'] = $successUrl;
}
... ... @@ -204,6 +205,7 @@ class ReturnsController extends WebAction
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->_view->display('returns-detail', array('meReturnsPage' => true, 'returns' => $data));
}
... ... @@ -224,6 +226,7 @@ class ReturnsController extends WebAction
//头部导航
$channel = Helpers::getChannelNameByCookie();
$this->setWebNavHeader($channel);
$this->_view->display('returns-detail', array('meReturnsPage' => true, 'returns' => $data));
}
... ... @@ -246,11 +249,11 @@ class ReturnsController extends WebAction
$expressNumber = $this->post('expressNumber');
$uid = $this->getUid();
$expressCompany = $this->post('expressCompany');
$res = array('code'=>201,'message'=>'请求失败');
$res = array('code' => 201, 'message' => '请求失败');
if (!isset($id) || !isset($expressId) || !isset($expressNumber) || !isset($uid) || !isset($expressCompany) || !isset($isChange)) {
return $res;
}
$res = ReturnsModel::setExpressNumber($id, $expressId, $expressNumber,$uid, $expressCompany, $isChange);
$res = ReturnsModel::setExpressNumber($id, $expressId, $expressNumber, $uid, $expressCompany, $isChange);
$this->echoJson($res);
}
... ... @@ -263,7 +266,7 @@ class ReturnsController extends WebAction
{
//判断是否登录,未登录则退出
if (!$this->getUid()) {
$this->echoJson(array('code'=>'400','message'=>'请登录'));
$this->echoJson(array('code' => '400', 'message' => '请登录'));
exit;
}
$result = ReturnsModel::saveRefundImg('fileData');
... ... @@ -271,7 +274,35 @@ class ReturnsController extends WebAction
$this->echoJson($result);
}
/**
* 取消退货申请
*/
public function cancelRefundAction()
{
if (!$this->isAjax()) {
return;
}
$orderId = $this->post('id');
$uid = $this->getUid();
$result = ReturnsData::cancelRefund($orderId, $uid);
$this->echoJson($result);
}
/**
* 取消换货申请
*/
public function cancelChangeAction()
{
if (!$this->isAjax()) {
return;
}
$orderId = $this->post('id');
$uid = $this->getUid();
$result = ReturnsData::cancelChange($orderId, $uid);
$this->echoJson($result);
}
/**
* 个人中心-根据商品skn,颜色,尺码返回商品的sku,goodsId(待用)
... ...