manager.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="manager">
  3. <view class="flex-row justify-center">
  4. <view class="grid">
  5. <view class="flex-col gridItem" @click="navigateToPage('/pages/specialistsList/specialistsList')">
  6. <view class="title flex-row justify-center">
  7. <text>累计专员数量</text>
  8. </view>
  9. <view class="number flex-row justify-center">
  10. <text>{{homeStaticsData.expandUserTotal || 0}}</text>
  11. </view>
  12. </view>
  13. <view class="flex-col gridItem leftBorder" @click="navigateToPage('/pages/todaySpecialistsList/todaySpecialistsList')">
  14. <view class="title flex-row justify-center">
  15. <text>今日新增专员</text>
  16. </view>
  17. <view class="number flex-row justify-center">
  18. <text>{{homeStaticsData.expandUserTotalToday || 0}}</text>
  19. </view>
  20. </view>
  21. <view class="flex-col gridItem leftBorder">
  22. <view class="title flex-row justify-center">
  23. <text>本月任务</text>
  24. </view>
  25. <view class="number flex-row justify-center">
  26. <text>{{homeStaticsData.finishTask || 0}}/{{homeStaticsData.totalTask || 0}}</text>
  27. </view>
  28. </view>
  29. <view class="flex-col gridItem">
  30. <view class="title flex-row justify-center">
  31. <text>累计异业伙伴</text>
  32. </view>
  33. <view class="number flex-row justify-center">
  34. <text>{{homeStaticsData.totalDiffBuddy || 0}}</text>
  35. </view>
  36. </view>
  37. <view class="flex-col gridItem leftBorder">
  38. <view class="title flex-row justify-center">
  39. <text>累计卖券金额</text>
  40. </view>
  41. <view class="number flex-row justify-center">
  42. <text>{{homeStaticsData.totalSaleCoupon || 0}}</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="flex-row">
  48. <view class="flex-col justify-center">
  49. <text class="roleSelectLabel">选择角色:</text>
  50. </view>
  51. <view class="roleSelect">
  52. <uni-data-select v-model="value" :localdata="roleList" @change="selectChange" :clear="false"></uni-data-select>
  53. </view>
  54. </view>
  55. <view class="flex-row justify-center" v-if="showQrCode">
  56. <view class="qrView" @click="qrCodePopup">
  57. <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  58. </view>
  59. </view>
  60. <uni-popup ref="createQrCodePopup" type="center">
  61. <view class="createQrCodePopup flex-col justify-center">
  62. <view class="flex-row justify-center">
  63. <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  64. </view>
  65. <view class="xoIcon" @click="closePopup">
  66. <u-icon name="close-circle" color="#666" size="35"></u-icon>
  67. </view>
  68. </view>
  69. </uni-popup>
  70. </view>
  71. </template>
  72. <script>
  73. import commonUtils from "../../../common/js/utils/commonUtils";
  74. export default {
  75. props: {
  76. height: {
  77. type: String,
  78. default () {
  79. return ''
  80. }
  81. },
  82. },
  83. data() {
  84. return {
  85. qrcodeUrl: this.$tkUrl + '?roleId={roleId}&parentId={parentId}&timestamp={timestamp}&type=2&expand1=2',
  86. options: {
  87. // 指定二维码前景,一般可在中间放logo
  88. foregroundImagePadding:2,
  89. foregroundImageBorderRadius:5,
  90. foregroundImageSrc: '/static/logo.png'
  91. },
  92. homeStaticsData:{},
  93. value:0,
  94. roleList:[],
  95. roleBindRuleList:[],
  96. showQrCode:true
  97. }
  98. },
  99. created() {
  100. console.log('接收到的高度', this.height)
  101. this.userInfo = uni.getStorageSync('spreadUserInfo')
  102. this.homeStatics()
  103. this.getRoleList()
  104. },
  105. methods: {
  106. selectChange(e){
  107. console.log(e)
  108. this.getRuleByRoleId(this.roleList[this.value].id)
  109. },
  110. formatDate() {
  111. this.qrCreateTime = commonUtils.formatDate(new Date())
  112. },
  113. qrCodePopup(){
  114. this.$refs.createQrCodePopup.open()
  115. },
  116. closePopup(){
  117. this.$refs.createQrCodePopup.close()
  118. },
  119. navigateToPage(url){
  120. uni.navigateTo({
  121. url:url
  122. })
  123. },
  124. getRoleList(){
  125. this.$api.service.getRoleList().then(res=>{
  126. console.log('获取角色列表',res)
  127. this.roleList = res.data.data
  128. for (let i = 0;i<this.roleList.length;i++){
  129. this.roleList[i].value = i;
  130. this.roleList[i].text = this.roleList[i].name
  131. }
  132. this.getRuleByRoleId(this.roleList[this.value].id)
  133. })
  134. },
  135. //查询角色已经绑定的规则
  136. getRuleByRoleId(roleId) {
  137. this.$api.service.getRuleByRoleId({
  138. roleId: roleId
  139. }).then(res => {
  140. console.log("1111111111111111111111")
  141. this.roleBindRuleList = res.data.data
  142. this.createQrCode()
  143. })
  144. },
  145. homeStatics(){
  146. this.$api.service.homeStatics({
  147. type:2
  148. }).then(res=>{
  149. console.log('获取首页拓客数据',res)
  150. this.homeStaticsData = res.data.data
  151. })
  152. },
  153. createQrCode() {
  154. if (!this.roleBindRuleList || this.roleBindRuleList.length === 0) {
  155. this.showQrCode = false
  156. uni.showToast({
  157. icon: 'error',
  158. duration: 3000,
  159. title: '当前角色没有添加规则!'
  160. });
  161. return
  162. }
  163. this.showQrCode = true
  164. let data = {
  165. roleId: this.roleList[this.value].id,
  166. parentId: this.userInfo.id,
  167. timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
  168. };
  169. this.qrcodeUrl = this.$tkUrl + '?roleId={roleId}&parentId={parentId}&timestamp={timestamp}&type=2&expand1=2',
  170. console.log('获取到的角色ID',data.roleId)
  171. for (let key in data) {
  172. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  173. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  174. }
  175. console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
  176. },
  177. }
  178. }
  179. </script>
  180. <style scoped lang="scss">
  181. @import './index.rpx.css';
  182. </style>