index.vue 9.8 KB

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