index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. this.$userAgent.isMiniProgram &&
  142. this.$wx.miniProgram.postMessage({
  143. data: {
  144. action: 'updateAppMessageShareData',
  145. params: {
  146. title: '双子星云手机',
  147. path: '/pages/home/home',
  148. imageUrl:
  149. location.origin +
  150. require('~/assets/image/activity/invite-user/bg@2x.png'),
  151. // promise: null,
  152. },
  153. },
  154. });
  155. },
  156. methods: {
  157. async share() {
  158. // console.log(this);
  159. if (this.data.status !== 1) {
  160. throw new Error('当前活动已失效');
  161. }
  162. this.$tongji.trackEvent('活动', '分享', '', 0);
  163. const url =
  164. location.origin +
  165. this.$router.resolve({
  166. path: '/activity/invite-user/register',
  167. query: {
  168. invitationUserName: this.data.inviteUserName,
  169. activityId: this.data.activityId,
  170. },
  171. }).href;
  172. if (this.$userAgent.isMiniProgram) {
  173. // 小程序环境
  174. await clipboard.writeText(url);
  175. this.$toast.success('链接复制成功');
  176. } else if (this.$userAgent.isApp) {
  177. // app环境
  178. this.$native.share({
  179. title: '双子星APP',
  180. content: '分享好友购买云机套餐,返星币换现金',
  181. gotoUrl: url,
  182. shareImg: 'sdsa.png',
  183. });
  184. } else {
  185. // 浏览器环境
  186. await clipboard.writeText(url);
  187. // throw new Error('1231');
  188. this.$toast.success('链接复制成功');
  189. }
  190. },
  191. },
  192. };
  193. </script>
  194. <style lang="scss" scoped>
  195. .invite-user {
  196. color: #333;
  197. background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  198. background-size: 100% auto;
  199. background-position-y: -44px;
  200. overflow: hidden;
  201. padding-bottom: 30px;
  202. }
  203. .box {
  204. width: 373px;
  205. box-sizing: border-box;
  206. margin: auto;
  207. border-image-source: url('~/assets/image/activity/invite-user/box@2x.png');
  208. border-image-slice: 38 * 2 20 * 2 30 * 2 fill;
  209. // border-image-width: 200px;
  210. // border-image-slice: 200%;
  211. border-width: 38px 15px 15px;
  212. // border-width: 1px;
  213. border-style: solid;
  214. position: relative;
  215. + .box {
  216. margin-top: 30px;
  217. }
  218. .box-header {
  219. position: absolute;
  220. top: -30px;
  221. // left: 141px;
  222. left: 0;
  223. right: 0;
  224. text-align: center;
  225. padding: 0 130px;
  226. color: #fff;
  227. }
  228. .box-main {
  229. padding: 30px 15px 20px;
  230. }
  231. }
  232. .box1 {
  233. margin-top: 275px;
  234. .box-main {
  235. // padding: 30px 15px 20px;
  236. padding-left: 0;
  237. padding-right: 0;
  238. }
  239. .cybz-content {
  240. width: 305px;
  241. height: 75px;
  242. margin: auto;
  243. display: block;
  244. // margin-top: 30px;
  245. }
  246. .cybz-content-text {
  247. // display: flex;
  248. display: grid;
  249. // width: 305px;
  250. // padding: 0 28px;
  251. // align-items: center;
  252. // margin: auto;
  253. // justify-content: space-between;
  254. grid-template-columns: 1fr 1fr 1fr;
  255. font-size: 12px;
  256. color: #333;
  257. .cybz-content-text-item {
  258. // width: 0;
  259. // flex: auto;
  260. text-align: center;
  261. }
  262. }
  263. .share-button {
  264. display: block;
  265. margin: auto;
  266. width: 302px !important;
  267. height: 62px !important;
  268. background-image: url('~/assets/image/activity/invite-user/share-button@2x.png');
  269. background-size: 100% 100%;
  270. margin-top: 24px;
  271. // margin-bottom: 24px;
  272. color: #dd1b0d;
  273. font-size: 22px;
  274. font-weight: bold;
  275. }
  276. }
  277. .box2 {
  278. .label {
  279. // font-size: 14px;
  280. }
  281. .value {
  282. color: #ff6600;
  283. // font-size: 24px;
  284. }
  285. .box-main {
  286. padding-left: 20px;
  287. padding-right: 20px;
  288. }
  289. }
  290. .box4 {
  291. .box-main {
  292. // padding-left: 20px;
  293. // padding-top: 0;
  294. }
  295. }
  296. </style>