|
@@ -1,167 +1,64 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view class="page">
|
|
|
|
|
- <view class="flex-row justify-between outView" :style="{marginTop:'24rpx'}" v-if="roleList.length>0"
|
|
|
|
|
- @click="selectRole">
|
|
|
|
|
- <view class="roleName">
|
|
|
|
|
- <text>角色</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row">
|
|
|
|
|
- <text class="roleName">{{roleList[confirmRoleIndex].name}}</text>
|
|
|
|
|
- <u-icon name="arrow-right" color="#666" size="18"></u-icon>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view class="dataNullView flex-col" v-if="roleBindRuleList.length===0">
|
|
|
|
|
- <view class="flex-row justify-center">
|
|
|
|
|
- <image class="dataNullImage" src="/static/zhanwu.png"></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- <text v-if="roleList[confirmRoleIndex]" class="roleName1">{{roleList[confirmRoleIndex].name}}<text
|
|
|
|
|
- class="roleHint">角色没有拓客规则,点击下方“添加规则”按钮可添加拓客规则</text></text>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <view class="manager">
|
|
|
|
|
|
|
|
- <view v-else class="scroll-Y">
|
|
|
|
|
- <view class="flex-col outView" v-for="(item,index) in roleBindRuleList" :key="index">
|
|
|
|
|
- <view class="flex-row justify-between">
|
|
|
|
|
- <text class="title">{{item.title}}</text>
|
|
|
|
|
- <u-icon name="trash" color="#666" size="24" @click="deleteRule(item)"></u-icon>
|
|
|
|
|
|
|
+ <view class="flex-row justify-center">
|
|
|
|
|
+ <view class="grid">
|
|
|
|
|
+ <view class="flex-col gridItem">
|
|
|
|
|
+ <view class="title flex-row justify-center">
|
|
|
|
|
+ <text>累计专员数量</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="number flex-row justify-center">
|
|
|
|
|
+ <text>2008</text>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>直推:</text>
|
|
|
|
|
- <view>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">注册现金:{{item.awardAmount}}元</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">消费现金:{{item.consumeAmount}}元</text>
|
|
|
|
|
- <text class="awardItem">消费比例:{{item.consumeRatio * 100}}%</text>
|
|
|
|
|
- </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>2008</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>间推:</text>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">间推现金:{{item.indirectAmount}}元</text>
|
|
|
|
|
- <text class="awardItem">间推比例:{{item.indirectRatio * 100}}%</text>
|
|
|
|
|
|
|
+ <view class="flex-col gridItem leftBorder">
|
|
|
|
|
+ <view class="title flex-row justify-center">
|
|
|
|
|
+ <text>本月任务</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="number flex-row justify-center">
|
|
|
|
|
+ <text>20/800</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>优惠券:</text>
|
|
|
|
|
- <view class="flex-col">
|
|
|
|
|
- <view class="flex-col discount award" v-for="(item1,index1) in item.strategyList" :key="index1">
|
|
|
|
|
- <text>{{item1.name}} * {{item1.degree}}张</text>
|
|
|
|
|
- <text>有效期:{{item1.startTime.substring(0,10)}} 至 {{item1.endTime.substring(0,10)}}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <view class="flex-col gridItem">
|
|
|
|
|
+ <view class="title flex-row justify-center">
|
|
|
|
|
+ <text>累计异业伙伴</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="number flex-row justify-center">
|
|
|
|
|
+ <text>2008</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>2008</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <view class="addButton" @click="addRule">
|
|
|
|
|
- <text>+添加规则</text>
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view class="confirmButton" @click="createQrCode">
|
|
|
|
|
- <text>生成二维码</text>
|
|
|
|
|
|
|
+ <view class="flex-row justify-center">
|
|
|
|
|
+ <view class="qrView" @click="qrCodePopup">
|
|
|
|
|
+ <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <!--邀请好友福利码-->
|
|
|
|
|
- <uni-popup ref="createQrCodePopup" type="center" @change="createQrCodePopupChange">
|
|
|
|
|
- <view class="createQrCodePopup">
|
|
|
|
|
|
|
+ <uni-popup ref="createQrCodePopup" type="center">
|
|
|
|
|
+ <view class="createQrCodePopup flex-col justify-center">
|
|
|
<view class="flex-row justify-center">
|
|
<view class="flex-row justify-center">
|
|
|
- <text class="popupTitle">邀请好友福利码</text>
|
|
|
|
|
|
|
+ <uv-qrcode ref="qrcode" size="600rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="xoIcon" @click="closePopup">
|
|
<view class="xoIcon" @click="closePopup">
|
|
|
- <u-icon name="close-circle" color="#666" size="24"></u-icon>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row justify-center">
|
|
|
|
|
- <uv-qrcode ref="qrcode" size="540rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row justify-center qrCreateTime">
|
|
|
|
|
- <text>生成时间:{{qrCreateTime}}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </uni-popup>
|
|
|
|
|
- <!--选择规则-->
|
|
|
|
|
- <uni-popup ref="rulePopup" type="bottom" @change="popupChange">
|
|
|
|
|
- <view class="rulePopup">
|
|
|
|
|
- <view class="flex-row justify-between">
|
|
|
|
|
- <text class="popupTitle">选择规则</text>
|
|
|
|
|
- <u-icon name="close-circle" color="#666" size="24" @click="closePopup"></u-icon>
|
|
|
|
|
- </view>
|
|
|
|
|
- <scroll-view scroll-y class="scroll-Y1">
|
|
|
|
|
- <view class="dataNullView flex-col" v-if="roleNoBindRuleList.length===0">
|
|
|
|
|
- <view class="flex-row justify-center">
|
|
|
|
|
- <image class="dataNullImage" src="/static/dataNull.png"></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- <text class="roleHint">暂无可添加的拓客规则</text>
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- <view v-else>
|
|
|
|
|
- <view class="flex-col outView " :class="{selectRoleName1: item.select }"
|
|
|
|
|
- v-for="(item,index) in roleNoBindRuleList" :style="{marginTop: '24rpx'}"
|
|
|
|
|
- @click="selectRule(item,index)" :key="index">
|
|
|
|
|
- <view class="flex-row justify-between">
|
|
|
|
|
- <text class="title">{{item.title}}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>直推:</text>
|
|
|
|
|
- <view>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">注册现金:{{item.awardAmount}}元</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">消费现金:{{item.consumeAmount}}元</text>
|
|
|
|
|
- <text class="awardItem">消费比例:{{item.consumeRatio * 100}}%</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>间推:</text>
|
|
|
|
|
- <view class="flex-row award justify-between">
|
|
|
|
|
- <text class="awardItem">间推现金:{{item.indirectAmount}}元</text>
|
|
|
|
|
- <text class="awardItem">间推比例:{{item.indirectRatio * 100}}%</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
|
|
- <text>优惠券:</text>
|
|
|
|
|
- <view class="flex-col">
|
|
|
|
|
- <view class="flex-col discount award" v-for="(item1,index1) in item.strategyList"
|
|
|
|
|
- :key="index1">
|
|
|
|
|
- <text>{{item1.name}} * {{item1.degree}}张</text>
|
|
|
|
|
- <text>有效期:{{item1.startTime.substring(0,10)}} 至
|
|
|
|
|
- {{item1.endTime.substring(0,10)}}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
-
|
|
|
|
|
- </scroll-view>
|
|
|
|
|
- <view class="confirmButton" @click="confirmAddRule">
|
|
|
|
|
- <text>确定</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </uni-popup>
|
|
|
|
|
- <!--选择角色-->
|
|
|
|
|
- <uni-popup ref="rolePopup" type="bottom" @change="popupChange">
|
|
|
|
|
- <view class="rolePopup">
|
|
|
|
|
- <view class="flex-row justify-between">
|
|
|
|
|
- <text class="popupTitle">选择角色</text>
|
|
|
|
|
- <u-icon name="close-circle" color="#666" size="24" @click="closePopup"></u-icon>
|
|
|
|
|
- </view>
|
|
|
|
|
- <scroll-view scroll-y class="scroll-Y2">
|
|
|
|
|
- <view class="roleName1" :class="{selectRoleName1: selectRoleIndex === index }"
|
|
|
|
|
- v-for="(item,index) in roleList" :key="index" @click="selectRoleIndex = index">
|
|
|
|
|
- <text>{{item.name}}</text>
|
|
|
|
|
-<!-- <text class="tag" v-if="item.tag == '0'">拓客专员</text>-->
|
|
|
|
|
-<!-- <text class="tag" v-if="item.tag == '1'">合作伙伴</text>-->
|
|
|
|
|
-<!-- <text class="tag" v-if="item.tag == '2'">推广人员</text>-->
|
|
|
|
|
- </view>
|
|
|
|
|
- </scroll-view>
|
|
|
|
|
- <view class="confirmButton" @click="confirmRole">
|
|
|
|
|
- <text>确定</text>
|
|
|
|
|
|
|
+ <u-icon name="close-circle" color="#666" size="35"></u-icon>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</uni-popup>
|
|
</uni-popup>
|
|
@@ -183,19 +80,11 @@
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- qrCreateTime: '',
|
|
|
|
|
- selectRoleIndex: 0, //正在选择的角色下标
|
|
|
|
|
- confirmRoleIndex: 0, //当前选中的角色下标
|
|
|
|
|
- roleList: [],
|
|
|
|
|
- roleBindRuleList: [], //角色已经绑定的规则
|
|
|
|
|
- roleNoBindRuleList: [], //角色没有绑定的规则
|
|
|
|
|
- roleBindRuleParam: {},
|
|
|
|
|
- value: 1,
|
|
|
|
|
- qrcodeUrl: this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2',
|
|
|
|
|
|
|
+ qrcodeUrl:this.$xcxUrl+'?expandUserId={expandUserId}&ruleId={ruleId}×tamp={timestamp}&type=2&expand1=2',
|
|
|
options: {
|
|
options: {
|
|
|
// 指定二维码前景,一般可在中间放logo
|
|
// 指定二维码前景,一般可在中间放logo
|
|
|
- foregroundImagePadding: 2,
|
|
|
|
|
- foregroundImageBorderRadius: 5,
|
|
|
|
|
|
|
+ foregroundImagePadding:2,
|
|
|
|
|
+ foregroundImageBorderRadius:5,
|
|
|
foregroundImageSrc: '/static/logo.png'
|
|
foregroundImageSrc: '/static/logo.png'
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -203,162 +92,17 @@
|
|
|
created() {
|
|
created() {
|
|
|
console.log('接收到的高度', this.height)
|
|
console.log('接收到的高度', this.height)
|
|
|
this.userInfo = uni.getStorageSync('spreadUserInfo')
|
|
this.userInfo = uni.getStorageSync('spreadUserInfo')
|
|
|
- this.getRoleList()
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
-
|
|
|
|
|
formatDate() {
|
|
formatDate() {
|
|
|
this.qrCreateTime = commonUtils.formatDate(new Date())
|
|
this.qrCreateTime = commonUtils.formatDate(new Date())
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- deleteRule(item) {
|
|
|
|
|
-
|
|
|
|
|
- let that = this
|
|
|
|
|
- uni.showModal({
|
|
|
|
|
- title: '温馨提示',
|
|
|
|
|
- content: '是否确认删除该规则!',
|
|
|
|
|
- success: function(res) {
|
|
|
|
|
- if (res.confirm) {
|
|
|
|
|
- console.log('用户点击确定');
|
|
|
|
|
- that.$api.service.cancelRoleBindRule({
|
|
|
|
|
- roleId: that.roleList[that.confirmRoleIndex].id,
|
|
|
|
|
- ruleIds: [item.id]
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
- that.getRuleByRoleId(that.roleList[that.confirmRoleIndex].id)
|
|
|
|
|
- that.getNewRules(that.roleList[that.confirmRoleIndex].id)
|
|
|
|
|
- })
|
|
|
|
|
- } else if (res.cancel) {
|
|
|
|
|
- console.log('用户点击取消');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- selectRule(item, index) {
|
|
|
|
|
- console.log(item)
|
|
|
|
|
- item.select = !item.select
|
|
|
|
|
- this.$set(this.roleNoBindRuleList, index, item)
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- confirmAddRule() {
|
|
|
|
|
- let ruleIds = []
|
|
|
|
|
- for (const rule of this.roleNoBindRuleList) {
|
|
|
|
|
- if (rule.select) {
|
|
|
|
|
- ruleIds.push(rule.id)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (ruleIds.length === 0) {
|
|
|
|
|
- this.closePopup()
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.$api.service.roleBindRule({
|
|
|
|
|
- roleId: this.roleList[this.confirmRoleIndex].id,
|
|
|
|
|
- ruleIds: ruleIds
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
- this.getRuleByRoleId(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- this.getNewRules(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- })
|
|
|
|
|
- this.closePopup()
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- confirmRole() {
|
|
|
|
|
- this.confirmRoleIndex = this.selectRoleIndex
|
|
|
|
|
- this.getRuleByRoleId(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- this.getNewRules(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- this.closePopup()
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- popupChange(e) {
|
|
|
|
|
- if (e.show) {
|
|
|
|
|
- uni.hideTabBar()
|
|
|
|
|
- }
|
|
|
|
|
- if (!e.show) {
|
|
|
|
|
- uni.showTabBar()
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- closePopup() {
|
|
|
|
|
-
|
|
|
|
|
- this.$refs.rolePopup.close()
|
|
|
|
|
- this.$refs.createQrCodePopup.close()
|
|
|
|
|
- this.$refs.rulePopup.close()
|
|
|
|
|
- },
|
|
|
|
|
- selectRole() {
|
|
|
|
|
- this.$refs.rolePopup.open()
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- createQrCode() {
|
|
|
|
|
-
|
|
|
|
|
- if (!this.roleBindRuleList || this.roleBindRuleList.length === 0) {
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- icon: 'error',
|
|
|
|
|
- duration: 3000,
|
|
|
|
|
- title: '请先添加规则!'
|
|
|
|
|
- });
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let data = {
|
|
|
|
|
- roleId: this.roleList[this.confirmRoleIndex].id,
|
|
|
|
|
- parentId: this.userInfo.id,
|
|
|
|
|
- timestamp: new Date().getTime() + (60 * 1000 * 60 * 24 * 365 * 10)
|
|
|
|
|
- };
|
|
|
|
|
- for (let key in data) {
|
|
|
|
|
- let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
|
|
|
|
|
- this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
|
|
|
|
|
- }
|
|
|
|
|
- console.log('++++qrcodeUrl+++++', this.qrcodeUrl)
|
|
|
|
|
- this.formatDate()
|
|
|
|
|
|
|
+ qrCodePopup(){
|
|
|
this.$refs.createQrCodePopup.open()
|
|
this.$refs.createQrCodePopup.open()
|
|
|
},
|
|
},
|
|
|
- createQrCodePopupChange(e) {
|
|
|
|
|
- console.log(e)
|
|
|
|
|
- if (!e.show) {
|
|
|
|
|
- this.qrcodeUrl = this.$tkUrl + '?roleId={roleId}&parentId={parentId}×tamp={timestamp}&type=2&expand1=2'
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- addRule() {
|
|
|
|
|
- this.$refs.rulePopup.open()
|
|
|
|
|
- },
|
|
|
|
|
- change(e) {
|
|
|
|
|
- console.log("e:", e);
|
|
|
|
|
- },
|
|
|
|
|
- //查询规则
|
|
|
|
|
- getRuleList() {
|
|
|
|
|
- this.$api.service.getRuleList().then(res => {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- this.ruleList = res.data.data
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- //查询角色
|
|
|
|
|
- getRoleList() {
|
|
|
|
|
- this.$api.service.getRoleList().then(res => {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- this.roleList = res.data.data
|
|
|
|
|
- this.getRuleByRoleId(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- this.getNewRules(this.roleList[this.confirmRoleIndex].id)
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- //查询角色已经绑定的规则
|
|
|
|
|
- getRuleByRoleId(roleId) {
|
|
|
|
|
- this.$api.service.getRuleByRoleId({
|
|
|
|
|
- roleId: roleId
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
- this.roleBindRuleList = res.data.data
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- //查询角色没有绑定的规则
|
|
|
|
|
- getNewRules(roleId) {
|
|
|
|
|
- this.$api.service.getNewRules({
|
|
|
|
|
- roleId: roleId
|
|
|
|
|
- }).then(res => {
|
|
|
|
|
- this.roleNoBindRuleList = res.data.data
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
|
|
+ closePopup(){
|
|
|
|
|
+ this.$refs.createQrCodePopup.close()
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|