Authored by 郭成尧

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

... ... @@ -36,10 +36,7 @@ const order = {
});
},
getOrderData: (req, res) => {
let uid = req.user.uid;
let page = req.query.page;
let type = req.query.type;
let limit = req.query.limit;
const uid = req.user.uid;
if (!uid && req.xhr) {
return res.json({
... ... @@ -47,11 +44,11 @@ const order = {
message: notLoginTip
});
}
let param = {
const param = {
uid: uid,
page: page,
type: type,
limit: limit
page: req.query.page,
type: req.query.type,
limit: req.query.limit
};
orderModel.getOrders(param).then(result => {
... ...
... ... @@ -7,7 +7,6 @@ const refundModel = require('../models/refund');
const notLoginCode = 400;
const notLoginTip = '抱歉,您暂未登录!';
const testUid = 8039837; // 测试uid
const isBLK = 1;
const refund = {
refund(req, res) {
... ... @@ -118,8 +117,7 @@ const refund = {
let param = {
uid: uid,
page: page,
limit: limit,
app_type: isBLK
limit: limit
};
refundModel.getRefundOrders(param).then(result => {
... ...
... ... @@ -6,8 +6,6 @@
'use strict';
const api = global.yoho.API;
// const serviceAPI = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
... ... @@ -65,7 +63,6 @@ exports.cancelOrder = (orderCode, reasonId, reason) => {
* @returns {Promise.<T>|*}
*/
exports.confirmOrder = (orderCode) => {
return api.post('', {
method: 'app.SpaceOrders.confirm',
order_code: orderCode
... ... @@ -101,7 +98,7 @@ exports.getOrderLogisticdate = (params) => {
let method;
if (_.isEmpty(params.order_code)) {
return [];
return Promise.resolve([]);
}
// getNewExpress:退换货物流,li:订单物流
... ...
... ... @@ -77,7 +77,6 @@ const refund = {
}, param);
return api.get('', param, {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
... ...
<div class="status" id="status">
<status :applyid="{{applyId}}" :type="{{type}}"></status>
<status type='{{type}}' applyid="{{applyId}}"></status>
</div>
... ...
<div class="modal">
<div class="modal {{styleClass}}">
<h2>{{title}}</h2>
<p>{{text}}</p>
<hr>
... ...
... ... @@ -2,6 +2,7 @@
* 拦截跳转, 在这里给将要打开的页面设置一下 header 样式
* @return {[type]}
*/
const $ = require('jquery');
const yoho = require('yoho');
const parse = require('yoho-qs/parse'); // 提供解析函数
... ... @@ -17,7 +18,7 @@ const origin = location.origin;
* 文档 http://git.yoho.cn/mobile/AppJSBridge/blob/master/HeaderType.md
* @type {Object}
*/
const titleMap = {
const defaultTitleMap = {
1: {
headerid: '1',
left: {
... ... @@ -95,11 +96,10 @@ const titleMap = {
}
};
const matchHeader = (url) => {
const matchHeader = (path, qs, titleMap) => {
let header = {
headerid: '-1'
};
let path = url.split('?')[0];
if (/\/cate-all$/.test(path)) {
header = titleMap[1];
... ... @@ -115,16 +115,14 @@ const matchHeader = (url) => {
if (/\/me\/order$/.test(path)) {
let des = '';
let u = url.split('?')[1];
u = parse(u);
if (u.type === '1') {
if (qs.type === '1') {
des = '我的订单';
} else if (u.type === '2') {
} else if (qs.type === '2') {
des = '待付款';
} else if (u.type === '3') {
} else if (qs.type === '3') {
des = '待发货';
} else if (u.type === '4') {
} else if (qs.type === '4') {
des = '待收货';
}
header = titleMap[1];
... ... @@ -182,11 +180,8 @@ const matchHeader = (url) => {
}
if (/\/me\/help-detail$/.test(path)) {
let u = url.split('?')[1];
u = parse(u);
header = titleMap[1];
header.title.des = u.title; // 帮助中心详细
header.title.des = qs.title; // 帮助中心详细
return header;
}
... ... @@ -217,6 +212,7 @@ const matchHeader = (url) => {
const intercept = (url) => {
if (yoho.isApp) {
let titleMap = $.extend({}, defaultTitleMap);
let [path, qs] = url.split('?');
qs = parse(qs);
... ... @@ -265,7 +261,7 @@ const intercept = (url) => {
}
yoho.goNewPage({
header: matchHeader(url),
header: matchHeader(path, qs, titleMap),
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
});
} else {
... ... @@ -274,6 +270,6 @@ const intercept = (url) => {
};
module.exports = {
titleMap: titleMap,
defaultTitleMap: defaultTitleMap,
intercept: intercept
};
... ...
... ... @@ -22,6 +22,7 @@ class Modal {
this.defaults = {
isModal: true,
template: template,
styleClass: '',
title: '',
text: '',
buttons: [
... ... @@ -37,6 +38,7 @@ class Modal {
// 初始化参数
this.settings = Object.assign({}, this.defaults, opts);
const tpl = this.settings.template({
styleClass: this.settings.styleClass,
title: this.settings.title,
text: this.settings.text,
buttons: this.settings.buttons
... ...
... ... @@ -15,6 +15,7 @@ console.log(vm);
/* eslint-disable */
// 私有包测试
var $ = require('jquery');
var qs = require('yoho-qs');
console.log(qs);
... ...
const $ = require('jquery');
const yoho = require('yoho');
const interceptClick = require('common/intercept-click');
const Modal = require('common/modal');
// 退换货 申请 成功, 打开 modal
exports.applySuccuss = function(type, applyId) {
let config = {
exchange: {
name: '换货',
detailUrl: `/me/return/exchange/detail/${applyId}`
},
refund: {
name: '退货',
detailUrl: `/me/return/refund/detail/${applyId}`
}
};
let kind = config[type];
let goStatusPage = function() {
let header = $.extend({}, interceptClick.defaultTitleMap[1]);
header.left.action = location.origin + '/me/return';
header.title.des = `${kind.name}状态`;
return yoho.goNewPage({
header: header,
url: location.origin + kind.detailUrl
});
};
const modal = new Modal({
styleClass: 'return-success-modal',
text: `${kind.name}申请已提交,请等待审核.....`,
buttons: [{
text: '返回订单',
handler: function() {
this.hide();
yoho.goBack();
}
}, {
text: '查看进度',
handler: function() {
this.hide();
goStatusPage();
}
}]
});
modal.show();
};
... ...
... ... @@ -17,8 +17,7 @@
p {
font-size: 21px;
text-align: center;
margin-top: 20px;
margin-bottom: 48px;
margin: 20px 40px 48px;
}
hr {
... ...
... ... @@ -228,7 +228,7 @@ $white: #fff;
background-size: 100%;
}
p{
p {
color: #b0b0b0;
}
... ...
.return-success-modal {
p {
font-size: 30px;
}
.button-group .modal-button:first-of-type {
color: #b0b0b0;
}
}
... ...
... ... @@ -71,13 +71,15 @@
.channel-tab {
position: fixed;
top: 0;
left: 0;
left: 50%;
z-index: 1;
width: 100%;
max-width: 750px;
height: 90px;
font-size: 24px;
text-align: center;
background: #fff;
transform: translate(-50%, 0);
.channel {
display: inline-block;
... ...
... ... @@ -28,17 +28,18 @@
</script>
<style>
.header {
box-sizing: content-box;
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 210;
padding-top: 5px;
padding-left: 30px;
padding-right: 30px;
width: 100%;
height: 80px;
line-height: 60px;
padding: 10px 30px;
height: 70px;
max-width: 750px;
margin-left: auto;
margin-right: auto;
line-height: 70px;
font-size: 48px;
background-color: #fff;
.icon,
... ... @@ -66,17 +67,16 @@
}
.header-gap {
height: 80px;
height: 90px;
background-color: #fff;
}
.app.ios {
.header {
padding-top: 55px;
padding-top: 50px;
}
.header-gap {
height: 120px;
height: calc(70 + 50+ 10)px;
}
}
</style>
... ...
... ... @@ -37,9 +37,9 @@
const qs = require('yoho-qs');
const tip = require('common/tip');
const bus = require('common/vue-bus');
const modal = require('common/modal');
const interceptClick = require('common/intercept-click');
const Modal = require('common/modal');
const yoho = require('yoho');
const returnUtil = require('me/return/util');
const productList = require('me/return/list.vue');
const featureSelector = require('component/product/feature-selector.vue');
... ... @@ -245,22 +245,15 @@
data
}).then(result => {
if (result.code === 200) {
let header = interceptClick.titleMap[1];
header.left.action = location.origin + '/me/return'
header.title.des = '换货状态';;
return yoho.goNewPage({
header: header,
url: location.origin + `/me/return/exchange/detail/${result.data.applyId}`
});
returnUtil.applySuccuss(self.page, result.data.applyId);
} else {
modal.alert(result.message);
Modal.alert(result.message);
}
}).always(()=>{
self.processing = false;
});
} else {
modal.alert(msg);
Modal.alert(msg);
}
}
},
... ... @@ -302,6 +295,8 @@
</script>
<style>
@import "../../scss/me/_return.css";
body {
background-color: #f6f6f6;
}
... ...
... ... @@ -206,7 +206,7 @@
this.hideDelBth();
this.editmodel = !this.editmodel;
let header = interceptClick.titleMap[5];
let header = $.extend({}, interceptClick.defaultTitleMap[5]);
header.defaultSelectedIndex = '1';
header.right.des = this.editmodel ? '完成' : '编辑';
... ...
... ... @@ -224,7 +224,7 @@
this.hideDelBth();
this.editmodel = !this.editmodel;
let header = interceptClick.titleMap[5];
let header = $.extend({}, interceptClick.defaultTitleMap[5]);
header.defaultSelectedIndex = '0';
header.right.des = this.editmodel ? '完成' : '编辑';
... ...
... ... @@ -98,10 +98,10 @@
}
}).then(result => {
if (result.code === 200) {
this.busy = false;
if (result.data.orderList.length > 0) {
if (result.data && result.data.orderList.length > 0) {
this.$set('orderList', this.orderList.concat(result.data.orderList));
this.pageTotal = result.data.pageTotal;
this.busy = false;
}
}
... ... @@ -130,7 +130,7 @@
$.ajax({
url: '/me/getCancelOrderReason',
}).then(result => {
if (result.data.length > 0) {
if (result && result.data) {
this.options = result.data;
}
}).fail(() => {
... ...
<template>
<ul v-infinite-scroll="getOrderData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<ul v-infinite-scroll="getRefundData()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<li class="order-item" v-for="(index, order) in orderList">
<div class="order-detail">
<div class="order-code">
... ... @@ -12,8 +12,7 @@
<div class="order-goods">
<div class="goods-info" v-for="product in order.goods">
<div class="img-box">
<img v-bind:src="product.goodsImage | resize 49 65" alt="{{product.productName}}">
<label v-if="product.goodsType == 'gift'">赠品</label>
<img v-bind:src="product.goodsImage | resize 49 65">
</div>
<div class="goods-detail">
<p class="name">{{product.productName}}</p>
... ... @@ -26,12 +25,14 @@
<p>&yen;{{product.salesPrice}}</p>
<p>×1</p>
</div>
<a v-if="order.refundType === 1" href="/me/return/refund/detail/{{order.id}}"></a>
<a v-if="order.refundType === 2" href="/me/return/exchange/detail/{{order.id}}"></a>
</div>
</div>
<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" @click="cancelApply(order.id, order.refundType)">取消申请</button>
<div class="options">
<button class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
</div>
</div>
</div>
... ... @@ -59,13 +60,11 @@
emptybox: 'hide'
};
},
ready() {
this.getOrderData();
this.getRefundData();
},
methods: {
getOrderData() {
getRefundData() {
this.busy = true;
if (this.page >= this.pageTotal) {
return;
... ... @@ -77,10 +76,12 @@
limit: this.limit
}
}).then(result => {
this.busy = false;
if (result.data.list.length > 0) {
this.$set('orderList', this.orderList.concat(result.data.list));
this.pageTotal = result.data.totalPage;
if (result.code === 200) {
if (result.data && result.data.list.length > 0) {
this.$set('orderList', this.orderList.concat(result.data.list));
this.pageTotal = result.data.totalPage;
this.busy = false;
}
}
if (this.orderList.length === 0) {
... ... @@ -97,7 +98,7 @@
*/
cancelApply(id, type) {
$.ajax({
url: '/me/' + (Number(type) === 2 ? 'exchange' : 'refund') + '/cancel-apply',
url: '/me/return/' + (Number(type) === 2 ? 'exchange' : 'refund') + '/cancel-apply',
type: 'post',
data: {
id: id
... ...
... ... @@ -15,7 +15,7 @@
<div v-if="detail.status == 20"
class="logistics-detail">
<template v-if="detail.notice">
<a href="/me/logistic?order_code={{orderCode}}&type=refund">
<a href="/me/logistic?order_code={{sourceOrderCode}}&type=refund">
<h2>{{detail.notice.title}}</h2>
<p>物流公司: {{detail.notice.expressCompany}}<br>快递单号: {{detail.notice.expressNumber}}</p>
<span class="right"><span class="icon icon-right"></span></span>
... ... @@ -96,7 +96,7 @@
</div>
</div>
<div class="exchange-order">
<a class="primary" href="/me/order/detail?orderCode={{orderCode}}">原订单详情
<a class="primary" href="/me/order/detail?orderCode={{sourceOrderCode}}">原订单详情
<span class="right"><span class="icon icon-right"></span></span>
</a>
</div>
... ... @@ -116,13 +116,14 @@
props: ['applyid', 'type'],
data() {
return {
orderCode: '',
id: '',
sourceOrderCode: '',
detail: {}
};
},
methods: {
cancel() {
if (!this.detail || !this.orderCode) {
if (!this.id) {
return false;
}
... ... @@ -138,7 +139,7 @@
method: 'POST',
url: url,
data: {
id: this.orderCode,
id: this.id,
}
}).then(data => {
if (data.code === 200) {
... ... @@ -165,12 +166,8 @@
return;
}
if (this.type === 'refund') {
this.orderCode = this.detail.sourceOrderCode;
} else if (this.type === 'exchange') {
this.orderCode = this.detail.orderCode;
}
this.id = this.detail.id;
this.sourceOrderCode = this.detail.sourceOrderCode;
this.detail.goodsList.forEach(d => {
d.evidenceImages = d.evidenceImages.map(p => {
return util.getImgHost(p) + '?imageView2/2/w/154/h/154';
... ...
... ... @@ -52,14 +52,15 @@
const $ = require('jquery');
const qs = require('yoho-qs');
const modal = require('common/modal');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
const productList = require('me/return/list.vue');
const reasonConfig = require('me/return/reason');
const returnUtil = require('me/return/util');
module.exports = {
data() {
return {
page: 'refund',
list: [],
amount: {},
refundData: {}
... ... @@ -150,6 +151,8 @@
return true;
},
submit() {
const self = this;
if (!this.checkSubmitData()) {
modal.alert('请填写完整退换货信息');
}
... ... @@ -159,14 +162,7 @@
data: this.submitData
}).then(result => {
if (result.code === 200) {
let header = interceptClick.titleMap[1];
header.left.action = location.origin + '/me/return'
header.title.des = '退货状态';;
return yoho.goNewPage({
header: header,
url: location.origin + `/me/return/refund/detail/${result.data.applyId}`
});
returnUtil.applySuccuss(self.page, result.data.applyId);
} else {
modal.alert(result.message);
}
... ... @@ -180,6 +176,8 @@
</script>
<style>
@import "../../scss/me/_return.css";
.main-wrap {
background: #f6f6f6;
}
... ...
... ... @@ -13,7 +13,7 @@
word-wrap: break-word;
img {
width: 100%;
max-width: 100%;
}
p {
... ...