buy-dev-dialog.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <el-dialog class="buy-dev-wrapper" :visible.sync="showDialog" :before-close="handleClose">
  3. <div slot="title" class="dialog-title">
  4. <img src="~@/assets/img/vip/vip_buy_icon@2x.png" alt="vip_icon" />
  5. <span>购买开发者会员</span>
  6. </div>
  7. <div slot="footer" class="dialog-footer">
  8. <el-button class="buy-btn" type="primary" @click="handleClickBuy">
  9. <!-- vip_type: 1 - 企业;2 - 开发者 -->
  10. {{vipDetail.user_info && vipDetail.user_info.vip_type == 2 ? "续费" : "开通"}}
  11. </el-button>
  12. </div>
  13. <div class="buy-dev-box">
  14. <div class="buy-dev-content">
  15. <!-- 4.27 todo: 包年、包季与后端联调 -->
  16. <div
  17. class="buy-dev-item"
  18. :class="{'active': number == '12+'}"
  19. v-if="item['can_buy_yearly'] === '0'"
  20. @click="clickNumber('12+')">
  21. <div class="name">连续包年</div>
  22. <div class="price">¥{{ Number(item['yearly_real_price']).toFixed(2) }}</div>
  23. <div class="price-per-month">¥{{ (Number(item['yearly_real_price']) / 12).toFixed(2) }}/月</div>
  24. </div>
  25. <div
  26. class="buy-dev-item"
  27. :class="{'active': number == '3+'}"
  28. v-if="item['can_buy_yearly'] === '0'"
  29. @click="clickNumber('3+')">
  30. <div class="name">连续包季</div>
  31. <div class="price">¥{{ Number(item['yearly_real_price']).toFixed(2) }}</div>
  32. <div class="price-per-month">¥{{ (Number(item['yearly_real_price']) / 12).toFixed(2) }}/月</div>
  33. </div>
  34. <div
  35. class="buy-dev-item"
  36. :class="{'active': number == '12'}"
  37. v-if="item['can_buy_yearly'] === '0'"
  38. @click="clickNumber('12')">
  39. <div class="name">12个月</div>
  40. <div class="price">¥{{ Number(item['yearly_real_price']).toFixed(2) }}</div>
  41. <div class="price-per-month">¥{{ (Number(item['yearly_real_price']) / 12).toFixed(2) }}/月</div>
  42. </div>
  43. <div
  44. class="buy-dev-item"
  45. :class="{'active': number == '6'}"
  46. v-if="item['can_buy_half_yearly'] === '1'"
  47. @click="clickNumber('6')">
  48. <div class="name">6个月</div>
  49. <div class="price">¥{{ Number(item['half_yearly_real_price']).toFixed(2) }}</div>
  50. <div class="price-per-month">¥{{ (Number(item['half_yearly_real_price']) / 12).toFixed(2) }}/月</div>
  51. </div>
  52. <div
  53. class="buy-dev-item"
  54. :class="{'active': number == '3'}"
  55. v-if="item['can_buy_quarterly'] === '0'"
  56. @click="clickNumber('3')">
  57. <div class="name">3个月</div>
  58. <div class="price">¥{{ Number(item['quarterly_real_price']).toFixed(2) }}</div>
  59. <div class="price-per-month">¥{{ (Number(item['quarterly_real_price']) / 12).toFixed(2) }}/月</div>
  60. </div>
  61. </div>
  62. <!-- 选择连续包年时展示 -->
  63. <div v-if="number == '12+'" class="buy-dev-tips">
  64. <span>到期按{{ Number(item['yearly_real_price']).toFixed(2) }}元每年自动续约,可随时取消</span>
  65. <el-tooltip placement="bottom-end">
  66. <div slot="content" class="">
  67. <p>自动续费说明</p>
  68. <p>1. 会员权益到期前一天,为您自动续费;</p>
  69. <p>2. 扣款前消息通知,完全透明;</p>
  70. <p>3. 可随时取消服务,取消后不再自动续费。</p>
  71. </div>
  72. <img src="~@/assets/img/vip/tips_icon@2x.png" class="tips-img" >
  73. </el-tooltip>
  74. </div>
  75. <!-- 选择连续包季时展示 -->
  76. <div v-if="number == '3+'" class="buy-dev-tips">
  77. <span>到期按{{ Number(item['yearly_real_price']).toFixed(2) }}元每季自动续约,可随时取消</span>
  78. <el-tooltip placement="bottom-end">
  79. <div slot="content" class="">
  80. <p>自动续费说明</p>
  81. <p>1. 会员权益到期前一天,为您自动续费;</p>
  82. <p>2. 扣款前消息通知,完全透明;</p>
  83. <p>3. 可随时取消服务,取消后不再自动续费。</p>
  84. </div>
  85. <img src="~@/assets/img/vip/tips_icon@2x.png" class="tips-img" >
  86. </el-tooltip>
  87. </div>
  88. </div>
  89. </el-dialog>
  90. </template>
  91. <script>
  92. export default {
  93. name: 'BuyDevDialog',
  94. props: {
  95. showDialog: {
  96. type: Boolean,
  97. default: false
  98. },
  99. // 购买开发者会员的配置信息
  100. item: Object,
  101. handleClose: Function,
  102. vipDetail: Object
  103. },
  104. data () {
  105. return {
  106. number: '12+'
  107. }
  108. },
  109. methods: {
  110. /**
  111. * 切换选择会员时间
  112. */
  113. clickNumber (number) {
  114. this.number = number;
  115. },
  116. /**
  117. * 点击开通/续费时
  118. */
  119. handleClickBuy () {
  120. if (this.number == '12+') {
  121. this.$message('连续包年')
  122. } else if (this.number == '3+') {
  123. this.$message('连续包季')
  124. } else {
  125. const item = this.item;
  126. location.href = `/vip/pay?product_id=${item.id}&number=${this.number}&next=/type/vip/`;
  127. }
  128. // else if (this.number == '12') {
  129. // this.$message('购买12个月')
  130. // } else if (this.number == '6') {
  131. // this.$message('购买6个月')
  132. // } else if (this.number == '3') {
  133. // this.$message('购买3个月')
  134. // }
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss">
  140. .buy-dev-wrapper {
  141. .el-dialog {
  142. width: 669px;
  143. }
  144. .el-dialog__headerbtn {
  145. top: 32px;
  146. right: 30px;
  147. }
  148. .el-dialog__header {
  149. padding: 30px 30px 10px;
  150. }
  151. .el-dialog__footer {
  152. padding: 0 30px 30px;
  153. }
  154. }
  155. </style>
  156. <style lang="scss" scoped>
  157. .buy-dev-box {
  158. width: 594px;
  159. margin: 0 auto;
  160. display: flex;
  161. flex-direction: column;
  162. .buy-dev-content {
  163. width: 100%;
  164. display: flex;
  165. flex-wrap: wrap;
  166. .buy-dev-item {
  167. width: 190px;
  168. height: 120px;
  169. margin: 0 12px 14px 0;
  170. background: #ffffff;
  171. border: 1px solid rgba(0,0,0,0.05);
  172. border-radius: 7px;
  173. box-shadow: 0px 3px 12px 0px rgba(8,27,50,0.05);
  174. display: flex;
  175. flex-direction: column;
  176. align-items: center;
  177. justify-content: center;
  178. cursor: pointer;
  179. &:nth-of-type(3n) {
  180. margin-right: 0;
  181. }
  182. &.active {
  183. border: 2px solid #308eff;
  184. }
  185. .name {
  186. font-size: 18px;
  187. font-family: PingFangSC, PingFangSC-Semibold;
  188. font-weight: 600;
  189. text-align: center;
  190. color: #308eff;
  191. line-height: 25px;
  192. }
  193. .price {
  194. margin-top: 10px;
  195. font-size: 16px;
  196. font-family: PingFangSC, PingFangSC-Semibold;
  197. font-weight: 600;
  198. text-align: center;
  199. color: #222222;
  200. line-height: 22px;
  201. }
  202. .price-per-month {
  203. font-size: 12px;
  204. font-family: PingFangSC, PingFangSC-Regular;
  205. font-weight: 400;
  206. text-align: center;
  207. color: #999999;
  208. line-height: 17px;
  209. }
  210. }
  211. }
  212. .buy-dev-tips {
  213. font-size: 14px;
  214. font-family: PingFangSC, PingFangSC-Regular;
  215. font-weight: 400;
  216. color: #999999;
  217. line-height: 20px;
  218. display: flex;
  219. align-items: center;
  220. .tips-img {
  221. margin-left: 2px;
  222. width: 14px;
  223. height: 14px;
  224. cursor: pointer;
  225. }
  226. }
  227. }
  228. .dialog-title {
  229. width: 100%;
  230. display: flex;
  231. align-items: center;
  232. justify-content: center;
  233. img {
  234. width: 31px;
  235. height: 25px;
  236. margin-right: 8px;
  237. }
  238. span {
  239. font-size: 23px;
  240. font-family: PingFangSC, PingFangSC-Semibold;
  241. font-weight: 600;
  242. color: #222222;
  243. }
  244. }
  245. .dialog-footer {
  246. width: 100%;
  247. display: flex;
  248. justify-content: center;
  249. .buy-btn {
  250. width: 290px;
  251. height: 48px;
  252. background: #e1a83f;
  253. border: none;
  254. border-radius: 10px;
  255. font-size: 16px;
  256. font-family: PingFangSC, PingFangSC-Semibold;
  257. font-weight: 600;
  258. text-align: center;
  259. color: #222222;
  260. line-height: 22px;
  261. }
  262. }
  263. </style>