roomType.vue 16 KB

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