contract.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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. })
  186. that.$api.request('contract', 'getTranContractList',{
  187. page: this.pages,
  188. limit:this.limit
  189. }, failres => {
  190. that.$api.msg(failres.errmsg)
  191. this.isLoadMore = false
  192. this.loadStatus = 'nomore'
  193. if(this.pages>1){this.pages=1}
  194. uni.hideLoading()
  195. uni.stopPullDownRefresh()
  196. }).then(res => {
  197. that.contractInfo = res.data
  198. uni.hideLoading()
  199. uni.stopPullDownRefresh()
  200. })
  201. if (!this.hasLogin) {
  202. uni.showModal({
  203. title: '登录提示',
  204. content: '您尚未登录,是否立即登录?',
  205. showCancel: true,
  206. confirmText: '登录',
  207. success: (e) => {
  208. if (e.confirm) {
  209. uni.navigateTo({
  210. url: '/pages/public/login'
  211. })
  212. }
  213. },
  214. fail: () => {},
  215. complete: () => {}
  216. })
  217. }
  218. },
  219. examine(item){
  220. uni.navigateTo({
  221. url: `/pageB/contract/look?contractNo=${item.contractNo}`
  222. })
  223. },
  224. //详情
  225. navToDetailPage(item) {
  226. var that = this
  227. uni.showLoading({
  228. title: '正在加载'
  229. })
  230. uni.downloadFile({
  231. url: item.contractImg,
  232. success: function (res) {
  233. var filePath = res.tempFilePath;
  234. uni.openDocument({
  235. filePath: filePath,
  236. success: function (res) {
  237. uni.hideLoading()
  238. console.log('打开文档成功');
  239. }
  240. });
  241. },
  242. })
  243. },
  244. navToDetailPage2(item) {
  245. uni.navigateTo({
  246. url: `/pageA/pages/deliver_goods?id=${item.id}&contractType=${item.contractType}&tradeStatus=${item.tradeStatus}`
  247. })
  248. },
  249. onReachBottomTmp(){ //上拉触底函数
  250. if(!this.isLoadMore){ //此处判断,上锁,防止重复请求
  251. this.isLoadMore=true
  252. this.pages += 1
  253. this.getContractData()
  254. }
  255. },
  256. getContractData(){
  257. const that = this
  258. var pages=that.pages
  259. var limit=that.limit
  260. uni.showLoading({
  261. title: '正在加载'
  262. })
  263. that.$api.request('contract', 'getTranContractList', {
  264. page: pages,
  265. limit:limit
  266. },failres => {
  267. that.$api.msg(failes.errmsg)
  268. that.isLoadMore=false
  269. that.loadStatus = 'nomore'
  270. if(that.pages>1){that.pages-=1}
  271. uni.hideLoading()
  272. }).then(res => {
  273. //销售信息
  274. if(that.contractInfo.length > 0){
  275. that.contractInfo = that.contractInfo.concat(data)
  276. that.isLoadMore=false
  277. }
  278. else{
  279. if(that.pages>1){that.pages-=1}
  280. that.isLoadMore=true
  281. that.loadStatus = 'nomore'
  282. }
  283. uni.hideLoading()
  284. })
  285. }
  286. },
  287. }
  288. </script>
  289. <style lang='scss' scoped>
  290. .contractType{
  291. padding: 10px 15px;
  292. width: 118rpx;
  293. border-radius: 9rpx;
  294. height: 118rpx;
  295. position: relative;
  296. }
  297. .button-group{
  298. margin-top:10px;
  299. justify-content: space-between;
  300. }
  301. .button-group button{
  302. height: 30px;
  303. font-size: 12px;
  304. line-height: 30px;
  305. margin:0;
  306. }
  307. page,
  308. .content {
  309. background: $page-color-base;
  310. height: 100%;
  311. }
  312. .cu-tag {
  313. font-size: 40rpx;
  314. word-break:break-all;
  315. }
  316. .container{
  317. padding-bottom: 100upx;
  318. }
  319. .cu-capsule+.cu-capsule {
  320. margin-left: 0rpx;
  321. }
  322. .cu-capsule {
  323. display: flex;
  324. position: relative;
  325. margin: 5px 0;
  326. }
  327. .cu-form-group input {
  328. text-align: right;
  329. }
  330. .cu-form-group textarea {
  331. text-align: right;
  332. }
  333. .place{
  334. font-size: 40rpx;
  335. line-height: 1;
  336. padding-right: 10upx;
  337. }
  338. .place-center{
  339. font-size: 28rpx;
  340. }
  341. .guess-item{
  342. /* margin-top: 10rpx; */
  343. }
  344. .btn-size{
  345. font-size: 28rpx;
  346. }
  347. .place-bottom{
  348. margin-top: 20rpx;
  349. }
  350. .swiper-box {
  351. height: calc(100% - 40px);
  352. }
  353. .list-scroll-content {
  354. height: 100%;
  355. }
  356. .uni-swiper-item {
  357. height: auto;
  358. }
  359. /* 标题简介 */
  360. .introduce-section_contract {
  361. background: #fff;
  362. padding: 20upx 30upx;
  363. }
  364. .title {
  365. font-size: 34upx;
  366. color: $font-color-dark;
  367. height: 50upx;
  368. line-height: 50upx;
  369. flex:3;
  370. }
  371. .title-tip {
  372. flex:1;
  373. color:#fa436a;
  374. }
  375. .price-box {
  376. display: flex;
  377. align-items: baseline;
  378. height: 100upx;
  379. padding: 10upx 0;
  380. font-size: 26upx;
  381. color: $uni-color-primary;
  382. }
  383. .price_contract {
  384. font-size: 34rpx;
  385. }
  386. .m-price {
  387. margin: 0 12upx;
  388. color: $font-color-light;
  389. text-decoration: line-through;
  390. }
  391. .coupon-tip {
  392. align-items: center;
  393. padding: 4upx 10upx;
  394. background: $uni-color-primary;
  395. font-size: $font-sm;
  396. color: #fff;
  397. border-radius: 6upx;
  398. line-height: 1;
  399. transform: translateY(-4upx);
  400. }
  401. .bot-row {
  402. display: flex;
  403. align-items: center;
  404. height: 50upx;
  405. font-size: $font-sm;
  406. color: $font-color-light;
  407. }
  408. .guess-section{
  409. padding-bottom: 100upx;
  410. display:flex;
  411. flex-wrap:wrap;
  412. padding: 0 30upx;
  413. background: #fff;
  414. .guess-item{
  415. display:flex;
  416. flex-direction: column;
  417. width: 98%;
  418. border-bottom:1px solid #f8f8f8;
  419. }
  420. .image-wrapper{
  421. width: 100%;
  422. height: 330upx;
  423. border-radius: 3px;
  424. overflow: hidden;
  425. image{
  426. width: 100%;
  427. height: 100%;
  428. opacity: 1;
  429. }
  430. }
  431. .title{
  432. font-size: $font-lg;
  433. color: #121212;
  434. }
  435. .price-orther{
  436. font-size: $font-sm;
  437. color:$font-color-base;
  438. }
  439. .price{
  440. font-size: 64rpx;
  441. color: #39b54a;
  442. line-height: 1;
  443. padding-right: 10upx;
  444. }
  445. .goods1{
  446. font-size: $font-sm;
  447. color: $font-color-base;
  448. }
  449. .goods2{
  450. font-size: $font-sm;
  451. color: $font-color-base;
  452. padding-left: 10%;
  453. }
  454. .goods3{
  455. font-size: $font-sm;
  456. color: $font-color-base;
  457. padding-left: 10%;
  458. }
  459. .goods4{
  460. font-size: $font-sm;
  461. color: #ff5500;
  462. }
  463. .goods5{
  464. font-size: $font-sm;
  465. color: $font-color-base;
  466. }
  467. .view-item{
  468. width: 100%;
  469. // line-height: 40upx;
  470. padding-top: 10upx;
  471. }
  472. .confirm-btn {
  473. margin-left: 20%;
  474. }
  475. .date-time {
  476. margin-left: 30%;
  477. }
  478. .padding-xs-tmp {
  479. padding: 15upx 10upx 10upx 10upx;
  480. }
  481. }
  482. .badge{
  483. position: absolute;
  484. right: -5px;
  485. top: -16px;
  486. color: #fff;
  487. background-color: #dc3545;
  488. display: inline-block;
  489. padding: .25em .4em;
  490. height: 15px;
  491. margin: 20rpx 0;
  492. font-size: 75%;
  493. font-weight: 700;
  494. line-height: 1;
  495. text-align: center;
  496. white-space: nowrap;
  497. vertical-align: top;
  498. border-radius: 50%;
  499. -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;
  500. transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  501. }
  502. </style>