index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  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. console.log(res)
  164. },
  165. showCode() {
  166. this.codeModal = true
  167. },
  168. posterImageClose() {
  169. this.codeModal = false
  170. },
  171. onLoadFun: function(e) {
  172. this.userSpreadNewList();
  173. },
  174. // 授权关闭
  175. authColse: function(e) {
  176. this.isShowAuth = e
  177. },
  178. setSort: function(sort) {
  179. let that = this;
  180. that.sort = sort;
  181. that.page = 1;
  182. that.limit = 20;
  183. that.status = false;
  184. that.$set(that, 'recordList', []);
  185. that.userSpreadNewList();
  186. },
  187. // setKeyword: function(e) {
  188. // this.keyword = e.detail.value;
  189. // },
  190. submitForm: function() {
  191. this.page = 1;
  192. this.limit = 20;
  193. this.status = false;
  194. this.$set(this, 'recordList', []);
  195. this.userSpreadNewList();
  196. },
  197. clear(data, index) {
  198. let that = this;
  199. uni.showModal({
  200. title: that.$t(`删除员工`),
  201. content: that.$t(`确定删除该员工?`),
  202. success: function(res) {
  203. if (res.confirm) {
  204. delClerkPercent(data.uid)
  205. .then(res => {
  206. that.recordList.splice(index, 1);
  207. that.$set(that, 'recordList', that.recordList);
  208. // that.userSpreadNewList();
  209. return that.$util.Tips({
  210. title: that.$t(`删除成功`),
  211. icon: 'success'
  212. });
  213. })
  214. .catch(err => {
  215. return that.$util.Tips({
  216. title: err
  217. });
  218. });
  219. } else if (res.cancel) {
  220. return that.$util.Tips({
  221. title: that.$t(`已取消`)
  222. });
  223. }
  224. }
  225. });
  226. },
  227. changeData(data) {
  228. this.refund_close = true
  229. this.uid = data.uid
  230. },
  231. refundSubmit() {
  232. if (this.agent_percent < 0) {
  233. return this.$util.Tips({
  234. title: this.$t(`请输入比例`)
  235. })
  236. }
  237. setClerkPercent({
  238. agent_percent: this.agent_percent,
  239. uid: this.uid
  240. }).then(res => {
  241. this.$util.Tips({
  242. title: res.msg,
  243. icon: 'success'
  244. }, () => {
  245. this.refund_close = false
  246. this.page = 1;
  247. this.limit = 20;
  248. this.keyword = '';
  249. this.sort = '';
  250. this.status = false;
  251. this.$set(this, 'recordList', []);
  252. this.userSpreadNewList();
  253. });
  254. }).catch(err => {
  255. this.$util.Tips({
  256. title: err,
  257. })
  258. })
  259. },
  260. setType: function(grade) {
  261. if (this.grade != grade) {
  262. this.grade = grade;
  263. this.page = 1;
  264. this.limit = 20;
  265. this.keyword = '';
  266. this.sort = '';
  267. this.status = false;
  268. this.$set(this, 'recordList', []);
  269. this.userSpreadNewList();
  270. }
  271. },
  272. userSpreadNewList: function() {
  273. let that = this;
  274. let page = that.page;
  275. let limit = that.limit;
  276. let status = that.status;
  277. let keyword = that.keyword;
  278. let sort = that.sort;
  279. let grade = that.grade;
  280. let recordList = that.recordList;
  281. let recordListNew = [];
  282. if (status == true) return;
  283. clerkPeople({
  284. page: page,
  285. limit: limit,
  286. keyword: keyword,
  287. grade: grade,
  288. sort: sort,
  289. }).then(res => {
  290. let len = res.data.list.length;
  291. let recordListData = res.data.list;
  292. recordListNew = recordList.concat(recordListData);
  293. that.total = res.data.total;
  294. that.totalLevel = res.data.totalLevel;
  295. that.teamCount = res.data.count;
  296. that.codeSrc = res.data.codeUrl;
  297. that.status = limit > len;
  298. that.page = page + 1;
  299. that.$set(that, 'recordList', recordListNew);
  300. });
  301. }
  302. },
  303. onReachBottom: function() {
  304. this.userSpreadNewList();
  305. }
  306. }
  307. </script>
  308. <style scoped lang="scss">
  309. .invoice-mask {
  310. background-color: #ccc;
  311. opacity: 0.7;
  312. }
  313. .promoter-list .nav {
  314. background-color: #fff;
  315. height: 86rpx;
  316. line-height: 86rpx;
  317. font-size: 28rpx;
  318. color: #282828;
  319. border-bottom: 1rpx solid #eee;
  320. }
  321. .promoter-list .nav .item.on {
  322. border-bottom: 5rpx solid #e93323;
  323. color: #e93323;
  324. }
  325. .promoter-list .search {
  326. width: 100%;
  327. background-color: #fff;
  328. height: 86rpx;
  329. padding-left: 30rpx;
  330. box-sizing: border-box;
  331. }
  332. .promoter-list .search .input {
  333. width: 610rpx;
  334. height: 60rpx;
  335. border-radius: 50rpx;
  336. background-color: #f5f5f5;
  337. text-align: center;
  338. position: relative;
  339. }
  340. .promoter-list .name {
  341. display: flex;
  342. .invitation {
  343. background-color: #fff;
  344. border-radius: 6rpx;
  345. padding: 0rpx 10rpx;
  346. margin-left: 20rpx;
  347. color: #d13d25;
  348. }
  349. }
  350. .promoter-list .search .input input {
  351. height: 100%;
  352. font-size: 26rpx;
  353. width: 610rpx;
  354. text-align: center;
  355. }
  356. .promoter-list .search .input .placeholder {
  357. color: #bbb;
  358. }
  359. .promoter-list .search .input .iconfont {
  360. position: absolute;
  361. right: 28rpx;
  362. color: #999;
  363. font-size: 28rpx;
  364. top: 50%;
  365. transform: translateY(-50%);
  366. }
  367. .promoter-list .search .iconfont {
  368. font-size: 45rpx;
  369. color: #515151;
  370. width: 110rpx;
  371. height: 60rpx;
  372. line-height: 60rpx;
  373. }
  374. .promoter-list .list {
  375. margin-top: 12rpx;
  376. }
  377. .promoter-list .list .sortNav {
  378. background-color: #fff;
  379. height: 76rpx;
  380. border-bottom: 1rpx solid #eee;
  381. color: #333;
  382. font-size: 28rpx;
  383. }
  384. .promoter-list .list .sortNav .sortItem {
  385. text-align: center;
  386. flex: 1;
  387. }
  388. .promoter-list .list .sortNav .sortItem image {
  389. width: 24rpx;
  390. height: 24rpx;
  391. margin-left: 6rpx;
  392. vertical-align: -3rpx;
  393. }
  394. .promoter-list .list .item {
  395. background-color: #fff;
  396. border-bottom: 1rpx solid #eee;
  397. height: 152rpx;
  398. padding: 0 30rpx 0 20rpx;
  399. font-size: 24rpx;
  400. color: #666;
  401. }
  402. .item-btn {
  403. display: flex;
  404. align-items: center;
  405. justify-content: flex-end;
  406. background-color: #fff;
  407. }
  408. .clear,
  409. .change {
  410. padding: 5rpx 15rpx;
  411. margin: 10rpx;
  412. border-radius: 6rpx;
  413. }
  414. .clear {
  415. background-color: #ccc;
  416. color: #fff;
  417. }
  418. .change {
  419. background-color: #de4d36;
  420. color: #fff;
  421. }
  422. .promoter-list .list .item .picTxt {
  423. width: 440rpx;
  424. }
  425. .promoter-list .list .item .picTxt .pictrue {
  426. width: 106rpx;
  427. height: 106rpx;
  428. border-radius: 50%;
  429. }
  430. .promoter-list .list .item .picTxt .pictrue image {
  431. width: 100%;
  432. height: 100%;
  433. border-radius: 50%;
  434. border: 3rpx solid #fff;
  435. box-shadow: 0 0 10rpx #aaa;
  436. box-sizing: border-box;
  437. }
  438. .promoter-list .list .item .picTxt .text {
  439. width: 304rpx;
  440. font-size: 24rpx;
  441. color: #666;
  442. }
  443. .promoter-list .list .item .picTxt .text .name {
  444. font-size: 28rpx;
  445. color: #333;
  446. margin-bottom: 13rpx;
  447. }
  448. .promoter-list .list .item .right {
  449. width: 240rpx;
  450. text-align: right;
  451. font-size: 22rpx;
  452. color: #333;
  453. }
  454. .promoter-list .list .item .right .num {
  455. margin-right: 7rpx;
  456. }
  457. .refund-input {
  458. position: fixed;
  459. bottom: 0;
  460. left: 0;
  461. width: 100%;
  462. border-radius: 16rpx 16rpx 0 0;
  463. background-color: #fff;
  464. z-index: 99;
  465. padding: 40rpx 0 70rpx 0;
  466. transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  467. transform: translate3d(0, 100%, 0);
  468. .refund-input-title {
  469. font-size: 32rpx;
  470. margin-bottom: 60rpx;
  471. color: #282828;
  472. }
  473. .refund-input-sty {
  474. border: 1px solid #ddd;
  475. padding: 20rpx 20rpx;
  476. border-radius: 40rpx;
  477. width: 100%;
  478. margin: 20rpx 65rpx;
  479. }
  480. .input-msg {
  481. display: flex;
  482. flex-direction: column;
  483. justify-content: center;
  484. align-items: center;
  485. position: relative;
  486. margin: 0 65rpx;
  487. .iconfont {
  488. position: absolute;
  489. font-size: 32rpx;
  490. color: #282828;
  491. top: 8rpx;
  492. right: -30rpx;
  493. }
  494. }
  495. .refund-bth {
  496. display: flex;
  497. margin: 0 65rpx;
  498. margin-top: 20rpx;
  499. justify-content: space-around;
  500. width: 100%;
  501. .close-refund {
  502. padding: 24rpx 80rpx;
  503. border-radius: 80rpx;
  504. color: #fff;
  505. background-color: #ccc;
  506. }
  507. .submit-refund {
  508. width: 100%;
  509. padding: 24rpx 0rpx;
  510. text-align: center;
  511. border-radius: 80rpx;
  512. color: #fff;
  513. background-color: #F62C2C;
  514. }
  515. }
  516. }
  517. .refund-input.on {
  518. transform: translate3d(0, 0, 0);
  519. }
  520. .poster-pop {
  521. width: 450rpx;
  522. height: 450rpx;
  523. position: fixed;
  524. padding: 10rpx;
  525. background-color: #fff;
  526. left: 50%;
  527. transform: translateX(-50%);
  528. z-index: 399;
  529. top: 50%;
  530. margin-top: -357rpx;
  531. }
  532. .poster-pop image {
  533. width: 100%;
  534. height: 100%;
  535. display: block;
  536. }
  537. .poster-pop .close {
  538. width: 46rpx;
  539. height: 75rpx;
  540. position: fixed;
  541. right: 0;
  542. top: -73rpx;
  543. display: block;
  544. }
  545. .poster-pop .save-poster {
  546. background-color: #df2d0a;
  547. font-size: :22rpx;
  548. color: #fff;
  549. text-align: center;
  550. height: 76rpx;
  551. line-height: 76rpx;
  552. width: 100%;
  553. }
  554. .poster-pop .keep {
  555. color: #fff;
  556. text-align: center;
  557. font-size: 25rpx;
  558. margin-top: 30rpx;
  559. }
  560. </style>