index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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" v-html="activityRules">
  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. import { getContentByType } from '~/api/public/agreement.js';
  85. export default {
  86. // auth: false,
  87. name: 'InviteUser',
  88. filters: {},
  89. data() {
  90. return {
  91. data: {
  92. todayIncomeStarCoin: 0,
  93. totalIncomeStarCoin: 0,
  94. todayBuyOrderCount: 0,
  95. totalBuyOrderCount: 0,
  96. todayBuyOrderSuccessCount: 0,
  97. totalBuyOrderSuccessCount: 0,
  98. withdrawStarCoinNum: 0,
  99. inviteUserName: null,
  100. activityId: null,
  101. status: 0,
  102. },
  103. activityRules: '',
  104. };
  105. },
  106. async fetch() {
  107. //
  108. try {
  109. this.getActivityRules();
  110. this.data = (await getStarCoinOverview(this)).data;
  111. } catch (error) {
  112. this.$toast.error(error.message);
  113. }
  114. },
  115. head: {
  116. title: '邀请好友',
  117. // share: {
  118. // title: '标题',
  119. // content: '内容',
  120. // gotoUrl: 'http://localhost',
  121. // shareImg: 'http://localhost',
  122. // },
  123. },
  124. computed: {
  125. dataList() {
  126. return [
  127. { label: '今日收益(星币)', value: this.data.todayIncomeStarCoin },
  128. { label: '总收益(星币)', value: this.data.totalIncomeStarCoin },
  129. { label: '今日购买订单数', value: this.data.todayBuyOrderSuccessCount },
  130. { label: '累计推广订单', value: this.data.totalBuyOrderCount },
  131. {
  132. label: '今日购买成功客户',
  133. value: this.data.todayBuyOrderSuccessCount,
  134. },
  135. {
  136. label: '累计购买成功客户',
  137. value: this.data.totalBuyOrderSuccessCount,
  138. },
  139. // { label: '可提现星币数量', value: this.data.withdrawStarCoinNum },
  140. ];
  141. },
  142. },
  143. mounted() {
  144. this.$userAgent.isMiniProgram &&
  145. this.$wx.miniProgram.postMessage({
  146. data: {
  147. action: 'updateAppMessageShareData',
  148. params: {
  149. title: '双子星云手机',
  150. path: '/pages/home/home',
  151. imageUrl:
  152. location.origin +
  153. require('~/assets/image/activity/invite-user/bg@2x.png'),
  154. // promise: null,
  155. },
  156. },
  157. });
  158. },
  159. methods: {
  160. async share() {
  161. // console.log(this);
  162. if (this.data.status !== 1) {
  163. throw new Error('当前活动已失效');
  164. }
  165. this.$tongji.trackEvent('活动', '分享', '', 0);
  166. const url =
  167. location.origin +
  168. this.$router.resolve({
  169. path: '/activity/invite-user/register',
  170. query: {
  171. invitationUserName: this.data.inviteUserName,
  172. activityId: this.data.activityId,
  173. },
  174. }).href;
  175. if (this.$userAgent.isMiniProgram) {
  176. // 小程序环境
  177. await clipboard.writeText(`${url} 唔即云手机`);
  178. this.$toast.success('链接复制成功');
  179. } else if (this.$userAgent.isApp) {
  180. // app环境
  181. this.$native.share({
  182. title: '双子星APP',
  183. content: '分享好友购买云机套餐,返星币换现金',
  184. gotoUrl: url,
  185. shareImg: 'sdsa.png',
  186. });
  187. } else {
  188. // 浏览器环境
  189. await clipboard.writeText(`${url} 唔即云手机`);
  190. // throw new Error('1231');
  191. this.$toast.success('链接复制成功');
  192. }
  193. },
  194. async getActivityRules() {
  195. const res = await getContentByType(this, 'iuserrules01');
  196. this.activityRules = res.data.content
  197. .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
  198. .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
  199. },
  200. },
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. .invite-user {
  205. color: #333;
  206. background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  207. background-size: 100% auto;
  208. background-position-y: -44px;
  209. overflow: hidden;
  210. padding-bottom: 30px;
  211. }
  212. .box {
  213. width: 373px;
  214. box-sizing: border-box;
  215. margin: auto;
  216. border-image-source: url('~/assets/image/activity/invite-user/box@2x.png');
  217. border-image-slice: 38 * 2 20 * 2 30 * 2 fill;
  218. // border-image-width: 200px;
  219. // border-image-slice: 200%;
  220. border-width: 38px 15px 15px;
  221. // border-width: 1px;
  222. border-style: solid;
  223. position: relative;
  224. + .box {
  225. margin-top: 30px;
  226. }
  227. .box-header {
  228. position: absolute;
  229. top: -30px;
  230. // left: 141px;
  231. left: 0;
  232. right: 0;
  233. text-align: center;
  234. padding: 0 130px;
  235. color: #fff;
  236. }
  237. .box-main {
  238. padding: 30px 15px 20px;
  239. }
  240. }
  241. .box1 {
  242. margin-top: 275px;
  243. .box-main {
  244. // padding: 30px 15px 20px;
  245. padding-left: 0;
  246. padding-right: 0;
  247. }
  248. .cybz-content {
  249. width: 305px;
  250. height: 75px;
  251. margin: auto;
  252. display: block;
  253. // margin-top: 30px;
  254. }
  255. .cybz-content-text {
  256. // display: flex;
  257. display: grid;
  258. // width: 305px;
  259. // padding: 0 28px;
  260. // align-items: center;
  261. // margin: auto;
  262. // justify-content: space-between;
  263. grid-template-columns: 1fr 1fr 1fr;
  264. font-size: 12px;
  265. color: #333;
  266. .cybz-content-text-item {
  267. // width: 0;
  268. // flex: auto;
  269. text-align: center;
  270. }
  271. }
  272. .share-button {
  273. display: block;
  274. margin: auto;
  275. width: 302px !important;
  276. height: 62px !important;
  277. background-image: url('~/assets/image/activity/invite-user/share-button@2x.png');
  278. background-size: 100% 100%;
  279. margin-top: 24px;
  280. // margin-bottom: 24px;
  281. color: #dd1b0d;
  282. font-size: 22px;
  283. font-weight: bold;
  284. }
  285. }
  286. .box2 {
  287. .label {
  288. // font-size: 14px;
  289. }
  290. .value {
  291. color: #ff6600;
  292. // font-size: 24px;
  293. }
  294. .box-main {
  295. padding-left: 20px;
  296. padding-right: 20px;
  297. }
  298. }
  299. .box4 {
  300. .box-main {
  301. // padding-left: 20px;
  302. // padding-top: 0;
  303. }
  304. }
  305. </style>