details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-03-13 14:45:47
  6. * @Description: file content
  7. * @FilePath: \oms\pages\project\details.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. <view class="main-top">
  23. <view class="customer-box">
  24. <view class="header flex1">
  25. <view class="name flex_l">
  26. <image class="img" src="../../static/images/menu2.png" mode="scaleToFill" />
  27. <text>{{ projectData.nboName }}</text>
  28. </view>
  29. <view class="date">{{ parseTime(projectData.createdTime, '{y}-{m}-{d}') || '-' }}</view>
  30. </view>
  31. <view class="info">
  32. <view class="info-item">
  33. <u-row>
  34. <u-col span="6">
  35. <view class="flex_l">
  36. <view class="info-label">项目编码:</view>
  37. <text class="info-txt">{{ projectData.nboCode }}</text>
  38. </view>
  39. </u-col>
  40. <u-col span="6">
  41. <view class="flex_l">
  42. <view class="info-label">客户名称:</view>
  43. <text class="info-txt">{{ projectData.custName }}</text>
  44. </view>
  45. </u-col>
  46. </u-row>
  47. </view>
  48. <view class="info-item">
  49. <u-row justify="space-between">
  50. <u-col span="6">
  51. <view class="flex_l">
  52. <view class="info-label">产品线:</view>
  53. <text class="info-txt">{{ selectDictLabel(productLineOptions, projectData.productLine) }}</text>
  54. </view>
  55. </u-col>
  56. <u-col span="6">
  57. <view class="flex_l">
  58. <view class="info-label">项目预算:</view>
  59. <text class="info-txt">{{ formatPrice(projectData.nboBudget) }}</text>
  60. </view>
  61. </u-col>
  62. </u-row>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="tabs">
  67. <u-tabs
  68. @change="changeTabs"
  69. :current="curTabIndex"
  70. :scrollable="false"
  71. :list="list"
  72. :activeStyle="{
  73. color: '#3E7EF8',
  74. fontWeight: 'bold',
  75. }"
  76. :inactiveStyle="{
  77. color: '#969696',
  78. }"></u-tabs>
  79. </view>
  80. </view>
  81. <view class="data-list">
  82. <!-- 跟进记录 -->
  83. <follow-records v-if="curTabIndex == 0" ref="follow" :projectId="projectId"></follow-records>
  84. <!-- 详情 -->
  85. <project-detail v-else-if="curTabIndex == 1" :detail="projectData"></project-detail>
  86. <!-- 联系人 -->
  87. <contacts v-else-if="curTabIndex == 2" :projectId="projectId"></contacts>
  88. <!-- 产品详情 -->
  89. <form-list
  90. v-else-if="curTabIndex == 3 && productList.length > 0"
  91. :data="productList"
  92. :columns="columns"
  93. ref="list">
  94. <template v-slot:header="{ dataItem }">
  95. <view>{{ dataItem.prodName }}</view>
  96. </template>
  97. <template v-slot:content="{ dataItem, propsss }">
  98. <!-- <view v-if="propsss === 'prodClass' && productList.length > 0">
  99. <u-input
  100. disabled
  101. :value="selectDictLabel(productLineOptions, dataItem['prodClass'], productList)"></u-input>
  102. </view> -->
  103. <view v-if="propsss === 'prodPrice'">
  104. <u-input disabled :value="'¥' + dataItem['prodPrice']"></u-input>
  105. </view>
  106. </template>
  107. <view @click="$refs.list.getData()">获取数据</view>
  108. </form-list>
  109. </view>
  110. </view>
  111. <!-- 新增按钮 -->
  112. <view class="fixed-btn-group" :style="{ width: openBtnWidth ? '480rpx' : '90rpx' }">
  113. <view class="flex1" v-if="openBtnWidth">
  114. <view
  115. class="btn center"
  116. v-if="['20', '30', '50'].includes(projectData.nboType) && projectData.approStatus != '20'"
  117. @click="linkToLevel(1)">
  118. </view>
  119. <view
  120. class="red btn center"
  121. v-if="['10', '20'].includes(projectData.nboType) && projectData.approStatus != '20'"
  122. @click="linkToLevel(0)">
  123. </view>
  124. <view
  125. class="btn center"
  126. v-if="projectData.nboType != '40' || projectData.nboType != '50' || projectData.approStatus != '20'"
  127. @click="$refs.reserve.open(projectId)">
  128. </view>
  129. <view class="btn center" @click="linkToTransfer()">转</view>
  130. <!-- <view class="btn center" @click="createProject()">增</view> -->
  131. <view class="btn center" @click="openFollow()">跟</view>
  132. </view>
  133. <view class="btn center" @click="openBtnWidth = !openBtnWidth">
  134. <u-icon name="plus" color="#fff" size="20"></u-icon>
  135. </view>
  136. </view>
  137. <!-- 转储备 -->
  138. <transfer-reserve ref="reserve"></transfer-reserve>
  139. </view>
  140. </template>
  141. <script>
  142. import projectApi from '../../api/project'
  143. import to from 'await-to-js'
  144. import projectDetail from './components/projectDetail'
  145. import followRecords from './components/followRecords'
  146. import Contacts from './components/contacts'
  147. import TransferReserve from './components/transferReserve'
  148. import FormList from '@/components/FormList/index'
  149. export default {
  150. name: 'omsIndex',
  151. components: { projectDetail, followRecords, Contacts, TransferReserve, FormList },
  152. data() {
  153. return {
  154. columns: [
  155. {
  156. prop: 'prodCode',
  157. label: '产品编码',
  158. disabled: true,
  159. },
  160. {
  161. prop: 'prodName',
  162. label: '产品名称',
  163. disabled: true,
  164. },
  165. // {
  166. // prop: 'prodClass',
  167. // label: '产品类别',
  168. // customRender: true,
  169. // },
  170. {
  171. prop: 'prodPrice',
  172. label: '产品单价',
  173. customRender: true,
  174. },
  175. {
  176. prop: 'prodNum',
  177. label: '数量',
  178. disabled: true,
  179. },
  180. {
  181. prop: 'totalPrice',
  182. label: '合计',
  183. disabled: true,
  184. },
  185. ],
  186. productList: [],
  187. openBtnWidth: false,
  188. curTabIndex: 0,
  189. fllowList: [], //跟进数据
  190. list: [
  191. {
  192. name: '跟进记录',
  193. index: 0,
  194. },
  195. {
  196. name: '详细信息',
  197. index: 1,
  198. },
  199. {
  200. name: '联系人',
  201. index: 2,
  202. },
  203. {
  204. name: '产品信息',
  205. index: 3,
  206. },
  207. ],
  208. height: '',
  209. paddingTop: '',
  210. projectData: {}, //项目详情
  211. projectId: 0, //项目id
  212. // salesModelOptions: [],
  213. productLineOptions: [], //产品线
  214. // sourceOptions: [],
  215. }
  216. },
  217. onLoad(option) {
  218. this.projectId = parseInt(option.id)
  219. this.getOptions()
  220. },
  221. created() {
  222. const navData = uni.getMenuButtonBoundingClientRect()
  223. this.height = navData.height + 'px'
  224. this.paddingTop = navData.top + 'px'
  225. },
  226. onShow() {
  227. this.openBtnWidth = false
  228. this.getProjectDetail()
  229. },
  230. watch: {
  231. curTabIndex(idx) {
  232. if (idx == 3) {
  233. this.getProductList()
  234. }
  235. },
  236. },
  237. methods: {
  238. dictLabel(datas, value) {
  239. return '32322332'
  240. },
  241. getOptions() {
  242. Promise.all([
  243. // this.getDicts('proj_sales_model'),
  244. this.getDicts('sys_product_line'),
  245. // this.getDicts('proj_nbo_source'),
  246. ])
  247. .then(([line]) => {
  248. // this.salesModelOptions = model.data.values || []
  249. this.productLineOptions = line.data.values || []
  250. // this.sourceOptions = source.data.values || []
  251. })
  252. .catch((err) => console.log(err))
  253. },
  254. async getProductList() {
  255. const [err, res] = await to(projectApi.getBusinessProduct({ id: this.projectId }))
  256. if (err) return
  257. if (res && res.code == 200) {
  258. this.productList = res.data
  259. }
  260. },
  261. async getProjectDetail() {
  262. const [err, res] = await to(projectApi.getDetail({ id: this.projectId }))
  263. if (err) return
  264. if (res && res.code == 200) {
  265. this.projectData = res.data
  266. //跟进记录
  267. if (this.curTabIndex == 0) {
  268. this.$refs.follow.getRecords()
  269. }
  270. }
  271. },
  272. // 改变tab
  273. changeTabs(data) {
  274. this.curTabIndex = data.index
  275. },
  276. // 打开转移
  277. openFollow() {
  278. this.$store.commit('setDetails', this.projectData)
  279. uni.navigateTo({
  280. //保留当前页面,跳转到应用内的某个页面
  281. url: '/pages/publicPages/follow?targetType=20&id=' + this.projectData.id,
  282. })
  283. },
  284. // 跳转到转移客户
  285. linkToTransfer() {
  286. uni.navigateTo({
  287. //保留当前页面,跳转到应用内的某个页面
  288. url: '/pages/project/transfer?id=' + this.projectId,
  289. })
  290. },
  291. // 升降级
  292. linkToLevel(type) {
  293. if (type === 1) {
  294. uni.navigateTo({
  295. //保留当前页面,跳转到应用内的某个页面
  296. url: '/pages/project/upgrade?id=' + this.projectId,
  297. })
  298. } else {
  299. uni.navigateTo({
  300. //保留当前页面,跳转到应用内的某个页面
  301. url: '/pages/project/downgrade?id=' + this.projectId,
  302. })
  303. }
  304. },
  305. // 跳转到新建项目
  306. createProject() {
  307. uni.navigateTo({
  308. //保留当前页面,跳转到应用内的某个页面
  309. url: '/pages/project/create',
  310. })
  311. },
  312. goBack() {
  313. uni.navigateBack({
  314. //关闭当前页面,返回上一页面或多级页面。
  315. delta: 1,
  316. })
  317. },
  318. },
  319. }
  320. </script>
  321. <style>
  322. page {
  323. background: #f2f3f5;
  324. }
  325. </style>
  326. <style lang="scss" scoped>
  327. .home {
  328. padding-top: 200rpx;
  329. .nav {
  330. position: absolute;
  331. left: 0;
  332. top: 0;
  333. width: 100%;
  334. height: 356rpx;
  335. background: #3e7ef8;
  336. border-radius: 0 0 31rpx 31rpx;
  337. .title {
  338. position: relative;
  339. text-align: center;
  340. font-size: 32rpx;
  341. font-weight: bold;
  342. color: #ffffff;
  343. .back {
  344. position: absolute;
  345. top: 0;
  346. bottom: 0;
  347. margin: auto;
  348. left: 70rpx;
  349. display: flex;
  350. }
  351. }
  352. }
  353. .main {
  354. position: absolute;
  355. width: 100%;
  356. height: calc(100vh - 200rpx);
  357. overflow: hidden;
  358. padding-bottom: 64rpx;
  359. .main-top {
  360. padding: 0 32rpx;
  361. }
  362. .customer-box {
  363. width: 100%;
  364. background: #ffffff;
  365. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  366. border-radius: 32rpx;
  367. padding: 22rpx 38rpx 68rpx 40rpx;
  368. .header {
  369. .name {
  370. .img {
  371. width: 46rpx;
  372. height: 46rpx;
  373. border-radius: 50%;
  374. margin-right: 8rpx;
  375. }
  376. text {
  377. font-size: 28rpx;
  378. font-weight: bold;
  379. color: #323232;
  380. }
  381. }
  382. .date {
  383. font-size: 24rpx;
  384. color: #3e7ef8;
  385. }
  386. }
  387. .info {
  388. .info-item {
  389. margin-top: 18rpx;
  390. .info-label {
  391. width: 120rpx;
  392. text-align: left;
  393. font-size: 24rpx;
  394. color: #646464;
  395. }
  396. .info-txt {
  397. flex: 1;
  398. font-size: 24rpx;
  399. color: #323232;
  400. }
  401. }
  402. }
  403. }
  404. .data-list {
  405. margin-top: 16rpx;
  406. width: 100%;
  407. height: calc(100vh - 532rpx);
  408. background: #ffffff;
  409. padding: 32rpx;
  410. overflow: auto;
  411. padding-bottom: 145rpx;
  412. }
  413. }
  414. .fixed-btn-group {
  415. position: fixed;
  416. display: flex;
  417. justify-content: space-around;
  418. align-items: center;
  419. width: 90rpx;
  420. height: 90rpx;
  421. bottom: 50rpx;
  422. right: 50rpx;
  423. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  424. border-radius: 20px;
  425. transition: all 0.2s;
  426. background: #fff;
  427. .red {
  428. background: #ff4d4f !important;
  429. }
  430. .btn {
  431. width: 60rpx;
  432. height: 60rpx;
  433. background: #3e7ef8;
  434. border-radius: 50%;
  435. margin: 10rpx;
  436. font-size: 26rpx;
  437. font-weight: bold;
  438. color: #ffffff;
  439. }
  440. }
  441. }
  442. </style>