roomType.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  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" iconSize="24" placement="row" activeColor='#1372FF'>
  89. <u-radio labelSize='30' label="固定设置" :name='1'></u-radio>
  90. <u-radio labelSize='30' label="按天设置" :name='2' v-if="tabIndex==0"></u-radio>
  91. </u-radio-group>
  92. </view>
  93. <view class="hander-three">
  94. <view class="hander-three-text">
  95. 起始日期
  96. </view>
  97. <view class="hander-three-input" @click="showTimeOne">
  98. <u--input placeholder="请选择" border="none" disabledColor='#fff' fontSize='26'
  99. v-model="valueTimeOne" disabled='false'></u--input>
  100. </view>
  101. <view class="hander-three-icon">
  102. <u-icon name="arrow-right"></u-icon>
  103. </view>
  104. </view>
  105. <view class="hander-three" style="margin-top:30rpx ;">
  106. <view class="hander-three-text">
  107. 结束日期
  108. </view>
  109. <view class="hander-three-input" @click="showTimeTwo">
  110. <u--input placeholder="请选择" border="none" disabledColor='#fff' fontSize='26'
  111. v-model="valueTimeTwo" disabled='false'></u--input>
  112. </view>
  113. <view class="hander-three-icon">
  114. <u-icon name="arrow-right"></u-icon>
  115. </view>
  116. </view>
  117. <view class="hander-four" v-if="typeIndex==1">
  118. <view class="hander-three-text" style="">
  119. <view class="">
  120. 价格
  121. </view>
  122. <view class="">
  123. </view>
  124. </view>
  125. <view class="hander-three-input">
  126. <u--input placeholder="请输入价格" fontSize='26' border="none" v-model="fromData.price"
  127. @change="change"></u--input>
  128. </view>
  129. <view class="hander-three-icon" @click="delPrice">
  130. <u-icon name="close-circle-fill"></u-icon>
  131. </view>
  132. </view>
  133. <view class="" v-else>
  134. <view class="hander-four">
  135. <view class="hander-three-text" style="">
  136. <view class="">
  137. 周五-周六
  138. </view>
  139. <view class="">
  140. </view>
  141. </view>
  142. <view class="hander-three-input">
  143. <u--input placeholder="请输入价格" fontSize='26' border="none"
  144. v-model="fromData.friToSatdayPrice" @change="change"></u--input>
  145. </view>
  146. <view class="hander-three-icon">
  147. <u-icon name="close-circle-fill"></u-icon>
  148. </view>
  149. </view>
  150. <view class="hander-four">
  151. <view class="hander-three-text" style="">
  152. <view class="">
  153. 周日-周四
  154. </view>
  155. <view class="">
  156. </view>
  157. </view>
  158. <view class="hander-three-input">
  159. <u--input placeholder="请输入价格" fontSize='26' border="none"
  160. v-model="fromData.sunToThursdayPrice" @change="change"></u--input>
  161. </view>
  162. <view class="hander-three-icon">
  163. <u-icon name="close-circle-fill"></u-icon>
  164. </view>
  165. </view>
  166. </view>
  167. <view class="btn-btn" @click='addTime()'>
  168. <view class="btn">
  169. 确定
  170. </view>
  171. </view>
  172. </view>
  173. </u-popup>
  174. <!-- <u-calendar :show="show" :mode="mode" @confirm="confirm"></u-calendar> -->
  175. <!-- 选择入驻时间 -->
  176. <u-calendar class="u-time" confirmDisabledText="确定" :show="showOne" :mode="mode" @confirm="confirmOne"
  177. @close="closeDate" :closeOnClickOverlay="true"></u-calendar>
  178. <u-calendar class="u-time" confirmDisabledText="确定" :show="showTwo" :mode="mode" @confirm="confirmTwo"
  179. @close="closeDate" :closeOnClickOverlay="true"></u-calendar>
  180. </view>
  181. </template>
  182. <script>
  183. export default {
  184. data() {
  185. return {
  186. homestayId: uni.getStorageSync('homestayId') || 0,
  187. roomType: [],
  188. isSelect: false,
  189. Selected: false,
  190. showPricing: false,
  191. showOne: false,
  192. showTwo: false,
  193. selectedTags: [],
  194. ids: [],
  195. from: {},
  196. tabIndex: 0,
  197. typeIndex: 1,
  198. mode: '',
  199. valueTimeOne: '',
  200. valueTimeTwo: '',
  201. labelName: 0,
  202. fromData: {
  203. homestayId: '',
  204. houseBaseIdList: [],
  205. friToSatdayPrice: '',
  206. sunToThursdayPrice: '',
  207. price: '',
  208. rentDateEnd: '',
  209. rentDateStart: '',
  210. }
  211. }
  212. },
  213. onLoad() {
  214. // console.log(this.homestayId)
  215. this.getHomestayId()
  216. },
  217. methods: {
  218. delPrice() {
  219. this.fromData.price = ''
  220. },
  221. showTimeOne() {
  222. this.showOne = true
  223. // if (this.typeIndex == 1) {
  224. this.mode = 'single'
  225. // this.valueTimeOne = ''
  226. // this.valueTimeTwo = ''
  227. // this.fromData.price = ''
  228. // } else if (this.typeIndex == 2) {
  229. // this.mode = 'single'
  230. // this.valueTimeOne = ''
  231. // this.valueTimeTwo = ''
  232. // }
  233. },
  234. showTimeTwo() {
  235. this.showTwo = true
  236. // if (this.typeIndex == 1) {
  237. this.mode = 'single'
  238. // this.valueTimeOne = ''
  239. // this.valueTimeTwo = ''
  240. // this.fromData.price = ''
  241. // } else if (this.typeIndex == 2) {
  242. // this.mode = 'range'
  243. // this.valueTimeOne = ''
  244. // this.valueTimeTwo = ''
  245. // }
  246. },
  247. addTime() {
  248. this.fromData.homestayId = uni.getStorageSync('homestayId')
  249. this.$api.post('/merchant/hotel/room/state/batchDefineRoomPrice', this.fromData).then(res => {
  250. console.log(res.data);
  251. if (res.data.code == 0) {
  252. this.$showToast('定价成功')
  253. setTimeout(() => {
  254. this.showPricing = false
  255. this.fromData = {}
  256. this.getHomestayId()
  257. this.valueTimeOne = ''
  258. this.valueTimeTwo = ''
  259. this.labelName = '0'
  260. this.Selected = false
  261. this.selectedTags = []
  262. }, 1000)
  263. } else this.$showToast(res.data.msg)
  264. })
  265. },
  266. confirmOne(e) {
  267. console.log('1111', e);
  268. this.showOne = false
  269. if (this.typeIndex == 1) {
  270. this.valueTimeOne = e[0]
  271. console.log(this.valueTimeOne);
  272. } else if (this.typeIndex == 2) {
  273. this.valueTimeOne = e[0]
  274. console.log(this.valueTimeOne);
  275. }
  276. this.fromData.rentDateStart = e[0]
  277. },
  278. confirmTwo(e) {
  279. console.log('22222', e);
  280. this.showTwo = false
  281. if (this.typeIndex == 1) {
  282. this.valueTimeTwo = e[0]
  283. console.log(this.valueTimeTwo);
  284. } else if (this.typeIndex == 2) {
  285. this.valueTimeTwo = e[0]
  286. console.log(this.valueTimeTwo);
  287. }
  288. this.fromData.rentDateEnd = e[0]
  289. },
  290. closeDate() {
  291. this.showOne = false
  292. this.showTwo = false
  293. },
  294. selectType(type) {
  295. console.log(type);
  296. this.typeIndex = type;
  297. },
  298. // 下架
  299. piliangxiajia() {
  300. let obj = {
  301. isPutaway: 0,
  302. idList: this.fromData.houseBaseIdList
  303. }
  304. console.log(this.selectedTags);
  305. this.$api.post('/merchant/hotel/room/state/updPutawayState', obj).then(res => {
  306. if (res.data.code == 0) {
  307. this.$showToast('下架成功')
  308. setTimeout(() => {
  309. this.showPricing = false
  310. this.getHomestayId()
  311. this.Selected = false
  312. this.selectedTags = []
  313. this.fromData.houseBaseIdList = []
  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. this.fromData.houseBaseIdList = []
  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. .u-calendar scroll-view {
  397. height: 600rpx !important;
  398. }
  399. .uicon-close {
  400. font-size: 35rpx !important;
  401. z-index: 99999 !important;
  402. }
  403. .u-popup__content__close--top-right {
  404. width: 40rpx !important;
  405. height: 40rpx !important;
  406. z-index: 99999 !important;
  407. }
  408. .u-popup__content {
  409. z-index: 99999 !important;
  410. }
  411. .u-radio__text {
  412. margin-right: 35rpx !important;
  413. }
  414. .u-reset-button,
  415. .u-button--active {
  416. width: 100% !important;
  417. }
  418. // .data-v-b73440ae {
  419. // height: 500rpx !important;
  420. // }
  421. // .u-slide-up-enter-active {
  422. // height: 55vh !important;
  423. // }
  424. .u-time {
  425. height: 75vh !important;
  426. }
  427. .u-calendar-month__days__day {
  428. height: 130rpx !important;
  429. }
  430. .u-square {
  431. background-color: #fff !important;
  432. }
  433. .u-input__content {
  434. margin-top: 22rpx !important;
  435. }
  436. .uicon-arrow-right,
  437. .uicon-close-circle-fill {
  438. margin-top: 32rpx !important;
  439. margin-right: 20rpx !important;
  440. }
  441. .pop-pop {
  442. height: 800rpx;
  443. overflow: auto;
  444. box-sizing: border-box;
  445. padding-bottom: 200rpx;
  446. .hander-one {
  447. padding: 46rpx 20rpx 0;
  448. display: flex;
  449. justify-content: space-between;
  450. .text {
  451. font-size: 36rpx;
  452. color: #333333;
  453. font-weight: bold;
  454. }
  455. .del {}
  456. }
  457. .hander-two {
  458. padding: 0 20rpx;
  459. display: flex;
  460. align-items: center;
  461. margin: 30rpx 0;
  462. .hander-two-text {
  463. font-size: 30rpx;
  464. color: #333333;
  465. font-weight: Regular;
  466. margin-right: 30rpx;
  467. }
  468. .hander-two-image {
  469. display: flex;
  470. align-items: center;
  471. .image {
  472. margin: 0 10rpx;
  473. width: 30rpx;
  474. height: 30rpx;
  475. image {
  476. width: 100%;
  477. height: 100%;
  478. }
  479. }
  480. }
  481. }
  482. .hander-three {
  483. padding: 0 20rpx;
  484. margin: 0 20rpx;
  485. display: flex;
  486. border: 1rpx solid #CCCCCC;
  487. border-radius: 16rpx;
  488. justify-content: space-between;
  489. height: 102rpx;
  490. line-height: 102rpx;
  491. .hander-three-text {
  492. width: 200rpx;
  493. text-align: left;
  494. display: flex;
  495. justify-content: space-between;
  496. margin: 0 20rpx;
  497. }
  498. .hander-three-input {
  499. width: 55%;
  500. }
  501. .hander-three-icon {
  502. height: 102rpx;
  503. line-height: 102rpx;
  504. }
  505. }
  506. .hander-four {
  507. padding: 0 20rpx;
  508. margin: 30rpx 20rpx 0;
  509. // margin-top: 30rpx;
  510. display: flex;
  511. border-radius: 16rpx;
  512. justify-content: space-between;
  513. border: 1rpx solid #CCCCCC;
  514. height: 102rpx;
  515. line-height: 102rpx;
  516. .hander-three-text {
  517. width: 200rpx;
  518. text-align: center;
  519. display: flex;
  520. justify-content: space-between;
  521. margin: 0 20rpx;
  522. }
  523. .hander-three-input {
  524. width: 55%;
  525. }
  526. .hander-three-icon {
  527. height: 102rpx;
  528. line-height: 102rpx;
  529. }
  530. }
  531. }
  532. .page {
  533. background: #F3F4F4;
  534. padding-bottom: 260rpx;
  535. box-sizing: border-box;
  536. overflow-y: auto;
  537. overflow-x: auto;
  538. }
  539. .typeNum {
  540. // width: 100%;
  541. height: 73rpx;
  542. display: flex;
  543. justify-content: space-between;
  544. padding: 23rpx 24rpx;
  545. align-items: center;
  546. // .left {}
  547. .right {
  548. display: flex;
  549. align-items: center;
  550. .image {
  551. margin: 0 10rpx;
  552. width: 30rpx;
  553. height: 30rpx;
  554. image {
  555. width: 100%;
  556. height: 100%;
  557. }
  558. }
  559. .text {
  560. font-size: 28rpx;
  561. font-weight: Regular;
  562. color: #333333;
  563. }
  564. }
  565. }
  566. .type {
  567. margin: 0 auto;
  568. border-radius: 10rpx 10rpx 10rpx 10rpx;
  569. width: 86%;
  570. // height: 114rpx;
  571. background-color: #fff;
  572. padding: 30rpx;
  573. margin-bottom: 20rpx;
  574. display: flex;
  575. .left {
  576. height: 114rpx;
  577. line-height: 114rpx;
  578. margin-right: 20rpx;
  579. .image {
  580. margin: 0 10rpx;
  581. width: 40rpx;
  582. height: 40rpx;
  583. image {
  584. width: 100%;
  585. height: 100%;
  586. }
  587. }
  588. }
  589. .right {
  590. width: 100%;
  591. }
  592. }
  593. .top {
  594. display: flex;
  595. justify-content: space-between;
  596. }
  597. .under {
  598. margin-top: 40rpx;
  599. display: flex;
  600. justify-content: space-between;
  601. }
  602. .btn-btn {
  603. width: 100%;
  604. height: 136rpx;
  605. background-color: #fff;
  606. position: fixed;
  607. bottom: 0;
  608. padding: 30rpx 0 0;
  609. // margin: 0 auto;
  610. z-index: 9;
  611. // margin-top: 30rpx;
  612. // margin-left: 30rpx;
  613. .bottom-btn {
  614. display: flex;
  615. justify-content: space-between;
  616. margin: 0 24rpx;
  617. .left {
  618. width: 25%;
  619. display: flex;
  620. align-items: center;
  621. .image {
  622. width: 40rpx;
  623. height: 40rpx;
  624. margin: 0 10rpx;
  625. image {
  626. width: 100%;
  627. height: 100%;
  628. }
  629. }
  630. }
  631. .right {
  632. width: 75%;
  633. display: flex;
  634. justify-content: space-evenly;
  635. .right-btn {
  636. margin: 0 20rpx;
  637. // width: 148rpx;
  638. width: 100%;
  639. height: 80rpx;
  640. line-height: 80rpx;
  641. background-color: #1372FF;
  642. border-radius: 16rpx;
  643. font-size: 26rpx;
  644. color: #fff;
  645. font-weight: Regular;
  646. text-align: center;
  647. }
  648. }
  649. }
  650. }
  651. .btn {
  652. margin: 0 auto;
  653. width: 690rpx;
  654. height: 96rpx;
  655. background-color: #1372FF;
  656. color: #fff;
  657. display: flex;
  658. justify-content: center;
  659. align-items: center;
  660. font-size: 34rpx;
  661. border-radius: 48rpx;
  662. }
  663. </style>