houseList.vue 12 KB

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