bankList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="mainBox">
  3. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  4. <myCard @add="add('edit',item,index)" @del="del(index)" :item="item" :index="index+1" :columns="columns" :btnList="btnList">
  5. </myCard>
  6. </view>
  7. <u-popup :show="show" @close="show=false">
  8. <u-button type="error" text="删除" @click="del"></u-button>
  9. </u-popup>
  10. <view class="add" @click="add('add')">
  11. <u-icon name="plus" color="#fff"></u-icon>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import myCard from '../../components/myCard.vue'
  17. export default {
  18. data() {
  19. return {
  20. columns: [
  21. [{
  22. label: '单位名称:',
  23. prop: 'accountName',
  24. type: 'title',
  25. className: 'perce100',
  26. }],
  27. [{
  28. label: '银行账号:',
  29. prop: 'accountNo',
  30. }, {
  31. label: '开户行:',
  32. prop: 'bankName'
  33. }],
  34. [{
  35. label: '银行银联号:',
  36. prop: 'interbankNo',
  37. className: 'perce100'
  38. }],
  39. [{
  40. label: '操作:',
  41. prop: 'action',
  42. type: 'action',
  43. className: 'perce100',
  44. }],
  45. ],
  46. btnList: [{
  47. name: '修改',
  48. apiName: 'add',
  49. btnType: 'primary',
  50. type: '2',
  51. }, {
  52. name: '删除',
  53. apiName: 'del',
  54. btnType: 'error',
  55. type: '2',
  56. pageUrl: '',
  57. }],
  58. tableList: [],
  59. show: false,
  60. current: {},
  61. index: ''
  62. }
  63. },
  64. props: {
  65. isDrawer: {
  66. default: false
  67. }
  68. },
  69. components: {
  70. myCard
  71. },
  72. created() {
  73. uni.$off('updateBankList')
  74. uni.$on('updateBankList', ({
  75. type,
  76. data
  77. }) => {
  78. if (type == 'add') {
  79. this.tableList.push(data)
  80. } else {
  81. this.$set(this.tableList, data.index, data)
  82. }
  83. if (this.isDrawer) {
  84. uni.$emit('setContact', {
  85. key: 'bankList',
  86. data: this.tableList
  87. })
  88. }
  89. // console.log(data)
  90. })
  91. },
  92. methods: {
  93. init(list) {
  94. if (list) {
  95. this.tableList = JSON.parse(JSON.stringify(list))
  96. }
  97. },
  98. getValue() {
  99. return this.tableList
  100. },
  101. del(index) {
  102. this.tableList.splice(index, 1);
  103. if (this.isDrawer) {
  104. uni.$emit('setContact', {
  105. key: 'bankList',
  106. data: this.tableList
  107. })
  108. }
  109. },
  110. add(type, data, index) {
  111. if (type == 'edit') {
  112. data['index'] = index
  113. }
  114. uni.navigateTo({
  115. url: '/pages/saleManage/contact/components/bankListAdd?type=' + type + (type == 'edit' ?
  116. '&data=' + JSON.stringify(data) : '')
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .add {
  124. width: 96rpx;
  125. height: 96rpx;
  126. border-radius: 48rpx;
  127. background: #3c9cff;
  128. position: fixed;
  129. bottom: 100rpx;
  130. right: 24rpx;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. z-index: 99;
  135. }
  136. </style>