order.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <view class="u-tabs-box">
  5. <u-tabs-swiper ref="tabs" :current="current" :is-scroll="false" :list="list" activeColor="#ff536f"
  6. swiperWidth="750" @change="change"></u-tabs-swiper>
  7. </view>
  8. <swiper :current="swiperCurrent" class="swiper-box" @animationfinish="animationfinish" @transition="transition">
  9. <swiper-item class="swiper-item">
  10. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  11. <view class="page-box">
  12. <view v-for="(res, index) in orderList[0]" :key="res.id" class="order">
  13. <view class="top">
  14. <view class="left">
  15. <view class="store">{{ res.orderCode }}</view>
  16. <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
  17. </view>
  18. <view class="right">{{ res.deal }}</view>
  19. </view>
  20. <view v-for="(item, index) in res.goodsList" :key="index" class="item">
  21. <view class="left">
  22. <image :src="item.goodsUrl" mode="aspectFill"></image>
  23. </view>
  24. <view class="content">
  25. <view class="title u-line-2">{{ item.title }}</view>
  26. <view class="type">{{ item.type }}</view>
  27. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  28. </view>
  29. <view class="right">
  30. <view class="price">
  31. ¥{{ priceInt(item.price) }}
  32. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  33. </view>
  34. <view class="number">x{{ item.number }}</view>
  35. </view>
  36. </view>
  37. <view class="total">
  38. 共{{ totalNum(res.goodsList) }}件商品 合计:
  39. <text class="total-price">
  40. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  41. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  42. </text>
  43. </view>
  44. <view class="bottom">
  45. <view class="logistics btn" @lick="cancle">取消订单</view>
  46. <view class="exchange btn" @contact="handleContact">联系客服</view>
  47. <view class="evaluate btn" @lick="pay">立即支付</view>
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </swiper-item>
  53. <swiper-item class="swiper-item">
  54. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  55. <view class="page-box">
  56. <view>
  57. <view class="centre">
  58. <image :src="empty" mode=""></image>
  59. <view class="explain">
  60. 您还没有相关的订单
  61. <view class="tips">可以去看看有那些想买的</view>
  62. </view>
  63. <view class="btn">随便逛逛</view>
  64. </view>
  65. </view>
  66. <view v-for="(res, index) in orderList[1]" :key="res.id" class="order">
  67. <view class="top">
  68. <view class="left">
  69. <view class="store">{{ res.store }}</view>
  70. <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
  71. </view>
  72. <view class="right">{{ res.deal }}</view>
  73. </view>
  74. <view v-for="(item, index) in res.goodsList" :key="index" class="item">
  75. <view class="left">
  76. <image :src="item.goodsUrl" mode="aspectFill"></image>
  77. </view>
  78. <view class="content">
  79. <view class="title u-line-2">{{ item.title }}</view>
  80. <view class="type">{{ item.type }}</view>
  81. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  82. </view>
  83. <view class="right">
  84. <view class="price">
  85. ¥{{ priceInt(item.price) }}
  86. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  87. </view>
  88. <view class="number">x{{ item.number }}</view>
  89. </view>
  90. </view>
  91. <view class="total">
  92. 共{{ totalNum(res.goodsList) }}件商品 合计:
  93. <text class="total-price">
  94. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  95. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  96. </text>
  97. </view>
  98. <view class="bottom">
  99. <view class="exchange btn" @contact="handleContact">联系客服</view>
  100. <view class="evaluate btn">提醒发货</view>
  101. </view>
  102. </view>
  103. </view>
  104. </scroll-view>
  105. </swiper-item>
  106. <swiper-item class="swiper-item">
  107. <scroll-view scroll-y style="height: 100%;width: 100%;">
  108. <view class="page-box">
  109. <view>
  110. <view class="centre">
  111. <image :src="empty" mode=""></image>
  112. <view class="explain">
  113. 您还没有相关的订单
  114. <view class="tips">可以去看看有那些想买的</view>
  115. </view>
  116. <view class="btn">随便逛逛</view>
  117. </view>
  118. </view>
  119. <view v-for="(res, index) in orderList[2]" :key="res.id" class="order">
  120. <view class="top">
  121. <view class="left">
  122. <view class="store">{{ res.store }}</view>
  123. <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
  124. </view>
  125. <view class="right">{{ res.deal }}</view>
  126. </view>
  127. <view v-for="(item, index) in res.goodsList" :key="index" class="item">
  128. <view class="left">
  129. <image :src="item.goodsUrl" mode="aspectFill"></image>
  130. </view>
  131. <view class="content">
  132. <view class="title u-line-2">{{ item.title }}</view>
  133. <view class="type">{{ item.type }}</view>
  134. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  135. </view>
  136. <view class="right">
  137. <view class="price">
  138. ¥{{ priceInt(item.price) }}
  139. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  140. </view>
  141. <view class="number">x{{ item.number }}</view>
  142. </view>
  143. </view>
  144. <view class="total">
  145. 共{{ totalNum(res.goodsList) }}件商品 合计:
  146. <text class="total-price">
  147. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  148. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  149. </text>
  150. </view>
  151. <view class="bottom">
  152. <view class="exchange btn" @contact="handleContact">联系客服</view>
  153. <view class="evaluate btn">查看物流</view>
  154. </view>
  155. </view>
  156. </view>
  157. </scroll-view>
  158. </swiper-item>
  159. <swiper-item class="swiper-item">
  160. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  161. <view class="page-box">
  162. <view>
  163. <view class="centre">
  164. <image :src="empty" mode=""></image>
  165. <view class="explain">
  166. 您还没有相关的订单
  167. <view class="tips">可以去看看有那些想买的</view>
  168. </view>
  169. <view class="btn">随便逛逛</view>
  170. </view>
  171. </view>
  172. <view v-for="(res, index) in orderList[3]" :key="res.id" class="order">
  173. <view class="top">
  174. <view class="left">
  175. <view class="store">{{ res.store }}</view>
  176. <u-icon :size="26" color="rgb(203,203,203)" name="arrow-right"></u-icon>
  177. </view>
  178. <view class="right">{{ res.deal }}</view>
  179. </view>
  180. <view v-for="(item, index) in res.goodsList" :key="index" class="item">
  181. <view class="left">
  182. <image :src="item.goodsUrl" mode="aspectFill"></image>
  183. </view>
  184. <view class="content">
  185. <view class="title u-line-2">{{ item.title }}</view>
  186. <view class="type">{{ item.type }}</view>
  187. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  188. </view>
  189. <view class="right">
  190. <view class="price">
  191. ¥{{ priceInt(item.price) }}
  192. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  193. </view>
  194. <view class="number">x{{ item.number }}</view>
  195. </view>
  196. </view>
  197. <view class="total">
  198. 共{{ totalNum(res.goodsList) }}件商品 合计:
  199. <text class="total-price">
  200. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  201. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  202. </text>
  203. </view>
  204. <view class="bottom">
  205. <view class="exchange btn" @contact="handleContact">联系客服</view>
  206. <view class="evaluate btn">去评价</view>
  207. </view>
  208. </view>
  209. </view>
  210. </scroll-view>
  211. </swiper-item>
  212. </swiper>
  213. </view>
  214. </view>
  215. </template>
  216. <script>
  217. export default {
  218. data() {
  219. return {
  220. empty: '/static/empty/default.png',
  221. orderList: [[], [], [], []],
  222. dataList: [
  223. {
  224. id: 1,
  225. orderCode: '20220814145211952128',
  226. deal: '待付款',
  227. goodsList: [
  228. {
  229. goodsUrl: '//img13.360buyimg.com/n7/jfs/t1/103005/7/17719/314825/5e8c19faEb7eed50d/5b81ae4b2f7f3bb7.jpg',
  230. title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
  231. type: '灰色;M',
  232. deliveryTime: '付款后30天内发货',
  233. price: '348.58',
  234. number: 2
  235. },
  236. {
  237. goodsUrl: '//img13.360buyimg.com/n7/jfs/t1/103005/7/17719/314825/5e8c19faEb7eed50d/5b81ae4b2f7f3bb7.jpg',
  238. title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
  239. type: '灰色;M',
  240. deliveryTime: '付款后30天内发货',
  241. price: '348.58',
  242. number: 2
  243. },
  244. ]
  245. },
  246. ],
  247. list: [
  248. {
  249. name: '待付款',
  250. count: 1
  251. },
  252. {
  253. name: '待发货'
  254. },
  255. {
  256. name: '待收货'
  257. },
  258. {
  259. name: '待评价'
  260. }
  261. ],
  262. current: 0,
  263. swiperCurrent: 0,
  264. tabsHeight: 0,
  265. dx: 0,
  266. loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore'],
  267. };
  268. },
  269. onLoad() {
  270. this.getOrderList(0);
  271. },
  272. computed: {
  273. // 价格小数
  274. priceDecimal() {
  275. return val => {
  276. if (val !== parseInt(val)) return val.slice(-2);
  277. else return '00';
  278. };
  279. },
  280. // 价格整数
  281. priceInt() {
  282. return val => {
  283. if (val !== parseInt(val)) return val.split('.')[0];
  284. else return val;
  285. };
  286. }
  287. },
  288. methods: {
  289. login() {
  290. this.$u.route('/pages/login/login')
  291. },
  292. reachBottom() {
  293. // 此tab为空数据
  294. // if(this.current != 2) {
  295. // this.loadStatus.splice(this.current,1,"loading")
  296. // setTimeout(() => {
  297. // this.getOrderList(this.current);
  298. // }, 1200);
  299. // }
  300. },
  301. // 页面数据
  302. getOrderList(idx) {
  303. for (let i = 0; i < 1; i++) {
  304. let index = this.$u.random(0, this.dataList.length - 1);
  305. let data = JSON.parse(JSON.stringify(this.dataList[index]));
  306. data.id = this.$u.guid();
  307. this.orderList[idx].push(data);
  308. }
  309. this.loadStatus.splice(this.current, 1, "loadmore")
  310. },
  311. // 总价
  312. totalPrice(item) {
  313. let price = 0;
  314. item.map(val => {
  315. price += parseFloat(val.price);
  316. });
  317. return price.toFixed(2);
  318. },
  319. // 总件数
  320. totalNum(item) {
  321. let num = 0;
  322. item.map(val => {
  323. num += val.number;
  324. });
  325. return num;
  326. },
  327. // tab栏切换
  328. change(index) {
  329. this.swiperCurrent = index;
  330. this.getOrderList(index);
  331. },
  332. transition({detail: {dx}}) {
  333. this.$refs.tabs.setDx(dx);
  334. },
  335. animationfinish({detail: {current}}) {
  336. this.$refs.tabs.setFinishCurrent(current);
  337. this.swiperCurrent = current;
  338. this.current = current;
  339. },
  340. cancle() {
  341. this.$mytip.toast('取消订单')
  342. },
  343. pay() {
  344. this.$mytip.toast('支付')
  345. }
  346. }
  347. };
  348. </script>
  349. <style>
  350. /* #ifndef H5 */
  351. page {
  352. height: 100%;
  353. background-color: #f2f2f2;
  354. }
  355. /* #endif */
  356. </style>
  357. <style lang="scss" scoped>
  358. .container {
  359. width: 100%;
  360. height: 100%;
  361. display: flex;
  362. justify-content: center;
  363. align-items: center;
  364. text-align: center;
  365. .empty {
  366. overflow: hidden;
  367. .tip {
  368. color: #909399;
  369. }
  370. .btn {
  371. color: #fff;
  372. background-color: $base-color;
  373. width: 200 rpx;
  374. padding: 15 rpx 28 rpx;
  375. border-radius: 130 rpx;
  376. margin: 30 rpx 0 0 100 rpx;
  377. }
  378. }
  379. }
  380. .order {
  381. width: 710 rpx;
  382. background-color: #ffffff;
  383. margin: 20 rpx auto;
  384. border-radius: 20 rpx;
  385. box-sizing: border-box;
  386. padding: 20 rpx;
  387. font-size: 28 rpx;
  388. .top {
  389. display: flex;
  390. justify-content: space-between;
  391. .left {
  392. display: flex;
  393. align-items: center;
  394. .store {
  395. margin: 0 10 rpx;
  396. font-size: 32 rpx;
  397. font-weight: bold;
  398. }
  399. }
  400. .right {
  401. color: $base-color;
  402. }
  403. }
  404. .item {
  405. display: flex;
  406. margin: 20 rpx 0 0;
  407. .left {
  408. margin-right: 20 rpx;
  409. image {
  410. width: 200 rpx;
  411. height: 200 rpx;
  412. border-radius: 10 rpx;
  413. }
  414. }
  415. .content {
  416. .title {
  417. font-size: 28 rpx;
  418. line-height: 50 rpx;
  419. }
  420. .type {
  421. margin: 10 rpx 0;
  422. font-size: 24 rpx;
  423. color: $u-tips-color;
  424. }
  425. .delivery-time {
  426. color: $base-color;
  427. font-size: 24 rpx;
  428. }
  429. }
  430. .right {
  431. margin-left: 10 rpx;
  432. padding-top: 20 rpx;
  433. text-align: right;
  434. .decimal {
  435. font-size: 24 rpx;
  436. margin-top: 4 rpx;
  437. }
  438. .number {
  439. color: $u-tips-color;
  440. font-size: 24 rpx;
  441. }
  442. }
  443. }
  444. .total {
  445. margin-top: 20 rpx;
  446. text-align: right;
  447. font-size: 24 rpx;
  448. .total-price {
  449. font-size: 32 rpx;
  450. }
  451. }
  452. .bottom {
  453. display: flex;
  454. margin-top: 40 rpx;
  455. padding: 0 10 rpx;
  456. justify-content: flex-end;
  457. align-items: center;
  458. .btn {
  459. margin-left: 20 rpx;
  460. line-height: 52 rpx;
  461. width: 160 rpx;
  462. border-radius: 26 rpx;
  463. border: 2 rpx solid $u-border-color;
  464. font-size: 26 rpx;
  465. text-align: center;
  466. color: $u-type-info-dark;
  467. }
  468. .evaluate {
  469. color: $base-color;
  470. border-color: $base-color;
  471. }
  472. }
  473. }
  474. .centre {
  475. text-align: center;
  476. margin: 200 rpx auto;
  477. font-size: 32 rpx;
  478. image {
  479. width: 164 rpx;
  480. height: 164 rpx;
  481. border-radius: 50%;
  482. margin-bottom: 20 rpx;
  483. }
  484. .tips {
  485. font-size: 24 rpx;
  486. color: #999999;
  487. margin-top: 20 rpx;
  488. }
  489. .btn {
  490. margin: 80 rpx auto;
  491. width: 200 rpx;
  492. border-radius: 32 rpx;
  493. line-height: 64 rpx;
  494. color: #ffffff;
  495. font-size: 26 rpx;
  496. background-image: linear-gradient(to left, #ff536f, rgba(#ff536f, 0.6));
  497. }
  498. }
  499. .wrap {
  500. display: flex;
  501. flex-direction: column;
  502. height: calc(100vh - var(--window-top));
  503. width: 100%;
  504. }
  505. .swiper-box {
  506. flex: 1;
  507. }
  508. .swiper-item {
  509. height: 100%;
  510. }
  511. </style>