order.vue 12 KB

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