selectHouse.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!-- 选择小区 -->
  2. <template>
  3. <view class="pageBg">
  4. <!-- <image src="../../static/select_bgimage@2x.png" style="width: 100%;height: 100vh;"></image> -->
  5. <view class="backIcon" :style="{marginTop:phoneHeight+'rpx'}" @tap="back">
  6. <image src="../../static/icon_back@2x.png" style="width: 100%;height: 100%;"></image>
  7. </view>
  8. <view class="infoBox">
  9. <view class="topTitle">
  10. 选择小区住处
  11. </view>
  12. <view class="dec">获取详细的小区住处,登记您的信息</view>
  13. <view class="item" @tap="pickerHouse">
  14. <view style="width: 26rpx;height: 26rpx;margin:29rpx 8rpx 32rpx 20rpx;">
  15. <image src="../../static/select_icon_village@2x.png" style="width: 100%;height: 100%;"></image>
  16. </view>
  17. <input class="uni-input item-input" style="width:290rpx;height:40rpx;margin-top: 26rpx;" v-model="form.houseName"
  18. disabled="true" placeholder="请选择小区名称" />
  19. <view class="selectIcon" >
  20. <image src="../../static/select_combo@2x.png" style="width: 100%;height: 100%;"></image>
  21. </view>
  22. </view>
  23. <view class="item" style="margin-top:50rpx;" @tap="pickerLou">
  24. <view style="width: 26rpx;height: 26rpx;margin:32rpx 8rpx 32rpx 20rpx;">
  25. <image src="../../static/select_icon_storey@2x.png" style="width: 100%;height: 100%;"></image>
  26. </view>
  27. <input class="uni-input item-input" style="width:290rpx;height:40rpx;margin-top: 26rpx;" v-model="form.lou"
  28. disabled="true" placeholder="请选择楼层" />
  29. <view class="selectIcon" >
  30. <image src="../../static/select_combo@2x.png" style="width: 100%;height: 100%;"></image>
  31. </view>
  32. </view>
  33. <view class="item" style="margin-top:50rpx;" @tap="pickerHood">
  34. <view style="width: 26rpx;height: 26rpx;margin:32rpx 8rpx 32rpx 20rpx;">
  35. <image src="../../static/select_icon_unit@2x.png" style="width: 100%;height: 100%;"></image>
  36. </view>
  37. <input class="uni-input item-input" style="width:290rpx;height:40rpx;margin-top: 26rpx;" v-model="form.hoodNum"
  38. disabled="true" placeholder="请选择单元号" />
  39. <view class="selectIcon" >
  40. <image src="../../static/select_combo@2x.png" style="width: 100%;height: 100%;"></image>
  41. </view>
  42. </view>
  43. <view class="bottom"></view>
  44. </view>
  45. <!-- 发表按钮 -->
  46. <button class="btn" @tap="submit" :class="{active:form.houseName&&form.lou&&form.hoodNum}">发表</button>
  47. <!-- 选择小区名称组件 -->
  48. <lb-picker ref="houseName" :props="typeProps" :list="houseData" @confirm="confirm"></lb-picker>
  49. <!-- 选择楼层组件 -->
  50. <lb-picker ref="Lou" :list="louData" @confirm="confirmLou">></lb-picker>
  51. <!-- 选择单元号组件 -->
  52. <lb-picker ref="hoodNum" :list="hoodData" @confirm="confirmHoodNum"></lb-picker>
  53. </view>
  54. </template>
  55. <script>
  56. import LbPicker from '@/components/lb-picker'
  57. export default {
  58. data() {
  59. return {
  60. phoneHeight: 0, //手机状态栏的高度
  61. lou: '',//楼层
  62. hoodNum: '',//单元号
  63. form: {
  64. houseName: '', //小区名称
  65. lou: '', //楼层
  66. hoodNum: '' //单元号
  67. },
  68. // 自定义选择组件字段
  69. typeProps:{
  70. label:'name',
  71. value:'value',
  72. },
  73. //小区名称数据
  74. houseData: [{
  75. name: '花园小区',
  76. value: 0,
  77. },
  78. {
  79. name: '番茄小区',
  80. value: 1,
  81. },
  82. {
  83. name: '蓬莱院',
  84. value: 2,
  85. },
  86. ],
  87. //楼层数据
  88. louData: [{
  89. label: '一楼',
  90. value: 0,
  91. children: []
  92. },
  93. {
  94. label: '二楼',
  95. value: 1,
  96. children: []
  97. },
  98. {
  99. label: '三楼',
  100. value: 2,
  101. children: []
  102. },
  103. ],
  104. //单元号数据
  105. hoodData: [{
  106. label: '101',
  107. value: 0,
  108. children: []
  109. },
  110. {
  111. label: '201',
  112. value: 1,
  113. children: []
  114. },
  115. {
  116. label: '301',
  117. value: 2,
  118. children: []
  119. },
  120. ]
  121. }
  122. },
  123. created() {
  124. // 获取状态栏的高度
  125. this.phoneHeight = uni.getSystemInfoSync().statusBarHeight
  126. },
  127. mounted(){},
  128. methods: {
  129. // 获取小区数据
  130. getAreaData(){
  131. },
  132. //返回
  133. back(){
  134. uni.navigateBack({
  135. delta:1
  136. })
  137. },
  138. //选择小区事件
  139. pickerHouse() {
  140. this.$refs.houseName.show()
  141. },
  142. // 选择楼层事件
  143. pickerLou() {
  144. this.$refs.Lou.show()
  145. },
  146. // 选择单元号事件
  147. pickerHood() {
  148. this.$refs.hoodNum.show()
  149. },
  150. //小区选择确定
  151. confirm(data) {
  152. console.log(data)
  153. this.form.houseName = data.item.name
  154. this.name = data.item.value
  155. },
  156. //楼层选择确定
  157. confirmLou(data) {
  158. this.form.lou = data.item.label
  159. this.lou = data.item.value
  160. },
  161. //单元号选择确定
  162. confirmHoodNum(data) {
  163. this.form.hoodNum = data.item.label
  164. this.hoodNum = data.item.value
  165. },
  166. // 发表
  167. submit() {
  168. // 判断信息是否选择完整
  169. if(this.form.houseName&& this.form.lou&&this.form.hoodNum){
  170. uni.switchTab({
  171. url:"../index/index"
  172. })
  173. }else{
  174. return
  175. }
  176. }
  177. },
  178. components: {
  179. LbPicker
  180. }
  181. }
  182. </script>
  183. <style>
  184. .backIcon{
  185. width: 48rpx;
  186. height: 48rpx;
  187. position: absolute;
  188. left: 24rpx;
  189. top: 30rpx;
  190. }
  191. .btn {
  192. width: 590rpx;
  193. height: 90rpx;
  194. font-size: 32rpx;
  195. font-family: PingFang SC;
  196. font-weight: bold;
  197. line-height: 90rpx;
  198. color: rgba(255, 255, 255, 1);
  199. background: rgba(163, 197, 237, 1);
  200. opacity: 1;
  201. position: absolute;
  202. top: 1160rpx;
  203. left: 80rpx;
  204. }
  205. .selectIcon {
  206. width: 17rpx;
  207. height: 12rpx;
  208. position: absolute;
  209. bottom: 60rpx;
  210. right: 30rpx;
  211. }
  212. .bottom {
  213. width: 642rpx;
  214. height: 42rpx;
  215. background: linear-gradient(84deg, rgba(64, 151, 255, 1) 0%, rgba(141, 193, 255, 1) 100%);
  216. opacity: 1;
  217. border-radius: 0rpx 0rpx 24rpx 24rpx;
  218. position: absolute;
  219. bottom: 0;
  220. }
  221. .pageBg {
  222. width: 100%;
  223. height: 100vh;
  224. background: url(../../static/select_bgimage@2x.png);
  225. background-size: 100% 100%;
  226. }
  227. .infoBox {
  228. position: relative;
  229. width: 642rpx;
  230. height: 890rpx;
  231. background: rgba(255, 255, 255, 1);
  232. box-shadow: 0px 0px 20px rgba(156, 202, 255, 0.36);
  233. opacity: 1;
  234. border-radius: 20px;
  235. /* margin: 0 auto; */
  236. /* margin-top: 190rpx; */
  237. overflow: hidden;
  238. position: absolute;
  239. top: 190rpx;
  240. left: 54rpx;
  241. }
  242. .topTitle {
  243. width: 348rpx;
  244. height: 80rpx;
  245. font-size: 56rpx;
  246. font-family: PingFang SC;
  247. font-weight: bold;
  248. line-height: 54rpx;
  249. color: rgba(41, 138, 253, 1);
  250. opacity: 1;
  251. margin: 0 auto;
  252. margin-top: 120rpx;
  253. }
  254. .dec {
  255. width: 532rpx;
  256. height: 44rpx;
  257. font-size: 32rpx;
  258. font-family: PingFang SC;
  259. font-weight: 400;
  260. line-height: 54rpx;
  261. color: rgba(153, 153, 153, 1);
  262. margin: 0 auto;
  263. margin-top: 16rpx;
  264. opacity: 1;
  265. }
  266. .item {
  267. position: relative;
  268. display: flex;
  269. width: 590rpx;
  270. height: 90rpx;
  271. border: 2rpx solid rgba(247, 247, 247, 1);
  272. opacity: 1;
  273. border-radius: 12rpx;
  274. margin: 0 auto;
  275. margin-top: 70rpx;
  276. }
  277. .item-input {
  278. font-size: 28rpx;
  279. font-family: PingFang SC;
  280. font-weight: 400;
  281. line-height: 54rpx;
  282. color: rgba(204, 204, 204, 1);
  283. }
  284. .active {
  285. background: rgba(41, 138, 253, 1);
  286. }
  287. </style>