| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <template>
- <view class="manager">
- <view class="flex-row justify-center">
- <view class="grid">
- <view class="flex-col gridItem" @click="navigateToPage('/pages/specialistsList/specialistsList')">
- <view class="title flex-row justify-center">
- <text>累计专员数量</text>
- </view>
- <view class="number flex-row justify-center">
- <text>{{homeStaticsData.expandUserTotal || 0}}</text>
- </view>
- </view>
- <view class="flex-col gridItem leftBorder" @click="navigateToPage('/pages/todaySpecialistsList/todaySpecialistsList')">
- <view class="title flex-row justify-center">
- <text>今日新增专员</text>
- </view>
- <view class="number flex-row justify-center">
- <text>{{homeStaticsData.expandUserTotalToday || 0}}</text>
- </view>
- </view>
- <view class="flex-col gridItem leftBorder">
- <view class="title flex-row justify-center">
- <text>本月任务</text>
- </view>
- <view class="number flex-row justify-center">
- <text>{{homeStaticsData.finishTask || 0}}/{{homeStaticsData.totalTask || 0}}</text>
- </view>
- </view>
- <view class="flex-col gridItem">
- <view class="title flex-row justify-center">
- <text>累计异业伙伴</text>
- </view>
- <view class="number flex-row justify-center">
- <text>{{homeStaticsData.totalDiffBuddy || 0}}</text>
- </view>
- </view>
- <view class="flex-col gridItem leftBorder">
- <view class="title flex-row justify-center">
- <text>累计卖券金额</text>
- </view>
- <view class="number flex-row justify-center">
- <text>{{homeStaticsData.totalSaleCoupon || 0}}</text>
- </view>
- </view>
- </view>
- </view>
- <view class="flex-row justify-center" v-if="showQrCode">
- <view class="qrView" @click="qrCodePopup">
- <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
- </view>
- </view>
- <view class="flex-row ">
- <view class="flex-col justify-center">
- <text class="roleSelectLabel">选择角色:</text>
- </view>
- <view class="roleSelect">
- <uni-data-select style="width:492rpx;background: #FFFFFF" placement="top" v-model="value" :localdata="roleList" @change="selectChange" :clear="false"></uni-data-select>
- </view>
- </view>
- <uni-popup ref="createQrCodePopup" type="center">
- <view class="createQrCodePopup flex-col justify-center">
- <view class="flex-row justify-center">
- <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
- </view>
- <view class="xoIcon" @click="closePopup">
- <u-icon name="close-circle" color="#666" size="35"></u-icon>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import commonUtils from "../../../common/js/utils/commonUtils";
- export default {
- props: {
- height: {
- type: String,
- default () {
- return ''
- }
- },
- },
- data() {
- return {
- qrcodeUrl: this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2',
- options: {
- // 指定二维码前景,一般可在中间放logo
- foregroundImagePadding:2,
- foregroundImageBorderRadius:5,
- foregroundImageSrc: '/static/logo.png'
- },
- homeStaticsData:{},
- value:0,
- roleList:[],
- roleBindRuleList:[],
- showQrCode:true
- }
- },
- created() {
- console.log('接收到的高度', this.height)
- this.userInfo = uni.getStorageSync('spreadUserInfo')
- this.homeStatics()
- this.getRoleList()
- },
- methods: {
- selectChange(e){
- console.log(e)
- this.getRuleByRoleId(this.roleList[this.value].id)
- },
- formatDate() {
- this.qrCreateTime = commonUtils.formatDate(new Date())
- },
- qrCodePopup(){
- this.$refs.createQrCodePopup.open()
- },
- closePopup(){
- this.$refs.createQrCodePopup.close()
- },
- navigateToPage(url){
- uni.navigateTo({
- url:url
- })
- },
- getRoleList(){
- this.$api.service.getRoleList().then(res=>{
- console.log('获取角色列表',res)
- this.roleList = res.data.data
- for (let i = 0;i<this.roleList.length;i++){
- this.roleList[i].value = i;
- this.roleList[i].text = this.roleList[i].name
- }
- this.getRuleByRoleId(this.roleList[this.value].id)
- })
- },
- //查询角色已经绑定的规则
- getRuleByRoleId(roleId) {
- this.$api.service.getRuleByRoleId({
- roleId: roleId
- }).then(res => {
- console.log("1111111111111111111111")
- this.roleBindRuleList = res.data.data
- this.createQrCode()
- })
- },
- homeStatics(){
- this.$api.service.homeStatics({
- type:2
- }).then(res=>{
- console.log('获取首页拓客数据',res)
- this.homeStaticsData = res.data.data
- })
- },
- createQrCode() {
- if (!this.roleBindRuleList || this.roleBindRuleList.length === 0) {
- this.showQrCode = false
- uni.showToast({
- icon: 'error',
- duration: 3000,
- title: '当前角色没有添加规则!'
- });
- return
- }
- this.showQrCode = true
- let data = {
- roleId: this.roleList[this.value].id,
- parentId: this.userInfo.id,
- timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
- };
- this.qrcodeUrl = this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2',
- console.log('获取到的角色ID',data.roleId)
- for (let key in data) {
- let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
- this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
- }
- console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import './index.rpx.css';
- </style>
|