This commit is contained in:
tx 2024-08-28 16:23:05 +08:00
commit bd3278c5d7
3 changed files with 176 additions and 52 deletions

View File

@ -179,7 +179,7 @@ import { listCoupon } from '@/api/system/coupon'
export default { export default {
name: "ClaimLog", name: "ClaimLog",
dicts: ['et_coupon_type', 'et_coupon_status','et_coupon_time_limit'], dicts: ['et_coupon_type', 'et_coupon_status','et_coupon_time_limit','et_coupon_gain_method','sys_normal_disable'],
data() { data() {
return { return {
// //

View File

@ -106,14 +106,14 @@
<el-table-column label="运营区" align="center" prop="areaName" /> <el-table-column label="运营区" align="center" prop="areaName" />
<!-- <el-table-column label="用户" align="center" prop="userName" />--> <!-- <el-table-column label="用户" align="center" prop="userName" />-->
<el-table-column label="抵扣金额" align="center" prop="discountAmount" :formatter="formatDiscountAmount"/> <el-table-column label="抵扣金额" align="center" prop="discountAmount" :formatter="formatDiscountAmount"/>
<el-table-column label="有效时间" align="center" prop="expirationTime" width="180"> <!-- <el-table-column label="有效时间" align="center" prop="expirationTime" width="180">-->
<template slot-scope="scope"> <!-- <template slot-scope="scope">-->
<span>{{ parseTime(scope.row.expirationTime, '{y}-{m}-{d}') }}</span> <!-- <span>{{ parseTime(scope.row.expirationTime, '{y}-{m}-{d}') }}</span>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.et_coupon_status" :value="scope.row.status"/> <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -191,7 +191,7 @@ import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon } from "@/api
export default { export default {
name: "Coupon", name: "Coupon",
dicts: ['et_coupon_type', 'et_coupon_status','et_coupon_time_limit'], dicts: ['et_coupon_type', 'et_coupon_status','et_coupon_time_limit','sys_normal_disable'],
data() { data() {
return { return {
// //

View File

@ -118,8 +118,8 @@
<el-table-column label="手机号" align="center" key="phonenumber" prop="phonenumber" v-if="columns[3].visible" width="120" /> <el-table-column label="手机号" align="center" key="phonenumber" prop="phonenumber" v-if="columns[3].visible" width="120" />
<el-table-column label="移动端" align="center" key="appName" prop="appName" v-if="columns[3].visible" width="120" /> <el-table-column label="移动端" align="center" key="appName" prop="appName" v-if="columns[3].visible" width="120" />
<el-table-column label="余额" align="center" key="balance" prop="balance" v-if="columns[4].visible" width="120" /> <el-table-column label="余额" align="center" key="balance" prop="balance" v-if="columns[4].visible" width="120" />
<el-table-column label="系统用户" align="center" key="userName" prop="sysUser.userName" v-if="columns[3].visible" width="120" /> <!-- <el-table-column label="系统用户" align="center" key="userName" prop="sysUser.userName" v-if="columns[3].visible" width="120" />-->
<el-table-column label="系统用户昵称" align="center" key="nickName" prop="sysUser.nickName" v-if="columns[3].visible" width="120" /> <!-- <el-table-column label="系统用户昵称" align="center" key="nickName" prop="sysUser.nickName" v-if="columns[3].visible" width="120" />-->
<el-table-column label="最后登录时间" align="center" prop="createTime" v-if="columns[5].visible" width="160"> <el-table-column label="最后登录时间" align="center" prop="createTime" v-if="columns[5].visible" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.loginDate) }}</span> <span>{{ parseTime(scope.row.loginDate) }}</span>
@ -145,30 +145,22 @@
<dict-tag :options="dict.type.et_user_is_authentication" :value="scope.row.isAuthentication" /> <dict-tag :options="dict.type.et_user_is_authentication" :value="scope.row.isAuthentication" />
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column--> <el-table-column
<!-- label="操作"--> label="操作"
<!-- align="center"--> align="center"
<!-- width="240"--> width="240"
<!-- class-name="small-padding fixed-width">--> class-name="small-padding fixed-width">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <el-button--> <el-button
<!-- size="mini"--> size="mini"
<!-- type="text"--> plain
<!-- icon="el-icon-circle-check"--> type="text"
<!-- @click="handleBandSysUser(scope.row)"--> icon="el-icon-present"
<!-- v-hasPermi="['system:user:edit']"--> @click="distributeCoupons(scope.row)"
<!-- >绑定系统用户</el-button>--> v-hasPermi="['system:user:edit']"
<!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">--> >派发优惠券</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>--> </template>
<!-- <el-dropdown-menu slot="dropdown">--> </el-table-column>
<!-- <el-dropdown-item command="handleResetPwd" icon="el-icon-key"-->
<!-- v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>-->
<!-- <el-dropdown-item command="handleBandSysUser" icon="el-icon-circle-check"-->
<!-- v-hasPermi="['system:user:edit']">绑定系统用户</el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
<pagination <pagination
@ -293,6 +285,70 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 添加或修改优惠券领取记录对话框 -->
<el-dialog :title="title3" :visible.sync="open3" width="1000px" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="运营区" prop="areaId">
<el-select v-model="queryParams.areaId" filterable placeholder="请选择运营区" clearable>
<el-option
v-for="item in areaOptions"
:key="item.areaId"
:label="item.areaName"
:value="item.areaId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable>
<el-option
v-for="dict in dict.type.et_coupon_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/></el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryCoupon">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-form-item label="用户" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户" />
</el-form-item>
<el-table v-loading="loading" :data="couponList" @selection-change="handleSelectionChange2">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="类型" align="center" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.et_coupon_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="限制次数" align="center" prop="limitNum">
<template slot-scope="scope">
<dict-tag :options="dict.type.et_coupon_time_limit" :value="scope.row.limitNum"/>
</template>
</el-table-column>
<el-table-column label="折扣比例" align="center" prop="discountPercent" :formatter="formatDiscountPercent"/>
<el-table-column label="运营区" align="center" prop="areaName" />
<el-table-column label="用户" align="center" prop="userName" width="120"/>
<el-table-column label="抵扣金额" align="center" prop="discountAmount" :formatter="formatDiscountAmount"/>
<el-table-column label="有效期" align="center" prop="validityValue" width="180">
<template slot-scope="scope">
<span>{{ formatValidity(scope.row)}}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel3"> </el-button>
</div>
</el-dialog>
<!-- 用户导入对话框 --> <!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload <el-upload
@ -329,10 +385,13 @@
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus,bandSystemUser } from "@/api/user/user"; import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus,bandSystemUser } from "@/api/user/user";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { listUser as getSysUserList } from "@/api/system/user"; import { listUser as getSysUserList } from "@/api/system/user";
import { listCoupon } from '@/api/system/coupon'
import { optionselect as getAreaOptionselect } from '@/api/system/area'
import { listClaimLog } from '@/api/system/claimLog'
export default { export default {
name: "User", name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex','et_user_is_authentication','et_asuser_role'], dicts: ['sys_normal_disable', 'sys_user_sex','et_user_is_authentication','et_asuser_role','et_coupon_type','et_coupon_time_limit','et_validity_unit'],
data() { data() {
return { return {
// //
@ -351,15 +410,20 @@ export default {
userList: null, userList: null,
// //
sysUserList: null, sysUserList: null,
areaOptions: [],
//
couponList: [],
sysUserOptions: null, sysUserOptions: null,
userId:null, userId:null,
role: null, role: null,
// //
title: "", title: "",
title3: "",
// //
open: false, open: false,
// //
open2: false, open2: false,
open3: false,
// //
initPassword: undefined, initPassword: undefined,
// //
@ -441,6 +505,7 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getAreaList();
this.getConfigKey("sys.user.initPassword").then(response => { this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg; this.initPassword = response.msg;
}); });
@ -449,6 +514,31 @@ export default {
}); });
}, },
methods: { methods: {
getAreaList() {
getAreaOptionselect().then(response => {
this.areaOptions = response.data;
});
},
formatValidity(row){
let selectDictLabel = this.selectDictLabel(this.dict.type.et_validity_unit, row.validityUnit)
if (selectDictLabel != null) {
return selectDictLabel === '月' ? row.validityValue +"个"+ selectDictLabel:row.validityValue + selectDictLabel
}
return "";
},
formatDiscountPercent(row, column, cellValue){
if (cellValue == null) {
return '';
}
const formattedValue = (cellValue * 100).toFixed(0) + '%';
return formattedValue;
},
formatDiscountAmount(row){
if (row.discountAmount === null || row.discountAmount === '') {
return '';
}
return row.discountAmount + '元';
},
/** 查询用户列表 */ /** 查询用户列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -485,6 +575,11 @@ export default {
this.open2 = false; this.open2 = false;
this.reset(); this.reset();
}, },
//
cancel3() {
this.open3 = false;
this.reset();
},
// //
reset() { reset() {
this.form = { this.form = {
@ -509,6 +604,14 @@ export default {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
handleQueryCoupon(){
this.loading = true;
listCoupon(this.queryParams).then(response => {
this.couponList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
@ -523,6 +626,12 @@ export default {
this.single = selection.length != 1; this.single = selection.length != 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
//
handleSelectionChange2(selection) {
this.ids = selection.map(item => item.couponId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
submitBand: function () { submitBand: function () {
console.log(this.form.userId) console.log(this.form.userId)
console.log(this.userId) console.log(this.userId)
@ -560,6 +669,16 @@ export default {
}); });
}).catch(() => {}); }).catch(() => {});
}, },
/** 派发优惠券 */
distributeCoupons(row){
this.userId = row.userId;
this.reset();
this.open3 = true;
this.title3 = "派发优惠券";
listCoupon(this.queryParams).then(response => {
this.couponList = response.rows;
});
},
/** 绑定系统用户 */ /** 绑定系统用户 */
handleBandSysUser(row){ handleBandSysUser(row){
this.reset(); this.reset();
@ -594,23 +713,28 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { const userId = this.ids;
if (valid) { console.log("userId==========",userId)
if (this.form.userId != undefined) { console.log("this.userId==========",this.userId)
updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false; // this.$refs["form"].validate(valid => {
this.getList(); // if (valid) {
}); // if (this.form.userId != undefined) {
} else { // updateUser(this.form).then(response => {
addUser(this.form).then(response => { // this.$modal.msgSuccess("");
this.$modal.msgSuccess("新增成功"); // this.open = false;
this.open = false; // this.getList();
this.getList(); // });
}); // } else {
} // addUser(this.form).then(response => {
} // this.$modal.msgSuccess("");
}); // this.open = false;
// this.getList();
// });
// }
// }
// });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {