order.vue 12 KB

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