|
|
@@ -138,46 +138,71 @@
|
|
|
</div>
|
|
|
|
|
|
<el-dialog title="申请开通课程" :visible.sync="buyCourseDialog" width="550px" top="100px" align="center">
|
|
|
- <el-form label-width="100px" :inline="false" :model="buyForm" :rules="rules"
|
|
|
- ref="elForm">
|
|
|
-
|
|
|
- <el-form-item label="报考岗位" prop="courseName">
|
|
|
- <el-input type="text" placeholder="报考岗位" v-model="buyForm.courseName+'-'+buyForm.nd"
|
|
|
- style="width: 360px;" />
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="证书编号" prop="rzCode">
|
|
|
- <el-input v-model="buyForm.rzCode" type="text" style="width: 360px;">
|
|
|
- <template #suffix>
|
|
|
- <el-button @click="openShowAllRzcodeDialog" type="text" style="margin-right: 10px;">修改</el-button>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
-<!-- <el-form-item label="支付类型" prop="payType">
|
|
|
- <div style="text-align: left;margin-left: 20px;">
|
|
|
- <el-button :type="buyForm.payType === 'wx' ? 'primary' : 'default'" style="margin-right: 30px;" @click="buyForm.payType='wx';onPayTypeChange()">微信</el-button>
|
|
|
- <el-button :type="buyForm.payType === 'ali' ? 'primary' : 'default'" @click="buyForm.payType='ali';onPayTypeChange()">支付宝</el-button>
|
|
|
- </div>
|
|
|
- </el-form-item> -->
|
|
|
+ <template v-if="!showPay">
|
|
|
+ <el-form label-width="100px" :inline="false" :model="buyForm" :rules="rules"
|
|
|
+ ref="elForm">
|
|
|
+
|
|
|
+ <el-form-item label="报考岗位" prop="courseName">
|
|
|
+ <el-input type="text" placeholder="报考岗位" v-model="buyForm.courseName+'-'+buyForm.nd"
|
|
|
+ style="width: 360px;" />
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-row>
|
|
|
+ <el-form-item label="证书编号" prop="rzCode">
|
|
|
+ <el-input v-model="buyForm.rzCode" type="text" style="width: 360px;">
|
|
|
+ <template #suffix>
|
|
|
+ <el-button @click="openShowAllRzcodeDialog" type="text" style="margin-right: 10px;">修改</el-button>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-divider></el-divider>
|
|
|
+ <h3 class="tc" style="margin-bottom: 16px;">发票信息</h3>
|
|
|
+ <el-form-item label="是否需要开票">
|
|
|
+ <el-radio-group v-model="buyForm.needInvoice">
|
|
|
+ <el-radio :label="1">是</el-radio>
|
|
|
+ <el-radio :label="0">否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <template v-if="buyForm.needInvoice">
|
|
|
+ <el-form-item label="开票类型">
|
|
|
+ <el-radio-group v-model="buyForm.invoiceType">
|
|
|
+ <el-radio label="personal">个人</el-radio>
|
|
|
+ <el-radio label="enterprise">企业</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="发票抬头" prop="title">
|
|
|
+ <el-input v-model="buyForm.title" :placeholder="buyForm.invoiceType === 'enterprise'?'请输入单位名称':'请输入真实名字'" style="width: 360px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号码" prop="phone">
|
|
|
+ <el-input v-model="buyForm.phone" placeholder="请输入手机号码" style="width: 360px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="邮箱地址" prop="email">
|
|
|
+ <el-input v-model="buyForm.email" placeholder="请输入邮箱地址" style="width: 360px;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-divider></el-divider>
|
|
|
<h2 class="tc"> 本课程费用: <strong style="color: red;"> {{buyForm.fee/100}} 元 </strong> </h2>
|
|
|
- <div style="width: 300px; margin: 0px auto;" v-if="buyForm.payType">
|
|
|
- <img :src="wxPayUrl" width="300px" @click="showImg(wxPayUrl)">
|
|
|
- </div>
|
|
|
- <div style="width: 300px; margin: 0px auto;" v-else>
|
|
|
- <img :src="aliPayUrl" width="300px" @click="showImg(aliPayUrl)">
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
|
|
|
- <el-row class="tc fc">
|
|
|
- <el-form-item>
|
|
|
+ <el-form-item label-width="0" style="margin-top: 30px;">
|
|
|
<el-button @click="cancelBuyCourse">取 消</el-button>
|
|
|
- <el-button @click="buyCourse" type="primary">确 定</el-button>
|
|
|
+ <el-button @click="generatePayQrcode" type="primary">提交订单</el-button>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-if="showPay">
|
|
|
+ <h2 class="tc"> 本课程费用: <strong style="color: red;"> {{buyForm.fee/100}} 元 </strong> </h2>
|
|
|
+ <div style="width: 300px; margin: 20px auto;">
|
|
|
+ <img :src="wxPayUrl" width="300px" @click="showImg(wxPayUrl)">
|
|
|
+ </div>
|
|
|
+ <p class="tc">请使用微信扫码支付</p>
|
|
|
+ <el-row class="tc fc">
|
|
|
+ <el-button @click="cancelBuyCourse">关 闭</el-button>
|
|
|
</el-row>
|
|
|
- </el-form>
|
|
|
+ </template>
|
|
|
+
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
@@ -246,31 +271,19 @@
|
|
|
showExample: false,
|
|
|
showImgDialog: false,
|
|
|
showAllRzcodeDialog: false,
|
|
|
- promiseType: {
|
|
|
- 1: '温馨提示',
|
|
|
- 2: '承诺书',
|
|
|
- 3: '委 托 书'
|
|
|
- },
|
|
|
+ showPay: false,
|
|
|
buyForm: {
|
|
|
payType:'wx',
|
|
|
- marks: '',
|
|
|
rzCode: '',
|
|
|
- payNo: '',
|
|
|
email: '',
|
|
|
- company: '',
|
|
|
- buyImg: '',
|
|
|
- name: '',
|
|
|
+ title: '',
|
|
|
+ phone: '',
|
|
|
courseName: '',
|
|
|
list: [],
|
|
|
fee: 0,
|
|
|
- course_id: ''
|
|
|
- },
|
|
|
- promise: {
|
|
|
- status: 0,
|
|
|
- showType: 1
|
|
|
- },
|
|
|
- typeInfo:{
|
|
|
-
|
|
|
+ courseId: '',
|
|
|
+ needInvoice: 0,
|
|
|
+ invoiceType: 'personal'
|
|
|
},
|
|
|
imgUrl: '',
|
|
|
qrcodeUrl: "",
|
|
|
@@ -294,9 +307,9 @@
|
|
|
required: true,
|
|
|
message: '请输入订单编号后六位'
|
|
|
}],
|
|
|
- marks: [{
|
|
|
+ title: [{
|
|
|
required: true,
|
|
|
- message: '请输入备注信息'
|
|
|
+ message: '抬头必须填写'
|
|
|
}],
|
|
|
email: [{
|
|
|
required: true,
|
|
|
@@ -316,7 +329,15 @@
|
|
|
],
|
|
|
company: [{
|
|
|
required: true,
|
|
|
- message: '请输入所在企业'
|
|
|
+ message: '请输入单位名称'
|
|
|
+ }],
|
|
|
+ phone: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入手机号码'
|
|
|
+ }, {
|
|
|
+ pattern: /^1[3-9]\d{9}$/,
|
|
|
+ message: '手机号码格式不正确',
|
|
|
+ trigger: 'blur'
|
|
|
}],
|
|
|
courseName: [{
|
|
|
required: true,
|
|
|
@@ -327,7 +348,7 @@
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters("user", ["typeList", "userInfo", "promiseList"])
|
|
|
+ ...mapGetters("user", ["typeList", "userInfo"])
|
|
|
},
|
|
|
components: {
|
|
|
DoUpload
|
|
|
@@ -349,9 +370,6 @@
|
|
|
filterName() {
|
|
|
this.page = 1
|
|
|
this.filterData()
|
|
|
- },
|
|
|
- isCommitment(val) {
|
|
|
- console.log(val)
|
|
|
}
|
|
|
},
|
|
|
beforeMount() {
|
|
|
@@ -368,11 +386,6 @@
|
|
|
this.imgUrl = url;
|
|
|
this.showImgDialog = true;
|
|
|
},
|
|
|
- onPayTypeChange() {
|
|
|
- if (this.buyCourseDialog && this.buyForm.course_id) {
|
|
|
- this.generatePayQrcode();
|
|
|
- }
|
|
|
- },
|
|
|
closeDialog() {
|
|
|
if (this.timer) window.clearInterval(this.timer);
|
|
|
},
|
|
|
@@ -384,29 +397,6 @@
|
|
|
}
|
|
|
this.width = width + "px";
|
|
|
},
|
|
|
- matchPromise(row) {
|
|
|
- let {type,name} = row;
|
|
|
- let isMatch = false
|
|
|
- for (let i in this.promiseList) {
|
|
|
- let item = this.promiseList[i];
|
|
|
- if (name == item.type || item.type == type) {
|
|
|
- this.promise = Object.assign(this.promise, item);
|
|
|
- console.log("promise", this.promise);
|
|
|
- isMatch = true
|
|
|
- } else if (!isMatch && item.type == '默认类型') {
|
|
|
- this.promise = Object.assign(this.promise, item);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- matchType(type) {
|
|
|
- for (let i in this.typeList) {
|
|
|
- let item = this.typeList[i];
|
|
|
- if(item.name == type) {
|
|
|
- this.typeInfo = Object.assign(this.typeInfo, item);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
initTimer() {
|
|
|
if (this.timer) window.clearInterval(this.timer);
|
|
|
this.tickCount = 0;
|
|
|
@@ -433,24 +423,38 @@
|
|
|
});
|
|
|
},
|
|
|
generatePayQrcode() {
|
|
|
+ console.log('generatePayQrcode')
|
|
|
let payType = this.buyForm.payType;
|
|
|
let apiName = payType === 'wx' ? "weixin.DoWxpay" : "weixin.DoaliPay";
|
|
|
-
|
|
|
+ let {
|
|
|
+ courseId,
|
|
|
+ courseName,
|
|
|
+ title,
|
|
|
+ email,
|
|
|
+ phone,
|
|
|
+ needInvoice,
|
|
|
+ invoiceType
|
|
|
+ } = this.buyForm;
|
|
|
let param = {
|
|
|
- courseId: this.buyForm.course_id,
|
|
|
- rzCode: this.buyForm.rzCode
|
|
|
+ courseId,
|
|
|
+ title,
|
|
|
+ phone,
|
|
|
+ email,
|
|
|
+ needInvoice,
|
|
|
+ invoiceType
|
|
|
};
|
|
|
httpServer(apiName, param).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- let { outTradeNo, showUrl } = res.data;
|
|
|
- this.outTradeNo = outTradeNo;
|
|
|
- if (payType === 'wx') {
|
|
|
- this.wxPayUrl = showUrl;
|
|
|
- } else {
|
|
|
- this.aliPayUrl = showUrl;
|
|
|
- }
|
|
|
- this.initTimer();
|
|
|
+ if (res.code != 200) return;
|
|
|
+ let { outTradeNo, showUrl } = res.data;
|
|
|
+ this.outTradeNo = outTradeNo;
|
|
|
+ if (payType === 'wx') {
|
|
|
+ this.wxPayUrl = showUrl;
|
|
|
+ } else {
|
|
|
+ this.aliPayUrl = showUrl;
|
|
|
}
|
|
|
+ this.showPay = true
|
|
|
+ this.initTimer();
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
getData() {
|
|
|
@@ -485,9 +489,9 @@
|
|
|
},
|
|
|
cancelBuyCourse() {
|
|
|
if (this.timer) window.clearInterval(this.timer);
|
|
|
- this.$refs["elForm"].resetFields();
|
|
|
+ this.$refs["elForm"] && this.$refs["elForm"].resetFields();
|
|
|
this.buyCourseDialog = false
|
|
|
- this.commitmentDialog = false;
|
|
|
+ this.showPay = false;
|
|
|
},
|
|
|
openShowAllRzcodeDialog() {
|
|
|
this.showAllRzcodeDialog = true;
|
|
|
@@ -496,101 +500,24 @@
|
|
|
this.buyForm.rzCode = row.certificateNum;
|
|
|
this.showAllRzcodeDialog = false;
|
|
|
},
|
|
|
- buyCourse() {
|
|
|
- this.$refs["elForm"].validate((valid) => {
|
|
|
- if (!valid) return;
|
|
|
- let {
|
|
|
- marks,
|
|
|
- company,
|
|
|
- payNo,
|
|
|
- course_id,
|
|
|
- courseName,
|
|
|
- rzCode,
|
|
|
- name,
|
|
|
- email,
|
|
|
- buyImg
|
|
|
- } = this.buyForm;
|
|
|
- if (courseName != name) {
|
|
|
- this.$message.errorMsg("报考岗位有误", 1)
|
|
|
- return;
|
|
|
- }
|
|
|
- let param = {
|
|
|
- marks,
|
|
|
- payNo,
|
|
|
- company,
|
|
|
- courseId: course_id,
|
|
|
- courseName,
|
|
|
- rzCode,
|
|
|
- email,
|
|
|
- buyImg
|
|
|
- }
|
|
|
- httpServer("course.buyCourse", param).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.successMsg("申请购买成功", 1);
|
|
|
- this.buyForm.temp.marks = this.buyForm.marks
|
|
|
- Object.assign(this.buyForm.temp, param);
|
|
|
- this.$refs["elForm"].resetFields();
|
|
|
- this.buyForm.temp.is_pay = 0
|
|
|
- this.buyCourseDialog = false;
|
|
|
- this.commitmentDialog = false;
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- },
|
|
|
gotoDetail(courseId) {
|
|
|
this.$router.push(`/main/course/${courseId}`);
|
|
|
},
|
|
|
- uploadBuyImg(url) {
|
|
|
- this.buyForm.buyImg = url;
|
|
|
- },
|
|
|
- testBuyOK(item) {
|
|
|
- this.stage = 2;
|
|
|
- this.isCompanyPay = 1;
|
|
|
- this.isCommitment = ''
|
|
|
- this.buyForm.rzCode = item.rzCode;
|
|
|
- this.buyForm.company = 'ssss';
|
|
|
- this.buyForm.name = item.courseName;
|
|
|
- // let isEdu = this.hasPromise(item.type);
|
|
|
- if (this.promise.status == 1) {
|
|
|
- this.commitmentDialog = true;
|
|
|
- this.buyCourseDialog = false;
|
|
|
- } else {
|
|
|
- this.buyCourseDialog = true;
|
|
|
- this.commitmentDialog = false;
|
|
|
- }
|
|
|
- // if( isEdu || this.hasNotice() ){
|
|
|
- // this.buyCourseDialog = false;
|
|
|
- // this.commitmentDialog = true;
|
|
|
- // }else{
|
|
|
- // this.buyCourseDialog = true;
|
|
|
- // this.commitmentDialog = false;
|
|
|
- // }
|
|
|
- },
|
|
|
goPay(item) {
|
|
|
+ this.showPay = false;
|
|
|
this.buyForm = Object.assign(this.buyForm, item)
|
|
|
- this.buyForm.company = this.userInfo.company;
|
|
|
+ this.buyForm.phone = this.userInfo.phone;
|
|
|
this.buyForm.temp = item;
|
|
|
this.buyForm.courseName = item.name;
|
|
|
- this.buyForm.course_id = item.course_id;
|
|
|
+ this.buyForm.courseId = item.course_id;
|
|
|
this.buyForm.fee = item.fee;
|
|
|
- this.matchType(item.type)
|
|
|
// 检查
|
|
|
httpServer("weixin.docheckpay", {
|
|
|
courseId: item.course_id
|
|
|
}).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.stage = 2;
|
|
|
- this.isCompanyPay = 0;
|
|
|
- this.isCommitment = ''
|
|
|
- Object.assign(this.buyForm, res.data);
|
|
|
- this.buyCourseDialog = true;
|
|
|
- this.commitmentDialog = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.generatePayQrcode();
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg || "无法购买该课程");
|
|
|
- }
|
|
|
+ if (res.code != 200) return;
|
|
|
+ Object.assign(this.buyForm, res.data);
|
|
|
+ this.buyCourseDialog = true;
|
|
|
});
|
|
|
},
|
|
|
gotoPlay(item) {
|
|
|
@@ -599,7 +526,7 @@
|
|
|
this.$message.warning("还未到学习时间");
|
|
|
return
|
|
|
}
|
|
|
- this.$router.push(`/center/class/train`);
|
|
|
+ this.$router.push({name:'play', params:{courseId}})
|
|
|
},
|
|
|
handleCurrentChange(page) {
|
|
|
this.page = page;
|