소스 검색

接口调试

lilei 4 년 전
부모
커밋
bea9b3184a
5개의 변경된 파일115개의 추가작업 그리고 17개의 파일을 삭제
  1. 21 0
      src/api/offPartnerGoldLog.js
  2. 9 1
      src/api/releaseRecord.js
  3. 47 11
      src/views/businessManage/leduQuery/leduQuery.vue
  4. 36 3
      src/views/releaseRecord/releaseRecordList.vue
  5. 2 2
      vue.config.js

+ 21 - 0
src/api/offPartnerGoldLog.js

@@ -0,0 +1,21 @@
+import { axios } from '@/utils/request'
+// 商户乐豆统计列表查询
+export const getOffPartnerGoldLog = (params) => {
+  const url = `/offPartnerGoldLog/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 商户乐豆统计导出接口
+export const exportOffPartnerGoldLog = (params) => {
+  return axios.request({
+    url: '/offPartnerGoldLog/exportGoldLogByDay',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 9 - 1
src/api/releaseRecord.js

@@ -11,7 +11,15 @@ export const getDeliveryLogList = (params) => {
     method: 'post'
   })
 }
-
+// 导出
+export const exportDeliveryLog = (params) => {
+  return axios.request({
+    url: 'deliveryLog/exportDeliveryLog',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
 // 合计
 export const getDeliveryLogTotal = (params) => {
   const url = `deliveryLog/total`

+ 47 - 11
src/views/businessManage/leduQuery/leduQuery.vue

@@ -16,13 +16,13 @@
           </a-col>
           <a-col :span="6">
             <a-form-item label="商户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
-              <a-input id="releaseRecordList-customerMobile" allowClear :maxLength="11" v-model=" queryParam.customerMobile" placeholder="请输入商户名称" />
+              <a-input id="releaseRecordList-officialPartnerName" allowClear :maxLength="11" v-model=" queryParam.officialPartnerName" placeholder="请输入商户名称" />
             </a-form-item>
           </a-col>
           <a-col :span="6">
             <a-button class="handle-btn serach-btn" id="releaseRecordList-serach" type="primary" @click="refresh">查询</a-button>
             <a-button class="handle-btn" id="releaseRecordList-reset" @click="handleReset">重置</a-button>
-            <a-button class="handle-btn export-btn" id="releaseRecordList-export" @click="handleExport">导出</a-button>
+            <a-button class="handle-btn export-btn" id="releaseRecordList-export" :loading="loading" @click="handleExport">导出</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -45,13 +45,14 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { getDeliveryLogList, getDeliveryLogTotal, stationList } from '@/api/releaseRecord.js'
+import { getOffPartnerGoldLog, exportOffPartnerGoldLog } from '@/api/offPartnerGoldLog.js'
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 export default {
   components: { STable, VSelect },
   data () {
     return {
+      loading: false,
       form: this.$form.createForm(this),
       formItemLayout: {
         labelCol: { span: 4 },
@@ -67,7 +68,7 @@ export default {
       queryParam: {
         beginDate: null, // 开始时间
         endDate: null, // 结束时间
-        customerMobile: '' //  用户手机
+        officialPartnerName: '' //  用户手机
       },
       optionData: [],
       orderTotal: 0,	// 总单数
@@ -75,8 +76,9 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '商户名称', dataIndex: 'stationName', width: 200, align: 'center' },
-        { title: '收取乐豆个数', dataIndex: 'stationName', width: 200, align: 'center' }
+        { title: '商户名称', dataIndex: 'officialPartnerName', align: 'center' },
+        { title: '收取乐豆个数', dataIndex: 'changeNum', width: 200, align: 'center' },
+        { title: '交易时间', dataIndex: 'createDate', width: 200, align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -88,14 +90,14 @@ export default {
           searchData.beginDate = ''
           searchData.endDate = ''
         }
-        return getDeliveryLogList(searchData).then(res => {
+        return getOffPartnerGoldLog(searchData).then(res => {
           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
             }
-            this.getListTotal()
+            // this.getListTotal()
             return res.data
           }
         })
@@ -115,7 +117,41 @@ export default {
     },
     // 导出
     handleExport () {
-
+      const params = {
+        officialPartnerName: this.queryParam.officialPartnerName
+      }
+      if (this.queryOrderDate && this.queryOrderDate.length) {
+        params.beginDate = moment(this.queryOrderDate[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.queryOrderDate[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      if (!params.beginDate && !params.endDate) {
+        this.$message.error('请先选择需要导出的交易时间区间再进行导出!')
+        return
+      }
+      // 判断两个时间段是否相差m个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 3) {
+        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+      }
+      this.loading = true
+      exportOffPartnerGoldLog(params).then(res => {
+        this.loading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDhhmmss')
+      const fname = '商户乐豆统计-' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
     },
     // 查询
     refresh () {
@@ -124,7 +160,7 @@ export default {
     // 合计
     getListTotal () {
       const params = {
-        customerMobile: this.queryParam.customerMobile,
+        officialPartnerName: this.queryParam.officialPartnerName,
         beginDate: this.queryParam.beginDate,
         endDate: this.queryParam.endDate
       }
@@ -153,7 +189,7 @@ export default {
         moment(getDate.getRecentday().starttime, this.dateFormat),
         moment(getDate.getRecentday().endtime, this.dateFormat)
       ]
-      this.queryParam.customerMobile = ''
+      this.queryParam.officialPartnerName = ''
       this.$refs.table.refresh(true)
     }
   }

+ 36 - 3
src/views/releaseRecord/releaseRecordList.vue

@@ -72,7 +72,7 @@
             </a-form-item>
           </a-col>
           <a-col :span="4">
-            <a-button class="export-btn" id="releaseRecordList-export" @click="handleExport">导出</a-button>
+            <a-button class="export-btn" id="releaseRecordList-export" :loading="loading" @click="handleExport">导出</a-button>
           </a-col>
         </a-row>
       </a-form>
@@ -128,13 +128,14 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { getDeliveryLogList, getDeliveryLogTotal, stationList } from '@/api/releaseRecord.js'
+import { getDeliveryLogList, getDeliveryLogTotal, stationList, exportDeliveryLog } from '@/api/releaseRecord.js'
 import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 export default {
   components: { STable, VSelect },
   data () {
     return {
+      loading: false,
       form: this.$form.createForm(this),
       formItemLayout: {
         labelCol: { span: 4 },
@@ -236,7 +237,39 @@ export default {
     },
     // 导出
     handleExport () {
-
+      const params = this.queryParam
+      if (this.queryOrderDate && this.queryOrderDate.length) {
+        params.beginDate = moment(this.queryOrderDate[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.queryOrderDate[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      if (!params.beginDate && !params.endDate) {
+        this.$message.error('请先选择需要导出的投放时间区间再进行导出!')
+        return
+      }
+      // 判断两个时间段是否相差m个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 3) {
+        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+      }
+      this.loading = true
+      exportDeliveryLog(params).then(res => {
+        this.loading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDhhmmss')
+      const fname = '投放记录-' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
     },
     // 查询
     refresh () {

+ 2 - 2
vue.config.js

@@ -108,8 +108,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.16.103:8301/gc-admin/',
-        target: 'https://lese.test.sxzxyj.net/gc-admin/',
+        target: 'http://192.168.16.105:8301/gc-admin/',
+        // target: 'https://lese.test.sxzxyj.net/gc-admin/',
         ws: false,
         changeOrigin: true,
         pathRewrite: {