Mall.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="usremei-container">
  3. <div class="top-bg"></div>
  4. <div class="desc-card">
  5. <div class="desc-title">国家社会保险公共服务平台《民生为本》万亿补贴!</div>
  6. <div class="desc-content">
  7. 国家鼓励民众参与《退休计划补贴政策》,使用红旗资产参与退休计划获得退休金,退休金是国家按照社会保障制度规定,根据对社会所作出的贡献和所具备的享有享受养老保险待遇或退休条件,因年老丧失劳动能力退出劳动岗位后的基本生活而建立的一种社会保险制度,主要用于保障职工退休后的生活需要
  8. </div>
  9. </div>
  10. <div
  11. class="plan-card"
  12. v-for="item in plans"
  13. :key="item.id"
  14. >
  15. <div class="plan-header">
  16. {{ item.title }}
  17. </div>
  18. <div class="plan-table-row">
  19. <div class="plan-col">
  20. <div class="plan-label">参与金额</div>
  21. <div class="plan-value">{{ item.money }}红旗资产</div>
  22. </div>
  23. <div class="plan-col">
  24. <div class="plan-label">退休金</div>
  25. <div class="plan-value">{{ item.computing_power }}</div>
  26. </div>
  27. <div class="plan-col">
  28. <div class="plan-label">日收益</div>
  29. <div class="plan-value">{{ item.power }}%</div>
  30. </div>
  31. <div class="plan-col-btn">
  32. <button
  33. class="plan-btn"
  34. :class="{ 'disabled': !canClick(item) }"
  35. @click="canClick(item) && toPayment(item)"
  36. :disabled="!canClick(item)"
  37. >
  38. {{ canClick(item) ? '立即参与' : '已参与' }}
  39. </button>
  40. </div>
  41. </div>
  42. </div>
  43. <div v-if="loading" class="loading-mask">
  44. <div class="loading-spinner"></div>
  45. <div>加载中...</div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import {getMiner,getUserInfo,joinRetirement} from '@/api/home.js'
  51. import { Toast } from 'vant';
  52. export default {
  53. name: 'Mall',
  54. data() {
  55. return {
  56. plans: [
  57. {
  58. "id": 1,
  59. "type": 1,
  60. "title": "初级退休补贴金",
  61. "money": "30000",
  62. "rent_cycle": 1825,
  63. "computing_power": "3000",
  64. "power": "10",
  65. },
  66. {
  67. "id": 2,
  68. "type": 2,
  69. "title": "一级退休补贴金",
  70. "money": "60000",
  71. "rent_cycle": 1825,
  72. "computing_power": "6000",
  73. "power": "10",
  74. },
  75. {
  76. "id": 3,
  77. "type": 3,
  78. "title": "二级退休补贴金",
  79. "money": "100000",
  80. "rent_cycle": 1825,
  81. "computing_power": "10000",
  82. "power": "10",
  83. },
  84. {
  85. "id": 4,
  86. "type": 4,
  87. "title": "三级退休补贴金",
  88. "money": "200000",
  89. "rent_cycle": 1825,
  90. "computing_power": "20000",
  91. "power": "10",
  92. }
  93. ],
  94. userInfo: {},
  95. loading: false
  96. }
  97. },
  98. methods:{
  99. async getUserInfo() {
  100. const res = await getUserInfo();
  101. this.userInfo = res.data;
  102. },
  103. getPlans(){
  104. let data = {
  105. page:'',
  106. size:'',
  107. type:1
  108. }
  109. getMiner(data).then(res=>{
  110. if(res.code === 1){
  111. this.plans = res.data
  112. }
  113. })
  114. },
  115. toPayment(item) {
  116. this.loading = true;
  117. joinRetirement(item.type)
  118. .then(res => {
  119. Toast({
  120. message: res.msg || (res.code === 1 ? '参与成功' : '参与失败'),
  121. duration: 2000,
  122. onClose: () => {
  123. if (res.code === 1) {
  124. this.getUserInfo();
  125. }
  126. }
  127. });
  128. })
  129. .catch(err => {
  130. Toast('网络异常,请重试');
  131. console.error(err);
  132. })
  133. .finally(() => {
  134. this.loading = false;
  135. });
  136. },
  137. canClick(item) {
  138. const { chuji, yiji, erji, sanji } = this.userInfo;
  139. switch(item.id) {
  140. case 1:
  141. return chuji === 0;
  142. case 2:
  143. return yiji === 0;
  144. case 3:
  145. return erji === 0;
  146. case 4:
  147. return sanji === 0;
  148. default:
  149. return false;
  150. }
  151. },
  152. },
  153. mounted() {
  154. this.getUserInfo()
  155. // this.getPlans()
  156. },
  157. }
  158. </script>
  159. <style scoped>
  160. .usremei-container {
  161. min-height: 100vh;
  162. background-image: url('../assets/dabag.png');
  163. background-size: cover;
  164. background-position: center;
  165. padding-top: 60px;
  166. padding-bottom: 80px; /* 为底部tab预留空间 */
  167. box-sizing: border-box; /* 确保padding不会增加容器高度 */
  168. overflow-y: auto; /* 允许内容滚动 */
  169. position: relative; /* 为fixed定位提供参考 */
  170. }
  171. .desc-card {
  172. background: #fff8e1;
  173. box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  174. margin: 0px 16px 24px 16px;
  175. padding: 18px 16px 12px 16px;
  176. z-index: 2;
  177. position: relative;
  178. }
  179. .desc-title {
  180. font-size: 14px;
  181. font-weight: bold;
  182. margin-bottom: 8px;
  183. }
  184. .desc-content {
  185. font-size: 12px;
  186. color: #333;
  187. line-height: 1.7;
  188. }
  189. .plan-card {
  190. background: #d0021b;
  191. border-radius: 8px;
  192. margin: 0 16px 22px 16px;
  193. box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  194. }
  195. .plan-header {
  196. background: #fff8e1;
  197. color: #333;
  198. font-size: 14px;
  199. font-weight: bold;
  200. padding: 6px 12px;
  201. border-bottom: 1px solid #f5c6cb;
  202. }
  203. .plan-table-row {
  204. display: flex;
  205. align-items: center;
  206. justify-content: space-between;
  207. background: #fff;
  208. padding: 0 18px;
  209. height: 70px;
  210. }
  211. .plan-col {
  212. width:auto;
  213. font-size:12px;
  214. white-space: nowrap;
  215. display: flex;
  216. flex-direction: column;
  217. justify-content: center;
  218. align-items: flex-start;
  219. }
  220. .plan-label {
  221. color: #333;
  222. font-size: 14px;
  223. font-weight: bold;
  224. margin-bottom: 2px;
  225. }
  226. .plan-value {
  227. margin-top:6px;
  228. font-size: 14px;
  229. text-align:center;
  230. }
  231. .plan-col-btn {
  232. display: flex;
  233. justify-content: center;
  234. align-items: center;
  235. }
  236. .plan-btn {
  237. background: #b80032;
  238. color: #fff;
  239. border: none;
  240. border-radius: 18px;
  241. padding: 2px 6px;
  242. font-size: 14px;
  243. cursor: pointer;
  244. transition: background 0.2s;
  245. }
  246. .plan-btn:hover {
  247. background: #a00028;
  248. }
  249. .plan-btn.disabled {
  250. background: #cccccc;
  251. cursor: not-allowed;
  252. }
  253. .loading-mask {
  254. position: fixed;
  255. left: 0; top: 0; right: 0; bottom: 0;
  256. background: rgba(0,0,0,0.3);
  257. z-index: 9999;
  258. display: flex;
  259. flex-direction: column;
  260. align-items: center;
  261. justify-content: center;
  262. }
  263. .loading-spinner {
  264. border: 4px solid #f3f3f3;
  265. border-top: 4px solid #b80032;
  266. border-radius: 50%;
  267. width: 40px; height: 40px;
  268. animation: spin 1s linear infinite;
  269. margin-bottom: 10px;
  270. }
  271. @keyframes spin {
  272. 0% { transform: rotate(0deg);}
  273. 100% { transform: rotate(360deg);}
  274. }
  275. </style>