|
|
@@ -1,95 +1,48 @@
|
|
|
<template>
|
|
|
<view class="page" :style="{height:height}">
|
|
|
- <view class="flex-row justify-between outView" :style="{marginTop:'24rpx'}">
|
|
|
+ <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" @click="selectRole">
|
|
|
- <text class="roleName">简德兴</text>
|
|
|
+ <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>
|
|
|
<scroll-view scroll-y class="scroll-Y">
|
|
|
- <view class="flex-col outView">
|
|
|
+ <view class="flex-col outView" v-for="(item,index) in roleBindRuleList" :key="index">
|
|
|
<view class="flex-row justify-between">
|
|
|
<text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
+ <u-icon name="trash" color="#666" size="24" @click="deleteRule(item)"></u-icon>
|
|
|
</view>
|
|
|
<view class="flex-row justify-between awardView">
|
|
|
- <text>注册:</text>
|
|
|
- <view class="flex-row award ">
|
|
|
- <text class="awardItem">现金:12元</text>
|
|
|
- <text class="awardItem">比例:10%</text>
|
|
|
+ <text>直推:</text>
|
|
|
+ <view>
|
|
|
+ <view class="flex-row award ">
|
|
|
+ <text class="awardItem">注册现金:{{item.awardAmount}}元</text>
|
|
|
+ </view>
|
|
|
+ <view class="flex-row award ">
|
|
|
+ <text class="awardItem">消费现金:{{item.consumeAmount}}元</text>
|
|
|
+ <text class="awardItem">消费比例:{{item.consumeRatio * 100}}%</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="flex-col outView">
|
|
|
- <view class="flex-row justify-between">
|
|
|
- <text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
- </view>
|
|
|
<view class="flex-row justify-between awardView">
|
|
|
- <text>注册:</text>
|
|
|
+ <text>间推:</text>
|
|
|
<view class="flex-row award ">
|
|
|
- <text class="awardItem">现金:12元</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- <view class="flex-col outView">
|
|
|
- <view class="flex-row justify-between">
|
|
|
- <text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
- </view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
- <text>优惠券:</text>
|
|
|
- <view class="flex-col award ">
|
|
|
- <text>数量:100张</text>
|
|
|
- <text>有效期:2024-01-01 至 2024-01-30</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="flex-col outView">
|
|
|
- <view class="flex-row justify-between">
|
|
|
- <text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
- </view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
- <text>优惠券:</text>
|
|
|
- <view class="flex-col award ">
|
|
|
- <text>数量:100张</text>
|
|
|
- <text>有效期:2024-01-01 至 2024-01-30</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="flex-col outView">
|
|
|
- <view class="flex-row justify-between">
|
|
|
- <text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
- </view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
- <text>优惠券:</text>
|
|
|
- <view class="flex-col award ">
|
|
|
- <text>数量:100张</text>
|
|
|
- <text>有效期:2024-01-01 至 2024-01-30</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="flex-col outView">
|
|
|
- <view class="flex-row justify-between">
|
|
|
- <text class="title">规则标题</text>
|
|
|
- <u-icon name="trash" color="#666" size="24"></u-icon>
|
|
|
- </view>
|
|
|
- <view class="flex-row justify-between awardView">
|
|
|
- <text>优惠券:</text>
|
|
|
- <view class="flex-col award ">
|
|
|
- <text>数量:100张</text>
|
|
|
- <text>有效期:2024-01-01 至 2024-01-30</text>
|
|
|
+ <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 award ">-->
|
|
|
+<!-- <text>满100减250的优惠券</text>-->
|
|
|
+<!-- <text>有效期:2024-01-01 至 2024-01-30</text>-->
|
|
|
+<!-- </view>-->
|
|
|
+<!-- </view>-->
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
@@ -104,7 +57,7 @@
|
|
|
<text>生成二维码</text>
|
|
|
</view>
|
|
|
|
|
|
-
|
|
|
+ <!--邀请专员二维码-->
|
|
|
<uni-popup ref="createQrCodePopup" type="center">
|
|
|
<view class="createQrCodePopup">
|
|
|
<view class="flex-row justify-center">
|
|
|
@@ -118,41 +71,66 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
-
|
|
|
- <uni-popup ref="rulePopup" type="bottom">
|
|
|
+ <!--选择规则-->
|
|
|
+ <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">
|
|
|
- <checkbox-group @change="checkboxChange">
|
|
|
- <view class="flex-row justify-between label" v-for="item in 10" :key="item.value">
|
|
|
- <view>规则名称规则名称</view>
|
|
|
- <view>
|
|
|
- <checkbox :value="item.value" :checked="item.checked" />
|
|
|
- </view>
|
|
|
+
|
|
|
+ <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 ">
|
|
|
+ <text class="awardItem">注册现金:{{item.awardAmount}}元</text>
|
|
|
</view>
|
|
|
- </checkbox-group>
|
|
|
+ <view class="flex-row award ">
|
|
|
+ <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 ">
|
|
|
+ <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 award ">-->
|
|
|
+<!-- <text>满100减250的优惠券</text>-->
|
|
|
+<!-- <text>有效期:2024-01-01 至 2024-01-30</text>-->
|
|
|
+<!-- </view>-->
|
|
|
+<!-- </view>-->
|
|
|
+ </view>
|
|
|
</scroll-view>
|
|
|
- <view class="confirmButton" @click="addRule">
|
|
|
+ <view class="confirmButton" @click="confirmAddRule">
|
|
|
<text>确定</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
-
|
|
|
- <uni-popup ref="rolePopup" type="bottom">
|
|
|
+ <!--选择角色-->
|
|
|
+ <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:i===5}" v-for="i in 10">
|
|
|
- <text>拓客专员</text>
|
|
|
+ <view class="roleName1" :class="{selectRoleName1: selectRoleIndex === index }" v-for="(item,index) in roleList" :key="index" @click="selectRoleIndex = index">
|
|
|
+ <text>{{item.name}}</text>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
- <view class="confirmButton">
|
|
|
+ <view class="confirmButton" @click="confirmRole">
|
|
|
<text>确定</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -173,11 +151,14 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- ruleList:[],
|
|
|
+ selectRoleIndex:0, //正在选择的角色下标
|
|
|
+ confirmRoleIndex:0, //当前选中的角色下标
|
|
|
roleList:[],
|
|
|
+ roleBindRuleList:[], //角色已经绑定的规则
|
|
|
+ roleNoBindRuleList:[], //角色没有绑定的规则
|
|
|
roleBindRuleParam:{},
|
|
|
value: 1,
|
|
|
- qrcodeUrl:'https://jje.admin.xinyuekj.com.cn/recharge/recharge?storeId={promotionStoreId}&techNo={techNo}',
|
|
|
+ qrcodeUrl:this.$tkUrl+'?roleId={roleId}&parentId={parentId}',
|
|
|
options: {
|
|
|
// 指定二维码前景,一般可在中间放logo
|
|
|
foregroundImagePadding:2,
|
|
|
@@ -191,11 +172,60 @@
|
|
|
],
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- // this.getRuleList()
|
|
|
- // this.getRoleList()
|
|
|
+ created() {
|
|
|
+ this.userInfo = uni.getStorageSync('spreadUserInfo')
|
|
|
+ this.getRoleList()
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ deleteRule(item){
|
|
|
+ this.$api.service.cancelRoleBindRule({
|
|
|
+ roleId:this.roleList[this.confirmRoleIndex].id,
|
|
|
+ ruleIds:[item.id]
|
|
|
+ }).then(res=>{
|
|
|
+ this.getRuleByRoleId(this.roleList[this.confirmRoleIndex].id)
|
|
|
+ this.getNewRules(this.roleList[this.confirmRoleIndex].id)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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()
|
|
|
@@ -203,8 +233,19 @@
|
|
|
},
|
|
|
selectRole(){
|
|
|
this.$refs.rolePopup.open()
|
|
|
+
|
|
|
},
|
|
|
createQrCode(){
|
|
|
+ let data = {
|
|
|
+ roleId:this.roleList[this.confirmRoleIndex].id,
|
|
|
+ parentId:this.userInfo.id
|
|
|
+ };
|
|
|
+ for (let key in data) {
|
|
|
+ let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
|
|
|
+ this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
|
|
|
+ }
|
|
|
+ console.log('++++qrcodeUrl+++++',this.qrcodeUrl)
|
|
|
+
|
|
|
this.$refs.createQrCodePopup.open()
|
|
|
},
|
|
|
addRule(){
|
|
|
@@ -225,15 +266,30 @@
|
|
|
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
|
|
|
})
|
|
|
},
|
|
|
- //角色绑定规则
|
|
|
- roleBindRule(){
|
|
|
- this.$api.service.roleBindRule(this.roleBindRuleParam).then(res=>{
|
|
|
- this.getRuleList()
|
|
|
- this.getRoleList()
|
|
|
+
|
|
|
+ //查询角色没有绑定的规则
|
|
|
+ getNewRules(roleId){
|
|
|
+ this.$api.service.getNewRules({
|
|
|
+ roleId:roleId
|
|
|
+ }).then(res=>{
|
|
|
+ this.roleNoBindRuleList = res.data.data
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|