houseList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <template>
  2. <view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="房型信息" :showIcon="false" :titleStyle="titleStyle"></c-nav-bar>
  4. <view class="body">
  5. <!-- 房型信息 -->
  6. <view class="typeInfo">
  7. <view class="titleInfo">
  8. <text style="font-size: 32rpx; font-weight: 700;">房型信息</text>
  9. </view>
  10. <view class="cellBox">
  11. <text style="font-size: 30rpx; margin-right: 30rpx;">房型名称</text>
  12. <input v-model="form.name" type="text" placeholder="请输入房型" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  13. </view>
  14. <view class="bigRoom">
  15. <text style="font-size: 30rpx;color: black; margin-right: 90rpx;">简称</text>
  16. <input v-model="form.shortName" type="text" placeholder="请输入简称" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  17. </view>
  18. </view>
  19. <view class="shelves">
  20. <view style="margin-left: 30rpx;">
  21. <text style="font-size: 30rpx; " >是否上架</text>
  22. </view>
  23. <view style="margin-right: 30rpx;">
  24. <u-switch v-model="checked" size="50" active-color="#07C160"> </u-switch>
  25. </view>
  26. </view>
  27. <!-- 图片上传
  28. -->
  29. <view class="uploadPic">
  30. <view style=" margin-left: 30rpx;">
  31. <text style="font-size: 32rpx; font-weight: 700; ">封面图片(0/1)</text>
  32. </view>
  33. <view style="margin-top: 20rpx; margin-left: 30rpx; color: #777; font-size: 24rpx;">
  34. <text>仅能上传1张,需展示房间内容</text>
  35. </view>
  36. <view class="pic">
  37. <!-- 图片 -->
  38. <u-upload>
  39. <img src="https://img.51miz.com/Element/00/77/24/47/cd39208d_E772447_a1d65d72.png" style="width: 190rpx; height: 120rpx;" />
  40. </u-upload>
  41. </view>
  42. </view>
  43. <!-- 价格信息 -->
  44. <view class="priceInfo">
  45. <!-- 标题 -->
  46. <view class="titleInfo">
  47. <text style="font-size: 32rpx; font-weight: 700; margin-left: 10rpx;">价格信息</text>
  48. </view>
  49. <!-- 周末周日区分 -->
  50. <view class="week">
  51. <view class="weekend">
  52. <view >
  53. <text style="font-size: 30rpx; " >区分平日周末</text>
  54. </view>
  55. <view >
  56. <u-switch v-model="weekedChecked" size="50" active-color="#07C160" ></u-switch>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 每日价格 -->
  61. <view class="priceBoxWeek">
  62. <view class="weekendBox">
  63. <view >
  64. <text style="font-size: 30rpx; margin-right: 90rpx; " >周一</text>
  65. </view>
  66. <view style="display: flex;">
  67. <text style="font-size: 30rpx;">¥</text> <input v-model="form.mondayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="priceBoxWeek">
  72. <view class="weekendBox">
  73. <view >
  74. <text style="font-size: 30rpx; margin-right: 90rpx; " >周二</text>
  75. </view>
  76. <view style="display: flex;">
  77. <text style="font-size: 30rpx;">¥</text> <input v-model="form.tuesdayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="priceBoxWeek">
  82. <view class="weekendBox">
  83. <view >
  84. <text style="font-size: 30rpx; margin-right: 90rpx; " >周三</text>
  85. </view>
  86. <view style="display: flex;">
  87. <text style="font-size: 30rpx;">¥</text> <input v-model="form.wednesdayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="priceBoxWeek">
  92. <view class="weekendBox">
  93. <view >
  94. <text style="font-size: 30rpx; margin-right: 90rpx; " >周四</text>
  95. </view>
  96. <view style="display: flex;">
  97. <text style="font-size: 30rpx;">¥</text> <input v-model="form.thursdayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="priceBoxWeek">
  102. <view class="weekendBox">
  103. <view >
  104. <text style="font-size: 30rpx; margin-right: 90rpx; " >周五</text>
  105. </view>
  106. <view style="display: flex;">
  107. <text style="font-size: 30rpx;">¥</text> <input v-model="form.fridayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="priceBoxWeek">
  112. <view class="weekendBox">
  113. <view >
  114. <text style="font-size: 30rpx; margin-right: 90rpx; " >周六</text>
  115. </view>
  116. <view style="display: flex;">
  117. <text style="font-size: 30rpx;">¥</text> <input v-model="form.saturdayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;"/>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="priceBoxWeek">
  122. <view class="weekendBox" style=" border-bottom: 1rpx solid #fff;">
  123. <view style="margin-top: 10rpx;">
  124. <text style="font-size: 30rpx; margin-right: 90rpx; " >周日</text>
  125. </view>
  126. <view style="display: flex; margin-top: 10rpx;">
  127. <text style="font-size: 30rpx;">¥</text> <input v-model="form.sundayPrice" type="text" placeholder="请输入价格" style="width: 210rpx;height: 42rpx; font-size: 30rpx;
  128. "/>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 房间列表 -->
  134. <view class="everyHouseList" style="padding-top: 20rpx;">
  135. <view class="HouseListTitleInfo" >
  136. <text style="font-size: 32rpx; font-weight: 700;">房间列表</text>
  137. <text style="font-size: 24rpx; color: #777;">共8个房间</text>
  138. </view>
  139. <!-- 房间号 -->
  140. <view class="priceBoxWeek" v-for="(room,index) in form.roomFloor" :key="index">
  141. <view class="weekendBox" style="display: flex; justify-content: space-between;">
  142. <view style="display: flex;">
  143. <text style="font-size: 30rpx;"> 楼层:</text><input style="width: 70rpx; margin-bottom: 5rpx; font-size: 28rpx;" v-model="room.floor" type="text" />
  144. </view>
  145. <view style="display: flex;">
  146. <text style="font-size: 30rpx;" > 房间号:</text><input style="width: 70rpx; margin-bottom: 5rpx; font-size: 28rpx;" v-model="room.roomNumber" type="text" />
  147. </view>
  148. <view style="display: flex; margin-top: 10rpx;" @click="delRoom(index)">
  149. <u-icon name="trash"></u-icon>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="submit" @click="addRoom">
  155. <u-icon name="plus-circle" color=" #1372FF"></u-icon>
  156. <text style="color: #1372FF; font-size: 30rpx;">添加房间</text>
  157. </view>
  158. <!-- 确定添加按钮 -->
  159. <view class="addSubmit" @click="addNewRoom">
  160. <text style="line-height: 96rpx; margin-left:310rpx; font-size: 32rpx; color: #fff;">确定</text>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. export default{
  167. data(){
  168. return{
  169. weekedChecked:false,
  170. action: 'https://i.ringzle.com/island-cloud-server',//图片服务器地址
  171. fileList: [
  172. {
  173. url: '',
  174. }
  175. ],
  176. id:'',//houseBaseId
  177. checked:true,
  178. form:{
  179. isPutAway:'',
  180. homestayId:'',
  181. mondayPrice:'',
  182. tuesdayPrice:'',
  183. wednesdayPrice:'',
  184. thursdayPrice:'',
  185. fridayPrice:'',
  186. saturdayPrice:'',
  187. sundayPrice:'',
  188. name:'',
  189. shortName:'',
  190. roomFloor:[
  191. { floor:'',
  192. roomNumber:''}
  193. ]
  194. },
  195. }
  196. },
  197. onLoad({id,houseBaseId}){
  198. this.form.homestayId=id
  199. // console.log(houseBaseId)
  200. this.id=houseBaseId
  201. // console.log(this.id)
  202. this.getTypeInfo()
  203. },
  204. computed:{
  205. },
  206. methods:{
  207. change(status) {
  208. console.log(status);
  209. },
  210. // 添加&编辑房屋
  211. addNewRoom(){
  212. if(this.checked===true){
  213. this.form.isPutAway=1
  214. }else{
  215. this.form.isPutAway=0
  216. }
  217. // console.log(this.form)
  218. if(!this.id){
  219. this.$api.post('/merchant/hotel/mine/addHouseBase',this.form).then(res=>{
  220. // console.log(res)
  221. if(res.data.code===0){
  222. this.$showToast('添加成功');
  223. setTimeout(()=>{
  224. uni.reLaunch({
  225. url:'/pages/my/roomType'
  226. })
  227. },1500)
  228. }
  229. })
  230. console.log('这是')
  231. }else{
  232. // console.log('这是修改')
  233. // if(this.)
  234. this.$api.put('/merchant/hotel/mine/updHouseBase',this.form).then(res=>{
  235. // console.log('修改成功')
  236. if(res.data.code===0){
  237. this.$showToast('添加成功')
  238. setTimeout(()=>{
  239. uni.reLaunch({
  240. url:'/pages/my/roomType'
  241. })
  242. },1500)
  243. }
  244. })
  245. }
  246. },
  247. // 添加房间
  248. addRoom(){
  249. const newRoom = {floor:'',roomNumber:''}
  250. this.form.roomFloor.push(newRoom)
  251. },
  252. // 删除房间
  253. delRoom(index){
  254. this.form.roomFloor.splice(index,1)
  255. },
  256. // 获取当前房型信息
  257. getTypeInfo(){
  258. if(this.id){
  259. this.$api.get(`/merchant/hotel/mine/getHouseBaseInfo/${this.id}`).then((res)=>{
  260. // console.log(res)
  261. if(res.data.code===0){
  262. this.form=res.data.data
  263. }
  264. })
  265. }else{
  266. return
  267. }
  268. }
  269. }
  270. }
  271. </script>
  272. <style lang="scss">
  273. .page {
  274. background: #F3F4F4;
  275. padding-bottom: 260rpx;
  276. box-sizing: border-box;
  277. overflow-y: auto;
  278. overflow-x: auto;
  279. }
  280. .body {
  281. padding-top: 20rpx;
  282. padding-left: 30rpx;
  283. padding-right: 30rpx;
  284. }
  285. .typeInfo{
  286. background-color: #fff;
  287. width: 650rpx;
  288. height: 290rpx;
  289. border-radius: 10rpx;
  290. padding-top: 30rpx;
  291. padding-left: 15rpx;
  292. padding-right: 30rpx;
  293. }
  294. .titleInfo{
  295. // margin-top: 30rpx;
  296. margin-left: 20rpx;
  297. margin-bottom: 40rpx;
  298. }
  299. .cellBox{
  300. margin-left: 20rpx;
  301. display: flex;
  302. padding-bottom: 40rpx;
  303. border-bottom: 1rpx solid #E1E1E1;
  304. }
  305. .bigRoom{
  306. margin-left: 20rpx;
  307. width: 100%;
  308. height: 102rpx;
  309. display: flex;
  310. // justify-content: center;
  311. align-items: center;
  312. }
  313. .shelves{
  314. width: 695rpx;
  315. height: 102rpx;
  316. background-color: #fff;
  317. margin-top: 20rpx;
  318. border-radius: 10rpx;
  319. display: flex;
  320. justify-content: space-between;
  321. align-items: center;
  322. // padding-left: 30rpx;
  323. // padding-right: 30rpx;
  324. }
  325. .uploadPic{
  326. padding-top: 28rpx;
  327. width: 690rpx;
  328. height: 293rpx;
  329. background-color: #fff;
  330. border-radius: 10rpx;
  331. margin-top: 20rpx;
  332. }
  333. .pic{
  334. margin-left: 30rpx;
  335. margin-top: 20rpx;
  336. width: 190rpx;
  337. height: 120rpx;
  338. // background-color: pink;
  339. }
  340. // .custom-upload-button{
  341. // width: 190rpx;
  342. // height: 120rpx;
  343. // }
  344. .priceInfo{
  345. width: 690rpx;
  346. height: 908rpx;
  347. background-color: #fff;
  348. border-radius: 10rpx;
  349. margin-top: 20rpx;
  350. padding-top: 30rpx;
  351. }
  352. .week{
  353. padding-left: 30rpx;
  354. padding-right: 30rpx;
  355. margin-bottom: 20rpx;
  356. }
  357. .weekend{
  358. display: flex;
  359. justify-content: space-between;
  360. border-bottom: 1rpx solid #E1E1E1;
  361. padding-bottom: 30rpx;
  362. }
  363. .everyDay{
  364. padding-left: 30rpx;
  365. padding-right: 30rpx;
  366. width: 100%;
  367. // background-color: pink;
  368. height: 102rpx;
  369. display: flex;
  370. align-items: center;
  371. }
  372. .days{
  373. display: flex;
  374. align-items: center;
  375. border-bottom: 1rpx solid #E1E1E1;
  376. padding-bottom: 30rpx;
  377. }
  378. .priceBoxWeek{
  379. display: flex;
  380. align-items: center;
  381. height: 102rpx;
  382. padding-left: 30rpx;
  383. padding-right: 30rpx;
  384. }
  385. .weekendBox{
  386. width: 630rpx;
  387. display: flex;
  388. margin-top: 20rpx;
  389. // margin-right: 90rpx;
  390. // justify-content: space-between;
  391. border-bottom: 1rpx solid #E1E1E1;
  392. padding-bottom: 32rpx;
  393. }
  394. .everyHouseList{
  395. // padding-right: 30rpx;
  396. width: 690rpx;
  397. // height: 908rpx;
  398. background-color: #fff;
  399. border-radius: 10rpx;
  400. margin-top: 20rpx;
  401. // padding-top: 30rpx;
  402. }
  403. .HouseListTitleInfo{
  404. margin-right: 30rpx;
  405. margin-left: 20rpx;
  406. margin-bottom: 40rpx;
  407. display: flex;
  408. justify-content: space-between;
  409. }
  410. .submit{
  411. margin-top: 20rpx;
  412. border-radius: 10rpx;
  413. width: 690rpx;
  414. height: 102rpx;
  415. background-color: #fff;
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. }
  420. .addSubmit{
  421. position: fixed; /* 固定定位 */
  422. bottom: 20rpx; /* 底部对齐 */
  423. left: 0; /* 可选:左对齐 */
  424. width: 690rpx; /* 可选:宽度为 100% */
  425. height: 96rpx;
  426. margin-left: 30rpx;
  427. // padding-top: 20rpx;
  428. margin-top: 30rpx;
  429. background-color: #1372FF;
  430. border-radius: 48rpx;
  431. }
  432. .uploadPicPic{
  433. position: relative;
  434. top: -96rpx;
  435. }
  436. .u-upload__deletable[data-v-69e2a36e] {
  437. width: 0 !important;
  438. }
  439. </style>