detail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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.getCustomerDetail()
  169. },
  170. methods: {
  171. async getCustomerDetail() {
  172. const [err, res] = await to(contApi.getDetails({
  173. id: this.contractId
  174. }))
  175. if (err) return
  176. if (res && res.code == 200) {
  177. let {
  178. product,
  179. ...data
  180. } = res.data
  181. this.product = product
  182. this.detail = data
  183. }
  184. },
  185. // 改变tab
  186. changeTabs(data) {
  187. this.curTabIndex = data.index
  188. },
  189. // 打开转移
  190. openFollow() {
  191. this.$store.commit('setDetails', this.detail)
  192. uni.navigateTo({
  193. //保留当前页面,跳转到应用内的某个页面
  194. url: '/pages/publicPages/follow?targetType=10',
  195. })
  196. },
  197. // 跳转到新建回款
  198. linkToInvoice() {
  199. uni.navigateTo({
  200. //保留当前页面,跳转到应用内的某个页面
  201. url: '/pages/contract/invoice?id=' + this.contractId + '&code=' + this.detail.contractCode,
  202. })
  203. },
  204. linkToCollection() {
  205. uni.navigateTo({
  206. //保留当前页面,跳转到应用内的某个页面
  207. url: '/pages/contract/collection?id=' + this.contractId + '&code=' + this.detail.contractCode,
  208. })
  209. },
  210. goBack() {
  211. uni.navigateBack({
  212. //关闭当前页面,返回上一页面或多级页面。
  213. delta: 1,
  214. })
  215. },
  216. },
  217. }
  218. </script>
  219. <style>
  220. page {
  221. background: #f2f3f5;
  222. }
  223. </style>
  224. <style lang="scss" scoped>
  225. .home {
  226. padding-top: 200rpx;
  227. .nav {
  228. position: absolute;
  229. left: 0;
  230. top: 0;
  231. width: 100%;
  232. height: 356rpx;
  233. background: #3e7ef8;
  234. border-radius: 0 0 31rpx 31rpx;
  235. .title {
  236. position: relative;
  237. text-align: center;
  238. font-size: 32rpx;
  239. font-weight: bold;
  240. color: #ffffff;
  241. .back {
  242. position: absolute;
  243. top: 0;
  244. bottom: 0;
  245. margin: auto;
  246. left: 70rpx;
  247. display: flex;
  248. }
  249. }
  250. }
  251. .main {
  252. position: absolute;
  253. width: 100%;
  254. height: calc(100vh - 200rpx);
  255. overflow: hidden;
  256. padding-bottom: 64rpx;
  257. .main-top {
  258. padding: 0 32rpx;
  259. }
  260. .customer-box {
  261. width: 100%;
  262. background: #ffffff;
  263. box-shadow: 0 6rpx 19rpx 2rpx rgba(0, 45, 132, 0.15);
  264. border-radius: 32rpx;
  265. padding: 22rpx 38rpx 68rpx 40rpx;
  266. .header {
  267. .name {
  268. .img {
  269. width: 46rpx;
  270. height: 46rpx;
  271. border-radius: 50%;
  272. margin-right: 8rpx;
  273. }
  274. text {
  275. font-size: 28rpx;
  276. font-weight: bold;
  277. color: #323232;
  278. }
  279. }
  280. .date {
  281. font-size: 24rpx;
  282. color: #3e7ef8;
  283. }
  284. }
  285. .info {
  286. .info-item {
  287. margin-top: 18rpx;
  288. .info-label {
  289. text-align: left;
  290. font-size: 24rpx;
  291. color: #646464;
  292. }
  293. .info-txt {
  294. flex: 1;
  295. font-size: 24rpx;
  296. color: #323232;
  297. }
  298. }
  299. }
  300. }
  301. .data-list {
  302. margin-top: 16rpx;
  303. width: 100%;
  304. height: calc(100vh - 532rpx);
  305. background: #ffffff;
  306. padding: 32rpx;
  307. overflow: auto;
  308. padding-bottom: 145rpx;
  309. .status1 {
  310. color: #4096fb;
  311. background: rgba(64, 150, 251, 0.2);
  312. }
  313. .status2 {
  314. background: rgba(255, 184, 60, 0.2);
  315. color: #ffb83c;
  316. }
  317. .status3 {
  318. color: #fe6936;
  319. background: rgba(254, 105, 54, 0.2);
  320. }
  321. }
  322. }
  323. .fixed-btn-group {
  324. position: fixed;
  325. display: flex;
  326. justify-content: space-around;
  327. align-items: center;
  328. width: 90rpx;
  329. height: 90rpx;
  330. bottom: 50rpx;
  331. right: 50rpx;
  332. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  333. border-radius: 20px;
  334. transition: all 0.2s;
  335. .btn {
  336. width: 60rpx;
  337. height: 60rpx;
  338. background: #3e7ef8;
  339. border-radius: 50%;
  340. margin: 10rpx;
  341. font-size: 26rpx;
  342. font-weight: bold;
  343. color: #ffffff;
  344. }
  345. }
  346. }
  347. </style>