companyFund.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <view class="switch-roles">
  3. <nav-bar title="公司福利" color="#000"></nav-bar>
  4. <view class="roles-content">
  5. <view class="content">
  6. <view class="progress-num"> <text>3</text>/8 </view>
  7. <view class="title">
  8. <view>公司福利</view>
  9. <view class="check-num"> <text>{{ selectedCount }}</text>/{{ totalCount }} </view>
  10. </view>
  11. <view class="desc"> 选择公司提供的福利信息,以吸引更多求职者 </view>
  12. <!-- 福利分类 -->
  13. <view class="welfare-category" v-for="(category, categoryIndex) in welfareList" :key="categoryIndex">
  14. <view class="category-title">{{ category.title }}</view>
  15. <view class="check-box">
  16. <view
  17. class="check-item"
  18. v-for="(item, index) in category.items"
  19. :key="index"
  20. @click="checkItem(categoryIndex, index)"
  21. >
  22. <view class="check-icon" :class="{ 'check-icon-active': item.selected }">
  23. <u-icon
  24. name="checkmark"
  25. color="#fff"
  26. size="28"
  27. v-if="item.selected"
  28. ></u-icon>
  29. </view>
  30. <view class="check-txt">{{ item.name }}</view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 已选福利 -->
  37. <view class="check-list" v-if="selectedWelfare.length > 0">
  38. 已选:
  39. <view
  40. class="check-list-item"
  41. v-for="(item, index) in selectedWelfare"
  42. :key="index"
  43. @click="removeSelected(item.categoryIndex, item.itemIndex)"
  44. >
  45. {{ item.name }}
  46. <text class="remove-icon">×</text>
  47. </view>
  48. </view>
  49. <view class="submit-btn" @click="goJobPostingSecond">下一步</view>
  50. </view>
  51. </template>
  52. <script>
  53. import navBar from "@/components/nav-bar/index.vue";
  54. export default {
  55. data() {
  56. return {
  57. welfareList: [
  58. {
  59. title: "保险",
  60. items: [
  61. { name: "五险一金", selected: false },
  62. { name: "补充医疗保险", selected: false },
  63. { name: "意外险", selected: false },
  64. { name: "定期体检", selected: false }
  65. ]
  66. },
  67. {
  68. title: "薪资期权",
  69. items: [
  70. { name: "年终奖", selected: false },
  71. { name: "绩效奖金", selected: false },
  72. { name: "保底工资", selected: false },
  73. { name: "底薪加提成", selected: false },
  74. { name: "股票期权", selected: false },
  75. { name: "企业年金", selected: false }
  76. ]
  77. },
  78. {
  79. title: "补贴",
  80. items: [
  81. { name: "餐补", selected: false },
  82. { name: "交通补贴", selected: false },
  83. { name: "住房补贴", selected: false },
  84. { name: "加班补贴", selected: false },
  85. { name: "团建补贴", selected: false }
  86. ]
  87. },
  88. {
  89. title: "休假",
  90. items: [
  91. { name: "带薪年假", selected: false },
  92. { name: "节假日加班费", selected: false },
  93. { name: "法定节假日三薪", selected: false },
  94. { name: "员工购房", selected: false }
  95. ]
  96. }
  97. ],
  98. selectedCount: 0,
  99. totalCount: 20
  100. };
  101. },
  102. components: {
  103. navBar,
  104. },
  105. computed: {
  106. // 计算已选的福利项目
  107. selectedWelfare() {
  108. const selected = [];
  109. this.welfareList.forEach((category, categoryIndex) => {
  110. category.items.forEach((item, itemIndex) => {
  111. if (item.selected) {
  112. selected.push({
  113. name: item.name,
  114. categoryIndex: categoryIndex,
  115. itemIndex: itemIndex
  116. });
  117. }
  118. });
  119. });
  120. return selected;
  121. }
  122. },
  123. onLoad(options) {
  124. if (options.text) {
  125. this.text = options.text;
  126. }
  127. },
  128. methods: {
  129. // 选择/取消选择福利项目
  130. checkItem(categoryIndex, itemIndex) {
  131. const item = this.welfareList[categoryIndex].items[itemIndex];
  132. item.selected = !item.selected;
  133. // 更新选中数量
  134. this.updateSelectedCount();
  135. },
  136. // 移除已选项目
  137. removeSelected(categoryIndex, itemIndex) {
  138. this.welfareList[categoryIndex].items[itemIndex].selected = false;
  139. this.updateSelectedCount();
  140. },
  141. // 更新选中数量
  142. updateSelectedCount() {
  143. let count = 0;
  144. this.welfareList.forEach(category => {
  145. category.items.forEach(item => {
  146. if (item.selected) count++;
  147. });
  148. });
  149. this.selectedCount = count;
  150. },
  151. goJobPostingSecond() {
  152. if (this.selectedCount === 0) {
  153. uni.showToast({
  154. title: '请至少选择一项福利',
  155. icon: 'none'
  156. });
  157. return;
  158. }
  159. // 获取选中的福利列表
  160. const selectedBenefits = this.selectedWelfare.map(item => item.name);
  161. console.log('选中的福利:', selectedBenefits);
  162. // 跳转到下一页,传递选中的福利数据
  163. uni.navigateTo({
  164. url: "/pages/my/jobPostingSecond?benefits=" + encodeURIComponent(JSON.stringify(selectedBenefits))
  165. });
  166. }
  167. },
  168. mounted() {
  169. // 初始化总数量
  170. this.totalCount = this.welfareList.reduce((total, category) => total + category.items.length, 0);
  171. }
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. .switch-roles {
  176. background-color: #fff;
  177. position: absolute;
  178. left: 0;
  179. right: 0;
  180. top: 0;
  181. bottom: 0;
  182. display: flex;
  183. flex-direction: column;
  184. .roles-content {
  185. width: 100%;
  186. flex: 1;
  187. overflow: hidden;
  188. overflow-y: auto;
  189. .content {
  190. padding: 40rpx;
  191. box-sizing: border-box;
  192. display: flex;
  193. flex-direction: column;
  194. align-items: center;
  195. justify-content: center;
  196. .progress-num {
  197. color: #016bf6;
  198. font-family: DM Sans;
  199. font-size: 24rpx;
  200. font-weight: 500;
  201. width: 100%;
  202. padding-bottom: 20rpx;
  203. box-sizing: border-box;
  204. text {
  205. font-size: 48rpx;
  206. font-weight: 700;
  207. }
  208. }
  209. .title {
  210. color: #333;
  211. width: 100%;
  212. font-family: DM Sans;
  213. font-size: 48rpx;
  214. font-weight: 700;
  215. display: flex;
  216. justify-content: space-between;
  217. align-items: center;
  218. margin-bottom: 20rpx;
  219. .check-num {
  220. font-family: DM Sans;
  221. font-size: 32rpx;
  222. font-weight: 500;
  223. line-height: 60rpx;
  224. color: #999;
  225. text {
  226. color: #016bf6;
  227. font-size: 32rpx;
  228. }
  229. }
  230. }
  231. .desc {
  232. color: rgba(102, 102, 102, 1);
  233. width: 100%;
  234. font-family: DM Sans;
  235. font-size: 24rpx;
  236. font-weight: 400;
  237. line-height: 32rpx;
  238. letter-spacing: 0.5%;
  239. text-align: left;
  240. padding: 20rpx 0;
  241. box-sizing: border-box;
  242. margin-bottom: 20rpx;
  243. }
  244. .welfare-category {
  245. width: 100%;
  246. margin-bottom: 40rpx;
  247. .category-title {
  248. color: #333;
  249. font-family: DM Sans;
  250. font-size: 32rpx;
  251. font-weight: 600;
  252. margin-bottom: 24rpx;
  253. padding-left: 10rpx;
  254. border-left: 6rpx solid #016bf6;
  255. }
  256. .check-box {
  257. width: 100%;
  258. display: grid;
  259. grid-template-columns: repeat(2, 1fr);
  260. gap: 20rpx;
  261. .check-item {
  262. padding: 20rpx 24rpx;
  263. box-sizing: border-box;
  264. border-radius: 16rpx;
  265. border: 2rpx solid rgba(227, 231, 236, 1);
  266. display: flex;
  267. align-items: center;
  268. gap: 20rpx;
  269. background: #f8f9fa;
  270. .check-icon {
  271. width: 40rpx;
  272. height: 40rpx;
  273. border-radius: 8rpx;
  274. border: 2rpx solid rgba(227, 231, 236, 1);
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. background: #fff;
  279. flex-shrink: 0;
  280. }
  281. .check-icon-active {
  282. background-color: #016bf6;
  283. border-color: #016bf6;
  284. }
  285. .check-txt {
  286. color: rgba(23, 23, 37, 1);
  287. font-family: DM Sans;
  288. font-size: 26rpx;
  289. font-weight: 400;
  290. line-height: 36rpx;
  291. flex: 1;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. }
  298. .check-list {
  299. flex-shrink: 0;
  300. padding: 20rpx 40rpx;
  301. background: #f8f9fa;
  302. border-top: 1rpx solid #eee;
  303. display: flex;
  304. flex-wrap: wrap;
  305. align-items: center;
  306. gap: 16rpx;
  307. .check-list-item {
  308. background: #016bf6;
  309. color: #fff;
  310. padding: 8rpx 20rpx;
  311. border-radius: 20rpx;
  312. font-size: 24rpx;
  313. display: flex;
  314. align-items: center;
  315. gap: 8rpx;
  316. .remove-icon {
  317. font-size: 28rpx;
  318. font-weight: bold;
  319. margin-left: 8rpx;
  320. cursor: pointer;
  321. }
  322. }
  323. }
  324. .submit-btn {
  325. flex-shrink: 0;
  326. border-radius: 999px;
  327. background: #ff6600;
  328. color: rgba(255, 255, 255, 1);
  329. font-family: DM Sans;
  330. font-size: 32rpx;
  331. font-weight: 400;
  332. line-height: 48rpx;
  333. display: flex;
  334. justify-content: center;
  335. align-items: center;
  336. padding: 24rpx 32rpx;
  337. box-sizing: border-box;
  338. margin: 30rpx 40rpx;
  339. margin-top: 20rpx;
  340. }
  341. }
  342. </style>