Browse Source

修改团长申请

zs 2 năm trước cách đây
mục cha
commit
b35c9997e3
6 tập tin đã thay đổi với 465 bổ sung3 xóa
  1. 4 0
      config.js
  2. 15 0
      pages.json
  3. 2 2
      pages/home/index.vue
  4. 7 1
      pages/my/index.vue
  5. 204 0
      pagesMy/apply/add.vue
  6. 233 0
      pagesMy/apply/index.vue

+ 4 - 0
config.js

@@ -68,6 +68,10 @@ export default {
 			title: "账号管理",
 			route: "pagesMy/account/index",
 		},
+		{
+			title: "团长申请",
+			route: "pagesMy/apply/add",
+		},
 		{
 			title: "客服电话",
 			route: "",

+ 15 - 0
pages.json

@@ -222,6 +222,21 @@
 					"style": {
 						"navigationBarTitleText": "个人信息"
 					}
+				},
+				{
+					"path": "apply/index",
+					"style": {
+						"navigationBarTitleText": "团长申请记录",
+						"enablePullDownRefresh": true,
+						"navigationBarBackgroundColor": "#23B67A"
+					}
+				},
+				{
+					"path": "apply/add",
+					"style": {
+						"navigationBarTitleText": "团长申请",
+						"navigationBarBackgroundColor": "#23B67A"
+					}
 				}
 			]
 		},

+ 2 - 2
pages/home/index.vue

@@ -170,7 +170,7 @@
 			},
 			// 首页产品查询
 			async searchMarket() {
-				const that = this;
+				const that = this; 
 				let res;
 				let info = {
 					skip: that.skip,
@@ -182,7 +182,7 @@
 				});
 				if (res.errcode == '0') {
 					let list = [...that.marketList, ...res.data];
-					that.$set(that, `marketList`, list);
+					that.$set(that, `marketList`, list); 
 					that.$set(that, `total`, res.total)
 				}
 			},

+ 7 - 1
pages/my/index.vue

@@ -52,7 +52,8 @@
 					<view class="title">{{item.title}}</view>
 					<view class="title">
 						<text v-if="user.id&&item.title=='我的尊荣'">{{integral||0}}分</text>
-						<text v-if="item.title=='客服电话'" @tap="makePhone(serviceContactInfo.phone)">{{serviceContactInfo.phone||''}}</text>
+						<text v-if="item.title=='客服电话'"
+							@tap="makePhone(serviceContactInfo.phone)">{{serviceContactInfo.phone||''}}</text>
 						<text class="iconfont icon-jiantouyou"></text>
 					</view>
 				</view>
@@ -164,6 +165,11 @@
 								}
 							}
 						}
+						if (user.is_leader == '0') {
+							config.my_menu = config.my_menu.filter((i) => {
+								return i.route != 'pagesMy/apply/add';
+							});
+						}
 					}
 					// 订单图标菜单
 					that.$set(that, `orderList`, config.my_orderList);

+ 204 - 0
pagesMy/apply/add.vue

