index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <template>
  2. <div class="app-container">
  3. <header>
  4. <!-- <img :src="userInfos.avatar" alt="" /> -->
  5. <van-image
  6. class="mr10"
  7. width="100px"
  8. height="100px"
  9. round
  10. :src="userInfos.avatar"
  11. />
  12. <div class="content">
  13. <p class="bold">
  14. <van-text-ellipsis :content="`${userInfos.nickName}(信用分:${userInfos.creditScore})`" />
  15. <van-icon
  16. name="setting"
  17. size="20"
  18. @click="onRouterPush('/user/edit')"
  19. />
  20. </p>
  21. <p class="flex justify-between">
  22. <van-text-ellipsis :content="userInfos.pgName" />
  23. </p>
  24. <p>
  25. <van-text-ellipsis :content="userInfos.deptName" />
  26. </p>
  27. </div>
  28. </header>
  29. <div class="main">
  30. <!-- <ul class="links">
  31. <li @click="onRouterPush('/training')">培训通知</li>
  32. <li>我的报名</li>
  33. <li>我的学习</li>
  34. <li>我的考试</li>
  35. </ul> -->
  36. <!-- <ul>
  37. <li>使用指引</li>
  38. <li>安全积分:{{ userInfos.creditScore }}分</li>
  39. </ul> -->
  40. <div class="card">
  41. <h4>经费统计</h4>
  42. <ul class="nav">
  43. <!-- <li>
  44. <span>123,000</span>
  45. <p>账户余额(¥)</p>
  46. </li> -->
  47. <li @click="onRouterPush('/my-cash-flow')">
  48. <span>{{ billInfo.totalFlowCount }}</span>
  49. <p>费用流水</p>
  50. </li>
  51. <li>
  52. <span>{{ billInfo.currentMonthFee }}</span>
  53. <p>本月支出</p>
  54. </li>
  55. <li>
  56. <span>{{ billInfo.totalFee }}</span>
  57. <p>累计支出</p>
  58. </li>
  59. </ul>
  60. </div>
  61. <div
  62. class="card"
  63. @click="showOperatingGuidelines"
  64. >
  65. <h4>点击查看操作指引</h4>
  66. </div>
  67. </div>
  68. <footer>
  69. <!-- <wx-open-subscribe template="-pVpM6TH1oz1cZntEhGzQjmMMODF9tLLzh_1yjjWYSk" @success="handleSubscribe">
  70. <component :is="'script'" type="text/wxtag-template">
  71. <button class="w100 ">订阅</button>
  72. </component>
  73. </wx-open-subscribe> -->
  74. <van-button
  75. class="w100 mt10"
  76. color="#1cb4fd"
  77. plain
  78. @click="onRouterPush('/user/password')"
  79. >
  80. 修改密码
  81. </van-button>
  82. <van-button
  83. class="w100 mt10"
  84. @click="signOut"
  85. type="primary"
  86. >
  87. 切换账号
  88. </van-button>
  89. </footer>
  90. <van-popup
  91. position="bottom"
  92. v-model:show="showPopup"
  93. :style="{ padding: '20px' }"
  94. >
  95. <div class="operation-guide">
  96. <div class="guide-header">
  97. <h3>操作指引</h3>
  98. <van-icon
  99. name="cross"
  100. @click="showPopup = false"
  101. />
  102. </div>
  103. <div class="steps-container">
  104. <div
  105. v-for="(item, index) in handleStepList"
  106. :key="item.step"
  107. class="step-item"
  108. :class="{ 'last-step': index === handleStepList.length - 1 }"
  109. >
  110. <div class="step-number-wrapper">
  111. <div class="step-number">{{ item.step }}</div>
  112. <div
  113. v-if="index < handleStepList.length - 1"
  114. class="step-line"
  115. ></div>
  116. </div>
  117. <div class="step-content">
  118. <h4 class="step-title">{{ item.title }}</h4>
  119. <p class="step-desc">{{ item.desc }}</p>
  120. <!-- <van-button
  121. v-if="item.btn"
  122. size="small"
  123. type="primary"
  124. class="step-btn"
  125. @click="handleStepAction(item)"
  126. >
  127. {{ item.btn }}
  128. </van-button> -->
  129. </div>
  130. </div>
  131. </div>
  132. <div class="guide-footer">
  133. <van-icon name="info-o" />
  134. <span>请按照步骤顺序完成操作</span>
  135. </div>
  136. </div>
  137. </van-popup>
  138. </div>
  139. </template>
  140. <script lang="ts" setup>
  141. import { ref, onMounted } from 'vue'
  142. import { storeToRefs } from 'pinia'
  143. import to from 'await-to-js'
  144. import { showConfirmDialog } from 'vant'
  145. import { useRouter } from 'vue-router'
  146. import { useUserInfo } from '/@/stores/userInfo'
  147. import { Local } from '/@/utils/storage'
  148. import { useBillApi } from '/@/api/instr/finance/bill'
  149. const billApi = useBillApi()
  150. const router = useRouter()
  151. const storesUseUserInfo = useUserInfo()
  152. const { userInfos, sdkConfig, openId } = storeToRefs(storesUseUserInfo)
  153. const showPopup = ref<boolean>(false)
  154. const billInfo = ref<{
  155. totalFlowCount: number
  156. currentMonthFee: number
  157. totalFee: number
  158. }>({
  159. totalFlowCount: 0,
  160. currentMonthFee: 0,
  161. totalFee: 0,
  162. })
  163. const handleStepList = ref([
  164. {
  165. title: '第一步:入室培训和考试',
  166. desc: '请先完成入室必要培训,掌握安全操作知识,并通过考试',
  167. btn: '培训报名',
  168. step: 1,
  169. },
  170. {
  171. title: '第二步:提交入室申请',
  172. desc: '在线完成入室前的培训,掌握必要的安全操作知识,并通过考试',
  173. btn: '前往提交',
  174. step: 2,
  175. },
  176. {
  177. title: '第三步:上传入室资料',
  178. desc: '整理相关凭证并将入室资料上传到系统中',
  179. step: 3,
  180. },
  181. {
  182. title: '第四步:等待审核和房间分配',
  183. desc: '由平台老师进行审核,通过后分配操作室',
  184. step: 4,
  185. },
  186. ])
  187. const onRouterPush = (val: string) => {
  188. router.push(val)
  189. }
  190. const signOut = () => {
  191. showConfirmDialog({
  192. message: '确认切换账号?',
  193. }).then(() => {
  194. Local.remove('token')
  195. window.location.reload()
  196. })
  197. }
  198. const handleSubscribe = (errMsg: any, subscribeDetails: any) => {
  199. console.log(errMsg, subscribeDetails)
  200. }
  201. const showOperatingGuidelines = () => {
  202. showPopup.value = true
  203. }
  204. const handleStepAction = (item: any) => {
  205. // Implementation of handleStepAction
  206. }
  207. // 获取个人账单信息
  208. const getBillInfo = async () => {
  209. const [err, res]: ToResponse = await to(billApi.getMyOrderTotal())
  210. if (err) return
  211. billInfo.value = res?.data
  212. }
  213. onMounted(() => {
  214. getBillInfo()
  215. })
  216. </script>
  217. <style lang="scss" scoped>
  218. .app-container {
  219. display: flex;
  220. flex-direction: column;
  221. header {
  222. background-color: #1c9bfd;
  223. color: #fff;
  224. padding: 10px;
  225. border-radius: 8px;
  226. margin-top: 10px;
  227. display: flex;
  228. .content {
  229. flex: 1;
  230. display: flex;
  231. flex-direction: column;
  232. justify-content: space-around;
  233. overflow: hidden;
  234. .bold {
  235. display: flex;
  236. align-items: center;
  237. font-weight: bold;
  238. // flex-wrap: nowrap;
  239. white-space: nowrap;
  240. .van-text-ellipsis {
  241. flex: 1;
  242. }
  243. }
  244. }
  245. }
  246. .main {
  247. flex: 1;
  248. overflow-y: auto;
  249. > ul {
  250. display: flex;
  251. height: 60px;
  252. margin-top: 10px;
  253. li {
  254. flex: 1;
  255. background: #fff;
  256. color: #333;
  257. display: flex;
  258. align-items: center;
  259. justify-content: center;
  260. border-radius: 4px;
  261. & + li {
  262. margin-left: 10px;
  263. }
  264. }
  265. &.links {
  266. li {
  267. color: #fff;
  268. background: #5eb7fc;
  269. &:nth-child(2) {
  270. background: #fd9c5e;
  271. }
  272. &:nth-child(3) {
  273. background: #53e3a7;
  274. }
  275. &:nth-child(4) {
  276. background: #888ac3;
  277. }
  278. }
  279. }
  280. }
  281. .card {
  282. margin-top: 10px;
  283. border-radius: 4px;
  284. background-color: #fff;
  285. padding: 10px;
  286. h4 {
  287. height: 18px;
  288. line-height: 18px;
  289. &::before {
  290. display: inline-block;
  291. content: '';
  292. width: 3px;
  293. height: 18px;
  294. background-color: #1c9bfd;
  295. margin-right: 4px;
  296. vertical-align: middle;
  297. }
  298. }
  299. .nav {
  300. display: flex;
  301. margin: 10px 0;
  302. flex-wrap: wrap;
  303. justify-content: space-between;
  304. li {
  305. flex: 0 0 25%;
  306. display: flex;
  307. flex-direction: column;
  308. align-items: center;
  309. justify-content: center;
  310. span {
  311. font-size: 20px;
  312. }
  313. p {
  314. margin-top: 4px;
  315. }
  316. &:nth-child(n + 5) {
  317. margin-top: 10px;
  318. }
  319. }
  320. }
  321. }
  322. }
  323. footer {
  324. flex: 0 0 44px;
  325. margin-bottom: 20px;
  326. }
  327. }
  328. :deep(.van-popup--bottom) {
  329. padding: 20px !important;
  330. }
  331. .operation-guide {
  332. max-height: 70vh;
  333. overflow-y: auto;
  334. .guide-header {
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. margin-bottom: 20px;
  339. padding-bottom: 15px;
  340. border-bottom: 1px solid #eee;
  341. h3 {
  342. margin: 0;
  343. font-size: 18px;
  344. font-weight: 600;
  345. color: #333;
  346. }
  347. .van-icon {
  348. font-size: 18px;
  349. color: #999;
  350. cursor: pointer;
  351. &:hover {
  352. color: #666;
  353. }
  354. }
  355. }
  356. .steps-container {
  357. .step-item {
  358. display: flex;
  359. margin-bottom: 20px;
  360. &.last-step {
  361. margin-bottom: 0;
  362. }
  363. .step-number-wrapper {
  364. position: relative;
  365. margin-right: 15px;
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. .step-number {
  370. width: 32px;
  371. height: 32px;
  372. background: linear-gradient(135deg, #1c9bfd, #5eb7fc);
  373. color: white;
  374. border-radius: 50%;
  375. display: flex;
  376. align-items: center;
  377. justify-content: center;
  378. font-weight: 600;
  379. font-size: 14px;
  380. box-shadow: 0 2px 8px rgba(28, 155, 253, 0.3);
  381. }
  382. .step-line {
  383. width: 2px;
  384. height: 40px;
  385. background: linear-gradient(to bottom, #1c9bfd, #e0e0e0);
  386. margin-top: 8px;
  387. }
  388. }
  389. .step-content {
  390. flex: 1;
  391. padding-top: 2px;
  392. .step-title {
  393. margin: 0 0 8px 0;
  394. font-size: 16px;
  395. font-weight: 600;
  396. color: #333;
  397. line-height: 1.4;
  398. }
  399. .step-desc {
  400. margin: 0 0 12px 0;
  401. font-size: 14px;
  402. color: #666;
  403. line-height: 1.5;
  404. }
  405. .step-btn {
  406. border-radius: 20px;
  407. padding: 8px 16px;
  408. font-size: 12px;
  409. background: linear-gradient(135deg, #1c9bfd, #5eb7fc);
  410. border: none;
  411. box-shadow: 0 2px 8px rgba(28, 155, 253, 0.3);
  412. &:active {
  413. transform: translateY(1px);
  414. }
  415. }
  416. }
  417. }
  418. }
  419. .guide-footer {
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. margin-top: 20px;
  424. padding: 15px;
  425. background: #f8f9fa;
  426. border-radius: 8px;
  427. .van-icon {
  428. margin-right: 6px;
  429. color: #1c9bfd;
  430. font-size: 16px;
  431. }
  432. span {
  433. font-size: 13px;
  434. color: #666;
  435. }
  436. }
  437. }
  438. </style>