作者 何书鹏

售后时间筛选

@@ -347,14 +347,15 @@ class Aftersale extends Backend @@ -347,14 +347,15 @@ class Aftersale extends Backend
347 private function buildSearchOrder() { 347 private function buildSearchOrder() {
348 $search = $this->request->get("search", ''); // 关键字 348 $search = $this->request->get("search", ''); // 关键字
349 $status = $this->request->get("status", 'all'); 349 $status = $this->request->get("status", 'all');
  350 + $createtime = $this->request->get("createtime/a");
350 351
351 $orders = $this->orderModel->withTrashed(); 352 $orders = $this->orderModel->withTrashed();
352 353
353 - $orders = $orders->whereExists(function ($query) use ($search, $status) { 354 + $orders = $orders->whereExists(function ($query) use ($search, $status, $createtime) {
354 extract($this->getModelTable()); 355 extract($this->getModelTable());
355 $aftersales = $query->table($aftersaleName)->where($aftersaleName . '.order_id=' . $orderName . '.id'); 356 $aftersales = $query->table($aftersaleName)->where($aftersaleName . '.order_id=' . $orderName . '.id');
356 357
357 - $aftersales = $this->aftersaleSearch($aftersales, $search, $status); 358 + $aftersales = $this->aftersaleSearch($aftersales, $search, $status, $createtime);
358 359
359 return $aftersales; 360 return $aftersales;
360 }); 361 });
@@ -363,7 +364,7 @@ class Aftersale extends Backend @@ -363,7 +364,7 @@ class Aftersale extends Backend
363 } 364 }
364 365
365 366
366 - private function aftersaleSearch($aftersales, $search, $status) { 367 + private function aftersaleSearch($aftersales, $search, $status, $createtime) {
367 extract($this->getModelTable()); 368 extract($this->getModelTable());
368 369
369 if ($search) { 370 if ($search) {
@@ -396,6 +397,19 @@ class Aftersale extends Backend @@ -396,6 +397,19 @@ class Aftersale extends Backend
396 } 397 }
397 } 398 }
398 399
  400 + // 申请时间
  401 + if ($createtime) {
  402 + $sym = 'BETWEEN';
  403 + if ($createtime[0] === '') {
  404 + $sym = '<=';
  405 + $createtime = $createtime[1];
  406 + } elseif ($createtime[1] === '') {
  407 + $sym = '>=';
  408 + $createtime = $createtime[0];
  409 + }
  410 + $aftersales = $aftersales->where('createtime',$sym . ' TIME',$createtime);
  411 + }
  412 +
399 // 经销商 413 // 经销商
400 $dealer = []; 414 $dealer = [];
401 $group_id_arr = array_column($this->auth->getGroups(), 'group_id'); 415 $group_id_arr = array_column($this->auth->getGroups(), 'group_id');
@@ -235,6 +235,30 @@ @@ -235,6 +235,30 @@
235 border-left: none; 235 border-left: none;
236 } 236 }
237 237
  238 + .order-time {
  239 + margin-left : 15px;
  240 + padding: 0 6px;
  241 + line-height: 32px;
  242 + height: 32px;
  243 + border: 1px solid #DCDFE6;
  244 + border-radius: 4px 0px 0px 4px;
  245 + border-right: none;
  246 + }
  247 + .el-date-editor .el-range-separator {
  248 + line-height: 24px;
  249 + width: 10%;
  250 + }
  251 + .common-btn {
  252 + width: 80px;
  253 + line-height: 28px;
  254 + height: 30px;
  255 + border: 1px solid #DCDFE6;
  256 + border-radius: 4px;
  257 + color: #666;
  258 + text-align: center;
  259 + cursor: pointer;
  260 + }
  261 +
238 [v-cloak] { 262 [v-cloak] {
239 display: none 263 display: none
240 } 264 }
@@ -265,6 +289,14 @@ @@ -265,6 +289,14 @@
265 <el-radio-button label="cancel">已取消</el-radio-button> 289 <el-radio-button label="cancel">已取消</el-radio-button>
266 <el-radio-button label="refuse">已拒绝</el-radio-button> 290 <el-radio-button label="refuse">已拒绝</el-radio-button>
267 </el-radio-group> 291 </el-radio-group>
  292 + <div class="display-flex margin-right-20">
  293 + <div class="color-666 order-time">申请时间</div>
  294 + <el-date-picker v-model="createtime" type="daterange" value-format="yyyy-MM-dd HH:mm:ss"
  295 + format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期"
  296 + end-placeholder="结束日期" @change="reqOrderList(0,10)">
  297 + </el-date-picker>
  298 + </div>
  299 +<!-- <div class="common-btn cursor-pointer" @click="goExport">导出</div>-->
268 </div> 300 </div>
269 <div class="custom-table-container"> 301 <div class="custom-table-container">
270 <el-table :data="pageData" style="width: 100%" default-expand-all="true" border :span-method="arraySpanMethod"> 302 <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 @@ -17,8 +17,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
17 el: "#aftersaleIndex", 17 el: "#aftersaleIndex",
18 data() { 18 data() {
19 return { 19 return {
  20 + screenType: false,
20 statusType: 'all', 21 statusType: 'all',
21 searchKey: '', 22 searchKey: '',
  23 + createtime: [],
22 24
23 pageData: [], 25 pageData: [],
24 //分页 26 //分页
@@ -30,9 +32,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -30,9 +32,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
30 } 32 }
31 }, 33 },
32 mounted() { 34 mounted() {
  35 + if(new URLSearchParams(location.search).get('datetimerange')){
  36 + this.createtime=new URLSearchParams(location.search).get('datetimerange').split(' - ')
  37 + }
33 this.getData(); 38 this.getData();
34 }, 39 },
35 methods: { 40 methods: {
  41 + //筛选
  42 + changeSwitch() {
  43 + this.screenType=!this.screenType;
  44 + },
36 arraySpanMethod({ row, column, rowIndex, columnIndex }) { 45 arraySpanMethod({ row, column, rowIndex, columnIndex }) {
37 if (rowIndex >= 0) { 46 if (rowIndex >= 0) {
38 if (columnIndex === 0) { 47 if (columnIndex === 0) {
@@ -55,6 +64,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -55,6 +64,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
55 offset: that.offset, 64 offset: that.offset,
56 limit: that.limit, 65 limit: that.limit,
57 status: that.statusType, 66 status: that.statusType,
  67 + createtime: that.createtime,
58 } 68 }
59 }, function (ret, res) { 69 }, function (ret, res) {
60 that.pageData = res.data.rows; 70 that.pageData = res.data.rows;
@@ -62,6 +72,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -62,6 +72,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
62 return false; 72 return false;
63 }) 73 })
64 }, 74 },
  75 + //导出
  76 + goExport() {
  77 + var that = this;
  78 + // if(offset==0 && limit==10){
  79 + // that.offset=offset;
  80 + // that.limit=limit;
  81 + // }
  82 + window.location.href = "aftersale/export?offset=" + that.offset + "&limit=" + that.limit + "&search=" + that.searchKey + "&status=" + that.statusType + "&createtime=" + that.createtime;
  83 + },
  84 + //请求
  85 + reqOrderList(offset,limit) {
  86 + var that = this;
  87 + if(offset==0 && limit==10){
  88 + that.offset=offset;
  89 + that.limit=limit;
  90 + }
  91 + that.getData()
  92 + },
65 //分页(更换页面显示条数) 93 //分页(更换页面显示条数)
66 pageSizeChange(val) { 94 pageSizeChange(val) {
67 this.offset = 0 95 this.offset = 0