Ver Fonte

时间选择

shish há 2 semanas atrás
pai
commit
7f69ec6a51
1 ficheiros alterados com 38 adições e 11 exclusões
  1. 38 11
      ghs/src/views/order/list.vue

+ 38 - 11
ghs/src/views/order/list.vue

@@ -163,7 +163,10 @@
 				<el-select size="mini" v-model="currentKdStaffName" placeholder="开单人" style="width:110px;margin-left:8px;" @change="getKdStaff" :clearable="true">
 					<el-option v-for="item in staffList" :key="item.id" :label="item.name" :value="item.id"></el-option>
 				</el-select>
-        <span style="margin-left:9px;font-size:16px;">账单时间:</span>
+        <el-button-group style="margin-left:9px;margin-right:4px;">
+          <el-button size="mini" :type="searchTimeType === 0 ? 'primary' : 'default'" @click="changeSearchTimeType(0)">创建时间</el-button>
+          <el-button size="mini" :type="searchTimeType === 1 ? 'primary' : 'default'" @click="changeSearchTimeType(1)">账单时间</el-button>
+        </el-button-group>
         <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
           class="custom-date-picker" end-placeholder="结束日期" :picker-options="pickerOptions" size="mini" style="margin-right:8px;">
         </el-date-picker>
@@ -363,6 +366,8 @@ export default {
       startTime:'',
       endTime:'',
       searchTime:'',
+      /** 时间筛选类型:0 创建时间,1 账单时间 */
+      searchTimeType: 0,
       name:'',
       currentRefundData:{},
       refundRecordData:{},
@@ -401,6 +406,28 @@ export default {
 
 	},
   methods: {
+    /** 组装订单列表查询参数 */
+    getListSearchParams(extra = {}) {
+      return Object.assign({
+        status: this.tabIndex,
+        book: this.book,
+        clearSign: this.clearSign,
+        searchTime: this.searchTime,
+        startTime: this.startTime,
+        endTime: this.endTime,
+        name: this.name,
+        shopAdminId: this.currentKdStaffId,
+        searchTimeType: this.searchTimeType
+      }, extra)
+    },
+    /** 切换按创建时间/账单时间筛选 */
+    changeSearchTimeType(type) {
+      if (this.searchTimeType === type) {
+        return
+      }
+      this.searchTimeType = type
+      this.app.refresh(this.getListSearchParams())
+    },
     searchFocus(){
       let that = this
       setTimeout(() => {
@@ -517,7 +544,7 @@ export default {
         clearTimeout(this.T)
       }
       this.T = setTimeout(function(){
-        that.app.refresh({ status: that.tabIndex,book:that.book,clearSign:that.clearSign,searchTime:that.searchTime,startTime:that.startTime,endTime:that.endTime,name:that.name,shopAdminId:this.currentKdStaffId })
+        that.app.refresh(that.getListSearchParams())
       },650)			
 		},
     confirmReach(info){
@@ -559,11 +586,11 @@ export default {
     },
     changeClearSign(e){
       this.clearSign = e
-      this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,name:this.name,shopAdminId:this.currentKdStaffId });
+      this.app.refresh(this.getListSearchParams());
     },
     changeBook(e){
       this.book = e
-      this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,name:this.name,shopAdminId:this.currentKdStaffId });
+      this.app.refresh(this.getListSearchParams());
     },
     getSearchDate(){
       if (this.$util.isEmpty(this.currentDateList)) {
@@ -575,10 +602,10 @@ export default {
         this.startTime = this.currentDateList[0]
         this.endTime = this.currentDateList[1]
       }
-      this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,name:this.name,shopAdminId:this.currentKdStaffId})
+      this.app.refresh(this.getListSearchParams())
     },
     refreshData(){
-      this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,name:this.name,shopAdminId:this.currentKdStaffId})
+      this.app.refresh(this.getListSearchParams())
     },
     todays(type) {
       var myDate = new Date();
@@ -636,7 +663,7 @@ export default {
           hiprintTemplate.print(printData)
           //增加打印次数
           this.$service.order.addPrintNum({id:info.id}).then(data => {
-            this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,name:this.name })
+            this.app.refresh(this.getListSearchParams())
           })
 			  })
     },
@@ -658,7 +685,7 @@ export default {
         hiprintTemplate.print(printData)
         //增加打印次数
         this.$service.order.addPrintNum({id:info.id}).then(data => {
-          this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,name:this.name })
+          this.app.refresh(this.getListSearchParams())
         })
 			});
     },
@@ -765,10 +792,10 @@ export default {
       })
     },
     handleClick(tab, e) {
-      this.app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,name:this.name });
+      this.app.refresh(this.getListSearchParams());
     },
 		exportData(){
-			this.$service.order.getOrderList({status: this.tabIndex,book:this.book,clearSign:this.clearSign,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,pageSize:9999999,export:1,name:this.name,shopAdminId:this.currentKdStaffId}).then(res => {
+			this.$service.order.getOrderList(this.getListSearchParams({ pageSize: 9999999, export: 1 })).then(res => {
 				if(res.file){
 					window.location.href = res.file
 				}
@@ -965,7 +992,7 @@ export default {
             this.totalActPrice = ret.totalActPrice ? ret.totalActPrice : 0
           })
           .done();
-          app.refresh({ status: this.tabIndex,book:this.book,clearSign:this.clearSign,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,name:this.name,shopAdminId:this.currentKdStaffId })
+          app.refresh(this.getListSearchParams())
     },
     onSongSuccess() {