details.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-21 12:00:38
  6. * @Description: file content
  7. * @FilePath: \frontend_mobile\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} {h}:{i}') || '-' }}</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" :custId="projectData.custId"></follow-records>
  84. <!-- 详情 -->
  85. <project-detail v-if="curTabIndex == 1" :detail="projectData"></project-detail>
  86. <!-- 联系人 -->
  87. <contacts v-if="curTabIndex == 2" :projectId="projectId"></contacts>
  88. </view>
  89. </view>
  90. <!-- 新增按钮 -->
  91. <view class="fixed-btn-group" :style="{ width: openBtnWidth ? '480rpx' : '90rpx' }">
  92. <view class="flex1" v-if="openBtnWidth">
  93. <view class="btn center" @click="linkToLevel(1)">升</view>
  94. <view class="red btn center" @click="linkToLevel(0)">降</view>
  95. <view class="btn center" @click="$refs.reserve.open(projectId)">储</view>
  96. <view class="btn center" @click="linkToTransfer()">转</view>
  97. <!-- <view class="btn center" @click="createProject()">增</view> -->
  98. <view class="btn center" @click="openFollow()">跟</view>
  99. </view>
  100. <view class="btn center" @click="openBtnWidth = !openBtnWidth">
  101. <u-icon name="plus" color="#fff" size="20"></u-icon>
  102. </view>
  103. </view>
  104. <!-- 转储备 -->
  105. <transfer-reserve ref="reserve"></transfer-reserve>
  106. </view>
  107. </template>
  108. <script>
  109. import projectApi from '../../api/project'
  110. import to from 'await-to-js'
  111. import projectDetail from './components/projectDetail'
  112. import followRecords from './components/followRecords'
  113. import Contacts from './components/contacts'
  114. import TransferReserve from './components/transferReserve'
  115. export default {
  116. name: 'omsIndex',
  117. components: { projectDetail, followRecords, Contacts, TransferReserve },
  118. data() {
  119. return {
  120. openBtnWidth: false,
  121. curTabIndex: 0,
  122. fllowList: [], //跟进数据
  123. list: [
  124. {
  125. name: '活动记录',
  126. index: 0,
  127. },
  128. {
  129. name: '详细信息',
  130. index: 1,
  131. },
  132. {
  133. name: '联系人',
  134. index: 2,
  135. },
  136. ],
  137. height: '',
  138. paddingTop: '',
  139. projectData: {}, //项目详情
  140. projectId: 0, //项目id
  141. // salesModelOptions: [],
  142. productLineOptions: [], //产品线
  143. // sourceOptions: [],
  144. }
  145. },
  146. onLoad(option) {
  147. this.projectId = parseInt(option.id)
  148. this.getOptions()
  149. },
  150. created() {
  151. const navData = uni.getMenuButtonBoundingClientRect()
  152. this.height = navData.height + 'px'
  153. this.paddingTop = navData.top + 'px'
  154. },
  155. onShow() {
  156. this.getProjectDetail()
  157. },
  158. methods: {
  159. getOptions() {
  160. Promise.all([
  161. // this.getDicts('proj_sales_model'),
  162. this.getDicts('sys_product_line'),
  163. // this.getDicts('proj_nbo_source'),
  164. ])
  165. .then(([line]) => {
  166. // this.salesModelOptions = model.data.values || []
  167. this.productLineOptions = line.data.values || []
  168. // this.sourceOptions = source.data.values || []
  169. })
  170. .catch((err) => console.log(err))
  171. },
  172. async getProjectDetail() {
  173. const [err, res] = await to(projectApi.getDetail({ id: this.projectId }))
  174. if (err) return
  175. if (res && res.code == 200) {
  176. this.$refs.follow.getRecords()
  177. this.projectData = res.data
  178. }
  179. },
  180. // 改变tab
  181. changeTabs(data) {
  182. this.curTabIndex = data.index
  183. },
  184. // 打开转移
  185. openFollow() {
  186. this.$store.commit('setDetails', this.projectData)
  187. uni.navigateTo({
  188. //保留当前页面,跳转到应用内的某个页面
  189. url: '/pages/publicPages/follow?targetType=20',
  190. })
  191. },
  192. // 跳转到转移客户
  193. linkToTransfer() {
  194. uni.navigateTo({
  195. //保留当前页面,跳转到应用内的某个页面
  196. url: '/pages/project/transfer?id=' + this.projectId,
  197. })
  198. },
  199. // 升降级
  200. linkToLevel(type) {
  201. if (type === 1) {
  202. uni.navigateTo({
  203. //保留当前页面,跳转到应用内的某个页面
  204. url: '/pages/project/upgrade?id=' + this.projectId,
  205. })
  206. } else {
  207. uni.navigateTo({
  208. //保留当前页面,跳转到应用内的某个页面
  209. url: '/pages/project/downgrade?id=' + this.projectId,
  210. })
  211. }
  212. },
  213. // 跳转到新建项目
  214. createProject() {
  215. uni.navigateTo({
  216. //保留当前页面,跳转到应用内的某个页面
  217. url: '/pages/project/create',
  218. })
  219. },
  220. goBack() {
  221. uni.navigateBack({
  222. //关闭当前页面,返回上一页面或多级页面。
  223. delta: 1,
  224. })
  225. },
  226. },
  227. }
  228. </script>
  229. <style>
  230. page {
  231. background: #f2f3f5;
  232. }
  233. </style>
  234. <style lang="scss" scoped>
  235. .home {
  236. padding-top: 200rpx;
  237. .nav {
  238. position: absolute;
  239. left: 0;
  240. top: 0;
  241. width: 100%;
  242. height: 356rpx;
  243. background: #3e7ef8;
  244. border-radius: 0 0 31rpx 31rpx;
  245. .title {
  246. position: relative;
  247. text-align: center;
  248. font-size: 32rpx;
  249. font-weight: bold;
  250. color: #ffffff;
  251. .back {
  252. position: absolute;
  253. top: 0;
  254. bottom: 0;
  255. margin: auto;
  256. left: 70rpx;
  257. display: flex;
  258. }
  259. }
  260. }
  261. .main {
  262. position: absolute;
  263. width: 100%;
  264. height: calc(100vh - 200rpx);
  265. overflow: hidden;
  266. padding-bottom: 64rpx;
  267. .main-top {
  268. padding: 0 32rpx;
  269. }
  270. .customer-box {
  271. width: 100%;
  272. background: #ffffff;
  273. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  274. border-radius: 32rpx;
  275. padding: 22rpx 38rpx 68rpx 40rpx;
  276. .header {
  277. .name {
  278. .img {
  279. width: 46rpx;
  280. height: 46rpx;
  281. border-radius: 50%;
  282. margin-right: 8rpx;
  283. }
  284. text {
  285. font-size: 28rpx;
  286. font-weight: bold;
  287. color: #323232;
  288. }
  289. }
  290. .date {
  291. font-size: 24rpx;
  292. color: #3e7ef8;
  293. }
  294. }
  295. .info {
  296. .info-item {
  297. margin-top: 18rpx;
  298. .info-label {
  299. width: 120rpx;
  300. text-align: left;
  301. font-size: 24rpx;
  302. color: #646464;
  303. }
  304. .info-txt {
  305. flex: 1;
  306. font-size: 24rpx;
  307. color: #323232;
  308. }
  309. }
  310. }
  311. }
  312. .data-list {
  313. margin-top: 16rpx;
  314. width: 100%;
  315. height: calc(100vh - 532rpx);
  316. background: #ffffff;
  317. padding: 32rpx;
  318. overflow: auto;
  319. padding-bottom: 145rpx;
  320. .status1 {
  321. color: #4096fb;
  322. background: rgba(64, 150, 251, 0.2);
  323. }
  324. .status2 {
  325. background: rgba(255, 184, 60, 0.2);
  326. color: #ffb83c;
  327. }
  328. .status3 {
  329. color: #fe6936;
  330. background: rgba(254, 105, 54, 0.2);
  331. }
  332. }
  333. }
  334. .fixed-btn-group {
  335. position: fixed;
  336. display: flex;
  337. justify-content: space-around;
  338. align-items: center;
  339. width: 90rpx;
  340. height: 90rpx;
  341. bottom: 50rpx;
  342. right: 50rpx;
  343. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  344. border-radius: 20px;
  345. transition: all 0.2s;
  346. background: #fff;
  347. .red {
  348. background: #ff4d4f !important;
  349. }
  350. .btn {
  351. width: 60rpx;
  352. height: 60rpx;
  353. background: #3e7ef8;
  354. border-radius: 50%;
  355. margin: 10rpx;
  356. font-size: 26rpx;
  357. font-weight: bold;
  358. color: #ffffff;
  359. }
  360. }
  361. }
  362. </style>