|
@@ -5,19 +5,26 @@
|
|
|
<view class="card-num">¥{{memberInfo.originalAmount}}</view>
|
|
|
<view class="card-icon iconfont iconzu4931"></view>
|
|
|
</view>
|
|
|
- <u-cell-group style="width: 100%; float: left;">
|
|
|
- <u-cell-item title="使用时间" :value="memberInfo.startDate + '~' + memberInfo.endDate" :arrow="false"></u-cell-item>
|
|
|
- <u-cell-item title="优惠金额" :value="couponId ? '-¥' + memberInfo.discountsAmount : ''" @click="couponShow = true"></u-cell-item>
|
|
|
- <u-cell-item title="学员姓名" :value="studentName" @click="studentShow = true" required></u-cell-item>
|
|
|
- <u-cell-item title="实际金额" :value="'¥' + memberInfo.realPayAmount" :arrow="false"></u-cell-item>
|
|
|
- <!-- <u-cell-item title="乙方签字" :arrow="false" :title-style="{width: '100%'}" required>
|
|
|
- <view class="canvas-container" slot="label">
|
|
|
- <canvas canvas-id="canvas" id="canvas" :disable-scroll="true" v-show="!couponShow && !studentShow" style="width: 100%; height: 200px;background-color: #FFFFFF;"
|
|
|
- @touchstart="handleTouchStart($event)" @touchmove="handleTouchMove($event)" @touchend="handleTouchEnd($event)"
|
|
|
- @touchcancel="handleEnd($event)"></canvas>
|
|
|
- </view>
|
|
|
- </u-cell-item> -->
|
|
|
- </u-cell-group>
|
|
|
+ <u-form :model="form" label-width="140" style="width: 100%; float: left;">
|
|
|
+ <u-form-item label="使用时间">
|
|
|
+ <text>{{memberInfo.startDate + '~' + memberInfo.endDate}}</text>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="优惠金额" right-icon="arrow-right" @click.native="couponShow = true">
|
|
|
+ <text>{{couponId ? '-¥' + memberInfo.discountsAmount : ''}}</text>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="学员姓名" right-icon="arrow-right" required @click.native="studentShow = true">
|
|
|
+ <text>{{studentName}}</text>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="实际金额" @click.native="studentShow = true">
|
|
|
+ <text>{{'¥' + memberInfo.realPayAmount}}</text>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="家长名称" required>
|
|
|
+ <u-input v-model="form.parentName" placeholder="请输入家长姓名" />
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item label="性别" prop="sex" required right-icon="arrow-right" @click.native="sexShow = true">
|
|
|
+ <text>{{form.sex}}</text>
|
|
|
+ </u-form-item>
|
|
|
+ </u-form>
|
|
|
<u-popup v-model="couponShow" mode="bottom" border-radius="30" closeable>
|
|
|
<scroll-view scroll-y style="height:300px;margin: 30px 0 15px 0;">
|
|
|
<u-card :show-head="false" :show-foot="false" padding="0px" margin="0px 30px 20px 30px" borderRadius="40" v-for="(item, index) in couponList"
|
|
@@ -51,12 +58,12 @@
|
|
|
<u-button type="warning" shape="circle" :ripple="true" :custom-style="{...customStyle,margin:'15px',float: 'left',width: 'calc(100% - 30px)'}"
|
|
|
@click="goToSubscribelForm()">新增学员</u-button>
|
|
|
</u-popup>
|
|
|
+ <u-action-sheet :list="sexList" v-model="sexShow" @click="setSex"></u-action-sheet>
|
|
|
<u-top-tips ref="uTips"></u-top-tips>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- var context = null
|
|
|
import {
|
|
|
mapGetters
|
|
|
} from 'vuex'
|
|
@@ -90,31 +97,23 @@
|
|
|
studentName: '',
|
|
|
studentShow: false,
|
|
|
studentList: [],
|
|
|
- contractInfo: {
|
|
|
- id: '',
|
|
|
- url: '',
|
|
|
+ form: {
|
|
|
+ parentName: 'xsaxs',
|
|
|
+ sex: '',
|
|
|
},
|
|
|
- canvasData: [],
|
|
|
- signUrl: ''
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- canvasData() {
|
|
|
- context.moveTo(this.canvasData[0].x, this.canvasData[0].y)
|
|
|
- for (let i = 0; i < this.canvasData.length; i++) {
|
|
|
- context.lineTo(this.canvasData[i].x, this.canvasData[i].y)
|
|
|
- }
|
|
|
- context.stroke()
|
|
|
- context.draw(true)
|
|
|
+ sexShow: false,
|
|
|
+ sexList: [{
|
|
|
+ text: '男'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ text: '女'
|
|
|
+ }
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.memberCardId = options.id
|
|
|
this.getMemberInfo()
|
|
|
- context = uni.createCanvasContext('canvas')
|
|
|
- context.setLineWidth(3)
|
|
|
- context.setStrokeStyle("#000000")
|
|
|
- this.reset()
|
|
|
},
|
|
|
onShow() {
|
|
|
NET.request(API.getAllStudentList, {}, 'POST').then(res => {
|
|
@@ -126,6 +125,18 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ onReady() {
|
|
|
+ NET.request(API.getParentInfo, {}, 'POST').then(res => {
|
|
|
+ debugger
|
|
|
+ this.form.parentName = res.data.parentName
|
|
|
+ this.form.sex = res.data.sex
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: error.message,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 获取数据
|
|
|
getMemberInfo() {
|
|
@@ -149,16 +160,6 @@
|
|
|
type: 'warning',
|
|
|
})
|
|
|
})
|
|
|
- NET.request(API.getContractInfo, {
|
|
|
- cardId: this.memberCardId
|
|
|
- }, 'POST').then(res => {
|
|
|
- this.contractInfo = res.data
|
|
|
- }).catch(error => {
|
|
|
- this.$refs.uTips.show({
|
|
|
- title: error.message,
|
|
|
- type: 'warning',
|
|
|
- })
|
|
|
- })
|
|
|
},
|
|
|
// 更新数据
|
|
|
refreshMemberInfo() {
|
|
@@ -188,10 +189,14 @@
|
|
|
this.studentName = item.studentName
|
|
|
this.refreshMemberInfo()
|
|
|
},
|
|
|
+ // 设置性别
|
|
|
+ setSex(index) {
|
|
|
+ this.form.sex = this.sexList[index].text
|
|
|
+ },
|
|
|
// 显示合同
|
|
|
checkContract() {
|
|
|
uni.downloadFile({
|
|
|
- url: this.contractInfo.url,
|
|
|
+ url: '',
|
|
|
success: (res) => {
|
|
|
uni.openDocument({
|
|
|
filePath: res.tempFilePath,
|
|
@@ -199,49 +204,8 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 重置
|
|
|
- reset() {
|
|
|
- context.draw()
|
|
|
- },
|
|
|
- // 签字版触屏开始
|
|
|
- handleTouchStart(e) {
|
|
|
- if (!this.studentShow && !this.couponShow) {
|
|
|
- const a = e.changedTouches[0]
|
|
|
- this.canvasData.push({
|
|
|
- x: a.x,
|
|
|
- y: a.y
|
|
|
- })
|
|
|
- }
|
|
|
- this.canvasData = []
|
|
|
- },
|
|
|
- // 签字版触屏移动
|
|
|
- handleTouchMove(e) {
|
|
|
- if (!this.studentShow && !this.couponShow) {
|
|
|
- const a = e.changedTouches[0]
|
|
|
- this.canvasData.push({
|
|
|
- x: a.x,
|
|
|
- y: a.y
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- // 签字版触屏结束
|
|
|
- handleTouchEnd(e) {
|
|
|
- if (!this.studentShow && !this.couponShow) {
|
|
|
- const a = e.changedTouches[0]
|
|
|
- this.canvasData.push({
|
|
|
- x: a.x,
|
|
|
- y: a.y
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- handleEnd() {
|
|
|
- if (!this.studentShow && !this.couponShow) {
|
|
|
- context.stroke()
|
|
|
- context.draw(true)
|
|
|
- }
|
|
|
- },
|
|
|
- // 提交签字
|
|
|
- submitContract() {
|
|
|
+ // 支付
|
|
|
+ toPay(contractId) {
|
|
|
if (!this.studentId) {
|
|
|
this.$refs.uTips.show({
|
|
|
title: '请选择学员',
|
|
@@ -249,80 +213,24 @@
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- let that = this
|
|
|
- uni.canvasToTempFilePath({
|
|
|
- canvasId: 'canvas',
|
|
|
- success: res => {
|
|
|
- uni.uploadFile({
|
|
|
- url: API.uploadFile,
|
|
|
- filePath: res.tempFilePath,
|
|
|
- name: 'file',
|
|
|
- header: {
|
|
|
- Authorization: uni.getStorageSync('token')
|
|
|
- },
|
|
|
- success: (uploadFileRes) => {
|
|
|
- that.signUrl = JSON.parse(uploadFileRes.data).data.id
|
|
|
- NET.request(API.submitContractForm, {
|
|
|
- contractId: that.contractInfo.id,
|
|
|
- fileId: that.signUrl,
|
|
|
- }, 'POST').then(res => {
|
|
|
- that.toPay(res.data.id)
|
|
|
- }).catch(error => {
|
|
|
- that.$refs.uTips.show({
|
|
|
- title: error.message,
|
|
|
- type: 'warning',
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 支付
|
|
|
- toPay(contractId) {
|
|
|
- if (!this.studentId) {
|
|
|
+ if (!this.form.parentName) {
|
|
|
this.$refs.uTips.show({
|
|
|
- title: '请选择学员',
|
|
|
+ title: '请输入家长姓名',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.form.sex) {
|
|
|
+ this.$refs.uTips.show({
|
|
|
+ title: '请选择性别',
|
|
|
type: 'warning',
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- // NET.request(API.getPayParams, {
|
|
|
- // id: this.memberCardId,
|
|
|
- // couponId: this.couponId,
|
|
|
- // studentId: this.studentId,
|
|
|
- // contractId: contractId
|
|
|
- // }, 'POST').then(res => {
|
|
|
- // if (this.memberInfo.realPayAmount <= 0) {
|
|
|
- // this.goToPayResult(res.data.oderNo)
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // uni.requestPayment({
|
|
|
- // provider: 'wxpay',
|
|
|
- // timeStamp: res.data.timeStamp,
|
|
|
- // nonceStr: res.data.nonceStr,
|
|
|
- // package: res.data.packageString,
|
|
|
- // signType: res.data.signType,
|
|
|
- // paySign: res.data.paySign,
|
|
|
- // success: (payRes) => {
|
|
|
- // this.goToPayResult(res.data.oderNo)
|
|
|
- // },
|
|
|
- // fail: (error) => {
|
|
|
- // this.$refs.uTips.show({
|
|
|
- // title: '支付未成功',
|
|
|
- // type: 'warning',
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }).catch(error => {
|
|
|
- // this.$refs.uTips.show({
|
|
|
- // title: error.message,
|
|
|
- // type: 'warning',
|
|
|
- // })
|
|
|
- // })
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesMain/contractInfo?memberCardId=' + this.memberCardId + '&couponId=' + this.couponId + '&studentId=' +
|
|
|
- this.studentId + '&realPayAmount=' + this.memberInfo.realPayAmount
|
|
|
+ this.studentId + '&realPayAmount=' + this.memberInfo.realPayAmount + '&parentName=' + this.form.parentName +
|
|
|
+ '&sex=' + this.form.sex
|
|
|
});
|
|
|
},
|
|
|
// 跳转支付结果
|