collectionCustomer.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view>
  3. <!-- 转移公海 -->
  4. <u-modal
  5. :show="showCollectionModel"
  6. :showCancelButton="true"
  7. @confirm="confirmCollection()"
  8. @cancel="closeMoveInModel()"
  9. :asyncClose="true"
  10. title="领取客户">
  11. <view class="slot-content" style="width: 100%">
  12. <view class="flex">
  13. <text>申请说明:</text>
  14. <u-textarea
  15. v-model="openSeaObj.applyRemark"
  16. placeholder="请输入申请说明"
  17. height="180"
  18. :count="true"
  19. maxlength="500"></u-textarea>
  20. </view>
  21. </view>
  22. </u-modal>
  23. </view>
  24. </template>
  25. <script>
  26. import { mapGetters } from 'vuex'
  27. import customerApi from '../../../api/customer'
  28. import to from 'await-to-js'
  29. export default {
  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. let params = this.openSeaObj
  53. const [err, res] = await to(customerApi.collection(params))
  54. if (err) return this.closeMoveInModel()
  55. // console.log(res.code)
  56. if (res.code == 200) {
  57. this.$refs.uToast.show({
  58. type: 'loading',
  59. message: '客户领用成功',
  60. complete: () => {
  61. this.showCollectionModel = false
  62. this.$emit('fetchList')
  63. },
  64. })
  65. } else {
  66. this.closeMoveInModel()
  67. }
  68. },
  69. // 关闭移入公海模块
  70. closeMoveInModel() {
  71. this.openSeaObj.ids = []
  72. this.openSeaObj.applyRemark = ''
  73. this.showCollectionModel = false
  74. },
  75. },
  76. }
  77. </script>
  78. <style></style>