This commit is contained in:
2025-09-19 10:25:44 +08:00
parent 5999a87725
commit 7fcb6e61ce
13 changed files with 664 additions and 120 deletions

BIN
dist.zip Normal file

Binary file not shown.

View File

@@ -17,6 +17,7 @@
"axios": "0.17.1", "axios": "0.17.1",
"babel-plugin-component": "0.10.1", "babel-plugin-component": "0.10.1",
"babel-polyfill": "6.26.0", "babel-polyfill": "6.26.0",
"dayjs": "^1.11.18",
"docx": "^9.5.1", "docx": "^9.5.1",
"element-ui": "^2.15.14", "element-ui": "^2.15.14",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",

View File

@@ -89,6 +89,7 @@ const mainRoutes = {
{ path: '/medicalrecords-userList', component: _import('modules/medicalrecords/userList'), name: 'medicalrecords-userList', meta: { title: '审核人员列表', isTab: true } }, { path: '/medicalrecords-userList', component: _import('modules/medicalrecords/userList'), name: 'medicalrecords-userList', meta: { title: '审核人员列表', isTab: true } },
{ path: '/vipList-userList', component: _import('modules/vipList/userList'), name: 'vipList-userList', meta: { title: 'VIP用户列表', isTab: true } }, { path: '/vipList-userList', component: _import('modules/vipList/userList'), name: 'vipList-userList', meta: { title: 'VIP用户列表', isTab: true } },
{ path: '/vipList-vipDetail', component: _import('modules/vipList/vipDetail'), name: 'vipList-vipDetail', meta: { title: 'VIP详情', isTab: true } }, { path: '/vipList-vipDetail', component: _import('modules/vipList/vipDetail'), name: 'vipList-vipDetail', meta: { title: 'VIP详情', isTab: true } },
{ path: '/reportList-vipList', component: _import('modules/reportList/vipList'), name: 'reportList-vipList', meta: { title: 'VIP报表', isTab: true } },
], ],
beforeEnter (to, from, next) { beforeEnter (to, from, next) {

View File

@@ -149,6 +149,7 @@
></mini-class> ></mini-class>
<!-- 学员管理 --> <!-- 学员管理 -->
<el-dialog <el-dialog
title="提示" title="提示"
:visible.sync="setStudentVisible" :visible.sync="setStudentVisible"
width="800px" width="800px"
@@ -157,7 +158,7 @@
<div> <div>
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-autocomplete <el-autocomplete
size="small" size="small" clearable
style="width: 100%;" style="width: 100%;"
v-model="addForm.userKey" v-model="addForm.userKey"
:fetch-suggestions="loadAll" :fetch-suggestions="loadAll"
@@ -349,6 +350,7 @@ export default {
async setStudent(data) { async setStudent(data) {
this.miniClass = data; this.miniClass = data;
var _classId = data.id; var _classId = data.id;
this.addForm = {};
var jieguo = await this.getCLassInfo(_classId) var jieguo = await this.getCLassInfo(_classId)
// console.log('jieguo',jieguo.data.code) // console.log('jieguo',jieguo.data.code)
if(jieguo.data.code == 0){ if(jieguo.data.code == 0){
@@ -415,6 +417,8 @@ export default {
}else{ }else{
this.$message.error("获取学员列表失败"); this.$message.error("获取学员列表失败");
} }
}else{
this.$message.error(data.msg);
} }
}); });
}else{ }else{

View File

@@ -6,8 +6,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button> <el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:transactiondetails:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> <!-- <el-button v-if="isAuth('book:transactiondetails:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
<el-button v-if="isAuth('book:transactiondetails:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> <!-- <el-button v-if="isAuth('book:transactiondetails:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table

View File

@@ -0,0 +1,344 @@
<template>
<div class="calendar" style="min-width: 1000px;overflow-x: auto;min-height: 100%;">
<div @click="handleExportAll()" style="position: absolute;left: 280px;top:35px;cursor: pointer;color: #006699;font-size: 14px;"><i class="el-icon-download"></i>下载 {{year}} 年全部报表</div>
<el-card class="box-card" v-for="(month, mIndex) in months"
:key="mIndex" >
<div slot="header" class="clearfix" >
<div style="color: #888;font-weight: 700;text-align: center;position: relative;font-size: 20px;">{{ monthNames[mIndex] }} <el-button @click="handleExport(mIndex)" style="float: right; padding: 3px 0;position: absolute;right: 0px;top: -2px;" type="text"><i class="el-icon-download"></i>下载报表</el-button>
</div>
</div>
<div class="days" style="margin-bottom: 15px;">
<!-- <div v-for="d in weekDays" :key="d" class="day header">{{ d }}</div> -->
<!-- <div v-for="blank in month.startWeek" :key="'b'+blank" class="day"></div> -->
<div v-for="d in list" :key="d" class="day header" style="margin-bottom: 10px;">{{ d.title }}</div>
<template v-if=" allMonthData[mIndex]&&allMonthData[mIndex].total">
<div v-for="d in list" :key="d" class="day" :style="`${d.val=='currentTanxiao'?'background-color:#ffdddd;color:#d00':''}`">{{
allMonthData[mIndex].total[d.val]
}}</div>
</template>
<div v-else>
-
</div>
<!-- <div
v-for="day in month.days"
:key="day.date"
template
:class="day.color"
>
{{ day.number }}
</div> -->
</div>
</el-card>
</div>
</template>
<script>
// 获取当年到当前月的所有月份数组
function getMonths(year) {
const now = new Date()
const currentYear = now.getFullYear()
const currentMonth = now.getMonth() + 1 // 月份从0开始
// 如果是今年只取到当前月否则取12个月
const endMonth = (year == currentYear) ? currentMonth-1 : 12
let months = []
for (let i = 1; i <= endMonth; i++) {
let monthStr = i < 10 ? "0" + i : i // 补零
months.push(`${monthStr}`)
}
return months
}
export default {
name: "FullYearCalendar",
props: {
year: {
type: Number,
default: new Date().getFullYear()
},
// 标记数据,例如:{ "2019-01-05": "red", "2019-03-12": "yellow" }
marks: {
type: Object,
default: () => ({})
}
},
data() {
return {
showCurrentMonth: '',
showCurrentMonthDate: '',
allMonthData: [],
list: [
{title:'收入',val:'fee'} ,
{title:'月摊销',val:'currentTanxiao'},
{title:'已摊销',val:'alreadyTanxiao'},
{title:'剩余摊销',val:'notyetTanxiao'},
],
weekDays: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
monthNames: [
"一", "二", "三", "四",
"五", "六", "七", "八",
"九", "十", "十 一", "十 二"
]
};
},
computed: {
// months() {
// let months = [];
// for (let m = 0; m < 12; m++) {
// let firstDay = new Date(this.year, m, 1);
// let lastDay = new Date(this.year, m + 1, 0);
// let daysInMonth = lastDay.getDate();
// let startWeek1 = (firstDay.getDay() + 6) % 7; // 转换为 Mon=0
// let startWeek = (firstDay.getDay() + 6) % 7; // 转换为 Mon=0
// let days = [];
// for (let d = 1; d <= daysInMonth; d++) {
// let dateStr = `${this.year}-${String(m+1).padStart(2,"0")}-${String(d).padStart(2,"0")}`;
// days.push({
// number: d,
// date: dateStr,
// color: this.marks[dateStr] || ""
// });
// }
// months.push({ startWeek, days });
// }
// return months;
// }
},
async created() {
await this.getMonthsByYear(this.year)
await this.fetchAllMonthData()
},
methods: {
async handleExportAll() {
const months = getMonths(this.year) // 例如 ["01","02",...,"09"]
this.$message({
message: "所有月份的VIP报表正在下载请耐心等待...",
type: "info",
duration: 6000,
showClose: true
});
// 构造请求数组
const requests = months.map(m => {
return this.$http({
url: this.$http.adornUrl("/master/userVip/exportUserVipLogInfo"),
method: "post",
data: this.$http.adornData({ date: `${this.year}-${m}` }),
responseType: "blob"
}).then(res => {
const filename = `VIP报表_${this.year}${m}月下载文件.xlsx`
const blob = new Blob([res.data], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
})
const link = document.createElement("a")
link.href = window.URL.createObjectURL(blob)
link.download = filename
link.click()
window.URL.revokeObjectURL(link.href)
return { month: m, success: true }
}).catch(() => {
return { month: m, success: false }
})
})
// 等待所有请求完成
const results = await Promise.all(requests)
// 统计成功/失败
const successMonths = results.filter(r => r.success).map(r => r.month)
const failMonths = results.filter(r => !r.success).map(r => r.month)
let message = `报表下载完成:成功 ${successMonths.length}`
if (failMonths.length > 0) {
message += `,失败 ${failMonths.length} 个(失败月份: ${failMonths.join("、")}`
}
this.$message({
message,
type: failMonths.length === 0 ? "success" : "warning",
duration: 5000,
showClose: true
});
},
async handleExport(mIndex) {
console.log('mIndex at line 120:', mIndex)
var filename = `VIP报表_${this.year}${this.pad(mIndex + 1)}月下载文件.xlsx`;
this.$message({
message: "请耐心等待...",
type: "info",
duration: 6000,
showClose: true
});
try {
this.$http({
url: this.$http.adornUrl(
"/master/userVip/exportUserVipLogInfo"
),
method: "post",
data: this.$http.adornData({
date: `${this.year}-${this.pad(mIndex + 1)}`
}),
responseType: "blob" // ⚡⚡⚡一定要加上
}).then(res => {
this.$message({
message: "VIP报表文件下载中下载完成后文件会自动下载请耐心等待...",
type: "info",
duration: 6000,
showClose: true
});
const blob = new Blob([res.data], {
type:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
});
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
link.click();
window.URL.revokeObjectURL(link.href); // 释放内存
this.$message({
message: "VIP报表文件下载完成,请注意查看!",
type: "success",
duration: 3000,
showClose: true
});
});
// const res = await axios.post(
// window.SITE_CONFIG.baseUrl+"/master/userContribution/exportContributionStatQuery",
// {
// current: this.current,
// limit: this.limit
// },
// {
// responseType: "blob" // 关键点:告诉 axios 返回的是二进制文件
// }
// );
} catch (err) {
this.$message.error("文件下载失败!");
// console.error("文件下载失败:", err);
}
},
async init(){
this.showCurrentMonth = ''
this.showCurrentMonthDate = ''
await this.getMonthsByYear(this.year)
await this.fetchAllMonthData()
},
getMonthsByYear(year) {
this.months = getMonths(year)
}
,pad(num) {
return num < 10 ? "0" + num : num
}
,
fetchAllMonthData() {
const loading = this.$loading({
lock: true,
text: "统计中",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
const year = this.year
const months = getMonths(year)
console.log('months', months)
// 构造请求数组
const requests = months.map(m => {
const monthNum = parseInt(m.split("-")[1]) // 拿到 1,2,3...
return this.$http({
url: this.$http.adornUrl("/master/userVip/getUserVipLogInfoTotal"),
method: "post",
data: this.$http.adornData({ date: `${year}-${m}` })
}).then(res => {
if (res.data && res.data.code === 0) {
return { month: monthNum, total: res.data.total }
} else {
return { month: monthNum, total: null, error: "获取失败" }
}
}).catch(err => {
return { month: monthNum, total: null, error: err.message || "请求出错" }
})
})
// 并发请求
Promise.all(requests).then(resArr => {
console.log("所有月份结果:", resArr)
loading.close()
this.allMonthData = resArr
if (this.year == new Date().getFullYear()) {
const now = new Date()
const year = now.getFullYear()
const month = this.pad(now.getMonth() + 1)
const day = this.pad(now.getDate())
this.showCurrentMonth = now.getMonth() + 1
console.log('this.showCurrentMonth at line 111:', this.showCurrentMonth)
this.showCurrentMonthDate = `${year}-${month}-${day}`
console.log('当前完整日期:', this.showCurrentMonthDate)
}
// resArr 是每个月接口返回结果的数组
}).catch(err => {
console.error("获取所有月份数据失败:", err)
loading.close()
})
}
},
};
</script>
<style scoped>
.calendar {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
.month {
background: #fff;
border: 1px solid #ddd;
border-radius: 6px;
padding: 10px;
text-align: center;
}
.month h3 {
margin: 0 0 5px;
font-size: 16px;
}
.days {
display: grid;
grid-template-columns: repeat(4, 1fr);
font-size: 16px;
}
.day {
text-align: center;
padding: 4px;
margin: 2px;
border-radius: 4px;
min-height: 20px;
}
.day.header {
font-weight: bold;
color: #555;
}
.day.red { background: #ffdddd; color: #d00; }
.day.blue { background: #ddeeff; color: #004; }
.day.yellow { background: #fff6cc; color: #665500; }
/deep/ .el-card .el-card__header{
padding: 8px 20px !important;
}
</style>

View File

@@ -0,0 +1,106 @@
<template>
<div class="mod-config">
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item>
<div class="block">
<el-date-picker
v-model="currentYear"
type="year"
format="yyyy"
value-format="yyyy" :picker-options="pickerOptions"
placeholder="选择年份"
@change="handleYearChange"
/>
</div>
</el-form-item>
<el-form-item>
<!-- <el-button
size="small"
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
> -->
<!-- <el-button
size="small"
plain
v-if="isAuth('book:user:save')"
type="danger"
@click="addOrUpdateHandle()"
>补录人工开通 VIP 记录</el-button
> -->
</el-form-item>
</el-form>
<FullYearCalendar ref="refCalendar" :year="Number(currentYear)" :marks="markedDates" v-if="currentYear" />
</div>
</template>
<script>
import FullYearCalendar from "./FullYearCalendar.vue";
export default {
data() {
return {
currentYear: '',
dataForm:{},
pickerOptions: {
disabledDate(time) {
// 禁用今年以后的年份
return time.getFullYear() > new Date().getFullYear()
}
},
markedDates: {
"2019-01-01": "red",
"2019-02-14": "blue",
"2019-03-12": "yellow",
"2019-05-20": "blue",
"2019-06-10": "yellow"
}
};
},
components: { FullYearCalendar },
activated() {
this.currentYear = new Date().getFullYear().toString();
this.handleYearChange();
},
methods: {
handleYearChange() {
this.$nextTick(() => {
this.$refs.refCalendar.init();
})
},
}
};
</script>
<style scoped>
/deep/ .mod-config .el-table .el-table__cell {
padding: 4px 0 !important;
box-sizing: border-box;
}
/deep/ .mod-config .el-table .cell,
.el-table th div {
padding: 0 !important;
box-sizing: border-box;
}
/deep/ .el-form .el-form-item{
margin-bottom:10px !important;
}
</style>

View File

@@ -55,12 +55,18 @@
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column <el-table-column
prop="relationId" prop="payMethod"
header-align="center" header-align="center"
align="center" align="center"
label="关联id"> label="支付方式">
</el-table-column> --> </el-table-column>
<el-table-column
prop="payNo"
header-align="center"
align="center"
label="交易流水号">
</el-table-column>
<el-table-column <el-table-column
prop="note" prop="note"
header-align="center" header-align="center"

View File

@@ -502,7 +502,7 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="adc" :visible.sync="adc"
append-to-body append-to-body
width="30%" width="1000px"
:before-close="closeDia" :before-close="closeDia"
> >
<el-form <el-form
@@ -543,17 +543,27 @@
> >
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="支付方式" class="coin_block">
<div>
<el-radio-group v-model="dataForm.payMethod" >
<el-radio label="微信">微信</el-radio>
<el-radio label="支付宝">支付宝</el-radio>
<el-radio label="银行支付">银行支付</el-radio>
<el-radio label="海外支付">海外支付</el-radio>
<!-- <el-radio label="其他">其他</el-radio> -->
</el-radio-group>
</div>
</el-form-item>
<el-form-item label="交易流水号"> <el-form-item label="交易流水号">
<el-input <el-input
v-model="pointForm.remark" v-model="pointForm.payNo"
placeholder="交易流水号" placeholder="交易流水号"
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="充明细"> <el-form-item label="充明细">
<el-input <el-input
type="textarea" type="textarea"
rows="5" rows="5"
@@ -930,7 +940,7 @@ export default {
this.$refs["pointForm"].validate(valid => { this.$refs["pointForm"].validate(valid => {
this.$http({ this.$http({
url: this.$http.adornUrl( url: this.$http.adornUrl(
`/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}` `/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark?this.pointForm.remark:''}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}`
), ),
method: "get", method: "get",
params: this.$http.adornParams() params: this.$http.adornParams()

View File

@@ -106,6 +106,15 @@
</el-radio-group> </el-radio-group>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="交易流水号" v-if="dataForm.payType == '微信'||'支付宝'">
<el-input
v-model="dataForm.orderSn"
placeholder="交易流水号"
>
</el-input>
</el-form-item>
<el-form-item label="金额" class="coin_block"> <el-form-item label="金额" class="coin_block">
<div> <div>
<el-input <el-input
@@ -160,7 +169,7 @@ export default {
pageType: "", //vip类型 pageType: "", //vip类型
type: "", //vip类型 type: "", //vip类型
year: "", year: "",
orderSn:'',
remark: "", remark: "",
fee: 0, //金额 fee: 0, //金额
jf: 0 //积分 jf: 0 //积分
@@ -213,7 +222,7 @@ export default {
pageType: "", //vip类型 pageType: "", //vip类型
type: "", //vip类型 type: "", //vip类型
year: "", year: "",
orderSn:'',
remark: "", remark: "",
fee: 0, //金额 fee: 0, //金额
jf: 0 //积分 jf: 0 //积分
@@ -274,6 +283,10 @@ export default {
}); });
}, },
payTypeChange(e){ payTypeChange(e){
if(this.dataForm.payType){
delete this.dataForm.orderSn;
}
console.log('e at line 261:', e) console.log('e at line 261:', e)
if (this.dataForm.payType == "海外支付") { if (this.dataForm.payType == "海外支付") {
this.dataForm.fee=0; this.dataForm.fee=0;
@@ -307,11 +320,16 @@ export default {
return; return;
} }
} }
if ((this.dataForm.payType == "微信" || this.dataForm.payType == "支付宝") && !this.dataForm.orderSn) {
this.$message.error("请输入交易流水号");
return;
}
var data = { var data = {
...this.dataForm, ...this.dataForm,
jf: this.dataForm.jf || 0, jf: this.dataForm.jf || 0,
fee: this.dataForm.fee || 0 fee: this.dataForm.fee || 0,
orderSn: this.dataForm.orderSn || '',
}; };
data.adminId = 1; data.adminId = 1;

View File

@@ -518,6 +518,14 @@ export default {
console.log("matchedData at line 508:", matchedData); console.log("matchedData at line 508:", matchedData);
if (matchedData && matchedData.length > 0) { if (matchedData && matchedData.length > 0) {
return matchedData[0].dayAmount; return matchedData[0].dayAmount;
}else{
const latest = data.userVipLogs.reduce((max, item) => {
return new Date(item.endTime) > new Date(max.endTime) ? item : max;
});
if (latest && latest.endTime) {
return latest.dayAmount;
}
} }
} else { } else {
return null; return null;
@@ -591,7 +599,7 @@ export default {
<span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${ <span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${
this.getVipPrice(e) != null this.getVipPrice(e) != null
? "¥" + this.getVipPrice(e) ? `<span style="${e.state == 0?'':'color:#c9bd50'}">¥${this.getVipPrice(e)}</span>${e.state == 0 ? "" : "<span style='color: #888;'> ( 已过期 ) </span>"}`
: '<i class="el-icon-close"></i>' : '<i class="el-icon-close"></i>'
}</span> }</span>
<span style="color: #888;margin-left: 20px;">有效期:${ <span style="color: #888;margin-left: 20px;">有效期:${
@@ -607,11 +615,11 @@ export default {
`<el-tag size="mini" type="info" style="text-align:center;width:76px;font-weight: bold; color: ${ `<el-tag size="mini" type="info" style="text-align:center;width:76px;font-weight: bold; color: ${
e.state == 0 ? "#fff" : "#888" e.state == 0 ? "#fff" : "#888"
};display:inline-block;margin-bottom: 6px; padding:0 6px; border-radius: 2px; font-size: 11px; background: ${ };display:inline-block;margin-bottom: 6px; padding:0 6px; border-radius: 2px; font-size: 11px; background: ${
e.state == 0 ? "#67c23a" : "#f0f0f0" e.state == 0 ? "#409EFF" : "#f0f0f0"
}" effect="dark">${vipMap[e.type]}</el-tag> }" effect="dark">${vipMap[e.type]}</el-tag>
<span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${ <span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${
this.getVipPrice(e) != null this.getVipPrice(e) != null
? "¥" + this.getVipPrice(e) ? `<span style="${e.state == 0?'':'color:#c9bd50'}">¥${this.getVipPrice(e)}</span>${e.state == 0 ? "" : "<span style='color: #888;'> ( 已过期 ) </span>"}`
: '<i class="el-icon-close"></i>' : '<i class="el-icon-close"></i>'
}</span> }</span>
<span style="color: #888;margin-left: 20px;">有效期:${ <span style="color: #888;margin-left: 20px;">有效期:${
@@ -627,13 +635,13 @@ export default {
`<el-tag size="mini" type="info" style="text-align:center;width:76px;font-weight: bold; color: ${ `<el-tag size="mini" type="info" style="text-align:center;width:76px;font-weight: bold; color: ${
e.state == 0 ? "#fff" : "#888" e.state == 0 ? "#fff" : "#888"
};display:inline-block;margin-bottom: 6px; background: ${ };display:inline-block;margin-bottom: 6px; background: ${
e.state == 0 ? "#00bcd4" : "#f0f0f0" e.state == 0 ? "#409EFF" : "#f0f0f0"
}; padding:0 6px; border-radius: 2px; font-size: 11px; " effect="dark">${ }; padding:0 6px; border-radius: 2px; font-size: 11px; " effect="dark">${
vipMap[e.type] vipMap[e.type]
}</el-tag> }</el-tag>
<span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${ <span style="color: #f94f04;margin-left: 20px;font-weight:700;display:inline-block;min-width:80px;text-align:center"> ${
this.getVipPrice(e) != null this.getVipPrice(e) != null
? "¥" + this.getVipPrice(e) ? `<span style="${e.state == 0?'':'color:#c9bd50'}">¥${this.getVipPrice(e)}</span>${e.state == 0 ? "" : "<span style='color: #888;'> ( 已过期 ) </span>"}`
: '<i class="el-icon-close"></i>' : '<i class="el-icon-close"></i>'
}</span> }</span>
<span style="color: #888;margin-left: 20px;">有效期:${ <span style="color: #888;margin-left: 20px;">有效期:${

View File

@@ -100,11 +100,11 @@
> >
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="orderSn" label="订单编号" width="180"> <el-table-column prop="orderSn" label="订单编号" width="280">
<template slot-scope="scope"> <template slot-scope="scope">
<span style="color:#888" v-if="scope.row.orderSn" <span style="color:#888" v-if="scope.row.orderSn">{{
>SN{{ scope.row.orderSn }}</span scope.row.orderSn
> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="startTime" label="开始时间" width="150"> <el-table-column prop="startTime" label="开始时间" width="150">
@@ -113,18 +113,19 @@
</el-table-column> </el-table-column>
<el-table-column prop="remark" label="备注"> </el-table-column> <el-table-column prop="remark" label="备注"> </el-table-column>
<el-table-column prop="remark" label="操作" width="80"> <el-table-column prop="remark" label="操作" width="110">
<template slot-scope="scope"> <template slot-scope="scope">
<span <span
style="margin-right: 4px;cursor: pointer;color: #67c23a;" style="margin-right: 4px;cursor: pointer;color: #67c23a;"
@click="handleEdit(scope.row, item)" @click="handleEdit(scope.row, item)"
>编辑</span >编辑</span
> >
<!-- <span <span
v-if="scope.row.type == 'master'"
style="color: red;cursor: pointer;" style="color: red;cursor: pointer;"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
>删除</span >删除</span
> --> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -157,8 +158,13 @@
</ul> </ul>
</div> </div>
<!-- 抽屉 --> <!-- 抽屉 -->
<el-dialog v-if="currentSheet && currentSheet.info" <el-dialog
:title="`${editType == 'add' ? '新增' : '编辑'} ${currentSheet.info.typeName} 明细`" v-if="currentSheet && currentSheet.info"
:title="
`${editType == 'add' ? '新增' : '编辑'} ${
currentSheet.info.typeName
} 明细`
"
:visible.sync="tracesShow" :visible.sync="tracesShow"
@close="drawerHandleClose" @close="drawerHandleClose"
append-to-body append-to-body
@@ -179,7 +185,12 @@
size="mini" size="mini"
style="display: flex;align-items: center;flex-wrap: wrap;position: relative;padding-top: 14px;" style="display: flex;align-items: center;flex-wrap: wrap;position: relative;padding-top: 14px;"
> >
<el-radio v-if="[11, 12,1,2,currentSheet.info.vipType].includes(option.value)" <el-radio
v-if="
[11, 12, 1, 2, currentSheet.info.vipType].includes(
option.value
)
"
:style="`${index == 1 ? '' : ''}`" :style="`${index == 1 ? '' : ''}`"
style="margin-left: 10px;display: inline-block;width: 140px;margin-bottom: 10px;" style="margin-left: 10px;display: inline-block;width: 140px;margin-bottom: 10px;"
v-for="(option, index) in typeList" v-for="(option, index) in typeList"
@@ -187,15 +198,13 @@
:label="option.value" :label="option.value"
> >
{{ option.label }} {{ option.label }}
</el-radio> </el-radio>
<el-tag style="position: absolute;top: -30px;left: 10px;" <el-tag
style="position: absolute;top: -30px;left: 10px;"
type="danger" type="danger"
v-if="[11, 12, 1, 2].includes(dataForm.vipType)" v-if="[11, 12, 1, 2].includes(dataForm.vipType)"
>选择此类型会同时生成多条VIP明细</el-tag >选择此类型会同时生成多条VIP明细</el-tag
> >
</el-radio-group> </el-radio-group>
<div v-if="editType == 'edit'"> <div v-if="editType == 'edit'">
@@ -205,15 +214,25 @@
<el-form-item label="VIP有效期" class="coin_block"> <el-form-item label="VIP有效期" class="coin_block">
<div> <div>
{{ currentSheet.startTime }} {{ currentSheet.startTime }}
<span style="padding: 0 10px;cursor: pointer;color: #006699;font-weight: bold;" @click="handleInsert('start',currentSheet.startTime)">插入</span> <span
style="padding: 0 10px;cursor: pointer;color: #006699;font-weight: bold;"
@click="handleInsert('start', currentSheet.startTime)"
>插入</span
>
<span style="padding: 0 10px;">至</span> <span style="padding: 0 10px;">至</span>
{{currentSheet.endTime }} <span style="padding: 0 10px;cursor: pointer;color: #006699;font-weight: bold;" @click="handleInsert('end',currentSheet.endTime)">插入</span> {{ currentSheet.endTime }}
<span
style="padding: 0 10px;cursor: pointer;color: #006699;font-weight: bold;"
@click="handleInsert('end', currentSheet.endTime)"
>插入</span
>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="明细有效期" class="coin_block"> <el-form-item label="明细有效期" class="coin_block">
<div> <div>
<el-date-picker size="mini" <el-date-picker
size="mini"
v-model="dataForm.startTime" v-model="dataForm.startTime"
type="datetime" type="datetime"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
@@ -224,7 +243,8 @@
</el-date-picker> </el-date-picker>
<span style="padding: 0 10px;">至</span> <span style="padding: 0 10px;">至</span>
<el-date-picker size="mini" <el-date-picker
size="mini"
v-model="dataForm.endTime" v-model="dataForm.endTime"
type="datetime" type="datetime"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
@@ -261,9 +281,19 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="订单号" :label="
dataForm.type == 'order'
? '订单号'
: dataForm.payType == '微信' || dataForm.payType == '支付宝'
? '交易流水号'
: '订单号'
"
class="coin_block" class="coin_block"
v-if="dataForm.type == 'order'" v-if="
dataForm.type == 'order' ||
dataForm.payType == '微信' ||
dataForm.payType == '支付宝'
"
> >
<div> <div>
<el-input <el-input
@@ -357,7 +387,8 @@ export default {
vipData: [], vipData: [],
orderList: [], orderList: [],
dataForm: { dataForm: {
key: "" key: "",
orderSn: ""
}, },
traces: [], // 物流轨迹 traces: [], // 物流轨迹
tracesShow: false, tracesShow: false,
@@ -420,54 +451,48 @@ export default {
methods: { methods: {
addYearsToTime(timeStr, yearsToAdd, type) { addYearsToTime(timeStr, yearsToAdd, type) {
// 1. 拆分时间字符串为「日期部分」和「时间部分」 // 1. 拆分时间字符串为「日期部分」和「时间部分」
const [datePart, timePart] = timeStr.split(' '); const [datePart, timePart] = timeStr.split(" ");
// 拆分日期为「年、月、日」,拆分时间为「时、分、秒」 // 拆分日期为「年、月、日」,拆分时间为「时、分、秒」
const [year, month, day] = datePart.split('-').map(Number); const [year, month, day] = datePart.split("-").map(Number);
const [hour, minute, second] = timePart.split(':').map(Number); const [hour, minute, second] = timePart.split(":").map(Number);
// 2. 构造 Date 对象注意Date 的月份是 0~11所以要减 1 // 2. 构造 Date 对象注意Date 的月份是 0~11所以要减 1
const date = new Date(year, month - 1, day, hour, minute, second); const date = new Date(year, month - 1, day, hour, minute, second);
// 3. 给年份加指定数值 // 3. 给年份加指定数值
if(type=='reduce'){ if (type == "reduce") {
date.setFullYear(date.getFullYear() - yearsToAdd); date.setFullYear(date.getFullYear() - yearsToAdd);
} else { } else {
date.setFullYear(date.getFullYear() + yearsToAdd); date.setFullYear(date.getFullYear() + yearsToAdd);
} }
// 4. 格式化 Date 对象为原字符串格式(补零保证两位) // 4. 格式化 Date 对象为原字符串格式(补零保证两位)
const newYear = date.getFullYear(); const newYear = date.getFullYear();
const newMonth = String(date.getMonth() + 1).padStart(2, '0'); // 月份加 1 后补零 const newMonth = String(date.getMonth() + 1).padStart(2, "0"); // 月份加 1 后补零
const newDay = String(date.getDate()).padStart(2, '0'); const newDay = String(date.getDate()).padStart(2, "0");
const newHour = String(date.getHours()).padStart(2, '0'); const newHour = String(date.getHours()).padStart(2, "0");
const newMinute = String(date.getMinutes()).padStart(2, '0'); const newMinute = String(date.getMinutes()).padStart(2, "0");
const newSecond = String(date.getSeconds()).padStart(2, '0'); const newSecond = String(date.getSeconds()).padStart(2, "0");
return `${newYear}-${newMonth}-${newDay} ${newHour}:${newMinute}:${newSecond}`; return `${newYear}-${newMonth}-${newDay} ${newHour}:${newMinute}:${newSecond}`;
}, },
handleYear(years) { handleYear(years) {
if (this.dataForm.startTime) { if (this.dataForm.startTime) {
const startTimeStr = this.dataForm.startTime; const startTimeStr = this.dataForm.startTime;
var endTime= this.addYearsToTime(startTimeStr,Number(years),'add') var endTime = this.addYearsToTime(startTimeStr, Number(years), "add");
console.log('endTime at line 447:', endTime) console.log("endTime at line 447:", endTime);
this.dataForm.endTime = endTime this.dataForm.endTime = endTime;
} else { } else {
this.$message.error("请选择开始时间"); this.$message.error("请选择开始时间");
return; return;
} }
}, },
handleInsert(type, time) { handleInsert(type, time) {
if(type == 'start'){ if (type == "start") {
this.dataForm.startTime = time this.dataForm.startTime = time;
} }
if(type == 'end'){ if (type == "end") {
this.dataForm.endTime = time this.dataForm.endTime = time;
} }
}, },
getUserInfo() { getUserInfo() {
@@ -491,11 +516,17 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
}); });
}, },
payTypeChange(e) { payTypeChange(e) {
console.log('e at line 261:', e) console.log("e at line 261:", e);
if(this.dataForm.payType){
delete this.dataForm.orderSn;
}
if (this.dataForm.payType == "海外支付") { if (this.dataForm.payType == "海外支付") {
this.dataForm.fee = 0; this.dataForm.fee = 0;
this.dataForm.jf = 0; this.dataForm.jf = 0;
} }
this.$forceUpdate();
}, },
dataFormSubmit() { dataFormSubmit() {
this.$refs["dataForm"].validate(valid => { this.$refs["dataForm"].validate(valid => {
@@ -514,14 +545,25 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
return; return;
} }
} }
if (!this.dataForm.payType) {
this.$message.error("请选择支付方式");
return;
}
if (this.dataForm.type == "order" && !this.dataForm.orderSn) { if (this.dataForm.type == "order" && !this.dataForm.orderSn) {
this.$message.error("请输入订单号"); this.$message.error("请输入订单号");
return; return;
} }
if (!this.dataForm.payType) {
this.$message.error("请输入支付方式"); if (
(this.dataForm.payType == "微信" ||
this.dataForm.payType == "支付宝") &&
!this.dataForm.orderSn &&
this.dataForm.type != "order"
) {
this.$message.error("请输入交易流水号");
return; return;
} }
if (this.dataForm.payType == "海外支付") { if (this.dataForm.payType == "海外支付") {
this.dataForm.fee = 0; this.dataForm.fee = 0;
this.dataForm.jf = 0; this.dataForm.jf = 0;
@@ -540,10 +582,10 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
...this.dataForm, ...this.dataForm,
jf: this.dataForm.jf || 0, jf: this.dataForm.jf || 0,
fee: this.dataForm.fee || 0, fee: this.dataForm.fee || 0,
userId: this.userInfo.id userId: this.userInfo.id,
orderSn: this.dataForm.orderSn || ""
}; };
if (this.editType == "add") { if (this.editType == "add") {
if (data.vipType == 1 || data.vipType == 2) { if (data.vipType == 1 || data.vipType == 2) {
data.userVipId = ""; data.userVipId = "";
@@ -609,7 +651,11 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
console.log("at line 274:", vipMap[data.type]); console.log("at line 274:", vipMap[data.type]);
this.currentSheet = { this.currentSheet = {
...data, ...data,
info: { type: "master", typeName: vipMap[data.type],vipType:data.type } info: {
type: "master",
typeName: vipMap[data.type],
vipType: data.type
}
}; };
this.dataForm = { this.dataForm = {
type: "master", type: "master",
@@ -651,21 +697,21 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
}; };
this.tracesShow = true; this.tracesShow = true;
}, },
handleDelete(data) { handleDelete(item) {
this.$confirm("确定要删除该明细吗?", "提示", { this.$confirm("确定要删除该明细吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
return;
this.$http({ this.$http({
url: this.$http.adornUrl("/book/point/delPoint"), url: this.$http.adornUrl("/master/userVip/delUserVipLogById"),
method: "post", method: "post",
data: this.$http.adornData({ data: this.$http.adornData({
pointId: item.id id: item.id
}) })
}).then(({ data }) => { }).then(({ data }) => {
console.log("data at line 668:", data);
if (data.code == 0) { if (data.code == 0) {
this.$message.success("删除成功"); this.$message.success("删除成功");
this.getData(); this.getData();
@@ -707,7 +753,7 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
`<span style="font-weight: bold; color: ${ `<span style="font-weight: bold; color: ${
data.state == 0 ? "#fff" : "#888" data.state == 0 ? "#fff" : "#888"
};display:inline-block;margin-bottom: 6px; padding:6px 10px; border-radius: 6px; font-size: 16px;background: ${ };display:inline-block;margin-bottom: 6px; padding:6px 10px; border-radius: 6px; font-size: 16px;background: ${
data.state == 0 ? "#67c23a" : "#f0f0f0" data.state == 0 ? "#409EFF" : "#f0f0f0"
};" effect="dark">${vipMap[type]}</span>` };" effect="dark">${vipMap[type]}</span>`
); );
} else if (type == 8) { } else if (type == 8) {
@@ -715,7 +761,7 @@ date.setFullYear(date.getFullYear() - yearsToAdd);
`<span style="font-weight: bold;color: ${ `<span style="font-weight: bold;color: ${
data.state == 0 ? "#fff" : "#888" data.state == 0 ? "#fff" : "#888"
};display:inline-block;margin-bottom: 6px; background: ${ };display:inline-block;margin-bottom: 6px; background: ${
data.state == 0 ? "#00bcd4" : "#f0f0f0" data.state == 0 ? "#409EFF" : "#f0f0f0"
}; padding:6px 10px; border-radius:6px; font-size: 16px; " effect="dark">${ }; padding:6px 10px; border-radius:6px; font-size: 16px; " effect="dark">${
vipMap[type] vipMap[type]
}</span>` }</span>`

View File

@@ -5,8 +5,8 @@
window.SITE_CONFIG = {}; window.SITE_CONFIG = {};
// api接口请求地址 // api接口请求地址
// window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境 window.SITE_CONFIG['baseUrl'] = 'https://api.nuttyreading.com'; // 线上正式环境
window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川 // window.SITE_CONFIG['baseUrl'] = 'http://192.168.110.100:9200/pb'; //川
// cdn地址 = 域名 + 版本号 // cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './'; // 域名 window.SITE_CONFIG['domain'] = './'; // 域名