index.vue 12 KB

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