From 72454c3e8f686c1325fb265d59b8b63251bd17e2 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 16 五月 2025 16:14:14 +0800
Subject: [PATCH] 黑名单列表(添加移出)
---
manager/src/views/customer/customer-black/index.vue | 257 ++++++++++++++++++++++++++++++++++++++++++
manager/src/api/customer-black.js | 27 ++++
manager/src/views/customer/index.vue | 30 ++--
3 files changed, 300 insertions(+), 14 deletions(-)
diff --git a/manager/src/api/customer-black.js b/manager/src/api/customer-black.js
new file mode 100644
index 0000000..433fc16
--- /dev/null
+++ b/manager/src/api/customer-black.js
@@ -0,0 +1,27 @@
+import service from "@/libs/axios";
+
+// 鑾峰彇瀹㈡埛榛戝悕鍗曞垪琛�
+export const getCustomerBlackList = (params) => {
+ return service({
+ url: "/customer-black/page",
+ method: "GET",
+ params: params
+ })
+}
+
+// 娣诲姞瀹㈡埛榛戝悕鍗�
+export const addCustomerBlackByPC = (params) => {
+ return service({
+ url: "/customer-black",
+ method: "POST",
+ data: params
+ })
+}
+
+// 绉婚櫎瀹㈡埛榛戝悕鍗曞垪琛�
+export const delCustomerBlackById = (params) => {
+ return service({
+ url: "/customer-black/" + params,
+ method: "DELETE",
+ })
+}
diff --git a/manager/src/views/customer/customer-black/index.vue b/manager/src/views/customer/customer-black/index.vue
new file mode 100644
index 0000000..58d829d
--- /dev/null
+++ b/manager/src/views/customer/customer-black/index.vue
@@ -0,0 +1,257 @@
+<template>
+ <card>
+ <Form
+ ref="searchForm"
+ @keydown.enter.native="handleSearch"
+ :model="searchForm"
+ inline
+ :label-width="70"
+ class="search-form"
+ >
+ <Form-item label="鐢ㄦ埛鍚�" prop="username">
+ <Input
+ type="text"
+ v-model="searchForm.username"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ style="width: 160px"
+ />
+ </Form-item>
+ <Form-item label="鏄电О" prop="nickname">
+ <Input
+ type="text"
+ v-model="searchForm.nickName"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ style="width: 160px"
+ />
+ </Form-item>
+ <Form-item label="鍟嗗" prop="storeId">
+ <Select
+ v-model="searchForm.storeId"
+ style="width:160px"
+ :loading="storeSelectLoading"
+ class="custom-select"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ >
+ <Option
+ v-for="item in selectOptions"
+ :value="item.id"
+ :key="item.id"
+ >
+ {{ item.storeName }}
+ </Option>
+ </Select>
+ </Form-item>
+ <Button
+ @click="handleSearch"
+ type="primary"
+ icon="ios-search"
+ class="search-btn"
+ >鎼滅储</Button
+ >
+ </Form>
+ <Table
+ :loading="loading"
+ border
+ :columns="columns"
+ :data="customerBlackList"
+ ref="table"
+ sortable="custom"
+ @on-sort-change="changeSort"
+ @on-selection-change="showSelect"
+ >
+ <template slot-scope="{ row, index }" slot="action">
+ <Button type="error" size="small" style="margin-right: 5px" @click="removeBlack(row)">绉诲嚭榛戝悕鍗�</Button>
+ </template>
+ </Table>
+ <Row type="flex" justify="end" class="mt_10">
+ <Page
+ :current="searchForm.pageNumber"
+ :total="total"
+ :page-size="searchForm.pageSize"
+ @on-change="changePage"
+ @on-page-size-change="changePageSize"
+ :page-size-opts="[10, 20, 50]"
+ size="small"
+ show-total
+ show-elevator
+ show-sizer
+ ></Page>
+ </Row>
+ </card>
+</template>
+<script>
+import JsonExcel from "vue-json-excel";
+import {addCustomerBlackByPC,getCustomerBlackList,delCustomerBlackById} from "@/api/customer-black.js"
+import {getStoreSelectOptions} from "@/api/customer";
+export default {
+ name: 'customer-black',
+ components:{
+ "download-excel": JsonExcel,
+ },
+ data(){
+ return{
+ searchForm:{
+ storeId: '', //鍟嗗
+ username:'', //鐢ㄦ埛鍚�
+ nickName:'', // 鏄电О
+ pageNumber: 1, // 褰撳墠椤垫暟
+ pageSize: 10, // 椤甸潰澶у皬
+ },
+
+ loading:false,
+ columns: [
+ {
+ type: 'selection',
+ width: 60,
+ align: 'center'
+ },
+ {
+ title:'鐢ㄦ埛鍚�',
+ key: 'username',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'鏄电О',
+ key: 'nickName',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'鎬у埆',
+ key: 'sex',
+ tooltip: true,
+ render: (h, params) => {
+ const sexText = params.row.sex === 1 ? '鐢�' : '濂�';
+ return h('span', sexText);
+ }
+ },
+ {
+ title:'鍦板潃',
+ key: 'region',
+ minWidth: 60,
+ tooltip: true,
+ },
+ {
+ title:'鐘舵��',
+ key: 'disabled',
+ tooltip: true,
+ render: (h, params) => {
+ const sexText = params.row.disabled === true ? '绂佺敤' : '姝e父';
+ return h('span', sexText);
+ }
+ },
+ {
+ title: '鎿嶄綔',
+ key: 'action',
+ slot: 'action',
+ minWidth: 150,
+ align: 'center'
+ }
+
+ ],
+ total:0,
+ customerBlackList:[],
+ selectCount: 0, // 宸查�夋暟閲�
+ selectList: [], // 宸查�夋暟鎹垪琛�
+
+ //鍟嗗涓嬫媺妗嗘暟鎹�
+ selectOptions:[],
+ storeSelectLoading: false,
+ }
+ },
+ mounted() {
+ this.init()
+ },
+ methods:{
+ init(){
+ this.getCustomerBlackList()
+ this.getStoreSelectOptions()
+ },
+ getStoreSelectOptions(){
+ this.storeSelectLoading = true;
+ getStoreSelectOptions().then(res =>{
+ this.storeSelectLoading = false;
+ if (res.code === 200){
+ this.selectOptions = res.data;
+ }
+ })
+ },
+ getCustomerBlackList(){
+ this.loading = true;
+ getCustomerBlackList(this.searchForm).then(res =>{
+ this.loading = false;
+ if (res.code === 200) {
+ this.customerBlackList = res.data;
+ this.total = res.total;
+ }
+ })
+ },
+ handleSearch(){
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = 10;
+ this.getCustomerBlackList();
+ },
+ changePage(v){
+ this.searchForm.pageNumber = v
+ this.getCustomerBlackList()
+ },
+ // 淇敼size
+ changePageSize(v){
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = v;
+ this.getCustomerBlackList()
+ },
+ changeSort(){
+
+ },
+ showSelect(){
+ this.selectList = e.map(d => d.id);
+ this.selectCount = e.length;
+ },
+ removeBlack(row){
+ console.log(row)
+ delCustomerBlackById(row.id).then(res =>{
+ if (res.code === 200){
+ this.$Message.success("绉婚櫎鎴愬姛");
+ }
+ this.getCustomerBlackList();
+ })
+ }
+
+ }
+}
+</script>
+<style lang="scss" scoped>
+.export {
+ margin: 10px 20px 10px 0;
+}
+.export-excel-wrapper {
+ display: inline;
+}
+.order-tab {
+ width: 950px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background-color: #f0f0f0;
+ padding: 0 10px;
+ margin-bottom: 10px;
+ div {
+ text-align: center;
+ padding: 4px 12px;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ .current {
+ background-color: #ffffff;
+ }
+}
+</style>
diff --git a/manager/src/views/customer/index.vue b/manager/src/views/customer/index.vue
index 0076c30..40112e7 100644
--- a/manager/src/views/customer/index.vue
+++ b/manager/src/views/customer/index.vue
@@ -126,6 +126,7 @@
<script>
import JsonExcel from "vue-json-excel";
import {getCustomerList,addCustomerTag,saveCustomerTagById,getTagList,getStoreSelectOptions} from "@/api/customer";
+import {addCustomerBlackByPC} from "@/api/customer-black.js"
export default {
name:"customer",
@@ -243,7 +244,13 @@
},
//鍟嗗涓嬫媺妗嗘暟鎹�
selectOptions:[],
- storeSelectLoading: false
+ storeSelectLoading: false,
+
+ //榛戝悕鍗曡姹傚璞�
+ blackParam:{
+ storeId:'',
+ userId:'',
+ }
}
},
@@ -309,17 +316,6 @@
this.searchForm.pageSize = 10;
this.getCustomerList();
},
- // 鏂板鎴栦慨鏀�
- // saveOrUpdate() {
- // this.$refs.form.validate(valid => {
- // if (valid) {
- // this.submitLoading = true
- // // 鏂板
- // console.log(this.tagForm)
- //
- // }
- // });
- // },
handleSelectChange(newVal){
console.log(newVal)
this.getCustomerList()
@@ -348,8 +344,14 @@
this.searchForm.pageSize = v;
this.getCustomerList()
},
- joinBlack(){
-
+ joinBlack(row){
+ this.blackParam.storeId = row.storeId;
+ this.blackParam.userId = row.id;
+ addCustomerBlackByPC(this.blackParam).then(res =>{
+ if (res.code === 200){
+ this.$Message.success(res.msg);
+ }
+ })
},
--
Gitblit v1.8.0