index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="c-share" v-if="show" @click="close">
  3. <div class="c-share__content" @click.stop>
  4. <div class="c-share__box">
  5. <div class="c-share__top" v-if="distribution && vip">
  6. <img class="c-share__icon" src="/static/share/icon_1.jpg" alt />
  7. </div>
  8. <div class="c-share__vip" v-if="!vip && distribution" @click="goVip">成为vip</div>
  9. <div class="c-share__title" v-if="distribution">推广给好友购买最多可赚</div>
  10. <div class="c-share__price c-price" v-if="distribution">
  11. <span class="c-price__sign">¥</span>
  12. <span class="c-price__text">{{ price || '0.00' }}</span>
  13. </div>
  14. </div>
  15. <div class="c-share__division">分享</div>
  16. <ul class="c-list">
  17. <!-- <li class="c-list__item">
  18. <button class="button" open-type="share">
  19. <div class="c-list__content">
  20. <img class="c-list__icon" src="/static/share/icon_2.jpg" alt />
  21. <div class="c-list__text">发送给微信好友</div>
  22. </div>
  23. </button>
  24. </li> -->
  25. <li class="c-list__item" @click="share('single')">
  26. <div class="c-list__content">
  27. <img class="c-list__icon" src="/static/share/icon_3.jpg" alt />
  28. <div class="c-list__text">保存图片到相册</div>
  29. </div>
  30. </li>
  31. <li class="c-list__item">
  32. <div class="c-list__content" @click="share('multi')">
  33. <img class="c-list__icon" src="/static/share/icon_4.jpg" alt />
  34. <div class="c-list__text">
  35. <div>保存多张素材图</div>
  36. <div>可用于分享朋友圈</div>
  37. </div>
  38. </div>
  39. </li>
  40. </ul>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. name: 'MyShare',
  47. // 数据
  48. data() {
  49. return {
  50. show: false,
  51. price: '',
  52. callback: '',
  53. distribution: false,
  54. vip: false,
  55. }
  56. },
  57. // 函数
  58. methods: {
  59. // 打开
  60. open(price, distribution, vip, callback) {
  61. const self = this
  62. self.show = true
  63. self.price = price
  64. self.distribution = distribution
  65. self.vip = vip
  66. self.callback = callback
  67. },
  68. // 关闭
  69. close() {
  70. const self = this
  71. self.show = false
  72. if (self.fn.getType(self.callback) === 'function') {
  73. self.callback()
  74. }
  75. },
  76. goVip() {
  77. this.router.push({
  78. path: '/pages/generalize/open',
  79. })
  80. },
  81. // 分享处理
  82. share(type) {
  83. const self = this
  84. self.$emit('share', type)
  85. },
  86. },
  87. // 数据计算
  88. computed: {
  89. },
  90. // 数据监听
  91. watch: {},
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .c-share {
  96. position: fixed;
  97. top: 0;
  98. left: 0;
  99. z-index: 995;
  100. width: 100%;
  101. height: 100%;
  102. background-color: rgba(0, 0, 0, 0.4);
  103. &__content {
  104. position: absolute;
  105. bottom: 0;
  106. left: 0;
  107. z-index: 100;
  108. width: 100%;
  109. background-color: #fff;
  110. border-radius: px(16) px(16) 0 0;
  111. }
  112. &__box {
  113. display: flex;
  114. flex-direction: column;
  115. align-items: center;
  116. }
  117. &__top {
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. width: px(230);
  122. height: px(230);
  123. margin-top: px(-115);
  124. border-radius: 50%;
  125. background-color: #ef4a37;
  126. }
  127. &__icon {
  128. width: px(137);
  129. height: px(134);
  130. }
  131. &__vip{
  132. margin-top: px(80);
  133. color: #f8662a;
  134. }
  135. &__title {
  136. font-size: px(42);
  137. margin-top: px(30);
  138. color: #333;
  139. &.mt{
  140. margin-top: px(80);
  141. }
  142. }
  143. &__price {
  144. margin-top: px(70);
  145. }
  146. &__division {
  147. display: flex;
  148. justify-content: space-between;
  149. align-items: center;
  150. margin-top: px(60);
  151. font-size: px(34);
  152. color: #999;
  153. &:before,
  154. &:after {
  155. content: "";
  156. display: block;
  157. width: px(460);
  158. height: px(3);
  159. background-color: #e7e7e7;
  160. }
  161. }
  162. }
  163. .c-price {
  164. display: flex;
  165. align-items: baseline;
  166. &__sign {
  167. font-size: px(26);
  168. color: #f8662a;
  169. }
  170. &__text {
  171. font-size: px(54);
  172. color: #f8662a;
  173. }
  174. }
  175. .c-list {
  176. display: flex;
  177. justify-content: space-around;
  178. height: px(345);
  179. padding-top: px(70);
  180. &__item {
  181. flex: 1;
  182. }
  183. &__content {
  184. display: flex;
  185. flex-direction: column;
  186. align-items: center;
  187. }
  188. &__icon {
  189. width: px(100);
  190. height: px(100);
  191. margin-bottom: px(20);
  192. }
  193. &__text {
  194. display: flex;
  195. flex-direction: column;
  196. align-items: center;
  197. font-size: px(32);
  198. color: #999;
  199. }
  200. }
  201. </style>