index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="商机" @clickLeft="back">
  4. </uni-nav-bar>
  5. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  6. <myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList"></myCard>
  7. </view>
  8. <view class="add" @click="add">
  9. <u-icon name="plus" color="#fff"></u-icon>
  10. </view>
  11. <u-toast ref="uToast"></u-toast>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. getTableList,
  17. deleteInformation
  18. } from '@/api/saleManage/businessOpportunity/index.js'
  19. import myCard from '../components/myCard.vue'
  20. export default {
  21. components: {
  22. myCard,
  23. },
  24. data() {
  25. return {
  26. tableList: [],
  27. page: 1,
  28. size: 10,
  29. isEnd: false,
  30. current: {},
  31. btnList: [{
  32. name: '详情',
  33. apiName: '',
  34. btnType: 'primary',
  35. type: '1',
  36. pageUrl: '/pages/saleManage/businessOpportunity/components/drawer',
  37. }, {
  38. name: '修改',
  39. apiName: '',
  40. btnType: 'primary',
  41. type: '1',
  42. pageUrl: '/pages/saleManage/businessOpportunity/add',
  43. judge: [{
  44. key: 'approvalStatus',
  45. value: [0, 3]
  46. }],
  47. }, {
  48. name: '删除',
  49. apiName: 'del',
  50. btnType: 'error ',
  51. type: '2',
  52. pageUrl: '',
  53. judge: [{
  54. key: 'approvalStatus',
  55. value: [0, 3]
  56. }],
  57. }],
  58. columns: [
  59. [{
  60. label: '名称:',
  61. prop: 'name',
  62. type: 'title',
  63. className: 'perce100',
  64. }],
  65. [{
  66. label: '编码:',
  67. prop: 'code'
  68. }, {
  69. label: '客户名称:',
  70. prop: 'contactName'
  71. }],
  72. [{
  73. label: '产品名称:',
  74. prop: 'productNames'
  75. }, {
  76. label: '商机来源:',
  77. prop: 'sourceName'
  78. }],
  79. [{
  80. label: '商机阶段:',
  81. prop: 'stageName'
  82. }, {
  83. label: '赢单率:',
  84. prop: 'winRate',
  85. formatter: (row) => {
  86. return row.winRate ? row.winRate + '%' : '';
  87. }
  88. }],
  89. [{
  90. label: '负责人:',
  91. prop: 'responsibleName'
  92. }, {
  93. label: '创建人:',
  94. prop: 'createUserName'
  95. }],
  96. [{
  97. label: '操作:',
  98. prop: 'action',
  99. type: 'action',
  100. className: 'perce100',
  101. }],
  102. ]
  103. }
  104. },
  105. computed: {
  106. },
  107. onShow() {
  108. this.isEnd = false
  109. this.page = 1
  110. this.getList()
  111. },
  112. methods: {
  113. //获取列表信息
  114. getList() {
  115. if (this.isEnd) {
  116. return
  117. }
  118. uni.showLoading({
  119. title: '加载中'
  120. })
  121. let data = {
  122. pageNum: this.page,
  123. size: this.size,
  124. type: 1
  125. }
  126. getTableList(data).then(res => {
  127. if (this.page === 1) {
  128. this.tableList = res.list
  129. } else {
  130. this.tableList.push(...res.list)
  131. }
  132. this.page += 1
  133. this.isEnd = this.tableList.length >= res.count
  134. }).then(() => {
  135. uni.hideLoading()
  136. })
  137. },
  138. add() {
  139. uni.navigateTo({
  140. url: '/pages/saleManage/businessOpportunity/add'
  141. })
  142. },
  143. view() {
  144. },
  145. del(item) {
  146. deleteInformation([item.id]).then(res => {
  147. this.isEnd = false
  148. this.page = 1
  149. this.$refs.uToast.show({
  150. type: "success",
  151. message: "操作成功",
  152. })
  153. this.getList(this.where)
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .add {
  161. width: 96rpx;
  162. height: 96rpx;
  163. border-radius: 48rpx;
  164. background: #3c9cff;
  165. position: fixed;
  166. bottom: 100rpx;
  167. right: 24rpx;
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. }
  172. </style>