index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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,hadOrder } 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 =async () => {
  221. try {
  222. const res = await hadOrder(details.value.volunteerInfoId);
  223. if(res.code === 200){
  224. uni.redirectTo({
  225. url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data.value))}`
  226. })
  227. }else{
  228. uni.showToast({
  229. title: res.msg,
  230. icon: 'error',
  231. });
  232. }
  233. } catch (error) {
  234. console.log("TCL: startSubmit -> error", error)
  235. }
  236. }
  237. onLoad((options) => {
  238. const option = JSON.parse(decodeURIComponent(options.data));
  239. data.value = option;
  240. console.log("option", option);
  241. uni.setNavigationBarTitle({
  242. title: option.businessName + '详情' // 根据业务逻辑调整
  243. });
  244. setTimeout(() => {
  245. getRegister();
  246. }, 500);
  247. })
  248. </script>
  249. <style lang="scss" scoped>
  250. .details-main {
  251. position: fixed;
  252. top: 0px;
  253. left: 0px;
  254. right: 0px;
  255. bottom: 0px;
  256. display: flex;
  257. flex-direction: column;
  258. overflow-y: auto;
  259. }
  260. .status-box {
  261. display: flex;
  262. align-items: center;
  263. justify-content: center;
  264. flex-direction: column;
  265. padding: 64rpx 0;
  266. .status-text {
  267. font-size: 40rpx;
  268. font-weight: 400;
  269. letter-spacing: 0rpx;
  270. line-height: 56rpx;
  271. color: rgba(17, 24, 39, 1);
  272. }
  273. .text2 {
  274. font-size: 28rpx;
  275. font-weight: 400;
  276. letter-spacing: 0rpx;
  277. line-height: 40rpx;
  278. color: rgba(107, 114, 128, 1);
  279. }
  280. }
  281. .status-main {
  282. flex: 1;
  283. background: whitesmoke;
  284. padding: 32rpx;
  285. .status-card {
  286. padding: 32rpx;
  287. border-radius: 24rpx;
  288. background: rgba(255, 255, 255, 1);
  289. 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);
  290. margin-bottom: 32rpx;
  291. .card-title {
  292. font-size: 32rpx;
  293. font-weight: 400;
  294. line-height: 48rpx;
  295. color: rgba(17, 24, 39, 1);
  296. margin-bottom: 32rpx;
  297. }
  298. .card-item {
  299. display: flex;
  300. align-items: center;
  301. justify-content: space-between;
  302. margin-bottom: 24rpx;
  303. }
  304. .card-lable {
  305. font-size: 28rpx;
  306. font-weight: 400;
  307. letter-spacing: 0rpx;
  308. line-height: 40rpx;
  309. color: rgba(107, 114, 128, 1);
  310. }
  311. .card-text {
  312. font-size: 28rpx;
  313. font-weight: 400;
  314. letter-spacing: 0rpx;
  315. line-height: 40rpx;
  316. color: rgba(17, 24, 39, 1);
  317. }
  318. }
  319. .status-btn {
  320. // width: 716rpx;
  321. height: 96rpx;
  322. border-radius: 16rpx;
  323. background: rgba(221, 94, 69, 1);
  324. display: flex;
  325. align-items: center;
  326. justify-content: center;
  327. font-size: 32rpx;
  328. font-weight: 400;
  329. color: rgba(255, 255, 255, 1);
  330. margin-bottom: 88rpx;
  331. }
  332. .card-imgs {
  333. display: flex;
  334. // flex-wrap: wrap;
  335. flex-direction: column;
  336. align-items: center;
  337. justify-content: center;
  338. }
  339. .upload-img {
  340. // height: 136rpx;
  341. // width: 136rpx;
  342. margin-bottom: 24rpx;
  343. }
  344. }
  345. .card-subtitle {
  346. font-size: 28rpx;
  347. font-weight: 500;
  348. letter-spacing: 0rpx;
  349. line-height: 40rpx;
  350. color: rgba(107, 114, 128, 1);
  351. margin-bottom: 16rpx;
  352. text-align: center;
  353. }
  354. .id-card-container {
  355. display: flex;
  356. flex-direction: column;
  357. align-items: center;
  358. width: 100%;
  359. @media screen and (min-width: 768px) {
  360. flex-direction: row;
  361. justify-content: space-around;
  362. }
  363. }
  364. .id-card-item {
  365. margin-bottom: 32rpx;
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. width: 100%;
  370. @media screen and (min-width: 768px) {
  371. width: 48%;
  372. }
  373. }
  374. .id-card-img {
  375. width: 100%;
  376. max-width: 600rpx;
  377. border-radius: 12rpx;
  378. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  379. }
  380. </style>