screenPopup.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="">
  3. <u-popup :show="show" :round="10" mode="top" @close="close">
  4. <view class="top-tab-search">
  5. <view class="search">
  6. <u--input
  7. v-model="searchData.keywords"
  8. placeholder="搜索商品名称"
  9. shape="circle"
  10. prefixIcon="search"
  11. prefixIconStyle="font-size: 22px;color: #909399"
  12. ></u--input>
  13. <view class="screen" @click="openPopup">
  14. 筛选
  15. <image
  16. class="screen-icon"
  17. src="../../../static/mine/335.png"
  18. mode=""
  19. ></image>
  20. </view>
  21. </view>
  22. <view class="tab">
  23. <view class="top-tab">
  24. <view
  25. :class="{ commodity: followPopup == '' }"
  26. class="tab"
  27. @click="tabSwitch('')"
  28. >
  29. 全部
  30. </view>
  31. <view
  32. :class="{ commodity: followPopup == 'normal' }"
  33. class="tab"
  34. @click="tabSwitch('normal')"
  35. >
  36. 已上架
  37. </view>
  38. <view
  39. :class="{ commodity: followPopup == 'down' }"
  40. class="tab"
  41. @click="tabSwitch('down')"
  42. >
  43. 已下架
  44. </view>
  45. </view>
  46. </view>
  47. <view class="btn-list">
  48. <view :class="{ 'select-tab': selectTab == 0 }" @click="selected(0)"
  49. >我的商品</view
  50. >
  51. <view :class="{ 'select-tab': selectTab == 1 }" @click="selected(1)"
  52. >供应链商品</view
  53. >
  54. <view :class="{ 'select-tab': selectTab == 2 }" @click="selected(2)"
  55. >平台自营商品</view
  56. >
  57. </view>
  58. <view class="reset-config">
  59. <button class="reset" @click="close">重置</button
  60. ><button class="config" @click="confirm">确定</button>
  61. </view>
  62. </view>
  63. </u-popup>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. followPopup: "",
  71. selectTab: 0,
  72. searchData: {
  73. keywords: "",
  74. status: "",
  75. source: "0",
  76. },
  77. };
  78. },
  79. props: {
  80. follow: {
  81. typeof: String,
  82. default: "",
  83. },
  84. show: {
  85. typeof: Boolean,
  86. default: false,
  87. },
  88. },
  89. watch: {
  90. //监听横向tab栏的数据,同步父组件和子组件横向tab栏的状态
  91. follow(newVal) {
  92. this.followPopup = newVal;
  93. },
  94. },
  95. methods: {
  96. //切换tab
  97. tabSwitch(num) {
  98. this.followPopup = num;
  99. this.searchData.status = num;
  100. },
  101. //关闭弹窗,将数据传入如=父组件
  102. close() {
  103. this.$emit("close");
  104. },
  105. confirm() {
  106. this.$emit("close", this.searchData);
  107. },
  108. //切换选中状态
  109. selected(num) {
  110. this.selectTab = num;
  111. this.searchData.source = num;
  112. },
  113. },
  114. };
  115. </script>
  116. <style scoped lang="scss">
  117. .top-tab-search {
  118. background-color: #fff;
  119. padding: 10rpx 24rpx;
  120. z-index: 20174;
  121. .search {
  122. display: flex;
  123. align-items: center;
  124. .screen {
  125. display: flex;
  126. align-items: center;
  127. font-size: 26rpx;
  128. color: #f83224;
  129. font-weight: 600;
  130. margin-left: 20rpx;
  131. .screen-icon {
  132. width: 24rpx;
  133. height: 24rpx;
  134. margin-left: 5rpx;
  135. }
  136. }
  137. }
  138. .top-tab {
  139. margin-top: 10rpx;
  140. padding: 0 20rpx;
  141. display: flex;
  142. justify-content: space-between;
  143. .tab {
  144. font-size: 26rpx;
  145. color: rgba(34, 34, 34, 0.8);
  146. flex-shrink: 0;
  147. height: 44rpx;
  148. display: flex;
  149. align-items: flex-end;
  150. padding-bottom: 12rpx;
  151. }
  152. .commodity {
  153. position: relative;
  154. font-weight: 600;
  155. }
  156. .commodity::before {
  157. content: "";
  158. display: block;
  159. height: 4rpx;
  160. width: 50%;
  161. background: #f83224;
  162. position: absolute;
  163. bottom: -10rpx;
  164. opacity: 0.8;
  165. left: 50%;
  166. transform: translate(-50%, 50%);
  167. }
  168. }
  169. .btn-list {
  170. display: flex;
  171. justify-content: space-around;
  172. align-items: center;
  173. margin-top: 32rpx;
  174. view {
  175. width: 210rpx;
  176. height: 68rpx;
  177. text-align: center;
  178. line-height: 68rpx;
  179. background-color: #f3f3f3;
  180. border-radius: 10rpx;
  181. font-size: 26rpx;
  182. color: #444;
  183. }
  184. .select-tab {
  185. background-color: rgba(248, 50, 36, 0.1);
  186. color: #f83224;
  187. font-weight: 600;
  188. }
  189. }
  190. .reset-config {
  191. display: flex;
  192. justify-content: space-between;
  193. align-items: center;
  194. margin-top: 44rpx;
  195. .reset {
  196. width: 260rpx;
  197. height: 76rpx;
  198. background-color: #f3f3f3;
  199. border: none;
  200. border-radius: 38rpx;
  201. color: #333;
  202. font-size: 28rpx;
  203. }
  204. .config {
  205. width: 402rpx;
  206. height: 76rpx;
  207. background-color: #f83224;
  208. color: #fff;
  209. border: none;
  210. border-radius: 38rpx;
  211. font-size: 28rpx;
  212. }
  213. }
  214. }
  215. </style>