updateDealerLevel.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <a-modal
  3. centered
  4. class="merchantInfoManagement-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. :title="title"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="600">
  11. <div>
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <a-form-model
  14. ref="ruleForm"
  15. :model="form"
  16. :rules="rules"
  17. :label-col="labelCol"
  18. :wrapper-col="wrapperCol"
  19. >
  20. <a-form-model-item label="商户名称">
  21. {{ form.dealerName }}
  22. </a-form-model-item>
  23. <a-form-model-item label="商户级别" prop="dealerLevel">
  24. <v-select code="DEALER_LEVEL" id="ucModal-dealerLevel" v-model="form.dealerLevel" allowClear placeholder="请选择商户级别"></v-select>
  25. </a-form-model-item>
  26. <div style="display: flex;justify-content: center;padding: 30px 0;">
  27. <a-button @click="cansel">取消</a-button>
  28. <a-button style="margin-left: 15px;" type="primary" @click="onSubmit">确定</a-button>
  29. </div>
  30. </a-form-model>
  31. </a-spin>
  32. </div>
  33. </a-modal>
  34. </template>
  35. <script>
  36. import { commonMixin } from '@/utils/mixin'
  37. import { VSelect } from '@/components'
  38. import { updateDealerLevel } from '@/api/dealer'
  39. export default {
  40. name: 'UpdateDealerLevel',
  41. mixins: [commonMixin],
  42. components: { VSelect },
  43. props: {
  44. openUdModal: { // 弹框显示状态
  45. type: Boolean,
  46. default: false
  47. }
  48. },
  49. data () {
  50. return {
  51. isShow: this.openUdModal, // 是否打开弹框
  52. spinning: false,
  53. title: '级别设置',
  54. labelCol: { span: 5 },
  55. wrapperCol: { span: 16 },
  56. other: '',
  57. form: {
  58. dealerName: '',
  59. dealerLevel: undefined
  60. },
  61. rules: {
  62. dealerLevel: [
  63. { required: true, message: '请选择商户级别', trigger: 'change' }
  64. ]
  65. },
  66. dealerLevelBak: undefined,
  67. isProvincialCustomers: ''
  68. }
  69. },
  70. methods: {
  71. setData (row) {
  72. this.form.dealerSn = row.dealerSn
  73. this.form.dealerName = row.dealerName
  74. this.form.dealerLevel = row.dealerLevel
  75. this.dealerLevelBak = row.dealerLevel
  76. this.isProvincialCustomers = row.serviceCenterSn ? '1' : '0'// 是否是省仓客户
  77. },
  78. onSubmit () {
  79. const _this = this
  80. this.$refs.ruleForm.validate(valid => {
  81. if (valid) {
  82. _this.submitForm()
  83. } else {
  84. return false
  85. }
  86. })
  87. },
  88. submitForm () {
  89. const _this = this
  90. const params = JSON.parse(JSON.stringify(_this.form))
  91. _this.spinning = true
  92. updateDealerLevel(params).then(res => {
  93. if (res.status == 200) {
  94. _this.$message.success(res.message)
  95. _this.$emit('ok')
  96. _this.spinning = false
  97. } else {
  98. _this.spinning = false
  99. }
  100. })
  101. },
  102. cansel () {
  103. this.$emit('close')
  104. this.$refs.ruleForm.resetFields()
  105. }
  106. },
  107. watch: {
  108. // 父页面传过来的弹框状态
  109. openUdModal (newValue, oldValue) {
  110. this.isShow = newValue
  111. },
  112. // 重定义的弹框状态
  113. isShow (newValue, oldValue) {
  114. if (!newValue) {
  115. this.$emit('close')
  116. }
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="less">
  122. .merchantInfoManagement-modal{
  123. .ant-modal-body {
  124. padding: 40px 40px 24px;
  125. }
  126. }
  127. </style>