hwq 1 سال پیش
والد
کامیت
272f4e2ba6
4فایلهای تغییر یافته به همراه101 افزوده شده و 47 حذف شده
  1. 14 5
      api/user.js
  2. 1 1
      manifest.json
  3. 51 15
      pages/user/sqdl.vue
  4. 35 26
      pages/user/user.vue

+ 14 - 5
api/user.js

@@ -130,7 +130,7 @@ export function sqdl(data) {
 	});
 }
 
-export function details(data,id) {
+export function details(data, id) {
 	return request({
 		url: '/api/article/details/' + id,
 		method: 'get',
@@ -140,16 +140,25 @@ export function details(data,id) {
 
 export function yjzye(data) {
 	return request({
-		url:'/api/user/transformation',
-		method:'post',
+		url: '/api/user/transformation',
+		method: 'post',
 		data
 	})
 }
 
 export function jfzz(data) {
 	return request({
-		url:'/api/user/transfer_account',
-		method:'post',
+		url: '/api/user/transfer_account',
+		method: 'post',
+		data
+	})
+}
+
+export function getLevelList(data) {
+	// api/give_level_list
+	return request({
+		url: '/api/give_level_list',
+		method: 'get',
 		data
 	})
 }

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
     "name" : "博晟美业",
-    "appid" : "__UNI__5B3B6E0",
+    "appid" : "__UNI__E0158B1",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",

+ 51 - 15
pages/user/sqdl.vue

@@ -34,7 +34,8 @@
 					详细地址:
 				</view>
 				<view class="bg-val">
-					<input type="text" value="" placeholder="请输入详细地址" class="val-ipt" v-model="addressDetail" ref="address" />
+					<input type="text" value="" placeholder="请输入详细地址" class="val-ipt" v-model="addressDetail"
+						ref="address" />
 				</view>
 			</view>
 			<view class="bd-wrap flex">
@@ -55,6 +56,17 @@
 						ref="storenamae" />
 				</view>
 			</view>
+			<view class="bd-wrap flex">
+				<view class="bg-name">
+					等级:
+				</view>
+				<view class="bg-val">
+					<picker @change="bindLevelChange" :value="index" :range="levelList" mode="selector"
+						range-key="name">
+						<view class="val-ipt ">{{chooseLevel.name||'请选择等级'}}</view>
+					</picker>
+				</view>
+			</view>
 
 		</view>
 		<view class="btm-btn" @click="enroll">
@@ -63,8 +75,13 @@
 	</view>
 </template>
 <script>
-	import  pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
-	import { enroll } from '@/api/index.js'
+	import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
+	import {
+		enroll
+	} from '@/api/index.js'
+	import {
+		getLevelList,
+	} from '@/api/user.js'
 	import {
 		mapState,
 		mapMutations
@@ -75,6 +92,9 @@
 		},
 		data() {
 			return {
+				levelList: [],
+				index: 0,
+				chooseLevel: '',
 				name: '',
 				phone: '',
 				address: '',
@@ -85,7 +105,7 @@
 			};
 		},
 		onLoad(opt) {
-
+			this.getLevelList()
 		},
 		onShow() {
 
@@ -107,18 +127,31 @@
 				// address.district = data[2];
 				this.address = data.join('-');
 			},
+			getLevelList() {
+				getLevelList().then(res => {
+					this.levelList = res.data
+				})
+			},
+			bindLevelChange(e) {
+				console.log(e)
+				this.chooseLevel = this.levelList[e.detail.value]
+			},
 			enroll() {
 				let that = this
 				console.log('bin');
-				if(that.loading) {
+				if (that.loading) {
 					return
 				}
-				if(that.name == '') {
+				if (that.name == '') {
 					return that.$api.msg('请输入您的姓名')
 				}
-				if(that.phone == '') {
+				if (that.phone == '') {
 					return that.$api.msg('请输入您的联系方式')
 				}
+				console.log(that.chooseLevel, '123456');
+				if (!that.chooseLevel) {
+					return that.$api.msg('请选择你的等级')
+				}
 				that.loading = true
 				enroll({
 					uid: that.userInfo.uid,
@@ -128,19 +161,21 @@
 					storename: that.storename,
 					spread: that.spread,
 					addressDetail: that.addressDetail,
+					level: that.chooseLevel.id,
+					level_name: that.chooseLevel.name
 				}).then(res => {
 					console.log(res);
 					uni.showToast({
-						title:'提交成功',
-						duration:2000
+						title: '提交成功',
+						duration: 2000
 					});
-					setTimeout(()=>{
+					setTimeout(() => {
 						uni.switchTab({
-							url:'/pages/user/user'
+							url: '/pages/user/user'
 						})
 						that.loading = false
-					},1500)
-					
+					}, 1500)
+
 				}).catch(err => {
 					console.log('err');
 					that.loading = false
@@ -160,10 +195,11 @@
 
 	.bd-wrap {
 		width: 690rpx;
-		height: 100rpx;
+		// height: 100rpx;
+		padding: 20rpx 0;
 		background-color: #fff;
 		border-bottom: 1px solid #f2f2f2;
-		line-height: 100rpx;
+		// line-height: 100rpx;
 		font-size: 32rpx;
 		position: relative;
 

+ 35 - 26
pages/user/user.vue

@@ -13,11 +13,11 @@
 				<view class="user-name-id">
 					<view class="user-name clamp2">{{ userInfo.nickname || '游客'}}</view>
 					<view class="user-shop flex" v-if="userInfo.uid">
-						<view class="user-shop-item" v-if="userInfo.enroll_status == 2 " style="width: 180rpx;">
+						<view class="user-shop-item" v-if="userInfo.level> 0 " style="width: 180rpx;">
 							<image class="user-shop-icon" src="../../static/img/level.png" mode=""
 								style="width: 180rpx;"></image>
 							<view class="user-shopname" style="padding-left: 70rpx;">
-								代理
+								{{userInfo.level_name}}
 							</view>
 						</view>
 						<!-- <view class="user-shop-item" >
@@ -26,9 +26,9 @@
 								{{userInfo.identity == 0?'粉丝':(userInfo.identity == 1?'店员':userInfo.identity == 2?'店长':'')}}
 							</view>
 						</view> -->
-					<!-- </view> -->
-					<!-- <view class="user-uid">UID:{{ userInfo.uid || ''}}</view> -->
-					<!-- <view class="user-shop" v-if="userInfo.user_rule != 'user'">
+						<!-- </view> -->
+						<!-- <view class="user-uid">UID:{{ userInfo.uid || ''}}</view> -->
+						<!-- <view class="user-shop" v-if="userInfo.user_rule != 'user'">
 						<view class="user-shopname">{{ userInfo.identity == 2 ? '店长' : userInfo.identity == 1 ? '店员' : '粉丝' }}</view>
 					</view> -->
 					</view>
@@ -58,7 +58,8 @@
 			</image>
 		</view>
 		<!--  -->
-		<image src="../../static/img/sqdl.png" mode="widthFix" class="sqdl" @click="sqdl" v-if="userInfo.enroll_status != 2"></image>
+		<image src="../../static/img/sqdl.png" mode="widthFix" class="sqdl" @click="sqdl"
+			v-if="userInfo.enroll_status != 2"></image>
 		<view class="main-box">
 			<view class="title flex" @click="navTo('/pages/order/order?state=0')">
 				<view class="title-left">
@@ -154,7 +155,8 @@
 	import {
 		orderData,
 		getUserInfo,
-		check
+		check,
+		getLevelList
 	} from '@/api/user.js';
 	import {
 		saveUrl,
@@ -175,6 +177,7 @@
 				store_name: '',
 				achievement: '',
 				code: '',
+				levelList: [],
 				text: '' //客服微信
 			};
 		},
@@ -216,17 +219,17 @@
 		methods: {
 			...mapMutations('user', ['setUserInfo']),
 			sqdl() {
-				if(this.hasLogin) {
-					if(this.userInfo.enroll_status == 1) {
-						
+				if (this.hasLogin) {
+					if (this.userInfo.enroll_status == 1) {
+
 						uni.showModal({
-							title:"提示",
+							title: "提示",
 							content: '您提交的申请正在审核中,请耐心等待审核'
 						})
-					}else {
+					} else {
 						this.navTo('/pages/user/sqdl')
 					}
-				}else {
+				} else {
 					this.navTo('/pages/user/sqdl')
 				}
 			},
@@ -307,16 +310,21 @@
 			},
 			// 加载初始数据
 			loadBaseData() {
-				getUserInfo({})
-					.then(({
-						data
-					}) => {
-						console.log(data.nickname)
-						this.setUserInfo(data);
-					})
-					.catch(e => {
-						console.log(e);
-					});
+				const obj = this
+				getLevelList().then(res => {
+					obj.levelList = res.data
+					getUserInfo({})
+						.then(({
+							data
+						}) => {
+							obj.setUserInfo(data);
+
+						})
+						.catch(e => {
+							console.log(e);
+						});
+				})
+
 			},
 			/**
 			 * 统一跳转接口,拦截未登录路由
@@ -581,7 +589,7 @@
 				}
 
 				.user-shopname {
-					padding-left:60rpx;
+					padding-left: 60rpx;
 					position: relative;
 					z-index: 2;
 					font-size: 30rpx;
@@ -673,7 +681,7 @@
 
 				.title-font {
 					margin-left: 20rpx;
-					font-size:30rpx;
+					font-size: 30rpx;
 					font-family: PingFang SC;
 					font-weight: bold;
 					color: #333333;
@@ -913,9 +921,10 @@
 			height: 23rpx;
 		}
 	}
+
 	.sqdl {
 		display: block;
 		width: 689rpx;
 		margin: 20rpx auto 20rpx;
 	}
-</style>
+</style>