LogList.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. <text class="btn-cont" @click="copyLogNum" style="float: right;">确认收货</text>
  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/goods.png'"></image>
  28. </view>
  29. <view >
  30. <view class="ellipsis-two">{{row.name}}</view>
  31. <view class="bundle-num">
  32. <view ><text class="price-num">{{row.price}}</text> <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. this.pageInit()
  108. },
  109. onUnload() {
  110. uni.$off('refreshBL', this.refresh)
  111. uni.$off('refreshBl-handle', this.handleRefresh)
  112. },
  113. methods: {
  114. pageInit() {
  115. this.sortIndex = 1
  116. this.pageNo = 1
  117. this.getRow()
  118. },
  119. handleRefresh() {
  120. this.getRow()
  121. },
  122. // tabs通知swiper切换
  123. tabsChange(index) {
  124. this.swiperCurrent = index;
  125. },
  126. swiperChange(event) {
  127. this.action = 'swiperChange'
  128. this.status = 'loading'
  129. },
  130. // swiper-item左右移动,通知tabs的滑块跟随移动
  131. transition(e) {
  132. let dx = e.detail.dx;
  133. this.$refs.uTabs.setDx(dx);
  134. },
  135. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  136. // swiper滑动结束,分别设置tabs和swiper的状态
  137. animationfinish(e) {
  138. let current = e.detail.current;
  139. let isCurtab = this.current == current
  140. if (this.status != "nomore") {
  141. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  142. if (loadData) {
  143. this.$refs.uTabs.setFinishCurrent(current);
  144. this.swiperCurrent = current;
  145. this.current = current;
  146. this.resetPage();
  147. }
  148. }
  149. },
  150. // scroll-view到底部加载更多
  151. onreachBottom() {
  152. this.action = 'onreachBottom'
  153. if (this.list.length < this.total) {
  154. this.pageNo += 1
  155. this.getRow()
  156. } else {
  157. uni.showToast({
  158. title: '已经到底了',
  159. icon: 'none'
  160. });
  161. this.status = "nomore"
  162. }
  163. },
  164. // 查询列表
  165. getRow(pageNo) {
  166. this.status = "loadmore"
  167. this.list = [{
  168. createDate: "2020-10-28 11:15:59",
  169. orderFlag: "待支付",
  170. payedAmount: 0,
  171. id: 11,
  172. amount: 450,
  173. totalNum: 3,
  174. logName: '韵达快递',
  175. logNum: '12454545485',
  176. itemList: [
  177. {
  178. name: "八九箭冠",
  179. id: 76435,
  180. number: 1,
  181. price: 150,
  182. icon: ''
  183. },
  184. {
  185. name: "数据库的合法身份觉得很附近发生纠纷解决",
  186. id: 76436,
  187. number: 2,
  188. price: 150,
  189. icon: ''
  190. }
  191. ]
  192. }]
  193. return
  194. if (pageNo) {
  195. this.pageNo = pageNo
  196. }
  197. let params = {
  198. pageNo: this.pageNo,
  199. pageSize: this.pageSize,
  200. queryLabel: this.tabList[this.current].queryLabel, // tab分类
  201. }
  202. this.status = "loading"
  203. getBackLogList(params).then(res => {
  204. if (res.status == 200) {
  205. if (this.pageNo > 1) {
  206. this.list = this.list.concat(res.data.list || [])
  207. } else {
  208. this.list = res.data.list || []
  209. }
  210. this.total = res.data.count || 0
  211. } else {
  212. this.list = []
  213. this.total = 0
  214. this.noDataText = res.message
  215. }
  216. this.status = "loadmore"
  217. })
  218. },
  219. resetPage() {
  220. this.status = 'loading';
  221. // 上划分页
  222. if (this.action == 'onreachBottom') {
  223. this.getRow();
  224. }
  225. // 左右切换tab
  226. if (this.action == 'swiperChange') {
  227. this.list = [];
  228. this.getRow(1);
  229. }
  230. },
  231. // 获取查询参数 刷新列表
  232. refresh(params) {
  233. // console.log(params,'1111111111')
  234. this.searchParams = params
  235. this.getRow(1)
  236. },
  237. // 复制运单编号
  238. copyLogNum () {
  239. // H5 不支持
  240. uni.setClipboardData({
  241. data: this.logData.logNum,
  242. success: function(res) {
  243. uni.getClipboardData({
  244. success: function(res) {
  245. uni.showToast({
  246. title: '已复制到剪贴板'
  247. });
  248. }
  249. });
  250. }
  251. })
  252. },
  253. // 详细页
  254. viewRow(item) {
  255. // if (!this.$hasPermissions('M_backlog_detail_mobile')) {
  256. // return
  257. // }
  258. // 已完成的
  259. uni.navigateTo({
  260. url: "/pages/order/orderDetail?id=" + item.id
  261. })
  262. },
  263. }
  264. }
  265. </script>
  266. <style lang="scss">
  267. page {
  268. height: 100%;
  269. width: 100%;
  270. background: #F8F8F8;
  271. }
  272. .pagesCons {
  273. height: 100%;
  274. width: 100%;
  275. background: #F8F8F8;
  276. display: flex;
  277. flex-direction: column;
  278. .text-right {
  279. text-align: right;
  280. }
  281. .tab-body {
  282. flex: 1;
  283. display: flex;
  284. flex-direction: column;
  285. .uTabs {
  286. border-bottom: 1px solid #EEEEEE;
  287. box-shadow: 1px 1px 3px #eeeeee;
  288. }
  289. .check-list {
  290. flex: 1;
  291. overflow-y: scroll;
  292. .swiper-item {
  293. width: 100%;
  294. height: 100%;
  295. overflow: hidden;
  296. .scroll-view {
  297. width: 100%;
  298. height: 100%;
  299. overflow: auto;
  300. }
  301. }
  302. }
  303. // 列表样式
  304. .check-order-list {
  305. background: #ffffff;
  306. padding: 10upx 20upx;
  307. margin: 25upx;
  308. border-radius: 6upx;
  309. box-shadow: 1px 1px 3px #EEEEEE;
  310. font-size: 28upx;
  311. .check-row {
  312. display: flex;
  313. align-items: center;
  314. padding: 20upx 10upx;
  315. .icon-xian {
  316. text-align: right;
  317. width: 40upx;
  318. }
  319. &:first-child {
  320. border-bottom: 1px dashed #F8F8F8;
  321. .createDate {
  322. color: #666;
  323. font-size: 26upx;
  324. margin-left: 10upx;
  325. }
  326. }
  327. &:last-child {
  328. border-top: 1px dashed #F8F8F8;
  329. }
  330. >view {
  331. &:first-child {
  332. flex: 1;
  333. }
  334. }
  335. }
  336. // 订单中商品列表
  337. .bundle-list {
  338. display: flex;
  339. padding: 20upx 10upx;
  340. font-size: 28upx;
  341. border-bottom: 1px solid #F8F8F8;
  342. &:last-child {
  343. border-bottom: none;
  344. }
  345. .img-cont {
  346. width: 160upx;
  347. height: 160upx;
  348. >image {
  349. width: 100%;
  350. height: 100%;
  351. }
  352. }
  353. >view {
  354. &:last-child {
  355. flex: 1;
  356. margin-left: 20upx;
  357. display: flex;
  358. flex-direction: column;
  359. justify-content: space-between;
  360. }
  361. }
  362. .bundle-num {
  363. display: flex;
  364. justify-content: space-between;
  365. }
  366. }
  367. .btn-cont {
  368. width: 180upx;
  369. height: 60upx;
  370. float: right;
  371. background-color: #2979ff;
  372. color: #fff;
  373. text-align: center;
  374. border-radius: 100upx;
  375. font-size: 30upx;
  376. }
  377. .price-text{
  378. font-size: 20upx;
  379. margin-left: 10upx;
  380. }
  381. .price-num{
  382. font-size: 32upx;
  383. color: red;
  384. }
  385. .total-text{
  386. margin-right: 50upx;
  387. }
  388. .money-total{
  389. margin-right: 10upx;
  390. }
  391. }
  392. }
  393. // 物流弹窗
  394. .order-log {
  395. padding: 20upx ;
  396. font-size: 28upx;
  397. >view{
  398. line-height: 60upx;
  399. }
  400. }
  401. }
  402. </style>