123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <a-modal
- centered
- :footer="null"
- :maskClosable="false"
- class="allocateBill-print-type-modal"
- :title="modalTit"
- v-model="isShow"
- @cancel="isShow=false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="allocateBill-print-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item style="margin-bottom: 0;" label="调拨单号">{{ itemData&&itemData.allocateNo || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="调往对象">{{ itemData&&itemData.targetName || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="发货编号">{{ itemData&&itemData.sendNo || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="收货客户名称">{{ itemData&&itemData.receiverName || '--' }}</a-form-model-item>
- <a-form-model-item style="margin-bottom: 0;" label="产品分类" prop="id" v-if="nowType=='dbflPrint'">
- <a-select id="allocateBill-print-form" v-model="form.id" placeholder="请选择产品分类">
- <a-select-option v-for="item in typeList" :value="item.id" :key="item.id">
- <span v-if="item.id != 'all'">{{ item.productBrandName }} - {{ item.productTypeName3 }}</span>
- <span v-else>全部</span>
- </a-select-option>
- </a-select>
- </a-form-model-item>
- <a-form-model-item label="产品价格" prop="priceType" v-if="nowType=='dbPrint'">
- <a-radio-group v-model="form.priceType">
- <a-radio value="ALLOCATE_BILL_PRICE">销售价</a-radio>
- <a-radio value="ALLOCATE_BILL_COST">成本价</a-radio>
- <a-radio value="ALLOCATE_BILL">不打印</a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button id="allocateBill-print-close" @click="handleClose('preview')">取消</a-button>
- <a-button id="allocateBill-print-save" @click="handleSave('preview')" style="margin-left: 15px;">打印预览</a-button>
- <a-button type="primary" id="allocateBill-print-back" @click="handleSave('print')" style="margin-left: 15px;">确定打印</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { allocateBillProductTypeList } from '@/api/allocateBill'
- export default {
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- itemData: {
- type: Object,
- default: () => {
- return null
- }
- },
- nowType: {
- type: String,
- default: ''
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- form: {
- id: 'all',
- priceType: undefined
- },
- rules: {
- id: [{ required: true, message: '请选择产品分类', trigger: 'change' }],
- priceType: [{ required: true, message: '请选择产品价格', trigger: 'change' }]
- },
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 16 }
- },
- spinning: false,
- typeList: []
- }
- },
- computed: {
- modalTit () {
- let title = ''
- if (this.nowType == 'dbPrint') {
- title = '调拨打印'
- } else if (this.nowType == 'dbflPrint') {
- title = '调拨分类打印'
- }
- return title
- }
- },
- methods: {
- // 确认
- handleSave (type) {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- if (_this.nowType == 'dbflPrint') {
- const item = _this.typeList.find(item => item.id == _this.form.id)
- if (item) {
- const obj = {
- allocateSn: _this.itemData.allocateSn,
- allocateNo: _this.itemData.allocateNo,
- productBrandSn: item.productBrandSn,
- productTypeSn3: item.productTypeSn3,
- printType: 'ALLOCATE_BILL_TYPE',
- isPreview: type == 'preview' ? 1 : 0
- }
- _this.$emit('ok', obj)
- }
- } else {
- const obj = {
- allocateSn: _this.itemData.allocateSn,
- allocateNo: _this.itemData.allocateNo,
- printType: _this.form.priceType,
- isPreview: type == 'preview' ? 1 : 0
- }
- _this.$emit('ok', obj)
- }
- _this.isShow = false
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- // 获取该销售单产品二级分类
- getTypeData () {
- this.typeList = [{ id: 'all' }]
- allocateBillProductTypeList({ sn: this.itemData.allocateSn || null }).then(res => {
- if (res.status == 200) {
- if (res.data && res.data.length > 0) {
- this.typeList = [...this.typeList, ...res.data]
- }
- }
- })
- },
- handleClose () {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- this.form = {
- id: 'all',
- priceType: undefined
- }
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.handleClose()
- } else {
- if (this.nowType == 'dbflPrint') {
- this.getTypeData()
- }
- }
- }
- }
- }
- </script>
- <style lang="less">
- .allocateBill-print-type-modal{
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|