roomType.vue 16 KB

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