roomType.vue 16 KB

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