@@ -0,0 +1,204 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="姓名" name="name">
+						<uni-easyinput type="text" v-model="form.name" placeholder="请输入真实姓名" />
+					</uni-forms-item>
+					<uni-forms-item label="身份证号" name="card">
+						<uni-easyinput type="text" v-model="form.card" placeholder="请输入身份证号" />
+					</uni-forms-item>
+					<uni-forms-item label="手机号" name="phone">
+						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入手机号" />
+					</uni-forms-item>
+				</uni-forms>
+				<view class="btn">
+					<button type="primary" @click="onSubmit('form')" size="mini">提交</button>
+					<button type="primary" @click="toApply" size="mini">申请记录</button>
+					<view class="btn_3">
+						<checkbox-group @change="changeAgree">
+							<label>
+								<checkbox :checked="agree" />
+								<text>我已阅读“团长规则”</text>
+							</label>
+						</checkbox-group>
+					</view>
+				</view>
+				<view class="config">
+					<rich-text :nodes="config&&config.leader_rule"></rich-text>
+				</view>
+			</view>
+		</view>
+
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 用戶协议
+				agree: true,
+				// 系统设置
+				config: {},
+				form: {},
+				rules: {
+					name: {
+						rules: [{
+							required: true,
+							errorMessage: '请填写真实姓名',
+						}]
+					},
+					phone: {
+						rules: [{
+							required: true,
+							errorMessage: '请填写手机号码',
+						}, {
+							validateFunction: function(rule, value, data, callback) {
+								let iphoneReg = (
+									/^(13[0-9]|14[1579]|15[0-3,5-9]|16[6]|17[0123456789]|18[0-9]|19[89])\d{8}$/
+								); //手机号码
+								if (!iphoneReg.test(value)) {
+									callback('手机号码格式不正确,请重新填写')
+								}
+							}
+						}]
+					},
+					card: {
+						rules: [{
+							required: true,
+							errorMessage: '请填写身份证',
+						}, {
+							validateFunction: function(rule, value, data, callback) {
+								let iphoneReg = (
+									/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
+								); //
+								if (!iphoneReg.test(value)) {
+									callback('身份证格式不正确,请重新填写')
+								}
+							}
+						}]
+					},
+				},
+			};
+		},
+		onLoad: function(e) {
+			const that = this;
+			that.watchLogin();
+		},
+		methods: {
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: async (res) => {
+						let user = that.$jwt(res.data);
+						if (user) {
+							that.$set(that, `form`, {
+								user_id: user.id,
+								openid: user.openid,
+								phone: user.phone
+							})
+						}
+						// 系统设置
+						let config = await that.$api(`/config`, 'GET', {});
+						if (config.errcode == '0') that.$set(that, `config`, config.data);
+					},
+					fail: (err) => {}
+				})
+			},
+			// 同意隐私协议
+			changeAgree() {
+				const that = this;
+				let agree = true;
+				if (that.agree) agree = false;
+				that.$set(that, `agree`, agree);
+			},
+			// 返回
+			back() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			// 团长记录
+			toApply() {
+				uni.navigateTo({
+					url: `/pagesMy/apply/index`
+				})
+			},
+			// 提交保存
+			onSubmit(ref) {
+				const that = this;
+				that.$refs[ref].validate().then(async params => {
+					if (that.agree) {
+						const arr = await that.$api(`/userleader`, 'POST', that.form);
+						if (arr.errcode == '0') {
+							uni.showToast({
+								title: `团长身份申请成功`,
+								icon: 'success',
+							});
+							that.back();
+						} else {
+							uni.showToast({
+								title: arr.errmsg,
+							})
+						}
+					} else {
+						uni.showToast({
+							title: '请阅读并同意用户协议和隐私政策',
+							icon: 'none'
+						})
+					}
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+
+			.uni-input {
+				border: #f1f1ff 1px solid;
+				padding: 2vw 2vw;
+				border-radius: 1vw;
+			}
+
+			.btn {
+				text-align: center;
+				margin: 0 0 1vw 0;
+
+				button {
+					margin: 0 2vw 2vw 2vw;
+					background-color: #23B67A;
+					color: var(--fffColor);
+				}
+
+				.name {
+					color: var(--f85Color);
+					font-size: var(--font14Size);
+				}
+
+				.btn_3 {
+					width: 100vw;
+					text-align: center;
+					font-size: 12px;
+				}
+			}
+		}
+	}
+
+	.uni-forms-item {
+		margin-bottom: 6vw !important;
+		display: flex;
+		flex-direction: row;
+	}
+</style>

+ 233 - 0
pagesMy/apply/index.vue

@@ -0,0 +1,233 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+					<view class="list-scroll-view">
+						<view class="one_1">
+							<view class="list" v-for="(item,index) in list" :key="index">
+								<view class="name textOver">
+									{{item.name||'暂无'}}
+								</view>
+								<view class="other_1">
+									身份证号:<text>{{item.card||'暂无'}}</text>
+								</view>
+								<view class="other_1">
+									手机号:<text>{{item.phone||'暂无'}}</text>
+								</view>
+								<view class="other_1">
+									状态:<text>{{item.zhStatus||'暂无'}}</text>
+								</view>
+								<view class="other_1">
+									审核结果:<text>{{item.cause||'暂无'}}</text>
+								</view>
+							</view>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+			<view class="is_bottom" v-if="is_bottom">
+				<text>{{config.bottom_title}}</text>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 系统设置
+				config: {},
+				user: {},
+				searchInfo: {},
+				list: [],
+				total: 0,
+				page: 0,
+				skip: 0,
+				limit: 10,
+				statusList: [],
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0
+			};
+		},
+		onLoad: async function(e) {
+			const that = this;
+			that.searchConfig();
+			await that.watchLogin();
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
+		methods: {
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: async (res) => {
+						let user = that.$jwt(res.data);
+						if (user) that.$set(that, `user`, user);
+						// 查询其他信息
+						await that.searchOther();
+						await that.search();
+					},
+					fail: (err) => {}
+				})
+			},
+			// 查询基本设置
+			searchConfig() {
+				const that = this;
+				uni.getStorage({
+					key: 'config',
+					success: function(res) {
+						if (res.data) that.$set(that, `config`, res.data)
+					},
+					fail: function(err) {
+						console.log(err);
+					}
+				})
+			},
+			async search() {
+				const that = this;
+				let info = {
+					skip: that.skip,
+					limit: that.limit,
+					user_id: that.user.id
+				}
+				const res = await that.$api(`/userleader`, `GET`, {
+					...info,
+					...that.searchInfo
+				})
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data]
+					for (let val of list) {
+						let status = that.statusList.find(i => i.value == val.status)
+						if (status) val.zhStatus = status.label;
+					}
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+					});
+				}
+			},
+			// 查询其他信息
+			async searchOther() {
+				const that = this;
+				let res;
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "exam_status"
+				});
+				if (res.errcode == '0') that.$set(that, `statusList`, res.data)
+			},
+			// 分页
+			toPage() {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			}
+		}
+
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			position: relative;
+			flex-grow: 1;
+
+			.one_1 {
+				display: flex;
+				justify-content: space-between;
+				flex-wrap: wrap;
+
+				.list {
+					width: 100%;
+					background: #fff;
+					padding: 2vw;
+					border-radius: 5px;
+					margin: 2vw 1vw 0 1vw;
+					border: 1px solid var(--f1Color);
+
+
+					.name {
+						font-size: var(--font15Size);
+						margin: 0 0 2vw 0;
+					}
+
+					.other_1 {
+						font-size: var(--font14Size);
+
+						text {
+							color: var(--f85Color);
+						}
+
+					}
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 2vw 0;
+			display: inline-block;
+			color: #858585;
+			font-size: 14px;
+		}
+	}
+</style>