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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<template>
  <PageLayoutWithBg title="订单详情" class="orderDetail-page-wrapper" :need-auth="false">
    <LoadingLayout :loading="isLoading" :error="isError" :loadError="refetch">
      <ContentScrollView style="background-color: transparent">
        <Cell :title="detail?.orderName ?? ''" titleSize="large">
          <template #title-right>
            <div class="orderDetail-supplierRefund">
              {{ detail?.integratedSalary ?? 0 }}元
              <div class="orderDetail-supplierRefund-unit">
                /{{ SalaryTimeTypeEnumUnitExact[detail?.salaryTimeType] }}
              </div>
            </div>
          </template>
          <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">{{ _hireNumber }}人</div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">年龄范围:</div>
              <div class="detail-info-list-item-content">
                {{ detail?.ageStart ?? 0 }}-{{ detail?.ageEnd ?? 0 }}周岁
              </div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">性别要求:</div>
              <div class="detail-info-list-item-content">
                {{ SexRequirementText[detail?.sexRequirement] }}
              </div>
            </div>
            <div class="detail-info-list-item">
              <div class="detail-info-list-item-label">需求城市:</div>
              <div class="detail-info-list-item-content">{{ address }}</div>
            </div>
          </div>
          <div class="order-detail-supplier-refund">
            <div class="order-detail-supplier-refund-tag">合作</div>
            <div class="order-detail-supplier-refund-text">
              {{ supplierRefund }},{{ rebateModeText }}
            </div>
          </div>
        </Cell>
        <Cell title="工作内容">
          <div class="detail-introduction">
            {{ detail?.jobIntroduction ?? '' }}
          </div>
        </Cell>
        <Cell title="工作环境" v-if="imageList.length > 0">
          <ImageGrid
            class="friend-message-content-image-grid"
            :imageList="imageList"
            :columnNum="4"
          />
        </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 * as orderServices from '@12333/services/api/Order';
import { OrderUtils, filterJoin, setOSSLink, format } from '@12333/utils';
import {
  HireType,
  SalaryTimeTypeEnumUnitExact,
  SexRequirementText,
  MatchMakingIdentityEnum,
} from '@12333/constants';
import { ImageGrid } from '@12333/components';
import IconSafe from '@/assets/order/icon-safe.png';
import IconShare from '@/assets/order/icon-share.png';
import {
  useUser,
  useAccessLogin,
  useToggleMatchMakingIdentityOnLaunch,
  useAccessPersonalInfo,
} from '@/hooks';
import { useToggle } from 'senin-mini/hooks';
 
defineOptions({
  name: 'orderDetail',
});
 
const router = Taro.useRouter();
const orderId = router.params?.id ?? '';
 
const { userDetail } = useUser();
 
useToggleMatchMakingIdentityOnLaunch({
  matchMakingIdentity: MatchMakingIdentityEnum.Contributors,
});
 
const {
  isLoading,
  isError,
  data: detail,
  refetch,
} = useQuery({
  queryKey: ['orderServices/getOrdeForDetail', orderId],
  queryFn: async () => {
    return await orderServices.getOrdeForDetail(
      { id: orderId },
      {
        showLoading: false,
      }
    );
  },
  placeholderData: () => ({} as API.OrderInfoDto),
  onSuccess(data) {
    if (data.isExistTradeChatRecord) setTrue();
  },
});
 
const isSelf = computed(() => userDetail.value?.userId === detail.value?.userId);
 
const _hireNumber = computed(() =>
  OrderUtils.getHireNumber(
    detail.value?.hireType,
    detail.value?.hireNumber,
    detail.value?.hireEndNumber
  )
);
 
const supplierRefund = computed(() => {
  if (detail.value?.orderSupplierRefundInfo) {
    return OrderUtils.getSupplierRefund(detail.value?.orderSupplierRefundInfo);
  }
  return '';
});
 
const rebateModeText = computed(() => {
  if (detail.value?.orderSupplierRefundInfo) {
    return OrderUtils.getRebateModeText(detail.value?.orderSupplierRefundInfo);
  }
  return '';
});
 
const address = computed(() =>
  filterJoin([detail.value.provinceName ?? '', detail.value.cityName ?? ''])
);
 
const imageList = computed(() => {
  if (detail.value?.src?.length > 0) {
    return detail.value?.src.map((item) => ({ fileUrl: setOSSLink(item) }));
  }
 
  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?.orderName ?? '',
  };
});
 
function goComplaint() {
  Taro.navigateTo({
    url: `${RouterPath.complaint}?id=${orderId}`,
  });
}
 
const { isCollapse, setTrue } = useToggle();
 
const handleGoAcontact = useAccessPersonalInfo(async () => {
  try {
    let res = await orderServices.addTradeChatRecord({
      relationalId: orderId,
      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 './common.scss';
 
.orderDetail-page-wrapper {
  .orderDetail-supplierRefund {
    font-weight: 600;
    font-size: 28px;
    color: boleGetCssVar('color', 'primary');
    line-height: 40px;
    flex-shrink: 0;
 
    .orderDetail-supplierRefund-unit {
      color: boleGetCssVar('text-color', 'secondary');
      display: inline;
      font-size: 24px;
    }
  }
 
  .order-detail-supplier-refund {
    display: flex;
    align-items: center;
 
    .order-detail-supplier-refund-tag {
      height: 40px;
      background: #edf2ff;
      border-radius: 4px;
      padding: 0 8px;
      margin-right: 16px;
      font-weight: 400;
      font-size: 24px;
      color: boleGetCssVar('color', 'primary');
      line-height: 34px;
      flex-shrink: 0;
    }
 
    .order-detail-supplier-refund-text {
      height: 40px;
      background: #f9faff;
      padding: 0 8px;
      font-weight: 400;
      font-size: 28px;
      color: boleGetCssVar('text-color', 'primary');
      line-height: 40px;
      @include ellipsis;
    }
  }
}
</style>