order.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <style lang="scss">
  2. .app-bg{
  3. position: absolute;
  4. image{width: 100vw;height: 45vw;}
  5. height: 50vw;
  6. background: #ca3a35;
  7. }
  8. .order-top{
  9. position: absolute;
  10. width: 100%;
  11. height: 100%;
  12. z-index: 20;
  13. top: 0px;
  14. .topbtn{
  15. height: 40px;
  16. line-height: 40px;
  17. border: 1px solid #fff;
  18. border-radius: 5px;
  19. text-align: center;
  20. font-size: 15px;
  21. font-weight: 700;
  22. color: #fff;
  23. background: #dc262b;
  24. width: calc(50% - 100rpx);
  25. margin-right: 50rpx;
  26. &:nth-child(2n) {
  27. margin-left: 50rpx;
  28. margin-right: 0px;
  29. }
  30. &.active{
  31. color: #dc262b;
  32. background: #fff;
  33. }
  34. }
  35. }
  36. </style>
  37. <template>
  38. <view>
  39. <view class="app-bg">
  40. <image src="/static/img/au_order_bg.png"></image>
  41. <view class="order-top fx-r fx-bc fx-ac" :style="'height:calc(45vw - 44px - ' + statusBarHeight + 'px - 20px);top:' + (statusBarHeight + 20 + 44) + 'px' ">
  42. <view class="topbtn" @tap="tapCk('buy')" :class="navType == 'buy' ? 'active' : ''">
  43. 我的买单
  44. </view>
  45. <view class="topbtn" @tap="tapCk('out')" :class="navType == 'out' ? 'active' : ''">
  46. 我的卖单
  47. </view>
  48. </view>
  49. </view>
  50. <uni-nav-bar color="#fff" :border="false" statusBar backgroundColor="transparent" left-icon="left" @clickLeft="utils.navigateBack()" fixed title="我的订单"></uni-nav-bar>
  51. <view class="htop" :style="'height:calc(45vw - 44px);'"></view>
  52. <view :hidden="navType != 'buy'">
  53. <buyorder ref="buyorder"></buyorder>
  54. </view>
  55. <view :hidden="navType != 'out'">
  56. <outorder ref="outorder"></outorder>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {mapState,mapMutations } from 'vuex';
  62. import buyorder from "./info/buyorder";
  63. import outorder from "./info/outorder";
  64. export default {
  65. computed: mapState(['user']),
  66. components: {buyorder,outorder},
  67. data() {
  68. return {
  69. statusBarHeight : 0,
  70. navType : "buy",
  71. }
  72. },
  73. onLoad(options) {
  74. this.navType = options.type || "buy";
  75. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  76. },
  77. onShow() {
  78. this.initView();
  79. },
  80. methods: {
  81. /**
  82. * 加载基础配置
  83. */
  84. initView:function(){
  85. this.$nextTick(()=>{
  86. setTimeout(()=>{
  87. if(this.navType == 'buy') {
  88. this.$refs['buyorder'].initView();
  89. }
  90. if(this.navType == 'out') {
  91. this.$refs['outorder'].initView();
  92. }
  93. },200);
  94. });
  95. },
  96. /**
  97. * 切换数据
  98. */
  99. tapCk:function(ev){
  100. this.navType = ev;
  101. if(ev == 'buy') {
  102. this.$refs['buyorder'].initView();
  103. }
  104. if(ev == 'out') {
  105. this.$refs['outorder'].initView();
  106. }
  107. }
  108. },
  109. }
  110. </script>