benefits.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353
  1. <template>
  2. <view class="benefits-page" :style="{ paddingTop: (12 + statusBarHeight + 44) + 'px' }">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
  5. <view class="nav-content">
  6. <view class="nav-left" @click="goBack">
  7. <u-icon name="arrow-leftward" color="rgba(255, 255, 255, 1)" size="42"></u-icon>
  8. </view>
  9. <view class="nav-title">我的权益</view>
  10. <view class="nav-right"></view>
  11. </view>
  12. </view>
  13. <!-- 当前会员状态卡片 -->
  14. <view class="membership-card">
  15. <view class="card-content">
  16. <view class="card-left">
  17. <view class="card-title">我的权益</view>
  18. <view class="card-subtitle">{{vipName}} 剩余{{remainingDays}}天到期</view>
  19. </view>
  20. <view class="card-right">
  21. <view class="benefit-item">
  22. <view class="benefit-label">查看权益</view>
  23. <view class="benefit-count">{{myViewTimes}}/{{vipViewTimes}}</view>
  24. </view>
  25. <view class="benefit-item">
  26. <view class="benefit-label">沟通权益</view>
  27. <view class="benefit-count">{{myConTimes}}/{{vipConTimes}}</view>
  28. </view>
  29. <view class="benefit-item">
  30. <view class="benefit-label">普通职位</view>
  31. <view class="benefit-count">{{myPostTimes}}/{{vipPostTimes}}</view>
  32. </view>
  33. <view class="benefit-item">
  34. <view class="benefit-label">急聘职位</view>
  35. <view class="benefit-count">{{myDueTimes}}/{{vipDueTimes}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 购买VIP享受更多权益 -->
  41. <view class="benefits-section">
  42. <!-- 权益对比表格 -->
  43. <view class="benefits-table">
  44. <view class="section-title">购买VIP, 享受更多权益</view>
  45. <!-- 表头 -->
  46. <view class="table-header">
  47. <view class="header-cell benefit-type">权益类型</view>
  48. <view class="header-cell basic">基础权益</view>
  49. <view class="header-cell regular active">
  50. <!-- <view class="plan-tag">生效中</view> -->
  51. <view class="plan-name">常规版</view>
  52. <view class="plan-expire">剩余5天到期</view>
  53. </view>
  54. <view class="header-cell vip">VIP版</view>
  55. <view class="header-cell flagship recommended">
  56. <view class="plan-tag">推荐</view>
  57. <view class="plan-name">旗舰版</view>
  58. </view>
  59. </view>
  60. <!-- 表格内容 -->
  61. <view class="table-row">
  62. <view class="row-cell benefit-type">在线普通职位</view>
  63. <view class="row-cell basic">10个</view>
  64. <view class="row-cell regular">35个</view>
  65. <view class="row-cell vip">45个</view>
  66. <view class="row-cell flagship">不限</view>
  67. </view>
  68. <view class="table-row">
  69. <view class="row-cell benefit-type">在线急聘职位</view>
  70. <view class="row-cell basic">0个</view>
  71. <view class="row-cell regular">5个</view>
  72. <view class="row-cell vip">15个</view>
  73. <view class="row-cell flagship">50个</view>
  74. </view>
  75. <view class="table-row">
  76. <view class="row-cell benefit-type">每日查看总数</view>
  77. <view class="row-cell basic">20个</view>
  78. <view class="row-cell regular">50个</view>
  79. <view class="row-cell vip">不限</view>
  80. <view class="row-cell flagship">不限</view>
  81. </view>
  82. <view class="table-row">
  83. <view class="row-cell benefit-type">每日沟通总数</view>
  84. <view class="row-cell basic">5个</view>
  85. <view class="row-cell regular">20个</view>
  86. <view class="row-cell vip">50个</view>
  87. <view class="row-cell flagship">100个</view>
  88. </view>
  89. <view class="table-row">
  90. <view class="row-cell benefit-type">查看沟通范围</view>
  91. <view class="row-cell basic">仅普通职位</view>
  92. <view class="row-cell regular">仅普通职位</view>
  93. <view class="row-cell vip">不限</view>
  94. <view class="row-cell flagship">不限</view>
  95. </view>
  96. <view class="table-row price-row">
  97. <view class="row-cell benefit-type">价格</view>
  98. <view class="row-cell basic">免费</view>
  99. <view class="row-cell regular">¥599/年</view>
  100. <view class="row-cell vip">¥1599/年</view>
  101. <view class="row-cell flagship">¥2599/年</view>
  102. </view>
  103. </view>
  104. <!-- 说明文字 -->
  105. <view class="notes">
  106. <view class="note-item">
  107. <text class="note-number">1.</text>
  108. <text class="note-text">基础&常规权益中,查看和开聊权限仅限普通职位使用</text>
  109. </view>
  110. <view class="note-item">
  111. <text class="note-number">2.</text>
  112. <text class="note-text">在常规版本体验期中购买VIP及以上版本体验卡将会立即失效</text>
  113. </view>
  114. <view class="note-item">
  115. <text class="note-number">3.</text>
  116. <text class="note-text">你可以直接购买VIP,也可以</text>
  117. <text class="note-link" @click="viewAllBenefits">查看全部权益包</text>
  118. <text class="note-text">进行购买</text>
  119. </view>
  120. <view class="note-item">
  121. <text class="note-number">4.</text>
  122. <text class="note-text">如有问题,请联系我的客服</text>
  123. </view>
  124. </view>
  125. </view>
  126. <!-- 升级VIP按钮 -->
  127. <view class="flex flex-column justify-evenly" style="width:100%;flex-direction: column;padding-bottom: 16px;">
  128. <view class="flex flex-direction align-start flex-wrap" style="width: 88%; margin: auto;">
  129. <view class="flex" style="width: 100%">
  130. <u-checkbox size="28rpx" v-model="checked" shape="circle">
  131. <view class="flex" style="flex-direction: row;">开通即同意<navigator style="color: #016bf6"
  132. url="/my/setting/weekXiYi" open-type="navigate">《会员开通协议》</navigator>
  133. </view>
  134. </u-checkbox>
  135. </view>
  136. </view>
  137. <view class="upgrade-button" @click="showPaymentModal">
  138. 升级VIP
  139. </view>
  140. </view>
  141. <!-- 支付弹窗 -->
  142. <u-popup v-model="showPayment" mode="bottom" border-radius="42" height="auto" :safe-area-inset-bottom="true">
  143. <view class="payment-picker">
  144. <view class="picker-header">
  145. <text class="picker-title">选择会员版本</text>
  146. </view>
  147. <view class="picker-content">
  148. <view class="plan-option" :class="{ active: selectedPlan === item.id }" @click="selectPlan(item.id)"
  149. v-for="(item,index) in viplist" :key="item.id || index">
  150. <view class="option-left">
  151. <view class="radio-btn" :class="{ checked: selectedPlan === item.id }">
  152. <u-icon v-if="selectedPlan === item.id" name="checkmark" color="#ffffff"
  153. size="28"></u-icon>
  154. </view>
  155. <text class="option-text">{{item.vipName}}</text>
  156. <view class="price-tag">
  157. <text>¥{{item.money}}</text>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <!-- 支付按钮 -->
  163. <view class="payment-button" @click="confirmPayment">
  164. <text>确认支付 ¥{{ getSelectedPrice() }}</text>
  165. </view>
  166. </view>
  167. </u-popup>
  168. </view>
  169. </template>
  170. <script>
  171. export default {
  172. data() {
  173. return {
  174. statusBarHeight: 0, // 状态栏高度
  175. // 当前会员信息
  176. currentPlan: 'regular',
  177. openWay: 1,
  178. isVip: false,
  179. isVipC: "",
  180. dataTime: "", //到期时间
  181. dataTimeC: "",
  182. isTrue: true,
  183. msgNum: 0, //非会员每天免费联系次数
  184. vipMsgNum: 0, //会员每天免费联系次数
  185. msgPrice: 0, //非会员每次联系价格
  186. vipMsgPrice: 0, //会员每次联系价格
  187. vipNum: 0,
  188. noVipNum: 0,
  189. vipNumCom: 0,
  190. noVipNumCom: 0,
  191. userMonthTime: "", //用户会员到期时间
  192. companyMonthTime: "", //企业会员到期时间
  193. vipPrice: "0", //会员价格
  194. viplist: [],
  195. endTime:"",
  196. createTime:"",
  197. remainingDays: 0, // 剩余天数
  198. vipName:"",
  199. vipStatus: "未开通VIP", // VIP状态文字(已过期/剩余x天到期/未开通VIP)
  200. totalValidDays: 0, // 总有效期天数(可选)
  201. myPostTimes:0,
  202. vipDueTimes:0,
  203. vipConTimes:0,
  204. myViewTimes:0,
  205. vipViewTimes:0,
  206. myConTimes:0,
  207. vipPostTimes:0,
  208. myDueTimes:0,
  209. // 权益使用情况
  210. benefits: {
  211. view: {
  212. used: 10,
  213. total: 50
  214. },
  215. communicate: {
  216. used: 10,
  217. total: 50
  218. },
  219. regularJobs: {
  220. used: 10,
  221. total: 50
  222. },
  223. urgentJobs: {
  224. used: 10,
  225. total: 50
  226. }
  227. },
  228. checked: false,
  229. // 支付弹窗
  230. showPayment: false,
  231. selectedPlan: '',
  232. planPrices: {
  233. regular: 599,
  234. vip: 1599,
  235. flagship: 2599
  236. }
  237. }
  238. },
  239. onLoad() {
  240. // 获取状态栏高度
  241. let systemInfo = uni.getSystemInfoSync();
  242. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  243. this.userType = uni.getStorageSync("userType");
  244. if (this.userType == 1) {
  245. //用户简历的刷新次数
  246. this.getVipPeople();
  247. this.getNoVipPeople();
  248. } else {
  249. this.getVipCom();
  250. this.getNoVipCom();
  251. }
  252. // this.getVipPrice();
  253. // #ifdef APP-PLUS
  254. this.openLists = [{
  255. image: "../../static/images/my/zhifubao.png",
  256. text: "支付宝",
  257. id: 1,
  258. },
  259. {
  260. image: "../../static/images/my/icon_weixin.png",
  261. text: "微信",
  262. id: 2,
  263. },
  264. ];
  265. this.openWay = 1;
  266. // #endif
  267. // #ifdef MP-WEIXIN
  268. this.openLists = [{
  269. image: "../../static/share/icon_weixin.png",
  270. text: "微信",
  271. id: 2,
  272. }, ];
  273. this.openWay = 2;
  274. // #endif
  275. // #ifdef H5
  276. let ua = navigator.userAgent.toLowerCase();
  277. if (ua.indexOf("micromessenger") !== -1) {
  278. this.openLists = [{
  279. image: "../../static/images/my/zhifubao.png",
  280. text: "支付宝",
  281. id: 1,
  282. },
  283. {
  284. image: "../../static/share/icon_weixin.png",
  285. text: "微信",
  286. id: 2,
  287. },
  288. ];
  289. } else {
  290. this.openLists = [{
  291. image: "../../static/images/my/zhifubao.png",
  292. text: "支付宝",
  293. id: 1,
  294. }, ];
  295. }
  296. this.openWay = 1;
  297. // #endif
  298. },
  299. onShow() {
  300. this.selectVipDetails();
  301. this.getVipdetile();
  302. },
  303. methods: {
  304. // 返回上一页
  305. goBack() {
  306. uni.navigateBack()
  307. },
  308. //支付
  309. // 确认支付
  310. confirmPayment() {
  311. let that = this;
  312. // 验证是否选择了会员套餐
  313. if (!this.selectedPlan) {
  314. uni.showToast({
  315. title: "请选择会员套餐",
  316. icon: "none"
  317. });
  318. return;
  319. }
  320. // 验证是否勾选了协议
  321. if (!this.checked) {
  322. uni.showToast({
  323. title: "请阅读并同意《会员开通协议》",
  324. icon: "none"
  325. });
  326. return;
  327. }
  328. if (that.isTrue == false) {
  329. return;
  330. }
  331. let token = uni.getStorageSync('token');
  332. if (!token) {
  333. uni.showToast({
  334. title: "登录过期",
  335. icon: "none"
  336. });
  337. return;
  338. }
  339. console.log('进入支付,选择的套餐ID:', this.selectedPlan);
  340. that.isTrue = false;
  341. // 获取选中的套餐详情
  342. const selectedPackage = this.viplist.find(item => item.id === this.selectedPlan);
  343. const amount = selectedPackage ? selectedPackage.money : 0;
  344. // 根据不同平台和支付方式调用不同的支付接口
  345. if (this.openWay == 2) {
  346. // 微信支付
  347. // #ifdef APP-PLUS
  348. this.$Request
  349. .post("/app/wxPay/wxPayOrder", {
  350. classify: 1,
  351. money: amount,
  352. type: this.selectedPlan,
  353. //Id: this.selectedPlan, // 传递选中的VIP套餐ID
  354. //vipName: selectedPackage ? selectedPackage.vipName : '' // 传递套餐名称
  355. })
  356. .then((ret) => {
  357. this.isCheckPay(ret.code, "wxpay", JSON.stringify(ret.data));
  358. })
  359. .catch(() => {
  360. that.isTrue = true;
  361. uni.showToast({
  362. title: "请求失败,请重试",
  363. icon: "none"
  364. });
  365. });
  366. // #endif
  367. // #ifdef MP-WEIXIN
  368. this.$Request
  369. .post("/app/wxPay/wxPayOrder", {
  370. classify: 3,
  371. money: amount,
  372. type: this.selectedPlan,
  373. //Id: this.selectedPlan, // 传递选中的VIP套餐ID
  374. //vipName: selectedPackage ? selectedPackage.vipName : '' // 传递套餐名称
  375. })
  376. .then((ret) => {
  377. uni.hideLoading();
  378. console.log(ret.data);
  379. uni.requestPayment({
  380. provider: "wxpay",
  381. timeStamp: ret.data.timestamp,
  382. nonceStr: ret.data.noncestr,
  383. package: ret.data.package,
  384. signType: ret.data.signType,
  385. paySign: ret.data.sign,
  386. success: function(suc) {
  387. console.log("success:" + JSON.stringify(suc));
  388. uni.showToast({
  389. title: "支付成功",
  390. icon: "success",
  391. });
  392. that.showPayment = false;
  393. that.isTrue = true;
  394. that.getUserInfo();
  395. // 支付成功后刷新页面数据
  396. that.selectVipDetails();
  397. },
  398. fail: function(err) {
  399. console.log("fail:" + JSON.stringify(err));
  400. that.isTrue = true;
  401. uni.showToast({
  402. title: "支付失败",
  403. icon: "none",
  404. });
  405. },
  406. });
  407. })
  408. .catch(() => {
  409. that.isTrue = true;
  410. uni.showToast({
  411. title: "请求失败,请重试",
  412. icon: "none"
  413. });
  414. });
  415. // #endif
  416. // #ifdef H5
  417. let ua = navigator.userAgent.toLowerCase();
  418. if (ua.indexOf("micromessenger") !== -1) {
  419. let data = {
  420. classify: 2,
  421. money: amount,
  422. type: this.selectedPlan,
  423. //Id: this.selectedPlan, // 传递选中的VIP套餐ID
  424. //vipName: selectedPackage ? selectedPackage.vipName : '' // 传递套餐名称
  425. };
  426. this.$Request.postJson("/app/wxPay/wxPayOrder", data).then((res) => {
  427. if (res.code == 0) {
  428. this.callPay(res.data);
  429. } else {
  430. that.isTrue = true;
  431. uni.showToast({
  432. icon: "none",
  433. title: "支付失败!",
  434. });
  435. }
  436. }).catch(() => {
  437. that.isTrue = true;
  438. uni.showToast({
  439. title: "请求失败,请重试",
  440. icon: "none"
  441. });
  442. });
  443. }
  444. // #endif
  445. } else {
  446. // 支付宝支付
  447. // #ifdef APP
  448. console.log("APP进入支付。");
  449. const datas = {
  450. classify: 4,
  451. money: amount,
  452. type: this.selectedPlan,
  453. //Id: this.selectedPlan, // 传递选中的VIP套餐ID
  454. //vipName: selectedPackage ? selectedPackage.vipName : '' // 传递套餐名称
  455. };
  456. this.$Request.postT("/app/aliPay/payMoneyOrder", datas).then((ret) => {
  457. this.showPayment = false;
  458. console.log(ret);
  459. this.isCheckPay(ret.code, "alipay", ret.data);
  460. }).catch(() => {
  461. that.isTrue = true;
  462. uni.showToast({
  463. title: "请求失败,请重试",
  464. icon: "none"
  465. });
  466. });
  467. // #endif
  468. // #ifdef H5
  469. let data = {
  470. classify: 5, //支付方式
  471. money: 0.1,
  472. type: this.selectedPlan,
  473. //Id: this.selectedPlan, // 传递选中的VIP套餐ID
  474. //vipName: selectedPackage ? selectedPackage.vipName : '' // 传递套餐名称
  475. };
  476. this.$Request.postT("/app/aliPay/payMoneyOrder", data).then((res) => {
  477. if (res.code === 0) {
  478. this.showPayment = false;
  479. that.isTrue = true;
  480. const div = document.createElement("div");
  481. div.innerHTML = res.data; //此处form就是后台返回接收到的数据
  482. document.body.appendChild(div);
  483. document.forms[0].submit();
  484. } else {
  485. that.isTrue = true;
  486. uni.showToast({
  487. icon: "none",
  488. title: "支付失败!",
  489. });
  490. }
  491. }).catch(() => {
  492. that.isTrue = true;
  493. uni.showToast({
  494. title: "请求失败,请重试",
  495. icon: "none"
  496. });
  497. });
  498. // #endif
  499. }
  500. },
  501. callPay: function(response) {
  502. if (typeof WeixinJSBridge === "undefined") {
  503. if (document.addEventListener) {
  504. document.addEventListener(
  505. "WeixinJSBridgeReady",
  506. this.onBridgeReady(response),
  507. false
  508. );
  509. } else if (document.attachEvent) {
  510. document.attachEvent("WeixinJSBridgeReady", this.onBridgeReady(response));
  511. document.attachEvent("onWeixinJSBridgeReady", this.onBridgeReady(response));
  512. }
  513. } else {
  514. this.onBridgeReady(response);
  515. }
  516. },
  517. onBridgeReady: function(response) {
  518. let that = this;
  519. if (!response.package) {
  520. return;
  521. }
  522. console.log(response, "++++++++");
  523. WeixinJSBridge.invoke(
  524. "getBrandWCPayRequest", {
  525. appId: response.appid, //公众号名称,由商户传入
  526. timeStamp: response.timestamp, //时间戳,自1970年以来的秒数
  527. nonceStr: response.noncestr, //随机串
  528. package: response.package,
  529. signType: response.signType, //微信签名方式:
  530. paySign: response.sign, //微信签名
  531. },
  532. function(res) {
  533. console.log(res, "/*-/*-/*-");
  534. if (res.err_msg === "get_brand_wcpay_request:ok") {
  535. // 使用以上方式判断前端返回,微信团队郑重提示:
  536. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  537. uni.showLoading({
  538. title: "支付成功",
  539. });
  540. setTimeout(function() {
  541. that.isTrue = true;
  542. uni.hideLoading();
  543. }, 1000);
  544. that.show = false;
  545. that.getUserInfo();
  546. } else {
  547. that.isTrue = true;
  548. uni.hideLoading();
  549. }
  550. WeixinJSBridge.log(response.err_msg);
  551. }
  552. );
  553. },
  554. isCheckPay(status, name, order) {
  555. let that = this;
  556. if (status == 0) {
  557. this.setPayment(name, order);
  558. } else {
  559. uni.hideLoading();
  560. that.isTrue = true;
  561. uni.showToast({
  562. title: "支付信息有误",
  563. icon: "none",
  564. });
  565. }
  566. },
  567. setPayment(name, order) {
  568. let that = this;
  569. console.log("*-*-*");
  570. uni.requestPayment({
  571. provider: name,
  572. orderInfo: order, //微信、支付宝订单数据
  573. success: function(res) {
  574. console.log(res);
  575. uni.hideLoading();
  576. uni.showLoading({
  577. title: "支付成功",
  578. });
  579. that.show = false;
  580. that.getUserInfo();
  581. that.isTrue = true;
  582. },
  583. fail: function(err) {
  584. console.log(err);
  585. that.isTrue = true;
  586. uni.hideLoading();
  587. },
  588. complete() {
  589. that.isTrue = true;
  590. uni.hideLoading();
  591. },
  592. });
  593. },
  594. selectWay: function(item) {
  595. this.openWay = item.id;
  596. },
  597. //获取会员开通价格
  598. getVipPrice() {
  599. if (uni.getStorageSync("userType") == 1) {
  600. //用户会员价格
  601. this.$Request.get("/app/common/type/331").then((res) => {
  602. if (res.code == 0) {
  603. this.planPrices = res.data.value;
  604. }
  605. });
  606. } else {
  607. //企业会员价格
  608. this.$Request.get("/app/common/type/332").then((res) => {
  609. if (res.code == 0) {
  610. this.planPrices = res.data.value;
  611. }
  612. });
  613. }
  614. },
  615. //vip 套餐
  616. selectVipDetails() {
  617. this.$Request.get("/app/VipDetails/selectVipDetails").then((res) => {
  618. if (res.code == 0) {
  619. this.viplist = res.data
  620. if (this.viplist.length > 0) {
  621. this.selectedPlan = this.viplist[0].id;
  622. }
  623. } else {
  624. uni.showToast({
  625. title: '暂无VIP套餐',
  626. icon: 'none'
  627. })
  628. }
  629. });
  630. },
  631. //获取个人信息
  632. getUserInfo() {
  633. this.$Request.get("/app/user/selectUserById").then((res) => {
  634. if (res.code == 0) {
  635. if (res.data.isUserVip + "" == 1) {
  636. this.isVip = true;
  637. this.dataTime = res.data.userMonthTime;
  638. } else {
  639. this.isVip = false;
  640. }
  641. if (res.data.isCompanyVip + "" == "1") {
  642. this.isVipC = true;
  643. this.dataTimeC = res.data.companyMonthTime;
  644. } else {
  645. this.isVipC = false;
  646. }
  647. }
  648. });
  649. },
  650. //获取vip个人信息
  651. getUserInfo() {
  652. this.$Request.get("/app/user/vipData").then((res) => {
  653. if (res.code == 0) {
  654. this.myPostTimes=res.data.myPostTimes || 0
  655. this.vipDueTimes=res.data.vipDueTimes || 0
  656. this.vipConTimes=res.data.vipConTimes || 0
  657. this.myViewTimes=res.data.myViewTimes || 0
  658. this.vipViewTimes=res.data.vipViewTimes || 0
  659. this.myConTimes=res.data.myConTimes || 0
  660. this.vipPostTimes=res.data.vipPostTimes || 0
  661. this.myDueTimes=res.data.myDueTimes || 0
  662. }
  663. });
  664. },
  665. //会员剩余天数
  666. getVipdetile() {
  667. this.$Request.get("/app/UserVip/selectUserVip").then((res) => {
  668. if (res.code == 0) {
  669. const endTimeStr = res.data.endTime; // 到期时间(格式:yyyy-MM-dd HH:mm:ss 或 yyyy-MM-dd)
  670. const createTimeStr = res.data.createTime; // 创建时间(格式同上)
  671. // 1. 时间字符串转时间戳(兼容不同格式)
  672. const endTime = this.formatTimeToTimestamp(endTimeStr);
  673. const createTime = this.formatTimeToTimestamp(createTimeStr);
  674. const currentTime = new Date().getTime(); // 当前时间戳
  675. // 2. 验证时间有效性
  676. if (!endTime || !createTime) {
  677. console.error("时间格式错误", { endTimeStr, createTimeStr });
  678. this.remainingDays = 0;
  679. this.vipStatus = "已过期";
  680. return;
  681. }
  682. if(res.data.vipDetails){
  683. this.vipName=res.data.vipDetails.vipName
  684. }
  685. // 3. 计算剩余时间(毫秒):到期时间 - 当前时间
  686. const remainingTime = endTime - currentTime;
  687. // 4. 处理不同情况
  688. if (remainingTime <= 0) {
  689. // 已过期
  690. this.remainingDays = 0;
  691. this.vipStatus = "已过期";
  692. } else {
  693. // 计算剩余天数(向上取整,不足1天按1天算)
  694. const days = Math.ceil(remainingTime / (1000 * 60 * 60 * 24));
  695. this.remainingDays = days;
  696. this.vipStatus = `剩余${days}天到期`;
  697. // 可选:如果需要显示总有效期(创建到到期的总天数)
  698. this.totalValidDays = Math.ceil((endTime - createTime) / (1000 * 60 * 60 * 24));
  699. }
  700. console.log("VIP剩余天数:", this.remainingDays);
  701. console.log("VIP状态:", this.vipStatus);
  702. } else {
  703. // 无VIP数据
  704. this.remainingDays = 0;
  705. this.vipStatus = "未开通VIP";
  706. // uni.showToast({
  707. // title: res.msg || "获取VIP信息失败",
  708. // icon: "none"
  709. // });
  710. }
  711. }).catch((err) => {
  712. console.error("获取VIP详情失败", err);
  713. this.remainingDays = 0;
  714. this.vipStatus = "未开通VIP";
  715. // uni.showToast({
  716. // title: "获取VIP信息失败,请重试",
  717. // icon: "none"
  718. // });
  719. });
  720. },
  721. // 辅助方法:时间字符串转时间戳(兼容 yyyy-MM-dd HH:mm:ss 和 yyyy-MM-dd 格式)
  722. formatTimeToTimestamp(timeStr) {
  723. if (!timeStr) return null;
  724. // 处理 iOS 不兼容的 "-" 分隔符(替换为 "/")
  725. const formattedTime = timeStr.replace(/-/g, "/");
  726. const timestamp = new Date(formattedTime).getTime();
  727. // 验证是否为有效时间戳
  728. return isNaN(timestamp) ? null : timestamp;
  729. },
  730. //会员简历刷新次数
  731. getVipPeople() {
  732. this.$Request.get("/app/common/type/328").then((res) => {
  733. if (res.code == 0) {
  734. this.vipNum = res.data.value;
  735. }
  736. });
  737. },
  738. //非会员简历刷新次数
  739. getNoVipPeople() {
  740. this.$Request.get("/app/common/type/327").then((res) => {
  741. if (res.code == 0) {
  742. this.noVipNum = res.data.value;
  743. }
  744. });
  745. },
  746. //会员岗位刷新次数
  747. getVipCom() {
  748. this.$Request.get("/app/common/type/330").then((res) => {
  749. if (res.code == 0) {
  750. this.vipNumCom = res.data.value;
  751. }
  752. });
  753. },
  754. //非会员岗位刷新次数
  755. getNoVipCom() {
  756. this.$Request.get("/app/common/type/329").then((res) => {
  757. if (res.code == 0) {
  758. this.noVipNumCom = res.data.value;
  759. }
  760. });
  761. },
  762. // 查看全部权益包
  763. viewAllBenefits() {
  764. uni.showToast({
  765. title: '查看全部权益包',
  766. icon: 'none'
  767. })
  768. },
  769. // 显示支付弹窗
  770. showPaymentModal() {
  771. if (this.checked == false) {
  772. uni.showToast({
  773. title: "请阅读并同意《会员开通协议》",
  774. icon: "none",
  775. });
  776. return;
  777. }
  778. console.log('准备支付')
  779. this.showPayment = true
  780. },
  781. // 选择会员计划
  782. selectPlan(plan) {
  783. this.selectedPlan = plan
  784. },
  785. // 获取选中计划的价格
  786. getSelectedPrice() {
  787. const selectedItem = this.viplist.find(item => item.id === this.selectedPlan);
  788. return selectedItem ? selectedItem.money : 0;
  789. },
  790. // 确认支付
  791. // confirmPayment() {
  792. // uni.showToast({
  793. // title: `支付¥${this.getSelectedPrice()}成功`,
  794. // icon: 'success'
  795. // })
  796. // this.showPayment = false
  797. // }
  798. }
  799. }
  800. </script>
  801. <style lang="scss" scoped>
  802. .benefits-page {
  803. min-height: 100vh;
  804. background: var(--线性渐变, linear-gradient(90.00deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 80%));
  805. background-size: 100% 40%;
  806. background-repeat: no-repeat;
  807. }
  808. // 顶部导航栏
  809. .nav-bar {
  810. position: fixed;
  811. top: 0;
  812. left: 0;
  813. right: 0;
  814. z-index: 1000;
  815. .nav-content {
  816. display: flex;
  817. align-items: center;
  818. justify-content: space-between;
  819. height: 88rpx;
  820. padding: 0 32rpx;
  821. .nav-left,
  822. .nav-right {
  823. width: 60rpx;
  824. height: 60rpx;
  825. display: flex;
  826. align-items: center;
  827. justify-content: center;
  828. }
  829. .nav-title {
  830. font-size: 36rpx;
  831. font-weight: 600;
  832. color: rgba(255, 255, 255, 1);
  833. }
  834. }
  835. }
  836. // 当前会员状态卡片
  837. .membership-card {
  838. background: linear-gradient(66.73deg, rgba(255, 160, 162, 1), rgba(255, 203, 204.5, 0.3) 49%, rgba(255, 181.5, 183.25, 0.56) 100%);
  839. border-radius: 20rpx;
  840. padding: 32rpx;
  841. margin: 0 40rpx;
  842. box-shadow: 0 8rpx 24rpx rgba(255, 182, 193, 0.3);
  843. .card-content {
  844. display: flex;
  845. justify-content: space-between;
  846. align-items: flex-start;
  847. .card-left {
  848. flex: 1;
  849. .card-title {
  850. color: rgba(255, 255, 255, 1);
  851. font-family: DM Sans;
  852. font-size: 48rpx;
  853. font-weight: 700;
  854. line-height: 60rpx;
  855. letter-spacing: 0px;
  856. text-align: left;
  857. margin-bottom: 8rpx;
  858. }
  859. .card-subtitle {
  860. color: rgba(255, 255, 255, 1);
  861. font-family: DM Sans;
  862. font-size: 26rpx;
  863. font-weight: 400;
  864. line-height: 32rpx;
  865. letter-spacing: 0%;
  866. text-align: left;
  867. }
  868. }
  869. .card-right {
  870. display: grid;
  871. grid-template-columns: 1fr 1fr;
  872. border-radius: 12rpx;
  873. background: radial-gradient(184.79% 115.97% at 92% 113.99999999999999%, rgba(255, 102, 0, 0.35), rgba(255, 65, 86, 1) 100%);
  874. gap: 16rpx;
  875. padding: 14rpx 38rpx;
  876. .benefit-item {
  877. text-align: center;
  878. .benefit-label {
  879. color: rgba(255, 255, 255, 1);
  880. font-family: DM Sans;
  881. font-size: 24rpx;
  882. font-weight: 400;
  883. line-height: 32rpx;
  884. letter-spacing: 0%;
  885. text-align: left;
  886. margin-bottom: 8rpx;
  887. }
  888. .benefit-count {
  889. color: rgba(255, 255, 255, 1);
  890. font-family: DM Sans;
  891. font-size: 24rpx;
  892. font-weight: 700;
  893. line-height: 32rpx;
  894. letter-spacing: 0%;
  895. text-align: left;
  896. }
  897. }
  898. }
  899. }
  900. }
  901. // 权益对比区域
  902. .benefits-section {
  903. margin: 20rpx 40rpx;
  904. .section-title {
  905. color: rgba(23, 23, 37, 1);
  906. font-family: DM Sans;
  907. font-size: 28rpx;
  908. font-weight: 400;
  909. line-height: 44rpx;
  910. letter-spacing: 0.5%;
  911. text-align: left;
  912. margin-bottom: 20rpx;
  913. }
  914. }
  915. // 权益对比表格
  916. .benefits-table {
  917. background: #fff;
  918. border-radius: 16rpx;
  919. padding: 26rpx;
  920. overflow: hidden;
  921. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  922. .table-header {
  923. display: grid;
  924. grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  925. background: #f8f9fa;
  926. border-bottom: 4rpx solid #FFFFFF;
  927. .header-cell {
  928. padding: 12rpx;
  929. color: rgba(23, 23, 37, 1);
  930. font-family: DM Sans;
  931. font-size: 24rpx;
  932. font-weight: 500;
  933. line-height: 26rpx;
  934. letter-spacing: 0.5%;
  935. text-align: center;
  936. position: relative;
  937. border-right: 4rpx solid #FFFFFF;
  938. display: flex;
  939. flex-direction: column;
  940. align-items: center;
  941. justify-content: center;
  942. &:first-child {
  943. border-top-left-radius: 16rpx;
  944. }
  945. &:last-child {
  946. border-right: none;
  947. border-top-right-radius: 16rpx;
  948. }
  949. &.benefit-type {
  950. color: rgba(23, 23, 37, 1);
  951. font-family: DM Sans;
  952. font-size: 24rpx;
  953. font-weight: 500;
  954. line-height: 26rpx;
  955. letter-spacing: 0.5%;
  956. text-align: center;
  957. background: rgba(219, 216, 216, 1);
  958. }
  959. &.basic {
  960. background: rgba(219, 216, 216, 1);
  961. }
  962. &.active {
  963. background: linear-gradient(135.00deg, rgba(255, 187, 141, 0.4), rgba(255, 102, 0, 0.4) 100%);
  964. color: rgba(224, 90, 0, 1);
  965. }
  966. &.vip {
  967. background: linear-gradient(135.00deg, rgba(255, 180, 180, 0.6), rgba(255, 89, 89, 0.6) 100%);
  968. color: rgba(255, 62, 62, 1);
  969. }
  970. &.recommended {
  971. background: linear-gradient(133.74deg, rgba(251, 231, 185, 1), rgba(240, 176, 72, 1) 100%);
  972. color: rgba(212, 131, 0, 1);
  973. }
  974. .plan-tag {
  975. position: absolute;
  976. top: 0rpx;
  977. right: 0rpx;
  978. background: var(--线性渐变, linear-gradient(132.53deg, rgba(106.94185638427734, 84.63434600830078, 214.0178680419922, 0.96), rgba(144.87640380859375, 87.8011474609375, 191.25, 1) 95%));
  979. color: rgba(255, 255, 255, 1);
  980. font-family: DM Sans;
  981. font-size: 12rpx;
  982. font-weight: 400;
  983. line-height: 14rpx;
  984. letter-spacing: 0px;
  985. text-align: left;
  986. padding: 4rpx 12rpx;
  987. border-radius: 0rpx 16rpx 0rpx 16rpx;
  988. transform-origin: center;
  989. display: flex;
  990. align-items: center;
  991. justify-content: center;
  992. overflow: hidden;
  993. &::before {
  994. content: '';
  995. position: absolute;
  996. top: 0;
  997. left: 0;
  998. right: 0;
  999. bottom: 0;
  1000. background: inherit;
  1001. transform: rotate(-45deg);
  1002. z-index: -1;
  1003. }
  1004. }
  1005. .plan-name {
  1006. font-size: 24rpx;
  1007. font-weight: 600;
  1008. margin-bottom: 4rpx;
  1009. }
  1010. .plan-expire {
  1011. font-size: 16rpx;
  1012. color: rgba(224, 90, 0, 1);
  1013. }
  1014. }
  1015. }
  1016. .table-row {
  1017. display: grid;
  1018. grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  1019. border-bottom: 4rpx solid #FFFFFF;
  1020. &:last-child {
  1021. border-bottom: none;
  1022. .row-cell:first-child {
  1023. border-bottom-left-radius: 16rpx;
  1024. }
  1025. .row-cell:last-child {
  1026. border-bottom-right-radius: 16rpx;
  1027. }
  1028. }
  1029. &.price-row {
  1030. background: #f8f9fa;
  1031. font-weight: 600;
  1032. }
  1033. .row-cell {
  1034. padding: 24rpx 12rpx;
  1035. font-size: 16rpx;
  1036. text-align: center;
  1037. border-right: 4rpx solid #FFFFFF;
  1038. display: flex;
  1039. align-items: center;
  1040. justify-content: center;
  1041. &:last-child {
  1042. border-right: none;
  1043. }
  1044. &.benefit-type {
  1045. text-align: center;
  1046. color: rgba(23, 23, 37, 1);
  1047. font-weight: 500;
  1048. align-items: center;
  1049. justify-content: center;
  1050. background: rgba(246, 246, 246, 1);
  1051. }
  1052. &.basic {
  1053. color: #666;
  1054. background: rgba(246, 246, 246, 1);
  1055. }
  1056. &.regular {
  1057. color: rgba(224, 90, 0, 1);
  1058. font-weight: 600;
  1059. background: rgba(254, 240, 229, 1);
  1060. }
  1061. &.vip {
  1062. color: rgba(255, 62, 62, 1);
  1063. font-weight: 600;
  1064. background: rgba(255, 235, 235, 1);
  1065. }
  1066. &.flagship {
  1067. color: #f57c00;
  1068. font-weight: 600;
  1069. background: rgba(254, 238, 209, 1);
  1070. }
  1071. }
  1072. }
  1073. }
  1074. // 说明文字
  1075. .notes {
  1076. margin-top: 32rpx;
  1077. .note-item {
  1078. display: flex;
  1079. align-items: flex-start;
  1080. margin-bottom: 16rpx;
  1081. font-size: 26rpx;
  1082. line-height: 1.5;
  1083. gap: 8rpx;
  1084. .note-number,
  1085. .note-text {
  1086. color: rgba(102, 102, 102, 1);
  1087. font-family: DM Sans;
  1088. font-size: 24rpx;
  1089. font-weight: 400;
  1090. line-height: 26rpx;
  1091. letter-spacing: 0.5%;
  1092. text-align: left;
  1093. }
  1094. .note-link {
  1095. color: #1976d2;
  1096. font-family: DM Sans;
  1097. font-size: 24rpx;
  1098. font-weight: 400;
  1099. line-height: 26rpx;
  1100. letter-spacing: 0.5%;
  1101. text-decoration: underline;
  1102. }
  1103. }
  1104. }
  1105. // 升级VIP按钮
  1106. .upgrade-button {
  1107. //position: fixed;
  1108. // bottom: 32rpx;
  1109. // left: 32rpx;
  1110. // right: 32rpx;
  1111. width: 88%;
  1112. height: 88rpx;
  1113. background: var(--线性渐变, linear-gradient(90.00deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%));
  1114. border-radius: 44rpx;
  1115. display: flex;
  1116. align-items: center;
  1117. justify-content: center;
  1118. color: #fff;
  1119. font-size: 32rpx;
  1120. font-weight: 600;
  1121. box-shadow: 0 8rpx 24rpx rgba(25, 118, 210, 0.3);
  1122. margin: auto;
  1123. }
  1124. // 支付弹窗样式 - 仿照 tagManage 页面
  1125. .payment-picker {
  1126. background: #fff;
  1127. border-radius: 20rpx 20rpx 0 0;
  1128. overflow: hidden;
  1129. }
  1130. .picker-header {
  1131. display: flex;
  1132. justify-content: center;
  1133. align-items: center;
  1134. padding: 30rpx 40rpx 20rpx;
  1135. border-bottom: 1rpx solid #F2F2F2;
  1136. position: relative;
  1137. .picker-title {
  1138. color: rgba(34, 37, 42, 1);
  1139. font-family: DM Sans;
  1140. font-size: 36rpx;
  1141. font-weight: 500;
  1142. line-height: 23px;
  1143. letter-spacing: 0px;
  1144. text-align: center;
  1145. }
  1146. }
  1147. .picker-content {
  1148. padding: 32rpx;
  1149. }
  1150. .plan-option {
  1151. display: flex;
  1152. flex-direction: row;
  1153. justify-content: flex-start;
  1154. align-items: center;
  1155. padding: 16rpx 28rpx;
  1156. box-sizing: border-box;
  1157. border: 1px solid rgba(227, 231, 236, 1);
  1158. border-radius: 24px;
  1159. background: rgba(255, 255, 255, 1);
  1160. margin-bottom: 32rpx;
  1161. &:active {
  1162. background-color: #F9F9F9;
  1163. }
  1164. &.active {
  1165. border-color: #007AFF;
  1166. background: #F0F9FF;
  1167. }
  1168. .option-left {
  1169. display: flex;
  1170. align-items: center;
  1171. flex: 1;
  1172. .radio-btn {
  1173. width: 40rpx;
  1174. height: 40rpx;
  1175. border: 2rpx solid #E5E5EA;
  1176. border-radius: 50%;
  1177. display: flex;
  1178. align-items: center;
  1179. justify-content: center;
  1180. margin-right: 24rpx;
  1181. background: #fff;
  1182. transition: all 0.2s;
  1183. &.checked {
  1184. border-color: #007AFF;
  1185. background: #007AFF;
  1186. }
  1187. }
  1188. .option-text {
  1189. font-size: 28rpx;
  1190. color: rgba(29, 33, 41, 1);
  1191. font-weight: 400;
  1192. flex: 1;
  1193. }
  1194. .price-tag {
  1195. background: rgba(153, 196, 250, 0.4);
  1196. border-radius: 8rpx;
  1197. padding: 4rpx 12rpx;
  1198. text {
  1199. font-size: 24rpx;
  1200. line-height: 24rpx;
  1201. color: rgba(1, 107, 246, 1);
  1202. font-weight: 500;
  1203. }
  1204. }
  1205. }
  1206. }
  1207. .picker-content :last-child {
  1208. margin-bottom: 0rpx;
  1209. }
  1210. .payment-button {
  1211. width: 90%;
  1212. height: 88rpx;
  1213. background: linear-gradient(90deg, #007AFF 0%, #42a5f5 100%);
  1214. border-radius: 44rpx;
  1215. display: flex;
  1216. align-items: center;
  1217. justify-content: center;
  1218. margin: 32rpx;
  1219. box-shadow: 0 8rpx 24rpx rgba(0, 122, 255, 0.3);
  1220. text {
  1221. color: #fff;
  1222. font-size: 32rpx;
  1223. font-weight: 600;
  1224. }
  1225. }
  1226. </style>