order-detail.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="">
  3. <scroll-view class="titleTop" scroll-x="true" @scroll="scroll" scroll-left="100%">
  4. <view class="">
  5. <view class="titleTop-name" v-for="(item,index) in titleList" :key="index">
  6. {{item}}
  7. </view>
  8. </view>
  9. <view class="list">
  10. <view class="" v-for="(item,index) in list" :key="index">
  11. <view class="list-item" v-for="(str,index) in item" :key="index">
  12. <text>{{str}}</text>
  13. </view>
  14. </view>
  15. </view>
  16. </scroll-view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. _API_GetOrderDetail
  22. } from '@/apis/order.js'
  23. export default {
  24. data() {
  25. return {
  26. id: '',
  27. // titleList: ['款式尺码','订单1','订单2','订单3','订单4','合并'],
  28. // list:[['精-男-L','精-男-XL'],[1,2], [3,0],[1,2],[3,4],[8,12]],
  29. titleList: [],
  30. list: []
  31. }
  32. },
  33. onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
  34. this.id = option.id
  35. },
  36. onShow() {
  37. this.getList()
  38. },
  39. computed: {},
  40. methods: {
  41. getList() {
  42. _API_GetOrderDetail({
  43. id: this.id
  44. }).then(res => {
  45. if (res.code === 200) {
  46. this.list = res.data
  47. let list = this.list
  48. let titleList = ['款式尺码']
  49. for (var i = 0; i < list.length; i++) {
  50. titleList[i + 1] = '订单' + (i + 1)
  51. }
  52. titleList.push('合并')
  53. titleList.splice(list.length - 1, 2)
  54. this.titleList = titleList
  55. } else {
  56. uni.showModal({
  57. content: res.message,
  58. showCancel: false,
  59. success() {
  60. uni.navigateBack()
  61. }
  62. })
  63. }
  64. }).catch(() => {})
  65. },
  66. scroll() {}
  67. },
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .titleTop {
  72. // width: 60rpx;
  73. white-space: nowrap;
  74. &-name {
  75. background-color: #eee;
  76. line-height: 104rpx;
  77. display: flex;
  78. color: #333;
  79. font-size: 32rpx;
  80. font-weight: bold;
  81. display: inline-block;
  82. text-align: center;
  83. width: 200rpx;
  84. }
  85. }
  86. .list {
  87. display: flex;
  88. &-item {
  89. width: 200rpx;
  90. font-weight: bold;
  91. line-height: 104rpx;
  92. text-align: center;
  93. border-right: 1rpx solid #eee;
  94. border-bottom: 1rpx solid #eee;
  95. }
  96. }
  97. </style>