Authored by 郭成尧

merge

... ... @@ -36,8 +36,12 @@ exports.order = (req, res, next) => {
return Promise.all([
orderModel.order(params),
orderModel.getOrders(initialData)
orderModel.getOrders(initialData),
orderModel.refundReason()
]).then(result => {
// 申请退款原因
let refundReason = result[2];
res.render('order', {
module: 'home',
page: 'order',
... ... @@ -49,6 +53,7 @@ exports.order = (req, res, next) => {
localCss: true,
pageFooter: true,
order: result[0] || [],
refundReason: refundReason,
walkwayUrl: result[1] && result[1].length ? '' : '//m.yohobuy.com/product/new',
firstPageOrdersList: result[1] || []
});
... ...
... ... @@ -10,7 +10,10 @@ const helpers = global.yoho.helpers;
const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const orderDetailModel = require('../models/orderDetail');
const orderModel = require('../models/order');
const payModel = require('../../cart/models/pay');
const addressModel = require('../models/address');
const addressProcess = require(global.utils + '/address-process');
const orderDetailData = (req, res, next) => {
let uid = req.user.uid;
... ... @@ -24,12 +27,24 @@ const orderDetailData = (req, res, next) => {
payModel.sendPayConfirm(orderCode, 22, uid);
}
orderDetailModel.orderDetailData(uid, orderCode).then(result => {
if (!result || _.isEmpty(result)) {
Promise.all([
orderDetailModel.orderDetailData(uid, orderCode),
orderDetailModel.closeReasons(),
orderModel.refundReason()
]).then(result => {
let orderDetail = result[0];
let cancelReason = result[1];
let refundReason = result[2];
Object.assign(orderDetail, {
cancelReason: cancelReason
});
if (!orderDetail || _.isEmpty(orderDetail)) {
return next(404);
}
result.serviceUrl = serviceUrl;
orderDetail.serviceUrl = serviceUrl;
res.render('orderDetail', {
module: 'home',
page: 'orderdetail',
... ... @@ -39,7 +54,8 @@ const orderDetailData = (req, res, next) => {
}),
title: '订单详情',
pageFooter: true,
orderDetail: result,
orderDetail: orderDetail,
refundReason: refundReason,
localCss: true,
});
}).catch(next);
... ... @@ -81,6 +97,28 @@ const cancelOrder = (req, res, next) => {
};
/**
* 申请退款
*/
const refundApply = (req, res, next) => {
let orderCode = req.query.id;
if (!orderCode) {
return res.json({
code: 404,
msg: '订单号不存在!'
});
}
orderDetailModel.refundApply({
orderCode: req.query.id,
uid: req.user.uid,
reasonId: req.query.reasonId || 1,
reason: req.query.reason
}).then(result => {
res.json(result);
}).catch(next);
};
/**
* 我的订单-查看物流信息
*/
const logistic = (req, res, next) => {
... ... @@ -97,10 +135,88 @@ const logistic = (req, res, next) => {
}).catch(next);
};
/**
* 订单修改地址页面
*/
const addressModify = (req, res, next) => {
let uid = req.user.uid;
let orderCode = req.query.orderCode;
let areaCode = req.query.areaCode;
let provinceAreaCode = req.query.provinceAreaCode || false;
addressModel.getAddressData({uid: uid}).then(result => {
let userAddressList = result;
let addressData = addressProcess.getAddressByAreaCode(areaCode,
_.get(userAddressList, 'data', [])) || {};
Object.assign(addressData, {
orderCode: orderCode,
});
if (provinceAreaCode) {
// 不允许修改省份,字符串拆分
let areaArray = addressData.area.split(' ');
let area = _.slice(areaArray, 1);
Object.assign(addressData, {
changeProvince: false,
provinceCode: provinceAreaCode,
province: areaArray[0],
area: area
});
} else {
Object.assign(addressData, {
changeProvince: true,
});
}
res.render('order-address-modify', Object.assign(addressData, {
pageHeader: headerModel.setNav({
navTitle: '修改地址',
navBtn: false
}),
module: 'home',
page: 'order-address-modify',
localCss: true
}));
}).catch(next);
};
/**
* 修改订单地址
* @param {*} req
* @param {*} res
* @param {*} next
*/
const changeAddress = (req, res, next) => {
let uid = req.user.uid;
if (!uid) {
return res.json({
code: 502,
msg: '用户数据不存在!'
});
}
orderDetailModel.changeAddress({
uid: req.user.uid,
orderCode: req.body.orderCode,
username: req.body.username,
areaCode: req.body.area_code,
address: req.body.address,
mobile: req.body.mobile
}).then(result => {
res.json(result);
}).catch(next);
};
module.exports = {
orderDetailData,
delOrder,
readdData,
cancelOrder,
logistic
refundApply,
logistic,
addressModify,
changeAddress
};
... ...
... ... @@ -100,7 +100,8 @@ const address = (params) => {
/* 加密地址 ID */
_.forEach(selfAddress.data, (value, key) => {
selfAddress.data[key].address_id = encodeURIComponent(crypto.encryption(null, selfAddress.data[key].address_id));
selfAddress.data[key].address_id =
encodeURIComponent(crypto.encryption(null, selfAddress.data[key].address_id));
});
/* 如果有 ID 是地址编辑页面 */
... ... @@ -218,5 +219,6 @@ module.exports = {
setDefaultAddress,
locationList,
newGetAddress,
chooseAddress
chooseAddress,
getAddressData: _getAddressData
};
... ...
... ... @@ -263,21 +263,21 @@ const _getNavs = (type) => {
};
/**
* 订单页面数据
* 订单页面导航条和取消订单原因
* @param params
* @returns {*|Promise.<TResult>}
*/
const order = (params) => {
let finalResult = {};
Object.assign(finalResult, {navs: _getNavs(params.type)});
let finalResult = {
navs: _getNavs(params.type)
};
return api.get('', _.assign({
method: 'app.SpaceOrders.closeReasons'
}, params), {
cache: true,
code: 200
}).then((result) => {
}).then(result => {
if (result.data) {
Object.assign(finalResult, {cancelReason: result.data});
... ... @@ -288,6 +288,17 @@ const order = (params) => {
};
/**
* 申请退款原因
*/
const refundReason = () => {
return api.get('', {
method: 'app.SpaceOrders.refundApplyReasons'
}, {code: 200, cache: true}).then(result => {
return _.get(result, 'data', []);
});
};
/**
* 获取订单列表
* @param params
*/
... ... @@ -333,6 +344,15 @@ const getOrders = (params) => {
});
}
/* 申请退款 */
if (parseInt(value.payment_type, 10) === 1 &&
value.payment_status === 'Y' &&
4 <= parseInt(value.status, 10) <= 5) {
Object.assign(perOrder, {
refundApply: true
});
}
finalResult.push(perOrder);
});
}
... ... @@ -343,5 +363,6 @@ const getOrders = (params) => {
module.exports = {
order,
getOrders
getOrders,
refundReason
};
... ...
... ... @@ -180,7 +180,7 @@ const orderDetailData = (uid, orderCode) => {
method: 'app.SpaceOrders.detail',
uid: uid,
order_code: orderCode
}).then((result) => {
}).then(result => {
if (result && result.code === 200) {
let orderDetail = camelCase(result.data);
... ... @@ -286,9 +286,15 @@ const orderDetailData = (uid, orderCode) => {
orderDetail = _.assign(orderDetail, {
goodsAmount: orderDetail.paymentAmount,
url: '/home/addressModify?orderCode=' + orderCode + '&relation=' + orderDetail.relation
url: '/home/orders/addressModify?orderCode=' + orderCode +
'&areaCode=' + orderDetail.areaCode
});
// 如果允许修改省
if (orderDetail.isSupportChangeProvince === 'Y' && orderDetail.provinceAreaCode) {
orderDetail.url = orderDetail.url + '&provinceAreaCode=' + orderDetail.provinceAreaCode;
}
// 为支付的拆单配送信息
if (orderDetail.isMultiPackage && orderDetail.isMultiPackage === 'Y') {
let jitInfo = {
... ... @@ -309,18 +315,17 @@ const orderDetailData = (uid, orderCode) => {
orderDetail.invoice.type = (orderDetail.invoice.type + '' === '2');
}
// 取消订单原因列表
let resons = closeReasons();
return closeReasons().then(list => {
resons = list;
orderDetail = _.assign(orderDetail, {
cancelReason: resons
/* 申请退款 */
if (orderDetail.isMultiPackage === 'N' &&
parseInt(orderDetail.paymentType, 10) === 1 &&
orderDetail.paymentStatus === 'Y' &&
4 <= parseInt(orderDetail.status, 10) <= 5) {
Object.assign(orderDetail, {
refundApply: true
});
}
return orderDetail;
});
} else {
logger.error('detail info return no 200');
return {};
... ... @@ -373,6 +378,19 @@ const cancelOrder = (orderCode, uid, reasonId, gender, channel, reason) => {
});
};
/**
* 申请退款
*/
const refundApply = (params) => {
return api.get('', {
method: 'app.SpaceOrders.refundApply',
uid: params.uid,
order_code: params.orderCode,
reason_id: params.reasonId,
reason: params.reason
});
};
/*
* 我的订单-查看物流
* @param int $orderCode 订单号
... ... @@ -446,11 +464,43 @@ const logistics = (orderCode, uid) => {
});
};
/**
* 修改订单地址
* @param {参数} params
*/
const changeAddress = (params) => {
let apiParams = {
method: 'app.SpaceOrders.updateDeliveryAddress',
order_code: params.orderCode,
uid: params.uid,
user_name: params.username,
area_code: params.areaCode,
address: params.address,
mobile: params.mobile
};
if (params.addressId) {
Object.assign(apiParams, {
address_id: params.addressId
});
}
if (params.phone) {
Object.assign(apiParams, {
phone: params.phone
});
}
return api.post('', apiParams);
};
module.exports = {
orderDetailData,
closeReasons,
delOrder,
readdData,
cancelOrder,
logistics
refundApply,
logistics,
changeAddress
};
... ...
... ... @@ -55,6 +55,10 @@ router.get('/orders/detail', auth, orderDetailController.orderDetailData); // è®
router.get('/delOrder', auth, orderDetailController.delOrder); // 删除订单
router.get('/readd', auth, orderDetailController.readdData); // 再次购买
router.get('/cancelOrder', auth, orderDetailController.cancelOrder); // 取消订单
router.get('/refundApply', auth, orderDetailController.refundApply); // 申请退款
router.get('/orders/addressModify', auth, orderDetailController.addressModify); // 订单详情地址修改页面
router.post('/orders/changeAddress', orderDetailController.changeAddress); // 提交新的地址数据
router.get('/', homeController.index); // 个人中心首页
router.get('/mydetails', auth, homeController.myDetails); // 个人基本资料页面
... ...
<div class="address-modify">
<div class="tip">由于需要仓库调拨,目前暂不支持省地址修改,请您谅解!</div>
<form class="form edit-address" id="areaForm">
<div class="form-group">
<label for="username">收货人:</label>
<input name="username" type="text" value="{{consignee}}">
</div>
<div class="form-group">
<label for="phone">联系电话:</label>
<input name="phone" type="text" value="{{mobile}}">
</div>
{{#unless changeProvince}}
<div class="form-group disable">
<label for="province">所在省:</label>
<input name="province" type="text" value="{{province}}" class="disable" readonly>
<input name="provinceCode" type="hidden" value="{{provinceCode}}">
</div>
{{/unless}}
<div class="form-group" id="area">
<label for="area">所在地区:</label>
<input name="area" type="text" value="{{area}}" readonly>
<input name="area_code" type="hidden" value={{area_code}}>
</div>
<div class="form-group">
<label for="address" class="label-address">详细地址:</label>
<textarea name="address" type="text" value="" maxlength="255">{{address}}
</textarea>
</div>
<input type="hidden" name="orderCode" value="{{orderCode}}">
</form>
<div class="tip"><span class="iconfont icon-info"></span>修改地址仅可修改一次,且会影响送货时间,请您谅解!</div>
<div class="btn-sure-line">
<button id="btnSure" class="btn-sure">确认修改</button>
</div>
</div>
<div id="vAddressAct">
<vue-address-act></vue-address-act>
</div>
\ No newline at end of file
... ...
... ... @@ -44,5 +44,21 @@
</div>
</div>
{{/ order}}
{{!-- 申请退款原因 --}}
<div class="refund-reason-mask">
<div class="refund-reason-box" >
<div class="box-head"><span class="box-cmp">完成</span></div>
<div class="swiper-container refund-box-main">
<ul class="swiper-wrapper">
{{#refundReason}}
<li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
{{/refundReason}}
</ul>
<div class="refund-active-mask"></div>
</div>
</div>
</div>
</div>
... ...
... ... @@ -153,6 +153,11 @@
<span class="btn btn-check-logistics">查看二维码</span>
</a>
{{/if}}
{{!-- 申请退款 --}}
{{#if refundApply}}
<span class="btn btn-refund">申请退款</span>
{{/if}}
{{/if}}
</div>
</div>
... ... @@ -171,6 +176,22 @@
</div>
</div>
{{/ orderDetail}}
{{!-- 申请退款原因 --}}
<div class="refund-reason-mask">
<div class="refund-reason-box" >
<div class="box-head"><span class="box-cmp">完成</span></div>
<div class="swiper-container refund-box-main">
<ul class="swiper-wrapper">
{{#refundReason}}
<li class="swiper-slide" data-reason-id="{{id}}"><span >{{reason}}</span></li>
{{/refundReason}}
</ul>
<div class="refund-active-mask"></div>
</div>
</div>
</div>
</div>
<script>_ozprm = "orderid={{orderCode}}&ordertotal={{orderTotal}}";</script>
<script type="text/javascript" src="//static.yohobuy.com/m/v1/js/AG_Tracking.js"></script>
... ...
... ... @@ -10,7 +10,6 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
... ...
... ... @@ -37,6 +37,11 @@
<span class="btn check-logistics">查看二维码</span>
</a>
{{/if}}
{{!-- 申请退款 --}}
{{#if refundApply}}
<span class="btn refund">申请退款</span>
{{/if}}
</div>
{{/unless}}
{{/unless}}
... ...
const $ = require('yoho-jquery');
const Vue = require('vue');
const tip = require('../plugin/tip');
require('home/order-address-modify.css');
require('common.css');
require('../common');
let $areaForm = $('#areaForm');
let $btnSure = $('#btnSure');
let $province = $('input[name=province]');
let $provinceCode = $('input[name=provinceCode]');
let $area = $('#area');
let vueAddressAct = require('home/address/address-act.vue');
let addressVact = new Vue({
el: '#vAddressAct',
components: {
vueAddressAct: vueAddressAct
}
});
/**
* 弹出地址选择框
*/
$area.on('click', function() {
if ($provinceCode.val() && $province.val()) {
addressVact.$children[0].supportChangeProvince = false;
addressVact.$children[0].switchAddress($provinceCode.val(), $province.val());
}
addressVact.$children[0].show = true;
});
/**
* 提交表单
*/
$btnSure.on('click', function() {
$.post('/home/orders/changeAddress', $areaForm.serialize(), function(result) {
if (result && result.code === 200) {
tip.show(result.msg);
location.href = document.referrer;
} else {
tip.show('系统错误,请重试!');
}
});
});
... ...
... ... @@ -32,7 +32,9 @@ var dialog = require('../plugin/dialog');
var orderHammer,
$reaMask = $('.reason-mask'),
reasonSwiper;
$refundReaMask = $('.refund-reason-mask'),
reasonSwiper,
refundReasonSwiper;
// 首屏加载标志
var firstScreen = $('.firstscreen-orders').children().size() > 0;
... ... @@ -110,14 +112,13 @@ function getOrders(option) {
type: activeType,
page: order.page + 1
};
var show = option && !option.noLoadingMask;
if (firstScreen) {
// 如果首屏加载了,则去掉10条记录
opt.start = 10;
}
var show = option && !option.noLoadingMask;
if (inAjax) {
return;
}
... ... @@ -155,7 +156,8 @@ function getOrders(option) {
if (opt.page > 1) {
return;
}
$curContainer.html('<div class="no-order"><div class="icon"></div><span>你还没有订单!</span><a class="walk-way" href="//m.yohobuy.com/product/new">随便逛逛</a></div>');
$curContainer.html('<div class="no-order"><div class="icon"></div><span>' +
'你还没有订单!</span><a class="walk-way" href="//m.yohobuy.com/product/new">随便逛逛</a></div>');
order.end = true;
}
... ... @@ -203,6 +205,7 @@ orderHammer.on('tap', function(e) {
id = $order.data('id');
$reaMask.data('orderId', id);
$refundReaMask.data('orderId', id);
if ($cur.closest('.del').length > 0) {
... ... @@ -237,7 +240,11 @@ orderHammer.on('tap', function(e) {
});
});
} else if ($cur.closest('.cancel').length > 0) {
// 取消订单
$reaMask.css('visibility', 'visible');
} else if ($cur.closest('.refund').length > 0) {
// 申请退款
$refundReaMask.css('visibility', 'visible');
} else if ($cur.closest('.order-goods').length > 0) {
// Location to order detail
... ... @@ -287,7 +294,7 @@ $(function() {
centeredSlides: true,
initialSlide: 0,
onSlideChangeStart: function(reasonSwiper) {//eslint-disable-line
var activeIndex = reasonSwiper.activeIndex,
let activeIndex = reasonSwiper.activeIndex,
slides = reasonSwiper.slides,
i = 0;
... ... @@ -312,10 +319,43 @@ $(function() {
$(slides[activeIndex]).css('transform', '');
}
});
// 申请退款 Swiper
refundReasonSwiper = new Swiper('.refund-box-main', {
direction: 'vertical',
slidesPerView: 5,
centeredSlides: true,
initialSlide: 0,
onSlideChangeStart: function(refundReasonSwiper) {//eslint-disable-line
let activeIndex = refundReasonSwiper.activeIndex,
slides = refundReasonSwiper.slides,
i = 0;
if (slides.length !== 1) {
if (activeIndex === 0) {
for (i = 1; i < slides.length; i++) {
$(slides[i]).css('transform', '');
}
} else if (activeIndex === slides.length - 1) {
for (i = 0; i < activeIndex; i++) {
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
}
} else {
for (i = 0; i < activeIndex; i++) {
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
}
for (i = activeIndex + 1; i < slides.length; i++) {
$(slides[i]).css('transform', '');
}
}
}
$(slides[activeIndex]).css('transform', '');
}
});
});
$reaMask.find('.box-cmp').on('touchend', function() {
var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
let selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
reason = $(selSolid).text(),
reasonId = $(selSolid).data('reasonId');
... ... @@ -343,6 +383,36 @@ $reaMask.find('.box-cmp').on('touchend', function() {
});
});
// 申请退款
$refundReaMask.find('.box-cmp').on('touchend', function() {
let selSolid = refundReasonSwiper.slides[refundReasonSwiper.activeIndex],
reason = $(selSolid).text(),
reasonId = $(selSolid).data('reasonId');
$.ajax({
type: 'GET',
url: '/home/refundApply',
data: {
id: $refundReaMask.data('orderId'),
reason: reason,
reasonId: reasonId
}
}).then(function(res) {
$refundReaMask.fadeOut();
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
tip.show(res.message);
}
setTimeout(function() {
window.location.href = '/home/orders';
}, 2000);
}).fail(function() {
tip.show('网络错误');
});
});
$reaMask.on('touchend', function(event) {
if (event.target.className !== 'reason-mask') {
return false;
... ... @@ -352,6 +422,16 @@ $reaMask.on('touchend', function(event) {
event.stopPropagation();
});
// 申请退款
$refundReaMask.on('touchend', function(event) {
if (event.target.className !== 'reason-mask') {
return false;
}
$refundReaMask.css('visibility', 'hidden');
event.stopPropagation();
});
$('.nav-tap').on('click', function(e) {
var $cur = $(e.target);
... ...
... ... @@ -4,24 +4,25 @@
* @date: 2015/11/16
*/
require('home/order-detail-index.page.css');
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
Hammer = require('yoho-hammer'),
dialog = require('../plugin/dialog'),
tip = require('../plugin/tip');
tip = require('../plugin/tip'),
Swiper = require('yoho-swiper');
var orderId = $('#order-detail').data('id'),
$countDownHours = $('.hours'),
$countdownContainer = $('.count-down'),
Swiper = require('yoho-swiper'),
$ownerInfo = $('.owner-info'),
$reaMask = $('.reason-mask'),
$refundReaMask = $('.refund-reason-mask'),
reasonSwiper,
refundReasonSwiper,
optHammer,
$createTime = new Date($('.createTime').text() * 1000);
require('home/order-detail-index.page.css');
require('../common');
lazyLoad({
... ... @@ -48,8 +49,8 @@ function downCount(options) {
seconds;
// calculate dates
hours = Math.floor((difference % _day) / _hour),
minutes = Math.floor((difference % _hour) / _minute),
hours = Math.floor((difference % _day) / _hour);
minutes = Math.floor((difference % _hour) / _minute);
seconds = Math.floor((difference % _minute) / _second);
// fix dates so that it will show two digets
... ... @@ -117,6 +118,8 @@ optHammer.on('tap', function(e) {
});
} else if ($cur.hasClass('btn-cancel')) {
$reaMask.css('visibility', 'visible');
} else if ($cur.hasClass('btn-refund')) {
$refundReaMask.css('visibility', 'visible');
} else if ($cur.hasClass('btn-rebuy')) {
$.ajax({
type: 'GET',
... ... @@ -148,7 +151,7 @@ $(function() {
centeredSlides: true,
slidesPerView: 5,
direction: 'vertical',
onSlideChangeStart: function(reasonSwiper) {
onSlideChangeStart: function(reasonSwiper) {//eslint-disable-line
var activeIndex = reasonSwiper.activeIndex,
slides = reasonSwiper.slides,
i = 0;
... ... @@ -174,9 +177,42 @@ $(function() {
$(slides[activeIndex]).css('transform', '');
}
});
// 申请退款 Swiper
refundReasonSwiper = new Swiper('.refund-box-main', {
direction: 'vertical',
slidesPerView: 5,
centeredSlides: true,
initialSlide: 0,
onSlideChangeStart: function(refundReasonSwiper) {//eslint-disable-line
let activeIndex = refundReasonSwiper.activeIndex,
slides = refundReasonSwiper.slides,
i = 0;
if (slides.length !== 1) {
if (activeIndex === 0) {
for (i = 1; i < slides.length; i++) {
$(slides[i]).css('transform', '');
}
} else if (activeIndex === slides.length - 1) {
for (i = 0; i < activeIndex; i++) {
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
}
} else {
for (i = 0; i < activeIndex; i++) {
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
}
for (i = activeIndex + 1; i < slides.length; i++) {
$(slides[i]).css('transform', '');
}
}
}
$(slides[activeIndex]).css('transform', '');
}
});
});
$reaMask.find('.box-cmp').on('touchend', function(e) {
$reaMask.find('.box-cmp').on('touchend', function() {
var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
reason = $(selSolid).text(),
reasonId = $(selSolid).data('reasonId');
... ... @@ -205,6 +241,36 @@ $reaMask.find('.box-cmp').on('touchend', function(e) {
});
});
// 申请退款
$refundReaMask.find('.box-cmp').on('touchend', function() {
let selSolid = refundReasonSwiper.slides[refundReasonSwiper.activeIndex],
reason = $(selSolid).text(),
reasonId = $(selSolid).data('reasonId');
$.ajax({
type: 'GET',
url: '/home/refundApply',
data: {
id: orderId,
reason: reason,
reasonId: reasonId
}
}).then(function(res) {
$refundReaMask.fadeOut();
if ($.type(res) !== 'object') {
return;
}
if (res.message) {
tip.show(res.message);
}
setTimeout(function() {
window.location.href = '/home/orders';
}, 2000);
}).fail(function() {
tip.show('网络错误');
});
});
$reaMask.on('touchend', function(event) {
if (event.target.className !== 'reason-mask') {
return false;
... ... @@ -214,6 +280,16 @@ $reaMask.on('touchend', function(event) {
event.stopPropagation();
});
// 申请退款
$refundReaMask.on('touchend', function(event) {
if (event.target.className !== 'reason-mask') {
return false;
}
$refundReaMask.css('visibility', 'hidden');
event.stopPropagation();
});
function formatDate(objD) {
var str,
yy = objD.getYear(),
... ...
... ... @@ -231,7 +231,8 @@
}
}
.reason-mask {
.reason-mask,
.refund-reason-mask {
position: fixed;
width: 100%;
height: 100%;
... ... @@ -241,7 +242,8 @@
z-index: 1;
visibility: hidden;
.reason-box {
.reason-box,
.refund-reason-box {
border-bottom: 1px solid #ccc;
font: inherit;
vertical-align: baseline;
... ... @@ -262,7 +264,8 @@
padding-right: 30px;
}
.box-main {
.box-main,
.refund-box-main {
background: #fff;
padding: 20px;
height: 300px;
... ...
.order-page {
background: #f0f0f0;
.reason-mask {
.reason-mask,
.refund-reason-mask {
position: fixed;
width: 100%;
height: 100%;
... ... @@ -11,7 +12,8 @@
z-index: 5;
visibility: hidden;
.reason-box {
.reason-box,
.refund-reason-box {
border-bottom: 1px solid #ccc;
font: inherit;
position: absolute;
... ... @@ -32,7 +34,8 @@
padding-right: 30px;
}
.box-main {
.box-main,
.refund-box-main {
background: #fff;
padding: 20px;
height: 300px;
... ...
.address-modify {
position: fixed;
width: 100%;
top: 90px;
bottom: 0;
background-color: #f0f0f0;
.icon-info:before {
content: "\e61f";
}
.tip {
color: #aeaeae;
font-size: 14px;
line-height: 60px;
padding-left: 30px;
.icon-info {
margin-right: 5px;
}
}
.form {
border-top: 1px solid #e7e7e7;
border-bottom: 1px solid #e7e7e7;
background-color: #fff;
.form-group {
line-height: 80px;
border-bottom: 1px solid #e7e7e7;
margin-left: 30px;
}
.disable {
color: #a2a2a2;
}
.form-group:last-child {
border-bottom: none;
}
label {
width: 20%;
}
input {
width: 77%;
line-height: 60px;
}
.label-address {
float: left;
}
textarea {
right: 0;
width: 77%;
resize: none;
padding-top: 22px;
height: 120px;
}
}
.btn-sure-line {
text-align: center;
margin-top: 40px;
.btn-sure {
background: #444;
color: #fff;
padding: 22px 160px;
border-radius: 4px;
}
}
}
... ...
... ... @@ -3,7 +3,7 @@
<div class="address-select-box">
<div class="component-title"><span class="title">所在地区</span><span class="iconfont close" @click="closeAddBox">&#xe623;</span></div>
<ul class="head-address-ul">
<li v-if="province.title" :class="{ 'head-address-li': common.titleActive }" @click="clickTitle('province')">{{province.title}}</li>
<li v-if="province.title" :class="{ 'head-address-li': common.titleActive, 'disable': !supportChangeProvince}" @click="clickTitle('province')">{{province.title}}</li>
<li v-if="city.title" :class="{ 'head-address-li': province.titleActive }" @click="clickTitle('city')">{{city.title}}</li>
<li v-if="area.title" :class="{ 'head-address-li': city.titleActive }" @click="clickTitle('area')">{{area.title}}</li>
<li v-if="street.title" :class="{ 'head-address-li': area.titleActive }">{{street.title}}</li>
... ... @@ -36,6 +36,10 @@
</div>
</template>
<style>
.disable {
color: #a6a6a6;
}
.icon-v:before {
content: "\e6ea";
}
... ... @@ -162,7 +166,8 @@
}
</style>
<script>
let $ = require('yoho-jquery');
const $ = require('yoho-jquery');
const tip = require('../../../js/plugin/tip');
require('home/address/address-index.page.css');
... ... @@ -173,6 +178,7 @@
module.exports = {
data() {
return {
supportChangeProvince: true, // 是否支持修改省
provinces: [],
citys: [],
areas: [],
... ... @@ -214,12 +220,20 @@
methods: {
/* 返回标题处理 */
returnTitle() {
let getTitle = '';
let streetTitle = this.street.allTitle !== '全部' ? this.street.allTitle : '';
let getTitle = this.province.allTitle +
let returnTitle = '';
if (this.supportChangeProvince) {
getTitle = this.province.allTitle +
this.city.allTitle +
this.area.allTitle +
streetTitle;
let returnTitle = '';
} else {
getTitle = this.city.allTitle +
this.area.allTitle +
streetTitle;
}
if (getTitle.length > 11) {
returnTitle = getTitle.substr(0, 5) + '...' + getTitle.substr(-5);
... ... @@ -360,6 +374,10 @@
clickTitle(type) {
switch (type) {
case 'province':
if (!this.supportChangeProvince) {
tip.show('不允许修改省地址!');
return false;
}
if (this.provinces.length < 1) {
this.switchAddress();
}
... ...
/**
* 地址处理
*/
const _ = require('lodash');
const getAddressByAreaCode = (areaCode, addressList) => {
return _.find(addressList, function(address) {
return parseInt(address.area_code, 10) === parseInt(areaCode, 10);
});
};
module.exports = {
getAddressByAreaCode
};
... ...