jiedian.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <template>
  2. <view class="content">
  3. <!-- 头部 -->
  4. <view class="container">
  5. <view class="jiedianbackground">
  6. <image src="../../static/image/jiedian.png" mode=""></image>
  7. </view>
  8. <view class="number-box">
  9. <view class="number">
  10. <text>{{ userInfo.A_count + userInfo.B_count + userInfo.C_count }}</text>
  11. </view>
  12. <view class="renshu">我的接点人数</view>
  13. </view>
  14. </view>
  15. <view class="message">
  16. <view class="yeji">
  17. <view class="yeji-a">
  18. <view class="yeji-top">A区业绩</view>
  19. <view class="yeji-buttom">¥{{ userInfo.A_achievement }}</view>
  20. </view>
  21. <view class="border"></view>
  22. <view class="yeji-a">
  23. <view class="yeji-top">B区业绩</view>
  24. <view class="yeji-buttom">¥{{ userInfo.B_achievement }}</view>
  25. </view>
  26. <view class="border"></view>
  27. <view class="yeji-a">
  28. <view class="yeji-top">C区业绩</view>
  29. <view class="yeji-buttom">¥{{ userInfo.C_achievement }}</view>
  30. </view>
  31. </view>
  32. <view class="back" @click="navBack()" v-if="parentList.length > 0">
  33. <image src="../../static/img/zhengyi10.png" mode=""></image>
  34. 返回
  35. </view>
  36. <view class="relation-box">
  37. <view class="relation">
  38. <view class="headbox">
  39. <view class="head">
  40. <view class="photo">
  41. <image v-if="avatar" :src="avatar"></image>
  42. </view>
  43. </view>
  44. <view class="head-title">
  45. <image src="../../static/image/jiedian1.png" mode=""></image>
  46. </view>
  47. </view>
  48. <view class="information">
  49. <view class="name clamp">{{ name }}</view>
  50. <view class="cell clamp">{{ phone }}</view>
  51. </view>
  52. </view>
  53. <view class="sanchaji">
  54. <image src="../../static/image/sanchaji.png" mode=""></image>
  55. </view>
  56. <view class="subordinate">
  57. <view class="headbox" v-if="listA" @click="nav('a')">
  58. <view class="head">
  59. <view class="photo">
  60. <image v-if='listA.avatar' :src="listA.avatar" mode="scaleToFill"></image>
  61. </view>
  62. </view>
  63. <view class="head-title">
  64. <image src="../../static/image/jiedian1.png" mode="scaleToFill"></image>
  65. </view>
  66. <view class="head-name">
  67. {{listA.nickname}}
  68. </view>
  69. <view class="head-phone">
  70. {{listA.phone}}
  71. </view>
  72. </view>
  73. <view class="zhuce" v-else @click="open('A')">
  74. <view class="jia">
  75. <view class="jia_photo">
  76. +
  77. <!-- <image v-if='!listA.avatar' class="imgbox" src="../../static/img/jiedian07.png" mode="scaleToFill"></image> -->
  78. </view>
  79. <view class="font">
  80. 点击添加
  81. </view>
  82. </view>
  83. </view>
  84. <view class="headbox" v-if="listB" @click="nav('b')">
  85. <view class="head">
  86. <view class="photo">
  87. <image :key='listB.id' :src="listB.avatar" mode="scaleToFill"></image>
  88. </view>
  89. </view>
  90. <view class="head-title">
  91. <image src="../../static/image/jiedian1.png" mode="scaleToFill"></image>
  92. </view>
  93. <view class="head-name">
  94. {{listB.nickname}}
  95. </view>
  96. <view class="head-phone">
  97. {{listB.phone}}
  98. </view>
  99. </view>
  100. <view class="zhuce" v-else @click="open('B')">
  101. <view class="jia">
  102. <view class="jia_photo">
  103. +
  104. <!-- <image v-if='!listB.avatar' class="imgbox" src="../../static/img/jiedian07.png" mode="scaleToFill"></image> -->
  105. </view>
  106. <view class="font">
  107. 点击添加
  108. </view>
  109. </view>
  110. </view>
  111. <view class="headbox" v-if="listC" @click="nav('c')">
  112. <view class="head">
  113. <view class="photo">
  114. <image v-if='listC.avatar' :src="listC.avatar" mode="scaleToFill"></image>
  115. </view>
  116. </view>
  117. <view class="head-title">
  118. <image src="../../static/image/jiedian1.png" mode="scaleToFill"></image>
  119. </view>
  120. <view class="head-name">
  121. {{listC.nickname}}
  122. </view>
  123. <view class="head-phone">
  124. {{listC.phone}}
  125. </view>
  126. </view>
  127. <view class="zhuce" v-else @click="open('C')">
  128. <view class="jia">
  129. <view class="jia_photo">
  130. +
  131. <!-- <image v-if='!listC.avatar' class="imgbox" src="../../static/img/jiedian07.png" mode="scaleToFill"></image> -->
  132. </view>
  133. <view class="font">
  134. 点击添加
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <uni-popup ref="popup" type="center">
  142. <view class="popup-box">
  143. <view class="backgroundimg">
  144. <image src="../../static/image/popup01.png" mode=""></image>
  145. </view>
  146. <view class="text">
  147. <view class="text-one">
  148. 添加类型
  149. </view>
  150. <view class="text-two">
  151. 请选择接点人添加类型
  152. </view>
  153. </view>
  154. <view class="box-choose">
  155. <view class="choose">
  156. <view class="zhuce">
  157. <view class="zhuce-img">
  158. <image src="../../static/image/popup03.png" mode="scaleToFill"></image>
  159. </view>
  160. <text>注册接点人</text>
  161. </view>
  162. <view class="radio">
  163. <radio value="2" :checked="bianhao==='3'" @click="radio('3')" color="#6EAB4E"></radio>
  164. </view>
  165. </view>
  166. <view class="choose">
  167. <view class="zhuce">
  168. <view class="zhuce-img">
  169. <image src="../../static/image/popup02.png" mode=""></image>
  170. </view>
  171. <text>选择接点人</text>
  172. </view>
  173. <view class="radio">
  174. <radio value="1" :checked="bianhao==='1'" color="#6EAB4E" @click="radio('1')">
  175. </radio>
  176. </view>
  177. </view>
  178. <view class="button" @click="navJiedian()">
  179. 确认
  180. </view>
  181. </view>
  182. </view>
  183. </uni-popup>
  184. </view>
  185. </template>
  186. <script>
  187. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  188. import {
  189. getjiedian,
  190. getReferralList,
  191. addJiedian
  192. } from '@/api/user.js';
  193. import {
  194. mapState,
  195. mapMutations
  196. } from 'vuex';
  197. export default {
  198. components: {
  199. uniPopup
  200. },
  201. data() {
  202. return {
  203. bianhao: '1',
  204. a: 1,
  205. b: 2,
  206. c: 3,
  207. listA: '', //节点A
  208. listB: '', //节点B
  209. listC: '', //节点C
  210. name: '', //当前节点姓名
  211. phone: '', //当前节点手机号
  212. avatar: '', //当前节点头像
  213. id: '',
  214. uid: '',
  215. jiedianList: [],
  216. parentList: [], //保存打开层级用户数据
  217. parent_area: ''
  218. };
  219. },
  220. computed: {
  221. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  222. },
  223. onLoad() {
  224. this.name = this.userInfo.nickname;
  225. this.phone = this.userInfo.phone;
  226. this.avatar = this.userInfo.avatar;
  227. this.id = this.userInfo.uid;
  228. this.loadData();
  229. },
  230. methods: {
  231. navJiedian() {
  232. this.$refs.popup.close();
  233. console.log(this.bianhao, 'bianhao')
  234. if (this.bianhao === '3') {
  235. uni.navigateTo({
  236. url: '/pages/public/register'
  237. })
  238. } else if (this.bianhao === '1') {
  239. uni.navigateTo({
  240. url: '/pages/user/selectList?patent=' + this.id + '&parent_area=' + this.parent_area
  241. })
  242. }
  243. },
  244. //切换按钮
  245. radio(e) {
  246. this.bianhao = e
  247. },
  248. //打开选择项
  249. open(are) {
  250. console.log(this.id)
  251. console.log('点击出现弹窗')
  252. this.$refs.popup.open();
  253. this.parent_area = are;
  254. console.log(this.parent_area);
  255. },
  256. //返回
  257. navBack() {
  258. const obj = this;
  259. // 删除
  260. let parent = obj.parentList.pop();
  261. console.log(parent);
  262. console.log(obj.parentList, 'navBack')
  263. // 保存回退后数据对象
  264. obj.name = parent.name;
  265. obj.avatar = parent.avatar;
  266. obj.id = parent.id;
  267. obj.listA = obj.listB = obj.listC = '';
  268. console.log(parent, '对象');
  269. obj.loadData();
  270. },
  271. loadData() {
  272. const obj = this;
  273. uni.showLoading({
  274. title: '加载中。。。',
  275. mask: true
  276. });
  277. getjiedian({}, this.id).then(({
  278. data
  279. }) => {
  280. uni.hideLoading()
  281. if (data.list.length != 0) {
  282. data.list.forEach(e => {
  283. console.log('e', e);
  284. let item = '';
  285. if (e.parent_area == 'A') {
  286. item = 'listA';
  287. } else if (e.parent_area == 'B') {
  288. item = 'listB';
  289. } else if (e.parent_area == 'C') {
  290. item = 'listC';
  291. }
  292. obj[item] = e;
  293. console.log(obj, '当前数据');
  294. });
  295. } else {
  296. return;
  297. }
  298. }).catch((e) => {
  299. uni.hideLoading()
  300. });
  301. },
  302. nav(type) {
  303. const obj = this;
  304. // 保存当前选中的对象
  305. let item = '';
  306. if (type == 'a') {
  307. item = 'listA'
  308. } else {
  309. if (type == 'b') {
  310. item = 'listB'
  311. } else if (type == 'c') {
  312. item = 'listC'
  313. }
  314. }
  315. obj.parentList.push({
  316. name: obj.name,
  317. phone: obj.phone,
  318. avatar: obj.avatar,
  319. id: obj.id,
  320. })
  321. console.log(obj.parentList, 's');
  322. obj.name = obj[item].nickname;
  323. obj.phone = obj[item].phone;
  324. obj.avatar = '';
  325. obj.$nextTick(function() {
  326. obj.avatar = obj[item].avatar;
  327. obj.id = obj[item].uid;
  328. obj.listA = '';
  329. obj.listB = '';
  330. obj.listC = '';
  331. obj.loadData();
  332. })
  333. },
  334. navto(type) {
  335. if (type == 'a') {
  336. uni.navigateTo({
  337. url: '/pages/public/register?id=' + this.id + '&area=A'
  338. });
  339. } else if (type == 'b') {
  340. uni.navigateTo({
  341. url: '/pages/public/register?id=' + this.id + '&area=B'
  342. });
  343. } else if (type == 'c') {
  344. if (this.listA == '' || this.listB == '') {
  345. this.$api.msg('请先注册完接点A和接点B');
  346. } else {
  347. uni.navigateTo({
  348. url: '/pages/public/register?id=' + this.id + '&area=C'
  349. });
  350. }
  351. }
  352. }
  353. }
  354. };
  355. </script>
  356. <style lang="scss">
  357. page {
  358. padding: 0;
  359. margin: 0;
  360. height: 100%;
  361. background-color: #ffffff;
  362. }
  363. .popup-box {
  364. width: 542rpx;
  365. height: 575rpx;
  366. background-color: #ffffff;
  367. border-radius: 20rpx;
  368. position: relative;
  369. margin: 0 auto;
  370. .backgroundimg {
  371. width: 542rpx;
  372. height: 138rpx;
  373. position: absolute;
  374. image {
  375. width: 100%;
  376. height: 100%;
  377. }
  378. }
  379. .text {
  380. display: flex;
  381. flex-direction: column;
  382. align-items: center;
  383. padding-top: 80rpx;
  384. margin-bottom: 50rpx;
  385. .text-one {
  386. font-size: 36rpx;
  387. font-family: PingFang SC;
  388. font-weight: bold;
  389. color: #333333;
  390. margin-bottom: 10rpx;
  391. }
  392. .text-two {
  393. font-size: 24rpx;
  394. font-family: PingFang SC;
  395. font-weight: 500;
  396. color: #808080;
  397. }
  398. }
  399. .box-choose {
  400. margin: 0 40rpx;
  401. display: flex;
  402. flex-direction: column;
  403. .choose {
  404. display: flex;
  405. justify-content: space-between;
  406. margin: 25rpx 0;
  407. .zhuce {
  408. display: flex;
  409. .zhuce-img {
  410. width: 42rpx;
  411. height: 43rpx;
  412. image {
  413. width: 100%;
  414. height: 100%;
  415. }
  416. }
  417. }
  418. text {
  419. margin-left: 10rpx;
  420. font-size: 28rpx;
  421. font-weight: 500;
  422. color: #333333;
  423. }
  424. .radio {}
  425. }
  426. .button {
  427. margin-top: 60rpx;
  428. width: 460rpx;
  429. text-align: center;
  430. line-height: 70rpx;
  431. height: 70rpx;
  432. background: #6EAB4E;
  433. border-radius: 10rpx;
  434. font-size: 28rpx;
  435. font-weight: 500;
  436. color: #FFFFFF;
  437. }
  438. }
  439. }
  440. .container {
  441. width: 750rpx;
  442. height: 400rpx;
  443. position: relative;
  444. .jiedianbackground {
  445. position: absolute;
  446. width: 750rpx;
  447. height: 400rpx;
  448. image {
  449. width: 100%;
  450. height: 100%;
  451. }
  452. }
  453. .number-box {
  454. width: 750rpx;
  455. height: 400rpx;
  456. position: absolute;
  457. display: flex;
  458. justify-content: center;
  459. flex-direction: column;
  460. align-items: center;
  461. .number {
  462. font-size: 30rpx;
  463. font-family: PingFang SC;
  464. font-weight: 500;
  465. color: #3f7c1f;
  466. text {
  467. font-size: 72rpx;
  468. font-family: PingFang SC;
  469. font-weight: bold;
  470. color: #3f7c1f;
  471. line-height: 86rpx;
  472. }
  473. }
  474. .renshu {
  475. font-size: 30rpx;
  476. font-family: PingFang SC;
  477. font-weight: 500;
  478. color: #3f7c1f;
  479. }
  480. }
  481. }
  482. .message {
  483. padding: 0 30rpx;
  484. .relation-box {
  485. margin-top: 100rpx;
  486. display: flex;
  487. flex-direction: column;
  488. align-items: center;
  489. .relation {
  490. position: relative;
  491. display: flex;
  492. align-items: center;
  493. .headbox {
  494. position: absolute;
  495. // width: 154rpx;
  496. // height: 154rpx;
  497. .head {
  498. width: 154rpx;
  499. height: 154rpx;
  500. background: #ef9e20;
  501. box-shadow: 5rpx 0rpx 5rpx 0rpx rgba(110, 171, 78, 0.26);
  502. border-radius: 50%;
  503. overflow: hidden;
  504. .photo {
  505. width: 154rpx;
  506. height: 154rpx;
  507. image {
  508. width: 100%;
  509. height: 100%;
  510. }
  511. }
  512. }
  513. .head-title {
  514. margin: -30rpx 30rpx 0 30rpx;
  515. width: 94rpx;
  516. height: 32rpx;
  517. image {
  518. width: 100%;
  519. height: 100%;
  520. }
  521. }
  522. // .head-name{
  523. // max-width: 100%;
  524. // font-size: 32rpx;
  525. // font-weight: bold;
  526. // color: #333333;
  527. // }
  528. // .head-phone{
  529. // font-size: 26rpx;
  530. // font-weight: 500;
  531. // color: #999999;
  532. // }
  533. }
  534. .information {
  535. margin-left: 77rpx;
  536. display: flex;
  537. padding: 20rpx 10rpx;
  538. flex-direction: column;
  539. width: 297rpx;
  540. height: 137rpx;
  541. background: #ffffff;
  542. border: 4rpx solid #6eab4e;
  543. border-radius: 10rpx;
  544. .name {
  545. text-align: left;
  546. margin-left: 70rpx;
  547. font-size: 32rpx;
  548. font-family: PingFang SC;
  549. font-weight: bold;
  550. color: #3f7c1f;
  551. }
  552. .cell {
  553. text-align: left;
  554. margin-left: 70rpx;
  555. font-size: 26rpx;
  556. font-family: PingFang SC;
  557. font-weight: 500;
  558. color: #abd56f;
  559. }
  560. }
  561. }
  562. .sanchaji {
  563. margin: 30rpx 0;
  564. width: 530rpx;
  565. height: 91rpx;
  566. image {
  567. width: 100%;
  568. height: 100%;
  569. }
  570. }
  571. .subordinate {
  572. width: 750rpx;
  573. display: flex;
  574. justify-content: space-around;
  575. .zhuce {
  576. width: 154rpx;
  577. height: 154rpx;
  578. .jia {
  579. width: 154rpx;
  580. height: 154rpx;
  581. display: flex;
  582. flex-direction: column;
  583. align-items: center;
  584. justify-content: center;
  585. background: #E8E8E8;
  586. box-shadow: 5rpx 0rpx 5rpx 0rpx rgba(110, 171, 78, 0.26);
  587. border-radius: 50%;
  588. overflow: hidden;
  589. .jia_photo {
  590. font-size: 80rpx;
  591. line-height: 1;
  592. color: #a3a3a3;
  593. }
  594. .font {
  595. font-size: 22rpx;
  596. font-weight: 500;
  597. color: #999999;
  598. }
  599. }
  600. }
  601. .headbox {
  602. width: 33.3%;
  603. // height: 154rpx;
  604. display: flex;
  605. flex-direction: column;
  606. // flex-wrap: nowrap;
  607. align-items: center;
  608. padding: 0 10rpx;
  609. .head {
  610. width: 154rpx;
  611. height: 154rpx;
  612. background: #ef9e20;
  613. box-shadow: 5rpx 0rpx 5rpx 0rpx rgba(110, 171, 78, 0.26);
  614. border-radius: 50%;
  615. overflow: hidden;
  616. .photo {
  617. width: 154rpx;
  618. height: 154rpx;
  619. image {
  620. width: 100%;
  621. height: 100%;
  622. }
  623. }
  624. }
  625. .head-title {
  626. margin: -30rpx 30rpx 0 30rpx;
  627. width: 94rpx;
  628. height: 32rpx;
  629. image {
  630. width: 100%;
  631. height: 100%;
  632. }
  633. }
  634. .head-name {
  635. margin-top: 20rpx;
  636. white-space: nowrap;
  637. overflow: hidden;
  638. text-overflow: ellipsis;
  639. width: 150rpx;
  640. padding-top: 10rpx;
  641. text-align: center;
  642. // margin: 30rpx 0 0 0;
  643. font-size: 32rpx;
  644. font-weight: bold;
  645. color: #333333;
  646. }
  647. .head-phone {
  648. margin: 15rpx 0 0 0;
  649. font-size: 26rpx;
  650. font-weight: 500;
  651. color: #999999;
  652. }
  653. }
  654. }
  655. }
  656. .yeji {
  657. position: relative;
  658. margin-top: -72rpx;
  659. width: 690rpx;
  660. height: 143rpx;
  661. background: #ffffff;
  662. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  663. border-radius: 10rpx;
  664. display: flex;
  665. justify-content: space-around;
  666. align-items: center;
  667. .yeji-a {
  668. display: flex;
  669. flex-direction: column;
  670. justify-content: space-around;
  671. align-items: center;
  672. .yeji-top {
  673. font-size: 24rpx;
  674. font-family: PingFang SC;
  675. font-weight: bold;
  676. color: #333333;
  677. line-height: 35px;
  678. }
  679. .yeji-buttom {
  680. font-size: 34rpx;
  681. font-family: PingFang SC;
  682. font-weight: bold;
  683. color: #333333;
  684. line-height: 35px;
  685. }
  686. }
  687. .border {
  688. width: 1rpx;
  689. height: 51rpx;
  690. background: #dddddd;
  691. }
  692. }
  693. .back {
  694. float: right;
  695. margin-top: 40rpx;
  696. display: flex;
  697. align-items: center;
  698. justify-content: center;
  699. image {
  700. width: 24rpx;
  701. height: 23rpx;
  702. }
  703. width: 104rpx;
  704. height: 39rpx;
  705. border: 2rpx solid #6EAB4E;
  706. border-radius: 7rpx;
  707. font-size: 24rpx;
  708. font-family: PingFang SC;
  709. font-weight: 500;
  710. color: #6EAB4E;
  711. }
  712. }
  713. </style>