Procházet zdrojové kódy

feat:首页接口

zhanghui před 2 roky
rodič
revize
4d64c1c16f

+ 9 - 0
common/js/login.js

@@ -11,6 +11,15 @@ export default {
 		})
 	},
 
+	//注册
+	expandRegister(param) {
+		return request({
+			url: '/auth/expandRegister',
+			method: 'POST',
+			data: param
+		})
+	},
+
 	//退出登录
 	logout() {
 		return request({

+ 33 - 0
common/js/service.js

@@ -28,6 +28,39 @@ export default {
         })
     },
 
+    //取消角色绑定规则,拓客经理调用
+    cancelRoleBindRule(param) {
+        return request({
+            url: '/member/wechat/cancelRoleBindRule',
+            method: 'POST',
+            data:param
+        })
+    },
+
+    //查询角色已经绑定的规则,拓客经理调用
+    getRuleByRoleId(param) {
+        return request({
+            url: '/member/wechat/getRuleByRoleId',
+            method: 'POST',
+            data:param
+        })
+    },
+    //查询角色没有绑定的规则,拓客经理调用
+    getNewRules(param) {
+        return request({
+            url: '/member/wechat/getNewRules',
+            method: 'POST',
+            data:param
+        })
+    },
+    // get请求,获取手机验证码
+    getSmsCode(data) {
+        return request({
+            url: '/resource/sms/code',
+            method: 'GET',
+            data: data
+        })
+    },
 
 
 }

+ 7 - 2
main.js

@@ -7,13 +7,18 @@ import './uni.promisify.adaptor'
 import uView from "uview-ui";
 // #ifdef H5
 // 提交前需要注释  本地调试使用 使用vconsole
-// const vconsole = require('vconsole')
-// Vue.prototype.$vconsole = new vconsole()
+const vconsole = require('vconsole')
+Vue.prototype.$vconsole = new vconsole()
 // #endif
 import api from './common/js/api'
 import env from './common/js/env.js';
 Vue.prototype.$phonePattern = '^1[3-9][0-9]\\d{8}$';
+//后端接口地址
 Vue.prototype.$baseUrl = env.baseUrl;
+//小程序地址
+Vue.prototype.$xcxUrl = 'https://jje.admin.xinyuekj.com.cn/recharge/recharge';
+//拓客端地址
+Vue.prototype.$tkUrl = 'http://tk.gzzzyd.com/#/pages/register/register';
 Vue.prototype.$api = api;
 Vue.use(uView);
 Vue.config.productionTip = false

+ 71 - 71
manifest.json

@@ -1,72 +1,72 @@
 {
-	"name": "jje_spread_uniapp",
-	"appid": "__UNI__0AD3309",
-	"description": "",
-	"versionName": "1.0.0",
-	"versionCode": "100",
-	"transformPx": false,
-	/* 5+App特有相关 */
-	"app-plus": {
-		"usingComponents": true,
-		"nvueStyleCompiler": "uni-app",
-		"compilerVersion": 3,
-		"splashscreen": {
-			"alwaysShowBeforeRender": true,
-			"waiting": true,
-			"autoclose": true,
-			"delay": 0
-		},
-		/* 模块配置 */
-		"modules": {},
-		/* 应用发布信息 */
-		"distribute": {
-			/* android打包配置 */
-			"android": {
-				"permissions": [
-					"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-					"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-					"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-					"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-					"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
-					"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-					"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
-					"<uses-permission android:name=\"android.permission.CAMERA\"/>",
-					"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
-					"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-					"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
-					"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-					"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-					"<uses-feature android:name=\"android.hardware.camera\"/>",
-					"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
-				]
-			},
-			/* ios打包配置 */
-			"ios": {},
-			/* SDK配置 */
-			"sdkConfigs": {}
-		}
-	},
-	/* 快应用特有相关 */
-	"quickapp": {},
-	/* 小程序特有相关 */
-	"mp-weixin": {
-		"appid": "",
-		"setting": {
-			"urlCheck": false
-		},
-		"usingComponents": true
-	},
-	"mp-alipay": {
-		"usingComponents": true
-	},
-	"mp-baidu": {
-		"usingComponents": true
-	},
-	"mp-toutiao": {
-		"usingComponents": true
-	},
-	"uniStatistics": {
-		"enable": false
-	},
-	"vueVersion": "2"
-}
+    "name" : "jje_spread_uniapp",
+    "appid" : "__UNI__0AD3309",
+    "description" : "",
+    "versionName" : "1.0.0",
+    "versionCode" : "100",
+    "transformPx" : false,
+    /* 5+App特有相关 */
+    "app-plus" : {
+        "usingComponents" : true,
+        "nvueStyleCompiler" : "uni-app",
+        "compilerVersion" : 3,
+        "splashscreen" : {
+            "alwaysShowBeforeRender" : true,
+            "waiting" : true,
+            "autoclose" : true,
+            "delay" : 0
+        },
+        /* 模块配置 */
+        "modules" : {},
+        /* 应用发布信息 */
+        "distribute" : {
+            /* android打包配置 */
+            "android" : {
+                "permissions" : [
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+                ]
+            },
+            /* ios打包配置 */
+            "ios" : {},
+            /* SDK配置 */
+            "sdkConfigs" : {}
+        }
+    },
+    /* 快应用特有相关 */
+    "quickapp" : {},
+    /* 小程序特有相关 */
+    "mp-weixin" : {
+        "appid" : "",
+        "setting" : {
+            "urlCheck" : false
+        },
+        "usingComponents" : true
+    },
+    "mp-alipay" : {
+        "usingComponents" : true
+    },
+    "mp-baidu" : {
+        "usingComponents" : true
+    },
+    "mp-toutiao" : {
+        "usingComponents" : true
+    },
+    "uniStatistics" : {
+        "enable" : false
+    },
+    "vueVersion" : "2"
+}

