InviterManage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view class="div container">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar title="推广管理" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div main-content">
  13. <view class="member-info item">
  14. <view class="logo"><image mode="aspectFit" class="img avatar" v-bind:src="user.member_avatar+'?'+time"/></image></view>
  15. <view class="name">会员名称:{{user.member_name}}</view>
  16. </view>
  17. <view class="money item mt-5">
  18. <view class="title">我的资产</view>
  19. <view class="money-wrapper mt-10">
  20. <view class="money-item">
  21. <view>{{inviter_member.inviter_total_amount}}</view>
  22. <text>已分销金额</text>
  23. </view>
  24. <view class="money-item">
  25. <view>{{inviter_member.inviter_goods_quantity}}</view>
  26. <text>分销商品数</text>
  27. </view>
  28. <view class="money-item">
  29. <view>{{inviter_member.inviter_goods_amount}}</view>
  30. <text>分销商品金额</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="team item mt-5">
  35. <view class="title"><text class="row"></text><text class="span">我的团队</text></view>
  36. <view class="team-wrapper">
  37. <view class="team-item">
  38. <view class="num">{{inviter_member.inviter_1_quantity}}</view>
  39. <view class="link"></view>
  40. <view class="text">一级会员</view>
  41. </view>
  42. <view class="team-item">
  43. <view class="num">{{inviter_member.inviter_2_quantity}}</view>
  44. <view class="link"></view>
  45. <view class="text">二级会员</view>
  46. </view>
  47. <view class="team-item">
  48. <view class="num">{{inviter_member.inviter_3_quantity}}</view>
  49. <view class="link"></view>
  50. <view class="text">三级会员</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="div nav-wrapper mt-5">
  55. <view class="div nav-item" @click='showPopup("weixinVisible")'>推广公众号</view>
  56. <view class="div nav-item" @click='showPopup("posterVisible")'>推广海报</view>
  57. <view class="div nav-item" @click='goNavigate("/pages/member/inviter/InviterUser")'>推广成员</view>
  58. <view class="div nav-item" @click='goNavigate("/pages/member/inviter/InviterOrder")'>推广业绩</view>
  59. </view>
  60. <view class="btn" @click.stop="onShare">点击查看推广链接</view>
  61. </view>
  62. <!--推广公众号-->
  63. <uni-popup background-color="#fff" ref="weixinVisible" type="right" >
  64. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  65. <view class="div common-header-wrap">
  66. <view :style="'height:'+navHeight+'px'"></view>
  67. <view class="common-header-holder"></view>
  68. <view class="common-header-fixed">
  69. <title-header />
  70. <uni-nav-bar title="推广公众号" class="common-header" left-icon="back" @clickLeft="hidePopup('weixinVisible')">
  71. </uni-nav-bar>
  72. </view>
  73. </view>
  74. <view class="div common-popup-content">
  75. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  76. <view class="div refer_qrcode_weixin" v-if="refer_qrcode_weixin" >
  77. <image mode="aspectFit" class="img" :src="refer_qrcode_weixin">
  78. <view class="p">赶快去推广微信二维码吧!</view>
  79. </view>
  80. <view class="p refer_qrcode_weixin_error" v-else>{{wx_error_msg}}</view>
  81. </scroll-view>
  82. </view>
  83. </view>
  84. </uni-popup>
  85. <!--推广海报-->
  86. <uni-popup background-color="#fff" ref="posterVisible" type="right" >
  87. <view :style="'width:'+screenWidth+'px'" class="common-popup-wrapper">
  88. <view class="div common-header-wrap">
  89. <view :style="'height:'+navHeight+'px'"></view>
  90. <view class="common-header-holder"></view>
  91. <view class="common-header-fixed">
  92. <title-header />
  93. <uni-nav-bar title="推广海报" class="common-header" left-icon="back" @clickLeft="hidePopup('posterVisible')">
  94. </uni-nav-bar>
  95. </view>
  96. </view>
  97. <view class="div common-popup-content">
  98. <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" scroll-y="true">
  99. <image mode="aspectFit" class="img refer_qrcode_logo" :src="refer_qrcode_logo" :style="'width:'+wrapperWidth+'px'">
  100. </scroll-view>
  101. </view>
  102. </view>
  103. </uni-popup>
  104. <uni-popup background-color="#fff" ref="shareVisible" type="bottom">
  105. <view class="div common-popup-content">
  106. <view class="div share-list">
  107. <view class="div share-item copy" @click.stop="showLink">复制</view>
  108. </view>
  109. </view>
  110. </uni-popup>
  111. <uni-popup background-color="#fff" ref="copyVisible">
  112. <view class="copy-wrapper">
  113. <view class="div title">您的浏览器不支持直接复制,请手动复制</view>
  114. <input type="text" :value="inviter_url" onfocus="this.select()" >
  115. </view>
  116. </uni-popup>
  117. </view></member-base>
  118. </template>
  119. <script>
  120. import {getFontSize} from '@/util/common'
  121. import TitleHeader from '../../TitleHeader'
  122. import MemberBase from '../MemberBase'
  123. import { mapState } from 'vuex'
  124. import { getInviterPoster } from '../../../api/memberInviter'
  125. import flexLine from '../../flexLine'
  126. export default {
  127. components:{
  128. TitleHeader,
  129. MemberBase,
  130. flexLine,
  131. },
  132. computed:{
  133. fontSize(){
  134. return getFontSize()
  135. },
  136. ...mapState({
  137. user: state => state.member.info
  138. })
  139. },
  140. data(){
  141. return {
  142. navHeight: 0,
  143. screenWidth:0,
  144. inviter_url: '',
  145. time:'',
  146. refer_qrcode_logo: '',
  147. refer_qrcode_weixin: '',
  148. wx_error_msg: '',
  149. wrapperWidth: 0,
  150. inviter_member:{}
  151. }
  152. },
  153. created () {
  154. getInviterPoster().then(res => {
  155. this.inviter_url = res.result.inviter_url
  156. this.refer_qrcode_logo = res.result.refer_qrcode_logo
  157. this.refer_qrcode_weixin = res.result.refer_qrcode_weixin
  158. this.wx_error_msg = res.result.wx_error_msg
  159. this.inviter_member = res.result.inviter_member
  160. }).catch(function (error) {
  161. uni.showToast({icon:'none',title: error.message})
  162. })
  163. },
  164. mounted(){
  165. // #ifdef MP-WEIXIN
  166. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  167. // #endif
  168. this.screenWidth=uni.getSystemInfoSync().screenWidth
  169. this.wrapperWidth = uni.getSystemInfoSync().windowWidth - 20
  170. this.time = new Date().getTime()
  171. },
  172. methods:{
  173. onShare () {
  174. this.showPopup('shareVisible')
  175. },
  176. goNavigate(path){
  177. uni.navigateTo({url:path})
  178. },
  179. showPopup(id){
  180. this.$refs[id].open()
  181. },
  182. hidePopup(id){
  183. this.$refs[id].close()
  184. },
  185. showLink () {
  186. // #ifdef H5
  187. if (window.clipboardData) {
  188. window.clipboardData.clearData()
  189. window.clipboardData.setData('Text', this.copyLink)
  190. uni.showToast({icon:'none',title: '复制成功!'})
  191. } else {
  192. this.showPopup('copyVisible')
  193. }
  194. // #endif
  195. // #ifndef H5
  196. var _this=this
  197. uni.setClipboardData({
  198. data: this.copyLink,
  199. success: function () {
  200. uni.showToast({
  201. icon: 'none',
  202. title: '复制成功!'
  203. })
  204. },
  205. fail:function () {
  206. _this.showPopup('popup_copy')
  207. }
  208. })
  209. // #endif
  210. },
  211. goBack(){uni.navigateBack({delta:1})},
  212. }
  213. }
  214. </script>
  215. <style scoped lang="scss">
  216. .main-content{
  217. padding:0 $pageSpace;
  218. margin-top: $modelSpace;
  219. .item{
  220. background-color: #fff;
  221. border-radius: .5rem;
  222. padding: $pageSpace;
  223. }
  224. .member-info{
  225. padding: $pageSpace;
  226. display: flex;
  227. align-items: center;
  228. background: -webkit-gradient(linear,left top,right top,from(#ecd8be),to(#dbb280));
  229. background: linear-gradient(90deg,#ecd8be,#dbb280);
  230. .logo{
  231. width: 3rem;
  232. height: 3rem;
  233. border-radius: 50%;
  234. overflow: hidden;
  235. image{
  236. width: 3rem;
  237. height: 3rem;
  238. }
  239. }
  240. .name{
  241. margin-left: .5rem;
  242. font-size: .7rem;
  243. color: #333;
  244. }
  245. }
  246. .money{
  247. .title{
  248. font-size: .7rem;
  249. color: #333;
  250. padding-bottom: .5rem;
  251. border-bottom: 1px dashed #dedede;
  252. }
  253. .money-wrapper{
  254. display: flex;
  255. .money-item{
  256. width: 33%;
  257. text-align: center;
  258. view{
  259. font-size: .7rem;
  260. color: #FB2630;
  261. }
  262. text{
  263. font-size: .6rem;
  264. color: #333;
  265. }
  266. }
  267. }
  268. }
  269. .team{
  270. .title{
  271. margin: 0 0 .75rem;
  272. position: relative;
  273. overflow: hidden;
  274. font-size: .8rem;
  275. font-weight: 700;
  276. color: #000;
  277. display: flex;
  278. justify-content: center;
  279. align-items: center;
  280. height: 1.5rem;
  281. .row{
  282. display: block;
  283. width: 6rem;
  284. height: .1rem;
  285. background-color: #000;
  286. }
  287. .span{
  288. width: 3.5rem;
  289. height: 1.25rem;
  290. text-align: center;
  291. padding: 0 .5rem;
  292. overflow: hidden;
  293. background-color: #fff;
  294. position: absolute;
  295. box-sizing: content-box;
  296. }
  297. }
  298. .team-wrapper{
  299. display: flex;
  300. .team-item{
  301. flex: 1 1 0%;
  302. justify-content: center;
  303. color: #333;
  304. display: flex;
  305. flex-direction: column;
  306. padding: 1.2rem 0;
  307. align-items: center;
  308. background-color: #fcf3e7;
  309. margin:0 .25rem;
  310. .num{
  311. font-size: .8rem;
  312. font-weight: bold;
  313. }
  314. .link{
  315. height: .1rem;
  316. width: 1.1rem;
  317. background: -webkit-gradient(linear,left top,right top,from(#ecd8be),to(#dbb280));
  318. background: linear-gradient(90deg,#ecd8be,#dbb280);
  319. margin: .4rem 0;
  320. }
  321. .text{
  322. font-size: .6rem;
  323. }
  324. }
  325. }
  326. }
  327. .nav-wrapper{
  328. display: flex;
  329. flex-wrap: wrap;
  330. .nav-item{
  331. width: 49%;
  332. margin-right: 2%;
  333. background-color: #FFFFFF;
  334. font-size: .6rem;
  335. text-align: center;
  336. border-radius: .25rem;
  337. margin-bottom: .5rem;
  338. padding: 1rem 0;
  339. }
  340. .nav-item:nth-child(2n){
  341. margin-right: 0;
  342. }
  343. }
  344. .btn{
  345. background-color: $primaryColor;
  346. color: #FFFFFF;
  347. font-size: .8rem;
  348. text-align: center;
  349. padding: .5rem 0;
  350. border-radius: 1.2rem;
  351. }
  352. }
  353. .share-list{
  354. display:flex;
  355. .share-item{
  356. height: 3rem;
  357. margin:1rem 0.8rem;
  358. width:2.5rem;
  359. padding-left:0;
  360. background: none;
  361. text-align:center;
  362. color: #333;
  363. font-size:$fontSize;
  364. }
  365. .share-item:before{
  366. font-family: "iconfont";
  367. content:'';
  368. display:block;
  369. border-radius:50%;
  370. width:2rem;
  371. height:2rem;
  372. line-height:2rem;
  373. text-align:center;
  374. font-size:1.2rem;
  375. color:#fff;
  376. background: red;
  377. margin:0 auto;
  378. margin-bottom:.25rem
  379. }
  380. .share-item.copy:before{
  381. content:"\e64b";
  382. background:#228B22;
  383. }
  384. }
  385. .copy-wrapper{
  386. padding:1rem;
  387. input{
  388. height:1.5rem;
  389. line-height:1.5rem;
  390. padding:0 .2rem;
  391. width:12rem;
  392. border:1px solid #e1e1e1
  393. }
  394. .title{
  395. font-size:$fontSize;
  396. text-align: center;
  397. margin-bottom:.5rem;
  398. }
  399. }
  400. .inviter_url{font-size:$subFontSize;padding:.5rem;margin-left: .5rem;box-sizing:border-box}
  401. .refer_qrcode_weixin_error{font-size:$subFontSize;padding:.5rem;}
  402. .refer_qrcode_logo{margin-left: .5rem}
  403. .refer_qrcode_weixin{text-align: center;margin-top:30%;}
  404. .refer_qrcode_weixin .img{width:8rem;height:8rem;}
  405. .refer_qrcode_weixin .p{line-height:2rem;font-size:$subFontSize;}
  406. </style>