作者 何书鹏

售后时间筛选

... ... @@ -347,14 +347,15 @@ class Aftersale extends Backend
private function buildSearchOrder() {
$search = $this->request->get("search", ''); // 关键字
$status = $this->request->get("status", 'all');
$createtime = $this->request->get("createtime/a");
$orders = $this->orderModel->withTrashed();
$orders = $orders->whereExists(function ($query) use ($search, $status) {
$orders = $orders->whereExists(function ($query) use ($search, $status, $createtime) {
extract($this->getModelTable());
$aftersales = $query->table($aftersaleName)->where($aftersaleName . '.order_id=' . $orderName . '.id');
$aftersales = $this->aftersaleSearch($aftersales, $search, $status);
$aftersales = $this->aftersaleSearch($aftersales, $search, $status, $createtime);
return $aftersales;
});
... ... @@ -363,7 +364,7 @@ class Aftersale extends Backend
}
private function aftersaleSearch($aftersales, $search, $status) {
private function aftersaleSearch($aftersales, $search, $status, $createtime) {
extract($this->getModelTable());
if ($search) {
... ... @@ -396,6 +397,19 @@ class Aftersale extends Backend
}
}
// 申请时间
if ($createtime) {
$sym = 'BETWEEN';
if ($createtime[0] === '') {
$sym = '<=';
$createtime = $createtime[1];
} elseif ($createtime[1] === '') {
$sym = '>=';
$createtime = $createtime[0];
}
$aftersales = $aftersales->where('createtime',$sym . ' TIME',$createtime);
}
// 经销商
$dealer = [];
$group_id_arr = array_column($this->auth->getGroups(), 'group_id');
... ...
... ... @@ -235,6 +235,30 @@
border-left: none;
}
.order-time {
margin-left : 15px;
padding: 0 6px;
line-height: 32px;
height: 32px;
border: 1px solid #DCDFE6;
border-radius: 4px 0px 0px 4px;
border-right: none;
}
.el-date-editor .el-range-separator {
line-height: 24px;
width: 10%;
}
.common-btn {
width: 80px;
line-height: 28px;
height: 30px;
border: 1px solid #DCDFE6;
border-radius: 4px;
color: #666;
text-align: center;
cursor: pointer;
}
[v-cloak] {
display: none
}
... ... @@ -265,6 +289,14 @@
<el-radio-button label="cancel">已取消</el-radio-button>
<el-radio-button label="refuse">已拒绝</el-radio-button>
</el-radio-group>
<div class="display-flex margin-right-20">
<div class="color-666 order-time">申请时间</div>
<el-date-picker v-model="createtime" type="daterange" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" @change="reqOrderList(0,10)">
</el-date-picker>
</div>
<!-- <div class="common-btn cursor-pointer" @click="goExport">导出</div>-->
</div>
<div class="custom-table-container">
<el-table :data="pageData" style="width: 100%" default-expand-all="true" border :span-method="arraySpanMethod">
... ...
... ... @@ -17,8 +17,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
el: "#aftersaleIndex",
data() {
return {
screenType: false,
statusType: 'all',
searchKey: '',
createtime: [],
pageData: [],
//分页
... ... @@ -30,9 +32,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
},
mounted() {
if(new URLSearchParams(location.search).get('datetimerange')){
this.createtime=new URLSearchParams(location.search).get('datetimerange').split(' - ')
}
this.getData();
},
methods: {
//筛选
changeSwitch() {
this.screenType=!this.screenType;
},
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex >= 0) {
if (columnIndex === 0) {
... ... @@ -55,6 +64,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
offset: that.offset,
limit: that.limit,
status: that.statusType,
createtime: that.createtime,
}
}, function (ret, res) {
that.pageData = res.data.rows;
... ... @@ -62,6 +72,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return false;
})
},
//导出
goExport() {
var that = this;
// if(offset==0 && limit==10){
// that.offset=offset;
// that.limit=limit;
// }
window.location.href = "aftersale/export?offset=" + that.offset + "&limit=" + that.limit + "&search=" + that.searchKey + "&status=" + that.statusType + "&createtime=" + that.createtime;
},
//请求
reqOrderList(offset,limit) {
var that = this;
if(offset==0 && limit==10){
that.offset=offset;
that.limit=limit;
}
that.getData()
},
//分页(更换页面显示条数)
pageSizeChange(val) {
this.offset = 0
... ...