zhangdan 4 years ago
parent
commit
045c5748a6

+ 20 - 7
src/api/SetmealSales.js

@@ -12,9 +12,21 @@ export const getVerificationRecordsList = (params) => {
   })
   })
 }
 }
 
 
+// 门店
+export const getStoreList = (params) => {
+  const url = `/store/queryLike/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
 // 合计
 // 合计
-export const getVerificationRecordsListTotal = params => {
-  const url = '/verification/export'
+export const getVerificationRecordsListTotal = (params) => {
+  const url = `/verification/countSettledByChannel`
   return axios({
   return axios({
     url: url,
     url: url,
     data: params,
     data: params,
@@ -22,12 +34,13 @@ export const getVerificationRecordsListTotal = params => {
   })
   })
 }
 }
 
 
-// 导出
-export const settlementRecordsExport = params => {
+// 导出核销数据
+export const settlementRecordsExport = (params) => {
   const url = `/verification/export`
   const url = `/verification/export`
-  return axios.request({
+  return axios({
     url: url,
     url: url,
     data: params,
     data: params,
-    method: 'post'
-  }).then(res => res.data)
+    method: 'post',
+    responseType: 'blob'
+  })
 }
 }

+ 5 - 4
src/views/FinancialManagement/PaySettlementRecords.vue

@@ -8,6 +8,7 @@
             <a-form-item label="结算时间:">
             <a-form-item label="结算时间:">
               <a-range-picker
               <a-range-picker
                 style="width:100%"
                 style="width:100%"
+                id="PaySettlementRecords-queryOrderDate"
                 :disabledDate="disabledDate"
                 :disabledDate="disabledDate"
                 v-model="queryOrderDate"
                 v-model="queryOrderDate"
                 format="YYYY-MM-DD"
                 format="YYYY-MM-DD"
@@ -16,12 +17,12 @@
           </a-col>
           </a-col>
           <a-col :lg="6" :sm="12">
           <a-col :lg="6" :sm="12">
             <a-form-item label="结算单号">
             <a-form-item label="结算单号">
-              <a-input class="full-width" v-model="queryParam.settleNo" placeholder="请输入" allowClear />
+              <a-input class="full-width" v-model="queryParam.settleNo" placeholder="请输入" allowClear id="PaySettlementRecords-queryOrderDate"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :lg="6" :sm="12">
           <a-col :lg="6" :sm="12">
-            <a-button type="primary" @click="refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+            <a-button type="primary" @click="refresh" id="PaySettlementRecords-refresh">查询</a-button>
+            <a-button style="margin-left: 8px" @click="resetSearchForm" id="PaySettlementRecords-resetSearchForm">重置</a-button>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
       </a-form>
       </a-form>
@@ -42,7 +43,7 @@
         :data="loadData">
         :data="loadData">
         <template slot="action" slot-scope="text, record">
         <template slot="action" slot-scope="text, record">
           <!-- <a-icon type="eye" title="查看" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleDetail(record)" /> -->
           <!-- <a-icon type="eye" title="查看" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleDetail(record)" /> -->
-          <a-button type="primary" @click="handleDetail(record)">详情</a-button>
+          <a-button type="primary" @click="handleDetail(record)" id="PaySettlementRecords-handleDetail">详情</a-button>
         </template>
         </template>
       </s-table>
       </s-table>
     </div>
     </div>

+ 1 - 1
src/views/FinancialManagement/PaySettlementRecordsDetailsModal.vue

@@ -17,7 +17,7 @@
         :data-source="loadData">
         :data-source="loadData">
         <template slot="action" slot-scope="text, record">
         <template slot="action" slot-scope="text, record">
           <!-- <a-icon type="eye" title="查看" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleDetail(record)" /> -->
           <!-- <a-icon type="eye" title="查看" :style="{ fontSize: '20px', color: '#e29e14', padding: '0 10px' }" @click="handleDetail(record)" /> -->
-          <a-button type="primary" @click="handleDetail(record)">查看</a-button>
+          <a-button type="primary" @click="handleDetail(record)" id="PaySettlementRecordsDetailsModal-handleDetail">详情</a-button>
         </template>
         </template>
       </a-table>
       </a-table>
     </a-modal>
     </a-modal>

+ 76 - 142
src/views/SetmealSales/VerificationRecords.vue

@@ -8,41 +8,41 @@
             <a-form-item label="核销时间" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
             <a-form-item label="核销时间" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
               <a-range-picker
               <a-range-picker
                 v-model="time"
                 v-model="time"
+                id="VerificationRecords-time"
                 :format="dateFormat"
                 :format="dateFormat"
                 :placeholder="['开始时间','结束时间']"
                 :placeholder="['开始时间','结束时间']"
                 :disabledDate="disabledDate"
                 :disabledDate="disabledDate"
-                @calendarChange="calendarChange"
                 @change="onChange" />
                 @change="onChange" />
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="核销门店" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
             <a-form-item label="核销门店" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-select placeholder="请选择" allowClear v-model="searchForm.usedStoreId">
+              <a-select placeholder="请选择" allowClear v-model="searchForm.usedStoreId" id="VerificationRecords-usedStoreId">
                 <a-select-option v-for="item in storeOptionData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                 <a-select-option v-for="item in storeOptionData" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
               </a-select>
               </a-select>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="客户信息" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
             <a-form-item label="客户信息" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input v-model.trim="searchForm.queryWorld" placeholder="请输入手机号/车牌号" allowClear />
+              <a-input v-model.trim="searchForm.queryWorld" placeholder="请输入手机号/车牌号" allowClear id="VerificationRecords-queryWorld"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="套餐名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
             <a-form-item label="套餐名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input v-model.trim="searchForm.bundName" placeholder="请输入" allowClear />
+              <a-input v-model.trim="searchForm.bundName" placeholder="请输入" allowClear id="VerificationRecords-bundName"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
         <a-row :gutter="48">
         <a-row :gutter="48">
           <a-col :span="6">
           <a-col :span="6">
             <a-form-item label="关联订单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
             <a-form-item label="关联订单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input v-model.trim="searchForm.orderNo" placeholder="请输入" allowClear :maxLength="11" />
+              <a-input v-model.trim="searchForm.orderNo" placeholder="请输入" allowClear id="VerificationRecords-orderNo"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :span="18">
           <a-col :span="18">
-            <a-button style="margin-right: 10px;" type="primary" @click="handleSearch">查询</a-button>
-            <a-button type="" @click="handleRest">重置</a-button>
-            <a-button type="" :loading="loading" class="export-btn" @click="handleExport">导出</a-button>
+            <a-button style="margin-right: 10px;" type="primary" @click="handleSearch" id="VerificationRecords-handleSearch">查询</a-button>
+            <a-button type="" @click="handleRest" id="VerificationRecords-handleRest">重置</a-button>
+            <a-button type="" :loading="loading" class="export-btn" @click="handleExport" id="VerificationRecords-handleExport">导出</a-button>
           </a-col>
           </a-col>
         </a-row>
         </a-row>
       </a-form>
       </a-form>
@@ -50,8 +50,8 @@
     <!-- 合计 -->
     <!-- 合计 -->
     <div class="total">
     <div class="total">
       <a-icon type="info-circle" class="iconImg" />
       <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>
+      <strong>总计:</strong><span>{{ orderTotal || 0 }} 单</span><strong style="margin-left: 15px;">结算金额:</strong><span
+      >{{ paymentAmountTotal || 0 }} 元</span>
     </div>
     </div>
     <!-- 列表 -->
     <!-- 列表 -->
     <s-table
     <s-table
@@ -61,26 +61,20 @@
       :columns="columns"
       :columns="columns"
       :data="loadData"
       :data="loadData"
       bordered>
       bordered>
-      <!-- 状态 -->
-      <span slot="orderStatus" slot-scope="text">
-        {{ $refs.orderStatus.getNameByCode(text) }}
-      </span>
-      <!-- 实收金额 -->
-      <span slot="paymentAmount" slot-scope="text, record">
-        <template v-if=" record.payStatus == 'PAID' ">{{ record.paymentAmount }}</template>
-        <template v-else-if=" record.payStatus != 'PAID' ">{{ 0 }}</template>
-      </span>
-      <!-- 优惠 -->
-      <span slot="couponAmount" slot-scope="text, record">
-        <template v-if=" record.orderStatus != 'CANCELED' ">{{ record.couponAmount }}</template>
-        <template v-else-if=" record.orderStatus == 'CANCELED' ">{{ 0 }}</template>
-      </span>
-      <!-- 操作 -->
-      <span slot="action" slot-scope="text, record">
-        <a-button type="primary" @click="seeDetail(record)">查看</a-button>
-        <!-- 本期暂不做 -->
-        <!-- <a-button type="danger" @click="refund(record)">退款</a-button> -->
-      </span>
+      <!-- 订单编号 -->
+      <template slot="num" slot-scope="text, record">
+        <p>{{ record.bizNum }}</p>
+        <p>{{ record.orderNo }}</p>
+      </template>
+      <!-- 客户信息 -->
+      <template slot="userInfo" slot-scope="text, record">
+        <!-- <p>{{ text }}<br>{{ record.vehicleNumber ? record.vehicleNumber : '--' }}</p> -->
+        <div>
+          <span v-if="record.custMobile">{{ record.custMobile }}</span>
+          <span v-if="record.vehicleNum">{{ record.vehicleNum }}</span>
+        </div>
+        <span v-if="!record.custMobile && !record.vehicleNum">--</span>
+      </template>
     </s-table>
     </s-table>
     <!-- 查看详情弹窗 -->
     <!-- 查看详情弹窗 -->
     <!-- <order-detail-modal :openModal="openDetailModal" :nowId="detailId" @close="openDetailModal=false" /> -->
     <!-- <order-detail-modal :openModal="openDetailModal" :nowId="detailId" @close="openDetailModal=false" /> -->
@@ -93,17 +87,16 @@ import {
   VSelect
   VSelect
 } from '@/components'
 } from '@/components'
 import getDate from '@/libs/getDate.js'
 import getDate from '@/libs/getDate.js'
+import { completeDate } from '@/libs/tools.js'
 import {
 import {
-  getVerificationRecordsList,getVerificationRecordsListTotal,settlementRecordsExport
+  getVerificationRecordsList, getVerificationRecordsListTotal, settlementRecordsExport, getStoreList
 } from '@/api/SetmealSales.js'
 } from '@/api/SetmealSales.js'
-// 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
-    // OrderDetailModal
   },
   },
   data () {
   data () {
     return {
     return {
@@ -111,7 +104,7 @@ export default {
       searchForm: {
       searchForm: {
         beginDate: null, // 创建的开始时间
         beginDate: null, // 创建的开始时间
         endDate: null, // 创建的结束时间
         endDate: null, // 创建的结束时间
-        usedStoreId: '', // 核销门店
+        usedStoreId: undefined, // 核销门店
         orderNo: '', // 单号
         orderNo: '', // 单号
         queryWorld: '', // 客户信息
         queryWorld: '', // 客户信息
         bundName: '' // 套餐名称
         bundName: '' // 套餐名称
@@ -119,57 +112,58 @@ export default {
       loading: false, // 导出loading
       loading: false, // 导出loading
       orderTotal: '', // 合计开单数量
       orderTotal: '', // 合计开单数量
       paymentAmountTotal: '', // 合计实收金额
       paymentAmountTotal: '', // 合计实收金额
-      itemOptionData: [], // 服务项目数据
-      storeOptionData: [], // 网点名称数据
-      openDetailModal: false, // 查看详情弹窗 默认关闭
-      detailId: null, // 初始化id
+      storeOptionData: [], // 门店数据
       // 将默认当天时间日期回显在时间选择框中
       // 将默认当天时间日期回显在时间选择框中
       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',
-	  nowBeginDate: '',
+      nowBeginDate: '',
       columns: [{
       columns: [{
-		    title: '序号',
-		    dataIndex: 'orderNo',
-		    minWidth: '40',
-		    align: 'center'
-		  }, {
+        title: '序号',
+        dataIndex: 'no',
+        minWidth: '40',
+        align: 'center'
+      },
+	  {
+	    title: '核销时间',
+	    dataIndex: 'usedTime',
+	    minWidth: '40',
+	    align: 'center'
+	  },
+      {
         title: '核销单号/关联订单号',
         title: '核销单号/关联订单号',
-        dataIndex: 'orderTime',
+        scopedSlots: { customRender: 'num' },
         minWidth: '40',
         minWidth: '40',
         align: 'center'
         align: 'center'
       },
       },
-      // {
-      //   title: '核销时间',
-      //   dataIndex: 'orderNo',
-      //   minWidth: '40',
-      //   align: 'center'
-      // },
       {
       {
         title: '核销服务名称',
         title: '核销服务名称',
-        dataIndex: 'storeName',
+        dataIndex: 'bundName',
         minWidth: '40',
         minWidth: '40',
         align: 'center'
         align: 'center'
       },
       },
       {
       {
         title: '客户信息',
         title: '客户信息',
-        dataIndex: 'itemName',
+        scopedSlots: { customRender: 'userInfo' },
         minWidth: '40',
         minWidth: '40',
         align: 'center'
         align: 'center'
       },
       },
       {
       {
         title: '套餐名称',
         title: '套餐名称',
-        dataIndex: 'customerMobile',
+        dataIndex: 'bundItemName',
         minWidth: '40',
         minWidth: '40',
         align: 'center'
         align: 'center'
       },
       },
       {
       {
         title: '结算金额(¥)',
         title: '结算金额(¥)',
-        dataIndex: 'payableAmount',
+        dataIndex: 'salesChannelSettleAmount',
         minWidth: '40',
         minWidth: '40',
-        align: 'center'
+        align: 'center',
+        customRender: function (text) {
+		  return (text || 0) + '元'
+        }
       }
       }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
@@ -177,10 +171,13 @@ export default {
         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
         return getVerificationRecordsList(Object.assign(parameter, this.searchForm)).then(res => {
         return getVerificationRecordsList(Object.assign(parameter, this.searchForm)).then(res => {
-          // 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
+            }
             return res.data
             return res.data
-            this.getTotal()
           }
           }
         })
         })
       }
       }
@@ -188,33 +185,9 @@ export default {
   },
   },
   methods: {
   methods: {
     moment,
     moment,
-    calendarChange (date, dateStrings) {
-	  if (date[0]) {
-	    this.nowBeginDate = date[0].format('YYYY-MM-DD')
-	  }
-    },
     // 不可选日期
     // 不可选日期
     disabledDate (date, dateStrings) {
     disabledDate (date, dateStrings) {
-	  if (this.nowBeginDate) { //  有下单时间开始时间时
-	    const bVal = this.getThreeMonthsAfter(this.nowBeginDate, -3) //  三个月前时间戳
-	    const eVal = this.getThreeMonthsAfter(this.nowBeginDate, 3) //  三个月后时间戳
-	    if (Date.now() < eVal) { //  当前日期距起始日期不足三个月
-	      return date && date.valueOf() < bVal || date && date.valueOf() > Date.now()
-	    } else {
-	      return date && date.valueOf() < bVal || date && date.valueOf() > eVal
-	    }
-	  } else {
-	    return date && date.valueOf() > Date.now()
-	  }
-    },
-    //  获取month个月后的时间戳
-    getThreeMonthsAfter (dtstr, month) {
-	  var s = dtstr.split('-')
-	  var yy = parseInt(s[0])
-	  var mm = parseInt(s[1])
-	  var dd = parseInt(s[2])
-	  var dt = new Date(yy, mm + Number(month) - 1, dd)
-	  return dt.valueOf()
+      return date && date.valueOf() > Date.now()
     },
     },
     // 创建时间change
     // 创建时间change
     onChange (dates, dateStrings) {
     onChange (dates, dateStrings) {
@@ -222,36 +195,19 @@ export default {
         this.searchForm.beginDate = dateStrings[0]
         this.searchForm.beginDate = dateStrings[0]
         this.searchForm.endDate = dateStrings[1]
         this.searchForm.endDate = dateStrings[1]
       }
       }
-      console.log(this.searchForm.beginDate, this.searchForm.endDate)
     },
     },
-    // 获取服务项目数据
-    // getItemListData () {
-    //   itemList({
-    //     pageNo: 1,
-    //     pageSize: 1000
-    //   }).then(res => {
-    //     // console.log(res, '-----------')
-    //     if (res.status == 200) {
-    //       this.itemOptionData = res.data.list || []
-    //     } else {
-    //       this.itemOptionData = []
-    //     }
-    //   })
-    // },
-    // // 获取网点名称数据
-    // getStoreListData () {
-    //   storeList({
-    //     pageNo: 1,
-    //     pageSize: 1000
-    //   }).then(res => {
-    //     // console.log(res, '-----------')
-    //     if (res.status == 200) {
-    //       this.storeOptionData = res.data.list || []
-    //     } else {
-    //       this.storeOptionData = []
-    //     }
-    //   })
-    // },
+    // 获取门店数据
+    getStoreListData () {
+      getStoreList({
+        pageNo: 1,
+        pageSize: 1000
+      }).then(res => {
+        console.log(res, '-----------')
+        if (res.status == 200) {
+          this.storeOptionData = res.data.list || []
+        }
+      })
+    },
     // 合计
     // 合计
     getTotal () {
     getTotal () {
       const params = {
       const params = {
@@ -272,25 +228,6 @@ export default {
         }
         }
       })
       })
     },
     },
-    // 查看详情--跳转到对应的详情页
-    seeDetail (record) {
-      // 将当前行的id传递给详情页
-      this.openDetailModal = true
-      this.detailId = record.id
-    },
-    // 退款---暂不做
-    // refund(row) {
-    //   const _this = this
-    //   this.$confirm({
-    //     title: '警告',
-    //     content: '确认退款后 款项将通过原渠道退回 且不可撤回,确认退款?',
-    //     okText: '确定',
-    //     cancelText: '取消',
-    //     // onOk() {
-    //
-    //     // }
-    //   })
-    // },
     // 查询
     // 查询
     handleSearch () {
     handleSearch () {
       this.$refs.table.refresh()
       this.$refs.table.refresh()
@@ -305,11 +242,8 @@ export default {
         moment(getDate.getToday().starttime, this.dateFormat),
         moment(getDate.getToday().starttime, this.dateFormat),
         moment(getDate.getToday().endtime, this.dateFormat)
         moment(getDate.getToday().endtime, this.dateFormat)
       ]
       ]
-      this.searchForm.usedStoreId = ''
+      this.searchForm.usedStoreId = undefined
       this.searchForm.orderNo = ''
       this.searchForm.orderNo = ''
-      this.searchForm.customerMobile = ''
-      this.searchForm.orderStatus = ''
-      // this.$refs.searchForm.resetFields()
       this.$refs.table.refresh()
       this.$refs.table.refresh()
       this.getTotal()
       this.getTotal()
     },
     },
@@ -324,6 +258,10 @@ export default {
         queryWorld: this.searchForm.queryWorld,
         queryWorld: this.searchForm.queryWorld,
         bundName: this.searchForm.bundName
         bundName: this.searchForm.bundName
       }
       }
+      if (!completeDate(params.beginDate, params.endDate, 3)) {
+        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+        return
+      }
       settlementRecordsExport(params).then(res => {
       settlementRecordsExport(params).then(res => {
         console.log(res)
         console.log(res)
         this.loading = false
         this.loading = false
@@ -331,19 +269,15 @@ export default {
       })
       })
     },
     },
     download (data) {
     download (data) {
-      if (!data) {
-        return
-      }
+      if (!data) { return }
       const url = window.URL.createObjectURL(new Blob([data]))
       const url = window.URL.createObjectURL(new Blob([data]))
       const link = document.createElement('a')
       const link = document.createElement('a')
-
       link.style.display = 'none'
       link.style.display = 'none'
       link.href = url
       link.href = url
       const a = moment().format('YYYYMMDDhhmmss')
       const a = moment().format('YYYYMMDDhhmmss')
       const fname = '核销记录-' + a
       const fname = '核销记录-' + a
       console.log(fname, '111111')
       console.log(fname, '111111')
       link.setAttribute('download', fname + '.xlsx')
       link.setAttribute('download', fname + '.xlsx')
-
       document.body.appendChild(link)
       document.body.appendChild(link)
       link.click()
       link.click()
     }
     }
@@ -351,8 +285,8 @@ export default {
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
     next(vm => {
     next(vm => {
       // vm.getItemListData()
       // vm.getItemListData()
-      // vm.handleRest()
-      // vm.getStoreListData()
+      vm.handleRest()
+      vm.getStoreListData()
     })
     })
   }
   }
 }
 }