Authored by ccbikai

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

/*
* 换货 controller
*/
'use strict';
const exchange = {
exchange(req, res) {
res.render('exchange');
}
};
module.exports = exchange;
... ...
... ... @@ -45,7 +45,7 @@ exports.getFavProductData = (uid, page, limit) => {
title: d.product_name,
price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
discountPrice: discountPrice,
sellOut: d.storage < 0,
sellOut: d.storage <= 0,
invalidGoods: d.status === 0
});
});
... ...
... ... @@ -12,6 +12,7 @@ const home = require(cRoot);
const favorite = require(cRoot + '/favorite');
const refund = require(cRoot + '/refund');
const order = require(cRoot + '/order');
const exchange = require(cRoot + '/exchange');
const router = expressRouter();
... ... @@ -44,6 +45,9 @@ router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回
router.get('/refund/companylist', refund.companylist); // 退换货 - 物流公司列表信息
router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息
// 换货
router.get('/exchange', exchange.exchange);
router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们
... ...
{{! HOME-换货}}
<div class="exchange">
<exchange></exchange>
</div>
\ No newline at end of file
... ...
... ... @@ -43,6 +43,7 @@
border-bottom: 0 none;
}
}
.coin-source {
flex: 1;
... ...
... ... @@ -167,7 +167,7 @@
width: 35px;
height: 35px;
margin-right: 15px;
margin-top: 35px;
margin-top: 50px;
background: resolve("home/fav/fav-del.png");
background-size: 100%;
}
... ...
... ... @@ -54,39 +54,34 @@
const $ = require('yoho-jquery');
const tip = require('common/tip');
const modal = require('common/modal');
const overlay = require('common/overlay');
const Modal = require('common/modal');
module.exports = {
data() {
return {
order:{}
order: {}
};
},
ready(){
ready() {
this.getOrderData();
},
methods:{
getOrderData(){
// let _that = this;
methods: {
getOrderData() {
$.ajax({
url: '/home/get-order',
data: {
orderCode: this.$parent.$data.orderCode
}
}).then(result => {
if(result){
if (result) {
this.$set('order', result.data);
//_that.orderList = result.data.orderList;
} else {
}
}).fail(() => {
tip('网络错误');
});
},
cancelOrder(code){
$.modal.confirm('', '订单取消后不能恢复,确认取消订单吗?', function() {
cancelOrder(code) {
Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() {
$.ajax({
url: '/home/cancel-order',
type: 'post',
... ... @@ -94,18 +89,18 @@
orderCode: code
}
}).then(result => {
if(result.code === 200 ){
if (result.code === 200) {
location.href = '/home/orders';
} else {
tip(result.message);
}
}).fail(() => {
tip('操作失敗');
tip('操作失敗');
});
});
},
deleteOrder(code){
$.modal.confirm('', '确认删除订单?', function() {
deleteOrder(code) {
Modal.confirm('确认删除订单?', '', function() {
$.ajax({
url: '/home/delete-order',
type: 'post',
... ... @@ -113,17 +108,17 @@
orderCode: code
}
}).then(result => {
if(result.code === 200 ){
if (result.code === 200) {
location.href = '/home/orders';
} else {
tip(result.message);
}
}).fail(() => {
tip('操作失敗');
tip('操作失敗');
});
});
},
confirmGoods(code){
confirmGoods(code) {
$.ajax({
url: '/home/confirm-order',
type: 'post',
... ... @@ -131,20 +126,20 @@
orderCode: code
}
}).then(result => {
if(result.code === 200 ){
if (result.code === 200) {
location.reload();
} else {
tip(result.message);
}
}).fail(() => {
tip('操作失敗');
tip('操作失敗');
});
},
goBuy(){
goBuy() {
location.href = '';
},
see(){
seeExpress() {
location.href = '';
}
}
};
... ...
... ... @@ -46,8 +46,7 @@
const $ = require('yoho-jquery');
const tip = require('common/tip');
const modal = require('common/modal');
const overlay = require('common/overlay');
const Modal = require('common/modal');
module.exports = {
data() {
... ... @@ -59,40 +58,40 @@
busy: false,
};
},
ready(){
ready() {
this.getOrderData();
},
methods:{
getOrderData(){
methods: {
getOrderData() {
let _that = this;
this.busy = true;
$.ajax({
url: '/home/get-orders',
data: {
page : ++ this.page,
limit : this.limit,
page: ++this.page,
limit: this.limit,
type: this.type
}
}).then(result => {
if(result.code === 200){
if (result.code === 200) {
if (result.isend) {
_that.busy = true;
} else {
_that.busy = false;
}
if(result.data.orderList.length > 0){
if (result.data.orderList.length > 0) {
this.$set('orderList', result.data.orderList);
//_that.orderList = result.data.orderList;
} else {
}
}
}).fail(() => {
tip('网络错误');
});
},
cancelOrder(code){
$.modal.confirm('', '订单取消后不能恢复,确认取消订单吗?', function() {
cancelOrder(code) {
Modal.confirm('订单取消后不能恢复,确认取消订单吗?', '', function() {
$.ajax({
url: '/home/cancel-order',
type: 'post',
... ... @@ -100,7 +99,7 @@
orderCode: code
}
}).then(result => {
if(result.code === 200 ){
if (result.code === 200) {
location.reload();
} else {
tip(result.message);
... ... @@ -110,9 +109,10 @@
});
});
},
deleteOrder(order, index){
var that = this;
$.modal.confirm('', '确认删除订单?', function() {
deleteOrder(order, index) {
let that = this;
Modal.confirm('确认删除订单?', '', function() {
$.ajax({
url: '/home/delete-order',
type: 'post',
... ... @@ -120,9 +120,8 @@
orderCode: order.orderCode
}
}).then(result => {
if(result.code === 200 ){
//location.reload();
that.$el.querySelectorAll('.order-item')[index].remove()
if (result.code === 200) {
that.$el.querySelectorAll('.order-item')[index].remove();
} else {
tip(result.message);
}
... ... @@ -131,7 +130,7 @@
});
});
},
confirmGoods(code){
confirmGoods(code) {
$.ajax({
url: '/home/confirm-order',
type: 'post',
... ... @@ -139,20 +138,20 @@
orderCode: code
}
}).then(result => {
if(result.code === 200 ){
if (result.code === 200) {
location.reload();
} else {
tip(result.message);
}
}).fail(() => {
tip('操作失敗');
tip('操作失敗');
});
},
goBuy(){
goBuy() {
location.href = '';
},
see(){
seeExpress() {
location.href = '';
}
}
};
... ... @@ -160,15 +159,20 @@
</script>
<style>
html,body{height:100%;}
html,
body {
height: 100%;
}
@import "../../scss/home/_order.css";
.order-wrapper {
height: 100%;
ul {
height: 100%;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
}
@import "../../scss/home/_order.css";
</style>
\ No newline at end of file
... ...