소스 검색

技师业绩分页,找回密码。

zhanghui 2 년 전
부모
커밋
f165c5c1e9

+ 8 - 0
common/js/login.js

@@ -25,5 +25,13 @@ export default {
 			method: 'POST',
 			data: param
 		})
+	},
+	//找回密码
+	retrievePassword(param) {
+		return request({
+			url: '/auth/tech/retrievePassword',
+			method: 'POST',
+			data: param
+		})
 	}
 }

+ 18 - 0
common/js/service.js

@@ -161,5 +161,23 @@ export default {
         })
     },
 
+    // get请求,查询技师业绩
+    performanceList(data) {
+        return request({
+            url: '/business/tech/performanceList',
+            method: 'GET',
+            data: data
+        })
+    },
+
+    // get请求,获取手机验证码
+    getSmsCode(data) {
+        return request({
+            url: '/resource/sms/code',
+            method: 'GET',
+            data: data
+        })
+    },
+
 
 }

+ 3 - 3
main.js

@@ -7,8 +7,8 @@ import env from './common/js/env.js';
 
 // #ifdef H5
 // 提交前需要注释  本地调试使用 使用vconsole
-const vconsole = require('vconsole')
-Vue.prototype.$vconsole = new vconsole()
+// const vconsole = require('vconsole')
+// Vue.prototype.$vconsole = new vconsole()
 // #endif
 import {
 	VueJsonp
@@ -23,4 +23,4 @@ App.mpType = 'app'
 const app = new Vue({
 	...App
 })
-app.$mount()
+app.$mount()

+ 16 - 0
pages.json

@@ -48,6 +48,22 @@
 				"navigationStyle": "custom",
 				"enablePullDownRefresh" : false
 			}
+		},
+		{
+			"path" : "pages/performanceList/performanceList",
+			"style" :
+			{
+				"navigationStyle": "custom",
+				"enablePullDownRefresh" : false
+			}
+		},
+		{
+			"path" : "pages/forgetPassword/forgetPassword",
+			"style" :
+			{
+				"navigationStyle": "custom",
+				"enablePullDownRefresh" : false
+			}
 		}
 	],
 

+ 138 - 0
pages/forgetPassword/forgetPassword.vue

