index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="worktable">
  3. <u-navbar placeholder :safeAreaInsetTop="true" bgColor="#363C4F">
  4. <view class="u-nav-left" slot="left" style="height:100%;display: flex;
  5. align-items: center;">
  6. 工作台
  7. </view>
  8. <view class="u-nav-center" slot="center" style="padding-right: 20rpx;">
  9. <u-transition :show="topSearch" mode="fade-up">
  10. <view class="searchBox_top">
  11. <input placeholder-style="color:#ffffff32;font-size: 20rpx;" type="text"
  12. placeholder="输入手机号码/会员卡号">
  13. <u-icon name="scan" size="22px" color="#D9D9D9"></u-icon>
  14. <i>|</i>
  15. <span>取消</span>
  16. </view>
  17. </u-transition>
  18. </view>
  19. </u-navbar>
  20. <view class="vipInfo">
  21. <view class="searchBox">
  22. <input placeholder-style="color:#ffffff32;font-size: 30rpx;" type="text" placeholder="输入手机号码/会员卡号">
  23. <u-icon name="scan" size="22px" color="#D9D9D9"></u-icon>
  24. <i>|</i>
  25. <span>取消</span>
  26. </view>
  27. <u-row customStyle="margin-bottom:20px;flex-wrap: wrap;">
  28. <u-col span="6" customStyle="margin-bottom:16px;">
  29. <view>会员姓名:xxx</view>
  30. </u-col>
  31. <u-col span="6" customStyle="margin-bottom:16px;">
  32. <view>会员卡号:123456789</view>
  33. </u-col>
  34. <u-col span="6" customStyle="margin-bottom:16px;">
  35. <view>手机号码:15900000000</view>
  36. </u-col>
  37. <u-col span="6" customStyle="margin-bottom:16px;">
  38. <view>剩余积分:1234</view>
  39. </u-col>
  40. </u-row>
  41. </view>
  42. <goods />
  43. <statistics ref="statistics" />
  44. </view>
  45. </template>
  46. <script>
  47. import goods from "./goods.vue"
  48. import statistics from "./statistics.vue"
  49. export default {
  50. components: {
  51. goods,
  52. statistics
  53. },
  54. data() {
  55. return {
  56. bottom: 0,
  57. topSearch: false,
  58. }
  59. },
  60. onPageScroll(e) {
  61. const query1 = uni.createSelectorQuery().in(this);
  62. query1.select('.searchBox').boundingClientRect((pos) => {
  63. if (pos.bottom <= this.bottom) {
  64. this.topSearch = true
  65. } else {
  66. this.topSearch = false
  67. }
  68. }).exec()
  69. },
  70. onLoad() {
  71. Promise.all([this.getHeightA(), this.getHeightB()]).then(res => {
  72. console.log(res)
  73. this.$store.commit("setGoodsHeight", res[1] - res[0])
  74. })
  75. },
  76. onReady() {},
  77. methods: {
  78. //计算顶部nav高度
  79. getHeightA() {
  80. return new Promise((resolve) => {
  81. const query1 = uni.createSelectorQuery().in(this);
  82. query1.select('.u-nav-left').boundingClientRect((pos) => {
  83. this.bottom = pos.bottom
  84. resolve(pos.bottom)
  85. }).exec()
  86. })
  87. },
  88. //计算底部shoppingCar高度
  89. getHeightB() {
  90. return new Promise((resolve) => {
  91. const query2 = uni.createSelectorQuery().in(this.$refs.statistics);
  92. query2.select('.statistics').boundingClientRect((pos) => {
  93. resolve(pos.top)
  94. }).exec()
  95. })
  96. },
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .u-nav-left,
  102. .u-nav-center {
  103. color: #fff;
  104. }
  105. .vipInfo {
  106. background-color: #363C4F;
  107. padding: 32rpx;
  108. color: #D9D9D9;
  109. font-size: 28rpx;
  110. &>.searchBox {
  111. padding: 28rpx;
  112. width: 100%;
  113. background: rgba(255, 255, 255, 0.37);
  114. border-radius: 300rpx;
  115. color: #D9D9D9;
  116. display: flex;
  117. align-items: center;
  118. margin-bottom: 48rpx;
  119. &>input {
  120. color: #fff;
  121. flex: 1;
  122. font-size: 30rpx;
  123. padding-right: 10rpx;
  124. }
  125. &>i {
  126. color: #DBDBDB;
  127. font-style: normal;
  128. margin: 0rpx 32rpx;
  129. }
  130. &>span {
  131. color: #fff;
  132. }
  133. }
  134. }
  135. .searchBox_top {
  136. padding: 8rpx 16rpx;
  137. width: 100%;
  138. background: rgba(255, 255, 255, 0.37);
  139. border-radius: 300rpx;
  140. color: #D9D9D9;
  141. display: flex;
  142. align-items: center;
  143. font-size: 20rpx;
  144. &>input {
  145. color: #fff;
  146. flex: 1;
  147. font-size: 20rpx;
  148. padding-right: 5rpx;
  149. }
  150. &>i {
  151. color: #DBDBDB;
  152. font-style: normal;
  153. margin: 0rpx 16rpx;
  154. }
  155. &>span {
  156. color: #fff;
  157. }
  158. }
  159. </style>