index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <view>
  3. <view class="wrap">
  4. <view class="u-tabs-box">
  5. <u-tabs-swiper activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
  6. </view>
  7. <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
  8. <swiper-item class="swiper-item">
  9. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  10. <view class="page-box">
  11. <view class="order" v-for="(res, index) in orderList[0]" :key="res.id">
  12. <view class="top">
  13. <view class="left">
  14. <u-icon name="home" :size="30" color="rgb(94,94,94)"></u-icon>
  15. <view class="store">{{ res.store }}</view>
  16. <u-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></u-icon>
  17. </view>
  18. <view class="right">{{ res.deal }}</view>
  19. </view>
  20. <view class="item" v-for="(item, index) in res.goodsList" :key="index">
  21. <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
  22. <view class="content">
  23. <view class="title u-line-2">{{ item.title }}</view>
  24. <view class="type">{{ item.type }}</view>
  25. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  26. </view>
  27. <view class="right">
  28. <view class="price">
  29. ¥{{ priceInt(item.price) }}
  30. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  31. </view>
  32. <view class="number">x{{ item.number }}</view>
  33. </view>
  34. </view>
  35. <view class="total">
  36. 共{{ totalNum(res.goodsList) }}件商品 合计:
  37. <text class="total-price">
  38. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  39. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  40. </text>
  41. </view>
  42. <view class="bottom">
  43. <view class="more"><u-icon name="more-dot-fill" color="rgb(203,203,203)"></u-icon></view>
  44. <view class="logistics btn">查看物流</view>
  45. <view class="exchange btn">卖了换钱</view>
  46. <view class="evaluate btn">评价</view>
  47. </view>
  48. </view>
  49. <u-loadmore :status="loadStatus[0]" bgColor="#f2f2f2"></u-loadmore>
  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 class="order" v-for="(res, index) in orderList[1]" :key="res.id">
  57. <view class="top">
  58. <view class="left">
  59. <u-icon name="home" :size="30" color="rgb(94,94,94)"></u-icon>
  60. <view class="store">{{ res.store }}</view>
  61. <u-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></u-icon>
  62. </view>
  63. <view class="right">{{ res.deal }}</view>
  64. </view>
  65. <view class="item" v-for="(item, index) in res.goodsList" :key="index">
  66. <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
  67. <view class="content">
  68. <view class="title u-line-2">{{ item.title }}</view>
  69. <view class="type">{{ item.type }}</view>
  70. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  71. </view>
  72. <view class="right">
  73. <view class="price">
  74. ¥{{ priceInt(item.price) }}
  75. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  76. </view>
  77. <view class="number">x{{ item.number }}</view>
  78. </view>
  79. </view>
  80. <view class="total">
  81. 共{{ totalNum(res.goodsList) }}件商品 合计:
  82. <text class="total-price">
  83. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  84. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  85. </text>
  86. </view>
  87. <view class="bottom">
  88. <view class="more"><u-icon name="more-dot-fill" color="rgb(203,203,203)"></u-icon></view>
  89. <view class="logistics btn">查看物流</view>
  90. <view class="exchange btn">卖了换钱</view>
  91. <view class="evaluate btn">评价</view>
  92. </view>
  93. </view>
  94. <u-loadmore :status="loadStatus[1]" bgColor="#f2f2f2"></u-loadmore>
  95. </view>
  96. </scroll-view>
  97. </swiper-item>
  98. <swiper-item class="swiper-item">
  99. <scroll-view scroll-y style="height: 100%;width: 100%;">
  100. <view class="page-box">
  101. <view>
  102. <view class="centre">
  103. <image src="https://cdn.uviewui.com/uview/template/taobao-order.png" mode=""></image>
  104. <view class="explain">
  105. 您还没有相关的订单
  106. <view class="tips">可以去看看有那些想买的</view>
  107. </view>
  108. <view class="btn">随便逛逛</view>
  109. </view>
  110. </view>
  111. </view>
  112. </scroll-view>
  113. </swiper-item>
  114. <swiper-item class="swiper-item">
  115. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  116. <view class="page-box">
  117. <view class="order" v-for="(res, index) in orderList[3]" :key="res.id">
  118. <view class="top">
  119. <view class="left">
  120. <u-icon name="home" :size="30" color="rgb(94,94,94)"></u-icon>
  121. <view class="store">{{ res.store }}</view>
  122. <u-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></u-icon>
  123. </view>
  124. <view class="right">{{ res.deal }}</view>
  125. </view>
  126. <view class="item" v-for="(item, index) in res.goodsList" :key="index">
  127. <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
  128. <view class="content">
  129. <view class="title u-line-2">{{ item.title }}</view>
  130. <view class="type">{{ item.type }}</view>
  131. <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
  132. </view>
  133. <view class="right">
  134. <view class="price">
  135. ¥{{ priceInt(item.price) }}
  136. <text class="decimal">.{{ priceDecimal(item.price) }}</text>
  137. </view>
  138. <view class="number">x{{ item.number }}</view>
  139. </view>
  140. </view>
  141. <view class="total">
  142. 共{{ totalNum(res.goodsList) }}件商品 合计:
  143. <text class="total-price">
  144. ¥{{ priceInt(totalPrice(res.goodsList)) }}.
  145. <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
  146. </text>
  147. </view>
  148. <view class="bottom">
  149. <view class="more"><u-icon name="more-dot-fill" color="rgb(203,203,203)"></u-icon></view>
  150. <view class="logistics btn">查看物流</view>
  151. <view class="exchange btn">卖了换钱</view>
  152. <view class="evaluate btn">评价</view>
  153. </view>
  154. </view>
  155. <u-loadmore :status="loadStatus[3]" bgColor="#f2f2f2"></u-loadmore>
  156. </view>
  157. </scroll-view>
  158. </swiper-item>
  159. </swiper>
  160. </view>
  161. </view>
  162. </template>
  163. <script>
  164. export default {
  165. data() {
  166. return {
  167. orderList: [[], [], [], []],
  168. dataList: [
  169. {
  170. id: 1,
  171. store: '夏日流星限定贩卖',
  172. deal: '交易成功',
  173. goodsList: [
  174. {
  175. goodsUrl: '//img13.360buyimg.com/n7/jfs/t1/103005/7/17719/314825/5e8c19faEb7eed50d/5b81ae4b2f7f3bb7.jpg',
  176. title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
  177. type: '灰色;M',
  178. deliveryTime: '付款后30天内发货',
  179. price: '348.58',
  180. number: 2
  181. },
  182. {
  183. goodsUrl: '//img12.360buyimg.com/n7/jfs/t1/102191/19/9072/330688/5e0af7cfE17698872/c91c00d713bf729a.jpg',
  184. title: '【葡萄藤】现货 小清新学院风制服格裙百褶裙女短款百搭日系甜美风原创jk制服女2020新款',
  185. type: '45cm;S',
  186. deliveryTime: '付款后30天内发货',
  187. price: '135.00',
  188. number: 1
  189. }
  190. ]
  191. },
  192. {
  193. id: 2,
  194. store: '江南皮革厂',
  195. deal: '交易失败',
  196. goodsList: [
  197. {
  198. goodsUrl: '//img14.360buyimg.com/n7/jfs/t1/60319/15/6105/406802/5d43f68aE9f00db8c/0affb7ac46c345e2.jpg',
  199. title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
  200. type: '粉色;M',
  201. deliveryTime: '付款后7天内发货',
  202. price: '128.05',
  203. number: 1
  204. }
  205. ]
  206. },
  207. {
  208. id: 3,
  209. store: '三星旗舰店',
  210. deal: '交易失败',
  211. goodsList: [
  212. {
  213. goodsUrl: '//img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg',
  214. title: '三星(SAMSUNG)京品家电 UA65RUF70AJXXZ 65英寸4K超高清 HDR 京东微联 智能语音 教育资源液晶电视机',
  215. type: '4K,广色域',
  216. deliveryTime: '保质5年',
  217. price: '1998',
  218. number: 3
  219. },
  220. {
  221. goodsUrl: '//img14.360buyimg.com/n7/jfs/t6007/205/4099529191/294869/ae4e6d4f/595dcf19Ndce3227d.jpg!q90.jpg',
  222. title: '美的(Midea)639升 对开门冰箱 19分钟急速净味 一级能效冷藏双开门杀菌智能家用双变频节能 BCD-639WKPZM(E)',
  223. type: '容量大,速冻',
  224. deliveryTime: '保质5年',
  225. price: '2354',
  226. number: 1
  227. }
  228. ]
  229. },
  230. {
  231. id: 4,
  232. store: '三星旗舰店',
  233. deal: '交易失败',
  234. goodsList: [
  235. {
  236. goodsUrl: '//img10.360buyimg.com/n7/jfs/t22300/31/1505958241/171936/9e201a89/5b2b12ffNe6dbb594.jpg!q90.jpg',
  237. title: '法国进口红酒 拉菲(LAFITE)传奇波尔多干红葡萄酒750ml*6整箱装',
  238. type: '4K,广色域',
  239. deliveryTime: '珍藏10年好酒',
  240. price: '1543',
  241. number: 3
  242. },
  243. {
  244. goodsUrl: '//img10.360buyimg.com/n7/jfs/t1/107598/17/3766/525060/5e143aacE9a94d43c/03573ae60b8bf0ee.jpg',
  245. title: '蓝妹(BLUE GIRL)酷爽啤酒 清啤 原装进口啤酒 罐装 500ml*9听 整箱装',
  246. type: '一打',
  247. deliveryTime: '口感好',
  248. price: '120',
  249. number: 1
  250. }
  251. ]
  252. },
  253. {
  254. id: 5,
  255. store: '三星旗舰店',
  256. deal: '交易成功',
  257. goodsList: [
  258. {
  259. goodsUrl: '//img12.360buyimg.com/n7/jfs/t1/52408/35/3554/78293/5d12e9cfEfd118ba1/ba5995e62cbd747f.jpg!q90.jpg',
  260. title: '企业微信 中控人脸指纹识别考勤机刷脸机 无线签到异地多店打卡机WX108',
  261. type: '识别效率高',
  262. deliveryTime: '使用方便',
  263. price: '451',
  264. number: 9
  265. }
  266. ]
  267. }
  268. ],
  269. list: [
  270. {
  271. name: '待付款'
  272. },
  273. {
  274. name: '待发货'
  275. },
  276. {
  277. name: '待收货'
  278. },
  279. {
  280. name: '待评价',
  281. count: 12
  282. }
  283. ],
  284. current: 0,
  285. swiperCurrent: 0,
  286. tabsHeight: 0,
  287. dx: 0,
  288. loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
  289. };
  290. },
  291. onLoad() {
  292. this.getOrderList(0);
  293. this.getOrderList(1);
  294. this.getOrderList(3);
  295. },
  296. computed: {
  297. // 价格小数
  298. priceDecimal() {
  299. return val => {
  300. if (val !== parseInt(val)) return val.slice(-2);
  301. else return '00';
  302. };
  303. },
  304. // 价格整数
  305. priceInt() {
  306. return val => {
  307. if (val !== parseInt(val)) return val.split('.')[0];
  308. else return val;
  309. };
  310. }
  311. },
  312. methods: {
  313. reachBottom() {
  314. // 此tab为空数据
  315. if(this.current != 2) {
  316. this.loadStatus.splice(this.current,1,"loading")
  317. setTimeout(() => {
  318. this.getOrderList(this.current);
  319. }, 1200);
  320. }
  321. },
  322. // 页面数据
  323. getOrderList(idx) {
  324. for(let i = 0; i < 5; i++) {
  325. let index = this.$u.random(0, this.dataList.length - 1);
  326. let data = JSON.parse(JSON.stringify(this.dataList[index]));
  327. data.id = this.$u.guid();
  328. this.orderList[idx].push(data);
  329. }
  330. this.loadStatus.splice(this.current,1,"loadmore")
  331. },
  332. // 总价
  333. totalPrice(item) {
  334. let price = 0;
  335. item.map(val => {
  336. price += parseFloat(val.price);
  337. });
  338. return price.toFixed(2);
  339. },
  340. // 总件数
  341. totalNum(item) {
  342. let num = 0;
  343. item.map(val => {
  344. num += val.number;
  345. });
  346. return num;
  347. },
  348. // tab栏切换
  349. change(index) {
  350. this.swiperCurrent = index;
  351. this.getOrderList(index);
  352. },
  353. transition({ detail: { dx } }) {
  354. this.$refs.tabs.setDx(dx);
  355. },
  356. animationfinish({ detail: { current } }) {
  357. this.$refs.tabs.setFinishCurrent(current);
  358. this.swiperCurrent = current;
  359. this.current = current;
  360. }
  361. }
  362. };
  363. </script>
  364. <style>
  365. /* #ifndef H5 */
  366. page {
  367. height: 100%;
  368. background-color: #f2f2f2;
  369. }
  370. /* #endif */
  371. </style>
  372. <style lang="scss" scoped>
  373. .order {
  374. width: 710rpx;
  375. background-color: #ffffff;
  376. margin: 20rpx auto;
  377. border-radius: 20rpx;
  378. box-sizing: border-box;
  379. padding: 20rpx;
  380. font-size: 28rpx;
  381. .top {
  382. display: flex;
  383. justify-content: space-between;
  384. .left {
  385. display: flex;
  386. align-items: center;
  387. .store {
  388. margin: 0 10rpx;
  389. font-size: 32rpx;
  390. font-weight: bold;
  391. }
  392. }
  393. .right {
  394. color: $u-type-warning-dark;
  395. }
  396. }
  397. .item {
  398. display: flex;
  399. margin: 20rpx 0 0;
  400. .left {
  401. margin-right: 20rpx;
  402. image {
  403. width: 200rpx;
  404. height: 200rpx;
  405. border-radius: 10rpx;
  406. }
  407. }
  408. .content {
  409. .title {
  410. font-size: 28rpx;
  411. line-height: 50rpx;
  412. }
  413. .type {
  414. margin: 10rpx 0;
  415. font-size: 24rpx;
  416. color: $u-tips-color;
  417. }
  418. .delivery-time {
  419. color: #e5d001;
  420. font-size: 24rpx;
  421. }
  422. }
  423. .right {
  424. margin-left: 10rpx;
  425. padding-top: 20rpx;
  426. text-align: right;
  427. .decimal {
  428. font-size: 24rpx;
  429. margin-top: 4rpx;
  430. }
  431. .number {
  432. color: $u-tips-color;
  433. font-size: 24rpx;
  434. }
  435. }
  436. }
  437. .total {
  438. margin-top: 20rpx;
  439. text-align: right;
  440. font-size: 24rpx;
  441. .total-price {
  442. font-size: 32rpx;
  443. }
  444. }
  445. .bottom {
  446. display: flex;
  447. margin-top: 40rpx;
  448. padding: 0 10rpx;
  449. justify-content: space-between;
  450. align-items: center;
  451. .btn {
  452. line-height: 52rpx;
  453. width: 160rpx;
  454. border-radius: 26rpx;
  455. border: 2rpx solid $u-border-color;
  456. font-size: 26rpx;
  457. text-align: center;
  458. color: $u-type-info-dark;
  459. }
  460. .evaluate {
  461. color: $u-type-warning-dark;
  462. border-color: $u-type-warning-dark;
  463. }
  464. }
  465. }
  466. .centre {
  467. text-align: center;
  468. margin: 200rpx auto;
  469. font-size: 32rpx;
  470. image {
  471. width: 164rpx;
  472. height: 164rpx;
  473. border-radius: 50%;
  474. margin-bottom: 20rpx;
  475. }
  476. .tips {
  477. font-size: 24rpx;
  478. color: #999999;
  479. margin-top: 20rpx;
  480. }
  481. .btn {
  482. margin: 80rpx auto;
  483. width: 200rpx;
  484. border-radius: 32rpx;
  485. line-height: 64rpx;
  486. color: #ffffff;
  487. font-size: 26rpx;
  488. background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
  489. }
  490. }
  491. .wrap {
  492. display: flex;
  493. flex-direction: column;
  494. height: calc(100vh - var(--window-top));
  495. width: 100%;
  496. }
  497. .swiper-box {
  498. flex: 1;
  499. }
  500. .swiper-item {
  501. height: 100%;
  502. }
  503. </style>