Authored by ccbikai

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -31,7 +31,7 @@ yoho币 | /home/mycurrency |
关于我们 | /home/about |
物流详情 | /home/logistic?order_code=1609827614 |
退换货物流详情| /home/logistic?order_code=1609827614&type=refund|
退换货列表 | /home/refund/orders |
--------------------------------------------------------------------------------
----
... ...
... ... @@ -16,7 +16,7 @@ const exchange = {
// 订单 可换货商品列表
order(req, res, next) {
const uid = req.user.uid || 8050882;
const uid = 8041886;
const orderId = req.query.orderId;
if (!orderId) {
... ... @@ -48,6 +48,21 @@ const exchange = {
exchangeModel.submitExchange(uid, req.body).then(result => {
res.json(result);
}).catch(next);
},
/**
* 取消换货申请
* @param req
* @param res
* @param next
*/
cancelApply(req, res, next) {
let id = req.body.id;
let uid = req.user.id;
exchangeModel.cancelApply(uid, id).then(result => {
return res.json(result);
}).catch(next);
}
};
... ...
... ... @@ -4,21 +4,18 @@
*/
'use strict';
const favModel = require('../models/favorite');
const helpers = global.yoho.helpers;
const fav = {
favorite: (req, res) => {
if (req.query.tab === 'brand') {
res.render('favorite-brand', {
module: 'home',
page: 'favorite-brand',
brandUrl: helpers.urlFormat('/product/new')
page: 'favorite-brand'
});
} else {
res.render('favorite', {
module: 'home',
page: 'favorite',
productUrl: helpers.urlFormat('/product/new')
page: 'favorite'
});
}
},
... ...
... ... @@ -5,7 +5,6 @@
*/
'use strict';
const homeModel = require('../models/index');
const _ = require('lodash');
const helpers = global.yoho.helpers;
/**
... ... @@ -29,12 +28,10 @@ const component = {
page: 'index',
noLocalCSS: true,
head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
nickname: proData ? proData.nickname : '登录/注册',
userinfourl: proData ? '/home/mydetails' : '',
serviceUrl: '/home/service'
nickname: proData ? proData.nickname : '登录/注册'
};
res.render('index', _.merge(result, data[1]));
res.render('index', Object.assign(result, data[1]));
}).catch(next);
},
mydetails: (req, res, next) => {
... ... @@ -121,22 +118,12 @@ const component = {
},
saveFeedback: (req, res, next) => {
let saveFeedbackPara = {
uid: req.user.uid,
udid: req.user.udid, // todo
content: req.body.content,
suggest_type: 2
};
if (req.user && req.user.uid) {
_.merge(saveFeedbackPara, {
uid: req.user.uid
});
}
if (req.user && req.user.udid && !req.user.uid) {
_.merge(saveFeedbackPara, {
udid: req.user.udid
});
}
homeModel.saveFeedback(saveFeedbackPara).then(result => {
if (result.code === 200) {
return res.json({
... ...
... ... @@ -90,6 +90,27 @@ const refund = {
refundModel.getRefundOrders(param).then(result => {
return res.json(result);
});
},
/**
* 取消申请
* @param req
* @param res
*/
cancelApply(req, res) {
let uid = req.user.id;
let id = req.body.id;
uid = testUid;
if (!uid && req.xhr) {
return res.json({
code: notLoginCode,
message: notLoginTip
});
}
refundModel.cancelRefundApply(uid, id).then(result => {
return res.json(result);
});
}
};
... ...
... ... @@ -36,6 +36,19 @@ const exchange = {
}, params);
return api.post('', data).then(global.yoho.camelCase);
},
/**
* 取消换货申请
* @param uid
* @param id
*/
cancelApply(uid, id) {
return api.post('', {
uid: uid,
id: id,
method: 'app.change.cancel'
}).then(global.yoho.camelCase);
}
};
... ...
... ... @@ -16,48 +16,10 @@ exports.getFavProductData = (uid, page, limit) => {
uid: uid,
page: page,
limit: limit
}, {
code: 200
}).then(result => {
var isend = true,
list = [],
data = result.data;
if (data && page <= data.page_total) {
data.product_list.forEach(function(d) {
if (!d.product_skn) {
return;
}
let link = '';
let discountPrice = false;
if (d.goodsId && d.cnAlphabet) {
link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`);
}
if (Number(d.market_price) - Number(d.sales_price) > 0) {
discountPrice = '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2);
}
list.push({
fav_id: d.product_id,
link: link,
imgUrl: d.image ? helpers.image(d.image) : '',
title: d.product_name,
price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
discountPrice: discountPrice,
sellOut: d.storage <= 0,
invalidGoods: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return {
isend: isend,
list: list
};
return result.data ? global.yoho.camelCase(result.data) : {};
});
};
... ... @@ -77,31 +39,10 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
gender: gender,
page: page,
limit: limit
}, {
code: 200
}).then(result => {
var isend = true,
list = [],
data = result.data;
if (data && page <= data.page_total) {
data.brand_list.forEach(function(d) {
list.push({
fav_id: d.brand_id,
link: '', // todo
imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '',
brandName: d.brand_name,
down: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return {
isend: isend,
list: list
};
return result.data ? global.yoho.camelCase(result.data) : {};
});
};
... ...
... ... @@ -2,7 +2,6 @@
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const Promise = require('bluebird');
const _ = require('lodash');
const helpers = global.yoho.helpers;
/**
... ... @@ -15,6 +14,8 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => {
return api.get('', {
uid: uid,
method: 'app.passport.profile'
}, {
code: 200
}).then(result => {
return result.data;
});
... ... @@ -30,9 +31,13 @@ const _getInfoNumData = (uid) => {
return api.all([api.get('', {
uid: uid,
method: 'app.home.getInfoNum' // 收藏及订单数目数据
}, {
code: 200
}), api.get('', {
uid: uid,
method: 'app.address.gethidden' // 用户地址的数据
}, {
code: 200
})]).then(data => {
let res = {
wait_pay_num: '',
... ... @@ -44,22 +49,18 @@ const _getInfoNumData = (uid) => {
yoho_coin_num: ''
};
if (data[0].data) {
for (let k in data[0].data) {
if (res[k] !== null) {
res[k] = data[0].data[k] ? data[0].data[k] : '';
if (k !== 'yoho_coin_num' && res[k] > 99) {
res[k] = '99+';
}
for (let k in data[0].data) {
if (res[k] !== null) {
res[k] = data[0].data[k] ? data[0].data[k] : '';
if (k !== 'yoho_coin_num' && res[k] > 99) {
res[k] = '99+';
}
}
}
if (data[1].data) {
res = _.merge(res, {
address_num: data[1].data.length ? data[1].data.length : ''
});
}
return res;
return Object.assign(res, {
address_num: data[1].data && data[1].data.length ? data[1].data.length : ''
});
});
};
... ... @@ -86,12 +87,14 @@ exports.getHelpInfo = (data) => {
},
infoData = Object.assign(defaultParam, data);
return api.get('', infoData).then(result => {
return api.get('', infoData, {
code: 200
}).then(result => {
var helpData = result.data;
var formatData = [];
helpData = helpData || [];
_.forEach(helpData, (item) => {
helpData.forEach(function(item) {
formatData.push({
name: item.caption,
code: item.code,
... ... @@ -117,9 +120,9 @@ exports.getHelpDetail = (data) => {
},
detailData = Object.assign(defaultParam, data);
return api.get('', detailData).then(result => {
return result;
});
return api.get('', detailData, {
code: 200
}).then(result => result);
};
/**
... ... @@ -149,7 +152,5 @@ exports.saveMydetails = (params) => {
},
data = Object.assign(defaultParam, params);
return api.get('', data).then(result => {
return result;
});
return api.get('', data).then(result => result);
};
... ...
... ... @@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => {
*/
exports.cancelOrder = (orderCode, reasonId, reason) => {
return api.get('057f5f856dff8b58.json', {
return api.post('', {
method: 'app.SpaceOrders.close',
order_code: orderCode,
reason_id: reasonId,
... ... @@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => {
*/
exports.confirmOrder = (orderCode) => {
return api.get('', {
return api.post('', {
method: 'app.SpaceOrders.confirm',
order_code: orderCode
}).then(result => {
... ... @@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => {
* @returns {Promise.<T>|*}
*/
exports.deleteOrder = (orderCode, uid) => {
return api.get('', {
return api.post('', {
method: 'app.SpaceOrders.delOrderByCode',
order_code: orderCode,
uid: uid
... ...
... ... @@ -28,6 +28,8 @@ const refund = {
getExpressCompany() {
return api.get('', {
method: 'app.express.getExpressCompany'
}, {
code: 200
});
},
... ... @@ -42,12 +44,28 @@ const refund = {
* @returns {Promise.<T>|*}
*/
getRefundOrders(param) {
param = Object.assign({method: 'app.refund.getList'}, param);
param = Object.assign({
method: 'app.refund.getList'
}, param);
return api.get('', param, {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
/**
* 取消退货申请
*
* @param uid 用户id
* @param id 退货id
*/
cancelRefundApply(uid, id) {
return api.post('', {
uid: uid,
id: id,
method: 'app.refund.cancel'
}).then(global.yoho.camelCase);
}
};
... ...
... ... @@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据
router.post('/refund/submit', refund.submit); // 提交信息
router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息
router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息
router.post('/refund/cancel-apply', refund.cancelApply); // 退货 - 取消申请
router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态
router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表
... ... @@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange);
router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品
router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式
router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请
router.post('/exchange/cancel-apply', exchange.cancelApply); // AJAX 取消换货申请
router.get('/mydetails', home.mydetails); // 个人信息
router.post('/save-mydetails', home.saveMydetails); // 保存个人信息
... ...
<div class="yoho-favorite-brand-page">
<div class="fav-content" id="fav-content">
<fav-brand-list brand-url='{{brandUrl}}'></fav-brand-list>
<fav-brand-list></fav-brand-list>
</div>
</div>
\ No newline at end of file
</div>
... ...
<div class="yoho-favorite-page">
<div class="fav-content" id="fav-content">
<fav-product-list product-url='{{productUrl}}'></fav-product-list>
<fav-product-list></fav-product-list>
</div>
</div>
\ No newline at end of file
</div>
... ...
<div class="my-page">
<div class="my-header">
<span class="setting icon icon-setting" id="setting"></span>
<a class="user-info" id="user-info" {{#if userinfourl}} href='{{userinfourl}}' {{/if}}>
<a class="user-info no-intercept" id="user-info" href='/home/mydetails'>
<span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span>
<br><span class="username">{{nickname}}</span>
</a>
</div>
<div class="my-order">
<a class="order-title" href="/home/orders?type=1">
<a class="order-title no-intercept" href="/home/orders?type=1">
我的订单
<span class="read-order">
查看全部订单 <span class="icon icon-right"></span>
</span>
</a>
<div class="order-type clearfix">
<a class="type-item" href="/home/orders?type=2">
<a class="type-item no-intercept" href="/home/orders?type=2">
<span class="icon icon-wait-pay"></span>
<br>待付款
{{#if wait_pay_num}}
<span class="num">{{wait_pay_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/orders?type=3">
<a class="type-item no-intercept" href="/home/orders?type=3">
<span class="icon icon-wait-cargo"></span>
<br>待发货
{{#if wait_cargo_num}}
<span class="num">{{wait_cargo_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/orders?type=4">
<a class="type-item no-intercept" href="/home/orders?type=4">
<span class="icon icon-send-cargo"></span>
<br>待收货
{{#if send_cargo_num}}
<span class="num">{{send_cargo_num}}</span>
{{/if}}
</a>
<a class="type-item" href="/home/refund/orders">
<a class="type-item no-intercept" href="/home/refund/orders">
<span class="icon icon-refund-exchange"></span>
<br>退换货
{{#if refund_exchange_num}}
... ... @@ -45,33 +45,33 @@
</div>
</div>
<div class="group-list">
<a class="list-item" id="address">
<a class="list-item no-intercept" id="address">
地址管理
<span class="num">{{address_num}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/favorite">
<a class="list-item no-intercept" href="/home/favorite">
收藏的商品
<span class="num">{{product_favorite_total}} <span class="icon icon-right"></span></span>
</a>
<a class="list-item" href="/home/favorite?tab=brand">
<a class="list-item no-intercept" href="/home/favorite?tab=brand">
收藏的品牌
<span class="num">{{brand_favorite_total}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/mycurrency">
<a class="list-item no-intercept" href="/home/mycurrency">
YOHO 币
<span class="num">{{yoho_coin_num}} <span class="icon icon-right"></span></span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/help">
<a class="list-item no-intercept" href="/home/help">
帮助中心
<span class="num"><span class="icon icon-right"></span></span>
</a>
<a class="list-item" href="{{serviceUrl}}">
<a class="list-item no-intercept" href="/home/service">
在线客服
<span class="num"><span class="icon icon-right"></span></span>
</a>
... ...
... ... @@ -9,6 +9,7 @@
// const helpers = global.yoho.helpers;
const model = require('../models/detail');
const camelCase = global.yoho.camelCase;
/**
* 商品详情
... ... @@ -25,7 +26,7 @@ const component = {
const id = req.params[0];
let params = {
uid: req.user.uid || 0,
uid: req.user.uid || 8050378,
article_id: id,
client_type: 'h5'
};
... ... @@ -33,6 +34,72 @@ const component = {
model.index(params).then(result => {
res.json(result);
}).catch(next);
},
/**
* 点赞
*
* @param req
* @param res
* @param next
*/
like(req, res, next) {
const params = {
article_id: req.params[0],
udid: req.sessionID
// uid: req.user.uid || 8050378
};
model.like(params, 'true' === req.query.flag).then(result => {
res.json(result);
}).catch(next);
},
/**
* 收藏
*
* @param req
* @param res
* @param next
*/
favorite(req, res, next) {
const params = {
article_id: req.params[0],
uid: req.user.uid || 8050378
};
/*
if (!req.user.id) {
res.json({
code: 403
});
return;
}
*/
model.favorite(params, 'true' === req.query.flag).then(result => {
res.json(result);
}).catch(next);
},
/**
* 杂项信息
*
* @param req
* @param res
* @param next
*/
misc(req, res, next) {
const params = {
article_id: req.params[0],
uid: req.user.uid || 8050378,
udid: req.sessionID
};
model.misc(params).then(result => {
res.json(camelCase(result));
}).catch(next);
}
};
... ...
... ... @@ -23,7 +23,7 @@ module.exports = {
getNewsList: (req, res, next) => {
let params = {
page: req.body.page,
gender: req.body.gender,
channel: req.body.channel,
uid: req.user.uid
};
... ...
... ... @@ -30,6 +30,67 @@ const model = {
return camelCase([article, content, brands, other]);
})();
},
/**
* 点赞
*
* @param params
* @param flag
* @returns {*}
*/
like(params, flag) {
return Promise.coroutine(function*() {
let ret = null;
if (flag) {
ret = yield serviceAPI.get('guang/api/v2/praise/setPraise', params);
} else {
ret = yield serviceAPI.get('guang/api/v2/praise/cancel', params);
}
const misc = yield serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({
id: params.article_id
}, params));
return [ret, misc];
})();
},
/**
* 收藏
*
* @param params
* @param flag
* @returns {*}
*/
favorite(params, flag) {
return Promise.coroutine(function*() {
let ret = null;
if (flag) {
ret = yield serviceAPI.get('guang/api/v1/favorite/setFavorite', params);
} else {
ret = yield serviceAPI.get('guang/api/v1/favorite/cancelFavorite', params);
}
const misc = yield serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({
id: params.article_id
}, params));
return [ret, misc];
})();
},
/**
* 其它信息
*
* @param params
*/
misc(params) {
return serviceAPI.get('guang/api/v2/article/getArticleBaseInfo', Object.assign({
id: params.article_id
}, params));
}
};
... ...
... ... @@ -8,13 +8,25 @@
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
const yhChannel = {
men: {
channel: '1,3'
},
women: {
channel: '2,3'
},
all: {
channel: '1,2,3'
}
};
module.exports = {
/* 资讯列表页数据获取 */
getNewsListData(params) {
return serviceAPI.get('guang/api/v2/article/getList', {
sort_id: '',
gender: params.gender,
gender: yhChannel[params.channel].channel,
uid: params.uid || '0',
page: params.page,
limit: '10'
... ...
... ... @@ -15,6 +15,9 @@ const detail = require(`${cRoot}/detail`);
router.get(/\/([\d]+)(.*)/, detail.index); // 详情routers
router.get(/news_(\d+)\.json/, detail.news);
router.get(/like_(\d+)\.json/, detail.like);
router.get(/favorite_(\d+)\.json/, detail.favorite);
router.get(/misc_(\d+)\.json/, detail.misc);
const news = require(`${cRoot}/index`);
... ...
... ... @@ -43,12 +43,12 @@ const model = {
*
* @param params
*/
favorite(params) {
favorite(params, flag) {
let method = '';
if (params.operation === 'add') {
if (flag) {
method = 'app.favorite.add';
} else if (params.operation === 'remove') {
} else {
method = 'app.favorite.cancel';
}
... ...
... ... @@ -37,6 +37,7 @@
"serve-favicon": "^2.3.0",
"uuid": "^2.0.2",
"vue-loader": "^8.5.3",
"vue-touch": "^1.1.0",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.1.4",
"yoho-md5": "^2.0.0",
... ... @@ -77,6 +78,7 @@
"stylelint": "^6.9.0",
"stylelint-config-yoho": "1.2.5",
"vue-loader": "^8.5.3",
"vue-touch": "^1.1.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1",
"webpack-stream": "^3.1.0",
... ...
<div class="select">
<ul>
{{#each items}}
<li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{val}}</li>
<li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{{val}}}</li>
{{/each}}
<li class="item-del">
<span>取消</span>
... ...
... ... @@ -43,14 +43,14 @@ function Select(items) {
if (elem.parent().length === 0) {
const lis = elem.find('.item-li');
lis.each(function() {
if (!$(this).attr('status')) {
lis.each(function(index) {
if ($(this).attr('status') === 'false' || $(this).attr('status') === '') {
$(this).click(function(e) {
hide();
cb({
key: $(e.target).attr('key'),
val: e.target.innerHTML
});
cb(Object.assign({
key: e.target.getAttribute('key'),
val: e.target.innerText
}, items[index]));
});
}
});
... ...
... ... @@ -7,67 +7,68 @@
const $ = require('yoho-jquery');
$.ajax({
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
dataType: 'script',
cache: true,
success: function() {
$.ajax({
url: '/api/wechat/share/token',
data: {
url: location.href
},
success: function(res) {
if (window.wx) {
window.wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
if (/MicroMessenger/i.test(navigator.userAgent)) {
$.ajax({
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
dataType: 'script',
cache: true,
success: function() {
$.ajax({
url: '/api/wechat/share/token',
data: {
url: location.href
},
success: function(res) {
if (window.wx) {
window.wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
}
}
});
}
});
});
}
});
}
module.exports = (shareData) => {
if (window.wx) {
window.wx.ready(function() {
... ...
... ... @@ -8,7 +8,7 @@ let Vue = require('yoho-vue');
*
* {value | resize 100 200 2} ==> /100/200/2
*/
Vue.filter('resize', (value, width, height, mode)=> {
Vue.filter('resize', (value, width, height, mode) => {
return value ? value.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
const dict = {
'{width}': width,
... ... @@ -27,7 +27,7 @@ Vue.filter('resize', (value, width, height, mode)=> {
*
* {value | gender}
*/
Vue.filter('clothingGenderIdentity', (value)=> {
Vue.filter('clothingGenderIdentity', (value) => {
let ret = null;
switch (value) {
... ... @@ -49,7 +49,7 @@ Vue.filter('clothingGenderIdentity', (value)=> {
*
* @param value brand domain
*/
Vue.filter('brandUrl', (value)=> {
Vue.filter('brandUrl', (value) => {
return `/product/shop?domain=${value}`;
});
... ... @@ -57,6 +57,7 @@ Vue.filter('brandUrl', (value)=> {
* 产品 URL
*/
Vue.filter('goodsUrl', productId => {
if (!productId) return '';
return `/product/${productId}`;
});
... ...
... ... @@ -24,13 +24,11 @@ const cate = {
lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad'
};
/* 资讯列表资源位 */
/* TODO 资讯列表资源位 */
const news = {
new: 'd4fdfcad1ec877d466d9780efaf4d296',
sports: 'e1f8dce8cb9de1a0977479c13c4d3dcc',
life: '5c0b9963d8b75e6fd788a2b49402be14',
sneakers: 'c4a62196c30cae5301e419aa3f77747b',
fashion: '70bc6b9d5c96bb7698eab85c7cd5ebbe'
all: 'd4fdfcad1ec877d466d9780efaf4d296',
men: 'e1f8dce8cb9de1a0977479c13c4d3dcc',
women: '5c0b9963d8b75e6fd788a2b49402be14'
};
module.exports = {
... ...
const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const favBrandList = require('home/fav-brand-list.vue');
const VueTouch = require('vue-touch');
Vue.use(VueTouch)
require('common/vue-filter');
Vue.use(VueTouch)
Vue.use(infiniteScroll);
new Vue({
... ...
const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const favProductList = require('home/fav-product-list.vue');
const VueTouch = require('vue-touch');
Vue.use(VueTouch)
require('common/vue-filter');
Vue.use(VueTouch)
Vue.use(infiniteScroll);
new Vue({
... ...
... ... @@ -2,31 +2,31 @@ var yoho = require('yoho');
var $ = require('yoho-jquery');
var interceptClick = require('common/intercept-click');
$('.my-page').on('click', 'a', function() {
// 拦截跳转
var href = $(this).attr('href');
if (href) {
interceptClick(href);
return false;
}
});
// 跳转登录页
$('#user-info').on('click', function() {
var href = $(this).attr('href');
if (!href) {
yoho.goLogin();
}
});
// 地址管理
$('#address').on('click', function() {
yoho.goAddress({
'type': '2'
});
return false;
});
// 系统设置
$('#setting').on('click', function() {
yoho.goSetting();
return false;
});
$('.my-page').on('click', 'a', function() {
// 未登录时跳转至登录页
if (!yoho.isLogin) {
yoho.goLogin();
return false;
}
// 拦截跳转
var href = $(this).attr('href');
if (href) {
interceptClick(href);
return false;
}
});
... ...
... ... @@ -8,7 +8,7 @@
*
* 希望能与 微信 JS-SDK 一样方便
*/
const cookie = require('yoho-cookie');
const tip = require('common/tip');
/* 空方法 */
... ... @@ -24,6 +24,11 @@ const yoho = {
isApp: /yh_blk/i.test(navigator.userAgent || ''),
/**
* 判断是否是 登录
*/
isLogin: cookie.get('_YOHOUID'),
/**
* JS 与 APP 共享的对象
*/
data: window.yohoInterfaceData,
... ...
... ... @@ -12,7 +12,7 @@
.setting {
float: left;
margin-top: 30px;
margin-top: 40px;
margin-left: 15px;
font-size: 46px;
}
... ...
... ... @@ -212,6 +212,7 @@ body {
border: 0 none;
background: $white;
font-size: 28px;
margin-right: 10px;
&.black {
width: 192px;
... ... @@ -237,3 +238,7 @@ body {
}
}
}
.select .overdue{
color: #b0b0b0;
}
\ No newline at end of file
... ...
... ... @@ -199,3 +199,40 @@ $white: #fff;
}
}
}
.order-empty {
width: 100%;
height: 100%;
text-align: center;
background: $white;
&:before {
content: "";
display: inline-block;
width: 153px;
height: 195px;
margin-top: 290px;
background: resolve("home/noorder.png") no-repeat;
background-size: 100%;
}
p{
color: #b0b0b0;
}
p:first-of-type{
font-size: 34px;
margin: 50px 0 20px;
}
a{
display: inline-block;
width: 414px;
height: 94px;
margin-top: 60px;
background: $black;
color: $white;
line-height: 94px;
font-size: 28px;
}
}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@
<button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
<button class="button" @click="yoho.goPay()">支付</button>
<button class="button" @click="yoho.goBack()">返回</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com/product/shop/share?domain=sctest1"})'>分享</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com/example/app"})'>分享</button>
<button class="button" @click='yoho.goSearch()'>搜索</button>
<button class="button" @click='yoho.goSetting()'>设置</button>
<button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
... ... @@ -27,6 +27,7 @@
<script>
const yoho = require('yoho');
const modal = require('common/modal');
const share = require('common/share');
module.exports = {
data() {
... ... @@ -41,6 +42,13 @@
modal.alert('传递的信息是:' + data);
}
});
share({
title: '标题',
link: location.href,
desc: '我在BLK发现了一个不错的品牌,赶快来看看吧!',
imgUrl: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg'
});
},
methods: {
addressCallback(info) {
... ...
... ... @@ -8,9 +8,9 @@
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
<a :href="item.link">
<a :href="item.link | brandUrl">
<div class="fav-img-box">
<img :src="item.imgUrl" alt=""/>
<img :src="item.imgUrl | resize 160 125" alt=""/>
</div>
<div class="fav-info-list">
<span class="title">{{item.brandName}}</span>
... ... @@ -29,7 +29,7 @@
<div class="fav-null-box {{ nullbox }}">
<span class="fav-null">您暂无收藏任何品牌</span>
<a slot="go-shopping" class="go-shopping" :href="brandUrl">随便逛逛</a>
<a slot="go-shopping" class="go-shopping" href="/product/new">随便逛逛</a>
</div>
</div>
</template>
... ... @@ -40,7 +40,6 @@
const yoho = require('yoho');
module.exports = {
props: ['brandUrl'],
data() {
return {
nullbox: 'hide',
... ... @@ -65,21 +64,26 @@
page: ++_this.page,
tab: 'brand'
}
}).then(result => {
if (result.isend) {
}).then(data => {
if (_this.page === data.pageTotal) {
_this.busy = true;
} else {
_this.busy = false;
}
if (result.list.length) {
result.list.forEach(function(o) {
if (!_this.keys[o.fav_id]) {
_this.keys[o.fav_id] = true;
_this.brandData.push(o);
data.brandList.forEach(function(o){
if (!_this.keys[o.brandId]) {
_this.keys[o.brandId] = true;
_this.brandData.push({
fav_id: o.brandId,
link: o.brandDomain,
imgUrl: o.brandIco,
brandName: o.brandName,
down: o.status === 0
});
}
});
}
})
_this.nullbox = _this.brandData.length ? 'hide' : '';
}).fail(() => {
... ...
... ... @@ -8,9 +8,9 @@
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
<a :href="item.link">
<a :href="item.link | goodsUrl">
<div class="fav-img-box">
<img :src="item.imgUrl" alt=""/>
<img :src="item.imgUrl | resize 152 203" alt=""/>
</div>
<div class="fav-info-list">
<span class="title">{{item.title}}</span>
... ... @@ -34,7 +34,7 @@
</ul>
<div class="fav-null-box {{ nullbox }}">
<span class="fav-null">您暂无收藏任何商品</span>
<a slot="go-shopping" class="go-shopping" :href="productUrl">随便逛逛</a>
<a slot="go-shopping" class="go-shopping" href='/product/new'>随便逛逛</a>
</div>
</div>
</template>
... ... @@ -45,7 +45,6 @@
const yoho = require('yoho');
module.exports = {
props: ['productUrl'],
data() {
return {
nullbox: 'hide',
... ... @@ -69,21 +68,39 @@
data: {
page: ++_this.page
}
}).then(result => {
if (result.isend) {
}).then(data => {
if (_this.page === data.pageTotal) {
_this.busy = true;
} else {
_this.busy = false;
}
if (result.list.length) {
result.list.forEach(function(o) {
if (!_this.keys[o.fav_id]) {
_this.keys[o.fav_id] = true;
_this.productData.push(o);
data.productList.forEach(function(o){
if (!o.productSkn) {
return;
}
if (!_this.keys[o.productId]) {
_this.keys[o.productId] = true;
let discountPrice = false;
if (Number(o.marketPrice) - Number(o.salesPrice) > 0) {
discountPrice = '¥' + Number(Math.max(o.salesPrice, 0)).toFixed(2);
}
});
}
_this.productData.push({
fav_id: o.productId,
link: o.goodsId && o.cnAlphabet ? o.productId : '',
imgUrl: o.image,
title: o.productName,
price: '¥' + Number(Math.max(o.marketPrice, 0)).toFixed(2),
discountPrice: discountPrice,
sellOut: o.storage <= 0,
invalidGoods: o.status === 0
});
}
})
_this.nullbox = _this.productData.length ? 'hide' : '';
}).fail(() => {
... ...
... ... @@ -43,10 +43,11 @@
<div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3">
<button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
<button v-if="order.status == 4 || order.status == 5 ">查看物流</button>
<button v-if="order.status == 4 || order.status == 5 " @click="seeExpress(order.orderCode)">查看物流</button>
<button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button>
<button v-if="order.status == 6" class="normal">再次购买</button>
<button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button>
</div>
</template>
<script>
... ... @@ -56,6 +57,7 @@
const tip = require('common/tip');
const Modal = require('common/modal');
const yohoAPI = require('yoho');
let genderSel = require('common/select');
module.exports = {
data() {
... ... @@ -76,6 +78,24 @@
}).then(result => {
if (result.code === 200) {
this.$set('order', result.data);
genderSel = genderSel([
{
key: this.order.isSupportRefund,
val: this.order.isSupportRefund === 'Y' ? '申请退货' : '<span class="overdue">申请退货(已过期限)</span>',
url: '/home/refund?orderId=' + this.order.orderCode,
disabled: this.order.isSupportRefund !== 'Y'
},
{
key: this.order.isSupportExchange,
val: this.order.isSupportExchange === 'Y' ? '申请换货' : '<span class="overdue">申请换货(已过期限)</span>',
url: '/home/exchange?orderId=' + this.order.orderCode,
disabled: this.order.isSupportExchange !== 'Y'
},
{
key: 'onlineService',
val: '在线客服'
}
]);
} else {
tip(result.message);
}
... ... @@ -161,8 +181,19 @@
goBuy(code) {
yohoAPI.goPay({orderid: code});
},
seeExpress() {
location.href = '';
seeExpress(code) {
location.href = '/home/logistic?order_code='+code;
},
/**
* 申请售后
*/
applyRefund(code) {
genderSel.show(function(item) {
console.log(item);
return;
location.href = item.url;
});
}
}
};
... ...
... ... @@ -30,7 +30,7 @@
<div class="options">
<button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
<button v-if="order.status === 4 || order.status === 5 ">查看物流</button>
<button v-if="order.status === 4 || order.status === 5 " @click="seeExpress(order.orderCode)">查看物流</button>
<button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button>
<button v-if="order.status === 6" class="normal">再次购买</button>
... ... @@ -39,6 +39,11 @@
</div>
</li>
</ul>
<div class="order-empty {{emptybox}}">
<p>您暂时还没有订单</p>
<p>Your do not have an order <br>for the time being</p>
<a href="">去购物</a>
</div>
</template>
<script>
... ... @@ -58,6 +63,7 @@
type: this.$parent.$data.type,
orderList: [],
busy: false,
emptybox: 'hide'
};
},
... ... @@ -86,7 +92,11 @@
if (result.data.orderList.length > 0) {
this.$set('orderList', _that.orderList.concat(result.data.orderList));
_that.pageTotal = result.data.pageTotal;
} else {
_that.emptybox = '';
}
} else {
_that.emptybox = '';
}
}).fail(() => {
tip('网络错误');
... ... @@ -172,8 +182,8 @@
goBuy(code) {
yohoAPI.goPay({orderid: code});
},
seeExpress() {
location.href = '';
seeExpress(code) {
location.href = '/home/logistic?order_code='+code;
}
}
};
... ...
... ... @@ -31,7 +31,7 @@
<div class="order-option" v-show="order.canCancel == 'Y'">
<div class="goods-total"></div>
<div class="options" v-show="order.canCancel == 'Y'">
<button v-if="order.canCancel == 'Y'" class="normal">取消申请</button>
<button v-if="order.canCancel == 'Y'" class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
</div>
</div>
</div>
... ... @@ -85,12 +85,17 @@
tip('网络错误');
});
},
cancelApply(code) {
/**
* 取消申请
* @param id
* @param type refundType 1为退货,2为换货
*/
cancelApply(id, type) {
$.ajax({
url: '/home/cancel-apply',
url: '/home/'+(type == 2 ? 'exchange' : 'refund')+'/cancel-apply',
type: 'post',
data: {
orderCode: code
id: id
}
}).then(result => {
if (result.code === 200) {
... ...
<template>
<top-nav></top-nav>
<div class="show-box no-padding first-box" :class="{'is-app': isApp}">
<top-nav :id="id" :article="article"></top-nav>
<div class="show-box no-padding first-box">
<div class="news-box">
<h1>{{article.articleTitle}}</h1>
<div class="status-bar">
<span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span>
<span class="icon icon-eye"></span><span class="label">{{article.pageViews}}</span>
<span class="icon icon-read"></span><span class="label">{{article.pageViews}}</span>
</div>
</div>
... ... @@ -31,7 +31,7 @@
</ul>
</div>
<div class="show-box" v-if="other">
<div class="show-box" v-if="other && other.length > 0">
<h2>相关文章</h2>
<div class="other-box" v-for="item in other">
<div>
... ... @@ -57,14 +57,6 @@
}
.show-box {
&.first-box {
margin-top: 120px;
}
&.first-box.is-app {
margin-top: 180px;
}
background: $bgcolor;
margin-top: 30px;
border-bottom: 1px solid #eee;
... ... @@ -206,8 +198,10 @@
recommendProducts: []
};
},
created() {
init() {
const newsId = $('#app').data('newsId');
this.id = newsId;
let loadDeferred = null;
$.get(`/news/news_${newsId}.json`).then(result => {
... ... @@ -215,6 +209,7 @@
content = result[1],
brands = result[2],
other = result[3];
let goods, prodMap = {};
if (article && article.code === 200 && article.data) {
... ... @@ -228,7 +223,6 @@
return block && typeof block.goods === 'object';
});
const list = [];
goods = products[0] ? products[0].goods.data : null;
... ... @@ -264,7 +258,6 @@
this.other = other.data;
}
// 延时读取商品价格、名称等信息
loadDeferred = () => {
$.get('/product/search_product.json', {
... ...
... ... @@ -77,15 +77,14 @@
module.exports = {
data() {
return {
contentCode: contentCode.news[qs.cate || 'new'],
contentCode: contentCode.news[qs.channel || 'all'],
newsList: [],
gender: qs.gender,
page: 0,
scrollDisabled: false
};
},
watch: {
gender() {
channel() {
this.getNewsList();
}
},
... ... @@ -96,9 +95,8 @@
$.post({
url: '/news/list.json',
data: {
sortId: this.crntCateId,
page: this.page++,
gender: this.gender || '1,2,3'
channel: qs.channel || 'all'
}
}).done(result => {
if (result.code === 200) {
... ...
<template>
<div class="top-nav">
<navbar>
<a slot="left" href="javascript:alert('TODO');">
<span class="icon icon-left"></span>
</a>
<template slot="right">
<a class="right-button" href="javascript:alert('TODO');">
<span class="icon icon-check"></span>
<a class="right-button" href="javascript:void(0);" @click="like()">
<span class="icon icon-like" :class=""></span>
{{likeCount}}
</a>
<a class="right-button" href="javascript:alert('TODO');">
<span class="icon icon-love"></span>
<a class="right-button" href="javascript:void(0);" @click="favorite()">
<span class="icon" :class="{ 'icon-love': !isFavorite, 'icon-love-solid': isFavorite}"></span>
</a>
<a class="right-button" href="javascript:alert('TODO');">
<a class="right-button" href="javascript:void(0);" @click="share()">
<span class="icon icon-share"></span>
</a>
</template>
... ... @@ -35,16 +31,80 @@
require('common/vue-filter');
module.exports = {
props: {
id: Number,
article: Object
},
components: {
navbar: require('component/header.vue')
},
data() {
return {
isApp: yoho.isApp,
likeCount: 9,
likeCount: this.article.praise,
isFavorite: false,
isLiked: false
};
},
watch: {
article: function() {
this.likeCount = this.article.praise;
}
},
methods: {
like: function() {
$.get(`/news/like_${this.article.id}.json`, {
flag: !this.isLiked
}, (results)=> {
const result = results[0], misc = results[1];
if (result.code === 200) {
this.likeCount = result.data;
}
if (misc.code === 200) {
this.isLiked = misc.data.isPraise === 'Y';
}
});
},
favorite: function() {
$.get(`/news/favorite_${this.article.id}.json`, {
flag: !this.isFavorite
}, (results)=> {
const result = results[0], misc = results[1];
if (result.code === 200) {
// TODO:
}
if (misc.code === 200) {
this.isFavorite = misc.data.isFavor === 'Y';
}
});
},
share: function() {
yoho.goShare({
title: this.article.articleTitle,
des: '优质精选,BLK潮流资讯为你呈现',
img: this.article.coverImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
const dict = {
'{width}': 300,
'{height}': 300,
'{mode}': 2
};
return dict[$0];
})
});
}
},
created() {
$.get(`/news/misc_${this.id}.json`).then(result => {
if (result.code === 200) {
this.isFavorite = result.data.isFavor === 'Y';
this.isLiked = result.data.isPraise === 'Y';
}
});
}
};
</script>
... ...
... ... @@ -179,7 +179,7 @@
<span v-if="entity.isCollect === 'Y' " class="icon icon-love-solid"></span>
<span v-else class="icon icon-love"></span>
</button>
<button class="button button-solid" style="flex: 2"
<button class="button button-solid add-to-cart"
@click="showAddToCart()"
:disabled="isSoldOut">
<span v-if="isSoldOut">
... ... @@ -292,10 +292,6 @@
}
.control-box {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: stretch;
position: fixed;
width: 750px;
height: 99px;
... ... @@ -305,12 +301,13 @@
min-width: 100px;
border: none;
border-top: 1px solid #ccc;
flex: 1;
width: 187.5px;
float: left;
display: block;
.icon {
font-size: 40px;
}
}
.control-button:first-child {
... ... @@ -321,6 +318,10 @@
font-size: 26px;
}
.add-to-cart {
width: 375px;
font-size: 28px;
}
}
.horizon-wrapper {
... ... @@ -404,7 +405,7 @@
data() {
return {
yoho: yoho,
isApp: yoho.isApp,
isApp: true || yoho.isApp,
intro: {},
firstImage: '',
entity: {
... ... @@ -483,9 +484,9 @@
} else if (result.code === 403) {
// 未登陆
yoho.goLogin('', function() {
this.toggleFavorite();
}, function() {
tip('登陆失败');
});
}
});
... ... @@ -499,7 +500,11 @@
this.entity.isCollect = 'Y';
} else if (result.code === 403) {
// 未登陆
yoho.goLogin();
yoho.goLogin('', function() {
this.toggleFavorite();
}, function() {
tip('登陆失败');
});
}
});
}
... ...