LogList.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view class="pagesCons">
  3. <view class="tab-body">
  4. <view class="uTabs">
  5. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  6. swiperWidth="750"></u-tabs-swiper>
  7. </view>
  8. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  9. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  10. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  11. <view class="check-order-list" v-if="index==current" v-for="(item,sindex) in list" :key="item.id+'-'+sindex"
  12. @click="viewRow(item)">
  13. <view class="order-log">
  14. <view>
  15. 快递公司:<text class="address-title">{{item.logName}}</text>
  16. <u-button class="btn-cont" @click="copyLogNum" style="float: right;" type="primary" shape="circle" size="mini">确认收货</u-button>
  17. </view>
  18. <view>
  19. <text>运单编号:</text>
  20. <text>{{item.logNum}}</text>
  21. <u-button @click="copyLogNum" style="margin-left: 20upx;" shape="square" size="mini">复制</u-button>
  22. </view>
  23. </view>
  24. <u-gap height="10" bg-color="#f8f8f8"></u-gap>
  25. <view class="bundle-list" v-for="row in item.itemList" :key="row.id">
  26. <view class="img-cont">
  27. <image :src="row.icon?row.icon:'../../static/tabbar/user.png'"></image>
  28. </view>
  29. <view >
  30. <view class="ellipsis-two">{{row.name}}</view>
  31. <view class="bundle-num">
  32. <view ><b class="price-num">{{row.price}}</b> <text class="price-text">乐豆</text></view>
  33. <view >X {{row.number}}</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <u-empty style="padding-top: 10vh;height: auto;" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'"
  39. mode="list"></u-empty>
  40. <view v-if="index==current" style="padding: 20upx;">
  41. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  42. </view>
  43. </scroll-view>
  44. </swiper-item>
  45. </swiper>
  46. </view>
  47. <!-- 查看物流弹窗 -->
  48. <view>
  49. <u-modal v-model="isShow" :show-title="false" confirm-text="好的">
  50. <view class="slot-content">
  51. <view>
  52. 快递公司:{{logData.logName}}
  53. </view>
  54. <view>
  55. 运单编号:{{logData.logNum}}
  56. <u-button @click="copyLogNum" style="margin-left: 20upx;" shape="square" size="mini">复制</u-button>
  57. </view>
  58. </view>
  59. </u-modal>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. getLookUpDatas,
  66. listLookUp
  67. } from '@/api/data'
  68. export default {
  69. components: {
  70. },
  71. data() {
  72. return {
  73. isShow: false, // 是否显示物流弹框
  74. status: 'loadmore',
  75. noDataText: '暂无数据',
  76. tabList: [
  77. {
  78. dispName: '包裹1',
  79. typeId: 1,
  80. queryLabel: 'DZF' // tab参数
  81. },
  82. {
  83. dispName: '包裹2',
  84. typeId: 3,
  85. queryLabel: 'DFH' // tab参数
  86. },
  87. {
  88. dispName: '待发货',
  89. typeId: 3,
  90. queryLabel: 'YFH' // tab参数
  91. },
  92. ],
  93. current: 0,
  94. swiperCurrent: 0,
  95. pageNo: 1,
  96. pageSize: 10,
  97. list: [],
  98. logData: { // 物流信息
  99. logName: '韵达快递',
  100. logNum: 12356544544
  101. },
  102. total: 0,
  103. action: 'swiperChange', // 操作类型,上划分页,或左右滑动
  104. }
  105. },
  106. onLoad() {
  107. // 监听待办处理后刷新
  108. uni.$on('refreshBl-handle', this.handleRefresh)
  109. this.pageInit()
  110. },
  111. onUnload() {
  112. uni.$off('refreshBL', this.refresh)
  113. uni.$off('refreshBl-handle', this.handleRefresh)
  114. },
  115. methods: {
  116. pageInit() {
  117. this.sortIndex = 1
  118. this.pageNo = 1
  119. this.getRow()
  120. },
  121. handleRefresh() {
  122. this.getRow()
  123. },
  124. // tabs通知swiper切换
  125. tabsChange(index) {
  126. this.swiperCurrent = index;
  127. },
  128. swiperChange(event) {
  129. this.action = 'swiperChange'
  130. this.status = 'loading'
  131. },
  132. // swiper-item左右移动,通知tabs的滑块跟随移动
  133. transition(e) {
  134. let dx = e.detail.dx;
  135. this.$refs.uTabs.setDx(dx);
  136. },
  137. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  138. // swiper滑动结束,分别设置tabs和swiper的状态
  139. animationfinish(e) {
  140. let current = e.detail.current;
  141. let isCurtab = this.current == current
  142. if (this.status != "nomore") {
  143. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  144. if (loadData) {
  145. this.$refs.uTabs.setFinishCurrent(current);
  146. this.swiperCurrent = current;
  147. this.current = current;
  148. this.resetPage();
  149. }
  150. }
  151. },
  152. // scroll-view到底部加载更多
  153. onreachBottom() {
  154. this.action = 'onreachBottom'
  155. if (this.list.length < this.total) {
  156. this.pageNo += 1
  157. this.getRow()
  158. } else {
  159. uni.showToast({
  160. title: '已经到底了',
  161. icon: 'none'
  162. });
  163. this.status = "nomore"
  164. }
  165. },
  166. // 查询列表
  167. getRow(pageNo) {
  168. this.status = "loadmore"
  169. this.list = [{
  170. createDate: "2020-10-28 11:15:59",
  171. orderFlag: "待支付",
  172. payedAmount: 0,
  173. id: 11,
  174. amount: 450,
  175. totalNum: 3,
  176. logName: '韵达快递',
  177. logNum: '12454545485',
  178. itemList: [
  179. {
  180. name: "八九箭冠",
  181. id: 76435,
  182. number: 1,
  183. price: 150,
  184. icon: ''
  185. },
  186. {
  187. name: "数据库的合法身份觉得很附近发生纠纷解决",
  188. id: 76436,
  189. number: 2,
  190. price: 150,
  191. icon: ''
  192. }
  193. ]
  194. }]
  195. return
  196. if (pageNo) {
  197. this.pageNo = pageNo
  198. }
  199. let params = {
  200. pageNo: this.pageNo,
  201. pageSize: this.pageSize,
  202. queryLabel: this.tabList[this.current].queryLabel, // tab分类
  203. }
  204. this.status = "loading"
  205. getBackLogList(params).then(res => {
  206. if (res.status == 200) {
  207. if (this.pageNo > 1) {
  208. this.list = this.list.concat(res.data.list || [])
  209. } else {
  210. this.list = res.data.list || []
  211. }
  212. this.total = res.data.count || 0
  213. } else {
  214. this.list = []
  215. this.total = 0
  216. this.noDataText = res.message
  217. }
  218. this.status = "loadmore"
  219. })
  220. },
  221. resetPage() {
  222. this.status = 'loading';
  223. // 上划分页
  224. if (this.action == 'onreachBottom') {
  225. this.getRow();
  226. }
  227. // 左右切换tab
  228. if (this.action == 'swiperChange') {
  229. this.list = [];
  230. this.getRow(1);
  231. }
  232. },
  233. // 获取查询参数 刷新列表
  234. refresh(params) {
  235. // console.log(params,'1111111111')
  236. this.searchParams = params
  237. this.getRow(1)
  238. },
  239. // 复制运单编号
  240. copyLogNum () {
  241. // H5 不支持
  242. uni.setClipboardData({
  243. data: this.logData.logNum,
  244. success: function(res) {
  245. uni.getClipboardData({
  246. success: function(res) {
  247. uni.showToast({
  248. title: '已复制到剪贴板'
  249. });
  250. }
  251. });
  252. }
  253. })
  254. },
  255. // 详细页
  256. viewRow(item) {
  257. // if (!this.$hasPermissions('M_backlog_detail_mobile')) {
  258. // return
  259. // }
  260. // 已完成的
  261. uni.navigateTo({
  262. url: "/pages/order/orderDetail?id=" + item.id
  263. })
  264. },
  265. }
  266. }
  267. </script>
  268. <style lang="scss">
  269. page {
  270. height: 100%;
  271. width: 100%;
  272. background: #F8F8F8;
  273. }
  274. .pagesCons {
  275. height: 100%;
  276. width: 100%;
  277. background: #F8F8F8;
  278. display: flex;
  279. flex-direction: column;
  280. .text-right {
  281. text-align: right;
  282. }
  283. .tab-body {
  284. flex: 1;
  285. display: flex;
  286. flex-direction: column;
  287. .uTabs {
  288. border-bottom: 1px solid #EEEEEE;
  289. box-shadow: 1px 1px 3px #eeeeee;
  290. }
  291. .check-list {
  292. flex: 1;
  293. overflow-y: scroll;
  294. .swiper-item {
  295. width: 100%;
  296. height: 100%;
  297. overflow: hidden;
  298. .scroll-view {
  299. width: 100%;
  300. height: 100%;
  301. overflow: auto;
  302. }
  303. }
  304. }
  305. // 列表样式
  306. .check-order-list {
  307. background: #ffffff;
  308. padding: 10upx 20upx;
  309. margin: 25upx;
  310. border-radius: 6upx;
  311. box-shadow: 1px 1px 3px #EEEEEE;
  312. font-size: 28upx;
  313. .check-row {
  314. display: flex;
  315. align-items: center;
  316. padding: 20upx 10upx;
  317. .icon-xian {
  318. text-align: right;
  319. width: 40upx;
  320. }
  321. &:first-child {
  322. border-bottom: 1px dashed #F8F8F8;
  323. .createDate {
  324. color: #666;
  325. font-size: 26upx;
  326. margin-left: 10upx;
  327. }
  328. }
  329. &:last-child {
  330. border-top: 1px dashed #F8F8F8;
  331. }
  332. >view {
  333. &:first-child {
  334. flex: 1;
  335. }
  336. }
  337. }
  338. // 订单中商品列表
  339. .bundle-list {
  340. display: flex;
  341. padding: 20upx 10upx;
  342. font-size: 28upx;
  343. border-bottom: 1px solid #F8F8F8;
  344. &:last-child {
  345. border-bottom: none;
  346. }
  347. .img-cont {
  348. width: 160upx;
  349. height: 160upx;
  350. >image {
  351. width: 100%;
  352. height: 100%;
  353. }
  354. }
  355. >view {
  356. &:last-child {
  357. padding: 10upx 0;
  358. flex: 1;
  359. margin-left: 20upx;
  360. display: flex;
  361. flex-direction: column;
  362. justify-content: space-between;
  363. }
  364. }
  365. .bundle-num {
  366. display: flex;
  367. justify-content: space-between;
  368. }
  369. }
  370. .btn-cont {
  371. width: 180upx;
  372. height: 60upx;
  373. font-size: 30upx;
  374. }
  375. .price-text{
  376. font-size: 20upx;
  377. margin-left: 10upx;
  378. }
  379. .price-num{
  380. font-size: 32upx;
  381. }
  382. .total-text{
  383. margin-right: 50upx;
  384. }
  385. .money-total{
  386. margin-right: 10upx;
  387. }
  388. }
  389. }
  390. // 物流弹窗
  391. .order-log {
  392. padding: 20upx ;
  393. font-size: 28upx;
  394. >view{
  395. line-height: 60upx;
  396. }
  397. }
  398. }
  399. </style>