Commit 87f83ce5 authored by zhengke's avatar zhengke

修改

parent f050e427
<style scoped>
.el-date-editor /deep/ .el-input__inner {
width: 100%;
border: none;
background-color: transparent;
}
</style>
<template>
<div>
123
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-2 Sysuser_Date">
<q-field filled dense>
 <template v-slot:control>
<el-date-picker v-model="msg.StartTime" size="mini" style="width:100%" type="date" placeholder="选择开始日期"
value-format="yyyy-MM-dd" @change="resetSearch">
</el-date-picker>    
</template>
</q-field>
</div>
<div class="col-2">
<q-field filled dense>
 <template v-slot:control>
<el-date-picker v-model="msg.EndTime" size="mini" style="width:100%" type="date" placeholder="选择结束日期"
value-format="yyyy-MM-dd" @change="resetSearch">
</el-date-picker>    
</template>
</q-field>
</div>
<div class="col-2" style="display:flex;align-items:center;">
<q-radio dense v-model="msg.Type" style="margin-right:20px;" @input="resetSearch" :val="1" label="存入" />
<q-radio dense v-model="msg.Type" :val="2" label="消费" @input="resetSearch" />
</div>
<div class="col-3" style="display:flex;align-items:center;">
<q-radio dense v-model="msg.BuyType" style="margin-right:20px;" @input="resetSearch" :val="1" label="免费的" />
<q-radio dense v-model="msg.BuyType" :val="2" label="使用购买的" @input="resetSearch" />
</div>
</div>
</div>
</template>
\ No newline at end of file
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="dataList" :columns="columns">
<template v-slot:top>
<div class="col-2 q-table__title">咖啡劵详情</div>
<q-space />
<div class="page-option">
<q-btn color="accent" class="q-mr-md" size="sm" icon="download" style="margin-top:15px;" label="下载"
@click="downloadStarBucks" />
</div>
</template>
<template v-slot:body-cell-Type="props">
<q-td :props="props">
{{props.row.Type==1?'存入':'消费'}}
</q-td>
</template>
<template v-slot:body-cell-BuyType="props">
<q-td :props="props">
<span v-if="props.row.BuyType==0">购买</span>
<span v-if="props.row.BuyType==1">免费的</span>
<span v-if="props.row.BuyType==2">使用购买的</span>
</q-td>
</template>
<template v-slot:body-cell-EmpType="props">
<q-td :props="props">
<span v-if="props.row.EmpType==1">员工</span>
<span v-if="props.row.EmpType==2">学员</span>
<span v-if="props.row.EmpType==3">来宾</span>
</q-td>
</template>
<template v-slot:body-cell-UserName="props">
<q-td :props="props">
<q-avatar rounded size="sm" v-if="props.row.UserIcon">
<img :src="props.row.UserIcon" />
</q-avatar>
<q-avatar rounded size="sm" color="teal-10" text-color="white" v-if="!props.row.UserIcon">
{{ props.row.UserName.substring(0, 1) }}
</q-avatar>
<span style="position:relative;top:2px;margin-left:2px;">{{ props.row.UserName }}</span>
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
</q-table>
</div>
</div>
</template>
<script>
export default {
meta: {
title: "咖啡券详情"
},
data() {
return {
msg: {
pageIndex: 1,
pageSize: 10,
rowsPerPage: 10,
StartTime: '',
EndTime: '',
Type: 2, //1存入 2消费
BuyType: 1 //使用类型 1免费的 2使用购买的
},
pageCount: 0,
dataList: [],
loading: true,
columns: [{
name: 'Type',
label: '类型',
field: 'Type',
align: 'left'
}, {
name: 'BuyType',
label: '使用类型',
field: 'BuyType',
align: 'left'
},
{
name: 'Number',
label: '数量',
align: 'left',
field: 'Number'
},
{
name: 'Remark',
label: '备注',
align: 'left',
field: 'Remark'
},
{
name: 'EmpType',
label: '员工类型',
align: 'left',
field: 'EmpType'
},
{
name: 'UserName',
label: '甲鹤用户名称',
align: 'left',
field: 'UserName'
},
{
name: 'EmpStuName',
label: '学生姓名',
align: 'left',
field: 'EmpStuName'
},
{
name: 'CreateByName',
label: '核销人',
align: 'left',
field: 'CreateByName'
},
{
name: 'CreateDate',
label: '时间',
field: 'CreateDate',
align: 'left'
}
],
}
},
mounted() {
if (this.$route.query) {
if (this.$route.query.Type == 1) {
this.msg.StartTime = this.$route.query.Date;
this.msg.EndTime = this.$route.query.Date;
}
if (this.$route.query.Type == 2) {
if (this.$route.query.Date) {
let year = this.$route.query.Date.split('-')[0];
let month = this.$route.query.Date.split('-')[1];
var firstDay = new Date(year, month - 1, 1);
var lastDay = new Date(year, month, 0);
this.msg.StartTime = this.getDateStr(firstDay);
this.msg.EndTime = this.getDateStr(lastDay);
}
}
if (this.$route.query.Type == 3) {
if (this.$route.query.Date) {
let year1 = new Date(this.$route.query.Date, 0, 1) //第一天
let year2 = new Date(this.$route.query.Date, 12, 0) //第一天
this.msg.StartTime = this.getDateStr(year1);
this.msg.EndTime = this.getDateStr(year2);
}
}
}
this.getList()
},
methods: {
getDateStr(dateStamp) {
var time = new Date(dateStamp);
var y = time.getFullYear();
var M = time.getMonth() + 1;
var d = time.getDate();
return y + '-' + M + '-' + d
},
getList() {
this.loading = true
this.apipostDS("/api/Coffee/GetCoffeeCouponsPageList", this.msg, (res) => {
this.loading = false
if (res.data.resultCode == 1) {
this.dataList = res.data.data.pageData;
this.pageCount = res.data.data.pageCount;
}
})
},
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.getList();
},
changePage(val) {
this.msg.pageIndex = val;
this.getList()
},
//获取下个月
getNextMonth(date) {
var arr = date.split('-');
var year = arr[0]; //获取当前日期的年份
var month = arr[1]; //获取当前日期的月份
var day = arr[2]; //获取当前日期的日
var days = new Date(year, month, 0);
days = days.getDate(); //获取当前日期中的月的天数
var year2 = year;
var month2 = parseInt(month) + 1;
if (month2 == 13) {
year2 = parseInt(year2) + 1;
month2 = 1;
}
var day2 = day;
var days2 = new Date(year2, month2, 0);
days2 = days2.getDate();
if (day2 > days2) {
day2 = days2;
}
if (month2 < 10) {
month2 = '0' + month2;
}
var t2 = year2 + '-' + month2 + '-' + day2;
return t2;
},
//下载导出星巴克
downloadStarBucks() {
this.loading = true;
var msg = JSON.parse(JSON.stringify(this.msg));
var dt1 = msg.EndTime;
var dt2 = msg.StartTime;
if(dt1!=null&&dt2!=null){
dt1 = dt1.split('-');
dt1 = parseInt(dt1[0])*12 + parseInt(dt1[1]);
dt2 = dt2.split('-');
dt2 = parseInt(dt2[0])*12 + parseInt(dt2[1]);
var num = Math.abs(dt1-dt2);
console.log(num);
if(num>30){
msg.EndTime = this.getNextMonth(msg.StartTime);
}
}
return
this.GetLocalFileDS("/api/Coffee/GetCoffeeCouponsListToExcel", {...msg}, "咖啡详情统计.xls")
this.loading = false;
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -43,7 +43,7 @@
<img :src="props.row.CreateByPhoto" />
</q-avatar>
<q-avatar rounded size="sm" color="teal-10" text-color="white" v-if="!props.row.CreateByPhoto">
{{ props.value.substring(0, 1) }}</q-avatar>
{{ props.row.CreateByName.substring(0, 1) }}</q-avatar>
{{ props.row.CreateByName }}
</q-td>
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment