details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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 class="btn center" @click="linkToLevel(1)">升</view>
  115. <view class="red btn center" @click="linkToLevel(0)">降</view>
  116. <view class="btn center" @click="$refs.reserve.open(projectId)">储</view>
  117. <view class="btn center" @click="linkToTransfer()">转</view>
  118. <!-- <view class="btn center" @click="createProject()">增</view> -->
  119. <view class="btn center" @click="openFollow()">跟</view>
  120. </view>
  121. <view class="btn center" @click="openBtnWidth = !openBtnWidth">
  122. <u-icon name="plus" color="#fff" size="20"></u-icon>
  123. </view>
  124. </view>
  125. <!-- 转储备 -->
  126. <transfer-reserve ref="reserve"></transfer-reserve>
  127. </view>
  128. </template>
  129. <script>
  130. import projectApi from '../../api/project'
  131. import to from 'await-to-js'
  132. import projectDetail from './components/projectDetail'
  133. import followRecords from './components/followRecords'
  134. import Contacts from './components/contacts'
  135. import TransferReserve from './components/transferReserve'
  136. import FormList from '@/components/FormList/index'
  137. export default {
  138. name: 'omsIndex',
  139. components: { projectDetail, followRecords, Contacts, TransferReserve, FormList },
  140. data() {
  141. return {
  142. columns: [
  143. {
  144. prop: 'prodCode',
  145. label: '产品编码',
  146. disabled: true,
  147. },
  148. {
  149. prop: 'prodName',
  150. label: '产品名称',
  151. disabled: true,
  152. },
  153. // {
  154. // prop: 'prodClass',
  155. // label: '产品类别',
  156. // customRender: true,
  157. // },
  158. {
  159. prop: 'prodPrice',
  160. label: '产品单价',
  161. customRender: true,
  162. },
  163. {
  164. prop: 'prodNum',
  165. label: '数量',
  166. disabled: true,
  167. },
  168. {
  169. prop: 'totalPrice',
  170. label: '合计',
  171. disabled: true,
  172. },
  173. ],
  174. productList: [],
  175. openBtnWidth: false,
  176. curTabIndex: 0,
  177. fllowList: [], //跟进数据
  178. list: [
  179. {
  180. name: '跟进记录',
  181. index: 0,
  182. },
  183. {
  184. name: '详细信息',
  185. index: 1,
  186. },
  187. {
  188. name: '联系人',
  189. index: 2,
  190. },
  191. {
  192. name: '产品信息',
  193. index: 3,
  194. },
  195. ],
  196. height: '',
  197. paddingTop: '',
  198. projectData: {}, //项目详情
  199. projectId: 0, //项目id
  200. // salesModelOptions: [],
  201. productLineOptions: [], //产品线
  202. // sourceOptions: [],
  203. }
  204. },
  205. onLoad(option) {
  206. this.projectId = parseInt(option.id)
  207. this.getOptions()
  208. },
  209. created() {
  210. const navData = uni.getMenuButtonBoundingClientRect()
  211. this.height = navData.height + 'px'
  212. this.paddingTop = navData.top + 'px'
  213. },
  214. onShow() {
  215. this.getProjectDetail()
  216. },
  217. watch: {
  218. curTabIndex(idx) {
  219. if (idx == 3) {
  220. this.getProductList()
  221. }
  222. },
  223. },
  224. methods: {
  225. dictLabel(datas, value) {
  226. return '32322332'
  227. },
  228. getOptions() {
  229. Promise.all([
  230. // this.getDicts('proj_sales_model'),
  231. this.getDicts('sys_product_line'),
  232. // this.getDicts('proj_nbo_source'),
  233. ])
  234. .then(([line]) => {
  235. // this.salesModelOptions = model.data.values || []
  236. this.productLineOptions = line.data.values || []
  237. // this.sourceOptions = source.data.values || []
  238. })
  239. .catch((err) => console.log(err))
  240. },
  241. async getProductList() {
  242. const [err, res] = await to(projectApi.getBusinessProduct({ id: this.projectId }))
  243. if (err) return
  244. if (res && res.code == 200) {
  245. console.log(res)
  246. this.productList = res.data
  247. }
  248. },
  249. async getProjectDetail() {
  250. const [err, res] = await to(projectApi.getDetail({ id: this.projectId }))
  251. if (err) return
  252. if (res && res.code == 200) {
  253. this.projectData = res.data
  254. //跟进记录
  255. if (this.curTabIndex == 0) {
  256. this.$refs.follow.getRecords()
  257. }
  258. }
  259. },
  260. // 改变tab
  261. changeTabs(data) {
  262. this.curTabIndex = data.index
  263. },
  264. // 打开转移
  265. openFollow() {
  266. this.$store.commit('setDetails', this.projectData)
  267. uni.navigateTo({
  268. //保留当前页面,跳转到应用内的某个页面
  269. url: '/pages/publicPages/follow?targetType=20&id=' + this.projectData.id,
  270. })
  271. },
  272. // 跳转到转移客户
  273. linkToTransfer() {
  274. uni.navigateTo({
  275. //保留当前页面,跳转到应用内的某个页面
  276. url: '/pages/project/transfer?id=' + this.projectId,
  277. })
  278. },
  279. // 升降级
  280. linkToLevel(type) {
  281. if (type === 1) {
  282. uni.navigateTo({
  283. //保留当前页面,跳转到应用内的某个页面
  284. url: '/pages/project/upgrade?id=' + this.projectId,
  285. })
  286. } else {
  287. uni.navigateTo({
  288. //保留当前页面,跳转到应用内的某个页面
  289. url: '/pages/project/downgrade?id=' + this.projectId,
  290. })
  291. }
  292. },
  293. // 跳转到新建项目
  294. createProject() {
  295. uni.navigateTo({
  296. //保留当前页面,跳转到应用内的某个页面
  297. url: '/pages/project/create',
  298. })
  299. },
  300. goBack() {
  301. uni.navigateBack({
  302. //关闭当前页面,返回上一页面或多级页面。
  303. delta: 1,
  304. })
  305. },
  306. },
  307. }
  308. </script>
  309. <style>
  310. page {
  311. background: #f2f3f5;
  312. }
  313. </style>
  314. <style lang="scss" scoped>
  315. .home {
  316. padding-top: 200rpx;
  317. .nav {
  318. position: absolute;
  319. left: 0;
  320. top: 0;
  321. width: 100%;
  322. height: 356rpx;
  323. background: #3e7ef8;
  324. border-radius: 0 0 31rpx 31rpx;
  325. .title {
  326. position: relative;
  327. text-align: center;
  328. font-size: 32rpx;
  329. font-weight: bold;
  330. color: #ffffff;
  331. .back {
  332. position: absolute;
  333. top: 0;
  334. bottom: 0;
  335. margin: auto;
  336. left: 70rpx;
  337. display: flex;
  338. }
  339. }
  340. }
  341. .main {
  342. position: absolute;
  343. width: 100%;
  344. height: calc(100vh - 200rpx);
  345. overflow: hidden;
  346. padding-bottom: 64rpx;
  347. .main-top {
  348. padding: 0 32rpx;
  349. }
  350. .customer-box {
  351. width: 100%;
  352. background: #ffffff;
  353. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  354. border-radius: 32rpx;
  355. padding: 22rpx 38rpx 68rpx 40rpx;
  356. .header {
  357. .name {
  358. .img {
  359. width: 46rpx;
  360. height: 46rpx;
  361. border-radius: 50%;
  362. margin-right: 8rpx;
  363. }
  364. text {
  365. font-size: 28rpx;
  366. font-weight: bold;
  367. color: #323232;
  368. }
  369. }
  370. .date {
  371. font-size: 24rpx;
  372. color: #3e7ef8;
  373. }
  374. }
  375. .info {
  376. .info-item {
  377. margin-top: 18rpx;
  378. .info-label {
  379. width: 120rpx;
  380. text-align: left;
  381. font-size: 24rpx;
  382. color: #646464;
  383. }
  384. .info-txt {
  385. flex: 1;
  386. font-size: 24rpx;
  387. color: #323232;
  388. }
  389. }
  390. }
  391. }
  392. .data-list {
  393. margin-top: 16rpx;
  394. width: 100%;
  395. height: calc(100vh - 532rpx);
  396. background: #ffffff;
  397. padding: 32rpx;
  398. overflow: auto;
  399. padding-bottom: 145rpx;
  400. }
  401. }
  402. .fixed-btn-group {
  403. position: fixed;
  404. display: flex;
  405. justify-content: space-around;
  406. align-items: center;
  407. width: 90rpx;
  408. height: 90rpx;
  409. bottom: 50rpx;
  410. right: 50rpx;
  411. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  412. border-radius: 20px;
  413. transition: all 0.2s;
  414. background: #fff;
  415. .red {
  416. background: #ff4d4f !important;
  417. }
  418. .btn {
  419. width: 60rpx;
  420. height: 60rpx;
  421. background: #3e7ef8;
  422. border-radius: 50%;
  423. margin: 10rpx;
  424. font-size: 26rpx;
  425. font-weight: bold;
  426. color: #ffffff;
  427. }
  428. }
  429. }
  430. </style>