<template>
|
<ProTabs
|
v-model="tab"
|
name="tradeChatRecord-tabs"
|
class="tradeChatRecord-tabs"
|
flexTitle
|
:showPaneContent="false"
|
>
|
<ProTabPane :title="`我联系的(${count.myCallCount})`" :pane-key="TradeChatRecordTab.Apply">
|
</ProTabPane>
|
<ProTabPane :title="`联系我的(${count.callMeCount})`" :pane-key="TradeChatRecordTab.My">
|
</ProTabPane>
|
</ProTabs>
|
<InfiniteLoading
|
scrollViewClassName="common-infinite-scroll-list-no-padding"
|
v-bind="infiniteLoadingProps"
|
:key="tab"
|
>
|
<template #renderItem="{ item }">
|
<AttentionCard
|
:key="tab === TradeChatRecordTab.Apply ? item.orderUserId : item.applyUserId"
|
:avatarUrl="
|
tab === TradeChatRecordTab.Apply ? item.orderUserAvatarUrl : item.applyUserAvatarUrl
|
"
|
:name="tab === TradeChatRecordTab.Apply ? item.orderUserContact : item.applyUserContact"
|
:enterpriseName="
|
tab === TradeChatRecordTab.Apply
|
? item.orderUserEnterpriseName
|
: item.applyUserEnterpriseName
|
"
|
>
|
<template #actions>
|
<nut-button type="default" class="card-action" @click="goChatRoom(item)"
|
>发私信</nut-button
|
>
|
</template>
|
</AttentionCard>
|
</template>
|
</InfiniteLoading>
|
</template>
|
|
<script setup lang="ts">
|
import { ProTabs, ProTabPane } from '@12333/components';
|
import { useInfiniteLoading } from '@12333/hooks';
|
import { OrderInputType } from '@12333/constants';
|
import * as orderServices from '@12333/services/api/Order';
|
import { useUser } from '@/hooks';
|
import Taro from '@tarojs/taro';
|
|
defineOptions({
|
name: 'InnerPage',
|
});
|
|
enum TradeChatRecordTab {
|
Apply = '1',
|
My = '2',
|
}
|
|
const tab = ref(TradeChatRecordTab.Apply);
|
|
const count = reactive({ callMeCount: 0, myCallCount: 0 });
|
|
const { userDetail } = useUser();
|
|
const { infiniteLoadingProps } = useInfiniteLoading(
|
async ({ pageParam }) => {
|
let params: API.QueryTradeChatRecordInput = {
|
pageModel: {
|
rows: 20,
|
page: pageParam,
|
},
|
};
|
if (tab.value === TradeChatRecordTab.Apply) {
|
params.applyUserId = userDetail.value.userId;
|
} else {
|
params.orderUserId = userDetail.value.userId;
|
}
|
let res = await orderServices.getTradeChatRecordPage(params, { showLoading: false });
|
count.callMeCount = res.objectData.callMeCount;
|
count.myCallCount = res.objectData.myCallCount;
|
return res;
|
},
|
{
|
queryKey: ['orderServices/getTradeChatRecordPage', tab],
|
}
|
);
|
|
function goChatRoom(item: API.TradeChatRecordOutput) {
|
Taro.navigateTo({
|
url: `${RouterPath.chatRoom}?chatId=${
|
tab.value === TradeChatRecordTab.Apply ? item.orderUserId : item.applyUserId
|
}`,
|
});
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/styles/common.scss';
|
</style>
|