Authored by xuqi

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -14,12 +14,9 @@ const accountModel = require('../models/account');
*/
const changePwd = (req, res) => {
let uid = req.user.uid;
// let uid = req.user.uid||"20000190" ;
let pwd = req.body.password;
accountModel.changePwd(uid, pwd).then(result=> {
// console.log("修改result", result);
res.send(result);
});
};
... ... @@ -31,14 +28,10 @@ const changePwd = (req, res) => {
*/
const checkVerifyMobile = (req, res)=> {
let uid = req.user.uid;
// let uid = req.user.uid||"20000190";
let mobile = req.body.mobile;
let area = req.body.area;
// console.log(uid, mobile, area);
accountModel.checkVerifyMobile(uid, mobile, area).then(result=> {
// console.log("验证手机号码", result);
res.send(result);
});
};
... ... @@ -50,14 +43,10 @@ const checkVerifyMobile = (req, res)=> {
*/
const sendMobileMsg = (req, res)=> {
let uid = req.user.uid;
// let uid = req.user.uid||"20000190";
let mobile = req.body.mobile;
let area = req.body.area || '+86';
// console.log(uid, mobile, area);
accountModel.sendMobileMsg(uid, mobile, area).then(result=> {
// console.log("发送短信result", result);
res.send(result);
});
};
... ... @@ -74,7 +63,6 @@ const checkVerifyMsg = (req, res)=> {
let area = req.body.area || '+86';
accountModel.checkVerifyMsg(code, mobile, area).then(result=> {
// console.log("短信验证result", result);
res.send(result);
});
};
... ... @@ -86,12 +74,9 @@ const checkVerifyMsg = (req, res)=> {
*/
const sendVerifyEmail = (req, res)=> {
let uid = req.user.uid;
// let uid = req.user.uid||"20000190";
let email = req.body.email;
accountModel.sendVerifyEmail(uid, email).then(result=> {
// console.log("发送验证邮件result", result);
res.send(result);
});
};
... ...
... ... @@ -21,7 +21,7 @@ const _setDefault = (id, uid) => {
* 收货地址页面加载
*/
const index = (req, res, next) => {
let uid = req.user.uid || '20000190';
let uid = req.user.uid;
addressModel.getAddressDataAsync(uid, 20).then(result => {
let resultData = result.data ? result.data : result;
... ...
... ... @@ -93,6 +93,7 @@ const favorite = {
},
// 品牌收藏页
brand(req, res, next) {
let q = req.query;
let page = parseInt(q.page || 1, 10);
... ... @@ -154,6 +155,7 @@ const favorite = {
}).catch(next);
},
// 资讯收藏页
editorial(req, res, next) {
let q = req.query;
let page = parseInt(q.page || 1, 10);
... ... @@ -203,6 +205,7 @@ const favorite = {
}).catch(next);
},
// 取消商品、店铺收藏
cancel(req, res, next) {
let type = req.body.type;
let ids = req.body.ids;
... ... @@ -217,6 +220,7 @@ const favorite = {
}).catch(next);
},
// 取消资讯收藏
editorialCancel(req, res, next) {
let ids = req.body.ids;
let uid = cookie.getUid(req);
... ...
... ... @@ -75,8 +75,6 @@ const _getTitle = (type)=> {
const index = (req, res, next) => {
let uid = req.user.uid;
// let uid = req.user.uid || "20000190";
settingModel.getUserInfo(uid).then(result=> {
result.info.gender ? result.genders[result.info.gender - 1].checked = true :
result.genders[2].checked = true;
... ... @@ -107,8 +105,6 @@ const index = (req, res, next) => {
*/
const editUserInfo = (req, res)=> {
let uid = req.user.uid;
// let uid = req.user.uid || "20000190";
let query = req.body;
settingModel.editUserInfo(uid, query).then(result=> {
... ... @@ -122,8 +118,6 @@ const editUserInfo = (req, res)=> {
* */
const bindMobile = (req, res, next) => {
let uid = req.user.uid;
// let uid = req.user.uid || "20000190";
let type = req.params.type;
settingModel.getUserInfo(uid).then(result=> {
... ... @@ -133,7 +127,6 @@ const bindMobile = (req, res, next) => {
info.ellipsisMobile = info.verify_mobile.substring(0, 3) + '****' + info.verify_mobile.substring(7, 11);
info.checkCode = settingModel.cipheriv(info.uid + '.completeverify');
// info.checkCode = settingModel.cipheriv("20000190" + ".completeverify");
res.display('index', {
module: 'me',
page: 'setting',
... ... @@ -159,8 +152,6 @@ const bindMobile = (req, res, next) => {
const bindEmail = (req, res, next) => {
let uid = req.user.uid;
// let uid = req.user.uid || "20000190";
let type = req.params.type;
settingModel.getUserInfo(uid).then(result=> {
... ... @@ -169,8 +160,6 @@ const bindEmail = (req, res, next) => {
info.ellipsisEmail = info.verify_email.substring(0, 3) + '****' + info.verify_email.substring(7, 11);
info.checkCode = settingModel.cipheriv(info.uid + '.completeverify');
// info.checkCode = settingModel.cipheriv("20000190" + ".completeverify");
res.display('index', {
module: 'me',
page: 'setting',
... ... @@ -194,10 +183,8 @@ const bindEmail = (req, res, next) => {
const modifyPassword = (req, res) => {
let type = req.params.type;
let checkCode = settingModel.cipheriv(req.user.uid + '.completeverify');
// let checkCode = settingModel.cipheriv("20000190" + ".completeverify");
res.display('index', {
module: 'me',
page: 'setting',
... ... @@ -225,7 +212,6 @@ const edit = (req, res)=> {
let codes = code.split('.');
if (parseInt(codes[0], 10) === req.user.uid && codes[1] === 'completeverify') {
// if (codes[0] === "20000190" && codes[1] === "completeverify") {
let result = {
title: _getTitle(type).typeName,
proTitle: _getTitle(type).proName,
... ... @@ -233,10 +219,8 @@ const edit = (req, res)=> {
isShowEmail: _getTitle(type).isModifyEmail || _getTitle(type).isBindEmail,
isShowPassword: _getTitle(type).isShowPassword
};
let checkCode = settingModel.cipheriv(req.user.uid + '.completeoperate');
// let checkCode = settingModel.cipheriv("20000190"+ ".completeoperate");
res.display('index', {
module: 'me',
page: 'setting',
... ... @@ -267,7 +251,6 @@ const success = (req, res)=> {
let codes = code.split('.');
if (parseInt(codes[0], 10) === req.user.uid && codes[1] === 'completeoperate') {
// if (codes[0] === "20000190" && codes[1] === "completeoperate") {
let result = {
title: _getTitle(type).typeName,
proTitle: _getTitle(type).proName,
... ... @@ -302,8 +285,6 @@ const success = (req, res)=> {
const validate1 = (req, res)=> {
co(function *() {
let type = req.params.type;
// let uid = req.user.uid || "20000190";
let uid = req.user.uid;
let body = req.body;
... ... @@ -330,8 +311,6 @@ const validate2 = (req, res)=> {
co(function *() {
let type = req.params.type;
let uid = req.user.uid;
// let uid = req.user.uid || "20000190";
let body = req.body;
if (type === 'password') {
... ...
... ... @@ -28,7 +28,6 @@ const yohoCoinList = (uid, page, queryType, beginTime) => {
queryType: queryType,
beginTime: beginTime
}).then(result => {
// console.log("列表接口",result);
let coinList = [];
let total = false;
let curPage = 1;
... ... @@ -97,16 +96,22 @@ const yohoCoinTotal = (uid)=> {
method: 'app.yoho.yohocoin',
uid: uid
}).then(result => {
// console.log("总数接口",result);
return result;
});
};
/**
* 获取yoho币相关数据
* @param uid
* @param page
* @param queryType
* @param beginTime
* @returns {*}
*/
const getIndexData = (uid, page, queryType, beginTime) => {
let getData = [yohoCoinList(uid, page, queryType, beginTime), yohoCoinTotal(uid)];
return Promise.all(getData).then(result => {
// console.log("合并接口", result);
return {
list: result[0],
num: result[1]
... ...
... ... @@ -11,6 +11,12 @@ const API = global.yoho.API;
const ServiceAPI = global.yoho.ServiceAPI;
const favorite = {
/**
* 查询收藏的商品
* @param param
* @returns {*}
*/
getFavoriteProduct(param) {
let p = {
method: 'web.favorite.product'
... ... @@ -19,6 +25,11 @@ const favorite = {
return API.get('', _.assign(p, param));
},
/**
* 查询收藏的店铺、品牌
* @param param
* @returns {*}
*/
getFavoriteBrand(param) {
let p = {
method: 'app.favorite.brand'
... ... @@ -27,10 +38,22 @@ const favorite = {
return API.get('', _.assign(p, param));
},
/**
* 查询收藏的资讯
* @param param
* @returns {*}
*/
getFavoriteEditoreial(param) {
return ServiceAPI.get('guang/api/*/favorite/getUserFavArticleList', param);
},
/**
* 取消收藏 商品、店铺
* @param uid
* @param ids
* @param type
* @returns {*|type[]}
*/
cancelFavorite(uid, ids, type) {
let p = {
method: 'web.favorite.cancel',
... ... @@ -42,6 +65,12 @@ const favorite = {
return API.post('', p);
},
/**
* 取消收藏资讯
* @param uid
* @param ids
* @returns {*}
*/
cancelEditorialFavorite(uid, ids) {
return ServiceAPI.get('guang/api/*/favorite/cancelFavorite', {
article_id: ids,
... ...
... ... @@ -10,7 +10,7 @@ const api = global.yoho.API;
const crypto = require('crypto');
/**
* 查询个人信息
* 查询个人详细信息
* @param uid
* @returns {*}
*/
... ... @@ -45,6 +45,12 @@ const _getUserInfo = (uid) => {
});
};
/**
* 查询个人联系信息
* @param uid
* @returns {*}
* @private
*/
const _getUserContactInfo = (uid)=> {
return api.get('', {
method: 'web.passport.getUserContacts',
... ... @@ -52,6 +58,11 @@ const _getUserContactInfo = (uid)=> {
}).then(result => result.data);
};
/**
* 合并查询个人信息
* @param uid
* @returns {*}
*/
const getUserInfo = (uid) => {
let getData = [_getUserInfo(uid), _getUserContactInfo(uid)];
... ... @@ -64,14 +75,23 @@ const getUserInfo = (uid) => {
});
};
const getVerifyInfo = (uid)=> {
/* const getVerifyInfo = (uid)=> {
return api.get('', {
method: 'web.passport.getUserVerifyInfo',
uid: uid
}).then(result => result);
};
};*/
/**
* 编辑个人详细信息
* @param uid
* @param nickName
* @param username
* @param gender
* @param birthday
* @returns {*}
* @private
*/
const _editInfo = (uid, nickName, username, gender, birthday)=> {
return api.get('', {
method: 'app.passport.modifyBase',
... ... @@ -83,6 +103,16 @@ const _editInfo = (uid, nickName, username, gender, birthday)=> {
}).then(result => result);
};
/**
* 编辑个人联系信息
* @param uid
* @param areaCode
* @param mobile
* @param fullAddress
* @param zipCode
* @returns {*}
* @private
*/
const _editUserContactInfo = (uid, areaCode, mobile, fullAddress, zipCode)=> {
return api.get('', {
method: 'web.passport.modifyUserContacts',
... ... @@ -94,6 +124,12 @@ const _editUserContactInfo = (uid, areaCode, mobile, fullAddress, zipCode)=> {
}).then(result => result);
};
/**
* 合并编辑个人信息
* @param uid
* @param info
* @returns {*}
*/
const editUserInfo = (uid, info) => {
let getData = [
_editInfo(uid, info.nick_name, info.username, info.gender, info.birthday),
... ... @@ -145,7 +181,6 @@ const decipheriv = (data) => {
module.exports = {
getUserInfo: getUserInfo,
getVerifyInfo: getVerifyInfo,
editUserInfo: editUserInfo,
cipheriv: cipheriv,
decipheriv: decipheriv
... ...
{{!-- 我的收藏 --}}
{{#favorite}}
{{> common/subtitle}}
<div class="order-nav">
... ...
/**
* 商品详情页controller
* 商品、店铺收藏
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/7/17
*/
... ... @@ -8,6 +8,12 @@
const helpers = global.yoho.helpers;
const fav = require('../models/favorite');
/**
* 收藏商品
* @param req
* @param res
* @param next
*/
const product = (req, res, next) => {
let uid = req.user.uid;
let pid = req.body.productId;
... ... @@ -37,6 +43,12 @@ const product = (req, res, next) => {
res.json(resData);
};
/**
* 收藏品牌
* @param req
* @param res
* @param next
*/
const brand = (req, res, next) => {
let uid = req.user.uid;
let pid = req.body.brandId;
... ... @@ -66,6 +78,12 @@ const brand = (req, res, next) => {
res.json(resData);
};
/**
* 收藏店铺
* @param req
* @param res
* @param next
*/
const shop = (req, res, next) => {
let uid = req.user.uid;
let pid = req.body.shopId;
... ...
/**
* 列表页、新品到着列表页
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
*
*/
'use strict';
const _ = require('lodash');
... ... @@ -7,6 +14,7 @@ const DataHelper = require('../models/helpers');
const Resouces = require('../models/resouces');
const list = {
// 列表页
index: (req, res, next) => {
let q = req.query;
... ... @@ -53,6 +61,7 @@ const list = {
},
// 新品到着
newPage: (req, res, next) => {
let q = req.query;
... ...
... ... @@ -18,6 +18,7 @@ const ShopData = require('../models/shop-service');
const Editorial = require('../models/editorial');
const shop = {
// 店铺首页
index(req, res, next) {
let domain = req.params.domain;
let uid = cookie.getUid(req);
... ... @@ -80,6 +81,8 @@ const shop = {
}).catch(next);
},
// 店铺列表页
list(req, res, next) {
let data = {
module: 'product',
... ...
/**
* 获取品牌相关信息
* @author: jiangfeng<jeff.jiang@yoho.cn>
*/
... ... @@ -7,6 +8,12 @@
const api = global.yoho.API;
const BrandApi = {
/**
* 查询品牌信息,是否已收藏
* @param bid 品牌id
* @param uid 用户id
* @returns {*}
*/
getBrandInfo(bid, uid) {
let params = {
method: 'app.brand.getBrandIntro',
... ... @@ -19,6 +26,11 @@ const BrandApi = {
return api.get('', params);
},
/**
* 根据品牌domain查询
* @param domain
* @returns {*}
*/
getDomainInfo(domain) {
return api.get('', {
domain: domain,
... ...
/**
* Created by TaoHuang on 2016/6/14.
* 获取品牌相关信息
* @author: jiangfeng<jeff.jiang@yoho.cn>
*/
'use strict';
... ... @@ -8,6 +9,11 @@ const co = Promise.coroutine;
const api = require('./brand-api');
const camelCase = global.yoho.camelCase;
/**
* 根据品牌domain查询
* @param domain
*/
const getDomainInfo = domain => {
return co(function*() {
let brandInfo = yield api.getDomainInfo(domain);
... ... @@ -19,6 +25,12 @@ const getDomainInfo = domain => {
})();
};
/**
* 查询品牌信息,是否已收藏
* @param bid 品牌id
* @param uid 用户id
* @returns {*}
*/
const getBrandInfo = (bid, uid) => {
return co(function*() {
let brandInfo = yield api.getBrandInfo(bid, uid);
... ...
/**
* 列表页、搜索数据处理工具类
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
*
*/
'use strict';
const _ = require('lodash');
const config = global.yoho.config;
const helpers = {
/**
* 生成 A-Z, 0-9 品牌首字母
* @param numberIndex
* @returns {Array}
*/
brandLetters(numberIndex) {
let letters = [];
... ... @@ -31,6 +44,10 @@ const helpers = {
return letters;
},
/**
* 男女条件
* @returns {*[]}
*/
genders() {
return [
{
... ... @@ -42,6 +59,11 @@ const helpers = {
}];
},
/**
* 颜色条件处理
* @param colors
* @returns {*}
*/
colorConvert(colors) {
if (colors) {
return colors.map((c) => {
... ... @@ -56,6 +78,10 @@ const helpers = {
}
},
/**
* 根据频道获取导航栏
* @returns {{link: string, pathTitle: string, name: string}}
*/
getChannelNav() {
return {
link: '#',
... ... @@ -63,6 +89,13 @@ const helpers = {
name: 'MEN首页'
};
},
/**
* 根据品类生成导航栏
* @param sort
* @param sorts
* @returns {Array}
*/
getSortNav(sort, sorts) {
let nav = [];
... ... @@ -95,6 +128,13 @@ const helpers = {
return nav;
},
/**
* 生成Filter对象
* @param key
* @param value
* @param name
* @returns {{key: *, value: *, name: *}}
*/
newFilter(key, value, name) {
return {
key: key,
... ... @@ -103,6 +143,12 @@ const helpers = {
};
},
/**
* 筛选器数据处理
* @param filter
* @param q
* @returns {*}
*/
filterHandle(filter, q) {
let priceRange = filter.priceRange;
let sizeInfo = filter.size;
... ... @@ -229,6 +275,11 @@ const helpers = {
};
},
/**
* 商品列表数据处理
* @param list
* @returns {*}
*/
handleProductList(list) {
if (_.isArray(list)) {
list.forEach(g => {
... ...
/**
* 资源位查询
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
*/
'use strict';
... ...
/**
* 列表、搜索相关api调用
*/
'use strict';
const api = global.yoho.API;
const _ = require('lodash');
/**
* 过滤空参数,不传给api
* @param obj
* @returns {*}
* @private
*/
function _paramHanlde(obj) {
_.keys(obj).forEach(k => {
if (obj[k] === null || obj[k] === '') {
... ...
... ... @@ -48,6 +48,12 @@ function resourceDataHandle(data) {
}
const ShopService = {
/**
* 获取店铺信息
* @param shopId
* @param uid
*/
getShopIntro(shopId, uid) {
return co(function*() {
let shopIntro = yield ShopApi.getShopIntro(shopId, uid);
... ... @@ -59,6 +65,11 @@ const ShopService = {
}
})();
},
/**
* 获取店铺装修
* @param shopId
*/
getShopDecorator(shopId) {
return co(function*() {
let data = yield ShopApi.getShopDecorator(shopId);
... ... @@ -71,6 +82,10 @@ const ShopService = {
})();
},
/**
* 获取店铺二级分类
* @param shopId
*/
getShopSecondSorts(shopId) {
return co(function*() {
let data = yield ShopApi.getShopSorts(shopId);
... ... @@ -87,6 +102,11 @@ const ShopService = {
})();
},
/**
* 获取店铺首页数据(头部、装修)
* @param domain
* @param uid
*/
getShopHeadData(domain, uid) {
return co(function*() {
let domainInfo = yield BrandService.getDomainInfo(domain);
... ...
... ... @@ -25,6 +25,7 @@
{{!-- 分页 --}}
{{{ pagination paginationData }}}
{{^}}
{{!-- 空结果 --}}
{{> list/empty}}
{{/if}}
</div>
... ...
/**
* 订单支付
* @author: TaoHuang
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 2016/07/18
*/
... ... @@ -12,10 +12,17 @@ const PayHelpers = require('../helpers/payment');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const Payments = {
alipay: 2
};
/**
* 支付页
* @param req
* @param res
* @param next
*/
const online = (req, res, next) => {
let orderCode = req.query.code;
let uid = req.user.uid;
... ... @@ -32,6 +39,12 @@ const online = (req, res, next) => {
};
/**
* 获取第三方支付跳转url
* @param req
* @param res
* @param next
*/
const toPay = (req, res, next) => {
let orderCode = req.body.code;
let method = req.body.method;
... ... @@ -56,6 +69,11 @@ const toPay = (req, res, next) => {
}).catch(next);
};
/**
* 支付成功回调
* @param req
* @param res
*/
const callback = (req, res) => {
let type = req.params.type;
let payId = Payments[type];
... ... @@ -80,20 +98,9 @@ const callback = (req, res) => {
};
const success = (req, res) => {
res.render('pay-success', {
defaultHeader: false,
content: {
cost: '12300.32',
orderNum: '234567890',
onlineCost: '589.00'
}
});
};
module.exports = {
online,
callback,
toPay,
success
toPay
};
... ...
... ... @@ -12,10 +12,9 @@ const api = global.yoho.API;
const helper = global.yoho.helpers;
/**
* 结算页面展示
* 结算页面api
* @param uid 用户id
*/
const _orderApi = uid => api.get('', {
method: 'app.Shopping.payment',
'cart_type': 'ordinary', // eslint-disable-line
... ... @@ -23,7 +22,10 @@ const _orderApi = uid => api.get('', {
uid: uid
});
/**
* 结算页面
* @param uid [int] user id
*/
const index = uid => {
return _orderApi(uid).then(data => {
if (data.code === 200) {
... ... @@ -87,7 +89,7 @@ const index = uid => {
};
/**
* 结算
* 结算api调用
* @param number uid user id
* @param number $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
... ... @@ -122,40 +124,7 @@ const compute = (uid, yohoCoin) => {
};
/**
* 提交订单(电子发票)api请求
* @param number uid user id
* @param number address_id 地址id
* @param number yohoCoin 使用的有货币
* @param number invoices_type 发票类型(1-纸质发票,2-电子发票)
* @param string invoices_title 发票抬头
* @param int invoices_content 发票内容
* @param string receiverMobile 收票人手机
* @param string remark 备注
* @param boolean isPrintPrice 是否打印价格
* @param number delivery_time 送货时间
* @param number delivery_way 送货方式(1-普通,2-顺丰)
* @param number payment_id 支付id
* @param number payment_type 支付类型
*/
// const _submitElInvoice = (uid, other) => api.get('', {
// method: 'app.Shopping.submit',
// uid: uid,
// address_id: other.address_id,
// yohoCoin: other.yohoCoin,
// invoices_type: other.invoices_type,
// invoices_title: other.invoices_title,
// invoices_content: other.invoices_content,
// recevierMobile: other.recevierMobile,
// remark: other.remark,
// isPrintPrice: other.isPrintPrice,
// delivery_time: other.delivery_time,
// delivery_way: other.delivery_way,
// payment_id: other.payment_id,
// payment_type: other.payment_type
// });
/**
* 提交订单api请求
* 提交订单api调用
* @param number uid user id
* @param number address_id 地址id
* @param number yohoCoin 使用的有货币
... ... @@ -216,6 +185,12 @@ const submit = (uid, other) => {
return _submit(uid, theOther).then(result => result);
};
/**
* 查询订单信息接口
* @param uid
* @param code
* @returns {*}
*/
const orderDetail = (uid, code) => {
return api.get('', {
method: 'app.SpaceOrders.detail',
... ... @@ -224,6 +199,13 @@ const orderDetail = (uid, code) => {
}, {code: 200});
};
/**
* 更新订单支付方式
* @param code
* @param payment
* @param uid
* @returns {*}
*/
const updateOrderPayment = (code, payment, uid) => {
return api.get('', {
method: 'app.SpaceOrders.updateOrdersPaymentByCode',
... ...
/**
* Created by TaoHuang on 2016/7/18.
* 支付相关api调用
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 2016/07/18
*/
'use strict';
... ...
/**
* 订单支付
* @author: TaoHuang
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 2016/07/18
*/
... ... @@ -17,6 +17,10 @@ const logger = global.yoho.logger;
const _ = require('lodash');
/**
* 获取在线支付方式
* @returns {*|Promise.<TResult>}
*/
const getOnlinePayProvider = () => {
return api.getPayProvider().then(result => {
if (!(result.code && result.code === 200)) {
... ... @@ -50,6 +54,11 @@ const getOnlinePayProvider = () => {
});
};
/**
* 获取订单详情
* @param uid
* @param code
*/
const getOrderInfo = (uid, code) => {
return co(function *() {
let orderData = yield OrderData.orderDetail(uid, code);
... ... @@ -62,6 +71,11 @@ const getOrderInfo = (uid, code) => {
})();
};
/**
* 获取支付页数据
* @param uid
* @param code
*/
const getPayInfo = (uid, code) => {
return co(function *() {
let payment = yield Promise.all([getOnlinePayProvider(), getOrderInfo(uid, code)]);
... ... @@ -74,7 +88,7 @@ const getPayInfo = (uid, code) => {
};
/**
*
* 获取支付方式的相关参数, (密钥等信息)
* @param id
*/
const getPaymentInfo = (id) => {
... ... @@ -88,6 +102,10 @@ const getPaymentInfo = (id) => {
})();
};
/**
* 获取订单支付银行信息
* @param id
*/
const getBankByOrder = (id) => {
return co(function *() {
let data = yield api.getBankByOrder(id);
... ... @@ -99,6 +117,12 @@ const getBankByOrder = (id) => {
})();
};
/**
* 设置订单支付银行
* @param code
* @param payment
* @param bankCode
*/
const setOrderPayBank = (code, payment, bankCode) => {
return co(function *() {
let data = yield api.setOrderPayBank(code, payment, bankCode);
... ... @@ -107,6 +131,12 @@ const setOrderPayBank = (code, payment, bankCode) => {
})();
};
/**
* 更新订单支付银行
* @param code
* @param payment
* @param bankCode
*/
const updateOrderPayBank = (code, payment, bankCode) => {
return co(function *() {
let data = yield api.updateOrderPayBank(code, payment, bankCode);
... ... @@ -115,6 +145,12 @@ const updateOrderPayBank = (code, payment, bankCode) => {
})();
};
/**
* 支付确认
* @param code
* @param payment
* @param uid
*/
const sendPayConfirm = (code, payment, uid) => {
return co(function *() {
let data = yield api.sendPayConfirm(code, payment, uid);
... ... @@ -123,6 +159,11 @@ const sendPayConfirm = (code, payment, uid) => {
})();
};
/**
* 支付成功,前端回调时,处理订单信息
* @param payResult
* @param uid
*/
const procOrderData = (payResult, uid) => {
return co(function *() {
let orderCode = payResult.orderCode;
... ...
... ... @@ -35,9 +35,6 @@ router.get('/pay/online', auth, pay.online);
router.post('/pay/online/go', auth, pay.toPay);
// 在线支持完成
router.get('/pay/online/success', auth, pay.success);
// 支付回调
router.get('/pay/callback/:type', auth, pay.callback);
... ...
... ... @@ -4,6 +4,8 @@
* @date: 2016/07/11
*/
const moment = require('moment');
// 时间格式化
const convertUnitTime = (src) => {
return moment.unix(src).format('YYYY-MM-DD');
... ... @@ -13,6 +15,7 @@ var beginTime = convertUnitTime(new Date() / 1000 - 3600 * 24 * 90);
var type = 0;
var page = 1;
var Bll = {
// 获取路由中的请求参数
getQueryString: function() {
let queryArr = location.search.substr(1).split('&');
let query = {};
... ... @@ -54,6 +57,8 @@ $('.tabs li').on('click', function() {
}
});
// 时间控件切换
$('#begin-time').on('change', function() {
let months = parseInt($(this).val(), 10);
... ...
... ... @@ -167,5 +167,3 @@ $(function() {
}
});
});
... ...
... ... @@ -7,7 +7,7 @@ var $imgCaptchaInput = $('#captcha');
var dialog = require('../../plugins/dialog');
var _alert = dialog.Alert;
var types = location.pathname.split('/');
var type = types[types.length - 1];
var type = types[types.length - 1];// 界面操作类型
/**
... ... @@ -58,6 +58,7 @@ $sms.click(function() {
});
});
// 手机验证第一步提交
$('#mobile-step1').click(function() {
var code = $('#msg-code').val().trim();
var mobile = $('#real-mobile').val();
... ...
... ... @@ -7,7 +7,7 @@ var dialog = require('../../plugins/dialog');
var _alert = dialog.Alert;
var regValidate = require('../../passport/common/mail-phone-regx');
var types = location.pathname.split('/');
var type = types[types.length - 1];
var type = types[types.length - 1];// 界面操作类型
var $imgCaptchaInput = $('#captcha');
var second = 60;
var $sms = $('#send-code2');// 发送短信验证码按钮
... ... @@ -42,7 +42,7 @@ var validatePhoneNumLocal = function(phoneNum) {
};
/**
* 绑定手机号码
* 绑定手机号码部分
*/
$('#region').on('change', function() {
$('#country-code').text($(this).val());
... ... @@ -106,6 +106,7 @@ $sms.click(function() {
});
});
// 绑定手机第二步提交
$('#mobile-step2').click(function() {
var code = $('#msg-code').val();
var mobile = $('#real-mobile').val();
... ... @@ -136,7 +137,7 @@ $('#mobile-step2').click(function() {
/**
* 修改密码
* 修改密码部分
*/
// 输入确认密码
$('#checkPwd').blur(function() {
... ... @@ -188,7 +189,6 @@ $('#step2-pwd').click(function() {
if (data.code === 200) {
location.href = '/me/setting/step3/' + type + '?checkCode=' + $('#checkCode').val();
} else {
// location.href = '/me/setting/step3/' + type + "?checkCode=" + $("#checkCode").val();
new _alert(data.message).show();
}
}
... ...