updata
This commit is contained in:
parent
2382d3f671
commit
72a1659037
@ -7,6 +7,12 @@ import store from "@/store";
|
|||||||
import {myBalanceAPI} from "@/api/finance/customerRechargeManagement";
|
import {myBalanceAPI} from "@/api/finance/customerRechargeManagement";
|
||||||
import {testData} from "@/views/homePage/components/topBox/testData";
|
import {testData} from "@/views/homePage/components/topBox/testData";
|
||||||
|
|
||||||
|
// 安全转换为字符串的辅助函数
|
||||||
|
const safeToString = (value, defaultValue = '') => {
|
||||||
|
if (value == null) return defaultValue;
|
||||||
|
return value.toString();
|
||||||
|
};
|
||||||
|
|
||||||
// 从sessionStorage恢复状态
|
// 从sessionStorage恢复状态
|
||||||
const getStoredState = () => {
|
const getStoredState = () => {
|
||||||
return {
|
return {
|
||||||
@ -75,9 +81,18 @@ const mutations = {
|
|||||||
state.userType = userType;
|
state.userType = userType;
|
||||||
sessionStorage.setItem("userType", userType);
|
sessionStorage.setItem("userType", userType);
|
||||||
},
|
},
|
||||||
// 新增:设置组织类型
|
// 修复:设置组织类型 - 添加防御性检查
|
||||||
SET_ORG_TYPE: (state, orgType) => {
|
SET_ORG_TYPE: (state, orgType) => {
|
||||||
state.orgType = 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());
|
sessionStorage.setItem("orgType", orgType.toString());
|
||||||
},
|
},
|
||||||
// 新增:设置用户角色
|
// 新增:设置用户角色
|
||||||
@ -120,7 +135,8 @@ const actions = {
|
|||||||
const userRoles = org_type == 2 ? ['客户'] : ['管理员'];
|
const userRoles = org_type == 2 ? ['客户'] : ['管理员'];
|
||||||
|
|
||||||
commit("SET_USER_TYPE", userType);
|
commit("SET_USER_TYPE", userType);
|
||||||
commit("SET_ORG_TYPE", org_type);
|
// 确保 org_type 不为 undefined
|
||||||
|
commit("SET_ORG_TYPE", org_type || '');
|
||||||
commit("SET_ROLES", userRoles); // 新增:设置用户角色
|
commit("SET_ROLES", userRoles); // 新增:设置用户角色
|
||||||
|
|
||||||
console.log("登录用户类型:", userType, "org_type:", org_type, "用户角色:", userRoles);
|
console.log("登录用户类型:", userType, "org_type:", org_type, "用户角色:", userRoles);
|
||||||
@ -171,7 +187,9 @@ const actions = {
|
|||||||
commit("SET_USER_TYPE", userType);
|
commit("SET_USER_TYPE", userType);
|
||||||
}
|
}
|
||||||
if (orgType) {
|
if (orgType) {
|
||||||
commit("SET_ORG_TYPE", parseInt(orgType));
|
// 确保 orgType 不为 null 或 undefined
|
||||||
|
const safeOrgType = orgType ? parseInt(orgType) : '';
|
||||||
|
commit("SET_ORG_TYPE", safeOrgType);
|
||||||
}
|
}
|
||||||
if (roles) {
|
if (roles) {
|
||||||
commit("SET_ROLES", JSON.parse(roles));
|
commit("SET_ROLES", JSON.parse(roles));
|
||||||
@ -190,8 +208,6 @@ const actions = {
|
|||||||
// user logout
|
// user logout
|
||||||
logout({commit, state, dispatch}) {
|
logout({commit, state, dispatch}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// logout(state.token)
|
|
||||||
// .then(() => {
|
|
||||||
commit("SET_TOKEN", "");
|
commit("SET_TOKEN", "");
|
||||||
commit("SET_ROLES", []);
|
commit("SET_ROLES", []);
|
||||||
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
commit("SET_USER_TYPE", ""); // 新增:清除用户类型
|
||||||
@ -214,10 +230,6 @@ const actions = {
|
|||||||
dispatch("tagsView/delAllViews", null, {root: true});
|
dispatch("tagsView/delAllViews", null, {root: true});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
// })
|
|
||||||
// .catch((error) => {
|
|
||||||
// reject(error);
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -272,3 +284,4 @@ export default {
|
|||||||
mutations,
|
mutations,
|
||||||
actions,
|
actions,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -14,57 +14,57 @@
|
|||||||
|
|
||||||
<!-- 展开行 - 客户详细信息 -->
|
<!-- 展开行 - 客户详细信息 -->
|
||||||
<el-table-column type="expand" align="center" header-align="center">
|
<el-table-column type="expand" align="center" header-align="center">
|
||||||
<template>
|
<template slot-scope="scope">
|
||||||
<div class="customer-detail-panel">
|
<div class="customer-detail-panel">
|
||||||
<h3 class="detail-title">客户详细信息</h3>
|
<h3 class="detail-title">客户详细信息</h3>
|
||||||
<el-row :gutter="20" class="detail-grid">
|
<el-row :gutter="20" class="detail-grid">
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">客户名称</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">客户地址</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">统一社会信用代码</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">联系人</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">电话</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">邮箱</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">开户行</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">银行账号</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">发票抬头</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">发票联系电话</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">发票地址</div>
|
<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>
|
||||||
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
<el-col :xs="24" :sm="12" :md="8" class="detail-item">
|
||||||
<div class="detail-label">纳税人识别号</div>
|
<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-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
@ -150,8 +150,15 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
@ -188,37 +195,6 @@ export default {
|
|||||||
currentRow: {},
|
currentRow: {},
|
||||||
expands: [],
|
expands: [],
|
||||||
lookBillVisible: false,
|
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,
|
current_page: 1,
|
||||||
total: null,
|
total: null,
|
||||||
dataOne: null,
|
dataOne: null,
|
||||||
@ -253,6 +229,9 @@ export default {
|
|||||||
this.dataTwo = end;
|
this.dataTwo = end;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getRowKeys(row) {
|
||||||
|
return row.id;
|
||||||
|
},
|
||||||
handleCurrentChange(index) {
|
handleCurrentChange(index) {
|
||||||
this.current_page = index;
|
this.current_page = index;
|
||||||
this.lookUp();
|
this.lookUp();
|
||||||
@ -324,16 +303,21 @@ export default {
|
|||||||
if (row) {
|
if (row) {
|
||||||
this.expands.push(row.id);
|
this.expands.push(row.id);
|
||||||
|
|
||||||
// 只在需要时请求数据
|
// 如果该行还没有详情数据,则请求数据
|
||||||
|
if (!row.detailData) {
|
||||||
var orgid = {
|
var orgid = {
|
||||||
orgid: row.id,
|
orgid: row.id,
|
||||||
};
|
};
|
||||||
getZJUserInfoAPI(orgid).then((res) => {
|
getZJUserInfoAPI(orgid).then((res) => {
|
||||||
this.tableData = res.data;
|
// 使用 $set 确保响应式更新
|
||||||
|
this.$set(row, 'detailData', res.data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error("获取客户详情失败:", error);
|
console.error("获取客户详情失败:", error);
|
||||||
|
// 即使请求失败,也设置一个空对象避免重复请求
|
||||||
|
this.$set(row, 'detailData', {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.expands = [];
|
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>
|
</script>
|
||||||
@ -514,6 +524,13 @@ export default {
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
line-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