order-amount-mask-setting.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <div class="my-title">订单金额屏蔽设置</div>
  4. <!-- 表单 -->
  5. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  6. <el-row class="my-row">
  7. <el-form-item label="屏蔽人" prop="userIds">
  8. <user-components v-model="dataForm.userIds" :userIds.sync="dataForm.userIds" @change="userSelectedChanged"/>
  9. </el-form-item>
  10. </el-row>
  11. </el-form>
  12. <span slot="footer" class="dialog-footer">
  13. <el-button @click="onChose">取消</el-button>
  14. <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
  15. </span>
  16. </div>
  17. </template>
  18. <script>
  19. import UserComponents from '../common/user-components'
  20. export default {
  21. name: 'order-amount-mask-setting',
  22. components: {
  23. UserComponents
  24. },
  25. data () {
  26. return {
  27. visible: false,
  28. dataForm: {
  29. userIds: []
  30. },
  31. dataRule: {
  32. userIds: [{ required: true, message: '请选择需屏蔽的人', trigger: 'change' }]
  33. }
  34. }
  35. },
  36. methods: {
  37. onChose () {
  38. this.$emit('onChose')
  39. },
  40. async init () {
  41. this.dataForm = {}
  42. this.$http({
  43. url: this.$http.adornUrl(`/biz-service/order/priceConfig`),
  44. method: 'get'
  45. }).then(({data}) => {
  46. if (data && data.code === '200') {
  47. this.dataForm = {
  48. userIds: data.data
  49. }
  50. }
  51. })
  52. this.visible = true
  53. },
  54. validateField (type) {
  55. this.$refs.dataForm.validateField(type)
  56. },
  57. // 表单提交
  58. dataFormSubmit () {
  59. this.$refs['dataForm'].validate((valid) => {
  60. if (valid) {
  61. this.$http({
  62. url: this.$http.adornUrl(`/biz-service/order/priceConfig`),
  63. method: 'post',
  64. data: this.dataForm.userIds
  65. }).then(({data}) => {
  66. if (data && data.code === '200') {
  67. this.$message({
  68. message: '操作成功',
  69. type: 'success',
  70. duration: 1500,
  71. onClose: () => {
  72. this.onChose()
  73. }
  74. })
  75. } else {
  76. this.$message.error(data.msg)
  77. }
  78. })
  79. }
  80. })
  81. },
  82. userSelectedChanged (val) {
  83. this.dataForm.userIds = val
  84. }
  85. }
  86. }
  87. </script>
  88. <style scoped>
  89. </style>