index.vue 11 KB

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