diff --git a/pages.json b/pages.json
index db88402..ab14d00 100644
--- a/pages.json
+++ b/pages.json
@@ -262,6 +262,20 @@
"disableScroll": true
}
},
+ {
+ "path": "step-edit-archive",
+ "style": {
+ "navigationBarTitleText": "新增档案",
+ "disableScroll": true
+ }
+ },
+ {
+ "path": "fill-his-archive",
+ "style": {
+ "navigationBarTitleText": "完善信息",
+ "disableScroll": true
+ }
+ },
{
"path": "archive-result",
"style": {
diff --git a/pages/archive/archive-manage.vue b/pages/archive/archive-manage.vue
index dbb0eef..409049c 100644
--- a/pages/archive/archive-manage.vue
+++ b/pages/archive/archive-manage.vue
@@ -109,6 +109,15 @@ async function getMatchedHisArchive(data) {
customer.value = data;
corpName.value = res.corpName || '';
showBindHisPopup.value = true;
+ } else if (res && res.isCustomerInfoNotMatchQueryPlans) {
+ try {
+ await confirm('请完善信息', { cancelText: '取消', confirmText: '确认' });
+ uni.navigateTo({
+ url: `/pages/archive/fill-his-archive?teamId=${teamId.value}&corpId=${corpId.value}&id=${data._id}`
+ });
+ } catch (error) {
+ // 用户取消后停留在档案管理页。
+ }
} else {
confirm(res?.message || '获取档案信息失败', { showCancel: false })
}
@@ -133,6 +142,7 @@ useLoad(options => {
})
useShow(() => {
+ console.log('show~~~~~~')
if (teamId.value && corpId.value) {
getMembers()
}
diff --git a/pages/archive/edit-archive.vue b/pages/archive/edit-archive.vue
index 5387b66..c7cbede 100644
--- a/pages/archive/edit-archive.vue
+++ b/pages/archive/edit-archive.vue
@@ -10,8 +10,9 @@
-
+
+
{
+ if (customerId.value) {
+ return { ...customer.value, ...form.value }
+ }
return { ...customer.value, ...form.value, mobile: account.value?.mobile }
});
+const formItems = computed(() => {
+ return teamFormItems.value.map(i => {
+ if (i.title === 'mobile' && formData.value.mobile && formData.value.mobile === account.value?.mobile) {
+ return { ...i, appendText: '(授权手机号)' }
+ }
+ return i
+ })
+})
+
+const disableTitles = computed(() => {
+ const list = ['mobile'];
+ if (customer.value._id && customer.value.isConnectHis) {
+ list.push('name', 'idCard', 'sex', 'age', 'birthday')
+ }
+ return list
+})
+
function change({ title, value }) {
if (title) {
form.value[title] = value;
@@ -111,30 +134,6 @@ function preProcessFrom() {
}
}
-/**
- * 产品要求, 编辑的情况下 姓名、身份证号、性别、年龄、出生年月
- * 建档成功或者绑定档案成功后,姓名、身份证号、性别、年龄、出生年月。如果有内容的都不允许修改。没有内容的则允许编辑。
- */
-function setDisabledTitles(data) {
- const list = ['mobile'];
- if (data.name) {
- list.push('name');
- }
- if (data.idCard) {
- list.push('idCard');
- }
- if (data.sex) {
- list.push('sex');
- }
- if (data.age) {
- list.push('age');
- }
- if (data.birthday) {
- list.push('birthday');
- }
- disableTitles.value = list;
-}
-
async function addArchive() {
if (loading.value) return;
loading.value = true;
@@ -230,6 +229,10 @@ async function bindArchive(customerId) {
}
async function init() {
+ if (await initArchiveQueryConfig()) return;
+ if (referenceCustomerId.value) {
+ getReferenceCustomer();
+ }
if (customerId.value) {
await getCustomer();
} else {
@@ -251,6 +254,39 @@ async function init() {
}
+async function initArchiveQueryConfig() {
+ const res = await api('getCorpInfo', { corpId: corpId.value }, false);
+ const data = Array.isArray(res.data)
+ ? res.data[0]
+ : Array.isArray(res.data?.data)
+ ? res.data.data[0]
+ : res.data?.data || res.data || {};
+ const config = data.hisArchiveQueryConfig && typeof data.hisArchiveQueryConfig === 'object'
+ ? data.hisArchiveQueryConfig
+ : {};
+ const plans = Array.isArray(config.plans)
+ ? config.plans
+ : Array.isArray(config.schemes)
+ ? config.schemes
+ : [];
+ archiveQueryPlans.value = plans.filter(plan => plan && Array.isArray(plan.fields) && plan.fields.length);
+ if (archiveQueryPlans.value.length) {
+ redirectArchivePage('step-edit-archive');
+ return true;
+ }
+ return false;
+}
+
+function redirectArchivePage(page) {
+ const query = Object.entries(pageOptions.value)
+ .filter(([, value]) => value !== undefined && value !== null && value !== '')
+ .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)
+ .join('&');
+ uni.redirectTo({
+ url: `/pages/archive/${page}${query ? `?${query}` : ''}`
+ });
+}
+
async function getExperienceCouponBindArchive() {
const res = await api('getCustomerByCustomerId', { corpId: corpId.value, customerId: bindCustomerId.value });
const data = res && res.success && res.data ? res.data : null;
@@ -271,12 +307,7 @@ async function getArchives() {
async function getBaseForm() {
const res = await api('getTeamBaseInfo', { corpId: corpId.value, teamId: teamId.value });
if (res && res.success) {
- formItems.value = Array.isArray(res.data) ? res.data : [];
- const mobileIndex = formItems.value.findIndex(item => item.title === 'mobile');
- if (mobileIndex > -1) {
- formItems.value[mobileIndex].appendText = `(授权手机号)`;
- }
-
+ teamFormItems.value = Array.isArray(res.data) ? res.data : [];
} else {
toast(res?.message || '查询失败');
return Promise.reject()
@@ -287,7 +318,6 @@ async function getCustomer() {
const res = await api('getCustomerByCustomerId', { customerId: customerId.value });
if (res && res.success && res.data) {
customer.value = res.data;
- setDisabledTitles(res.data)
} else {
await toast(res?.message || '查询档案信息失败');
uni.navigateBack();
@@ -339,6 +369,7 @@ async function getTeam(corpId, teamId, customerId) {
onLoad(options => {
+ pageOptions.value = { ...options };
teamId.value = options.teamId;
corpId.value = options.corpId;
customerId.value = options.id || '';
@@ -347,9 +378,6 @@ onLoad(options => {
referenceCustomerId.value = options.referenceCustomerId || '';
source.value = options.source || '';
redirectUrl.value = options.redirectUrl || '';
- if (referenceCustomerId.value) {
- getReferenceCustomer();
- }
uni.setNavigationBarTitle({ title: customerId.value ? '编辑档案' : '新增档案' })
})
diff --git a/pages/archive/fill-his-archive.vue b/pages/archive/fill-his-archive.vue
new file mode 100644
index 0000000..62ea7f4
--- /dev/null
+++ b/pages/archive/fill-his-archive.vue
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/archive/step-edit-archive.vue b/pages/archive/step-edit-archive.vue
new file mode 100644
index 0000000..af56e14
--- /dev/null
+++ b/pages/archive/step-edit-archive.vue
@@ -0,0 +1,549 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/routes/index.js b/routes/index.js
index db6426b..101ec2d 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -48,6 +48,14 @@ export default [
path: 'pages/archive/edit-archive',
meta: { title: '新增档案', login: true }
},
+ {
+ path: 'pages/archive/step-edit-archive',
+ meta: { title: '新增档案', login: true }
+ },
+ {
+ path: 'pages/archive/fill-his-archive',
+ meta: { title: '完善信息', login: true }
+ },
{
path: 'pages/archive/archive-result',
meta: { title: '团队服务' }
diff --git a/utils/api.js b/utils/api.js
index d4ad2be..34d8c4a 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -90,6 +90,9 @@ const urlsConfig = {
bindHisArchive: 'bindHisArchive',
getMatchedHisArchive: 'getMatchedHisArchive',
},
+ customerHisSync: {
+ getHisCustomerArchive: 'getHisCustomerArchive',
+ },
wecom: {
addContactWay: 'getCorpFriendQrcode'
},
diff --git a/utils/http.js b/utils/http.js
index 7dcde85..d6bf871 100644
--- a/utils/http.js
+++ b/utils/http.js
@@ -173,6 +173,7 @@ const request = async (options = {}, showLoading = true) => {
return res.data;
}
return {
+ ...(res && res.data && typeof res.data === "object" ? res.data : {}),
success: false,
message: res.data && res.data.message ? res.data.message : "请求失败",
};