index.vue 8.9 KB

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