detail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-15 18:21:43
  6. * @Description: file content
  7. * @FilePath: \oms\pages\customer\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/menu1.png" mode="scaleToFill" />
  27. <text>{{ detail.contractName }}</text>
  28. </view>
  29. <view class="date">{{ parseTime(detail.createdTime, '{y}-{m}-{d}') }}</view>
  30. </view>
  31. <view class="info">
  32. <view class="info-item">
  33. <u-row>
  34. <u-col span="7">
  35. <view class="flex_l">
  36. <view class="info-label">客户名称:</view>
  37. <text class="info-txt">{{ detail.custName }}</text>
  38. </view>
  39. </u-col>
  40. <u-col span="5">
  41. <view class="flex_l">
  42. <view class="info-label">负责人:</view>
  43. <text class="info-txt">{{ detail.inchargeName }}</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="7">
  51. <view class="flex_l">
  52. <view class="info-label">合同金额:</view>
  53. <text class="info-txt">{{ formatPrice(detail.contractAmount) }}</text>
  54. </view>
  55. </u-col>
  56. <u-col span="5">
  57. <view class="flex_l">
  58. <view class="info-label">回款金额:</view>
  59. <text class="info-txt">{{ formatPrice(detail.collectedAmount) }}</text>
  60. </view>
  61. </u-col>
  62. </u-row>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="tabs">
  67. <u-tabs @change="changeTabs" lineWidth="8" :current="curTabIndex" lineHeight="8" :scrollable="false"
  68. :list="list" :lineColor="`url(${lineBg}) 100% 100%`" :activeStyle="{
  69. color: '#3E7EF8',
  70. fontWeight: 'bold',
  71. }" :inactiveStyle="{
  72. color: '#969696',
  73. }" itemStyle="height: 90rpx;"></u-tabs>
  74. </view>
  75. </view>
  76. <view class="data-list">
  77. <!-- 产品 -->
  78. <contract-product v-if="curTabIndex == 0" :list="product"></contract-product>
  79. <!-- 回款记录 -->
  80. <contract-collection v-else-if="curTabIndex == 1" :contractId="contractId"></contract-collection>
  81. <!-- 详情 -->
  82. <contract-detail v-else-if="curTabIndex == 2" :detail="detail">
  83. </contract-detail>
  84. <!-- 发票 -->
  85. <contract-invoice v-else-if="curTabIndex == 3" :contractId="contractId"></contract-invoice>
  86. <!-- 活动 -->
  87. <contract-dynamics v-else-if="curTabIndex == 4" :contractId="contractId"></contract-dynamics>
  88. </view>
  89. </view>
  90. <!-- 新增按钮 -->
  91. <view class="fixed-btn-group" :style="{ width: openBtnWidth ? '320rpx' : '90rpx' }">
  92. <view class="flex1" v-if="openBtnWidth">
  93. <view class="btn center" @click="linkToCollection()">回</view>
  94. <view class="btn center" @click="linkToInvoice()">发</view>
  95. </view>
  96. <view class="btn center" @click="openBtnWidth = !openBtnWidth">
  97. <u-icon name="plus" color="#fff" size="20"></u-icon>
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import customerApi from '../../api/customer'
  104. import contApi from '../../api/contract'
  105. import ContractDetail from './components/contractDetail'
  106. import ContractCollection from './components/contractCollection'
  107. import ContractInvoice from './components/contractInvoice'
  108. import ContractProduct from './components/contractProduct'
  109. import ContractDynamics from './components/contractDynamics'
  110. import to from 'await-to-js'
  111. export default {
  112. name: 'omsIndex',
  113. components: {
  114. ContractDetail,
  115. ContractCollection,
  116. ContractInvoice,
  117. ContractProduct,
  118. ContractDynamics
  119. },
  120. data() {
  121. return {
  122. openBtnWidth: false,
  123. lineBg: require('../../static/images/up.png'),
  124. curTabIndex: 0,
  125. fllowList: [], //跟进数据
  126. list: [{
  127. name: '产品',
  128. index: 0,
  129. },
  130. {
  131. name: '回款',
  132. index: 1,
  133. },
  134. {
  135. name: '详情',
  136. index: 2,
  137. },
  138. {
  139. name: '发票',
  140. index: 3,
  141. },
  142. {
  143. name: '活动',
  144. index: 4,
  145. },
  146. ],
  147. height: '',
  148. paddingTop: '',
  149. detail: {},
  150. abstractDetail: null,
  151. custStatus: {
  152. 10: '正常',
  153. 20: '异常',
  154. },
  155. contractId: 0, //客户id
  156. product:[]
  157. }
  158. },
  159. onLoad(option) {
  160. this.contractId = parseInt(option.id)
  161. },
  162. created() {
  163. const navData = uni.getMenuButtonBoundingClientRect()
  164. this.height = navData.height + 'px'
  165. this.paddingTop = navData.top + 'px'
  166. },
  167. onShow() {
  168. this.openBtnWidth = false
  169. this.getCustomerDetail()
  170. },
  171. methods: {
  172. async getCustomerDetail() {
  173. const [err, res] = await to(contApi.getDetails({
  174. id: this.contractId
  175. }))
  176. if (err) return
  177. if (res && res.code == 200) {
  178. let {
  179. product,
  180. ...data
  181. } = res.data
  182. this.product = product
  183. this.detail = data
  184. }
  185. },
  186. // 改变tab
  187. changeTabs(data) {
  188. this.curTabIndex = data.index
  189. },
  190. // 打开转移
  191. openFollow() {
  192. this.$store.commit('setDetails', this.detail)
  193. uni.navigateTo({
  194. //保留当前页面,跳转到应用内的某个页面
  195. url: '/pages/publicPages/follow?targetType=10',
  196. })
  197. },
  198. // 跳转到新建回款
  199. linkToInvoice() {
  200. uni.navigateTo({
  201. //保留当前页面,跳转到应用内的某个页面
  202. url: '/pages/contract/invoice?id=' + this.contractId + '&code=' + this.detail.contractCode,
  203. })
  204. },
  205. linkToCollection() {
  206. uni.navigateTo({
  207. //保留当前页面,跳转到应用内的某个页面
  208. url: '/pages/contract/collection?id=' + this.contractId + '&code=' + this.detail.contractCode,
  209. })
  210. },
  211. goBack() {
  212. uni.navigateBack({
  213. //关闭当前页面,返回上一页面或多级页面。
  214. delta: 1,
  215. })
  216. },
  217. },
  218. }
  219. </script>
  220. <style>
  221. page {
  222. background: #f2f3f5;
  223. }
  224. </style>
  225. <style lang="scss" scoped>
  226. .home {
  227. padding-top: 200rpx;
  228. .nav {
  229. position: absolute;
  230. left: 0;
  231. top: 0;
  232. width: 100%;
  233. height: 356rpx;
  234. background: #3e7ef8;
  235. border-radius: 0 0 31rpx 31rpx;
  236. .title {
  237. position: relative;
  238. text-align: center;
  239. font-size: 32rpx;
  240. font-weight: bold;
  241. color: #ffffff;
  242. .back {
  243. position: absolute;
  244. top: 0;
  245. bottom: 0;
  246. margin: auto;
  247. left: 70rpx;
  248. display: flex;
  249. }
  250. }
  251. }
  252. .main {
  253. position: absolute;
  254. width: 100%;
  255. height: calc(100vh - 200rpx);
  256. overflow: hidden;
  257. padding-bottom: 64rpx;
  258. .main-top {
  259. padding: 0 32rpx;
  260. }
  261. .customer-box {
  262. width: 100%;
  263. background: #ffffff;
  264. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  265. border-radius: 32rpx;
  266. padding: 22rpx 38rpx 68rpx 40rpx;
  267. .header {
  268. .name {
  269. .img {
  270. width: 46rpx;
  271. height: 46rpx;
  272. border-radius: 50%;
  273. margin-right: 8rpx;
  274. }
  275. text {
  276. font-size: 28rpx;
  277. font-weight: bold;
  278. color: #323232;
  279. }
  280. }
  281. .date {
  282. font-size: 24rpx;
  283. color: #3e7ef8;
  284. }
  285. }
  286. .info {
  287. .info-item {
  288. margin-top: 18rpx;
  289. .info-label {
  290. text-align: left;
  291. font-size: 24rpx;
  292. color: #646464;
  293. }
  294. .info-txt {
  295. flex: 1;
  296. font-size: 24rpx;
  297. color: #323232;
  298. }
  299. }
  300. }
  301. }
  302. .data-list {
  303. margin-top: 16rpx;
  304. width: 100%;
  305. height: calc(100vh - 532rpx);
  306. background: #ffffff;
  307. padding: 32rpx;
  308. overflow: auto;
  309. padding-bottom: 145rpx;
  310. .status1 {
  311. color: #4096fb;
  312. background: rgba(64, 150, 251, 0.2);
  313. }
  314. .status2 {
  315. background: rgba(255, 184, 60, 0.2);
  316. color: #ffb83c;
  317. }
  318. .status3 {
  319. color: #fe6936;
  320. background: rgba(254, 105, 54, 0.2);
  321. }
  322. }
  323. }
  324. .fixed-btn-group {
  325. position: fixed;
  326. display: flex;
  327. justify-content: space-around;
  328. align-items: center;
  329. width: 90rpx;
  330. height: 90rpx;
  331. bottom: 50rpx;
  332. right: 50rpx;
  333. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  334. border-radius: 20px;
  335. transition: all 0.2s;
  336. .btn {
  337. width: 60rpx;
  338. height: 60rpx;
  339. background: #3e7ef8;
  340. border-radius: 50%;
  341. margin: 10rpx;
  342. font-size: 26rpx;
  343. font-weight: bold;
  344. color: #ffffff;
  345. }
  346. }
  347. }
  348. </style>