|
@@ -0,0 +1,108 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-dialog
|
|
|
+ title="标签打印"
|
|
|
+ width="70%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="visible">
|
|
|
+ <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="物料名称" prop="productName">
|
|
|
+ <el-input v-model="dataForm.productName" placeholder="物料名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 10px">
|
|
|
+ <el-form-item label="税率" prop="rate">
|
|
|
+ <el-input-number style="width: 160px" v-model="dataForm.rate" :step="1" :precision="1"/> %
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="含税单价" prop="price">
|
|
|
+ <el-input-number v-model="dataForm.price" :precision="1" :step="1" :min="1"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 10px">
|
|
|
+ <el-form-item label="数量" prop="cnt">
|
|
|
+ <el-input-number v-model="dataForm.cnt" :min="1" :step="1"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" style="padding-left: 10px">
|
|
|
+ <el-form-item label="含税总价" prop="amount">
|
|
|
+ <span>{{ (dataForm.cnt * dataForm.price).toFixed(1) }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-form-item label="备注" prop="notes">
|
|
|
+ <el-input type="textarea" v-model="dataForm.notes"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer">
|
|
|
+ <el-button @click="onChose">取消</el-button>
|
|
|
+ <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: 'print-label',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ isAdd: false,
|
|
|
+ dataForm: {
|
|
|
+ cnt: 1,
|
|
|
+ price: 1,
|
|
|
+ rate: 1
|
|
|
+ },
|
|
|
+ dataRule: {
|
|
|
+ productName: [{ required: true, message: '物料名称不能为空', trigger: 'blur' }],
|
|
|
+ cnt: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
|
|
|
+ price: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }],
|
|
|
+ rate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async init (row) {
|
|
|
+ this.visible = true
|
|
|
+ if (!row) {
|
|
|
+ this.isAdd = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.dataForm = row
|
|
|
+ },
|
|
|
+ validateField (type) {
|
|
|
+ this.$refs.dataForm.validateField(type)
|
|
|
+ },
|
|
|
+ onChose () {
|
|
|
+ this.visible = false
|
|
|
+ },
|
|
|
+ // 表单提交
|
|
|
+ dataFormSubmit () {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.isAdd === true) {
|
|
|
+ // console.log('1')
|
|
|
+ this.dataForm.productId = Math.round(Math.random() * 1000000)
|
|
|
+ }
|
|
|
+ // 计算含税总价
|
|
|
+ this.dataForm.amount = (this.dataForm.cnt * this.dataForm.price).toFixed(1)
|
|
|
+ this.onChose()
|
|
|
+ this.$emit('changeItem', this.dataForm)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|