Authored by zhangxiaoru

brand

... ... @@ -13,6 +13,6 @@ const cRoot = './controllers';
const index = require(`${cRoot}`).index;
router.get('/', index);
router.get(['/', '/men', '/women', '/lifestyle'], index);
module.exports = router;
... ...
... ... @@ -29,11 +29,11 @@ const index = (req, res, next) => {
let reg = /(\d{3})\d{4}(\d{4})/;
for (let i = 0; i < length; i++) {
resultData[i].default = resultData[i].is_default === 'Y';
resultData[i].mobile = resultData[i].mobile.replace(reg, '$1****$2');
}
resultData.leftLength = 7 - length;
resultData.length = length;
res.display('index', {
module: 'me',
page: 'address',
... ...
... ... @@ -23,6 +23,19 @@ const getTime = (time, a)=> {
};
/**
* 取时间的秒数
* @param time
* @returns {number}
*/
const getDate = (time)=> {
if (typeof (time) === 'string') {
return new Date(time).getTime() / 1000;
} else {
return new Date(time.getFullYear() + '-' + time.getMonth() + '-' + time.getDate()).getTime() / 1000;
}
};
/**
* yoho币页面加载
*/
const index = (req, res, next) => {
... ... @@ -30,9 +43,9 @@ const index = (req, res, next) => {
let page = parseInt(req.query.page, 10) || 1;
let queryType = parseInt(req.query.queryType, 10) || 0;
let beginTime = req.query.beginTime || getTime(new Date(), 3);
let date1 = new Date().getTime();
let date2 = new Date(beginTime).getTime();
let selectIndex = parseInt((date1 - date2) / (1000 * 3600 * 24 * 90), 10);
let date1 = getDate(new Date());
let date2 = getDate(beginTime);
let selectIndex = parseInt((date1 - date2) / (90 * 3600 * 24), 10);
currencyModel.getIndexData(uid, page, queryType, beginTime).then(result=> {
result.list.tabs[queryType].isActive = true;
... ...
... ... @@ -34,7 +34,7 @@ const index = (req, res) => {
};
const detail = (req, res) => {
const code = req.query.code;
const code = req.query.orderCode;
const uid = req.user.uid;
Promise.all([orderModel.getOrderDetail(uid, code), mcHandler.getMeThumb()]).then(result => {
... ...
... ... @@ -34,7 +34,7 @@ const index = (req, res, next) => {
*/
const refund = (req, res, next) => {
let uid = req.user.uid;
let code = parseInt(req.params.orderCode, 10);
let code = parseInt(req.query.orderCode, 10);
if (!uid || !code) {
return next();
... ... @@ -75,7 +75,7 @@ const refundApply = (req, res, next) => {
* 退货详情页
*/
const refundDetail = (req, res, next) => {
let applyId = parseInt(req.params.applyId, 10),
let applyId = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
if (!uid || !applyId) {
... ... @@ -94,7 +94,7 @@ const refundDetail = (req, res, next) => {
* 换货申请页
*/
const exchange = (req, res, next) => {
const code = req.params.orderCode;
const code = parseInt(req.query.orderCode, 10);
const uid = req.user.uid;
returns.getChangeGoodsList(code, uid).then(result => {
... ... @@ -130,7 +130,7 @@ const getProductInfo = (req, res, next) => {
* 换货详情页
*/
const exchangeDeatail = (req, res) => {
let id = parseInt(req.params.applyId, 10),
let id = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
returns.getExchangeDetailData(id, uid).then(result => {
... ...
... ... @@ -16,6 +16,7 @@ var fs = require('fs');
var path = require('path');
const uuid = require('uuid');
const os = require('os');
const _ = require('lodash');
const regMobile = /(\d{3})\d{4}(\d{4})/;// 正则匹配替换手机号码中间4位
const regEmail = /(\d{3})\d{4}/;// 正则匹配替换邮箱中间4位
... ... @@ -84,6 +85,25 @@ const index = (req, res, next) => {
result.info.head_ico = result.info.head_ico ? helpers.image(result.info.head_ico, 400, 300, 2) : '';
result.info.mobile = result.info.mobile ? result.info.mobile.replace(regMobile, '$1****$2') : '';
result.stepUrl = '/me/setting/step1';
if (result.info.birthday) {
let a = result.info.birthday.split('-');
_.forEach(result.date.selectYear, function(x) {
if (x.value === a[0]) {
x.isSelected = 'selected';
}
});
_.forEach(result.date.selectMonth, function(x) {
if (x.value === a[1]) {
x.isSelected = 'selected';
}
});
_.forEach(result.date.selectDay, function(x) {
if (x.value === a[2]) {
x.isSelected = 'selected';
}
});
}
res.display('index', {
module: 'me',
... ... @@ -305,6 +325,7 @@ const validate1 = (req, res)=> {
} else if (type === 'mobile') {
let a = yield accountModel.checkVerifyMsg(body.code, body.mobile, body.area);
res.send(a);
} else if (type === 'email') {
let a = yield accountModel.sendVerifyEmail(uid, body.email);
... ...
... ... @@ -320,10 +320,14 @@ const _getUserOrder = (uid, type, page) => {
code: item.orderCode
});
item.refundUrl = helpers.urlFormat('/me/return/refund/' + item.orderCode);
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/' + item.orderCode);
item.refundUrl = helpers.urlFormat('/me/return/refund/', {
orderCode: item.orderCode
});
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/', {
orderCode: item.orderCode
});
item.detailUrl = helpers.urlFormat('/me/order/detail/', {
code: item.orderCode
orderCode: item.orderCode
});
});
... ...
... ... @@ -80,7 +80,9 @@ const getUserReturn = (uid, page) => {
item.hidePrice = true;
item.showStatus = true;
item.refundStr = refundStr[item.refundType];
item.detailUrl = helpers.urlFormat(urlIndex[item.refundType] + item.id);
item.detailUrl = helpers.urlFormat(urlIndex[item.refundType], {
orderCode: item.id
});
item.type = typeIndex[item.refundType];
item.orderGoods.forEach(good => {
... ... @@ -485,7 +487,7 @@ const saveRefund = (orderCode, uid, goods, payment) => {
return {
code: 200,
data: {
refer: `/me/return/refund/detail/${subRes.data.apply_id}`
refer: `/me/return/refund/detail?orderCode=${subRes.data.apply_id}`
}
};
}
... ...
... ... @@ -11,6 +11,43 @@ const crypto = require('crypto');
const fs = require('fs');
/**
* 日期数据
* @returns {{selectYear: Array, selectMonth: Array, selectDay: Array}}
*/
const getSelect = ()=> {
let date = new Date();
let year = date.getFullYear();
let selectYear = [];
let selectMonth = [];
let selectDay = [];
for (let i = 1950; i < year + 1; i++) {
selectYear.push({
id: i,
value: i + ''
});
}
for (let j = 1; j < 13; j++) {
selectMonth.push({
id: j,
value: j + ''
});
}
for (let k = 1; k < 32; k++) {
selectDay.push({
id: k,
value: k + ''
});
}
return {
selectYear,
selectMonth,
selectDay
};
};
/**
* 查询个人详细信息
* @param uid
* @returns {*}
... ... @@ -67,21 +104,17 @@ const _getUserContactInfo = (uid)=> {
const getUserInfo = (uid) => {
let getData = [_getUserInfo(uid), _getUserContactInfo(uid)];
return Promise.all(getData).then(result => {
return {
info: result[0].info,
genders: result[0].genders,
concat: result[1]
concat: result[1],
date: getSelect()
};
});
};
/* const getVerifyInfo = (uid)=> {
return api.get('', {
method: 'web.passport.getUserVerifyInfo',
uid: uid
}).then(result => result);
};*/
/**
* 编辑个人详细信息
... ...
... ... @@ -35,10 +35,10 @@ router.get('/confirmReceive', order.confirmReceive);
// 退换货
router.get('/return', returns.index);
router.get('/return/refund/:orderCode', returns.refund);
router.get('/return/exchange/:orderCode', returns.exchange);
router.get('/return/refund/detail/:applyId', returns.refundDetail);
router.get('/return/exchange/detail/:applyId', returns.exchangeDeatail);
router.get('/return/refund', returns.refund);
router.get('/return/exchange', returns.exchange);
router.get('/return/refund/detail', returns.refundDetail);
router.get('/return/exchange/detail', returns.exchangeDeatail);
router.post('/return/refund/apply', returns.refundApply);
router.post('/return/cancel', returns.cancelApply);
router.post('/return/setEepress', returns.setEepress);
... ...
... ... @@ -10,7 +10,7 @@
<th class="width-opearte">操作</th>
</tr>
{{#each data}}
<tr class="table-body">
<tr class="table-body ">
<input type="hidden" id="tr_{{address_id}}" value="{{address_id}}">
<input type="hidden" id="tr_{{area_code}}" value="{{area_code}}">
<td class="width-name">{{consignee}}</td>
... ... @@ -22,11 +22,11 @@
<span class="blue opreation update-address" data-id="{{address_id}}">修改</span>
<em class="op-sep">|</em>
<span class="blue opreation del-address" data-id="{{address_id}}">删除</span>
{{#isY is_default}}
{{#if default}}
<span class="btn set-default opreation current-default ">默认地址</span>
{{^}}
<span class="btn set-default opreation " data-id="{{address_id}}">设为默认</span>
{{/isY}}
{{else}}
<span class="btn set-default opreation " data-id={{address_id}}>设为默认</span>
{{/if}}
</div>
</td>
</tr>
... ...
... ... @@ -53,7 +53,39 @@
</div>
<div class="form-group">
<label class="label-name">出生日期:</label>
<input id="birthday" class="input" type="text" value="{{info.birthday}}">
{{#date}}
<select id="year" >
{{#each selectYear}}
{{#if isSelected}}
<option value="{{id}}" selected={{isSelected}}>{{value}}</option>
{{else}}
<option value="{{id}}" >{{value}}</option>
{{/if}}
{{/each}}
</select>
<select id="month" >
{{#each selectMonth}}
{{#if isSelected}}
<option value="{{id}}" selected={{isSelected}}>{{value}}</option>
{{else}}
<option value="{{id}}" >{{value}}</option>
{{/if}}
{{/each}}
</select>
<select id="day" >
{{#each selectDay}}
{{#if isSelected}}
<option value="{{id}}" selected={{isSelected}}>{{value}}</option>
{{else}}
<option value="{{id}}" >{{value}}</option>
{{/if}}
{{/each}}
</select>
{{/date}}
<span class="blue error-tips">{{> icon/error-round}}出生日期格式不对</span>
</div>
<div class="form-group-address">
... ...
... ... @@ -73,7 +73,7 @@ const getProductItemData = (params, url, uid) => {
}
result.uid = uid;
result.mainPath = url;
result.mainPath = `/product${url}`;
// 商品基本信息
data.goodInfo = itemFun.setProductData(result);
... ...
... ... @@ -18,7 +18,7 @@ const logger = global.yoho.logger;
const _ = require('lodash');
const payments = {
alipay: 2
alipay: 33
};
/**
... ...
... ... @@ -13,14 +13,14 @@ module.exports = {
app: 'web',
appVersion: '4.6.0', // 调用api接口版本
port: 6003,
siteUrl: '//www.yohobuy.com',
siteUrl: '//www.yohoblk.com',
signExtend: {
app_type: 1
},
subDomains: {
default: '//www.yohobuy.com'
default: '//www.yohoblk.com'
},
cookieDomain: 'yohobuy.com',
cookieDomain: 'yohoblk.com',
domains: {
api: 'http://devapi.yoho.cn:58078/', // devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service: 'http://devservice.yoho.cn:58077/', // testservice.yoho.cn:28077 devservice.yoho.cn:58077
... ... @@ -94,8 +94,8 @@ if (isProduction) {
Object.assign(module.exports, {
appName: 'www.yohoblk.com for test',
domains: {
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/',
api: 'http://devapi.yoho.cn:58078/',
service: 'http://devservice.yoho.cn:58077/',
search: 'http://192.168.102.216:8080/yohosearch/'
},
useOneapm: true,
... ...
... ... @@ -41,7 +41,7 @@ module.exports = () => {
let password = data.password;
let area = data.area;
return LoginService.signin(area, account, password);
return LoginService.signinAsync(area, account, password);
}).then(result => {
if (result.code !== 200) {
return Promise.reject(new Error(result.message));
... ...
{{# pageHeader}}
<div class="yoho-header">
<div class="blk-header">
<div class="center-content">
<div class="yoho-group-map">
<span class="iconfont">&#xe600;</span>
... ...
{{# navMenu}}
<div class="yoho-nav">
<div class="blk-nav">
<div class="main-nav">
<div class="center-content">
<ul class="main-nav-list">
... ...
<div class="yoho-sign-header">
<div class="blk-sign-header">
<div class="center-content">
<div class="main-logo"></div>
<div class="main-logo">
<a href="{{siteUrl}}"></a>
</div>
<ul class="header-tools right clearfix">
<li>
{{#if userName}}
... ...

8.8 KB | W: 0px | H: 0px

1.78 KB | W: 0px | H: 0px

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -76,6 +76,39 @@ $('.yoho-group a').hover(function() {
$(this).text(data.en);
});
$bagGoodsList.on('click', '.del-good-btn', function() {
var $this = $(this),
data = $this.data();
var list = [];
if (!data) {
return;
}
list.push({
goods_type: data.type,
buy_number: data.num,
selected: 'Y',
product_sku: data.sku,
promotion_id: data.pid
});
$.ajax({
type: 'DELETE',
url: '/shopping/cart/product/remove',
data: {skuList: JSON.stringify(list)},
success: function(result) {
var num = parseInt($bagNum.text(), 10) || 0;
if (result.code === 200) {
num = num - data.num;
$bagNum.text(num);
$this.closest('.goods-item').remove();
}
}
});
});
$('.contain-third').on({
mouseenter: function() {
var $thirdWrapper = $(this).children('.third-nav-wrapper');
... ... @@ -144,6 +177,4 @@ $(document).click(function(e) {
}
});
module.exports = {
refreshBag
};
exports.refreshBag = refreshBag;
... ...
... ... @@ -59,16 +59,28 @@ $(function() {
info.consignee === '' ? $consignee.next().show() : $consignee.next().hide();
info.address === '' ? $address.next().show() : $address.next().hide();
info.mobile === '' ? $mobile.next().show() :
(!reg.test(info.mobile) ? $mobile.next().html('手机号码格式不对').show() : $mobile.next().hide());
typeof (info.area_code) === 'undefined' ?
addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
if (info.consignee === '' || info.address === '' || info.mobile === '' || !reg.test(info.mobile) ||
typeof (info.area_code) === 'undefined') {
flag = false;
if (info.id) {
info.mobile === '' ? $mobile.next().show() : $mobile.next().hide();
if (info.consignee === '' || info.address === '' || info.mobile === '' ||
typeof (info.area_code) === 'undefined') {
flag = false;
}
return flag;
} else {
info.mobile === '' ? $mobile.next().show() :
(!reg.test(info.mobile) ? $mobile.next().html('手机号码格式不对').show() : $mobile.next().hide());
if (info.consignee === '' || info.address === '' || info.mobile === '' || !reg.test(info.mobile) ||
typeof (info.area_code) === 'undefined') {
flag = false;
}
return flag;
}
return flag;
},
// 拼接一条数据的html
... ... @@ -84,7 +96,8 @@ $(function() {
'<td class=\'width-opearte\'><div><span class=\'blue opreation update-address\' data-id=\'' +
info.address_id + '\'>修改</span>\n<em class="op-sep">|</em>\n' +
'<span class=\'blue opreation del-address\' data-id=\'' + info.address_id + '\'>删除</span>\n' +
'<span class=\'btn set-default opreation \' data-id=\'' + info.address_id + '\'>设为默认</span></div></td>';
'<span class=\'btn set-default opreation \' data-id=\'' + info.address_id + '\'>设为默认</span>' +
'</div></td>';
html += '</tr>';
return html;
},
... ... @@ -118,6 +131,7 @@ $(function() {
info.area_code = area.split(',')[2];
info.area = areaInfo.split(',').join(' ');
if (Bll.check(info) === true) {
// 新增
... ... @@ -149,23 +163,46 @@ $(function() {
});
}
} else { // 修改
$.ajax({
type: 'POST',
url: '/me/address/update',
dataType: 'json',
data: info,
success: function(data) {
if (data.code === 200) {
info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
info.address_id = info.id;
$('#tr_' + info.id).parent().before(Bll.getHtml(info)).remove();
Bll.clearInput();
$('.tip em').html('新增地址');
} else {
new _alert(data.message).show();
if (new RegExp(/^\d{3}[*]{4}\d{4}/).test(info.mobile)) {
$.ajax({
type: 'POST',
url: '/me/address/update',
dataType: 'json',
data: info,
success: function(data) {
if (data.code === 200) {
info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
info.address_id = info.id;
$('#tr_' + info.id).parent().before(Bll.getHtml(info)).remove();
Bll.clearInput();
$('.tip em').html('新增地址');
} else {
new _alert(data.message).show();
}
}
}
});
});
} else if (reg.test(info.mobile)) {
$mobile.next().hide();
$.ajax({
type: 'POST',
url: '/me/address/update',
dataType: 'json',
data: info,
success: function(data) {
if (data.code === 200) {
info.mobile = info.mobile.substring(0, 3) + '****' + info.mobile.substring(7, 11);
info.address_id = info.id;
$('#tr_' + info.id).parent().before(Bll.getHtml(info)).remove();
Bll.clearInput();
$('.tip em').html('新增地址');
} else {
new _alert(data.message).show();
}
}
});
} else {
$mobile.next().html('手机号码格式不对').show();
}
}
}
});
... ... @@ -227,12 +264,29 @@ $(function() {
data: {
id: id
},
success: function() {
$('.current-default').removeClass('current-default').text('设为默认');
$(self).addClass('current-default').text('默认地址');
tbody.find('.table-body').eq(0).before('<tr class=\'table-body\'>' + tr.html() + '</tr>');
tr.remove();
success: function(data) {
if (data.code === 200) {
$('.current-default').removeClass('current-default').text('设为默认');
$(self).addClass('current-default').text('默认地址');
tbody.find('.table-body').eq(0).before('<tr class=\'table-body select-row\'>' + tr.html() +
'</tr>');
tr.remove();
} else {
new _alert(data.message).show();
}
}
});
});
// 选中某一行
$(document).on('click', '.table-body', function() {
$('.table-body').removeClass('select-row');
$(this).addClass('select-row');
$('.set-default').hide();
$(this).find('.set-default').css('display', 'inline-block');
});
});
... ...
... ... @@ -9,6 +9,14 @@ var _dialog = dialog.Dialog;
var _alert = dialog.Alert;
var modifyHead = require('./setting/modifyHead');// flash操作
var tip;// 头像编辑弹框
var $year = $('#year');
var $month = $('#month');
var $day = $('#day');
var birthday = {
year: $year.val() || '',
month: $month.val() || '',
day: $day.val() || ''
};
var headHtml = modifyHead.swfobject('head', '600px', '400px', '../../img/me/head.swf?code=' + Math.random() +
'&upload_url=' + encodeURIComponent(location.protocol + '//' +
... ... @@ -40,8 +48,8 @@ var Bll = {
typeof (info.area_code) === 'undefined' ?
addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) ||
!regRealName.test(info.username) || typeof (info.area_code) === 'undefined') {
if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) || !regRealName.test(info.username) ||
typeof (info.area_code) === 'undefined') {
flag = false;
}
return flag;
... ... @@ -109,6 +117,18 @@ window.receive_image_bytes = function(obj) {
}
};
// 时间控件切换
$year.on('change', function() {
birthday.year = $(this).val();
});
$month.on('change', function() {
birthday.month = $(this).val();
});
$day.on('change', function() {
birthday.day = $(this).val();
});
$(function() {
var address = cascadingAddress({el: '#address'});
var areaCode = $('#area_code').val();
... ... @@ -139,7 +159,7 @@ $(function() {
nick_name: $('#nick_name').val(),
username: $('#username').val(),
gender: $('#gender').val(),
birthday: $('#birthday').val(),
birthday: birthday.year + '-' + birthday.month + '-' + birthday.day,
area_code: area.split(',')[2],
// todo 手机号码老接口必填
... ...
... ... @@ -11,7 +11,7 @@ var type = types[types.length - 1];// 界面操作类型
var $imgCaptchaInput = $('#captcha');
var second = 60;
var $sms = $('#send-code2');// 发送短信验证码按钮
var area = $('#country-code').text().substring(0)||"86";// 地区码
var area = $('#country-code').text().substring(0) || '86';// 地区码
// 发送短信后倒计时显示
var disableSMSBtn = function() {
second -= 1;
... ...
... ... @@ -8,7 +8,7 @@ var dialog = require('../../plugins/dialog');
var _alert = dialog.Alert;
var types = location.pathname.split('/');
var type = types[types.length - 1];// 界面操作类型
var area = $('#country-code').text()||"86";
var area = $('#country-code').text() || '86';
/**
* 手机号码验证
... ... @@ -35,7 +35,7 @@ $('[placeholder]').placeholder();
// 发送手机验证码
$sms.click(function() {
var mobile = $('#real-mobile').val();
if ($(this).hasClass('disable')) {
return;
... ...
.yoho-header {
.blk-header {
height: 50px;
line-height: 50px;
font-size: 12px;
... ... @@ -231,7 +231,7 @@
}
}
.yoho-nav {
.blk-nav {
.main-nav {
height: 80px;
... ... @@ -285,7 +285,11 @@
li {
float: left;
margin-right: 66px;
margin-left: 66px;
}
li:first-child {
margin-left: 0;
}
li > a {
... ...
.yoho-sign-header {
.blk-sign-header {
.center-content {
height: 80px;
border-bottom: 2px solid #eee;
... ... @@ -9,6 +9,12 @@
height: 80px;
background: resolve('layout/sign-logo.png') no-repeat center center;
display: inline-block;
> a {
display: inline-block;
width: 100%;
height: 100%;
}
}
.header-tools {
... ...
... ... @@ -119,6 +119,10 @@
padding: 8px 0 8px 10px;
}
.select-row {
border: solid 2px black;
}
.width-name {
width: 60px;
word-break: break-all;
... ... @@ -148,8 +152,7 @@
.current-default,
.set-default {
display: inline-block;
display: none;
margin-left: 20px;
}
}
... ...
... ... @@ -258,6 +258,7 @@
.btn {
display: inline-block;
width: 100px !important;
}
}
}
... ...
... ... @@ -6,6 +6,9 @@
clear: both;
margin-bottom: 20px;
}
select {
width: 60px;
}
.form-group-address {
clear: both;
... ...
... ... @@ -11,7 +11,7 @@
</div>
<div class="price">
<p>¥{{round sales_price 2}} X{{buy_number}}</p>
<span class="del-good-btn">删除</span>
<span class="del-good-btn" data-type="{{goods_type}}" data-num="{{buy_number}}" data-num="{{buy_number}}" data-sku="{{product_sku}}" data-pid="{{promotion_id}}">删除</span>
</div>
</dd>
{{/ goods}}
\ No newline at end of file
... ...