Commit 7f28b354 authored by chenqikuai's avatar chenqikuai

fix: 接口调整,前端修复

parent 69319571
......@@ -3,6 +3,8 @@ module.exports = {
browser: true,
es2021: true,
"vue/setup-compiler-macros": true,
node: true,
commonjs: true,
},
extends: [
"eslint:recommended",
......
......@@ -19,13 +19,12 @@ export default defineComponent({
chatAuthCheck(
async () => {
const ret = await AddressService.getInstance().getNearby({
// eslint-disable-next-line no-undef
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 1,
});
if (ret.code === 200) {
goToChatWithOutletRoboot({
outletId: ret.data[0].outlet_id,
outletPosId: ret.data[0].pos_id,
});
}
},
......
......@@ -183,6 +183,10 @@ const props = defineProps({
opening_hours: String,
weekend_status: Number,
outlet_id: Number,
outlet_posId: {
type: String,
required: true,
},
});
const judgeWeekend = () => {
......@@ -285,11 +289,9 @@ const handleClickNagigate = () => {
};
const handleClickChatWithClientManager = async () => {
console.log(props.outlet_id, "show outlet id");
authCheck(async () => {
goToChatWithOutletRoboot({
outletId: props.outlet_id as number,
outletPosId: props.outlet_posId,
});
});
};
......
import { iOutLet, MyAppDatabase } from '.'
import { iOutLet, MyAppDatabase } from ".";
export default class OutletDBService {
static instance: OutletDBService
outlet: Dexie.Table<iOutLet, number>
static instance: OutletDBService;
outlet: Dexie.Table<iOutLet, number>;
static getInstance() {
if (!OutletDBService.instance)
OutletDBService.instance = new OutletDBService()
return OutletDBService.instance
OutletDBService.instance = new OutletDBService();
return OutletDBService.instance;
}
constructor() {
const db = new MyAppDatabase()
this.outlet = db.outlet
const db = new MyAppDatabase();
this.outlet = db.outlet;
}
add(outlet: iOutLet) {
return this.outlet.add(outlet)
return this.outlet.add(outlet);
}
update(outlet: Partial<Omit<iOutLet, 'id'>> & Pick<iOutLet, 'id'>) {
return this.outlet.update(outlet.id, outlet)
update(outlet: Partial<Omit<iOutLet, "id">> & Pick<iOutLet, "posId">) {
return this.outlet
.filter((i) => i.posId === outlet.posId)
.modify((i) => {
outlet.name && (i.name = outlet.name);
outlet.isDeleted && (i.isDeleted = outlet.isDeleted);
});
}
delete(id: number) {
return this.outlet.delete(id)
return this.outlet.delete(id);
}
get(id: number) {
return this.outlet.get(id)
get(posId: string) {
return this.outlet.filter((i) => i.posId === posId).first();
}
}
......@@ -18,7 +18,7 @@ export interface iChatListCard {
}
export interface iOutLet {
id: number;
posId: string;
name: string;
isDeleted?: boolean;
}
......@@ -33,14 +33,14 @@ export class MyAppDatabase extends Dexie {
constructor() {
super("MyAppDatabase");
this.version(1.5).stores({
this.version(1.7).stores({
chatMessage:
"++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed",
chatListCard:
"++id, masterId, targetId, unreadMsgCount, content, inChat, isRobootCard,isDeleted",
contactPerson: "++id, addr, bank, phone, user_name, out_let_name",
userInfo: "++id, created_at, phone, remark, user_name, uuid, addr",
outlet: "id, name, isDeleted",
outlet: "posId, name, isDeleted",
});
this.chatMessage = this.table("chatMessage");
......
import router from '.'
import router from ".";
export function goToChatWithOutletRoboot(data: { outletId: number }) {
export function goToChatWithOutletRoboot(data: { outletPosId: string }) {
router.push({
name: 'Chat',
name: "Chat",
query: {
targetId: data.outletId,
outlet: 'true',
targetId: data.outletPosId,
outlet: "true",
},
})
});
}
export function gotoChatWithStaff(data: { address: string; beginChat?: boolean }) {
export function gotoChatWithStaff(data: {
address: string;
beginChat?: boolean;
}) {
router.push({
name: 'Chat',
name: "Chat",
query: {
targetId: data.address,
beginChat: data.beginChat ? 'true' : undefined,
beginChat: data.beginChat ? "true" : undefined,
},
})
});
}
......@@ -56,15 +56,15 @@ class AddressService {
});
}
getOutlet(data: { outlet_name?: string; id?: number }) {
getOutlet(data: { outlet_name?: string; pos_id?: string }) {
const theData = {
bank_code: Number(process.env.VUE_APP_BANK_CODE),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
if (data.outlet_name) {
theData.outlet_name = data.outlet_name;
} else if (data.id !== undefined) {
theData.id = data.id;
} else if (data.pos_id !== undefined) {
theData.pos_id = data.pos_id;
}
return baseAxios<iOutLetDetail>({
url: "/address/getOutlet",
......
......@@ -10,7 +10,7 @@ class UserService {
return UserService.instance;
}
contact_custom_service(data: { outLetID: number }) {
contact_custom_service(data: { outLetID: string }) {
return baseAxios<iContact>({
url: "/user/contact_custom_service",
method: "post",
......
......@@ -64,17 +64,17 @@ export const getDisplayNamesFromAddress = async (
};
/* 获取网点名称 */
export const getDisplayNamesFromOutletId = async (outletids: number[]) => {
const promiseList = outletids.map(async (id) => {
export const getDisplayNamesFromOutletId = async (outletPosId: string[]) => {
const promiseList = outletPosId.map(async (id) => {
const outlet = await OutletDBService.getInstance().get(id);
if (!outlet) {
const ret = await AddressService.getInstance().getOutlet({
id,
pos_id: id,
});
if (ret.code === 200) {
await OutletDBService.getInstance().add({
name: ret.data.outlet_name,
id: ret.data.id,
posId: ret.data.pos_id,
});
return ret.data.outlet_name;
}
......@@ -82,17 +82,17 @@ export const getDisplayNamesFromOutletId = async (outletids: number[]) => {
!outlet.isDeleted &&
AddressService.getInstance()
.getOutlet({
id,
pos_id: id,
})
.then((ret) => {
if (ret.code === 200) {
OutletDBService.getInstance().update({
name: ret.data.outlet_name,
id: ret.data.id,
posId: ret.data.pos_id,
});
} else {
OutletDBService.getInstance().update({
id,
posId: id,
isDeleted: true,
});
}
......@@ -105,11 +105,11 @@ export const getDisplayNamesFromOutletId = async (outletids: number[]) => {
};
export const getDisplayNames = async (
list: { outletId?: number; address?: string }[]
list: { outletPosId?: string; address?: string }[]
) => {
const promiseList = list.map((i) => {
if (i.outletId !== undefined) {
return getDisplayNamesFromOutletId([i.outletId]).then((ret) => ret[0]);
if (i.outletPosId !== undefined) {
return getDisplayNamesFromOutletId([i.outletPosId]).then((ret) => ret[0]);
} else if (i.address !== undefined) {
return getDisplayNamesFromAddress([i.address]).then((ret) => ret[0]);
} else return "";
......
......@@ -153,7 +153,7 @@ export default defineComponent({
if (serviceShowValue.value === "人工服务") {
questionSelected.value = false;
const ret = await UserService.getInstance().contact_custom_service({
outLetID: Number(route.query.targetId) as number,
outLetID: route.query.targetId as string,
});
if (ret.code === 200) {
gotoChatWithStaff({
......@@ -203,7 +203,7 @@ export default defineComponent({
const handleClickCall = async () => {
if (isChatWithRoboot.value) {
const ret = await UserService.getInstance().contact_custom_service({
outLetID: Number(target) as number,
outLetID: target,
});
if (ret.code === 200) {
callPhone.value = ret.data.phone;
......@@ -311,7 +311,7 @@ export default defineComponent({
// console.log(isChatWithRoboot.value, "show isChatWithRoboot");
if (isChatWithRoboot.value) {
const list = await getDisplayNames([
{ outletId: Number(route.query.targetId) },
{ outletPosId: route.query.targetId as string },
]);
title.value = list[0] as string;
} else {
......
......@@ -78,7 +78,6 @@ export default defineComponent({
const fetchBranch = async () => {
state.loading = true;
const ret = await AddressService.getInstance().getNearby({
// eslint-disable-next-line no-undef
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 1,
});
......@@ -143,13 +142,12 @@ export default defineComponent({
const getOutletAndNavigateToChat = async () => {
const ret = await AddressService.getInstance().getNearby({
// eslint-disable-next-line no-undef
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 1,
});
if (ret.code === 200) {
goToChatWithOutletRoboot({
outletId: ret.data[0].outlet_id,
outletPosId: ret.data[0].pos_id,
});
}
};
......@@ -302,6 +300,7 @@ export default defineComponent({
opening_hours={state.outletList[0].opening_hours}
weekend_status={state.outletList[0].weekend_status}
outlet_id={state.outletList[0].outlet_id}
outlet_posId={state.outletList[0].pos_id}
/>
)}
</Skeleton>
......
......@@ -32,6 +32,7 @@
:opening_hours="result.topItem.opening_hours"
:weekend_status="result.topItem.weekend_status"
:outlet_id="result.topItem.outlet_id"
:outlet_posId="result.topItem.pos_id"
class="mt-3 shadow-sm z-20 relative"
/>
</Skeleton>
......@@ -52,10 +53,10 @@
:longitude="item.longitude"
:opening_hours="item.opening_hours"
:weekend_status="item.weekend_status"
:outlet_posId="item.pos_id"
:outlet_id="item.outlet_id"
class="mt-3 shadow-sm"
/>
<!-- <branch :isOpen="false" class="mt-3 shadow-sm"/> -->
</div>
</Skeleton>
<!-- 附近网点 -->
......@@ -93,14 +94,15 @@ export default defineComponent({
result.loading = true;
addressService
.getNearby({
// eslint-disable-next-line no-undef
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 4,
})
.then((res) => {
if (res.data.length !== 0) {
result.loading = false;
result.topItem = res.data[0];
result.lists = res.data.slice(1);
}
});
};
getAddressList();
......
......@@ -71,6 +71,7 @@
:opening_hours="state.branchinfo.opening_hours"
:weekend_status="state.branchinfo.weekend_status"
:outlet_id="state.branchinfo.outlet_id"
:outlet_posId="state.branchinfo.pos_id"
/>
</Skeleton>
</div>
......@@ -123,11 +124,10 @@ export default defineComponent({
if (userMsg?.value?.role2 === undefined || isUser.value) {
const ret = await AddressService.getInstance().getNearby({
// eslint-disable-next-line no-undef
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 1,
});
if (ret.code === 200) {
if (ret.code === 200 && ret.data.length !== 0) {
state.branchinfo = ret.data[0];
}
} else {
......
......@@ -5,9 +5,9 @@ module.exports = {
devServer: {
proxy: {
"/proxyApi": {
// target: "http://172.16.102.150:8091",
target: "http://172.16.101.129:8091",
// target: 'https://www.puhuijr.net/proxyApi',
target: "http://172.16.102.150:8091", // 测试环境
// target: "http://172.16.101.129:8091", // posId环境
// target: 'https://www.puhuijr.net/proxyApi', // 正式环境
pathRewrite: {
"^/proxyApi": "",
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment