selectNew.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <u-popup round="28rpx" :show="isShow" @close="closeDialog">
  3. <view>
  4. <view class="select-box">
  5. <view class="select-box-title">
  6. <text>{{title}}</text>
  7. <!-- <view> -->
  8. <!-- <u-button @click="edit" shape="circle" color="linear-gradient(to top, #F59A02, #FFD334)" class="select-button-style">确认</u-button>
  9. </view> -->
  10. <!-- <image @click="closeDialog" style="width: 30rpx;height: 30rpx;" src="../../static/images/close.png"
  11. mode="">
  12. </image> -->
  13. </view>
  14. <!-- <view class="box"> -->
  15. <view class="search-box" v-if="isCar">
  16. <u--input style="width: 580rpx;" placeholderStyle="color:#7E8EC1" :placeholder="placeholder"
  17. border="surround" v-model="value">
  18. </u--input>
  19. <!-- <u-button type="primary" icon="map" text="图标按钮"></u-button> -->
  20. <u-button @click="search" color="linear-gradient(to top, #F59A02, #FFD334)" class="search-buton">
  21. <view class="search"></view>
  22. <!-- <image src="../../static/images/serch.png" mode="widthFix" style="width: 45rpx;height: 45rpx"></image> -->
  23. </u-button>
  24. </view>
  25. <view class="select-bottom">
  26. <!-- <view class="select-list" id="select-list"> -->
  27. <!-- 回显到指定位置 -->
  28. <scroll-view class="select-list" scroll-y="true" :scroll-into-view="activeId"
  29. :show-scrollbar='true'>
  30. <view :class="isChecked.value===item.value?'active':''" @click="selectClick(item)"
  31. :id="'active'+index" class="select-list-item" v-for="(item,index) in showList" :key="index">
  32. {{item.name}}
  33. </view>
  34. </scroll-view>
  35. <!-- </view> -->
  36. </view>
  37. <!-- <view class="select-button">
  38. <u-button @click="edit" shape="circle" color="linear-gradient(to top, #F59A02, #FFD334)" class="select-button-style">确认选择车辆</u-button>
  39. </view> -->
  40. <!-- </view> -->
  41. </view>
  42. </view>
  43. </u-popup>
  44. </template>
  45. <script>
  46. export default {
  47. props: {
  48. isCar: {
  49. type: Boolean,
  50. default: true
  51. },
  52. isShow: {
  53. type: Boolean,
  54. default: false,
  55. },
  56. oldList: {
  57. type: Array,
  58. default: [],
  59. },
  60. valueData: {
  61. type: String,
  62. default: "",
  63. },
  64. title: {
  65. type: String,
  66. default: "选择车辆",
  67. },
  68. placeholder: {
  69. type: String,
  70. default: "搜索车辆车牌号",
  71. },
  72. },
  73. watch: {
  74. isShow(newVal) {
  75. this.value = '';
  76. this.isChecked = {};
  77. this.list = this.oldList;
  78. this.showList = this.oldList;
  79. this.oldList.forEach((item, index) => {
  80. if (item.value === this.valueData) {
  81. this.isChecked = item;
  82. this.activeId = 'active' + (index - 1);
  83. }
  84. })
  85. },
  86. },
  87. mounted() {
  88. },
  89. data() {
  90. return {
  91. isChecked: {},
  92. index: 0,
  93. value: '',
  94. selectName: '',
  95. list: [],
  96. showList: [],
  97. activeId: ''
  98. }
  99. },
  100. computed: {
  101. },
  102. methods: {
  103. isList() {
  104. },
  105. closeDialog() {
  106. this.$emit('changSelect')
  107. },
  108. edit() {
  109. this.$emit('changSelect', this.isChecked);
  110. },
  111. selectClick(index) {
  112. this.isChecked = index;
  113. this.edit();
  114. },
  115. search() {
  116. this.isChecked = {};
  117. if (this.list && this.list.length > 0) {
  118. let showList = this.list.filter(item => item.name.indexOf(this.value) !== -1)
  119. this.showList = showList
  120. }
  121. },
  122. },
  123. }
  124. </script>
  125. <style>
  126. .select-box {
  127. /* height: 583rpx; */
  128. background: rgba(255, 255, 255, 0.6);
  129. box-shadow: 0px 0px 24rpx 6rpx rgba(109, 160, 251, 0.6);
  130. border-top-left-radius: 28rpx;
  131. border-top-right-radius: 28rpx;
  132. }
  133. /deep/.u-popup__content {
  134. background: rgba(255, 255, 255, 0.3) !important;
  135. /* background: rgba(255,255,255,0.6);
  136. box-shadow: 0px 0px 24rpx 6rpx rgba(109,160,251,0.6); */
  137. box-shadow: inset 0px 10rpx 0px 10rpx rgba(109, 160, 251, 0.6);
  138. }
  139. .select-box-title {
  140. width: 100vw;
  141. background: #7FB5FF;
  142. border-radius: 28rpx 28rpx 0px 0px;
  143. display: flex;
  144. padding: 18rpx 36rpx;
  145. box-sizing: border-box;
  146. justify-content: space-between;
  147. align-items: center;
  148. font-size: 28rpx;
  149. font-weight: bold;
  150. color: #FFFFFF;
  151. }
  152. .search-box {
  153. display: flex;
  154. justify-content: space-between;
  155. width: 750rpx;
  156. align-items: center;
  157. padding: 23rpx 36rpx;
  158. box-sizing: border-box;
  159. }
  160. /deep/.search-box .u-input {
  161. /* width: 507rpx; */
  162. height: 72rpx;
  163. background: rgba(255, 255, 255, 0.1);
  164. /* border: 2rpx solid #495B93; */
  165. border-radius: 15rpx;
  166. box-sizing: border-box;
  167. margin-right: 27rpx;
  168. /* flex: none; */
  169. }
  170. /deep/.search-box .u-border {
  171. border-color: #495B93 !important;
  172. border-width: 2rpx !important;
  173. }
  174. .search-box .search-buton {
  175. width: 72rpx;
  176. height: 72rpx;
  177. /* background: linear-gradient(0deg, #F59A02 0%, #FFD334 100%); */
  178. /* border-radius: 36rpx; */
  179. border-radius: 15rpx;
  180. color: #fff;
  181. margin: 0;
  182. font-size: 28rpx;
  183. font-weight: bold;
  184. padding: 0;
  185. }
  186. .search {
  187. width: 37rpx;
  188. height: 37rpx;
  189. background-image: url('../../static/images/serch.png');
  190. background-size: 100% 100%;
  191. }
  192. /deep/.u-popup__content {
  193. border-top: none;
  194. border-bottom: none;
  195. }
  196. .select-bottom {
  197. /* margin: 20rpx auto; */
  198. padding-top: 20rpx;
  199. padding-bottom: 20rpx;
  200. }
  201. .select-button {
  202. width: 677rpx;
  203. margin: 46rpx auto;
  204. }
  205. .select-button-style {
  206. width: 100rpx !important;
  207. height: 45rpx !important;
  208. color: #ffffff !important;
  209. font-size: 26rpx;
  210. font-weight: bold;
  211. }
  212. .active {
  213. width: 677rpx;
  214. /* height: 85rpx; */
  215. background: rgba(127, 181, 255, 0.8);
  216. border-radius: 28rpx;
  217. font-size: 30rpx;
  218. font-weight: bold !important;
  219. color: #333333 !important;
  220. margin: 0 auto;
  221. }
  222. .select-list {
  223. /* height: 344rpx; */
  224. height: 200rpx;
  225. /* overflow-y: auto; */
  226. }
  227. .select-list .select-list-item {
  228. /* padding: 28rpx 0; */
  229. height: 86rpx;
  230. line-height: 86rpx;
  231. text-align: center;
  232. box-sizing: border-box;
  233. font-size: 28rpx;
  234. font-weight: bold;
  235. color: #666666;
  236. }
  237. /deep/.select-box .u-button--info {
  238. border: none !important;
  239. }
  240. </style>