Commit 1403b4e1 by wangql

财务列表下载对账单

1 parent 4d3e9ede
......@@ -46,3 +46,8 @@ export function getServiceSummaryApi(data) {
data.method = `${path2}goodsOrderProfitAllocation.count.service.merchant`
return request(data, 'post')
}
export function exportAccountStatement(data) {
data.method = `${path2}goodsOrderProfitAllocation.exportAccountStatement`
return request(data, 'post')
}
......@@ -32,3 +32,9 @@ export function getMerchantLevelApi(data) {
data.method = `${djPath}smartcarlife.get.merchant.level`
return request(data, 'post')
}
// 分页搜索服务门店
export function getMerchantPageSearch(data) {
data.method = `${path}page.search`
return request(data, 'post')
}
<!-- 下载对账单 -->
<template>
<div>
<d2-dialog title="下载对账单"
:isVisible="accountVisible"
width="40%"
btnOkLabel="确定下载"
@closeDialog="handleClose"
@confirmDialog="handleAddConfirm">
<el-form ref="accountForm"
:model="infoForm"
:rules="formRules"
label-width="120px">
<el-form-item label="商户类型:"
prop="merchantType">
<el-radio-group v-model="infoForm.merchantType"
@change="changeType">
<el-radio-button label="2">4S店</el-radio-button>
<el-radio-button label="7">服务商</el-radio-button>
<el-radio-button label="6">园区店</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="选择商户:"
prop="merchant">
<el-select v-model="infoForm.merchant"
multiple
filterable
remote
reserve-keyword
:remote-method="remoteMethod"
:loading="selectLoading"
style="width:350px">
<el-option v-for="(item, index) in baseData.merchantList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId"></el-option>
</el-select>
</el-form-item>
<el-form-item label="订单支付时间:"
prop="time">
<el-date-picker v-model="infoForm.time"
type="daterange"
value-format="yyyy-MM-dd"
clearable
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOption['rangePickerOptions']">
</el-date-picker>
</el-form-item>
</el-form>
</d2-dialog>
</div>
</template>
<script>
import { BaseData, rangePickerOptions } from '@/common/constants.js'
import * as api from '@api/finance'
import { getMerchantPageSearch } from '@api/publicAccount'
export default {
name: 'downloadAccountDialog',
data () {
return {
pickerOption: {
rangePickerOptions: rangePickerOptions
},
userInfo: this.$store.state.d2admin.user.info,
infoForm: {
merchantType: 2,
merchant: [],
time: ''
},
formRules: {
merchantType: [{ required: true, message: '请选择商户类型', trigger: 'change' }],
merchant: [{ required: true, message: '请选择商户', trigger: 'change' }],
time: [{ required: true, message: '请选择时间', trigger: 'change' }]
},
selectLoading: false,
// 基本数据
baseData: {
merchantList: []
}
}
},
props: {
accountVisible: {
type: Boolean,
default: false
},
},
watch: {
// accountVisible (value) {
// if (value && this.couponInfo) {
// var addAttr = ['chargeFlag', 'merchantType', 'merchantTypeName']
// this.infoForm = _.cloneDeep(this.couponInfo)
// addAttr.forEach(item => {
// this.infoForm[item] = this.infoForm.couponInfo[item]
// })
// // console.log(this.infoForm)
// }
// }
},
created () {
// this.$nextTick(() => {
// this.$refs.accountForm.resetFields();
// })
},
components: {
},
mounted () {
},
methods: {
changeType () {
this.infoForm.merchant = ''
this.baseData.merchantList = []
},
remoteMethod (query) {
if (query !== '') {
this.selectLoading = true
var params = {}
params.currentPage = 1
params.pageSize = 1000
params.merchantName = query
var merchantTypeList = this.infoForm.merchantType ? [this.infoForm.merchantType] : []
params.merchantTypeList = merchantTypeList
getMerchantPageSearch(params).then(res => {
this.selectLoading = false
this.baseData.merchantList = res.list
})
} else {
this.baseData.merchantList = [];
}
},
handleAddConfirm () {
// console.log(this.infoForm.remark)
this.$refs.accountForm.validate(valid => {
if (valid) {
var infoForm = _.cloneDeep(this.infoForm)
console.log(infoForm)
var params = {}
var merchantList = []
var obj
infoForm.merchant.forEach(item => {
obj = {}
obj.merchantId = item
obj.merchantName = this.baseData.merchantList.find(mer => mer.merchantId === item).merchantName
merchantList.push(obj)
})
params.payStartDate = infoForm.time[0] + " 00:00:00"
params.payEndDate = infoForm.time[1] + " 23:59:59"
params.merchantList = merchantList
console.log(params);
api.exportAccountStatement(params).then(res => {
window.location.href = res
})
}
})
},
handleClose () {
this.$emit('accountClose', true)
}
}
}
</script>
<style scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!