index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <v-container class="invite-user pa-0" fluid>
  3. <div class="box box1">
  4. <div class="box-header">参与步骤</div>
  5. <div class="box-main">
  6. <v-img
  7. class="cybz-content"
  8. src="~/assets/image/activity/invite-user/cybz-content@2x.png"
  9. />
  10. <div class="cybz-content-text">
  11. <div class="cybz-content-text-item">分享好友</div>
  12. <div class="cybz-content-text-item">邀请购买云机</div>
  13. <div class="cybz-content-text-item">返星币换现金</div>
  14. </div>
  15. <v-btn class="share-button" rounded @click="share()"
  16. >分享好友赚星币</v-btn
  17. >
  18. <!-- <button @click="share()">邀请</button> -->
  19. </div>
  20. <!-- <div class="h-40">13</div> -->
  21. </div>
  22. <div class="box box2">
  23. <div class="box-header">收益明细</div>
  24. <div class="box-main">
  25. <div class="grid grid-cols-2 gap-x-4 gap-y-8">
  26. <div
  27. v-for="(item, index) in dataList"
  28. :key="index"
  29. :class="{
  30. 'col-span-2': index === 6,
  31. }"
  32. >
  33. <div class="label text-sm">
  34. <span>{{ item.label }}</span>
  35. </div>
  36. <div class="value text-2xl font-bold">
  37. <span>{{ item.value | formatNumber }}</span>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <!-- <div class="box box3">
  44. <div class="box-header">返利套餐</div>
  45. <div class="box-main"></div>
  46. </div> -->
  47. <div class="box box4">
  48. <div class="box-header">活动规则</div>
  49. <div class="box-main text-sm">
  50. <p>1、传播过程中有任何疑问,可直接咨询客服</p>
  51. <p>
  52. 2、用户可以通过分享页面或者套餐给想要分享的人,被分享人购买云机套餐后,分享人可获得套餐对应的星币
  53. </p>
  54. <p>
  55. 3、星币为双子星云手机平台唯一认可代币,仅能通过充值、赠送和分享获得,其它渠道途径非法获取的星币,不受平台认可
  56. </p>
  57. <p>4、星币可在双子星购买任一等价值套餐</p>
  58. <p>
  59. 5、请勿利用双子星传播或扩散任何有关于政治、情色等任何违法的信息,一经发现,取消资格,如果触犯任何法律相关问题,平台不负任何责任
  60. </p>
  61. </div>
  62. </div>
  63. <!-- <div class="">invite-user</div> -->
  64. <!-- <button>刷新数据</button> -->
  65. <!-- <div class="">{{ data }}</div> -->
  66. <!-- <div class="text-center">
  67. <span>分享好友购买云机套餐<br />返星币换现金</span>
  68. </div>
  69. <div class="text-center mt-4">
  70. <van-button type="primary" @click="share()">邀请好友</van-button>
  71. </div>
  72. <van-icon name="chat-o" />
  73. <van-icon name="shape-plus" class-prefix="mdi" />
  74. <van-button @click="$fetch()">刷新</van-button>
  75. <div class="ccc">{{ 36666666.123456 | formatNumber }}</div>
  76. <div class="ccc">{{ '2020-01-01' | formatDate }}</div> -->
  77. </v-container>
  78. </template>
  79. <script>
  80. // import qs from 'qs';
  81. // import clipboard from 'clipboardy/browser';
  82. import * as clipboard from 'clipboard-polyfill/text';
  83. import { getStarCoinOverview } from '~/api/activity/invite-user.js';
  84. export default {
  85. // auth: false,
  86. name: 'InviteUser',
  87. filters: {},
  88. data() {
  89. return {
  90. data: {
  91. todayIncomeStarCoin: 0,
  92. totalIncomeStarCoin: 0,
  93. todayBuyOrderCount: 0,
  94. totalBuyOrderCount: 0,
  95. todayBuyOrderSuccessCount: 0,
  96. totalBuyOrderSuccessCount: 0,
  97. withdrawStarCoinNum: 0,
  98. inviteUserName: null,
  99. activityId: null,
  100. status: 0,
  101. },
  102. };
  103. },
  104. async fetch() {
  105. //
  106. try {
  107. this.data = (await getStarCoinOverview(this)).data;
  108. } catch (error) {
  109. this.$toast.error(error.message);
  110. }
  111. },
  112. head: {
  113. title: '邀请好友',
  114. // share: {
  115. // title: '标题',
  116. // content: '内容',
  117. // gotoUrl: 'http://localhost',
  118. // shareImg: 'http://localhost',
  119. // },
  120. },
  121. computed: {
  122. dataList() {
  123. return [
  124. { label: '今日收益(星币)', value: this.data.todayIncomeStarCoin },
  125. { label: '总收益(星币)', value: this.data.totalIncomeStarCoin },
  126. { label: '今日购买订单数', value: this.data.todayBuyOrderSuccessCount },
  127. { label: '累计推广订单', value: this.data.totalBuyOrderCount },
  128. {
  129. label: '今日购买成功客户',
  130. value: this.data.todayBuyOrderSuccessCount,
  131. },
  132. {
  133. label: '累计购买成功客户',
  134. value: this.data.totalBuyOrderSuccessCount,
  135. },
  136. // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
  137. ];
  138. },
  139. },
  140. mounted() {},
  141. methods: {
  142. async share() {
  143. // console.log(this);
  144. if (this.data.status !== 1) {
  145. throw new Error('当前活动已失效');
  146. }
  147. this.$tongji.trackEvent('活动', '分享', '', 0);
  148. const url =
  149. location.origin +
  150. this.$router.resolve({
  151. path: '/activity/invite-user/register',
  152. query: {
  153. invitationUserName: this.data.inviteUserName,
  154. activityId: this.data.activityId,
  155. },
  156. }).href;
  157. if (this.$userAgent.isMiniProgram) {
  158. // 小程序环境
  159. await clipboard.writeText(url);
  160. this.$toast.success('链接复制成功');
  161. } else if (this.$userAgent.isApp) {
  162. // app环境
  163. this.$native.share({
  164. title: '双子星APP',
  165. content: '分享好友购买云机套餐,返星币换现金',
  166. gotoUrl: url,
  167. shareImg: 'sdsa.png',
  168. });
  169. } else {
  170. // 浏览器环境
  171. await clipboard.writeText(url);
  172. // throw new Error('1231');
  173. this.$toast.success('链接复制成功');
  174. }
  175. },
  176. },
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. .invite-user {
  181. color: #333;
  182. background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  183. background-size: 100% auto;
  184. background-position-y: -44px;
  185. overflow: hidden;
  186. padding-bottom: 30px;
  187. }
  188. .box {
  189. width: 373px;
  190. box-sizing: border-box;
  191. margin: auto;
  192. border-image-source: url('~/assets/image/activity/invite-user/box@2x.png');
  193. border-image-slice: 38 * 2 20 * 2 30 * 2 fill;
  194. // border-image-width: 200px;
  195. // border-image-slice: 200%;
  196. border-width: 38px 15px 15px;
  197. // border-width: 1px;
  198. border-style: solid;
  199. position: relative;
  200. + .box {
  201. margin-top: 30px;
  202. }
  203. .box-header {
  204. position: absolute;
  205. top: -30px;
  206. // left: 141px;
  207. left: 0;
  208. right: 0;
  209. text-align: center;
  210. padding: 0 130px;
  211. color: #fff;
  212. }
  213. .box-main {
  214. padding: 30px 15px 20px;
  215. }
  216. }
  217. .box1 {
  218. margin-top: 275px;
  219. .box-main {
  220. // padding: 30px 15px 20px;
  221. padding-left: 0;
  222. padding-right: 0;
  223. }
  224. .cybz-content {
  225. width: 305px;
  226. height: 75px;
  227. margin: auto;
  228. display: block;
  229. // margin-top: 30px;
  230. }
  231. .cybz-content-text {
  232. // display: flex;
  233. display: grid;
  234. // width: 305px;
  235. // padding: 0 28px;
  236. // align-items: center;
  237. // margin: auto;
  238. // justify-content: space-between;
  239. grid-template-columns: 1fr 1fr 1fr;
  240. font-size: 12px;
  241. color: #333;
  242. .cybz-content-text-item {
  243. // width: 0;
  244. // flex: auto;
  245. text-align: center;
  246. }
  247. }
  248. .share-button {
  249. display: block;
  250. margin: auto;
  251. width: 302px !important;
  252. height: 62px !important;
  253. background-image: url('~/assets/image/activity/invite-user/share-button@2x.png');
  254. background-size: 100% 100%;
  255. margin-top: 24px;
  256. // margin-bottom: 24px;
  257. color: #dd1b0d;
  258. font-size: 22px;
  259. font-weight: bold;
  260. }
  261. }
  262. .box2 {
  263. .label {
  264. // font-size: 14px;
  265. }
  266. .value {
  267. color: #ff6600;
  268. // font-size: 24px;
  269. }
  270. .box-main {
  271. padding-left: 20px;
  272. padding-right: 20px;
  273. }
  274. }
  275. .box4 {
  276. .box-main {
  277. // padding-left: 20px;
  278. // padding-top: 0;
  279. }
  280. }
  281. </style>