roomType.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. <template>
  2. <view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="房型列表" :showIcon="true"></c-nav-bar>
  4. <!-- 房型数量 -->
  5. <view class="typeNum">
  6. <view class="left" style="font-size: 24rpx; color: #777;">
  7. 共{{roomType.length}}个房型
  8. </view>
  9. <view class="right" @click="showList">
  10. <view class="image">
  11. <image src="https://fsy.shengsi.gov.cn/file/20240619/0a897090737641b5b4111899617a8085.png" mode="">
  12. </image>
  13. </view>
  14. <view class="text">
  15. 批量定价
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 房型选择 -->
  20. <view class="type" v-for="item,index in roomType" :key="item.houseBaseId">
  21. <view class="left" v-if="Selected==true" @tap="selectPerson(item,index)">
  22. <view class="image">
  23. <image
  24. :src="selectedTags.includes(item)?'https://fsy.shengsi.gov.cn/file/20240619/ab6bcbe73e114802a93baa7c40c7ac97.png':'https://fsy.shengsi.gov.cn/file/20240619/bf140a7159e249e7bf47be677a5d9585.png'">
  25. </image>
  26. </view>
  27. </view>
  28. <view class="right" @click="goEditTypeInfo(item.houseBaseId)">
  29. <view class="top">
  30. <view style="font-size: 30rpx; color: #333;">{{item.name}}( {{item.isPutaway==1?'已上架':'已下架'}})
  31. </view>
  32. <u-icon name="arrow-right"></u-icon>
  33. </view>
  34. <view class="under">
  35. <text style="font-size: 24rpx; color: #777;">{{item.shortName}}</text>
  36. <text style="font-size: 24rpx; color: #777;">{{item.roomCount}}间</text>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 批量按钮 -->
  41. <view class="btn-btn" v-if="Selected==true">
  42. <view class="bottom-btn">
  43. <view class="left">
  44. <view class="image">
  45. <image
  46. :src="selectedTags.length>0?'https://fsy.shengsi.gov.cn/file/20240619/ab6bcbe73e114802a93baa7c40c7ac97.png':'https://fsy.shengsi.gov.cn/file/20240619/bf140a7159e249e7bf47be677a5d9585.png'">
  47. </image>
  48. </view>
  49. <view class="text">
  50. 已选:{{selectedTags.length}}
  51. </view>
  52. </view>
  53. <view class="right">
  54. <view class="right-btn" @click="piliangshangjia()">
  55. 批量上架
  56. </view>
  57. <view class="right-btn" @click="piliangxiajia()">
  58. 批量下架
  59. </view>
  60. <view class="right-btn" @click="Pricing()">
  61. 批量定价
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 新增按钮 -->
  67. <view class="btn-btn" @click="addType(id)" v-else>
  68. <view class="btn">
  69. 新增
  70. </view>
  71. </view>
  72. <u-popup :show="showPricing" @close="close" @open="open">
  73. <view class="pop-pop">
  74. <view class="hander-one">
  75. <view class="">
  76. </view>
  77. <view class="text">
  78. 批量定价
  79. </view>
  80. <view class="del" @click="close">
  81. <u-icon name="close" color=""></u-icon>
  82. </view>
  83. </view>
  84. <view class="hander-two">
  85. <view class="hander-two-text">
  86. 每天价格
  87. </view>
  88. <u-radio-group @change="selectType" size="32" v-model="typeIndex" iconSize="24" placement="row"
  89. activeColor='#1372FF'>
  90. <u-radio labelSize='30' label="固定设置" :name='1'></u-radio>
  91. <u-radio labelSize='30' label="按天设置" :name='2' v-if="tabIndex==0"></u-radio>
  92. </u-radio-group>
  93. </view>
  94. <view class="hander-three">
  95. <view class="hander-three-text">
  96. 起始日期
  97. </view>
  98. <view class="hander-three-input" @click="showTimeOne">
  99. <u--input placeholder="请选择" border="none" disabledColor='#fff' fontSize='26'
  100. v-model="valueTimeOne" disabled='false'></u--input>
  101. </view>
  102. <view class="hander-three-icon">
  103. <u-icon name="arrow-right"></u-icon>
  104. </view>
  105. </view>
  106. <view class="hander-three" style="margin-top:30rpx ;">
  107. <view class="hander-three-text">
  108. 结束日期
  109. </view>
  110. <view class="hander-three-input" @click="showTimeTwo">
  111. <u--input placeholder="请选择" border="none" disabledColor='#fff' fontSize='26'
  112. v-model="valueTimeTwo" disabled='false'></u--input>
  113. </view>
  114. <view class="hander-three-icon">
  115. <u-icon name="arrow-right"></u-icon>
  116. </view>
  117. </view>
  118. <view class="hander-four" v-if="typeIndex==1">
  119. <view class="hander-three-text" style="">
  120. <view class="">
  121. 价格
  122. </view>
  123. <view class="">
  124. </view>
  125. </view>
  126. <view class="hander-three-input">
  127. <u--input placeholder="请输入价格" fontSize='26' border="none" v-model="fromData.price"
  128. @change="change"></u--input>
  129. </view>
  130. <view class="hander-three-icon" @click="delPrice">
  131. <u-icon name="close-circle-fill"></u-icon>
  132. </view>
  133. </view>
  134. <view class="" v-else>
  135. <view class="hander-four">
  136. <view class="hander-three-text" style="">
  137. <view class="">
  138. 周五-周六
  139. </view>
  140. <view class="">
  141. </view>
  142. </view>
  143. <view class="hander-three-input">
  144. <u--input placeholder="请输入价格" fontSize='26' border="none"
  145. v-model="fromData.friToSatdayPrice" @change="change"></u--input>
  146. </view>
  147. <view class="hander-three-icon">
  148. <u-icon name="close-circle-fill"></u-icon>
  149. </view>
  150. </view>
  151. <view class="hander-four">
  152. <view class="hander-three-text" style="">
  153. <view class="">
  154. 周日-周四
  155. </view>
  156. <view class="">
  157. </view>
  158. </view>
  159. <view class="hander-three-input">
  160. <u--input placeholder="请输入价格" fontSize='26' border="none"
  161. v-model="fromData.sunToThursdayPrice" @change="change"></u--input>
  162. </view>
  163. <view class="hander-three-icon">
  164. <u-icon name="close-circle-fill"></u-icon>
  165. </view>
  166. </view>
  167. </view>
  168. <view class="btn-btn" @click='addTime()'>
  169. <view class="btn">
  170. 确定
  171. </view>
  172. </view>
  173. </view>
  174. </u-popup>
  175. <!-- <u-calendar :show="show" :mode="mode" @confirm="confirm"></u-calendar> -->
  176. <!-- 选择入驻时间 -->
  177. <u-calendar class="u-time" confirmDisabledText="确定" :show="showOne" :mode="mode" @confirm="confirmOne"
  178. @close="closeDate" :closeOnClickOverlay="true"></u-calendar>
  179. <u-calendar class="u-time" confirmDisabledText="确定" :show="showTwo" :mode="mode" @confirm="confirmTwo"
  180. @close="closeDate" :closeOnClickOverlay="true"></u-calendar>
  181. </view>
  182. </template>
  183. <script>
  184. export default {
  185. data() {
  186. return {
  187. homestayId: uni.getStorageSync('homestayId') || 0,
  188. roomType: [],
  189. isSelect: false,
  190. Selected: false,
  191. showPricing: false,
  192. showOne: false,
  193. showTwo: false,
  194. selectedTags: [],
  195. ids: [],
  196. from: {},
  197. tabIndex: 0,
  198. typeIndex: 1,
  199. mode: '',
  200. valueTimeOne: '',
  201. valueTimeTwo: '',
  202. labelName: 0,
  203. fromData: {
  204. homestayId: '',
  205. houseBaseIdList: [],
  206. friToSatdayPrice: '',
  207. sunToThursdayPrice: '',
  208. price: '',
  209. rentDateEnd: '',
  210. rentDateStart: '',
  211. }
  212. }
  213. },
  214. onLoad() {
  215. this.getHomestayId()
  216. },
  217. methods: {
  218. delPrice() {
  219. this.fromData.price = ''
  220. },
  221. showTimeOne() {
  222. this.showOne = true
  223. this.mode = 'single'
  224. },
  225. showTimeTwo() {
  226. this.showTwo = true
  227. this.mode = 'single'
  228. },
  229. addTime() {
  230. this.fromData.homestayId = uni.getStorageSync('homestayId')
  231. this.$api.post('/merchant/hotel/room/state/batchDefineRoomPrice', this.fromData).then(res => {
  232. if (res.data.code == 0) {
  233. this.$showToast('定价成功')
  234. setTimeout(() => {
  235. this.showPricing = false
  236. this.fromData = {}
  237. this.getHomestayId()
  238. this.valueTimeOne = ''
  239. this.valueTimeTwo = ''
  240. this.labelName = '0'
  241. this.Selected = false
  242. this.selectedTags = []
  243. }, 1000)
  244. } else this.$showToast(res.data.msg)
  245. })
  246. },
  247. confirmOne(e) {
  248. this.showOne = false
  249. if (this.typeIndex == 1) {
  250. this.valueTimeOne = e[0]
  251. } else if (this.typeIndex == 2) {
  252. this.valueTimeOne = e[0]
  253. }
  254. this.fromData.rentDateStart = e[0]
  255. },
  256. confirmTwo(e) {
  257. this.showTwo = false
  258. if (this.typeIndex == 1) {
  259. this.valueTimeTwo = e[0]
  260. } else if (this.typeIndex == 2) {
  261. this.valueTimeTwo = e[0]
  262. }
  263. this.fromData.rentDateEnd = e[0]
  264. },
  265. closeDate() {
  266. this.showOne = false
  267. this.showTwo = false
  268. },
  269. selectType(type) {
  270. this.typeIndex = type;
  271. },
  272. // 下架
  273. piliangxiajia() {
  274. if (this.fromData.houseBaseIdList.length != 0) {
  275. let obj = {
  276. isPutaway: 0,
  277. idList: this.fromData.houseBaseIdList
  278. }
  279. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  280. if (res.data.code == 0) {
  281. this.$showToast('下架成功')
  282. setTimeout(() => {
  283. this.showPricing = false
  284. this.getHomestayId()
  285. this.Selected = false
  286. this.selectedTags = []
  287. this.fromData.houseBaseIdList = []
  288. }, 1000)
  289. } else this.$showToast(res.data.msg)
  290. })
  291. } else this.$showToast('请选择房型')
  292. },
  293. // 上架
  294. piliangshangjia() {
  295. if (this.fromData.houseBaseIdList.length != 0) {
  296. let obj = {
  297. isPutaway: 1,
  298. idList: this.fromData.houseBaseIdList
  299. }
  300. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  301. if (res.data.code == 0) {
  302. this.$showToast('上架成功')
  303. setTimeout(() => {
  304. this.showPricing = false
  305. this.getHomestayId()
  306. this.Selected = false
  307. this.selectedTags = []
  308. this.fromData.houseBaseIdList = []
  309. }, 1000)
  310. } else this.$showToast(res.data.msg)
  311. })
  312. } else this.$showToast('请选择房型')
  313. },
  314. selectPerson(e, i) {
  315. if (this.selectedTags.includes(e)) {
  316. this.selectedTags = this.selectedTags.filter(t => t !== e);
  317. this.ids.splice(i, 1)
  318. } else {
  319. this.selectedTags.push(e);
  320. this.fromData.houseBaseIdList.push(e.houseBaseId)
  321. // this.from = {
  322. // idList: this.ids,
  323. // status: e.status == 1 ? 0 : 1
  324. // }
  325. }
  326. },
  327. close() {
  328. this.showPricing = false
  329. },
  330. open() {},
  331. Pricing() {
  332. if (this.fromData.houseBaseIdList.length != 0) {
  333. this.showPricing = true
  334. } else this.$showToast('请选择房型')
  335. },
  336. // 批量显示
  337. showList() {
  338. this.Selected = !this.Selected
  339. // this.selectedTags = []
  340. },
  341. // 获取房型列表信息
  342. getHomestayId() {
  343. this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`, {
  344. homestayId: this.homestayId
  345. }).then((res) => {
  346. this.roomType = res.data.data
  347. // let roomSymbleName=this.roomType.name
  348. })
  349. },
  350. // 新增房型
  351. addType(id) {
  352. uni.navigateTo({
  353. url: `/pages/my/houseList?id=${this.homestayId}`
  354. })
  355. },
  356. // 修改房型信息
  357. goEditTypeInfo(houseBaseId) {
  358. uni.navigateTo({
  359. url: `/pages/my/houseList?houseBaseId=${houseBaseId}`
  360. })
  361. }
  362. }
  363. }
  364. </script>
  365. <style lang="scss">
  366. .u-calendar scroll-view {
  367. height: 600rpx !important;
  368. }
  369. .uicon-close {
  370. font-size: 35rpx !important;
  371. z-index: 99999 !important;
  372. }
  373. .u-popup__content__close--top-right {
  374. width: 40rpx !important;
  375. height: 40rpx !important;
  376. z-index: 99999 !important;
  377. }
  378. .u-popup__content {
  379. z-index: 99999 !important;
  380. }
  381. .u-radio__text {
  382. margin-right: 35rpx !important;
  383. }
  384. .u-reset-button,
  385. .u-button--active {
  386. width: 100% !important;
  387. }
  388. // .data-v-b73440ae {
  389. // height: 500rpx !important;
  390. // }
  391. // .u-slide-up-enter-active {
  392. // height: 55vh !important;
  393. // }
  394. .u-time {
  395. height: 75vh !important;
  396. }
  397. .u-calendar-month__days__day {
  398. height: 130rpx !important;
  399. }
  400. .u-square {
  401. background-color: #fff !important;
  402. }
  403. .u-input__content {
  404. margin-top: 22rpx !important;
  405. }
  406. .uicon-arrow-right,
  407. .uicon-close-circle-fill {
  408. margin-top: 32rpx !important;
  409. margin-right: 20rpx !important;
  410. }
  411. .pop-pop {
  412. height: 800rpx;
  413. overflow: auto;
  414. box-sizing: border-box;
  415. padding-bottom: 200rpx;
  416. .hander-one {
  417. padding: 46rpx 20rpx 0;
  418. display: flex;
  419. justify-content: space-between;
  420. .text {
  421. font-size: 36rpx;
  422. color: #333333;
  423. font-weight: bold;
  424. }
  425. .del {}
  426. }
  427. .hander-two {
  428. padding: 0 20rpx;
  429. display: flex;
  430. align-items: center;
  431. margin: 30rpx 0;
  432. .hander-two-text {
  433. font-size: 30rpx;
  434. color: #333333;
  435. font-weight: Regular;
  436. margin-right: 30rpx;
  437. }
  438. .hander-two-image {
  439. display: flex;
  440. align-items: center;
  441. .image {
  442. margin: 0 10rpx;
  443. width: 30rpx;
  444. height: 30rpx;
  445. image {
  446. width: 100%;
  447. height: 100%;
  448. }
  449. }
  450. }
  451. }
  452. .hander-three {
  453. padding: 0 20rpx;
  454. margin: 0 20rpx;
  455. display: flex;
  456. border: 1rpx solid #CCCCCC;
  457. border-radius: 16rpx;
  458. justify-content: space-between;
  459. height: 102rpx;
  460. line-height: 102rpx;
  461. .hander-three-text {
  462. width: 200rpx;
  463. text-align: left;
  464. display: flex;
  465. justify-content: space-between;
  466. margin: 0 20rpx;
  467. }
  468. .hander-three-input {
  469. width: 55%;
  470. }
  471. .hander-three-icon {
  472. height: 102rpx;
  473. line-height: 102rpx;
  474. }
  475. }
  476. .hander-four {
  477. padding: 0 20rpx;
  478. margin: 30rpx 20rpx 0;
  479. // margin-top: 30rpx;
  480. display: flex;
  481. border-radius: 16rpx;
  482. justify-content: space-between;
  483. border: 1rpx solid #CCCCCC;
  484. height: 102rpx;
  485. line-height: 102rpx;
  486. .hander-three-text {
  487. width: 200rpx;
  488. text-align: center;
  489. display: flex;
  490. justify-content: space-between;
  491. margin: 0 20rpx;
  492. }
  493. .hander-three-input {
  494. width: 55%;
  495. }
  496. .hander-three-icon {
  497. height: 102rpx;
  498. line-height: 102rpx;
  499. }
  500. }
  501. }
  502. .page {
  503. background: #F3F4F4;
  504. padding-bottom: 260rpx;
  505. box-sizing: border-box;
  506. overflow-y: auto;
  507. overflow-x: auto;
  508. }
  509. .typeNum {
  510. // width: 100%;
  511. height: 73rpx;
  512. display: flex;
  513. justify-content: space-between;
  514. padding: 23rpx 24rpx;
  515. align-items: center;
  516. // .left {}
  517. .right {
  518. display: flex;
  519. align-items: center;
  520. .image {
  521. margin: 0 10rpx;
  522. width: 30rpx;
  523. height: 30rpx;
  524. image {
  525. width: 100%;
  526. height: 100%;
  527. }
  528. }
  529. .text {
  530. font-size: 28rpx;
  531. font-weight: Regular;
  532. color: #333333;
  533. }
  534. }
  535. }
  536. .type {
  537. margin: 0 auto;
  538. border-radius: 10rpx 10rpx 10rpx 10rpx;
  539. width: 86%;
  540. // height: 114rpx;
  541. background-color: #fff;
  542. padding: 30rpx;
  543. margin-bottom: 20rpx;
  544. display: flex;
  545. .left {
  546. height: 114rpx;
  547. line-height: 114rpx;
  548. margin-right: 20rpx;
  549. .image {
  550. margin: 0 10rpx;
  551. width: 40rpx;
  552. height: 40rpx;
  553. image {
  554. width: 100%;
  555. height: 100%;
  556. }
  557. }
  558. }
  559. .right {
  560. width: 100%;
  561. }
  562. }
  563. .top {
  564. display: flex;
  565. justify-content: space-between;
  566. }
  567. .under {
  568. margin-top: 40rpx;
  569. display: flex;
  570. justify-content: space-between;
  571. }
  572. .btn-btn {
  573. width: 100%;
  574. height: 136rpx;
  575. background-color: #fff;
  576. position: fixed;
  577. bottom: 0;
  578. padding: 30rpx 0 0;
  579. // margin: 0 auto;
  580. z-index: 9;
  581. // margin-top: 30rpx;
  582. // margin-left: 30rpx;
  583. .bottom-btn {
  584. display: flex;
  585. justify-content: space-between;
  586. margin: 0 24rpx;
  587. .left {
  588. width: 25%;
  589. display: flex;
  590. align-items: center;
  591. .image {
  592. width: 40rpx;
  593. height: 40rpx;
  594. margin: 0 10rpx;
  595. image {
  596. width: 100%;
  597. height: 100%;
  598. }
  599. }
  600. }
  601. .right {
  602. width: 75%;
  603. display: flex;
  604. justify-content: space-evenly;
  605. .right-btn {
  606. margin: 0 20rpx;
  607. // width: 148rpx;
  608. width: 100%;
  609. height: 80rpx;
  610. line-height: 80rpx;
  611. background-color: #1372FF;
  612. border-radius: 16rpx;
  613. font-size: 26rpx;
  614. color: #fff;
  615. font-weight: Regular;
  616. text-align: center;
  617. }
  618. }
  619. }
  620. }
  621. .btn {
  622. margin: 0 auto;
  623. width: 690rpx;
  624. height: 96rpx;
  625. background-color: #1372FF;
  626. color: #fff;
  627. display: flex;
  628. justify-content: center;
  629. align-items: center;
  630. font-size: 34rpx;
  631. border-radius: 48rpx;
  632. }
  633. </style>