123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <a-modal
- centered
- class="modalBox"
- :footer="null"
- :maskClosable="false"
- title="物流信息"
- v-model="isShow"
- @cancle="isShow=false"
- :width="1000">
- <a-form
- id="logistics-form"
- :form="form"
- ref="form"
- v-bind="formItemLayout"
- @submit="handleSubmit">
- <a-form-item label="快递公司" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-select
- id="logistics-expressName"
- allowClear
- v-decorator="[
- 'formData.expressName',
- { initialValue: formData.expressName,
- rules: [{ required: true, message: '请选择快递公司' }] },
- ]"
- placeholder="请选择快递公司"
- >
- <a-select-option v-for="(item,index) in expressCompany" :key="index" :value="item.expressName">
- {{ item.expressName }}
- </a-select-option>
- </a-select>
- </a-form-item>
- <a-form-item label="运单编号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
- <a-input
- id="logistics-expressNum"
- :maxLength="30"
- v-decorator="[
- 'formData.expressNum',
- { initialValue: formData.expressNum, getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入运单编号' }] }
- ]"
- placeholder="请输入运单编号(最多30个字符)"
- allowClear />
- </a-form-item>
- <a-form-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
- <a-button type="primary" html-type="submit" id="logistics-submit" style="margin-right: 15px">保存</a-button>
- <a-button @click="isShow=false" style="margin-left: 15px" id="logistics-close">取消</a-button>
- </a-form-item>
- </a-form>
- </a-modal>
- </template>
- <script>
- import { VSelect } from '@/components'
- import { expressCompanyQuery } from '@/api/order'
- export default {
- name: 'GoodsLogistics',
- components: { VSelect },
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- }
- },
- data () {
- return {
- form: this.$form.createForm(this),
- formItemLayout: {
- labelCol: { span: 4 },
- wrapperCol: { span: 16 }
- },
- formData: {
- expressName: undefined, // 快递公司
- expressNum: '' // 运单编号
- },
- isShow: this.openModal, // 是否填写物流信息
- expressCompany: [] // 快递公司
- }
- },
- mounted () {
- this.getExpressCompany()
- },
- methods: {
- // 物流信息 保存
- handleSubmit (e) {
- e.preventDefault()
- this.form.validateFields((err, values) => {
- if (!err) {
- this.$emit('submit', values.formData)
- }
- })
- },
- // 获取快递公司
- getExpressCompany () {
- expressCompanyQuery({}).then(res => {
- if (res.status == 200) {
- this.expressCompany = res.data
- } else {
- this.expressCompany = []
- }
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (val) {
- if (!val) {
- this.$emit('close')
- } else {
- this.form.resetFields()
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- </style>
|