benefits.vue 35 KB

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