index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="promoter-list">
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>{{$t(`员工人数`)}}
  8. <view class="invitation" @click="showCode">{{$t(`邀请`)}}</view>
  9. </view>
  10. <view><text class='num'>{{teamCount}}</text>{{$t(`人`)}}</view>
  11. </view>
  12. <view class='iconfont icon-tuandui'></view>
  13. </view>
  14. </view>
  15. <!-- <view class='search acea-row row-between-wrapper'>
  16. <view class='input'><input placeholder='点击搜索会员名称' placeholder-class='placeholder' v-model="keyword"
  17. @confirm="submitForm" confirm-type='search' name="search"></input></view>
  18. <button class='iconfont icon-sousuo2' @click="submitForm"></button>
  19. </view> -->
  20. <view class='list'>
  21. <block v-for="(item,index) in recordList" :key="index">
  22. <view class='item acea-row row-between-wrapper'>
  23. <view class="picTxt acea-row row-between-wrapper">
  24. <view class='pictrue'>
  25. <image :src='item.avatar'></image>
  26. </view>
  27. <view class='text'>
  28. <view class='name line1'>{{item.nickname}}</view>
  29. <view>{{$t(`加入时间`)}}: {{item.division_change_time}}</view>
  30. <view>{{$t(`分佣比例`)}}: {{item.division_percent}}%</view>
  31. </view>
  32. </view>
  33. <view class="right">
  34. <view><text class='num font-color'>{{item.childCount ? item.childCount : 0}}</text>{{$t(`人`)}}</view>
  35. <view><text class="num">{{item.orderCount ? item.orderCount : 0}}</text>{{$t(`单`)}}</view>
  36. <view><text class="num">{{item.numberCount ? item.numberCount : 0}}</text>{{$t(`元`)}}</view>
  37. </view>
  38. </view>
  39. <view class="item-btn">
  40. <view class="change" @click="changeData(item)">{{$t(`修改分佣比例`)}}</view>
  41. <view class="clear" @click="clear(item,index)">{{$t(`删除`)}}</view>
  42. </view>
  43. </block>
  44. </view>
  45. </view>
  46. <!-- #ifdef MP -->
  47. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  48. <!-- #endif -->
  49. <home></home>
  50. <view class="refund-input" :class="refund_close ? 'on' : ''">
  51. <view class="input-msg">
  52. <text class='iconfont icon-guanbi5' @tap='refund_close = false'></text>
  53. <view class="refund-input-title">{{$t(`修改分佣比例`)}}
  54. </view>
  55. <view class="refund-input-sty">
  56. <input type="number" v-model="agent_percent" :placeholder="$t(`请输入百分比`)" />
  57. </view>
  58. <view class="refund-bth">
  59. <!-- <view class="close-refund" @click="refund_close = false">取消</view> -->
  60. <view class="submit-refund" @click="refundSubmit()">{{$t(`提交`)}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="mask invoice-mask" v-if="refund_close" @click="refund_close = false"></view>
  65. <view class="mask invoice-mask" v-if="codeModal" @click="codeModal = false"></view>
  66. <view class="poster-pop" v-if="codeModal">
  67. <image src="/static/images/poster-close.png" class="close" @click="posterImageClose"></image>
  68. <image :src="codeSrc"></image>
  69. <!-- #ifndef H5 -->
  70. <view class="save-poster" @click="savePosterPath">{{$t(`保存到手机`)}}</view>
  71. <!-- #endif -->
  72. <!-- #ifdef H5 -->
  73. <view class="keep">{{$t(`长按图片可以保存到手机`)}}</view>
  74. <!-- #endif -->
  75. </view>
  76. <zb-code ref="qrcode" :show="codeShow" :cid="cid" :val="val" :size="size" :unit="unit" :background="background"
  77. :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconsize" :onval="onval"
  78. :loadMake="loadMake" @result="qrR" />
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. clerkPeople,
  84. setClerkPercent,
  85. delClerkPercent
  86. } from '@/api/user.js';
  87. import {
  88. toLogin
  89. } from '@/libs/login.js';
  90. import {
  91. mapGetters
  92. } from "vuex";
  93. // #ifdef MP
  94. import authorize from '@/components/Authorize';
  95. // #endif
  96. import home from '@/components/home';
  97. import colors from '@/mixins/color.js'
  98. import zbCode from '@/components/zb-code/zb-code.vue'
  99. export default {
  100. components: {
  101. // #ifdef MP
  102. authorize,
  103. // #endif
  104. home,
  105. zbCode
  106. },
  107. mixins: [colors],
  108. data() {
  109. return {
  110. total: 0,
  111. totalLevel: 0,
  112. agent_percent: null,
  113. teamCount: 0,
  114. page: 1,
  115. limit: 20,
  116. keyword: '',
  117. sort: '',
  118. grade: 0,
  119. uid: 0,
  120. status: false,
  121. recordList: [],
  122. refund_close: false,
  123. isAuto: false, //没有授权的不会自动授权
  124. isShowAuth: false, //是否隐藏授权
  125. //二维码参数
  126. codeShow: false,
  127. cid: '1',
  128. ifShow: true,
  129. val: "", // 要生成的二维码值
  130. size: 400, // 二维码大小
  131. unit: 'upx', // 单位
  132. background: '#FFF', // 背景色
  133. foreground: '#000', // 前景色
  134. pdground: '#000', // 角标色
  135. icon: '', // 二维码图标
  136. iconsize: 70, // 二维码图标大小
  137. lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
  138. onval: true, // val值变化时自动重新生成二维码
  139. loadMake: true, // 组件加载完成后自动生成二维码
  140. src: '', // 二维码生成后的图片地址或base64
  141. codeSrc: '',
  142. codeModal: false
  143. };
  144. },
  145. computed: mapGetters(['isLogin']),
  146. onLoad() {
  147. if (this.isLogin) {
  148. this.userSpreadNewList();
  149. } else {
  150. toLogin();
  151. }
  152. },
  153. onShow: function() {
  154. if (this.is_show) this.userSpreadNewList();
  155. // this.getUrlCode()
  156. },
  157. onHide: function() {
  158. this.is_show = true;
  159. },
  160. methods: {
  161. qrR(res) {
  162. this.codeSrc = res
  163. },
  164. showCode() {
  165. this.codeModal = true
  166. },
  167. posterImageClose() {
  168. this.codeModal = false
  169. },
  170. onLoadFun: function(e) {
  171. this.userSpreadNewList();
  172. },
  173. // 授权关闭
  174. authColse: function(e) {
  175. this.isShowAuth = e
  176. },
  177. setSort: function(sort) {
  178. let that = this;
  179. that.sort = sort;
  180. that.page = 1;
  181. that.limit = 20;
  182. that.status = false;
  183. that.$set(that, 'recordList', []);
  184. that.userSpreadNewList();
  185. },
  186. // setKeyword: function(e) {
  187. // this.keyword = e.detail.value;
  188. // },
  189. submitForm: function() {
  190. this.page = 1;
  191. this.limit = 20;
  192. this.status = false;
  193. this.$set(this, 'recordList', []);
  194. this.userSpreadNewList();
  195. },
  196. clear(data, index) {
  197. let that = this;
  198. uni.showModal({
  199. title: that.$t(`删除员工`),
  200. content: that.$t(`确定删除该员工?`),
  201. success: function(res) {
  202. if (res.confirm) {
  203. delClerkPercent(data.uid)
  204. .then(res => {
  205. that.recordList.splice(index, 1);
  206. that.$set(that, 'recordList', that.recordList);
  207. // that.userSpreadNewList();
  208. return that.$util.Tips({
  209. title: that.$t(`删除成功`),
  210. icon: 'success'
  211. });
  212. })
  213. .catch(err => {
  214. return that.$util.Tips({
  215. title: err
  216. });
  217. });
  218. } else if (res.cancel) {
  219. return that.$util.Tips({
  220. title: that.$t(`已取消`)
  221. });
  222. }
  223. }
  224. });
  225. },
  226. changeData(data) {
  227. this.refund_close = true
  228. this.uid = data.uid
  229. },
  230. refundSubmit() {
  231. if (this.agent_percent < 0) {
  232. return this.$util.Tips({
  233. title: this.$t(`请输入比例`)
  234. })
  235. }
  236. setClerkPercent({
  237. agent_percent: this.agent_percent,
  238. uid: this.uid
  239. }).then(res => {
  240. this.$util.Tips({
  241. title: res.msg,
  242. icon: 'success'
  243. }, () => {
  244. this.refund_close = false
  245. this.page = 1;
  246. this.limit = 20;
  247. this.keyword = '';
  248. this.sort = '';
  249. this.status = false;
  250. this.$set(this, 'recordList', []);
  251. this.userSpreadNewList();
  252. });
  253. }).catch(err => {
  254. this.$util.Tips({
  255. title: err,
  256. })
  257. })
  258. },
  259. setType: function(grade) {
  260. if (this.grade != grade) {
  261. this.grade = grade;
  262. this.page = 1;
  263. this.limit = 20;
  264. this.keyword = '';
  265. this.sort = '';
  266. this.status = false;
  267. this.$set(this, 'recordList', []);
  268. this.userSpreadNewList();
  269. }
  270. },
  271. userSpreadNewList: function() {
  272. let that = this;
  273. let page = that.page;
  274. let limit = that.limit;
  275. let status = that.status;
  276. let keyword = that.keyword;
  277. let sort = that.sort;
  278. let grade = that.grade;
  279. let recordList = that.recordList;
  280. let recordListNew = [];
  281. if (status == true) return;
  282. clerkPeople({
  283. page: page,
  284. limit: limit,
  285. keyword: keyword,
  286. grade: grade,
  287. sort: sort,
  288. }).then(res => {
  289. let len = res.data.list.length;
  290. let recordListData = res.data.list;
  291. recordListNew = recordList.concat(recordListData);
  292. that.total = res.data.total;
  293. that.totalLevel = res.data.totalLevel;
  294. that.teamCount = res.data.count;
  295. that.codeSrc = res.data.codeUrl;
  296. that.status = limit > len;
  297. that.page = page + 1;
  298. that.$set(that, 'recordList', recordListNew);
  299. });
  300. }
  301. },
  302. onReachBottom: function() {
  303. this.userSpreadNewList();
  304. }
  305. }
  306. </script>
  307. <style scoped lang="scss">
  308. .invoice-mask {
  309. background-color: #ccc;
  310. opacity: 0.7;
  311. }
  312. .promoter-list .nav {
  313. background-color: #fff;
  314. height: 86rpx;
  315. line-height: 86rpx;
  316. font-size: 28rpx;
  317. color: #282828;
  318. border-bottom: 1rpx solid #eee;
  319. }
  320. .promoter-list .nav .item.on {
  321. border-bottom: 5rpx solid #e93323;
  322. color: #e93323;
  323. }
  324. .promoter-list .search {
  325. width: 100%;
  326. background-color: #fff;
  327. height: 86rpx;
  328. padding-left: 30rpx;
  329. box-sizing: border-box;
  330. }
  331. .promoter-list .search .input {
  332. width: 610rpx;
  333. height: 60rpx;
  334. border-radius: 50rpx;
  335. background-color: #f5f5f5;
  336. text-align: center;
  337. position: relative;
  338. }
  339. .promoter-list .name {
  340. display: flex;
  341. .invitation {
  342. background-color: #fff;
  343. border-radius: 6rpx;
  344. padding: 0rpx 10rpx;
  345. margin-left: 20rpx;
  346. color: #d13d25;
  347. }
  348. }
  349. .promoter-list .search .input input {
  350. height: 100%;
  351. font-size: 26rpx;
  352. width: 610rpx;
  353. text-align: center;
  354. }
  355. .promoter-list .search .input .placeholder {
  356. color: #bbb;
  357. }
  358. .promoter-list .search .input .iconfont {
  359. position: absolute;
  360. right: 28rpx;
  361. color: #999;
  362. font-size: 28rpx;
  363. top: 50%;
  364. transform: translateY(-50%);
  365. }
  366. .promoter-list .search .iconfont {
  367. font-size: 45rpx;
  368. color: #515151;
  369. width: 110rpx;
  370. height: 60rpx;
  371. line-height: 60rpx;
  372. }
  373. .promoter-list .list {
  374. margin-top: 12rpx;
  375. }
  376. .promoter-list .list .sortNav {
  377. background-color: #fff;
  378. height: 76rpx;
  379. border-bottom: 1rpx solid #eee;
  380. color: #333;
  381. font-size: 28rpx;
  382. }
  383. .promoter-list .list .sortNav .sortItem {
  384. text-align: center;
  385. flex: 1;
  386. }
  387. .promoter-list .list .sortNav .sortItem image {
  388. width: 24rpx;
  389. height: 24rpx;
  390. margin-left: 6rpx;
  391. vertical-align: -3rpx;
  392. }
  393. .promoter-list .list .item {
  394. background-color: #fff;
  395. border-bottom: 1rpx solid #eee;
  396. height: 152rpx;
  397. padding: 0 30rpx 0 20rpx;
  398. font-size: 24rpx;
  399. color: #666;
  400. }
  401. .item-btn {
  402. display: flex;
  403. align-items: center;
  404. justify-content: flex-end;
  405. background-color: #fff;
  406. }
  407. .clear,
  408. .change {
  409. padding: 5rpx 15rpx;
  410. margin: 10rpx;
  411. border-radius: 6rpx;
  412. }
  413. .clear {
  414. background-color: #ccc;
  415. color: #fff;
  416. }
  417. .change {
  418. background-color: #de4d36;
  419. color: #fff;
  420. }
  421. .promoter-list .list .item .picTxt {
  422. width: 440rpx;
  423. }
  424. .promoter-list .list .item .picTxt .pictrue {
  425. width: 106rpx;
  426. height: 106rpx;
  427. border-radius: 50%;
  428. }
  429. .promoter-list .list .item .picTxt .pictrue image {
  430. width: 100%;
  431. height: 100%;
  432. border-radius: 50%;
  433. border: 3rpx solid #fff;
  434. box-shadow: 0 0 10rpx #aaa;
  435. box-sizing: border-box;
  436. }
  437. .promoter-list .list .item .picTxt .text {
  438. width: 304rpx;
  439. font-size: 24rpx;
  440. color: #666;
  441. }
  442. .promoter-list .list .item .picTxt .text .name {
  443. font-size: 28rpx;
  444. color: #333;
  445. margin-bottom: 13rpx;
  446. }
  447. .promoter-list .list .item .right {
  448. width: 240rpx;
  449. text-align: right;
  450. font-size: 22rpx;
  451. color: #333;
  452. }
  453. .promoter-list .list .item .right .num {
  454. margin-right: 7rpx;
  455. }
  456. .refund-input {
  457. position: fixed;
  458. bottom: 0;
  459. left: 0;
  460. width: 100%;
  461. border-radius: 16rpx 16rpx 0 0;
  462. background-color: #fff;
  463. z-index: 99;
  464. padding: 40rpx 0 70rpx 0;
  465. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  466. transform: translate3d(0, 100%, 0);
  467. .refund-input-title {
  468. font-size: 32rpx;
  469. margin-bottom: 60rpx;
  470. color: #282828;
  471. }
  472. .refund-input-sty {
  473. border: 1px solid #ddd;
  474. padding: 20rpx 20rpx;
  475. border-radius: 40rpx;
  476. width: 100%;
  477. margin: 20rpx 65rpx;
  478. }
  479. .input-msg {
  480. display: flex;
  481. flex-direction: column;
  482. justify-content: center;
  483. align-items: center;
  484. position: relative;
  485. margin: 0 65rpx;
  486. .iconfont {
  487. position: absolute;
  488. font-size: 32rpx;
  489. color: #282828;
  490. top: 8rpx;
  491. right: -30rpx;
  492. }
  493. }
  494. .refund-bth {
  495. display: flex;
  496. margin: 0 65rpx;
  497. margin-top: 20rpx;
  498. justify-content: space-around;
  499. width: 100%;
  500. .close-refund {
  501. padding: 24rpx 80rpx;
  502. border-radius: 80rpx;
  503. color: #fff;
  504. background-color: #ccc;
  505. }
  506. .submit-refund {
  507. width: 100%;
  508. padding: 24rpx 0rpx;
  509. text-align: center;
  510. border-radius: 80rpx;
  511. color: #fff;
  512. background-color: #F62C2C;
  513. }
  514. }
  515. }
  516. .refund-input.on {
  517. transform: translate3d(0, 0, 0);
  518. }
  519. .poster-pop {
  520. width: 450rpx;
  521. height: 450rpx;
  522. position: fixed;
  523. padding: 10rpx;
  524. background-color: #fff;
  525. left: 50%;
  526. transform: translateX(-50%);
  527. z-index: 399;
  528. top: 50%;
  529. margin-top: -357rpx;
  530. }
  531. .poster-pop image {
  532. width: 100%;
  533. height: 100%;
  534. display: block;
  535. }
  536. .poster-pop .close {
  537. width: 46rpx;
  538. height: 75rpx;
  539. position: fixed;
  540. right: 0;
  541. top: -73rpx;
  542. display: block;
  543. }
  544. .poster-pop .save-poster {
  545. background-color: #df2d0a;
  546. font-size: :22rpx;
  547. color: #fff;
  548. text-align: center;
  549. height: 76rpx;
  550. line-height: 76rpx;
  551. width: 100%;
  552. }
  553. .poster-pop .keep {
  554. color: #fff;
  555. text-align: center;
  556. font-size: 25rpx;
  557. margin-top: 30rpx;
  558. }
  559. </style>