+ 87 - 1
package-lock.json

@@ -5,9 +5,45 @@
   "packages": {
     "": {
       "dependencies": {
-        "uview-ui": "^2.0.36"
+        "uview-ui": "^2.0.36",
+        "vconsole": "^3.15.1"
       }
     },
+    "node_modules/@babel/runtime": {
+      "version": "7.23.9",
+      "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.23.9.tgz",
+      "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==",
+      "dependencies": {
+        "regenerator-runtime": "^0.14.0"
+      },
+      "engines": {
+        "node": ">=6.9.0"
+      }
+    },
+    "node_modules/copy-text-to-clipboard": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz",
+      "integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==",
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/core-js": {
+      "version": "3.35.1",
+      "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.35.1.tgz",
+      "integrity": "sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw==",
+      "hasInstallScript": true
+    },
+    "node_modules/mutation-observer": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
+      "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
+    },
+    "node_modules/regenerator-runtime": {
+      "version": "0.14.1",
+      "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
+      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
+    },
     "node_modules/uview-ui": {
       "version": "2.0.36",
       "resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.36.tgz",
@@ -15,13 +51,63 @@
       "engines": {
         "HBuilderX": "^3.1.0"
       }
+    },
+    "node_modules/vconsole": {
+      "version": "3.15.1",
+      "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.15.1.tgz",
+      "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==",
+      "dependencies": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
     }
   },
   "dependencies": {
+    "@babel/runtime": {
+      "version": "7.23.9",
+      "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.23.9.tgz",
+      "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==",
+      "requires": {
+        "regenerator-runtime": "^0.14.0"
+      }
+    },
+    "copy-text-to-clipboard": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz",
+      "integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q=="
+    },
+    "core-js": {
+      "version": "3.35.1",
+      "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.35.1.tgz",
+      "integrity": "sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw=="
+    },
+    "mutation-observer": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
+      "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
+    },
+    "regenerator-runtime": {
+      "version": "0.14.1",
+      "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
+      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
+    },
     "uview-ui": {
       "version": "2.0.36",
       "resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.36.tgz",
       "integrity": "sha512-ASSZT6M8w3GTO1eFPbsgEFV0U5UujK+8pTNr+MSUbRNcRMC1u63DDTLJVeArV91kWM0bfAexK3SK9pnTqF9TtA=="
+    },
+    "vconsole": {
+      "version": "3.15.1",
+      "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.15.1.tgz",
+      "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==",
+      "requires": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
     }
   }
 }

+ 2 - 1
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
-    "uview-ui": "^2.0.36"
+    "uview-ui": "^2.0.36",
+    "vconsole": "^3.15.1"
   }
 }

+ 1 - 1
pages/index/attach/attach.vue

