index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <!-- 货源 -->
  2. <template>
  3. <view class="content">
  4. <view class="fixed1"></view>
  5. <view v-if="!isSearch">
  6. <view class="fixed">
  7. <view class='title flex flex-center'>
  8. <view>订单</view>
  9. <u-icon class="search" name="search" color="" size="28" @click="search"></u-icon>
  10. </view>
  11. <u-tabs :list="tabList" @click="clickTab" lineColor='#2772FB' :current='tabIndex' :activeStyle="{
  12. color: '#2772FB',
  13. fontWeight: 'bold',
  14. transform: 'scale(1.05)'
  15. }"></u-tabs>
  16. </view>
  17. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
  18. class="mescroll">
  19. <view :id="'good'+good.id" class="good-list" v-for="good in goods" :key="good.id"
  20. @click="toDetail(good.id)">
  21. <view style="padding: 0 35rpx 20rpx 35rpx;">
  22. <view class="flex flex-space-between row1">
  23. <view class="item1">
  24. CY20220210666666 玉米
  25. </view>
  26. <view class="item2">
  27. 待签约
  28. </view>
  29. </view>
  30. <view class="flex row2">
  31. <view class="left flex flex-space-between">
  32. <view class="ssx">辽</view>
  33. <view class="level2-title">营口 鲅鱼圈</view>
  34. <view>
  35. <image class="jt-icon" src="@/static/images/goodSource/jt.png" mode='widthFix'>
  36. </image>
  37. </view>
  38. <view class="ssx">
  39. </view>
  40. <view class="level2-title">北京 通州</view>
  41. </view>
  42. </view>
  43. <view class="flex row3">
  44. <view class="left">
  45. <image class="hz" src="@/static/images/news/hz.png"></image>
  46. </view>
  47. <view class="right">
  48. <view class="flex fontsize-26 row">
  49. <view>中天昊元贸易有限公司</view>
  50. <view class="sline"></view>
  51. <view>李振华</view>
  52. </view>
  53. <view class="flex align-center">
  54. <view class="fontsize-26">货距 10km</view>
  55. <view class="sline"></view>
  56. <view class="fontsize-26 ">运距 35km</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="row4 flex flex-end align-center">
  61. <view class="time">2022-02-10 10:08</view>
  62. <view class="car">1000元/车</view>
  63. </view>
  64. <view class="row5 flex flex-end">
  65. <view class="stop active">终止</view>
  66. <view class="start normal">确认装车</view>
  67. <!-- <view class="start">联系客服</view>
  68. <view class="start">确认卸车</view>
  69. <view class="start">评价</view>
  70. <view class="start">完结</view> -->
  71. </view>
  72. </view>
  73. </view>
  74. </mescroll-body>
  75. </view>
  76. <view v-else class="search-view">
  77. <view class="flex">
  78. <u-icon name="arrow-left" color="" size="20" class="back-icon"></u-icon>
  79. <u-search placeholder="可按编号、货主、收发地查找" placeholderColor="#AFB3BF" :actionStyle="textColor"
  80. bgColor="#F5F6FA" v-model="keyword" actionText='取消' @custom="cancel" @search="getSearch"></u-search>
  81. </view>
  82. <view class="near-search">
  83. <view class="flex flex-space-between">
  84. <view class="near-search-text">最近搜索</view>
  85. <u-icon name="trash-fill" color="#AFB3BF" size="20" class="back-icon" @click="del"></u-icon>
  86. </view>
  87. <view class="">
  88. <view v-for="(item,index) in 3" :key="index" class="item-style inline-block">
  89. 中天好远
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  95. :showCancelButton='true' @confirm="confirmClick" @close="cancelClick"
  96. @cancel="cancelClick"></u-modal>
  97. </view>
  98. </template>
  99. <script>
  100. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  101. import {
  102. apiGoods
  103. } from "@/api/mock.js"
  104. export default {
  105. mixins: [MescrollMixin], // 使用mixin
  106. data() {
  107. return {
  108. alertTitle:'',
  109. alertContent:"确定删除全部历史记录?",
  110. isShowAlert:false,
  111. textColor: {
  112. "color": "#AFB3BF"
  113. },
  114. keyword: '',
  115. isSearch: false,
  116. startPlace: '齐齐哈尔齐齐哈尔',
  117. endPlace: '全国',
  118. goods: [], // 数据列表
  119. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  120. height: "", // 需要固定swiper的高度
  121. tabList: [{
  122. name: '全部'
  123. }, {
  124. name: '未发运'
  125. }, {
  126. name: '运输中'
  127. }, {
  128. name: '待收货'
  129. }, {
  130. name: '待结算'
  131. },
  132. {
  133. name: '已完结'
  134. },
  135. {
  136. name: '评价'
  137. },
  138. ],
  139. tabIndex: 0,
  140. scrollTop: 0
  141. }
  142. },
  143. onTabItemTap(e) {
  144. // tab 点击时执行,此处直接接收单击事件
  145. uni.pageScrollTo({
  146. scrollTop: 0,
  147. duration: 300
  148. });
  149. console.log(e)
  150. },
  151. created() {
  152. //#ifdef APP-PLUS
  153. // this.getLngLat();
  154. //#endif
  155. },
  156. onLoad() {
  157. let _isHave = this.$utils.getRoles('aaa')
  158. console.log(_isHave)
  159. },
  160. onPageScroll(res) {
  161. this.scrollTop = res.scrollTop
  162. console.log("页面滚动了", res.scrollTop)
  163. if (this.scrollTop > 1200) {
  164. uni.setTabBarItem({
  165. index: 1,
  166. text: '返回顶部',
  167. iconPath: 'static/images/common/top@2x.png',
  168. selectedIconPath: 'static/images/common/top@2x.png'
  169. })
  170. } else {
  171. uni.setTabBarItem({
  172. index: 1,
  173. text: '订单',
  174. iconPath: 'static/images/common/dingdan@2x(1).png',
  175. selectedIconPath: 'static/images/common/dingdan@2x.png'
  176. })
  177. }
  178. },
  179. methods: {
  180. del(){
  181. this.isShowAlert= true
  182. },
  183. confirmClick(){},
  184. cancelClick(){
  185. this.isShowAlert = false
  186. },
  187. getSearch() {
  188. console.log("点击搜索")
  189. },
  190. cancel() {
  191. this.isSearch = false
  192. },
  193. toDetail(id) {
  194. uni.$u.route('/pages/order/orderDetails', {
  195. id: id,
  196. });
  197. },
  198. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  199. upCallback(page) {
  200. // 此处可以继续请求其他接口
  201. // if(page.num == 1){
  202. // // 请求其他接口...
  203. // }
  204. // 如果希望先请求其他接口,再触发upCallback,可参考以下写法
  205. // if(!this.isInitxx){
  206. // apiGetxx().then(res=>{
  207. // this.isInitxx = true
  208. // this.mescroll.resetUpScroll() // 重新触发upCallback
  209. // }).catch(()=>{
  210. // this.mescroll.endErr()
  211. // })
  212. // return // 此处return,先获取xx
  213. // }
  214. //联网加载数据
  215. apiGoods(page.num, page.size).then(res => {
  216. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  217. //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
  218. //方法一(推荐): 后台接口有返回列表的总页数 totalPage
  219. //this.mescroll.endByPage(res.list.length, totalPage); //必传参数(当前页的数据个数, 总页数)
  220. //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
  221. //this.mescroll.endBySize(res.list.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
  222. //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
  223. //this.mescroll.endSuccess(res.list.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
  224. //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据
  225. this.mescroll.endSuccess(res.list.length);
  226. //设置列表数据
  227. if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
  228. this.goods = this.goods.concat(res.list); //追加新数据
  229. }).catch(() => {
  230. //联网失败, 结束加载
  231. this.mescroll.endErr();
  232. })
  233. },
  234. clickTab(val) {
  235. console.log(val)
  236. },
  237. search() {
  238. this.isSearch = true
  239. }
  240. }
  241. }
  242. </script>
  243. <style scoped lang="scss">
  244. .banner {
  245. width: 100%;
  246. position: relative;
  247. }
  248. .fixed,
  249. .fixed1 {
  250. background: white;
  251. position: fixed;
  252. top: var(--status-bar-height);
  253. z-index: 999;
  254. width: 100%;
  255. }
  256. .fixed {
  257. .title {
  258. background: white;
  259. position: relative;
  260. font-size: 36rpx;
  261. font-weight: 500;
  262. color: rgba(0, 0, 0, 0.85);
  263. .search {
  264. position: absolute;
  265. right: 20rpx;
  266. }
  267. }
  268. }
  269. .fixed1 {
  270. top: 0;
  271. height: var(--status-bar-height);
  272. background: white;
  273. }
  274. .banner-img {
  275. width: 100%;
  276. }
  277. .head {
  278. position: absolute;
  279. width: calc(100% - 108rpx);
  280. bottom: 0;
  281. background: white;
  282. margin: 0 20rpx;
  283. border-radius: 20rpx;
  284. .item1,
  285. .item3 {
  286. width: 40%;
  287. .text {
  288. text-overflow: ellipsis;
  289. overflow: hidden;
  290. white-space: nowrap;
  291. }
  292. }
  293. .item1 .text {
  294. text-align: left;
  295. }
  296. .item3 .text {
  297. text-align: right;
  298. }
  299. }
  300. .change-btn {
  301. width: 86rpx;
  302. height: 86rpx;
  303. }
  304. .good-list {
  305. background-color: white;
  306. margin: 20rpx;
  307. padding: 20rpx 0rpx 0 0;
  308. border-radius: 20rpx;
  309. .row1 {
  310. font-size: 26rpx;
  311. .item1 {
  312. color: #333333;
  313. }
  314. .item2 {
  315. color: #FE6300;
  316. }
  317. }
  318. .row2 {
  319. margin: 30rpx 0;
  320. }
  321. .row3 {
  322. background: #F5F6FA;
  323. padding: 20rpx;
  324. border-radius: 10rpx;
  325. color: #333333;
  326. .hz {
  327. width: 74rpx;
  328. height: 74rpx;
  329. margin-right: 30rpx;
  330. }
  331. }
  332. .row4 {
  333. margin: 20rpx 0;
  334. .time {
  335. font-size: 26rpx;
  336. color: #999999;
  337. margin-right: 20rpx;
  338. }
  339. .car {
  340. font-size: 28rpx;
  341. color: #000000;
  342. }
  343. }
  344. .row5 {
  345. margin: 20rpx 0;
  346. font-size: 28rpx;
  347. .stop {
  348. border-radius: 33px;
  349. border: 1px solid #FE6300;
  350. padding: 13rpx 31rpx;
  351. margin-right: 20rpx;
  352. color: #FE6300;
  353. }
  354. .normal {
  355. border: 1px solid #CDCDCD;
  356. border-radius: 33px;
  357. padding: 13rpx 31rpx;
  358. }
  359. }
  360. }
  361. .jt-icon {
  362. position: relative;
  363. top: 6rpx;
  364. width: 60rpx;
  365. margin: 0 20rpx;
  366. }
  367. .row {
  368. margin: 10rpx 0;
  369. align-items: center;
  370. }
  371. // .item-bottom {
  372. // background: #F0F5FF;
  373. // padding: 0 30rpx;
  374. // .name {
  375. // font-size: 26rpx;
  376. // font-weight: 700;
  377. // color: #000000;
  378. // margin-left: 30rpx;
  379. // }
  380. // .hp {
  381. // margin: 30rpx;
  382. // }
  383. // .number-color {
  384. // margin: 0 10rpx;
  385. // }
  386. // .qd {
  387. // background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  388. // border-radius: 13px;
  389. // font-size: 29rpx;
  390. // font-weight: 400;
  391. // color: #FFFFFF;
  392. // padding: 10rpx 35rpx;
  393. // }
  394. // }
  395. .dw {
  396. align-items: center;
  397. }
  398. .mescroll {
  399. margin-top: calc(var(--status-bar-height) + 140rpx);
  400. }
  401. .sline {
  402. height: 28rpx;
  403. width: 1px;
  404. background: black;
  405. margin: 0 20rpx;
  406. }
  407. .search-view {
  408. margin-top: var(--status-bar-height);
  409. background: white;
  410. padding: 0 20rpx;
  411. }
  412. .back-icon {
  413. margin-right: 20rpx;
  414. }
  415. .near-search-text {
  416. margin: 20rpx 0;
  417. }
  418. .item-style {
  419. background: #F5F6FA;
  420. padding: 11rpx 24rpx;
  421. margin-right: 20rpx;
  422. border-radius: 10px;
  423. font-size: 26rpx;
  424. color: #333333;
  425. }
  426. </style>