Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f317e2960 | ||
|
|
196a67d6fd | ||
|
|
a3313064c0 | ||
|
|
ae2661ab26 | ||
|
|
c22f57b281 | ||
|
|
289e697330 | ||
|
|
2c9be532dd | ||
|
|
0378c0523c |
@ -10,7 +10,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button-footer :showCancel="customerId ? true : false" cancelText="删除" confirmText="保存" @cancel="unBindArchive()"
|
<button-footer :showCancel="customerId ? true : false" cancelText="删除" :confirmText="healthTypes.length?'下一步':'保存'" @cancel="unBindArchive()"
|
||||||
@confirm="confirm()" />
|
@confirm="confirm()" />
|
||||||
</template>
|
</template>
|
||||||
</full-page>
|
</full-page>
|
||||||
@ -57,6 +57,7 @@ const tempRef = ref(null);
|
|||||||
const verifyVisible = ref(false);
|
const verifyVisible = ref(false);
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const referenceCustomer = ref(null)
|
const referenceCustomer = ref(null)
|
||||||
|
const healthTypes = ref([]);
|
||||||
|
|
||||||
const formData = computed(() => {
|
const formData = computed(() => {
|
||||||
return { ...customer.value, ...form.value, mobile: account.value?.mobile }
|
return { ...customer.value, ...form.value, mobile: account.value?.mobile }
|
||||||
@ -164,7 +165,17 @@ async function addArchive() {
|
|||||||
set('home-invite-team-info', { teamId: teamId.value })
|
set('home-invite-team-info', { teamId: teamId.value })
|
||||||
if (res && res.success) {
|
if (res && res.success) {
|
||||||
uni.$emit('reloadTeamCustomers')
|
uni.$emit('reloadTeamCustomers')
|
||||||
getTeam(corpId.value, teamId.value, res.data.id);
|
// getTeam(corpId.value, teamId.value, res.data.id);
|
||||||
|
if (healthTypes.value.length) {
|
||||||
|
const nextType = healthTypes.value[0];
|
||||||
|
const nextTypes = healthTypes.value.slice(1);
|
||||||
|
const url = `/pages/health/record?type=${nextType}&teamId=${teamId.value}&corpId=${corpId.value}&customerId=${res.data.id}&nextTypes=${nextTypes.join(',')}&source=afterArchive`
|
||||||
|
uni.redirectTo({ url });
|
||||||
|
} else {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}&customerId=${res.data.id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
toast(res?.message || '新增档案失败');
|
toast(res?.message || '新增档案失败');
|
||||||
}
|
}
|
||||||
@ -205,6 +216,7 @@ async function init() {
|
|||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
getExternalUserId(corpId.value);
|
getExternalUserId(corpId.value);
|
||||||
|
getTeam(corpId.value, teamId.value)
|
||||||
}
|
}
|
||||||
await getBaseForm();
|
await getBaseForm();
|
||||||
if (!customerId.value) {
|
if (!customerId.value) {
|
||||||
@ -285,18 +297,18 @@ async function getTeam(corpId, teamId, customerId) {
|
|||||||
const team = res.data;
|
const team = res.data;
|
||||||
const qrcode = team && Array.isArray(team.qrcodes) ? team.qrcodes[0] : null;
|
const qrcode = team && Array.isArray(team.qrcodes) ? team.qrcodes[0] : null;
|
||||||
const healthTempList = qrcode && Array.isArray(qrcode.healthTempList) ? qrcode.healthTempList : [];
|
const healthTempList = qrcode && Array.isArray(qrcode.healthTempList) ? qrcode.healthTempList : [];
|
||||||
const types = healthTempList.filter(i => typeof i.templateType === 'string' && i.templateType.trim() && i.archiveRecommend === true).map(i => i.templateType);
|
healthTypes.value = healthTempList.filter(i => typeof i.templateType === 'string' && i.templateType.trim() && i.archiveRecommend === true).map(i => i.templateType);
|
||||||
if (types.length && customerId) {
|
// if (types.length && customerId) {
|
||||||
const nextType = types[0];
|
// const nextType = types[0];
|
||||||
const nextTypes = types.slice(1);
|
// const nextTypes = types.slice(1);
|
||||||
const url = `/pages/health/record?type=${nextType}&teamId=${teamId}&corpId=${corpId}&customerId=${customerId}&nextTypes=${nextTypes.join(',')}&source=afterArchive`
|
// const url = `/pages/health/record?type=${nextType}&teamId=${teamId}&corpId=${corpId}&customerId=${customerId}&nextTypes=${nextTypes.join(',')}&source=afterArchive`
|
||||||
uni.redirectTo({ url });
|
// uni.redirectTo({ url });
|
||||||
return
|
// return
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
// uni.redirectTo({
|
||||||
uni.redirectTo({
|
// url: `/pages/archive/archive-result?corpId=${corpId}&teamId=${teamId}&customerId=${customerId}`
|
||||||
url: `/pages/archive/archive-result?corpId=${corpId}&teamId=${teamId}&customerId=${customerId}`
|
// })
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button-footer v-if="canEdit" confirmText="保存" :showCancel="false" @confirm="confirm()" />
|
<button-footer v-if="canEdit" :confirmText="nextTypes.length ? '下一步' : '保存'" :showCancel="false"
|
||||||
|
@confirm="confirm()" />
|
||||||
</template>
|
</template>
|
||||||
</full-page>
|
</full-page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -83,7 +83,8 @@ const consultItems = ref([
|
|||||||
]);
|
]);
|
||||||
const hideMenus = computed(() => {
|
const hideMenus = computed(() => {
|
||||||
const result = {};
|
const result = {};
|
||||||
if (!props.team || !props.team.creator) {
|
// 非医助手团队
|
||||||
|
if (!(props.team && props.team.createSource === 'yzs')) {
|
||||||
result.chat = true;
|
result.chat = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -92,7 +93,7 @@ const hideMenus = computed(() => {
|
|||||||
function handleItemClick(item) {
|
function handleItemClick(item) {
|
||||||
// 聊天咨询需要选择咨询人
|
// 聊天咨询需要选择咨询人
|
||||||
if (item.needSelectConsultant) {
|
if (item.needSelectConsultant) {
|
||||||
if (!props.team || !props.team.creator) {
|
if (!(props.team && props.team.createSource === 'yzs')) {
|
||||||
return toast('该团队暂未开放咨询服务')
|
return toast('该团队暂未开放咨询服务')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -146,7 +146,7 @@ const hasHealthTemp = computed(
|
|||||||
() =>
|
() =>
|
||||||
qrcode.value &&
|
qrcode.value &&
|
||||||
Array.isArray(qrcode.value.healthTempList) &&
|
Array.isArray(qrcode.value.healthTempList) &&
|
||||||
qrcode.value.healthTempList.length > 0
|
qrcode.value.healthTempList.filter(i => i && i.enable).length > 0
|
||||||
);
|
);
|
||||||
const baseInfo = computed(() =>
|
const baseInfo = computed(() =>
|
||||||
qrcode.value &&
|
qrcode.value &&
|
||||||
|
|||||||
@ -15,7 +15,9 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
|
import useAccount from '@/store/account';
|
||||||
import api from "@/utils/api.js";
|
import api from "@/utils/api.js";
|
||||||
import { loading, toast, hideLoading } from "@/utils/widget";
|
import { loading, toast, hideLoading } from "@/utils/widget";
|
||||||
|
|
||||||
@ -24,6 +26,8 @@ import surveyCover from "./components/survey-cover.vue";
|
|||||||
import surveyQuestion from "./components/survey-question.vue";
|
import surveyQuestion from "./components/survey-question.vue";
|
||||||
import surveyRecord from "./components/survey-record.vue";
|
import surveyRecord from "./components/survey-record.vue";
|
||||||
|
|
||||||
|
const env = __VITE_ENV__;
|
||||||
|
const appid = env.MP_WX_APP_ID;
|
||||||
const corpId = ref('');
|
const corpId = ref('');
|
||||||
const surveryId = ref('');
|
const surveryId = ref('');
|
||||||
const answerId = ref('');
|
const answerId = ref('');
|
||||||
@ -32,7 +36,7 @@ const survey = ref(null);
|
|||||||
const emptyTxt = ref('')
|
const emptyTxt = ref('')
|
||||||
const customerName = ref('');
|
const customerName = ref('');
|
||||||
const step = ref('cover');
|
const step = ref('cover');
|
||||||
|
const { login, getExternalUserId } = useAccount();
|
||||||
const readonly = computed(() => survey.value && survey.value.submitTime);
|
const readonly = computed(() => survey.value && survey.value.submitTime);
|
||||||
const list = computed(() => survey.value && Array.isArray(survey.value.list) ? survey.value.list : []);
|
const list = computed(() => survey.value && Array.isArray(survey.value.list) ? survey.value.list : []);
|
||||||
const showList = computed(() => {
|
const showList = computed(() => {
|
||||||
@ -80,7 +84,8 @@ async function init() {
|
|||||||
async function getAnswerRecord() {
|
async function getAnswerRecord() {
|
||||||
const res = await api('getAnswer', { corpId: corpId.value, surveryId: surveryId.value, answerId: answerId.value, memberId: memberId.value });
|
const res = await api('getAnswer', { corpId: corpId.value, surveryId: surveryId.value, answerId: answerId.value, memberId: memberId.value });
|
||||||
if (res && res.success) {
|
if (res && res.success) {
|
||||||
return res.record
|
relateWxappp(res.record)
|
||||||
|
return res.record;
|
||||||
}
|
}
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
@ -108,17 +113,34 @@ async function submit({ list, score }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function relateWxappp(record) {
|
||||||
|
const { teamId, corpId, memberId } = record || {};
|
||||||
|
if (!(teamId && corpId && memberId)) return;
|
||||||
|
const account = await login();
|
||||||
|
const externalUserId = await getExternalUserId(corpId);
|
||||||
|
if (!externalUserId) return;
|
||||||
|
const res = await api('relateWxappTeamByExternalUserId', {
|
||||||
|
appid,
|
||||||
|
openid: account.openid,
|
||||||
|
teamId: teamId,
|
||||||
|
corpId: corpId,
|
||||||
|
memberId: memberId,
|
||||||
|
externalUserId: externalUserId,
|
||||||
|
})
|
||||||
|
console.clear()
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
|
||||||
onLoad(opts => {
|
onLoad(opts => {
|
||||||
corpId.value = opts.corpId;
|
corpId.value = opts.corpId;
|
||||||
surveryId.value = opts.surveryId;
|
surveryId.value = opts.surveryId;
|
||||||
answerId.value = opts.answerId;
|
answerId.value = opts.answerId;
|
||||||
memberId.value = opts.memberId;
|
memberId.value = opts.memberId;
|
||||||
customerName.value = opts.name;
|
customerName.value = decodeURIComponent(decodeURIComponent(opts.name || ''));
|
||||||
init();
|
init();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -157,6 +157,7 @@ export default defineStore("accountStore", () => {
|
|||||||
const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId }, false);
|
const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId }, false);
|
||||||
const id = res && res.success && typeof res.data === 'string' && res.data.trim() ? res.data.trim() : '';
|
const id = res && res.success && typeof res.data === 'string' && res.data.trim() ? res.data.trim() : '';
|
||||||
externalUserId.value = id;
|
externalUserId.value = id;
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(hasImCorpId, n => {
|
watch(hasImCorpId, n => {
|
||||||
|
|||||||
@ -6,6 +6,10 @@ export const CORP_API_BASE_URL_MAP = {
|
|||||||
wwa54dfba0b5441ef1: "https://crm.gykqyy.com/ykt/",
|
wwa54dfba0b5441ef1: "https://crm.gykqyy.com/ykt/",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CORP_ID_ALIAS_MAP = {
|
||||||
|
"wpLgjyawAAeRkCPQMp9-z5q-xEzK64nA": "wwa54dfba0b5441ef1",
|
||||||
|
};
|
||||||
|
|
||||||
function normalizeBaseUrl(url) {
|
function normalizeBaseUrl(url) {
|
||||||
return String(url || "").replace(/\/+$/, "");
|
return String(url || "").replace(/\/+$/, "");
|
||||||
}
|
}
|
||||||
@ -14,6 +18,11 @@ function getDefaultBaseUrl() {
|
|||||||
return normalizeBaseUrl(env.MP_API_BASE_URL);
|
return normalizeBaseUrl(env.MP_API_BASE_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeCorpId(corpId) {
|
||||||
|
const normalizedCorpId = String(corpId || "").trim();
|
||||||
|
return CORP_ID_ALIAS_MAP[normalizedCorpId] || normalizedCorpId;
|
||||||
|
}
|
||||||
|
|
||||||
function readCachedContext() {
|
function readCachedContext() {
|
||||||
if (typeof uni === "undefined" || typeof uni.getStorageSync !== "function") {
|
if (typeof uni === "undefined" || typeof uni.getStorageSync !== "function") {
|
||||||
return null;
|
return null;
|
||||||
@ -75,12 +84,12 @@ function parseQueryString(queryString) {
|
|||||||
export function getCorpIdFromAppOptions(options = {}) {
|
export function getCorpIdFromAppOptions(options = {}) {
|
||||||
const query = options.query || options || {};
|
const query = options.query || options || {};
|
||||||
const corpId = query.corpId || query.corpid || query.corp_id;
|
const corpId = query.corpId || query.corpid || query.corp_id;
|
||||||
if (corpId) return String(corpId).trim();
|
if (corpId) return normalizeCorpId(corpId);
|
||||||
|
|
||||||
if (typeof query.q === "string") {
|
if (typeof query.q === "string") {
|
||||||
const qParams = parseQueryString(safeDecode(query.q));
|
const qParams = parseQueryString(safeDecode(query.q));
|
||||||
const qCorpId = qParams.corpId || qParams.corpid || qParams.corp_id;
|
const qCorpId = qParams.corpId || qParams.corpid || qParams.corp_id;
|
||||||
if (qCorpId) return String(qCorpId).trim();
|
if (qCorpId) return normalizeCorpId(qCorpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -93,7 +102,7 @@ export function initApiContextFromAppOptions(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resolveApiContext(corpId) {
|
export function resolveApiContext(corpId) {
|
||||||
const normalizedCorpId = String(corpId || "").trim();
|
const normalizedCorpId = normalizeCorpId(corpId);
|
||||||
|
|
||||||
if (normalizedCorpId) {
|
if (normalizedCorpId) {
|
||||||
const configuredBaseUrl = CORP_API_BASE_URL_MAP[normalizedCorpId];
|
const configuredBaseUrl = CORP_API_BASE_URL_MAP[normalizedCorpId];
|
||||||
|
|||||||
@ -14,7 +14,8 @@ const urlsConfig = {
|
|||||||
getWxappRelateTeams: 'getWxappRelateTeams',
|
getWxappRelateTeams: 'getWxappRelateTeams',
|
||||||
getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName",
|
getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName",
|
||||||
getMiniAppHomeStats: "getMiniAppHomeStats",
|
getMiniAppHomeStats: "getMiniAppHomeStats",
|
||||||
getResponsiblePerson: 'getTeamResponsiblePerson'
|
getResponsiblePerson: 'getTeamResponsiblePerson',
|
||||||
|
relateWxappTeamByExternalUserId: 'relateWxappTeamByExternalUserId'
|
||||||
},
|
},
|
||||||
|
|
||||||
knowledgeBase: {
|
knowledgeBase: {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { loading, hideLoading } from "./widget";
|
import { loading, hideLoading } from "./widget";
|
||||||
import { buildApiUrl, getDefaultUploadUrl } from "./api-base-config";
|
import { buildApiUrl, getDefaultUploadUrl, normalizeCorpId } from "./api-base-config";
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
header: {
|
header: {
|
||||||
@ -96,6 +96,12 @@ async function refreshAccessToken() {
|
|||||||
const request = async (options = {}, showLoading = true) => {
|
const request = async (options = {}, showLoading = true) => {
|
||||||
// 合并用户传入的配置和默认配置
|
// 合并用户传入的配置和默认配置
|
||||||
if (!options.data) options.data = {};
|
if (!options.data) options.data = {};
|
||||||
|
if (options.data.corpId) {
|
||||||
|
options.data = {
|
||||||
|
...options.data,
|
||||||
|
corpId: normalizeCorpId(options.data.corpId),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
@ -201,12 +207,13 @@ export default request;
|
|||||||
export const uploadUrl = getDefaultUploadUrl();
|
export const uploadUrl = getDefaultUploadUrl();
|
||||||
|
|
||||||
export function getFullPath(path, corpId) {
|
export function getFullPath(path, corpId) {
|
||||||
return buildApiUrl(path, corpId);
|
return buildApiUrl(path, normalizeCorpId(corpId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function upload(path, corpId) {
|
export function upload(path, corpId) {
|
||||||
const currentUploadUrl = buildApiUrl("/upload", corpId);
|
const normalizedCorpId = normalizeCorpId(corpId);
|
||||||
|
const currentUploadUrl = buildApiUrl("/upload", normalizedCorpId);
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: currentUploadUrl,
|
url: currentUploadUrl,
|
||||||
@ -216,7 +223,7 @@ export function upload(path, corpId) {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
try {
|
try {
|
||||||
const url = JSON.parse(res.data).filePath;
|
const url = JSON.parse(res.data).filePath;
|
||||||
resolve(url ? getFullPath(url, corpId) : '')
|
resolve(url ? getFullPath(url, normalizedCorpId) : '')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user