Răsfoiți Sursa

Signed-off-by: liuboyan <632697560@qq.com>
bug

liuboyan 4 ani în urmă
părinte
comite
8f97fe5414
5 a modificat fișierele cu 253 adăugiri și 18 ștergeri
  1. 2 0
      config/api.js
  2. 6 1
      pages.json
  3. 1 0
      pages/index/index.vue
  4. 167 0
      pagesEnroll/classList.vue
  5. 77 17
      pagesEnroll/enrolledForm.vue

+ 2 - 0
config/api.js

@@ -33,6 +33,8 @@ module.exports = {
 	getTalkerList: API_BASE + '/v2/sale/customer/getTalkerList',
 	//  获取支付方式列表
 	getPayTypeList: API_BASE + '/v2/sale/customer/getPayTypeList',
+	//  根据订单二维码获取表单信息
+	getQrCodeInfo: API_BASE + '/v2/sale/customer/getQrCodeInfo',
 	//  提交已报名表单
 	submitEnrolledForm: API_BASE + '/v2/sale/customer/joinCLass',
 	//  提交意向客户表单

+ 6 - 1
pages.json

@@ -36,6 +36,11 @@
 			"style": {
 				"navigationBarTitleText": "场馆列表"
 			}
+		}, {
+			"path": "classList",
+			"style": {
+				"navigationBarTitleText": "班级列表"
+			}
 		}, {
 			"path": "venueDetail",
 			"style": {
@@ -61,7 +66,7 @@
 			"style": {
 				"navigationBarTitleText": "报名列表"
 			}
-		},  {
+		}, {
 			"path": "orderDetail",
 			"style": {
 				"navigationBarTitleText": "报名详情"

+ 1 - 0
pages/index/index.vue

@@ -254,6 +254,7 @@
 			},
 			//  跳转添加信息
 			goToAddForm(path) {
+				uni.removeStorageSync('defaultClass');
 				uni.navigateTo({
 					url: '/pagesEnroll/' + path
 				});

+ 167 - 0
pagesEnroll/classList.vue

@@ -0,0 +1,167 @@
+<template>
+	<view class="content">
+		<view class="filter-box">
+			<u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
+		</view>
+		<scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
+		 :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
+		 @refresherrestore="onRestore">
+			<u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in tableList"
+			 :key="index" class="card-box" @click="selectClass(item)">
+				<view class="card-content" slot="head" style="padding-top: 10px;">
+					<view class="card-name">{{item.name}}</view>
+				</view>
+				<view class="card-content" slot="body">
+					<view class="card-info-text">
+						<u-icon name="clock"></u-icon>
+						{{item.classStartDate}}&nbsp;&nbsp;{{item.classStartHours}}
+					</view>
+					<view class="card-info-text">
+						<u-icon name="map"></u-icon>
+						{{item.address}}
+					</view>
+				</view>
+			</u-card>
+			<u-divider v-if="isOver" bg-color="transparent">没有更多了</u-divider>
+		</scroll-view>
+		<u-top-tips ref="uTips"></u-top-tips>
+	</view>
+</template>
+
+<script>
+	import {
+		mapGetters
+	} from 'vuex'
+	const NET = require('@/utils/request')
+	const API = require('@/config/api')
+	export default {
+		computed: {
+			...mapGetters([
+				'mainColor'
+			])
+		},
+		data() {
+			return {
+				filterText: '',
+				triggered: false,
+				isOver: false,
+				pageIndex: 1,
+				tableList: [],
+			}
+		},
+		onLoad() {
+			this.getTableList()
+		},
+		onReady() {},
+		methods: {
+			//  设置过滤字段
+			setFilterText(value) {
+				this.onRefresh()
+			},
+			//  下拉刷新
+			onRefresh() {
+				this.triggered = true
+				this.isOver = false
+				this.pageIndex = 1
+				this.tableList = []
+				this.getTableList()
+			},
+			//  重置下拉刷新状态
+			onRestore() {
+				this.triggered = 'restore'
+				this.triggered = false
+			},
+			//  懒加载
+			handleLoadMore() {
+				if (!this.isOver) {
+					this.pageIndex++
+					this.getTableList()
+				}
+			},
+			//  获取列表数据
+			getTableList() {
+				NET.request(API.getClassList, {
+					name: this.filterText,
+					page: this.pageIndex,
+					size: 10,
+				}, 'POST').then(res => {
+					this.triggered = false
+					this.tableList = this.tableList.concat(res.data.row)
+					this.isOver = res.data.row.length != 10
+				}).catch(error => {
+					this.triggered = false
+					this.$refs.uTips.show({
+						title: error.message,
+						type: 'warning',
+					})
+				})
+			},
+			//  跳转场馆详情
+			selectClass(item) {
+				uni.setStorage({
+					key: 'defaultClass',
+					data: {
+						classId: item.id,
+						className: item.name,
+					}
+				});
+				uni.navigateBack()
+			},
+		},
+	}
+</script>
+
+<style>
+	page {
+		width: 100%;
+		height: 100%;
+		background-color: #f7f7f7;
+	}
+</style>
+<style lang="scss" scoped>
+	@import "@/static/css/themes.scss";
+
+	.content {
+		width: 100%;
+		float: left;
+
+		.filter-box {
+			height: 48px;
+			padding: 10px 15px;
+			background-color: #FFFFFF;
+		}
+
+		.scroll-box {
+			width: 100%;
+			height: calc(100vh - 48px);
+			box-sizing: border-box;
+			padding-bottom: 10px;
+
+			.card-box {
+				.card-content {
+					padding: 5px 15px;
+				}
+
+				.card-name {
+					height: 20px;
+					display: inline-block;
+					font-weight: bold;
+					font-size: 14px;
+					line-height: 20px;
+				}
+
+				.card-info-text {
+					color: #999999;
+					margin-bottom: 5px;
+
+					/deep/.u-icon {
+						margin-right: 5px;
+						font-size: 14px;
+						color: #000000;
+					}
+
+				}
+			}
+		}
+	}
+</style>

+ 77 - 17
pagesEnroll/enrolledForm.vue

@@ -1,9 +1,22 @@
 <template>
 	<view class="content">
 		<u-form :model="form" ref="form" label-width="140">
+			<u-form-item label="订单号" prop="orderNo" required>
+				<view style="display: flex;">
+					<u-input v-model="form.orderNo" placeholder="请输入订单号" style="flex: 1;" />
+					<u-icon name="scan" size="60" style="margin-left: 5px;" @click="scanQRCode()" v-if="payTypeCode == 0"></u-icon>
+				</view>
+			</u-form-item>
+			<u-form-item label="支付方式" prop="payTypeName" required right-icon="arrow-right" @click.native="payTypeShow = true">
+				<text>{{form.payTypeName}}</text>
+			</u-form-item>
 			<u-form-item label="学生照片" prop="imageFileId" required label-position="top">
 				<u-upload :max-count="1" :action="uploadUrl" :header="uploadHeader" @on-success="uploadSuccess" @on-error="uploadError"
-				 @on-remove="uploadRemove"></u-upload>
+				 @on-remove="uploadRemove" :file-list="fileList" index="1"></u-upload>
+			</u-form-item>
+			<u-form-item label="上传合同" prop="contractFileId" required label-position="top" v-if="payTypeCode == 1">
+				<u-upload :max-count="1" :action="uploadUrl" :header="uploadHeader" @on-success="uploadSuccess" @on-error="uploadError"
+				 @on-remove="uploadRemove" index="2"></u-upload>
 			</u-form-item>
 			<u-form-item label="接收人" prop="coachName" required>
 				<u-input v-model="form.coachName" placeholder="请输入接收人" disabled />
@@ -26,20 +39,17 @@
 			<u-form-item label="手机号码" prop="phone" required>
 				<u-input v-model="form.phone" type="number" placeholder="请输入手机号码" />
 			</u-form-item>
-			<u-form-item label="报名班级" prop="className" required right-icon="arrow-right" @click.native="classShow = true">
+			<u-form-item label="报名班级" prop="className" required right-icon="arrow-right" @click.native="selectClass()">
 				<text>{{form.className}}</text>
 			</u-form-item>
 			<u-form-item label="课时数" prop="courseNumber" required>
-				<u-input v-model="form.courseNumber" type="number" placeholder="请输入课时数" @blur="setSumPrice()" />
+				<u-input v-model="form.courseNumber" type="number" placeholder="请输入课时数" @blur="setCoursePrice()" />
 			</u-form-item>
 			<u-form-item label="课时单价" prop="coursePrice" required>
-				<u-input v-model="form.coursePrice" type="number" placeholder="请输入课时单价" @blur="setSumPrice()" />
+				<u-input v-model="form.coursePrice" type="number" placeholder="请输入课时单价" />
 			</u-form-item>
 			<u-form-item label="课时总价" prop="sumPrice" required>
-				<u-input v-model="form.sumPrice" type="number" placeholder="请输入课时总价" />
-			</u-form-item>
-			<u-form-item label="订单号" prop="orderNo" required>
-				<u-input v-model="form.orderNo" placeholder="请输入订单号" />
+				<u-input v-model="form.sumPrice" type="number" placeholder="请输入课时总价" @blur="setCoursePrice()" />
 			</u-form-item>
 			<u-form-item label="赠课数量">
 				<u-input v-model="form.lessonsGiveNumber" type="number" placeholder="请输入赠课数量" />
@@ -63,9 +73,6 @@
 			<u-form-item label="谈单人" prop="talkerName" required right-icon="arrow-right" @click.native="talkerShow = true">
 				<text>{{form.talkerName}}</text>
 			</u-form-item>
-			<u-form-item label="支付方式" prop="payTypeName" required right-icon="arrow-right" @click.native="payTypeShow = true">
-				<text>{{form.payTypeName}}</text>
-			</u-form-item>
 			<u-form-item label="备注">
 				<u-input v-model="form.remark" type="textarea" placeholder="请输入备注" auto-height :height="100" />
 			</u-form-item>
@@ -101,8 +108,11 @@
 				uploadHeader: {
 					Authorization: uni.getStorageSync('token')
 				},
+				payTypeCode: '',
+				fileList: [],
 				form: {
 					imageFileId: '',
+					contractFileId: '',
 					coachName: '',
 					parentsName: '',
 					studentName: '',
@@ -239,7 +249,12 @@
 				payTypeList: [],
 			}
 		},
-		onLoad() {},
+		onShow() {
+			if (uni.getStorageSync("defaultClass")) {
+				this.form.classId = uni.getStorageSync("defaultClass").classId
+				this.form.className = uni.getStorageSync("defaultClass").className
+			}
+		},
 		onReady() {
 			this.form.coachName = uni.getStorageSync('userData').nickName
 			this.$refs.form.setRules(this.rules);
@@ -303,9 +318,43 @@
 			})
 		},
 		methods: {
+			//  扫码二维码
+			scanQRCode() {
+				uni.scanCode({
+					onlyFromCamera: true,
+					success: (res) => {
+						NET.request(API.getQrCodeInfo, {
+							orderNo: res.result
+						}, 'POST').then(res => {
+							this.form.imageFileId = res.data.imageFileId
+							this.fileList = [{
+								url: res.data.imageFileUrl
+							}]
+							this.form.parentsName = res.data.parentsName
+							this.form.studentName = res.data.studentName
+							this.form.sex = res.data.sex
+							this.form.age = res.data.age
+							this.form.birthday = res.data.birthday
+							this.form.phone = res.data.phone
+							this.form.payTypeId = res.data.payTypeId
+							this.form.payTypeName = res.data.payTypeName
+							this.form.orderNo = res.data.orderNo
+						}).catch(error => {
+							this.$refs.uTips.show({
+								title: error.message,
+								type: 'warning',
+							})
+						})
+					}
+				});
+			},
 			//  文件上传成功回调
 			uploadSuccess(res, index, lists, name) {
-				this.form.imageFileId = res.data.id
+				if (name == 1) {
+					this.form.imageFileId = res.data.id
+				} else if (name == 2) {
+					this.form.contractFileId = res.data.id
+				}
 				this.$refs.uTips.show({
 					title: '文件上传成功',
 					type: 'success',
@@ -321,7 +370,11 @@
 			},
 			//  移除文件回调
 			uploadRemove(index, lists, name) {
-				this.form.imageFileId = ''
+				if (name == 1) {
+					this.form.imageFileId = ''
+				} else if (name == 2) {
+					this.form.contractFileId = ''
+				}
 			},
 			//  设置性别
 			setSex(index) {
@@ -331,6 +384,12 @@
 			setBirthday(object) {
 				this.form.birthday = object.year + '-' + object.month + '-' + object.day
 			},
+			//  跳转班级列表
+			selectClass() {
+				uni.navigateTo({
+					url: '/pagesEnroll/classList'
+				});
+			},
 			//  设置报名班级
 			setClass(object) {
 				this.form.classId = this.classList[object[0]].id
@@ -350,11 +409,12 @@
 			setPayType(object) {
 				this.form.payTypeId = this.payTypeList[object[0]].id
 				this.form.payTypeName = this.payTypeList[object[0]].name
+				this.payTypeCode = this.payTypeList[object[0]].other
 			},
 			//  设置总价
-			setSumPrice() {
-				if (this.form.courseNumber && this.form.coursePrice) {
-					this.form.sumPrice = JSON.stringify(this.form.courseNumber * this.form.coursePrice)
+			setCoursePrice() {
+				if (this.form.courseNumber && this.form.sumPrice) {
+					this.form.coursePrice = (this.form.sumPrice / this.form.courseNumber).toFixed(2)
 				}
 			},
 			//  提交表单