order-amount-mask-setting.vue 2.5 KB

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