index.vue 9.5 KB

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