index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="商机"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  13. </view>
  14. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  15. <myCard @del="del(item)" :item="item" :index="index+1" :columns="columns" :btnList="btnList"></myCard>
  16. </view>
  17. <view style='margin-top: 20vh;' v-if="tableList.length==0">
  18. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  19. </u-empty>
  20. </view>
  21. <view class="add" @click="add">
  22. <u-icon name="plus" color="#fff"></u-icon>
  23. </view>
  24. <u-toast ref="uToast"></u-toast>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. getTableList,
  30. deleteInformation
  31. } from '@/api/saleManage/businessOpportunity/index.js'
  32. import myCard from '../components/myCard.vue'
  33. export default {
  34. components: {
  35. myCard,
  36. },
  37. data() {
  38. return {
  39. tableList: [],
  40. searchVal: '',
  41. page: 1,
  42. size: 10,
  43. isEnd: false,
  44. current: {},
  45. btnList: [{
  46. name: '详情',
  47. apiName: '',
  48. btnType: 'primary',
  49. type: '1',
  50. pageUrl: '/pages/saleManage/businessOpportunity/components/drawer',
  51. }, {
  52. name: '修改',
  53. apiName: '',
  54. btnType: 'primary',
  55. type: '1',
  56. pageUrl: '/pages/saleManage/businessOpportunity/add',
  57. judge: [{
  58. key: 'approvalStatus',
  59. value: [0, 3]
  60. }],
  61. }, {
  62. name: '跟进记录',
  63. apiName: '',
  64. btnType: 'primary',
  65. type: '1',
  66. pageUrl: '/pages/saleManage/businessOpportunity/components/drawer',
  67. query: '&current=4',
  68. judge: [{
  69. key: 'approvalStatus',
  70. value: [0, 3]
  71. }],
  72. }, {
  73. name: '删除',
  74. apiName: 'del',
  75. btnType: 'error ',
  76. type: '2',
  77. pageUrl: '',
  78. judge: [{
  79. key: 'approvalStatus',
  80. value: [0, 3]
  81. }],
  82. }],
  83. columns: [
  84. [{
  85. label: '名称:',
  86. prop: 'name',
  87. type: 'title',
  88. className: 'perce100',
  89. }],
  90. [{
  91. label: '编码:',
  92. prop: 'code'
  93. }, {
  94. label: '客户名称:',
  95. prop: 'contactName'
  96. }],
  97. [{
  98. label: '产品名称:',
  99. prop: 'productNames'
  100. }, {
  101. label: '商机来源:',
  102. prop: 'sourceName'
  103. }],
  104. [{
  105. label: '商机阶段:',
  106. prop: 'stageName'
  107. }, {
  108. label: '赢单率:',
  109. prop: 'winRate',
  110. formatter: (row) => {
  111. return row.winRate ? row.winRate + '%' : '';
  112. }
  113. }],
  114. [{
  115. label: '负责人:',
  116. prop: 'responsibleName'
  117. }, {
  118. label: '创建人:',
  119. prop: 'createUserName'
  120. }],
  121. [{
  122. label: '操作:',
  123. prop: 'action',
  124. type: 'action',
  125. className: 'perce100',
  126. }],
  127. ]
  128. }
  129. },
  130. computed: {
  131. },
  132. onShow() {
  133. this.isEnd = false
  134. this.page = 1
  135. this.getList()
  136. },
  137. methods: {
  138. doSearch() {
  139. this.isEnd = false
  140. this.page = 1
  141. this.getList()
  142. },
  143. //获取列表信息
  144. getList() {
  145. if (this.isEnd) {
  146. return
  147. }
  148. uni.showLoading({
  149. title: '加载中'
  150. })
  151. let data = {
  152. pageNum: this.page,
  153. size: this.size,
  154. type: 1,
  155. name: this.searchVal
  156. }
  157. getTableList(data).then(res => {
  158. if (this.page === 1) {
  159. this.tableList = res.list
  160. } else {
  161. this.tableList.push(...res.list)
  162. }
  163. this.page += 1
  164. this.isEnd = this.tableList.length >= res.count
  165. }).then(() => {
  166. uni.hideLoading()
  167. })
  168. },
  169. add() {
  170. uni.navigateTo({
  171. url: '/pages/saleManage/businessOpportunity/add'
  172. })
  173. },
  174. view() {
  175. },
  176. del(item) {
  177. deleteInformation([item.id]).then(res => {
  178. this.isEnd = false
  179. this.page = 1
  180. this.$refs.uToast.show({
  181. type: "success",
  182. message: "操作成功",
  183. })
  184. this.getList(this.where)
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. .add {
  192. width: 96rpx;
  193. height: 96rpx;
  194. border-radius: 48rpx;
  195. background: #3c9cff;
  196. position: fixed;
  197. bottom: 100rpx;
  198. right: 24rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. }
  203. .top-wrapper {
  204. background-color: #fff;
  205. display: flex;
  206. width: 750rpx;
  207. height: 88rpx;
  208. padding: 16rpx 32rpx;
  209. align-items: center;
  210. gap: 16rpx;
  211. /deep/.uni-section {
  212. margin-top: 0px;
  213. }
  214. /deep/.uni-section-header {
  215. padding: 0px;
  216. }
  217. .search_btn {
  218. width: 120rpx;
  219. height: 70rpx;
  220. line-height: 70rpx;
  221. padding: 0 24rpx;
  222. background: $theme-color;
  223. font-size: 32rpx;
  224. color: #fff;
  225. margin: 0;
  226. margin-left: 26rpx;
  227. }
  228. .menu_icon {
  229. width: 44rpx;
  230. height: 44rpx;
  231. margin-left: 14rpx;
  232. }
  233. }
  234. </style>