Authored by 王洪广

修改退换货、订单列表

... ... @@ -31,7 +31,7 @@ yoho币 | /home/mycurrency |
关于我们 | /home/about |
物流详情 | /home/logistic?order_code=1609827614 |
退换货物流详情| /home/logistic?order_code=1609827614&type=refund|
退换货列表 | /home/refund/orders |
--------------------------------------------------------------------------------
----
... ...
... ... @@ -16,7 +16,7 @@ const exchange = {
// 订单 可换货商品列表
order(req, res, next) {
const uid = req.user.uid || 8050882;
const uid = 8041886;
const orderId = req.query.orderId;
if (!orderId) {
... ... @@ -48,6 +48,21 @@ const exchange = {
exchangeModel.submitExchange(uid, req.body).then(result => {
res.json(result);
}).catch(next);
},
/**
* 取消换货申请
* @param req
* @param res
* @param next
*/
cancelApply(req, res, next) {
let id = req.body.id;
let uid = req.user.id;
exchangeModel.cancelApply(uid, id).then(result => {
return res.json(result);
}).catch(next);
}
};
... ...
... ... @@ -90,6 +90,27 @@ const refund = {
refundModel.getRefundOrders(param).then(result => {
return res.json(result);
});
},
/**
* 取消申请
* @param req
* @param res
*/
cancelApply(req, res) {
let uid = req.user.id;
let id = req.body.id;
uid = testUid;
if (!uid && req.xhr) {
return res.json({
code: notLoginCode,
message: notLoginTip
});
}
refundModel.cancelRefundApply(uid, id).then(result => {
return res.json(result);
});
}
};
... ...
... ... @@ -36,6 +36,19 @@ const exchange = {
}, params);
return api.post('', data).then(global.yoho.camelCase);
},
/**
* 取消换货申请
* @param uid
* @param id
*/
cancelApply(uid, id) {
return api.post('', {
uid: uid,
id: id,
method: 'app.change.cancel'
}).then(global.yoho.camelCase);
}
};
... ...
... ... @@ -50,7 +50,7 @@ exports.getOrderDetail = (uid, orderCode) => {
*/
exports.cancelOrder = (orderCode, reasonId, reason) => {
return api.get('057f5f856dff8b58.json', {
return api.post('', {
method: 'app.SpaceOrders.close',
order_code: orderCode,
reason_id: reasonId,
... ... @@ -67,7 +67,7 @@ exports.cancelOrder = (orderCode, reasonId, reason) => {
*/
exports.confirmOrder = (orderCode) => {
return api.get('', {
return api.post('', {
method: 'app.SpaceOrders.confirm',
order_code: orderCode
}).then(result => {
... ... @@ -82,7 +82,7 @@ exports.confirmOrder = (orderCode) => {
* @returns {Promise.<T>|*}
*/
exports.deleteOrder = (orderCode, uid) => {
return api.get('', {
return api.post('', {
method: 'app.SpaceOrders.delOrderByCode',
order_code: orderCode,
uid: uid
... ...
... ... @@ -52,6 +52,20 @@ const refund = {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
/**
* 取消退货申请
*
* @param uid 用户id
* @param id 退货id
*/
cancelRefundApply(uid, id) {
return api.post('', {
uid: uid,
id: id,
method: 'app.refund.cancel'
}).then(global.yoho.camelCase);
}
};
... ...
... ... @@ -46,6 +46,7 @@ router.get('/refund/order', refund.order); // 查询订单数据
router.post('/refund/submit', refund.submit); // 提交信息
router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息
router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息
router.post('/refund/cancel-apply', refund.cancelApply); // 退货 - 取消申请
router.get('/exchange-status', refund.exchangeGoods); // 退换货 - 换货状态
router.get('/refund/orders', refund.refundOrders); // 退换货 - 订单列表
... ... @@ -56,6 +57,7 @@ router.get('/exchange', exchange.exchange);
router.get('/exchange/order', exchange.order); // AJAX 获取订单 商品
router.get('/exchange/delivery', exchange.delivery); // AJAX 获取 退货方式
router.post('/exchange/submit', exchange.submit); // AJAX 提交换货 申请
router.post('/exchange/cancel-apply', exchange.cancelApply); // AJAX 取消换货申请
router.get('/mydetails', home.mydetails); // 个人信息
router.post('/save-mydetails', home.saveMydetails); // 保存个人信息
... ...
<div class="select">
<ul>
{{#each items}}
<li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{val}}</li>
<li class="item-li {{#if disabled}} disabled {{/if}}" key="{{key}}" status="{{disabled}}">{{{val}}}</li>
{{/each}}
<li class="item-del">
<span>取消</span>
... ...
... ... @@ -43,14 +43,14 @@ function Select(items) {
if (elem.parent().length === 0) {
const lis = elem.find('.item-li');
lis.each(function() {
if (!$(this).attr('status')) {
lis.each(function(index) {
if ($(this).attr('status') === 'false' || $(this).attr('status') === '') {
$(this).click(function(e) {
hide();
cb({
key: $(e.target).attr('key'),
val: e.target.innerHTML
});
cb(Object.assign({
key: e.target.getAttribute('key'),
val: e.target.innerText
}, items[index]));
});
}
});
... ...
... ... @@ -212,6 +212,7 @@ body {
border: 0 none;
background: $white;
font-size: 28px;
margin-right: 10px;
&.black {
width: 192px;
... ... @@ -237,3 +238,7 @@ body {
}
}
}
.select .overdue{
color: #b0b0b0;
}
\ No newline at end of file
... ...
... ... @@ -199,3 +199,40 @@ $white: #fff;
}
}
}
.order-empty {
width: 100%;
height: 100%;
text-align: center;
background: $white;
&:before {
content: "";
display: inline-block;
width: 153px;
height: 195px;
margin-top: 290px;
background: resolve("home/noorder.png") no-repeat;
background-size: 100%;
}
p{
color: #b0b0b0;
}
p:first-of-type{
font-size: 34px;
margin: 50px 0 20px;
}
a{
display: inline-block;
width: 414px;
height: 94px;
margin-top: 60px;
background: $black;
color: $white;
line-height: 94px;
font-size: 28px;
}
}
\ No newline at end of file
... ...
... ... @@ -43,10 +43,11 @@
<div class="order-button" v-show="order.status != 1 && order.status != 2 && order.status != 3">
<button v-if="order.status == 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status == 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
<button v-if="order.status == 4 || order.status == 5 ">查看物流</button>
<button v-if="order.status == 4 || order.status == 5 " @click="seeExpress(order.orderCode)">查看物流</button>
<button v-if="order.status == 4 || order.status == 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status == 6" @click="deleteOrder(order,index)">删除订单</button>
<button v-if="order.status == 6" class="normal">再次购买</button>
<button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button>
</div>
</template>
<script>
... ... @@ -56,6 +57,7 @@
const tip = require('common/tip');
const Modal = require('common/modal');
const yohoAPI = require('yoho');
let genderSel = require('common/select');
module.exports = {
data() {
... ... @@ -76,6 +78,24 @@
}).then(result => {
if (result.code === 200) {
this.$set('order', result.data);
genderSel = genderSel([
{
key: this.order.isSupportRefund = 'N',
val: this.order.isSupportRefund === 'Y' ? '申请退货' : '<span class="overdue">申请退货(已过期限)</span>',
url: '/home/refund?orderId=' + this.order.orderCode,
disabled: this.order.isSupportRefund !== 'Y'
},
{
key: this.order.isSupportExchange,
val: this.order.isSupportExchange === 'Y' ? '申请换货' : '<span class="overdue">申请换货(已过期限)</span>',
url: '/home/exchange?orderId=' + this.order.orderCode,
disabled: this.order.isSupportExchange !== 'Y'
},
{
key: 'onlineService',
val: '在线客服'
}
]);
} else {
tip(result.message);
}
... ... @@ -161,8 +181,18 @@
goBuy(code) {
yohoAPI.goPay({orderid: code});
},
seeExpress() {
location.href = '';
seeExpress(code) {
location.href = '/home/logistic?order_code='+code;
},
/**
* 申请售后
*/
applyRefund(code) {
genderSel.show(function(item) {
console.log(item)
location.href = item.url;
});
}
}
};
... ...
... ... @@ -30,7 +30,7 @@
<div class="options">
<button v-if="order.status === 0" @click="cancelOrder(order.orderCode)">取消订单</button>
<button v-if="order.status === 0 " class="countdown" @click="goBuy(order.orderCode)">去支付 <span v-count-down v-bind:left-time="order.payLefttime" v-bind:callback="autoCancel(order.orderCode)"></span></button>
<button v-if="order.status === 4 || order.status === 5 ">查看物流</button>
<button v-if="order.status === 4 || order.status === 5 " @click="seeExpress(order.orderCode)">查看物流</button>
<button v-if="order.status === 4 || order.status === 5 " class="black" @click="confirmGoods(order.orderCode)">确认收货</button>
<button v-if="order.status === 6" @click="deleteOrder(order,index)">删除订单</button>
<button v-if="order.status === 6" class="normal">再次购买</button>
... ... @@ -39,6 +39,11 @@
</div>
</li>
</ul>
<div class="order-empty {{emptybox}}">
<p>您暂时还没有订单</p>
<p>Your do not have an order <br>for the time being</p>
<a href="">去购物</a>
</div>
</template>
<script>
... ... @@ -58,6 +63,7 @@
type: this.$parent.$data.type,
orderList: [],
busy: false,
emptybox: 'hide'
};
},
... ... @@ -86,7 +92,11 @@
if (result.data.orderList.length > 0) {
this.$set('orderList', _that.orderList.concat(result.data.orderList));
_that.pageTotal = result.data.pageTotal;
} else {
_that.emptybox = '';
}
} else {
_that.emptybox = '';
}
}).fail(() => {
tip('网络错误');
... ... @@ -172,8 +182,8 @@
goBuy(code) {
yohoAPI.goPay({orderid: code});
},
seeExpress() {
location.href = '';
seeExpress(code) {
location.href = '/home/logistic?order_code='+code;
}
}
};
... ...
... ... @@ -31,7 +31,7 @@
<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">取消申请</button>
<button v-if="order.canCancel == 'Y'" class="normal" @click="cancelApply(order.id, order.refundType)">取消申请</button>
</div>
</div>
</div>
... ... @@ -85,12 +85,17 @@
tip('网络错误');
});
},
cancelApply(code) {
/**
* 取消申请
* @param id
* @param type refundType 1为退货,2为换货
*/
cancelApply(id, type) {
$.ajax({
url: '/home/cancel-apply',
url: '/home/'+(type == 2 ? 'exchange' : 'refund')+'/cancel-apply',
type: 'post',
data: {
orderCode: code
id: id
}
}).then(result => {
if (result.code === 200) {
... ...