label-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="label-list-container">
  3. <!-- <TuanAppShim bg="transparent"></TuanAppShim> -->
  4. <JHeader title="名片标签列表" width="50" height="50"></JHeader>
  5. <view style="width: 70%; margin: 14rpx auto 14rpx">
  6. <tui-button
  7. type="blue" bold shape="circle" width="100%"
  8. @click="go(`/another-tf/another-user/calling-card-management/card-label-form`)"
  9. >
  10. 新增标签
  11. </tui-button>
  12. </view>
  13. <view v-if="electronicLabelInfo && electronicLabelInfo.length" style="padding: 12rpx 0;">
  14. <view v-for="(item, index) in electronicLabelInfo" :key="index" style="margin-top: 20rpx;">
  15. <tui-card :title="{ text: item.labelName }" :tag="{ text: `ID:${item.labelId}` }">
  16. <template #body>
  17. <view style="padding: 10rpx 32rpx;">
  18. <view>关联名片ID:{{ item.enterpriseUserId }}</view>
  19. <view>创建时间:{{ item.createTime }}</view>
  20. <view>更新时间:{{ item.updateTime }}</view>
  21. </view>
  22. </template>
  23. <template #footer>
  24. <view class="label-btn" style="padding: 0 20rpx 20rpx;text-align: right;">
  25. <tui-button
  26. type="warning" width="120rpx" height="50rpx" margin="0 20rpx 0"
  27. @click="go(`/another-tf/another-user/calling-card-management/card-label-form?id=${item.labelId}`)"
  28. >
  29. 编辑
  30. </tui-button>
  31. <tui-button type="danger" width="120rpx" height="50rpx" @click="handleLabelDelete(item)">
  32. 删除
  33. </tui-button>
  34. </view>
  35. </template>
  36. </tui-card>
  37. </view>
  38. </view>
  39. <view style="padding-bottom: 45rpx;">
  40. <LoadingMore :status="isLoading ? 'loading' : ''"></LoadingMore>
  41. <view v-if="!isLoading && !electronicLabelInfo.length">
  42. <tui-no-data :fixed="false">您还没有设置名片标签哦~</tui-no-data>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { deleteByIdEnterpriseUserLabelApi } from '../../../api/anotherTFInterface'
  49. export default {
  50. name: 'LabelList',
  51. components: {
  52. },
  53. data() {
  54. return {
  55. electronicLabelInfo: [],
  56. isLoading: true
  57. }
  58. },
  59. onShow() {
  60. this.getLabelList()
  61. },
  62. methods: {
  63. async getLabelList() {
  64. if (this.$store.getters.electronicCardInfo.enterpriseUserId) {
  65. uni.showLoading()
  66. this.isLoading = true
  67. try {
  68. this.electronicLabelInfo = await this.$store.dispatch('user/getElectronicLabelAction', { id: this.$store.getters.electronicCardInfo.enterpriseUserId })
  69. uni.hideLoading()
  70. this.isLoading = false
  71. } catch (err) {
  72. uni.hideLoading()
  73. this.isLoading = false
  74. }
  75. } else {
  76. this.$showToast('缺少名片信息')
  77. }
  78. },
  79. handleLabelDelete(item) {
  80. uni.showModal({
  81. title: '提示',
  82. content: '确定要删除当前名片标签?',
  83. success: (res) => {
  84. if (res.confirm) {
  85. deleteByIdEnterpriseUserLabelApi({
  86. labelId: item.labelId
  87. }).then((res) => {
  88. this.$showToast('删除成功', 'success')
  89. this.getLabelList()
  90. })
  91. }
  92. }
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="less" scoped>
  99. .label-list-container {
  100. width: 100%;
  101. min-height: 100vh;
  102. background-color: #f5f4f9;
  103. /deep/ .j-header-container{
  104. padding: 24rpx 0 0;
  105. }
  106. /deep/ .tui-nodata-box {
  107. padding-top: 60rpx;
  108. }
  109. .label-btn {
  110. /deep/ .tui-btn {
  111. display: inline-block;
  112. border-radius: 50rpx;
  113. }
  114. }
  115. }
  116. </style>