Authored by 沈志敏

fix bug

... ... @@ -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>
... ...
... ... @@ -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,7 +96,7 @@ const titleMap = {
}
};
const matchHeader = (url) => {
const matchHeader = (url, titleMap) => {
let header = {
headerid: '-1'
};
... ... @@ -217,6 +218,7 @@ const matchHeader = (url) => {
const intercept = (url) => {
if (yoho.isApp) {
let titleMap = $.extend({}, defaultTitleMap);
let [path, qs] = url.split('?');
qs = parse(qs);
... ... @@ -265,7 +267,7 @@ const intercept = (url) => {
}
yoho.goNewPage({
header: matchHeader(url),
header: matchHeader(url, titleMap),
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
});
} else {
... ... @@ -274,6 +276,6 @@ const intercept = (url) => {
};
module.exports = {
titleMap: titleMap,
defaultTitleMap: defaultTitleMap,
intercept: intercept
};
... ...
... ... @@ -228,7 +228,7 @@ $white: #fff;
background-size: 100%;
}
p{
p {
color: #b0b0b0;
}
... ...
... ... @@ -245,7 +245,7 @@
data
}).then(result => {
if (result.code === 200) {
let header = interceptClick.titleMap[1];
let header = $.extend({}, interceptClick.defaultTitleMap[1]);
header.left.action = location.origin + '/me/return'
header.title.des = '换货状态';;
... ...
... ... @@ -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';
... ...
... ... @@ -159,7 +159,7 @@
data: this.submitData
}).then(result => {
if (result.code === 200) {
let header = interceptClick.titleMap[1];
let header = $.extend({}, interceptClick.defaultTitleMap[1]);
header.left.action = location.origin + '/me/return'
header.title.des = '退货状态';;
... ...