apply-edit.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template id="apply-edit">
  2. <el-dialog :visible.sync="edit.visible" width="20%" title="分销商审核">
  3. <div>
  4. <el-form @submit.native.prevent size="small" label-width="150px">
  5. <el-form-item label="审核状态" prop="status">
  6. <el-radio-group v-model="status">
  7. <el-radio :label="1">通过</el-radio>
  8. <el-radio :label="2">不通过</el-radio>
  9. </el-radio-group>
  10. </el-form-item>
  11. </el-form>
  12. <el-form @submit.native.prevent size="small" label-width="150px">
  13. <el-form-item label="审核备注" prop="marks">
  14. <el-input type="textarea"
  15. :rows="4"
  16. placeholder="备注"
  17. v-model="marks">
  18. </el-input>
  19. </el-form-item>
  20. </el-form>
  21. </div>
  22. <span slot="footer" class="dialog-footer">
  23. <el-button @click="editCancel" type="default" size="small">取消</el-button>
  24. <el-button type="primary" :loading="edit.btnLoading" style="margin-bottom: 10px;" size="small"
  25. @click="editSave">保存</el-button>
  26. </span>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. Vue.component('apply-edit', {
  31. template: '#apply-edit',
  32. props: {
  33. value: {
  34. type: Boolean,
  35. default: false,
  36. },
  37. row: {
  38. type: Object,
  39. default: null,
  40. },
  41. },
  42. data() {
  43. return {
  44. edit: {
  45. visible: false,
  46. keyword: '',
  47. nickname: '',
  48. id: '',
  49. btnLoading: false,
  50. },
  51. status:'',
  52. marks:'',
  53. user_id: 0,
  54. apply_id:0,
  55. props: {
  56. value: 'id',
  57. label: 'name',
  58. children: 'list'
  59. },
  60. }
  61. },
  62. watch: {
  63. value() {
  64. if (this.value) {
  65. this.user_id = this.row.user_id;
  66. this.apply_id = this.row.id;
  67. this.edit.visible = true;
  68. }
  69. },
  70. 'edit.visible'() {
  71. if (!this.edit.visible) {
  72. this.editCancel();
  73. }
  74. }
  75. },
  76. created() {
  77. },
  78. methods: {
  79. editCancel() {
  80. this.$emit('input', false);
  81. navigateTo({
  82. r: 'distribution/audit/apply',
  83. })
  84. },
  85. editSave() {
  86. this.edit.btnLoading = true;
  87. if (this.user_id == 0) {
  88. this.$message.error('请确定用户信息');
  89. return;
  90. }
  91. if (!this.status) {
  92. this.$message.error('请选择是否审核通过');
  93. return false;
  94. }
  95. request({
  96. params: {
  97. r: 'distribution/audit/edit',
  98. },
  99. method: 'post',
  100. data: {
  101. id: this.user_id,
  102. level: this.level,
  103. apply_id:this.apply_id,
  104. apply_marks:this.marks,
  105. apply_status:this.status
  106. }
  107. }).then(response => {
  108. this.edit.btnLoading = false;
  109. if (response.data.code == 0) {
  110. this.$message.success('添加成功');
  111. this.editCancel();
  112. } else {
  113. this.$message.error(response.data.msg);
  114. }
  115. }).catch(response => {
  116. this.edit.btnLoading = false;
  117. });
  118. }
  119. }
  120. });
  121. </script>