dsModal.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <a-modal
  3. centered
  4. class="dealerAccountEdit-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="下推销售单"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="800">
  11. <!-- 表单 -->
  12. <div>
  13. <a-spin :spinning="spinning" tip="Loading...">
  14. <a-form-model
  15. id="dealerAccountEdit-form"
  16. ref="ruleForm"
  17. :model="form"
  18. :rules="rules"
  19. :label-col="formItemLayout.labelCol"
  20. :wrapper-col="formItemLayout.wrapperCol"
  21. >
  22. <a-form-model-item label="客户名称">
  23. <span>{{ detailData ? detailData.buyerName : '--' }}</span>
  24. </a-form-model-item>
  25. <a-form-model-item label="收货客户名称" extra="如果收货客户和下单客户相同,则不需要选择收货客户名称">
  26. <dealerSubareaScopeList ref="dealerSubareaScopeList" defValKey="buyerSn" @change="custChange" v-model="form.receiverSn" />
  27. </a-form-model-item>
  28. <a-form-model-item label="发货编号" prop="sendNo">
  29. <a-input
  30. id="dealerAccountEdit-phone"
  31. :maxLength="30"
  32. v-model.trim="form.sendNo"
  33. placeholder="请输入发货编号"
  34. allowClear />
  35. <div style="height: 24px;line-height: normal;">
  36. 常用:<a-button size="small" v-for="i in 5" @click="setSendNo(i)" type="link">{{ i }}</a-button>
  37. </div>
  38. </a-form-model-item>
  39. <a-form-model-item label="备货打印" prop="printStatus">
  40. <a-radio-group v-model="form.printStatus">
  41. <a-radio value="NO_PRINT">
  42. 允许打印
  43. </a-radio>
  44. <a-radio value="UNABLE_PRINT">
  45. 暂不打印
  46. </a-radio>
  47. </a-radio-group>
  48. </a-form-model-item>
  49. </a-form-model>
  50. <div class="btn-cont">
  51. <a-button id="dealerAccountEdit-back" @click="isShow = false">取消下推</a-button>
  52. <a-button type="primary" id="dealerAccountEdit-save" @click="handleSave" style="margin-left: 15px;">确定下推</a-button>
  53. </div>
  54. </a-spin>
  55. </div>
  56. </a-modal>
  57. </template>
  58. <script>
  59. import { commonMixin } from '@/utils/mixin'
  60. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  61. export default {
  62. name: 'DsModal',
  63. mixins: [commonMixin],
  64. components: { dealerSubareaScopeList },
  65. props: {
  66. openModal: { // 弹框显示状态
  67. type: Boolean,
  68. default: false
  69. }
  70. },
  71. data () {
  72. return {
  73. isShow: this.openModal, // 是否打开弹框
  74. spinning: false,
  75. formItemLayout: {
  76. labelCol: { span: 4 },
  77. wrapperCol: { span: 18 }
  78. },
  79. form: {
  80. sendNo: '',
  81. printStatus: undefined,
  82. buyerName: '',
  83. receiverSn: '',
  84. receiverName: ''
  85. },
  86. rules: {
  87. sendNo: [{ required: true, message: '请输入发货编号', trigger: 'change' }],
  88. printStatus: [{ required: true, message: '请选择备货打印', trigger: 'change' }]
  89. },
  90. detailData: null // 详情数据
  91. }
  92. },
  93. methods: {
  94. setSendNo (i) {
  95. this.form.sendNo = i
  96. this.$refs.ruleForm.validateField('sendNo')
  97. },
  98. custChange (val) {
  99. this.form.receiverSn = val.key || ''
  100. this.form.receiverName = val.name || ''
  101. },
  102. // 保存
  103. handleSave () {
  104. const _this = this
  105. _this.$refs.ruleForm.validate(valid => {
  106. if (valid) {
  107. const formData = JSON.parse(JSON.stringify(_this.form))
  108. _this.$emit('ok', formData)
  109. _this.isShow = false
  110. } else {
  111. return false
  112. }
  113. })
  114. },
  115. // 获取详情
  116. setDetail (data) {
  117. this.detailData = data
  118. },
  119. // 重置表单
  120. resetForm () {
  121. this.detailData = null
  122. this.$refs.ruleForm.resetFields()
  123. this.form = {
  124. sendNo: '',
  125. printStatus: undefined,
  126. buyerName: '',
  127. receiverSn: '',
  128. receiverName: ''
  129. }
  130. this.$refs.dealerSubareaScopeList.resetForm()
  131. }
  132. },
  133. watch: {
  134. // 父页面传过来的弹框状态
  135. openModal (newValue, oldValue) {
  136. this.isShow = newValue
  137. },
  138. // 重定义的弹框状态
  139. isShow (newValue, oldValue) {
  140. if (!newValue) {
  141. this.$emit('close')
  142. this.resetForm()
  143. }
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="less">
  149. .dealerAccountEdit-modal{
  150. .ant-modal-body {
  151. padding: 40px 40px 24px;
  152. }
  153. .btn-cont {
  154. text-align: center;
  155. margin: 35px 0 10px;
  156. }
  157. }
  158. </style>