collectionCustomer.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view>
  3. <!-- 领取客户 -->
  4. <u-modal :show="showCollectionModel" :showCancelButton="true" @confirm="confirmCollection()"
  5. @cancel="closeMoveInModel()" title="领取客户">
  6. <view class="slot-content" style="width: 100%">
  7. <view class="flex">
  8. <text>申请说明:</text>
  9. <u-textarea v-model="openSeaObj.applyRemark" placeholder="请输入申请说明" height="180" :count="true" maxlength="500">
  10. </u-textarea>
  11. </view>
  12. </view>
  13. </u-modal>
  14. <u-notify ref="uNotify"></u-notify>
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. mapGetters
  20. } from 'vuex'
  21. import customerApi from '../../../api/customer'
  22. import to from 'await-to-js'
  23. export default {
  24. props: {
  25. position: {
  26. default: () => {},
  27. required: true,
  28. }
  29. },
  30. data() {
  31. return {
  32. showCollectionModel: false,
  33. openSeaObj: {
  34. applyRemark: '',
  35. receive: '1',
  36. ids: [],
  37. },
  38. }
  39. },
  40. computed: {
  41. ...mapGetters(['userId', 'username']),
  42. },
  43. methods: {
  44. open(id) {
  45. this.openSeaObj.ids = [id]
  46. this.showCollectionModel = true
  47. },
  48. // 领用
  49. async confirmCollection() {
  50. // this.openSeaObj.salesId = this.userId
  51. // this.openSeaObj.salesName = this.username
  52. if (!this.openSeaObj.applyRemark) {
  53. this.$refs.uNotify.show({
  54. top: this.position.height + this.position.paddingTop + 10,
  55. type: 'warning',
  56. message: '请输入领用原因',
  57. duration: 1000 * 3,
  58. })
  59. return
  60. }
  61. let params = {
  62. ...this.openSeaObj,
  63. salesId: this.userId,
  64. salesName: this.username
  65. }
  66. const [err, res] = await to(customerApi.collection(params))
  67. if (err) return this.closeMoveInModel()
  68. // console.log(res.code)
  69. if (res.code == 200) {
  70. this.$refs.uToast.show({
  71. type: 'loading',
  72. message: '客户领用成功',
  73. complete: () => {
  74. this.showCollectionModel = false
  75. this.$emit('fetchList')
  76. },
  77. })
  78. } else {
  79. this.closeMoveInModel()
  80. }
  81. },
  82. // 关闭移入公海模块
  83. closeMoveInModel() {
  84. this.openSeaObj.ids = []
  85. this.openSeaObj.applyRemark = ''
  86. this.showCollectionModel = false
  87. },
  88. },
  89. }
  90. </script>
  91. <style></style>