123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893 |
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 零星收费
- </h2>
- <div class="m-core">
- <!-- v-permission="'sporadicChargeInfo/add'" -->
- <div class="newBand"
- v-permission="'sporadicChargeInfo/add'"
- @click="newVisible">新增公用收费</div>
- <div class="newBand"
- v-permission="'sporadicChargeInfo/add'"
- @click="newVisible1">新增个人收费</div>
- <el-form :inline="true"
- :model="searchForm">
- <el-form-item>
- <el-input placeholder="标题或学生姓名"
- v-model.trim="searchForm.search"></el-input>
- </el-form-item>
- <el-form-item>
- <el-select v-model.trim="searchForm.organId"
- placeholder='请选择分部'
- clearable
- filterable>
- <el-option v-for='(item,index) in organList'
- :key="index"
- :value="item.id"
- :label="item.name"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select v-model.trim="searchForm.chargeType"
- placeholder='请选择收费类型'
- clearable>
- <el-option v-for="item in orderType"
- :key="item.value"
- :label="item.label"
- :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select v-model.trim="searchForm.openFlag"
- placeholder='收费状态'
- clearable>
- <el-option label="关闭"
- value="1"></el-option>
- <el-option label="开启"
- value="0"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-select v-model.trim="searchForm.type"
- placeholder='请选择订单类型'
- clearable>
- <el-option label="个人"
- value="personal"></el-option>
- <el-option label="公用"
- value="common"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="danger"
- @click="search">搜索</el-button>
- <el-button @click="onReSet"
- type="primary">重置</el-button>
- <el-button @click="exportSporad"
- v-permission="'export/sporadicChargeInfo'"
- style=" background: #14928a; border:1px solid #14928a;color:#fff">导出</el-button>
- </el-form-item>
- </el-form>
- <div class="tableWrap">
- <el-table :data='tableList'
- :header-cell-style="{background:'#EDEEF0',color:'#444'}">
- <el-table-column align='center'
- label="分部"
- prop="organName">
- </el-table-column>
- <el-table-column align='center'
- label="收费类型">
- <template slot-scope="scope">
- <div>
- {{ scope.row.chargeType | chargeTypeFilter }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="标题"
- prop="title">
- </el-table-column>
- <el-table-column align='center'
- label="收费状态">
- <template slot-scope="scope">
- <div>
- {{ scope.row.openFlag?'关闭':'开启'}}
- </div>
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="金额"
- prop="amount">
- <template slot-scope="scope">
- <div>
- {{scope.row.amount | moneyFormat}}
- </div>
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="时间">
- <template slot-scope="scope">
- <div>
- {{ scope.row.createTime | formatTimer }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="学生姓名"
- prop="userName">
- <template slot-scope="scope">
- {{ scope.row.userName || '-' }}
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="订单类型">
- <template slot-scope="scope">
- {{ scope.row.userId ? '个人' : '公用' }}
- </template>
- </el-table-column>
- <el-table-column align='center'
- label="创建人"
- prop="operatorName">
- </el-table-column>
- <el-table-column align='center'
- label="操作">
- <template slot-scope="scope">
- <div>
- <el-button type="text" v-if="scope.row.chargeType == 12" key="update"
- v-permission="'sporadicChargeInfo/update'"
- @click="lookVisible(scope.row)">修改</el-button>
- <el-button type="text" v-else key="update"
- v-permission="'sporadicChargeInfo/look'"
- @click="lookVisible(scope.row)">查看</el-button>
- <el-button type="text"
- v-permission="'sporadicChargeInfo/delete'"
- @click="removeItem(scope.row)">删除</el-button>
- <el-button type="text"
- v-if="scope.row.openFlag"
- v-permission="'sporadicChargeInfo/updateOpenFlag'"
- @click="setSporadic(scope.row)">开启</el-button>
- <el-button type="text"
- v-else
- v-permission="'sporadicChargeInfo/updateOpenFlag'"
- @click="setSporadic(scope.row)">关闭</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :total="pageInfo.total"
- :page.sync="pageInfo.page"
- :limit.sync="pageInfo.limit"
- :page-sizes="pageInfo.page_size"
- @pagination="getList" />
- </div>
- </div>
- <el-dialog :title="title"
- :visible.sync="zeroVisible"
- @close="onFormClose('maskForm')"
- width="650px">
- <el-form :model='maskForm'
- :rules="maskRules"
- label-width="110px"
- label-position="right"
- :inline="true"
- ref="maskForm">
- <el-form-item label="标题"
- prop="title">
- <el-input v-model.trim="maskForm.title"
- :disabled='!isNew'></el-input>
- </el-form-item>
- <el-form-item label="收费类型"
- prop="type">
- <el-select v-model.trim="maskForm.type"
- :disabled='!isNew'
- clearable
- filterable>
- <el-option v-for="item in orderType1"
- :key="item.value"
- :label="item.label"
- :value="item.value"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="金额"
- prop='money'>
- <el-input v-model.trim="maskForm.money"
- type="number"
- @mousewheel.native.prevent
- :disabled='!isNew'></el-input>
- </el-form-item>
- <el-form-item label="是否开启限制"
- prop="openMaxTerm"
- :rules="[{ required: true, message: '请选择是否开启目标金额', trigger: 'change' }]"
- v-if="maskForm.type == 12">
- <el-select v-model.trim="maskForm.openMaxTerm" clearable>
- <el-option :value="1" label="是"></el-option>
- <el-option :value="0" label="否"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="目标金额"
- prop="maxAmount"
- :rules="[{ required: true, validator: validMaxNum, trigger: 'blur' }]"
- v-if="maskForm.type == 12">
- <el-input v-model.trim="maskForm.maxAmount"
- type="number"
- @mousewheel.native.prevent></el-input>
- </el-form-item>
- <el-form-item label="减免金额"
- v-if="maskForm.type == 6"
- prop='money'>
- <el-input v-model.trim="maskForm.subMoney"
- type="number"
- @mousewheel.native.prevent
- :disabled='!isNew'></el-input>
- </el-form-item>
- <el-form-item label="分部"
- prop="organId">
- <el-select v-model.trim="maskForm.organId"
- :disabled='!isNew'
- clearable
- @change="onMusicGroupChange"
- filterable>
- <el-option v-for='(item,index) in organList'
- :key="index"
- :value="item.id"
- :label="item.name"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="所属乐团"
- v-if="maskForm.type != 12"
- prop="musicGroupId">
- <el-select v-model.trim="maskForm.musicGroupId"
- :disabled='!isNew || !maskForm.organId'
- clearable
- filterable>
- <el-option v-for='item in maskMusicList'
- :key="item.musicGroupId"
- :value="item.musicGroupId"
- :label="item.musicGroupName"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="查看链接"
- v-if="!isNew">
- <el-input style='width:400px !important'
- :disabled='!isNew'
- v-model.trim="maskForm.code"></el-input>
- <el-button type='danger'
- @click="qrcodeStatus = true">二维码</el-button>
- </el-form-item>
- <el-form-item label="收费详情"
- prop="desc">
- <el-input type='textarea'
- :disabled='!isNew'
- v-model.trim="maskForm.desc"
- style="width:490px"
- :autosize="{minRows: 5}"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer"
- class="dialog-footer">
- <el-button @click="zeroVisible = false">取 消</el-button>
- <el-button type="primary"
- v-if="isNew"
- @click="addZero">确 定</el-button>
- <el-button v-if="!isNew"
- type="primary"
- @click="updateZero">确定</el-button>
- </span>
- </el-dialog>
- <el-dialog :title="title1"
- :visible.sync="zeroVisible1"
- @close="onFormClose('maskForm1')"
- width="650px">
- <el-form :model='maskForm1'
- :rules="maskRules1"
- label-width="100px"
- label-position="right"
- :inline="true"
- ref="maskForm1">
- <el-form-item label="标题"
- prop="title">
- <el-input v-model.trim="maskForm1.title"
- :disabled='!isNew1'></el-input>
- </el-form-item>
- <el-form-item label="收费类型"
- prop="type">
- <el-select v-model.trim="maskForm1.type"
- :disabled='!isNew1'
- clearable
- filterable>
- <template v-for="item in orderType1">
- <el-option v-if="item.value != 12"
- :key="item.value"
- :label="item.label"
- :value="item.value"></el-option>
- </template>
- </el-select>
- </el-form-item>
- <el-form-item label="学员编号"
- prop='studentId'>
- <el-input v-model.trim="maskForm1.studentId"
- @blur="onStudentChange"
- type="number"
- maxlength="10"
- @mousewheel.native.prevent
- :disabled='!isNew1'></el-input>
- </el-form-item>
- <el-form-item label="金额"
- prop='money'>
- <el-input v-model.trim="maskForm1.money"
- type="number"
- @mousewheel.native.prevent
- :disabled='!isNew1'></el-input>
- </el-form-item>
- <el-form-item label="学员姓名"
- prop='studentName'>
- <el-input v-model.trim="maskForm1.studentName"
- :disabled='true'></el-input>
- </el-form-item>
- <el-form-item label="所属乐团"
- prop="musicGroupId">
- <el-select v-model.trim="maskForm1.musicGroupId"
- :disabled='!isNew1'
- clearable
- filterable>
- <el-option v-for='(item,index) in maskMusicList1'
- :key="index"
- :value="item.musicGroupId"
- :label="item.musicGroupName"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="查看链接"
- v-if="!isNew1">
- <el-input style='width:400px !important'
- :disabled='!isNew1'
- v-model.trim="maskForm1.code"></el-input>
- <el-button type='danger'
- @click="qrcodeStatus = true">二维码</el-button>
- </el-form-item>
- <el-form-item label="收费详情"
- prop="desc">
- <el-input type='textarea'
- :disabled='!isNew1'
- v-model.trim="maskForm1.desc"
- style="width:490px"
- :autosize="{minRows: 5}"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer"
- class="dialog-footer">
- <el-button @click="zeroVisible1 = false">取 消</el-button>
- <el-button type="primary"
- v-if="isNew1"
- @click="addZero1">确 定</el-button>
- <el-button v-if="!isNew1"
- type="primary"
- @click="zeroVisible1 = false">确定</el-button>
- </span>
- </el-dialog>
- <el-dialog :visible.sync="qrcodeStatus"
- center
- width="300px">
- <div class="right-code">
- <h2 class="title">缴费链接</h2>
- <vue-qr :text="qrCodeUrl"
- style="width: 100%"
- :margin="0"></vue-qr>
- <!-- <div id="qrcode"
- class="qrcode code"
- ref="qrCodeUrl"></div> -->
- <!-- <p class="code-url"
- v-if="codeUrl2">{{ codeUrl2 }}</p> -->
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { getEmployeeOrgan } from '@/api/buildTeam'
- import pagination from '@/components/Pagination/index'
- import { vaildStudentUrl } from '@/utils/validate'
- import cleanDeep from 'clean-deep'
- import { addZero, getZero, updateZero, removeZero, getBasic, updateOpenFlag, queryOrganMusicInfos, queryUserMusicInfos } from '@/api/zeroManager'
- import axios from 'axios'
- import qs from 'qs'
- import {
- getToken
- } from '@/utils/auth'
- import load from '@/utils/loading'
- // import QRCode from 'qrcodejs2'
- import vueQr from 'vue-qr'
- let validMaxNum = (rule, value, callback) => {
- if (value == '' && typeof value == 'string' || value == null) {
- callback(new Error('请输入缴费金额'))
- } else if (value < 0) {
- callback(new Error('输入缴费金额必须大于0'))
- } else {
- callback()
- }
- }
- export default {
- name: 'sporadicList',
- components: { pagination, vueQr },
- data () {
- return {
- validMaxNum: validMaxNum,
- zeroVisible: false,
- qrCodeUrl: null,
- searchForm: {
- organId: null,
- chargeType: null,
- type: null,
- search: null,
- openFlag: null
- },
- tableList: [],
- organList: [],
- orderType: [
- { label: '考级', value: 1 },
- { label: '声部更改', value: 2 },
- { label: '乐器更换', value: 3 },
- { label: '配件销售', value: 4 },
- { label: '维修费', value: 5 },
- { label: '福袋活动', value: 6 },
- { label: '双十一活动', value: 12 },
- { label: '上门费', value: 7 },
- { label: '账户充值', value: 9 },
- { label: '乐保服务', value: 10 },
- { label: '其它', value: 11 }
- ],
- orderType1: [
- { label: '考级', value: 1 },
- { label: '声部更改', value: 2 },
- // { label: '乐器更换', value: 3 },
- // { label: '配件销售', value: 4 },
- // { label: '双十一活动', value: 12 },
- { label: '上门费', value: 7 },
- { label: '账户充值', value: 9 },
- { label: '乐保服务', value: 10 },
- ],
- maskForm: {
- organId: '',
- type: '',
- money: '',
- desc: '',
- title: '',
- code: '',
- musicGroupId: '',
- maxAmount: null,
- openMaxTerm: null,
- subMoney: ''
- },
- maskMusicList: [],
- maskRules: {
- organId: [{ required: true, message: '请选择分部', trigger: 'change' }],
- // musicGroupId: [{ required: true, message: '请选择所属乐团', trigger: 'change' }],
- type: [{ required: true, message: '请选择收费类型', trigger: 'change' }],
- money: [{ required: true, message: '请输入收费金额', trigger: 'change' }],
- title: [{ required: true, message: '请输入标题名称', trigger: 'change' }],
- desc: [{ required: true, message: '请输入收费详情' }]
- },
- pageInfo: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50] // 选择限制显示条数
- },
- isNew: false,
- title: '新增收费',
- qrcodeStatus: false,
- qrcodes: true,
- activeRow: null,
- title1: '新增收费',
- activeRow1: null,
- zeroVisible1: false,
- maskForm1: {
- type: null,
- money: null,
- desc: null,
- title: null,
- code: null,
- musicGroupId: null,
- studentId: null,
- studentName: null,
- },
- isNew1: false,
- maskMusicList1: [],
- maskRules1: {
- organId: [{ required: true, message: '请选择分部', trigger: 'change' }],
- // musicGroupId: [{ required: true, message: '请选择所属乐团', trigger: 'change' }],
- type: [{ required: true, message: '请选择收费类型', trigger: 'change' }],
- money: [{ required: true, message: '请输入收费金额', trigger: 'change' }],
- title: [{ required: true, message: '请输入标题名称', trigger: 'change' }],
- studentId: [{ required: true, message: '请输入学员编号', trigger: 'blur' }],
- desc: [{ required: true, message: '请输入收费详情' }]
- },
- }
- }, mounted () {
- getEmployeeOrgan().then(res => {
- if (res.code == 200) {
- this.organList = res.data;
- }
- })
- this.getList();
- },
- methods: {
- search () {
- this.pageInfo.page = 1;
- this.getList()
- },
- onReSet () {
- this.searchForm = {
- organId: null,
- chargeType: null,
- type: null,
- search: null
- }
- },
- getList () {
- let searchForm = this.searchForm
- let params = {
- organId: searchForm.organId ? searchForm.organId : null,
- chargeType: searchForm.chargeType ? searchForm.chargeType : null,
- type: searchForm.type ? searchForm.type : null,
- search: searchForm.search ? searchForm.search : null,
- openFlag: searchForm.openFlag ? searchForm.openFlag * 1 : null,
- page: this.pageInfo.page,
- rows: this.pageInfo.limit
- }
- getZero(params).then(res => {
- if (res.code == 200) {
- this.tableList = res.data.rows
- this.pageInfo.total = res.data.total
- }
- })
- },
- onFormClose (formName) { // 关闭弹窗重置验证
- if (formName == 'maskForm') {
- this.maskForm = {
- organId: null,
- musicGroupId: null,
- type: null,
- money: null,
- maxAmount: null,
- openMaxTerm: null,
- desc: null,
- title: null,
- code: null
- }
- } else if (formName == 'maskForm1') {
- this.maskForm1 = {
- type: null,
- musicGroupId: null,
- money: null,
- desc: null,
- title: null,
- code: null,
- studentId: null,
- studentName: null,
- }
- }
- if (this.$refs[formName]) {
- this.$refs[formName].resetFields()
- }
- },
- newVisible () {
- this.isNew = true;
- this.zeroVisible = true;
- this.title = '新增公用收费'
- },
- newVisible1 () {
- this.isNew1 = true;
- this.zeroVisible1 = true;
- this.title1 = '新增个人收费'
- },
- lookVisible (row) {
- let maskForm = null
- if (row.userId) {
- maskForm = this.maskForm1
- this.isNew1 = false;
- this.zeroVisible1 = true;
- this.title1 = '查看个人收费'
- let url = vaildStudentUrl() + `/#/sporadicPay?id=${row.id}&userId=${row.userId}`
- this.qrCodeUrl = url
- maskForm.code = url
- maskForm.studentId = row.userId
- maskForm.studentName = row.userName
- } else {
- maskForm = this.maskForm
- this.isNew = false;
- this.zeroVisible = true;
- this.title = '查看公用收费'
- let url = vaildStudentUrl() + `/#/sporadicLogin?id=${row.id}`
- this.qrCodeUrl = url
- maskForm.code = url
- }
- maskForm.type = parseInt(row.chargeType)
- maskForm.id = row.id
- maskForm.desc = row.detail
- maskForm.title = row.title
- maskForm.organId = row.organId
- maskForm.money = row.amount
- maskForm.subMoney = row.discountAmount
- maskForm.maxAmount = row.maxAmount
- maskForm.openMaxTerm = row.openMaxTerm
- maskForm.musicGroupId = row.musicGroupId ? row.musicGroupId : null
- if (row.userId) {
- queryUserMusicInfos({ userId: row.userId }).then(studentInfo => {
- if (studentInfo.code == 200) {
- this.maskMusicList1 = studentInfo.data
- }
- })
- } else {
- this.onMusicGroupChange(true)
- }
- },
- onMusicGroupChange (status) {
- let maskForm = this.maskForm
- if (!maskForm.organId) {
- return
- }
- if (!status) {
- maskForm.musicGroupId = null // 重置可能已经选中的乐团
- }
- queryOrganMusicInfos({ organId: maskForm.organId }).then(res => {
- if (res.code == 200) {
- this.maskMusicList = res.data
- }
- })
- },
- updateZero() {
- let maskForm = this.maskForm
- if(maskForm.type != 12) {
- this.zeroVisible = false
- return
- }
- this.$refs['maskForm'].validate(item => {
- if(item) {
- updateZero(cleanDeep({ id: maskForm.id, maxAmount: maskForm.maxAmount, openMaxTerm: maskForm.openMaxTerm })).then(res => {
- if (res.code == 200) {
- this.$message.success('更新成功')
- this.zeroVisible = false;
- this.getList()
- }
- })
- }
- })
- },
- addZero () {
- this.$refs['maskForm'].validate(item => {
- if (item) {
- let maskForm = this.maskForm
- let obj = {
- chargeType: maskForm.type,
- detail: maskForm.desc,
- title: maskForm.title,
- organId: maskForm.organId,
- amount: maskForm.money,
- musicGroupId: maskForm.musicGroupId,
- discountAmount: maskForm.subMoney,
- }
- if(maskForm.type == 12) {
- obj.maxAmount = maskForm.maxAmount,
- obj.openMaxTerm = maskForm.openMaxTerm
- }
- addZero(obj).then(res => {
- if (res.code == 200) {
- this.$message.success('新增成功')
- this.zeroVisible = false;
- this.getList()
- }
- })
- }
- })
- },
- addZero1 () {
- this.$refs['maskForm1'].validate(item => {
- if (item) {
- let maskForm1 = this.maskForm1
- if (!maskForm1.studentName) {
- this.$message.error('学员信息不存在')
- return
- }
- let obj = {
- chargeType: maskForm1.type,
- detail: maskForm1.desc,
- title: maskForm1.title,
- musicGroupId: this.maskForm1.musicGroupId,
- userId: maskForm1.studentId,
- amount: maskForm1.money
- }
- addZero(obj).then(res => {
- if (res.code == 200) {
- this.$message.success('新增成功')
- this.zeroVisible1 = false;
- this.getList()
- }
- })
- }
- })
- },
- async onStudentChange () {
- let studentId = this.maskForm1.studentId
- // 判断学生编号是否存在
- if (!studentId) {
- return
- }
- if (studentId.length > 10) {
- this.$message.error('学员编号不合法')
- return
- }
- await getBasic({ userId: studentId }).then(res => {
- if (res.code == 200) {
- if (res.data) {
- this.maskForm1.studentName = res.data.name
- queryUserMusicInfos({ userId: studentId }).then(studentInfo => {
- if (studentInfo.code == 200) {
- this.maskMusicList1 = studentInfo.data
- }
- })
- } else {
- this.maskForm1.studentName = null
- }
- }
- })
- },
- removeItem (row) {
- this.$confirm('是否删除该收费', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- removeZero({ id: row.id }).then(res => {
- if (res.code == 200) {
- this.$message.success('删除成功')
- this.zeroVisible = false;
- this.getList()
- }
- })
- }).catch(() => {
- });
- },
- setSporadic (row) {
- // openFlag
- let str = ''
- let openFlag = ''
- if (row.openFlag) {
- // 关闭=>开启 1是关闭
- openFlag = 0;
- str = '开启'
- } else {
- // 开启=>关闭 0是开启
- openFlag = 1;
- str = '关闭'
- }
- this.$confirm(`是否${str}该收费`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- updateOpenFlag({ sporadicId: row.id, openFlag }).then(res => {
- if (res.code == 200) {
- this.$message.success(`${str}成功`)
- this.getList()
- }
- })
- }).catch(() => {
- });
- },
- exportSporad () {
- let url = '/api-web/export/sporadicChargeInfo'
- let data = this.searchForm
- const options = {
- method: 'get',
- headers: {
- 'Authorization': getToken()
- },
- params: data,
- url,
- responseType: 'blob'
- }
- this.$confirm('您确定导出零星缴费列表', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- load.startLoading()
- axios(options).then(res => {
- let blob = new Blob([res.data], {
- // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
- type: 'application/vnd.ms-excel;charset=utf-8'
- //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
- })
- let text = (new Response(blob)).text()
- text.then(res => {
- // 判断是否报错
- if (res.indexOf('code') != -1) {
- let json = JSON.parse(res)
- this.$message.error(json.msg)
- } else {
- let objectUrl = URL.createObjectURL(blob)
- let link = document.createElement("a")
- let nowTime = new Date()
- let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate()
- let fname = ymd + '零星缴费' //下载文件的名字
- link.href = objectUrl
- link.setAttribute("download", fname)
- document.body.appendChild(link)
- link.click()
- }
- })
- load.endLoading();
- }).catch(error => {
- this.$message.error('导出数据失败,请联系管理员');
- load.endLoading();
- })
- }).catch(() => { })
- }
- },
- watch: {
- zeroVisible (val) {
- if (!val) {
- this.maskForm = {
- organId: '',
- type: '',
- money: '',
- desc: '',
- title: '',
- maxAmount: null,
- openMaxTerm: null,
- code: ''
- }
- // this.$refs['maskForm'].resetFields()
- // console.log(this.$refs['zeroForm'].resetFields)
- }
- },
- },
- filters: {
- chargeTypeFilter (val) {
- let template = {
- '1': '考级',
- '2': '声部更改',
- '3': '乐器更换',
- '4': '配件销售',
- '5': '维修费',
- '6': '福袋活动',
- '7': '上门费',
- '9': '账户充值',
- '10': '乐保服务',
- '11': '其它',
- '12': '双十一活动'
- }
- return template[val]
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .right-code {
- // width: 50%;
- // float: left;
- .title {
- font-size: 18px;
- text-align: center;
- padding-bottom: 8px;
- }
- }
- .newBand {
- display: inline-block;
- }
- .el-input {
- width: 180px !important;
- }
- </style>
|