main #34
@ -7,6 +7,12 @@ import store from "@/store";
|
||||
import {myBalanceAPI} from "@/api/finance/customerRechargeManagement";
|
||||
import {testData} from "@/views/homePage/components/topBox/testData";
|
||||
|
||||
// 安全转换为字符串的辅助函数
|
||||
const safeToString = (value, defaultValue = '') => {
|
||||
if (value == null) return defaultValue;
|
||||
return value.toString();
|
||||
};
|
||||
|
||||
// 从sessionStorage恢复状态
|
||||
const getStoredState = () => {
|
||||
return {
|
||||
@ -75,9 +81,18 @@ const mutations = {
|
||||
state.userType = userType;
|
||||
sessionStorage.setItem("userType", userType);
|
||||
},
|
||||
// 新增:设置组织类型
|
||||
// 修复:设置组织类型 - 添加防御性检查
|
||||
SET_ORG_TYPE: (state, orgType) => {
|
||||
state.orgType = orgType;
|
||||
|
||||
// 防御性检查,确保 orgType 不为 null 或 undefined
|
||||
if (orgType == null) {
|
||||
console.warn('SET_ORG_TYPE: orgType is null or undefined, setting to empty string');
|
||||
sessionStorage.setItem("orgType", '');
|
||||
return;
|
||||
}
|
||||
|
||||
// 安全地调用 toString()
|
||||
sessionStorage.setItem("orgType", orgType.toString());
|
||||
},
|
||||
// 新增:设置用户角色
|
||||
@ -120,7 +135,8 @@ const actions = {
|
||||
const userRoles = org_type == 2 ? ['客户'] : ['管理员'];
|
||||
|
||||
commit("SET_USER_TYPE", userType);
|
||||
commit("SET_ORG_TYPE", org_type);
|
||||
// 确保 org_type 不为 undefined
|
||||
commit("SET_ORG_TYPE", org_type || '');
|
||||
commit("SET_ROLES", userRoles); // 新增:设置用户角色
|
||||
|
||||
console.log("登录用户类型:", userType, "org_type:", org_type, "用户角色:", userRoles);
|
||||
@ -171,7 +187,9 @@ const actions = {
|
||||
commit("SET_USER_TYPE", userType);
|
||||
}
|
||||
if (orgType) {
|
||||
commit("SET_ORG_TYPE", parseInt(orgType));
|
||||
// 确保 orgType 不为 null 或 undefined
|
||||
const safeOrgType = orgType ? parseInt(orgType) : '';
|
||||
commit("SET_ORG_TYPE", safeOrgType);
|
||||
}
|
||||
if (roles) {
|
||||
commit("SET_ROLES", JSON.parse(roles));
|
||||
@ -190,34 +208,28 @@ const actions = {
|
||||
// user logout
|
||||
logout({commit, state, dispatch}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// logout(state.token)
|
||||
// .then(() => {
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
||||
commit("SET_ORG_TYPE", ""); // 新增:清除组织类型
|
||||
commit("SET_USER", "");
|
||||
commit("SET_AUTHS", []);
|
||||
removeToken();
|
||||
resetRouter();
|
||||
commit("SET_TOKEN", "");
|
||||
commit("SET_ROLES", []);
|
||||
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
||||
commit("SET_ORG_TYPE", ""); // 新增:清除组织类型
|
||||
commit("SET_USER", "");
|
||||
commit("SET_AUTHS", []);
|
||||
removeToken();
|
||||
resetRouter();
|
||||
|
||||
// 清除sessionStorage
|
||||
sessionStorage.removeItem('user');
|
||||
sessionStorage.removeItem('auths');
|
||||
sessionStorage.removeItem('userType');
|
||||
sessionStorage.removeItem('orgType');
|
||||
sessionStorage.removeItem('mybalance');
|
||||
sessionStorage.removeItem('roles'); // 新增:清除角色信息
|
||||
// 清除sessionStorage
|
||||
sessionStorage.removeItem('user');
|
||||
sessionStorage.removeItem('auths');
|
||||
sessionStorage.removeItem('userType');
|
||||
sessionStorage.removeItem('orgType');
|
||||
sessionStorage.removeItem('mybalance');
|
||||
sessionStorage.removeItem('roles'); // 新增:清除角色信息
|
||||
|
||||
// reset visited views and cached views
|
||||
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||
dispatch("tagsView/delAllViews", null, {root: true});
|
||||
// reset visited views and cached views
|
||||
// to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
|
||||
dispatch("tagsView/delAllViews", null, {root: true});
|
||||
|
||||
resolve();
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// reject(error);
|
||||
// });
|
||||
resolve();
|
||||
});
|
||||
|
||||
},
|
||||
@ -272,3 +284,4 @@ export default {
|
||||
mutations,
|
||||
actions,
|
||||
};
|
||||
|
||||
@ -14,57 +14,57 @@
|
||||
|
||||
<!-- 展开行 - 客户详细信息 -->
|
||||
<el-table-column type="expand" align="center" header-align="center">
|
||||
<template>
|
||||
<template slot-scope="scope">
|
||||
<div class="customer-detail-panel">
|
||||
<h3 class="detail-title">客户详细信息</h3>
|
||||
<el-row :gutter="20" class="detail-grid">
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">客户名称</div>
|
||||
<div class="detail-value">{{ tableData.name || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.name) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">客户地址</div>
|
||||
<div class="detail-value">{{ tableData.address || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.address) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">统一社会信用代码</div>
|
||||
<div class="detail-value">{{ tableData.identityCode || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.identityCode) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">联系人</div>
|
||||
<div class="detail-value">{{ tableData.contact || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.contact) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">电话</div>
|
||||
<div class="detail-value">{{ tableData.tel || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.tel) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">邮箱</div>
|
||||
<div class="detail-value">{{ tableData.email || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.email) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">开户行</div>
|
||||
<div class="detail-value">{{ tableData.bankName || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.bankName) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">银行账号</div>
|
||||
<div class="detail-value">{{ tableData.bankAcc || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.bankAcc) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">发票抬头</div>
|
||||
<div class="detail-value">{{ tableData.identityName || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.identityName) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">发票联系电话</div>
|
||||
<div class="detail-value">{{ tableData.taxTel || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.taxTel) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">发票地址</div>
|
||||
<div class="detail-value">{{ tableData.taxAddress || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.taxAddress) || '--' }}</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||
<div class="detail-label">纳税人识别号</div>
|
||||
<div class="detail-value">{{ tableData.taxpayerIdentity || '--' }}</div>
|
||||
<div class="detail-value">{{ (scope.row.detailData && scope.row.detailData.taxpayerIdentity) || '--' }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@ -150,8 +150,15 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="购买状态" prop="productname" align="center" header-align="center" min-width="120">
|
||||
<!-- 购买状态逻辑可根据实际情况补充 -->
|
||||
<el-table-column label="购买状态" align="center" header-align="center" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="getBusinessOpType(scope.row.business_op)"
|
||||
effect="light"
|
||||
class="business-op-tag">
|
||||
{{ getBusinessOpText(scope.row.business_op) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
@ -188,37 +195,6 @@ export default {
|
||||
currentRow: {},
|
||||
expands: [],
|
||||
lookBillVisible: false,
|
||||
getRowKeys(row) {
|
||||
return row.id;
|
||||
},
|
||||
tableData: {
|
||||
address: "",
|
||||
ak: "",
|
||||
appId: "",
|
||||
bankAcc: "",
|
||||
bankName: "",
|
||||
contact: "",
|
||||
email: "",
|
||||
fullName: "",
|
||||
identityCode: "",
|
||||
identityName: "",
|
||||
name: "",
|
||||
remark: "",
|
||||
saleMgrEmail: "",
|
||||
saleMgrName: "",
|
||||
saleMgrTel: "",
|
||||
saleorgname: "",
|
||||
sk: "",
|
||||
supId: 1,
|
||||
taxAddress: "",
|
||||
taxTel: "",
|
||||
taxpayerIdentity: "",
|
||||
tel: "",
|
||||
thirdId: "",
|
||||
userAc: "",
|
||||
userPhone: "",
|
||||
userid: "",
|
||||
},
|
||||
current_page: 1,
|
||||
total: null,
|
||||
dataOne: null,
|
||||
@ -253,6 +229,9 @@ export default {
|
||||
this.dataTwo = end;
|
||||
},
|
||||
methods: {
|
||||
getRowKeys(row) {
|
||||
return row.id;
|
||||
},
|
||||
handleCurrentChange(index) {
|
||||
this.current_page = index;
|
||||
this.lookUp();
|
||||
@ -324,15 +303,20 @@ export default {
|
||||
if (row) {
|
||||
this.expands.push(row.id);
|
||||
|
||||
// 只在需要时请求数据
|
||||
var orgid = {
|
||||
orgid: row.id,
|
||||
};
|
||||
getZJUserInfoAPI(orgid).then((res) => {
|
||||
this.tableData = res.data;
|
||||
}).catch(error => {
|
||||
console.error("获取客户详情失败:", error);
|
||||
});
|
||||
// 如果该行还没有详情数据,则请求数据
|
||||
if (!row.detailData) {
|
||||
var orgid = {
|
||||
orgid: row.id,
|
||||
};
|
||||
getZJUserInfoAPI(orgid).then((res) => {
|
||||
// 使用 $set 确保响应式更新
|
||||
this.$set(row, 'detailData', res.data);
|
||||
}).catch(error => {
|
||||
console.error("获取客户详情失败:", error);
|
||||
// 即使请求失败,也设置一个空对象避免重复请求
|
||||
this.$set(row, 'detailData', {});
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.expands = [];
|
||||
@ -383,6 +367,32 @@ export default {
|
||||
};
|
||||
}
|
||||
},
|
||||
// 获取购买状态文本
|
||||
getBusinessOpText(businessOp) {
|
||||
switch (businessOp) {
|
||||
case 'BUY':
|
||||
return '购买';
|
||||
case 'BUY_REVERSE':
|
||||
return '退费';
|
||||
case 'RECHARGE ':
|
||||
return '续费';
|
||||
default:
|
||||
return businessOp || '--';
|
||||
}
|
||||
},
|
||||
// 获取购买状态标签类型
|
||||
getBusinessOpType(businessOp) {
|
||||
switch (businessOp) {
|
||||
case 'BUY':
|
||||
return 'success';
|
||||
case 'BUY_REVERSE':
|
||||
return 'danger';
|
||||
case 'RENEW':
|
||||
return 'primary';
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -514,6 +524,13 @@ export default {
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.business-op-tag {
|
||||
border-radius: 12px;
|
||||
padding: 0 10px;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user