123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <a-modal
- centered
- class="shelfSet-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- title="新增回调单"
- v-model="isShow"
- @cancel="isShow = false"
- :width="600">
- <a-spin :spinning="spinning" tip="Loading...">
- <a-form-model
- id="shelfSet-basicInfo-form"
- ref="ruleForm"
- :model="form"
- :rules="rules"
- :label-col="formItemLayout.labelCol"
- :wrapper-col="formItemLayout.wrapperCol">
- <a-form-model-item label="货架名称" prop="shelfName">
- <shelfSList v-model="form.shelfName" @change="shelfChange"></shelfSList>
- </a-form-model-item>
- </a-form-model>
- <div class="btn-cont">
- <a-button type="primary" id="importGuide-nextStep" @click="handlerNextStep">下一步</a-button>
- <a-button id="shelfSet-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- <!-- 新增回调单(实现新增) -->
- <add-recall-bill-modal :openModal="showRecallBill" @close="showRecallBill=false"></add-recall-bill-modal>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { VSelect } from '@/components'
- import custList from '@/views/common/custList.vue'
- import shelfSList from '@/views/common/shelfList'
- import { shelfSave } from '@/api/shelf'
- import addRecallBillModal from './addRecallBillModal.vue'
- export default {
- name: 'ShelfSetBasicInfoModal',
- components: { VSelect, custList, shelfSList, addRecallBillModal },
- mixins: [commonMixin],
- props: {
- openModal: {
- // 弹框显示状态
- type: Boolean,
- default: false
- },
- nowData: {
- type: Object,
- default: () => {
- return {}
- }
- },
- type: {
- type: [String, Number],
- default: '1'
- }
- },
- data () {
- return {
- spinning: false,
- isShow: this.openModal, // 是否打开弹框
- formItemLayout: {
- labelCol: { span: 5 },
- wrapperCol: { span: 17 }
- },
- form: {
- shelfName: ''
- },
- rules: {
- shelfName: [{ required: true, message: '请选择货架名称', trigger: 'change' }]
- },
- showRecallBill: false
- }
- },
- methods: {
- shelfChange (v, row) {
- this.shelfName = row ? row.shelfName : ''
- },
- // 下一步 保存货架信息
- handlerNextStep () {
- this.showRecallBill = true
- },
- // 客户 change
- custChange (obj, row) {
- this.form.customerSn = row && row.customerSn || undefined
- },
- // 保存
- handleSave () {
- const _this = this
- this.$refs.ruleForm.validate(valid => {
- if (valid) {
- const form = JSON.parse(JSON.stringify(_this.form))
- form.shelfSn = _this.nowData && _this.nowData.shelfSn
- _this.spinning = true
- shelfSave(form).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- setTimeout(() => {
- _this.isShow = false
- _this.$emit('ok', res.data)
- _this.spinning = false
- }, 100)
- // 更新价格显示
- // updateShelfPriceShow({
- // shelfSn: form.shelfSn,
- // paramValue: form.showPrice
- // }).then(ret => {
- // if (ret.status == 200) {
- // _this.$message.success(ret.message)
- // setTimeout(() => {
- // _this.isShow = false
- // _this.$emit('ok', res.data)
- // _this.spinning = false
- // }, 100)
- // } else {
- // _this.spinning = false
- // }
- // })
- } else {
- _this.spinning = false
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.$refs.ruleForm.resetFields()
- // this.$refs.custList.resetForm()
- } else {
- // const _this = this
- // this.$nextTick(() => {
- // _this.form.shelfName = _this.nowData.shelfName
- // _this.form.showPrice = _this.nowData.showPrice
- // const custome = _this.nowData.customerEntity
- // if (custome) {
- // _this.form.customerSn = custome.customerSn || ''
- // _this.$refs.custList.fetchUser(custome.customerName || '')
- // _this.$refs.custList.dealerName = {
- // key: custome.customerSn,
- // label: custome.customerName,
- // row: _this.nowData
- // }
- // }
- // })
- }
- }
- }
- }
- </script>
- <style lang="less">
- .shelfSet-basicInfo-modal {
- .ant-modal-body {
- padding: 40px 40px 24px;
- }
- .ant-form-item{
- margin-bottom: 15px;
- }
- .btn-cont {
- text-align: center;
- margin: 35px 0 10px;
- }
- }
- </style>
|