Authored by 郭成尧

促销信息更改

@@ -208,13 +208,15 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -208,13 +208,15 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => {
208 208
209 // 促销信息 209 // 促销信息
210 dest.goodsDiscount = {}; 210 dest.goodsDiscount = {};
211 - dest.goodsDiscount.list = {}; 211 + dest.goodsDiscount.list = [];
212 212
213 if (origin.promotionBoList !== null && typeof origin.promotionBoList !== 'undefined') { 213 if (origin.promotionBoList !== null && typeof origin.promotionBoList !== 'undefined') {
214 - _.forEach(origin.promotionBoList, function(value, key) {  
215 - dest.goodsDiscount.list[key] = {};  
216 - dest.goodsDiscount.list[key].text = '【' + value.promotionType + '】' + 214 + _.forEach(origin.promotionBoList, function(value) {
  215 + let temp = {};
  216 +
  217 + temp.text = '【' + value.promotionType + '】' +
217 value.promotionTitle; 218 value.promotionTitle;
  219 + dest.goodsDiscount.list.push(temp);
218 }); 220 });
219 } 221 }
220 222
@@ -491,6 +493,256 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { @@ -491,6 +493,256 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => {
491 return dest; 493 return dest;
492 }; 494 };
493 495
  496 +/**
  497 + * 商品尺码信息处理
  498 + * @param {[type]} productSkn [description]
  499 + * @param {[type]} uid [description]
  500 + * @param {[type]} udid [description]
  501 + * @return {[type]} [description]
  502 + */
  503 +// const getSizeInfo = (sizeInfo) => {
  504 +// var dest = {},
  505 +// temp = {};
  506 +
  507 +// if (sizeInfo.productDescBo.erpProductId !== null &&
  508 +// typeof sizeInfo.productDescBo.erpProductId !== 'undefined') {
  509 +// let sex = '通用';
  510 +// switch (sizeInfo.productDescBo.gender) {
  511 +// case 1:
  512 +// sex = '男款';
  513 +// break;
  514 +// case 2:
  515 +// sex = '女款';
  516 +// break;
  517 +// default:
  518 +// break;
  519 +// }
  520 +
  521 +// dest.goodsDescription = {};
  522 +
  523 +// dest.goodsDescription.title = '商品信息';
  524 +// dest.goodsDescription.enTitle = 'DESCRIPTION';
  525 +// dest.goodsDescription.detail = {};
  526 +// dest.goodsDescription.detail.list = {};
  527 +// dest.goodsDescription.detail.list[0].param =
  528 +// '编号:' + sizeInfo.productDescBo.erpProductId;
  529 +// dest.goodsDescription.detail.list[1].param =
  530 +// '颜色:' + sizeInfo.productDescBo.colorName;
  531 +// dest.goodsDescription.detail.list[2].param =
  532 +// '性别:' + sex;
  533 +// }
  534 +
  535 +// if (sizeInfo.productDescBo.standardBos !== null &&
  536 +// typeof sizeInfo.productDescBo.standardBos !== 'undefined') {
  537 +// _.forEach(sizeInfo.productDescBo.standardBos, function(value, key){
  538 +// dest.goodsDescription.detail.list[3].param = value.standardName + ':' +
  539 +// value.standardVal;
  540 +// });
  541 +// }
  542 +
  543 +// if (sizeInfo.phrase !== null && typeof sizeInfo.phrase !== 'undefined') {
  544 +// dest.goodsDescription.desc = sizeInfo.phrase;
  545 +// }
  546 +
  547 +// // 尺码信息
  548 +// if (!empty(sizeInfo.sizeInfoBo)) {
  549 +// dest.sizeInfo = {};
  550 +// dest.sizeInfo.title = '尺码信息';
  551 +// dest.sizeInfo.enTitle = 'SIZE INFO';
  552 +// dest.sizeInfo.detail = {};
  553 +// dest.sizeInfo.detail.list = {};
  554 +
  555 +// // 参考尺码
  556 +// let boyReference = !empty(sizeInfo.productExtra.boyReference);
  557 +// let girlReference = !empty(sizeInfo.productExtra.girlReference);
  558 +// let gender = !empty(sizeInfo.productDescBo.gender) ? sizeInfo.productDescBo.gender : 3;
  559 +// let referenceName = '参考尺码';
  560 +
  561 +// if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
  562 +// referenceName = '参考尺码';
  563 +// } else if (gender === 3 && boyReference) {
  564 +// referenceName = '参考尺码(男)';
  565 +// } else if (gender === 3 && girlReference) {
  566 +// referenceName = '参考尺码(女)';
  567 +// }
  568 +
  569 +// let referenceList = {};
  570 +
  571 +// // 判断是否显示参考尺码
  572 +// let showReference = (boyReference &&
  573 +// !empty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
  574 +// !empty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
  575 +
  576 +// if (showReference) {
  577 +// referenceList[0] = {};
  578 +// referenceList[0].param = referenceName;
  579 +// }
  580 +
  581 +// if (!empty(sizeInfo.sizeInfoBo.sizeAttributeBos)) {
  582 +// let sizeNameList = {};
  583 +
  584 +// sizeNameList[0] = {};
  585 +// sizeNameList[0].param = '吊牌尺码';
  586 +
  587 +// let sizeBoGroup = {};
  588 +
  589 +// _.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr){
  590 +// sizeBoGroup[attr.id[0]].param = empty(value.attributeName) ?
  591 +// ' ' : attr.attributeName;
  592 +// });
  593 +
  594 +// let item = {};
  595 +
  596 +// _.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value){
  597 +// item = {};
  598 +
  599 +// let sizeNameList = {};
  600 +
  601 +// sizeNameList[0].param = value.sizeName;
  602 +
  603 +// if (boyReference && (gender === 1 || gender === 3)) {
  604 +// temp = {};
  605 +// temp.param = empty(value.boyReferSize.referenceName) ?
  606 +// ' ' : value.boyReferSize.referenceName;
  607 +// sizeNameList.push(temp);
  608 +// } else if (girlReference && (gender === 2 || gender === 3)) {
  609 +// temp = {};
  610 +// temp.param = empty(value.girlReferSize.referenceName) ? :
  611 +// ' ' : value.girlReferSize.referenceName;
  612 +// sizeNameList.push(temp);
  613 +// } else {
  614 +// showReference = false;
  615 +// }
  616 +
  617 +// _.forEach(value.sortAttributes, function(attr){
  618 +// temp = {};
  619 +// temp.param = empty(attr.sizeValue) ? ' ' : attr.sizeValue;
  620 +// sizeBoGroup[attr.id].push(temp);
  621 +// });
  622 +// });
  623 +
  624 +// // 根据模板页面的显示,按表格一列一列来显示
  625 +// dest.sizeInfo.detail.list[0].params = sizeNameList;
  626 +// if (showReference) {
  627 +// dest.sizeInfo.detail.list[1].params = referenceList;
  628 +// }
  629 +// _.forEach(sizeBoGroup, function(value){
  630 +// temp = {};
  631 +// temp.params = value;
  632 +// dest.sizeInfo.detail.list.push(temp);
  633 +// });
  634 +// } else {
  635 +// temp = {};
  636 +// temp[0].param = '';
  637 +// dest.sizeInfo.detail.list[0].params.push(temp);
  638 +// }
  639 +// }
  640 +
  641 +// // 测量方式
  642 +// if (!empty(sizeInfo.sizeImage)) {
  643 +// dest.measurementMethod = {};
  644 +
  645 +// dest.measurementMethod.title = '测量方式';
  646 +// dest.measurementMethod.enTitle = 'MEASUREMENT METHOD';
  647 +// dest.measurementMethod.img = sizeInfo.sizeImage;
  648 +// }
  649 +
  650 +// // 模特试穿, 竖着输出排列显示
  651 +// if (!empty(sizeInfo.modelBos)) {
  652 +// dest.reference = {};
  653 +// dest.reference.title = '模特试穿';
  654 +// dest.reference.enTitle = 'REFERENCE';
  655 +// dest.reference.detail = {};
  656 +// dest.reference.detail.list = {};
  657 +
  658 +// // 控制是否显示备注
  659 +// let showRemark = false;
  660 +// let remarkList = {};
  661 +// remarkList[0] = {};
  662 +// remarkList[0].param = '备注';
  663 +
  664 +// for (var i = 0; i < 7; i++) {
  665 +// dest.reference.detail.list[i] = {};
  666 +// dest.reference.detail.list[i].params = {};
  667 +// dest.reference.detail.list[0].params[0] = {};
  668 +// }
  669 +// dest.reference.detail.list[0].params[0].param = '';
  670 +// dest.reference.detail.list[1].params[0].param = '模特';
  671 +// dest.reference.detail.list[2].params[0].param = '身高';
  672 +// dest.reference.detail.list[3].params[0].param = '体重';
  673 +// dest.reference.detail.list[4].params[0].param = '三围';
  674 +// dest.reference.detail.list[5].params[0].param = '吊牌尺码';
  675 +// dest.reference.detail.list[6].params[0].param = '试穿描述';
  676 +
  677 +// _.forEach(sizeInfo.modelBos, function(value){
  678 +// // 待处理
  679 +// });
  680 +
  681 +// // 显示模特备注
  682 +// if (showRemark) {
  683 +
  684 +// }
  685 +
  686 +// }
  687 +
  688 +// // 商品材质
  689 +// if (!empty(sizeInfo.productMaterialList)) {
  690 +// dest.materials = {};
  691 +// dest.materials.title = '商品材质';
  692 +// dest.materials.enTitle = 'MATERIALS';
  693 +// dest.materials.list = {};
  694 +
  695 +// _.forEach(sizeInfo.productMaterialList, function(value){
  696 +// temp = {};
  697 +// temp.img = value.imageUrl;
  698 +// temp.desc = value.remark;
  699 +// dest.materials.list.push();
  700 +// });
  701 +// }
  702 +
  703 +// // 洗涤提示
  704 +// if (!empty(sizeInfo.washTipsBoList)) {
  705 +// dest.washTips = {};
  706 +// dest.washTips.list = {};
  707 +// _.forEach(sizeInfo.washTipsBoList, function(value){
  708 +// dest.washTips.list.push(value);
  709 +// });
  710 +// }
  711 +
  712 +// // 详情配图
  713 +
  714 +// if (!empty(sizeInfo.productIntroBo.productIntro)) {
  715 +// let productIntro = '';
  716 +// if (!empty(sizeInfo.productDescBo.phrase)) {
  717 +// productIntro = productIntro + sizeInfo.productDescBo.phrase +
  718 +// '<br />';
  719 +// }
  720 +// productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
  721 +// if (!empty(productIntro) && productIntro !== '') {
  722 +// dest.productDetail = {};
  723 +// dest.productDetail.title = '商品详情';
  724 +// dest.productDetail.enTitle = 'DETAILS';
  725 +// // 待开发
  726 +// }
  727 +// // 清空变量,释放内存
  728 +// sizeInfo = {};
  729 +// }
  730 +
  731 +// return dest;
  732 +// };
  733 +
  734 +/**
  735 + * 判断是否不为空
  736 + * @type {[type]}
  737 + */
  738 +/* const empty = (data) => {
  739 + if (data !== null && typeof data !== 'undefined') {
  740 + return false;
  741 + } else {
  742 + return true;
  743 + }
  744 +};*/
  745 +
494 module.exports = (data) => { 746 module.exports = (data) => {
495 var finalResult; 747 var finalResult;
496 748