企微助手 ,仓库名 短剧

resetReceiveDialog.vue 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <el-dialog
  3. :visible.sync="dialogVisible"
  4. :before-close="handleCancel"
  5. class="assign-dialog"
  6. title="重置客户消息接收状态"
  7. width="450px"
  8. >
  9. <div class="form-wrap" v-loading="loading">
  10. 重置后该客服下所有客户状态均变更为【可接收消息】<br/><br/>
  11. 后续根据群发结果重新判断客户可接收消息状态。
  12. </div>
  13. <div slot="footer" class="dialog-footer">
  14. <el-button size="mini" @click="handleCancel">取 消</el-button>
  15. <el-button size="mini" type="primary" @click="handleConfirm">确 定</el-button>
  16. </div>
  17. </el-dialog>
  18. </template>
  19. <script>
  20. export default {
  21. name: "resetReceiveDialog",
  22. props: {
  23. // 控制弹框是否显示
  24. dialogVisible: {
  25. type: Boolean,
  26. default: () => false
  27. },
  28. // 成员信息
  29. userInfo: {
  30. type: Object,
  31. default: () => ({
  32. user_id: '',
  33. name: '',
  34. })
  35. },
  36. },
  37. data() {
  38. return {
  39. loading: false,
  40. form: {
  41. corpid: '',
  42. userid: '',
  43. }
  44. }
  45. },
  46. watch: {
  47. dialogVisible(isShow) {
  48. if (isShow) {
  49. // 获取表单数据
  50. this.handleGetFormData()
  51. }
  52. },
  53. },
  54. methods: {
  55. // 获取弹框表单数据
  56. handleGetFormData() {
  57. const { user_id = '' } = this.userInfo
  58. this.form.user_id = user_id
  59. console.log(this.form.userid)
  60. },
  61. // 清空弹框表单数据
  62. handleClearFormData() {
  63. this.form.user_id = ''
  64. },
  65. async handleConfirm() {
  66. try {
  67. const url = `${this.URL.BASEURL}${this.URL.member_resetCustomerReceiveStatus}`
  68. const params = {
  69. ...this.form,
  70. corpid: this.$localSelfStore.getLocal('defaultCorp') && this.$localSelfStore.getLocal('defaultCorp') != 'undefined' ? JSON.parse(this.$localSelfStore.getLocal('defaultCorp')).corpid : '',
  71. }
  72. this.loading = true
  73. const { data: res = {} } = await this.$axios.get(url, { params })
  74. if (res && res.errno == 0) {
  75. this.$message.success('操作成功')
  76. this.handleClearFormData()
  77. this.$emit('confirm')
  78. } else if (res.errno != 4002) {
  79. this.$message.warning(res.err || '操作失败')
  80. this.handleCancel()
  81. }
  82. } catch (error) {
  83. console.log('error => ', error)
  84. } finally {
  85. this.loading = false
  86. }
  87. },
  88. handleCancel() {
  89. this.handleClearFormData()
  90. this.$emit('cancel')
  91. },
  92. },
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. .assign-dialog {
  97. .form-wrap {
  98. padding: 0 10px;
  99. }
  100. .dialog-footer {
  101. text-align: right;
  102. }
  103. }
  104. </style>