Authored by 陈轩

commit

... ... @@ -11,21 +11,21 @@ const index = (req, res, next)=>{
let $uid = '8041246';// req.user.uid;
let $udid = 'abcdrf';// req.sessionID;
co(function * (){
let pall= yield Promise.all([OrderData.closeReasons(),IndexModel.getInfoNumData($uid, $udid),IndexModel.getFooterBanner(),IndexModel.latestOrders($uid),IndexModel.homeData()]);
let $cancelReason=pall[0].data?pall[0].data:'';
res.render("home/index/index",{
cancelReason:$cancelReason,
content:[
{messages:pall[1]},
co(function * () {
let pall = yield Promise.all([OrderData.closeReasons(), IndexModel.getInfoNumData($uid, $udid), IndexModel.getFooterBanner(), IndexModel.latestOrders($uid), IndexModel.homeData()]);
let $cancelReason = pall[0].data ? pall[0].data : '';
res.render('home/index/index', {
cancelReason: $cancelReason,
content: [
{messages: pall[1]},
{
latestOrders:pall[3],
favBrand:{
more:'/brands',
brands:pall[4].brand
latestOrders: pall[3],
favBrand: {
more: '/brands',
brands: pall[4].brand
},
newArrival:pall[4].new,
banner:pall[2]
newArrival: pall[4].new,
banner: pall[2]
}
],
helpUsUrl: ''
... ...
const $exchangeDay=15;
const $exchangeDay = 15;
const $refundDay= 7;
const $refundDay = 7;
module.exports = {
$exchangeDay,
... ...
'use strict';
const helpers = global.yoho.helpers;
const Images=require('../../../utils/Images');
const Images = require('../../../utils/Images');
const formatFavBrand=($brandInfo, $i)=>{
$i=$i||10;
let $hotBrands=[];
if($brandInfo.length>0){
for(let i=0;i<$brandInfo.length;i++){
let $value=$brandInfo[i];
const formatFavBrand = ($brandInfo, $i)=>{
$i = $i || 10;
let $hotBrands = [];
if ($brandInfo.length > 0) {
for (let i = 0; i < $brandInfo.length; i++) {
let $value = $brandInfo[i];
if ($value.is_hot && $value.is_hot == 'Y') {
$hotBrands.push({
'href' : helpers.urlFormat('', '', $value['brand_domain']),
'logo' : Images.getSourceUrl($value['brand_ico'], 'brandLogo'),
'name' : $value.brand_name,
'href': helpers.urlFormat('', '', $value['brand_domain']),
'logo': Images.getSourceUrl($value['brand_ico'], 'brandLogo'),
'name': $value.brand_name
});
$i--;
}
if($i<=0){
if ($i <= 0) {
break;
}
};
}
}
return $hotBrands;
}
const formatNew=($product)=>{
};
const formatNew = ($product)=>{
let $result = [];
$product.forEach(function($val,$key){
$result[$key]={};
$product.forEach(function($val, $key) {
$result[$key] = {};
$result[$key]['href'] = helpers.getUrlBySkc($val['product_id'], $val['goods_list'][0]['product_skc'], $val['cn_alphabet']);
$result[$key]['thumb'] = $val['default_images']?Images.getImageUrl($val['default_images'], 400, 500):'';
$result[$key]['thumb'] = $val['default_images'] ? Images.getImageUrl($val['default_images'], 400, 500) : '';
$result[$key]['name'] = $val['product_name'];
$result[$key]['price'] = $val['sales_price'];
});
return $result;
}
};
module.exports = {
formatFavBrand,
formatNew
}
};
... ...
... ... @@ -2,19 +2,19 @@
const Promise = require('bluebird');
const co = Promise.coroutine;
const OrderData=require('./OrderData');
const OrderModel=require('./OrderModel');
const OrderData = require('./OrderData');
const OrderModel = require('./OrderModel');
const helpers = global.yoho.helpers;
const api = global.yoho.API;
const searchApi = global.yoho.SearchAPI;
const BrandData=require('./BrandData');
const IndexData=require('./IndexData');
const SearchData=require('./SearchData');
const BrandData = require('./BrandData');
const IndexData = require('./IndexData');
const SearchData = require('./SearchData');
const HelperHome=require('./HelperHome');
const HelperHome = require('./HelperHome');
const _=require('lodash');
const _ = require('lodash');
/**
* 个人中心——消息提示
... ... @@ -22,19 +22,19 @@ const _=require('lodash');
* @param type $udid
* @return array
*/
const getInfoNumData=($uid, $udid)=>{
let $result=[
{href:helpers.urlFormat('/home/orders'),name:'待处理订单','count':0},
{href:helpers.urlFormat('/home/message'),name:'未读消息','count':0},
{href:helpers.urlFormat('/home/comment'),name:'待评论商品','count':0}
];
return co(function * (){
let $getPendingOrderCount = yield IndexData.getPendingOrderCount($uid);//待处理订单
let $infoNumData = yield IndexData.infoNum($uid, $udid); //未读消息
let $notCommentRecordCount = yield IndexData.notCommentRecordCount($uid);//待评论商品
$result[0]['count']=$getPendingOrderCount.data.count?$getPendingOrderCount.data.count:0;
$result[1]['count']=$infoNumData.data.inbox_total?$infoNumData.data.inbox_total:0;
$result[2]['count']=$notCommentRecordCount.data?$notCommentRecordCount.data:0;
const getInfoNumData = ($uid, $udid)=>{
let $result = [
{href: helpers.urlFormat('/home/orders'), name: '待处理订单', 'count': 0},
{href: helpers.urlFormat('/home/message'), name: '未读消息', 'count': 0},
{href: helpers.urlFormat('/home/comment'), name: '待评论商品', 'count': 0}
];
return co(function * () {
let $getPendingOrderCount = yield IndexData.getPendingOrderCount($uid);// 待处理订单
let $infoNumData = yield IndexData.infoNum($uid, $udid); // 未读消息
let $notCommentRecordCount = yield IndexData.notCommentRecordCount($uid);// 待评论商品
$result[0]['count'] = $getPendingOrderCount.data.count ? $getPendingOrderCount.data.count : 0;
$result[1]['count'] = $infoNumData.data.inbox_total ? $infoNumData.data.inbox_total : 0;
$result[2]['count'] = $notCommentRecordCount.data ? $notCommentRecordCount.data : 0;
return $result;
})();
};
... ... @@ -45,36 +45,38 @@ const getInfoNumData=($uid, $udid)=>{
* @param type $uid
* @return array
*/
const latestOrders=($uid)=>{
return co(function *(){
let $orders=yield OrderModel.getOrders($uid, 1, 2, 1)
const latestOrders = ($uid)=>{
return co(function *() {
let $orders = yield OrderModel.getOrders($uid, 1, 2, 1);
return {
more : helpers.urlFormat('/home/orders'),
orders:$orders
}
more: helpers.urlFormat('/home/orders'),
orders: $orders
};
})();
}
const homeData=()=>{
return co(function * (){
};
const homeData = ()=>{
return co(function * () {
let $result = {};
let $url={};
let $url = {};
$url.fav_brand = SearchData.getBrandListUrl();
$url.new= SearchData.getProductUrl({new:'Y',viewNum:10});
let $data= yield Promise.all([searchApi.get($url.fav_brand,{},{cache:true}),searchApi.get($url.new,{},{cache:true})])
//格式化数据
$result['brand'] = $data[0].data && $data[0].data.length>0 ? HelperHome.formatFavBrand($data[0].data, 6) : [];
$result['new'] = $data[1].data['product_list'] && $data[1].data['product_list'].length>0 ? HelperHome.formatNew($data[1].data['product_list']) : {};
$url.new = SearchData.getProductUrl({new: 'Y', viewNum: 10});
let $data = yield Promise.all([searchApi.get($url.fav_brand, {}, {cache: true}), searchApi.get($url.new, {}, {cache: true})]);
// 格式化数据
$result['brand'] = $data[0].data && $data[0].data.length > 0 ? HelperHome.formatFavBrand($data[0].data, 6) : [];
$result['new'] = $data[1].data['product_list'] && $data[1].data['product_list'].length > 0 ? HelperHome.formatNew($data[1].data['product_list']) : {};
return $result;
// $result.brand=$data.fav_brand&&!$data.fav_brand?
})();
}
};
/**
* 底部banner
* @param string $code
* @return mixed
*/
const getFooterBanner=($code)=>{
const getFooterBanner = ($code)=>{
$code = $code || '20110609-152143';
return co(function *() {
... ... @@ -84,8 +86,8 @@ const getFooterBanner=($code)=>{
result = $banner.data.replace('http://', '//');
}
return result;
})()
}
})();
};
module.exports = {
getInfoNumData,
... ...
... ... @@ -2,12 +2,12 @@
const Promise = require('bluebird');
const co = Promise.coroutine;
const OrderData=require('./OrderData');
const ChannelConfig=require('./ChannelConfig');
const OrderData = require('./OrderData');
const ChannelConfig = require('./ChannelConfig');
const helpers = global.yoho.helpers;
const api = global.yoho.API;
const _=require('lodash');
const Image=require('../../../utils/images');
const _ = require('lodash');
const Image = require('../../../utils/images');
/**
* 获取我的订单列表数据-分页
... ... @@ -16,34 +16,35 @@ const Image=require('../../../utils/images');
* @param type $limit
* @param type $type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
*/
const getOrders=($uid, $page, $limit, $type, $isPage)=>{
return co(function *(){
$isPage=$isPage||false;
let getOrderDescStr={
1:'您还没有任何订单',
5:'您目前还没有成功的订单',
7:'您还没有任何取消的订单'
}
let $descStr=getOrderDescStr[$type]||'';
let $orders={empty:$descStr};
let $orderInfo=yield OrderData.getUserOrders($uid, $page, $limit, $type);
if($orderInfo.data&&$orderInfo.data.order_list){
$orders={};
$orderInfo.data.order_list.forEach(function($orderV,$orderK){
$orders[$orderK]={};
$orders[$orderK]['orderNum'] = $orderV['order_code']; //订单标识
const getOrders = ($uid, $page, $limit, $type, $isPage)=>{
return co(function *() {
$isPage = $isPage || false;
let getOrderDescStr = {
1: '您还没有任何订单',
5: '您目前还没有成功的订单',
7: '您还没有任何取消的订单'
};
let $descStr = getOrderDescStr[$type] || '';
let $orders = {empty: $descStr};
let $orderInfo = yield OrderData.getUserOrders($uid, $page, $limit, $type);
if ($orderInfo.data && $orderInfo.data.order_list) {
$orders = {};
$orderInfo.data.order_list.forEach(function($orderV, $orderK) {
$orders[$orderK] = {};
$orders[$orderK]['orderNum'] = $orderV['order_code']; // 订单标识
$orders[$orderK]['orderTime'] = new Date($orderV['create_time']);
let $statusInfo = getOrderStatus($orderV['is_cancel'], $orderV['status'], $orderV['payment_type'], $orderV['payment_status']);
//订单状态
// 订单状态
if ($statusInfo['cancel']) {
$orders[$orderK]['cancel'] = $statusInfo['cancel'];
}
else {
if ($statusInfo['keyName']) {
$orders[$orderK][$statusInfo['keyName']] = true;
//已发货,物流信息
// 已发货,物流信息
if ($statusInfo['keyName'] == 'shipped') {
let $expressInfo = getExpressInfo($orderV['order_code'], $uid, $orderV['payment_type'], $orderV['create_time']);
$orders[$orderK]['logistics'] = $expressInfo['logistics'];
... ... @@ -51,12 +52,12 @@ const getOrders=($uid, $page, $limit, $type, $isPage)=>{
}
}
//订单商品相关信息
let $opRefundStatus = true; //订单不可操作退换货
// 订单商品相关信息
let $opRefundStatus = true; // 订单不可操作退换货
if ($orderV['order_goods'] && $orderV['order_goods']) {
let $goods={},$refundFlag={};
$orderV['order_goods'].forEach(function($goval,$gokey){
$goods[$gokey]={};
let $goods = {}, $refundFlag = {};
$orderV['order_goods'].forEach(function($goval, $gokey) {
$goods[$gokey] = {};
$goods[$gokey]['href'] = helpers.getUrlBySkc($goval['product_id'], $goval['goods_id'], $goval['cn_alphabet']);
$goods[$gokey]['thumb'] = $goval['goods_image'] && $goval['goods_image'] ? Image.getImageUrl($goval['goods_image'], 100, 100) : '';
$goods[$gokey]['name'] = $goval['product_name'];
... ... @@ -66,9 +67,9 @@ const getOrders=($uid, $page, $limit, $type, $isPage)=>{
let $buyNum = Number($goval['buy_number']);
let $refundNum = Number($goval['refund_num']);
$goods[$gokey]['count'] = $buyNum;
let $refundStatus = ($refundNum > 0) ? true : false; //只要发生一件退换,退换过的标记
let $refundStatus = ($refundNum > 0) ? true : false; // 只要发生一件退换,退换过的标记
$goods[$gokey]['refundStatus'] = $refundStatus;
$refundFlag = (($buyNum == $refundNum) && $refundNum > 0) ? 'finished' : 'unfinished'; //某一件商品全部退换结束
$refundFlag = (($buyNum == $refundNum) && $refundNum > 0) ? 'finished' : 'unfinished'; // 某一件商品全部退换结束
$goods[$gokey]['arrivalDate'] = $goval['expect_arrival_time'];
let $goodsTagName = getGoodsTag($orderV['attribute'], $goval['goods_type']);
if ($goodsTagName) {
... ... @@ -77,13 +78,14 @@ const getOrders=($uid, $page, $limit, $type, $isPage)=>{
$orders[$orderK]['goods'] = $goods;
});
if($refundFlag.indexOf('unfinished')){
if ($refundFlag.indexOf('unfinished')) {
$opRefundStatus = false;
}
$orders[$orderK]['pay'] = $orderV['amount']; //付款数
$orders[$orderK]['fregit'] = $orderV['shipping_cost']; //邮费
$orders[$orderK]['pay'] = $orderV['amount']; // 付款数
$orders[$orderK]['fregit'] = $orderV['shipping_cost']; // 邮费
}
//操作
// 操作
$orders[$orderK]['operation'] = 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);
});
... ... @@ -95,26 +97,28 @@ const getOrders=($uid, $page, $limit, $type, $isPage)=>{
return $orders;
}
})();
}
const getOrderStatus=($isCancel, $status, $payType, $payStatus)=>{
//初始化:未取消,待付款
let $ret={cancel:false,keyName:'noPay',statusStr:'待付款'};
};
const getOrderStatus = ($isCancel, $status, $payType, $payStatus)=>{
// 初始化:未取消,待付款
let $ret = {cancel: false, keyName: 'noPay', statusStr: '待付款'};
if ($isCancel == 'Y') {
$ret = {cancel:true,statusStr:'已取消'};
}else{
$ret = {cancel: true, statusStr: '已取消'};
} else {
switch ($status) {
case 0:
//'订单已成功,等待付款'
// '订单已成功,等待付款'
if ($payType != 2 && $payStatus == 'N') {
$ret['keyName'] = 'noPay';
$ret['statusStr'] = '待付款';
}
//'订单已付款,等待备货中'
// '订单已付款,等待备货中'
else if ($payType != 2 && $payStatus == 'Y') {
$ret['keyName'] = 'paid';
$ret['statusStr'] = '备货中';
}
//'订单已成功,等待备货中'-货到付款
// '订单已成功,等待备货中'-货到付款
else if ($payType == 2 && $payStatus == 'N') {
$ret['keyName'] = 'complete';
$ret['statusStr'] = '备货中';
... ... @@ -123,29 +127,29 @@ const getOrderStatus=($isCancel, $status, $payType, $payStatus)=>{
case 1:
case 2:
case 3:
//'订单已付款,等待备货中'
// '订单已付款,等待备货中'
$ret['keyName'] = 'paid';
$ret['statusStr'] = '备货中';
break;
case 4:
case 5:
//'订单已发货'
// '订单已发货'
$ret['keyName'] = 'shipped';
$ret['statusStr'] = '待收货';
break;
case 6:
//'交易完成';
// '交易完成';
$ret['keyName'] = 'reback';
$ret['statusStr'] = '交易完成';
break;
}
}
return $ret;
}
const getExpressInfo=($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
return co(function * (){
$isDetail=$isDetail||false;
let $result={};
};
const getExpressInfo = ($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
return co(function * () {
$isDetail = $isDetail || false;
let $result = {};
$result['logisticsUrl'] = '';
$result['logisticsImg'] = '';
$result['logisticsCompany'] = '';
... ... @@ -164,24 +168,25 @@ const getExpressInfo=($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
$result['logistics'] = [new Date($createTime), ' ', '您的订单已提交,等待审核'];
}
else {
$result['logistics'] = new Date($createTime) +' ' + '您的订单已提交,等待审核';
$result['logistics'] = new Date($createTime) + ' ' + '您的订单已提交,等待审核';
}
}
//有物流
// 有物流
if ($orderCode && _.isNumber($uid)) {
let $logistics = yield OrderData.getLogisticsData($orderCode, $uid);
let $logistics = yield OrderData.getLogisticsData($orderCode, $uid);
if ($logistics['data']) {
$result['logisticsUrl'] = $logistics['data']['url'] ? helper.getUrlSafe($logistics['data']['url']) : '';
$result['logisticsImg'] = $logistics['data']['logo'] ? $logistics['data']['logo'] : '';
$result['logisticsCompany'] = $logistics['data']['caption'] ? $logistics['data']['caption'] : '';
$result['courierNumbe'] = $logistics['data']['express_number']? $logistics['data']['express_number'] : '';
$result['courierNumbe'] = $logistics['data']['express_number'] ? $logistics['data']['express_number'] : '';
let $expressDetail = $logistics['data']['express_detail'] ? $logistics['data']['express_detail'] : {};
if ($expressDetail) {
let $logisticsTmp = $result['logistics'][0]; //暂存
let $logisticsTmp = $result['logistics'][0]; // 暂存
$result['logistics'] = {};
$expressDetail.forEach(function($value){
let $pos =$value['accept_address'].indexOf(' ') / 3;
let $city = $value['accept_address'].substr(0,$pos);
$expressDetail.forEach(function($value) {
let $pos = $value['accept_address'].indexOf(' ') / 3;
let $city = $value['accept_address'].substr(0, $pos);
let $exInfo = $value['accept_address'].substr($pos);
if ($isDetail) {
$result['logistics'] = [$value['acceptTime'], $city, $exInfo];
... ... @@ -190,7 +195,8 @@ const getExpressInfo=($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
$result['logistics'] = $value['acceptTime'] + $city + $exInfo;
}
});
//把最初的处理放最后
// 把最初的处理放最后
$result['logistics'] = $logisticsTmp;
}
}
... ... @@ -198,94 +204,112 @@ const getExpressInfo=($orderCode, $uid, $paymetType, $createTime, $isDetail)=>{
return $result;
})();
}
const getGoodsTag=($attribute, $goodsType)=>{
};
const getGoodsTag = ($attribute, $goodsType)=>{
let $goodsTagName = '';
switch ($goodsType) {
//赠品
// 赠品
case 'gift':
$goodsTagName = 'freebie';
break;
//加价购
// 加价购
case 'price_gift':
$goodsTagName = 'advanceBuy';
break;
//预售
// 预售
case 'advance':
$goodsTagName = 'preSaleGood';
break;
//outlet
// outlet
case 'outlet':
$goodsTagName = '';
break;
//免单
// 免单
case 'free':
$goodsTagName = '';
break;
//电子
// 电子
case 'ticket':
$goodsTagName = '';
break;
default:
break;
}
//虚拟
// 虚拟
if ($attribute == 3) {
$goodsTagName = 'virtualGood';
}
return $goodsTagName;
}
const getOperateInfo=($attribute, $isCancel, $status, $payStatus, $updateTime, $orderType, $refundStatus, $paymentType, $orderCode, $opRefundStatus)=>{
//查看订单
let $orderDetailUrl = helpers.urlFormat('/home/orders/detail', {orderCode:$orderCode});
//查看二维码
let $ticketUrl = helpers.urlFormat('/home/orders/tickets', {orderCode:$orderCode});
//立即付款
let $payUrl = helpers.urlFormat('/shopping/pay', {orderCode:$orderCode});
//取消订单
let $cancelOrderUrl = 'javascript:void(0)';
//确认订单
let $confirmOrderUrl = 'javascript:void(0)';
//申请换货
let $exchangeUrl = helpers.urlFormat('/home/returns/exchangeRequest', {orderCode:$orderCode});
//申请退货
let $refundUrl = helpers.urlFormat('/home/returns/refundrequest', {orderCode:$orderCode});
let $operation={};
//立即付款
if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') {
$operation = {payNow:true,href:$payUrl};
}
};
const getOperateInfo = ($attribute, $isCancel, $status, $payStatus, $updateTime, $orderType, $refundStatus, $paymentType, $orderCode, $opRefundStatus)=>{
// 查看订单
let $orderDetailUrl = helpers.urlFormat('/home/orders/detail', {orderCode: $orderCode});
$operation = {href:$orderDetailUrl, name:'查看订单'};
//查看订单,虚拟订单查看二维码
if ($attribute == 3) {
if ($payStatus == 'Y') {
$operation = {href: $ticketUrl, name : '查看二维码'};
}
}
// 查看二维码
let $ticketUrl = helpers.urlFormat('/home/orders/tickets', {orderCode: $orderCode});
//取消订单
if ($status < 3 && $isCancel == 'N' && $orderType != 5 && $payStatus == 'N') {
$operation = {href : $cancelOrderUrl,name:'取消订单',cancelOrder:true};
}
//确认收货
if ($status >= 4 && $status < 6 && $refundStatus == 0 && $attribute != 3 && $isCancel == 'N') {
$operation = {href : $confirmOrderUrl, name : '确认收货', confirmReceived : true};
}
//换货
let $time = (Date.now() - $updateTime);
let $orderExchangeLimitTime = ChannelConfig.$exchangeDay;
if ($status >= 6 && $time < 86400 * $orderExchangeLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $exchangeUrl,name: '申请换货', optDis : $opRefundStatus};
}
//退货
let $orderRefundLimitTime = ChannelConfig.$refundDay;
if ($status >= 6 && $time < 86400 * $orderRefundLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href:$refundUrl, name: '申请退货', optDis: $opRefundStatus};
// 立即付款
let $payUrl = helpers.urlFormat('/shopping/pay', {orderCode: $orderCode});
// 取消订单
let $cancelOrderUrl = 'javascript:void(0)';
// 确认订单
let $confirmOrderUrl = 'javascript:void(0)';
// 申请换货
let $exchangeUrl = helpers.urlFormat('/home/returns/exchangeRequest', {orderCode: $orderCode});
// 申请退货
let $refundUrl = helpers.urlFormat('/home/returns/refundrequest', {orderCode: $orderCode});
let $operation = {};
// 立即付款
if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') {
$operation = {payNow: true, href: $payUrl};
}
$operation = {href: $orderDetailUrl, name: '查看订单'};
// 查看订单,虚拟订单查看二维码
if ($attribute == 3) {
if ($payStatus == 'Y') {
$operation = {href: $ticketUrl, name: '查看二维码'};
}
return $operation;
}
}
// 取消订单
if ($status < 3 && $isCancel == 'N' && $orderType != 5 && $payStatus == 'N') {
$operation = {href: $cancelOrderUrl, name: '取消订单', cancelOrder: true};
}
// 确认收货
if ($status >= 4 && $status < 6 && $refundStatus == 0 && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $confirmOrderUrl, name: '确认收货', confirmReceived: true};
}
// 换货
let $time = (Date.now() - $updateTime);
let $orderExchangeLimitTime = ChannelConfig.$exchangeDay;
if ($status >= 6 && $time < 86400 * $orderExchangeLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $exchangeUrl, name: '申请换货', optDis: $opRefundStatus};
}
// 退货
let $orderRefundLimitTime = ChannelConfig.$refundDay;
if ($status >= 6 && $time < 86400 * $orderRefundLimitTime && $attribute != 3 && $isCancel == 'N') {
$operation = {href: $refundUrl, name: '申请退货', optDis: $opRefundStatus};
}
return $operation;
};
module.exports = {
... ...
'use strict';
const querystring=require('querystring');
const querystring = require('querystring');
const getUrl=($type)=>{
var map={
sort:'/sortgroup.json',
discount:'/discount.json',
recent:'/recent.json',
suggest:'/suggest.json',
'new-shelve':'/new-shelve.json',
shop:'/shops.json',
brand:'/brand/list.json',
}
return map[$type]||'/search.json';
}
const getUrl = ($type)=>{
var map = {
sort: '/sortgroup.json',
discount: '/discount.json',
recent: '/recent.json',
suggest: '/suggest.json',
'new-shelve': '/new-shelve.json',
shop: '/shops.json',
brand: '/brand/list.json'
};
return map[$type] || '/search.json';
};
const getBrandListUrl=()=>{
const getBrandListUrl = ()=>{
return getUrl('brand');
}
const getProductUrl=($condition, $type)=>{
let $orderMaps={
s_t_desc:'shelve_time:desc',
s_t_asc:'shelve_time:asc',
s_p_asc:'sales_price:asc',
s_p_desc:'sales_price:desc',
p_d_desc:'discount:desc',
p_d_asc:'discount:asc',
skn_desc:'product_skn:desc',
skn_asc:'product_skn:asc',
activities_desc:'activities.order_by:desc',
activities_asc:'activities.order_by:asc',
s_n_asc:'sales_num:asc',
s_n_desc:'sales_num:desc',
activities_id_desc:'activities.activity_id:desc',
activities_id_asc:'activities.activity_id:asc',
brand_desc:'brand_weight:desc'
}
let $param={
status:1,
sales:'Y',
outlets:2,
stocknumber:1,
attribute_not:2
};
const getProductUrl = ($condition, $type)=>{
let $orderMaps = {
s_t_desc: 'shelve_time:desc',
s_t_asc: 'shelve_time:asc',
s_p_asc: 'sales_price:asc',
s_p_desc: 'sales_price:desc',
p_d_desc: 'discount:desc',
p_d_asc: 'discount:asc',
skn_desc: 'product_skn:desc',
skn_asc: 'product_skn:asc',
activities_desc: 'activities.order_by:desc',
activities_asc: 'activities.order_by:asc',
s_n_asc: 'sales_num:asc',
s_n_desc: 'sales_num:desc',
activities_id_desc: 'activities.activity_id:desc',
activities_id_asc: 'activities.activity_id:asc',
brand_desc: 'brand_weight:desc'
};
let $param = {
status: 1,
sales: 'Y',
outlets: 2,
stocknumber: 1,
attribute_not: 2
};
if(!$condition.order){
$param.order=$orderMaps.s_t_desc;
}else{
$param.order=$orderMaps[$condition.order]?$orderMaps[$condition.order]:'';
if (!$condition.order) {
$param.order = $orderMaps.s_t_desc;
} else {
$param.order = $orderMaps[$condition.order] ? $orderMaps[$condition.order] : '';
}
if(!$condition.page){
$param.page=1;
if (!$condition.page) {
$param.page = 1;
}
if($condition.viewNum){
$param.viewNum=$condition.viewNum;
}else if(!$condition.limit){
$param.viewNum=60;
}else{
$param.viewNum=$condition.limit;
if ($condition.viewNum) {
$param.viewNum = $condition.viewNum;
} else if (!$condition.limit) {
$param.viewNum = 60;
} else {
$param.viewNum = $condition.limit;
delete $condition.limit;
}
if(!$condition){
if (!$condition) {
$param += $condition;
}
console.log(JSON.stringify($param));
return getUrl($type)+"?"+querystring.stringify($param);// searchApi.get(getUrl($type), $param,{cache:true});
}
return getUrl($type) + '?' + querystring.stringify($param);// searchApi.get(getUrl($type), $param,{cache:true});
};
module.exports = {
getProductUrl,
getBrandListUrl
}
};
... ...
... ... @@ -94,6 +94,6 @@ var Index = require(`${cRoot}/Index`);
// 我的评论
router.get('/comment', commentController.index);
router.get('/index', [getCommonHeader, getHomeNav],Index.index);
router.get('/index', [getCommonHeader, getHomeNav], Index.index);
module.exports = router;
... ...
... ... @@ -8,12 +8,12 @@ var $ = require('yoho-jquery');
require('./order-block');
//关闭消息提示
// 关闭消息提示
$('#close-message').click(function() {
$('.message-tip').slideUp(200);
});
//新品上架
// 新品上架
(function() {
var $naPager = $('.na-pager'),
$naUl = $('.new-arrival ul'),
... ... @@ -23,36 +23,36 @@ $('#close-message').click(function() {
$naUl.width($naUl.width() * naPage);
//最新上架翻页
// 最新上架翻页
$naPager.click(function() {
var $this = $(this),
left;
if ($this.hasClass('next')) {
//后翻
// 后翻
++naCurPage;
//第2页显示前翻按钮
// 第2页显示前翻按钮
if (naCurPage === 2) {
$this.siblings().removeClass('no-visible');
}
//最后一页隐藏后翻按钮
// 最后一页隐藏后翻按钮
if (naCurPage === naPage) {
$this.addClass('no-visible');
}
} else {
//前翻
// 前翻
--naCurPage;
//倒数第2页显示后翻按钮
// 倒数第2页显示后翻按钮
if (naCurPage === naPage - 1) {
$this.siblings().removeClass('no-visible');
}
//第1页隐藏前翻按钮
// 第1页隐藏前翻按钮
if (naCurPage === 1) {
$this.addClass('no-visible');
}
... ...
... ... @@ -126,7 +126,7 @@ function getAddressId(dom) {
return id;
}
//表单焦点显示
// 表单焦点显示
function focusAction(opt) {
var msg = '';
... ... @@ -157,7 +157,7 @@ function focusAction(opt) {
opt.$checkInfo.removeClass('form-prompt').addClass('form-focus').html(msg);
}
//表单失去焦点显示
// 表单失去焦点显示
function blurAction(opt) {
var regular = '',
res = true,
... ... @@ -284,7 +284,7 @@ function fullOneValidator() {
}
}
//校验所有内容
// 校验所有内容
function checkAllForm() {
var arr = [];
... ... @@ -357,4 +357,4 @@ $(document).ready(function() {
$('#btn-reset').click(function() {
address.clearAddrForm();
});
});
\ No newline at end of file
});
... ...
... ... @@ -14,7 +14,7 @@ var categoryTop = $category.offset() ? $category.offset().top : 0;
var timeout;
//用于临时存储数据
// 用于临时存储数据
var tempdata = {};
var templete = '<div class="brands-layer">';
... ... @@ -41,7 +41,7 @@ $.easing.easeOutQuint = function(x, t, b, c, d) {
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
};
//头部图片TAB切换展示
// 头部图片TAB切换展示
$tab.eq(0).parent('li').find('.brands-content').css('z-index', '1');
$tab.hover(function() {
var $this = $(this);
... ... @@ -61,7 +61,7 @@ $tab.hover(function() {
clearTimeout(timeout);
});
//品牌类别滚动事件
// 品牌类别滚动事件
$(window).scroll(function() {
if ($(this).scrollTop() > categoryTop) {
$gory.addClass('category-fix');
... ... @@ -70,7 +70,7 @@ $(window).scroll(function() {
}
});
//点击字母,页面滚动到相关区域
// 点击字母,页面滚动到相关区域
$category.click(function() {
var name = $(this).attr('href').split('#')[1];
var targetTop = $list.find('[name=' + name + ']').offset().top - categoryHeight;
... ... @@ -82,7 +82,7 @@ $category.click(function() {
});
//浮层代码
// 浮层代码
function bindTemplete($select, data, templete) {
var $this = $select;
var offset = {
... ... @@ -103,7 +103,7 @@ function bindTemplete($select, data, templete) {
}
}
//鼠标悬浮品牌,请求数据,并且展示
// 鼠标悬浮品牌,请求数据,并且展示
$brand.hover(function() {
var $this = $(this);
var key = $this.attr('data-key');
... ...
... ... @@ -121,4 +121,4 @@ $dialog.on('click', '.dialog-save-btn', function() {
$dialog.on('click', '.dialog-close-btn', function() {
$optDom.length = 0;
$dialog.addClass('hide');
});
\ No newline at end of file
});
... ...
... ... @@ -15,41 +15,41 @@ var $cancelBtn = $('.cancel-btn'),
var ajaxing = false;
var rule = {
title: {
dom: $title,
min: 1,
max: 10,
onshow: '请输入您的投诉主题',
onfocus: '请输入主题',
onmin: '投诉主题不能为空',
onmax: '输入投诉主题不能超过10个字'
},
customer: {
dom: $customer,
min: 1,
max: 10,
onshow: '请填写您要投诉的对象,比如:客服00*号、发货员...',
onfocus: '请填写您要投诉的对象',
onmin: '投诉对象不能为空',
onmax: '输入投诉对象不能超过10个字'
},
orderCode: {
dom: $orderCode,
regexp: /^([0-9,]{9,})$/, //一个和多个订单
onshow: '如果多个是多个订单号,请用英文逗号隔开,没有则不填',
onfocus: '请输入订单号',
onerror: '您输入的订单格式不对,如果多个是多个订单号,请用英文逗号隔开'
},
content: {
dom: $content,
min: 1,
max: 130,
onshow: '输入您投诉的内容',
onfocus: '请输入您投诉的内容',
onmin: '投诉内容不能为空',
onmax: '输入的投诉内容不能超过130个字'
}
};
title: {
dom: $title,
min: 1,
max: 10,
onshow: '请输入您的投诉主题',
onfocus: '请输入主题',
onmin: '投诉主题不能为空',
onmax: '输入投诉主题不能超过10个字'
},
customer: {
dom: $customer,
min: 1,
max: 10,
onshow: '请填写您要投诉的对象,比如:客服00*号、发货员...',
onfocus: '请填写您要投诉的对象',
onmin: '投诉对象不能为空',
onmax: '输入投诉对象不能超过10个字'
},
orderCode: {
dom: $orderCode,
regexp: /^([0-9,]{9,})$/, // 一个和多个订单
onshow: '如果多个是多个订单号,请用英文逗号隔开,没有则不填',
onfocus: '请输入订单号',
onerror: '您输入的订单格式不对,如果多个是多个订单号,请用英文逗号隔开'
},
content: {
dom: $content,
min: 1,
max: 130,
onshow: '输入您投诉的内容',
onfocus: '请输入您投诉的内容',
onmin: '投诉内容不能为空',
onmax: '输入的投诉内容不能超过130个字'
}
};
function preventResubmit() {
if (!ajaxing) {
... ... @@ -169,4 +169,4 @@ $cancelBtn.click(function() {
if (data && data.id) {
cancelComplaint(data.id, $(this).parent());
}
});
\ No newline at end of file
});
... ...
... ... @@ -8,4 +8,4 @@ var $ = require('yoho.jquery');
$('.filter-select').change(function() {
location.href = $(this).val();
});
\ No newline at end of file
});
... ...
... ... @@ -220,8 +220,8 @@ function addBrand(domObj, brandId, brandName) {
function checkBrand() {
var postData = {
brandName: $('#keywords').val()
};
brandName: $('#keywords').val()
};
$.post('/home/user/isbrandname', postData, function(data) {
if (data.code === 200) {
... ...
... ... @@ -18,4 +18,4 @@ require('./edit');
require('./gift');
require('./validate');
require('./address');
require('./common-address');
\ No newline at end of file
require('./common-address');
... ...
... ... @@ -23,7 +23,7 @@ var $curClock;
require('yoho.dotdotdot');
//商品收藏
// 商品收藏
(function() {
var $defaultSorts,
$allSorts;
... ... @@ -47,16 +47,16 @@ require('yoho.dotdotdot');
$noticeSuccess.find('.notice-num').text(5 - num);
}
//关闭价格订阅弹窗和蒙层
// 关闭价格订阅弹窗和蒙层
function closeNoticeBox() {
$bodyMask.addClass('hide');
$priceNotice.addClass('hide');
//重置头部文字
// 重置头部文字
$noticeSubOrCancel.text('订阅成功');
}
//显示价格订阅弹窗和蒙层
// 显示价格订阅弹窗和蒙层
function showNoticeBox() {
var top = $(document).scrollTop() + $(window).height() / 2;
... ... @@ -74,7 +74,7 @@ require('yoho.dotdotdot');
if ($curClock.hasClass('noticed')) {
//取消降价通知
// 取消降价通知
$.ajax({
type: 'GET',
url: '/home/favorite/cancelnotice',
... ... @@ -144,33 +144,33 @@ require('yoho.dotdotdot');
noticeNum = $noticeNum.text() * 1;
//展开分类
// 展开分类
$('#spread-sort').click(function() {
$defaultSorts.slideUp(function() {
$allSorts.slideDown();
});
});
//收起分类
// 收起分类
$('#retract-sort').click(function() {
$allSorts.slideUp(function() {
$defaultSorts.slideDown();
});
});
//降价通知
// 降价通知
$('.price-down-clock').click(function() {
$curClock = $(this);
curSkn = $curClock.closest('.fav-good').data('id');
showNoticeBox();
});
//checkbox【手动触发checkbox点击后跳转链接的地址】
// checkbox【手动触发checkbox点击后跳转链接的地址】
$('.reduction-filter input[type="checkbox"]').change(function() {
location.href = $(this).parent().attr('href');
});
//降价通知确定按钮
// 降价通知确定按钮
$('#price-notice').on('click', '.close', function() {
closeNoticeBox();
}).on('click', '.price-notice-sure', function() {
... ... @@ -179,7 +179,7 @@ require('yoho.dotdotdot');
if (!$priceNotice.hasClass('error') && !$noticeContent.hasClass('hide')) {
//订阅到手机号
// 订阅到手机号
phone = $.trim($phone.val());
if (phone === '' || !phoneReg.test(phone)) {
... ... @@ -216,7 +216,7 @@ require('yoho.dotdotdot');
reduction.change = false;
$('#price-notice .phone-diff').addClass('hide');
//切换商品通知文字
// 切换商品通知文字
$curClock.toggleClass('noticed').text(clockTxt.off);
} else {
if (data.message) {
... ... @@ -227,12 +227,12 @@ require('yoho.dotdotdot');
});
} else {
//关闭窗口
// 关闭窗口
closeNoticeBox();
}
});
//商品可参加活动
// 商品可参加活动
$('.has-activity').click(function() {
var $this = $(this),
$activites = $this.next('.activites'),
... ... @@ -240,12 +240,12 @@ require('yoho.dotdotdot');
if ($activites.hasClass('hide')) {
//显示
// 显示
$activites.removeClass('hide');
$li.css('padding-bottom', $activites.outerHeight());
} else {
//隐藏
// 隐藏
$activites.addClass('hide');
$li.css('padding-bottom', '');
}
... ... @@ -253,7 +253,7 @@ require('yoho.dotdotdot');
}());
//品牌收藏
// 品牌收藏
(function() {
var naTpl;
var naCache = {};
... ... @@ -275,16 +275,16 @@ require('yoho.dotdotdot');
curPage += flag;
//初始
// 初始
$pre.removeClass('hidden');
$next.removeClass('hidden');
//第一页
// 第一页
if (curPage === 1) {
$pre.addClass('hidden');
}
//最后一页
// 最后一页
if (curPage === page) {
$next.addClass('hidden');
}
... ... @@ -348,7 +348,7 @@ require('yoho.dotdotdot');
$naList.removeClass('hide').find('.na-content').html(html);
setListPadding($li, $naList);
//初始,判断是否显示Next翻页
// 初始,判断是否显示Next翻页
if (res.length > 5) {
$li.find('.na-next').removeClass('hidden');
}
... ... @@ -357,7 +357,7 @@ require('yoho.dotdotdot');
naCache[id] = {};
}
naCache[id].cache = true;//set cache
naCache[id].cache = true;// set cache
naCache[id].total = res.length;
}
});
... ... @@ -372,7 +372,7 @@ require('yoho.dotdotdot');
});
}());
//文章收藏
// 文章收藏
(function() {
if ($('.fav-articles').length < 0) {
return;
... ... @@ -385,12 +385,12 @@ if (param && param.length) {
favType = param[1];
}
//全选【通用】
// 全选【通用】
$('#me-checkall').click(function() {
$('.checkbox input[type="checkbox"]').prop('checked', $(this).prop('checked'));
});
//删除收藏
// 删除收藏
$('.del-favorite').click(function(e) {
var id = $(this).closest('.fav-row').data('id'),
shopid = $(this).closest('.fav-row').data('shopid'),
... ... @@ -414,7 +414,7 @@ $('.del-favorite').click(function(e) {
});
});
//删除多个商品/品牌/文章【通用】
// 删除多个商品/品牌/文章【通用】
$('#me-del-checked').click(function() {
var ids = [],
name = '商品';
... ... @@ -453,4 +453,4 @@ if (location.href.match(/is_reduction=(.*)[&]*/)) {
}
if (location.href.match(/is_promotion=(.*)[&]*/)) {
$('.activityChecked').attr('checked', true);
}
\ No newline at end of file
}
... ...
... ... @@ -85,7 +85,7 @@ var Gift = {
}
};
//更换验证码
// 更换验证码
function refreshCaptcha() {
var dt = new Date();
... ... @@ -118,4 +118,4 @@ $(document).on('click', '#imgcode,.check-img', function() {
$(function() {
refreshCaptcha();
Gift.bindGiftCardForm();
});
\ No newline at end of file
});
... ...
... ... @@ -25,12 +25,12 @@ $(document).on('mouseout', '.imgopacity a img', function() {
if ($.inArray(homePage, ['boys','girls','kids','lifestyle']) > -1) {
if ($.inArray(homePage, ['boys', 'girls', 'kids', 'lifestyle']) > -1) {
require('../common/new-arrivls')({
type: homePage,
url: '/common/getNewArrival',
count: (homePage === 'boys') || (homePage === 'lifestyle') ? 5 : 4,
rows: [5,3]
rows: [5, 3]
});
window.setCookie('_Channel', homePage, {
domain: '.yohobuy.com',
... ...
... ... @@ -32,4 +32,4 @@ $pickBtn.click(function() {
alert(msg);
});
});
\ No newline at end of file
});
... ...
... ... @@ -111,4 +111,4 @@ $container.on('click', '.read-choose-btn', function() {
id: operationId.join(',')
});
}
});
\ No newline at end of file
});
... ...
... ... @@ -21,7 +21,7 @@ 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 = {
... ... @@ -98,7 +98,7 @@ function showMessgaeDialog(message_icon, message_title, message_summary, cb) {
}
],
content: html,
className: 'message-dialog',
className: 'message-dialog'
};
return new Dialog(options);
... ... @@ -137,7 +137,7 @@ function editOrder(id) {
$tpl.remove();
$dialogEdit.remove();
//查看物流
// 查看物流
$('.check-logistics').click(function() {
$(this).siblings('.logistics').removeClass('hide');
});
... ... @@ -147,16 +147,16 @@ $('.close-logistics').click(function() {
});
//订单列表&订单详情【取消订单和确认收货】
// 订单列表&订单详情【取消订单和确认收货】
$('.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) {
var id = $(this).closest('.order, .order-detail').data('id');
//确认收货
// 确认收货
active = new Confirm({
cb: function() {
$.ajax({
... ... @@ -177,7 +177,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
active.show();
}).on('click', '.edit-order', function() {
$(this).addClass('edit-order-active');
active = editOrder($(this).closest('.order, .order-detail').data('id'))
active = editOrder($(this).closest('.order, .order-detail').data('id'));
active.show();
newAddress(0);
});
... ... @@ -186,7 +186,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
function newAddress(id) {
var code, codeId;
var pId = id || 0; //如果没有传id则获取所有省列表
var pId = id || 0; // 如果没有传id则获取所有省列表
var addressCodeReg = /[0-9]{2}/gi;
... ... @@ -203,10 +203,10 @@ function newAddress(id) {
var validate = validateForm();
code = $province.data("areacode") + '';
code = $province.data('areacode') + '';
codeId = !!code && code.match(addressCodeReg);
//获取省
// 获取省
getAddress({
id: pId,
type: 'getProvince',
... ... @@ -218,7 +218,7 @@ function newAddress(id) {
if (provinceId !== '0') {
isProvinceChecked = true;
//如果获取的省有默认选中项则获取市
// 如果获取的省有默认选中项则获取市
getAddress({
id: provinceId,
type: 'getCity',
... ... @@ -227,7 +227,7 @@ function newAddress(id) {
var cityId = $city.val();
//如果获取的市有默认选中项则获取县
// 如果获取的市有默认选中项则获取县
if (cityId !== '0') {
getAddress({
id: cityId,
... ... @@ -286,11 +286,12 @@ function newAddress(id) {
});
$tel.on('blur', function() {
validate.tel($.trim($telCode.val()), $.trim($tel.val()));
})
});
$county.on('change', function() {
validate.city($province.val(), $city.val(),$county.val());
})
validate.city($province.val(), $city.val(), $county.val());
});
}
/**
* @description: 改函数会返回地址信息
* d {Object} type: 'getProvince'获取省 type: 'getCity'获取城市 type: 'getCounty'获取县
... ... @@ -304,15 +305,15 @@ function getAddress(d, callback) {
if (d.type === 'getProvince') {
//url = 'getProvince';
// url = 'getProvince';
$obj = $province;
} else if (d.type === 'getCity') {
//url = 'getCity';
// url = 'getCity';
$obj = $city;
} else if (d.type === 'getCounty') {
//url = 'getCounty';
// url = 'getCounty';
$obj = $county;
}
... ... @@ -415,7 +416,7 @@ function saveAddress(id) {
} else {
new dialog.Alert(d.message).show();
}
})
});
}
function validateForm() {
var $err_name = $name.siblings('.error'),
... ... @@ -486,7 +487,7 @@ function validateForm() {
}
},
tel: function(telCode, tel) {
if(telCode === '' && tel === ''){
if (telCode === '' && tel === '') {
_right_html = '';
}
if ((!!telCode && !telCodeReg.test(telCode)) || (!!tel && !telReg.test(tel)) ||
... ... @@ -501,5 +502,5 @@ function validateForm() {
return true;
}
}
}
};
}
... ...
... ... @@ -8,7 +8,7 @@ var $ = require('yoho.jquery');
require('./order-block');
//不同订单包裹提示
// 不同订单包裹提示
$('.why').click(function() {
$('#differentBag').show();
... ... @@ -23,7 +23,7 @@ $(document).click(function() {
});
//订单包裹左右切换
// 订单包裹左右切换
function lunBo($pre, $next, $ul, $iWidth) {
var i = 1,
j = 1;
... ... @@ -71,7 +71,7 @@ function lunBo($pre, $next, $ul, $iWidth) {
});
}
//订单分类
// 订单分类
$('.bag').find('ul').each(function() {
var $pre = $(this).parent().parent().find('.pre');
var $next = $(this).parent().parent().find('.next');
... ...
... ... @@ -157,7 +157,7 @@ $file.each(function(e) {
$par = $this.closest('.problem-description');
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
window.location.origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
}
$this.qupload({
button_image_url: '',
... ... @@ -431,4 +431,4 @@ $('.save-btn').click(function() {
loadWaiting(false);
}
});
});
\ No newline at end of file
});
... ...
... ... @@ -92,4 +92,4 @@ $('#modify').click(function() {
$('#submit-btn').click(function() {
sendExpressCode();
});
\ No newline at end of file
});
... ...
... ... @@ -5,4 +5,4 @@
*/
require('./returns-detail');
require('./returns-apply');
\ No newline at end of file
require('./returns-apply');
... ...
... ... @@ -470,4 +470,4 @@ $(function() {
}
});
}
});
\ No newline at end of file
});
... ...
... ... @@ -21,7 +21,7 @@ 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 = {
... ... @@ -98,7 +98,7 @@ function showMessgaeDialog(message_icon, message_title, message_summary, cb) {
}
],
content: html,
className: 'message-dialog',
className: 'message-dialog'
};
return new Dialog(options);
... ... @@ -137,7 +137,7 @@ function editOrder(id) {
$tpl.remove();
$dialogEdit.remove();
//查看物流
// 查看物流
$('.check-logistics').click(function() {
$(this).siblings('.logistics').removeClass('hide');
});
... ... @@ -147,16 +147,16 @@ $('.close-logistics').click(function() {
});
//订单列表&订单详情【取消订单和确认收货】
// 订单列表&订单详情【取消订单和确认收货】
$('.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) {
var id = $(this).closest('.order, .order-detail').data('id');
//确认收货
// 确认收货
active = new Confirm({
cb: function() {
$.ajax({
... ... @@ -177,7 +177,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
active.show();
}).on('click', '.edit-order', function() {
$(this).addClass('edit-order-active');
active = editOrder($(this).closest('.order, .order-detail').data('id'))
active = editOrder($(this).closest('.order, .order-detail').data('id'));
active.show();
newAddress(0);
});
... ... @@ -186,7 +186,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
function newAddress(id) {
var code, codeId;
var pId = id || 0; //如果没有传id则获取所有省列表
var pId = id || 0; // 如果没有传id则获取所有省列表
var addressCodeReg = /[0-9]{2}/gi;
... ... @@ -203,10 +203,10 @@ function newAddress(id) {
var validate = validateForm();
code = $province.data("areacode") + '';
code = $province.data('areacode') + '';
codeId = !!code && code.match(addressCodeReg);
//获取省
// 获取省
getAddress({
id: pId,
type: 'getProvince',
... ... @@ -218,7 +218,7 @@ function newAddress(id) {
if (provinceId !== '0') {
isProvinceChecked = true;
//如果获取的省有默认选中项则获取市
// 如果获取的省有默认选中项则获取市
getAddress({
id: provinceId,
type: 'getCity',
... ... @@ -227,7 +227,7 @@ function newAddress(id) {
var cityId = $city.val();
//如果获取的市有默认选中项则获取县
// 如果获取的市有默认选中项则获取县
if (cityId !== '0') {
getAddress({
id: cityId,
... ... @@ -286,11 +286,12 @@ function newAddress(id) {
});
$tel.on('blur', function() {
validate.tel($.trim($telCode.val()), $.trim($tel.val()));
})
});
$county.on('change', function() {
validate.city($province.val(), $city.val(),$county.val());
})
validate.city($province.val(), $city.val(), $county.val());
});
}
/**
* @description: 改函数会返回地址信息
* d {Object} type: 'getProvince'获取省 type: 'getCity'获取城市 type: 'getCounty'获取县
... ... @@ -304,15 +305,15 @@ function getAddress(d, callback) {
if (d.type === 'getProvince') {
//url = 'getProvince';
// url = 'getProvince';
$obj = $province;
} else if (d.type === 'getCity') {
//url = 'getCity';
// url = 'getCity';
$obj = $city;
} else if (d.type === 'getCounty') {
//url = 'getCounty';
// url = 'getCounty';
$obj = $county;
}
... ... @@ -415,7 +416,7 @@ function saveAddress(id) {
} else {
new dialog.Alert(d.message).show();
}
})
});
}
function validateForm() {
var $err_name = $name.siblings('.error'),
... ... @@ -486,7 +487,7 @@ function validateForm() {
}
},
tel: function(telCode, tel) {
if(telCode === '' && tel === ''){
if (telCode === '' && tel === '') {
_right_html = '';
}
if ((!!telCode && !telCodeReg.test(telCode)) || (!!tel && !telReg.test(tel)) ||
... ... @@ -501,5 +502,5 @@ function validateForm() {
return true;
}
}
}
};
}
... ...
... ... @@ -126,11 +126,11 @@ exports.getImageUrl = (fileName, width, height, mode, bucket) => {
}
return myReplace(fileName, {width: width, height: height, mode: mode});
};
exports.getSourceUrl=(fileName, bucket)=>{
if(fileName.indexOf('http://')===0){
exports.getSourceUrl = (fileName, bucket)=>{
if (fileName.indexOf('http://') === 0) {
return fileName;
}
let domain = getDomain(bucket, fileName);
return '//' + domain + '/' + bucket + fileName;
}
};
... ...