index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <view class="details-main">
  3. <view class="status-box">
  4. <img src="/static/serverImg/home/no.png" alt="" style="width: 160rpx;height: 160rpx;margin-bottom: 36rpx;" v-if="details.appStatus === '3'">
  5. <img src="/static/serverImg/home/ok.png" alt="" style="width: 160rpx;height: 160rpx;margin-bottom: 36rpx;" v-if="['1','2'].includes(details.appStatus)">
  6. <text class="status-text">{{ statusData.text }}</text>
  7. <text v-if="statusData.rejectReason" class="text2">失败原因:{{ statusData.rejectReason }}</text>
  8. </view>
  9. <view class="status-main">
  10. <view class="status-card">
  11. <view class="card-title">基本信息</view>
  12. <view class="card-item" v-for="item in list" :key="item.key">
  13. <view class="card-lable">{{ item.label }}</view>
  14. <view class="card-text" v-if=" item.key === 'sex'"> {{ sex_status[details[item.key]] || '-'}} </view>
  15. <view class="card-text" v-else-if=" item.key === 'city'"> {{details['provinceName']+ details['cityName']+details['districtName']}} </view>
  16. <view class="card-text" v-else> {{ details[item.key] || '-'}} </view>
  17. </view>
  18. </view>
  19. <view class="status-card">
  20. <view class="card-title">服务信息</view>
  21. <view class="card-item" v-for="item in serveslist" :key="item.key">
  22. <view class="card-lable">{{ item.label }}</view>
  23. <view class="card-text"> {{ details[item.key] || '-'}}{{item.dese}} </view>
  24. </view>
  25. </view>
  26. <view class="status-card">
  27. <view class="card-title">个人简介</view>
  28. <view class="card-text"> {{ details.skillDescribe }} </view>
  29. </view>
  30. <view class="status-card">
  31. <view class="card-title">用户头像</view>
  32. <view class="card-imgs">
  33. <!-- <img class="upload-img" v-for="(item, index) in volunteerPicture_img" :key="index + 'userimg'"
  34. :src="item" :alt="item.fileName" srcset=""> -->
  35. <up-image v-for="(item, index) in volunteerPicture_img" :key="index + 'userimg'"
  36. :src="item" class="upload-img" mode="widthFix" :alt="item.fileName"></up-image>
  37. </view>
  38. </view>
  39. <view class="status-card">
  40. <view class="card-title">身份证</view>
  41. <view class="id-card-container" v-if="idCardImages.hasSeparateImages">
  42. <view class="id-card-item" v-if="idCardImages.front">
  43. <!-- <img class="id-card-img" :src="idCardImages.front" alt="身份证正面"> -->
  44. <up-image :src="idCardImages.front" class="upload-img" mode="widthFix" alt="身份证正面"></up-image>
  45. </view>
  46. <view class="id-card-item" v-if="idCardImages.back">
  47. <!-- <img class="id-card-img" :src="idCardImages.back" alt="身份证背面"> -->
  48. <up-image :src="idCardImages.back" class="upload-img" mode="widthFix" alt="身份证背面"></up-image>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="status-card">
  53. <view class="card-title">资格证书</view>
  54. <view class="card-imgs">
  55. <view v-for="(item, index) in certificationPicture_img" :key="index + 'cer'">
  56. <!-- <img class="upload-img" :src="item" :alt="item.fileName" srcset=""> -->
  57. <up-image :src="item" class="upload-img" mode="widthFix" :alt="item.fileName"></up-image>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="status-btn" v-if="details.appStatus === '3'" @click="startSubmit">重新提交</view>
  62. </view>
  63. <Picker :columnData="options" ref="pickerRef" />
  64. </view>
  65. </template>
  66. <script setup>
  67. import { ref, reactive, onMounted, nextTick, computed } from 'vue';
  68. import { onLoad } from '@dcloudio/uni-app';
  69. import { add, getVolunteerInfo } from "@/api/volunteer";
  70. import Picker from '@/pages_home/components/picker/index.vue'
  71. import { getTreeList } from '@/api/volunteer'
  72. import { useDict } from '@/utils/dict.js';
  73. // 身份证图片处理组合式函数
  74. const useIdCardImages = (detailsData) => {
  75. const idCardImages = computed(() => ({
  76. combined: detailsData.value.idCardPicture ? detailsData.value.idCardPicture.split(',') : [],
  77. front: detailsData.value.idCardPictureFront || '',
  78. back: detailsData.value.idCardPictureBack || '',
  79. hasSeparateImages: !!(detailsData.value.idCardPictureFront || detailsData.value.idCardPictureBack)
  80. }))
  81. return {
  82. idCardImages
  83. }
  84. }
  85. const details = ref({});
  86. const data = ref({});
  87. const options = ref([])
  88. const pickerRef = ref(null);
  89. // 使用组合式函数
  90. const { idCardImages } = useIdCardImages(details);
  91. // const {
  92. // volunteer_app_status
  93. // } = useDict('volunteer_app_status');
  94. const list = [
  95. {
  96. label: "姓名",
  97. key: "name",
  98. },
  99. {
  100. label: "性别",
  101. key: "sex",
  102. },
  103. {
  104. label: "年龄",
  105. key: "age",
  106. },
  107. {
  108. label: "手机号",
  109. key: "phonenumber",
  110. },
  111. // {
  112. // label: "服务项目",
  113. // key: "businessManagementId",
  114. // },
  115. {
  116. label: "地区",
  117. key: "city",
  118. },
  119. {
  120. label: "详细地址",
  121. key: "address",
  122. },
  123. ]
  124. const serveslist =[
  125. {
  126. label: "服务项目",
  127. key: "businessTierName",
  128. },
  129. {
  130. label: "服务时长",
  131. key: "businessDuration",
  132. dese:'分钟'
  133. },
  134. {
  135. label: "服务价格",
  136. key: "businessPrice",
  137. dese:'元'
  138. },
  139. ]
  140. const sex_status = {
  141. 0: '男',
  142. 1: '女'
  143. }
  144. //头像
  145. const volunteerPicture_img = computed(() => {
  146. return details.value.volunteerPicture ? details.value.volunteerPicture.split(',') : []
  147. })
  148. // const idCardPicture_img = computed(() => {
  149. // return details.value.idCardPicture ? details.value.idCardPicture.split(',') : []
  150. // })
  151. //职业、资质证书
  152. const certificationPicture_img = computed(() => {
  153. return details.value.certificationPicture ? details.value.certificationPicture.split(',') : []
  154. })
  155. const status_e = {
  156. 1: '审核中',
  157. 2: '注册成功',
  158. 3: '申请失败'
  159. }
  160. const statusData = computed(() => {
  161. // console.log('volunteer_app_status',volunteer_app_status.value);
  162. // const parmas = volunteer_app_status.value.find(item => item.value === details.value.appStatus)
  163. if (details.value.appStatus === '3') {
  164. return {
  165. img: '/static/serverImg/home/no.png',
  166. text: status_e[details.value.appStatus],
  167. rejectReason: details.value.rejectReason
  168. }
  169. }
  170. return {
  171. img: '/static/serverImg/home/yes.png',
  172. text: status_e[details.value.appStatus],
  173. }
  174. })
  175. function idToIndexs(array, targetId, path = []) {
  176. for (let i = 0; i < array.length; i++) {
  177. const item = array[i];
  178. const currentPath = path.concat(i);
  179. if (item.id === targetId) {
  180. return item.businessTierName
  181. }
  182. if (item.children) {
  183. const result = idToIndexs(item.children, targetId, currentPath);
  184. if (result) {
  185. return result;
  186. }
  187. }
  188. }
  189. return null; // 如果没有找到对应的项,返回 null
  190. }
  191. async function getRegister() {
  192. try {
  193. // uni.showLoading({
  194. // title: '数据加载中...'
  195. // });
  196. const op_res = await getTreeList({ parentId: data.value.key });
  197. const res = await getVolunteerInfo({ serviceCategory: data.value.key });
  198. if (res.data) {
  199. const names = idToIndexs(op_res.data, res.data.businessManagementId + '')
  200. console.log('res', res, names);
  201. details.value = {
  202. ...res.data,
  203. businessManagementId: names
  204. };
  205. }
  206. getTreeList({ parentId: data.value.key }).then(res => {
  207. options.value = res.data;
  208. })
  209. } catch (error) {
  210. console.log('error', error);
  211. uni.showToast({
  212. title: error.msg,
  213. icon: 'error',
  214. });
  215. } finally {
  216. // uni.hideLoading();
  217. }
  218. }
  219. const startSubmit = () => {
  220. uni.redirectTo({
  221. url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data.value))}`
  222. })
  223. }
  224. onLoad((options) => {
  225. const option = JSON.parse(decodeURIComponent(options.data));
  226. data.value = option;
  227. console.log("option", option);
  228. uni.setNavigationBarTitle({
  229. title: option.businessName + '详情' // 根据业务逻辑调整
  230. });
  231. setTimeout(() => {
  232. getRegister();
  233. }, 500);
  234. })
  235. </script>
  236. <style lang="scss" scoped>
  237. .details-main {
  238. position: fixed;
  239. top: 0px;
  240. left: 0px;
  241. right: 0px;
  242. bottom: 0px;
  243. display: flex;
  244. flex-direction: column;
  245. overflow-y: auto;
  246. }
  247. .status-box {
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. flex-direction: column;
  252. padding: 64rpx 0;
  253. .status-text {
  254. font-size: 40rpx;
  255. font-weight: 400;
  256. letter-spacing: 0rpx;
  257. line-height: 56rpx;
  258. color: rgba(17, 24, 39, 1);
  259. }
  260. .text2 {
  261. font-size: 28rpx;
  262. font-weight: 400;
  263. letter-spacing: 0rpx;
  264. line-height: 40rpx;
  265. color: rgba(107, 114, 128, 1);
  266. }
  267. }
  268. .status-main {
  269. flex: 1;
  270. background: whitesmoke;
  271. padding: 32rpx;
  272. .status-card {
  273. padding: 32rpx;
  274. border-radius: 24rpx;
  275. background: rgba(255, 255, 255, 1);
  276. box-shadow: 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 0rpx 0rpx rgba(0, 0, 0, 0), 0rpx 2rpx 4rpx rgba(0, 0, 0, 0.05);
  277. margin-bottom: 32rpx;
  278. .card-title {
  279. font-size: 32rpx;
  280. font-weight: 400;
  281. line-height: 48rpx;
  282. color: rgba(17, 24, 39, 1);
  283. margin-bottom: 32rpx;
  284. }
  285. .card-item {
  286. display: flex;
  287. align-items: center;
  288. justify-content: space-between;
  289. margin-bottom: 24rpx;
  290. }
  291. .card-lable {
  292. font-size: 28rpx;
  293. font-weight: 400;
  294. letter-spacing: 0rpx;
  295. line-height: 40rpx;
  296. color: rgba(107, 114, 128, 1);
  297. }
  298. .card-text {
  299. font-size: 28rpx;
  300. font-weight: 400;
  301. letter-spacing: 0rpx;
  302. line-height: 40rpx;
  303. color: rgba(17, 24, 39, 1);
  304. }
  305. }
  306. .status-btn {
  307. // width: 716rpx;
  308. height: 96rpx;
  309. border-radius: 16rpx;
  310. background: rgba(221, 94, 69, 1);
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. font-size: 32rpx;
  315. font-weight: 400;
  316. color: rgba(255, 255, 255, 1);
  317. margin-bottom: 88rpx;
  318. }
  319. .card-imgs {
  320. display: flex;
  321. // flex-wrap: wrap;
  322. flex-direction: column;
  323. align-items: center;
  324. justify-content: center;
  325. }
  326. .upload-img {
  327. // height: 136rpx;
  328. // width: 136rpx;
  329. margin-bottom: 24rpx;
  330. }
  331. }
  332. .card-subtitle {
  333. font-size: 28rpx;
  334. font-weight: 500;
  335. letter-spacing: 0rpx;
  336. line-height: 40rpx;
  337. color: rgba(107, 114, 128, 1);
  338. margin-bottom: 16rpx;
  339. text-align: center;
  340. }
  341. .id-card-container {
  342. display: flex;
  343. flex-direction: column;
  344. align-items: center;
  345. width: 100%;
  346. @media screen and (min-width: 768px) {
  347. flex-direction: row;
  348. justify-content: space-around;
  349. }
  350. }
  351. .id-card-item {
  352. margin-bottom: 32rpx;
  353. display: flex;
  354. flex-direction: column;
  355. align-items: center;
  356. width: 100%;
  357. @media screen and (min-width: 768px) {
  358. width: 48%;
  359. }
  360. }
  361. .id-card-img {
  362. width: 100%;
  363. max-width: 600rpx;
  364. border-radius: 12rpx;
  365. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  366. }
  367. </style>