@@ -116,7 +116,7 @@
 		},
 		data() {
 			return {
-				qrcodeUrl:'https://jje.admin.xinyuekj.com.cn/recharge/recharge?storeId={promotionStoreId}&techNo={techNo}',
+				qrcodeUrl:this.$xcxUrl,
 				options: {
 					// 指定二维码前景,一般可在中间放logo
 					foregroundImagePadding:2,

+ 1 - 0
pages/index/attach/index.rpx.css

@@ -62,6 +62,7 @@
     position: absolute;
     top: 20rpx;
     right: 32rpx;
+
 }
 .select{
     background: rgba(255, 224, 92, 0.1);

+ 7 - 27
pages/index/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="page">
 		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"   title="首页"  />
-		<manager :height="height" v-if="isManager"></manager>
+		<manager :height="height" v-if="userInfo.isManager == 1"></manager>
 		<attach :height="height" v-else></attach>
 	</view>
 </template>
@@ -15,42 +15,22 @@
 		},
 		data() {
 			return {
-				isManager:false,
+				isManager:true,
 				height:'',
 				ruleList:[],
 				roleList:[],
-				roleBindRuleParam:{}
+				roleBindRuleParam:{},
+				userInfo:{}
 			}
 		},
 		onLoad() {
+			this.userInfo = uni.getStorageSync('spreadUserInfo')
 			let sysInfo = uni.getSystemInfoSync()
-			this.height = sysInfo.windowHeight - 70 + 'px'
-			// this.getRuleList()
-			// this.getRoleList()
+			this.height = sysInfo.windowHeight - 45 + 'px'
 		},
 		methods: {
 
-			//查询规则
-			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
-				})
-			},
-			//角色绑定规则
-			roleBindRule(){
-				this.$api.service.roleBindRule(this.roleBindRuleParam).then(res=>{
-					this.getRuleList()
-					this.getRoleList()
-				})
-			},
+
 		}
 	}
 </script>

+ 4 - 2
pages/index/manager/index.rpx.css

@@ -27,13 +27,13 @@
     font-weight: 400;
     color: #666666;
     line-height: 40rpx;
-    padding: 20rpx 0;
+    padding: 5rpx 0;
 }
 .award{
     width: 500rpx;
 }
 .awardItem{
-    margin-right: 100rpx;
+    min-width: 230rpx;
 }
 .addButton{
     width: 686rpx;
@@ -57,6 +57,7 @@
     border-top-left-radius: 10rpx;
     background: white;
     padding: 0 32rpx;
+    background: #f7f7f7;
 }
 .popupTitle{
     line-height: 100rpx;
@@ -121,6 +122,7 @@
 
 .selectRoleName1{
     background: rgba(255, 224, 92, 0.1);
+    /*box-shadow: 0 0 0 2px  #FFE05C;*/
     border: 4rpx solid #FFE05C;
     box-sizing:border-box
 }

+ 153 - 97
pages/index/manager/manager.vue

@@ -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>

+ 2 - 8
pages/register/index.rpx.css

@@ -23,24 +23,18 @@
 }
 .register {
 	margin-top: 24rpx;
-}
-.register text{
+	padding-bottom: 50rpx;
 	font-size: 30rpx;
 	color: #AAAAAA;
 }
+
 .photoView{
 	width: 100rpx;
 	height: 100rpx;
 	border-radius: 50rpx;
-	padding: 0;
-	margin: 30rpx 0;
 	overflow: hidden;
-	margin-left: 100rpx;
 }
 .photoImage{
 	width: 100rpx;
 	height: 100rpx;
 }
-.bordBot{
-	border-bottom: 1px solid #F7F7F7;
-}

+ 67 - 32
pages/register/register.vue

@@ -3,20 +3,16 @@
 		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  title="注册"  />
 		<view :style="{'marginTop':'10rpx'}">
 			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
-
-				<view class="flex-row  bordBot" >
-					<view class="key flex-col justify-center ">
-						<text>头像</text>
-					</view>
-					<view class="photoView" @click="updateAvatar">
-						<image class="photoImage" :src="userInfo.img || '/static/ud4.png'"></image>
+				<u-form-item :labelWidth="80" label="头像:" borderBottom prop="img" ref="item1">
+					<view class="photoView" @click="updateAvatar" >
+						<image class="photoImage" :src="form.imgUrl || '/static/ud4.png'"></image>
 					</view>
-				</view>
+				</u-form-item>
 				<u-form-item :labelWidth="80" label="姓名:" borderBottom prop="name" ref="item1">
-					<u--input v-model="form.username"  placeholder="请输入姓名" border="none"></u--input>
+					<u--input v-model="form.name"  placeholder="请输入姓名" border="none"></u--input>
 				</u-form-item>
-				<u-form-item :labelWidth="80" label="身份证号:" borderBottom prop="name" ref="item1">
-					<u--input v-model="form.username"  placeholder="请输入姓名" border="none"></u--input>
+				<u-form-item :labelWidth="80" label="身份证号:" borderBottom prop="idCard" ref="item1">
+					<u--input v-model="form.idCard"  placeholder="请输入姓名" border="none"></u--input>
 				</u-form-item>
 				<u-form-item :labelWidth="80" label="密码:" borderBottom prop="newPassword" ref="item1">
 					<u--input v-model="form.newPassword" placeholder="请输入密码" type="password" border="none"></u--input>
