companyFund.vue 9.7 KB

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