index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-17 14:46:41
  6. * @Description: file content
  7. * @FilePath: \oms\pages\project\index.vue
  8. -->
  9. <template>
  10. <view class="home">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <view class="back" @click="goBack()">
  15. <u-icon name="arrow-left" color="#ffffff" size="22"></u-icon>
  16. </view>
  17. <text>项目管理</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="main">
  22. <!-- 搜索 -->
  23. <view class="query-wrap">
  24. <view class="search-container">
  25. <view class="search-input">
  26. <u-input
  27. clearable
  28. placeholderStyle="font-size:26rpx"
  29. :customStyle="{ height: '66rpx' }"
  30. v-model="queryForm.nboName"
  31. prefixIcon="search"
  32. prefixIconStyle="font-size: 22px;color: #909399"
  33. placeholder="请输入项目名称"
  34. shape="circle"
  35. border="surround"></u-input>
  36. </view>
  37. <view class="search-btn" @click="searchList">搜索</view>
  38. </view>
  39. </view>
  40. <u-tabs
  41. :list="list"
  42. @change="changeTabs"
  43. :current="curTabIndex"
  44. :activeStyle="{
  45. color: '#323232',
  46. fontWeight: 'bold',
  47. }"
  48. :inactiveStyle="{
  49. color: '#969696',
  50. }"></u-tabs>
  51. <u-empty v-if="projectData.length == 0" mode="list" text="暂无数据"></u-empty>
  52. <scroll-view :scroll-y="true" class="data-list" @scrolltolower="lower" v-else>
  53. <view>
  54. <view class="data-item" v-for="(v, i) in projectData" :key="i" @click="toDetails(v)">
  55. <view class="customer-name flex">
  56. <text class="name">{{ v.nboName }}</text>
  57. <view class="user-code">
  58. <text>{{ v.nboCode }}</text>
  59. </view>
  60. </view>
  61. <view class="customer-info flex">
  62. <view class="info-left flex_1">
  63. <view class="info-row flex_l">
  64. <text class="info-label">销售工程师:</text>
  65. <u-text color="#323232" size="24rpx" :text="v.saleName"></u-text>
  66. </view>
  67. <view class="info-row flex_l">
  68. <text class="info-label">客户名称:</text>
  69. <u-text color="#323232" size="24rpx" :text="v.custName"></u-text>
  70. </view>
  71. <view class="info-row flex_l">
  72. <text class="info-label">项目来源:</text>
  73. <u-text
  74. color="#323232"
  75. size="24rpx"
  76. :text="selectDictLabel(sourceOptions, v.nboSource) || '-'"></u-text>
  77. </view>
  78. <view class="info-row flex_l">
  79. <text class="info-label">销售模式:</text>
  80. <u-text
  81. color="#323232"
  82. size="24rpx"
  83. :text="selectDictLabel(salesModelOptions, v.salesModel) || '-'"></u-text>
  84. </view>
  85. <view class="info-row flex_l">
  86. <text class="info-label">产品线:</text>
  87. <u-text
  88. color="#323232"
  89. size="24rpx"
  90. :text="selectDictLabel(productLineOptions, v.productLine) || '-'"></u-text>
  91. </view>
  92. <view class="info-row flex_l">
  93. <text class="info-label">项目预算(万元):</text>
  94. <u-text color="#323232" size="24rpx" mode="price" :text="v.nboBudget"></u-text>
  95. </view>
  96. <view class="flex_l">
  97. <view class="transfer-btn mr20" @click.stop="linkToTransfer(v.id)">
  98. <u-button type="primary" size="small" text="转移项目"></u-button>
  99. </view>
  100. <!-- <view class="transfer-btn mr20" @click.stop="$refs.moveCust.open(v.id)">
  101. <u-button type="primary" size="small" text="移入公海"></u-button>
  102. </view> -->
  103. </view>
  104. </view>
  105. <view class="info-right flex_l flex-column">
  106. <!-- <image class="user-img" src="@/static/images/user.jpg" mode="scaleToFill" /> -->
  107. <u-text color="#646464" size="20rpx" :text="v.salesName"></u-text>
  108. </view>
  109. </view>
  110. </view>
  111. <u-loadmore :status="loadStatus" />
  112. </view>
  113. </scroll-view>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import projectApi from '../../api/project'
  119. import to from 'await-to-js'
  120. export default {
  121. name: 'omsIndex',
  122. components: {},
  123. data() {
  124. return {
  125. list: [
  126. {
  127. name: '全部项目',
  128. status: 0,
  129. nboType: null,
  130. },
  131. {
  132. name: 'C类项目',
  133. status: 1,
  134. nboType: '30',
  135. },
  136. {
  137. name: 'B类项目',
  138. status: 2,
  139. nboType: '20',
  140. },
  141. {
  142. name: 'A类项目',
  143. status: 3,
  144. nboType: '10',
  145. },
  146. {
  147. name: '成交项目',
  148. status: 4,
  149. nboType: '40',
  150. },
  151. {
  152. name: '储备项目',
  153. status: 5,
  154. nboType: '50',
  155. },
  156. ],
  157. curTabIndex: 0, //tabs状态
  158. height: '',
  159. paddingTop: '',
  160. queryForm: {
  161. pageNum: 0,
  162. pageSize: 10,
  163. nboName: '', //项目名称
  164. },
  165. projectData: [], //项目列表
  166. projectDataTotal: 0, //列表元素数量
  167. loadStatus: '', //加载状态
  168. salesModelOptions: [], //销售模式列表
  169. productLineOptions: [], //产品线列表
  170. sourceOptions: [], //来源列表
  171. }
  172. },
  173. created() {
  174. const navData = uni.getMenuButtonBoundingClientRect()
  175. this.height = navData.height + 'px'
  176. this.paddingTop = navData.top + 'px'
  177. },
  178. onShow() {
  179. this.getOptions()
  180. this.searchList()
  181. },
  182. methods: {
  183. getOptions() {
  184. Promise.all([
  185. this.getDicts('proj_sales_model'),
  186. this.getDicts('sys_product_line'),
  187. this.getDicts('proj_nbo_source'),
  188. ])
  189. .then(([model, line, source]) => {
  190. this.salesModelOptions = model.data.values || []
  191. this.productLineOptions = line.data.values || []
  192. this.sourceOptions = source.data.values || []
  193. })
  194. .catch((err) => console.log(err))
  195. },
  196. // 改变tab
  197. changeTabs(data) {
  198. console.log(data)
  199. this.curTabIndex = data.status
  200. this.searchList()
  201. },
  202. // 上拉滚动
  203. lower() {
  204. if (this.projectData.length < this.projectDataTotal && this.loadStatus != 'loading') {
  205. this.$u.throttle(this.getProjectData(), 2000, false)
  206. }
  207. },
  208. // 查询列表
  209. searchList() {
  210. this.queryForm.pageNum = 0
  211. this.getProjectData(true)
  212. },
  213. async getProjectData(reset) {
  214. this.loadStatus = 'loading'
  215. this.queryForm.pageNum++
  216. let params = {
  217. nboType: this.list[this.curTabIndex].nboType,
  218. nboName: this.queryForm.nboName,
  219. pageNum: this.queryForm.pageNum,
  220. pageSize: this.queryForm.pageSize,
  221. }
  222. const [err, res] = await to(projectApi.getList(params))
  223. if (err) {
  224. this.loadStatus = 'nomore'
  225. return
  226. }
  227. if (res && res.code == 200) {
  228. if (reset) {
  229. this.projectData = res.data.list || []
  230. } else {
  231. this.projectData = [...this.projectData, ...(res.data.list || [])]
  232. }
  233. this.projectDataTotal = res.data.total
  234. console.log(
  235. 'this.projectData.length == this.projectDataTotal',
  236. this.projectData.length == this.projectDataTotal
  237. )
  238. this.loadStatus = this.projectData.length == this.projectDataTotal ? 'nomore' : 'loadmore'
  239. } else {
  240. this.loadStatus = 'nomore'
  241. }
  242. },
  243. // 跳转到转移客户
  244. linkToTransfer(id) {
  245. uni.navigateTo({
  246. //保留当前页面,跳转到应用内的某个页面
  247. url: '/pages/project/transfer?id=' + id,
  248. })
  249. },
  250. goBack() {
  251. uni.navigateBack({
  252. //关闭当前页面,返回上一页面或多级页面。
  253. delta: 1,
  254. })
  255. },
  256. toDetails(v) {
  257. uni.navigateTo({
  258. //保留当前页面,跳转到应用内的某个页面
  259. url: '/pages/project/details?id=' + v.id,
  260. })
  261. },
  262. },
  263. }
  264. </script>
  265. <style>
  266. page {
  267. background: #f2f3f5;
  268. }
  269. </style>
  270. <style lang="scss" scoped>
  271. .home {
  272. padding-top: 188rpx;
  273. .nav {
  274. position: absolute;
  275. left: 0;
  276. top: 0;
  277. width: 100%;
  278. height: 284rpx;
  279. background: #3e7ef8;
  280. .title {
  281. position: relative;
  282. text-align: center;
  283. font-size: 32rpx;
  284. font-weight: bold;
  285. color: #ffffff;
  286. .back {
  287. position: absolute;
  288. top: 0;
  289. bottom: 0;
  290. margin: auto;
  291. left: 70rpx;
  292. display: flex;
  293. }
  294. }
  295. }
  296. .main {
  297. position: absolute;
  298. width: 100%;
  299. height: calc(100vh - 188rpx);
  300. background: #ffffff;
  301. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  302. border-radius: 31rpx 31rpx 0 0;
  303. padding: 0 32rpx;
  304. overflow: auto;
  305. padding-bottom: 64rpx;
  306. .query-wrap {
  307. padding-top: 20rpx;
  308. .search-container {
  309. display: flex;
  310. align-items: center;
  311. .search-input {
  312. flex: 1;
  313. }
  314. .search-btn {
  315. text-align: center;
  316. line-height: 60rpx;
  317. border-radius: 12rpx;
  318. width: 100rpx;
  319. height: 60rpx;
  320. font-size: 26rpx;
  321. margin: 0 0 0 12rpx;
  322. background: $u-primary;
  323. color: #ffffff;
  324. }
  325. }
  326. }
  327. .data-list {
  328. width: 100%;
  329. height: calc(100vh - 422rpx);
  330. overflow: auto;
  331. .data-item {
  332. background: rgba(242, 243, 245, 0.5);
  333. border-radius: 15rpx;
  334. padding: 28rpx 40rpx 28rpx 38rpx;
  335. margin-top: 32rpx;
  336. .customer-name {
  337. .name {
  338. flex: 1;
  339. color: #323232;
  340. font-weight: bold;
  341. font-size: 28rpx;
  342. margin-right: 12rpx;
  343. }
  344. .user-code {
  345. width: 180rpx;
  346. height: 32rpx;
  347. font-size: 24rpx;
  348. color: #323232;
  349. line-height: 32rpx;
  350. }
  351. }
  352. .customer-info {
  353. .info-left {
  354. .transfer-btn {
  355. margin-top: 20rpx;
  356. width: 150rpx;
  357. }
  358. .info-row {
  359. margin-top: 12rpx;
  360. .info-label {
  361. color: #646464;
  362. font-size: 24rpx;
  363. }
  364. }
  365. }
  366. .info-right {
  367. padding-top: 30rpx;
  368. .user-img {
  369. border-radius: 50%;
  370. width: 46rpx;
  371. height: 46rpx;
  372. }
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .filter-popup {
  379. background: rgba(0, 0, 0, 0.8);
  380. position: fixed;
  381. width: 100%;
  382. height: 100%;
  383. left: 0;
  384. z-index: 1;
  385. .filter-wrap {
  386. width: 100%;
  387. padding: 20rpx;
  388. background: #ffffff;
  389. .filter-item {
  390. padding-bottom: 30rpx;
  391. .tit {
  392. font-size: 26rpx;
  393. color: #323232;
  394. font-weight: bold;
  395. padding-bottom: 20rpx;
  396. }
  397. .menu-list {
  398. display: flex;
  399. flex-wrap: wrap;
  400. .menu-item {
  401. margin-right: 40rpx;
  402. margin-bottom: 20rpx;
  403. }
  404. }
  405. }
  406. }
  407. .btn-box {
  408. width: 698rpx;
  409. height: 75px;
  410. display: flex;
  411. align-items: center;
  412. justify-content: space-between;
  413. > view {
  414. width: 320rpx;
  415. height: 40px;
  416. border-radius: 40px;
  417. border: solid 1rpx #ec652b;
  418. align-items: center;
  419. justify-content: center;
  420. text-align: center;
  421. line-height: 40px;
  422. }
  423. .reset {
  424. color: #ec652b;
  425. }
  426. .submit {
  427. color: #fff;
  428. background-color: #ec652b;
  429. }
  430. }
  431. }
  432. }
  433. </style>