文件
mashangyoujiu/Application/Super/View/Plug/purchaseRecord.html

205 行
6.2 KiB
HTML
可执行文件

此文件含有不可见的 Unicode 字符

此文件含有人类无法区分的不可见的 Unicode 字符,但可以由计算机进行不同的处理。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<!--[1.5.22]-->
<style>
.purchase-top {
width: 100%;
box-sizing: border-box;
background-color: #fff;
}
.top-search-box {
width: 100%;
display: flex;
align-items: center;
font-size: 14px;
color: #333;
margin-bottom: 20px
}
.el-input {
width: 20%;
margin: 0 14px;
}
.el-range-editor.el-input__inner {
margin: 0 14px;
}
.purchase-cont {
width: 100%;
box-sizing: border-box;
/*padding: 12px 20px;*/
background-color: #fff;
margin-top: 20px;
}
.el-table th,
.el-table th tr:first-child {
background-color: #f5f5f5;
}
.el-pagination {
margin-top: 20px;
text-align: -webkit-right;
}
.isred {
color: red;
}
.isgreen {
color: green;
}
.isyellow {
/* color: yellow; */
}
.paytype-img {
width: 8px;
height: 8px;
vertical-align: middle;
}
/* .top-search-box input {
margin: 0 10px;
width: 280px;
height: 30px;
} */
/* .top-search-box>div {
font-size: 14px;
color: #333;
width: 68px;
height: 30px;
line-height: 30px;
} */
[v-cloak] {
display: none;
}
</style>
<div id="purchasebox" v-cloak>
<!-- 搜索 -->
<div class="purchase-top">
<div class="top-search-box">
<div>应用名称</div>
<el-input v-model="appName" size="small" clearable placeholder="请输入应用名称"></el-input>
<el-button type="primary" size="small" @click="search()">查询</el-button>
</div>
<div class="top-search-box">
<span>选择日期</span>
<el-date-picker v-model="search_date" size="small" type="daterange" format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
<el-button type="primary" size="small" @click="search()">查询</el-button>
</div>
</div>
<!-- 表单 -->
<div class="purchase-cont">
<el-table :data="tableData" style="width: 100%;background-color: #f5f5f5;" size="small"
:cell-class-name="cellStyle"
v-loading="loading">
<el-table-column align="center" prop="out_trade_no" label="订单号" min-width="140"></el-table-column>
<el-table-column align="center" prop="create_time" label="购买时间" min-width="140"></el-table-column>
<el-table-column align="center" prop="addon_name" label="应用名称" min-width="120"></el-table-column>
<el-table-column align="center" prop="versions" label="版本" min-width="80"></el-table-column>
<el-table-column align="center" prop="price" label="价格" min-width="80"></el-table-column>
<el-table-column align="center" prop="trade_amount" label="实付金额" min-width="80"></el-table-column>
<el-table-column align="center" prop="status_name" label="交易状态" min-width="80"></el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-size="10" layout="total, prev, pager, next, jumper" :total="count">
</el-pagination>
</div>
</div>
<script>
var purchase = new Vue({
el: "#purchasebox",
data() {
return {
appName: '',
count: 0,//购买记录总条数
search_date: [],//日期数组
tableData: [],
page: 1,
limit: 10,
loading: false,
cellColorList: [],
}
},
mounted() {
this.cellColorList.length = 1;//只渲染一行;
this.getBuyRecords();
// this.getStaffList()
},
methods: {
search(type) {
this.page = 1;
this.getBuyRecords();
},
handleSizeChange(val) {
this.page = 1;
this.getBuyRecords();
},
handleCurrentChange(val) {
this.getBuyRecords();
},
//获取购买记录
getBuyRecords() {
this.loading = true;
$.ajax({
type: "POST",
url: "/index.php/Super/Plug/getOrderList",
async: true,
data: {
start_time: this.data
},
success: (res) => {
if (res.status = 1) {
this.tableData = res.data;
this.count = Number(res.count);
this.loading = false;
}
}
})
},
//修改单元格样式
processColor(row) {
if (row.status_name === "待支付") {
this.cellColorList[0] = 'isred';  // 因为demo里是固定2列渲染颜色,所以直接写死数据的第0个什么颜色就OK了
} else if (row.status_name === "已支付") {
this.cellColorList[0] = 'isyellow';
} else {
this.cellColorList[0] = 'isgreen';
}
},
//修改单元格样式
cellStyle({row, column, rowIndex, columnIndex}) {
if (columnIndex > 5) { // 只有交易状态单元格需要渲染颜色
this.processColor(row);
return this.cellColorList[columnIndex - 6]; // -6是因为交易状态这列的索引是6,6-6=0就代表使用cellColorList的第0个
}
}
}
})
</script>