roomType.vue 16 KB

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