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