buy-dev-dialog.vue 9.0 KB

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