collectionCustomer.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if (res.code == 200) {
  69. this.$refs.uToast.show({
  70. type: 'loading',
  71. message: '客户领用成功',
  72. complete: () => {
  73. this.showCollectionModel = false
  74. this.$emit('fetchList')
  75. },
  76. })
  77. } else {
  78. this.closeMoveInModel()
  79. }
  80. },
  81. // 关闭移入公海模块
  82. closeMoveInModel() {
  83. this.openSeaObj.ids = []
  84. this.openSeaObj.applyRemark = ''
  85. this.showCollectionModel = false
  86. },
  87. },
  88. }
  89. </script>
  90. <style></style>