contract.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view v-if='contractInfo'>
  3. <view class="content">
  4. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="onReachBottomTmp">
  5. <view class="guess-section">
  6. <view
  7. v-for="(item, index) in contractInfo.tran" :key="index"
  8. class="guess-item"
  9. @click="navToDetailPage(item)"
  10. >
  11. <view class="flex justify-between padding-xs ">
  12. <view style='background:#4BA831;' class='contractType'>{{item.contractType}}</view>
  13. <view style='width:75%;'>
  14. <view>合同编号:{{item.contractNo}}</view>
  15. <view>运输人员:{{item.driver}}</view>
  16. <view>运输车牌:{{item.carNo}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view
  21. v-for="(item, index) in contractInfo.trade" :key="index"
  22. class="guess-item"
  23. >
  24. <view class="flex justify-between padding-xs ">
  25. <view style='background:#3C73F2;' v-if="item.contractType == '销售合同'" class='contractType'>
  26. <text v-if='item.tips != 0' class='badge'>{{item.tips}}</text>
  27. <!-- <text class='badge'>1</text> -->
  28. {{item.contractType}}
  29. </view>
  30. <view style='background:#E3A13E;' v-if="item.contractType == '采购合同'" class='contractType'>
  31. <text v-if='item.tips != 0' class='badge'>{{item.tips}}</text>
  32. <!-- <text class='badge'>1</text> -->
  33. {{item.contractType}}
  34. </view>
  35. <view style='width:75%;'>
  36. <view class='flex justify-between'>
  37. <view>合同编号:{{item.contractNo}}</view>
  38. <view v-if='item.tradeStatus==2'>已受理</view>
  39. <view v-if='item.tradeStatus==3'>已成交</view>
  40. <view v-if='item.tradeStatus==4'>已完成</view>
  41. </view>
  42. <view v-if='item.tradeStatus==2' class='flex justify-between'>
  43. <text style='display:inline-block;margin-right:5px;' v-if="item.price">暂定价:{{item.price}}</text>
  44. <text style='display:inline-block;margin-right:5px;' v-if="item.basis">基差:{{item.basis}}</text>
  45. <text style='display:inline-block;margin-right:5px;' v-if="item.allCount">吨位:{{item.allCount}}T</text>
  46. </view>
  47. <view v-else class='flex justify-between'>
  48. <text style='display:inline-block;margin-right:5px;' v-if="item.price">成交价:{{item.price}}</text>
  49. <text style='display:inline-block;margin-right:5px;' v-if="item.basis">基差:{{item.basis}}</text>
  50. <text style='display:inline-block;margin-right:5px;' v-if="item.allCount">吨位:{{item.allCount}}T</text>
  51. </view>
  52. <view class='flex button-group'><button @click="navToDetailPage2(item)">操作</button><button @click="examine(item)">查看</button></view>
  53. <!-- <view class='flex justify-between' v-if="item.contractType == '采购合同'">
  54. <text style='display:inline-block;margin-right:5px;' >总量:{{item.allCount}}</text>
  55. <text style='display:inline-block;margin-right:5px;' >已完成量 {{item.num}}</text>
  56. </view>
  57. <view class='flex justify-between' v-if="item.contractType == '采购合同'">
  58. <text style='display:inline-block;margin-right:5px;' v-if="item.money">应付金额:{{item.money}}</text>
  59. <text style='display:inline-block;margin-right:5px;' v-if='item.notMoney'>未付金额:{{item.notMoney}}</text>
  60. </view>
  61. <view class='flex justify-between' v-if="item.contractType == '销售合同'">
  62. <text style='display:inline-block;margin-right:5px;' v-if="item.money">应收金额:{{item.money}}</text>
  63. <text style='display:inline-block;margin-right:5px;' v-if='item.notMoney'>未收金额:{{item.notMoney}}</text>
  64. </view>
  65. <view class='flex justify-between'>
  66. <text style='display:inline-block;margin-right:5px;' v-if="item.basis">基差:{{item.basis}}</text>
  67. <text style='display:inline-block;margin-right:5px;' v-if="item.price">点价金额:{{item.price}}</text>
  68. </view>
  69. <view class='flex justify-between'>
  70. <text v-if="item.invoiceMoney">发票费:{{item.invoiceMoney}}</text>
  71. <text v-if="item.packingMoney">包装费:{{item.packingMoney}}</text>
  72. <text v-if="item.unloadingFee">卸车费:{{item.unloadingFee}}</text>
  73. <text v-if="item.deductionFee">总扣款(元):{{item.deductionFee}}</text>
  74. </view> -->
  75. </view>
  76. <!-- <text class='badge'>11</text> -->
  77. </view>
  78. <!-- <view class="flex justify-between padding-xs ">
  79. <view class=" padding-xs">
  80. <view class="cu-capsule radius">
  81. <view class="cu-tag bg-green">
  82. {{item.contractType}}
  83. </view>
  84. <view class="cu-tag line-green">
  85. {{item.contractNo}}
  86. </view>
  87. </view>
  88. <view class="cu-capsule radius">
  89. <view v-if="item.allCount" class="cu-tag bg-orange">
  90. 总量 {{item.allCount}}
  91. </view>
  92. <view v-if="item.allCount&&item.num" class="cu-tag line-orange">
  93. <view v-if="item.allCount-item.num > 0">未完成量 {{item.allCount-item.num}}</view>
  94. <view v-else>未完成量 0</view>
  95. </view>
  96. <view v-if="item.basis" class="cu-tag line-orange">
  97. <view>基差 {{basis}}</view>
  98. </view>
  99. <view v-if="item.price" class="cu-tag bg-orange">
  100. 点价金额 {{item.price}}
  101. </view>
  102. </view>
  103. <view class="cu-capsule radius">
  104. <view v-if="item.money && item.contractType == '销售合同'" class="cu-tag bg-orange">
  105. 应收款 {{item.money}}
  106. </view>
  107. <view v-if="item.notMoney && item.contractType == '销售合同'" class="cu-tag line-orange">
  108. 未收款 {{item.notMoney}}
  109. </view>
  110. <view v-if="item.money && item.contractType == '采购合同'" class="cu-tag bg-orange">
  111. 应付款 {{item.money}}
  112. </view>
  113. <view v-if="item.notMoney && item.contractType == '采购合同'" class="cu-tag line-orange">
  114. 未付款 {{item.notMoney}}
  115. </view>
  116. <view v-if="item.definitePrice" class="cu-tag bg-orange">
  117. 我的定金 {{item.definitePrice}}
  118. </view>
  119. </view>
  120. </view>
  121. <text v-if='item.tips != 0' class='badge'>{{item.tips}}</text>
  122. </view> -->
  123. </view>
  124. <view v-show="isLoadMore">
  125. <uni-load-more :status="loadStatus" ></uni-load-more>
  126. </view>
  127. </view>
  128. </scroll-view>
  129. </view>
  130. </view>
  131. <view v-else>
  132. 当前暂无合同信息
  133. </view>
  134. </template>
  135. <script>
  136. import {
  137. mapState
  138. } from 'vuex';
  139. export default {
  140. data() {
  141. return {
  142. contractInfo: [],
  143. pages:1,//页数
  144. limit:10 ,//每次取条目数
  145. price: 0,
  146. loadStatus:'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  147. isLoadMore:false //是否加载中
  148. };
  149. },
  150. computed: {
  151. ...mapState(['hasLogin','userInfo'])
  152. },
  153. onShow() {
  154. this.loadData()
  155. },
  156. //下拉刷新
  157. onPullDownRefresh() {
  158. this.pages = 1
  159. this.isLoadMore = false
  160. this.loadStatus = 'loading'
  161. this.loadData()
  162. },
  163. onLoad(options) {
  164. },
  165. // onPageScroll(e) {
  166. // //兼容iOS端下拉时顶部漂移
  167. // if (e.scrollTop >= 0) {
  168. // this.headerPosition = "fixed";
  169. // } else {
  170. // this.headerPosition = "absolute";
  171. // }
  172. // },
  173. onReachBottom(){ //上拉触底函数
  174. if(!this.isLoadMore){ //此处判断,上锁,防止重复请求
  175. this.isLoadMore=true
  176. this.pages += 1
  177. this.getContractData()
  178. }
  179. },
  180. methods: {
  181. async loadData() {
  182. const that = this
  183. uni.showLoading({
  184. title: '正在加载',
  185. mask:true
  186. })
  187. that.$api.request('contract', 'getTranContractList',{
  188. page: this.pages,
  189. limit:this.limit
  190. }, failres => {
  191. that.$api.msg(failres.errmsg)
  192. this.isLoadMore = false
  193. this.loadStatus = 'nomore'
  194. if(this.pages>1){this.pages=1}
  195. uni.hideLoading()
  196. uni.stopPullDownRefresh()
  197. }).then(res => {
  198. that.contractInfo = res.data
  199. uni.hideLoading()
  200. uni.stopPullDownRefresh()
  201. })
  202. if (!this.hasLogin) {
  203. uni.showModal({
  204. title: '登录提示',
  205. content: '您尚未登录,是否立即登录?',
  206. showCancel: true,
  207. confirmText: '登录',
  208. success: (e) => {
  209. if (e.confirm) {
  210. uni.navigateTo({
  211. url: '/pages/public/login'
  212. })
  213. }
  214. },
  215. fail: () => {},
  216. complete: () => {}
  217. })
  218. }
  219. },
  220. examine(item){
  221. uni.navigateTo({
  222. url: `/pageB/contract/look?contractNo=${item.contractNo}`
  223. })
  224. },
  225. //详情
  226. navToDetailPage(item) {
  227. var that = this
  228. uni.showLoading({
  229. title: '正在加载',
  230. mask:true
  231. })
  232. uni.downloadFile({
  233. url: item.contractImg,
  234. success: function (res) {
  235. var filePath = res.tempFilePath;
  236. uni.openDocument({
  237. filePath: filePath,
  238. success: function (res) {
  239. uni.hideLoading()
  240. console.log('打开文档成功');
  241. }
  242. });
  243. },
  244. })
  245. },
  246. navToDetailPage2(item) {
  247. uni.navigateTo({
  248. url: `/pageA/pages/deliver_goods?id=${item.id}&contractType=${item.contractType}&tradeStatus=${item.tradeStatus}`
  249. })
  250. },
  251. onReachBottomTmp(){ //上拉触底函数
  252. if(!this.isLoadMore){ //此处判断,上锁,防止重复请求
  253. this.isLoadMore=true
  254. this.pages += 1
  255. this.getContractData()
  256. }
  257. },
  258. getContractData(){
  259. const that = this
  260. var pages=that.pages
  261. var limit=that.limit
  262. uni.showLoading({
  263. title: '正在加载',
  264. mask:true
  265. })
  266. that.$api.request('contract', 'getTranContractList', {
  267. page: pages,
  268. limit:limit
  269. },failres => {
  270. that.$api.msg(failes.errmsg)
  271. that.isLoadMore=false
  272. that.loadStatus = 'nomore'
  273. if(that.pages>1){that.pages-=1}
  274. uni.hideLoading()
  275. }).then(res => {
  276. //销售信息
  277. if(that.contractInfo.length > 0){
  278. that.contractInfo = that.contractInfo.concat(data)
  279. that.isLoadMore=false
  280. }
  281. else{
  282. if(that.pages>1){that.pages-=1}
  283. that.isLoadMore=true
  284. that.loadStatus = 'nomore'
  285. }
  286. uni.hideLoading()
  287. })
  288. }
  289. },
  290. }
  291. </script>
  292. <style lang='scss' scoped>
  293. .contractType{
  294. padding: 10px 15px;
  295. width: 118rpx;
  296. border-radius: 9rpx;
  297. height: 118rpx;
  298. position: relative;
  299. }
  300. .button-group{
  301. margin-top:10px;
  302. justify-content: space-between;
  303. }
  304. .button-group button{
  305. height: 30px;
  306. font-size: 12px;
  307. line-height: 30px;
  308. margin:0;
  309. }
  310. page,
  311. .content {
  312. background: $page-color-base;
  313. height: 100%;
  314. }
  315. .cu-tag {
  316. font-size: 40rpx;
  317. word-break:break-all;
  318. }
  319. .container{
  320. padding-bottom: 100upx;
  321. }
  322. .cu-capsule+.cu-capsule {
  323. margin-left: 0rpx;
  324. }
  325. .cu-capsule {
  326. display: flex;
  327. position: relative;
  328. margin: 5px 0;
  329. }
  330. .cu-form-group input {
  331. text-align: right;
  332. }
  333. .cu-form-group textarea {
  334. text-align: right;
  335. }
  336. .place{
  337. font-size: 40rpx;
  338. line-height: 1;
  339. padding-right: 10upx;
  340. }
  341. .place-center{
  342. font-size: 28rpx;
  343. }
  344. .guess-item{
  345. /* margin-top: 10rpx; */
  346. }
  347. .btn-size{
  348. font-size: 28rpx;
  349. }
  350. .place-bottom{
  351. margin-top: 20rpx;
  352. }
  353. .swiper-box {
  354. height: calc(100% - 40px);
  355. }
  356. .list-scroll-content {
  357. height: 100%;
  358. }
  359. .uni-swiper-item {
  360. height: auto;
  361. }
  362. /* 标题简介 */
  363. .introduce-section_contract {
  364. background: #fff;
  365. padding: 20upx 30upx;
  366. }
  367. .title {
  368. font-size: 34upx;
  369. color: $font-color-dark;
  370. height: 50upx;
  371. line-height: 50upx;
  372. flex:3;
  373. }
  374. .title-tip {
  375. flex:1;
  376. color:#fa436a;
  377. }
  378. .price-box {
  379. display: flex;
  380. align-items: baseline;
  381. height: 100upx;
  382. padding: 10upx 0;
  383. font-size: 26upx;
  384. color: $uni-color-primary;
  385. }
  386. .price_contract {
  387. font-size: 34rpx;
  388. }
  389. .m-price {
  390. margin: 0 12upx;
  391. color: $font-color-light;
  392. text-decoration: line-through;
  393. }
  394. .coupon-tip {
  395. align-items: center;
  396. padding: 4upx 10upx;
  397. background: $uni-color-primary;
  398. font-size: $font-sm;
  399. color: #fff;
  400. border-radius: 6upx;
  401. line-height: 1;
  402. transform: translateY(-4upx);
  403. }
  404. .bot-row {
  405. display: flex;
  406. align-items: center;
  407. height: 50upx;
  408. font-size: $font-sm;
  409. color: $font-color-light;
  410. }
  411. .guess-section{
  412. padding-bottom: 100upx;
  413. display:flex;
  414. flex-wrap:wrap;
  415. padding: 0 30upx;
  416. background: #fff;
  417. .guess-item{
  418. display:flex;
  419. flex-direction: column;
  420. width: 98%;
  421. border-bottom:1px solid #f8f8f8;
  422. }
  423. .image-wrapper{
  424. width: 100%;
  425. height: 330upx;
  426. border-radius: 3px;
  427. overflow: hidden;
  428. image{
  429. width: 100%;
  430. height: 100%;
  431. opacity: 1;
  432. }
  433. }
  434. .title{
  435. font-size: $font-lg;
  436. color: #121212;
  437. }
  438. .price-orther{
  439. font-size: $font-sm;
  440. color:$font-color-base;
  441. }
  442. .price{
  443. font-size: 64rpx;
  444. color: #39b54a;
  445. line-height: 1;
  446. padding-right: 10upx;
  447. }
  448. .goods1{
  449. font-size: $font-sm;
  450. color: $font-color-base;
  451. }
  452. .goods2{
  453. font-size: $font-sm;
  454. color: $font-color-base;
  455. padding-left: 10%;
  456. }
  457. .goods3{
  458. font-size: $font-sm;
  459. color: $font-color-base;
  460. padding-left: 10%;
  461. }
  462. .goods4{
  463. font-size: $font-sm;
  464. color: #ff5500;
  465. }
  466. .goods5{
  467. font-size: $font-sm;
  468. color: $font-color-base;
  469. }
  470. .view-item{
  471. width: 100%;
  472. // line-height: 40upx;
  473. padding-top: 10upx;
  474. }
  475. .confirm-btn {
  476. margin-left: 20%;
  477. }
  478. .date-time {
  479. margin-left: 30%;
  480. }
  481. .padding-xs-tmp {
  482. padding: 15upx 10upx 10upx 10upx;
  483. }
  484. }
  485. .badge{
  486. position: absolute;
  487. right: -5px;
  488. top: -16px;
  489. color: #fff;
  490. background-color: #dc3545;
  491. display: inline-block;
  492. padding: .25em .4em;
  493. height: 15px;
  494. margin: 20rpx 0;
  495. font-size: 75%;
  496. font-weight: 700;
  497. line-height: 1;
  498. text-align: center;
  499. white-space: nowrap;
  500. vertical-align: top;
  501. border-radius: 50%;
  502. -webkit-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  503. transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  504. }
  505. </style>