|
|
@ -38,7 +38,7 @@ |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="fileName" label="防伪码"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a :href="BASE_URL + scope.row.downloadUrl"><el-button type="text">{{scope.row.fileName}}</el-button></a> |
|
|
|
<el-button type="text" @click="downLoadFile(scope.row.fetchId)">{{scope.row.fileName}}</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" width="250"> |
|
|
@ -59,29 +59,67 @@ |
|
|
|
layout="total, prev, pager, next, sizes, jumper" |
|
|
|
:total="total"> |
|
|
|
</el-pagination> |
|
|
|
|
|
|
|
<el-dialog title="发码" :visible.sync="dialogDownloadVisible" width="500px" :close-on-click-modal='false'> |
|
|
|
<el-form :model="form" :rules="rules" ref="form"> |
|
|
|
<el-form-item label="手机号:" :label-width="formLabelWidth" prop="telPhone" ref="telPhone"> |
|
|
|
<el-input v-model.number="form.telPhone" maxlength="11" autocomplete="off" size="small"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="短信验证码:" :label-width="formLabelWidth" prop="vCode"> |
|
|
|
<el-input v-model.number="form.vCode" autocomplete="off" size="small" style="width:110px;margin-right:5px;"></el-input> |
|
|
|
<el-button type="danger" style="width:100px;" size="small" @click="getSendMessage" :disabled="sendStatus">{{!sendStatus?'获取验证码':timer+'秒'}}</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" size="mini" @click="submitForm('form')">保存</el-button> |
|
|
|
<el-button type="info" size="mini" @click="resetForm('form')">取消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { |
|
|
|
getFetchList,generateFetch |
|
|
|
getFetchList,generateFetch,sendMessage,getDownloadUrl |
|
|
|
} from "@/api/get" |
|
|
|
import {validatePhone} from "@/utils/validate" |
|
|
|
export default { |
|
|
|
name: "getGet", |
|
|
|
data() { |
|
|
|
|
|
|
|
const checkPhoneNum = (rule, value, callback) => { |
|
|
|
if (!validatePhone(value)) { |
|
|
|
return callback(new Error('请输入正确的手机号码')); |
|
|
|
} else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}; |
|
|
|
return { |
|
|
|
BASE_URL:config.API_URL, |
|
|
|
formSearch: {//模糊搜索 |
|
|
|
time: '', |
|
|
|
number: '', |
|
|
|
}, |
|
|
|
form:{ |
|
|
|
telPhone:'', |
|
|
|
vCode:'' |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
telPhone: [ |
|
|
|
{ required: true, message: '请输入手机号', trigger: 'blur' }, |
|
|
|
{validator:checkPhoneNum,trigger:"blur"} |
|
|
|
], |
|
|
|
vCode: [ |
|
|
|
{ required: true, message: '请输入短信验证码', trigger: 'blur' } |
|
|
|
] |
|
|
|
}, |
|
|
|
currentPage: 1, //当前页 |
|
|
|
pageSize: 10, //每页条数 |
|
|
|
total: 0, //总条数 |
|
|
|
tableData: [ |
|
|
|
|
|
|
|
], //表格数据 |
|
|
|
tableData: [], //表格数据 |
|
|
|
formLabelWidth:'120px', |
|
|
|
dialogDownloadVisible:false, |
|
|
|
sendStatus:false, |
|
|
|
timer:60, |
|
|
|
fetchId:'', |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
@ -108,6 +146,58 @@ export default { |
|
|
|
this.total = res.data.count |
|
|
|
}) |
|
|
|
}, |
|
|
|
downLoadFile(id){ |
|
|
|
this.dialogDownloadVisible = true |
|
|
|
this.fetchId = id |
|
|
|
}, |
|
|
|
getSendMessage(){ |
|
|
|
this.$refs['form'].validateField('telPhone',(valid) => { |
|
|
|
if (valid) { |
|
|
|
console.log('telPhone error'); |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
sendMessage({phone:this.form.telPhone+''}).then(res => { |
|
|
|
this.$message({ |
|
|
|
message: res.msg, |
|
|
|
type: 'success' |
|
|
|
}); |
|
|
|
this.timer = 60 |
|
|
|
this.sendStatus = true |
|
|
|
var flag = setInterval(() =>{ |
|
|
|
if(this.timer == 0) |
|
|
|
{ |
|
|
|
clearInterval(flag) |
|
|
|
this.sendStatus = false |
|
|
|
} else { |
|
|
|
this.timer-- |
|
|
|
} |
|
|
|
},1000) |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
submitForm(formName) { |
|
|
|
this.$refs[formName].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
const param ={ |
|
|
|
fetch_id:this.fetchId, |
|
|
|
phone:this.form.telPhone+'', |
|
|
|
verify_code:this.form.vCode+'' |
|
|
|
} |
|
|
|
getDownloadUrl(param).then(res => { |
|
|
|
window.location.href = this.BASE_URL + res.data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('error submit!!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
resetForm(formName) { |
|
|
|
this.$refs[formName].resetFields(); |
|
|
|
this.dialogDownloadVisible = false |
|
|
|
}, |
|
|
|
confirm(id){ |
|
|
|
this.$confirm('此操作将生成防伪码印刷文件, 是否继续?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|