123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <a-modal
- centered
- class="dealerAccountEdit-modal"
- :footer="null"
- :maskClosable="false"
- title="提交调拨单"
- v-model="isShow"
- @cancel="isShow=false"
- :width="800">
- <!-- 表单 -->
- <div>
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="dealerAccountEdit-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol"
- >
- <a-form-model-item label="收货客户名称" v-if="dealerLevel != 'OTHER'">
- <dealerSubareaScopeList ref="custList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
- </a-form-model-item>
- <a-form-model-item label="收货客户名称" v-else>
- <a-input
- id="dealerAccountEdit-receiverName"
- :maxLength="30"
- v-model.trim="form.receiverName"
- placeholder="请输入收货客户名称"
- allowClear />
- </a-form-model-item>
- <a-form-model-item label="发货编号" prop="sendNo">
- <a-input
- id="dealerAccountEdit-phone"
- :maxLength="10"
- v-model.trim="form.sendNo"
- placeholder="请输入发货编号"
- allowClear />
- <div style="height: 24px;line-height: normal;">
- 常用:<a-button size="small" v-for="i in 5" @click="setSendNo(i)" type="link">{{ i }}</a-button>
- </div>
- </a-form-model-item>
- <a-form-model-item label="发货说明">
- <a-input
- id="dealerAccountEdit-sendGoodsDesc"
- type="textarea"
- :maxLength="630"
- v-model.trim="form.sendGoodsDesc"
- placeholder="请输入发货说明"/>
- </a-form-model-item>
- <a-form-model-item label="备货打印" prop="printState">
- <a-radio-group v-model="form.printState">
- <a-radio value="NO_PRINT">
- 允许打印
- </a-radio>
- <a-radio value="UNABLE_PRINT">
- 暂不打印
- </a-radio>
- <a-radio value="CANCEL_PRINT">
- 取消打印
- </a-radio>
- </a-radio-group>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button type="primary" id="dealerAccountEdit-save" @click="handleSave">确定</a-button>
- <a-button id="dealerAccountEdit-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </div>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
- export default {
- name: 'DealerAccountEditModal',
- mixins: [commonMixin],
- components: { dealerSubareaScopeList },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- dealerLevel: {
- type: String,
- default: ''
- }
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- spinning: false,
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 18 }
- },
- form: {
- sendNo: '',
- printState: '',
- receiverSn: '',
- receiverName: '',
- sendGoodsDesc: ''
- },
- rules: {
- sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
- printState: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
- },
- detailData: null // 详情数据
- }
- },
- methods: {
- setSendNo (i) {
- this.form.sendNo = i
- this.$refs.ruleForm.validateField('sendNo')
- },
- custChange (val) {
- this.form.receiverSn = val.key || ''
- this.form.receiverName = val.name || ''
- },
- // 保存
- handleSave () {
- const _this = this
- _this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const formData = JSON.parse(JSON.stringify(_this.form))
- _this.$emit('ok', formData)
- } else {
- return false
- }
- })
- },
- // 获取详情
- setDetail (data) {
- this.detailData = data
- },
- // 重置表单
- resetForm () {
- this.detailData = null
- this.$refs.ruleForm.resetFields()
- this.form = {
- sendNo: '',
- printState: '',
- receiverSn: '',
- receiverName: ''
- }
- this.$refs.custList.resetForm()
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.resetForm()
- }
- },
- itemId (newValue, oldValue) {
- if (this.isShow && newValue) {
- this.getDetail()
- }
- }
- }
- }
- </script>
- <style lang="less">
- .dealerAccountEdit-modal{
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|