index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="details-main">
  3. <view class="status-box">
  4. <img :src="statusData.img" alt="" style="width: 160rpx;height: 160rpx;margin-bottom: 36rpx;">
  5. <text class="status-text">{{ statusData.text }}</text>
  6. <text v-if="statusData.rejectReason" class="text2">{{ statusData.rejectReason }}</text>
  7. </view>
  8. <view class="status-main">
  9. <view class="status-card">
  10. <view class="card-title"> 基本信息</view>
  11. <view class="card-item" v-for="item in list" :key="item.key">
  12. <view class="card-lable">{{ item.label }}</view>
  13. <view class="card-text"> {{item.key ==='sex'? sex_status[details[item.key]] ||'-' : details[item.key] || '-'}} </view>
  14. </view>
  15. </view>
  16. <view class="status-card">
  17. <view class="card-title">技能简介</view>
  18. <view class="card-text"> {{ details.skillDescribe }} </view>
  19. </view>
  20. <view class="status-card">
  21. <view class="card-title">用户头像</view>
  22. <view class="card-imgs">
  23. <img class="upload-img" v-for="(item,index) in volunteerPicture_img" :key="index+ 'userimg'" :src="item" :alt="item.fileName" srcset="">
  24. </view>
  25. </view>
  26. <view class="status-card">
  27. <view class="card-title">身份证</view>
  28. <view class="card-imgs">
  29. <img class="upload-img" v-for="(item,index) in idCardPicture_img" :key="index+ 'card'" :src="item" :alt="item.fileName" srcset="">
  30. </view>
  31. </view>
  32. <view class="status-card">
  33. <view class="card-title">资格证书</view>
  34. <view class="card-imgs">
  35. <view v-for="(item,index) in certificationPicture_img" :key="index+ 'cer'">
  36. <img class="upload-img" :src="item" :alt="item.fileName" srcset="" >
  37. </view>
  38. </view>
  39. </view>
  40. <view class="status-btn" v-if="details.appStatus === 3" @click="startSubmit">重新提交</view>
  41. </view>
  42. <Picker :columnData="options" ref="pickerRef" />
  43. </view>
  44. </template>
  45. <script setup>
  46. import { ref, reactive, onMounted, nextTick, computed } from 'vue';
  47. import { onLoad } from '@dcloudio/uni-app';
  48. import { add, getVolunteerInfo } from "@/api/volunteer";
  49. import Picker from '@/components/picker/index.vue'
  50. import { getTreeList } from '@/api/volunteer'
  51. const details = ref({});
  52. const data =ref({});
  53. const options = ref([])
  54. const pickerRef = ref(null);
  55. const list = [
  56. {
  57. label: "姓名",
  58. key: "name",
  59. },
  60. {
  61. label: "性别",
  62. key: "sex",
  63. },
  64. {
  65. label: "年龄",
  66. key: "age",
  67. },
  68. {
  69. label: "手机号",
  70. key: "phonenumber",
  71. },
  72. {
  73. label: "服务项目",
  74. key: "businessManagementId",
  75. },
  76. {
  77. label: "地区",
  78. key: "city",
  79. },
  80. {
  81. label: "详细地址",
  82. key: "address",
  83. },
  84. ]
  85. const sex_status = {
  86. 0:'男',
  87. 1:'女'
  88. }
  89. //头像
  90. const volunteerPicture_img = computed(() => {
  91. return details.value.volunteerPicture?details.value.volunteerPicture.split(','):[]
  92. })
  93. //个人身份证
  94. const idCardPicture_img = computed(() => {
  95. return details.value.idCardPicture?details.value.idCardPicture.split(','):[]
  96. })
  97. //职业、资质证书
  98. const certificationPicture_img = computed(() => {
  99. return details.value.certificationPicture?details.value.certificationPicture.split(','):[]
  100. })
  101. const statusData = computed(() => {
  102. if (details.value.appStatus === 3) {
  103. return {
  104. img: '/static/serverImg/home/no.png',
  105. text: '注册失败',
  106. rejectReason: details.value.rejectReason || '暂无原因'
  107. }
  108. }
  109. return {
  110. img: '/static/serverImg/home/ok.png',
  111. text: '注册成功'
  112. }
  113. })
  114. function idToIndexs(array, targetId, path = []) {
  115. for (let i = 0; i < array.length; i++) {
  116. const item = array[i];
  117. const currentPath = path.concat(i);
  118. if (item.id === targetId) {
  119. return item.businessTierName
  120. }
  121. if (item.children) {
  122. const result = idToIndexs(item.children, targetId, currentPath);
  123. if (result) {
  124. return result;
  125. }
  126. }
  127. }
  128. return null; // 如果没有找到对应的项,返回 null
  129. }
  130. async function getRegister() {
  131. try {
  132. uni.showLoading({
  133. title: '数据加载中...'
  134. });
  135. const op_res = await getTreeList({ parentId: data.value.key });
  136. const res = await getVolunteerInfo({ serviceCategory: data.value.key });
  137. if (res.data) {
  138. const names = idToIndexs(op_res.data,res.data.businessManagementId + '')
  139. console.log('res',res,names);
  140. details.value = {
  141. ...res.data,
  142. businessManagementId: names
  143. };
  144. }
  145. getTreeList({ parentId: data.value.key }).then(res => {
  146. options.value = res.data;
  147. })
  148. } catch (error) {
  149. console.log('error', error);
  150. uni.showToast({
  151. title: error.msg,
  152. icon: 'error',
  153. });
  154. } finally {
  155. uni.hideLoading();
  156. }
  157. }
  158. const startSubmit = () => {
  159. uni.navigateTo({
  160. url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data.value))}`
  161. })
  162. }
  163. onLoad((options) => {
  164. const option = JSON.parse(decodeURIComponent(options.data));
  165. data.value = option;
  166. console.log("option", option);
  167. uni.setNavigationBarTitle({
  168. title: option.name + '详情' // 根据业务逻辑调整
  169. });
  170. setTimeout(() => {
  171. getRegister();
  172. }, 500);
  173. })
  174. </script>
  175. <style lang="scss" scoped>
  176. .details-main {
  177. position: fixed;
  178. top: 0px;
  179. left: 0px;
  180. right: 0px;
  181. bottom: 0px;
  182. display: flex;
  183. flex-direction: column;
  184. overflow-y: auto;
  185. }
  186. .status-box {
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. flex-direction: column;
  191. padding: 64rpx 0;
  192. .status-text {
  193. font-size: 40rpx;
  194. font-weight: 400;
  195. letter-spacing: 0rpx;
  196. line-height: 56rpx;
  197. color: rgba(17, 24, 39, 1);
  198. }
  199. .text2 {
  200. font-size: 28rpx;
  201. font-weight: 400;
  202. letter-spacing: 0rpx;
  203. line-height: 40rpx;
  204. color: rgba(107, 114, 128, 1);
  205. }
  206. }
  207. .status-main {
  208. flex: 1;
  209. background: whitesmoke;
  210. padding: 32rpx;
  211. .status-card {
  212. padding: 32rpx;
  213. border-radius: 24rpx;
  214. background: rgba(255, 255, 255, 1);
  215. 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);
  216. margin-bottom: 32rpx;
  217. .card-title {
  218. font-size: 32rpx;
  219. font-weight: 400;
  220. line-height: 48rpx;
  221. color: rgba(17, 24, 39, 1);
  222. margin-bottom: 32rpx;
  223. }
  224. .card-item {
  225. display: flex;
  226. align-items: center;
  227. justify-content: space-between;
  228. margin-bottom: 24rpx;
  229. }
  230. .card-lable {
  231. font-size: 28rpx;
  232. font-weight: 400;
  233. letter-spacing: 0rpx;
  234. line-height: 40rpx;
  235. color: rgba(107, 114, 128, 1);
  236. }
  237. .card-text {
  238. font-size: 28rpx;
  239. font-weight: 400;
  240. letter-spacing: 0rpx;
  241. line-height: 40rpx;
  242. color: rgba(17, 24, 39, 1);
  243. }
  244. }
  245. .status-btn {
  246. width: 716rpx;
  247. height: 96rpx;
  248. border-radius: 16rpx;
  249. background: rgba(51, 102, 255, 1);
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. font-size: 32rpx;
  254. font-weight: 400;
  255. color: rgba(255, 255, 255, 1);
  256. margin-bottom: 68rpx;
  257. }
  258. .card-imgs {
  259. display: flex;
  260. flex-wrap: wrap;
  261. margin-right: 32rpx;
  262. }
  263. .upload-img{
  264. height: 136rpx;
  265. width: 136rpx;
  266. margin-right: 24rpx;
  267. }
  268. }
  269. </style>