<template>
<div class="codeExtract">
<navbar :name="name"/>
<!-- 提取码打印-->
<div class="box flex-center">
<div class="main">
<!-- <div class="tit">取件码提取打印</div>-->
<div class="flex-center">
<input v-model="qjmData" class="myInput" disabled maxlength="6" placeholder="请输入6位取件码" type="text">
</div>
<div class="numjp flex-between">
<div v-for="item in numL" :key="item" class="li flex-center" @click="onImport(item)">{{ item }}</div>
</div>
<div class="btn flex-center" @click="open()">提取打印</div>
</div>
<div class="tip">
<div class="title">温馨提示</div>
<div class="content">
请在左边的取件码输入框中输入需要打印订单的取件码,然后点按下面的“提取打印”按钮开始打印。取件码可从小程序的个人中心-打印记录中对应的打印订单信息中获取。取件码作为取件一次性使用有效,如无法提取打印时,请核对改取件码是否已经使用过并已失效。
</div>
</div>
</div>
</div>
</template>
<script>
import navbar from '@/components/nav'
import {orderSubmitPrintingTask} from "@/api/resultApi";
import alert from "@/utils/alert";
export default {
name: 'codeExtract',
components: {
navbar
},
provide() {
return {
title: this.tit,
type: this.name
}
},
data() {
return {
tit: '取件码打印',
name: '取件码打印',
qjmData: '',
numL: [1, 2, 3, 4, 5, 6, 7, 8, 9, '清除', '0', '删除']
}
},
methods: {
onImport(num) {
let _this = this
if (num === '清除') {
_this.qjmData = ''
return
} else if (num === '删除') {
_this.qjmData = _this.qjmData.slice(0, _this.qjmData.length - 1)
return
} else if (_this.qjmData.length > 5) {
return
}
_this.qjmData = _this.qjmData + num
},
open() {
let _this = this
let data = {
deviceCode: _this.cite.code,
pickupCode: _this.qjmData
}
if (_this.qjmData.length !== 6) {
this.cite.state = {
name: '请输入6位取件码!',
sta: true
}
return
}
orderSubmitPrintingTask(data).then(res => {
if(res.code) {
this.cite.state = {
name: res.msg,
sta: true
}
}else if (res === true) {
// _this.$router.push({
// name: 'complete',
// params: {
// name: _this.name
// }
// })
}
}).catch(error => {
alert(error, this)
})
}
}
}
</script>
<style lang="less" scoped>
@font-face {
font-family: 'STHeiti'; //自定义字体名字
src: url('../assets/typeface/STHeiti.ttf') format('truetype'); //定义好文件的相对地址
}
@font-face {
font-family: 'OCR'; //自定义字体名字
src: url('../assets/typeface/OCR-B-10-BT.ttf') format('truetype'); //定义好文件的相对地址
}
.codeExtract {
.box {
width: 114.06rem;
height: 42.13rem;
background: #ffffff;
box-shadow: 0rem 0.31rem 0.63rem 0.06rem rgba(0, 0, 0, 0.14);
border-radius: 1.63rem;
margin: 0 auto;
font-size: 2.25rem;
font-weight: bold;
color: #323232;
line-height: 3rem;
.main {
width: 32.6875rem;
margin-right: 18.75rem;
.myInput {
width: 100%;
padding: 0 1.5rem;
height: 5.625rem;
font-size: 1.875rem;
margin: 1.25rem 0 0;
border-radius: 1.25rem;
border: 0.0625rem solid #C9C7C0;
}
}
.tip {
width: 40rem;
.title {
font-size: 2.88rem;
font-weight: bold;
color: #d41212;
line-height: 4.06rem;
}
.content {
margin: 3rem auto;
text-align: center;
}
}
.btn {
width: 100%;
height: 5.5rem;
background: linear-gradient(132deg, #52a39d 0%, #a1c553 50%, #81d012 100%);
border-radius: 1.25rem;
font-size: 1.88rem;
font-weight: 400;
color: #ffffff;
line-height: 2.63rem;
cursor: pointer;
}
.numjp {
flex-wrap: wrap;
width: 25rem;
font-size: 1.75rem;
margin: 1.25rem auto 0.625rem;
.li {
width: 6.875rem;
height: 3.125rem;
margin-bottom: 1.25rem;
border: 0.0625rem solid #ccc;
border-radius: 0.625rem;
cursor: pointer;
}
}
}
}
</style>