diff --git a/.env.development b/.env.development index 70e7c7a..9e539d9 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ MP_API_BASE_URL=https://patient.youcan365.com MP_CACHE_PREFIX=development MP_WX_APP_ID=wx6ee11733526b4f04 +MP_SHARE_WX_APP_VERSION=2 MP_TIM_SDK_APP_ID=1600126296 \ No newline at end of file diff --git a/pages/archive/archive-manage.vue b/pages/archive/archive-manage.vue index 5469370..7dcf993 100644 --- a/pages/archive/archive-manage.vue +++ b/pages/archive/archive-manage.vue @@ -58,13 +58,14 @@ const { useLoad, useShow } = useGuard(); const { account } = storeToRefs(useAccount()); const corpId = ref(''); const teamId = ref(''); -const corpUserId = ref('') +const corpUserId = ref(''); +const referenceCustomerId = ref(''); const enableHis = ref(false); const customers = ref([]); function addArchive() { uni.navigateTo({ - url: `/pages/archive/edit-archive?corpUserId=${corpUserId.value}&teamId=${teamId.value}&corpId=${corpId.value}` + url: `/pages/archive/edit-archive?corpUserId=${corpUserId.value}&referenceCustomerId=${referenceCustomerId.value}&teamId=${teamId.value}&corpId=${corpId.value}` }) } @@ -98,6 +99,7 @@ useLoad(options => { teamId.value = options.teamId; corpId.value = options.corpId; corpUserId.value = options.corpUserId; + referenceCustomerId.value = options.referenceCustomerId || ''; }) useShow(() => { diff --git a/pages/archive/edit-archive.vue b/pages/archive/edit-archive.vue index 807dfb3..8ef48e5 100644 --- a/pages/archive/edit-archive.vue +++ b/pages/archive/edit-archive.vue @@ -44,6 +44,7 @@ const { getExternalUserId } = useAccount() const corpId = ref(''); const corpName = ref(''); const corpUserId = ref(''); +const referenceCustomerId = ref(''); const customer = ref({}); const customerId = ref(''); const customers = ref([]); @@ -55,6 +56,7 @@ const teamId = ref(''); const tempRef = ref(null); const verifyVisible = ref(false); const visible = ref(false); +const referenceCustomer = ref(null) const formData = computed(() => { return { ...customer.value, ...form.value, mobile: account.value?.mobile } @@ -147,6 +149,15 @@ async function addArchive() { params.personResponsibles = [{ corpUserId, teamId: teamId.value }] } } + if (referenceCustomerId.value && !referenceCustomer.value) { + await getReferenceCustomer(); + } + if (referenceCustomer.value) { + params.referenceCustomerId = referenceCustomer.value._id; + params.referenceUserId = ''; + params.reference = referenceCustomer.value.name; + params.referenceType = '客户'; + } loading.value = false; const res = await api('addCustomer', { params }); if (res && res.success) { @@ -226,7 +237,7 @@ async function getBaseForm() { } async function getCustomer() { - const res = await api('getCustomerByCustomerId', { customerId: customerId.value }); + const res = await api('getRefrencePeople', { customerId: customerId.value }); if (res && res.success && res.data) { customer.value = res.data; setDisabledTitles(res.data) @@ -264,27 +275,25 @@ async function unBindArchive() { } } -// async updateCustomer() { -// if (Object.keys(this.form).length === 0) return this.editMemberId; -// const { success, message } = await updateCustomer( -// this.editMemberId, -// this.form -// ); -// if (success) return this.editMemberId; -// this.widget.hideLoading(); -// this.widget.toast(message); -// return Promise.reject(); -// }, +async function getReferenceCustomer() { + const res = await api('getRefrencePeople', { corpId: corpId.value, id: referenceCustomerId.value }); + referenceCustomer.value = res && res.data ? res.data : null; +} + onLoad(options => { + teamId.value = options.teamId; + corpId.value = options.corpId; customerId.value = options.id || ''; corpUserId.value = options.corpUserId || ''; + referenceCustomerId.value = options.referenceCustomerId || ''; + if (referenceCustomerId.value) { + getReferenceCustomer(); + } uni.setNavigationBarTitle({ title: customerId.value ? '编辑档案' : '新增档案' }) }) useLoad(options => { - teamId.value = options.teamId; - corpId.value = options.corpId; init(); }) diff --git a/pages/home/customer-archive.vue b/pages/home/customer-archive.vue index e62ff57..06f879a 100644 --- a/pages/home/customer-archive.vue +++ b/pages/home/customer-archive.vue @@ -86,6 +86,10 @@ const props = defineProps({ type: Object, default: () => ({}), }, + referenceCustomerIds: { + type: Object, + default: () => ({}), + }, customers: { type: Array, default: () => [], @@ -162,8 +166,9 @@ function toggle(i) { function toManagePage() { const corpUserId = props.corpUserIds && props.corpUserIds[props.team.teamId] ? props.corpUserIds[props.team.teamId] : ""; + const referenceCustomerId = props.referenceCustomerIds && props.referenceCustomerIds[props.team.teamId] ? props.referenceCustomerIds[props.team.teamId] : ""; uni.navigateTo({ - url: `/pages/archive/archive-manage?corpUserId=${corpUserId}&corpId=${props.corpId}&teamId=${props.team.teamId}`, + url: `/pages/archive/archive-manage?corpUserId=${corpUserId}&corpId=${props.corpId}&teamId=${props.team.teamId}&referenceCustomerId=${referenceCustomerId}`, }); } diff --git a/pages/home/home.vue b/pages/home/home.vue index 5c43a19..a739f63 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -5,8 +5,8 @@ - + @@ -26,7 +26,7 @@