zhengyiming
2025-02-10 0f686ea1fe4700a909a6159efcf1fcb0e1f88a17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<template>
  <PageLayoutWithBg title="资源详情" class="resourceDetail-page-wrapper" :need-auth="false">
    <LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
      <ContentScrollView style="background-color: transparent">
        <Cell :title="detail?.title ?? ''" titleSize="large">
          <div class="orderDetail-industryTypeName">
            {{ detail?.industryTypeName ?? '' }}
          </div>
          <div class="detail-page-avatar-wrapper">
            <CardAvatar
              :src="detail?.avatarUrl"
              :name="detail?.contact"
              :jobTitle="detail?.jobTitle"
              :isCertified="detail?.isCertified"
              :userId="detail?.userId"
            />
            <div class="detail-page-time">
              发布于:{{ format(detail?.lastShelfTime, 'YYYY-MM-DD HH:mm') }}
            </div>
          </div>
        </Cell>
        <Cell title="基本信息">
          <div class="detail-info-list">
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">交付人数:</div>
              <div class="detail-info-list-item-content">{{ detail?.resourceCount ?? 0 }}人</div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">资源城市:</div>
              <div class="detail-info-list-item-content">
                {{ cities }}
              </div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">意向城市:</div>
              <div class="detail-info-list-item-content">
                {{ intendedDeliveryCities }}
              </div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">合作费用:</div>
              <div class="detail-info-list-item-content">{{ detail?.cooperationFee ?? '' }}</div>
            </div>
          </div>
        </Cell>
        <Cell title="资源介绍">
          <div class="detail-introduction">
            {{ resourceIntros }}
          </div>
        </Cell>
        <Cell>
          <template #title>
            <div class="safe-cell-title-wrapper">
              <img :src="IconSafe" class="safe-cell-title-icon" />
              <div class="safe-cell-title">安全提示</div>
            </div>
          </template>
          <div class="safe-cell-content">
            该信息由用户自主发布,如遇虚假信息、诈骗、传销等违法违规行为,请立即
            <div class="safe-cell-content-btn" @click="goComplaint">投诉举报</div>
          </div>
        </Cell>
      </ContentScrollView>
      <PageFooter>
        <PageFooterAction
          :icon="IconShare"
          text="分享"
          :isFlex="false"
          openType="share"
        ></PageFooterAction>
 
        <PageFooterBtn v-if="isSelf || isCollapse" type="primary" @click="makePhoneCall">{{
          contactPhone
        }}</PageFooterBtn>
        <PageFooterBtn v-else type="primary" @click="handleGoAcontact">去对接</PageFooterBtn>
      </PageFooter>
    </LoadingLayout>
  </PageLayoutWithBg>
</template>
 
<script setup lang="ts">
import Taro from '@tarojs/taro';
import { useQuery } from '@tanstack/vue-query';
import { useUserStore } from '@/stores/modules/user';
import {
  useUser,
  useAccessLogin,
  useToggleMatchMakingIdentityOnLaunch,
  useAccessPersonalInfo,
} from '@/hooks';
import { MatchMakingIdentityEnum, EditorType } from '@12333/constants';
import * as resourceServices from '@12333/services/api/Resource';
import IconSafe from '@/assets/order/icon-safe.png';
import IconShare from '@/assets/order/icon-share.png';
import { OrderUtils, filterJoin, setOSSLink, format } from '@12333/utils';
import { useAllAreaList } from '@12333/hooks';
import { useToggle } from 'senin-mini/hooks';
import * as orderServices from '@12333/services/api/Order';
 
defineOptions({
  name: 'resourceDetail',
});
 
const router = Taro.useRouter();
const resourceId = router.params?.id ?? '';
 
const { userDetail } = useUser();
 
const { findAreaNameFromCode } = useAllAreaList();
 
useToggleMatchMakingIdentityOnLaunch({
  matchMakingIdentity: MatchMakingIdentityEnum.Employing,
});
 
const {
  isLoading,
  data: detail,
  isError,
  refetch,
} = useQuery({
  queryKey: ['resourceServices/getFrontResourceInfo', resourceId],
  queryFn: async () => {
    return await resourceServices.getFrontResourceInfo(
      { id: resourceId },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.ResourceFrontInfoDto),
  onSuccess(data) {
    if (data.isExistTradeChatRecord) setTrue();
  },
});
 
const isSelf = computed(() => userDetail.value?.userId === detail.value?.userId);
 
const cities = computed(() => {
  return detail.value.cities
    ?.map((x) => `${findAreaNameFromCode(x.provinceCode)}${x.areaName}`)
    .join('、');
});
 
const intendedDeliveryCities = computed(() => {
  return detail.value.intendedDeliveryCities
    ?.map((x) => `${findAreaNameFromCode(x.provinceCode)}${x.areaName}`)
    .join('、');
});
 
const resourceIntros = computed(() => {
  if (detail.value?.resourceIntros?.length > 0) {
    return detail.value?.resourceIntros.find((x) => x.type === EditorType.Text)?.content ?? '';
  }
  return '';
});
 
const contactPhone = computed(() => {
  if (detail.value) {
    return detail.value?.parkOrHRSimpleInfo?.contactPhone
      ? detail.value?.parkOrHRSimpleInfo?.contactPhone
      : detail.value?.contactNumber
      ? detail.value?.contactNumber
      : '';
  }
  return '';
});
 
Taro.showShareMenu({
  showShareItems: ['shareAppMessage', 'shareTimeline'],
});
 
Taro.useShareAppMessage((res) => {
  return {
    title: detail.value?.title ?? '',
  };
});
 
function goComplaint() {
  Taro.navigateTo({
    url: `${RouterPath.complaint}?id=${resourceId}`,
  });
}
 
const { isCollapse, setTrue } = useToggle();
 
const handleGoAcontact = useAccessPersonalInfo(async () => {
  try {
    let res = await orderServices.addTradeChatRecord({
      relationalId: resourceId,
      applyUserId: userDetail.value?.userId,
    });
    if (res) {
      setTrue();
    }
  } catch (error) {}
});
 
const makePhoneCall = useAccessPersonalInfo(() => {
  if (contactPhone.value) {
    Taro.makePhoneCall({
      phoneNumber: contactPhone.value,
    });
  }
});
</script>
 
<style lang="scss">
@import '@/styles/common.scss';
@import '../../order/orderDetail/common.scss';
</style>