roomType.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  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. }, 1000)
  316. } else this.$showToast(res.data.msg)
  317. })
  318. },
  319. // 上架
  320. piliangshangjia() {
  321. let obj = {
  322. isPutaway: 1,
  323. idList: this.fromData.houseBaseIdList
  324. }
  325. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  326. console.log(res);
  327. if (res.data.code == 0) {
  328. this.$showToast('上架成功')
  329. setTimeout(() => {
  330. this.showPricing = false
  331. this.getHomestayId()
  332. this.Selected = false
  333. this.selectedTags = []
  334. }, 1000)
  335. } else this.$showToast(res.data.msg)
  336. })
  337. },
  338. selectPerson(e, i) {
  339. console.log(e, i);
  340. if (this.selectedTags.includes(e)) {
  341. this.selectedTags = this.selectedTags.filter(t => t !== e);
  342. this.ids.splice(i, 1)
  343. console.log('1111');
  344. } else {
  345. console.log('2222');
  346. this.selectedTags.push(e);
  347. this.fromData.houseBaseIdList.push(e.houseBaseId)
  348. // this.from = {
  349. // idList: this.ids,
  350. // status: e.status == 1 ? 0 : 1
  351. // }
  352. }
  353. },
  354. close() {
  355. this.showPricing = false
  356. },
  357. open() {},
  358. Pricing() {
  359. console.log('11111111');
  360. this.showPricing = true
  361. },
  362. // 批量显示
  363. showList() {
  364. this.Selected = !this.Selected
  365. // this.selectedTags = []
  366. },
  367. // 获取房型列表信息
  368. getHomestayId() {
  369. this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`, {
  370. homestayId: this.homestayId
  371. }).then((res) => {
  372. // console.log(res)
  373. this.roomType = res.data.data
  374. // let roomSymbleName=this.roomType.name
  375. // console.log(roomSymbleName)
  376. // console.log(this.roomType)
  377. })
  378. },
  379. // 新增房型
  380. addType(id) {
  381. uni.navigateTo({
  382. url: `/pages/my/houseList?id=${this.homestayId}`
  383. })
  384. },
  385. // 修改房型信息
  386. goEditTypeInfo(houseBaseId) {
  387. uni.navigateTo({
  388. url: `/pages/my/houseList?houseBaseId=${houseBaseId}`
  389. })
  390. console.log(houseBaseId)
  391. }
  392. }
  393. }
  394. </script>
  395. <style lang="scss">
  396. .uicon-close {
  397. font-size: 35rpx !important;
  398. }
  399. .u-radio__text {
  400. margin-right: 35rpx !important;
  401. }
  402. .u-reset-button,
  403. .u-button--active {
  404. width: 100% !important;
  405. }
  406. .data-v-b73440ae {
  407. height: 500rpx !important;
  408. }
  409. .u-slide-up-enter-active {
  410. height: 55vh !important;
  411. }
  412. .u-time {
  413. height: 75vh !important;
  414. }
  415. .u-calendar-month__days__day {
  416. height: 130rpx !important;
  417. }
  418. .u-square {
  419. background-color: #fff !important;
  420. }
  421. .u-input__content {
  422. margin-top: 22rpx !important;
  423. }
  424. .uicon-arrow-right,
  425. .uicon-close-circle-fill {
  426. margin-top: 32rpx !important;
  427. margin-right: 20rpx !important;
  428. }
  429. .pop-pop {
  430. height: 65vh;
  431. .hander-one {
  432. padding: 46rpx 20rpx 0;
  433. display: flex;
  434. justify-content: space-between;
  435. .text {
  436. font-size: 36rpx;
  437. color: #333333;
  438. font-weight: bold;
  439. }
  440. .del {}
  441. }
  442. .hander-two {
  443. padding: 0 20rpx;
  444. display: flex;
  445. align-items: center;
  446. margin: 30rpx 0;
  447. .hander-two-text {
  448. font-size: 30rpx;
  449. color: #333333;
  450. font-weight: Regular;
  451. margin-right: 30rpx;
  452. }
  453. .hander-two-image {
  454. display: flex;
  455. align-items: center;
  456. .image {
  457. margin: 0 10rpx;
  458. width: 30rpx;
  459. height: 30rpx;
  460. image {
  461. width: 100%;
  462. height: 100%;
  463. }
  464. }
  465. }
  466. }
  467. .hander-three {
  468. padding: 0 20rpx;
  469. margin: 0 20rpx;
  470. display: flex;
  471. border: 1rpx solid #CCCCCC;
  472. border-radius: 16rpx;
  473. justify-content: space-between;
  474. height: 102rpx;
  475. line-height: 102rpx;
  476. .hander-three-text {
  477. width: 200rpx;
  478. text-align: left;
  479. display: flex;
  480. justify-content: space-between;
  481. margin: 0 20rpx;
  482. }
  483. .hander-three-input {
  484. width: 55%;
  485. }
  486. .hander-three-icon {
  487. height: 102rpx;
  488. line-height: 102rpx;
  489. }
  490. }
  491. .hander-four {
  492. padding: 0 20rpx;
  493. margin: 30rpx 20rpx 0;
  494. // margin-top: 30rpx;
  495. display: flex;
  496. border-radius: 16rpx;
  497. justify-content: space-between;
  498. border: 1rpx solid #CCCCCC;
  499. height: 102rpx;
  500. line-height: 102rpx;
  501. .hander-three-text {
  502. width: 200rpx;
  503. text-align: center;
  504. display: flex;
  505. justify-content: space-between;
  506. margin: 0 20rpx;
  507. }
  508. .hander-three-input {
  509. width: 55%;
  510. }
  511. .hander-three-icon {
  512. height: 102rpx;
  513. line-height: 102rpx;
  514. }
  515. }
  516. }
  517. .page {
  518. background: #F3F4F4;
  519. padding-bottom: 260rpx;
  520. box-sizing: border-box;
  521. overflow-y: auto;
  522. overflow-x: auto;
  523. }
  524. .typeNum {
  525. // width: 100%;
  526. height: 73rpx;
  527. display: flex;
  528. justify-content: space-between;
  529. padding: 23rpx 24rpx;
  530. align-items: center;
  531. // .left {}
  532. .right {
  533. display: flex;
  534. align-items: center;
  535. .image {
  536. margin: 0 10rpx;
  537. width: 30rpx;
  538. height: 30rpx;
  539. image {
  540. width: 100%;
  541. height: 100%;
  542. }
  543. }
  544. .text {
  545. font-size: 28rpx;
  546. font-weight: Regular;
  547. color: #333333;
  548. }
  549. }
  550. }
  551. .type {
  552. margin: 0 auto;
  553. border-radius: 10rpx 10rpx 10rpx 10rpx;
  554. width: 86%;
  555. // height: 114rpx;
  556. background-color: #fff;
  557. padding: 30rpx;
  558. margin-bottom: 20rpx;
  559. display: flex;
  560. .left {
  561. height: 114rpx;
  562. line-height: 114rpx;
  563. margin-right: 20rpx;
  564. .image {
  565. margin: 0 10rpx;
  566. width: 30rpx;
  567. height: 30rpx;
  568. image {
  569. width: 100%;
  570. height: 100%;
  571. }
  572. }
  573. }
  574. .right {
  575. width: 100%;
  576. }
  577. }
  578. .top {
  579. display: flex;
  580. justify-content: space-between;
  581. }
  582. .under {
  583. margin-top: 40rpx;
  584. display: flex;
  585. justify-content: space-between;
  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: 38rpx;
  608. height: 38rpx;
  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>