roomType.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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. .uicon-close {
  397. font-size: 35rpx !important;
  398. z-index: 99999 !important;
  399. }
  400. .u-popup__content__close--top-right {
  401. width: 40rpx !important;
  402. height: 40rpx !important;
  403. z-index: 99999 !important;
  404. }
  405. .u-popup__content {
  406. z-index: 99999 !important;
  407. }
  408. .u-radio__text {
  409. margin-right: 35rpx !important;
  410. }
  411. .u-reset-button,
  412. .u-button--active {
  413. width: 100% !important;
  414. }
  415. .data-v-b73440ae {
  416. height: 500rpx !important;
  417. }
  418. .u-slide-up-enter-active {
  419. height: 55vh !important;
  420. }
  421. .u-time {
  422. height: 75vh !important;
  423. }
  424. .u-calendar-month__days__day {
  425. height: 130rpx !important;
  426. }
  427. .u-square {
  428. background-color: #fff !important;
  429. }
  430. .u-input__content {
  431. margin-top: 22rpx !important;
  432. }
  433. .uicon-arrow-right,
  434. .uicon-close-circle-fill {
  435. margin-top: 32rpx !important;
  436. margin-right: 20rpx !important;
  437. }
  438. .pop-pop {
  439. height: 65vh;
  440. .hander-one {
  441. padding: 46rpx 20rpx 0;
  442. display: flex;
  443. justify-content: space-between;
  444. .text {
  445. font-size: 36rpx;
  446. color: #333333;
  447. font-weight: bold;
  448. }
  449. .del {}
  450. }
  451. .hander-two {
  452. padding: 0 20rpx;
  453. display: flex;
  454. align-items: center;
  455. margin: 30rpx 0;
  456. .hander-two-text {
  457. font-size: 30rpx;
  458. color: #333333;
  459. font-weight: Regular;
  460. margin-right: 30rpx;
  461. }
  462. .hander-two-image {
  463. display: flex;
  464. align-items: center;
  465. .image {
  466. margin: 0 10rpx;
  467. width: 30rpx;
  468. height: 30rpx;
  469. image {
  470. width: 100%;
  471. height: 100%;
  472. }
  473. }
  474. }
  475. }
  476. .hander-three {
  477. padding: 0 20rpx;
  478. margin: 0 20rpx;
  479. display: flex;
  480. border: 1rpx solid #CCCCCC;
  481. border-radius: 16rpx;
  482. justify-content: space-between;
  483. height: 102rpx;
  484. line-height: 102rpx;
  485. .hander-three-text {
  486. width: 200rpx;
  487. text-align: left;
  488. display: flex;
  489. justify-content: space-between;
  490. margin: 0 20rpx;
  491. }
  492. .hander-three-input {
  493. width: 55%;
  494. }
  495. .hander-three-icon {
  496. height: 102rpx;
  497. line-height: 102rpx;
  498. }
  499. }
  500. .hander-four {
  501. padding: 0 20rpx;
  502. margin: 30rpx 20rpx 0;
  503. // margin-top: 30rpx;
  504. display: flex;
  505. border-radius: 16rpx;
  506. justify-content: space-between;
  507. border: 1rpx solid #CCCCCC;
  508. height: 102rpx;
  509. line-height: 102rpx;
  510. .hander-three-text {
  511. width: 200rpx;
  512. text-align: center;
  513. display: flex;
  514. justify-content: space-between;
  515. margin: 0 20rpx;
  516. }
  517. .hander-three-input {
  518. width: 55%;
  519. }
  520. .hander-three-icon {
  521. height: 102rpx;
  522. line-height: 102rpx;
  523. }
  524. }
  525. }
  526. .page {
  527. background: #F3F4F4;
  528. padding-bottom: 260rpx;
  529. box-sizing: border-box;
  530. overflow-y: auto;
  531. overflow-x: auto;
  532. }
  533. .typeNum {
  534. // width: 100%;
  535. height: 73rpx;
  536. display: flex;
  537. justify-content: space-between;
  538. padding: 23rpx 24rpx;
  539. align-items: center;
  540. // .left {}
  541. .right {
  542. display: flex;
  543. align-items: center;
  544. .image {
  545. margin: 0 10rpx;
  546. width: 30rpx;
  547. height: 30rpx;
  548. image {
  549. width: 100%;
  550. height: 100%;
  551. }
  552. }
  553. .text {
  554. font-size: 28rpx;
  555. font-weight: Regular;
  556. color: #333333;
  557. }
  558. }
  559. }
  560. .type {
  561. margin: 0 auto;
  562. border-radius: 10rpx 10rpx 10rpx 10rpx;
  563. width: 86%;
  564. // height: 114rpx;
  565. background-color: #fff;
  566. padding: 30rpx;
  567. margin-bottom: 20rpx;
  568. display: flex;
  569. .left {
  570. height: 114rpx;
  571. line-height: 114rpx;
  572. margin-right: 20rpx;
  573. .image {
  574. margin: 0 10rpx;
  575. width: 40rpx;
  576. height: 40rpx;
  577. image {
  578. width: 100%;
  579. height: 100%;
  580. }
  581. }
  582. }
  583. .right {
  584. width: 100%;
  585. }
  586. }
  587. .top {
  588. display: flex;
  589. justify-content: space-between;
  590. }
  591. .under {
  592. margin-top: 40rpx;
  593. display: flex;
  594. justify-content: space-between;
  595. }
  596. .btn-btn {
  597. width: 100%;
  598. height: 136rpx;
  599. background-color: #fff;
  600. position: fixed;
  601. bottom: 0;
  602. padding: 30rpx 0 0;
  603. // margin: 0 auto;
  604. z-index: 9;
  605. // margin-top: 30rpx;
  606. // margin-left: 30rpx;
  607. .bottom-btn {
  608. display: flex;
  609. justify-content: space-between;
  610. margin: 0 24rpx;
  611. .left {
  612. width: 25%;
  613. display: flex;
  614. align-items: center;
  615. .image {
  616. width: 40rpx;
  617. height: 40rpx;
  618. margin: 0 10rpx;
  619. image {
  620. width: 100%;
  621. height: 100%;
  622. }
  623. }
  624. }
  625. .right {
  626. width: 75%;
  627. display: flex;
  628. justify-content: space-evenly;
  629. .right-btn {
  630. margin: 0 20rpx;
  631. // width: 148rpx;
  632. width: 100%;
  633. height: 80rpx;
  634. line-height: 80rpx;
  635. background-color: #1372FF;
  636. border-radius: 16rpx;
  637. font-size: 26rpx;
  638. color: #fff;
  639. font-weight: Regular;
  640. text-align: center;
  641. }
  642. }
  643. }
  644. }
  645. .btn {
  646. margin: 0 auto;
  647. width: 690rpx;
  648. height: 96rpx;
  649. background-color: #1372FF;
  650. color: #fff;
  651. display: flex;
  652. justify-content: center;
  653. align-items: center;
  654. font-size: 34rpx;
  655. border-radius: 48rpx;
  656. }
  657. </style>