roomType.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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 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/20240228/c741a340e19642c59473e6f4a6d2f4be.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/20240228/c741a340e19642c59473e6f4a6d2f4be.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="piliangxiajia()">
  57. 批量下架
  58. </view> -->
  59. <view class="right-btn" @click="Pricing()">
  60. 批量定价
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 新增按钮 -->
  66. <view class="btn-btn" @click="addType(id)" v-else>
  67. <view class="btn">
  68. 新增
  69. </view>
  70. </view>
  71. <u-popup :show="showPricing" @close="close" @open="open">
  72. <view class="pop-pop">
  73. <view class="hander-one">
  74. <view class="">
  75. </view>
  76. <view class="text">
  77. 批量定价
  78. </view>
  79. <view class="del" @click="close">
  80. <u-icon name="close" color=""></u-icon>
  81. </view>
  82. </view>
  83. <view class="hander-two">
  84. <view class="hander-two-text">
  85. 每天价格
  86. </view>
  87. <u-radio-group @change="selectType" size="32" iconSize="24" placement="row" activeColor='#1372FF'>
  88. <u-radio labelSize='30' label="固定设置" :name='1'></u-radio>
  89. <u-radio labelSize='30' label="按天设置" :name='2' v-if="tabIndex==0"></u-radio>
  90. </u-radio-group>
  91. </view>
  92. <view class="hander-three">
  93. <view class="hander-three-text">
  94. 起始日期
  95. </view>
  96. <view class="hander-three-input" @click="show=true">
  97. <u--input placeholder="请选择" border="none" disabledColor='#fff' fontSize='26' v-model="valueTime"
  98. disabled='false'></u--input>
  99. </view>
  100. <view class="hander-three-icon">
  101. <u-icon name="arrow-right"></u-icon>
  102. </view>
  103. </view>
  104. <view class="hander-four" v-if="typeIndex==1">
  105. <view class="hander-three-text" style="">
  106. <view class="">
  107. 价格
  108. </view>
  109. <view class="">
  110. </view>
  111. </view>
  112. <view class="hander-three-input">
  113. <u--input placeholder="请输入价格" fontSize='26' border="none" v-model="fromData.price"
  114. @change="change"></u--input>
  115. </view>
  116. <view class="hander-three-icon">
  117. <u-icon name="close-circle-fill"></u-icon>
  118. </view>
  119. </view>
  120. <view class="" v-else>
  121. <view class="hander-four">
  122. <view class="hander-three-text" style="">
  123. <view class="">
  124. 周五-周六
  125. </view>
  126. <view class="">
  127. </view>
  128. </view>
  129. <view class="hander-three-input">
  130. <u--input placeholder="请输入价格" fontSize='26' border="none"
  131. v-model="fromData.friToSatdayPrice" @change="change"></u--input>
  132. </view>
  133. <view class="hander-three-icon">
  134. <u-icon name="close-circle-fill"></u-icon>
  135. </view>
  136. </view>
  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.sunToThursdayPrice" @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>
  154. <view class="btn-btn" @click='addTime()'>
  155. <view class="btn">
  156. 确定
  157. </view>
  158. </view>
  159. </view>
  160. </u-popup>
  161. <!-- <u-calendar :show="show" :mode="mode" @confirm="confirm"></u-calendar> -->
  162. <!-- 选择入驻时间 -->
  163. <u-calendar class="u-time" confirmDisabledText="确定" :show="show" :mode="mode" @confirm="confirm"
  164. @close="closeDate" :closeOnClickOverlay="true" color="#007A69"></u-calendar>
  165. </view>
  166. </template>
  167. <script>
  168. export default {
  169. data() {
  170. return {
  171. homestayId: uni.getStorageSync('homestayId') || 0,
  172. roomType: [],
  173. isSelect: false,
  174. Selected: false,
  175. showPricing: false,
  176. show: false,
  177. selectedTags: [],
  178. ids: [],
  179. from: {},
  180. tabIndex: 0,
  181. typeIndex: 1,
  182. mode: 'range',
  183. valueTime: '',
  184. fromData: {
  185. homestayId: uni.getStorageSync('homestayId'),
  186. houseBaseIdList: [],
  187. friToSatdayPrice: '',
  188. sunToThursdayPrice: '',
  189. price: '',
  190. rentDateEnd: '',
  191. rentDateStart: '',
  192. }
  193. }
  194. },
  195. onLoad() {
  196. // console.log(this.homestayId)
  197. this.getHomestayId()
  198. },
  199. methods: {
  200. addTime() {
  201. this.$api.post('/merchant/hotel/room/state/batchDefineRoomPrice', this.fromData).then(res => {
  202. console.log(res.data);
  203. if (res.data.code == 0) {
  204. this.$showToast('定价成功')
  205. setTimeout(() => {
  206. this.showPricing = false
  207. this.fromData = {}
  208. this.getHomestayId()
  209. }, 1000)
  210. } else this.$showToast(res.data.msg)
  211. })
  212. },
  213. confirm(e) {
  214. console.log(e);
  215. this.show = false
  216. this.valueTime = e[0] + '~' + e[e.length - 1]
  217. console.log(this.valueTime);
  218. this.fromData.rentDateStart = e[0]
  219. this.fromData.rentDateEnd = e[e.length - 1]
  220. },
  221. closeDate() {
  222. this.show = false
  223. },
  224. selectType(type) {
  225. console.log(type);
  226. this.typeIndex = type;
  227. // this.fromData.comboType = type
  228. },
  229. piliangxiajia() {
  230. this.$api.post('/merchant/hotel/repast/batchPutAway', this.from).then(res => {
  231. this.selectedTags = [];
  232. this.Selected = false;
  233. this.getHomestayId(); //获取商品列表
  234. })
  235. },
  236. selectPerson(e, i) {
  237. console.log(e, i);
  238. if (this.selectedTags.includes(e)) {
  239. this.selectedTags = this.selectedTags.filter(t => t !== e);
  240. this.ids.splice(i, 1)
  241. console.log('1111');
  242. } else {
  243. console.log('2222');
  244. this.selectedTags.push(e);
  245. this.fromData.houseBaseIdList.push(e.houseBaseId)
  246. // this.from = {
  247. // idList: this.ids,
  248. // status: e.status == 1 ? 0 : 1
  249. // }
  250. }
  251. },
  252. close() {
  253. this.showPricing = false
  254. },
  255. open() {},
  256. Pricing() {
  257. console.log('11111111');
  258. this.showPricing = true
  259. },
  260. // 批量显示
  261. showList() {
  262. this.Selected = !this.Selected
  263. },
  264. // 获取房型列表信息
  265. getHomestayId() {
  266. this.$api.get(`/merchant/hotel/mine/getHouseBaseList/${this.homestayId}`, {
  267. homestayId: this.homestayId
  268. }).then((res) => {
  269. // console.log(res)
  270. this.roomType = res.data.data
  271. // let roomSymbleName=this.roomType.name
  272. // console.log(roomSymbleName)
  273. // console.log(this.roomType)
  274. })
  275. },
  276. // 新增房型
  277. addType(id) {
  278. uni.navigateTo({
  279. url: `/pages/my/houseList?id=${this.homestayId}`
  280. })
  281. },
  282. // 修改房型信息
  283. goEditTypeInfo(houseBaseId) {
  284. uni.navigateTo({
  285. url: `/pages/my/houseList?houseBaseId=${houseBaseId}`
  286. })
  287. console.log(houseBaseId)
  288. }
  289. }
  290. }
  291. </script>
  292. <style lang="scss">
  293. .u-reset-button,
  294. .u-button--active {
  295. width: 100% !important;
  296. }
  297. .data-v-b73440ae {
  298. height: 500rpx !important;
  299. }
  300. .u-slide-up-enter-active {
  301. height: 75vh !important;
  302. }
  303. .u-time {
  304. height: 75vh !important;
  305. }
  306. .u-calendar-month__days__day {
  307. height: 130rpx !important;
  308. }
  309. .u-square {
  310. background-color: #fff !important;
  311. }
  312. .u-input__content {
  313. margin-top: 22rpx !important;
  314. }
  315. .uicon-arrow-right,
  316. .uicon-close-circle-fill {
  317. margin-top: 32rpx !important;
  318. margin-right: 20rpx !important;
  319. }
  320. .pop-pop {
  321. height: 65vh;
  322. padding: 46rpx 20rpx 0;
  323. .hander-one {
  324. display: flex;
  325. justify-content: space-between;
  326. .text {
  327. font-size: 36rpx;
  328. color: #333333;
  329. font-weight: bold;
  330. }
  331. .del {}
  332. }
  333. .hander-two {
  334. display: flex;
  335. align-items: center;
  336. margin: 30rpx 0;
  337. .hander-two-text {
  338. font-size: 30rpx;
  339. color: #333333;
  340. font-weight: Regular;
  341. margin-right: 30rpx;
  342. }
  343. .hander-two-image {
  344. display: flex;
  345. align-items: center;
  346. .image {
  347. margin: 0 10rpx;
  348. width: 30rpx;
  349. height: 30rpx;
  350. image {
  351. width: 100%;
  352. height: 100%;
  353. }
  354. }
  355. }
  356. }
  357. .hander-three {
  358. display: flex;
  359. border: 1rpx solid #CCCCCC;
  360. border-radius: 16rpx;
  361. justify-content: space-between;
  362. height: 102rpx;
  363. line-height: 102rpx;
  364. .hander-three-text {
  365. width: 200rpx;
  366. text-align: left;
  367. display: flex;
  368. justify-content: space-between;
  369. margin: 0 20rpx;
  370. }
  371. .hander-three-input {
  372. width: 55%;
  373. }
  374. .hander-three-icon {
  375. height: 102rpx;
  376. line-height: 102rpx;
  377. }
  378. }
  379. .hander-four {
  380. margin-top: 30rpx;
  381. display: flex;
  382. border-radius: 16rpx;
  383. justify-content: space-between;
  384. border: 1rpx solid #CCCCCC;
  385. height: 102rpx;
  386. line-height: 102rpx;
  387. .hander-three-text {
  388. width: 200rpx;
  389. text-align: center;
  390. display: flex;
  391. justify-content: space-between;
  392. margin: 0 20rpx;
  393. }
  394. .hander-three-input {
  395. width: 55%;
  396. }
  397. .hander-three-icon {
  398. height: 102rpx;
  399. line-height: 102rpx;
  400. }
  401. }
  402. }
  403. .page {
  404. background: #F3F4F4;
  405. padding-bottom: 260rpx;
  406. box-sizing: border-box;
  407. overflow-y: auto;
  408. overflow-x: auto;
  409. }
  410. .typeNum {
  411. // width: 100%;
  412. height: 73rpx;
  413. display: flex;
  414. justify-content: space-between;
  415. padding: 23rpx 24rpx;
  416. align-items: center;
  417. // .left {}
  418. .right {
  419. display: flex;
  420. align-items: center;
  421. .image {
  422. margin: 0 10rpx;
  423. width: 30rpx;
  424. height: 30rpx;
  425. image {
  426. width: 100%;
  427. height: 100%;
  428. }
  429. }
  430. .text {
  431. font-size: 28rpx;
  432. font-weight: Regular;
  433. color: #333333;
  434. }
  435. }
  436. }
  437. .type {
  438. margin: 0 auto;
  439. border-radius: 10rpx 10rpx 10rpx 10rpx;
  440. width: 86%;
  441. // height: 114rpx;
  442. background-color: #fff;
  443. padding: 30rpx;
  444. margin-bottom: 20rpx;
  445. display: flex;
  446. .left {
  447. height: 114rpx;
  448. line-height: 114rpx;
  449. margin-right: 20rpx;
  450. .image {
  451. margin: 0 10rpx;
  452. width: 30rpx;
  453. height: 30rpx;
  454. image {
  455. width: 100%;
  456. height: 100%;
  457. }
  458. }
  459. }
  460. .right {
  461. width: 100%;
  462. }
  463. }
  464. .top {
  465. display: flex;
  466. justify-content: space-between;
  467. }
  468. .under {
  469. margin-top: 40rpx;
  470. display: flex;
  471. justify-content: space-between;
  472. }
  473. .btn-btn {
  474. width: 100%;
  475. height: 136rpx;
  476. background-color: #fff;
  477. position: fixed;
  478. bottom: 0;
  479. padding: 30rpx 0 0;
  480. // margin: 0 auto;
  481. z-index: 9;
  482. // margin-top: 30rpx;
  483. // margin-left: 30rpx;
  484. .bottom-btn {
  485. display: flex;
  486. justify-content: space-between;
  487. margin: 0 24rpx;
  488. .left {
  489. width: 25%;
  490. display: flex;
  491. align-items: center;
  492. .image {
  493. width: 38rpx;
  494. height: 38rpx;
  495. margin: 0 10rpx;
  496. image {
  497. width: 100%;
  498. height: 100%;
  499. }
  500. }
  501. }
  502. .right {
  503. width: 75%;
  504. display: flex;
  505. justify-content: space-evenly;
  506. .right-btn {
  507. // width: 148rpx;
  508. width: 100%;
  509. height: 80rpx;
  510. line-height: 80rpx;
  511. background-color: #1372FF;
  512. border-radius: 16rpx;
  513. font-size: 26rpx;
  514. color: #fff;
  515. font-weight: Regular;
  516. text-align: center;
  517. }
  518. }
  519. }
  520. }
  521. .btn {
  522. margin: 0 auto;
  523. width: 690rpx;
  524. height: 96rpx;
  525. background-color: #1372FF;
  526. color: #fff;
  527. display: flex;
  528. justify-content: center;
  529. align-items: center;
  530. font-size: 34rpx;
  531. border-radius: 48rpx;
  532. }
  533. </style>