|
@@ -10,9 +10,12 @@
|
|
|
:size="'mini'"
|
|
|
>
|
|
|
<el-row>
|
|
|
- <el-col :span="12"
|
|
|
+ <el-col :span="24"
|
|
|
><el-form-item label="售价凭证类型" prop="proof_type">
|
|
|
- <el-radio-group v-model="ruleForm.proof_type">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="ruleForm.proof_type"
|
|
|
+ @change="set_proof_url()"
|
|
|
+ >
|
|
|
<el-radio
|
|
|
v-for="item in options"
|
|
|
:key="item.value"
|
|
@@ -20,21 +23,75 @@
|
|
|
>{{ item.label }}</el-radio
|
|
|
>
|
|
|
</el-radio-group>
|
|
|
+ <el-button class="fr" type="primary" @click="showVoucher = true"
|
|
|
+ >查看历史凭证</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <show-voucher-model
|
|
|
+ :showModel="showVoucher"
|
|
|
+ :id="id"
|
|
|
+ @cancel="showVoucher = false"
|
|
|
+ />
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <el-col :span="24">
|
|
|
<el-form-item label="凭证文件" prop="proof_url">
|
|
|
<ul class="shangchuan-ul">
|
|
|
- <li v-if="ruleForm.proof_type === '1'" class="shiping">暂无接口</li>
|
|
|
- <li v-if="ruleForm.proof_type === '2'" class="tupian">
|
|
|
- <div class="activity-upload">
|
|
|
+ <li v-if="ruleForm.proof_type === '1'" class="shiping">
|
|
|
+ <div v-if="video_url" class="clearfix">
|
|
|
+ <video width="250" controls class="fl">
|
|
|
+ <source :src="video_url" type="video/mp4" />
|
|
|
+ <source :src="video_url" type="video/avi" />
|
|
|
+ 您的浏览器不支持Video标签。
|
|
|
+ </video>
|
|
|
+ <el-link
|
|
|
+ :underline="false"
|
|
|
+ @click="deleteUrl('1')"
|
|
|
+ type="warning"
|
|
|
+ style="margin: 0 0 0 16px"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="activity-upload" v-else>
|
|
|
<div class="btnupload" style="position: relative">
|
|
|
- <img
|
|
|
- v-if="ruleForm.proof_url"
|
|
|
- :src="ruleForm.proof_url"
|
|
|
- class="avatar"
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ <video-upload
|
|
|
+ class="Upload"
|
|
|
+ :disabled="type === 'view' || type === 'editCoin'"
|
|
|
+ :accept="'.mp4,.avi'"
|
|
|
+ :multiple="false"
|
|
|
+ :uploadcondition="beforeVideoUpload"
|
|
|
+ @UploadErrorEvent="UploadVideoEventproof_url"
|
|
|
+ @UploadSuccessEvent="UploadSuccessVideoproof_url"
|
|
|
/>
|
|
|
- <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="txt-tips fl">
|
|
|
+ <p>建议大小:小于5MB</p>
|
|
|
+ <p>文件格式:.mp4,.avi</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <li v-if="ruleForm.proof_type === '2'" class="tupian">
|
|
|
+ <div v-if="img_url" class="clearfix">
|
|
|
+ <img
|
|
|
+ style="width: 102px; height: 102px"
|
|
|
+ :src="img_url"
|
|
|
+ class="avatar fl"
|
|
|
+ />
|
|
|
+ <el-link
|
|
|
+ :underline="false"
|
|
|
+ @click="deleteUrl('2')"
|
|
|
+ type="warning"
|
|
|
+ style="margin: 0 0 0 16px"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="activity-upload" v-else>
|
|
|
+ <div class="btnupload" style="position: relative">
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
<file-upload
|
|
|
class="Upload"
|
|
|
:disabled="type === 'view' || type === 'editCoin'"
|
|
@@ -49,10 +106,39 @@
|
|
|
<p>建议大小:小于1MB</p>
|
|
|
<p>文件格式:.jpg,.png,.jpeg</p>
|
|
|
</div>
|
|
|
- <div class="show-"></div>
|
|
|
</div>
|
|
|
</li>
|
|
|
- <li v-if="ruleForm.proof_type === '3'" class="qita">暂无接口</li>
|
|
|
+ <li v-if="ruleForm.proof_type === '3'" class="qita">
|
|
|
+ <div v-if="other_url" class="clearfix">
|
|
|
+ <a :href="other_url" download="凭证文件">点击下载</a>
|
|
|
+
|
|
|
+ <el-link
|
|
|
+ :underline="false"
|
|
|
+ @click="deleteUrl('3')"
|
|
|
+ type="warning"
|
|
|
+ style="margin: 0 0 0 16px"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="activity-upload" v-else>
|
|
|
+ <div class="btnupload" style="position: relative">
|
|
|
+ <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ <file-upload-pdf
|
|
|
+ class="Upload"
|
|
|
+ :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
|
|
|
+ :multiple="false"
|
|
|
+ :uploadcondition="beforeOtherUpload"
|
|
|
+ @UploadErrorEvent="UploadErrorOtherproof_url"
|
|
|
+ @UploadSuccessEvent="UploadSuccessOtherproof_url"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="txt-tips fl">
|
|
|
+ <p>建议大小:小于5MB</p>
|
|
|
+ <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -121,11 +207,13 @@
|
|
|
<script>
|
|
|
import costFormAddEdit from "./costFormAddEdit";
|
|
|
import asyncRequest from "@/apis/service/goodStore/goodsOnline";
|
|
|
+import showVoucherModel from "@/components/show-voucher-model";
|
|
|
export default {
|
|
|
name: "exam-form",
|
|
|
props: ["size", "statusList", "disabled", "isMust", "labelWidth", "id"],
|
|
|
components: {
|
|
|
costFormAddEdit,
|
|
|
+ showVoucherModel,
|
|
|
},
|
|
|
/**
|
|
|
* 属性集合
|
|
@@ -143,6 +231,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ showVoucher: false,
|
|
|
+ video_url: "",
|
|
|
+ img_url: "",
|
|
|
+ other_url: "",
|
|
|
options: [
|
|
|
{
|
|
|
value: "1",
|
|
@@ -184,7 +276,7 @@ export default {
|
|
|
proof_url: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请上传",
|
|
|
+ message: "请上传凭证文件",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
@@ -327,8 +419,8 @@ export default {
|
|
|
if (url === "noToken") {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
- this.ruleForm.proof_url = url;
|
|
|
- this.$refs.ruleForm.validateField("proof_url");
|
|
|
+ this.img_url = url;
|
|
|
+ this.set_proof_url();
|
|
|
this.$message.success("图片上传成功!");
|
|
|
}
|
|
|
},
|
|
@@ -336,8 +428,8 @@ export default {
|
|
|
//图片上传失败
|
|
|
UploadErrorEventproof_url(res) {
|
|
|
if (res !== "break") {
|
|
|
+ this.set_proof_url();
|
|
|
this.$message.error("图片上传失败!");
|
|
|
- this.$refs.ruleForm.validateField("proof_url");
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -360,6 +452,125 @@ export default {
|
|
|
}
|
|
|
return isJPG && isLt2M;
|
|
|
},
|
|
|
+
|
|
|
+ //视频上传成功
|
|
|
+ async UploadSuccessVideoproof_url(data) {
|
|
|
+ const { url } = data;
|
|
|
+ if (url === "noToken") {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.video_url = url;
|
|
|
+ this.set_proof_url();
|
|
|
+ this.$message.success("视频上传成功!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //视频上传失败
|
|
|
+ UploadErrorVideoproof_url(res) {
|
|
|
+ if (res !== "break") {
|
|
|
+ this.set_proof_url();
|
|
|
+ this.$message.error("视频上传失败!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //判断视频规格
|
|
|
+ beforeVideoUpload(file) {
|
|
|
+ let isJPG = false;
|
|
|
+ if (file.type === "video/mp4" || file.type === "video/avi") {
|
|
|
+ isJPG = true;
|
|
|
+ }
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 5;
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("视频格式不正确!");
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("视频大小不能超过 5MB!");
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 其他文件上传成功
|
|
|
+ async UploadSuccessOtherproof_url(data) {
|
|
|
+ const { url } = data;
|
|
|
+ if (url === "noToken") {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.other_url = url;
|
|
|
+ this.set_proof_url();
|
|
|
+ this.$message.success("文件成功!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //其他文件上传失败
|
|
|
+ UploadErrorOtherproof_url(res) {
|
|
|
+ if (res !== "break") {
|
|
|
+ this.set_proof_url();
|
|
|
+ this.$message.error("文件上传失败!");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ //判断其他文件规格
|
|
|
+ beforeOtherUpload(file) {
|
|
|
+ console.log(file);
|
|
|
+ let isJPG = false;
|
|
|
+ if (
|
|
|
+ file.type === "application/vnd.ms-excel" ||
|
|
|
+ file.type ===
|
|
|
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
|
|
|
+ file.type === "application/pdf" ||
|
|
|
+ file.type === "application/x-zip-compressed"
|
|
|
+ ) {
|
|
|
+ isJPG = true;
|
|
|
+ }
|
|
|
+ let name = file.name;
|
|
|
+ let list = name.split(".");
|
|
|
+ if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
|
|
|
+ isJPG = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 5;
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error("文件格式不正确!");
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("文件大小不能超过 5MB!");
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
+
|
|
|
+ deleteUrl(type) {
|
|
|
+ switch (type) {
|
|
|
+ case "1":
|
|
|
+ this.video_url = "";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ this.img_url = "";
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ this.other_url = "";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this.video_url = "";
|
|
|
+ }
|
|
|
+ this.set_proof_url();
|
|
|
+ },
|
|
|
+ set_proof_url() {
|
|
|
+ const { proof_type } = this.ruleForm;
|
|
|
+ switch (proof_type) {
|
|
|
+ case "1":
|
|
|
+ this.ruleForm.proof_url = this.video_url;
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ this.ruleForm.proof_url = this.img_url;
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ this.ruleForm.proof_url = this.other_url;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ this.ruleForm.proof_url = this.video_url;
|
|
|
+ }
|
|
|
+ this.$refs.ruleForm.validateField("proof_url");
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|