<template>
|
<div>
|
<div class="title spaceBetween">
|
<span
|
:class="paymentStatus == 0 ? 'paymentStatus' : 'place'"
|
@click="changeTabs(0)"
|
>全部</span
|
>
|
<span class="splitline"></span>
|
<span
|
:class="paymentStatus == 1 ? 'paymentStatus' : 'place'"
|
@click="changeTabs(1)"
|
>已支付</span
|
>
|
<span class="splitline"></span>
|
<span
|
:class="paymentStatus == 2 ? 'paymentStatus' : 'place'"
|
@click="changeTabs(2)"
|
>待支付</span
|
>
|
</div>
|
|
<div class="content" v-loading="orderListloading">
|
<el-empty
|
v-if="orderList.length == 0"
|
:image-size="200"
|
description="暂无数据"
|
></el-empty>
|
<template v-else>
|
<div class="" v-for="(item, index) in orderList" :key="index">
|
<div class="orderNum">
|
<span>订单编号:{{ item.orderNumber }}</span>
|
<span>创建日期:{{ item.createDate.split("T")[0] }}</span>
|
</div>
|
<div class="bookItem">
|
<div class="wrapImg">
|
<img
|
class="autoImg"
|
:src="
|
getPublicImage(
|
item.saleMethodLinks[0].orderSaleMethod.product.icon
|
)
|
"
|
alt=""
|
/>
|
</div>
|
<div class="information">
|
<div>
|
<span
|
class="name ellipsis"
|
:title="item.saleMethodLinks[0].orderSaleMethod.product.name"
|
>{{
|
item.saleMethodLinks[0].orderSaleMethod.product.name
|
}}</span
|
>
|
<span
|
style="float: right; color: #00873c"
|
v-if="item.state == 'Success'"
|
>已支付</span
|
>
|
<span
|
style="float: right; color: #e50021"
|
v-else-if="item.state == 'WaitPay'"
|
>待支付</span
|
>
|
<span
|
style="float: right; color: #ccc"
|
v-else-if="item.state == 'Cancel'"
|
>已取消</span
|
>
|
</div>
|
<!-- <p class="author">
|
作者:{{ item.author }}
|
</p> -->
|
<p class="payPrice">
|
支付价格:
|
<span
|
>¥ <span>{{ item.payPrice }}</span>
|
</span>
|
</p>
|
<p class="quantity">数量:{{ item.saleMethodLinks[0].count }}</p>
|
<!-- 不需要显示快递消息 10988 -->
|
<!-- <div class="express" v-if="item.state == 'Success'">
|
<p>快递信息:{{ item.expressCompany }}</p>
|
<p>快递单号:{{ item.courierNumber }}</p>
|
<p class="ellipsis" :title="item.receivingInformation">
|
收货信息: {{ item.receivingInformation }}
|
</p>
|
</div> -->
|
<!--
|
2023-04-11 暂时屏蔽
|
<div class="succeeded" v-if="item.state == 'Success'">
|
<el-button
|
size="medium"
|
@click="
|
() => {
|
drawABill = true;
|
}
|
"
|
>开具发票</el-button
|
>
|
</div> -->
|
<div class="unpaid" v-if="item.state == 'WaitPay'">
|
<el-button size="medium" @click="toPay(item.orderNumber)"
|
>立即支付</el-button
|
>
|
<el-button
|
type="danger"
|
plain
|
@click="cancelOrder(item.orderNumber)"
|
>取消订单</el-button
|
>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
</div>
|
|
<!-- 开具发票模态框 -->
|
<el-dialog
|
v-loading="loading"
|
title="提示"
|
:visible="drawABill"
|
width="40%"
|
:before-close="handleClose"
|
>
|
<el-form
|
:model="billData"
|
ref="form"
|
label-position="left"
|
:rules="rules"
|
label-width="130px"
|
>
|
<el-form-item label="发票类型"> 增值税纸质普通发票 </el-form-item>
|
<el-form-item label="抬头类型">
|
<el-radio v-model="billData.type" label="1">个人或事业单位</el-radio>
|
<el-radio v-model="billData.type" label="2">公司</el-radio>
|
</el-form-item>
|
<el-form-item label="发票抬头" prop="name">
|
<el-input
|
v-model="billData.name"
|
placeholder="请填写需要开具发票的姓名"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="发票内容" prop="phone">
|
<el-input v-model="billData.content" placeholder="明细"></el-input>
|
</el-form-item>
|
<el-form-item label="收货地址" prop="phone">
|
<el-radio
|
v-model="billData.type"
|
label="2"
|
v-for="(item, index) in addressList"
|
:key="index"
|
>
|
<div></div>
|
<span>
|
{{ item.city + item.address }}
|
</span>
|
<div>{{ item.name }} {{ item.tel }}</div>
|
</el-radio>
|
</el-form-item>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="dialogVisible = false"
|
>确 定</el-button
|
>
|
</span>
|
</el-form>
|
</el-dialog>
|
<!-- 分页 -->
|
<div class="pageinateBox" v-if="orderList.length > 0">
|
<el-pagination
|
@size-change="
|
(val) => {
|
paginationData.limit = val;
|
getData();
|
}
|
"
|
@current-change="
|
(val) => {
|
paginationData.page = val;
|
getData();
|
}
|
"
|
background=""
|
:current-page="paginationData.page - 0"
|
:page-size="paginationData.limit"
|
prev-text="上一页"
|
next-text="下一页"
|
layout="total, prev, pager, next, slot, jumper"
|
:total="paginationData.totalCount"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</template>
|
<script>
|
import { getPublicImage } from "@/assets/js/middleGround/tool";
|
|
export default {
|
data() {
|
return {
|
orderList: [],
|
paginationData: {
|
page: 1,
|
totalCount: 0,
|
limit: 5,
|
totalPage: 0,
|
},
|
orderListloading: false,
|
paymentStatus: 0,
|
drawABill: false, // 开具发票模态框是否展示
|
billData: {
|
type: 1, // 发票类型,默认为个人
|
name: "", // 开发票的姓名
|
content: "", // 发票内容
|
address: "", // 发票地址
|
}, // 发票信息
|
rules: {
|
name: [
|
{
|
required: true,
|
message: "请填写需要开具发票的姓名",
|
trigger: "blur",
|
},
|
],
|
},
|
addressList: [], // 用户地址
|
loading: false,
|
};
|
},
|
created() {
|
this.getData();
|
this.getAddress();
|
},
|
methods: {
|
getPublicImage,
|
changeTabs(index) {
|
this.paymentStatus = index;
|
this.getData();
|
},
|
getData() {
|
this.orderListloading = true;
|
let { limit, page } = this.paginationData;
|
|
let filterList = [];
|
|
if (this.paymentStatus != 0) {
|
filterList = [
|
{
|
value: this.paymentStatus == 1 ? "Success" : "WaitPay",
|
field: "State",
|
},
|
];
|
}
|
|
let query = {
|
size: limit,
|
start: limit * page - limit,
|
sort: {
|
type: "Desc",
|
field: "CreateDate",
|
},
|
filterList,
|
};
|
this.MG.store.getUserOrderList(query).then((res) => {
|
this.orderListloading = false;
|
this.orderList = res.datas;
|
this.paginationData.totalCount = res.totalSize;
|
});
|
},
|
toPay(orderNumber) {
|
this.$router.push({
|
name: "bookStore-order",
|
query: {
|
orderNum: orderNumber,
|
},
|
});
|
},
|
handleClose(done) {
|
this.$confirm("确定取消开具发票吗?")
|
.then(() => {
|
this.drawABill = false;
|
})
|
.catch((_) => {});
|
},
|
// 获取所有地址
|
getAddress() {
|
this.loading = true;
|
this.MG.identity.getCurrentAppUser().then((res) => {
|
this.loading = false;
|
let storeInfoList = res.infoList.find((i) => i.type == "Address");
|
if (storeInfoList && storeInfoList.data) {
|
this.addressList = JSON.parse(storeInfoList.data);
|
} else {
|
// 用户为第一次添加地址,则当前所选地址为默认地址
|
this.addressItem.ifdefalut = true;
|
}
|
});
|
},
|
// 取消订单
|
cancelOrder(orderNum) {
|
this.$confirm("确定取消支付", "提示", {
|
type: "warning",
|
})
|
.then(() => {
|
let query = {
|
orderNum: orderNum,
|
};
|
this.MG.store.cancelOrder(query).then((res) => {
|
this.$message({
|
type: "success",
|
message: "订单已取消",
|
});
|
this.getData();
|
});
|
})
|
.catch(() => {});
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
.title {
|
font-size: 18px;
|
font-weight: 700;
|
letter-spacing: 1.8px;
|
border-top: 2px solid #008e3f;
|
line-height: 36px;
|
padding-left: 40px;
|
background: #d8f7e6;
|
line-height: 60px;
|
color: #00873c;
|
.splitline {
|
width: 1px;
|
height: 24px;
|
background-color: #008e3f;
|
}
|
}
|
.spaceBetween {
|
padding-left: 0;
|
display: flex;
|
justify-content: space-evenly;
|
align-items: center;
|
span {
|
font-weight: 400;
|
}
|
.paymentStatus {
|
font-weight: 700;
|
}
|
.place {
|
cursor: pointer;
|
}
|
}
|
.content {
|
padding: 40px 40px 0 40px;
|
.orderNum {
|
font-size: 16px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
margin-bottom: 40px;
|
}
|
.bookItem {
|
display: flex;
|
justify-content: space-between;
|
border-bottom: 1px solid #eeeeee;
|
padding-bottom: 40px;
|
margin-bottom: 40px;
|
.wrapImg {
|
border: 1px solid #e6e6e6;
|
background: #ffffff;
|
width: 150px;
|
height: 200px;
|
position: relative;
|
}
|
.information {
|
width: 520px;
|
font-size: 16px;
|
.name {
|
display: inline-block;
|
width: 460px;
|
font-size: 24px;
|
font-weight: 700;
|
line-height: 24px;
|
color: #333333;
|
}
|
.author {
|
font-weight: 400;
|
color: #666666;
|
padding: 14px 0;
|
}
|
.payPrice {
|
color: #333333;
|
padding: 14px 0;
|
span {
|
font-size: 14px;
|
color: #e50021;
|
span {
|
font-size: 24px;
|
}
|
}
|
}
|
.quantity {
|
color: #333333;
|
padding: 5px 0;
|
padding-bottom: 20px;
|
}
|
.express {
|
height: 70px;
|
background: #f2f7f4;
|
border-radius: 4px;
|
padding: 10px;
|
color: #666666;
|
font-size: 14px;
|
line-height: 24px;
|
margin-bottom: 30px;
|
}
|
.succeeded {
|
:deep(.el-button--medium) {
|
padding: 11px 27px;
|
border: 1px solid #00873c;
|
color: #00873c;
|
font-size: 16px;
|
}
|
}
|
// .unpaid {
|
// }
|
.pay {
|
:deep(.el-button--medium) {
|
padding: 11px 27px;
|
border: 1px solid #e50021;
|
color: #e50021;
|
font-size: 16px;
|
}
|
}
|
.cancel {
|
:deep(.el-button--medium) {
|
padding: 11px 27px;
|
// border: 1px solid yellow;
|
color: #fff;
|
font-size: 16px;
|
}
|
}
|
}
|
}
|
}
|
.pageinateBox {
|
text-align: center;
|
padding: 40px 0;
|
:deep(.el-pagination.is-background .btn-next) {
|
padding: 0 10px;
|
}
|
:deep(.el-pagination.is-background .btn-prev) {
|
padding: 0 10px;
|
}
|
}
|
</style>
|