|
@@ -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)
|
|
|
}
|
|
|
},
|
|
|
// 提交表单
|