432 lines
15 KiB
Vue
Raw Normal View History

2025-06-06 13:28:38 +08:00
<template>
<div>
2025-06-10 13:54:50 +08:00
<el-dialog v-model="refundVs" title="退货/退款" width="800" :before-close="handleClose">
<div class="refundVs-title">退货/退款原因</div>
<el-select v-model="optionsValue" placeholder="Select" size="large" style="width: 765px" @change="change">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<div class="refundVs-title" style="margin-top: 15px">退货/退款描述</div>
<el-input v-model="input" type="textarea" size="large" style="width: 765px" placeholder="退货/退款描述" clearable />
<template #footer>
<div class="dialog-footer">
<el-button @click="refundVs = false">取消</el-button>
2025-06-10 18:18:52 +08:00
<el-button type="primary" @click="upRefund"> 确认 </el-button>
2025-06-10 13:54:50 +08:00
</div>
</template>
</el-dialog>
<el-dialog v-model="dialogVisible" title="修改地址" width="800" :before-close="handleClose">
<el-radio-group v-model="radio1" @change="changeAddress">
<el-radio v-for="(item, index) in data" :key="item.id" :value="item.id"
><div style="font-size: 15px">
联系人:{{ item.receiverName }}, 联系人手机号:{{ item.receiverPhone }}, 地址:{{ item.postArea }} {{ item.postAddress }}
</div></el-radio
>
</el-radio-group>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="upAddress()"> 确认 </el-button>
</div>
</template>
</el-dialog>
2025-06-06 13:28:38 +08:00
<common current-name="order">
<template #main>
2025-06-10 13:54:50 +08:00
<div class="user-orders-warp">
<userHeader :title="'订单详情'"></userHeader>
<div class="user-orders-content">
<div class="order-tab">
<div class="order-tab-title">
<el-icon style="cursor: pointer" size="30" @click="back()"><ArrowLeftBold /></el-icon>
<span style="font-weight: bold; color: #25bf82; font-size: 20px">
{{
2025-06-10 18:18:52 +08:00
detailsData.orderStatus == '1'
2025-06-10 13:54:50 +08:00
? '待支付'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '2' || detailsData.orderStatus == '3'
2025-06-10 13:54:50 +08:00
? '待发货'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '4' || detailsData.orderStatus == '5'
2025-06-10 13:54:50 +08:00
? '已发货'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '6'
2025-06-10 13:54:50 +08:00
? '已收货'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '7'
2025-06-10 13:54:50 +08:00
? '已取消'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '8'
2025-06-10 13:54:50 +08:00
? '已完成'
2025-06-10 18:18:52 +08:00
: detailsData.orderStatus == '10'
? '退款中'
: detailsData.orderStatus == '11'
? '已退款'
: ''
2025-06-10 13:54:50 +08:00
}}</span
>
2025-06-10 18:18:52 +08:00
<span v-if="detailsData.orderStatus == '1'" style="font-size: 15px">在71小时59分59秒之前发货</span>
2025-06-06 13:28:38 +08:00
</div>
</div>
2025-06-10 13:54:50 +08:00
<div class="order-list-warp">
<div class="order-list-warp-left">
<div style="display: flex; align-items: center; justify-content: flex-start; margin-top: 20px">
<el-icon size="30"><LocationFilled /></el-icon>
<div class="order-list-warp-left-address">
<div>{{ detailsData.receiverAddress }}</div>
<div>{{ detailsData.receiverName }} {{ detailsData.receiverPhone }}</div>
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 13:54:50 +08:00
</div>
<div class="order-list-warp-left-title">商品信息</div>
<div v-for="(item, index) in detailsData.orderItemInfos" :key="item.id" class="order-list-warp-left-goods">
<div class="order-list-warp-left-goods-list">
<img style="width: 100px; height: 100px" :src="item.productImage" alt="" />
<div class="order-list-warp-left-goods-list-info">
<div class="order-list-warp-left-goods-list-info-title">{{ item.productName }}</div>
<div class="order-list-warp-left-goods-list-info-info">{{ item.unitPrice }}/{{ item.unit }}</div>
2025-06-06 13:28:38 +08:00
</div>
</div>
2025-06-10 13:54:50 +08:00
<div>
<div style="color: #25bf82; font-size: 15px">{{ item.subtotalAmount }}</div>
<div style="font-size: 15px; color: #999999; width: 50px; text-align: right">x{{ item.quantity }}</div>
</div>
2025-06-06 13:28:38 +08:00
</div>
</div>
2025-06-10 13:54:50 +08:00
<div class="order-list-warp-right">
<div style="margin-top: 20px">
<div style="width: 100%; text-align: left; font-size: 18px; font-weight: bold">订单详情</div>
<div class="order-list-warp-right-list">
<div>订单编号</div>
<div style="color: #000000">{{ detailsData.orderNo }}</div>
</div>
<div class="order-list-warp-right-list">
<div>订单备注</div>
<div style="color: #000000">{{ detailsData.orderNote ?? '暂无备注' }}</div>
</div>
<div class="order-list-warp-right-list">
<div>商品总数</div>
<div style="color: #000000">{{ detailsData.totalQuantity }}</div>
</div>
<div class="order-list-warp-right-list">
<div>创建时间</div>
<div style="color: #999999">{{ detailsData.createTime }}</div>
</div>
<div v-if="detailsData.paymentTime" class="order-list-warp-right-list">
<div>付款时间</div>
<div style="color: #999999">{{ detailsData.paymentTime }}</div>
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 18:18:52 +08:00
<div v-if="detailsData.orderStatus == '11'" class="order-list-warp-right-list">
<div>退款时间</div>
<div style="color: #999999">{{ detailsData.refundTime }}</div>
</div>
<div v-if="detailsData.orderStatus == '11'" class="order-list-warp-right-list">
<div>退款金额</div>
<div style="color: red">{{ detailsData.refundAmount }}</div>
</div>
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 13:54:50 +08:00
<div v-if="detailsData.totalAmount" style="margin-top: 30px">
<div style="width: 100%; text-align: left; font-size: 18px; font-weight: bold">付款信息</div>
<div class="order-list-warp-right-list">
<div>商品总价</div>
<div style="color: #000000">{{ detailsData.totalAmount }}</div>
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 13:54:50 +08:00
<div class="order-list-warp-right-list">
<div>运费</div>
<div style="color: #000000">{{ detailsData.totalShipFee }}</div>
</div>
<div class="order-list-warp-right-list">
<div>优惠金额</div>
<div style="color: #999999">{{ detailsData.discountAmount }}</div>
</div>
<div class="order-list-warp-right-list">
<div>实付金额</div>
<div style="color: #999999">{{ detailsData.payableAmount }}</div>
2025-06-06 13:28:38 +08:00
</div>
</div>
</div>
</div>
2025-06-10 18:18:52 +08:00
<div style="display: flex; align-items: center; justify-content: center; width: 100%">
2025-06-10 13:54:50 +08:00
<div v-if="detailsData.orderStatus == '1'" class="button-bottom" @click="doPay(1)">立即付款</div>
<div
v-if="
detailsData.orderStatus == '2' || detailsData.orderStatus == '3' || detailsData.orderStatus == '4' || detailsData.orderStatus == '5'
"
class="button-bottom"
@click="confirmReceipt()"
>
确认收货
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 18:18:52 +08:00
<div v-if="detailsData.orderStatus == '2' || detailsData.orderStatus == '3'" class="button-bottoms" @click="reAddress()">修改地址</div>
2025-06-10 13:54:50 +08:00
<div
v-if="
detailsData.orderStatus == '2' || detailsData.orderStatus == '3' || detailsData.orderStatus == '4' || detailsData.orderStatus == '5'
"
class="button-bottoms"
@click="refund()"
>
退货/退款
2025-06-06 13:28:38 +08:00
</div>
2025-06-10 13:54:50 +08:00
<div v-if="detailsData.orderStatus == '1'" class="button-bottoms" @click="doCancel">取消订单</div>
<!-- <div class="button-bottoms">打印订单</div> -->
</div>
2025-06-06 13:28:38 +08:00
</div>
</div>
</template>
</common>
</div>
</template>
<script setup>
2025-06-10 18:18:52 +08:00
import { userPostAddress, upOrderInfoList, confirmOrder, refundApprove } from '../../apis/user';
2025-06-06 13:28:38 +08:00
import common from './components/common.vue';
import { ref, reactive, computed, onMounted } from 'vue';
import userHeader from './components/userHeader.vue';
import { useRoute, useRouter } from 'vue-router';
2025-06-10 18:18:52 +08:00
import { cancelOrder, updateOrderReceiveAddress, orderInfoGetById } from '../../apis/user';
2025-06-10 13:54:50 +08:00
import { useGetUserOrder } from '../../store/modules/userOrder';
let store = useGetUserOrder();
let dialogVisible = ref(false);
let refundVs = ref(false);
2025-06-06 13:28:38 +08:00
const router = useRouter();
const route = useRoute();
2025-06-10 13:54:50 +08:00
let addressId = ref(0);
let data = ref([]);
let detailsData = ref([]);
let radio1 = ref(0);
let input = ref('');
let page = reactive({
orderStatus: 1,
current: 1,
size: 10,
});
2025-06-10 18:18:52 +08:00
let optionsValue = ref('1');
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const options = [
{
2025-06-10 18:18:52 +08:00
value: '1',
2025-06-10 13:54:50 +08:00
label: '不想要了',
},
{
2025-06-10 18:18:52 +08:00
value: '2',
2025-06-10 13:54:50 +08:00
label: '与卖家协商一致',
},
{
2025-06-10 18:18:52 +08:00
value: '3',
2025-06-10 13:54:50 +08:00
label: '货物损坏',
},
{
2025-06-10 18:18:52 +08:00
value: '4',
2025-06-10 13:54:50 +08:00
label: '实物与宣传不符',
},
];
2025-06-06 13:28:38 +08:00
onMounted(() => {
2025-06-10 13:54:50 +08:00
getDetails();
getUserAddressList();
2025-06-06 13:28:38 +08:00
});
2025-06-10 13:54:50 +08:00
const confirmReceipt = () => {
getDetails();
2025-06-06 13:28:38 +08:00
};
2025-06-10 13:54:50 +08:00
const change = (value) => {
console.log(value);
optionsValue.value = value;
2025-06-06 13:28:38 +08:00
};
2025-06-10 13:54:50 +08:00
const getDetails = () => {
orderInfoGetById({ id: route.query.id }).then((res) => {
detailsData.value = res.data.records[0];
2025-06-06 13:28:38 +08:00
});
};
2025-06-10 13:54:50 +08:00
const changeAddress = (value) => {
addressId.value = value;
2025-06-06 13:28:38 +08:00
};
2025-06-10 13:54:50 +08:00
const doCancel = () => {
cancelOrder({ id: route.query.id }).then((res) => {
store.getData(JSON.parse(route.query.page)).then((res) => {
router.back();
2025-06-06 13:28:38 +08:00
});
});
};
2025-06-10 13:54:50 +08:00
const refund = () => {
refundVs.value = true;
};
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const upRefund = () => {
refundApprove({
2025-06-10 18:18:52 +08:00
orderId: route.query.id,
2025-06-10 13:54:50 +08:00
refundCategory: '1',
2025-06-10 18:18:52 +08:00
refundType: optionsValue.value,
refundReason: input.value,
2025-06-10 13:54:50 +08:00
}).then((res) => {
getDetails();
refundVs.value = false;
});
};
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const upAddress = () => {
updateOrderReceiveAddress({ orderId: route.query.id, addressId: addressId.value }).then((res) => {
getDetails();
dialogVisible.value = false;
});
};
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const reAddress = () => {
dialogVisible.value = true;
};
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const doPay = () => {
router.push({
path: '/sub-operation-service/orderSuccess',
query: { id: route.query.id },
});
};
2025-06-06 13:28:38 +08:00
2025-06-10 13:54:50 +08:00
const getUserAddressList = () => {
userPostAddress({ size: 100, current: 1 }).then((res) => {
console.log(res.data.records);
data.value = res.data.records;
});
};
const back = () => {
router.back();
};
2025-06-06 13:28:38 +08:00
</script>
<style lang="scss" scoped>
2025-06-10 13:54:50 +08:00
.refundVs-title {
font-size: 15px;
color: #999999;
margin-bottom: 10px;
}
.user-orders-warp {
2025-06-06 13:28:38 +08:00
width: 100%;
2025-06-10 13:54:50 +08:00
.user-orders-content {
margin-top: 16px;
2025-06-06 13:28:38 +08:00
padding: 16px;
2025-06-10 13:54:50 +08:00
width: 100%;
height: calc(100vh - 136px);
2025-06-06 13:28:38 +08:00
border-radius: 16px;
background: $color-fff;
2025-06-10 13:54:50 +08:00
.order-list-warp {
display: flex;
2025-06-06 13:28:38 +08:00
justify-content: space-between;
width: 100%;
2025-06-10 13:54:50 +08:00
.order-list-warp-left {
width: 55%;
height: 70vh;
.order-list-warp-left-title {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
text-align: left;
2025-06-06 13:28:38 +08:00
}
2025-06-10 13:54:50 +08:00
.order-list-warp-left-goods {
margin-top: 20px;
display: flex;
justify-content: space-between;
.order-list-warp-left-goods-list {
display: flex;
.order-list-warp-left-goods-list-info {
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
height: 100px;
.order-list-warp-left-goods-list-info-title {
text-align: left;
width: 300px;
font-size: 15px;
}
.order-list-warp-left-goods-list-info-info {
margin-top: 10px;
text-align: left;
width: 300px;
font-size: 12px;
color: #999999;
}
}
}
2025-06-06 13:28:38 +08:00
}
2025-06-10 13:54:50 +08:00
.order-list-warp-left-address {
font-size: 15px;
text-align: start;
margin-left: 15px;
2025-06-06 13:28:38 +08:00
}
}
2025-06-10 13:54:50 +08:00
.order-list-warp-right {
width: 40%;
height: 70vh;
.order-list-warp-right-list {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
div {
font-size: 14px;
color: #999999;
2025-06-06 13:28:38 +08:00
}
}
}
}
}
2025-06-10 13:54:50 +08:00
.order-tab {
2025-06-06 13:28:38 +08:00
width: 100%;
2025-06-10 13:54:50 +08:00
::v-deep() {
.el-tabs__nav-wrap::after {
background: transparent !important;
2025-06-06 13:28:38 +08:00
}
2025-06-10 13:54:50 +08:00
.el-tabs__item {
font-size: 20px !important;
2025-06-06 13:28:38 +08:00
}
2025-06-10 13:54:50 +08:00
.el-tabs__active-bar {
height: 5px !important;
border-radius: 4px;
}
.el-descriptions__label,
.el-descriptions__content {
font-size: 16px !important;
2025-06-06 13:28:38 +08:00
}
2025-06-10 13:54:50 +08:00
.cell-item {
2025-06-06 13:28:38 +08:00
display: inline-flex;
2025-06-10 13:54:50 +08:00
}
.el-descriptions__label {
color: $color-999;
}
.el-descriptions__content {
color: $color-333;
2025-06-06 13:28:38 +08:00
}
}
2025-06-10 13:54:50 +08:00
.order-tab-title {
width: 100%;
display: flex;
align-items: center;
span {
margin-left: 10px;
2025-06-06 13:28:38 +08:00
}
}
}
}
2025-06-10 13:54:50 +08:00
.button-bottom {
cursor: pointer;
width: 100px;
border-radius: 10px;
height: 40px;
color: #fff;
line-height: 40px;
font-size: 15px;
font-weight: bold;
background-color: #25bf82;
}
.button-bottoms {
cursor: pointer;
margin-left: 20px;
width: 100px;
border-radius: 10px;
height: 40px;
color: #000000;
line-height: 40px;
font-size: 15px;
background-color: #ffffff;
border: 1px solid #707070;
}
2025-06-06 13:28:38 +08:00
</style>