order.vue 12 KB

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