order.vue 10.0 KB

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