@@ -0,0 +1,138 @@
+<template>
+	<view class="page">
+		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="找回密码" @clickLeft="back" />
+
+		<view :style="{'marginTop':'10rpx'}">
+			<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
+
+				<u-form-item :labelWidth="80" label="手机号:" prop="username" ref="item1">
+					<u--input v-model="form.username"  placeholder="请输入手机号"></u--input>
+				</u-form-item>
+
+				<u-form-item :labelWidth="80" label="验证码:" prop="code" ref="item1">
+					<view class="inputCode">
+						<u--input v-model="form.code"  placeholder="请输入验证码" ></u--input>
+					</view>
+					<u-button slot="right" @tap="getCode" :text="tips" type="success" size="small" :disabled="disabled1"></u-button>
+				</u-form-item>
+
+				<u-form-item :labelWidth="80" label="新密码:" prop="newPassword" ref="item1">
+					<u--input v-model="form.newPassword" placeholder="请输入新密码" type="password"></u--input>
+				</u-form-item>
+
+				<u-form-item :labelWidth="80" label="确认密码:" prop="againPassword" ref="item1">
+					<u--input v-model="form.againPassword" placeholder="再次确认新密码" type="password"></u--input>
+				</u-form-item>
+
+			</u--form>
+
+			<view :style="{'marginTop':'100rpx'}">
+				<button class="customStyle"  @click="retrievePassword">提交</button>
+			</view>
+		</view>
+		<u-code ref="uCode" @change="codeChange" seconds="60" @start="disabled1 = true" @end="disabled1 = false"></u-code>
+	</view>
+</template>
+<script>
+	export default {
+		data() {
+			return {
+				tips:'',
+				form:{
+					username:'',
+					code:'',
+					newPassword:'',
+					againPassword:''
+				},
+				rules: {
+					'username': {
+						type: 'string',
+						required: true,
+						min:11,
+						max: 11,
+						message: '请输入电话号码',
+						trigger: ['blur', 'change']
+					},
+					'code': {
+						type: 'string',
+						required: true,
+						min:4,
+						max: 6,
+						message: '请输入验证码',
+						trigger: ['blur', 'change']
+					},
+					'newPassword': {
+						type: 'string',
+						min:6,
+						max: 16,
+						required: true,
+						message: '请输入6-18位密码',
+						trigger: ['blur', 'change']
+					},
+					'againPassword': {
+						type: 'string',
+						min:6,
+						max: 16,
+						required: true,
+						message: '请输入6-18位密码',
+						trigger: ['blur', 'change']
+					}
+				},
+			}
+		},
+		methods: {
+			retrievePassword(){
+				this.$refs.uForm.validate().then(res => {
+					this.$api.login.retrievePassword(this.form).then(res=>{
+						uni.showToast({
+							icon: 'success',
+							duration: 2000,
+							title: '修改成功,即将跳转登录页'
+						});
+						setTimeout(()=>{
+							this.logout()
+						},2000)
+
+					})
+				})
+			},
+			logout(){
+				this.$api.login.logout().then(res=>{
+					uni.clearStorageSync();
+					uni.navigateTo({
+						url:'/pages/login/login'
+					})
+				})
+			}
+			back(){
+				uni.navigateBack({
+					delta: 1
+				});
+			},
+			codeChange(text) {
+				this.tips = text;
+			},
+			getCode() {
+				if (this.$refs.uCode.canGetCode) {
+					// 模拟向后端请求验证码
+					uni.showLoading({
+						title: '正在获取验证码'
+					})
+					this.$api.service.getSmsCode({phonenumber: this.form.username}).then(res=>{
+						uni.hideLoading();
+						// 这里此提示会被this.start()方法中的提示覆盖
+						uni.$u.toast('验证码已发送');
+						// 通知验证码组件内部开始倒计时
+						this.$refs.uCode.start();
+					})
+				} else {
+					uni.$u.toast('倒计时结束后再发送');
+				}
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import './index.rpx.css';
+</style>

+ 24 - 0
pages/forgetPassword/index.rpx.css

@@ -0,0 +1,24 @@
+.page {
+	height: 100vh;
+	background-color: #f7f7f7;
+	padding: 0 32rpx;
+}
+.updatePasswordButton{
+	text-align: center;
+	background: #4cd964;
+	line-height: 80rpx;
+	border-radius: 10rpx;
+	color: #FFFFFF;
+	margin-top: 100rpx;
+}
+.customStyle{
+	background: #fff05c;
+	border: #fff05c;
+	border-radius: 10rpx;
+}
+.customStyle::after{
+	border: none;
+}
+.inputCode{
+	width: 350rpx;
+}

+ 9 - 3
pages/login/login.vue

@@ -34,9 +34,9 @@
 							<text>记住账号密码</text>
 						</checkbox-group>
 					</view>
-<!--					<view class="">-->
-<!--						<text>忘记密码?</text>-->
-<!--					</view>-->
+					<view>
+						<text @click="forgetPassword">忘记密码?</text>
+					</view>
 				</view>
 
 				<view class="loginButton" @click="login">
@@ -86,6 +86,12 @@
 			this.savePassword = uni.getStorageSync('savePassword')
 		},
 		methods: {
+
+			forgetPassword(){
+				uni.navigateTo({
+					url:'/pages/forgetPassword/forgetPassword'
+				})
+			},
 			checkboxChange(e){
 				this.savePassword = !this.savePassword
 				console.log(this.savePassword)

+ 8 - 3
pages/my/my.vue

@@ -20,7 +20,7 @@
 					<text >业绩统计</text>
 				</view>
 				<view class="flex-row justify-center ">
-					<view class="statisticsItem flex-col ">
+					<view class="statisticsItem flex-col " @click="goperList(0)">
 						<view class="flex-row justify-center">
 							<u-icon name="/static/my/fuwuNmber.png" size="28"></u-icon>
 						</view>
@@ -31,7 +31,7 @@
 							<text>{{staticsData.serviceTotal || 0}}</text>
 						</view>
 					</view>
-					<view class="statisticsItem statisticsItemBorder flex-col ">
+					<view class="statisticsItem statisticsItemBorder flex-col " @click="goperList(1)">
 						<view class="flex-row justify-center">
 							<u-icon name="/static/my/jinriyeji.png" size="28"></u-icon>
 						</view>
@@ -42,7 +42,7 @@
 							<text>{{staticsData.todayTotal || 0}}</text>
 						</view>
 					</view>
-					<view class="statisticsItem statisticsItemBorder flex-col ">
+					<view class="statisticsItem statisticsItemBorder flex-col "@click="goperList(2)">
 						<view class="flex-row justify-center">
 							<u-icon name="/static/my/benyueyeji.png" size="28"></u-icon>
 						</view>
@@ -122,6 +122,11 @@
 		},
 
 		methods: {
+			goperList(index){
+				uni.navigateTo({
+					url:"/pages/performanceList/performanceList?index="+ index
+				})
+			},
 			goUserInfo(){
 				uni.navigateTo({
 					url: '/pages/userInfo/userInfo'

+ 5 - 0
pages/performanceList/index.rpx.css

@@ -0,0 +1,5 @@
+.page {
+	height: 100vh;
+	background-color: #f7f7f7;
+	padding: 0 32rpx;
+}

+ 29 - 0
pages/performanceList/module/index.rpx.css

@@ -0,0 +1,29 @@
+.item{
+    background: linear-gradient(180deg, #FFFCED 0%, #FFFFFF 100%);
+    padding: 20rpx 0;
+    border-radius: 15rpx;
+    margin-top: 20rpx;
+}
+.item:first-child{
+    margin-top: 0;
+}
+.avatarView{
+    width: 150rpx;
+    overflow: hidden;
+}
+.avatar{
+    width: 100rpx;
+    height: 100rpx;
+    border-radius: 50rpx;
+}
+.name{
+    margin-top: 10rpx;
+    font-size: 28rpx;
+}
+.msg{
+    font-size: 28rpx;
+    margin-left: 20rpx;
+}
+.value{
+    color: #999999;
+}

+ 190 - 0
pages/performanceList/module/mescrollUni-item.vue

@@ -0,0 +1,190 @@
+<template>
+	<!--
+    swiper中的transfrom会使fixed失效,此时用height固定高度;
+    swiper中无法触发mescroll-mixins.js的onPageScroll和onReachBottom方法,只能用mescroll-uni,不能用mescroll-body
+    -->
+	<!-- ref动态生成: 字节跳动小程序编辑器不支持一个页面存在相同的ref (如不考虑字节跳动小程序可固定值为 ref="mescrollRef") -->
+	<!-- top的高度等于悬浮菜单tabs的高度 -->
+	<mescroll-uni :ref="'mescrollRef' + i" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
+				  :up="upOption" @up="upCallback" @emptyclick="emptyClick">
+		<view class="flex-row item " v-for="(item ,index) in list" :key="index">
+			<view class="flex-col avatarView">
+				<view class="flex-row justify-center">
+					<image :src="item.avatar || '/static/ud4.png'" class="avatar"></image>
+				</view>
+				<view class="flex-row justify-center">
+					<text class="name">{{item.serviceObjectName}}</text>
+				</view>
+			</view>
+
+			<view class="flex-col justify-around msg ">
+				<view>
+					<text>服务项目:</text>
+					<text class="value">{{item.serviceProject}}</text>
+				</view>
+				<view>
+					<text>服务金额:</text>
+					<text class="value">¥{{item.serviceFee}}</text>
+				</view>
+				<view>
+					<text>服务时间:</text>
+					<text class="value">{{item.date.substring(0,10)}}  {{item.time}}</text>
+				</view>
+			</view>
+
+
+
+
+		</view>
+
+	</mescroll-uni>
+</template>
+
+<script>
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
+	export default {
+		mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
+		components: {},
+
+		data() {
+			return {
+				downOption: {
+					auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
+				},
+				upOption: {
+					auto: false, // 不自动加载
+					// page: {
+					// 	num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
+					// 	size: 10 // 每页数据的数量
+					// },
+					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
+					empty: {
+						icon: '',
+						tip: '暂无内容', // 提示
+						// btnText: '去看看'
+					},
+					textNoMore: '没有更多了'
+				},
+				list: [],
+
+			}
+		},
+		props: {
+			i: Number, // 每个tab页的专属下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
+			index: { // 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
+				type: Number,
+				default () {
+					return 0
+				}
+			},
+			dataTime: {
+				type: String,
+				default () {
+					return ''
+				}
+			},
+
+			tabs: { // 为了请求数据,演示用,可根据自己的项目判断是否要传
+				type: Array,
+				default () {
+					return []
+				}
+			},
+			height: [Number, String], // mescroll的高度
+
+		},
+		watch: {
+
+		},
+
+		created() {
+			this.userInfo = uni.getStorageSync('userInfo')
+		},
+
+
+		methods: {
+
+
+			orderFinish(item){
+				this.$api.orderFinish(item.orderNo).then((res)=>{
+					uni.$u.toast('操作成功')
+					this.downCallback()
+				})
+			},
+
+			getOrderSign(order){
+				this.$emit('serialNumber',order)
+			},
+
+			appointment(order){
+				this.$emit('openPayAppointment',order,2)
+			},
+
+			oneClickPay(order){
+				this.$emit('openPay',order,1)
+			},
+
+
+			/*下拉刷新的回调 */
+			downCallback() {
+				// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
+				// loadSwiper();
+				// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
+				this.mescroll.resetUpScroll()
+			},
+			/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
+			upCallback(page) {
+
+				let status = this.index
+				if (this.index === 3){
+					status = 4
+				}
+
+				//联网加载数据
+
+				this.$api.service.performanceList({
+					pageNum: page.num,
+					pageSize: 10,
+					type:this.index
+				}).then((res) => {
+					//联网成功的回调,隐藏下拉刷新和上拉加载的状态;
+					this.mescroll.endSuccess(res.data.data.records.length, res.data.data.records.length === 10);
+					//设置列表数据
+					if (page.num === 1) this.list = []; //如果是第一页需手动制空列表
+					res.data.data.records.forEach(i=>{
+						if (i.avatar){
+							i.avatar = i.avatar.replace(/^http:/, "https:")
+						}
+					})
+					this.list = this.list.concat(res.data.data.records); //追加新数据
+					console.log(this.list)
+				}).catch((err) => {
+					//联网失败, 结束加载
+					this.mescroll.endErr();
+				})
+
+
+			},
+
+
+
+			//点击空布局按钮的回调
+			emptyClick() {
+				uni.showToast({
+					title: '点击了按钮,具体逻辑自行实现'
+				})
+			},
+			// 搜索
+			doSearch() {
+				this.list = []; // 先清空列表,显示加载进度
+				this.mescroll.resetUpScroll();
+			},
+
+
+		}
+	}
+</script>
+<style scoped lang="scss">
+	@import './index.rpx.css';
+</style>

+ 67 - 0
pages/performanceList/performanceList.vue

@@ -0,0 +1,67 @@
+<template>
+	<view class="page">
+		<uni-nav-bar  :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true"  left-icon="left" title="我的业绩" @clickLeft="back" />
+		<view class=" tabs ">
+			<u-tabs :list="tabList" :scrollable="false" lineWidth="30" lineColor="#FFE05C" :activeStyle="{color: '#333333',fontWeight: 'bold',transform: 'scale(1.05)'}" :current="tabIndex" @click="clickTab"></u-tabs>
+		</view>
+
+
+		<!-- 订单列表 -->
+		<view :style="{'height':windowHeight}">
+			<swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
+				<swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index">
+					<view>
+						<mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :tabs="tabList" :height="windowHeight" >
+						</mescroll-item>
+					</view>
+				</swiper-item>
+			</swiper>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	import MescrollItem from "./module/mescrollUni-item.vue";
+	export default {
+		components: {
+			MescrollItem
+		},
+		data() {
+			return {
+				tabIndex: 0,
+				tabList: [{
+					name: '累计服务'
+				}, {
+					name: '今日业绩'
+				}, {
+					name: '本月业绩'
+				}],
+				windowHeight:'',
+			}
+		},
+		onLoad(e) {
+			this.tabIndex = e.index
+			let sysInfo = uni.getSystemInfoSync()
+			this.windowHeight = sysInfo.windowHeight - 74 - 70 + 'px' //除标题栏栏外的屏幕可用高度
+		},
+		methods: {
+			back() {
+				uni.navigateBack({
+					delta: 1
+				})
+			},
+			clickTab(e) {
+				this.tabIndex = e.index
+			},
+			swiperChange(e) {
+				this.tabIndex = e.detail.current
+
+			},
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	@import './index.rpx.css';
+</style>

+ 4 - 1
pages/updatePassword/index.rpx.css

@@ -12,8 +12,11 @@
     color: #FFFFFF;
     margin-top: 100rpx;
 }
-.custom-style{
+.customStyle{
     background: #fff05c;
     border: #fff05c;
     border-radius: 10rpx;
 }
+.customStyle::after{
+    border: none;
+}

+ 6 - 1
pages/updatePassword/updatePassword.vue

@@ -19,7 +19,7 @@
 			</u--form>
 
 			<view :style="{'marginTop':'100rpx'}">
-				<u-button class="custom-style"  text="提交" @click="updatePassword"></u-button>
+				<button class="customStyle"  @click="updatePassword">提交</button>
 			</view>
 		</view>
 	</view>
@@ -63,6 +63,11 @@
 			}
 		},
 		methods: {
+			back(){
+				uni.navigateBack({
+					delta: 1
+				});
+			},
 			updatePassword(){
 				console.log("+++++++++++++++++++")
 				this.$refs.uForm.validate().then(res => {