@@ -26,8 +22,8 @@
 					<u--input v-model="form.againPassword" placeholder="再次确认密码" type="password" border="none"></u--input>
 				</u-form-item>
 
-				<u-form-item :labelWidth="80" label="手机号:" borderBottom prop="username" ref="item1">
-					<u--input v-model="form.username"  placeholder="请输入手机号" border="none"></u--input>
+				<u-form-item :labelWidth="80" label="手机号:" borderBottom prop="phone" ref="item1">
+					<u--input v-model="form.phone"  placeholder="请输入手机号" border="none"></u--input>
 				</u-form-item>
 				<u-form-item :labelWidth="80" label="验证码:" borderBottom prop="code" ref="item1">
 					<view class="inputCode">
@@ -39,7 +35,7 @@
 			</u--form>
 
 			<view :style="{'marginTop':'100rpx'}">
-				<button class="customStyle"  @click="retrievePassword">提交</button>
+				<button class="customStyle"  @click="expandRegister">提交</button>
 			</view>
 
 			<view class="flex-row justify-center  register">
@@ -71,6 +67,7 @@
 	export default {
 		data() {
 			return {
+				disabled1:false,
 				showBirthday:false,
 				showSex:false,
 				birthday: Number(new Date()),
@@ -88,13 +85,40 @@
 				],
 				tips:'',
 				form:{
-					username:'',
-					code:'',
+					roleId:'',
+					parentId:'',
+					img:'',
+					imgUrl:'',
+					name:'',
+					idCard:'',
 					newPassword:'',
-					againPassword:''
+					againPassword:'',
+					phone:'',
+					code:'',
 				},
 				rules: {
-					'username': {
+					'img': {
+						type: 'string',
+						required: true,
+						message: '请上传头像',
+						trigger: ['blur', 'change']
+					},
+					'name': {
+						type: 'string',
+						required: true,
+						min:2,
+						message: '请输入姓名',
+						trigger: ['blur', 'change']
+					},
+					'idCard': {
+						type: 'string',
+						required: true,
+						min:18,
+						max: 18,
+						message: '请输入身份证号',
+						trigger: ['blur', 'change']
+					},
+					'phone': {
 						type: 'string',
 						required: true,
 						min:11,
@@ -130,6 +154,14 @@
 				},
 			}
 		},
+		onLoad(e){
+			if (e.roleId){
+				console.log('获取到的id',e.roleId)
+			}
+			if (e.parentId){
+				console.log('获取到的name',e.parentId)
+			}
+		},
 		methods: {
 			gologin(){
 				uni.redirectTo({
@@ -157,12 +189,8 @@
 							success: (uploadFileRes) => {
 								let res = JSON.parse(uploadFileRes.data)
 								console.log('+++++++++++++++++chooseavatar+++++++++++++++++++++++',uploadFileRes.data)
-								that.userInfo.img = res.data.url.replace(/^http:/, "https:")
-
-								//todo  更新头像的接口
-
-								uni.setStorageSync('spreadUserInfo', that.userInfo)
-
+								that.form.imgUrl = res.data.url.replace(/^http:/, "https:")
+								that.form.img = res.data.ossId
 							}
 						});
 
@@ -185,16 +213,17 @@
 			sexSelect(e) {
 				console.log(e)
 			},
-			retrievePassword(){
+			expandRegister(){
+				console.log(this.form)
 				this.$refs.uForm.validate().then(res => {
-					this.$api.login.retrievePassword(this.form).then(res=>{
-						uni.showToast({
-							icon: 'success',
-							duration: 2000,
-							title: '修改成功,即将跳转登录页'
-						});
+					this.$api.login.expandRegister(this.form).then(res=>{
+
 						setTimeout(()=>{
-							this.logout()
+							uni.showToast({
+								icon: 'success',
+								duration: 2000,
+								title: '注册成功,即将跳转登录页'
+							});
 						},2000)
 
 					})
@@ -217,6 +246,12 @@
 				this.tips = text;
 			},
 			getCode() {
+				let regExp=new RegExp(this.$phonePattern);
+				let b= regExp.test(this.form.phone)
+				if (!b){
+					uni.$u.toast('请输入正确的手机号')
+					return
+				}
 				if (this.$refs.uCode.canGetCode) {
 					// 模拟向后端请求验证码
 					uni.showLoading({