style(owner-vue): 지난 주문 표기법 변경
- 모든 아이템이 다 나오던 형식에서 외 n건으로 변경
This commit is contained in:
@@ -49,24 +49,11 @@ export default {
|
|||||||
'date-picker': DatePicker
|
'date-picker': DatePicker
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
orderApi.requestPrevOrder(this.startDate, this.endDate, this.page - 1)
|
this.search();
|
||||||
.then( (response) => {
|
|
||||||
this.renderList(response.data);
|
|
||||||
})
|
|
||||||
.catch( (error) => {
|
|
||||||
console.log(error);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
"page": function (newPage) {
|
"page": function () {
|
||||||
orderApi.requestPrevOrder(this.startDate, this.endDate, newPage - 1)
|
this.search();
|
||||||
.then( (response) => {
|
|
||||||
this.renderList(response.data);
|
|
||||||
})
|
|
||||||
.catch( (error) => {
|
|
||||||
console.log(error);
|
|
||||||
console.log(error.response.data);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
@@ -98,7 +85,6 @@ export default {
|
|||||||
orders: [],
|
orders: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
search: function() {
|
search: function() {
|
||||||
if(!this.checkDate()) return;
|
if(!this.checkDate()) return;
|
||||||
@@ -116,16 +102,12 @@ export default {
|
|||||||
|
|
||||||
this.orders = [];
|
this.orders = [];
|
||||||
orders.forEach(order => {
|
orders.forEach(order => {
|
||||||
let orderItemNames = [];
|
|
||||||
order.orderItems.forEach(orderItem => {
|
|
||||||
orderItemNames.push(orderItem.orderItemId);
|
|
||||||
})
|
|
||||||
|
|
||||||
this.orders.push({
|
this.orders.push({
|
||||||
orderId: order.orderId,
|
orderId: order.orderId,
|
||||||
orderStatus: order.orderStatus,
|
orderStatus: this.getOrderStatusName(order.orderStatus),
|
||||||
orderTime: order.orderTime,
|
orderTime: order.orderTime,
|
||||||
orderItemNames: orderItemNames.join(", "),
|
orderItemNames: this.getOrderItemName(order.orderItems),
|
||||||
orderPrice: order.orderPrice,
|
orderPrice: order.orderPrice,
|
||||||
userName: order.userName
|
userName: order.userName
|
||||||
});
|
});
|
||||||
@@ -154,6 +136,21 @@ export default {
|
|||||||
},
|
},
|
||||||
inputEndDate: function(value) {
|
inputEndDate: function(value) {
|
||||||
this.endDate = value;
|
this.endDate = value;
|
||||||
|
},
|
||||||
|
getOrderStatusName: function(orderStatus) {
|
||||||
|
if (orderStatus === "ORDER") return "주문";
|
||||||
|
if (orderStatus === "PLACED") return "주문 수락";
|
||||||
|
if (orderStatus === "REJECT") return "주문 거절";
|
||||||
|
return orderStatus;
|
||||||
|
},
|
||||||
|
getOrderItemName: function(orderItems) {
|
||||||
|
const orderItemLength = orderItems.length;
|
||||||
|
const orderItemName = orderItems[0].orderItemName;
|
||||||
|
if (orderItemLength == 1) {
|
||||||
|
return orderItemName;
|
||||||
|
} else if (orderItemLength > 1) {
|
||||||
|
return orderItemName + " 외 " + (orderItemLength - 1) + "건";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user