index.vue 5.3 KB

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