Browse Source

合计接口对接

zhangdan 4 years ago
parent
commit
d9feaa591f
3 changed files with 114 additions and 72 deletions
  1. 10 0
      src/api/order.js
  2. 102 67
      src/views/Order/OrderCenter.vue
  3. 2 5
      src/views/Order/OrderDetailModal.vue

+ 10 - 0
src/api/order.js

@@ -45,3 +45,13 @@ export const orderDetail = params => {
     method: 'get'
     method: 'get'
   })
   })
 }
 }
+
+// 合计
+export const orderTotal = params => {
+  const url = 'order/getSum'
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 102 - 67
src/views/Order/OrderCenter.vue

@@ -5,7 +5,7 @@
       <a-form ref="searchForm">
       <a-form ref="searchForm">
         <a-row :gutter="48">
         <a-row :gutter="48">
           <a-col :span="8">
           <a-col :span="8">
-            <a-form-item label="创建时间" :label-col="{ span:4 }" :wrapper-col="{ span:12}">
+            <a-form-item label="下单时间" :label-col="{ span:4 }" :wrapper-col="{ span:12}">
               <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
               <a-range-picker v-model="time" :format="dateFormat" :placeholder="['开始时间','结束时间']" @change="onChange" />
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
@@ -18,12 +18,12 @@
           </a-col>
           </a-col>
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="单号" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
             <a-form-item label="单号" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <a-input v-model.trim="searchForm.orderNo" placeholder="请输入" allowClear/>
+              <a-input v-model.trim="searchForm.orderNo" placeholder="请输入" allowClear />
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="4">
           <a-col :span="4">
-            <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-            <a-button type="" @click="resetForm">重置</a-button>
+            <a-button style="margin-right: 10px;" type="primary" @click="handleSearch">查询</a-button>
+            <a-button type="" @click="handleRest">重置</a-button>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
         <a-row :gutter="48">
         <a-row :gutter="48">
@@ -41,19 +41,21 @@
           </a-col>
           </a-col>
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="状态" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
             <a-form-item label="状态" :label-col="{ span:6 }" :wrapper-col="{ span:12}">
-              <v-select v-model="searchForm.orderStatus" ref="orderStatus" code="ORDER_STATUS" placeholder="请选择" allowClear></v-select>
+              <v-select v-model="searchForm.orderStatus" ref="orderStatus" code="ORDER_STATUS" placeholder="请选择"
+                allowClear></v-select>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
       </a-form>
       </a-form>
     </div>
     </div>
     <!-- 合计 -->
     <!-- 合计 -->
-    <div class="total" >
-      <a-icon type="info-circle" class="iconImg"/>
-      <strong>合计:</strong><span v-model="countHJ">{{countHJ}} 单</span><strong style="margin-left: 15px;">实收:</strong><span v-model="incomeHJ">{{incomeHJ}} 元</span>
+    <div class="total">
+      <a-icon type="info-circle" class="iconImg" />
+      <strong>合计:</strong><span v-model="orderTotal">{{orderTotal || 0}} 单</span><strong style="margin-left: 15px;">实收:</strong><span
+        v-model="paymentAmountTotal">{{paymentAmountTotal || 0}} 元</span>
     </div>
     </div>
     <!-- 列表 -->
     <!-- 列表 -->
-    <s-table ref="table" size="default" :showPagination="false" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
+    <s-table ref="table" size="default" :rowKey="(record) => record.id" :columns="columns" :data="loadData" bordered>
       <!-- 状态 -->
       <!-- 状态 -->
       <span slot="orderStatus" slot-scope="text, record">
       <span slot="orderStatus" slot-scope="text, record">
         {{ $refs.orderStatus.getNameByCode(text) }}
         {{ $refs.orderStatus.getNameByCode(text) }}
@@ -72,21 +74,26 @@
       </span>
       </span>
     </s-table>
     </s-table>
     <!-- 查看详情弹窗 -->
     <!-- 查看详情弹窗 -->
-    <order-detail-modal 
-      :openModal="openDetailModal"
-      :nowId="detailId"
-      @close="openDetailModal=false"/> 
+    <order-detail-modal :openModal="openDetailModal" :nowId="detailId" @close="openDetailModal=false" />
   </a-card>
   </a-card>
 </template>
 </template>
 
 
 <script>
 <script>
-  import { STable, VSelect } from '@/components'
+  import {
+    STable,
+    VSelect
+  } from '@/components'
   import getDate from '../../libs/getDate.js'
   import getDate from '../../libs/getDate.js'
-  import { orderCenterList, itemList, storeList } from '../../api/order.js'
+  import {
+    orderCenterList,
+    itemList,
+    storeList,
+    orderTotal
+  } from '../../api/order.js'
   import OrderDetailModal from './OrderDetailModal.vue'
   import OrderDetailModal from './OrderDetailModal.vue'
   import moment from 'moment'
   import moment from 'moment'
   export default {
   export default {
-    name:'OrderCenter',
+    name: 'OrderCenter',
     components: {
     components: {
       STable,
       STable,
       VSelect,
       VSelect,
@@ -94,28 +101,29 @@
     },
     },
     data() {
     data() {
       return {
       return {
-        storeId: [],        // 网点名称
+        storeId: [], // 网点名称
         // 查询参数
         // 查询参数
         searchForm: {
         searchForm: {
-          beginDate: null,    // 创建的开始时间
-          endDate: null,      // 创建的结束时间
-          storeIdList: [],        // 网点名称
-          orderNo: '',        // 单号
-          itemId:'',          // 服务项目
-          customerMobile:'',  // 手机号码
-          orderStatus:''      // 状态
+          beginDate: null, // 创建的开始时间
+          endDate: null, // 创建的结束时间
+          storeIdList: [], // 网点名称
+          orderNo: '', // 单号
+          itemId: '', // 服务项目
+          customerMobile: '', // 手机号码
+          orderStatus: '' // 状态
         },
         },
-        pageNo:1,             // 列表当前页
-        pageSize:10,          // 列表当前页码
-        countHJ:'40',
-        incomeHJ:'2000',
-        itemOptionData:[],    // 服务项目数据
-        storeOptionData:[],   // 网点名称数据
-        openDetailModal:false,   // 查看详情弹窗 默认关闭
-        detailId:null,          // 初始化id
+        pageNo: 1, // 列表当前页
+        pageSize: 10, // 列表当前页码
+        orderTotal: '', // 合计开单数量
+        paymentAmountTotal: '', // 合计实收金额
+        itemOptionData: [], // 服务项目数据
+        storeOptionData: [], // 网点名称数据
+        openDetailModal: false, // 查看详情弹窗 默认关闭
+        detailId: null, // 初始化id
+        // 将默认当天时间日期回显在时间选择框中
         time: [
         time: [
           moment(getDate.getToday().starttime, this.dateFormat),
           moment(getDate.getToday().starttime, this.dateFormat),
-					moment(getDate.getToday().endtime, this.dateFormat)
+          moment(getDate.getToday().endtime, this.dateFormat)
         ],
         ],
         dateFormat: 'YYYY-MM-DD',
         dateFormat: 'YYYY-MM-DD',
         columns: [{
         columns: [{
@@ -195,23 +203,18 @@
           // console.log(this.searchForm.storeId)
           // console.log(this.searchForm.storeId)
           this.searchForm.beginDate == null ? this.searchForm.beginDate = getDate.getToday().starttime : null
           this.searchForm.beginDate == null ? this.searchForm.beginDate = getDate.getToday().starttime : null
           this.searchForm.endDate == null ? this.searchForm.endDate = getDate.getToday().endtime : null
           this.searchForm.endDate == null ? this.searchForm.endDate = getDate.getToday().endtime : null
-          this.searchForm.storeIdList = this.storeId 
-          // console.log(this.searchForm.storeId)
+          this.searchForm.storeIdList = this.storeId
           return orderCenterList(Object.assign(parameter, this.searchForm)).then(res => {
           return orderCenterList(Object.assign(parameter, this.searchForm)).then(res => {
-            console.log(res,'0000000000000000000')
+            // console.log(res,'0000000000000000000')
             if (res.status == 200) {
             if (res.status == 200) {
-              // const no = (res.data.pageNo - 1) * res.data.pageSize
-              // for (let i = 0; i < res.data.list.length; i++) {
-              //   const _item = res.data.list[i]
-              //   _item.no = no + i + 1
-              //   _item.status = _item.status + '' === '1'
-              // }
-              return res.data.list
+              return res.data
+              _this.getTotal()
             }
             }
           })
           })
         }
         }
       }
       }
     },
     },
+
     methods: {
     methods: {
       moment,
       moment,
       // 创建时间change
       // 创建时间change
@@ -223,32 +226,56 @@
         console.log(this.searchForm.beginDate, this.searchForm.endDate)
         console.log(this.searchForm.beginDate, this.searchForm.endDate)
       },
       },
       // 获取服务项目数据
       // 获取服务项目数据
-      getItemListData(){
-        itemList({pageNo:this.pageNo,pageSize:this.pageSize}).then(res=>{
-          console.log(res,'-----------')
-          if(res.status == 200){
+      getItemListData() {
+        itemList({
+          pageNo: this.pageNo,
+          pageSize: this.pageSize
+        }).then(res => {
+          console.log(res, '-----------')
+          if (res.status == 200) {
             this.itemOptionData = res.data.list
             this.itemOptionData = res.data.list
           }
           }
         })
         })
       },
       },
       // 获取网点名称数据
       // 获取网点名称数据
-      getStoreListData(){
-        storeList({pageNo:this.pageNo,pageSize:this.pageSize}).then(res=>{
-          console.log(res,'-----------')
-          if(res.status == 200){
+      getStoreListData() {
+        storeList({
+          pageNo: this.pageNo,
+          pageSize: this.pageSize
+        }).then(res => {
+          console.log(res, '-----------')
+          if (res.status == 200) {
             this.storeOptionData = res.data.list
             this.storeOptionData = res.data.list
           }
           }
         })
         })
       },
       },
       // 合计
       // 合计
-      getTotal(){},
+      getTotal() {
+        let params = {
+          beginDate: this.searchForm.beginDate,
+          endDate: this.searchForm.endDate,
+          storeIdList: this.searchForm.storeIdList,
+          orderNo: this.searchForm.orderNo,
+          itemId: this.searchForm.itemId,
+          customerMobile: this.searchForm.customerMobile,
+          orderStatus: this.searchForm.orderStatus
+        }
+        params.beginDate == null ? params.beginDate = getDate.getToday().starttime : null
+        params.endDate == null ? params.endDate = getDate.getToday().endtime : null
+        params.storeIdList = this.storeId
+        orderTotal(params).then(res => {
+          console.log(res, '--------')
+          if (res.status == 200) {
+            this.orderTotal = res.data.orderNum || 0
+            this.paymentAmountTotal = res.data.paymentAmount || 0
+          }
+        })
+      },
       // 查看详情--跳转到对应的详情页
       // 查看详情--跳转到对应的详情页
       seeDetail(record) {
       seeDetail(record) {
-        // this.$router.push({name: 'OrderDetail',query: {id: record.id}
-        // })
+        // 将当前行的id传递给详情页 
         this.detailId = record.id
         this.detailId = record.id
         this.openDetailModal = true
         this.openDetailModal = true
-        console.log(this.detailId)
       },
       },
       // 退款---暂不做
       // 退款---暂不做
       // refund(row) {
       // refund(row) {
@@ -270,14 +297,19 @@
       //     // }
       //     // }
       //   })
       //   })
       // },
       // },
+      // 查询
+      handleSearch() {
+        this.$refs.table.refresh()
+        this.getTotal()
+      },
       // 重置
       // 重置
-      resetForm() {
+      handleRest() {
         this.searchForm.beginDate = getDate.getToday().starttime
         this.searchForm.beginDate = getDate.getToday().starttime
         this.searchForm.endDate = getDate.getToday().endtime
         this.searchForm.endDate = getDate.getToday().endtime
         this.time = [
         this.time = [
-        	moment(getDate.getToday().starttime, this.dateFormat),
-        	moment(getDate.getToday().endtime, this.dateFormat)
-        	]
+          moment(getDate.getToday().starttime, this.dateFormat),
+          moment(getDate.getToday().endtime, this.dateFormat)
+        ]
         this.storeId = []
         this.storeId = []
         this.searchForm.storeIdList = []
         this.searchForm.storeIdList = []
         this.searchForm.orderNo = ''
         this.searchForm.orderNo = ''
@@ -286,36 +318,39 @@
         this.searchForm.orderStatus = ''
         this.searchForm.orderStatus = ''
         // this.$refs.searchForm.resetFields()
         // this.$refs.searchForm.resetFields()
         this.$refs.table.refresh()
         this.$refs.table.refresh()
+        this.getTotal()
       }
       }
     },
     },
-    beforeRouteEnter (to, from, next) {
+    beforeRouteEnter(to, from, next) {
       next(vm => {
       next(vm => {
         vm.getItemListData()
         vm.getItemListData()
-        vm.resetForm()
+        vm.handleRest()
         vm.getStoreListData()
         vm.getStoreListData()
       })
       })
     }
     }
   }
   }
 </script>
 </script>
 <style lang="less">
 <style lang="less">
-  .orderCenter-searchForm{
+  .orderCenter-searchForm {
+
     // 搜索框的下间距
     // 搜索框的下间距
-    .ant-form-item{
+    .ant-form-item {
       margin-bottom: 10px;
       margin-bottom: 10px;
     }
     }
   }
   }
+
   // 合计
   // 合计
   .total {
   .total {
-    margin:15px 0 25px;
-    width:100%;
+    margin: 15px 0 25px;
+    width: 100%;
     background-color: #e6f7ff;
     background-color: #e6f7ff;
     border: 1px solid #91d5ff;
     border: 1px solid #91d5ff;
     padding: 8px 15px 8px 27px;
     padding: 8px 15px 8px 27px;
     border-radius: 4px;
     border-radius: 4px;
-    .iconImg{
+
+    .iconImg {
       color: #1890FF;
       color: #1890FF;
       margin-right: 10px;
       margin-right: 10px;
     }
     }
   }
   }
-  
 </style>
 </style>

+ 2 - 5
src/views/Order/OrderDetailModal.vue

@@ -117,13 +117,10 @@
       }
       }
     },
     },
     methods: {
     methods: {
-      // // 查看详情
-      // getOrderDetail(){
-      //   orderDetail()
-      // },
+     
     },
     },
     watch: {
     watch: {
-      //  父页面传过来的弹框状态
+      //  父页面传过来的弹框状态以及当前行id
       openModal (newValue, oldValue) {
       openModal (newValue, oldValue) {
         this.isShow = newValue
         this.isShow = newValue
       },
       },