| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089 |
- <template>
- <div class="context">
- <div class="panel">
- <h5>消费记录</h5>
- <div class="panel-body">
- <div class="panel_control">
- <el-row :gutter="20">
- <el-col :span="4">
- <em>姓名:</em>
- <el-input v-model="panel.name" placeholder="请输入姓名"></el-input>
- </el-col>
- <el-col :span="4">
- <em>手机号:</em>
- <el-input v-model="panel.phone" placeholder="请输入手机号"></el-input>
- </el-col>
- <el-col :span="6">
- <em>日期:</em>
- <el-date-picker
- v-model="panel.timeScope"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-col>
- <el-col :span="4">
- <em>预约课程:</em>
- <el-select v-model="panel.classId">
- <el-option
- v-for="item in panel.options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="4">
- <el-button size="" type="primary" @click="query" plain>查询</el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <div class="table">
- <el-table
- :data="tableData"
- border
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- show-summary
- :summary-method="getSummaries"
- @selection-change="handleSelectionChange"
- >
- >
- <el-table-column
- type="index"
- label="序号"
- align="center"
- width="50">
- </el-table-column>
- <el-table-column
- prop="Name"
- label="会员名"
- >
- </el-table-column>
- <el-table-column
- prop="Phone"
- label="手机号"
- >
- </el-table-column>
- <el-table-column
- prop="ClassName"
- label="课程"
- sortable
- >
- <template slot-scope="scope">
- <span class="lessons" :style="{ background:scope.row.ClassColor }">{{scope.row.ClassName}}</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="NormalHour"
- label="消费课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="PreNormalhour"
- label="消费前课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="AfterNormalhour"
- label="消费后课时"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="GiftHour"
- label="消费赠送"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="PreGifthour"
- label="消费前赠送"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="AfterGifthour"
- label="消费后赠送"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="ShopName"
- label="所处门店"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="CreatedAt"
- label="时间"
- width="180"
- :formatter="filterFmtDate"
- sortable
- >
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- </div>
- <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible" width="1200px">
- <div class="dialogContent">
- <div class="pull-left">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="手机号">
- <el-input v-model="form.userCode"></el-input>
- </el-form-item>
- <el-form-item label="会员名">
- <el-input v-model="form.name"></el-input>
- </el-form-item>
- <el-form-item label="会员类型">
- <el-select v-model="form.memberType" placeholder="请选择所属门店">
- <el-option
- v-for="item in memberTypes"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="课时">
- <el-input-number v-model="form.lesson" :min="0" :max="99999" label="(天)"></el-input-number>
- </el-form-item>
- <el-form-item label="赠送课时">
- <el-input-number v-model="form.gift" :min="0" :max="99999" label="(天)"></el-input-number>
- </el-form-item>
- <el-form-item label="备注">
- <el-input v-model="form.memo"></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="pull-right">
- <el-form ref="form" :model="form" label-width="160px">
- <el-form-item label="会员课程">
- <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"></el-transfer>
- </el-form-item>
- </el-form>
- </div>
- </div>
- <div class="dialogFooter">
- <el-button type="primary" size="small" v-if="form.btnType == 0" @click="confirmMember">确定</el-button>
- <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
- </el-button>
- <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
- </div>
- </el-dialog>
- <el-dialog :visible.sync="dialogVisible">
- <div class="dialogTitle">
- <h5>
- 用户:
- <em class="blue">【 {{form.rowName}}】</em>
- <span v-if="dialogLesson">当前课时</span>
- <span v-if="dialogGift">当前赠送课时</span>
- <span v-if="dialogExpTime">当前到期时间</span>
- <span v-if="dialogLessonTable">当前会员课程</span>
- </h5>
- </div>
- <div v-if="dialogLesson">
- <el-input-number v-model="form.lesson" :min="0" :max="9999" label="课时调整"></el-input-number>
- </div>
- <div v-if="dialogGift">
- <el-input-number v-model="form.gift" :min="0" :max="9999" label="赠送课时调整"></el-input-number>
- </div>
- <div v-if="dialogExpTime">
- <el-date-picker
- v-model="form.expTime"
- type="date"
- placeholder="选择日期">
- </el-date-picker>
- </div>
- <div v-if="dialogLessonTable">
- <el-transfer filterable v-model="form.dialogValue" :data="form.dialogdata"></el-transfer>
- </div>
- <div class="dialogFooter">
- <!-- 当前课时-->
- <el-button type="primary" size="small" @click="confirmLesson" v-if="dialogLesson">确定</el-button>
- <el-button type="primary" size="small" @click="confirmGift" v-if="dialogGift">确定</el-button>
- <el-button type="primary" size="small" @click="confirmExpTime" v-if="dialogExpTime">确定</el-button>
- <el-button type="primary" size="small" @click="confirmLessonTable" v-if="dialogLessonTable">确定
- </el-button>
- <el-button size="small" @click="dialogVisible = false">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import {
- VipUserConsumeListQuery,
- testTable,
- testSelect,
- ClassListQuery,
- } from "../api/getApiRes";
- let qs = require('qs');
- export default {
- data() {
- return {
- dialogVisible: false,//其他dialog
- dialogMemberVisible: false,//新增会员dialog
- dialogLesson: false,//课时调整
- dialogGift: false,//赠送课时调整
- dialogExpTime: false,//有效期调整
- dialogLessonTable: false,//会员课程
- dialogTitle: '新增会员',
- dialogValue: [],
- // panel 配置项目
- panel: {
- name: '',
- phone: '',
- classId: '',
- usercode: '',
- username: '',
- timeScope: globalBt2(30),
- compname: '',
- keyword: '',
- USERCODE: '',
- endType: '',
- taskstatus: 99,
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: false,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- options: [],
- time1: globalBt(),
- },
- multipleSelection: [],
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 100,
- pageIndex: 1,
- },
- form: {
- name: '',
- userCode: '',
- shopId: '',
- memberType: 1,
- lesson: 1,
- gift: 1,
- btnType: 0,//0新建,1编辑编辑
- memo: '',
- expTime: '',
- dialogdata: [],//穿梭待选
- dialogValue: [],//穿梭已选
- },
- memberTypes: [
- {value: 1, label: '年会员'},
- {value: 2, label: '充值会员'},
- ],
- tableData: []
- }
- },
- mounted() {
- this.panelSelect();
- this.getTableQuery();
- },
- methods: {
- // 编辑
- editMember(row) {
- let that = this;
- this.clearForm();
- this.form.userCode = row.userCode;
- this.form.name = row.name;
- this.form.memberType = row.vipType;
- this.form.lesson = row.Recovered;
- this.form.gift = row.Recovered;
- this.form.memo = row.memo;
- this.form.btnType = 1;
- this.form.shopId = row.Id;
- this.dialogMemberVisible = true
- this.dialogTitle = '编辑会员'
- },
- // 禁用
- pauseRow(row) {
- let that = this;
- this.$confirm('是否禁用用户' + row.name + '?', '禁用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 0,
- };
- let postdata = qs.stringify(param);
- testTable(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '禁用成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消禁用'
- });
- });
- },
- // 启用
- runRow(row) {
- let that = this;
- this.$confirm('是否启用用户' + row.name + '?', '启用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let param = {
- token: localStorage.token,
- Id: row.Id,
- status: 1,
- };
- let postdata = qs.stringify(param);
- testTable(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: row.name + '启用成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消启用'
- });
- });
- },
- // 表格合计
- getSummaries(param) {
- const {columns, data} = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '合计';
- return;
- }
- const values = data.map(item => Number(item[column.property]));
- if (!values.every(value => isNaN(value)) && index != 0 && index != 1 && index != 2) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] += '';
- sums[index] = parseInt(sums[index]);
- } else {
- sums[index] = '';
- }
- });
- return sums;
- },
- // 关闭所有
- allDialogClose() {
- this.dialogVisible = false;
- this.dialogGift = false;
- this.dialogLesson = false;
- this.dialogExpTime = false;
- this.dialogLessonTable = false;
- },
- // 用户禁用 todo
- // 用户启用 todo
- // 有效期调整
- ExpTimeChange() {
- // 仅针对年费用户,使用日期格式
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- if (parseInt(row.vipType) == 2) {
- this.$message({
- showClose: true,
- message: '错了哦,充值会员不能调整有效期',
- type: 'error'
- });
- return false
- }
- this.form.expTime = row.expTime;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogExpTime = true;
- },
- // 课时调整
- lessonChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.lesson = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogLesson = true;
- },
- // 赠送调整
- giftChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.gift = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogGift = true;
- },
- // 增删会员课程
- lessonStudenChange() {
- this.allDialogClose();
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let row = this.tableRadio;
- this.form.gift = row.Recovered;
- this.form.rowName = row.name;
- this.dialogVisible = true;
- this.dialogLessonTable = true;
- },
- // 确认提交新增会员
- confirmMember() {
- let that = this;
- // checkNum
- if (!that.form.userCode) {
- this.$message.error('错了哦,手机号不能为空');
- return false
- }
- if (!globalCheckPhone(that.form.userCode)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (!that.form.name) {
- this.$message.error('错了哦,会员名不能为空');
- return false
- }
- if (that.form.name.length > 8) {
- this.$message.error('错了哦,会员名字数超过8个字');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- name: that.form.name,
- memberType: that.form.memberType,
- lesson: that.form.lesson,
- gift: that.form.gift,
- memo: that.form.memo,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '会员添加成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- confirmEditMember() {
- console.log(123);
- let that = this;
- // checkNum
- if (!that.form.userCode) {
- this.$message.error('错了哦,手机号不能为空');
- return false
- }
- console.log(that.form.userCode);
- if (!globalCheckPhone(that.form.userCode)) {
- this.$message.error('错了哦,手机号格式不正确');
- return false
- }
- if (!that.form.name) {
- this.$message.error('错了哦,会员名不能为空');
- return false
- }
- if (that.form.name.length > 8) {
- this.$message.error('错了哦,会员名字数超过8个字');
- return false
- }
- if (that.form.memo) {
- if (that.form.memo.length > 200) {
- this.$message.error('错了哦,备注字数超过200个字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- name: that.form.name,
- memberType: that.form.memberType,
- lesson: that.form.lesson,
- gift: that.form.gift,
- memo: that.form.memo,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogMemberVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '会员信息编辑成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交课时
- confirmLesson() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- lesson: that.form.lesson,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '课时调整成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交赠送
- confirmGift() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- gift: that.form.gift,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '赠送课时调整成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交有效期
- confirmExpTime() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- expTime: that.form.expTime,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '赠送课时调整成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 确认提交会员课程
- confirmLessonTable() {
- let that = this;
- // checkNum
- let param = {
- token: localStorage.token,
- userCode: that.form.userCode,
- dialogValue: that.form.dialogValue,
- };
- let postdata = qs.stringify(param);
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- // 关闭弹窗
- that.dialogVisible = false;
- // 重载列表
- that.getTableQuery();
- that.$message({
- showClose: true,
- message: '会员课程调整成功!',
- type: 'success'
- });
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 加载选项
- panelSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- ClassListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.panel.options = turnClassResToOption(json.Rs);
- that.panel.options.unshift({label: "全部", value: ''})
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 新增会员
- addMember() {
- this.clearForm();
- this.dialogMemberVisible = true
- this.btnType = 0;
- this.dialogTitle = '新增会员'
- },
- // 删除
- delList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- that.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length != 1) {
- that.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- let detectorid = that.tableRadio.Id;
- let param = {
- token: localStorage.token,
- detectorid: detectorid,
- status: 9,//0禁用1启用9删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该会员, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- testSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '选中的会员已删除!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 查询按钮
- query() {
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- clearForm() {
- // clear
- this.form.name = '';
- this.form.userCode = '';
- this.form.shopId = '';
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- // this.getGetChildRegionSelect(0, 1);
- that.loading = true;
- // 查询检测设备。上级区域id,区域id必传。regionid传0,查询supregionid对应所有子区域的检测设备。 如果supregionid,regionid都传0,默认查询企业ID下所有检测设备
- let param = {
- token: localStorage.token,
- classId: that.panel.classId,
- name: that.panel.name,
- phone: that.panel.phone,
- bt: nonTfmtDatetoLength(that.panel.timeScope[0], 10) + ' 00:00:01',
- et: nonTfmtDatetoLength(that.panel.timeScope[1], 10) + ' 23:59:59',
- start: 1,//
- tableMax: 9999,//
- };
- let postdata = qs.stringify(param);
- VipUserConsumeListQuery(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 导出excel
- btnExpAll() {
- let that = this;
- let url = headapi + '?ctl=ajax&mod=czgl&act=czcx_excel';//获取
- let bt = globaltime2String(that.panel.time1[0]);
- let et = globaltime2String(that.panel.time1[1]);
- let usercode = that.panel.usercode;
- window.location = url + '&bt=' + bt + '&et=' + et + '&usercode=' + usercode;
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- that.getTableQuery();
- },
- // 自动排序
- sortChange(params) {
- console.log(params)
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- return nonTfmtDate(column, 11);
- },
- // 过滤金额
- filterMoney(value, row, column) {
- let that = this;
- return parseFloat(column).toFixed(2);
- },
- },
- watch: {
- $route(to) {
- if (to.name == 'cost') {
- this.panelSelect();
- this.getTableQuery();
- }
- },
- },
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- .context {
- height: 770px;
- overflow-y: scroll;
- display: block;
- margin: 0 auto;
- background-color: #fff !important;
- padding: 30px;
- }
- .panel-body {
- padding: 20px;
- background: #F0F2F5;
- }
- .change {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-top: 10px;
- padding-bottom: 10px;
- }
- .change button {
- float: left;
- }
- .change button.pull-right {
- float: right;
- }
- .dialogTitle {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- color: #000000;
- font-size: 18px;
- text-align: center;
- }
- .dialogTitle em {
- float: none;
- font-style: normal;
- color: #3799FF;
- margin: 0;
- }
- /deep/ .el-transfer-panel__item .el-checkbox__input {
- left: 40px;
- }
- .dialogFooter {
- width: 90%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-top: 10px;
- }
- .dialogFooter button {
- float: right;
- margin-left: 10px;
- }
- .dialogContent {
- width: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .dialogContent .pull-left {
- width: 30%;
- float: left;
- }
- .dialogContent .pull-right {
- width: 70%;
- float: right;
- }
- .panel /deep/ .el-date-editor--daterange {
- /*width: 260px;*/
- }
- /deep/ .el-col-4 {
- width: 15% !important;
- }
- .panel /deep/ .el-input__inner {
- /*width: 130px;*/
- }
- .panel /deep/ .el-input {
- /*width: 130px;*/
- }
- .panel /deep/ .el-select {
- width: 130px;
- }
- /deep/ .el-date-editor .el-range-separator {
- line-height: 22px;
- }
- .lessons {
- padding: 1px 7px;
- border-radius: 250px;
- float: left;
- color: #000;
- }
- </style>
|