index.vue 5.3 KB

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