roomType.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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. homestayId: '',
  242. houseBaseIdList: [],
  243. friToSatdayPrice: '',
  244. sunToThursdayPrice: '',
  245. price: '',
  246. rentDateEnd: '',
  247. rentDateStart: '',
  248. }
  249. this.getHomestayId()
  250. this.valueTimeOne = ''
  251. this.valueTimeTwo = ''
  252. this.labelName = '0'
  253. this.Selected = false
  254. this.selectedTags = []
  255. }, 1000)
  256. } else this.$showToast(res.data.msg)
  257. })
  258. },
  259. confirmOne(e) {
  260. this.showOne = false
  261. if (this.typeIndex == 1) {
  262. this.valueTimeOne = e[0]
  263. } else if (this.typeIndex == 2) {
  264. this.valueTimeOne = e[0]
  265. }
  266. this.fromData.rentDateStart = e[0]
  267. this.showTwo = true
  268. this.mode = 'single'
  269. },
  270. confirmTwo(e) {
  271. this.showTwo = false
  272. if (this.typeIndex == 1) {
  273. this.valueTimeTwo = e[0]
  274. } else if (this.typeIndex == 2) {
  275. this.valueTimeTwo = e[0]
  276. }
  277. this.fromData.rentDateEnd = e[0]
  278. },
  279. closeDate() {
  280. this.showOne = false
  281. this.showTwo = false
  282. },
  283. selectType(type) {
  284. this.typeIndex = type;
  285. },
  286. // 下架
  287. piliangxiajia() {
  288. if (this.fromData.houseBaseIdList.length != 0) {
  289. let obj = {
  290. isPutaway: 0,
  291. idList: this.fromData.houseBaseIdList
  292. }
  293. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  294. if (res.data.code == 0) {
  295. this.$showToast('下架成功')
  296. setTimeout(() => {
  297. this.showPricing = false
  298. this.getHomestayId()
  299. this.Selected = false
  300. this.selectedTags = []
  301. this.fromData.houseBaseIdList = []
  302. }, 1000)
  303. } else this.$showToast(res.data.msg)
  304. })
  305. } else this.$showToast('请选择房型')
  306. },
  307. // 上架
  308. piliangshangjia() {
  309. if (this.fromData.houseBaseIdList.length != 0) {
  310. let obj = {
  311. isPutaway: 1,
  312. idList: this.fromData.houseBaseIdList
  313. }
  314. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  315. if (res.data.code == 0) {
  316. this.$showToast('上架成功')
  317. setTimeout(() => {
  318. this.showPricing = false
  319. this.getHomestayId()
  320. this.Selected = false
  321. this.selectedTags = []
  322. this.fromData.houseBaseIdList = []
  323. }, 1000)
  324. } else this.$showToast(res.data.msg)
  325. })
  326. } else this.$showToast('请选择房型')
  327. },
  328. selectPerson(e, i) {
  329. if (!e || typeof e !== 'object') return;
  330. const index = this.selectedTags.findIndex(t => t === e);
  331. if (index > -1) {
  332. this.selectedTags = this.selectedTags.filter(t => t !== e);
  333. this.ids.splice(index, 1);
  334. if (e.houseBaseId) {
  335. const idIndex = this.fromData.houseBaseIdList.indexOf(e.houseBaseId);
  336. if (idIndex > -1) {
  337. this.fromData.houseBaseIdList.splice(idIndex, 1);
  338. }
  339. }
  340. } else {
  341. this.selectedTags = [...this.selectedTags, e];
  342. if (e.houseBaseId) {
  343. this.fromData.houseBaseIdList = [...this.fromData.houseBaseIdList, e.houseBaseId];
  344. }
  345. }
  346. },
  347. close() {
  348. this.showPricing = false
  349. },
  350. open() {},
  351. Pricing() {
  352. if (this.fromData.houseBaseIdList.length != 0) {
  353. this.showPricing = true
  354. } else this.$showToast('请选择房型')
  355. },
  356. // 批量显示
  357. showList() {
  358. this.Selected = !this.Selected
  359. // this.selectedTags = []
  360. },
  361. // 获取房型列表信息
  362. getHomestayId() {
  363. this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`, {
  364. homestayId: this.homestayId
  365. }).then((res) => {
  366. this.roomType = res.data.data
  367. // let roomSymbleName=this.roomType.name
  368. })
  369. },
  370. // 新增房型
  371. addType(id) {
  372. uni.navigateTo({
  373. url: `/pages/my/houseList?id=${this.homestayId}`
  374. })
  375. },
  376. // 修改房型信息
  377. goEditTypeInfo(houseBaseId) {
  378. uni.navigateTo({
  379. url: `/pages/my/houseList?houseBaseId=${houseBaseId}`
  380. })
  381. }
  382. }
  383. }
  384. </script>
  385. <style lang="scss">
  386. .u-calendar scroll-view {
  387. height: 600rpx !important;
  388. }
  389. .uicon-close {
  390. font-size: 35rpx !important;
  391. z-index: 99999 !important;
  392. }
  393. .u-popup__content__close--top-right {
  394. width: 40rpx !important;
  395. height: 40rpx !important;
  396. z-index: 99999 !important;
  397. }
  398. .u-popup__content {
  399. z-index: 99999 !important;
  400. }
  401. .u-radio__text {
  402. margin-right: 35rpx !important;
  403. }
  404. .u-reset-button,
  405. .u-button--active {
  406. width: 100% !important;
  407. }
  408. // .data-v-b73440ae {
  409. // height: 500rpx !important;
  410. // }
  411. // .u-slide-up-enter-active {
  412. // height: 55vh !important;
  413. // }
  414. .u-time {
  415. height: 75vh !important;
  416. }
  417. .u-calendar-month__days__day {
  418. height: 130rpx !important;
  419. }
  420. .u-square {
  421. background-color: #fff !important;
  422. }
  423. .u-input__content {
  424. margin-top: 22rpx !important;
  425. }
  426. .uicon-arrow-right,
  427. .uicon-close-circle-fill {
  428. margin-top: 32rpx !important;
  429. margin-right: 20rpx !important;
  430. }
  431. .pop-pop {
  432. height: 800rpx;
  433. overflow: auto;
  434. box-sizing: border-box;
  435. padding-bottom: 200rpx;
  436. .hander-one {
  437. padding: 46rpx 20rpx 0;
  438. display: flex;
  439. justify-content: space-between;
  440. .text {
  441. font-size: 36rpx;
  442. color: #333333;
  443. font-weight: bold;
  444. }
  445. .del {}
  446. }
  447. .hander-two {
  448. padding: 0 20rpx;
  449. display: flex;
  450. align-items: center;
  451. margin: 30rpx 0;
  452. .hander-two-text {
  453. font-size: 30rpx;
  454. color: #333333;
  455. font-weight: Regular;
  456. margin-right: 30rpx;
  457. }
  458. .hander-two-image {
  459. display: flex;
  460. align-items: center;
  461. .image {
  462. margin: 0 10rpx;
  463. width: 30rpx;
  464. height: 30rpx;
  465. image {
  466. width: 100%;
  467. height: 100%;
  468. }
  469. }
  470. }
  471. }
  472. .hander-three {
  473. padding: 0 20rpx;
  474. margin: 0 20rpx;
  475. display: flex;
  476. border: 1rpx solid #CCCCCC;
  477. border-radius: 16rpx;
  478. justify-content: space-between;
  479. height: 102rpx;
  480. line-height: 102rpx;
  481. .hander-three-text {
  482. width: 200rpx;
  483. text-align: left;
  484. display: flex;
  485. justify-content: space-between;
  486. margin: 0 20rpx;
  487. }
  488. .hander-three-input {
  489. width: 55%;
  490. }
  491. .hander-three-icon {
  492. height: 102rpx;
  493. line-height: 102rpx;
  494. }
  495. }
  496. .hander-four {
  497. padding: 0 20rpx;
  498. margin: 30rpx 20rpx 0;
  499. // margin-top: 30rpx;
  500. display: flex;
  501. border-radius: 16rpx;
  502. justify-content: space-between;
  503. border: 1rpx solid #CCCCCC;
  504. height: 102rpx;
  505. line-height: 102rpx;
  506. .hander-three-text {
  507. width: 200rpx;
  508. text-align: center;
  509. display: flex;
  510. justify-content: space-between;
  511. margin: 0 20rpx;
  512. }
  513. .hander-three-input {
  514. width: 55%;
  515. }
  516. .hander-three-icon {
  517. height: 102rpx;
  518. line-height: 102rpx;
  519. }
  520. }
  521. }
  522. .page {
  523. background: #F3F4F4;
  524. padding-bottom: 260rpx;
  525. box-sizing: border-box;
  526. overflow-y: auto;
  527. overflow-x: auto;
  528. }
  529. .typeNum {
  530. // width: 100%;
  531. height: 73rpx;
  532. display: flex;
  533. justify-content: space-between;
  534. padding: 23rpx 24rpx;
  535. align-items: center;
  536. // .left {}
  537. .right {
  538. display: flex;
  539. align-items: center;
  540. .image {
  541. margin: 0 10rpx;
  542. width: 30rpx;
  543. height: 30rpx;
  544. image {
  545. width: 100%;
  546. height: 100%;
  547. }
  548. }
  549. .text {
  550. font-size: 28rpx;
  551. font-weight: Regular;
  552. color: #333333;
  553. }
  554. }
  555. }
  556. .type {
  557. margin: 0 auto;
  558. border-radius: 10rpx 10rpx 10rpx 10rpx;
  559. width: 86%;
  560. // height: 114rpx;
  561. background-color: #fff;
  562. padding: 30rpx;
  563. margin-bottom: 20rpx;
  564. display: flex;
  565. .left {
  566. height: 114rpx;
  567. line-height: 114rpx;
  568. margin-right: 20rpx;
  569. .image {
  570. margin: 0 10rpx;
  571. width: 40rpx;
  572. height: 40rpx;
  573. image {
  574. width: 100%;
  575. height: 100%;
  576. }
  577. }
  578. }
  579. .right {
  580. width: 100%;
  581. }
  582. }
  583. .top {
  584. display: flex;
  585. justify-content: space-between;
  586. }
  587. .under {
  588. margin-top: 40rpx;
  589. display: flex;
  590. justify-content: space-between;
  591. }
  592. // .xgfj {
  593. // width: 115rpx;
  594. // background: aqua;
  595. // height: 50rpx;
  596. // border-radius: 13rpx;
  597. // line-height: 50rpx;
  598. // padding: 0rpx 4rpx;
  599. // margin-top: 28rpx;
  600. // }
  601. .btn-btn {
  602. width: 100%;
  603. height: 136rpx;
  604. background-color: #fff;
  605. position: fixed;
  606. bottom: 0;
  607. padding: 30rpx 0 0;
  608. // margin: 0 auto;
  609. z-index: 9;
  610. // margin-top: 30rpx;
  611. // margin-left: 30rpx;
  612. .bottom-btn {
  613. display: flex;
  614. justify-content: space-between;
  615. margin: 0 24rpx;
  616. .left {
  617. width: 25%;
  618. display: flex;
  619. align-items: center;
  620. .image {
  621. width: 40rpx;
  622. height: 40rpx;
  623. margin: 0 10rpx;
  624. image {
  625. width: 100%;
  626. height: 100%;
  627. }
  628. }
  629. }
  630. .right {
  631. width: 75%;
  632. display: flex;
  633. justify-content: space-evenly;
  634. .right-btn {
  635. margin: 0 20rpx;
  636. // width: 148rpx;
  637. width: 100%;
  638. height: 80rpx;
  639. line-height: 80rpx;
  640. background-color: #1372FF;
  641. border-radius: 16rpx;
  642. font-size: 26rpx;
  643. color: #fff;
  644. font-weight: Regular;
  645. text-align: center;
  646. }
  647. }
  648. }
  649. }
  650. .btn {
  651. margin: 0 auto;
  652. width: 690rpx;
  653. height: 96rpx;
  654. background-color: #1372FF;
  655. color: #fff;
  656. display: flex;
  657. justify-content: center;
  658. align-items: center;
  659. font-size: 34rpx;
  660. border-radius: 48rpx;
  661. }
  662. </style>