mobile.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <template>
  2. <div class="wrapper">
  3. <div class="switch-bar" :class="active===0?'switch-bar-brown':current===0?'switch-bar-blue':'switch-bar-green'" >
  4. <div class="switch-item" :class="{'switch-item-active':active===0}" @click="handleSwitchClick(0)">
  5. <div class="switch-item-title">开发者会员</div>
  6. <div class="switch-item-border"/>
  7. </div>
  8. <div class="switch-item" :class="{'switch-item-active':active===1}" @click="handleSwitchClick(1)">
  9. <div class="switch-item-title">企业会员套餐</div>
  10. <div class="switch-item-border"/>
  11. </div>
  12. </div>
  13. <div class="banner-brown-wrapper" v-show="active===0">
  14. <div class="banner-brown">
  15. <div class="banner-content">
  16. <div class="avatar">
  17. <img :src="userInfo.icon_url" alt="">
  18. </div>
  19. <div class="name-wrapper">
  20. <div class="name">{{userInfo.nickname}}</div>
  21. <div class="validity">{{isCom?'暂未开通':endTimeCalc}}</div>
  22. </div>
  23. <div class="renew-btn">{{vipNow ? '续费' : '开通'}}</div>
  24. </div>
  25. </div>
  26. </div>
  27. <div v-swiper:mySwiper="swiperOption" v-show="active===1">
  28. <div class="swiper-wrapper">
  29. <div class="swiper-slide">
  30. <div class="banner-blue-wrapper">
  31. <div class="banner-blue">
  32. <div class="banner-content">
  33. <div class="avatar">
  34. <img :src="userInfo.icon_url" alt="">
  35. </div>
  36. <div class="name-wrapper">
  37. <div class="name">{{userInfo.nickname}}</div>
  38. <div class="validity">{{isCom?'暂未开通':endTimeCalc}}</div>
  39. </div>
  40. <div class="renew-btn">{{vipNow ? '续费' : '开通'}}</div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="swiper-slide">
  46. <div class="banner-green-wrapper">
  47. <div class="banner-green">
  48. <div class="banner-content">
  49. <div class="avatar">
  50. <img :src="userInfo.icon_url" alt="">
  51. </div>
  52. <div class="name-wrapper">
  53. <div class="name">{{userInfo.nickname}}</div>
  54. <div class="validity">{{isCom?'暂未开通':endTimeCalc}}</div>
  55. </div>
  56. <div class="renew-btn">{{vipNow ? '续费' : '开通'}}</div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="swiper-pagination swiper-pagination-bullets"></div>
  63. </div>
  64. <div class="content">
  65. <div class="title-wrapper">
  66. <div class="title">开发者会员</div>
  67. <div class="price-wrapper">
  68. <div class="monthly-price-wrapper">
  69. <div class="monthly-origin-price">原价¥{{detail.monthly_origin_price}}/月</div>
  70. <div class="monthly-discount-price"><span>¥{{detail.monthly_real_price}}</span>/月</div>
  71. </div>
  72. <div class="quarterly-price">按季付费 <span>¥{{detail.quarterly_real_price}}</span></div>
  73. </div>
  74. </div>
  75. <div class="list" v-show="active===0">
  76. <div class="item">
  77. <div class="item-title">· 整包项目-平台服务费(减免2%) </div>
  78. <div class="item-discount">{{detail.project_discount}}折</div>
  79. </div>
  80. <div class="item">
  81. <div class="item-title">· 云端工作-平台服务费(减免1%) </div>
  82. <div class="item-discount">{{detail.project_discount}}折</div>
  83. </div>
  84. <div class="item">
  85. <div class="item-title">· 认证的云端开发者可同时接两单</div>
  86. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  87. </div>
  88. <div class="item">
  89. <div class="item-title"> · 专属VIP服务顾问</div>
  90. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  91. </div>
  92. </div>
  93. <div class="list" v-show="active===1 && current===0">
  94. <div class="item">
  95. <div class="item-title">· 整包项目-平台服务费(减免2%) </div>
  96. <div class="item-discount">8.0折</div>
  97. </div>
  98. <div class="item">
  99. <div class="item-title">· 云端工作-平台服务费(减免1%) </div>
  100. <div class="item-discount">8.3折</div>
  101. </div>
  102. <div class="item">
  103. <div class="item-title">· 认证的云端开发者可同时接两单</div>
  104. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  105. </div>
  106. <div class="item">
  107. <div class="item-title"> · 专属VIP服务顾问</div>
  108. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  109. </div>
  110. </div>
  111. <div class="list" v-show="active===1 && current===1">
  112. <div class="item">
  113. <div class="item-title">· 整包项目-平台服务费(减免2%) </div>
  114. <div class="item-discount">8.0折</div>
  115. </div>
  116. <div class="item">
  117. <div class="item-title">· 云端工作-平台服务费(减免1%) </div>
  118. <div class="item-discount">8.3折</div>
  119. </div>
  120. <div class="item">
  121. <div class="item-title">· 认证的云端开发者可同时接两单</div>
  122. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  123. </div>
  124. <div class="item">
  125. <div class="item-title"> · 专属VIP服务顾问</div>
  126. <img class="item-include" src="@/assets/img/vip/icon_include_brown.png" alt="">
  127. </div>
  128. </div>
  129. <div class="tips-wrapper">
  130. <div class="tips-title">会员说明</div>
  131. <div class="tips-content">
  132. <p>1.购买会员按季付费;</p>
  133. <p> 2.开通会员即代表您已同意《程序员客栈会员服务条款》;</p>
  134. <p>3.如有任何问题,欢迎咨询在线客服,或拨打热线:0571-28120931 转1。</p>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. let touchX = 0;
  142. import getDeviceType from "@/mixins/getDeviceType";
  143. import qs from "qs";
  144. import buyDialog from "./buy-dialog";
  145. export default {
  146. props: ["com", "dev", "vipDetail", "isCom"],
  147. data() {
  148. const _this = this
  149. return {
  150. active: 0,
  151. current: 0,
  152. swiperOption: {
  153. loop: true,
  154. slidesPerView: 'auto',
  155. centeredSlides: true,
  156. spaceBetween: 30,
  157. pagination: {
  158. el: '.swiper-pagination',
  159. dynamicBullets: true
  160. },
  161. on: {
  162. slideChange() {
  163. console.log(window)
  164. _this.current = this.realIndex
  165. if (window.appBridge && _this.active===0) {
  166. window.appBridge.setTitleBarColor('#D89823')
  167. } else if (window.appBridge && _this.active===1 && _this.current===0) {
  168. window.appBridge.setTitleBarColor('#308EFF')
  169. } else if (window.appBridge && _this.active===1 && _this.current===1) {
  170. window.appBridge.setTitleBarColor('#00BF66')
  171. }
  172. },
  173. tap() {
  174. console.log('onTap', this);
  175. }
  176. }
  177. },
  178. // 当前是企业页
  179. currentCom: false,
  180. // 会员详情
  181. // vipDetail: {},
  182. buyDialog: false,
  183. type: "com" // com: 企业会员, dev: 开发者会员
  184. };
  185. },
  186. components: {
  187. buyDialog
  188. },
  189. mixins: [getDeviceType],
  190. computed: {
  191. item: function() {
  192. return this[this.type] || {};
  193. },
  194. endTimeCalc() {
  195. return this.vipNow ? "有效期至" + this.userInfo.vip_end_date : "暂未开通";
  196. },
  197. detail() {
  198. return (this.currentCom ? this.com : this.dev) || {};
  199. },
  200. vipNow() {
  201. return this.vipDetail.is_vip || false;
  202. },
  203. vipInfo() {
  204. return this.vipDetail.vip_info || {};
  205. },
  206. userInfo() {
  207. console.log(this.vipDetail);
  208. return this.vipDetail.user_info || {};
  209. },
  210. pricePrefix() {
  211. return this.deviceType === "ios" ? "apple_" : "";
  212. }
  213. },
  214. mounted() {
  215. console.log("mobile", this.com, this.dev);
  216. if (window.appBridge && this.active===0) {
  217. window.appBridge.setTitleBarColor('#D89823')
  218. } else if (window.appBridge && this.active===1 && this.current===0) {
  219. window.appBridge.setTitleBarColor('#308EFF')
  220. } else if (window.appBridge && this.active===1 && this.current===1) {
  221. window.appBridge.setTitleBarColor('#00BF66')
  222. }
  223. },
  224. methods: {
  225. clickPay(type) {
  226. this.type = type;
  227. this.buyDialog = true;
  228. // location.href = `/vip/pay?product_id=${item.id}&number=3&next=/type/vip/`;
  229. },
  230. handleClose() {
  231. this.buyDialog = false;
  232. },
  233. async gotoPay(number) {
  234. const item = this[this.type];
  235. let query = {
  236. product_type: 11,
  237. number: number,
  238. product_id: item.id
  239. };
  240. if (this.deviceType === "ios") {
  241. let cookie = this.getSign();
  242. let res = await this.$axios.$post("/api/vip/pay", {
  243. product_type: 11,
  244. number: number,
  245. product_id: item.id,
  246. channel: "apple",
  247. ...cookie
  248. });
  249. if (res && res.data) {
  250. query = Object.assign({}, query, res.data);
  251. location.href = "proginn://pay?" + qs.stringify(query);
  252. }
  253. } else {
  254. location.href = "proginn://pay?" + qs.stringify(query);
  255. }
  256. },
  257. /**
  258. * 手指右划
  259. */
  260. swipeRight() {
  261. this.currentCom = false;
  262. },
  263. /**
  264. * 手指左划
  265. */
  266. swipeLeft() {
  267. this.currentCom = true;
  268. },
  269. touchStart(e) {
  270. touchX = e.touches[0].clientX;
  271. },
  272. touchEnd(e) {
  273. var offsetX = e.changedTouches[0].clientX - touchX;
  274. if (offsetX < -50) this.swipeLeft();
  275. else if (offsetX > 50) this.swipeRight();
  276. },
  277. /**
  278. * 点击会员计划
  279. */
  280. clickProject(index) {
  281. const vip = this.vipDetail[index];
  282. window.open(recommend.seo_uri);
  283. },
  284. handleSwitchClick(index) {
  285. this.active = index
  286. console.log(this.active)
  287. if (window.appBridge && this.active===0) {
  288. window.appBridge.setTitleBarColor('#D89823')
  289. } else if (window.appBridge && this.active===1 && this.current===0) {
  290. window.appBridge.setTitleBarColor('#308EFF')
  291. } else if (window.appBridge && this.active===1 && this.current===1) {
  292. window.appBridge.setTitleBarColor('#00BF66')
  293. }
  294. }
  295. }
  296. };
  297. </script>
  298. <style scoped>
  299. .wrapper {
  300. overflow: hidden;
  301. margin-top: 0;
  302. width: 100%;
  303. background-color: #F4F5F9;
  304. }
  305. .switch-bar {
  306. display: flex;
  307. background-color: #D89823;
  308. }
  309. .switch-bar-brown {
  310. background-color: #D89823;
  311. }
  312. .switch-bar-blue {
  313. background-color: #308EFF;
  314. }
  315. .switch-bar-green {
  316. background-color: #00BF66;
  317. }
  318. .switch-item {
  319. flex: 1;
  320. padding-top: .4rem;
  321. padding-bottom: .15rem;
  322. }
  323. .switch-item .switch-item-title {
  324. line-height: .42rem;
  325. text-align: center;
  326. font-size: .3rem;
  327. color: #FFFFFF;
  328. }
  329. .switch-item .switch-item-border {
  330. margin: .18rem auto 0;
  331. width: .6rem;
  332. height: .06rem;
  333. background-color: transparent;
  334. }
  335. .switch-item-active .switch-item-title {
  336. font-weight: 600;
  337. }
  338. .switch-item-active .switch-item-border {
  339. background-color: #ffffff;
  340. }
  341. .banner-brown-wrapper {
  342. background-color: #D89823;
  343. }
  344. .banner-brown {
  345. overflow: hidden;
  346. margin: 0 auto;
  347. width: 7rem;
  348. height: 2.9rem;
  349. background-image:url('~@/assets/img/vip/banner_brown.png');
  350. background-size: 100%;
  351. background-repeat:no-repeat;
  352. }
  353. .banner-blue-wrapper {
  354. background-color: #308EFF;
  355. }
  356. .banner-blue {
  357. overflow: hidden;
  358. margin: 0 auto;
  359. width: 7rem;
  360. height: 2.9rem;
  361. background-image:url('~@/assets/img/vip/banner_blue.png');
  362. background-size: 100%;
  363. background-repeat:no-repeat;
  364. }
  365. .banner-green-wrapper {
  366. background-color: #00BF66;
  367. }
  368. .banner-green {
  369. overflow: hidden;
  370. margin: 0 auto;
  371. width: 7rem;
  372. height: 2.9rem;
  373. background-image:url('~@/assets/img/vip/banner_green.png');
  374. background-size: 100%;
  375. background-repeat:no-repeat;
  376. }
  377. .banner-content {
  378. margin-top: 1.12rem;
  379. display: flex;
  380. align-items: center;
  381. }
  382. .avatar {
  383. position: relative;
  384. margin-left: .32rem;
  385. width: 1.1rem;
  386. height: 1.1rem;
  387. }
  388. .avatar img {
  389. width: 100%;
  390. height: 100%;
  391. border-radius: 50%;
  392. border: .03rem solid #E1A83F;
  393. }
  394. .name-wrapper {
  395. flex: 1;
  396. margin-left: .23rem;
  397. }
  398. .name {
  399. line-height: .48rem;
  400. font-weight: 500;
  401. font-size: .34rem;
  402. color: #222222;
  403. }
  404. .validity {
  405. margin-top: .02rem;
  406. line-height: .3rem;
  407. font-size: .22rem;
  408. color: rgba(34,34,34,0.6)
  409. }
  410. .renew-btn {
  411. margin-right: .3rem;
  412. width: 1.54rem;
  413. height: .64rem;
  414. border-radius: .32rem;
  415. background-color: #D89823;
  416. line-height: .64rem;
  417. font-weight: 600;
  418. text-align: center;
  419. font-size: .26rem;
  420. color: #FFFFFF;
  421. }
  422. .content {
  423. overflow: hidden;
  424. background-color: #FFFFFF;
  425. }
  426. .title-wrapper {
  427. margin: 0 auto;
  428. width: 7.1rem;
  429. padding-bottom: .2rem;
  430. display: flex;
  431. }
  432. .title {
  433. flex: 1;
  434. margin-top: .17rem;
  435. margin-left: .24rem;
  436. line-height: .75rem;
  437. font-weight: 600;
  438. font-size: .29rem;
  439. color: #222222;
  440. }
  441. .price-wrapper {
  442. margin-top: .23rem;
  443. text-align: right;
  444. }
  445. .monthly-price-wrapper {
  446. display: flex;
  447. }
  448. .monthly-origin-price {
  449. margin-top: .17rem;
  450. line-height: .3rem;
  451. font-size: .22rem;
  452. color: #919AA7;
  453. text-decoration: line-through;
  454. }
  455. .monthly-discount-price {
  456. margin-left: .07rem;
  457. line-height: .62rem;
  458. font-size: .24rem;
  459. color: #222222;
  460. }
  461. .monthly-discount-price span {
  462. font-weight: 600;
  463. font-size: .45rem;
  464. }
  465. .quarterly-price {
  466. margin-top: .01rem;
  467. margin-right: .05rem;
  468. line-height: .33rem;
  469. font-size: .24rem;
  470. color: #666666;
  471. }
  472. .quarterly-price span {
  473. color: #333333;
  474. }
  475. .list {
  476. padding-top: .3rem;
  477. padding-bottom: .33rem;
  478. }
  479. .item {
  480. margin: 0 auto;
  481. width: 7.1rem;
  482. display: flex;
  483. align-items: center;
  484. }
  485. .item-title {
  486. flex: 1;
  487. line-height: .74rem;
  488. font-size: .28rem;
  489. color: #1D2A3A;
  490. }
  491. .item-discount {
  492. width: 1.02rem;
  493. height: .44rem;
  494. background-image: url('~@/assets/img/vip/icon_discount_brown.png');
  495. background-size: 100%;
  496. background-repeat: no-repeat;
  497. line-height: .44rem;
  498. text-indent: .16rem;
  499. font-size: .22rem;
  500. color: #E1A83F;
  501. }
  502. .item-include {
  503. margin-right: .35rem;
  504. width: .3rem;
  505. height: .2rem;
  506. }
  507. .tips-wrapper {
  508. overflow: hidden;
  509. margin-top: .15rem;
  510. padding-bottom: .39rem;
  511. background-color: #ffffff;
  512. }
  513. .tips-title {
  514. margin-top: .36rem;
  515. margin-left: .2rem;
  516. line-height: .4rem;
  517. font-weight: 600;
  518. font-size: .28rem;
  519. color: #666666;
  520. }
  521. .tips-content {
  522. margin-top: .18rem;
  523. margin-left: .2rem;
  524. width: 6.8rem;
  525. line-height: .56rem;
  526. font-size: .26rem;
  527. color: #999999;
  528. }
  529. </style>